From 3ad3455551be0d7859ecb02290376206d5e66498 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sun, 22 Apr 2012 09:20:32 +1000 Subject: And actually include new files, plus elementary libraries. --- libraries/elementary/src/Makefile.am | 10 + libraries/elementary/src/Makefile.in | 667 +++ libraries/elementary/src/bin/Makefile.am | 200 + libraries/elementary/src/bin/Makefile.in | 3503 +++++++++++ libraries/elementary/src/bin/config.c | 3133 ++++++++++ libraries/elementary/src/bin/quicklaunch.c | 298 + libraries/elementary/src/bin/run.c | 160 + libraries/elementary/src/bin/test.c | 766 +++ libraries/elementary/src/bin/test.h | 19 + libraries/elementary/src/bin/test_3d.c | 341 ++ libraries/elementary/src/bin/test_actionslider.c | 195 + libraries/elementary/src/bin/test_anim.c | 113 + libraries/elementary/src/bin/test_bg.c | 270 + libraries/elementary/src/bin/test_box.c | 706 +++ libraries/elementary/src/bin/test_bubble.c | 176 + libraries/elementary/src/bin/test_button.c | 169 + libraries/elementary/src/bin/test_calendar.c | 337 ++ libraries/elementary/src/bin/test_check.c | 193 + libraries/elementary/src/bin/test_clock.c | 309 + libraries/elementary/src/bin/test_cnp.c | 105 + libraries/elementary/src/bin/test_colorselector.c | 180 + libraries/elementary/src/bin/test_conform.c | 199 + libraries/elementary/src/bin/test_ctxpopup.c | 321 + libraries/elementary/src/bin/test_cursor.c | 450 ++ libraries/elementary/src/bin/test_datetime.c | 75 + libraries/elementary/src/bin/test_dayselector.c | 90 + libraries/elementary/src/bin/test_diskselector.c | 353 ++ libraries/elementary/src/bin/test_eio.c | 182 + libraries/elementary/src/bin/test_entry.c | 2191 +++++++ libraries/elementary/src/bin/test_entry_anchor.c | 237 + libraries/elementary/src/bin/test_entry_anchor2.c | 102 + libraries/elementary/src/bin/test_factory.c | 183 + libraries/elementary/src/bin/test_fileselector.c | 218 + .../elementary/src/bin/test_fileselector_button.c | 247 + .../elementary/src/bin/test_fileselector_entry.c | 257 + libraries/elementary/src/bin/test_flip.c | 610 ++ libraries/elementary/src/bin/test_flip_page.c | 913 +++ libraries/elementary/src/bin/test_flipselector.c | 178 + libraries/elementary/src/bin/test_floating.c | 103 + libraries/elementary/src/bin/test_focus.c | 367 ++ libraries/elementary/src/bin/test_focus2.c | 149 + libraries/elementary/src/bin/test_focus3.c | 299 + libraries/elementary/src/bin/test_gengrid.c | 842 +++ libraries/elementary/src/bin/test_genlist.c | 2814 +++++++++ libraries/elementary/src/bin/test_gesture_layer.c | 406 ++ libraries/elementary/src/bin/test_gesture_layer2.c | 778 +++ libraries/elementary/src/bin/test_gesture_layer3.c | 589 ++ libraries/elementary/src/bin/test_glview.c | 623 ++ libraries/elementary/src/bin/test_glview_simple.c | 286 + libraries/elementary/src/bin/test_grid.c | 190 + libraries/elementary/src/bin/test_hover.c | 181 + libraries/elementary/src/bin/test_hoversel.c | 209 + libraries/elementary/src/bin/test_icon.c | 159 + libraries/elementary/src/bin/test_icon_animated.c | 49 + libraries/elementary/src/bin/test_icon_desktops.c | 100 + libraries/elementary/src/bin/test_index.c | 385 ++ libraries/elementary/src/bin/test_inwin.c | 129 + libraries/elementary/src/bin/test_label.c | 218 + libraries/elementary/src/bin/test_launcher.c | 922 +++ libraries/elementary/src/bin/test_layout.c | 257 + libraries/elementary/src/bin/test_list.c | 1178 ++++ libraries/elementary/src/bin/test_map.c | 1117 ++++ libraries/elementary/src/bin/test_menu.c | 127 + libraries/elementary/src/bin/test_multi.c | 135 + .../elementary/src/bin/test_multibuttonentry.c | 226 + libraries/elementary/src/bin/test_naviframe.c | 256 + .../elementary/src/bin/test_naviframe_complex.c | 366 ++ libraries/elementary/src/bin/test_notify.c | 300 + libraries/elementary/src/bin/test_panel.c | 267 + libraries/elementary/src/bin/test_panes.c | 118 + libraries/elementary/src/bin/test_photo.c | 108 + libraries/elementary/src/bin/test_photocam.c | 373 ++ libraries/elementary/src/bin/test_popup.c | 351 ++ libraries/elementary/src/bin/test_progressbar.c | 199 + libraries/elementary/src/bin/test_radio.c | 96 + libraries/elementary/src/bin/test_scaling.c | 120 + libraries/elementary/src/bin/test_scroller.c | 253 + .../elementary/src/bin/test_segment_control.c | 99 + libraries/elementary/src/bin/test_separator.c | 68 + libraries/elementary/src/bin/test_slider.c | 193 + libraries/elementary/src/bin/test_slideshow.c | 218 + libraries/elementary/src/bin/test_spinner.c | 87 + libraries/elementary/src/bin/test_store.c | 271 + libraries/elementary/src/bin/test_table.c | 392 ++ libraries/elementary/src/bin/test_thumb.c | 66 + libraries/elementary/src/bin/test_toolbar.c | 905 +++ libraries/elementary/src/bin/test_tooltip.c | 605 ++ libraries/elementary/src/bin/test_transit.c | 558 ++ libraries/elementary/src/bin/test_video.c | 91 + libraries/elementary/src/bin/test_weather.c | 170 + libraries/elementary/src/bin/test_web.c | 501 ++ libraries/elementary/src/bin/test_win_inline.c | 246 + libraries/elementary/src/bin/test_win_plug.c | 108 + libraries/elementary/src/bin/test_win_socket.c | 205 + libraries/elementary/src/bin/test_win_state.c | 369 ++ .../elementary/src/edje_externals/Makefile.am | 69 + .../elementary/src/edje_externals/Makefile.in | 739 +++ libraries/elementary/src/edje_externals/elm.c | 319 + .../src/edje_externals/elm_actionslider.c | 99 + .../elementary/src/edje_externals/elm_bubble.c | 168 + .../elementary/src/edje_externals/elm_button.c | 200 + .../elementary/src/edje_externals/elm_calendar.c | 200 + .../elementary/src/edje_externals/elm_check.c | 148 + .../elementary/src/edje_externals/elm_clock.c | 241 + .../elementary/src/edje_externals/elm_entry.c | 376 ++ .../src/edje_externals/elm_fileselector.c | 185 + .../src/edje_externals/elm_fileselector_button.c | 251 + .../src/edje_externals/elm_fileselector_entry.c | 252 + .../elementary/src/edje_externals/elm_frame.c | 125 + .../elementary/src/edje_externals/elm_gengrid.c | 468 ++ .../elementary/src/edje_externals/elm_genlist.c | 332 ++ .../elementary/src/edje_externals/elm_hoversel.c | 148 + libraries/elementary/src/edje_externals/elm_icon.c | 322 + .../elementary/src/edje_externals/elm_index.c | 104 + .../elementary/src/edje_externals/elm_label.c | 100 + libraries/elementary/src/edje_externals/elm_list.c | 317 + libraries/elementary/src/edje_externals/elm_map.c | 185 + .../src/edje_externals/elm_multibuttonentry.c | 125 + .../elementary/src/edje_externals/elm_naviframe.c | 133 + .../elementary/src/edje_externals/elm_notify.c | 199 + .../elementary/src/edje_externals/elm_panes.c | 198 + .../elementary/src/edje_externals/elm_photocam.c | 208 + .../src/edje_externals/elm_progressbar.c | 251 + .../elementary/src/edje_externals/elm_radio.c | 176 + .../elementary/src/edje_externals/elm_scroller.c | 104 + .../src/edje_externals/elm_segment_control.c | 75 + .../elementary/src/edje_externals/elm_slider.c | 339 ++ .../elementary/src/edje_externals/elm_slideshow.c | 182 + .../elementary/src/edje_externals/elm_spinner.c | 244 + .../elementary/src/edje_externals/elm_thumb.c | 146 + .../elementary/src/edje_externals/elm_toolbar.c | 311 + .../elementary/src/edje_externals/elm_video.c | 261 + libraries/elementary/src/edje_externals/elm_web.c | 208 + .../elementary/src/edje_externals/modules.inc | 35 + libraries/elementary/src/edje_externals/private.h | 135 + libraries/elementary/src/examples/Makefile.am | 361 ++ libraries/elementary/src/examples/Makefile.in | 1909 ++++++ .../src/examples/actionslider_example_01.c | 148 + libraries/elementary/src/examples/bg_example_01.c | 50 + libraries/elementary/src/examples/bg_example_02.c | 45 + libraries/elementary/src/examples/bg_example_03.c | 172 + libraries/elementary/src/examples/box_example_02.c | 169 + .../elementary/src/examples/bubble_example_01.c | 68 + .../elementary/src/examples/button_example_00.c | 49 + .../elementary/src/examples/button_example_01.c | 265 + .../elementary/src/examples/calendar_example_01.c | 41 + .../elementary/src/examples/calendar_example_02.c | 59 + .../elementary/src/examples/calendar_example_03.c | 43 + .../elementary/src/examples/calendar_example_04.c | 62 + .../elementary/src/examples/calendar_example_05.c | 69 + .../elementary/src/examples/calendar_example_06.c | 96 + .../elementary/src/examples/check_example_01.c | 59 + libraries/elementary/src/examples/clock_example.c | 85 + .../src/examples/colorselector_example_01.c | 95 + .../src/examples/conformant_example_01.c | 76 + .../src/examples/conformant_example_02.c | 82 + .../elementary/src/examples/ctxpopup_example_01.c | 106 + .../elementary/src/examples/datetime_example.c | 69 + .../elementary/src/examples/dayselector_example.c | 92 + .../src/examples/diskselector_example_01.c | 104 + .../src/examples/diskselector_example_02.c | 349 ++ libraries/elementary/src/examples/efl_thread_1.c | 79 + libraries/elementary/src/examples/efl_thread_2.c | 95 + libraries/elementary/src/examples/efl_thread_3.c | 97 + libraries/elementary/src/examples/efl_thread_4.c | 120 + libraries/elementary/src/examples/efl_thread_5.c | 104 + libraries/elementary/src/examples/efl_thread_6.c | 165 + .../elementary/src/examples/efl_thread_win32_1.c | 84 + .../elementary/src/examples/efl_thread_win32_2.c | 100 + .../elementary/src/examples/efl_thread_win32_3.c | 102 + .../elementary/src/examples/efl_thread_win32_4.c | 126 + libraries/elementary/src/examples/entry_example.c | 580 ++ .../src/examples/fileselector_button_example.c | 181 + .../src/examples/fileselector_entry_example.c | 170 + .../elementary/src/examples/fileselector_example.c | 240 + .../elementary/src/examples/flip_example_01.c | 91 + .../elementary/src/examples/flipselector_example.c | 206 + .../elementary/src/examples/frame_example_01.c | 77 + .../src/examples/general_funcs_example.c | 188 + .../elementary/src/examples/gengrid_example.c | 630 ++ .../elementary/src/examples/genlist_example_01.c | 89 + .../elementary/src/examples/genlist_example_02.c | 203 + .../elementary/src/examples/genlist_example_03.c | 131 + .../elementary/src/examples/genlist_example_04.c | 364 ++ .../elementary/src/examples/genlist_example_05.c | 425 ++ .../elementary/src/examples/hover_example_01.c | 80 + .../elementary/src/examples/hoversel_example_01.c | 103 + .../elementary/src/examples/icon_example_01.c | 53 + .../elementary/src/examples/image_example_01.c | 55 + .../elementary/src/examples/index_example_01.c | 209 + .../elementary/src/examples/index_example_02.c | 152 + libraries/elementary/src/examples/inwin_example.c | 152 + .../elementary/src/examples/label_example_01.c | 80 + .../elementary/src/examples/layout_example_01.c | 150 + .../elementary/src/examples/layout_example_02.c | 83 + .../elementary/src/examples/layout_example_03.c | 94 + .../elementary/src/examples/list_example_01.c | 71 + .../elementary/src/examples/list_example_02.c | 85 + .../elementary/src/examples/list_example_03.c | 441 ++ libraries/elementary/src/examples/map_example_01.c | 121 + libraries/elementary/src/examples/map_example_02.c | 277 + libraries/elementary/src/examples/map_example_03.c | 208 + libraries/elementary/src/examples/mapbuf_example.c | 126 + .../elementary/src/examples/menu_example_01.c | 73 + .../elementary/src/examples/notify_example_01.c | 79 + .../elementary/src/examples/panel_example_01.c | 75 + libraries/elementary/src/examples/panes_example.c | 122 + .../elementary/src/examples/photocam_example_01.c | 96 + .../elementary/src/examples/popup_example_01.c | 60 + .../elementary/src/examples/popup_example_02.c | 83 + .../elementary/src/examples/popup_example_03.c | 99 + .../elementary/src/examples/progressbar_example.c | 239 + .../elementary/src/examples/radio_example_01.c | 90 + .../elementary/src/examples/scroller_example_01.c | 142 + .../src/examples/segment_control_example.c | 83 + .../elementary/src/examples/separator_example_01.c | 55 + libraries/elementary/src/examples/slider_example.c | 149 + .../elementary/src/examples/slideshow_example.c | 323 + .../elementary/src/examples/spinner_example.c | 132 + .../elementary/src/examples/table_example_01.c | 53 + .../elementary/src/examples/table_example_02.c | 56 + .../elementary/src/examples/theme_example_01.c | 79 + .../elementary/src/examples/theme_example_02.c | 70 + .../elementary/src/examples/thumb_example_01.c | 83 + .../elementary/src/examples/toolbar_example_01.c | 97 + .../elementary/src/examples/toolbar_example_02.c | 88 + .../elementary/src/examples/toolbar_example_03.c | 81 + .../elementary/src/examples/transit_example_01.c | 52 + .../elementary/src/examples/transit_example_02.c | 85 + .../elementary/src/examples/transit_example_03.c | 332 ++ .../elementary/src/examples/transit_example_04.c | 173 + libraries/elementary/src/examples/web_example.c | 623 ++ libraries/elementary/src/examples/win_example.c | 327 + libraries/elementary/src/lib/Elementary.h | 258 + libraries/elementary/src/lib/Elementary.h.in | 258 + libraries/elementary/src/lib/Elementary_Cursor.h | 87 + libraries/elementary/src/lib/Makefile.am | 253 + libraries/elementary/src/lib/Makefile.in | 1731 ++++++ libraries/elementary/src/lib/elc_ctxpopup.c | 1433 +++++ libraries/elementary/src/lib/elc_ctxpopup.h | 211 + libraries/elementary/src/lib/elc_dayselector.c | 669 +++ libraries/elementary/src/lib/elc_dayselector.h | 207 + libraries/elementary/src/lib/elc_fileselector.c | 1249 ++++ libraries/elementary/src/lib/elc_fileselector.h | 313 + .../elementary/src/lib/elc_fileselector_button.c | 520 ++ .../elementary/src/lib/elc_fileselector_button.h | 306 + .../elementary/src/lib/elc_fileselector_entry.c | 508 ++ .../elementary/src/lib/elc_fileselector_entry.h | 349 ++ libraries/elementary/src/lib/elc_hoversel.c | 507 ++ libraries/elementary/src/lib/elc_hoversel.h | 224 + .../elementary/src/lib/elc_multibuttonentry.c | 1742 ++++++ .../elementary/src/lib/elc_multibuttonentry.h | 318 + libraries/elementary/src/lib/elc_naviframe.c | 1530 +++++ libraries/elementary/src/lib/elc_naviframe.h | 406 ++ libraries/elementary/src/lib/elc_player.c | 590 ++ libraries/elementary/src/lib/elc_popup.c | 1454 +++++ libraries/elementary/src/lib/elc_popup.h | 269 + libraries/elementary/src/lib/elc_scrolled_entry.c | 193 + libraries/elementary/src/lib/elm_access.c | 536 ++ libraries/elementary/src/lib/elm_actionslider.c | 505 ++ libraries/elementary/src/lib/elm_actionslider.h | 139 + libraries/elementary/src/lib/elm_app.h | 193 + libraries/elementary/src/lib/elm_authors.h | 61 + libraries/elementary/src/lib/elm_bg.c | 324 + libraries/elementary/src/lib/elm_bg.h | 199 + libraries/elementary/src/lib/elm_box.c | 683 +++ libraries/elementary/src/lib/elm_box.h | 498 ++ libraries/elementary/src/lib/elm_bubble.c | 368 ++ libraries/elementary/src/lib/elm_bubble.h | 111 + libraries/elementary/src/lib/elm_button.c | 534 ++ libraries/elementary/src/lib/elm_button.h | 159 + libraries/elementary/src/lib/elm_cache.h | 31 + libraries/elementary/src/lib/elm_calendar.c | 1029 ++++ libraries/elementary/src/lib/elm_calendar.h | 510 ++ libraries/elementary/src/lib/elm_check.c | 518 ++ libraries/elementary/src/lib/elm_check.h | 105 + libraries/elementary/src/lib/elm_clock.c | 681 +++ libraries/elementary/src/lib/elm_clock.h | 308 + libraries/elementary/src/lib/elm_cnp.c | 1635 +++++ libraries/elementary/src/lib/elm_cnp.h | 163 + libraries/elementary/src/lib/elm_colorselector.c | 1279 ++++ libraries/elementary/src/lib/elm_colorselector.h | 192 + libraries/elementary/src/lib/elm_config.c | 2215 +++++++ libraries/elementary/src/lib/elm_config.h | 948 +++ libraries/elementary/src/lib/elm_conform.c | 692 +++ libraries/elementary/src/lib/elm_conform.h | 49 + libraries/elementary/src/lib/elm_cursor.h | 122 + libraries/elementary/src/lib/elm_datetime.c | 1075 ++++ libraries/elementary/src/lib/elm_datetime.h | 592 ++ libraries/elementary/src/lib/elm_debug.h | 28 + libraries/elementary/src/lib/elm_deprecated.h | 423 ++ libraries/elementary/src/lib/elm_diskselector.c | 1401 +++++ libraries/elementary/src/lib/elm_diskselector.h | 440 ++ libraries/elementary/src/lib/elm_entry.c | 3934 ++++++++++++ libraries/elementary/src/lib/elm_entry.h | 1730 ++++++ libraries/elementary/src/lib/elm_factory.c | 338 ++ libraries/elementary/src/lib/elm_factory.h | 6 + libraries/elementary/src/lib/elm_finger.h | 45 + libraries/elementary/src/lib/elm_flip.c | 1941 ++++++ libraries/elementary/src/lib/elm_flip.h | 257 + libraries/elementary/src/lib/elm_flipselector.c | 936 +++ libraries/elementary/src/lib/elm_flipselector.h | 310 + libraries/elementary/src/lib/elm_focus.h | 214 + libraries/elementary/src/lib/elm_font.c | 221 + libraries/elementary/src/lib/elm_font.h | 99 + libraries/elementary/src/lib/elm_frame.c | 325 + libraries/elementary/src/lib/elm_frame.h | 114 + libraries/elementary/src/lib/elm_gen.h | 63 + libraries/elementary/src/lib/elm_gen_common.h | 204 + libraries/elementary/src/lib/elm_general.h | 365 ++ libraries/elementary/src/lib/elm_gengrid.c | 2869 +++++++++ libraries/elementary/src/lib/elm_gengrid.h | 1615 +++++ libraries/elementary/src/lib/elm_genlist.c | 6231 ++++++++++++++++++++ libraries/elementary/src/lib/elm_genlist.h | 1874 ++++++ libraries/elementary/src/lib/elm_gesture_layer.c | 3520 +++++++++++ libraries/elementary/src/lib/elm_gesture_layer.h | 336 ++ libraries/elementary/src/lib/elm_getting_started.h | 197 + libraries/elementary/src/lib/elm_glview.c | 462 ++ libraries/elementary/src/lib/elm_glview.h | 226 + libraries/elementary/src/lib/elm_grid.c | 177 + libraries/elementary/src/lib/elm_grid.h | 125 + libraries/elementary/src/lib/elm_hover.c | 852 +++ libraries/elementary/src/lib/elm_hover.h | 199 + libraries/elementary/src/lib/elm_icon.c | 1006 ++++ libraries/elementary/src/lib/elm_icon.h | 566 ++ libraries/elementary/src/lib/elm_image.c | 352 ++ libraries/elementary/src/lib/elm_image.h | 390 ++ libraries/elementary/src/lib/elm_index.c | 932 +++ libraries/elementary/src/lib/elm_index.h | 373 ++ libraries/elementary/src/lib/elm_intro.h | 34 + libraries/elementary/src/lib/elm_label.c | 543 ++ libraries/elementary/src/lib/elm_label.h | 180 + libraries/elementary/src/lib/elm_layout.c | 967 +++ libraries/elementary/src/lib/elm_layout.h | 638 ++ libraries/elementary/src/lib/elm_list.c | 2004 +++++++ libraries/elementary/src/lib/elm_list.h | 779 +++ libraries/elementary/src/lib/elm_macros.h | 3 + libraries/elementary/src/lib/elm_main.c | 1490 +++++ libraries/elementary/src/lib/elm_map.c | 5669 ++++++++++++++++++ libraries/elementary/src/lib/elm_map.h | 1503 +++++ libraries/elementary/src/lib/elm_mapbuf.c | 305 + libraries/elementary/src/lib/elm_mapbuf.h | 149 + libraries/elementary/src/lib/elm_menu.c | 968 +++ libraries/elementary/src/lib/elm_menu.h | 283 + libraries/elementary/src/lib/elm_mirroring.h | 59 + libraries/elementary/src/lib/elm_module.c | 251 + libraries/elementary/src/lib/elm_need.h | 49 + libraries/elementary/src/lib/elm_notify.c | 626 ++ libraries/elementary/src/lib/elm_notify.h | 173 + libraries/elementary/src/lib/elm_object.h | 376 ++ libraries/elementary/src/lib/elm_object_item.h | 434 ++ libraries/elementary/src/lib/elm_panel.c | 399 ++ libraries/elementary/src/lib/elm_panel.h | 105 + libraries/elementary/src/lib/elm_panes.c | 470 ++ libraries/elementary/src/lib/elm_panes.h | 205 + libraries/elementary/src/lib/elm_photo.c | 633 ++ libraries/elementary/src/lib/elm_photo.h | 113 + libraries/elementary/src/lib/elm_photocam.c | 1962 ++++++ libraries/elementary/src/lib/elm_photocam.h | 318 + libraries/elementary/src/lib/elm_plug.c | 128 + libraries/elementary/src/lib/elm_plug.h | 57 + libraries/elementary/src/lib/elm_priv.h | 315 + libraries/elementary/src/lib/elm_progressbar.c | 462 ++ libraries/elementary/src/lib/elm_progressbar.h | 289 + libraries/elementary/src/lib/elm_radio.c | 520 ++ libraries/elementary/src/lib/elm_radio.h | 159 + libraries/elementary/src/lib/elm_route.c | 286 + libraries/elementary/src/lib/elm_route.h | 54 + libraries/elementary/src/lib/elm_scale.h | 36 + libraries/elementary/src/lib/elm_scroll.h | 114 + libraries/elementary/src/lib/elm_scroller.c | 765 +++ libraries/elementary/src/lib/elm_scroller.h | 423 ++ libraries/elementary/src/lib/elm_segment_control.c | 742 +++ libraries/elementary/src/lib/elm_segment_control.h | 290 + libraries/elementary/src/lib/elm_separator.c | 106 + libraries/elementary/src/lib/elm_separator.h | 44 + libraries/elementary/src/lib/elm_slider.c | 1073 ++++ libraries/elementary/src/lib/elm_slider.h | 400 ++ libraries/elementary/src/lib/elm_slideshow.c | 776 +++ libraries/elementary/src/lib/elm_slideshow.h | 546 ++ libraries/elementary/src/lib/elm_spinner.c | 830 +++ libraries/elementary/src/lib/elm_spinner.h | 426 ++ libraries/elementary/src/lib/elm_store.c | 751 +++ libraries/elementary/src/lib/elm_store.h | 402 ++ libraries/elementary/src/lib/elm_table.c | 243 + libraries/elementary/src/lib/elm_table.h | 159 + libraries/elementary/src/lib/elm_theme.c | 706 +++ libraries/elementary/src/lib/elm_theme.h | 436 ++ libraries/elementary/src/lib/elm_thumb.c | 728 +++ libraries/elementary/src/lib/elm_thumb.h | 263 + libraries/elementary/src/lib/elm_toolbar.c | 2061 +++++++ libraries/elementary/src/lib/elm_toolbar.h | 900 +++ libraries/elementary/src/lib/elm_tooltip.h | 100 + libraries/elementary/src/lib/elm_transit.c | 2357 ++++++++ libraries/elementary/src/lib/elm_transit.h | 824 +++ libraries/elementary/src/lib/elm_util.c | 46 + libraries/elementary/src/lib/elm_video.c | 581 ++ libraries/elementary/src/lib/elm_video.h | 268 + libraries/elementary/src/lib/elm_web.c | 1944 ++++++ libraries/elementary/src/lib/elm_web.h | 1060 ++++ libraries/elementary/src/lib/elm_widget.c | 3949 +++++++++++++ libraries/elementary/src/lib/elm_widget.h | 751 +++ libraries/elementary/src/lib/elm_win.c | 3428 +++++++++++ libraries/elementary/src/lib/elm_win.h | 1371 +++++ libraries/elementary/src/lib/els_box.c | 256 + libraries/elementary/src/lib/els_box.h | 1 + libraries/elementary/src/lib/els_cursor.c | 506 ++ libraries/elementary/src/lib/els_icon.c | 842 +++ libraries/elementary/src/lib/els_icon.h | 27 + libraries/elementary/src/lib/els_pan.c | 332 ++ libraries/elementary/src/lib/els_pan.h | 10 + libraries/elementary/src/lib/els_scroller.c | 3000 ++++++++++ libraries/elementary/src/lib/els_scroller.h | 48 + libraries/elementary/src/lib/els_tooltip.c | 951 +++ libraries/elementary/src/lib/elu_ews_wm.c | 545 ++ libraries/elementary/src/modules/Makefile.am | 8 + libraries/elementary/src/modules/Makefile.in | 671 +++ .../src/modules/access_output/Makefile.am | 33 + .../src/modules/access_output/Makefile.in | 664 +++ .../elementary/src/modules/access_output/mod.c | 119 + .../modules/datetime_input_ctxpopup/Makefile.am | 33 + .../modules/datetime_input_ctxpopup/Makefile.in | 664 +++ .../datetime_input_ctxpopup.c | 325 + .../elementary/src/modules/test_entry/Makefile.am | 33 + .../elementary/src/modules/test_entry/Makefile.in | 664 +++ libraries/elementary/src/modules/test_entry/mod.c | 36 + .../elementary/src/modules/test_map/Makefile.am | 33 + .../elementary/src/modules/test_map/Makefile.in | 664 +++ libraries/elementary/src/modules/test_map/mod.c | 77 + 429 files changed, 196274 insertions(+) create mode 100644 libraries/elementary/src/Makefile.am create mode 100644 libraries/elementary/src/Makefile.in create mode 100644 libraries/elementary/src/bin/Makefile.am create mode 100644 libraries/elementary/src/bin/Makefile.in create mode 100644 libraries/elementary/src/bin/config.c create mode 100644 libraries/elementary/src/bin/quicklaunch.c create mode 100644 libraries/elementary/src/bin/run.c create mode 100644 libraries/elementary/src/bin/test.c create mode 100644 libraries/elementary/src/bin/test.h create mode 100644 libraries/elementary/src/bin/test_3d.c create mode 100644 libraries/elementary/src/bin/test_actionslider.c create mode 100644 libraries/elementary/src/bin/test_anim.c create mode 100644 libraries/elementary/src/bin/test_bg.c create mode 100644 libraries/elementary/src/bin/test_box.c create mode 100644 libraries/elementary/src/bin/test_bubble.c create mode 100644 libraries/elementary/src/bin/test_button.c create mode 100644 libraries/elementary/src/bin/test_calendar.c create mode 100644 libraries/elementary/src/bin/test_check.c create mode 100644 libraries/elementary/src/bin/test_clock.c create mode 100644 libraries/elementary/src/bin/test_cnp.c create mode 100644 libraries/elementary/src/bin/test_colorselector.c create mode 100644 libraries/elementary/src/bin/test_conform.c create mode 100644 libraries/elementary/src/bin/test_ctxpopup.c create mode 100644 libraries/elementary/src/bin/test_cursor.c create mode 100644 libraries/elementary/src/bin/test_datetime.c create mode 100644 libraries/elementary/src/bin/test_dayselector.c create mode 100644 libraries/elementary/src/bin/test_diskselector.c create mode 100644 libraries/elementary/src/bin/test_eio.c create mode 100644 libraries/elementary/src/bin/test_entry.c create mode 100644 libraries/elementary/src/bin/test_entry_anchor.c create mode 100644 libraries/elementary/src/bin/test_entry_anchor2.c create mode 100644 libraries/elementary/src/bin/test_factory.c create mode 100644 libraries/elementary/src/bin/test_fileselector.c create mode 100644 libraries/elementary/src/bin/test_fileselector_button.c create mode 100644 libraries/elementary/src/bin/test_fileselector_entry.c create mode 100644 libraries/elementary/src/bin/test_flip.c create mode 100644 libraries/elementary/src/bin/test_flip_page.c create mode 100644 libraries/elementary/src/bin/test_flipselector.c create mode 100644 libraries/elementary/src/bin/test_floating.c create mode 100644 libraries/elementary/src/bin/test_focus.c create mode 100644 libraries/elementary/src/bin/test_focus2.c create mode 100644 libraries/elementary/src/bin/test_focus3.c create mode 100644 libraries/elementary/src/bin/test_gengrid.c create mode 100644 libraries/elementary/src/bin/test_genlist.c create mode 100644 libraries/elementary/src/bin/test_gesture_layer.c create mode 100644 libraries/elementary/src/bin/test_gesture_layer2.c create mode 100644 libraries/elementary/src/bin/test_gesture_layer3.c create mode 100644 libraries/elementary/src/bin/test_glview.c create mode 100644 libraries/elementary/src/bin/test_glview_simple.c create mode 100644 libraries/elementary/src/bin/test_grid.c create mode 100644 libraries/elementary/src/bin/test_hover.c create mode 100644 libraries/elementary/src/bin/test_hoversel.c create mode 100644 libraries/elementary/src/bin/test_icon.c create mode 100644 libraries/elementary/src/bin/test_icon_animated.c create mode 100644 libraries/elementary/src/bin/test_icon_desktops.c create mode 100644 libraries/elementary/src/bin/test_index.c create mode 100644 libraries/elementary/src/bin/test_inwin.c create mode 100644 libraries/elementary/src/bin/test_label.c create mode 100644 libraries/elementary/src/bin/test_launcher.c create mode 100644 libraries/elementary/src/bin/test_layout.c create mode 100644 libraries/elementary/src/bin/test_list.c create mode 100644 libraries/elementary/src/bin/test_map.c create mode 100644 libraries/elementary/src/bin/test_menu.c create mode 100644 libraries/elementary/src/bin/test_multi.c create mode 100644 libraries/elementary/src/bin/test_multibuttonentry.c create mode 100644 libraries/elementary/src/bin/test_naviframe.c create mode 100644 libraries/elementary/src/bin/test_naviframe_complex.c create mode 100644 libraries/elementary/src/bin/test_notify.c create mode 100644 libraries/elementary/src/bin/test_panel.c create mode 100644 libraries/elementary/src/bin/test_panes.c create mode 100644 libraries/elementary/src/bin/test_photo.c create mode 100644 libraries/elementary/src/bin/test_photocam.c create mode 100644 libraries/elementary/src/bin/test_popup.c create mode 100644 libraries/elementary/src/bin/test_progressbar.c create mode 100644 libraries/elementary/src/bin/test_radio.c create mode 100644 libraries/elementary/src/bin/test_scaling.c create mode 100644 libraries/elementary/src/bin/test_scroller.c create mode 100644 libraries/elementary/src/bin/test_segment_control.c create mode 100644 libraries/elementary/src/bin/test_separator.c create mode 100644 libraries/elementary/src/bin/test_slider.c create mode 100644 libraries/elementary/src/bin/test_slideshow.c create mode 100644 libraries/elementary/src/bin/test_spinner.c create mode 100644 libraries/elementary/src/bin/test_store.c create mode 100644 libraries/elementary/src/bin/test_table.c create mode 100644 libraries/elementary/src/bin/test_thumb.c create mode 100644 libraries/elementary/src/bin/test_toolbar.c create mode 100644 libraries/elementary/src/bin/test_tooltip.c create mode 100644 libraries/elementary/src/bin/test_transit.c create mode 100644 libraries/elementary/src/bin/test_video.c create mode 100644 libraries/elementary/src/bin/test_weather.c create mode 100644 libraries/elementary/src/bin/test_web.c create mode 100644 libraries/elementary/src/bin/test_win_inline.c create mode 100644 libraries/elementary/src/bin/test_win_plug.c create mode 100644 libraries/elementary/src/bin/test_win_socket.c create mode 100644 libraries/elementary/src/bin/test_win_state.c create mode 100644 libraries/elementary/src/edje_externals/Makefile.am create mode 100644 libraries/elementary/src/edje_externals/Makefile.in create mode 100644 libraries/elementary/src/edje_externals/elm.c create mode 100644 libraries/elementary/src/edje_externals/elm_actionslider.c create mode 100644 libraries/elementary/src/edje_externals/elm_bubble.c create mode 100644 libraries/elementary/src/edje_externals/elm_button.c create mode 100644 libraries/elementary/src/edje_externals/elm_calendar.c create mode 100644 libraries/elementary/src/edje_externals/elm_check.c create mode 100644 libraries/elementary/src/edje_externals/elm_clock.c create mode 100644 libraries/elementary/src/edje_externals/elm_entry.c create mode 100644 libraries/elementary/src/edje_externals/elm_fileselector.c create mode 100644 libraries/elementary/src/edje_externals/elm_fileselector_button.c create mode 100644 libraries/elementary/src/edje_externals/elm_fileselector_entry.c create mode 100644 libraries/elementary/src/edje_externals/elm_frame.c create mode 100644 libraries/elementary/src/edje_externals/elm_gengrid.c create mode 100644 libraries/elementary/src/edje_externals/elm_genlist.c create mode 100644 libraries/elementary/src/edje_externals/elm_hoversel.c create mode 100644 libraries/elementary/src/edje_externals/elm_icon.c create mode 100644 libraries/elementary/src/edje_externals/elm_index.c create mode 100644 libraries/elementary/src/edje_externals/elm_label.c create mode 100644 libraries/elementary/src/edje_externals/elm_list.c create mode 100644 libraries/elementary/src/edje_externals/elm_map.c create mode 100644 libraries/elementary/src/edje_externals/elm_multibuttonentry.c create mode 100644 libraries/elementary/src/edje_externals/elm_naviframe.c create mode 100644 libraries/elementary/src/edje_externals/elm_notify.c create mode 100644 libraries/elementary/src/edje_externals/elm_panes.c create mode 100644 libraries/elementary/src/edje_externals/elm_photocam.c create mode 100644 libraries/elementary/src/edje_externals/elm_progressbar.c create mode 100644 libraries/elementary/src/edje_externals/elm_radio.c create mode 100644 libraries/elementary/src/edje_externals/elm_scroller.c create mode 100644 libraries/elementary/src/edje_externals/elm_segment_control.c create mode 100644 libraries/elementary/src/edje_externals/elm_slider.c create mode 100644 libraries/elementary/src/edje_externals/elm_slideshow.c create mode 100644 libraries/elementary/src/edje_externals/elm_spinner.c create mode 100644 libraries/elementary/src/edje_externals/elm_thumb.c create mode 100644 libraries/elementary/src/edje_externals/elm_toolbar.c create mode 100644 libraries/elementary/src/edje_externals/elm_video.c create mode 100644 libraries/elementary/src/edje_externals/elm_web.c create mode 100644 libraries/elementary/src/edje_externals/modules.inc create mode 100644 libraries/elementary/src/edje_externals/private.h create mode 100644 libraries/elementary/src/examples/Makefile.am create mode 100644 libraries/elementary/src/examples/Makefile.in create mode 100644 libraries/elementary/src/examples/actionslider_example_01.c create mode 100644 libraries/elementary/src/examples/bg_example_01.c create mode 100644 libraries/elementary/src/examples/bg_example_02.c create mode 100644 libraries/elementary/src/examples/bg_example_03.c create mode 100644 libraries/elementary/src/examples/box_example_02.c create mode 100644 libraries/elementary/src/examples/bubble_example_01.c create mode 100644 libraries/elementary/src/examples/button_example_00.c create mode 100644 libraries/elementary/src/examples/button_example_01.c create mode 100644 libraries/elementary/src/examples/calendar_example_01.c create mode 100644 libraries/elementary/src/examples/calendar_example_02.c create mode 100644 libraries/elementary/src/examples/calendar_example_03.c create mode 100644 libraries/elementary/src/examples/calendar_example_04.c create mode 100644 libraries/elementary/src/examples/calendar_example_05.c create mode 100644 libraries/elementary/src/examples/calendar_example_06.c create mode 100644 libraries/elementary/src/examples/check_example_01.c create mode 100644 libraries/elementary/src/examples/clock_example.c create mode 100644 libraries/elementary/src/examples/colorselector_example_01.c create mode 100644 libraries/elementary/src/examples/conformant_example_01.c create mode 100644 libraries/elementary/src/examples/conformant_example_02.c create mode 100644 libraries/elementary/src/examples/ctxpopup_example_01.c create mode 100644 libraries/elementary/src/examples/datetime_example.c create mode 100644 libraries/elementary/src/examples/dayselector_example.c create mode 100644 libraries/elementary/src/examples/diskselector_example_01.c create mode 100644 libraries/elementary/src/examples/diskselector_example_02.c create mode 100644 libraries/elementary/src/examples/efl_thread_1.c create mode 100644 libraries/elementary/src/examples/efl_thread_2.c create mode 100644 libraries/elementary/src/examples/efl_thread_3.c create mode 100644 libraries/elementary/src/examples/efl_thread_4.c create mode 100644 libraries/elementary/src/examples/efl_thread_5.c create mode 100644 libraries/elementary/src/examples/efl_thread_6.c create mode 100644 libraries/elementary/src/examples/efl_thread_win32_1.c create mode 100644 libraries/elementary/src/examples/efl_thread_win32_2.c create mode 100644 libraries/elementary/src/examples/efl_thread_win32_3.c create mode 100644 libraries/elementary/src/examples/efl_thread_win32_4.c create mode 100644 libraries/elementary/src/examples/entry_example.c create mode 100644 libraries/elementary/src/examples/fileselector_button_example.c create mode 100644 libraries/elementary/src/examples/fileselector_entry_example.c create mode 100644 libraries/elementary/src/examples/fileselector_example.c create mode 100644 libraries/elementary/src/examples/flip_example_01.c create mode 100644 libraries/elementary/src/examples/flipselector_example.c create mode 100644 libraries/elementary/src/examples/frame_example_01.c create mode 100644 libraries/elementary/src/examples/general_funcs_example.c create mode 100644 libraries/elementary/src/examples/gengrid_example.c create mode 100644 libraries/elementary/src/examples/genlist_example_01.c create mode 100644 libraries/elementary/src/examples/genlist_example_02.c create mode 100644 libraries/elementary/src/examples/genlist_example_03.c create mode 100644 libraries/elementary/src/examples/genlist_example_04.c create mode 100644 libraries/elementary/src/examples/genlist_example_05.c create mode 100644 libraries/elementary/src/examples/hover_example_01.c create mode 100644 libraries/elementary/src/examples/hoversel_example_01.c create mode 100644 libraries/elementary/src/examples/icon_example_01.c create mode 100644 libraries/elementary/src/examples/image_example_01.c create mode 100644 libraries/elementary/src/examples/index_example_01.c create mode 100644 libraries/elementary/src/examples/index_example_02.c create mode 100644 libraries/elementary/src/examples/inwin_example.c create mode 100644 libraries/elementary/src/examples/label_example_01.c create mode 100644 libraries/elementary/src/examples/layout_example_01.c create mode 100644 libraries/elementary/src/examples/layout_example_02.c create mode 100644 libraries/elementary/src/examples/layout_example_03.c create mode 100644 libraries/elementary/src/examples/list_example_01.c create mode 100644 libraries/elementary/src/examples/list_example_02.c create mode 100644 libraries/elementary/src/examples/list_example_03.c create mode 100644 libraries/elementary/src/examples/map_example_01.c create mode 100644 libraries/elementary/src/examples/map_example_02.c create mode 100644 libraries/elementary/src/examples/map_example_03.c create mode 100644 libraries/elementary/src/examples/mapbuf_example.c create mode 100644 libraries/elementary/src/examples/menu_example_01.c create mode 100644 libraries/elementary/src/examples/notify_example_01.c create mode 100644 libraries/elementary/src/examples/panel_example_01.c create mode 100644 libraries/elementary/src/examples/panes_example.c create mode 100644 libraries/elementary/src/examples/photocam_example_01.c create mode 100644 libraries/elementary/src/examples/popup_example_01.c create mode 100644 libraries/elementary/src/examples/popup_example_02.c create mode 100644 libraries/elementary/src/examples/popup_example_03.c create mode 100644 libraries/elementary/src/examples/progressbar_example.c create mode 100644 libraries/elementary/src/examples/radio_example_01.c create mode 100644 libraries/elementary/src/examples/scroller_example_01.c create mode 100644 libraries/elementary/src/examples/segment_control_example.c create mode 100644 libraries/elementary/src/examples/separator_example_01.c create mode 100644 libraries/elementary/src/examples/slider_example.c create mode 100644 libraries/elementary/src/examples/slideshow_example.c create mode 100644 libraries/elementary/src/examples/spinner_example.c create mode 100644 libraries/elementary/src/examples/table_example_01.c create mode 100644 libraries/elementary/src/examples/table_example_02.c create mode 100644 libraries/elementary/src/examples/theme_example_01.c create mode 100644 libraries/elementary/src/examples/theme_example_02.c create mode 100644 libraries/elementary/src/examples/thumb_example_01.c create mode 100644 libraries/elementary/src/examples/toolbar_example_01.c create mode 100644 libraries/elementary/src/examples/toolbar_example_02.c create mode 100644 libraries/elementary/src/examples/toolbar_example_03.c create mode 100644 libraries/elementary/src/examples/transit_example_01.c create mode 100644 libraries/elementary/src/examples/transit_example_02.c create mode 100644 libraries/elementary/src/examples/transit_example_03.c create mode 100644 libraries/elementary/src/examples/transit_example_04.c create mode 100644 libraries/elementary/src/examples/web_example.c create mode 100644 libraries/elementary/src/examples/win_example.c create mode 100644 libraries/elementary/src/lib/Elementary.h create mode 100644 libraries/elementary/src/lib/Elementary.h.in create mode 100644 libraries/elementary/src/lib/Elementary_Cursor.h create mode 100644 libraries/elementary/src/lib/Makefile.am create mode 100644 libraries/elementary/src/lib/Makefile.in create mode 100644 libraries/elementary/src/lib/elc_ctxpopup.c create mode 100644 libraries/elementary/src/lib/elc_ctxpopup.h create mode 100644 libraries/elementary/src/lib/elc_dayselector.c create mode 100644 libraries/elementary/src/lib/elc_dayselector.h create mode 100644 libraries/elementary/src/lib/elc_fileselector.c create mode 100644 libraries/elementary/src/lib/elc_fileselector.h create mode 100644 libraries/elementary/src/lib/elc_fileselector_button.c create mode 100644 libraries/elementary/src/lib/elc_fileselector_button.h create mode 100644 libraries/elementary/src/lib/elc_fileselector_entry.c create mode 100644 libraries/elementary/src/lib/elc_fileselector_entry.h create mode 100644 libraries/elementary/src/lib/elc_hoversel.c create mode 100644 libraries/elementary/src/lib/elc_hoversel.h create mode 100644 libraries/elementary/src/lib/elc_multibuttonentry.c create mode 100644 libraries/elementary/src/lib/elc_multibuttonentry.h create mode 100644 libraries/elementary/src/lib/elc_naviframe.c create mode 100644 libraries/elementary/src/lib/elc_naviframe.h create mode 100644 libraries/elementary/src/lib/elc_player.c create mode 100644 libraries/elementary/src/lib/elc_popup.c create mode 100644 libraries/elementary/src/lib/elc_popup.h create mode 100644 libraries/elementary/src/lib/elc_scrolled_entry.c create mode 100644 libraries/elementary/src/lib/elm_access.c create mode 100644 libraries/elementary/src/lib/elm_actionslider.c create mode 100644 libraries/elementary/src/lib/elm_actionslider.h create mode 100644 libraries/elementary/src/lib/elm_app.h create mode 100644 libraries/elementary/src/lib/elm_authors.h create mode 100644 libraries/elementary/src/lib/elm_bg.c create mode 100644 libraries/elementary/src/lib/elm_bg.h create mode 100644 libraries/elementary/src/lib/elm_box.c create mode 100644 libraries/elementary/src/lib/elm_box.h create mode 100644 libraries/elementary/src/lib/elm_bubble.c create mode 100644 libraries/elementary/src/lib/elm_bubble.h create mode 100644 libraries/elementary/src/lib/elm_button.c create mode 100644 libraries/elementary/src/lib/elm_button.h create mode 100644 libraries/elementary/src/lib/elm_cache.h create mode 100644 libraries/elementary/src/lib/elm_calendar.c create mode 100644 libraries/elementary/src/lib/elm_calendar.h create mode 100644 libraries/elementary/src/lib/elm_check.c create mode 100644 libraries/elementary/src/lib/elm_check.h create mode 100644 libraries/elementary/src/lib/elm_clock.c create mode 100644 libraries/elementary/src/lib/elm_clock.h create mode 100644 libraries/elementary/src/lib/elm_cnp.c create mode 100644 libraries/elementary/src/lib/elm_cnp.h create mode 100644 libraries/elementary/src/lib/elm_colorselector.c create mode 100644 libraries/elementary/src/lib/elm_colorselector.h create mode 100644 libraries/elementary/src/lib/elm_config.c create mode 100644 libraries/elementary/src/lib/elm_config.h create mode 100644 libraries/elementary/src/lib/elm_conform.c create mode 100644 libraries/elementary/src/lib/elm_conform.h create mode 100644 libraries/elementary/src/lib/elm_cursor.h create mode 100644 libraries/elementary/src/lib/elm_datetime.c create mode 100644 libraries/elementary/src/lib/elm_datetime.h create mode 100644 libraries/elementary/src/lib/elm_debug.h create mode 100644 libraries/elementary/src/lib/elm_deprecated.h create mode 100644 libraries/elementary/src/lib/elm_diskselector.c create mode 100644 libraries/elementary/src/lib/elm_diskselector.h create mode 100644 libraries/elementary/src/lib/elm_entry.c create mode 100644 libraries/elementary/src/lib/elm_entry.h create mode 100644 libraries/elementary/src/lib/elm_factory.c create mode 100644 libraries/elementary/src/lib/elm_factory.h create mode 100644 libraries/elementary/src/lib/elm_finger.h create mode 100644 libraries/elementary/src/lib/elm_flip.c create mode 100644 libraries/elementary/src/lib/elm_flip.h create mode 100644 libraries/elementary/src/lib/elm_flipselector.c create mode 100644 libraries/elementary/src/lib/elm_flipselector.h create mode 100644 libraries/elementary/src/lib/elm_focus.h create mode 100644 libraries/elementary/src/lib/elm_font.c create mode 100644 libraries/elementary/src/lib/elm_font.h create mode 100644 libraries/elementary/src/lib/elm_frame.c create mode 100644 libraries/elementary/src/lib/elm_frame.h create mode 100644 libraries/elementary/src/lib/elm_gen.h create mode 100644 libraries/elementary/src/lib/elm_gen_common.h create mode 100644 libraries/elementary/src/lib/elm_general.h create mode 100644 libraries/elementary/src/lib/elm_gengrid.c create mode 100644 libraries/elementary/src/lib/elm_gengrid.h create mode 100644 libraries/elementary/src/lib/elm_genlist.c create mode 100644 libraries/elementary/src/lib/elm_genlist.h create mode 100644 libraries/elementary/src/lib/elm_gesture_layer.c create mode 100644 libraries/elementary/src/lib/elm_gesture_layer.h create mode 100644 libraries/elementary/src/lib/elm_getting_started.h create mode 100644 libraries/elementary/src/lib/elm_glview.c create mode 100644 libraries/elementary/src/lib/elm_glview.h create mode 100644 libraries/elementary/src/lib/elm_grid.c create mode 100644 libraries/elementary/src/lib/elm_grid.h create mode 100644 libraries/elementary/src/lib/elm_hover.c create mode 100644 libraries/elementary/src/lib/elm_hover.h create mode 100644 libraries/elementary/src/lib/elm_icon.c create mode 100644 libraries/elementary/src/lib/elm_icon.h create mode 100644 libraries/elementary/src/lib/elm_image.c create mode 100644 libraries/elementary/src/lib/elm_image.h create mode 100644 libraries/elementary/src/lib/elm_index.c create mode 100644 libraries/elementary/src/lib/elm_index.h create mode 100644 libraries/elementary/src/lib/elm_intro.h create mode 100644 libraries/elementary/src/lib/elm_label.c create mode 100644 libraries/elementary/src/lib/elm_label.h create mode 100644 libraries/elementary/src/lib/elm_layout.c create mode 100644 libraries/elementary/src/lib/elm_layout.h create mode 100644 libraries/elementary/src/lib/elm_list.c create mode 100644 libraries/elementary/src/lib/elm_list.h create mode 100644 libraries/elementary/src/lib/elm_macros.h create mode 100644 libraries/elementary/src/lib/elm_main.c create mode 100644 libraries/elementary/src/lib/elm_map.c create mode 100644 libraries/elementary/src/lib/elm_map.h create mode 100644 libraries/elementary/src/lib/elm_mapbuf.c create mode 100644 libraries/elementary/src/lib/elm_mapbuf.h create mode 100644 libraries/elementary/src/lib/elm_menu.c create mode 100644 libraries/elementary/src/lib/elm_menu.h create mode 100644 libraries/elementary/src/lib/elm_mirroring.h create mode 100644 libraries/elementary/src/lib/elm_module.c create mode 100644 libraries/elementary/src/lib/elm_need.h create mode 100644 libraries/elementary/src/lib/elm_notify.c create mode 100644 libraries/elementary/src/lib/elm_notify.h create mode 100644 libraries/elementary/src/lib/elm_object.h create mode 100644 libraries/elementary/src/lib/elm_object_item.h create mode 100644 libraries/elementary/src/lib/elm_panel.c create mode 100644 libraries/elementary/src/lib/elm_panel.h create mode 100644 libraries/elementary/src/lib/elm_panes.c create mode 100644 libraries/elementary/src/lib/elm_panes.h create mode 100644 libraries/elementary/src/lib/elm_photo.c create mode 100644 libraries/elementary/src/lib/elm_photo.h create mode 100644 libraries/elementary/src/lib/elm_photocam.c create mode 100644 libraries/elementary/src/lib/elm_photocam.h create mode 100644 libraries/elementary/src/lib/elm_plug.c create mode 100644 libraries/elementary/src/lib/elm_plug.h create mode 100644 libraries/elementary/src/lib/elm_priv.h create mode 100644 libraries/elementary/src/lib/elm_progressbar.c create mode 100644 libraries/elementary/src/lib/elm_progressbar.h create mode 100644 libraries/elementary/src/lib/elm_radio.c create mode 100644 libraries/elementary/src/lib/elm_radio.h create mode 100644 libraries/elementary/src/lib/elm_route.c create mode 100644 libraries/elementary/src/lib/elm_route.h create mode 100644 libraries/elementary/src/lib/elm_scale.h create mode 100644 libraries/elementary/src/lib/elm_scroll.h create mode 100644 libraries/elementary/src/lib/elm_scroller.c create mode 100644 libraries/elementary/src/lib/elm_scroller.h create mode 100644 libraries/elementary/src/lib/elm_segment_control.c create mode 100644 libraries/elementary/src/lib/elm_segment_control.h create mode 100644 libraries/elementary/src/lib/elm_separator.c create mode 100644 libraries/elementary/src/lib/elm_separator.h create mode 100644 libraries/elementary/src/lib/elm_slider.c create mode 100644 libraries/elementary/src/lib/elm_slider.h create mode 100644 libraries/elementary/src/lib/elm_slideshow.c create mode 100644 libraries/elementary/src/lib/elm_slideshow.h create mode 100644 libraries/elementary/src/lib/elm_spinner.c create mode 100644 libraries/elementary/src/lib/elm_spinner.h create mode 100644 libraries/elementary/src/lib/elm_store.c create mode 100644 libraries/elementary/src/lib/elm_store.h create mode 100644 libraries/elementary/src/lib/elm_table.c create mode 100644 libraries/elementary/src/lib/elm_table.h create mode 100644 libraries/elementary/src/lib/elm_theme.c create mode 100644 libraries/elementary/src/lib/elm_theme.h create mode 100644 libraries/elementary/src/lib/elm_thumb.c create mode 100644 libraries/elementary/src/lib/elm_thumb.h create mode 100644 libraries/elementary/src/lib/elm_toolbar.c create mode 100644 libraries/elementary/src/lib/elm_toolbar.h create mode 100644 libraries/elementary/src/lib/elm_tooltip.h create mode 100644 libraries/elementary/src/lib/elm_transit.c create mode 100644 libraries/elementary/src/lib/elm_transit.h create mode 100644 libraries/elementary/src/lib/elm_util.c create mode 100644 libraries/elementary/src/lib/elm_video.c create mode 100644 libraries/elementary/src/lib/elm_video.h create mode 100644 libraries/elementary/src/lib/elm_web.c create mode 100644 libraries/elementary/src/lib/elm_web.h create mode 100644 libraries/elementary/src/lib/elm_widget.c create mode 100644 libraries/elementary/src/lib/elm_widget.h create mode 100644 libraries/elementary/src/lib/elm_win.c create mode 100644 libraries/elementary/src/lib/elm_win.h create mode 100644 libraries/elementary/src/lib/els_box.c create mode 100644 libraries/elementary/src/lib/els_box.h create mode 100644 libraries/elementary/src/lib/els_cursor.c create mode 100644 libraries/elementary/src/lib/els_icon.c create mode 100644 libraries/elementary/src/lib/els_icon.h create mode 100644 libraries/elementary/src/lib/els_pan.c create mode 100644 libraries/elementary/src/lib/els_pan.h create mode 100644 libraries/elementary/src/lib/els_scroller.c create mode 100644 libraries/elementary/src/lib/els_scroller.h create mode 100644 libraries/elementary/src/lib/els_tooltip.c create mode 100644 libraries/elementary/src/lib/elu_ews_wm.c create mode 100644 libraries/elementary/src/modules/Makefile.am create mode 100644 libraries/elementary/src/modules/Makefile.in create mode 100644 libraries/elementary/src/modules/access_output/Makefile.am create mode 100644 libraries/elementary/src/modules/access_output/Makefile.in create mode 100644 libraries/elementary/src/modules/access_output/mod.c create mode 100644 libraries/elementary/src/modules/datetime_input_ctxpopup/Makefile.am create mode 100644 libraries/elementary/src/modules/datetime_input_ctxpopup/Makefile.in create mode 100644 libraries/elementary/src/modules/datetime_input_ctxpopup/datetime_input_ctxpopup.c create mode 100644 libraries/elementary/src/modules/test_entry/Makefile.am create mode 100644 libraries/elementary/src/modules/test_entry/Makefile.in create mode 100644 libraries/elementary/src/modules/test_entry/mod.c create mode 100644 libraries/elementary/src/modules/test_map/Makefile.am create mode 100644 libraries/elementary/src/modules/test_map/Makefile.in create mode 100644 libraries/elementary/src/modules/test_map/mod.c (limited to 'libraries/elementary/src') diff --git a/libraries/elementary/src/Makefile.am b/libraries/elementary/src/Makefile.am new file mode 100644 index 0000000..abaa75d --- /dev/null +++ b/libraries/elementary/src/Makefile.am @@ -0,0 +1,10 @@ +AUTOMAKE_OPTIONS = 1.4 foreign +MAINTAINERCLEANFILES = Makefile.in + +SUBDIRS = lib bin + +if BUILD_MODULES +SUBDIRS += modules edje_externals +endif + +SUBDIRS += examples diff --git a/libraries/elementary/src/Makefile.in b/libraries/elementary/src/Makefile.in new file mode 100644 index 0000000..3aa372c --- /dev/null +++ b/libraries/elementary/src/Makefile.in @@ -0,0 +1,667 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@BUILD_MODULES_TRUE@am__append_1 = modules edje_externals +subdir = src +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/efl_binary.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/elementary_config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = lib bin modules edje_externals examples +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EIO_CFLAGS = @EIO_CFLAGS@ +EIO_LIBS = @EIO_LIBS@ +ELEMENTARY_CFLAGS = @ELEMENTARY_CFLAGS@ +ELEMENTARY_COCOA_CFLAGS = @ELEMENTARY_COCOA_CFLAGS@ +ELEMENTARY_COCOA_LIBS = @ELEMENTARY_COCOA_LIBS@ +ELEMENTARY_CONFIG_PRG = @ELEMENTARY_CONFIG_PRG@ +ELEMENTARY_ECORE_CON_CFLAGS = @ELEMENTARY_ECORE_CON_CFLAGS@ +ELEMENTARY_ECORE_CON_INC = @ELEMENTARY_ECORE_CON_INC@ +ELEMENTARY_ECORE_CON_LIBS = @ELEMENTARY_ECORE_CON_LIBS@ +ELEMENTARY_ECORE_IMF_CFLAGS = @ELEMENTARY_ECORE_IMF_CFLAGS@ +ELEMENTARY_ECORE_IMF_INC = @ELEMENTARY_ECORE_IMF_INC@ +ELEMENTARY_ECORE_IMF_LIBS = @ELEMENTARY_ECORE_IMF_LIBS@ +ELEMENTARY_EDBUS_CFLAGS = @ELEMENTARY_EDBUS_CFLAGS@ +ELEMENTARY_EDBUS_LIBS = @ELEMENTARY_EDBUS_LIBS@ +ELEMENTARY_EFREET_CFLAGS = @ELEMENTARY_EFREET_CFLAGS@ +ELEMENTARY_EFREET_LIBS = @ELEMENTARY_EFREET_LIBS@ +ELEMENTARY_EMAP_CFLAGS = @ELEMENTARY_EMAP_CFLAGS@ +ELEMENTARY_EMAP_LIBS = @ELEMENTARY_EMAP_LIBS@ +ELEMENTARY_ETHUMB_CFLAGS = @ELEMENTARY_ETHUMB_CFLAGS@ +ELEMENTARY_ETHUMB_LIBS = @ELEMENTARY_ETHUMB_LIBS@ +ELEMENTARY_EWEATHER_CFLAGS = @ELEMENTARY_EWEATHER_CFLAGS@ +ELEMENTARY_EWEATHER_LIBS = @ELEMENTARY_EWEATHER_LIBS@ +ELEMENTARY_FB_CFLAGS = @ELEMENTARY_FB_CFLAGS@ +ELEMENTARY_FB_LIBS = @ELEMENTARY_FB_LIBS@ +ELEMENTARY_LIBS = @ELEMENTARY_LIBS@ +ELEMENTARY_PSL1GHT_CFLAGS = @ELEMENTARY_PSL1GHT_CFLAGS@ +ELEMENTARY_PSL1GHT_LIBS = @ELEMENTARY_PSL1GHT_LIBS@ +ELEMENTARY_SDL_CFLAGS = @ELEMENTARY_SDL_CFLAGS@ +ELEMENTARY_SDL_LIBS = @ELEMENTARY_SDL_LIBS@ +ELEMENTARY_TEST_PRG = @ELEMENTARY_TEST_PRG@ +ELEMENTARY_WEB_CFLAGS = @ELEMENTARY_WEB_CFLAGS@ +ELEMENTARY_WEB_LIBS = @ELEMENTARY_WEB_LIBS@ +ELEMENTARY_WIN32_CFLAGS = @ELEMENTARY_WIN32_CFLAGS@ +ELEMENTARY_WIN32_LIBS = @ELEMENTARY_WIN32_LIBS@ +ELEMENTARY_WINCE_CFLAGS = @ELEMENTARY_WINCE_CFLAGS@ +ELEMENTARY_WINCE_LIBS = @ELEMENTARY_WINCE_LIBS@ +ELEMENTARY_X_CFLAGS = @ELEMENTARY_X_CFLAGS@ +ELEMENTARY_X_LIBS = @ELEMENTARY_X_LIBS@ +ELM_ALLOCA_H_DEF = @ELM_ALLOCA_H_DEF@ +ELM_DEBUG_DEF = @ELM_DEBUG_DEF@ +ELM_DIRENT_H_DEF = @ELM_DIRENT_H_DEF@ +ELM_EDBUS_DEF = @ELM_EDBUS_DEF@ +ELM_EFREET_DEF = @ELM_EFREET_DEF@ +ELM_EMAP_DEF = @ELM_EMAP_DEF@ +ELM_ETHUMB_DEF = @ELM_ETHUMB_DEF@ +ELM_EWEATHER_DEF = @ELM_EWEATHER_DEF@ +ELM_LIBINTL_H_DEF = @ELM_LIBINTL_H_DEF@ +ELM_UNIX_DEF = @ELM_UNIX_DEF@ +ELM_WEB_DEF = @ELM_WEB_DEF@ +ELM_WIN32_DEF = @ELM_WIN32_DEF@ +ELM_WINCE_DEF = @ELM_WINCE_DEF@ +EMOTION_CFLAGS = @EMOTION_CFLAGS@ +EMOTION_LIBS = @EMOTION_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALE_DIR = @LOCALE_DIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MODULE_ARCH = @MODULE_ARCH@ +MODULE_EDJE = @MODULE_EDJE@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +VMIN = @VMIN@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +edje_cc = @edje_cc@ +eet_eet = @eet_eet@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +my_libs = @my_libs@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirement_elm = @requirement_elm@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +AUTOMAKE_OPTIONS = 1.4 foreign +MAINTAINERCLEANFILES = Makefile.in +SUBDIRS = lib bin $(am__append_1) examples +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ + install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + ctags ctags-recursive distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/elementary/src/bin/Makefile.am b/libraries/elementary/src/bin/Makefile.am new file mode 100644 index 0000000..93fd441 --- /dev/null +++ b/libraries/elementary/src/bin/Makefile.am @@ -0,0 +1,200 @@ +AUTOMAKE_OPTIONS = 1.4 foreign + +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I$(top_srcdir) \ +-I$(top_srcdir)/src/lib \ +-I$(top_builddir)/src/lib \ +-I$(top_srcdir)/src/bin \ +-DPACKAGE_BIN_DIR=\"$(bindir)\" \ +-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ +@ELEMENTARY_CFLAGS@ \ +@ELEMENTARY_X_CFLAGS@ \ +@ELEMENTARY_FB_CFLAGS@ \ +@ELEMENTARY_WIN32_CFLAGS@ \ +@ELEMENTARY_WINCE_CFLAGS@ \ +@ELEMENTARY_EDBUS_CFLAGS@ \ +@ELEMENTARY_EFREET_CFLAGS@ \ +@ELEMENTARY_EWEATHER_CFLAGS@ \ +@ELEMENTARY_ETHUMB_CFLAGS@ \ +@ELEMENTARY_EMAP_CFLAGS@ \ +@EIO_CFLAGS@ \ +@ELEMENTARY_WEB_CFLAGS@ + +bin_PROGRAMS = @ELEMENTARY_TEST_PRG@ @ELEMENTARY_CONFIG_PRG@ +if BUILD_QUICKLAUNCH +bin_PROGRAMS += elementary_quicklaunch elementary_run elementary_testql +endif + +EXTRA_PROGRAMS = elementary_test elementary_config + +elementary_test_SOURCES = \ +test.c \ +test_3d.c \ +test_actionslider.c \ +test_anim.c \ +test_bg.c \ +test_box.c \ +test_bubble.c \ +test_button.c \ +test_calendar.c \ +test_check.c \ +test_clock.c \ +test_cnp.c \ +test_colorselector.c \ +test_conform.c \ +test_ctxpopup.c \ +test_cursor.c \ +test_datetime.c \ +test_dayselector.c \ +test_diskselector.c \ +test_entry.c \ +test_entry_anchor.c \ +test_entry_anchor2.c \ +test_fileselector_button.c \ +test_fileselector.c \ +test_fileselector_entry.c \ +test_flip.c \ +test_flip_page.c \ +test_flipselector.c \ +test_floating.c \ +test_focus.c \ +test_focus2.c \ +test_focus3.c \ +test_gengrid.c \ +test_genlist.c \ +test_gesture_layer.c \ +test_gesture_layer2.c \ +test_gesture_layer3.c \ +test_glview_simple.c \ +test_glview.c \ +test_grid.c \ +test_hover.c \ +test_hoversel.c \ +test_icon.c \ +test_icon_desktops.c \ +test_icon_animated.c \ +test_index.c \ +test_inwin.c \ +test_label.c \ +test_launcher.c \ +test_layout.c \ +test_list.c \ +test_map.c \ +test_menu.c \ +test_multi.c \ +test_multibuttonentry.c \ +test_naviframe.c \ +test_naviframe_complex.c \ +test_notify.c \ +test_panel.c \ +test_panes.c \ +test_photo.c \ +test_photocam.c \ +test_popup.c \ +test_progressbar.c \ +test_radio.c \ +test_scaling.c \ +test_scroller.c \ +test_segment_control.c \ +test_separator.c \ +test_slider.c \ +test_slideshow.c \ +test_spinner.c \ +test_store.c \ +test_table.c \ +test_thumb.c \ +test_toolbar.c \ +test_tooltip.c \ +test_transit.c \ +test_video.c \ +test_weather.c \ +test_web.c \ +test_win_inline.c \ +test_win_socket.c \ +test_win_plug.c \ +test_win_state.c \ +test.h + +if HAVE_EIO +elementary_test_SOURCES += test_eio.c +endif + +elementary_test_LDADD = $(top_builddir)/src/lib/libelementary.la \ + @ELEMENTARY_EWEATHER_LIBS@ \ + @ELEMENTARY_EDBUS_LIBS@ \ + @ELEMENTARY_EFREET_LIBS@ \ + @ELEMENTARY_EMAP_LIBS@ \ + @ELEMENTARY_LIBS@ \ + @EIO_LIBS@ \ + @ELEMENTARY_WEB_LIBS@ \ + @my_libs@ +elementary_test_LDFLAGS = + +elementary_config_SOURCES = \ +config.c + +elementary_config_LDADD = $(top_builddir)/src/lib/libelementary.la \ + @ELEMENTARY_EWEATHER_LIBS@ \ + @ELEMENTARY_EDBUS_LIBS@ \ + @ELEMENTARY_EFREET_LIBS@ \ + @ELEMENTARY_EMAP_LIBS@ \ + @ELEMENTARY_LIBS@ \ + @my_libs@ +elementary_config_LDFLAGS = + +if BUILD_QUICKLAUNCH +elementary_quicklaunch_SOURCES = quicklaunch.c +elementary_quicklaunch_LDADD = $(top_builddir)/src/lib/libelementary.la \ + @ELEMENTARY_EWEATHER_LIBS@ \ + @ELEMENTARY_EDBUS_LIBS@ \ + @ELEMENTARY_EFREET_LIBS@ \ + @ELEMENTARY_EMAP_LIBS@ \ + @ELEMENTARY_LIBS@ \ + @my_libs@ +elementary_quicklaunch_LDFLAGS = + +if BUILD_RUN +elementary_run_SOURCES = run.c +elementary_run_LDADD = +elementary_run_LDFLAGS = +endif + +## This is how to build a quicklanch capable app +# build the shared lib version - libtool produces a .a and .la file as well +# as a .so - these get put in libdir ($PREFIX/lib) as elementary_testql.so +# etc. - this is where elementary will expect to find the .so's for +# quicklaunch apps. +elementary_testqldir = $(libdir) +elementary_testql_LTLIBRARIES = elementary_testql.la +elementary_testql_la_SOURCES = $(elementary_test_SOURCES) +elementary_testql_la_LIBADD = $(top_builddir)/src/lib/libelementary.la \ + @ELEMENTARY_EWEATHER_LIBS@ \ + @ELEMENTARY_EDBUS_LIBS@ \ + @ELEMENTARY_EFREET_LIBS@ \ + @ELEMENTARY_EMAP_LIBS@ \ + @ELEMENTARY_LIBS@ \ + @EIO_LIBS@ \ + @ELEMENTARY_WEB_LIBS@ \ + @my_libs@ + +elementary_testql_la_CFLAGS = +elementary_testql_la_LDFLAGS = -module -avoid-version -no-undefined +elementary_testql_SOURCES = $(elementary_test_SOURCES) +elementary_testql_LDADD = $(top_builddir)/src/lib/libelementary.la \ + @ELEMENTARY_EWEATHER_LIBS@ \ + @ELEMENTARY_EDBUS_LIBS@ \ + @ELEMENTARY_EFREET_LIBS@ \ + @ELEMENTARY_EMAP_LIBS@ \ + @ELEMENTARY_LIBS@ \ + @EIO_LIBS@ \ + @ELEMENTARY_WEB_LIBS@ \ + @my_libs@ + +elementary_testql_CFLAGS = -DELM_LIB_QUICKLAUNCH=1 +elementary_testql_LDFLAGS = +endif + +EXTRA_DIST = \ +test_factory.c diff --git a/libraries/elementary/src/bin/Makefile.in b/libraries/elementary/src/bin/Makefile.in new file mode 100644 index 0000000..b851015 --- /dev/null +++ b/libraries/elementary/src/bin/Makefile.in @@ -0,0 +1,3503 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = @ELEMENTARY_TEST_PRG@ @ELEMENTARY_CONFIG_PRG@ \ + $(am__EXEEXT_1) +@BUILD_QUICKLAUNCH_TRUE@am__append_1 = elementary_quicklaunch elementary_run elementary_testql +EXTRA_PROGRAMS = elementary_test$(EXEEXT) elementary_config$(EXEEXT) +@HAVE_EIO_TRUE@am__append_2 = test_eio.c +subdir = src/bin +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/efl_binary.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/elementary_config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(elementary_testqldir)" \ + "$(DESTDIR)$(bindir)" +LTLIBRARIES = $(elementary_testql_LTLIBRARIES) +@BUILD_QUICKLAUNCH_TRUE@elementary_testql_la_DEPENDENCIES = $(top_builddir)/src/lib/libelementary.la +am__elementary_testql_la_SOURCES_DIST = test.c test_3d.c \ + test_actionslider.c test_anim.c test_bg.c test_box.c \ + test_bubble.c test_button.c test_calendar.c test_check.c \ + test_clock.c test_cnp.c test_colorselector.c test_conform.c \ + test_ctxpopup.c test_cursor.c test_datetime.c \ + test_dayselector.c test_diskselector.c test_entry.c \ + test_entry_anchor.c test_entry_anchor2.c \ + test_fileselector_button.c test_fileselector.c \ + test_fileselector_entry.c test_flip.c test_flip_page.c \ + test_flipselector.c test_floating.c test_focus.c test_focus2.c \ + test_focus3.c test_gengrid.c test_genlist.c \ + test_gesture_layer.c test_gesture_layer2.c \ + test_gesture_layer3.c test_glview_simple.c test_glview.c \ + test_grid.c test_hover.c test_hoversel.c test_icon.c \ + test_icon_desktops.c test_icon_animated.c test_index.c \ + test_inwin.c test_label.c test_launcher.c test_layout.c \ + test_list.c test_map.c test_menu.c test_multi.c \ + test_multibuttonentry.c test_naviframe.c \ + test_naviframe_complex.c test_notify.c test_panel.c \ + test_panes.c test_photo.c test_photocam.c test_popup.c \ + test_progressbar.c test_radio.c test_scaling.c test_scroller.c \ + test_segment_control.c test_separator.c test_slider.c \ + test_slideshow.c test_spinner.c test_store.c test_table.c \ + test_thumb.c test_toolbar.c test_tooltip.c test_transit.c \ + test_video.c test_weather.c test_web.c test_win_inline.c \ + test_win_socket.c test_win_plug.c test_win_state.c test.h \ + test_eio.c +@HAVE_EIO_TRUE@am__objects_1 = elementary_testql_la-test_eio.lo +am__objects_2 = elementary_testql_la-test.lo \ + elementary_testql_la-test_3d.lo \ + elementary_testql_la-test_actionslider.lo \ + elementary_testql_la-test_anim.lo \ + elementary_testql_la-test_bg.lo \ + elementary_testql_la-test_box.lo \ + elementary_testql_la-test_bubble.lo \ + elementary_testql_la-test_button.lo \ + elementary_testql_la-test_calendar.lo \ + elementary_testql_la-test_check.lo \ + elementary_testql_la-test_clock.lo \ + elementary_testql_la-test_cnp.lo \ + elementary_testql_la-test_colorselector.lo \ + elementary_testql_la-test_conform.lo \ + elementary_testql_la-test_ctxpopup.lo \ + elementary_testql_la-test_cursor.lo \ + elementary_testql_la-test_datetime.lo \ + elementary_testql_la-test_dayselector.lo \ + elementary_testql_la-test_diskselector.lo \ + elementary_testql_la-test_entry.lo \ + elementary_testql_la-test_entry_anchor.lo \ + elementary_testql_la-test_entry_anchor2.lo \ + elementary_testql_la-test_fileselector_button.lo \ + elementary_testql_la-test_fileselector.lo \ + elementary_testql_la-test_fileselector_entry.lo \ + elementary_testql_la-test_flip.lo \ + elementary_testql_la-test_flip_page.lo \ + elementary_testql_la-test_flipselector.lo \ + elementary_testql_la-test_floating.lo \ + elementary_testql_la-test_focus.lo \ + elementary_testql_la-test_focus2.lo \ + elementary_testql_la-test_focus3.lo \ + elementary_testql_la-test_gengrid.lo \ + elementary_testql_la-test_genlist.lo \ + elementary_testql_la-test_gesture_layer.lo \ + elementary_testql_la-test_gesture_layer2.lo \ + elementary_testql_la-test_gesture_layer3.lo \ + elementary_testql_la-test_glview_simple.lo \ + elementary_testql_la-test_glview.lo \ + elementary_testql_la-test_grid.lo \ + elementary_testql_la-test_hover.lo \ + elementary_testql_la-test_hoversel.lo \ + elementary_testql_la-test_icon.lo \ + elementary_testql_la-test_icon_desktops.lo \ + elementary_testql_la-test_icon_animated.lo \ + elementary_testql_la-test_index.lo \ + elementary_testql_la-test_inwin.lo \ + elementary_testql_la-test_label.lo \ + elementary_testql_la-test_launcher.lo \ + elementary_testql_la-test_layout.lo \ + elementary_testql_la-test_list.lo \ + elementary_testql_la-test_map.lo \ + elementary_testql_la-test_menu.lo \ + elementary_testql_la-test_multi.lo \ + elementary_testql_la-test_multibuttonentry.lo \ + elementary_testql_la-test_naviframe.lo \ + elementary_testql_la-test_naviframe_complex.lo \ + elementary_testql_la-test_notify.lo \ + elementary_testql_la-test_panel.lo \ + elementary_testql_la-test_panes.lo \ + elementary_testql_la-test_photo.lo \ + elementary_testql_la-test_photocam.lo \ + elementary_testql_la-test_popup.lo \ + elementary_testql_la-test_progressbar.lo \ + elementary_testql_la-test_radio.lo \ + elementary_testql_la-test_scaling.lo \ + elementary_testql_la-test_scroller.lo \ + elementary_testql_la-test_segment_control.lo \ + elementary_testql_la-test_separator.lo \ + elementary_testql_la-test_slider.lo \ + elementary_testql_la-test_slideshow.lo \ + elementary_testql_la-test_spinner.lo \ + elementary_testql_la-test_store.lo \ + elementary_testql_la-test_table.lo \ + elementary_testql_la-test_thumb.lo \ + elementary_testql_la-test_toolbar.lo \ + elementary_testql_la-test_tooltip.lo \ + elementary_testql_la-test_transit.lo \ + elementary_testql_la-test_video.lo \ + elementary_testql_la-test_weather.lo \ + elementary_testql_la-test_web.lo \ + elementary_testql_la-test_win_inline.lo \ + elementary_testql_la-test_win_socket.lo \ + elementary_testql_la-test_win_plug.lo \ + elementary_testql_la-test_win_state.lo $(am__objects_1) +@BUILD_QUICKLAUNCH_TRUE@am_elementary_testql_la_OBJECTS = \ +@BUILD_QUICKLAUNCH_TRUE@ $(am__objects_2) +elementary_testql_la_OBJECTS = $(am_elementary_testql_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +elementary_testql_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(elementary_testql_la_CFLAGS) $(CFLAGS) \ + $(elementary_testql_la_LDFLAGS) $(LDFLAGS) -o $@ +@BUILD_QUICKLAUNCH_TRUE@am_elementary_testql_la_rpath = -rpath \ +@BUILD_QUICKLAUNCH_TRUE@ $(elementary_testqldir) +@BUILD_QUICKLAUNCH_TRUE@am__EXEEXT_1 = \ +@BUILD_QUICKLAUNCH_TRUE@ elementary_quicklaunch$(EXEEXT) \ +@BUILD_QUICKLAUNCH_TRUE@ elementary_run$(EXEEXT) \ +@BUILD_QUICKLAUNCH_TRUE@ elementary_testql$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) +am_elementary_config_OBJECTS = config.$(OBJEXT) +elementary_config_OBJECTS = $(am_elementary_config_OBJECTS) +elementary_config_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +elementary_config_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(elementary_config_LDFLAGS) $(LDFLAGS) \ + -o $@ +am__elementary_quicklaunch_SOURCES_DIST = quicklaunch.c +@BUILD_QUICKLAUNCH_TRUE@am_elementary_quicklaunch_OBJECTS = \ +@BUILD_QUICKLAUNCH_TRUE@ quicklaunch.$(OBJEXT) +elementary_quicklaunch_OBJECTS = $(am_elementary_quicklaunch_OBJECTS) +@BUILD_QUICKLAUNCH_TRUE@elementary_quicklaunch_DEPENDENCIES = $(top_builddir)/src/lib/libelementary.la +elementary_quicklaunch_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(elementary_quicklaunch_LDFLAGS) \ + $(LDFLAGS) -o $@ +am__elementary_run_SOURCES_DIST = run.c +@BUILD_QUICKLAUNCH_TRUE@@BUILD_RUN_TRUE@am_elementary_run_OBJECTS = \ +@BUILD_QUICKLAUNCH_TRUE@@BUILD_RUN_TRUE@ run.$(OBJEXT) +elementary_run_OBJECTS = $(am_elementary_run_OBJECTS) +elementary_run_DEPENDENCIES = +elementary_run_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(elementary_run_LDFLAGS) $(LDFLAGS) -o \ + $@ +am__elementary_test_SOURCES_DIST = test.c test_3d.c \ + test_actionslider.c test_anim.c test_bg.c test_box.c \ + test_bubble.c test_button.c test_calendar.c test_check.c \ + test_clock.c test_cnp.c test_colorselector.c test_conform.c \ + test_ctxpopup.c test_cursor.c test_datetime.c \ + test_dayselector.c test_diskselector.c test_entry.c \ + test_entry_anchor.c test_entry_anchor2.c \ + test_fileselector_button.c test_fileselector.c \ + test_fileselector_entry.c test_flip.c test_flip_page.c \ + test_flipselector.c test_floating.c test_focus.c test_focus2.c \ + test_focus3.c test_gengrid.c test_genlist.c \ + test_gesture_layer.c test_gesture_layer2.c \ + test_gesture_layer3.c test_glview_simple.c test_glview.c \ + test_grid.c test_hover.c test_hoversel.c test_icon.c \ + test_icon_desktops.c test_icon_animated.c test_index.c \ + test_inwin.c test_label.c test_launcher.c test_layout.c \ + test_list.c test_map.c test_menu.c test_multi.c \ + test_multibuttonentry.c test_naviframe.c \ + test_naviframe_complex.c test_notify.c test_panel.c \ + test_panes.c test_photo.c test_photocam.c test_popup.c \ + test_progressbar.c test_radio.c test_scaling.c test_scroller.c \ + test_segment_control.c test_separator.c test_slider.c \ + test_slideshow.c test_spinner.c test_store.c test_table.c \ + test_thumb.c test_toolbar.c test_tooltip.c test_transit.c \ + test_video.c test_weather.c test_web.c test_win_inline.c \ + test_win_socket.c test_win_plug.c test_win_state.c test.h \ + test_eio.c +@HAVE_EIO_TRUE@am__objects_3 = test_eio.$(OBJEXT) +am_elementary_test_OBJECTS = test.$(OBJEXT) test_3d.$(OBJEXT) \ + test_actionslider.$(OBJEXT) test_anim.$(OBJEXT) \ + test_bg.$(OBJEXT) test_box.$(OBJEXT) test_bubble.$(OBJEXT) \ + test_button.$(OBJEXT) test_calendar.$(OBJEXT) \ + test_check.$(OBJEXT) test_clock.$(OBJEXT) test_cnp.$(OBJEXT) \ + test_colorselector.$(OBJEXT) test_conform.$(OBJEXT) \ + test_ctxpopup.$(OBJEXT) test_cursor.$(OBJEXT) \ + test_datetime.$(OBJEXT) test_dayselector.$(OBJEXT) \ + test_diskselector.$(OBJEXT) test_entry.$(OBJEXT) \ + test_entry_anchor.$(OBJEXT) test_entry_anchor2.$(OBJEXT) \ + test_fileselector_button.$(OBJEXT) test_fileselector.$(OBJEXT) \ + test_fileselector_entry.$(OBJEXT) test_flip.$(OBJEXT) \ + test_flip_page.$(OBJEXT) test_flipselector.$(OBJEXT) \ + test_floating.$(OBJEXT) test_focus.$(OBJEXT) \ + test_focus2.$(OBJEXT) test_focus3.$(OBJEXT) \ + test_gengrid.$(OBJEXT) test_genlist.$(OBJEXT) \ + test_gesture_layer.$(OBJEXT) test_gesture_layer2.$(OBJEXT) \ + test_gesture_layer3.$(OBJEXT) test_glview_simple.$(OBJEXT) \ + test_glview.$(OBJEXT) test_grid.$(OBJEXT) test_hover.$(OBJEXT) \ + test_hoversel.$(OBJEXT) test_icon.$(OBJEXT) \ + test_icon_desktops.$(OBJEXT) test_icon_animated.$(OBJEXT) \ + test_index.$(OBJEXT) test_inwin.$(OBJEXT) test_label.$(OBJEXT) \ + test_launcher.$(OBJEXT) test_layout.$(OBJEXT) \ + test_list.$(OBJEXT) test_map.$(OBJEXT) test_menu.$(OBJEXT) \ + test_multi.$(OBJEXT) test_multibuttonentry.$(OBJEXT) \ + test_naviframe.$(OBJEXT) test_naviframe_complex.$(OBJEXT) \ + test_notify.$(OBJEXT) test_panel.$(OBJEXT) \ + test_panes.$(OBJEXT) test_photo.$(OBJEXT) \ + test_photocam.$(OBJEXT) test_popup.$(OBJEXT) \ + test_progressbar.$(OBJEXT) test_radio.$(OBJEXT) \ + test_scaling.$(OBJEXT) test_scroller.$(OBJEXT) \ + test_segment_control.$(OBJEXT) test_separator.$(OBJEXT) \ + test_slider.$(OBJEXT) test_slideshow.$(OBJEXT) \ + test_spinner.$(OBJEXT) test_store.$(OBJEXT) \ + test_table.$(OBJEXT) test_thumb.$(OBJEXT) \ + test_toolbar.$(OBJEXT) test_tooltip.$(OBJEXT) \ + test_transit.$(OBJEXT) test_video.$(OBJEXT) \ + test_weather.$(OBJEXT) test_web.$(OBJEXT) \ + test_win_inline.$(OBJEXT) test_win_socket.$(OBJEXT) \ + test_win_plug.$(OBJEXT) test_win_state.$(OBJEXT) \ + $(am__objects_3) +elementary_test_OBJECTS = $(am_elementary_test_OBJECTS) +elementary_test_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +elementary_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(elementary_test_LDFLAGS) $(LDFLAGS) \ + -o $@ +am__elementary_testql_SOURCES_DIST = test.c test_3d.c \ + test_actionslider.c test_anim.c test_bg.c test_box.c \ + test_bubble.c test_button.c test_calendar.c test_check.c \ + test_clock.c test_cnp.c test_colorselector.c test_conform.c \ + test_ctxpopup.c test_cursor.c test_datetime.c \ + test_dayselector.c test_diskselector.c test_entry.c \ + test_entry_anchor.c test_entry_anchor2.c \ + test_fileselector_button.c test_fileselector.c \ + test_fileselector_entry.c test_flip.c test_flip_page.c \ + test_flipselector.c test_floating.c test_focus.c test_focus2.c \ + test_focus3.c test_gengrid.c test_genlist.c \ + test_gesture_layer.c test_gesture_layer2.c \ + test_gesture_layer3.c test_glview_simple.c test_glview.c \ + test_grid.c test_hover.c test_hoversel.c test_icon.c \ + test_icon_desktops.c test_icon_animated.c test_index.c \ + test_inwin.c test_label.c test_launcher.c test_layout.c \ + test_list.c test_map.c test_menu.c test_multi.c \ + test_multibuttonentry.c test_naviframe.c \ + test_naviframe_complex.c test_notify.c test_panel.c \ + test_panes.c test_photo.c test_photocam.c test_popup.c \ + test_progressbar.c test_radio.c test_scaling.c test_scroller.c \ + test_segment_control.c test_separator.c test_slider.c \ + test_slideshow.c test_spinner.c test_store.c test_table.c \ + test_thumb.c test_toolbar.c test_tooltip.c test_transit.c \ + test_video.c test_weather.c test_web.c test_win_inline.c \ + test_win_socket.c test_win_plug.c test_win_state.c test.h \ + test_eio.c +@HAVE_EIO_TRUE@am__objects_4 = elementary_testql-test_eio.$(OBJEXT) +am__objects_5 = elementary_testql-test.$(OBJEXT) \ + elementary_testql-test_3d.$(OBJEXT) \ + elementary_testql-test_actionslider.$(OBJEXT) \ + elementary_testql-test_anim.$(OBJEXT) \ + elementary_testql-test_bg.$(OBJEXT) \ + elementary_testql-test_box.$(OBJEXT) \ + elementary_testql-test_bubble.$(OBJEXT) \ + elementary_testql-test_button.$(OBJEXT) \ + elementary_testql-test_calendar.$(OBJEXT) \ + elementary_testql-test_check.$(OBJEXT) \ + elementary_testql-test_clock.$(OBJEXT) \ + elementary_testql-test_cnp.$(OBJEXT) \ + elementary_testql-test_colorselector.$(OBJEXT) \ + elementary_testql-test_conform.$(OBJEXT) \ + elementary_testql-test_ctxpopup.$(OBJEXT) \ + elementary_testql-test_cursor.$(OBJEXT) \ + elementary_testql-test_datetime.$(OBJEXT) \ + elementary_testql-test_dayselector.$(OBJEXT) \ + elementary_testql-test_diskselector.$(OBJEXT) \ + elementary_testql-test_entry.$(OBJEXT) \ + elementary_testql-test_entry_anchor.$(OBJEXT) \ + elementary_testql-test_entry_anchor2.$(OBJEXT) \ + elementary_testql-test_fileselector_button.$(OBJEXT) \ + elementary_testql-test_fileselector.$(OBJEXT) \ + elementary_testql-test_fileselector_entry.$(OBJEXT) \ + elementary_testql-test_flip.$(OBJEXT) \ + elementary_testql-test_flip_page.$(OBJEXT) \ + elementary_testql-test_flipselector.$(OBJEXT) \ + elementary_testql-test_floating.$(OBJEXT) \ + elementary_testql-test_focus.$(OBJEXT) \ + elementary_testql-test_focus2.$(OBJEXT) \ + elementary_testql-test_focus3.$(OBJEXT) \ + elementary_testql-test_gengrid.$(OBJEXT) \ + elementary_testql-test_genlist.$(OBJEXT) \ + elementary_testql-test_gesture_layer.$(OBJEXT) \ + elementary_testql-test_gesture_layer2.$(OBJEXT) \ + elementary_testql-test_gesture_layer3.$(OBJEXT) \ + elementary_testql-test_glview_simple.$(OBJEXT) \ + elementary_testql-test_glview.$(OBJEXT) \ + elementary_testql-test_grid.$(OBJEXT) \ + elementary_testql-test_hover.$(OBJEXT) \ + elementary_testql-test_hoversel.$(OBJEXT) \ + elementary_testql-test_icon.$(OBJEXT) \ + elementary_testql-test_icon_desktops.$(OBJEXT) \ + elementary_testql-test_icon_animated.$(OBJEXT) \ + elementary_testql-test_index.$(OBJEXT) \ + elementary_testql-test_inwin.$(OBJEXT) \ + elementary_testql-test_label.$(OBJEXT) \ + elementary_testql-test_launcher.$(OBJEXT) \ + elementary_testql-test_layout.$(OBJEXT) \ + elementary_testql-test_list.$(OBJEXT) \ + elementary_testql-test_map.$(OBJEXT) \ + elementary_testql-test_menu.$(OBJEXT) \ + elementary_testql-test_multi.$(OBJEXT) \ + elementary_testql-test_multibuttonentry.$(OBJEXT) \ + elementary_testql-test_naviframe.$(OBJEXT) \ + elementary_testql-test_naviframe_complex.$(OBJEXT) \ + elementary_testql-test_notify.$(OBJEXT) \ + elementary_testql-test_panel.$(OBJEXT) \ + elementary_testql-test_panes.$(OBJEXT) \ + elementary_testql-test_photo.$(OBJEXT) \ + elementary_testql-test_photocam.$(OBJEXT) \ + elementary_testql-test_popup.$(OBJEXT) \ + elementary_testql-test_progressbar.$(OBJEXT) \ + elementary_testql-test_radio.$(OBJEXT) \ + elementary_testql-test_scaling.$(OBJEXT) \ + elementary_testql-test_scroller.$(OBJEXT) \ + elementary_testql-test_segment_control.$(OBJEXT) \ + elementary_testql-test_separator.$(OBJEXT) \ + elementary_testql-test_slider.$(OBJEXT) \ + elementary_testql-test_slideshow.$(OBJEXT) \ + elementary_testql-test_spinner.$(OBJEXT) \ + elementary_testql-test_store.$(OBJEXT) \ + elementary_testql-test_table.$(OBJEXT) \ + elementary_testql-test_thumb.$(OBJEXT) \ + elementary_testql-test_toolbar.$(OBJEXT) \ + elementary_testql-test_tooltip.$(OBJEXT) \ + elementary_testql-test_transit.$(OBJEXT) \ + elementary_testql-test_video.$(OBJEXT) \ + elementary_testql-test_weather.$(OBJEXT) \ + elementary_testql-test_web.$(OBJEXT) \ + elementary_testql-test_win_inline.$(OBJEXT) \ + elementary_testql-test_win_socket.$(OBJEXT) \ + elementary_testql-test_win_plug.$(OBJEXT) \ + elementary_testql-test_win_state.$(OBJEXT) $(am__objects_4) +@BUILD_QUICKLAUNCH_TRUE@am_elementary_testql_OBJECTS = \ +@BUILD_QUICKLAUNCH_TRUE@ $(am__objects_5) +elementary_testql_OBJECTS = $(am_elementary_testql_OBJECTS) +@BUILD_QUICKLAUNCH_TRUE@elementary_testql_DEPENDENCIES = $(top_builddir)/src/lib/libelementary.la +elementary_testql_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(elementary_testql_CFLAGS) $(CFLAGS) \ + $(elementary_testql_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(elementary_testql_la_SOURCES) $(elementary_config_SOURCES) \ + $(elementary_quicklaunch_SOURCES) $(elementary_run_SOURCES) \ + $(elementary_test_SOURCES) $(elementary_testql_SOURCES) +DIST_SOURCES = $(am__elementary_testql_la_SOURCES_DIST) \ + $(elementary_config_SOURCES) \ + $(am__elementary_quicklaunch_SOURCES_DIST) \ + $(am__elementary_run_SOURCES_DIST) \ + $(am__elementary_test_SOURCES_DIST) \ + $(am__elementary_testql_SOURCES_DIST) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EIO_CFLAGS = @EIO_CFLAGS@ +EIO_LIBS = @EIO_LIBS@ +ELEMENTARY_CFLAGS = @ELEMENTARY_CFLAGS@ +ELEMENTARY_COCOA_CFLAGS = @ELEMENTARY_COCOA_CFLAGS@ +ELEMENTARY_COCOA_LIBS = @ELEMENTARY_COCOA_LIBS@ +ELEMENTARY_CONFIG_PRG = @ELEMENTARY_CONFIG_PRG@ +ELEMENTARY_ECORE_CON_CFLAGS = @ELEMENTARY_ECORE_CON_CFLAGS@ +ELEMENTARY_ECORE_CON_INC = @ELEMENTARY_ECORE_CON_INC@ +ELEMENTARY_ECORE_CON_LIBS = @ELEMENTARY_ECORE_CON_LIBS@ +ELEMENTARY_ECORE_IMF_CFLAGS = @ELEMENTARY_ECORE_IMF_CFLAGS@ +ELEMENTARY_ECORE_IMF_INC = @ELEMENTARY_ECORE_IMF_INC@ +ELEMENTARY_ECORE_IMF_LIBS = @ELEMENTARY_ECORE_IMF_LIBS@ +ELEMENTARY_EDBUS_CFLAGS = @ELEMENTARY_EDBUS_CFLAGS@ +ELEMENTARY_EDBUS_LIBS = @ELEMENTARY_EDBUS_LIBS@ +ELEMENTARY_EFREET_CFLAGS = @ELEMENTARY_EFREET_CFLAGS@ +ELEMENTARY_EFREET_LIBS = @ELEMENTARY_EFREET_LIBS@ +ELEMENTARY_EMAP_CFLAGS = @ELEMENTARY_EMAP_CFLAGS@ +ELEMENTARY_EMAP_LIBS = @ELEMENTARY_EMAP_LIBS@ +ELEMENTARY_ETHUMB_CFLAGS = @ELEMENTARY_ETHUMB_CFLAGS@ +ELEMENTARY_ETHUMB_LIBS = @ELEMENTARY_ETHUMB_LIBS@ +ELEMENTARY_EWEATHER_CFLAGS = @ELEMENTARY_EWEATHER_CFLAGS@ +ELEMENTARY_EWEATHER_LIBS = @ELEMENTARY_EWEATHER_LIBS@ +ELEMENTARY_FB_CFLAGS = @ELEMENTARY_FB_CFLAGS@ +ELEMENTARY_FB_LIBS = @ELEMENTARY_FB_LIBS@ +ELEMENTARY_LIBS = @ELEMENTARY_LIBS@ +ELEMENTARY_PSL1GHT_CFLAGS = @ELEMENTARY_PSL1GHT_CFLAGS@ +ELEMENTARY_PSL1GHT_LIBS = @ELEMENTARY_PSL1GHT_LIBS@ +ELEMENTARY_SDL_CFLAGS = @ELEMENTARY_SDL_CFLAGS@ +ELEMENTARY_SDL_LIBS = @ELEMENTARY_SDL_LIBS@ +ELEMENTARY_TEST_PRG = @ELEMENTARY_TEST_PRG@ +ELEMENTARY_WEB_CFLAGS = @ELEMENTARY_WEB_CFLAGS@ +ELEMENTARY_WEB_LIBS = @ELEMENTARY_WEB_LIBS@ +ELEMENTARY_WIN32_CFLAGS = @ELEMENTARY_WIN32_CFLAGS@ +ELEMENTARY_WIN32_LIBS = @ELEMENTARY_WIN32_LIBS@ +ELEMENTARY_WINCE_CFLAGS = @ELEMENTARY_WINCE_CFLAGS@ +ELEMENTARY_WINCE_LIBS = @ELEMENTARY_WINCE_LIBS@ +ELEMENTARY_X_CFLAGS = @ELEMENTARY_X_CFLAGS@ +ELEMENTARY_X_LIBS = @ELEMENTARY_X_LIBS@ +ELM_ALLOCA_H_DEF = @ELM_ALLOCA_H_DEF@ +ELM_DEBUG_DEF = @ELM_DEBUG_DEF@ +ELM_DIRENT_H_DEF = @ELM_DIRENT_H_DEF@ +ELM_EDBUS_DEF = @ELM_EDBUS_DEF@ +ELM_EFREET_DEF = @ELM_EFREET_DEF@ +ELM_EMAP_DEF = @ELM_EMAP_DEF@ +ELM_ETHUMB_DEF = @ELM_ETHUMB_DEF@ +ELM_EWEATHER_DEF = @ELM_EWEATHER_DEF@ +ELM_LIBINTL_H_DEF = @ELM_LIBINTL_H_DEF@ +ELM_UNIX_DEF = @ELM_UNIX_DEF@ +ELM_WEB_DEF = @ELM_WEB_DEF@ +ELM_WIN32_DEF = @ELM_WIN32_DEF@ +ELM_WINCE_DEF = @ELM_WINCE_DEF@ +EMOTION_CFLAGS = @EMOTION_CFLAGS@ +EMOTION_LIBS = @EMOTION_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALE_DIR = @LOCALE_DIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MODULE_ARCH = @MODULE_ARCH@ +MODULE_EDJE = @MODULE_EDJE@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +VMIN = @VMIN@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +edje_cc = @edje_cc@ +eet_eet = @eet_eet@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +my_libs = @my_libs@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirement_elm = @requirement_elm@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +AUTOMAKE_OPTIONS = 1.4 foreign +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = \ +-I$(top_srcdir) \ +-I$(top_srcdir)/src/lib \ +-I$(top_builddir)/src/lib \ +-I$(top_srcdir)/src/bin \ +-DPACKAGE_BIN_DIR=\"$(bindir)\" \ +-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ +@ELEMENTARY_CFLAGS@ \ +@ELEMENTARY_X_CFLAGS@ \ +@ELEMENTARY_FB_CFLAGS@ \ +@ELEMENTARY_WIN32_CFLAGS@ \ +@ELEMENTARY_WINCE_CFLAGS@ \ +@ELEMENTARY_EDBUS_CFLAGS@ \ +@ELEMENTARY_EFREET_CFLAGS@ \ +@ELEMENTARY_EWEATHER_CFLAGS@ \ +@ELEMENTARY_ETHUMB_CFLAGS@ \ +@ELEMENTARY_EMAP_CFLAGS@ \ +@EIO_CFLAGS@ \ +@ELEMENTARY_WEB_CFLAGS@ + +elementary_test_SOURCES = test.c test_3d.c test_actionslider.c \ + test_anim.c test_bg.c test_box.c test_bubble.c test_button.c \ + test_calendar.c test_check.c test_clock.c test_cnp.c \ + test_colorselector.c test_conform.c test_ctxpopup.c \ + test_cursor.c test_datetime.c test_dayselector.c \ + test_diskselector.c test_entry.c test_entry_anchor.c \ + test_entry_anchor2.c test_fileselector_button.c \ + test_fileselector.c test_fileselector_entry.c test_flip.c \ + test_flip_page.c test_flipselector.c test_floating.c \ + test_focus.c test_focus2.c test_focus3.c test_gengrid.c \ + test_genlist.c test_gesture_layer.c test_gesture_layer2.c \ + test_gesture_layer3.c test_glview_simple.c test_glview.c \ + test_grid.c test_hover.c test_hoversel.c test_icon.c \ + test_icon_desktops.c test_icon_animated.c test_index.c \ + test_inwin.c test_label.c test_launcher.c test_layout.c \ + test_list.c test_map.c test_menu.c test_multi.c \ + test_multibuttonentry.c test_naviframe.c \ + test_naviframe_complex.c test_notify.c test_panel.c \ + test_panes.c test_photo.c test_photocam.c test_popup.c \ + test_progressbar.c test_radio.c test_scaling.c test_scroller.c \ + test_segment_control.c test_separator.c test_slider.c \ + test_slideshow.c test_spinner.c test_store.c test_table.c \ + test_thumb.c test_toolbar.c test_tooltip.c test_transit.c \ + test_video.c test_weather.c test_web.c test_win_inline.c \ + test_win_socket.c test_win_plug.c test_win_state.c test.h \ + $(am__append_2) +elementary_test_LDADD = $(top_builddir)/src/lib/libelementary.la \ + @ELEMENTARY_EWEATHER_LIBS@ \ + @ELEMENTARY_EDBUS_LIBS@ \ + @ELEMENTARY_EFREET_LIBS@ \ + @ELEMENTARY_EMAP_LIBS@ \ + @ELEMENTARY_LIBS@ \ + @EIO_LIBS@ \ + @ELEMENTARY_WEB_LIBS@ \ + @my_libs@ + +elementary_test_LDFLAGS = +elementary_config_SOURCES = \ +config.c + +elementary_config_LDADD = $(top_builddir)/src/lib/libelementary.la \ + @ELEMENTARY_EWEATHER_LIBS@ \ + @ELEMENTARY_EDBUS_LIBS@ \ + @ELEMENTARY_EFREET_LIBS@ \ + @ELEMENTARY_EMAP_LIBS@ \ + @ELEMENTARY_LIBS@ \ + @my_libs@ + +elementary_config_LDFLAGS = +@BUILD_QUICKLAUNCH_TRUE@elementary_quicklaunch_SOURCES = quicklaunch.c +@BUILD_QUICKLAUNCH_TRUE@elementary_quicklaunch_LDADD = $(top_builddir)/src/lib/libelementary.la \ +@BUILD_QUICKLAUNCH_TRUE@ @ELEMENTARY_EWEATHER_LIBS@ \ +@BUILD_QUICKLAUNCH_TRUE@ @ELEMENTARY_EDBUS_LIBS@ \ +@BUILD_QUICKLAUNCH_TRUE@ @ELEMENTARY_EFREET_LIBS@ \ +@BUILD_QUICKLAUNCH_TRUE@ @ELEMENTARY_EMAP_LIBS@ \ +@BUILD_QUICKLAUNCH_TRUE@ @ELEMENTARY_LIBS@ \ +@BUILD_QUICKLAUNCH_TRUE@ @my_libs@ + +@BUILD_QUICKLAUNCH_TRUE@elementary_quicklaunch_LDFLAGS = +@BUILD_QUICKLAUNCH_TRUE@@BUILD_RUN_TRUE@elementary_run_SOURCES = run.c +@BUILD_QUICKLAUNCH_TRUE@@BUILD_RUN_TRUE@elementary_run_LDADD = +@BUILD_QUICKLAUNCH_TRUE@@BUILD_RUN_TRUE@elementary_run_LDFLAGS = + +# build the shared lib version - libtool produces a .a and .la file as well +# as a .so - these get put in libdir ($PREFIX/lib) as elementary_testql.so +# etc. - this is where elementary will expect to find the .so's for +# quicklaunch apps. +@BUILD_QUICKLAUNCH_TRUE@elementary_testqldir = $(libdir) +@BUILD_QUICKLAUNCH_TRUE@elementary_testql_LTLIBRARIES = elementary_testql.la +@BUILD_QUICKLAUNCH_TRUE@elementary_testql_la_SOURCES = $(elementary_test_SOURCES) +@BUILD_QUICKLAUNCH_TRUE@elementary_testql_la_LIBADD = $(top_builddir)/src/lib/libelementary.la \ +@BUILD_QUICKLAUNCH_TRUE@ @ELEMENTARY_EWEATHER_LIBS@ \ +@BUILD_QUICKLAUNCH_TRUE@ @ELEMENTARY_EDBUS_LIBS@ \ +@BUILD_QUICKLAUNCH_TRUE@ @ELEMENTARY_EFREET_LIBS@ \ +@BUILD_QUICKLAUNCH_TRUE@ @ELEMENTARY_EMAP_LIBS@ \ +@BUILD_QUICKLAUNCH_TRUE@ @ELEMENTARY_LIBS@ \ +@BUILD_QUICKLAUNCH_TRUE@ @EIO_LIBS@ \ +@BUILD_QUICKLAUNCH_TRUE@ @ELEMENTARY_WEB_LIBS@ \ +@BUILD_QUICKLAUNCH_TRUE@ @my_libs@ + +@BUILD_QUICKLAUNCH_TRUE@elementary_testql_la_CFLAGS = +@BUILD_QUICKLAUNCH_TRUE@elementary_testql_la_LDFLAGS = -module -avoid-version -no-undefined +@BUILD_QUICKLAUNCH_TRUE@elementary_testql_SOURCES = $(elementary_test_SOURCES) +@BUILD_QUICKLAUNCH_TRUE@elementary_testql_LDADD = $(top_builddir)/src/lib/libelementary.la \ +@BUILD_QUICKLAUNCH_TRUE@ @ELEMENTARY_EWEATHER_LIBS@ \ +@BUILD_QUICKLAUNCH_TRUE@ @ELEMENTARY_EDBUS_LIBS@ \ +@BUILD_QUICKLAUNCH_TRUE@ @ELEMENTARY_EFREET_LIBS@ \ +@BUILD_QUICKLAUNCH_TRUE@ @ELEMENTARY_EMAP_LIBS@ \ +@BUILD_QUICKLAUNCH_TRUE@ @ELEMENTARY_LIBS@ \ +@BUILD_QUICKLAUNCH_TRUE@ @EIO_LIBS@ \ +@BUILD_QUICKLAUNCH_TRUE@ @ELEMENTARY_WEB_LIBS@ \ +@BUILD_QUICKLAUNCH_TRUE@ @my_libs@ + +@BUILD_QUICKLAUNCH_TRUE@elementary_testql_CFLAGS = -DELM_LIB_QUICKLAUNCH=1 +@BUILD_QUICKLAUNCH_TRUE@elementary_testql_LDFLAGS = +EXTRA_DIST = \ +test_factory.c + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/bin/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/bin/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-elementary_testqlLTLIBRARIES: $(elementary_testql_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(elementary_testqldir)" || $(MKDIR_P) "$(DESTDIR)$(elementary_testqldir)" + @list='$(elementary_testql_LTLIBRARIES)'; test -n "$(elementary_testqldir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(elementary_testqldir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(elementary_testqldir)"; \ + } + +uninstall-elementary_testqlLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(elementary_testql_LTLIBRARIES)'; test -n "$(elementary_testqldir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(elementary_testqldir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(elementary_testqldir)/$$f"; \ + done + +clean-elementary_testqlLTLIBRARIES: + -test -z "$(elementary_testql_LTLIBRARIES)" || rm -f $(elementary_testql_LTLIBRARIES) + @list='$(elementary_testql_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +elementary_testql.la: $(elementary_testql_la_OBJECTS) $(elementary_testql_la_DEPENDENCIES) + $(AM_V_CCLD)$(elementary_testql_la_LINK) $(am_elementary_testql_la_rpath) $(elementary_testql_la_OBJECTS) $(elementary_testql_la_LIBADD) $(LIBS) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +elementary_config$(EXEEXT): $(elementary_config_OBJECTS) $(elementary_config_DEPENDENCIES) + @rm -f elementary_config$(EXEEXT) + $(AM_V_CCLD)$(elementary_config_LINK) $(elementary_config_OBJECTS) $(elementary_config_LDADD) $(LIBS) +elementary_quicklaunch$(EXEEXT): $(elementary_quicklaunch_OBJECTS) $(elementary_quicklaunch_DEPENDENCIES) + @rm -f elementary_quicklaunch$(EXEEXT) + $(AM_V_CCLD)$(elementary_quicklaunch_LINK) $(elementary_quicklaunch_OBJECTS) $(elementary_quicklaunch_LDADD) $(LIBS) +elementary_run$(EXEEXT): $(elementary_run_OBJECTS) $(elementary_run_DEPENDENCIES) + @rm -f elementary_run$(EXEEXT) + $(AM_V_CCLD)$(elementary_run_LINK) $(elementary_run_OBJECTS) $(elementary_run_LDADD) $(LIBS) +elementary_test$(EXEEXT): $(elementary_test_OBJECTS) $(elementary_test_DEPENDENCIES) + @rm -f elementary_test$(EXEEXT) + $(AM_V_CCLD)$(elementary_test_LINK) $(elementary_test_OBJECTS) $(elementary_test_LDADD) $(LIBS) +elementary_testql$(EXEEXT): $(elementary_testql_OBJECTS) $(elementary_testql_DEPENDENCIES) + @rm -f elementary_testql$(EXEEXT) + $(AM_V_CCLD)$(elementary_testql_LINK) $(elementary_testql_OBJECTS) $(elementary_testql_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/config.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_3d.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_actionslider.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_anim.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_bg.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_box.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_bubble.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_button.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_calendar.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_check.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_clock.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_cnp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_colorselector.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_conform.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_ctxpopup.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_cursor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_datetime.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_dayselector.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_diskselector.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_eio.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_entry.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_entry_anchor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_entry_anchor2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_fileselector.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_fileselector_button.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_fileselector_entry.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_flip.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_flip_page.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_flipselector.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_floating.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_focus.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_focus2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_focus3.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_gengrid.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_genlist.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_gesture_layer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_gesture_layer2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_gesture_layer3.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_glview.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_glview_simple.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_grid.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_hover.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_hoversel.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_icon.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_icon_animated.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_icon_desktops.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_index.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_inwin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_label.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_launcher.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_layout.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_list.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_map.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_menu.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_multi.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_multibuttonentry.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_naviframe.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_naviframe_complex.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_notify.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_panel.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_panes.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_photo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_photocam.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_popup.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_progressbar.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_radio.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_scaling.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_scroller.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_segment_control.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_separator.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_slider.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_slideshow.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_spinner.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_store.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_table.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_thumb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_toolbar.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_tooltip.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_transit.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_video.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_weather.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_web.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_win_inline.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_win_plug.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_win_socket.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql-test_win_state.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_3d.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_actionslider.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_anim.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_bg.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_box.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_bubble.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_button.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_calendar.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_check.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_clock.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_cnp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_colorselector.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_conform.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_ctxpopup.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_cursor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_datetime.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_dayselector.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_diskselector.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_eio.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_entry.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_entry_anchor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_entry_anchor2.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_fileselector.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_fileselector_button.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_fileselector_entry.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_flip.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_flip_page.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_flipselector.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_floating.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_focus.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_focus2.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_focus3.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_gengrid.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_genlist.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_gesture_layer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_gesture_layer2.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_gesture_layer3.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_glview.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_glview_simple.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_grid.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_hover.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_hoversel.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_icon.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_icon_animated.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_icon_desktops.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_index.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_inwin.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_label.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_launcher.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_layout.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_list.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_map.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_menu.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_multi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_multibuttonentry.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_naviframe.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_naviframe_complex.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_notify.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_panel.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_panes.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_photo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_photocam.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_popup.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_progressbar.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_radio.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_scaling.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_scroller.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_segment_control.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_separator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_slider.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_slideshow.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_spinner.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_store.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_table.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_thumb.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_toolbar.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_tooltip.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_transit.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_video.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_weather.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_web.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_win_inline.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_win_plug.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_win_socket.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementary_testql_la-test_win_state.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quicklaunch.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_3d.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_actionslider.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_anim.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_bg.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_box.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_bubble.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_button.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_calendar.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_check.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_clock.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_cnp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_colorselector.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conform.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_ctxpopup.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_cursor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_datetime.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_dayselector.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_diskselector.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_eio.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_entry.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_entry_anchor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_entry_anchor2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_fileselector.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_fileselector_button.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_fileselector_entry.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_flip.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_flip_page.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_flipselector.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_floating.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_focus.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_focus2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_focus3.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_gengrid.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_genlist.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_gesture_layer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_gesture_layer2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_gesture_layer3.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_glview.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_glview_simple.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_grid.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_hover.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_hoversel.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_icon.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_icon_animated.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_icon_desktops.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_index.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_inwin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_label.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_launcher.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_layout.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_list.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_map.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_menu.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_multi.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_multibuttonentry.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_naviframe.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_naviframe_complex.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_notify.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_panel.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_panes.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_photo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_photocam.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_popup.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_progressbar.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_radio.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_scaling.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_scroller.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_segment_control.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_separator.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_slider.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_slideshow.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_spinner.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_store.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_table.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_thumb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_toolbar.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_tooltip.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_transit.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_video.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_weather.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_web.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_win_inline.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_win_plug.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_win_socket.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_win_state.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +elementary_testql_la-test.lo: test.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test.Tpo -c -o elementary_testql_la-test.lo `test -f 'test.c' || echo '$(srcdir)/'`test.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test.Tpo $(DEPDIR)/elementary_testql_la-test.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test.c' object='elementary_testql_la-test.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test.lo `test -f 'test.c' || echo '$(srcdir)/'`test.c + +elementary_testql_la-test_3d.lo: test_3d.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_3d.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_3d.Tpo -c -o elementary_testql_la-test_3d.lo `test -f 'test_3d.c' || echo '$(srcdir)/'`test_3d.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_3d.Tpo $(DEPDIR)/elementary_testql_la-test_3d.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_3d.c' object='elementary_testql_la-test_3d.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_3d.lo `test -f 'test_3d.c' || echo '$(srcdir)/'`test_3d.c + +elementary_testql_la-test_actionslider.lo: test_actionslider.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_actionslider.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_actionslider.Tpo -c -o elementary_testql_la-test_actionslider.lo `test -f 'test_actionslider.c' || echo '$(srcdir)/'`test_actionslider.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_actionslider.Tpo $(DEPDIR)/elementary_testql_la-test_actionslider.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_actionslider.c' object='elementary_testql_la-test_actionslider.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_actionslider.lo `test -f 'test_actionslider.c' || echo '$(srcdir)/'`test_actionslider.c + +elementary_testql_la-test_anim.lo: test_anim.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_anim.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_anim.Tpo -c -o elementary_testql_la-test_anim.lo `test -f 'test_anim.c' || echo '$(srcdir)/'`test_anim.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_anim.Tpo $(DEPDIR)/elementary_testql_la-test_anim.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_anim.c' object='elementary_testql_la-test_anim.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_anim.lo `test -f 'test_anim.c' || echo '$(srcdir)/'`test_anim.c + +elementary_testql_la-test_bg.lo: test_bg.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_bg.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_bg.Tpo -c -o elementary_testql_la-test_bg.lo `test -f 'test_bg.c' || echo '$(srcdir)/'`test_bg.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_bg.Tpo $(DEPDIR)/elementary_testql_la-test_bg.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_bg.c' object='elementary_testql_la-test_bg.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_bg.lo `test -f 'test_bg.c' || echo '$(srcdir)/'`test_bg.c + +elementary_testql_la-test_box.lo: test_box.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_box.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_box.Tpo -c -o elementary_testql_la-test_box.lo `test -f 'test_box.c' || echo '$(srcdir)/'`test_box.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_box.Tpo $(DEPDIR)/elementary_testql_la-test_box.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_box.c' object='elementary_testql_la-test_box.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_box.lo `test -f 'test_box.c' || echo '$(srcdir)/'`test_box.c + +elementary_testql_la-test_bubble.lo: test_bubble.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_bubble.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_bubble.Tpo -c -o elementary_testql_la-test_bubble.lo `test -f 'test_bubble.c' || echo '$(srcdir)/'`test_bubble.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_bubble.Tpo $(DEPDIR)/elementary_testql_la-test_bubble.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_bubble.c' object='elementary_testql_la-test_bubble.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_bubble.lo `test -f 'test_bubble.c' || echo '$(srcdir)/'`test_bubble.c + +elementary_testql_la-test_button.lo: test_button.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_button.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_button.Tpo -c -o elementary_testql_la-test_button.lo `test -f 'test_button.c' || echo '$(srcdir)/'`test_button.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_button.Tpo $(DEPDIR)/elementary_testql_la-test_button.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_button.c' object='elementary_testql_la-test_button.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_button.lo `test -f 'test_button.c' || echo '$(srcdir)/'`test_button.c + +elementary_testql_la-test_calendar.lo: test_calendar.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_calendar.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_calendar.Tpo -c -o elementary_testql_la-test_calendar.lo `test -f 'test_calendar.c' || echo '$(srcdir)/'`test_calendar.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_calendar.Tpo $(DEPDIR)/elementary_testql_la-test_calendar.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_calendar.c' object='elementary_testql_la-test_calendar.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_calendar.lo `test -f 'test_calendar.c' || echo '$(srcdir)/'`test_calendar.c + +elementary_testql_la-test_check.lo: test_check.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_check.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_check.Tpo -c -o elementary_testql_la-test_check.lo `test -f 'test_check.c' || echo '$(srcdir)/'`test_check.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_check.Tpo $(DEPDIR)/elementary_testql_la-test_check.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_check.c' object='elementary_testql_la-test_check.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_check.lo `test -f 'test_check.c' || echo '$(srcdir)/'`test_check.c + +elementary_testql_la-test_clock.lo: test_clock.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_clock.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_clock.Tpo -c -o elementary_testql_la-test_clock.lo `test -f 'test_clock.c' || echo '$(srcdir)/'`test_clock.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_clock.Tpo $(DEPDIR)/elementary_testql_la-test_clock.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_clock.c' object='elementary_testql_la-test_clock.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_clock.lo `test -f 'test_clock.c' || echo '$(srcdir)/'`test_clock.c + +elementary_testql_la-test_cnp.lo: test_cnp.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_cnp.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_cnp.Tpo -c -o elementary_testql_la-test_cnp.lo `test -f 'test_cnp.c' || echo '$(srcdir)/'`test_cnp.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_cnp.Tpo $(DEPDIR)/elementary_testql_la-test_cnp.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_cnp.c' object='elementary_testql_la-test_cnp.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_cnp.lo `test -f 'test_cnp.c' || echo '$(srcdir)/'`test_cnp.c + +elementary_testql_la-test_colorselector.lo: test_colorselector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_colorselector.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_colorselector.Tpo -c -o elementary_testql_la-test_colorselector.lo `test -f 'test_colorselector.c' || echo '$(srcdir)/'`test_colorselector.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_colorselector.Tpo $(DEPDIR)/elementary_testql_la-test_colorselector.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_colorselector.c' object='elementary_testql_la-test_colorselector.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_colorselector.lo `test -f 'test_colorselector.c' || echo '$(srcdir)/'`test_colorselector.c + +elementary_testql_la-test_conform.lo: test_conform.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_conform.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_conform.Tpo -c -o elementary_testql_la-test_conform.lo `test -f 'test_conform.c' || echo '$(srcdir)/'`test_conform.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_conform.Tpo $(DEPDIR)/elementary_testql_la-test_conform.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_conform.c' object='elementary_testql_la-test_conform.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_conform.lo `test -f 'test_conform.c' || echo '$(srcdir)/'`test_conform.c + +elementary_testql_la-test_ctxpopup.lo: test_ctxpopup.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_ctxpopup.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_ctxpopup.Tpo -c -o elementary_testql_la-test_ctxpopup.lo `test -f 'test_ctxpopup.c' || echo '$(srcdir)/'`test_ctxpopup.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_ctxpopup.Tpo $(DEPDIR)/elementary_testql_la-test_ctxpopup.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_ctxpopup.c' object='elementary_testql_la-test_ctxpopup.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_ctxpopup.lo `test -f 'test_ctxpopup.c' || echo '$(srcdir)/'`test_ctxpopup.c + +elementary_testql_la-test_cursor.lo: test_cursor.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_cursor.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_cursor.Tpo -c -o elementary_testql_la-test_cursor.lo `test -f 'test_cursor.c' || echo '$(srcdir)/'`test_cursor.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_cursor.Tpo $(DEPDIR)/elementary_testql_la-test_cursor.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_cursor.c' object='elementary_testql_la-test_cursor.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_cursor.lo `test -f 'test_cursor.c' || echo '$(srcdir)/'`test_cursor.c + +elementary_testql_la-test_datetime.lo: test_datetime.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_datetime.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_datetime.Tpo -c -o elementary_testql_la-test_datetime.lo `test -f 'test_datetime.c' || echo '$(srcdir)/'`test_datetime.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_datetime.Tpo $(DEPDIR)/elementary_testql_la-test_datetime.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_datetime.c' object='elementary_testql_la-test_datetime.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_datetime.lo `test -f 'test_datetime.c' || echo '$(srcdir)/'`test_datetime.c + +elementary_testql_la-test_dayselector.lo: test_dayselector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_dayselector.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_dayselector.Tpo -c -o elementary_testql_la-test_dayselector.lo `test -f 'test_dayselector.c' || echo '$(srcdir)/'`test_dayselector.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_dayselector.Tpo $(DEPDIR)/elementary_testql_la-test_dayselector.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_dayselector.c' object='elementary_testql_la-test_dayselector.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_dayselector.lo `test -f 'test_dayselector.c' || echo '$(srcdir)/'`test_dayselector.c + +elementary_testql_la-test_diskselector.lo: test_diskselector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_diskselector.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_diskselector.Tpo -c -o elementary_testql_la-test_diskselector.lo `test -f 'test_diskselector.c' || echo '$(srcdir)/'`test_diskselector.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_diskselector.Tpo $(DEPDIR)/elementary_testql_la-test_diskselector.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_diskselector.c' object='elementary_testql_la-test_diskselector.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_diskselector.lo `test -f 'test_diskselector.c' || echo '$(srcdir)/'`test_diskselector.c + +elementary_testql_la-test_entry.lo: test_entry.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_entry.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_entry.Tpo -c -o elementary_testql_la-test_entry.lo `test -f 'test_entry.c' || echo '$(srcdir)/'`test_entry.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_entry.Tpo $(DEPDIR)/elementary_testql_la-test_entry.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_entry.c' object='elementary_testql_la-test_entry.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_entry.lo `test -f 'test_entry.c' || echo '$(srcdir)/'`test_entry.c + +elementary_testql_la-test_entry_anchor.lo: test_entry_anchor.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_entry_anchor.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_entry_anchor.Tpo -c -o elementary_testql_la-test_entry_anchor.lo `test -f 'test_entry_anchor.c' || echo '$(srcdir)/'`test_entry_anchor.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_entry_anchor.Tpo $(DEPDIR)/elementary_testql_la-test_entry_anchor.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_entry_anchor.c' object='elementary_testql_la-test_entry_anchor.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_entry_anchor.lo `test -f 'test_entry_anchor.c' || echo '$(srcdir)/'`test_entry_anchor.c + +elementary_testql_la-test_entry_anchor2.lo: test_entry_anchor2.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_entry_anchor2.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_entry_anchor2.Tpo -c -o elementary_testql_la-test_entry_anchor2.lo `test -f 'test_entry_anchor2.c' || echo '$(srcdir)/'`test_entry_anchor2.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_entry_anchor2.Tpo $(DEPDIR)/elementary_testql_la-test_entry_anchor2.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_entry_anchor2.c' object='elementary_testql_la-test_entry_anchor2.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_entry_anchor2.lo `test -f 'test_entry_anchor2.c' || echo '$(srcdir)/'`test_entry_anchor2.c + +elementary_testql_la-test_fileselector_button.lo: test_fileselector_button.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_fileselector_button.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_fileselector_button.Tpo -c -o elementary_testql_la-test_fileselector_button.lo `test -f 'test_fileselector_button.c' || echo '$(srcdir)/'`test_fileselector_button.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_fileselector_button.Tpo $(DEPDIR)/elementary_testql_la-test_fileselector_button.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_fileselector_button.c' object='elementary_testql_la-test_fileselector_button.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_fileselector_button.lo `test -f 'test_fileselector_button.c' || echo '$(srcdir)/'`test_fileselector_button.c + +elementary_testql_la-test_fileselector.lo: test_fileselector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_fileselector.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_fileselector.Tpo -c -o elementary_testql_la-test_fileselector.lo `test -f 'test_fileselector.c' || echo '$(srcdir)/'`test_fileselector.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_fileselector.Tpo $(DEPDIR)/elementary_testql_la-test_fileselector.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_fileselector.c' object='elementary_testql_la-test_fileselector.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_fileselector.lo `test -f 'test_fileselector.c' || echo '$(srcdir)/'`test_fileselector.c + +elementary_testql_la-test_fileselector_entry.lo: test_fileselector_entry.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_fileselector_entry.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_fileselector_entry.Tpo -c -o elementary_testql_la-test_fileselector_entry.lo `test -f 'test_fileselector_entry.c' || echo '$(srcdir)/'`test_fileselector_entry.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_fileselector_entry.Tpo $(DEPDIR)/elementary_testql_la-test_fileselector_entry.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_fileselector_entry.c' object='elementary_testql_la-test_fileselector_entry.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_fileselector_entry.lo `test -f 'test_fileselector_entry.c' || echo '$(srcdir)/'`test_fileselector_entry.c + +elementary_testql_la-test_flip.lo: test_flip.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_flip.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_flip.Tpo -c -o elementary_testql_la-test_flip.lo `test -f 'test_flip.c' || echo '$(srcdir)/'`test_flip.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_flip.Tpo $(DEPDIR)/elementary_testql_la-test_flip.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_flip.c' object='elementary_testql_la-test_flip.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_flip.lo `test -f 'test_flip.c' || echo '$(srcdir)/'`test_flip.c + +elementary_testql_la-test_flip_page.lo: test_flip_page.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_flip_page.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_flip_page.Tpo -c -o elementary_testql_la-test_flip_page.lo `test -f 'test_flip_page.c' || echo '$(srcdir)/'`test_flip_page.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_flip_page.Tpo $(DEPDIR)/elementary_testql_la-test_flip_page.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_flip_page.c' object='elementary_testql_la-test_flip_page.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_flip_page.lo `test -f 'test_flip_page.c' || echo '$(srcdir)/'`test_flip_page.c + +elementary_testql_la-test_flipselector.lo: test_flipselector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_flipselector.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_flipselector.Tpo -c -o elementary_testql_la-test_flipselector.lo `test -f 'test_flipselector.c' || echo '$(srcdir)/'`test_flipselector.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_flipselector.Tpo $(DEPDIR)/elementary_testql_la-test_flipselector.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_flipselector.c' object='elementary_testql_la-test_flipselector.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_flipselector.lo `test -f 'test_flipselector.c' || echo '$(srcdir)/'`test_flipselector.c + +elementary_testql_la-test_floating.lo: test_floating.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_floating.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_floating.Tpo -c -o elementary_testql_la-test_floating.lo `test -f 'test_floating.c' || echo '$(srcdir)/'`test_floating.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_floating.Tpo $(DEPDIR)/elementary_testql_la-test_floating.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_floating.c' object='elementary_testql_la-test_floating.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_floating.lo `test -f 'test_floating.c' || echo '$(srcdir)/'`test_floating.c + +elementary_testql_la-test_focus.lo: test_focus.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_focus.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_focus.Tpo -c -o elementary_testql_la-test_focus.lo `test -f 'test_focus.c' || echo '$(srcdir)/'`test_focus.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_focus.Tpo $(DEPDIR)/elementary_testql_la-test_focus.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_focus.c' object='elementary_testql_la-test_focus.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_focus.lo `test -f 'test_focus.c' || echo '$(srcdir)/'`test_focus.c + +elementary_testql_la-test_focus2.lo: test_focus2.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_focus2.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_focus2.Tpo -c -o elementary_testql_la-test_focus2.lo `test -f 'test_focus2.c' || echo '$(srcdir)/'`test_focus2.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_focus2.Tpo $(DEPDIR)/elementary_testql_la-test_focus2.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_focus2.c' object='elementary_testql_la-test_focus2.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_focus2.lo `test -f 'test_focus2.c' || echo '$(srcdir)/'`test_focus2.c + +elementary_testql_la-test_focus3.lo: test_focus3.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_focus3.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_focus3.Tpo -c -o elementary_testql_la-test_focus3.lo `test -f 'test_focus3.c' || echo '$(srcdir)/'`test_focus3.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_focus3.Tpo $(DEPDIR)/elementary_testql_la-test_focus3.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_focus3.c' object='elementary_testql_la-test_focus3.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_focus3.lo `test -f 'test_focus3.c' || echo '$(srcdir)/'`test_focus3.c + +elementary_testql_la-test_gengrid.lo: test_gengrid.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_gengrid.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_gengrid.Tpo -c -o elementary_testql_la-test_gengrid.lo `test -f 'test_gengrid.c' || echo '$(srcdir)/'`test_gengrid.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_gengrid.Tpo $(DEPDIR)/elementary_testql_la-test_gengrid.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_gengrid.c' object='elementary_testql_la-test_gengrid.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_gengrid.lo `test -f 'test_gengrid.c' || echo '$(srcdir)/'`test_gengrid.c + +elementary_testql_la-test_genlist.lo: test_genlist.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_genlist.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_genlist.Tpo -c -o elementary_testql_la-test_genlist.lo `test -f 'test_genlist.c' || echo '$(srcdir)/'`test_genlist.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_genlist.Tpo $(DEPDIR)/elementary_testql_la-test_genlist.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_genlist.c' object='elementary_testql_la-test_genlist.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_genlist.lo `test -f 'test_genlist.c' || echo '$(srcdir)/'`test_genlist.c + +elementary_testql_la-test_gesture_layer.lo: test_gesture_layer.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_gesture_layer.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_gesture_layer.Tpo -c -o elementary_testql_la-test_gesture_layer.lo `test -f 'test_gesture_layer.c' || echo '$(srcdir)/'`test_gesture_layer.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_gesture_layer.Tpo $(DEPDIR)/elementary_testql_la-test_gesture_layer.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_gesture_layer.c' object='elementary_testql_la-test_gesture_layer.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_gesture_layer.lo `test -f 'test_gesture_layer.c' || echo '$(srcdir)/'`test_gesture_layer.c + +elementary_testql_la-test_gesture_layer2.lo: test_gesture_layer2.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_gesture_layer2.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_gesture_layer2.Tpo -c -o elementary_testql_la-test_gesture_layer2.lo `test -f 'test_gesture_layer2.c' || echo '$(srcdir)/'`test_gesture_layer2.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_gesture_layer2.Tpo $(DEPDIR)/elementary_testql_la-test_gesture_layer2.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_gesture_layer2.c' object='elementary_testql_la-test_gesture_layer2.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_gesture_layer2.lo `test -f 'test_gesture_layer2.c' || echo '$(srcdir)/'`test_gesture_layer2.c + +elementary_testql_la-test_gesture_layer3.lo: test_gesture_layer3.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_gesture_layer3.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_gesture_layer3.Tpo -c -o elementary_testql_la-test_gesture_layer3.lo `test -f 'test_gesture_layer3.c' || echo '$(srcdir)/'`test_gesture_layer3.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_gesture_layer3.Tpo $(DEPDIR)/elementary_testql_la-test_gesture_layer3.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_gesture_layer3.c' object='elementary_testql_la-test_gesture_layer3.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_gesture_layer3.lo `test -f 'test_gesture_layer3.c' || echo '$(srcdir)/'`test_gesture_layer3.c + +elementary_testql_la-test_glview_simple.lo: test_glview_simple.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_glview_simple.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_glview_simple.Tpo -c -o elementary_testql_la-test_glview_simple.lo `test -f 'test_glview_simple.c' || echo '$(srcdir)/'`test_glview_simple.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_glview_simple.Tpo $(DEPDIR)/elementary_testql_la-test_glview_simple.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_glview_simple.c' object='elementary_testql_la-test_glview_simple.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_glview_simple.lo `test -f 'test_glview_simple.c' || echo '$(srcdir)/'`test_glview_simple.c + +elementary_testql_la-test_glview.lo: test_glview.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_glview.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_glview.Tpo -c -o elementary_testql_la-test_glview.lo `test -f 'test_glview.c' || echo '$(srcdir)/'`test_glview.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_glview.Tpo $(DEPDIR)/elementary_testql_la-test_glview.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_glview.c' object='elementary_testql_la-test_glview.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_glview.lo `test -f 'test_glview.c' || echo '$(srcdir)/'`test_glview.c + +elementary_testql_la-test_grid.lo: test_grid.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_grid.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_grid.Tpo -c -o elementary_testql_la-test_grid.lo `test -f 'test_grid.c' || echo '$(srcdir)/'`test_grid.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_grid.Tpo $(DEPDIR)/elementary_testql_la-test_grid.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_grid.c' object='elementary_testql_la-test_grid.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_grid.lo `test -f 'test_grid.c' || echo '$(srcdir)/'`test_grid.c + +elementary_testql_la-test_hover.lo: test_hover.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_hover.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_hover.Tpo -c -o elementary_testql_la-test_hover.lo `test -f 'test_hover.c' || echo '$(srcdir)/'`test_hover.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_hover.Tpo $(DEPDIR)/elementary_testql_la-test_hover.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_hover.c' object='elementary_testql_la-test_hover.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_hover.lo `test -f 'test_hover.c' || echo '$(srcdir)/'`test_hover.c + +elementary_testql_la-test_hoversel.lo: test_hoversel.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_hoversel.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_hoversel.Tpo -c -o elementary_testql_la-test_hoversel.lo `test -f 'test_hoversel.c' || echo '$(srcdir)/'`test_hoversel.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_hoversel.Tpo $(DEPDIR)/elementary_testql_la-test_hoversel.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_hoversel.c' object='elementary_testql_la-test_hoversel.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_hoversel.lo `test -f 'test_hoversel.c' || echo '$(srcdir)/'`test_hoversel.c + +elementary_testql_la-test_icon.lo: test_icon.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_icon.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_icon.Tpo -c -o elementary_testql_la-test_icon.lo `test -f 'test_icon.c' || echo '$(srcdir)/'`test_icon.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_icon.Tpo $(DEPDIR)/elementary_testql_la-test_icon.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_icon.c' object='elementary_testql_la-test_icon.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_icon.lo `test -f 'test_icon.c' || echo '$(srcdir)/'`test_icon.c + +elementary_testql_la-test_icon_desktops.lo: test_icon_desktops.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_icon_desktops.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_icon_desktops.Tpo -c -o elementary_testql_la-test_icon_desktops.lo `test -f 'test_icon_desktops.c' || echo '$(srcdir)/'`test_icon_desktops.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_icon_desktops.Tpo $(DEPDIR)/elementary_testql_la-test_icon_desktops.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_icon_desktops.c' object='elementary_testql_la-test_icon_desktops.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_icon_desktops.lo `test -f 'test_icon_desktops.c' || echo '$(srcdir)/'`test_icon_desktops.c + +elementary_testql_la-test_icon_animated.lo: test_icon_animated.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_icon_animated.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_icon_animated.Tpo -c -o elementary_testql_la-test_icon_animated.lo `test -f 'test_icon_animated.c' || echo '$(srcdir)/'`test_icon_animated.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_icon_animated.Tpo $(DEPDIR)/elementary_testql_la-test_icon_animated.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_icon_animated.c' object='elementary_testql_la-test_icon_animated.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_icon_animated.lo `test -f 'test_icon_animated.c' || echo '$(srcdir)/'`test_icon_animated.c + +elementary_testql_la-test_index.lo: test_index.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_index.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_index.Tpo -c -o elementary_testql_la-test_index.lo `test -f 'test_index.c' || echo '$(srcdir)/'`test_index.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_index.Tpo $(DEPDIR)/elementary_testql_la-test_index.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_index.c' object='elementary_testql_la-test_index.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_index.lo `test -f 'test_index.c' || echo '$(srcdir)/'`test_index.c + +elementary_testql_la-test_inwin.lo: test_inwin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_inwin.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_inwin.Tpo -c -o elementary_testql_la-test_inwin.lo `test -f 'test_inwin.c' || echo '$(srcdir)/'`test_inwin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_inwin.Tpo $(DEPDIR)/elementary_testql_la-test_inwin.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_inwin.c' object='elementary_testql_la-test_inwin.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_inwin.lo `test -f 'test_inwin.c' || echo '$(srcdir)/'`test_inwin.c + +elementary_testql_la-test_label.lo: test_label.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_label.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_label.Tpo -c -o elementary_testql_la-test_label.lo `test -f 'test_label.c' || echo '$(srcdir)/'`test_label.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_label.Tpo $(DEPDIR)/elementary_testql_la-test_label.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_label.c' object='elementary_testql_la-test_label.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_label.lo `test -f 'test_label.c' || echo '$(srcdir)/'`test_label.c + +elementary_testql_la-test_launcher.lo: test_launcher.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_launcher.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_launcher.Tpo -c -o elementary_testql_la-test_launcher.lo `test -f 'test_launcher.c' || echo '$(srcdir)/'`test_launcher.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_launcher.Tpo $(DEPDIR)/elementary_testql_la-test_launcher.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_launcher.c' object='elementary_testql_la-test_launcher.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_launcher.lo `test -f 'test_launcher.c' || echo '$(srcdir)/'`test_launcher.c + +elementary_testql_la-test_layout.lo: test_layout.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_layout.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_layout.Tpo -c -o elementary_testql_la-test_layout.lo `test -f 'test_layout.c' || echo '$(srcdir)/'`test_layout.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_layout.Tpo $(DEPDIR)/elementary_testql_la-test_layout.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_layout.c' object='elementary_testql_la-test_layout.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_layout.lo `test -f 'test_layout.c' || echo '$(srcdir)/'`test_layout.c + +elementary_testql_la-test_list.lo: test_list.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_list.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_list.Tpo -c -o elementary_testql_la-test_list.lo `test -f 'test_list.c' || echo '$(srcdir)/'`test_list.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_list.Tpo $(DEPDIR)/elementary_testql_la-test_list.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_list.c' object='elementary_testql_la-test_list.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_list.lo `test -f 'test_list.c' || echo '$(srcdir)/'`test_list.c + +elementary_testql_la-test_map.lo: test_map.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_map.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_map.Tpo -c -o elementary_testql_la-test_map.lo `test -f 'test_map.c' || echo '$(srcdir)/'`test_map.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_map.Tpo $(DEPDIR)/elementary_testql_la-test_map.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_map.c' object='elementary_testql_la-test_map.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_map.lo `test -f 'test_map.c' || echo '$(srcdir)/'`test_map.c + +elementary_testql_la-test_menu.lo: test_menu.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_menu.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_menu.Tpo -c -o elementary_testql_la-test_menu.lo `test -f 'test_menu.c' || echo '$(srcdir)/'`test_menu.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_menu.Tpo $(DEPDIR)/elementary_testql_la-test_menu.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_menu.c' object='elementary_testql_la-test_menu.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_menu.lo `test -f 'test_menu.c' || echo '$(srcdir)/'`test_menu.c + +elementary_testql_la-test_multi.lo: test_multi.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_multi.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_multi.Tpo -c -o elementary_testql_la-test_multi.lo `test -f 'test_multi.c' || echo '$(srcdir)/'`test_multi.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_multi.Tpo $(DEPDIR)/elementary_testql_la-test_multi.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_multi.c' object='elementary_testql_la-test_multi.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_multi.lo `test -f 'test_multi.c' || echo '$(srcdir)/'`test_multi.c + +elementary_testql_la-test_multibuttonentry.lo: test_multibuttonentry.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_multibuttonentry.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_multibuttonentry.Tpo -c -o elementary_testql_la-test_multibuttonentry.lo `test -f 'test_multibuttonentry.c' || echo '$(srcdir)/'`test_multibuttonentry.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_multibuttonentry.Tpo $(DEPDIR)/elementary_testql_la-test_multibuttonentry.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_multibuttonentry.c' object='elementary_testql_la-test_multibuttonentry.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_multibuttonentry.lo `test -f 'test_multibuttonentry.c' || echo '$(srcdir)/'`test_multibuttonentry.c + +elementary_testql_la-test_naviframe.lo: test_naviframe.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_naviframe.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_naviframe.Tpo -c -o elementary_testql_la-test_naviframe.lo `test -f 'test_naviframe.c' || echo '$(srcdir)/'`test_naviframe.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_naviframe.Tpo $(DEPDIR)/elementary_testql_la-test_naviframe.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_naviframe.c' object='elementary_testql_la-test_naviframe.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_naviframe.lo `test -f 'test_naviframe.c' || echo '$(srcdir)/'`test_naviframe.c + +elementary_testql_la-test_naviframe_complex.lo: test_naviframe_complex.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_naviframe_complex.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_naviframe_complex.Tpo -c -o elementary_testql_la-test_naviframe_complex.lo `test -f 'test_naviframe_complex.c' || echo '$(srcdir)/'`test_naviframe_complex.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_naviframe_complex.Tpo $(DEPDIR)/elementary_testql_la-test_naviframe_complex.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_naviframe_complex.c' object='elementary_testql_la-test_naviframe_complex.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_naviframe_complex.lo `test -f 'test_naviframe_complex.c' || echo '$(srcdir)/'`test_naviframe_complex.c + +elementary_testql_la-test_notify.lo: test_notify.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_notify.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_notify.Tpo -c -o elementary_testql_la-test_notify.lo `test -f 'test_notify.c' || echo '$(srcdir)/'`test_notify.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_notify.Tpo $(DEPDIR)/elementary_testql_la-test_notify.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_notify.c' object='elementary_testql_la-test_notify.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_notify.lo `test -f 'test_notify.c' || echo '$(srcdir)/'`test_notify.c + +elementary_testql_la-test_panel.lo: test_panel.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_panel.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_panel.Tpo -c -o elementary_testql_la-test_panel.lo `test -f 'test_panel.c' || echo '$(srcdir)/'`test_panel.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_panel.Tpo $(DEPDIR)/elementary_testql_la-test_panel.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_panel.c' object='elementary_testql_la-test_panel.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_panel.lo `test -f 'test_panel.c' || echo '$(srcdir)/'`test_panel.c + +elementary_testql_la-test_panes.lo: test_panes.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_panes.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_panes.Tpo -c -o elementary_testql_la-test_panes.lo `test -f 'test_panes.c' || echo '$(srcdir)/'`test_panes.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_panes.Tpo $(DEPDIR)/elementary_testql_la-test_panes.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_panes.c' object='elementary_testql_la-test_panes.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_panes.lo `test -f 'test_panes.c' || echo '$(srcdir)/'`test_panes.c + +elementary_testql_la-test_photo.lo: test_photo.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_photo.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_photo.Tpo -c -o elementary_testql_la-test_photo.lo `test -f 'test_photo.c' || echo '$(srcdir)/'`test_photo.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_photo.Tpo $(DEPDIR)/elementary_testql_la-test_photo.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_photo.c' object='elementary_testql_la-test_photo.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_photo.lo `test -f 'test_photo.c' || echo '$(srcdir)/'`test_photo.c + +elementary_testql_la-test_photocam.lo: test_photocam.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_photocam.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_photocam.Tpo -c -o elementary_testql_la-test_photocam.lo `test -f 'test_photocam.c' || echo '$(srcdir)/'`test_photocam.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_photocam.Tpo $(DEPDIR)/elementary_testql_la-test_photocam.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_photocam.c' object='elementary_testql_la-test_photocam.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_photocam.lo `test -f 'test_photocam.c' || echo '$(srcdir)/'`test_photocam.c + +elementary_testql_la-test_popup.lo: test_popup.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_popup.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_popup.Tpo -c -o elementary_testql_la-test_popup.lo `test -f 'test_popup.c' || echo '$(srcdir)/'`test_popup.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_popup.Tpo $(DEPDIR)/elementary_testql_la-test_popup.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_popup.c' object='elementary_testql_la-test_popup.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_popup.lo `test -f 'test_popup.c' || echo '$(srcdir)/'`test_popup.c + +elementary_testql_la-test_progressbar.lo: test_progressbar.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_progressbar.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_progressbar.Tpo -c -o elementary_testql_la-test_progressbar.lo `test -f 'test_progressbar.c' || echo '$(srcdir)/'`test_progressbar.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_progressbar.Tpo $(DEPDIR)/elementary_testql_la-test_progressbar.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_progressbar.c' object='elementary_testql_la-test_progressbar.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_progressbar.lo `test -f 'test_progressbar.c' || echo '$(srcdir)/'`test_progressbar.c + +elementary_testql_la-test_radio.lo: test_radio.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_radio.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_radio.Tpo -c -o elementary_testql_la-test_radio.lo `test -f 'test_radio.c' || echo '$(srcdir)/'`test_radio.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_radio.Tpo $(DEPDIR)/elementary_testql_la-test_radio.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_radio.c' object='elementary_testql_la-test_radio.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_radio.lo `test -f 'test_radio.c' || echo '$(srcdir)/'`test_radio.c + +elementary_testql_la-test_scaling.lo: test_scaling.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_scaling.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_scaling.Tpo -c -o elementary_testql_la-test_scaling.lo `test -f 'test_scaling.c' || echo '$(srcdir)/'`test_scaling.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_scaling.Tpo $(DEPDIR)/elementary_testql_la-test_scaling.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_scaling.c' object='elementary_testql_la-test_scaling.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_scaling.lo `test -f 'test_scaling.c' || echo '$(srcdir)/'`test_scaling.c + +elementary_testql_la-test_scroller.lo: test_scroller.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_scroller.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_scroller.Tpo -c -o elementary_testql_la-test_scroller.lo `test -f 'test_scroller.c' || echo '$(srcdir)/'`test_scroller.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_scroller.Tpo $(DEPDIR)/elementary_testql_la-test_scroller.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_scroller.c' object='elementary_testql_la-test_scroller.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_scroller.lo `test -f 'test_scroller.c' || echo '$(srcdir)/'`test_scroller.c + +elementary_testql_la-test_segment_control.lo: test_segment_control.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_segment_control.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_segment_control.Tpo -c -o elementary_testql_la-test_segment_control.lo `test -f 'test_segment_control.c' || echo '$(srcdir)/'`test_segment_control.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_segment_control.Tpo $(DEPDIR)/elementary_testql_la-test_segment_control.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_segment_control.c' object='elementary_testql_la-test_segment_control.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_segment_control.lo `test -f 'test_segment_control.c' || echo '$(srcdir)/'`test_segment_control.c + +elementary_testql_la-test_separator.lo: test_separator.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_separator.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_separator.Tpo -c -o elementary_testql_la-test_separator.lo `test -f 'test_separator.c' || echo '$(srcdir)/'`test_separator.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_separator.Tpo $(DEPDIR)/elementary_testql_la-test_separator.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_separator.c' object='elementary_testql_la-test_separator.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_separator.lo `test -f 'test_separator.c' || echo '$(srcdir)/'`test_separator.c + +elementary_testql_la-test_slider.lo: test_slider.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_slider.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_slider.Tpo -c -o elementary_testql_la-test_slider.lo `test -f 'test_slider.c' || echo '$(srcdir)/'`test_slider.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_slider.Tpo $(DEPDIR)/elementary_testql_la-test_slider.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_slider.c' object='elementary_testql_la-test_slider.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_slider.lo `test -f 'test_slider.c' || echo '$(srcdir)/'`test_slider.c + +elementary_testql_la-test_slideshow.lo: test_slideshow.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_slideshow.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_slideshow.Tpo -c -o elementary_testql_la-test_slideshow.lo `test -f 'test_slideshow.c' || echo '$(srcdir)/'`test_slideshow.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_slideshow.Tpo $(DEPDIR)/elementary_testql_la-test_slideshow.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_slideshow.c' object='elementary_testql_la-test_slideshow.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_slideshow.lo `test -f 'test_slideshow.c' || echo '$(srcdir)/'`test_slideshow.c + +elementary_testql_la-test_spinner.lo: test_spinner.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_spinner.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_spinner.Tpo -c -o elementary_testql_la-test_spinner.lo `test -f 'test_spinner.c' || echo '$(srcdir)/'`test_spinner.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_spinner.Tpo $(DEPDIR)/elementary_testql_la-test_spinner.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_spinner.c' object='elementary_testql_la-test_spinner.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_spinner.lo `test -f 'test_spinner.c' || echo '$(srcdir)/'`test_spinner.c + +elementary_testql_la-test_store.lo: test_store.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_store.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_store.Tpo -c -o elementary_testql_la-test_store.lo `test -f 'test_store.c' || echo '$(srcdir)/'`test_store.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_store.Tpo $(DEPDIR)/elementary_testql_la-test_store.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_store.c' object='elementary_testql_la-test_store.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_store.lo `test -f 'test_store.c' || echo '$(srcdir)/'`test_store.c + +elementary_testql_la-test_table.lo: test_table.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_table.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_table.Tpo -c -o elementary_testql_la-test_table.lo `test -f 'test_table.c' || echo '$(srcdir)/'`test_table.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_table.Tpo $(DEPDIR)/elementary_testql_la-test_table.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_table.c' object='elementary_testql_la-test_table.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_table.lo `test -f 'test_table.c' || echo '$(srcdir)/'`test_table.c + +elementary_testql_la-test_thumb.lo: test_thumb.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_thumb.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_thumb.Tpo -c -o elementary_testql_la-test_thumb.lo `test -f 'test_thumb.c' || echo '$(srcdir)/'`test_thumb.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_thumb.Tpo $(DEPDIR)/elementary_testql_la-test_thumb.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_thumb.c' object='elementary_testql_la-test_thumb.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_thumb.lo `test -f 'test_thumb.c' || echo '$(srcdir)/'`test_thumb.c + +elementary_testql_la-test_toolbar.lo: test_toolbar.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_toolbar.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_toolbar.Tpo -c -o elementary_testql_la-test_toolbar.lo `test -f 'test_toolbar.c' || echo '$(srcdir)/'`test_toolbar.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_toolbar.Tpo $(DEPDIR)/elementary_testql_la-test_toolbar.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_toolbar.c' object='elementary_testql_la-test_toolbar.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_toolbar.lo `test -f 'test_toolbar.c' || echo '$(srcdir)/'`test_toolbar.c + +elementary_testql_la-test_tooltip.lo: test_tooltip.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_tooltip.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_tooltip.Tpo -c -o elementary_testql_la-test_tooltip.lo `test -f 'test_tooltip.c' || echo '$(srcdir)/'`test_tooltip.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_tooltip.Tpo $(DEPDIR)/elementary_testql_la-test_tooltip.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_tooltip.c' object='elementary_testql_la-test_tooltip.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_tooltip.lo `test -f 'test_tooltip.c' || echo '$(srcdir)/'`test_tooltip.c + +elementary_testql_la-test_transit.lo: test_transit.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_transit.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_transit.Tpo -c -o elementary_testql_la-test_transit.lo `test -f 'test_transit.c' || echo '$(srcdir)/'`test_transit.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_transit.Tpo $(DEPDIR)/elementary_testql_la-test_transit.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_transit.c' object='elementary_testql_la-test_transit.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_transit.lo `test -f 'test_transit.c' || echo '$(srcdir)/'`test_transit.c + +elementary_testql_la-test_video.lo: test_video.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_video.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_video.Tpo -c -o elementary_testql_la-test_video.lo `test -f 'test_video.c' || echo '$(srcdir)/'`test_video.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_video.Tpo $(DEPDIR)/elementary_testql_la-test_video.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_video.c' object='elementary_testql_la-test_video.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_video.lo `test -f 'test_video.c' || echo '$(srcdir)/'`test_video.c + +elementary_testql_la-test_weather.lo: test_weather.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_weather.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_weather.Tpo -c -o elementary_testql_la-test_weather.lo `test -f 'test_weather.c' || echo '$(srcdir)/'`test_weather.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_weather.Tpo $(DEPDIR)/elementary_testql_la-test_weather.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_weather.c' object='elementary_testql_la-test_weather.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_weather.lo `test -f 'test_weather.c' || echo '$(srcdir)/'`test_weather.c + +elementary_testql_la-test_web.lo: test_web.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_web.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_web.Tpo -c -o elementary_testql_la-test_web.lo `test -f 'test_web.c' || echo '$(srcdir)/'`test_web.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_web.Tpo $(DEPDIR)/elementary_testql_la-test_web.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_web.c' object='elementary_testql_la-test_web.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_web.lo `test -f 'test_web.c' || echo '$(srcdir)/'`test_web.c + +elementary_testql_la-test_win_inline.lo: test_win_inline.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_win_inline.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_win_inline.Tpo -c -o elementary_testql_la-test_win_inline.lo `test -f 'test_win_inline.c' || echo '$(srcdir)/'`test_win_inline.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_win_inline.Tpo $(DEPDIR)/elementary_testql_la-test_win_inline.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_win_inline.c' object='elementary_testql_la-test_win_inline.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_win_inline.lo `test -f 'test_win_inline.c' || echo '$(srcdir)/'`test_win_inline.c + +elementary_testql_la-test_win_socket.lo: test_win_socket.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_win_socket.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_win_socket.Tpo -c -o elementary_testql_la-test_win_socket.lo `test -f 'test_win_socket.c' || echo '$(srcdir)/'`test_win_socket.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_win_socket.Tpo $(DEPDIR)/elementary_testql_la-test_win_socket.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_win_socket.c' object='elementary_testql_la-test_win_socket.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_win_socket.lo `test -f 'test_win_socket.c' || echo '$(srcdir)/'`test_win_socket.c + +elementary_testql_la-test_win_plug.lo: test_win_plug.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_win_plug.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_win_plug.Tpo -c -o elementary_testql_la-test_win_plug.lo `test -f 'test_win_plug.c' || echo '$(srcdir)/'`test_win_plug.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_win_plug.Tpo $(DEPDIR)/elementary_testql_la-test_win_plug.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_win_plug.c' object='elementary_testql_la-test_win_plug.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_win_plug.lo `test -f 'test_win_plug.c' || echo '$(srcdir)/'`test_win_plug.c + +elementary_testql_la-test_win_state.lo: test_win_state.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_win_state.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_win_state.Tpo -c -o elementary_testql_la-test_win_state.lo `test -f 'test_win_state.c' || echo '$(srcdir)/'`test_win_state.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_win_state.Tpo $(DEPDIR)/elementary_testql_la-test_win_state.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_win_state.c' object='elementary_testql_la-test_win_state.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_win_state.lo `test -f 'test_win_state.c' || echo '$(srcdir)/'`test_win_state.c + +elementary_testql_la-test_eio.lo: test_eio.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -MT elementary_testql_la-test_eio.lo -MD -MP -MF $(DEPDIR)/elementary_testql_la-test_eio.Tpo -c -o elementary_testql_la-test_eio.lo `test -f 'test_eio.c' || echo '$(srcdir)/'`test_eio.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql_la-test_eio.Tpo $(DEPDIR)/elementary_testql_la-test_eio.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_eio.c' object='elementary_testql_la-test_eio.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_la_CFLAGS) $(CFLAGS) -c -o elementary_testql_la-test_eio.lo `test -f 'test_eio.c' || echo '$(srcdir)/'`test_eio.c + +elementary_testql-test.o: test.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test.o -MD -MP -MF $(DEPDIR)/elementary_testql-test.Tpo -c -o elementary_testql-test.o `test -f 'test.c' || echo '$(srcdir)/'`test.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test.Tpo $(DEPDIR)/elementary_testql-test.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test.c' object='elementary_testql-test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test.o `test -f 'test.c' || echo '$(srcdir)/'`test.c + +elementary_testql-test.obj: test.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test.Tpo -c -o elementary_testql-test.obj `if test -f 'test.c'; then $(CYGPATH_W) 'test.c'; else $(CYGPATH_W) '$(srcdir)/test.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test.Tpo $(DEPDIR)/elementary_testql-test.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test.c' object='elementary_testql-test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test.obj `if test -f 'test.c'; then $(CYGPATH_W) 'test.c'; else $(CYGPATH_W) '$(srcdir)/test.c'; fi` + +elementary_testql-test_3d.o: test_3d.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_3d.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_3d.Tpo -c -o elementary_testql-test_3d.o `test -f 'test_3d.c' || echo '$(srcdir)/'`test_3d.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_3d.Tpo $(DEPDIR)/elementary_testql-test_3d.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_3d.c' object='elementary_testql-test_3d.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_3d.o `test -f 'test_3d.c' || echo '$(srcdir)/'`test_3d.c + +elementary_testql-test_3d.obj: test_3d.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_3d.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_3d.Tpo -c -o elementary_testql-test_3d.obj `if test -f 'test_3d.c'; then $(CYGPATH_W) 'test_3d.c'; else $(CYGPATH_W) '$(srcdir)/test_3d.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_3d.Tpo $(DEPDIR)/elementary_testql-test_3d.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_3d.c' object='elementary_testql-test_3d.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_3d.obj `if test -f 'test_3d.c'; then $(CYGPATH_W) 'test_3d.c'; else $(CYGPATH_W) '$(srcdir)/test_3d.c'; fi` + +elementary_testql-test_actionslider.o: test_actionslider.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_actionslider.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_actionslider.Tpo -c -o elementary_testql-test_actionslider.o `test -f 'test_actionslider.c' || echo '$(srcdir)/'`test_actionslider.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_actionslider.Tpo $(DEPDIR)/elementary_testql-test_actionslider.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_actionslider.c' object='elementary_testql-test_actionslider.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_actionslider.o `test -f 'test_actionslider.c' || echo '$(srcdir)/'`test_actionslider.c + +elementary_testql-test_actionslider.obj: test_actionslider.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_actionslider.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_actionslider.Tpo -c -o elementary_testql-test_actionslider.obj `if test -f 'test_actionslider.c'; then $(CYGPATH_W) 'test_actionslider.c'; else $(CYGPATH_W) '$(srcdir)/test_actionslider.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_actionslider.Tpo $(DEPDIR)/elementary_testql-test_actionslider.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_actionslider.c' object='elementary_testql-test_actionslider.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_actionslider.obj `if test -f 'test_actionslider.c'; then $(CYGPATH_W) 'test_actionslider.c'; else $(CYGPATH_W) '$(srcdir)/test_actionslider.c'; fi` + +elementary_testql-test_anim.o: test_anim.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_anim.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_anim.Tpo -c -o elementary_testql-test_anim.o `test -f 'test_anim.c' || echo '$(srcdir)/'`test_anim.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_anim.Tpo $(DEPDIR)/elementary_testql-test_anim.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_anim.c' object='elementary_testql-test_anim.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_anim.o `test -f 'test_anim.c' || echo '$(srcdir)/'`test_anim.c + +elementary_testql-test_anim.obj: test_anim.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_anim.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_anim.Tpo -c -o elementary_testql-test_anim.obj `if test -f 'test_anim.c'; then $(CYGPATH_W) 'test_anim.c'; else $(CYGPATH_W) '$(srcdir)/test_anim.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_anim.Tpo $(DEPDIR)/elementary_testql-test_anim.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_anim.c' object='elementary_testql-test_anim.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_anim.obj `if test -f 'test_anim.c'; then $(CYGPATH_W) 'test_anim.c'; else $(CYGPATH_W) '$(srcdir)/test_anim.c'; fi` + +elementary_testql-test_bg.o: test_bg.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_bg.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_bg.Tpo -c -o elementary_testql-test_bg.o `test -f 'test_bg.c' || echo '$(srcdir)/'`test_bg.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_bg.Tpo $(DEPDIR)/elementary_testql-test_bg.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_bg.c' object='elementary_testql-test_bg.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_bg.o `test -f 'test_bg.c' || echo '$(srcdir)/'`test_bg.c + +elementary_testql-test_bg.obj: test_bg.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_bg.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_bg.Tpo -c -o elementary_testql-test_bg.obj `if test -f 'test_bg.c'; then $(CYGPATH_W) 'test_bg.c'; else $(CYGPATH_W) '$(srcdir)/test_bg.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_bg.Tpo $(DEPDIR)/elementary_testql-test_bg.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_bg.c' object='elementary_testql-test_bg.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_bg.obj `if test -f 'test_bg.c'; then $(CYGPATH_W) 'test_bg.c'; else $(CYGPATH_W) '$(srcdir)/test_bg.c'; fi` + +elementary_testql-test_box.o: test_box.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_box.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_box.Tpo -c -o elementary_testql-test_box.o `test -f 'test_box.c' || echo '$(srcdir)/'`test_box.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_box.Tpo $(DEPDIR)/elementary_testql-test_box.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_box.c' object='elementary_testql-test_box.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_box.o `test -f 'test_box.c' || echo '$(srcdir)/'`test_box.c + +elementary_testql-test_box.obj: test_box.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_box.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_box.Tpo -c -o elementary_testql-test_box.obj `if test -f 'test_box.c'; then $(CYGPATH_W) 'test_box.c'; else $(CYGPATH_W) '$(srcdir)/test_box.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_box.Tpo $(DEPDIR)/elementary_testql-test_box.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_box.c' object='elementary_testql-test_box.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_box.obj `if test -f 'test_box.c'; then $(CYGPATH_W) 'test_box.c'; else $(CYGPATH_W) '$(srcdir)/test_box.c'; fi` + +elementary_testql-test_bubble.o: test_bubble.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_bubble.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_bubble.Tpo -c -o elementary_testql-test_bubble.o `test -f 'test_bubble.c' || echo '$(srcdir)/'`test_bubble.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_bubble.Tpo $(DEPDIR)/elementary_testql-test_bubble.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_bubble.c' object='elementary_testql-test_bubble.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_bubble.o `test -f 'test_bubble.c' || echo '$(srcdir)/'`test_bubble.c + +elementary_testql-test_bubble.obj: test_bubble.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_bubble.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_bubble.Tpo -c -o elementary_testql-test_bubble.obj `if test -f 'test_bubble.c'; then $(CYGPATH_W) 'test_bubble.c'; else $(CYGPATH_W) '$(srcdir)/test_bubble.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_bubble.Tpo $(DEPDIR)/elementary_testql-test_bubble.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_bubble.c' object='elementary_testql-test_bubble.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_bubble.obj `if test -f 'test_bubble.c'; then $(CYGPATH_W) 'test_bubble.c'; else $(CYGPATH_W) '$(srcdir)/test_bubble.c'; fi` + +elementary_testql-test_button.o: test_button.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_button.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_button.Tpo -c -o elementary_testql-test_button.o `test -f 'test_button.c' || echo '$(srcdir)/'`test_button.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_button.Tpo $(DEPDIR)/elementary_testql-test_button.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_button.c' object='elementary_testql-test_button.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_button.o `test -f 'test_button.c' || echo '$(srcdir)/'`test_button.c + +elementary_testql-test_button.obj: test_button.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_button.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_button.Tpo -c -o elementary_testql-test_button.obj `if test -f 'test_button.c'; then $(CYGPATH_W) 'test_button.c'; else $(CYGPATH_W) '$(srcdir)/test_button.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_button.Tpo $(DEPDIR)/elementary_testql-test_button.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_button.c' object='elementary_testql-test_button.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_button.obj `if test -f 'test_button.c'; then $(CYGPATH_W) 'test_button.c'; else $(CYGPATH_W) '$(srcdir)/test_button.c'; fi` + +elementary_testql-test_calendar.o: test_calendar.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_calendar.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_calendar.Tpo -c -o elementary_testql-test_calendar.o `test -f 'test_calendar.c' || echo '$(srcdir)/'`test_calendar.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_calendar.Tpo $(DEPDIR)/elementary_testql-test_calendar.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_calendar.c' object='elementary_testql-test_calendar.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_calendar.o `test -f 'test_calendar.c' || echo '$(srcdir)/'`test_calendar.c + +elementary_testql-test_calendar.obj: test_calendar.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_calendar.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_calendar.Tpo -c -o elementary_testql-test_calendar.obj `if test -f 'test_calendar.c'; then $(CYGPATH_W) 'test_calendar.c'; else $(CYGPATH_W) '$(srcdir)/test_calendar.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_calendar.Tpo $(DEPDIR)/elementary_testql-test_calendar.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_calendar.c' object='elementary_testql-test_calendar.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_calendar.obj `if test -f 'test_calendar.c'; then $(CYGPATH_W) 'test_calendar.c'; else $(CYGPATH_W) '$(srcdir)/test_calendar.c'; fi` + +elementary_testql-test_check.o: test_check.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_check.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_check.Tpo -c -o elementary_testql-test_check.o `test -f 'test_check.c' || echo '$(srcdir)/'`test_check.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_check.Tpo $(DEPDIR)/elementary_testql-test_check.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_check.c' object='elementary_testql-test_check.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_check.o `test -f 'test_check.c' || echo '$(srcdir)/'`test_check.c + +elementary_testql-test_check.obj: test_check.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_check.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_check.Tpo -c -o elementary_testql-test_check.obj `if test -f 'test_check.c'; then $(CYGPATH_W) 'test_check.c'; else $(CYGPATH_W) '$(srcdir)/test_check.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_check.Tpo $(DEPDIR)/elementary_testql-test_check.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_check.c' object='elementary_testql-test_check.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_check.obj `if test -f 'test_check.c'; then $(CYGPATH_W) 'test_check.c'; else $(CYGPATH_W) '$(srcdir)/test_check.c'; fi` + +elementary_testql-test_clock.o: test_clock.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_clock.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_clock.Tpo -c -o elementary_testql-test_clock.o `test -f 'test_clock.c' || echo '$(srcdir)/'`test_clock.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_clock.Tpo $(DEPDIR)/elementary_testql-test_clock.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_clock.c' object='elementary_testql-test_clock.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_clock.o `test -f 'test_clock.c' || echo '$(srcdir)/'`test_clock.c + +elementary_testql-test_clock.obj: test_clock.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_clock.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_clock.Tpo -c -o elementary_testql-test_clock.obj `if test -f 'test_clock.c'; then $(CYGPATH_W) 'test_clock.c'; else $(CYGPATH_W) '$(srcdir)/test_clock.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_clock.Tpo $(DEPDIR)/elementary_testql-test_clock.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_clock.c' object='elementary_testql-test_clock.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_clock.obj `if test -f 'test_clock.c'; then $(CYGPATH_W) 'test_clock.c'; else $(CYGPATH_W) '$(srcdir)/test_clock.c'; fi` + +elementary_testql-test_cnp.o: test_cnp.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_cnp.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_cnp.Tpo -c -o elementary_testql-test_cnp.o `test -f 'test_cnp.c' || echo '$(srcdir)/'`test_cnp.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_cnp.Tpo $(DEPDIR)/elementary_testql-test_cnp.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_cnp.c' object='elementary_testql-test_cnp.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_cnp.o `test -f 'test_cnp.c' || echo '$(srcdir)/'`test_cnp.c + +elementary_testql-test_cnp.obj: test_cnp.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_cnp.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_cnp.Tpo -c -o elementary_testql-test_cnp.obj `if test -f 'test_cnp.c'; then $(CYGPATH_W) 'test_cnp.c'; else $(CYGPATH_W) '$(srcdir)/test_cnp.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_cnp.Tpo $(DEPDIR)/elementary_testql-test_cnp.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_cnp.c' object='elementary_testql-test_cnp.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_cnp.obj `if test -f 'test_cnp.c'; then $(CYGPATH_W) 'test_cnp.c'; else $(CYGPATH_W) '$(srcdir)/test_cnp.c'; fi` + +elementary_testql-test_colorselector.o: test_colorselector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_colorselector.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_colorselector.Tpo -c -o elementary_testql-test_colorselector.o `test -f 'test_colorselector.c' || echo '$(srcdir)/'`test_colorselector.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_colorselector.Tpo $(DEPDIR)/elementary_testql-test_colorselector.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_colorselector.c' object='elementary_testql-test_colorselector.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_colorselector.o `test -f 'test_colorselector.c' || echo '$(srcdir)/'`test_colorselector.c + +elementary_testql-test_colorselector.obj: test_colorselector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_colorselector.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_colorselector.Tpo -c -o elementary_testql-test_colorselector.obj `if test -f 'test_colorselector.c'; then $(CYGPATH_W) 'test_colorselector.c'; else $(CYGPATH_W) '$(srcdir)/test_colorselector.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_colorselector.Tpo $(DEPDIR)/elementary_testql-test_colorselector.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_colorselector.c' object='elementary_testql-test_colorselector.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_colorselector.obj `if test -f 'test_colorselector.c'; then $(CYGPATH_W) 'test_colorselector.c'; else $(CYGPATH_W) '$(srcdir)/test_colorselector.c'; fi` + +elementary_testql-test_conform.o: test_conform.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_conform.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_conform.Tpo -c -o elementary_testql-test_conform.o `test -f 'test_conform.c' || echo '$(srcdir)/'`test_conform.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_conform.Tpo $(DEPDIR)/elementary_testql-test_conform.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_conform.c' object='elementary_testql-test_conform.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_conform.o `test -f 'test_conform.c' || echo '$(srcdir)/'`test_conform.c + +elementary_testql-test_conform.obj: test_conform.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_conform.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_conform.Tpo -c -o elementary_testql-test_conform.obj `if test -f 'test_conform.c'; then $(CYGPATH_W) 'test_conform.c'; else $(CYGPATH_W) '$(srcdir)/test_conform.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_conform.Tpo $(DEPDIR)/elementary_testql-test_conform.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_conform.c' object='elementary_testql-test_conform.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_conform.obj `if test -f 'test_conform.c'; then $(CYGPATH_W) 'test_conform.c'; else $(CYGPATH_W) '$(srcdir)/test_conform.c'; fi` + +elementary_testql-test_ctxpopup.o: test_ctxpopup.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_ctxpopup.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_ctxpopup.Tpo -c -o elementary_testql-test_ctxpopup.o `test -f 'test_ctxpopup.c' || echo '$(srcdir)/'`test_ctxpopup.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_ctxpopup.Tpo $(DEPDIR)/elementary_testql-test_ctxpopup.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_ctxpopup.c' object='elementary_testql-test_ctxpopup.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_ctxpopup.o `test -f 'test_ctxpopup.c' || echo '$(srcdir)/'`test_ctxpopup.c + +elementary_testql-test_ctxpopup.obj: test_ctxpopup.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_ctxpopup.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_ctxpopup.Tpo -c -o elementary_testql-test_ctxpopup.obj `if test -f 'test_ctxpopup.c'; then $(CYGPATH_W) 'test_ctxpopup.c'; else $(CYGPATH_W) '$(srcdir)/test_ctxpopup.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_ctxpopup.Tpo $(DEPDIR)/elementary_testql-test_ctxpopup.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_ctxpopup.c' object='elementary_testql-test_ctxpopup.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_ctxpopup.obj `if test -f 'test_ctxpopup.c'; then $(CYGPATH_W) 'test_ctxpopup.c'; else $(CYGPATH_W) '$(srcdir)/test_ctxpopup.c'; fi` + +elementary_testql-test_cursor.o: test_cursor.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_cursor.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_cursor.Tpo -c -o elementary_testql-test_cursor.o `test -f 'test_cursor.c' || echo '$(srcdir)/'`test_cursor.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_cursor.Tpo $(DEPDIR)/elementary_testql-test_cursor.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_cursor.c' object='elementary_testql-test_cursor.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_cursor.o `test -f 'test_cursor.c' || echo '$(srcdir)/'`test_cursor.c + +elementary_testql-test_cursor.obj: test_cursor.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_cursor.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_cursor.Tpo -c -o elementary_testql-test_cursor.obj `if test -f 'test_cursor.c'; then $(CYGPATH_W) 'test_cursor.c'; else $(CYGPATH_W) '$(srcdir)/test_cursor.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_cursor.Tpo $(DEPDIR)/elementary_testql-test_cursor.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_cursor.c' object='elementary_testql-test_cursor.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_cursor.obj `if test -f 'test_cursor.c'; then $(CYGPATH_W) 'test_cursor.c'; else $(CYGPATH_W) '$(srcdir)/test_cursor.c'; fi` + +elementary_testql-test_datetime.o: test_datetime.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_datetime.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_datetime.Tpo -c -o elementary_testql-test_datetime.o `test -f 'test_datetime.c' || echo '$(srcdir)/'`test_datetime.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_datetime.Tpo $(DEPDIR)/elementary_testql-test_datetime.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_datetime.c' object='elementary_testql-test_datetime.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_datetime.o `test -f 'test_datetime.c' || echo '$(srcdir)/'`test_datetime.c + +elementary_testql-test_datetime.obj: test_datetime.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_datetime.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_datetime.Tpo -c -o elementary_testql-test_datetime.obj `if test -f 'test_datetime.c'; then $(CYGPATH_W) 'test_datetime.c'; else $(CYGPATH_W) '$(srcdir)/test_datetime.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_datetime.Tpo $(DEPDIR)/elementary_testql-test_datetime.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_datetime.c' object='elementary_testql-test_datetime.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_datetime.obj `if test -f 'test_datetime.c'; then $(CYGPATH_W) 'test_datetime.c'; else $(CYGPATH_W) '$(srcdir)/test_datetime.c'; fi` + +elementary_testql-test_dayselector.o: test_dayselector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_dayselector.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_dayselector.Tpo -c -o elementary_testql-test_dayselector.o `test -f 'test_dayselector.c' || echo '$(srcdir)/'`test_dayselector.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_dayselector.Tpo $(DEPDIR)/elementary_testql-test_dayselector.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_dayselector.c' object='elementary_testql-test_dayselector.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_dayselector.o `test -f 'test_dayselector.c' || echo '$(srcdir)/'`test_dayselector.c + +elementary_testql-test_dayselector.obj: test_dayselector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_dayselector.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_dayselector.Tpo -c -o elementary_testql-test_dayselector.obj `if test -f 'test_dayselector.c'; then $(CYGPATH_W) 'test_dayselector.c'; else $(CYGPATH_W) '$(srcdir)/test_dayselector.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_dayselector.Tpo $(DEPDIR)/elementary_testql-test_dayselector.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_dayselector.c' object='elementary_testql-test_dayselector.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_dayselector.obj `if test -f 'test_dayselector.c'; then $(CYGPATH_W) 'test_dayselector.c'; else $(CYGPATH_W) '$(srcdir)/test_dayselector.c'; fi` + +elementary_testql-test_diskselector.o: test_diskselector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_diskselector.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_diskselector.Tpo -c -o elementary_testql-test_diskselector.o `test -f 'test_diskselector.c' || echo '$(srcdir)/'`test_diskselector.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_diskselector.Tpo $(DEPDIR)/elementary_testql-test_diskselector.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_diskselector.c' object='elementary_testql-test_diskselector.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_diskselector.o `test -f 'test_diskselector.c' || echo '$(srcdir)/'`test_diskselector.c + +elementary_testql-test_diskselector.obj: test_diskselector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_diskselector.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_diskselector.Tpo -c -o elementary_testql-test_diskselector.obj `if test -f 'test_diskselector.c'; then $(CYGPATH_W) 'test_diskselector.c'; else $(CYGPATH_W) '$(srcdir)/test_diskselector.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_diskselector.Tpo $(DEPDIR)/elementary_testql-test_diskselector.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_diskselector.c' object='elementary_testql-test_diskselector.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_diskselector.obj `if test -f 'test_diskselector.c'; then $(CYGPATH_W) 'test_diskselector.c'; else $(CYGPATH_W) '$(srcdir)/test_diskselector.c'; fi` + +elementary_testql-test_entry.o: test_entry.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_entry.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_entry.Tpo -c -o elementary_testql-test_entry.o `test -f 'test_entry.c' || echo '$(srcdir)/'`test_entry.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_entry.Tpo $(DEPDIR)/elementary_testql-test_entry.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_entry.c' object='elementary_testql-test_entry.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_entry.o `test -f 'test_entry.c' || echo '$(srcdir)/'`test_entry.c + +elementary_testql-test_entry.obj: test_entry.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_entry.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_entry.Tpo -c -o elementary_testql-test_entry.obj `if test -f 'test_entry.c'; then $(CYGPATH_W) 'test_entry.c'; else $(CYGPATH_W) '$(srcdir)/test_entry.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_entry.Tpo $(DEPDIR)/elementary_testql-test_entry.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_entry.c' object='elementary_testql-test_entry.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_entry.obj `if test -f 'test_entry.c'; then $(CYGPATH_W) 'test_entry.c'; else $(CYGPATH_W) '$(srcdir)/test_entry.c'; fi` + +elementary_testql-test_entry_anchor.o: test_entry_anchor.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_entry_anchor.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_entry_anchor.Tpo -c -o elementary_testql-test_entry_anchor.o `test -f 'test_entry_anchor.c' || echo '$(srcdir)/'`test_entry_anchor.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_entry_anchor.Tpo $(DEPDIR)/elementary_testql-test_entry_anchor.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_entry_anchor.c' object='elementary_testql-test_entry_anchor.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_entry_anchor.o `test -f 'test_entry_anchor.c' || echo '$(srcdir)/'`test_entry_anchor.c + +elementary_testql-test_entry_anchor.obj: test_entry_anchor.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_entry_anchor.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_entry_anchor.Tpo -c -o elementary_testql-test_entry_anchor.obj `if test -f 'test_entry_anchor.c'; then $(CYGPATH_W) 'test_entry_anchor.c'; else $(CYGPATH_W) '$(srcdir)/test_entry_anchor.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_entry_anchor.Tpo $(DEPDIR)/elementary_testql-test_entry_anchor.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_entry_anchor.c' object='elementary_testql-test_entry_anchor.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_entry_anchor.obj `if test -f 'test_entry_anchor.c'; then $(CYGPATH_W) 'test_entry_anchor.c'; else $(CYGPATH_W) '$(srcdir)/test_entry_anchor.c'; fi` + +elementary_testql-test_entry_anchor2.o: test_entry_anchor2.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_entry_anchor2.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_entry_anchor2.Tpo -c -o elementary_testql-test_entry_anchor2.o `test -f 'test_entry_anchor2.c' || echo '$(srcdir)/'`test_entry_anchor2.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_entry_anchor2.Tpo $(DEPDIR)/elementary_testql-test_entry_anchor2.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_entry_anchor2.c' object='elementary_testql-test_entry_anchor2.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_entry_anchor2.o `test -f 'test_entry_anchor2.c' || echo '$(srcdir)/'`test_entry_anchor2.c + +elementary_testql-test_entry_anchor2.obj: test_entry_anchor2.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_entry_anchor2.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_entry_anchor2.Tpo -c -o elementary_testql-test_entry_anchor2.obj `if test -f 'test_entry_anchor2.c'; then $(CYGPATH_W) 'test_entry_anchor2.c'; else $(CYGPATH_W) '$(srcdir)/test_entry_anchor2.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_entry_anchor2.Tpo $(DEPDIR)/elementary_testql-test_entry_anchor2.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_entry_anchor2.c' object='elementary_testql-test_entry_anchor2.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_entry_anchor2.obj `if test -f 'test_entry_anchor2.c'; then $(CYGPATH_W) 'test_entry_anchor2.c'; else $(CYGPATH_W) '$(srcdir)/test_entry_anchor2.c'; fi` + +elementary_testql-test_fileselector_button.o: test_fileselector_button.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_fileselector_button.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_fileselector_button.Tpo -c -o elementary_testql-test_fileselector_button.o `test -f 'test_fileselector_button.c' || echo '$(srcdir)/'`test_fileselector_button.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_fileselector_button.Tpo $(DEPDIR)/elementary_testql-test_fileselector_button.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_fileselector_button.c' object='elementary_testql-test_fileselector_button.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_fileselector_button.o `test -f 'test_fileselector_button.c' || echo '$(srcdir)/'`test_fileselector_button.c + +elementary_testql-test_fileselector_button.obj: test_fileselector_button.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_fileselector_button.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_fileselector_button.Tpo -c -o elementary_testql-test_fileselector_button.obj `if test -f 'test_fileselector_button.c'; then $(CYGPATH_W) 'test_fileselector_button.c'; else $(CYGPATH_W) '$(srcdir)/test_fileselector_button.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_fileselector_button.Tpo $(DEPDIR)/elementary_testql-test_fileselector_button.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_fileselector_button.c' object='elementary_testql-test_fileselector_button.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_fileselector_button.obj `if test -f 'test_fileselector_button.c'; then $(CYGPATH_W) 'test_fileselector_button.c'; else $(CYGPATH_W) '$(srcdir)/test_fileselector_button.c'; fi` + +elementary_testql-test_fileselector.o: test_fileselector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_fileselector.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_fileselector.Tpo -c -o elementary_testql-test_fileselector.o `test -f 'test_fileselector.c' || echo '$(srcdir)/'`test_fileselector.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_fileselector.Tpo $(DEPDIR)/elementary_testql-test_fileselector.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_fileselector.c' object='elementary_testql-test_fileselector.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_fileselector.o `test -f 'test_fileselector.c' || echo '$(srcdir)/'`test_fileselector.c + +elementary_testql-test_fileselector.obj: test_fileselector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_fileselector.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_fileselector.Tpo -c -o elementary_testql-test_fileselector.obj `if test -f 'test_fileselector.c'; then $(CYGPATH_W) 'test_fileselector.c'; else $(CYGPATH_W) '$(srcdir)/test_fileselector.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_fileselector.Tpo $(DEPDIR)/elementary_testql-test_fileselector.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_fileselector.c' object='elementary_testql-test_fileselector.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_fileselector.obj `if test -f 'test_fileselector.c'; then $(CYGPATH_W) 'test_fileselector.c'; else $(CYGPATH_W) '$(srcdir)/test_fileselector.c'; fi` + +elementary_testql-test_fileselector_entry.o: test_fileselector_entry.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_fileselector_entry.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_fileselector_entry.Tpo -c -o elementary_testql-test_fileselector_entry.o `test -f 'test_fileselector_entry.c' || echo '$(srcdir)/'`test_fileselector_entry.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_fileselector_entry.Tpo $(DEPDIR)/elementary_testql-test_fileselector_entry.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_fileselector_entry.c' object='elementary_testql-test_fileselector_entry.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_fileselector_entry.o `test -f 'test_fileselector_entry.c' || echo '$(srcdir)/'`test_fileselector_entry.c + +elementary_testql-test_fileselector_entry.obj: test_fileselector_entry.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_fileselector_entry.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_fileselector_entry.Tpo -c -o elementary_testql-test_fileselector_entry.obj `if test -f 'test_fileselector_entry.c'; then $(CYGPATH_W) 'test_fileselector_entry.c'; else $(CYGPATH_W) '$(srcdir)/test_fileselector_entry.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_fileselector_entry.Tpo $(DEPDIR)/elementary_testql-test_fileselector_entry.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_fileselector_entry.c' object='elementary_testql-test_fileselector_entry.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_fileselector_entry.obj `if test -f 'test_fileselector_entry.c'; then $(CYGPATH_W) 'test_fileselector_entry.c'; else $(CYGPATH_W) '$(srcdir)/test_fileselector_entry.c'; fi` + +elementary_testql-test_flip.o: test_flip.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_flip.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_flip.Tpo -c -o elementary_testql-test_flip.o `test -f 'test_flip.c' || echo '$(srcdir)/'`test_flip.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_flip.Tpo $(DEPDIR)/elementary_testql-test_flip.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_flip.c' object='elementary_testql-test_flip.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_flip.o `test -f 'test_flip.c' || echo '$(srcdir)/'`test_flip.c + +elementary_testql-test_flip.obj: test_flip.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_flip.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_flip.Tpo -c -o elementary_testql-test_flip.obj `if test -f 'test_flip.c'; then $(CYGPATH_W) 'test_flip.c'; else $(CYGPATH_W) '$(srcdir)/test_flip.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_flip.Tpo $(DEPDIR)/elementary_testql-test_flip.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_flip.c' object='elementary_testql-test_flip.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_flip.obj `if test -f 'test_flip.c'; then $(CYGPATH_W) 'test_flip.c'; else $(CYGPATH_W) '$(srcdir)/test_flip.c'; fi` + +elementary_testql-test_flip_page.o: test_flip_page.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_flip_page.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_flip_page.Tpo -c -o elementary_testql-test_flip_page.o `test -f 'test_flip_page.c' || echo '$(srcdir)/'`test_flip_page.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_flip_page.Tpo $(DEPDIR)/elementary_testql-test_flip_page.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_flip_page.c' object='elementary_testql-test_flip_page.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_flip_page.o `test -f 'test_flip_page.c' || echo '$(srcdir)/'`test_flip_page.c + +elementary_testql-test_flip_page.obj: test_flip_page.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_flip_page.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_flip_page.Tpo -c -o elementary_testql-test_flip_page.obj `if test -f 'test_flip_page.c'; then $(CYGPATH_W) 'test_flip_page.c'; else $(CYGPATH_W) '$(srcdir)/test_flip_page.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_flip_page.Tpo $(DEPDIR)/elementary_testql-test_flip_page.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_flip_page.c' object='elementary_testql-test_flip_page.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_flip_page.obj `if test -f 'test_flip_page.c'; then $(CYGPATH_W) 'test_flip_page.c'; else $(CYGPATH_W) '$(srcdir)/test_flip_page.c'; fi` + +elementary_testql-test_flipselector.o: test_flipselector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_flipselector.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_flipselector.Tpo -c -o elementary_testql-test_flipselector.o `test -f 'test_flipselector.c' || echo '$(srcdir)/'`test_flipselector.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_flipselector.Tpo $(DEPDIR)/elementary_testql-test_flipselector.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_flipselector.c' object='elementary_testql-test_flipselector.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_flipselector.o `test -f 'test_flipselector.c' || echo '$(srcdir)/'`test_flipselector.c + +elementary_testql-test_flipselector.obj: test_flipselector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_flipselector.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_flipselector.Tpo -c -o elementary_testql-test_flipselector.obj `if test -f 'test_flipselector.c'; then $(CYGPATH_W) 'test_flipselector.c'; else $(CYGPATH_W) '$(srcdir)/test_flipselector.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_flipselector.Tpo $(DEPDIR)/elementary_testql-test_flipselector.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_flipselector.c' object='elementary_testql-test_flipselector.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_flipselector.obj `if test -f 'test_flipselector.c'; then $(CYGPATH_W) 'test_flipselector.c'; else $(CYGPATH_W) '$(srcdir)/test_flipselector.c'; fi` + +elementary_testql-test_floating.o: test_floating.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_floating.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_floating.Tpo -c -o elementary_testql-test_floating.o `test -f 'test_floating.c' || echo '$(srcdir)/'`test_floating.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_floating.Tpo $(DEPDIR)/elementary_testql-test_floating.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_floating.c' object='elementary_testql-test_floating.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_floating.o `test -f 'test_floating.c' || echo '$(srcdir)/'`test_floating.c + +elementary_testql-test_floating.obj: test_floating.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_floating.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_floating.Tpo -c -o elementary_testql-test_floating.obj `if test -f 'test_floating.c'; then $(CYGPATH_W) 'test_floating.c'; else $(CYGPATH_W) '$(srcdir)/test_floating.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_floating.Tpo $(DEPDIR)/elementary_testql-test_floating.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_floating.c' object='elementary_testql-test_floating.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_floating.obj `if test -f 'test_floating.c'; then $(CYGPATH_W) 'test_floating.c'; else $(CYGPATH_W) '$(srcdir)/test_floating.c'; fi` + +elementary_testql-test_focus.o: test_focus.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_focus.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_focus.Tpo -c -o elementary_testql-test_focus.o `test -f 'test_focus.c' || echo '$(srcdir)/'`test_focus.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_focus.Tpo $(DEPDIR)/elementary_testql-test_focus.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_focus.c' object='elementary_testql-test_focus.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_focus.o `test -f 'test_focus.c' || echo '$(srcdir)/'`test_focus.c + +elementary_testql-test_focus.obj: test_focus.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_focus.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_focus.Tpo -c -o elementary_testql-test_focus.obj `if test -f 'test_focus.c'; then $(CYGPATH_W) 'test_focus.c'; else $(CYGPATH_W) '$(srcdir)/test_focus.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_focus.Tpo $(DEPDIR)/elementary_testql-test_focus.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_focus.c' object='elementary_testql-test_focus.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_focus.obj `if test -f 'test_focus.c'; then $(CYGPATH_W) 'test_focus.c'; else $(CYGPATH_W) '$(srcdir)/test_focus.c'; fi` + +elementary_testql-test_focus2.o: test_focus2.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_focus2.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_focus2.Tpo -c -o elementary_testql-test_focus2.o `test -f 'test_focus2.c' || echo '$(srcdir)/'`test_focus2.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_focus2.Tpo $(DEPDIR)/elementary_testql-test_focus2.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_focus2.c' object='elementary_testql-test_focus2.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_focus2.o `test -f 'test_focus2.c' || echo '$(srcdir)/'`test_focus2.c + +elementary_testql-test_focus2.obj: test_focus2.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_focus2.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_focus2.Tpo -c -o elementary_testql-test_focus2.obj `if test -f 'test_focus2.c'; then $(CYGPATH_W) 'test_focus2.c'; else $(CYGPATH_W) '$(srcdir)/test_focus2.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_focus2.Tpo $(DEPDIR)/elementary_testql-test_focus2.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_focus2.c' object='elementary_testql-test_focus2.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_focus2.obj `if test -f 'test_focus2.c'; then $(CYGPATH_W) 'test_focus2.c'; else $(CYGPATH_W) '$(srcdir)/test_focus2.c'; fi` + +elementary_testql-test_focus3.o: test_focus3.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_focus3.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_focus3.Tpo -c -o elementary_testql-test_focus3.o `test -f 'test_focus3.c' || echo '$(srcdir)/'`test_focus3.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_focus3.Tpo $(DEPDIR)/elementary_testql-test_focus3.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_focus3.c' object='elementary_testql-test_focus3.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_focus3.o `test -f 'test_focus3.c' || echo '$(srcdir)/'`test_focus3.c + +elementary_testql-test_focus3.obj: test_focus3.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_focus3.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_focus3.Tpo -c -o elementary_testql-test_focus3.obj `if test -f 'test_focus3.c'; then $(CYGPATH_W) 'test_focus3.c'; else $(CYGPATH_W) '$(srcdir)/test_focus3.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_focus3.Tpo $(DEPDIR)/elementary_testql-test_focus3.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_focus3.c' object='elementary_testql-test_focus3.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_focus3.obj `if test -f 'test_focus3.c'; then $(CYGPATH_W) 'test_focus3.c'; else $(CYGPATH_W) '$(srcdir)/test_focus3.c'; fi` + +elementary_testql-test_gengrid.o: test_gengrid.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_gengrid.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_gengrid.Tpo -c -o elementary_testql-test_gengrid.o `test -f 'test_gengrid.c' || echo '$(srcdir)/'`test_gengrid.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_gengrid.Tpo $(DEPDIR)/elementary_testql-test_gengrid.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_gengrid.c' object='elementary_testql-test_gengrid.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_gengrid.o `test -f 'test_gengrid.c' || echo '$(srcdir)/'`test_gengrid.c + +elementary_testql-test_gengrid.obj: test_gengrid.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_gengrid.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_gengrid.Tpo -c -o elementary_testql-test_gengrid.obj `if test -f 'test_gengrid.c'; then $(CYGPATH_W) 'test_gengrid.c'; else $(CYGPATH_W) '$(srcdir)/test_gengrid.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_gengrid.Tpo $(DEPDIR)/elementary_testql-test_gengrid.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_gengrid.c' object='elementary_testql-test_gengrid.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_gengrid.obj `if test -f 'test_gengrid.c'; then $(CYGPATH_W) 'test_gengrid.c'; else $(CYGPATH_W) '$(srcdir)/test_gengrid.c'; fi` + +elementary_testql-test_genlist.o: test_genlist.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_genlist.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_genlist.Tpo -c -o elementary_testql-test_genlist.o `test -f 'test_genlist.c' || echo '$(srcdir)/'`test_genlist.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_genlist.Tpo $(DEPDIR)/elementary_testql-test_genlist.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_genlist.c' object='elementary_testql-test_genlist.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_genlist.o `test -f 'test_genlist.c' || echo '$(srcdir)/'`test_genlist.c + +elementary_testql-test_genlist.obj: test_genlist.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_genlist.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_genlist.Tpo -c -o elementary_testql-test_genlist.obj `if test -f 'test_genlist.c'; then $(CYGPATH_W) 'test_genlist.c'; else $(CYGPATH_W) '$(srcdir)/test_genlist.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_genlist.Tpo $(DEPDIR)/elementary_testql-test_genlist.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_genlist.c' object='elementary_testql-test_genlist.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_genlist.obj `if test -f 'test_genlist.c'; then $(CYGPATH_W) 'test_genlist.c'; else $(CYGPATH_W) '$(srcdir)/test_genlist.c'; fi` + +elementary_testql-test_gesture_layer.o: test_gesture_layer.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_gesture_layer.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_gesture_layer.Tpo -c -o elementary_testql-test_gesture_layer.o `test -f 'test_gesture_layer.c' || echo '$(srcdir)/'`test_gesture_layer.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_gesture_layer.Tpo $(DEPDIR)/elementary_testql-test_gesture_layer.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_gesture_layer.c' object='elementary_testql-test_gesture_layer.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_gesture_layer.o `test -f 'test_gesture_layer.c' || echo '$(srcdir)/'`test_gesture_layer.c + +elementary_testql-test_gesture_layer.obj: test_gesture_layer.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_gesture_layer.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_gesture_layer.Tpo -c -o elementary_testql-test_gesture_layer.obj `if test -f 'test_gesture_layer.c'; then $(CYGPATH_W) 'test_gesture_layer.c'; else $(CYGPATH_W) '$(srcdir)/test_gesture_layer.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_gesture_layer.Tpo $(DEPDIR)/elementary_testql-test_gesture_layer.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_gesture_layer.c' object='elementary_testql-test_gesture_layer.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_gesture_layer.obj `if test -f 'test_gesture_layer.c'; then $(CYGPATH_W) 'test_gesture_layer.c'; else $(CYGPATH_W) '$(srcdir)/test_gesture_layer.c'; fi` + +elementary_testql-test_gesture_layer2.o: test_gesture_layer2.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_gesture_layer2.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_gesture_layer2.Tpo -c -o elementary_testql-test_gesture_layer2.o `test -f 'test_gesture_layer2.c' || echo '$(srcdir)/'`test_gesture_layer2.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_gesture_layer2.Tpo $(DEPDIR)/elementary_testql-test_gesture_layer2.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_gesture_layer2.c' object='elementary_testql-test_gesture_layer2.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_gesture_layer2.o `test -f 'test_gesture_layer2.c' || echo '$(srcdir)/'`test_gesture_layer2.c + +elementary_testql-test_gesture_layer2.obj: test_gesture_layer2.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_gesture_layer2.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_gesture_layer2.Tpo -c -o elementary_testql-test_gesture_layer2.obj `if test -f 'test_gesture_layer2.c'; then $(CYGPATH_W) 'test_gesture_layer2.c'; else $(CYGPATH_W) '$(srcdir)/test_gesture_layer2.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_gesture_layer2.Tpo $(DEPDIR)/elementary_testql-test_gesture_layer2.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_gesture_layer2.c' object='elementary_testql-test_gesture_layer2.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_gesture_layer2.obj `if test -f 'test_gesture_layer2.c'; then $(CYGPATH_W) 'test_gesture_layer2.c'; else $(CYGPATH_W) '$(srcdir)/test_gesture_layer2.c'; fi` + +elementary_testql-test_gesture_layer3.o: test_gesture_layer3.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_gesture_layer3.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_gesture_layer3.Tpo -c -o elementary_testql-test_gesture_layer3.o `test -f 'test_gesture_layer3.c' || echo '$(srcdir)/'`test_gesture_layer3.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_gesture_layer3.Tpo $(DEPDIR)/elementary_testql-test_gesture_layer3.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_gesture_layer3.c' object='elementary_testql-test_gesture_layer3.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_gesture_layer3.o `test -f 'test_gesture_layer3.c' || echo '$(srcdir)/'`test_gesture_layer3.c + +elementary_testql-test_gesture_layer3.obj: test_gesture_layer3.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_gesture_layer3.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_gesture_layer3.Tpo -c -o elementary_testql-test_gesture_layer3.obj `if test -f 'test_gesture_layer3.c'; then $(CYGPATH_W) 'test_gesture_layer3.c'; else $(CYGPATH_W) '$(srcdir)/test_gesture_layer3.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_gesture_layer3.Tpo $(DEPDIR)/elementary_testql-test_gesture_layer3.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_gesture_layer3.c' object='elementary_testql-test_gesture_layer3.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_gesture_layer3.obj `if test -f 'test_gesture_layer3.c'; then $(CYGPATH_W) 'test_gesture_layer3.c'; else $(CYGPATH_W) '$(srcdir)/test_gesture_layer3.c'; fi` + +elementary_testql-test_glview_simple.o: test_glview_simple.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_glview_simple.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_glview_simple.Tpo -c -o elementary_testql-test_glview_simple.o `test -f 'test_glview_simple.c' || echo '$(srcdir)/'`test_glview_simple.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_glview_simple.Tpo $(DEPDIR)/elementary_testql-test_glview_simple.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_glview_simple.c' object='elementary_testql-test_glview_simple.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_glview_simple.o `test -f 'test_glview_simple.c' || echo '$(srcdir)/'`test_glview_simple.c + +elementary_testql-test_glview_simple.obj: test_glview_simple.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_glview_simple.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_glview_simple.Tpo -c -o elementary_testql-test_glview_simple.obj `if test -f 'test_glview_simple.c'; then $(CYGPATH_W) 'test_glview_simple.c'; else $(CYGPATH_W) '$(srcdir)/test_glview_simple.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_glview_simple.Tpo $(DEPDIR)/elementary_testql-test_glview_simple.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_glview_simple.c' object='elementary_testql-test_glview_simple.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_glview_simple.obj `if test -f 'test_glview_simple.c'; then $(CYGPATH_W) 'test_glview_simple.c'; else $(CYGPATH_W) '$(srcdir)/test_glview_simple.c'; fi` + +elementary_testql-test_glview.o: test_glview.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_glview.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_glview.Tpo -c -o elementary_testql-test_glview.o `test -f 'test_glview.c' || echo '$(srcdir)/'`test_glview.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_glview.Tpo $(DEPDIR)/elementary_testql-test_glview.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_glview.c' object='elementary_testql-test_glview.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_glview.o `test -f 'test_glview.c' || echo '$(srcdir)/'`test_glview.c + +elementary_testql-test_glview.obj: test_glview.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_glview.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_glview.Tpo -c -o elementary_testql-test_glview.obj `if test -f 'test_glview.c'; then $(CYGPATH_W) 'test_glview.c'; else $(CYGPATH_W) '$(srcdir)/test_glview.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_glview.Tpo $(DEPDIR)/elementary_testql-test_glview.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_glview.c' object='elementary_testql-test_glview.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_glview.obj `if test -f 'test_glview.c'; then $(CYGPATH_W) 'test_glview.c'; else $(CYGPATH_W) '$(srcdir)/test_glview.c'; fi` + +elementary_testql-test_grid.o: test_grid.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_grid.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_grid.Tpo -c -o elementary_testql-test_grid.o `test -f 'test_grid.c' || echo '$(srcdir)/'`test_grid.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_grid.Tpo $(DEPDIR)/elementary_testql-test_grid.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_grid.c' object='elementary_testql-test_grid.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_grid.o `test -f 'test_grid.c' || echo '$(srcdir)/'`test_grid.c + +elementary_testql-test_grid.obj: test_grid.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_grid.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_grid.Tpo -c -o elementary_testql-test_grid.obj `if test -f 'test_grid.c'; then $(CYGPATH_W) 'test_grid.c'; else $(CYGPATH_W) '$(srcdir)/test_grid.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_grid.Tpo $(DEPDIR)/elementary_testql-test_grid.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_grid.c' object='elementary_testql-test_grid.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_grid.obj `if test -f 'test_grid.c'; then $(CYGPATH_W) 'test_grid.c'; else $(CYGPATH_W) '$(srcdir)/test_grid.c'; fi` + +elementary_testql-test_hover.o: test_hover.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_hover.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_hover.Tpo -c -o elementary_testql-test_hover.o `test -f 'test_hover.c' || echo '$(srcdir)/'`test_hover.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_hover.Tpo $(DEPDIR)/elementary_testql-test_hover.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_hover.c' object='elementary_testql-test_hover.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_hover.o `test -f 'test_hover.c' || echo '$(srcdir)/'`test_hover.c + +elementary_testql-test_hover.obj: test_hover.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_hover.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_hover.Tpo -c -o elementary_testql-test_hover.obj `if test -f 'test_hover.c'; then $(CYGPATH_W) 'test_hover.c'; else $(CYGPATH_W) '$(srcdir)/test_hover.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_hover.Tpo $(DEPDIR)/elementary_testql-test_hover.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_hover.c' object='elementary_testql-test_hover.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_hover.obj `if test -f 'test_hover.c'; then $(CYGPATH_W) 'test_hover.c'; else $(CYGPATH_W) '$(srcdir)/test_hover.c'; fi` + +elementary_testql-test_hoversel.o: test_hoversel.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_hoversel.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_hoversel.Tpo -c -o elementary_testql-test_hoversel.o `test -f 'test_hoversel.c' || echo '$(srcdir)/'`test_hoversel.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_hoversel.Tpo $(DEPDIR)/elementary_testql-test_hoversel.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_hoversel.c' object='elementary_testql-test_hoversel.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_hoversel.o `test -f 'test_hoversel.c' || echo '$(srcdir)/'`test_hoversel.c + +elementary_testql-test_hoversel.obj: test_hoversel.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_hoversel.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_hoversel.Tpo -c -o elementary_testql-test_hoversel.obj `if test -f 'test_hoversel.c'; then $(CYGPATH_W) 'test_hoversel.c'; else $(CYGPATH_W) '$(srcdir)/test_hoversel.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_hoversel.Tpo $(DEPDIR)/elementary_testql-test_hoversel.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_hoversel.c' object='elementary_testql-test_hoversel.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_hoversel.obj `if test -f 'test_hoversel.c'; then $(CYGPATH_W) 'test_hoversel.c'; else $(CYGPATH_W) '$(srcdir)/test_hoversel.c'; fi` + +elementary_testql-test_icon.o: test_icon.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_icon.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_icon.Tpo -c -o elementary_testql-test_icon.o `test -f 'test_icon.c' || echo '$(srcdir)/'`test_icon.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_icon.Tpo $(DEPDIR)/elementary_testql-test_icon.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_icon.c' object='elementary_testql-test_icon.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_icon.o `test -f 'test_icon.c' || echo '$(srcdir)/'`test_icon.c + +elementary_testql-test_icon.obj: test_icon.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_icon.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_icon.Tpo -c -o elementary_testql-test_icon.obj `if test -f 'test_icon.c'; then $(CYGPATH_W) 'test_icon.c'; else $(CYGPATH_W) '$(srcdir)/test_icon.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_icon.Tpo $(DEPDIR)/elementary_testql-test_icon.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_icon.c' object='elementary_testql-test_icon.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_icon.obj `if test -f 'test_icon.c'; then $(CYGPATH_W) 'test_icon.c'; else $(CYGPATH_W) '$(srcdir)/test_icon.c'; fi` + +elementary_testql-test_icon_desktops.o: test_icon_desktops.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_icon_desktops.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_icon_desktops.Tpo -c -o elementary_testql-test_icon_desktops.o `test -f 'test_icon_desktops.c' || echo '$(srcdir)/'`test_icon_desktops.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_icon_desktops.Tpo $(DEPDIR)/elementary_testql-test_icon_desktops.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_icon_desktops.c' object='elementary_testql-test_icon_desktops.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_icon_desktops.o `test -f 'test_icon_desktops.c' || echo '$(srcdir)/'`test_icon_desktops.c + +elementary_testql-test_icon_desktops.obj: test_icon_desktops.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_icon_desktops.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_icon_desktops.Tpo -c -o elementary_testql-test_icon_desktops.obj `if test -f 'test_icon_desktops.c'; then $(CYGPATH_W) 'test_icon_desktops.c'; else $(CYGPATH_W) '$(srcdir)/test_icon_desktops.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_icon_desktops.Tpo $(DEPDIR)/elementary_testql-test_icon_desktops.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_icon_desktops.c' object='elementary_testql-test_icon_desktops.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_icon_desktops.obj `if test -f 'test_icon_desktops.c'; then $(CYGPATH_W) 'test_icon_desktops.c'; else $(CYGPATH_W) '$(srcdir)/test_icon_desktops.c'; fi` + +elementary_testql-test_icon_animated.o: test_icon_animated.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_icon_animated.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_icon_animated.Tpo -c -o elementary_testql-test_icon_animated.o `test -f 'test_icon_animated.c' || echo '$(srcdir)/'`test_icon_animated.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_icon_animated.Tpo $(DEPDIR)/elementary_testql-test_icon_animated.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_icon_animated.c' object='elementary_testql-test_icon_animated.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_icon_animated.o `test -f 'test_icon_animated.c' || echo '$(srcdir)/'`test_icon_animated.c + +elementary_testql-test_icon_animated.obj: test_icon_animated.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_icon_animated.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_icon_animated.Tpo -c -o elementary_testql-test_icon_animated.obj `if test -f 'test_icon_animated.c'; then $(CYGPATH_W) 'test_icon_animated.c'; else $(CYGPATH_W) '$(srcdir)/test_icon_animated.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_icon_animated.Tpo $(DEPDIR)/elementary_testql-test_icon_animated.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_icon_animated.c' object='elementary_testql-test_icon_animated.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_icon_animated.obj `if test -f 'test_icon_animated.c'; then $(CYGPATH_W) 'test_icon_animated.c'; else $(CYGPATH_W) '$(srcdir)/test_icon_animated.c'; fi` + +elementary_testql-test_index.o: test_index.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_index.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_index.Tpo -c -o elementary_testql-test_index.o `test -f 'test_index.c' || echo '$(srcdir)/'`test_index.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_index.Tpo $(DEPDIR)/elementary_testql-test_index.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_index.c' object='elementary_testql-test_index.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_index.o `test -f 'test_index.c' || echo '$(srcdir)/'`test_index.c + +elementary_testql-test_index.obj: test_index.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_index.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_index.Tpo -c -o elementary_testql-test_index.obj `if test -f 'test_index.c'; then $(CYGPATH_W) 'test_index.c'; else $(CYGPATH_W) '$(srcdir)/test_index.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_index.Tpo $(DEPDIR)/elementary_testql-test_index.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_index.c' object='elementary_testql-test_index.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_index.obj `if test -f 'test_index.c'; then $(CYGPATH_W) 'test_index.c'; else $(CYGPATH_W) '$(srcdir)/test_index.c'; fi` + +elementary_testql-test_inwin.o: test_inwin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_inwin.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_inwin.Tpo -c -o elementary_testql-test_inwin.o `test -f 'test_inwin.c' || echo '$(srcdir)/'`test_inwin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_inwin.Tpo $(DEPDIR)/elementary_testql-test_inwin.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_inwin.c' object='elementary_testql-test_inwin.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_inwin.o `test -f 'test_inwin.c' || echo '$(srcdir)/'`test_inwin.c + +elementary_testql-test_inwin.obj: test_inwin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_inwin.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_inwin.Tpo -c -o elementary_testql-test_inwin.obj `if test -f 'test_inwin.c'; then $(CYGPATH_W) 'test_inwin.c'; else $(CYGPATH_W) '$(srcdir)/test_inwin.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_inwin.Tpo $(DEPDIR)/elementary_testql-test_inwin.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_inwin.c' object='elementary_testql-test_inwin.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_inwin.obj `if test -f 'test_inwin.c'; then $(CYGPATH_W) 'test_inwin.c'; else $(CYGPATH_W) '$(srcdir)/test_inwin.c'; fi` + +elementary_testql-test_label.o: test_label.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_label.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_label.Tpo -c -o elementary_testql-test_label.o `test -f 'test_label.c' || echo '$(srcdir)/'`test_label.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_label.Tpo $(DEPDIR)/elementary_testql-test_label.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_label.c' object='elementary_testql-test_label.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_label.o `test -f 'test_label.c' || echo '$(srcdir)/'`test_label.c + +elementary_testql-test_label.obj: test_label.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_label.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_label.Tpo -c -o elementary_testql-test_label.obj `if test -f 'test_label.c'; then $(CYGPATH_W) 'test_label.c'; else $(CYGPATH_W) '$(srcdir)/test_label.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_label.Tpo $(DEPDIR)/elementary_testql-test_label.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_label.c' object='elementary_testql-test_label.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_label.obj `if test -f 'test_label.c'; then $(CYGPATH_W) 'test_label.c'; else $(CYGPATH_W) '$(srcdir)/test_label.c'; fi` + +elementary_testql-test_launcher.o: test_launcher.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_launcher.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_launcher.Tpo -c -o elementary_testql-test_launcher.o `test -f 'test_launcher.c' || echo '$(srcdir)/'`test_launcher.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_launcher.Tpo $(DEPDIR)/elementary_testql-test_launcher.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_launcher.c' object='elementary_testql-test_launcher.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_launcher.o `test -f 'test_launcher.c' || echo '$(srcdir)/'`test_launcher.c + +elementary_testql-test_launcher.obj: test_launcher.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_launcher.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_launcher.Tpo -c -o elementary_testql-test_launcher.obj `if test -f 'test_launcher.c'; then $(CYGPATH_W) 'test_launcher.c'; else $(CYGPATH_W) '$(srcdir)/test_launcher.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_launcher.Tpo $(DEPDIR)/elementary_testql-test_launcher.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_launcher.c' object='elementary_testql-test_launcher.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_launcher.obj `if test -f 'test_launcher.c'; then $(CYGPATH_W) 'test_launcher.c'; else $(CYGPATH_W) '$(srcdir)/test_launcher.c'; fi` + +elementary_testql-test_layout.o: test_layout.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_layout.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_layout.Tpo -c -o elementary_testql-test_layout.o `test -f 'test_layout.c' || echo '$(srcdir)/'`test_layout.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_layout.Tpo $(DEPDIR)/elementary_testql-test_layout.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_layout.c' object='elementary_testql-test_layout.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_layout.o `test -f 'test_layout.c' || echo '$(srcdir)/'`test_layout.c + +elementary_testql-test_layout.obj: test_layout.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_layout.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_layout.Tpo -c -o elementary_testql-test_layout.obj `if test -f 'test_layout.c'; then $(CYGPATH_W) 'test_layout.c'; else $(CYGPATH_W) '$(srcdir)/test_layout.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_layout.Tpo $(DEPDIR)/elementary_testql-test_layout.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_layout.c' object='elementary_testql-test_layout.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_layout.obj `if test -f 'test_layout.c'; then $(CYGPATH_W) 'test_layout.c'; else $(CYGPATH_W) '$(srcdir)/test_layout.c'; fi` + +elementary_testql-test_list.o: test_list.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_list.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_list.Tpo -c -o elementary_testql-test_list.o `test -f 'test_list.c' || echo '$(srcdir)/'`test_list.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_list.Tpo $(DEPDIR)/elementary_testql-test_list.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_list.c' object='elementary_testql-test_list.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_list.o `test -f 'test_list.c' || echo '$(srcdir)/'`test_list.c + +elementary_testql-test_list.obj: test_list.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_list.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_list.Tpo -c -o elementary_testql-test_list.obj `if test -f 'test_list.c'; then $(CYGPATH_W) 'test_list.c'; else $(CYGPATH_W) '$(srcdir)/test_list.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_list.Tpo $(DEPDIR)/elementary_testql-test_list.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_list.c' object='elementary_testql-test_list.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_list.obj `if test -f 'test_list.c'; then $(CYGPATH_W) 'test_list.c'; else $(CYGPATH_W) '$(srcdir)/test_list.c'; fi` + +elementary_testql-test_map.o: test_map.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_map.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_map.Tpo -c -o elementary_testql-test_map.o `test -f 'test_map.c' || echo '$(srcdir)/'`test_map.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_map.Tpo $(DEPDIR)/elementary_testql-test_map.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_map.c' object='elementary_testql-test_map.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_map.o `test -f 'test_map.c' || echo '$(srcdir)/'`test_map.c + +elementary_testql-test_map.obj: test_map.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_map.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_map.Tpo -c -o elementary_testql-test_map.obj `if test -f 'test_map.c'; then $(CYGPATH_W) 'test_map.c'; else $(CYGPATH_W) '$(srcdir)/test_map.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_map.Tpo $(DEPDIR)/elementary_testql-test_map.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_map.c' object='elementary_testql-test_map.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_map.obj `if test -f 'test_map.c'; then $(CYGPATH_W) 'test_map.c'; else $(CYGPATH_W) '$(srcdir)/test_map.c'; fi` + +elementary_testql-test_menu.o: test_menu.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_menu.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_menu.Tpo -c -o elementary_testql-test_menu.o `test -f 'test_menu.c' || echo '$(srcdir)/'`test_menu.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_menu.Tpo $(DEPDIR)/elementary_testql-test_menu.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_menu.c' object='elementary_testql-test_menu.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_menu.o `test -f 'test_menu.c' || echo '$(srcdir)/'`test_menu.c + +elementary_testql-test_menu.obj: test_menu.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_menu.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_menu.Tpo -c -o elementary_testql-test_menu.obj `if test -f 'test_menu.c'; then $(CYGPATH_W) 'test_menu.c'; else $(CYGPATH_W) '$(srcdir)/test_menu.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_menu.Tpo $(DEPDIR)/elementary_testql-test_menu.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_menu.c' object='elementary_testql-test_menu.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_menu.obj `if test -f 'test_menu.c'; then $(CYGPATH_W) 'test_menu.c'; else $(CYGPATH_W) '$(srcdir)/test_menu.c'; fi` + +elementary_testql-test_multi.o: test_multi.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_multi.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_multi.Tpo -c -o elementary_testql-test_multi.o `test -f 'test_multi.c' || echo '$(srcdir)/'`test_multi.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_multi.Tpo $(DEPDIR)/elementary_testql-test_multi.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_multi.c' object='elementary_testql-test_multi.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_multi.o `test -f 'test_multi.c' || echo '$(srcdir)/'`test_multi.c + +elementary_testql-test_multi.obj: test_multi.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_multi.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_multi.Tpo -c -o elementary_testql-test_multi.obj `if test -f 'test_multi.c'; then $(CYGPATH_W) 'test_multi.c'; else $(CYGPATH_W) '$(srcdir)/test_multi.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_multi.Tpo $(DEPDIR)/elementary_testql-test_multi.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_multi.c' object='elementary_testql-test_multi.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_multi.obj `if test -f 'test_multi.c'; then $(CYGPATH_W) 'test_multi.c'; else $(CYGPATH_W) '$(srcdir)/test_multi.c'; fi` + +elementary_testql-test_multibuttonentry.o: test_multibuttonentry.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_multibuttonentry.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_multibuttonentry.Tpo -c -o elementary_testql-test_multibuttonentry.o `test -f 'test_multibuttonentry.c' || echo '$(srcdir)/'`test_multibuttonentry.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_multibuttonentry.Tpo $(DEPDIR)/elementary_testql-test_multibuttonentry.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_multibuttonentry.c' object='elementary_testql-test_multibuttonentry.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_multibuttonentry.o `test -f 'test_multibuttonentry.c' || echo '$(srcdir)/'`test_multibuttonentry.c + +elementary_testql-test_multibuttonentry.obj: test_multibuttonentry.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_multibuttonentry.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_multibuttonentry.Tpo -c -o elementary_testql-test_multibuttonentry.obj `if test -f 'test_multibuttonentry.c'; then $(CYGPATH_W) 'test_multibuttonentry.c'; else $(CYGPATH_W) '$(srcdir)/test_multibuttonentry.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_multibuttonentry.Tpo $(DEPDIR)/elementary_testql-test_multibuttonentry.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_multibuttonentry.c' object='elementary_testql-test_multibuttonentry.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_multibuttonentry.obj `if test -f 'test_multibuttonentry.c'; then $(CYGPATH_W) 'test_multibuttonentry.c'; else $(CYGPATH_W) '$(srcdir)/test_multibuttonentry.c'; fi` + +elementary_testql-test_naviframe.o: test_naviframe.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_naviframe.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_naviframe.Tpo -c -o elementary_testql-test_naviframe.o `test -f 'test_naviframe.c' || echo '$(srcdir)/'`test_naviframe.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_naviframe.Tpo $(DEPDIR)/elementary_testql-test_naviframe.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_naviframe.c' object='elementary_testql-test_naviframe.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_naviframe.o `test -f 'test_naviframe.c' || echo '$(srcdir)/'`test_naviframe.c + +elementary_testql-test_naviframe.obj: test_naviframe.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_naviframe.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_naviframe.Tpo -c -o elementary_testql-test_naviframe.obj `if test -f 'test_naviframe.c'; then $(CYGPATH_W) 'test_naviframe.c'; else $(CYGPATH_W) '$(srcdir)/test_naviframe.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_naviframe.Tpo $(DEPDIR)/elementary_testql-test_naviframe.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_naviframe.c' object='elementary_testql-test_naviframe.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_naviframe.obj `if test -f 'test_naviframe.c'; then $(CYGPATH_W) 'test_naviframe.c'; else $(CYGPATH_W) '$(srcdir)/test_naviframe.c'; fi` + +elementary_testql-test_naviframe_complex.o: test_naviframe_complex.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_naviframe_complex.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_naviframe_complex.Tpo -c -o elementary_testql-test_naviframe_complex.o `test -f 'test_naviframe_complex.c' || echo '$(srcdir)/'`test_naviframe_complex.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_naviframe_complex.Tpo $(DEPDIR)/elementary_testql-test_naviframe_complex.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_naviframe_complex.c' object='elementary_testql-test_naviframe_complex.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_naviframe_complex.o `test -f 'test_naviframe_complex.c' || echo '$(srcdir)/'`test_naviframe_complex.c + +elementary_testql-test_naviframe_complex.obj: test_naviframe_complex.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_naviframe_complex.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_naviframe_complex.Tpo -c -o elementary_testql-test_naviframe_complex.obj `if test -f 'test_naviframe_complex.c'; then $(CYGPATH_W) 'test_naviframe_complex.c'; else $(CYGPATH_W) '$(srcdir)/test_naviframe_complex.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_naviframe_complex.Tpo $(DEPDIR)/elementary_testql-test_naviframe_complex.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_naviframe_complex.c' object='elementary_testql-test_naviframe_complex.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_naviframe_complex.obj `if test -f 'test_naviframe_complex.c'; then $(CYGPATH_W) 'test_naviframe_complex.c'; else $(CYGPATH_W) '$(srcdir)/test_naviframe_complex.c'; fi` + +elementary_testql-test_notify.o: test_notify.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_notify.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_notify.Tpo -c -o elementary_testql-test_notify.o `test -f 'test_notify.c' || echo '$(srcdir)/'`test_notify.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_notify.Tpo $(DEPDIR)/elementary_testql-test_notify.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_notify.c' object='elementary_testql-test_notify.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_notify.o `test -f 'test_notify.c' || echo '$(srcdir)/'`test_notify.c + +elementary_testql-test_notify.obj: test_notify.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_notify.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_notify.Tpo -c -o elementary_testql-test_notify.obj `if test -f 'test_notify.c'; then $(CYGPATH_W) 'test_notify.c'; else $(CYGPATH_W) '$(srcdir)/test_notify.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_notify.Tpo $(DEPDIR)/elementary_testql-test_notify.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_notify.c' object='elementary_testql-test_notify.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_notify.obj `if test -f 'test_notify.c'; then $(CYGPATH_W) 'test_notify.c'; else $(CYGPATH_W) '$(srcdir)/test_notify.c'; fi` + +elementary_testql-test_panel.o: test_panel.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_panel.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_panel.Tpo -c -o elementary_testql-test_panel.o `test -f 'test_panel.c' || echo '$(srcdir)/'`test_panel.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_panel.Tpo $(DEPDIR)/elementary_testql-test_panel.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_panel.c' object='elementary_testql-test_panel.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_panel.o `test -f 'test_panel.c' || echo '$(srcdir)/'`test_panel.c + +elementary_testql-test_panel.obj: test_panel.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_panel.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_panel.Tpo -c -o elementary_testql-test_panel.obj `if test -f 'test_panel.c'; then $(CYGPATH_W) 'test_panel.c'; else $(CYGPATH_W) '$(srcdir)/test_panel.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_panel.Tpo $(DEPDIR)/elementary_testql-test_panel.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_panel.c' object='elementary_testql-test_panel.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_panel.obj `if test -f 'test_panel.c'; then $(CYGPATH_W) 'test_panel.c'; else $(CYGPATH_W) '$(srcdir)/test_panel.c'; fi` + +elementary_testql-test_panes.o: test_panes.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_panes.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_panes.Tpo -c -o elementary_testql-test_panes.o `test -f 'test_panes.c' || echo '$(srcdir)/'`test_panes.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_panes.Tpo $(DEPDIR)/elementary_testql-test_panes.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_panes.c' object='elementary_testql-test_panes.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_panes.o `test -f 'test_panes.c' || echo '$(srcdir)/'`test_panes.c + +elementary_testql-test_panes.obj: test_panes.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_panes.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_panes.Tpo -c -o elementary_testql-test_panes.obj `if test -f 'test_panes.c'; then $(CYGPATH_W) 'test_panes.c'; else $(CYGPATH_W) '$(srcdir)/test_panes.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_panes.Tpo $(DEPDIR)/elementary_testql-test_panes.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_panes.c' object='elementary_testql-test_panes.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_panes.obj `if test -f 'test_panes.c'; then $(CYGPATH_W) 'test_panes.c'; else $(CYGPATH_W) '$(srcdir)/test_panes.c'; fi` + +elementary_testql-test_photo.o: test_photo.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_photo.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_photo.Tpo -c -o elementary_testql-test_photo.o `test -f 'test_photo.c' || echo '$(srcdir)/'`test_photo.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_photo.Tpo $(DEPDIR)/elementary_testql-test_photo.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_photo.c' object='elementary_testql-test_photo.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_photo.o `test -f 'test_photo.c' || echo '$(srcdir)/'`test_photo.c + +elementary_testql-test_photo.obj: test_photo.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_photo.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_photo.Tpo -c -o elementary_testql-test_photo.obj `if test -f 'test_photo.c'; then $(CYGPATH_W) 'test_photo.c'; else $(CYGPATH_W) '$(srcdir)/test_photo.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_photo.Tpo $(DEPDIR)/elementary_testql-test_photo.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_photo.c' object='elementary_testql-test_photo.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_photo.obj `if test -f 'test_photo.c'; then $(CYGPATH_W) 'test_photo.c'; else $(CYGPATH_W) '$(srcdir)/test_photo.c'; fi` + +elementary_testql-test_photocam.o: test_photocam.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_photocam.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_photocam.Tpo -c -o elementary_testql-test_photocam.o `test -f 'test_photocam.c' || echo '$(srcdir)/'`test_photocam.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_photocam.Tpo $(DEPDIR)/elementary_testql-test_photocam.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_photocam.c' object='elementary_testql-test_photocam.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_photocam.o `test -f 'test_photocam.c' || echo '$(srcdir)/'`test_photocam.c + +elementary_testql-test_photocam.obj: test_photocam.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_photocam.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_photocam.Tpo -c -o elementary_testql-test_photocam.obj `if test -f 'test_photocam.c'; then $(CYGPATH_W) 'test_photocam.c'; else $(CYGPATH_W) '$(srcdir)/test_photocam.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_photocam.Tpo $(DEPDIR)/elementary_testql-test_photocam.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_photocam.c' object='elementary_testql-test_photocam.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_photocam.obj `if test -f 'test_photocam.c'; then $(CYGPATH_W) 'test_photocam.c'; else $(CYGPATH_W) '$(srcdir)/test_photocam.c'; fi` + +elementary_testql-test_popup.o: test_popup.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_popup.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_popup.Tpo -c -o elementary_testql-test_popup.o `test -f 'test_popup.c' || echo '$(srcdir)/'`test_popup.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_popup.Tpo $(DEPDIR)/elementary_testql-test_popup.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_popup.c' object='elementary_testql-test_popup.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_popup.o `test -f 'test_popup.c' || echo '$(srcdir)/'`test_popup.c + +elementary_testql-test_popup.obj: test_popup.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_popup.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_popup.Tpo -c -o elementary_testql-test_popup.obj `if test -f 'test_popup.c'; then $(CYGPATH_W) 'test_popup.c'; else $(CYGPATH_W) '$(srcdir)/test_popup.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_popup.Tpo $(DEPDIR)/elementary_testql-test_popup.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_popup.c' object='elementary_testql-test_popup.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_popup.obj `if test -f 'test_popup.c'; then $(CYGPATH_W) 'test_popup.c'; else $(CYGPATH_W) '$(srcdir)/test_popup.c'; fi` + +elementary_testql-test_progressbar.o: test_progressbar.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_progressbar.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_progressbar.Tpo -c -o elementary_testql-test_progressbar.o `test -f 'test_progressbar.c' || echo '$(srcdir)/'`test_progressbar.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_progressbar.Tpo $(DEPDIR)/elementary_testql-test_progressbar.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_progressbar.c' object='elementary_testql-test_progressbar.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_progressbar.o `test -f 'test_progressbar.c' || echo '$(srcdir)/'`test_progressbar.c + +elementary_testql-test_progressbar.obj: test_progressbar.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_progressbar.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_progressbar.Tpo -c -o elementary_testql-test_progressbar.obj `if test -f 'test_progressbar.c'; then $(CYGPATH_W) 'test_progressbar.c'; else $(CYGPATH_W) '$(srcdir)/test_progressbar.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_progressbar.Tpo $(DEPDIR)/elementary_testql-test_progressbar.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_progressbar.c' object='elementary_testql-test_progressbar.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_progressbar.obj `if test -f 'test_progressbar.c'; then $(CYGPATH_W) 'test_progressbar.c'; else $(CYGPATH_W) '$(srcdir)/test_progressbar.c'; fi` + +elementary_testql-test_radio.o: test_radio.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_radio.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_radio.Tpo -c -o elementary_testql-test_radio.o `test -f 'test_radio.c' || echo '$(srcdir)/'`test_radio.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_radio.Tpo $(DEPDIR)/elementary_testql-test_radio.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_radio.c' object='elementary_testql-test_radio.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_radio.o `test -f 'test_radio.c' || echo '$(srcdir)/'`test_radio.c + +elementary_testql-test_radio.obj: test_radio.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_radio.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_radio.Tpo -c -o elementary_testql-test_radio.obj `if test -f 'test_radio.c'; then $(CYGPATH_W) 'test_radio.c'; else $(CYGPATH_W) '$(srcdir)/test_radio.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_radio.Tpo $(DEPDIR)/elementary_testql-test_radio.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_radio.c' object='elementary_testql-test_radio.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_radio.obj `if test -f 'test_radio.c'; then $(CYGPATH_W) 'test_radio.c'; else $(CYGPATH_W) '$(srcdir)/test_radio.c'; fi` + +elementary_testql-test_scaling.o: test_scaling.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_scaling.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_scaling.Tpo -c -o elementary_testql-test_scaling.o `test -f 'test_scaling.c' || echo '$(srcdir)/'`test_scaling.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_scaling.Tpo $(DEPDIR)/elementary_testql-test_scaling.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_scaling.c' object='elementary_testql-test_scaling.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_scaling.o `test -f 'test_scaling.c' || echo '$(srcdir)/'`test_scaling.c + +elementary_testql-test_scaling.obj: test_scaling.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_scaling.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_scaling.Tpo -c -o elementary_testql-test_scaling.obj `if test -f 'test_scaling.c'; then $(CYGPATH_W) 'test_scaling.c'; else $(CYGPATH_W) '$(srcdir)/test_scaling.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_scaling.Tpo $(DEPDIR)/elementary_testql-test_scaling.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_scaling.c' object='elementary_testql-test_scaling.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_scaling.obj `if test -f 'test_scaling.c'; then $(CYGPATH_W) 'test_scaling.c'; else $(CYGPATH_W) '$(srcdir)/test_scaling.c'; fi` + +elementary_testql-test_scroller.o: test_scroller.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_scroller.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_scroller.Tpo -c -o elementary_testql-test_scroller.o `test -f 'test_scroller.c' || echo '$(srcdir)/'`test_scroller.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_scroller.Tpo $(DEPDIR)/elementary_testql-test_scroller.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_scroller.c' object='elementary_testql-test_scroller.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_scroller.o `test -f 'test_scroller.c' || echo '$(srcdir)/'`test_scroller.c + +elementary_testql-test_scroller.obj: test_scroller.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_scroller.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_scroller.Tpo -c -o elementary_testql-test_scroller.obj `if test -f 'test_scroller.c'; then $(CYGPATH_W) 'test_scroller.c'; else $(CYGPATH_W) '$(srcdir)/test_scroller.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_scroller.Tpo $(DEPDIR)/elementary_testql-test_scroller.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_scroller.c' object='elementary_testql-test_scroller.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_scroller.obj `if test -f 'test_scroller.c'; then $(CYGPATH_W) 'test_scroller.c'; else $(CYGPATH_W) '$(srcdir)/test_scroller.c'; fi` + +elementary_testql-test_segment_control.o: test_segment_control.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_segment_control.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_segment_control.Tpo -c -o elementary_testql-test_segment_control.o `test -f 'test_segment_control.c' || echo '$(srcdir)/'`test_segment_control.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_segment_control.Tpo $(DEPDIR)/elementary_testql-test_segment_control.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_segment_control.c' object='elementary_testql-test_segment_control.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_segment_control.o `test -f 'test_segment_control.c' || echo '$(srcdir)/'`test_segment_control.c + +elementary_testql-test_segment_control.obj: test_segment_control.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_segment_control.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_segment_control.Tpo -c -o elementary_testql-test_segment_control.obj `if test -f 'test_segment_control.c'; then $(CYGPATH_W) 'test_segment_control.c'; else $(CYGPATH_W) '$(srcdir)/test_segment_control.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_segment_control.Tpo $(DEPDIR)/elementary_testql-test_segment_control.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_segment_control.c' object='elementary_testql-test_segment_control.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_segment_control.obj `if test -f 'test_segment_control.c'; then $(CYGPATH_W) 'test_segment_control.c'; else $(CYGPATH_W) '$(srcdir)/test_segment_control.c'; fi` + +elementary_testql-test_separator.o: test_separator.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_separator.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_separator.Tpo -c -o elementary_testql-test_separator.o `test -f 'test_separator.c' || echo '$(srcdir)/'`test_separator.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_separator.Tpo $(DEPDIR)/elementary_testql-test_separator.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_separator.c' object='elementary_testql-test_separator.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_separator.o `test -f 'test_separator.c' || echo '$(srcdir)/'`test_separator.c + +elementary_testql-test_separator.obj: test_separator.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_separator.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_separator.Tpo -c -o elementary_testql-test_separator.obj `if test -f 'test_separator.c'; then $(CYGPATH_W) 'test_separator.c'; else $(CYGPATH_W) '$(srcdir)/test_separator.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_separator.Tpo $(DEPDIR)/elementary_testql-test_separator.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_separator.c' object='elementary_testql-test_separator.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_separator.obj `if test -f 'test_separator.c'; then $(CYGPATH_W) 'test_separator.c'; else $(CYGPATH_W) '$(srcdir)/test_separator.c'; fi` + +elementary_testql-test_slider.o: test_slider.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_slider.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_slider.Tpo -c -o elementary_testql-test_slider.o `test -f 'test_slider.c' || echo '$(srcdir)/'`test_slider.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_slider.Tpo $(DEPDIR)/elementary_testql-test_slider.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_slider.c' object='elementary_testql-test_slider.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_slider.o `test -f 'test_slider.c' || echo '$(srcdir)/'`test_slider.c + +elementary_testql-test_slider.obj: test_slider.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_slider.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_slider.Tpo -c -o elementary_testql-test_slider.obj `if test -f 'test_slider.c'; then $(CYGPATH_W) 'test_slider.c'; else $(CYGPATH_W) '$(srcdir)/test_slider.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_slider.Tpo $(DEPDIR)/elementary_testql-test_slider.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_slider.c' object='elementary_testql-test_slider.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_slider.obj `if test -f 'test_slider.c'; then $(CYGPATH_W) 'test_slider.c'; else $(CYGPATH_W) '$(srcdir)/test_slider.c'; fi` + +elementary_testql-test_slideshow.o: test_slideshow.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_slideshow.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_slideshow.Tpo -c -o elementary_testql-test_slideshow.o `test -f 'test_slideshow.c' || echo '$(srcdir)/'`test_slideshow.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_slideshow.Tpo $(DEPDIR)/elementary_testql-test_slideshow.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_slideshow.c' object='elementary_testql-test_slideshow.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_slideshow.o `test -f 'test_slideshow.c' || echo '$(srcdir)/'`test_slideshow.c + +elementary_testql-test_slideshow.obj: test_slideshow.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_slideshow.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_slideshow.Tpo -c -o elementary_testql-test_slideshow.obj `if test -f 'test_slideshow.c'; then $(CYGPATH_W) 'test_slideshow.c'; else $(CYGPATH_W) '$(srcdir)/test_slideshow.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_slideshow.Tpo $(DEPDIR)/elementary_testql-test_slideshow.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_slideshow.c' object='elementary_testql-test_slideshow.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_slideshow.obj `if test -f 'test_slideshow.c'; then $(CYGPATH_W) 'test_slideshow.c'; else $(CYGPATH_W) '$(srcdir)/test_slideshow.c'; fi` + +elementary_testql-test_spinner.o: test_spinner.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_spinner.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_spinner.Tpo -c -o elementary_testql-test_spinner.o `test -f 'test_spinner.c' || echo '$(srcdir)/'`test_spinner.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_spinner.Tpo $(DEPDIR)/elementary_testql-test_spinner.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_spinner.c' object='elementary_testql-test_spinner.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_spinner.o `test -f 'test_spinner.c' || echo '$(srcdir)/'`test_spinner.c + +elementary_testql-test_spinner.obj: test_spinner.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_spinner.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_spinner.Tpo -c -o elementary_testql-test_spinner.obj `if test -f 'test_spinner.c'; then $(CYGPATH_W) 'test_spinner.c'; else $(CYGPATH_W) '$(srcdir)/test_spinner.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_spinner.Tpo $(DEPDIR)/elementary_testql-test_spinner.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_spinner.c' object='elementary_testql-test_spinner.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_spinner.obj `if test -f 'test_spinner.c'; then $(CYGPATH_W) 'test_spinner.c'; else $(CYGPATH_W) '$(srcdir)/test_spinner.c'; fi` + +elementary_testql-test_store.o: test_store.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_store.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_store.Tpo -c -o elementary_testql-test_store.o `test -f 'test_store.c' || echo '$(srcdir)/'`test_store.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_store.Tpo $(DEPDIR)/elementary_testql-test_store.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_store.c' object='elementary_testql-test_store.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_store.o `test -f 'test_store.c' || echo '$(srcdir)/'`test_store.c + +elementary_testql-test_store.obj: test_store.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_store.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_store.Tpo -c -o elementary_testql-test_store.obj `if test -f 'test_store.c'; then $(CYGPATH_W) 'test_store.c'; else $(CYGPATH_W) '$(srcdir)/test_store.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_store.Tpo $(DEPDIR)/elementary_testql-test_store.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_store.c' object='elementary_testql-test_store.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_store.obj `if test -f 'test_store.c'; then $(CYGPATH_W) 'test_store.c'; else $(CYGPATH_W) '$(srcdir)/test_store.c'; fi` + +elementary_testql-test_table.o: test_table.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_table.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_table.Tpo -c -o elementary_testql-test_table.o `test -f 'test_table.c' || echo '$(srcdir)/'`test_table.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_table.Tpo $(DEPDIR)/elementary_testql-test_table.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_table.c' object='elementary_testql-test_table.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_table.o `test -f 'test_table.c' || echo '$(srcdir)/'`test_table.c + +elementary_testql-test_table.obj: test_table.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_table.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_table.Tpo -c -o elementary_testql-test_table.obj `if test -f 'test_table.c'; then $(CYGPATH_W) 'test_table.c'; else $(CYGPATH_W) '$(srcdir)/test_table.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_table.Tpo $(DEPDIR)/elementary_testql-test_table.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_table.c' object='elementary_testql-test_table.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_table.obj `if test -f 'test_table.c'; then $(CYGPATH_W) 'test_table.c'; else $(CYGPATH_W) '$(srcdir)/test_table.c'; fi` + +elementary_testql-test_thumb.o: test_thumb.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_thumb.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_thumb.Tpo -c -o elementary_testql-test_thumb.o `test -f 'test_thumb.c' || echo '$(srcdir)/'`test_thumb.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_thumb.Tpo $(DEPDIR)/elementary_testql-test_thumb.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_thumb.c' object='elementary_testql-test_thumb.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_thumb.o `test -f 'test_thumb.c' || echo '$(srcdir)/'`test_thumb.c + +elementary_testql-test_thumb.obj: test_thumb.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_thumb.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_thumb.Tpo -c -o elementary_testql-test_thumb.obj `if test -f 'test_thumb.c'; then $(CYGPATH_W) 'test_thumb.c'; else $(CYGPATH_W) '$(srcdir)/test_thumb.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_thumb.Tpo $(DEPDIR)/elementary_testql-test_thumb.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_thumb.c' object='elementary_testql-test_thumb.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_thumb.obj `if test -f 'test_thumb.c'; then $(CYGPATH_W) 'test_thumb.c'; else $(CYGPATH_W) '$(srcdir)/test_thumb.c'; fi` + +elementary_testql-test_toolbar.o: test_toolbar.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_toolbar.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_toolbar.Tpo -c -o elementary_testql-test_toolbar.o `test -f 'test_toolbar.c' || echo '$(srcdir)/'`test_toolbar.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_toolbar.Tpo $(DEPDIR)/elementary_testql-test_toolbar.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_toolbar.c' object='elementary_testql-test_toolbar.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_toolbar.o `test -f 'test_toolbar.c' || echo '$(srcdir)/'`test_toolbar.c + +elementary_testql-test_toolbar.obj: test_toolbar.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_toolbar.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_toolbar.Tpo -c -o elementary_testql-test_toolbar.obj `if test -f 'test_toolbar.c'; then $(CYGPATH_W) 'test_toolbar.c'; else $(CYGPATH_W) '$(srcdir)/test_toolbar.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_toolbar.Tpo $(DEPDIR)/elementary_testql-test_toolbar.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_toolbar.c' object='elementary_testql-test_toolbar.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_toolbar.obj `if test -f 'test_toolbar.c'; then $(CYGPATH_W) 'test_toolbar.c'; else $(CYGPATH_W) '$(srcdir)/test_toolbar.c'; fi` + +elementary_testql-test_tooltip.o: test_tooltip.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_tooltip.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_tooltip.Tpo -c -o elementary_testql-test_tooltip.o `test -f 'test_tooltip.c' || echo '$(srcdir)/'`test_tooltip.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_tooltip.Tpo $(DEPDIR)/elementary_testql-test_tooltip.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_tooltip.c' object='elementary_testql-test_tooltip.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_tooltip.o `test -f 'test_tooltip.c' || echo '$(srcdir)/'`test_tooltip.c + +elementary_testql-test_tooltip.obj: test_tooltip.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_tooltip.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_tooltip.Tpo -c -o elementary_testql-test_tooltip.obj `if test -f 'test_tooltip.c'; then $(CYGPATH_W) 'test_tooltip.c'; else $(CYGPATH_W) '$(srcdir)/test_tooltip.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_tooltip.Tpo $(DEPDIR)/elementary_testql-test_tooltip.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_tooltip.c' object='elementary_testql-test_tooltip.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_tooltip.obj `if test -f 'test_tooltip.c'; then $(CYGPATH_W) 'test_tooltip.c'; else $(CYGPATH_W) '$(srcdir)/test_tooltip.c'; fi` + +elementary_testql-test_transit.o: test_transit.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_transit.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_transit.Tpo -c -o elementary_testql-test_transit.o `test -f 'test_transit.c' || echo '$(srcdir)/'`test_transit.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_transit.Tpo $(DEPDIR)/elementary_testql-test_transit.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_transit.c' object='elementary_testql-test_transit.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_transit.o `test -f 'test_transit.c' || echo '$(srcdir)/'`test_transit.c + +elementary_testql-test_transit.obj: test_transit.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_transit.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_transit.Tpo -c -o elementary_testql-test_transit.obj `if test -f 'test_transit.c'; then $(CYGPATH_W) 'test_transit.c'; else $(CYGPATH_W) '$(srcdir)/test_transit.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_transit.Tpo $(DEPDIR)/elementary_testql-test_transit.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_transit.c' object='elementary_testql-test_transit.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_transit.obj `if test -f 'test_transit.c'; then $(CYGPATH_W) 'test_transit.c'; else $(CYGPATH_W) '$(srcdir)/test_transit.c'; fi` + +elementary_testql-test_video.o: test_video.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_video.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_video.Tpo -c -o elementary_testql-test_video.o `test -f 'test_video.c' || echo '$(srcdir)/'`test_video.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_video.Tpo $(DEPDIR)/elementary_testql-test_video.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_video.c' object='elementary_testql-test_video.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_video.o `test -f 'test_video.c' || echo '$(srcdir)/'`test_video.c + +elementary_testql-test_video.obj: test_video.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_video.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_video.Tpo -c -o elementary_testql-test_video.obj `if test -f 'test_video.c'; then $(CYGPATH_W) 'test_video.c'; else $(CYGPATH_W) '$(srcdir)/test_video.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_video.Tpo $(DEPDIR)/elementary_testql-test_video.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_video.c' object='elementary_testql-test_video.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_video.obj `if test -f 'test_video.c'; then $(CYGPATH_W) 'test_video.c'; else $(CYGPATH_W) '$(srcdir)/test_video.c'; fi` + +elementary_testql-test_weather.o: test_weather.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_weather.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_weather.Tpo -c -o elementary_testql-test_weather.o `test -f 'test_weather.c' || echo '$(srcdir)/'`test_weather.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_weather.Tpo $(DEPDIR)/elementary_testql-test_weather.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_weather.c' object='elementary_testql-test_weather.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_weather.o `test -f 'test_weather.c' || echo '$(srcdir)/'`test_weather.c + +elementary_testql-test_weather.obj: test_weather.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_weather.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_weather.Tpo -c -o elementary_testql-test_weather.obj `if test -f 'test_weather.c'; then $(CYGPATH_W) 'test_weather.c'; else $(CYGPATH_W) '$(srcdir)/test_weather.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_weather.Tpo $(DEPDIR)/elementary_testql-test_weather.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_weather.c' object='elementary_testql-test_weather.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_weather.obj `if test -f 'test_weather.c'; then $(CYGPATH_W) 'test_weather.c'; else $(CYGPATH_W) '$(srcdir)/test_weather.c'; fi` + +elementary_testql-test_web.o: test_web.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_web.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_web.Tpo -c -o elementary_testql-test_web.o `test -f 'test_web.c' || echo '$(srcdir)/'`test_web.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_web.Tpo $(DEPDIR)/elementary_testql-test_web.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_web.c' object='elementary_testql-test_web.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_web.o `test -f 'test_web.c' || echo '$(srcdir)/'`test_web.c + +elementary_testql-test_web.obj: test_web.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_web.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_web.Tpo -c -o elementary_testql-test_web.obj `if test -f 'test_web.c'; then $(CYGPATH_W) 'test_web.c'; else $(CYGPATH_W) '$(srcdir)/test_web.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_web.Tpo $(DEPDIR)/elementary_testql-test_web.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_web.c' object='elementary_testql-test_web.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_web.obj `if test -f 'test_web.c'; then $(CYGPATH_W) 'test_web.c'; else $(CYGPATH_W) '$(srcdir)/test_web.c'; fi` + +elementary_testql-test_win_inline.o: test_win_inline.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_win_inline.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_win_inline.Tpo -c -o elementary_testql-test_win_inline.o `test -f 'test_win_inline.c' || echo '$(srcdir)/'`test_win_inline.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_win_inline.Tpo $(DEPDIR)/elementary_testql-test_win_inline.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_win_inline.c' object='elementary_testql-test_win_inline.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_win_inline.o `test -f 'test_win_inline.c' || echo '$(srcdir)/'`test_win_inline.c + +elementary_testql-test_win_inline.obj: test_win_inline.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_win_inline.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_win_inline.Tpo -c -o elementary_testql-test_win_inline.obj `if test -f 'test_win_inline.c'; then $(CYGPATH_W) 'test_win_inline.c'; else $(CYGPATH_W) '$(srcdir)/test_win_inline.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_win_inline.Tpo $(DEPDIR)/elementary_testql-test_win_inline.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_win_inline.c' object='elementary_testql-test_win_inline.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_win_inline.obj `if test -f 'test_win_inline.c'; then $(CYGPATH_W) 'test_win_inline.c'; else $(CYGPATH_W) '$(srcdir)/test_win_inline.c'; fi` + +elementary_testql-test_win_socket.o: test_win_socket.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_win_socket.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_win_socket.Tpo -c -o elementary_testql-test_win_socket.o `test -f 'test_win_socket.c' || echo '$(srcdir)/'`test_win_socket.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_win_socket.Tpo $(DEPDIR)/elementary_testql-test_win_socket.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_win_socket.c' object='elementary_testql-test_win_socket.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_win_socket.o `test -f 'test_win_socket.c' || echo '$(srcdir)/'`test_win_socket.c + +elementary_testql-test_win_socket.obj: test_win_socket.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_win_socket.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_win_socket.Tpo -c -o elementary_testql-test_win_socket.obj `if test -f 'test_win_socket.c'; then $(CYGPATH_W) 'test_win_socket.c'; else $(CYGPATH_W) '$(srcdir)/test_win_socket.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_win_socket.Tpo $(DEPDIR)/elementary_testql-test_win_socket.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_win_socket.c' object='elementary_testql-test_win_socket.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_win_socket.obj `if test -f 'test_win_socket.c'; then $(CYGPATH_W) 'test_win_socket.c'; else $(CYGPATH_W) '$(srcdir)/test_win_socket.c'; fi` + +elementary_testql-test_win_plug.o: test_win_plug.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_win_plug.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_win_plug.Tpo -c -o elementary_testql-test_win_plug.o `test -f 'test_win_plug.c' || echo '$(srcdir)/'`test_win_plug.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_win_plug.Tpo $(DEPDIR)/elementary_testql-test_win_plug.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_win_plug.c' object='elementary_testql-test_win_plug.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_win_plug.o `test -f 'test_win_plug.c' || echo '$(srcdir)/'`test_win_plug.c + +elementary_testql-test_win_plug.obj: test_win_plug.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_win_plug.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_win_plug.Tpo -c -o elementary_testql-test_win_plug.obj `if test -f 'test_win_plug.c'; then $(CYGPATH_W) 'test_win_plug.c'; else $(CYGPATH_W) '$(srcdir)/test_win_plug.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_win_plug.Tpo $(DEPDIR)/elementary_testql-test_win_plug.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_win_plug.c' object='elementary_testql-test_win_plug.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_win_plug.obj `if test -f 'test_win_plug.c'; then $(CYGPATH_W) 'test_win_plug.c'; else $(CYGPATH_W) '$(srcdir)/test_win_plug.c'; fi` + +elementary_testql-test_win_state.o: test_win_state.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_win_state.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_win_state.Tpo -c -o elementary_testql-test_win_state.o `test -f 'test_win_state.c' || echo '$(srcdir)/'`test_win_state.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_win_state.Tpo $(DEPDIR)/elementary_testql-test_win_state.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_win_state.c' object='elementary_testql-test_win_state.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_win_state.o `test -f 'test_win_state.c' || echo '$(srcdir)/'`test_win_state.c + +elementary_testql-test_win_state.obj: test_win_state.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_win_state.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_win_state.Tpo -c -o elementary_testql-test_win_state.obj `if test -f 'test_win_state.c'; then $(CYGPATH_W) 'test_win_state.c'; else $(CYGPATH_W) '$(srcdir)/test_win_state.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_win_state.Tpo $(DEPDIR)/elementary_testql-test_win_state.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_win_state.c' object='elementary_testql-test_win_state.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_win_state.obj `if test -f 'test_win_state.c'; then $(CYGPATH_W) 'test_win_state.c'; else $(CYGPATH_W) '$(srcdir)/test_win_state.c'; fi` + +elementary_testql-test_eio.o: test_eio.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_eio.o -MD -MP -MF $(DEPDIR)/elementary_testql-test_eio.Tpo -c -o elementary_testql-test_eio.o `test -f 'test_eio.c' || echo '$(srcdir)/'`test_eio.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_eio.Tpo $(DEPDIR)/elementary_testql-test_eio.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_eio.c' object='elementary_testql-test_eio.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_eio.o `test -f 'test_eio.c' || echo '$(srcdir)/'`test_eio.c + +elementary_testql-test_eio.obj: test_eio.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -MT elementary_testql-test_eio.obj -MD -MP -MF $(DEPDIR)/elementary_testql-test_eio.Tpo -c -o elementary_testql-test_eio.obj `if test -f 'test_eio.c'; then $(CYGPATH_W) 'test_eio.c'; else $(CYGPATH_W) '$(srcdir)/test_eio.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elementary_testql-test_eio.Tpo $(DEPDIR)/elementary_testql-test_eio.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_eio.c' object='elementary_testql-test_eio.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elementary_testql_CFLAGS) $(CFLAGS) -c -o elementary_testql-test_eio.obj `if test -f 'test_eio.c'; then $(CYGPATH_W) 'test_eio.c'; else $(CYGPATH_W) '$(srcdir)/test_eio.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(elementary_testqldir)" "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-binPROGRAMS clean-elementary_testqlLTLIBRARIES \ + clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-elementary_testqlLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS \ + uninstall-elementary_testqlLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-elementary_testqlLTLIBRARIES clean-generic clean-libtool \ + ctags distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-dvi install-dvi-am \ + install-elementary_testqlLTLIBRARIES install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-elementary_testqlLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/elementary/src/bin/config.c b/libraries/elementary/src/bin/config.c new file mode 100644 index 0000000..3f371a9 --- /dev/null +++ b/libraries/elementary/src/bin/config.c @@ -0,0 +1,3133 @@ +#include +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#ifndef ELM_LIB_QUICKLAUNCH + +typedef struct _Theme Theme; +typedef struct _Fonts_Data Fonts_Data; +typedef struct _Elm_Text_Class_Data Elm_Text_Class_Data; +typedef struct _Elm_Font_Size_Data Elm_Font_Size_Data; + +struct _Theme +{ + const char *label; + const char *name; + const char *path; + Eina_Bool in_search_path; +}; + +static const Eina_List *tsel = NULL; +static Eina_List *themes = NULL; + +struct _Elm_Text_Class_Data +{ + const char *name; + const char *desc; + const char *font; + const char *style; + Evas_Font_Size size; +}; + +struct _Elm_Font_Size_Data +{ + const char *size_str; + Evas_Font_Size size; +}; + +struct _Fonts_Data +{ + Eina_List *text_classes; + + Eina_Hash *font_hash; + Eina_List *font_px_list; + Eina_List *font_scale_list; + + const char *cur_font; + const char *cur_style; + double cur_size; +}; + +#define ELM_LIST_DISABLE(list) \ + do \ + { \ + const Eina_List *_l = elm_list_items_get(list); \ + if (_l) \ + { \ + elm_list_item_show(eina_list_data_get(_l));\ + elm_object_disabled_set(list, EINA_TRUE); \ + } \ + } \ + while (0) + +#define ELM_LIST_ENABLE(list) \ + do \ + { \ + elm_object_disabled_set(list, EINA_FALSE); \ + } \ + while (0) + +#define LABEL_FRAME_ADD(label) \ + do \ + { \ + pd = elm_frame_add(win); \ + evas_object_size_hint_weight_set(pd, EVAS_HINT_EXPAND, 0.0); \ + evas_object_size_hint_align_set(pd, EVAS_HINT_FILL, 0.5); \ + elm_object_style_set(pd, "pad_medium"); \ + elm_box_pack_end(bx, pd); \ + evas_object_show(pd); \ + \ + lb = elm_label_add(win); \ + evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0); \ + evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, 0.5); \ + elm_object_text_set(lb, label); \ + elm_object_content_set(pd, lb); \ + evas_object_show(lb); \ + } \ + while (0) + +static int quiet = 0; +static int interactive = 1; + +static const char *theme_set = NULL; +static const char *finger_size_set = NULL; +static const char *scale_set = NULL; +static Fonts_Data fndata = {NULL, NULL, NULL, NULL, NULL, NULL, 0.0}; + +static void +_font_styles_list_sel(void *data __UNUSED__, + Evas_Object *obj, + void *event_info); + +static void +config_exit(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Elm_Text_Class_Data *tc_data; + Elm_Font_Size_Data *sd; + + EINA_LIST_FREE(fndata.text_classes, tc_data) + { + eina_stringshare_del(tc_data->name); + eina_stringshare_del(tc_data->desc); + eina_stringshare_del(tc_data->font); + eina_stringshare_del(tc_data->style); + free(tc_data); + } + + elm_font_available_hash_del(fndata.font_hash); + fndata.font_hash = NULL; + + EINA_LIST_FREE(fndata.font_px_list, sd) + { + eina_stringshare_del(sd->size_str); + free(sd); + } + + EINA_LIST_FREE(fndata.font_scale_list, sd) + { + eina_stringshare_del(sd->size_str); + free(sd); + } + + if (fndata.cur_font) eina_stringshare_del(fndata.cur_font); + fndata.cur_font = NULL; + + if (fndata.cur_style) eina_stringshare_del(fndata.cur_style); + fndata.cur_style = NULL; + + elm_config_save(); + elm_exit(); /* exit the program's main loop that runs in elm_run() */ +} + +static void +sb_change(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Eina_Bool val = elm_check_state_get(obj); + Eina_Bool sb = elm_config_scroll_bounce_enabled_get(); + + if (val == sb) return; + elm_config_scroll_bounce_enabled_set(val); + elm_config_all_flush(); + + /*TODO: enable/disable subordinate sliders (make 'em support it 1st)*/ +} + +static void +bf_round(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double val = elm_slider_value_get(obj); + double v; + + v = ((double)((int)(val * 10.0))) / 10.0; + if (v != val) elm_slider_value_set(obj, v); +} + +static void +bf_change(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double bf = elm_config_scroll_bounce_friction_get(); + double val = elm_slider_value_get(obj); + + if (bf == val) return; + elm_config_scroll_bounce_friction_set(val); + elm_config_all_flush(); +} + +static void +ps_round(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double val = elm_slider_value_get(obj); + double v; + + v = ((double)((int)(val * 10.0))) / 10.0; + if (v != val) elm_slider_value_set(obj, v); +} + +static void +ps_change(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double ps = elm_config_scroll_page_scroll_friction_get(); + double val = elm_slider_value_get(obj); + + if (ps == val) return; + elm_config_scroll_page_scroll_friction_set(val); + elm_config_all_flush(); +} + +static void +bis_round(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double val = elm_slider_value_get(obj); + double v; + + v = ((double)((int)(val * 10.0))) / 10.0; + if (v != val) elm_slider_value_set(obj, v); +} + +static void +bis_change(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double bis = elm_config_scroll_bring_in_scroll_friction_get(); + double val = elm_slider_value_get(obj); + + if (bis == val) return; + elm_config_scroll_bring_in_scroll_friction_set(val); + elm_config_all_flush(); +} + +static void +zf_round(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double val = elm_slider_value_get(obj); + double v; + + v = ((double)((int)(val * 10.0))) / 10.0; + if (v != val) elm_slider_value_set(obj, v); +} + +static void +zf_change(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double zf = elm_config_scroll_zoom_friction_get(); + double val = elm_slider_value_get(obj); + + if (zf == val) return; + elm_config_scroll_zoom_friction_set(val); + elm_config_all_flush(); +} + +static void +ts_change(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Eina_Bool val = elm_check_state_get(obj); + Eina_Bool sb = elm_config_scroll_thumbscroll_enabled_get(); + + if (val == sb) return; + elm_config_scroll_thumbscroll_enabled_set(val); + elm_config_all_flush(); + + /*TODO: enable/disable subordinate sliders (make 'em support it 1st)*/ +} + +static void +tst_round(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double val = elm_slider_value_get(obj); + double v; + + v = ((double)((int)(val * 10.0))) / 10.0; + if (v != val) elm_slider_value_set(obj, v); +} + +static void +tst_change(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double tst = elm_config_scroll_thumbscroll_threshold_get(); + double val = elm_slider_value_get(obj); + + if (tst == val) return; + elm_config_scroll_thumbscroll_threshold_set(val); + elm_config_all_flush(); +} + +static void +tsmt_round(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double val = elm_slider_value_get(obj); + double v; + + v = ((double)((int)(val * 10.0))) / 10.0; + if (v != val) elm_slider_value_set(obj, v); +} + +static void +tsmt_change(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double tsmt = elm_config_scroll_thumbscroll_momentum_threshold_get(); + double val = elm_slider_value_get(obj); + + if (tsmt == val) return; + elm_config_scroll_thumbscroll_momentum_threshold_set(val); + elm_config_all_flush(); +} + +static void +tsf_round(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double val = elm_slider_value_get(obj); + double v; + + v = ((double)((int)(val * 10.0))) / 10.0; + if (v != val) elm_slider_value_set(obj, v); +} + +static void +tsf_change(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double tsf = elm_config_scroll_thumbscroll_friction_get(); + double val = elm_slider_value_get(obj); + + if (tsf == val) return; + elm_config_scroll_thumbscroll_friction_set(val); + elm_config_all_flush(); +} + +static void +tsbf_round(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double val = elm_slider_value_get(obj); + double v; + + v = ((double)((int)(val * 10.0))) / 10.0; + if (v != val) elm_slider_value_set(obj, v); +} + +static void +tsbf_change(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double tsbf = elm_config_scroll_thumbscroll_border_friction_get(); + double val = elm_slider_value_get(obj); + + if (tsbf == val) return; + elm_config_scroll_thumbscroll_border_friction_set(val); + elm_config_all_flush(); +} + +static void +tssf_round(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double val = elm_slider_value_get(obj); + double v; + + v = ((double)((int)(val * 20.0))) / 20.0; + if (v != val) elm_slider_value_set(obj, v); +} + +static void +tssf_change(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double tssf = elm_config_scroll_thumbscroll_sensitivity_friction_get(); + double val = elm_slider_value_get(obj); + + if (tssf == val) return; + elm_config_scroll_thumbscroll_sensitivity_friction_set(val); + elm_config_all_flush(); +} + +static void +cf_enable(void *data, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Eina_Bool cf = elm_config_cache_flush_enabled_get(); + Eina_Bool val = elm_check_state_get(obj); + + if (cf == val) return; + elm_object_disabled_set((Evas_Object *)data, !val); + elm_config_cache_flush_enabled_set(val); + elm_config_all_flush(); +} + +static void +cf_round(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double val = elm_slider_value_get(obj); + double v; + + v = ((double)((int)(val * 5.0))) / 5.0; + if (v != val) elm_slider_value_set(obj, v); +} + +static void +cf_change(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double cf = elm_config_cache_flush_interval_get(); + double val = elm_slider_value_get(obj); + + if (cf == val) return; + elm_config_cache_flush_interval_set(val); + elm_config_all_flush(); +} + +static void +fc_round(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double val = elm_slider_value_get(obj); + double v; + + v = ((double)((int)(val * 10.0))) / 10.0; + if (v != val) elm_slider_value_set(obj, v); +} + +static void +fc_change(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double font_cache = elm_config_cache_font_cache_size_get(); + double val = elm_slider_value_get(obj); + + if (font_cache == val) return; + elm_config_cache_font_cache_size_set(val * 1024); + elm_config_all_flush(); +} + +static void +ic_round(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double val = elm_slider_value_get(obj); + double v; + + v = ((double)((int)(val * 10.0))) / 10.0; + if (v != val) elm_slider_value_set(obj, v); +} + +static void +ic_change(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double image_cache = elm_config_cache_image_cache_size_get(); + double val = elm_slider_value_get(obj); + + if (image_cache == val) return; + elm_config_cache_image_cache_size_set(val * 1024); + elm_config_all_flush(); +} + +static void +sc_round(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double val = elm_slider_value_get(obj); + double v; + + v = ((double)((int)(val * 10.0))) / 10.0; + if (v != val) elm_slider_value_set(obj, v); +} + +static void +sc_change(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double scale = elm_config_scale_get(); + double val = elm_slider_value_get(obj); + + if (scale == val) return; + elm_config_scale_set(val); + elm_config_all_flush(); +} + +static void +fs_round(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double val = elm_slider_value_get(obj); + double v; + + v = ((double)((int)(val * 5.0))) / 5.0; + if (v != val) elm_slider_value_set(obj, v); +} + +static void +fs_change(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double fs = elm_config_finger_size_get(); + double val = elm_slider_value_get(obj); + + if (fs == val) return; + elm_config_finger_size_set(val); + elm_config_all_flush(); +} + +static void +efc_round(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double val = elm_slider_value_get(obj); + double v; + + v = ((double)((int)(val * 5.0))) / 5.0; + if (v != val) elm_slider_value_set(obj, v); +} + +static void +efc_change(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double efc = elm_config_cache_edje_file_cache_size_get(); + double val = elm_slider_value_get(obj); + + if (efc == val) return; + elm_config_cache_edje_file_cache_size_set(val); + elm_config_all_flush(); +} + +static void +ecc_round(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double val = elm_slider_value_get(obj); + double v; + + v = ((double)((int)(val * 5.0))) / 5.0; + if (v != val) elm_slider_value_set(obj, v); +} + +static void +ecc_change(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double ecc = elm_config_cache_edje_collection_cache_size_get(); + double val = elm_slider_value_get(obj); + + if (ecc == val) return; + elm_config_cache_edje_collection_cache_size_set(val); + elm_config_all_flush(); +} + +static void +_status_basic(Evas_Object *win, + Evas_Object *bx0) +{ + Evas_Object *lb, *fr; + + fr = elm_frame_add(win); + evas_object_size_hint_weight_set(fr, 1.0, 1.0); + elm_object_text_set(fr, "Information"); + elm_box_pack_end(bx0, fr); + evas_object_show(fr); + + lb = elm_label_add(win); + elm_object_text_set(lb, + "Applying configuration change" + ); + elm_object_content_set(fr, lb); + evas_object_show(lb); +} + +static void +_status_config(Evas_Object *win, + Evas_Object *bx0) +{ + Evas_Object *lb, *pd, *bx, *fr, *sl, *sp; + + fr = elm_frame_add(win); + evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(fr, "Sizing"); + elm_box_pack_end(bx0, fr); + evas_object_show(fr); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.5); + + LABEL_FRAME_ADD("Scale"); + + sl = elm_slider_add(win); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + elm_slider_span_size_set(sl, 120); + elm_slider_unit_format_set(sl, "%1.2f"); + elm_slider_indicator_format_set(sl, "%1.2f"); + elm_slider_min_max_set(sl, 0.25, 5.0); + elm_slider_value_set(sl, elm_config_scale_get()); + elm_box_pack_end(bx, sl); + evas_object_show(sl); + + evas_object_smart_callback_add(sl, "changed", sc_round, NULL); + evas_object_smart_callback_add(sl, "delay,changed", sc_change, NULL); + + sp = elm_separator_add(win); + elm_separator_horizontal_set(sp, EINA_TRUE); + evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, sp); + evas_object_show(sp); + + LABEL_FRAME_ADD("Finger Size
"); + + sl = elm_slider_add(win); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + elm_slider_span_size_set(sl, 120); + elm_slider_unit_format_set(sl, "%1.0f"); + elm_slider_indicator_format_set(sl, "%1.0f"); + elm_slider_min_max_set(sl, 5, 200); + elm_slider_value_set(sl, elm_config_finger_size_get()); + elm_box_pack_end(bx, sl); + evas_object_show(sl); + + evas_object_smart_callback_add(sl, "changed", fs_round, NULL); + evas_object_smart_callback_add(sl, "delay,changed", fs_change, NULL); + + // FIXME: add theme selector (basic mode and advanced for fallbacks) + // FIXME: save config + // FIXME: profile selector / creator etc. + elm_object_content_set(fr, bx); + evas_object_show(bx); +} + +static void +_flip_to(Evas_Object *win, + const char *name) +{ + Evas_Object *wid, *naviframe; + wid = evas_object_data_get(win, name); + naviframe = evas_object_data_get(win, "naviframe"); + elm_naviframe_item_simple_promote(naviframe, wid); +} + +static void +_cf_sizing(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + _flip_to(data, "sizing"); +} + +static void +_cf_themes(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + _flip_to(data, "themes"); +} + +static void +_cf_fonts(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + _flip_to(data, "fonts"); +} + +static void +_cf_profiles(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + _flip_to(data, "profiles"); +} + +static void +_cf_scrolling(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + _flip_to(data, "scrolling"); +} + +static void +_cf_rendering(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + _flip_to(data, "rendering"); +} + +static void +_cf_caches(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + _flip_to(data, "caches"); +} + +const char * +_elm_theme_current_get(const char *theme_search_order) +{ + const char *ret; + const char *p; + + if (!theme_search_order) + return NULL; + + for (p = theme_search_order;; p++) + { + if ((*p == ':') || (!*p)) + { + if (p > theme_search_order) + { + char *n = malloc(p - theme_search_order + 1); + if (!n) + return NULL; + + strncpy(n, theme_search_order, p - theme_search_order); + n[p - theme_search_order] = 0; + ret = eina_stringshare_add(n); + free(n); + break; + } + } + } + + return ret; +} + +static void +_font_overlay_set_all(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *win, *fclasses; + Elm_Text_Class_Data *tc_data, *tc; + Elm_Object_Item *list_it; + Eina_List *l; + + win = data; + + fclasses = evas_object_data_get(win, "font_classes_list"); + list_it = elm_list_selected_item_get(fclasses); + if (!list_it) return; + tc_data = elm_object_item_data_get(list_it); + + EINA_LIST_FOREACH(fndata.text_classes, l, tc) + { + eina_stringshare_replace(&tc->font, tc_data->font); + eina_stringshare_replace(&tc->style, tc_data->style); + tc->size = tc_data->size; + } + + elm_config_all_flush(); + elm_config_save(); +} + +static void +_font_overlay_reset(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *win, *fclasses, *fnames, *fstyles, *fsizes; + Elm_Text_Class_Data *tc_data; + Elm_Object_Item *list_it; + + win = data; + + fclasses = evas_object_data_get(win, "font_classes_list"); + list_it = elm_list_selected_item_get(fclasses); + if (!list_it) return; + tc_data = elm_object_item_data_get(list_it); + + fnames = evas_object_data_get(win, "font_names_list"); + fstyles = evas_object_data_get(win, "font_styles_list"); + fsizes = evas_object_data_get(win, "font_sizes_list"); + + elm_config_font_overlay_unset(tc_data->name); + + eina_stringshare_replace(&fndata.cur_font, NULL); + eina_stringshare_replace(&tc_data->font, NULL); + eina_stringshare_replace(&fndata.cur_style, NULL); + eina_stringshare_replace(&tc_data->style, NULL); + fndata.cur_size = 0.0; + tc_data->size = 0.0; + + ELM_LIST_DISABLE(fnames); + ELM_LIST_DISABLE(fstyles); + ELM_LIST_DISABLE(fsizes); + + elm_config_all_flush(); + elm_config_save(); +} + +static void +_font_overlay_reset_all(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *win, *fclasses, *fnames, *fstyles, *fsizes; + Elm_Text_Class_Data *tc_data; + Elm_Object_Item *list_it; + Eina_List *l; + + win = data; + eina_stringshare_replace(&fndata.cur_font, NULL); + eina_stringshare_replace(&fndata.cur_style, NULL); + fndata.cur_size = 0.0; + + EINA_LIST_FOREACH(fndata.text_classes, l, tc_data) + { + elm_config_font_overlay_unset(tc_data->name); + + eina_stringshare_replace(&tc_data->font, NULL); + eina_stringshare_replace(&tc_data->style, NULL); + tc_data->size = 0.0; + } + + fclasses = evas_object_data_get(win, "font_classes_list"); + fnames = evas_object_data_get(win, "font_names_list"); + fstyles = evas_object_data_get(win, "font_styles_list"); + fsizes = evas_object_data_get(win, "font_sizes_list"); + + list_it = elm_list_selected_item_get(fclasses); + if (list_it) elm_list_item_selected_set(list_it, EINA_FALSE); + + ELM_LIST_DISABLE(fnames); + ELM_LIST_DISABLE(fstyles); + ELM_LIST_DISABLE(fsizes); + + elm_config_all_flush(); + elm_config_save(); +} + +static void +_font_overlay_change(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Elm_Text_Class_Data *tc_data; + Eina_List *l; + + EINA_LIST_FOREACH(fndata.text_classes, l, tc_data) + { + if (tc_data->font) + { + char *name; + + name = elm_font_fontconfig_name_get(tc_data->font, + tc_data->style); + elm_config_font_overlay_set(tc_data->name, name, + tc_data->size ? tc_data->size : -100); + elm_font_fontconfig_name_free(name); + } + else + elm_config_font_overlay_unset(tc_data->name); + } + + elm_config_font_overlay_apply(); + elm_config_all_flush(); + elm_config_save(); + + /* TODO: apply hinting */ +} + +static void +_config_display_update(Evas_Object *win) +{ + int flush_interval, font_c, image_c, edje_file_c, edje_col_c, ts_threshould; + double scale, s_bounce_friction, ts_momentum_threshold, ts_friction, + ts_border_friction, ts_sensitivity_friction, page_friction, bring_in_friction, zoom_friction; + const char *curr_theme, *curr_engine; + const Eina_List *l_items, *l; + Eina_Bool s_bounce, ts; + Elm_Object_Item *list_it; + Elm_Theme *th; + int fs; + + scale = elm_config_scale_get(); + fs = elm_config_finger_size_get(); + flush_interval = elm_config_cache_flush_interval_get(); + font_c = elm_config_cache_font_cache_size_get(); + image_c = elm_config_cache_image_cache_size_get(); + edje_file_c = elm_config_cache_edje_file_cache_size_get(); + edje_col_c = elm_config_cache_edje_collection_cache_size_get(); + + s_bounce = elm_config_scroll_bounce_enabled_get(); + s_bounce_friction = elm_config_scroll_bounce_friction_get(); + ts = elm_config_scroll_thumbscroll_enabled_get(); + ts_threshould = elm_config_scroll_thumbscroll_threshold_get(); + ts_momentum_threshold = elm_config_scroll_thumbscroll_momentum_threshold_get(); + ts_friction = elm_config_scroll_thumbscroll_friction_get(); + ts_border_friction = elm_config_scroll_thumbscroll_border_friction_get(); + ts_sensitivity_friction = elm_config_scroll_thumbscroll_sensitivity_friction_get(); + page_friction = elm_config_scroll_page_scroll_friction_get(); + bring_in_friction = elm_config_scroll_bring_in_scroll_friction_get(); + zoom_friction = elm_config_scroll_zoom_friction_get(); + + /* gotta update root windows' atoms */ + elm_slider_value_set(evas_object_data_get(win, "scale_slider"), scale); + elm_slider_value_set(evas_object_data_get(win, "fs_slider"), fs); + + elm_slider_value_set(evas_object_data_get(win, + "cache_flush_interval_slider"), + flush_interval); + elm_slider_value_set(evas_object_data_get(win, "font_cache_slider"), + font_c / 1024.0); + elm_slider_value_set(evas_object_data_get(win, "image_cache_slider"), + image_c / 1024.0); + elm_slider_value_set(evas_object_data_get(win, "edje_file_cache_slider"), + edje_file_c); + elm_slider_value_set(evas_object_data_get(win, + "edje_collection_cache_slider"), + edje_col_c); + + elm_check_state_set(evas_object_data_get(win, "scroll_bounce_check"), + s_bounce); + elm_slider_value_set(evas_object_data_get(win, "bounce_friction_slider"), + s_bounce_friction); + elm_check_state_set(evas_object_data_get(win, "thumbscroll_check"), ts); + elm_slider_value_set(evas_object_data_get(win, + "thumbscroll_threshold_slider"), + ts_threshould); + elm_slider_value_set(evas_object_data_get(win, + "ts_momentum_threshold_slider"), + ts_momentum_threshold); + elm_slider_value_set(evas_object_data_get(win, + "thumbscroll_friction_slider"), + ts_friction); + elm_slider_value_set(evas_object_data_get(win, "ts_border_friction_slider"), + ts_border_friction); + elm_slider_value_set(evas_object_data_get(win, "ts_sensitivity_friction_slider"), + ts_sensitivity_friction); + elm_slider_value_set(evas_object_data_get(win, + "page_scroll_friction_slider"), + page_friction); + elm_slider_value_set(evas_object_data_get(win, + "bring_in_scroll_friction_slider"), + bring_in_friction); + elm_slider_value_set(evas_object_data_get(win, + "zoom_scroll_friction_slider"), + zoom_friction); + + curr_theme = _elm_theme_current_get(elm_theme_get(NULL)); + + th = elm_theme_new(); + elm_theme_set(th, curr_theme); + elm_object_theme_set(evas_object_data_get(win, "theme_preview"), th); + elm_theme_free(th); + eina_stringshare_del(curr_theme); + + curr_engine = elm_config_engine_get(); + l_items = elm_list_items_get(evas_object_data_get(win, "engines_list")); + EINA_LIST_FOREACH(l_items, l, list_it) + { + if (!strcmp(elm_object_item_data_get(list_it), curr_engine)) + { + elm_list_item_selected_set(list_it, EINA_TRUE); + break; + } + } +} + +static void +_profile_change_do(Evas_Object *win, + const char *profile) +{ + elm_config_profile_set(profile); + elm_config_all_flush(); + _config_display_update(win); +} + +static Eina_Bool +_config_all_changed(void *data, + int ev_type __UNUSED__, + void *ev __UNUSED__) +{ + Evas_Object *win = data; + _config_display_update(win); + return ECORE_CALLBACK_PASS_ON; +} + +static void +_engine_use(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *li; + const char *selection; + + li = data; + selection = elm_object_item_data_get(elm_list_selected_item_get(li)); + + if (!strcmp(elm_config_engine_get(), selection)) + return; + + elm_config_engine_set(selection); + elm_config_all_flush(); + elm_config_save(); /* make sure new engine has its data dir */ +} + +static void +_profile_use(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *li; + const char *selection; + const char *profile; + + li = data; + selection = elm_object_item_data_get(elm_list_selected_item_get(li)); + profile = elm_config_profile_get(); + + if (!profile) + { + fprintf(stderr, "No profile currently set!\n"); /* FIXME: log domain */ + return; + } + + if (!strcmp(profile, selection)) + return; + + elm_config_profile_set(selection); /* just here to update info for getters below */ + + _profile_change_do(elm_object_top_widget_get(li), selection); + elm_config_all_flush(); + elm_config_save(); /* make sure new profile has its data dir */ +} + +static void +_btn_todo(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + printf("To be done!\n"); +} + +static void +_profile_reset(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + const char *selection, *curr; + const char *pdir; + Evas_Object *li; + + li = data; + selection = elm_object_item_data_get(elm_list_selected_item_get(li)); + curr = elm_config_profile_get(); + + elm_config_all_flush(); + elm_config_save(); /* dump config into old profile's data dir */ + + pdir = elm_config_profile_dir_get(selection, EINA_TRUE); + if (!pdir) + return; + + ecore_file_recursive_rm(pdir); + elm_config_profile_dir_free(pdir); + + elm_config_reload(); + + _profile_change_do(elm_object_top_widget_get(li), curr); + elm_config_all_flush(); + elm_config_save(); /* make sure new profile has its data dir */ +} + +static void +_theme_use(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + const char *defth; + Elm_Theme *th; + Evas_Object *win = elm_object_top_widget_get(obj); + Evas_Object *sample = evas_object_data_get(win, "theme_preview"); + + th = elm_object_theme_get(sample); + defth = elm_theme_get(th); + elm_theme_set(NULL, defth); + elm_config_all_flush(); + elm_config_save(); +} + +static void +_theme_sel(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Evas_Object *win = elm_object_top_widget_get(obj); + Evas_Object *sample = evas_object_data_get(win, "theme_preview"); + Elm_Theme *th; + Elm_Object_Item *list_it; + Eina_Strbuf *newth; + Eina_List *l; + + if (!sample) return; + tsel = elm_list_selected_items_get(obj); + newth = eina_strbuf_new(); + EINA_SAFETY_ON_NULL_RETURN(newth); + th = elm_theme_new(); + if (!th) + { + eina_strbuf_free(newth); + return; + } + EINA_LIST_REVERSE_FOREACH((Eina_List*)tsel, l, list_it) + { + Theme *t = elm_object_item_data_get(list_it); + eina_strbuf_append_printf(newth, "%s:", t->name); + if ((!l->prev) && strcmp(t->name, "default")) + /* ensure default theme is always there for fallback */ + eina_strbuf_append(newth, "default"); + } + elm_theme_set(th, eina_strbuf_string_get(newth)); + eina_strbuf_free(newth); + elm_object_theme_set(sample, th); + elm_theme_free(th); +} + +/*static void + _theme_browse(void *data, Evas_Object *obj, void *event_info) + { + printf("not implemented\n"); + }*/ + +static void +_status_config_sizing(Evas_Object *win, + Evas_Object *naviframe) +{ + Evas_Object *lb, *pd, *bx, *sl, *sp; + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.5); + + LABEL_FRAME_ADD("Scale"); + + sl = elm_slider_add(win); + evas_object_data_set(win, "scale_slider", sl); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + elm_slider_span_size_set(sl, 120); + elm_slider_unit_format_set(sl, "%1.2f"); + elm_slider_indicator_format_set(sl, "%1.2f"); + elm_slider_min_max_set(sl, 0.25, 5.0); + elm_slider_value_set(sl, elm_config_scale_get()); + elm_box_pack_end(bx, sl); + evas_object_show(sl); + + evas_object_smart_callback_add(sl, "changed", sc_round, NULL); + evas_object_smart_callback_add(sl, "delay,changed", sc_change, NULL); + + sp = elm_separator_add(win); + elm_separator_horizontal_set(sp, EINA_TRUE); + evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, sp); + evas_object_show(sp); + + LABEL_FRAME_ADD("Finger Size
"); + + sl = elm_slider_add(win); + evas_object_data_set(win, "fs_slider", sl); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + elm_slider_span_size_set(sl, 120); + elm_slider_unit_format_set(sl, "%1.0f"); + elm_slider_indicator_format_set(sl, "%1.0f"); + elm_slider_min_max_set(sl, 5, 200); + elm_slider_value_set(sl, elm_config_finger_size_get()); + elm_box_pack_end(bx, sl); + evas_object_show(sl); + + evas_object_smart_callback_add(sl, "changed", fs_round, NULL); + evas_object_smart_callback_add(sl, "delay,changed", fs_change, NULL); + + evas_object_data_set(win, "sizing", bx); + + elm_naviframe_item_simple_push(naviframe, bx); +} + +static Evas_Object * +_sample_theme_new(Evas_Object *win) +{ + Evas_Object *base, *bg, *bt, *ck, *rd, *rdg, *sl, *fr, *li, *rc, *sp; + + base = elm_table_add(win); + evas_object_size_hint_weight_set(base, 1.0, 1.0); + evas_object_size_hint_align_set(base, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, 1.0, 1.0); + evas_object_size_hint_align_set(bg, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(base, bg, 0, 0, 2, 5); + evas_object_show(bg); + + bt = elm_button_add(win); + evas_object_size_hint_weight_set(bt, 1.0, 0.0); + elm_object_text_set(bt, "Button"); + elm_table_pack(base, bt, 0, 0, 1, 1); + evas_object_show(bt); + + ck = elm_check_add(win); + evas_object_size_hint_weight_set(ck, 1.0, 0.0); + elm_object_text_set(ck, "Check"); + elm_table_pack(base, ck, 0, 1, 1, 1); + evas_object_show(ck); + + rd = elm_radio_add(win); + evas_object_size_hint_weight_set(rd, 1.0, 0.0); + elm_radio_state_value_set(rd, 0); + elm_object_text_set(rd, "Radio 1"); + elm_table_pack(base, rd, 1, 0, 1, 1); + evas_object_show(rd); + rdg = rd; + + rd = elm_radio_add(win); + evas_object_size_hint_weight_set(rd, 1.0, 0.0); + elm_radio_state_value_set(rd, 1); + elm_object_text_set(rd, "Radio 2"); + elm_radio_group_add(rd, rdg); + elm_table_pack(base, rd, 1, 1, 1, 1); + evas_object_show(rd); + + sp = elm_separator_add(win); + elm_separator_horizontal_set(sp, EINA_TRUE); + evas_object_size_hint_weight_set(sp, 1.0, 0.0); + evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5); + elm_table_pack(base, sp, 0, 2, 2, 1); + evas_object_show(sp); + + sl = elm_slider_add(win); + elm_object_text_set(sl, "Slider"); + elm_slider_span_size_set(sl, 120); + elm_slider_min_max_set(sl, 1, 10); + elm_slider_value_set(sl, 4); + evas_object_size_hint_weight_set(sl, 1.0, 0.0); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(base, sl, 0, 3, 2, 1); + evas_object_show(sl); + + fr = elm_frame_add(win); + elm_object_text_set(fr, "Frame"); + elm_table_pack(base, fr, 0, 4, 2, 1); + evas_object_size_hint_weight_set(fr, 1.0, 1.0); + evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(fr); + + li = elm_list_add(win); + evas_object_size_hint_weight_set(li, 1.0, 1.0); + evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_content_set(fr, li); + evas_object_show(li); + + elm_list_item_append(li, "List Item 1", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "Second Item", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "Third Item", NULL, NULL, NULL, NULL); + elm_list_go(li); + + rc = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_size_hint_weight_set(rc, 1.0, 1.0); + evas_object_size_hint_min_set(rc, 160, 120); + elm_table_pack(base, rc, 0, 4, 2, 1); + + return base; +} + +static void +_status_config_themes(Evas_Object *win, + Evas_Object *naviframe) +{ + Evas_Object *tb, *rc, *sc, *sp, *li, *pd, *fr, *bt, *sample; + Eina_List *list, *l; + char *th, *s, *ext; + Elm_Theme *d; + Elm_Object_Item *list_it, *def_it = NULL; + const char *theme_name, *sep[20]; + unsigned int x; + + tb = elm_table_add(win); + evas_object_size_hint_weight_set(tb, 1.0, 1.0); + evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL); + + rc = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_size_hint_weight_set(rc, 1.0, 1.0); + evas_object_size_hint_min_set(rc, 0, 130); + elm_table_pack(tb, rc, 0, 0, 1, 1); + + rc = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_size_hint_weight_set(rc, 1.0, 1.0); + evas_object_size_hint_min_set(rc, 0, 200); + elm_table_pack(tb, rc, 0, 1, 1, 1); + + ///////////////////////////////////////////// + + pd = elm_frame_add(win); + elm_object_style_set(pd, "pad_medium"); + evas_object_size_hint_weight_set(pd, 1.0, 1.0); + evas_object_size_hint_align_set(pd, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, pd, 0, 0, 1, 1); + evas_object_show(pd); + + li = elm_list_add(win); + elm_list_multi_select_set(li, EINA_TRUE); + evas_object_size_hint_weight_set(li, 1.0, 1.0); + evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_content_set(pd, li); + evas_object_show(li); + + list = elm_theme_name_available_list_new(); + d = elm_theme_default_get(); + theme_name = elm_theme_get(d); + for (x = 1, sep[0] = theme_name; x < sizeof(sep) / sizeof(sep[0]); x++) + { + sep[x] = strchr(sep[x - 1] + 1, ':'); + if (!sep[x]) break; + } + EINA_LIST_FOREACH(list, l, th) + { + Theme *t; + int y; + + t = calloc(1, sizeof(Theme)); + t->name = eina_stringshare_add(th); + s = elm_theme_list_item_path_get(th, &(t->in_search_path)); + if (s) + { + t->path = eina_stringshare_add(s); + free(s); + } + if (t->in_search_path) + { + s = strdup(th); + if (s) + { + s[0] = toupper(s[0]); + t->label = eina_stringshare_add(s); + free(s); + } + else + t->label = eina_stringshare_add(s); + } + else + { + s = strdup(ecore_file_file_get(th)); + if (s) + { + s[0] = toupper(s[0]); + ext = strrchr(s, '.'); + if (ext) *ext = 0; + t->label = eina_stringshare_add(s); + free(s); + } + else + t->label = eina_stringshare_add(s); + } + themes = eina_list_append(themes, t); + list_it = elm_list_item_append(li, t->label, NULL, NULL, NULL, t); + if (!strcmp(t->name, "default")) def_it = list_it; + for (y = x - 1 /* ignore default e theme */; y > 0; y--) + { + const char *start = (sep[y - 1][0] == ':') ? sep[y - 1] + 1 : sep[y - 1]; + unsigned int len = (unsigned int)(sep[y] - start); + if (strncmp(start , t->name, len) || (strlen(t->name) != len)) continue; + + if (!elm_list_item_selected_get(list_it)) + elm_list_item_selected_set(list_it, EINA_TRUE); + break; + } + } + if (!elm_list_selected_items_get(li)) + elm_list_item_selected_set(def_it, EINA_TRUE); + evas_object_smart_callback_add(li, "selected", _theme_sel, NULL); + evas_object_smart_callback_add(li, "unselected", _theme_sel, NULL); + elm_theme_name_available_list_free(list); + + elm_list_go(li); + + pd = elm_frame_add(win); + elm_object_style_set(pd, "pad_medium"); + evas_object_size_hint_weight_set(pd, 1.0, 1.0); + evas_object_size_hint_align_set(pd, 0.9, 0.9); + elm_table_pack(tb, pd, 0, 0, 1, 1); + evas_object_show(pd); + + /* FIXME: not implemented yet + bt = elm_button_add(win); + evas_object_smart_callback_add(bt, "clicked", _theme_browse, win); + elm_object_text_set(bt, "Browse..."); + evas_object_size_hint_weight_set(bt, 1.0, 1.0); + evas_object_size_hint_align_set(bt, 0.9, 0.9); + elm_object_content_set(pd, bt); + evas_object_show(bt); + */ + pd = elm_frame_add(win); + elm_object_style_set(pd, "pad_medium"); + evas_object_size_hint_weight_set(pd, 1.0, 0.0); + evas_object_size_hint_align_set(pd, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, pd, 0, 1, 1, 1); + evas_object_show(pd); + + fr = elm_frame_add(win); + elm_object_text_set(fr, "Preview"); + evas_object_size_hint_weight_set(fr, 1.0, 1.0); + evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_content_set(pd, fr); + evas_object_show(fr); + + sc = elm_scroller_add(win); + elm_scroller_bounce_set(sc, EINA_FALSE, EINA_FALSE); + evas_object_size_hint_weight_set(sc, 1.0, 1.0); + evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_content_set(fr, sc); + evas_object_show(sc); + + sample = _sample_theme_new(win); + elm_object_content_set(sc, sample); + evas_object_show(sample); + evas_object_data_set(win, "theme_preview", sample); + + ///////////////////////////////////////////// + sp = elm_separator_add(win); + elm_separator_horizontal_set(sp, EINA_TRUE); + evas_object_size_hint_weight_set(sp, 1.0, 0.0); + evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5); + elm_table_pack(tb, sp, 0, 2, 1, 1); + evas_object_show(sp); + + pd = elm_frame_add(win); + elm_object_style_set(pd, "pad_medium"); + evas_object_size_hint_weight_set(pd, 1.0, 0.0); + evas_object_size_hint_align_set(pd, 0.5, 0.5); + elm_table_pack(tb, pd, 0, 3, 1, 1); + evas_object_show(pd); + + bt = elm_button_add(win); + evas_object_smart_callback_add(bt, "clicked", _theme_use, win); + elm_object_text_set(bt, "Use Theme"); + evas_object_size_hint_weight_set(bt, 1.0, 0.0); + evas_object_size_hint_align_set(bt, 0.5, 0.5); + elm_object_content_set(pd, bt); + evas_object_show(bt); + + evas_object_data_set(win, "themes", tb); + elm_naviframe_item_simple_push(naviframe, tb); +} + +static void +_font_preview_update(Evas_Object *win) +{ + Evas_Font_Size sz; + char *name; + + if (!fndata.cur_font) + return; + + name = elm_font_fontconfig_name_get(fndata.cur_font, fndata.cur_style); + sz = fndata.cur_size; + + if (sz < 0) + sz = (-sz * 10) / 100; + if (sz == 0) + sz = 10; + + edje_object_text_class_set(evas_object_data_get(win, "font_preview"), + "font_preview", name, sz); + + elm_font_fontconfig_name_free(name); +} + +static void +_font_classes_list_sel(void *data __UNUSED__, + Evas_Object *obj, + void *event_info) +{ + const Eina_List *f_names_items, *l; + Elm_Text_Class_Data *tc_data; + Evas_Object *f_names_list; + Elm_Object_Item *list_it; + + tc_data = elm_object_item_data_get(event_info); + + f_names_list = evas_object_data_get(elm_object_top_widget_get(obj), + "font_names_list"); + ELM_LIST_ENABLE(f_names_list); + + f_names_items = elm_list_items_get(f_names_list); + + EINA_LIST_FOREACH(f_names_items, l, list_it) + { + const char *s; + + s = elm_object_item_text_get(list_it); + + if (tc_data->font && !strcmp(s, tc_data->font)) + { + elm_list_item_selected_set(list_it, EINA_TRUE); + elm_list_item_show(list_it); + break; + } + } +} + +static void +_font_names_list_sel(void *data __UNUSED__, + Evas_Object *obj, + void *event_info) +{ + Evas_Object *style_list, *cls_list, *win; + const char *style, *sel_font; + Elm_Text_Class_Data *tc_data; + Elm_Object_Item *list_it, *fc_list_it; + Elm_Font_Properties *efp; + const Eina_List *l; + + list_it = event_info; + sel_font = elm_object_item_text_get(list_it); + + win = elm_object_top_widget_get(obj); + style_list = evas_object_data_get(win, "font_styles_list"); + cls_list = evas_object_data_get(win, "font_classes_list"); + + fc_list_it = elm_list_selected_item_get(cls_list); + if (!fc_list_it) return; /* should not happen, fonts list disabled in + * this case */ + + eina_stringshare_replace(&fndata.cur_font, sel_font); + + tc_data = elm_object_item_data_get(fc_list_it); + if (tc_data->font) eina_stringshare_del(tc_data->font); + if (fndata.cur_font) tc_data->font = eina_stringshare_ref(fndata.cur_font); + + /* load styles list */ + efp = eina_hash_find(fndata.font_hash, sel_font); + + ELM_LIST_ENABLE(style_list); + elm_list_clear(style_list); + + evas_event_freeze(evas_object_evas_get(style_list)); + edje_freeze(); + + list_it = NULL; + + EINA_LIST_FOREACH(efp->styles, l, style) + { + Elm_Object_Item *i; + + i = elm_list_item_append(style_list, style, NULL, NULL, + _font_styles_list_sel, NULL); + + if (tc_data->style && (!strcmp(style, tc_data->style))) + list_it = i; + } + + elm_list_go(style_list); + + edje_thaw(); + evas_event_thaw(evas_object_evas_get(style_list)); + + if (list_it) + elm_list_item_selected_set(list_it, EINA_TRUE); + + _font_preview_update(win); +} + +static void +_font_styles_list_sel(void *data __UNUSED__, + Evas_Object *obj, + void *event_info) +{ + Evas_Object *fc_list, *fs_list, *win; + Elm_Text_Class_Data *tc_data; + const Eina_List *l; + Elm_Object_Item *list_it; + + win = elm_object_top_widget_get(obj); + fc_list = evas_object_data_get(win, "font_classes_list"); + fs_list = evas_object_data_get(win, "font_sizes_list"); + + list_it = elm_list_selected_item_get(fc_list); + if (!list_it) return; /* should not happen */ + + eina_stringshare_replace(&fndata.cur_style, + elm_object_item_text_get(event_info)); + ELM_LIST_ENABLE(fs_list); + + tc_data = elm_object_item_data_get(list_it); + eina_stringshare_del(tc_data->style); + tc_data->style = eina_stringshare_ref(fndata.cur_style); + + evas_event_freeze(evas_object_evas_get(fs_list)); + edje_freeze(); + + EINA_LIST_FOREACH(elm_list_items_get(fs_list), l, list_it) + { + Elm_Font_Size_Data *sdata; + + sdata = elm_object_item_data_get(list_it); + elm_list_item_selected_set(l->data, EINA_FALSE); + + if (tc_data->size == sdata->size) + { + elm_list_item_selected_set(list_it, EINA_TRUE); + elm_list_item_show(list_it); + break; + } + } + + edje_thaw(); + evas_event_thaw(evas_object_evas_get(fs_list)); + + _font_preview_update(win); +} + +static void +_font_sizes_list_sel(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Elm_Text_Class_Data *tc_data; + Evas_Object *fc_list, *win; + Elm_Font_Size_Data *sd; + Elm_Object_Item *list_it; + + win = elm_object_top_widget_get(obj); + fc_list = evas_object_data_get(win, "font_classes_list"); + + list_it = elm_list_selected_item_get(fc_list); + if (!list_it) return; /* should not happen */ + + sd = elm_object_item_data_get(event_info); + fndata.cur_size = sd->size; + + tc_data = elm_object_item_data_get(list_it); + tc_data->size = fndata.cur_size; + + _font_preview_update(win); +} + +static void +_fstyle_list_unselect_cb(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Evas_Object *sizes_list, *win; + + if (elm_list_selected_item_get(obj)) return; + + win = elm_object_top_widget_get(obj); + + sizes_list = evas_object_data_get(win, "font_sizes_list"); + ELM_LIST_DISABLE(sizes_list); +} + +static void +_fc_list_unselect_cb(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Evas_Object *font_names_list, *styles_list, *sizes_list, *win; + + if (elm_list_selected_item_get(obj)) return; + + win = elm_object_top_widget_get(obj); + + font_names_list = evas_object_data_get(win, "font_names_list"); + ELM_LIST_DISABLE(font_names_list); + + styles_list = evas_object_data_get(win, "font_styles_list"); + ELM_LIST_DISABLE(styles_list); + + sizes_list = evas_object_data_get(win, "font_sizes_list"); + ELM_LIST_DISABLE(sizes_list); +} + +static void +_font_classes_list_load(Evas_Object *li) +{ + Elm_Text_Class_Data *tc_data; + Eina_List *l; + Evas *evas; + + evas = evas_object_evas_get(li); + evas_event_freeze(evas); + edje_freeze(); + + EINA_LIST_FOREACH(fndata.text_classes, l, tc_data) + elm_list_item_append(li, tc_data->desc, NULL, NULL, + _font_classes_list_sel, tc_data); + + evas_object_smart_callback_add(li, "unselected", _fc_list_unselect_cb, + NULL); + + elm_list_go(li); + edje_thaw(); + evas_event_thaw(evas); +} + +static void +_fonts_data_fill(Evas *evas) +{ + const Eina_List *fo_list, *l; + Eina_List *text_classes; + Elm_Text_Class_Data *tc_data; + Elm_Font_Size_Data *sd; + Elm_Font_Overlay *efo; + Eina_List *evas_fonts; + Elm_Text_Class *etc; + int i; + + evas_fonts = evas_font_available_list(evas); + fndata.font_hash = elm_font_available_hash_add(evas_fonts); + evas_font_available_list_free(evas, evas_fonts); + + text_classes = elm_config_text_classes_list_get(); + fo_list = elm_config_font_overlay_list_get(); + + EINA_LIST_FOREACH(text_classes, l, etc) + { + const Eina_List *ll; + + tc_data = calloc(1, sizeof(*tc_data)); + if (!tc_data) continue; + + tc_data->name = eina_stringshare_add(etc->name); + tc_data->desc = eina_stringshare_add(etc->desc); + + EINA_LIST_FOREACH(fo_list, ll, efo) + { + if (strcmp(tc_data->name, efo->text_class)) + continue; + + if (efo->font) + { + Elm_Font_Properties *efp; + + efp = elm_font_properties_get(efo->font); + if (efp) + { + tc_data->font = eina_stringshare_add(efp->name); + /* we're sure we recorded with only 1 style selected */ + tc_data->style = eina_stringshare_add(efp->styles->data); + elm_font_properties_free(efp); + } + } + tc_data->size = efo->size; + } + + fndata.text_classes = eina_list_append(fndata.text_classes, tc_data); + } + + elm_config_text_classes_list_free(text_classes); + + /* FIXME: hinting later */ + /* fndata.hinting = e_config->font_hinting; */ + + sd = calloc(1, sizeof(Elm_Font_Size_Data)); + sd->size_str = eina_stringshare_add("Tiny"); + sd->size = -50; + fndata.font_scale_list = eina_list_append(fndata.font_scale_list, sd); + + sd = calloc(1, sizeof(Elm_Font_Size_Data)); + sd->size_str = eina_stringshare_add("Small"); + sd->size = -80; + fndata.font_scale_list = eina_list_append(fndata.font_scale_list, sd); + + sd = calloc(1, sizeof(Elm_Font_Size_Data)); + sd->size_str = eina_stringshare_add("Normal"); + sd->size = -100; + fndata.font_scale_list = eina_list_append(fndata.font_scale_list, sd); + + sd = calloc(1, sizeof(Elm_Font_Size_Data)); + sd->size_str = eina_stringshare_add("Big"); + sd->size = -150; + fndata.font_scale_list = eina_list_append(fndata.font_scale_list, sd); + + sd = calloc(1, sizeof(Elm_Font_Size_Data)); + sd->size_str = eina_stringshare_add("Really Big"); + sd->size = -190; + fndata.font_scale_list = eina_list_append(fndata.font_scale_list, sd); + + sd = calloc(1, sizeof(Elm_Font_Size_Data)); + sd->size_str = eina_stringshare_add("Huge"); + sd->size = -250; + fndata.font_scale_list = eina_list_append(fndata.font_scale_list, sd); + + for (i = 5; i < 51; i++) + { + char str[16]; + + str[0] = 0; + snprintf(str, sizeof(str), "%d pixels", i); + + sd = calloc(1, sizeof(Elm_Font_Size_Data)); + sd->size_str = eina_stringshare_add(str); + sd->size = i; + fndata.font_px_list = eina_list_append(fndata.font_px_list, sd); + } +} + +static int +_font_sort_cb(const void *data1, + const void *data2) +{ + if (!data1) return 1; + if (!data2) return -1; + return strcmp(data1, data2); +} + +static void +_font_sizes_list_load(Evas_Object *size_list) +{ + Elm_Font_Size_Data *size_data; + Eina_List *l; + Evas *evas; + + evas = evas_object_evas_get(size_list); + evas_event_freeze(evas); + edje_freeze(); + + EINA_LIST_FOREACH(fndata.font_scale_list, l, size_data) + elm_list_item_append(size_list, size_data->size_str, NULL, NULL, + _font_sizes_list_sel, size_data); + + EINA_LIST_FOREACH(fndata.font_px_list, l, size_data) + elm_list_item_append(size_list, size_data->size_str, NULL, NULL, + _font_sizes_list_sel, size_data); + + elm_list_go(size_list); + edje_thaw(); + evas_event_thaw(evas); +} + +static void +_fnames_list_unselect_cb(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Evas_Object *styles_list, *sizes_list, *win; + + if (elm_list_selected_item_get(obj)) return; + + win = elm_object_top_widget_get(obj); + + styles_list = evas_object_data_get(win, "font_styles_list"); + ELM_LIST_DISABLE(styles_list); + + sizes_list = evas_object_data_get(win, "font_sizes_list"); + ELM_LIST_DISABLE(sizes_list); +} + +static Eina_Bool +_font_list_fill(const Eina_Hash *hash __UNUSED__, + const void *key __UNUSED__, + void *data, + void *fdata) +{ + Elm_Font_Properties *efp; + Eina_List **flist; + + flist = fdata; + efp = data; + + *flist = eina_list_append(*flist, efp->name); + + return EINA_TRUE; +} + +static void +_font_names_list_load(Evas_Object *flist) +{ + Eina_List *l, *names_list = NULL; + const char *font; + Evas *evas; + + evas = evas_object_evas_get(flist); + evas_event_freeze(evas); + edje_freeze(); + + eina_hash_foreach(fndata.font_hash, _font_list_fill, &names_list); + names_list = eina_list_sort(names_list, eina_list_count(names_list), + _font_sort_cb); + + EINA_LIST_FOREACH(names_list, l, font) + elm_list_item_append(flist, font, NULL, NULL, _font_names_list_sel, NULL); + + EINA_LIST_FREE(names_list, font) ; + + evas_object_smart_callback_add(flist, "unselected", + _fnames_list_unselect_cb, NULL); + + elm_list_go(flist); + + edje_thaw(); + evas_event_thaw(evas); +} + +static void +_status_config_fonts(Evas_Object *win, + Evas_Object *naviframe) +{ + Evas_Object *base, *fr, *li, *rc, *preview, *sp, *pd, *bt, *bx; + char buf[PATH_MAX]; + + _fonts_data_fill(evas_object_evas_get(win)); + + base = elm_table_add(win); + evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(base, EVAS_HINT_FILL, EVAS_HINT_FILL); + + /* yeah, dummy rectangles are ugly as hell, but no good way yet of + fixing sizes */ + rc = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_size_hint_weight_set(rc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(rc, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_min_set(rc, 70, 170); + elm_table_pack(base, rc, 1, 0, 1, 1); + + fr = elm_frame_add(win); + elm_object_text_set(fr, "Font Class"); + elm_table_pack(base, fr, 0, 0, 1, 2); + evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(fr); + + /* FIXME: no multiselection for this list, for now */ + li = elm_list_add(win); + evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_content_set(fr, li); + evas_object_show(li); + + evas_object_data_set(win, "font_classes_list", li); + _font_classes_list_load(li); + + fr = elm_frame_add(win); + elm_object_text_set(fr, "Font"); + elm_table_pack(base, fr, 1, 0, 1, 2); + evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(fr); + + li = elm_list_add(win); + evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_content_set(fr, li); + evas_object_show(li); + + evas_object_data_set(win, "font_names_list", li); + _font_names_list_load(li); + ELM_LIST_DISABLE(li); + + rc = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_size_hint_weight_set(rc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(rc, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_min_set(rc, 70, 130); + elm_table_pack(base, rc, 1, 2, 1, 1); + + fr = elm_frame_add(win); + elm_object_text_set(fr, "Style"); + elm_table_pack(base, fr, 0, 2, 1, 1); + evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(fr); + ELM_LIST_DISABLE(li); + + li = elm_list_add(win); + evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_content_set(fr, li); + evas_object_show(li); + + evas_object_data_set(win, "font_styles_list", li); + evas_object_smart_callback_add(li, "unselected", _fstyle_list_unselect_cb, + NULL); + + fr = elm_frame_add(win); + elm_object_text_set(fr, "Size"); + elm_table_pack(base, fr, 1, 2, 1, 1); + evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(fr); + + li = elm_list_add(win); + evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_content_set(fr, li); + evas_object_show(li); + + evas_object_data_set(win, "font_sizes_list", li); + _font_sizes_list_load(li); + ELM_LIST_DISABLE(li); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(base, bx, 0, 3, 2, 1); + evas_object_show(bx); + + /* FIXME: what to do here? dedicated widget? some new entry API set? */ + snprintf(buf, sizeof(buf), "%s/objects/font_preview.edj", elm_app_data_dir_get()); + preview = elm_layout_add(win); + elm_layout_file_set(preview, buf, "font_preview"); + elm_object_part_text_set(preview, "elm.text", "Preview Text — 我真的会写中文"); + evas_object_size_hint_weight_set(preview, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(preview, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(preview); + + elm_box_pack_end(bx, preview); + evas_object_data_set(win, "font_preview", elm_layout_edje_get(preview)); + + ///////////////////////////////////////////// + sp = elm_separator_add(win); + elm_separator_horizontal_set(sp, EINA_TRUE); + evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5); + elm_table_pack(base, sp, 0, 4, 2, 1); + evas_object_show(sp); + + pd = elm_frame_add(win); + elm_object_style_set(pd, "pad_medium"); + evas_object_size_hint_weight_set(pd, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(pd, 0.5, 0.5); + elm_table_pack(base, pd, 0, 5, 2, 1); + evas_object_show(pd); + + bx = elm_box_add(win); + elm_box_horizontal_set(bx, EINA_TRUE); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bx); + + bt = elm_button_add(win); + evas_object_smart_callback_add(bt, "clicked", _font_overlay_set_all, win); + elm_object_text_set(bt, "Set to All"); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + evas_object_size_hint_align_set(bt, 0.5, 0.5); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + evas_object_smart_callback_add(bt, "clicked", _font_overlay_reset, win); + elm_object_text_set(bt, "Reset"); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + evas_object_size_hint_align_set(bt, 0.5, 0.5); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + evas_object_smart_callback_add(bt, "clicked", _font_overlay_reset_all, win); + elm_object_text_set(bt, "Reset All"); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + evas_object_size_hint_align_set(bt, 0.5, 0.5); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + evas_object_smart_callback_add(bt, "clicked", _font_overlay_change, win); + elm_object_text_set(bt, "Apply"); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + evas_object_size_hint_align_set(bt, 0.5, 0.5); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + elm_object_content_set(pd, bx); + + evas_object_data_set(win, "fonts", base); + + elm_naviframe_item_simple_push(naviframe, base); +} + +static void +_engines_list_item_del_cb(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + free(data); +} + +static void +_profiles_list_item_del_cb(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + free(data); +} + +static void +_profiles_list_selected_cb(void *data, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + const char *cur_profile = NULL; + const char *sel_profile, *pdir; + const char *prof_name; + char buf[PATH_MAX]; + Evas_Object *en; +#ifdef ELM_EFREET + Efreet_Desktop *desk = NULL; +#endif + + sel_profile = data; + if (!sel_profile) + return; + + cur_profile = elm_config_profile_get(); + + pdir = elm_config_profile_dir_get(sel_profile, EINA_TRUE); + if (!pdir) pdir = elm_config_profile_dir_get(sel_profile, EINA_FALSE); +#ifdef ELM_EFREET + snprintf(buf, sizeof(buf), "%s/profile.desktop", pdir); + desk = efreet_desktop_new(buf); + if ((desk) && (desk->name)) prof_name = desk->name; + else + { + if (desk) efreet_desktop_free(desk); + pdir = elm_config_profile_dir_get(sel_profile, EINA_FALSE); + snprintf(buf, sizeof(buf), "%s/profile.desktop", pdir); + desk = efreet_desktop_new(buf); + if ((desk) && (desk->name)) prof_name = desk->name; + else prof_name = cur_profile; + } +#endif + prof_name = cur_profile; + + if (!pdir) + elm_object_disabled_set(evas_object_data_get(obj, "prof_reset_btn"), + EINA_TRUE); + else + { + elm_object_disabled_set(evas_object_data_get(obj, "prof_del_btn"), + EINA_TRUE); + elm_object_disabled_set(evas_object_data_get(obj, "prof_reset_btn"), + EINA_FALSE); + elm_object_disabled_set(evas_object_data_get(obj, "prof_use_btn"), + EINA_FALSE); + elm_config_profile_dir_free(pdir); + } + + snprintf(buf, sizeof(buf), "Selected profile: %s
", + prof_name); + elm_object_text_set(evas_object_data_get(obj, "prof_name_lbl"), buf); + + en = evas_object_data_get(obj, "prof_desc_entry"); +#ifdef ELM_EFREET + if (desk) elm_object_text_set(en, desk->comment); + else +#endif + elm_object_text_set(en, "Unknown"); + +#ifdef ELM_EFREET + if (desk) efreet_desktop_free(desk); +#endif +} + +static void +_profiles_list_fill(Evas_Object *l_widget, + Eina_List *p_names) +{ + const char *cur_profile = NULL; + const char *profile; + void *sel_it = NULL; + Eina_List *l; + + if (!p_names) + return; + + elm_list_clear(l_widget); + + cur_profile = elm_config_profile_get(); + + EINA_LIST_FOREACH(p_names, l, profile) + { +#ifdef ELM_EFREET + Efreet_Desktop *desk = NULL; +#endif + const char *label, *ext, *pdir; + char buf[PATH_MAX]; + Elm_Object_Item *list_it; + Evas_Object *ic; + + pdir = elm_config_profile_dir_get(profile, EINA_TRUE); + if (!pdir) pdir = elm_config_profile_dir_get(profile, EINA_FALSE); + label = profile; + +#ifdef ELM_EFREET + snprintf(buf, sizeof(buf), "%s/profile.desktop", pdir); + desk = efreet_desktop_new(buf); + if ((desk) && (desk->name)) label = desk->name; + else + { + if (desk) efreet_desktop_free(desk); + pdir = elm_config_profile_dir_get(profile, EINA_FALSE); + snprintf(buf, sizeof(buf), "%s/profile.desktop", pdir); + desk = efreet_desktop_new(buf); + if ((desk) && (desk->name)) label = desk->name; + else label = profile; + } +#endif + + buf[0] = 0; + if (pdir) snprintf(buf, sizeof(buf), "%s/icon.edj", pdir); +#ifdef ELM_EFREET + if ((desk) && (desk->icon) && (pdir)) + snprintf(buf, sizeof(buf), "%s/%s", pdir, desk->icon); +#endif + ic = elm_icon_add(l_widget); + ext = strrchr(buf, '.'); + if (ext) + { + if (!strcmp(ext, ".edj")) elm_icon_file_set(ic, buf, "icon"); + else elm_icon_file_set(ic, buf, NULL); + } + + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, + 1, 1); + evas_object_show(ic); + + list_it = elm_list_item_append(l_widget, label, ic, NULL, + _profiles_list_selected_cb, + strdup(profile)); + elm_object_item_del_cb_set(list_it, _profiles_list_item_del_cb); + if (cur_profile && !strcmp(profile, cur_profile)) + sel_it = list_it; + + elm_config_profile_dir_free(pdir); + +#ifdef ELM_EFREET + if (desk) efreet_desktop_free(desk); +#endif + } + + if (sel_it) elm_list_item_selected_set(sel_it, EINA_TRUE); + elm_list_go(l_widget); +} + +static void +_profiles_list_unselect_cb(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + if (elm_list_selected_item_get(obj)) return; + elm_object_disabled_set(evas_object_data_get(obj, "prof_del_btn"), + EINA_TRUE); + elm_object_disabled_set(evas_object_data_get(obj, "prof_reset_btn"), + EINA_TRUE); + elm_object_disabled_set(evas_object_data_get(obj, "prof_use_btn"), + EINA_TRUE); +} + +static void +_status_config_profiles(Evas_Object *win, + Evas_Object *naviframe) +{ + Evas_Object *li, *bx, *fr_bx1, *fr_bx2, *btn_bx, *fr, *lb, *en, *sp, *pd, + *bt; + Eina_List *profs; + Evas *evas; + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + + fr_bx1 = elm_box_add(win); + evas_object_size_hint_weight_set(fr_bx1, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(fr_bx1, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_homogeneous_set(fr_bx1, EINA_TRUE); + evas_object_show(fr_bx1); + + fr_bx2 = elm_box_add(win); + evas_object_size_hint_weight_set(fr_bx2, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(fr_bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(fr_bx2); + + fr = elm_frame_add(win); + elm_object_text_set(fr, "Available Profiles"); + evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_content_set(fr, fr_bx1); + elm_box_pack_end(bx, fr); + evas_object_show(fr); + + li = elm_list_add(win); + evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_smart_callback_add(li, "unselected", _profiles_list_unselect_cb, + NULL); + + profs = elm_config_profile_list_get(); + + evas_object_show(li); + elm_box_pack_end(fr_bx2, li); + + lb = elm_label_add(win); + evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, 0.5); + + evas_object_show(lb); + + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + elm_entry_editable_set(en, EINA_FALSE); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(en); + + evas_object_data_set(li, "prof_name_lbl", lb); + evas_object_data_set(li, "prof_desc_entry", en); + + elm_box_pack_end(fr_bx2, lb); + elm_box_pack_end(fr_bx1, fr_bx2); + elm_box_pack_end(fr_bx1, en); + + ///////////////////////////////////////////// + sp = elm_separator_add(win); + elm_separator_horizontal_set(sp, EINA_TRUE); + evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, sp); + evas_object_show(sp); + + pd = elm_frame_add(win); + elm_object_style_set(pd, "pad_medium"); + evas_object_size_hint_weight_set(pd, 0.0, 0.0); + evas_object_size_hint_align_set(pd, 0.5, 0.5); + elm_box_pack_end(bx, pd); + evas_object_show(pd); + + btn_bx = elm_box_add(win); + elm_box_horizontal_set(btn_bx, EINA_TRUE); + evas_object_size_hint_weight_set(btn_bx, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(btn_bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(btn_bx); + + bt = elm_button_add(win); + evas_object_smart_callback_add(bt, "clicked", _profile_use, li); + elm_object_text_set(bt, "Use"); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + evas_object_size_hint_align_set(bt, 0.5, 0.5); + elm_box_pack_end(btn_bx, bt); + evas_object_show(bt); + + evas_object_data_set(li, "prof_use_btn", bt); + + bt = elm_button_add(win); + evas_object_smart_callback_add(bt, "clicked", _btn_todo, NULL); /* TODO */ + elm_object_text_set(bt, "Delete"); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + evas_object_size_hint_align_set(bt, 0.5, 0.5); + elm_box_pack_end(btn_bx, bt); + evas_object_show(bt); + + evas_object_data_set(li, "prof_del_btn", bt); + + bt = elm_button_add(win); + evas_object_smart_callback_add(bt, "clicked", _profile_reset, li); + elm_object_text_set(bt, "Reset"); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + evas_object_size_hint_align_set(bt, 0.5, 0.5); + elm_box_pack_end(btn_bx, bt); + evas_object_show(bt); + + evas_object_data_set(li, "prof_reset_btn", bt); + + bt = elm_button_add(win); + evas_object_smart_callback_add(bt, "clicked", _btn_todo, NULL); /* TODO */ + elm_object_text_set(bt, "Add new"); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + evas_object_size_hint_align_set(bt, 0.5, 0.5); + elm_box_pack_end(btn_bx, bt); + evas_object_show(bt); + + elm_object_content_set(pd, btn_bx); + + evas = evas_object_evas_get(li); + evas_event_freeze(evas); + edje_freeze(); + + _profiles_list_fill(li, profs); + + elm_config_profile_list_free(profs); + + edje_thaw(); + evas_event_thaw(evas); + + evas_object_data_set(win, "profiles", bx); + elm_naviframe_item_simple_push(naviframe, bx); +} + +static void +_status_config_scrolling(Evas_Object *win, + Evas_Object *naviframe) +{ + Evas_Object *lb, *pd, *bx, *sl, *sp, *ck, *sc; + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.5); + + sc = elm_scroller_add(win); + evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_scroller_bounce_set(sc, EINA_FALSE, EINA_TRUE); + evas_object_show(sc); + elm_object_content_set(sc, bx); + + ck = elm_check_add(win); + elm_object_tooltip_text_set(ck, "Set whether scrollers should bounce
" + "when they reach their viewport's edge
" + "during a scroll"); + elm_object_text_set(ck, "Enable scroll bounce"); + evas_object_data_set(win, "scroll_bounce_check", ck); + evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(ck, EVAS_HINT_FILL, 0.5); + elm_check_state_set(ck, elm_config_scroll_bounce_enabled_get()); + elm_box_pack_end(bx, ck); + evas_object_show(ck); + + evas_object_smart_callback_add(ck, "changed", sb_change, NULL); + + LABEL_FRAME_ADD("Scroll bounce friction"); + + sl = elm_slider_add(win); + elm_object_tooltip_text_set(sl, "This is the amount of inertia a
" + "scroller will impose at bounce animations"); + evas_object_data_set(win, "bounce_friction_slider", sl); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + elm_slider_span_size_set(sl, 120); + elm_slider_unit_format_set(sl, "%1.2f"); + elm_slider_indicator_format_set(sl, "%1.2f"); + elm_slider_min_max_set(sl, 0.0, 4.0); + elm_slider_value_set(sl, elm_config_scroll_bounce_friction_get()); + elm_box_pack_end(bx, sl); + evas_object_show(sl); + + evas_object_smart_callback_add(sl, "changed", bf_round, NULL); + evas_object_smart_callback_add(sl, "delay,changed", bf_change, NULL); + + sp = elm_separator_add(win); + elm_separator_horizontal_set(sp, EINA_TRUE); + evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, sp); + evas_object_show(sp); + + ck = elm_check_add(win); + elm_object_tooltip_text_set(ck, "Set whether scrollers should be
" + "draggable from any point in their views"); + elm_object_text_set(ck, "Enable thumb scroll"); + evas_object_data_set(win, "thumbscroll_check", ck); + evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(ck, EVAS_HINT_FILL, 0.5); + elm_check_state_set(ck, elm_config_scroll_thumbscroll_enabled_get()); + elm_box_pack_end(bx, ck); + evas_object_show(ck); + + evas_object_smart_callback_add(ck, "changed", ts_change, NULL); + + LABEL_FRAME_ADD("Thumb scroll threshold"); + + sl = elm_slider_add(win); + elm_object_tooltip_text_set(sl, "This is the number of pixels one should
" + "travel while dragging a scroller's view
" + "to actually trigger scrolling"); + evas_object_data_set(win, "thumbscroll_threshold_slider", sl); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + elm_slider_span_size_set(sl, 120); + elm_slider_unit_format_set(sl, "%1.0f pixels"); + elm_slider_indicator_format_set(sl, "%1.0f"); + elm_slider_min_max_set(sl, 8.0, 50.0); + elm_slider_value_set(sl, elm_config_scroll_thumbscroll_threshold_get()); + elm_box_pack_end(bx, sl); + evas_object_show(sl); + + evas_object_smart_callback_add(sl, "changed", tst_round, NULL); + evas_object_smart_callback_add(sl, "delay,changed", tst_change, NULL); + + LABEL_FRAME_ADD("Thumb scroll momentum threshold"); + + sl = elm_slider_add(win); + elm_object_tooltip_text_set(sl, "This is the minimum speed of mouse
" + "cursor movement which will trigger
" + "list self scrolling animation after a
" + "mouse up event (pixels/second)"); + evas_object_data_set(win, "ts_momentum_threshold_slider", sl); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + elm_slider_span_size_set(sl, 120); + elm_slider_unit_format_set(sl, "%1.0f pixels/s"); + elm_slider_indicator_format_set(sl, "%1.0f"); + elm_slider_min_max_set(sl, 10.0, 200.0); + elm_slider_value_set(sl, elm_config_scroll_thumbscroll_momentum_threshold_get()); + elm_box_pack_end(bx, sl); + evas_object_show(sl); + + evas_object_smart_callback_add(sl, "changed", tsmt_round, NULL); + evas_object_smart_callback_add(sl, "delay,changed", tsmt_change, + NULL); + + LABEL_FRAME_ADD("Thumb scroll friction"); + + sl = elm_slider_add(win); + elm_object_tooltip_text_set(sl, "This is the amount of inertia a
" + "scroller will impose at self scrolling
" + "animations"); + evas_object_data_set(win, "thumbscroll_friction_slider", sl); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + elm_slider_span_size_set(sl, 120); + elm_slider_unit_format_set(sl, "%1.1f"); + elm_slider_indicator_format_set(sl, "%1.1f"); + elm_slider_min_max_set(sl, 0.0, 15.0); + elm_slider_value_set(sl, elm_config_scroll_thumbscroll_friction_get()); + elm_box_pack_end(bx, sl); + evas_object_show(sl); + + evas_object_smart_callback_add(sl, "changed", tsf_round, NULL); + evas_object_smart_callback_add(sl, "delay,changed", tsf_change, NULL); + + LABEL_FRAME_ADD("Thumb scroll border friction"); + + sl = elm_slider_add(win); + elm_object_tooltip_text_set(sl, "This is the amount of lag between your
" + "actual mouse cursor dragging movement
" + "and a scroller's view movement itself,
" + "while pushing it into bounce state
" + "manually"); + evas_object_data_set(win, "ts_border_friction_slider", sl); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + elm_slider_span_size_set(sl, 120); + elm_slider_unit_format_set(sl, "%1.2f"); + elm_slider_indicator_format_set(sl, "%1.2f"); + elm_slider_min_max_set(sl, 0.0, 1.0); + elm_slider_value_set(sl, elm_config_scroll_thumbscroll_border_friction_get()); + elm_box_pack_end(bx, sl); + evas_object_show(sl); + + evas_object_smart_callback_add(sl, "changed", tsbf_round, NULL); + evas_object_smart_callback_add(sl, "delay,changed", tsbf_change, NULL); + + LABEL_FRAME_ADD("Thumb scroll sensitivity friction"); + + sl = elm_slider_add(win); + elm_object_tooltip_text_set(sl, "This is the sensitivity amount which
" + "is be multiplied by the length of mouse
" + "dragging."); + evas_object_data_set(win, "ts_sensitivity_friction_slider", sl); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + elm_slider_span_size_set(sl, 120); + elm_slider_unit_format_set(sl, "%1.2f"); + elm_slider_indicator_format_set(sl, "%1.2f"); + elm_slider_min_max_set(sl, 0.1, 1.0); + elm_slider_value_set(sl, elm_config_scroll_thumbscroll_sensitivity_friction_get()); + elm_box_pack_end(bx, sl); + evas_object_show(sl); + + evas_object_smart_callback_add(sl, "changed", tssf_round, NULL); + evas_object_smart_callback_add(sl, "delay,changed", tssf_change, NULL); + + sp = elm_separator_add(win); + elm_separator_horizontal_set(sp, EINA_TRUE); + evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, sp); + evas_object_show(sp); + + LABEL_FRAME_ADD("Page scroll friction"); + + sl = elm_slider_add(win); + elm_object_tooltip_text_set(sl, "This is the amount of inertia a
" + "paged scroller will impose at
" + "page fitting animations"); + evas_object_data_set(win, "page_scroll_friction_slider", sl); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + elm_slider_span_size_set(sl, 120); + elm_slider_unit_format_set(sl, "%1.1f"); + elm_slider_indicator_format_set(sl, "%1.1f"); + elm_slider_min_max_set(sl, 0.0, 5.0); + elm_slider_value_set(sl, elm_config_scroll_page_scroll_friction_get()); + elm_box_pack_end(bx, sl); + evas_object_show(sl); + + evas_object_smart_callback_add(sl, "changed", ps_round, NULL); + evas_object_smart_callback_add(sl, "delay,changed", ps_change, NULL); + + LABEL_FRAME_ADD("Bring in scroll friction"); + + sl = elm_slider_add(win); + elm_object_tooltip_text_set(sl, "This is the amount of inertia a
" + "scroller will impose at region bring
" + "animations"); + evas_object_data_set(win, "bring_in_scroll_friction_slider", sl); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + elm_slider_span_size_set(sl, 120); + elm_slider_unit_format_set(sl, "%1.1f"); + elm_slider_indicator_format_set(sl, "%1.1f"); + elm_slider_min_max_set(sl, 0.0, 5.0); + elm_slider_value_set(sl, elm_config_scroll_bring_in_scroll_friction_get()); + elm_box_pack_end(bx, sl); + evas_object_show(sl); + + evas_object_smart_callback_add(sl, "changed", bis_round, NULL); + evas_object_smart_callback_add(sl, "delay,changed", bis_change, NULL); + + LABEL_FRAME_ADD("Zoom scroll friction"); + + sl = elm_slider_add(win); + elm_object_tooltip_text_set(sl, "This is the amount of inertia
" + "scrollers will impose at animations
" + "triggered by Elementary widgets'
" + "zooming API"); + evas_object_data_set(win, "zoom_scroll_friction_slider", sl); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + elm_slider_span_size_set(sl, 120); + elm_slider_unit_format_set(sl, "%1.1f"); + elm_slider_indicator_format_set(sl, "%1.1f"); + elm_slider_min_max_set(sl, 0.0, 5.0); + elm_slider_value_set(sl, elm_config_scroll_zoom_friction_get()); + elm_box_pack_end(bx, sl); + evas_object_show(sl); + + evas_object_smart_callback_add(sl, "changed", zf_round, NULL); + evas_object_smart_callback_add(sl, "delay,changed", zf_change, NULL); + + evas_object_data_set(win, "scrolling", sc); + + elm_naviframe_item_simple_push(naviframe, sc); +} + +static char * +_engine_name_prettify(const char *engine) +{ + char *ret, *ptr; + + ret = strdup(engine); + ret[0] -= 0x20; + + while ((ptr = strpbrk(ret, "_"))) + { + *ptr = ' '; + } + + return ret; +} + +/* FIXME! ideally, we would trim elm_config.c's _elm_engines list at + build time, making a getter for is as in ecore-evas. */ +static Eina_Bool +_elm_engine_supported(const char *engine) +{ + const char *engines[] = { + "software_x11", + "fb", + "directfb", + "software_16_x11", + "software_8_x11", + "xrender_x11", + "opengl_x11", + "software_gdi", + "software_16_wince_gdi", + "sdl", + "software_16_sdl", + "opengl_sdl", + "ews", + "opengl_cocoa", + "psl1ght", + "wayland_shm", + "wayland_egl", + NULL + }; + + unsigned int i; + + for (i = 0; engines[i]; i++) + { +#define ENGINE_COMPARE(name) (!strcmp(engines[i], name)) + if (ENGINE_COMPARE(engine)) + return EINA_TRUE; +#undef ENGINE_COMPARE + } + + return EINA_FALSE; +} + +static void +_engines_list_fill(Evas_Object *l_widget, + Eina_List *e_names) +{ + const char *engine, *cur_engine; + void *sel_it = NULL; + Eina_List *l; + + if (!e_names) + return; + + cur_engine = elm_config_engine_get(); + + EINA_LIST_FOREACH(e_names, l, engine) + { + const char *label; + Elm_Object_Item *list_it; + + if (!_elm_engine_supported(engine)) + continue; + + label = _engine_name_prettify(engine); + + list_it = elm_list_item_append(l_widget, label, NULL, NULL, NULL, + strdup(engine)); + elm_object_item_del_cb_set(list_it, _engines_list_item_del_cb); + free((void *)label); + + if (!strcmp(cur_engine, engine)) + sel_it = list_it; + } + + if (sel_it) elm_list_item_selected_set(sel_it, EINA_TRUE); + elm_list_go(l_widget); +} + +static void +_status_config_rendering(Evas_Object *win, + Evas_Object *naviframe) +{ + Evas_Object *li, *bx, *fr, *sp, *pd, *bt; + Eina_List *engines; + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + + fr = elm_frame_add(win); + elm_object_text_set(fr, "Available Engines"); + evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, fr); + evas_object_show(fr); + + li = elm_list_add(win); + elm_object_content_set(fr, li); + evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL); + + engines = ecore_evas_engines_get(); + _engines_list_fill(li, engines); + ecore_evas_engines_free(engines); + + evas_object_show(li); + evas_object_data_set(win, "engines_list", li); + + ///////////////////////////////////////////// + sp = elm_separator_add(win); + elm_separator_horizontal_set(sp, EINA_TRUE); + evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, sp); + evas_object_show(sp); + + pd = elm_frame_add(win); + elm_object_style_set(pd, "pad_medium"); + evas_object_size_hint_weight_set(pd, 0.0, 0.0); + evas_object_size_hint_align_set(pd, 0.5, 0.5); + elm_box_pack_end(bx, pd); + evas_object_show(pd); + + bt = elm_button_add(win); + evas_object_smart_callback_add(bt, "clicked", _engine_use, li); + elm_object_text_set(bt, "Use Engine"); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + evas_object_size_hint_align_set(bt, 0.5, 0.5); + elm_object_content_set(pd, bt); + evas_object_show(bt); + + evas_object_data_set(win, "rendering", bx); + elm_naviframe_item_simple_push(naviframe, bx); +} + +static void +_status_config_caches(Evas_Object *win, + Evas_Object *naviframe) +{ + Evas_Object *lb, *pd, *bx, *sl, *sp, *ck; + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.5); + + LABEL_FRAME_ADD("Cache Flush Interval (8 ticks pre second)"); + + sl = elm_slider_add(win); + evas_object_data_set(win, "cache_flush_interval_slider", sl); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + elm_slider_span_size_set(sl, 120); + elm_slider_unit_format_set(sl, "%1.0f ticks"); + elm_slider_indicator_format_set(sl, "%1.0f"); + elm_slider_min_max_set(sl, 8.0, 4096.0); + elm_slider_value_set(sl, elm_config_cache_flush_interval_get()); + elm_object_disabled_set(sl, !elm_config_cache_flush_enabled_get()); + + ck = elm_check_add(win); + evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(ck, EVAS_HINT_FILL, 0.5); + elm_object_text_set(ck, "Enable Flushing"); + elm_check_state_set(ck, elm_config_cache_flush_enabled_get()); + evas_object_smart_callback_add(ck, "changed", cf_enable, sl); + elm_box_pack_end(bx, ck); + evas_object_show(ck); + + elm_box_pack_end(bx, sl); + evas_object_show(sl); + + evas_object_smart_callback_add(sl, "changed", cf_round, NULL); + evas_object_smart_callback_add(sl, "delay,changed", cf_change, NULL); + + sp = elm_separator_add(win); + elm_separator_horizontal_set(sp, EINA_TRUE); + evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, sp); + evas_object_show(sp); + + LABEL_FRAME_ADD("Font Cache Size"); + + sl = elm_slider_add(win); + evas_object_data_set(win, "font_cache_slider", sl); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + elm_slider_span_size_set(sl, 120); + elm_slider_unit_format_set(sl, "%1.1f MB"); + elm_slider_indicator_format_set(sl, "%1.1f"); + elm_slider_min_max_set(sl, 0.0, 4.0); + elm_slider_value_set(sl, (double)elm_config_cache_font_cache_size_get() / 1024.0); + elm_box_pack_end(bx, sl); + evas_object_show(sl); + + evas_object_smart_callback_add(sl, "changed", fc_round, NULL); + evas_object_smart_callback_add(sl, "delay,changed", fc_change, NULL); + + sp = elm_separator_add(win); + elm_separator_horizontal_set(sp, EINA_TRUE); + evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, sp); + evas_object_show(sp); + + LABEL_FRAME_ADD("Image Cache Size"); + + sl = elm_slider_add(win); + evas_object_data_set(win, "image_cache_slider", sl); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + elm_slider_span_size_set(sl, 120); + elm_slider_unit_format_set(sl, "%1.0f MB"); + elm_slider_indicator_format_set(sl, "%1.0f"); + elm_slider_min_max_set(sl, 0, 32); + elm_slider_value_set(sl, (double)elm_config_cache_image_cache_size_get() / 1024.0); + elm_box_pack_end(bx, sl); + evas_object_show(sl); + + evas_object_smart_callback_add(sl, "changed", ic_round, NULL); + evas_object_smart_callback_add(sl, "delay,changed", ic_change, NULL); + + sp = elm_separator_add(win); + elm_separator_horizontal_set(sp, EINA_TRUE); + evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, sp); + evas_object_show(sp); + + LABEL_FRAME_ADD("Number of Edje Files to Cache"); + + sl = elm_slider_add(win); + evas_object_data_set(win, "edje_file_cache_slider", sl); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + elm_slider_span_size_set(sl, 120); + elm_slider_unit_format_set(sl, "%1.0f files"); + elm_slider_indicator_format_set(sl, "%1.0f"); + elm_slider_min_max_set(sl, 0, 32); + elm_slider_value_set(sl, elm_config_cache_edje_file_cache_size_get()); + elm_box_pack_end(bx, sl); + evas_object_show(sl); + + evas_object_smart_callback_add(sl, "changed", efc_round, NULL); + evas_object_smart_callback_add(sl, "delay,changed", efc_change, NULL); + + sp = elm_separator_add(win); + elm_separator_horizontal_set(sp, EINA_TRUE); + evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, sp); + evas_object_show(sp); + + LABEL_FRAME_ADD("Number of Edje Collections to Cache"); + + sl = elm_slider_add(win); + evas_object_data_set(win, "edje_collection_cache_slider", sl); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + elm_slider_span_size_set(sl, 120); + elm_slider_unit_format_set(sl, "%1.0f collections"); + elm_slider_indicator_format_set(sl, "%1.0f"); + elm_slider_min_max_set(sl, 0, 128); + elm_slider_value_set(sl, elm_config_cache_edje_collection_cache_size_get()); + elm_box_pack_end(bx, sl); + evas_object_show(sl); + + evas_object_smart_callback_add(sl, "changed", ecc_round, NULL); + evas_object_smart_callback_add(sl, "delay,changed", ecc_change, NULL); + + evas_object_data_set(win, "caches", bx); + + elm_naviframe_item_simple_push(naviframe, bx); +} + +static void +_status_config_full(Evas_Object *win, + Evas_Object *bx0) +{ + Evas_Object *tb, *naviframe; + Elm_Object_Item *tb_sizing, *tb_it; + + tb = elm_toolbar_add(win); + elm_toolbar_select_mode_set(tb, ELM_OBJECT_SELECT_MODE_ALWAYS); + elm_toolbar_menu_parent_set(tb, win); + elm_toolbar_homogeneous_set(tb, EINA_FALSE); + evas_object_size_hint_weight_set(tb, 1.0, 0.0); + evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL); + + tb_sizing = elm_toolbar_item_append(tb, "zoom-fit-best", "Sizing", + _cf_sizing, win); + elm_toolbar_item_priority_set(tb_sizing, 100); + + tb_it = elm_toolbar_item_append(tb, "preferences-desktop-theme", "Theme", + _cf_themes, win); + elm_toolbar_item_priority_set(tb_it, 90); + + elm_toolbar_item_append(tb, "preferences-desktop-font", "Fonts", + _cf_fonts, win); + + tb_it = elm_toolbar_item_append(tb, "system-users", "Profiles", + _cf_profiles, win); + elm_toolbar_item_priority_set(tb_it, 90); + + elm_toolbar_item_append(tb, "system-run", "Scrolling", _cf_scrolling, win); + elm_toolbar_item_append(tb, "video-display", "Rendering", + _cf_rendering, win); + elm_toolbar_item_append(tb, "appointment-new", "Caches", _cf_caches, win); + + elm_box_pack_end(bx0, tb); + evas_object_show(tb); + + naviframe = elm_naviframe_add(win); + evas_object_size_hint_align_set(naviframe, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(naviframe, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_data_set(win, "naviframe", naviframe); + + _status_config_themes(win, naviframe); + _status_config_fonts(win, naviframe); + _status_config_profiles(win, naviframe); + _status_config_rendering(win, naviframe); + _status_config_scrolling(win, naviframe); + _status_config_caches(win, naviframe); + _status_config_sizing(win, naviframe); + + // FIXME uncomment after flip style fix, please + //elm_object_style_set(naviframe, "flip"); + elm_toolbar_item_selected_set(tb_sizing, EINA_TRUE); + elm_box_pack_end(bx0, naviframe); + evas_object_show(naviframe); +} + +static void +win_create(void) +{ + Evas_Object *win, *bx0; + + win = elm_win_util_standard_add("main", "Elementary Config"); + ecore_event_handler_add(ELM_EVENT_CONFIG_ALL_CHANGED, _config_all_changed, + win); + evas_object_smart_callback_add(win, "delete,request", config_exit, NULL); + + bx0 = elm_box_add(win); + evas_object_size_hint_weight_set(bx0, 1.0, 1.0); + elm_win_resize_object_add(win, bx0); + evas_object_show(bx0); + + if (!interactive) _status_basic(win, bx0); + else if (0) + _status_config(win, bx0); + else _status_config_full(win, bx0); + + evas_object_resize(win, 320, 480); + evas_object_show(win); +} + +static Eina_Bool +_exit_timer(void *data __UNUSED__) +{ + elm_exit(); + return ECORE_CALLBACK_CANCEL; +} + +/* this is your elementary main function - it MUST be called IMMEDIATELY + * after elm_init() and MUST be passed argc and argv, and MUST be called + * elm_main and not be static - must be a visible symbol with EAPI infront */ +EAPI_MAIN int +elm_main(int argc, + char **argv) +{ + int i; + + elm_app_info_set(elm_main, "elementary", "images/logo.png"); + elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR); + elm_app_compile_data_dir_set(PACKAGE_DATA_DIR); + + for (i = 1; i < argc; i++) + { + if (!strcmp(argv[i], "-h")) + { + printf("Usage:\n" + " -h This help\n" + " -q Quiet mode (dont show window)\n" + " -t THEME Set theme to THEME (ELM_THEME spec)\n" + " -f SIZE Set finger size to SIZE pixels\n" + " -s SCALE Set scale factor to SCALE\n" + ); + } + else if (!strcmp(argv[i], "-q")) + { + quiet = 1; + interactive = 0; + } + else if ((!strcmp(argv[i], "-t")) && (i < argc - 1)) + { + i++; + theme_set = argv[i]; + interactive = 0; + } + else if ((!strcmp(argv[i], "-f")) && (i < argc - 1)) + { + i++; + finger_size_set = argv[i]; + interactive = 0; + } + else if ((!strcmp(argv[i], "-s")) && (i < argc - 1)) + { + i++; + scale_set = argv[i]; + interactive = 0; + } + } + /* put here any init code specific to this app like parsing args, etc. */ + if (!quiet) + { +#ifdef ELM_EFREET + elm_need_efreet(); +#endif + win_create(); /* create main window */ + if (!interactive) + ecore_timer_add(2.0, _exit_timer, NULL); + } + if (!interactive) + { + if (theme_set) elm_theme_set(NULL, theme_set); + if (finger_size_set) elm_config_finger_size_set(atoi(finger_size_set)); + if (scale_set) elm_config_scale_set(atof(scale_set)); + + elm_config_all_flush(); + + if (quiet) elm_exit(); + } + elm_run(); /* and run the program now and handle all events, etc. */ + /* if the mainloop that elm_run() runs exists, we exit the app */ + elm_shutdown(); /* clean up and shut down */ + /* exit code */ + return 0; +} + +#endif +/* All emelentary apps should use this. Put it right after elm_main() */ +ELM_MAIN() diff --git a/libraries/elementary/src/bin/quicklaunch.c b/libraries/elementary/src/bin/quicklaunch.c new file mode 100644 index 0000000..c9e6de9 --- /dev/null +++ b/libraries/elementary/src/bin/quicklaunch.c @@ -0,0 +1,298 @@ +#include +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static double restart_time = 0.0; + +#define LENGTH_OF_SOCKADDR_UN(s) (strlen((s)->sun_path) + (size_t)(((struct sockaddr_un *)NULL)->sun_path)) + +static struct sigaction old_sigint; +static struct sigaction old_sigterm; +static struct sigaction old_sigquit; +static struct sigaction old_sigalrm; +static struct sigaction old_sigusr1; +static struct sigaction old_sigusr2; +static struct sigaction old_sighup; +static struct sigaction old_sigchld; +static struct sigaction old_sigsegv; +static struct sigaction old_sigill; +static struct sigaction old_sigfpe; +static struct sigaction old_sigbus; +static struct sigaction old_sigabrt; +static int _log_dom = -1; + +#define CRITICAL(...) EINA_LOG_DOM_CRIT(_log_dom, __VA_ARGS__) +#define ERR(...) EINA_LOG_DOM_ERR(_log_dom, __VA_ARGS__) +#define WRN(...) EINA_LOG_DOM_WARN(_log_dom, __VA_ARGS__) +#define INF(...) EINA_LOG_DOM_INFO(_log_dom, __VA_ARGS__) +#define DBG(...) EINA_LOG_DOM_DBG(_log_dom, __VA_ARGS__) + +static void +post_fork(void *data __UNUSED__) +{ + sigaction(SIGINT, &old_sigint, NULL); + sigaction(SIGTERM, &old_sigterm, NULL); + sigaction(SIGQUIT, &old_sigquit, NULL); + sigaction(SIGALRM, &old_sigalrm, NULL); + sigaction(SIGUSR1, &old_sigusr1, NULL); + sigaction(SIGUSR2, &old_sigusr2, NULL); + sigaction(SIGHUP, &old_sighup, NULL); + sigaction(SIGCHLD, &old_sigchld, NULL); + sigaction(SIGSEGV, &old_sigsegv, NULL); + sigaction(SIGILL, &old_sigill, NULL); + sigaction(SIGFPE, &old_sigfpe, NULL); + sigaction(SIGBUS, &old_sigbus, NULL); + sigaction(SIGABRT, &old_sigabrt, NULL); + if ((_log_dom > -1) && (_log_dom != EINA_LOG_DOMAIN_GLOBAL)) + { + eina_log_domain_unregister(_log_dom); + _log_dom = -1; + } +} + +static void +child_handler(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED__) +{ + int status; + while (waitpid(-1, &status, WNOHANG) > 0); +} + +static void +crash_handler(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED__) +{ + double t; + + ERR("crash detected. restarting."); + t = ecore_time_get(); + if ((t - restart_time) <= 2.0) + { + CRITICAL("crash too fast - less than 2 seconds. abort restart"); + exit(-1); + } + ecore_app_restart(); +} + +static void +handle_run(int fd, unsigned long bytes) +{ + unsigned char *buf = NULL; + int i; + char **argv = NULL; + char *cwd; + int argc; + + buf = alloca(bytes); + if (read(fd, buf, bytes) <= 0) + { + close(fd); + return; + } + close(fd); + argc = ((unsigned long *)(buf))[0]; + argv = (char **)(&(((unsigned long *)(buf))[1])); + for (i = 0; i < argc; i++) argv[i] = (char *)(buf + (unsigned long)argv[i]); + cwd = argv[argc - 1] + strlen(argv[argc - 1]) + 1; + elm_quicklaunch_prepare(argc, argv); + elm_quicklaunch_fork(argc, argv, cwd, post_fork, NULL); + elm_quicklaunch_cleanup(); +} + +int +main(int argc, char **argv) +{ + int sock, socket_unix_len; + struct stat st; + struct sockaddr_un socket_unix; + struct linger lin; + char buf[PATH_MAX]; + struct sigaction action; + + if (!eina_init()) + { + fprintf(stderr, "ERROR: failed to init eina."); + exit(-1); + } + _log_dom = eina_log_domain_register + ("elementary_quicklaunch", EINA_COLOR_CYAN); + if (_log_dom < 0) + { + EINA_LOG_ERR("could not register elementary_quicklaunch log domain."); + _log_dom = EINA_LOG_DOMAIN_GLOBAL; + } + + if (!getenv("DISPLAY")) + { + CRITICAL("DISPLAY env var not set"); + exit(-1); + } + snprintf(buf, sizeof(buf), "/tmp/elm-ql-%i", getuid()); + if (stat(buf, &st) < 0) mkdir(buf, S_IRUSR | S_IWUSR | S_IXUSR); + snprintf(buf, sizeof(buf), "/tmp/elm-ql-%i/%s", getuid(), getenv("DISPLAY")); + unlink(buf); + sock = socket(AF_UNIX, SOCK_STREAM, 0); + if (sock < 0) + { + CRITICAL("cannot create socket for socket for '%s': %s", + buf, strerror(errno)); + exit(-1); + } + if (fcntl(sock, F_SETFD, FD_CLOEXEC) < 0) + { + CRITICAL("cannot set close on exec socket for '%s' (fd=%d): %s", + buf, sock, strerror(errno)); + exit(-1); + } + lin.l_onoff = 1; + lin.l_linger = 0; + if (setsockopt(sock, SOL_SOCKET, SO_LINGER, &lin, sizeof(struct linger)) < 0) + { + CRITICAL("cannot set linger for socket for '%s' (fd=%d): %s", + buf, sock, strerror(errno)); + exit(-1); + } + socket_unix.sun_family = AF_UNIX; + strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path)); + socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix); + if (bind(sock, (struct sockaddr *)&socket_unix, socket_unix_len) < 0) + { + CRITICAL("cannot bind socket for '%s' (fd=%d): %s", + buf, sock, strerror(errno)); + exit(-1); + } + if (listen(sock, 4096) < 0) + { + CRITICAL("listen(sock=%d, 4096): %s", sock, strerror(errno)); + exit(-1); + } + elm_quicklaunch_mode_set(EINA_TRUE); + elm_quicklaunch_init(argc, argv); + restart_time = ecore_time_get(); + + memset(&action, 0, sizeof(struct sigaction)); + action.sa_handler = SIG_DFL; + action.sa_sigaction = NULL; + action.sa_flags = SA_RESTART | SA_SIGINFO; + sigemptyset(&action.sa_mask); + sigaction(SIGINT, &action, &old_sigint); + + action.sa_handler = SIG_DFL; + action.sa_sigaction = NULL; + action.sa_flags = SA_RESTART | SA_SIGINFO; + sigemptyset(&action.sa_mask); + sigaction(SIGTERM, &action, &old_sigterm); + + action.sa_handler = SIG_DFL; + action.sa_sigaction = NULL; + action.sa_flags = SA_RESTART | SA_SIGINFO; + sigemptyset(&action.sa_mask); + sigaction(SIGQUIT, &action, &old_sigquit); + + action.sa_handler = SIG_DFL; + action.sa_sigaction = NULL; + action.sa_flags = SA_RESTART | SA_SIGINFO; + sigemptyset(&action.sa_mask); + sigaction(SIGALRM, &action, &old_sigalrm); + + action.sa_handler = SIG_DFL; + action.sa_sigaction = NULL; + action.sa_flags = SA_RESTART | SA_SIGINFO; + sigemptyset(&action.sa_mask); + sigaction(SIGUSR1, &action, &old_sigusr1); + + action.sa_handler = SIG_DFL; + action.sa_sigaction = NULL; + action.sa_flags = SA_RESTART | SA_SIGINFO; + sigemptyset(&action.sa_mask); + sigaction(SIGUSR2, &action, &old_sigusr2); + + action.sa_handler = SIG_DFL; + action.sa_sigaction = NULL; + action.sa_flags = SA_RESTART | SA_SIGINFO; + sigemptyset(&action.sa_mask); + sigaction(SIGHUP, &action, &old_sighup); + + action.sa_handler = NULL; + action.sa_sigaction = child_handler; + action.sa_flags = SA_RESTART | SA_SIGINFO; + sigemptyset(&action.sa_mask); + sigaction(SIGCHLD, &action, &old_sigchld); + + action.sa_handler = NULL; + action.sa_sigaction = crash_handler; + action.sa_flags = SA_NODEFER | SA_RESETHAND | SA_SIGINFO; + sigemptyset(&action.sa_mask); + sigaction(SIGSEGV, &action, &old_sigsegv); + + action.sa_handler = NULL; + action.sa_sigaction = crash_handler; + action.sa_flags = SA_NODEFER | SA_RESETHAND | SA_SIGINFO; + sigemptyset(&action.sa_mask); + sigaction(SIGILL, &action, &old_sigill); + + action.sa_handler = NULL; + action.sa_sigaction = crash_handler; + action.sa_flags = SA_NODEFER | SA_RESETHAND | SA_SIGINFO; + sigemptyset(&action.sa_mask); + sigaction(SIGFPE, &action, &old_sigfpe); + + action.sa_handler = NULL; + action.sa_sigaction = crash_handler; + action.sa_flags = SA_NODEFER | SA_RESETHAND | SA_SIGINFO; + sigemptyset(&action.sa_mask); + sigaction(SIGBUS, &action, &old_sigbus); + + action.sa_handler = NULL; + action.sa_sigaction = crash_handler; + action.sa_flags = SA_NODEFER | SA_RESETHAND | SA_SIGINFO; + sigemptyset(&action.sa_mask); + sigaction(SIGABRT, &action, &old_sigabrt); + + for (;;) + { + int fd; + struct sockaddr_un client; + socklen_t len; + + len = sizeof(struct sockaddr_un); + fd = accept(sock, (struct sockaddr *)&client, &len); + elm_quicklaunch_sub_init(argc, argv); +// don't seed since we are doing this AFTER launch request +// elm_quicklaunch_seed(); + if (fd >= 0) + { + unsigned long bytes; + int num; + + num = read(fd, &bytes, sizeof(unsigned long)); + if (num == sizeof(unsigned long)) + { + ecore_app_args_set(argc, (const char **)argv); + handle_run(fd, bytes); + } + } + while (elm_quicklaunch_sub_shutdown() > 0); + } + elm_quicklaunch_shutdown(); + + if ((_log_dom > -1) && (_log_dom != EINA_LOG_DOMAIN_GLOBAL)) + { + eina_log_domain_unregister(_log_dom); + _log_dom = -1; + } + eina_shutdown(); + + return 0; +} diff --git a/libraries/elementary/src/bin/run.c b/libraries/elementary/src/bin/run.c new file mode 100644 index 0000000..ebd9833 --- /dev/null +++ b/libraries/elementary/src/bin/run.c @@ -0,0 +1,160 @@ +#include "elementary_config.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef HAVE_ALLOCA_H +# include +#endif + +#define LENGTH_OF_SOCKADDR_UN(s) (strlen((s)->sun_path) + (size_t)(((struct sockaddr_un *)NULL)->sun_path)) + +int +main(int argc, char **argv) +{ + int sock, socket_unix_len, i; + struct sockaddr_un socket_unix; + char buf[PATH_MAX]; + struct stat st; + char *exe; + int we_are_elementary_run = 0; + char *disp; + char *cwd; + + int sargc, slen; + unsigned char *sbuf = NULL, *pos; + char **sargv = NULL; + + if (!getcwd(buf, sizeof(buf) - 1)) + { + fprintf(stderr, "elementary_quicklaunch: currect working dir too big.\n"); + exit(-1); + } + cwd = strdup(buf); + if (!(disp = getenv("DISPLAY"))) + { + fprintf(stderr, "elementary_quicklaunch: DISPLAY env var not set\n"); + exit(-1); + } + snprintf(buf, sizeof(buf), "/tmp/elm-ql-%i/%s", getuid(), disp); + if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) + { + perror("elementary_quicklaunch: socket(AF_UNIX, SOCK_STREAM, 0)"); + exit(-1); + } + socket_unix.sun_family = AF_UNIX; + strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path)); + socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix); + if (connect(sock, (struct sockaddr *)&socket_unix, socket_unix_len) < 0) + { + perror("elementary_quicklaunch: connect(sock, (struct sockaddr *)&socket_unix, socket_unix_len)"); + printf("elementary_quicklaunch: cannot connect to socket '%s'\n", buf); + exit(1); + } + exe = argv[0]; + if (!(((exe[0] == '/')) || + ((exe[0] == '.') && (exe[1] == '/')) || + ((exe[0] == '.') && (exe[1] == '.') && (exe[2] == '/')))) + { + char *path = getenv("PATH"); + int exelen = strlen(argv[0]); + if (path) + { + const char *p, *pp; + + p = path; + pp = p; + exe = NULL; + for (;;) + { + if ((*p == ':') || (!*p)) + { + unsigned int len; + + len = p - pp; + if (len < (sizeof(buf) - exelen - 3)) + { + strncpy(buf, pp, len); + strcpy(buf + len, "/"); + strcpy(buf + len + 1, argv[0]); + if (!access(buf, R_OK | X_OK)) + { + exe = buf; + break; + } + if (!*p) break; + p++; + pp = p; + } + } + else + { + if (!*p) break; + p++; + } + } + } + } + if (exe) + { + if (!lstat(exe, &st)) + { + if (S_ISLNK(st.st_mode)) + { + char buf2[PATH_MAX]; + + ssize_t len = readlink(exe, buf2, sizeof(buf2) - 1); + if (len >= 0) + { + char *p; + buf2[len] = 0; + p = strrchr(buf2, '/'); + if (p) p++; + else p = buf2; + if (!strncasecmp(p, "elementary_run", 14)) + we_are_elementary_run = 1; + } + } + } + } + if (we_are_elementary_run) + { + sargc = argc; + sargv = argv; + } + else + { + sargc = argc - 1; + sargv = &(argv[1]); + } + slen = sizeof(unsigned long) + sizeof(unsigned long); + for (i = 0; i < sargc; i++) + { + slen += sizeof(unsigned long); + slen += strlen(sargv[i]) + 1; + } + slen += strlen(cwd) + 1; + sbuf = alloca(slen); + ((unsigned long *)(sbuf))[0] = slen - sizeof(unsigned long); + ((unsigned long *)(sbuf))[1] = sargc; + pos = (unsigned char *)(&((((unsigned long *)(sbuf))[2 + sargc]))); + for (i = 0; i < sargc; i++) + { + ((unsigned long *)(sbuf))[2 + i] = + (unsigned long)pos - ((unsigned long)sbuf + sizeof(unsigned long)); + strcpy((char *)pos, sargv[i]); + pos += strlen(sargv[i]) + 1; + } + strcpy((char *)pos, cwd); + if (write(sock, sbuf, slen) < 0) + printf("elementary_quicklaunch: cannot write to socket '%s'\n", buf); + close(sock); + return 0; +} diff --git a/libraries/elementary/src/bin/test.c b/libraries/elementary/src/bin/test.c new file mode 100644 index 0000000..2ca69d2 --- /dev/null +++ b/libraries/elementary/src/bin/test.c @@ -0,0 +1,766 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +#include +#include +#include "test.h" +#ifndef ELM_LIB_QUICKLAUNCH + +/* all tests prototypes */ +void test_bg_plain(void *data, Evas_Object *obj, void *event_info); +void test_bg_image(void *data, Evas_Object *obj, void *event_info); +void test_bg_options(void *data, Evas_Object *obj, void *event_info); +void test_icon(void *data, Evas_Object *obj, void *event_info); +void test_icon_transparent(void *data, Evas_Object *obj, void *event_info); +void test_box_vert(void *data, Evas_Object *obj, void *event_info); +void test_box_vert2(void *data, Evas_Object *obj, void *event_info); +void test_box_pack(void *data, Evas_Object *obj, void *event_info); +void test_box_horiz(void *data, Evas_Object *obj, void *event_info); +void test_box_homo(void *data, Evas_Object *obj, void *event_info); +void test_box_transition(void *data, Evas_Object *obj, void *event_info); +void test_button(void *data, Evas_Object *obj, void *event_info); +void test_cnp(void *data, Evas_Object *obj, void *event_info); +void test_transit(void *data, Evas_Object *obj, void *event_info); +void test_transit2(void *data, Evas_Object *obj, void *event_info); +void test_transit3(void *data, Evas_Object *obj, void *event_info); +void test_transit4(void *data, Evas_Object *obj, void *event_info); +void test_transit5(void *data, Evas_Object *obj, void *event_info); +void test_transit6(void *data, Evas_Object *obj, void *event_info); +void test_transit7(void *data, Evas_Object *obj, void *event_info); +void test_transit8(void *data, Evas_Object *obj, void *event_info); +void test_transit9(void *data, Evas_Object *obj, void *event_info); +void test_fileselector_button(void *data, Evas_Object *obj, void *event_info); +void test_fileselector_entry(void *data, Evas_Object *obj, void *event_info); +void test_clock(void *data, Evas_Object *obj, void *event_info); +void test_clock2(void *data, Evas_Object *obj, void *event_info); +void test_clock3(void *data, Evas_Object *obj, void *event_info); +void test_check(void *data, Evas_Object *obj, void *event_info); +void test_check_toggle(void *data, Evas_Object *obj, void *event_info); +void test_radio(void *data, Evas_Object *obj, void *event_info); +void test_layout(void *data, Evas_Object *obj, void *event_info); +void test_layout2(void *data, Evas_Object *obj, void *event_info); +void test_hover(void *data, Evas_Object *obj, void *event_info); +void test_hover2(void *data, Evas_Object *obj, void *event_info); +void test_entry(void *data, Evas_Object *obj, void *event_info); +void test_entry_scrolled(void *data, Evas_Object *obj, void *event_info); +void test_entry3(void *data, Evas_Object *obj, void *event_info); +void test_entry4(void *data, Evas_Object *obj, void *event_info); +void test_entry5(void *data, Evas_Object *obj, void *event_info); +void test_entry6(void *data, Evas_Object *obj, void *event_info); +void test_entry7(void *data, Evas_Object *obj, void *event_info); +void test_entry8(void *data, Evas_Object *obj, void *event_info); +void test_entry_notepad(void *data, Evas_Object *obj, void *event_info); +void test_multibuttonentry(void *data, Evas_Object *obj, void *event_info); +void test_entry_anchor2(void *data, Evas_Object *obj, void *event_info); +void test_entry_anchor(void *data, Evas_Object *obj, void *event_info); +void test_toolbar(void *data, Evas_Object *obj, void *event_info); +void test_toolbar2(void *data, Evas_Object *obj, void *event_info); +void test_toolbar3(void *data, Evas_Object *obj, void *event_info); +void test_toolbar4(void *data, Evas_Object *obj, void *event_info); +void test_toolbar5(void *data, Evas_Object *obj, void *event_info); +void test_toolbar6(void *data, Evas_Object *obj, void *event_info); +void test_toolbar7(void *data, Evas_Object *obj, void *event_info); +void test_toolbar8(void *data, Evas_Object *obj, void *event_info); +void test_hoversel(void *data, Evas_Object *obj, void *event_info); +void test_list(void *data, Evas_Object *obj, void *event_info); +void test_list_horizontal(void *data, Evas_Object *obj, void *event_info); +void test_list2(void *data, Evas_Object *obj, void *event_info); +void test_list3(void *data, Evas_Object *obj, void *event_info); +void test_list4(void *data, Evas_Object *obj, void *event_info); +void test_list5(void *data, Evas_Object *obj, void *event_info); +void test_list6(void *data, Evas_Object *obj, void *event_info); +void test_inwin(void *data, Evas_Object *obj, void *event_info); +void test_inwin2(void *data, Evas_Object *obj, void *event_info); +void test_scaling(void *data, Evas_Object *obj, void *event_info); +void test_scaling2(void *data, Evas_Object *obj, void *event_info); +void test_slider(void *data, Evas_Object *obj, void *event_info); +void test_actionslider(void *data, Evas_Object *obj, void *event_info); +void test_genlist(void *data, Evas_Object *obj, void *event_info); +void test_genlist2(void *data, Evas_Object *obj, void *event_info); +void test_genlist3(void *data, Evas_Object *obj, void *event_info); +void test_genlist4(void *data, Evas_Object *obj, void *event_info); +void test_genlist5(void *data, Evas_Object *obj, void *event_info); +void test_genlist6(void *data, Evas_Object *obj, void *event_info); +void test_genlist7(void *data, Evas_Object *obj, void *event_info); +void test_genlist8(void *data, Evas_Object *obj, void *event_info); +void test_genlist9(void *data, Evas_Object *obj, void *event_info); +void test_genlist10(void *data, Evas_Object *obj, void *event_info); +void test_genlist11(void *data, Evas_Object *obj, void *event_info); +void test_genlist12(void *data, Evas_Object *obj, void *event_info); +void test_genlist13(void *data, Evas_Object *obj, void *event_info); +void test_genlist14(void *data, Evas_Object *obj, void *event_info); +void test_genlist15(void *data, Evas_Object *obj, void *event_info); +void test_genlist16(void *data, Evas_Object *obj, void *event_info); +void test_genlist17(void *data, Evas_Object *obj, void *event_info); +void test_gesture_layer(void *data, Evas_Object *obj, void *event_info); +void test_gesture_layer2(void *data, Evas_Object *obj, void *event_info); +void test_gesture_layer3(void *data, Evas_Object *obj, void *event_info); +void test_table(void *data, Evas_Object *obj, void *event_info); +void test_table2(void *data, Evas_Object *obj, void *event_info); +void test_table3(void *data, Evas_Object *obj, void *event_info); +void test_table4(void *data, Evas_Object *obj, void *event_info); +void test_table5(void *data, Evas_Object *obj, void *event_info); +void test_table6(void *data, Evas_Object *obj, void *event_info); +void test_table7(void *data, Evas_Object *obj, void *event_info); +void test_gengrid(void *data, Evas_Object *obj, void *event_info); +void test_gengrid2(void *data, Evas_Object *obj, void *event_info); +void test_gengrid3(void *data, Evas_Object *obj, void *event_info); +void test_win_state(void *data, Evas_Object *obj, void *event_info); +void test_win_state2(void *data, Evas_Object *obj, void *event_info); +void test_progressbar(void *data, Evas_Object *obj, void *event_info); +void test_fileselector(void *data, Evas_Object *obj, void *event_info); +void test_separator(void *data, Evas_Object *obj, void *event_info); +void test_scroller(void *data, Evas_Object *obj, void *event_info); +void test_scroller2(void *data, Evas_Object *obj, void *event_info); +void test_spinner(void *data, Evas_Object *obj, void *event_info); +void test_index(void *data, Evas_Object *obj, void *event_info); +void test_index2(void *data, Evas_Object *obj, void *event_info); +void test_photocam(void *data, Evas_Object *obj, void *event_info); +void test_photo(void *data, Evas_Object *obj, void *event_info); +void test_thumb(void *data, Evas_Object *obj, void *event_info); +void test_icon_desktops(void *data, Evas_Object *obj, void *event_info); +void test_icon_animated(void *data, Evas_Object *obj, void *event_info); +void test_notify(void *data, Evas_Object *obj, void *event_info); +void test_slideshow(void *data, Evas_Object *obj, void *event_info); +void test_menu(void *data, Evas_Object *obj, void *event_info); +void test_panel(void *data, Evas_Object *obj, void *event_info); +void test_panes(void *data, Evas_Object *obj, void *event_info); +void test_calendar(void *data, Evas_Object *obj, void *event_info); +void test_calendar2(void *data, Evas_Object *obj, void *event_info); +void test_map(void *data, Evas_Object *obj, void *event_info); +void test_weather(void *data, Evas_Object *obj, void *event_info); +void test_flip(void *data, Evas_Object *obj, void *event_info); +void test_flip2(void *data, Evas_Object *obj, void *event_info); +void test_flip3(void *data, Evas_Object *obj, void *event_info); +void test_flip4(void *data, Evas_Object *obj, void *event_info); +void test_flip_page(void *data, Evas_Object *obj, void *event_info); +void test_label(void *data, Evas_Object *obj, void *event_info); +void test_label2(void *data, Evas_Object *obj, void *event_info); +void test_conformant(void *data, Evas_Object *obj, void *event_info); +void test_conformant2(void *data, Evas_Object *obj, void *event_info); +void test_multi(void *data, Evas_Object *obj, void *event_info); +void test_floating(void *data, Evas_Object *obj, void *event_info); +void test_launcher(void *data, Evas_Object *obj, void *event_info); +void test_launcher2(void *data, Evas_Object *obj, void *event_info); +void test_launcher3(void *data, Evas_Object *obj, void *event_info); +void test_anim(void *data, Evas_Object *obj, void *event_info); +void test_tooltip(void *data, Evas_Object *obj, void *event_info); +void test_tooltip2(void *data, Evas_Object *obj, void *event_info); +void test_cursor(void *data, Evas_Object *obj, void *event_info); +void test_cursor2(void *data, Evas_Object *obj, void *event_info); +void test_cursor3(void *data, Evas_Object *obj, void *event_info); +void test_cursor4(void *data, Evas_Object *obj, void *event_info); +void test_focus(void *data, Evas_Object *obj, void *event_info); +void test_focus2(void *data, Evas_Object *obj, void *event_info); +void test_focus3(void *data, Evas_Object *obj, void *event_info); +void test_focus4(void *data, Evas_Object *obj, void *event_info); +void test_flipselector(void *data, Evas_Object *obj, void *event_info); +void test_diskselector(void *data, Evas_Object *obj, void *event_info); +void test_colorselector(void *data, Evas_Object *obj, void *event_info); +void test_ctxpopup(void *data, Evas_Object *obj, void *event_info); +void test_bubble(void *data, Evas_Object *obj, void *event_info); +void test_segment_control(void *data, Evas_Object *obj, void *event_info); +void test_store(void *data, Evas_Object *obj, void *event_info); +void test_win_inline(void *data, Evas_Object *obj, void *event_info); +void test_win_socket(void *data, Evas_Object *obj, void *event_info); +void test_win_plug(void *data, Evas_Object *obj, void *event_info); +void test_grid(void *data, Evas_Object *obj, void *event_info); +void test_glview_simple(void *data, Evas_Object *obj, void *event_info); +void test_glview(void *data, Evas_Object *obj, void *event_info); +void test_3d(void *data, Evas_Object *obj, void *event_info); +void test_naviframe(void *data, Evas_Object *obj, void *event_info); +void test_naviframe_complex(void *data, Evas_Object *obj, void *event_info); +//void test_factory(void *data, Evas_Object *obj, void *event_info); +void test_datetime(void *data, Evas_Object *obj, void *event_info); +void test_popup(void *data, Evas_Object *obj, void *event_info); +void test_dayselector(void *data, Evas_Object *obj, void *event_info); +#ifdef HAVE_EMOTION +void test_video(void *data, Evas_Object *obj, void *event_info); +#endif +#ifdef HAVE_EIO +void test_eio(void *data, Evas_Object *obj, void *event_info); +#endif +#ifdef HAVE_ELEMENTARY_WEB +void test_web_normal(void *data, Evas_Object *obj, void *event_info); +void test_web_mobile(void *data, Evas_Object *obj, void *event_info); +#endif + +Evas_Object *win, *tbx; // TODO: refactoring +void *tt; +Eina_List *tests; + +struct elm_test +{ + const char *icon; + const char *category; + const char *name; + void (*cb)(void *, Evas_Object *, void *); +}; + +static int +elm_test_sort(const void *pa, const void *pb) +{ + const struct elm_test *a = pa, *b = pb; + int res = strcasecmp(a->category, b->category); + if (res) return res; + return strcasecmp(a->name, b->name); +} + +static void +_elm_test_add(Eina_List **p_list, const char *icon, const char *category, const char *name, void (*cb)(void *, Evas_Object *, void *)) +{ + struct elm_test *t = malloc(sizeof(struct elm_test)); + t->icon = icon; + t->category = category; + t->name = name; + t->cb = cb; + *p_list = eina_list_sorted_insert(*p_list, elm_test_sort, t); +} + +void +my_win_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_exit(); /* exit the program's main loop that runs in elm_run() */ +} + +static void +_ui_tg_changed(void *data, Evas_Object *obj, void *event_info) +{ + (void) data; (void) event_info; + elm_config_mirrored_set(elm_check_state_get(obj)); +} + +static void +_frame_clicked(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + printf("frame %p is: %s\n", obj, elm_frame_collapse_get(obj) ? "collapsed" : "expanded"); +} + +static void +_menu_create(const char *option_str) +{ + struct elm_test *t = NULL; + const char *pcat = NULL; + Evas_Object *cfr = NULL, *tbx2 = NULL, *bt = NULL, *ic = NULL; + char buf[PATH_MAX]; + Eina_List *l; + + elm_box_clear(tbx); + EINA_LIST_FOREACH(tests, l, t) + { + if (option_str && !strcasestr(t->name, option_str)) continue; + if ((!pcat) || (strcmp(pcat, t->category))) + { + cfr = elm_frame_add(win); + // FIXME: add new style of frame for this + evas_object_smart_callback_add(cfr, "clicked", _frame_clicked, NULL); + elm_frame_autocollapse_set(cfr, EINA_TRUE); + elm_object_text_set(cfr, t->category); + evas_object_size_hint_weight_set(cfr, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_fill_set(cfr, EVAS_HINT_FILL, 0.0); + elm_box_pack_end(tbx, cfr); + evas_object_show(cfr); + + tbx2 = elm_box_add(win); + elm_box_layout_set(tbx2, evas_object_box_layout_flow_horizontal, NULL, NULL); + evas_object_size_hint_weight_set(tbx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(tbx2, EVAS_HINT_FILL, 0.0); + elm_box_align_set(tbx2, 0.0, 0.5); + elm_object_content_set(cfr, tbx2); + evas_object_show(tbx2); + } + bt = elm_button_add(win); + // FIXME: add new style of button for this like efm in e17 + elm_object_text_set(bt, t->name); + if (t->icon) + { + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), t->icon); + elm_icon_file_set(ic, buf, NULL); + elm_object_part_content_set(bt, "icon", ic); + evas_object_show(ic); + } + elm_box_pack_end(tbx2, bt); + evas_object_show(bt); + evas_object_smart_callback_add(bt, "clicked", t->cb, NULL); + pcat = t->category; + if (t == tt) tt = cfr; + } +} + +static void +_entry_activated_cb(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + const char *str = elm_entry_entry_get(obj); + if (!str) return; + _menu_create(str); +} + +static void +_btn_clicked_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + const char *str = elm_entry_entry_get(data); + if (!str) return; + _menu_create(str); +} + +static void +my_win_main(char *autorun, Eina_Bool test_win_only) +{ + Evas_Object *bg = NULL, *bx0 = NULL, *bx1 = NULL, *lb = NULL; + Evas_Object *fr = NULL, *tg = NULL, *sc = NULL, *en = NULL; + Evas_Object *btn = NULL; + Eina_List *l; + struct elm_test *t = NULL; + + if (test_win_only) goto add_tests; + /* Create an elm window - It returns an evas object. This is a little + * special as the object lives in the canvas that is inside the window + * so what is returned is really inside the window, but as you manipulate + * the evas object returned - the window will respond. elm_win makes sure + * of that so you can blindly treat it like any other evas object + * pretty much, just as long as you know it has special significance. + * The first parameter is a "parent" window - eg for a dialog you want to + * have a main window it is related to, here it is NULL meaning there + * is no parent. "main" is the name of the window - used by the window + * manager for identifying the window uniquely amongst all the windows + * within this application (and all instances of the application). The + * type is a basic window (the final parameter). + * You can call elm_win_util_standard_add() instead. This is a convenient API + * for window and bg creation. You don't need to create bg object manually. + * You can also set the title of the window at the same time. + * ex) win = elm_win_util_standard_add("main", "Elementary Tests"); */ + win = elm_win_add(NULL, "main", ELM_WIN_BASIC); + /* Set the title of the window - This is in the titlebar. */ + elm_win_title_set(win, "Elementary Tests"); + + /* Set a callback on the window when "delete,request" is emitted as + * a callback. When this happens my_win_del() is called and the + * data pointer (first param) is passed the final param here (in this + * case it is NULL). This is how you can pass specific things to a + * callback like objects or data layered on top. */ + evas_object_smart_callback_add(win, "delete,request", my_win_del, NULL); + + /* Add a background to our window. This just uses the standard theme set + * background. Without a background, you could make a window seem + * transparent with elm_win_alpha_set(win, EINA_TRUE); For example. if you + * have a compositor running this will make the window able to be + * semi-transparent and any space not filled by object/widget pixels will + * be transparent or translucent based on alpha. If you do not have a + * compositor running this should fall back to using shaped windows + * (which have a mask). Both these features will be slow and rely on + * a lot more resources, so only use it if you need it. */ + bg = elm_bg_add(win); + /* Set weight to 1.0 x 1.0 == expand in both x and y direction. */ + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + /* Tell the window that this object is to be resized along with the window. + * Also as a result this object will be one of several objects that + * controls the minimum/maximum size of the window. */ + elm_win_resize_object_add(win, bg); + /* And show the background. */ + evas_object_show(bg); + + /* Add a box layout widget to the window. */ + bx0 = elm_box_add(win); + /* Allow base box (bx0) to expand in x and y. */ + evas_object_size_hint_weight_set(bx0, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + /* Tell the window that the box affects window size and also will be + * resized when the window is resized. */ + elm_win_resize_object_add(win, bx0); + evas_object_show(bx0); + + fr = elm_frame_add(win); + evas_object_smart_callback_add(fr, "clicked", _frame_clicked, NULL); + elm_frame_autocollapse_set(fr, EINA_TRUE); + elm_object_text_set(fr, "Information"); + elm_box_pack_end(bx0, fr); + evas_object_show(fr); + + lb = elm_label_add(win); + elm_object_text_set(lb, + "Please select a test from the list below by clicking
" + "the test button to show the test window."); + elm_object_content_set(fr, lb); + evas_object_show(lb); + + tg = elm_check_add(win); + elm_object_style_set(tg, "toggle"); + elm_object_text_set(tg, "UI-Mirroring:"); + elm_check_state_set(tg, elm_config_mirrored_get()); + evas_object_smart_callback_add(tg, "changed", _ui_tg_changed, NULL); + elm_box_pack_end(bx0, tg); + evas_object_show(tg); + + bx1 = elm_box_add(win); + elm_box_horizontal_set(bx1, EINA_TRUE); + evas_object_size_hint_weight_set(bx1, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx1, EVAS_HINT_FILL, 0.0); + elm_box_pack_end(bx0, bx1); + evas_object_show(bx1); + + lb = elm_label_add(win); + elm_object_text_set(lb, " Search Menu :"); + evas_object_size_hint_weight_set(lb, 0.0, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(lb, 0.0, EVAS_HINT_FILL); + elm_box_pack_end(bx1, lb); + evas_object_show(lb); + + en = elm_entry_add(win); + elm_entry_single_line_set(en, EINA_TRUE); + elm_entry_scrollable_set(en, EINA_TRUE); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_smart_callback_add(en, "activated", _entry_activated_cb, NULL); + elm_box_pack_end(bx1, en); + evas_object_show(en); + elm_object_focus_set(en, EINA_TRUE); + + btn = elm_button_add(win); + elm_object_text_set(btn, "Go"); + evas_object_smart_callback_add(btn, "clicked", _btn_clicked_cb, en); + elm_box_pack_end(bx1, btn); + evas_object_show(btn); + + sc = elm_scroller_add(win); + elm_scroller_bounce_set(sc, EINA_FALSE, EINA_TRUE); + evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_fill_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx0, sc); + evas_object_show(sc); + + tbx = elm_box_add(win); + evas_object_size_hint_weight_set(tbx, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(tbx, EVAS_HINT_FILL, 0.0); + elm_object_content_set(sc, tbx); + evas_object_show(tbx); + +add_tests: + tests = NULL; +#define ADD_TEST(icon_, cat_, name_, cb_) _elm_test_add(&tests, icon_, cat_, name_, cb_) + + //------------------------------// + ADD_TEST(NULL, "Window / Background", "Bg Plain", test_bg_plain); + ADD_TEST(NULL, "Window / Background", "Bg Image", test_bg_image); + ADD_TEST(NULL, "Window / Background", "Bg Options", test_bg_options); + ADD_TEST(NULL, "Window / Background", "Window States", test_win_state); + ADD_TEST(NULL, "Window / Background", "Window States 2", test_win_state2); + ADD_TEST(NULL, "Window / Background", "Inwin", test_inwin); + ADD_TEST(NULL, "Window / Background", "Inwin 2", test_inwin2); + ADD_TEST(NULL, "Window / Background", "Window Inline", test_win_inline); + ADD_TEST(NULL, "Window / Background", "Window Socket", test_win_socket); + ADD_TEST(NULL, "Window / Background", "Window Plug", test_win_plug); + + //------------------------------// + ADD_TEST(NULL, "Images", "Icon", test_icon); + ADD_TEST(NULL, "Images", "Icon Transparent", test_icon_transparent); + ADD_TEST(NULL, "Images", "Icon Animation", test_icon_animated); + ADD_TEST(NULL, "Images", "Photocam", test_photocam); + ADD_TEST(NULL, "Images", "Photo", test_photo); + ADD_TEST(NULL, "Images", "Thumb", test_thumb); + ADD_TEST(NULL, "Images", "Slideshow", test_slideshow); +#ifdef HAVE_EMOTION + ADD_TEST(NULL, "Images", "Video", test_video); +#endif + + //------------------------------// + ADD_TEST(NULL, "Containers", "Box Vert", test_box_vert); + ADD_TEST(NULL, "Containers", "Box Vert 2", test_box_vert2); + ADD_TEST(NULL, "Containers", "Box Pack", test_box_pack); + ADD_TEST(NULL, "Containers", "Box Horiz", test_box_horiz); + ADD_TEST(NULL, "Containers", "Box Homogeneous", test_box_homo); + ADD_TEST(NULL, "Containers", "Box Transition", test_box_transition); + ADD_TEST(NULL, "Containers", "Table", test_table); + ADD_TEST(NULL, "Containers", "Table Homogeneous", test_table2); + ADD_TEST(NULL, "Containers", "Table 3", test_table3); + ADD_TEST(NULL, "Containers", "Table 4", test_table4); + ADD_TEST(NULL, "Containers", "Table 5", test_table5); + ADD_TEST(NULL, "Containers", "Table 6", test_table6); + ADD_TEST(NULL, "Containers", "Table 7", test_table7); + ADD_TEST(NULL, "Containers", "Layout", test_layout); + ADD_TEST(NULL, "Containers", "Layout 2", test_layout2); + ADD_TEST(NULL, "Containers", "Grid", test_grid); + + //------------------------------// + ADD_TEST(NULL, "Entries", "Entry", test_entry); + ADD_TEST(NULL, "Entries", "Entry Scrolled", test_entry_scrolled); + ADD_TEST(NULL, "Entries", "Entry 3", test_entry3); + ADD_TEST(NULL, "Entries", "Entry 4", test_entry4); + ADD_TEST(NULL, "Entries", "Entry 5", test_entry5); + ADD_TEST(NULL, "Entries", "Entry 6", test_entry6); + ADD_TEST(NULL, "Entries", "Entry 7", test_entry7); + ADD_TEST(NULL, "Entries", "Entry 8", test_entry8); + ADD_TEST(NULL, "Entries", "Entry Notepad", test_entry_notepad); + ADD_TEST(NULL, "Entries", "Multibuttonentry", test_multibuttonentry); + ADD_TEST(NULL, "Entries", "Entry Anchor", test_entry_anchor); + ADD_TEST(NULL, "Entries", "Entry Anchor2", test_entry_anchor2); + + //------------------------------// + ADD_TEST(NULL, "Buttons", "Buttons", test_button); + + //------------------------------// + ADD_TEST(NULL, "Effects", "Transit", test_transit); + ADD_TEST(NULL, "Effects", "Transit 2", test_transit2); + ADD_TEST(NULL, "Effects", "Transit 3", test_transit3); + ADD_TEST(NULL, "Effects", "Transit 4", test_transit4); + ADD_TEST(NULL, "Effects", "Transit 5", test_transit5); + ADD_TEST(NULL, "Effects", "Transit 6", test_transit6); + ADD_TEST(NULL, "Effects", "Transit 7", test_transit7); + ADD_TEST(NULL, "Effects", "Transit 8", test_transit8); + ADD_TEST(NULL, "Effects", "Transit 9", test_transit9); + ADD_TEST(NULL, "Effects", "Flip", test_flip); + ADD_TEST(NULL, "Effects", "Flip 2", test_flip2); + ADD_TEST(NULL, "Effects", "Flip 3", test_flip3); + ADD_TEST(NULL, "Effects", "Flip Interactive", test_flip4); + ADD_TEST(NULL, "Effects", "Flip Page", test_flip_page); + ADD_TEST(NULL, "Effects", "Animation", test_anim); + + //------------------------------// + ADD_TEST(NULL, "Toolbars", "Toolbar", test_toolbar); + ADD_TEST(NULL, "Toolbars", "Toolbar 2", test_toolbar2); + ADD_TEST(NULL, "Toolbars", "Toolbar 3", test_toolbar3); + ADD_TEST(NULL, "Toolbars", "Toolbar 4", test_toolbar4); + ADD_TEST(NULL, "Toolbars", "Toolbar 5", test_toolbar5); + ADD_TEST(NULL, "Toolbars", "Toolbar 6", test_toolbar6); + ADD_TEST(NULL, "Toolbars", "Toolbar 7", test_toolbar7); + ADD_TEST(NULL, "Toolbars", "Toolbar 8", test_toolbar8); + + //------------------------------// + ADD_TEST(NULL, "Lists", "List", test_list); + ADD_TEST(NULL, "Lists", "List - Horizontal", test_list_horizontal); + ADD_TEST(NULL, "Lists", "List 2", test_list2); + ADD_TEST(NULL, "Lists", "List 3", test_list3); + ADD_TEST(NULL, "Lists", "List 4", test_list4); + ADD_TEST(NULL, "Lists", "List 5", test_list5); + ADD_TEST(NULL, "Lists", "List 6", test_list6); + ADD_TEST(NULL, "Lists", "Genlist", test_genlist); + ADD_TEST(NULL, "Lists", "Genlist 2", test_genlist2); + ADD_TEST(NULL, "Lists", "Genlist 3", test_genlist3); + ADD_TEST(NULL, "Lists", "Genlist 4", test_genlist4); + ADD_TEST(NULL, "Lists", "Genlist 5", test_genlist5); + ADD_TEST(NULL, "Lists", "Genlist 7", test_genlist7); + ADD_TEST(NULL, "Lists", "Genlist Tree", test_genlist6); + ADD_TEST(NULL, "Lists", "Genlist Group", test_genlist8); + ADD_TEST(NULL, "Lists", "Genlist Group Tree", test_genlist9); + ADD_TEST(NULL, "Lists", "Genlist Decorate Item Mode", test_genlist10); + ADD_TEST(NULL, "Lists", "Genlist Decorate All Mode", test_genlist15); + ADD_TEST(NULL, "Lists", "Genlist Reorder Mode", test_genlist11); +#ifdef HAVE_EIO + ADD_TEST(NULL, "Lists", "Genlist Eio", test_eio); +#endif + ADD_TEST(NULL, "Lists", "Genlist Textblock", test_genlist12); + ADD_TEST(NULL, "Lists", "Genlist Tree, Insert Sorted", test_genlist13); + ADD_TEST(NULL, "Lists", "Genlist Tree, Insert Relative", test_genlist14); + ADD_TEST(NULL, "Lists", "Genlist Flip Mode", test_genlist16); + ADD_TEST(NULL, "Lists", "Genlist Tree Effect", test_genlist17); + ADD_TEST(NULL, "Lists", "GenGrid", test_gengrid); + ADD_TEST(NULL, "Lists", "GenGrid 2", test_gengrid2); + ADD_TEST(NULL, "Lists", "GenGrid Group", test_gengrid3); + + //------------------------------// + ADD_TEST(NULL, "General", "Scaling", test_scaling); + ADD_TEST(NULL, "General", "Scaling 2", test_scaling2); + + //------------------------------// + ADD_TEST(NULL, "3D", "GLViewSimple", test_glview_simple); + ADD_TEST(NULL, "3D", "GLView", test_glview); + ADD_TEST(NULL, "3D", "Evas Map 3D", test_3d); + + //------------------------------// +#ifdef HAVE_ELEMENTARY_WEB + ADD_TEST(NULL, "Web", "Web", test_web_normal); + ADD_TEST(NULL, "Web", "Web-mobile", test_web_mobile); +#endif + + //------------------------------// + ADD_TEST(NULL, "Input", "Gesture Layer", test_gesture_layer); + ADD_TEST(NULL, "Input", "Gesture Layer 2", test_gesture_layer2); + ADD_TEST(NULL, "Input", "Gesture Layer 3", test_gesture_layer3); + ADD_TEST(NULL, "Input", "Multi Touch", test_multi); + + //------------------------------// + ADD_TEST(NULL, "Selectors", "Index", test_index); + ADD_TEST(NULL, "Selectors", "Index 2", test_index2); + ADD_TEST(NULL, "Selectors", "File Selector", test_fileselector); + ADD_TEST(NULL, "Selectors", "File Selector Entry", test_fileselector_entry); + ADD_TEST(NULL, "Selectors", "File Selector Button", test_fileselector_button); + ADD_TEST(NULL, "Selectors", "Actionslider", test_actionslider); + ADD_TEST(NULL, "Selectors", "Menu", test_menu); + ADD_TEST(NULL, "Selectors", "Disk Selector", test_diskselector); + ADD_TEST(NULL, "Selectors", "Color Selector", test_colorselector); + ADD_TEST(NULL, "Selectors", "Segment Control", test_segment_control); + ADD_TEST(NULL, "Selectors", "Hoversel", test_hoversel); + ADD_TEST(NULL, "Selectors", "Radios", test_radio); + ADD_TEST(NULL, "Selectors", "Flip Selector", test_flipselector); + ADD_TEST(NULL, "Selectors", "Dayselector", test_dayselector); + + //------------------------------// + ADD_TEST(NULL, "Cursors", "Cursor", test_cursor); + ADD_TEST(NULL, "Cursors", "Cursor 2", test_cursor2); + ADD_TEST(NULL, "Cursors", "Cursor 3", test_cursor3); + ADD_TEST(NULL, "Cursors", "Cursor Layout", test_cursor4); + + //------------------------------// + ADD_TEST(NULL, "Scroller", "Scroller", test_scroller); + ADD_TEST(NULL, "Scroller", "Scroller 2", test_scroller2); + + //------------------------------// + // FIXME: add frame test + ADD_TEST(NULL, "Boundaries", "Bubble", test_bubble); + ADD_TEST(NULL, "Boundaries", "Separator", test_separator); + + //------------------------------// + ADD_TEST(NULL, "Range Values", "Spinner", test_spinner); + ADD_TEST(NULL, "Range Values", "Slider", test_slider); + ADD_TEST(NULL, "Range Values", "Progressbar", test_progressbar); + + //------------------------------// + ADD_TEST(NULL, "Booleans", "Check", test_check); + ADD_TEST(NULL, "Booleans", "Check Toggle", test_check_toggle); + + //------------------------------// + ADD_TEST(NULL, "Popups", "Ctxpopup", test_ctxpopup); + ADD_TEST(NULL, "Popups", "Hover", test_hover); + ADD_TEST(NULL, "Popups", "Hover 2", test_hover2); + ADD_TEST(NULL, "Popups", "Notify", test_notify); + ADD_TEST(NULL, "Popups", "Tooltip", test_tooltip); + ADD_TEST(NULL, "Popups", "Tooltip 2", test_tooltip2); + ADD_TEST(NULL, "Popups", "Popup", test_popup); + + //------------------------------// + ADD_TEST(NULL, "Times & Dates", "Calendar", test_calendar); + ADD_TEST(NULL, "Times & Dates", "Calendar 2", test_calendar2); + ADD_TEST(NULL, "Times & Dates", "Clock", test_clock); + ADD_TEST(NULL, "Times & Dates", "Clock 2", test_clock2); + ADD_TEST(NULL, "Times & Dates", "Clock 3", test_clock3); + ADD_TEST(NULL, "Times & Dates", "Datetime", test_datetime); + + //------------------------------// + ADD_TEST(NULL, "Text", "Label", test_label); + ADD_TEST(NULL, "Text", "Label2", test_label2); + + //------------------------------// + ADD_TEST(NULL, "Stored Surface Buffer", "Launcher", test_launcher); + ADD_TEST(NULL, "Stored Surface Buffer", "Launcher 2", test_launcher2); + ADD_TEST(NULL, "Stored Surface Buffer", "Launcher 3", test_launcher3); + + //------------------------------// + ADD_TEST(NULL, "Focus", "Focus", test_focus); + ADD_TEST(NULL, "Focus", "Focus 2", test_focus2); + ADD_TEST(NULL, "Focus", "Focus 3", test_focus3); + ADD_TEST(NULL, "Focus", "Focus 4", test_focus4); + + //------------------------------// + ADD_TEST(NULL, "Naviframe", "Naviframe", test_naviframe); + ADD_TEST(NULL, "Naviframe", "Naviframe: Complex", test_naviframe_complex); + + //------------------------------// + ADD_TEST(NULL, "Geographic", "Map", test_map); + + //------------------------------// + ADD_TEST(NULL, "Dividers", "Panel", test_panel); + ADD_TEST(NULL, "Dividers", "Panes", test_panes); + + //------------------------------// + ADD_TEST(NULL, "Standardization", "Conformant", test_conformant); + ADD_TEST(NULL, "Standardization", "Conformant 2", test_conformant2); + + //------------------------------// + ADD_TEST(NULL, "Helpers", "Store", test_store); +// ADD_TEST(NULL, "Helpers", "Factory", test_factory); + + //------------------------------// + ADD_TEST(NULL, "Micellaneous", "Copy And Paste", test_cnp); + ADD_TEST(NULL, "Micellaneous", "Weather", test_weather); + ADD_TEST(NULL, "Micellaneous", "Icon Desktops", test_icon_desktops); + ADD_TEST(NULL, "Micellaneous", "Floating Objects", test_floating); + +#undef ADD_TEST + + if (autorun) + { + size_t alen = strlen(autorun); + EINA_LIST_FOREACH(tests, l, t) + { + if ((t->name) && (t->cb) && (!strncasecmp(t->name, autorun, alen))) + { + t->cb(NULL, NULL, NULL); + break; + } + } + + } + tt = t; + + if (test_win_only) + { + EINA_LIST_FREE(tests, t) + free(t); + + return; + } + + if (tests) + _menu_create(NULL); + + /* set an initial window size */ + evas_object_resize(win, 480, 480); + /* show the window */ + if (!test_win_only) + { + evas_object_show(win); + /* bring in autorun frame */ + if (autorun) + { + Evas_Coord x, y; + evas_object_geometry_get(tt, &x, &y, NULL, NULL); + elm_scroller_region_bring_in(sc, x, y, 0, 0); + } + } +} + +/* this is your elementary main function - it MUST be called IMMEDIATELY + * after elm_init() and MUST be passed argc and argv, and MUST be called + * elm_main and not be static - must be a visible symbol with EAPI_MAIN infront */ +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Eina_Bool test_win_only = EINA_FALSE; + char *autorun = NULL; + + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + /* tell elm about our app so it can figure out where to get files */ + elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR); + elm_app_compile_data_dir_set(PACKAGE_DATA_DIR); + elm_app_info_set(elm_main, "elementary", "images/logo.png"); + + /* if called with a single argument try to autorun a test with + * the same name as the given param + * ex: elementary_test "Box Vert 2" */ + if (argc == 2) + autorun = argv[1]; + else if (argc == 3) + { + /* Just a workaround to make the shot module more + * useful with elementary test. */ + if ((!strcmp(argv[1], "--test-win-only")) || + (!strcmp(argv[1], "-to"))) + { + test_win_only = EINA_TRUE; + autorun = argv[2]; + } + } + + /* put here any init specific to this app like parsing args etc. */ + my_win_main(autorun, test_win_only); /* create main window */ + elm_run(); /* and run the program now and handle all events etc. */ + /* if the mainloop that elm_run() runs exist - we exit the app */ + elm_shutdown(); /* clean up and shut down */ + /* exit code */ + return 0; +} +#endif +/* all elementary apps should use this. but it should be placed right after + * elm_main() */ +ELM_MAIN() diff --git a/libraries/elementary/src/bin/test.h b/libraries/elementary/src/bin/test.h new file mode 100644 index 0000000..0f0e6fe --- /dev/null +++ b/libraries/elementary/src/bin/test.h @@ -0,0 +1,19 @@ +#ifndef _TEST_H +#define _TEST_H + +#define fail_if(expr) \ + do { \ + if ( expr ) \ + { \ + FILE *fp; \ + char buf[1024]; \ + sprintf(buf, "fail_%s.txt", elm_win_title_get(win)); \ + if ((fp = fopen(buf, "a")) != NULL) \ + { \ + fprintf(fp, "Failed at %s:%d on <%s>\n", \ + __FILE__, __LINE__, #expr); \ + fclose(fp); \ + } \ + } \ + } while(0) +#endif diff --git a/libraries/elementary/src/bin/test_3d.c b/libraries/elementary/src/bin/test_3d.c new file mode 100644 index 0000000..6a960fb --- /dev/null +++ b/libraries/elementary/src/bin/test_3d.c @@ -0,0 +1,341 @@ +#include "test.h" +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +typedef struct _Point +{ + Evas_Coord x, y, z, u, v; +} Point; + +typedef struct _Side +{ + Evas_Object *o; + Point pt[4]; +} Side; + +typedef struct _Cube +{ + Side side[6]; +} Cube; + +static Cube *cube; +static double rotx = 0.0, roty = 0.0, rotz = 0.0; +static double cxo = 0.0, cyo = 0.0, focv = 256.0, z0v = 0.0; +#define POINT(n, p, xx, yy, zz, uu, vv) \ + c->side[n].pt[p].x = xx; \ + c->side[n].pt[p].y = yy; \ + c->side[n].pt[p].z = zz; \ + c->side[n].pt[p].u = uu; \ + c->side[n].pt[p].v = vv + +static Cube * +_cube_new(Evas *evas, Evas_Coord w, Evas_Coord h, Evas_Coord d) +{ + Cube *c; + int i; + + w -= (w / 2); + h -= (h / 2); + d -= (d / 2); + c = calloc(1, sizeof(Cube)); + for (i = 0; i < 6; i++) + { + Evas_Object *o; + char buf[PATH_MAX]; + o = evas_object_image_add(evas); + c->side[i].o = o; + snprintf(buf, sizeof(buf), "%s/images/%s", + elm_app_data_dir_get(), "twofish.jpg"); + evas_object_image_file_set(o, buf, NULL); + evas_object_image_fill_set(o, 0, 0, 256, 256); + evas_object_resize(o, 256, 256); + evas_object_image_smooth_scale_set(o, 0); + evas_object_show(o); + } + POINT(0, 0, -w, -h, -d, 0, 0); + POINT(0, 1, w, -h, -d, 256, 0); + POINT(0, 2, w, h, -d, 256, 256); + POINT(0, 3, -w, h, -d, 0, 256); + + POINT(1, 0, w, -h, -d, 0, 0); + POINT(1, 1, w, -h, d, 256, 0); + POINT(1, 2, w, h, d, 256, 256); + POINT(1, 3, w, h, -d, 0, 256); + + POINT(2, 0, w, -h, d, 0, 0); + POINT(2, 1, -w, -h, d, 256, 0); + POINT(2, 2, -w, h, d, 256, 256); + POINT(2, 3, w, h, d, 0, 256); + + POINT(3, 0, -w, -h, d, 0, 0); + POINT(3, 1, -w, -h, -d, 256, 0); + POINT(3, 2, -w, h, -d, 256, 256); + POINT(3, 3, -w, h, d, 0, 256); + + POINT(4, 0, -w, -h, d, 0, 0); + POINT(4, 1, w, -h, d, 256, 0); + POINT(4, 2, w, -h, -d, 256, 256); + POINT(4, 3, -w, -h, -d, 0, 256); + + POINT(5, 0, -w, h, -d, 0, 0); + POINT(5, 1, w, h, -d, 256, 0); + POINT(5, 2, w, h, d, 256, 256); + POINT(5, 3, -w, h, d, 0, 256); + + return c; +} + +static void +_cube_pos(Cube *c, + Evas_Coord x, Evas_Coord y, Evas_Coord z, + double dx, double dy, double dz, + Evas_Coord cx, Evas_Coord cy, Evas_Coord foc, Evas_Coord z0) +{ + Evas_Map *m; + int i, j, order[6], sorted; + Evas_Coord mz[6]; + + m = evas_map_new(4); + evas_map_smooth_set(m, 0); + + for (i = 0; i < 6; i++) + { + Evas_Coord tz[4]; + + for (j = 0; j < 4; j++) + { + evas_map_point_coord_set(m, j, + c->side[i].pt[j].x + x, + c->side[i].pt[j].y + y, + c->side[i].pt[j].z + z); + evas_map_point_image_uv_set(m, j, + c->side[i].pt[j].u, + c->side[i].pt[j].v); + evas_map_point_color_set(m, j, 255, 255, 255, 255); + } + evas_map_util_3d_rotate(m, dx, dy, dz, x, y, z); + evas_map_util_3d_lighting(m, -1000, -1000, -1000, + 255, 255, 255, + 20, 20, 20); + evas_map_util_3d_perspective(m, cx, cy, foc, z0); + if (evas_map_util_clockwise_get(m)) + { + evas_object_map_enable_set(c->side[i].o, 1); + evas_object_map_set(c->side[i].o, m); + evas_object_show(c->side[i].o); + } + else + evas_object_hide(c->side[i].o); + + order[i] = i; + for (j = 0; j < 4; j++) + evas_map_point_coord_get(m, j, NULL, NULL, &(tz[j])); + mz[i] = (tz[0] + tz[1] + tz[2] + tz[3]) / 4; + } + sorted = 0; + do + { + sorted = 1; + for (i = 0; i < 5; i++) + { + if (mz[order[i]] > mz[order[i + 1]]) + { + j = order[i]; + order[i] = order[i + 1]; + order[i + 1] = j; + sorted = 0; + } + } + } + while (!sorted); + + evas_object_raise(c->side[order[0]].o); + for (i = 1; i < 6; i++) + evas_object_stack_below(c->side[order[i]].o, c->side[order[i - 1]].o); + evas_map_free(m); +} + +/* +static void +_cube_free(Cube *c) +{ + int i; + + for (i = 0; i < 6; i++) evas_object_del(c->side[i].o); + free(c); +} +*/ + +static void +_cube_update(Evas_Object *win, Cube *c) +{ + Evas_Coord w, h; + + evas_object_geometry_get(win, NULL, NULL, &w, &h); + _cube_pos(c, + (w / 2), (h / 2), 512, + rotx, roty, rotz, + (w / 2) + cxo, (h / 2) + cyo, z0v, focv); +} + +void +_ch_rot_x(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + rotx = elm_slider_value_get(obj); + _cube_update(win, cube); +} + +void +_ch_rot_y(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + roty = elm_slider_value_get(obj); + _cube_update(win, cube); +} + +void +_ch_rot_z(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + rotz = elm_slider_value_get(obj); + _cube_update(win, cube); +} + +void +_ch_cx(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + cxo = elm_slider_value_get(obj); + _cube_update(win, cube); +} + +void +_ch_cy(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + cyo = elm_slider_value_get(obj); + _cube_update(win, cube); +} + +void +_ch_foc(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + focv = elm_slider_value_get(obj); + _cube_update(win, cube); +} + +void +_ch_z0(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + z0v = elm_slider_value_get(obj); + _cube_update(win, cube); +} + +void +test_3d(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *sl; + + win = elm_win_util_standard_add("box-vert", "Box Vert"); + elm_win_autodel_set(win, EINA_TRUE); + + cube = _cube_new(evas_object_evas_get(win), 240, 240, 240); + + bx = elm_box_add(win); + evas_object_layer_set(bx, 10); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + sl = elm_slider_add(win); + elm_object_text_set(sl, "Rot X"); + elm_slider_unit_format_set(sl, "%1.0f units"); + elm_slider_span_size_set(sl, 360); + elm_slider_min_max_set(sl, 0, 360); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sl); + evas_object_smart_callback_add(sl, "changed", _ch_rot_x, win); + evas_object_show(sl); + + sl = elm_slider_add(win); + elm_object_text_set(sl, "Rot Y"); + elm_slider_unit_format_set(sl, "%1.0f units"); + elm_slider_span_size_set(sl, 360); + elm_slider_min_max_set(sl, 0, 360); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sl); + evas_object_smart_callback_add(sl, "changed", _ch_rot_y, win); + evas_object_show(sl); + + sl = elm_slider_add(win); + elm_object_text_set(sl, "Rot Z"); + elm_slider_unit_format_set(sl, "%1.0f units"); + elm_slider_span_size_set(sl, 360); + elm_slider_min_max_set(sl, 0, 360); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sl); + evas_object_smart_callback_add(sl, "changed", _ch_rot_z, win); + evas_object_show(sl); + + sl = elm_slider_add(win); + elm_object_text_set(sl, "CX Off"); + elm_slider_unit_format_set(sl, "%1.0f units"); + elm_slider_span_size_set(sl, 360); + elm_slider_min_max_set(sl, -320, 320); + elm_slider_value_set(sl, cxo); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sl); + evas_object_smart_callback_add(sl, "changed", _ch_cx, win); + evas_object_show(sl); + + sl = elm_slider_add(win); + elm_object_text_set(sl, "CY Off"); + elm_slider_unit_format_set(sl, "%1.0f units"); + elm_slider_span_size_set(sl, 360); + elm_slider_min_max_set(sl, -320, 320); + elm_slider_value_set(sl, cyo); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sl); + evas_object_smart_callback_add(sl, "changed", _ch_cy, win); + evas_object_show(sl); + + sl = elm_slider_add(win); + elm_object_text_set(sl, "Foc"); + elm_slider_unit_format_set(sl, "%1.0f units"); + elm_slider_span_size_set(sl, 360); + elm_slider_min_max_set(sl, 1, 2000); + elm_slider_value_set(sl, focv); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sl); + evas_object_smart_callback_add(sl, "changed", _ch_foc, win); + evas_object_show(sl); + + sl = elm_slider_add(win); + elm_object_text_set(sl, "Z0"); + elm_slider_unit_format_set(sl, "%1.0f units"); + elm_slider_span_size_set(sl, 360); + elm_slider_min_max_set(sl, -2000, 2000); + elm_slider_value_set(sl, z0v); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sl); + evas_object_smart_callback_add(sl, "changed", _ch_z0, win); + evas_object_show(sl); + + evas_object_resize(win, 480, 480); + _cube_update(win, cube); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_actionslider.c b/libraries/elementary/src/bin/test_actionslider.c new file mode 100644 index 0000000..f3b6454 --- /dev/null +++ b/libraries/elementary/src/bin/test_actionslider.c @@ -0,0 +1,195 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static void _pos_selected_cb(void *data __UNUSED__, Evas_Object *obj, void *event_info) +{ + Elm_Actionslider_Pos ipos, mpos, epos; + + printf("Selection: %s\n", (char *)event_info); + printf("Label selected: %s\n", elm_actionslider_selected_label_get(obj)); + + ipos = elm_actionslider_indicator_pos_get(obj); + + switch (ipos) + { + case ELM_ACTIONSLIDER_NONE: + printf("actionslider indicator pos: none!\n"); + break; + case ELM_ACTIONSLIDER_LEFT: + printf("actionslider indicator pos: left!\n"); + break; + case ELM_ACTIONSLIDER_CENTER: + printf("actionslider indicator pos: center!\n"); + break; + case ELM_ACTIONSLIDER_RIGHT: + printf("actionslider indicator pos: right!\n"); + break; + case ELM_ACTIONSLIDER_ALL: + printf("actionslider indicator pos: all!\n"); + break; + } + + mpos = elm_actionslider_magnet_pos_get(obj); + + switch (mpos) + { + case ELM_ACTIONSLIDER_NONE: + printf("actionslider magnet pos: none!\n"); + break; + case ELM_ACTIONSLIDER_LEFT: + printf("actionslider magnet pos: left!\n"); + break; + case ELM_ACTIONSLIDER_CENTER: + printf("actionslider magnet pos: center!\n"); + break; + case ELM_ACTIONSLIDER_RIGHT: + printf("actionslider magnet pos: right!\n"); + break; + case ELM_ACTIONSLIDER_ALL: + printf("actionslider magnet pos: all!\n"); + break; + } + + epos = elm_actionslider_enabled_pos_get(obj); + + if (epos) + { + printf("actionslider enabled pos: "); + if (epos & ELM_ACTIONSLIDER_LEFT) + printf("left "); + if (epos & ELM_ACTIONSLIDER_CENTER) + printf("center "); + if (epos & ELM_ACTIONSLIDER_RIGHT) + printf("right "); + printf("\n"); + } +} + +static void +_position_change_magnetic_cb(void *data __UNUSED__, Evas_Object * obj, void *event_info) +{ + if (!strcmp((char *)event_info, "left")) + elm_actionslider_magnet_pos_set(obj, ELM_ACTIONSLIDER_LEFT); + else if (!strcmp((char *)event_info, "right")) + elm_actionslider_magnet_pos_set(obj, ELM_ACTIONSLIDER_RIGHT); +} + +static void +_magnet_enable_disable_cb(void *data __UNUSED__, Evas_Object *obj, void *event_info) +{ + if (!strcmp((char *)event_info, "left")) + elm_actionslider_magnet_pos_set(obj, ELM_ACTIONSLIDER_CENTER); + else if (!strcmp((char *)event_info, "right")) + elm_actionslider_magnet_pos_set(obj, ELM_ACTIONSLIDER_NONE); +} + +void +test_actionslider(void *data __UNUSED__, Evas_Object * obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *as; + + win = elm_win_util_standard_add("actionslider", "Actionslider"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + as = elm_actionslider_add(win); + evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0); + elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_RIGHT); + elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_RIGHT); + elm_object_part_text_set(as, "left", "Snooze"); + elm_object_part_text_set(as, "center", NULL); + elm_object_part_text_set(as, "right", "Stop"); + elm_actionslider_enabled_pos_set(as, ELM_ACTIONSLIDER_LEFT | + ELM_ACTIONSLIDER_RIGHT); + evas_object_smart_callback_add(as, "pos_changed", + _position_change_magnetic_cb, NULL); + evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL); + evas_object_show(as); + elm_box_pack_end(bx, as); + + as = elm_actionslider_add(win); + evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0); + elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_CENTER); + elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_CENTER); + elm_object_part_text_set(as, "left", "Snooze"); + elm_object_part_text_set(as, "center", NULL); + elm_object_part_text_set(as, "right", "Stop"); + elm_actionslider_enabled_pos_set(as, ELM_ACTIONSLIDER_LEFT | + ELM_ACTIONSLIDER_RIGHT); + evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL); + evas_object_show(as); + elm_box_pack_end(bx, as); + + as = elm_actionslider_add(win); + elm_object_style_set(as, "bar"); + evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0); + elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_LEFT); + elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_CENTER| + ELM_ACTIONSLIDER_RIGHT); + elm_actionslider_enabled_pos_set(as, ELM_ACTIONSLIDER_CENTER | + ELM_ACTIONSLIDER_RIGHT); + elm_object_part_text_set(as, "left", NULL); + elm_object_part_text_set(as, "center", "Accept"); + elm_object_part_text_set(as, "right", "Reject"); + evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL); + evas_object_show(as); + elm_box_pack_end(bx, as); + + as = elm_actionslider_add(win); + elm_object_style_set(as, "bar"); + evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0); + elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_LEFT); + elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_LEFT); + elm_object_part_text_set(as, "left", NULL); + elm_object_part_text_set(as, "center", "Accept"); + elm_object_part_text_set(as, "right", "Reject"); + elm_object_text_set(as, "Go"); + evas_object_smart_callback_add(as, "pos_changed", + _position_change_magnetic_cb, NULL); + evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL); + evas_object_show(as); + elm_box_pack_end(bx, as); + + + as = elm_actionslider_add(win); + evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0); + elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_LEFT); + elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_ALL); + elm_object_part_text_set(as, "left", "Left"); + elm_object_part_text_set(as, "center", "Center"); + elm_object_part_text_set(as, "right", "Right"); + elm_object_text_set(as, "Go"); + evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL); + evas_object_show(as); + elm_box_pack_end(bx, as); + + as = elm_actionslider_add(win); + evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0); + elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_CENTER); + elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_CENTER); + elm_object_part_text_set(as, "left", "Enable"); + elm_object_part_text_set(as, "center", "Magnet"); + elm_object_part_text_set(as, "right", "Disable"); + evas_object_smart_callback_add(as, "pos_changed", + _magnet_enable_disable_cb, NULL); + evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL); + evas_object_show(as); + elm_box_pack_end(bx, as); + + evas_object_resize(win, 320, 400); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_anim.c b/libraries/elementary/src/bin/test_anim.c new file mode 100644 index 0000000..92fbc17 --- /dev/null +++ b/libraries/elementary/src/bin/test_anim.c @@ -0,0 +1,113 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static const char *names[] = +{ + "bub1", "sh1", + "bub2", "sh2", + "bub3", "sh3", +}; + +static void +_del(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + Ecore_Animator *ani = evas_object_data_get(win, "animator"); + + ecore_animator_del(ani); +} + +static Eina_Bool +anim(void *data) +{ + Evas_Object *win = data; + Evas_Object *bub, *sh; + Evas_Coord x, y, w, h, vw, vh; + double t, xx, yy, zz, r, fac; + double lx, ly; + unsigned int i; + + evas_output_viewport_get(evas_object_evas_get(win), 0, 0, &vw, &vh); + r = 48; + t = ecore_loop_time_get(); + fac = 2.0 / (double)((sizeof(names) / sizeof(char *) / 2)); + evas_pointer_canvas_xy_get(evas_object_evas_get(win), &x, &y); + lx = x; + ly = y; + + for (i = 0; i < (sizeof(names) / sizeof(char *) / 2); i++) + { + bub = evas_object_data_get(win, names[i * 2]); + sh = evas_object_data_get(win, names[(i * 2) + 1]); + zz = (((2 + sin(t * 6 + (M_PI * (i * fac)))) / 3) * 64) * 2; + xx = (cos(t * 4 + (M_PI * (i * fac))) * r) * 2; + yy = (sin(t * 6 + (M_PI * (i * fac))) * r) * 2; + + w = zz; + h = zz; + x = (vw / 2) + xx - (w / 2); + y = (vh / 2) + yy - (h / 2); + + evas_object_move(bub, x, y); + evas_object_resize(bub, w, h); + + x = x - ((lx - (x + (w / 2))) / 4); + y = y - ((ly - (y + (h / 2))) / 4); + + evas_object_move(sh, x, y); + evas_object_resize(sh, w, h); + } + return ECORE_CALLBACK_RENEW; +} + +void +test_anim(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bg, *bub, *sh; + Ecore_Animator *ani; + char buf[PATH_MAX]; + unsigned int i; + + win = elm_win_add(NULL, "animation", ELM_WIN_BASIC); + elm_win_title_set(win, "Animation"); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + snprintf(buf, sizeof(buf), "%s/images/rock_01.jpg", elm_app_data_dir_get()); + elm_bg_file_set(bg, buf, NULL); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + snprintf(buf, sizeof(buf), "%s/images/bubble_sh.png", elm_app_data_dir_get()); + for (i = 0; i < (sizeof(names) / sizeof(char *) / 2); i++) + { + sh = evas_object_image_filled_add(evas_object_evas_get(win)); + evas_object_image_file_set(sh, buf, NULL); + evas_object_resize(sh, 64, 64); + evas_object_show(sh); + evas_object_data_set(win, names[(i * 2) + 1], sh); + } + + snprintf(buf, sizeof(buf), "%s/images/bubble.png", elm_app_data_dir_get()); + for (i = 0; i < (sizeof(names) / sizeof(char *) / 2); i++) + { + bub = evas_object_image_filled_add(evas_object_evas_get(win)); + evas_object_image_file_set(bub, buf, NULL); + evas_object_resize(bub, 64, 64); + evas_object_show(bub); + evas_object_data_set(win, names[(i * 2)], bub); + } + + evas_object_resize(win, 480, 800); + evas_object_show(win); + + ani = ecore_animator_add(anim, win); + evas_object_data_set(win, "animator", ani); + + evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, _del, win); +} +#endif diff --git a/libraries/elementary/src/bin/test_bg.c b/libraries/elementary/src/bin/test_bg.c new file mode 100644 index 0000000..d0a3829 --- /dev/null +++ b/libraries/elementary/src/bin/test_bg.c @@ -0,0 +1,270 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static void +_cb_size_radio_changed(void *data, Evas_Object *obj, void *event __UNUSED__) +{ + Evas_Object *o_bg = data; + int size; + size = elm_radio_value_get((Evas_Object *)obj); + elm_bg_load_size_set(o_bg, size, size); +} + +static void +_cb_radio_changed(void *data, Evas_Object *obj, void *event __UNUSED__) +{ + Evas_Object *o_bg = data; + + elm_bg_option_set(o_bg, elm_radio_value_get((Evas_Object *)obj)); +} + +static void +_cb_overlay_changed(void *data, Evas_Object *obj, void *event __UNUSED__) +{ + Evas_Object *o_bg = data; + + if (elm_check_state_get(obj)) + { + Evas_Object *parent, *over; + char buff[PATH_MAX]; + + snprintf(buff, sizeof(buff), "%s/objects/test.edj", elm_app_data_dir_get()); + parent = elm_object_parent_widget_get(o_bg); + over = edje_object_add(evas_object_evas_get(parent)); + edje_object_file_set(over, buff, "bg_overlay"); + elm_object_part_content_set(o_bg, "overlay", over); + } + else + elm_object_part_content_set(o_bg, "overlay", NULL); +} + +static void +_cb_color_changed(void *data, Evas_Object *obj, void *event __UNUSED__) +{ + Evas_Object *o_bg = data; + double val = 0.0; + + val = elm_spinner_value_get(obj); + if (val == 1.0) + elm_bg_color_set(o_bg, 255, 255, 255); + else if (val == 2.0) + elm_bg_color_set(o_bg, 255, 0, 0); + else if (val == 3.0) + elm_bg_color_set(o_bg, 0, 0, 255); + else if (val == 4.0) + elm_bg_color_set(o_bg, 0, 255, 0); +} + +void +test_bg_plain(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bg; + + win = elm_win_add(NULL, "bg-plain", ELM_WIN_BASIC); + elm_win_title_set(win, "Bg Plain"); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + /* allow bg to expand in x & y */ + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + /* set size hints. a minimum size for the bg. this should propagate back + * to the window thus limiting its size based off the bg as the bg is one + * of the window's resize objects. */ + evas_object_size_hint_min_set(bg, 160, 160); + /* and set a maximum size. not needed very often. normally used together + * with evas_object_size_hint_min_set() at the same size to make a + * window not resizable */ + evas_object_size_hint_max_set(bg, 640, 640); + /* and now just resize the window to a size you want. normally widgets + * will determine the initial size though */ + evas_object_resize(win, 320, 320); + /* and show the window */ + evas_object_show(win); +} + +void +test_bg_image(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bg; + Evas_Object *box, *hbox, *o_bg; + Evas_Object *rd, *rdg; + char buf[PATH_MAX]; + + win = elm_win_add(NULL, "bg-image", ELM_WIN_BASIC); + elm_win_title_set(win, "Bg Image"); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + box = elm_box_add(win); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, box); + evas_object_show(box); + + o_bg = elm_bg_add(win); + snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); + elm_bg_file_set(o_bg, buf, NULL); + evas_object_size_hint_weight_set(o_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(o_bg, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, o_bg); + + hbox = elm_box_add(win); + elm_box_horizontal_set(hbox, EINA_TRUE); + evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL); + + rd = elm_radio_add(win); + elm_radio_state_value_set(rd, 50); + elm_object_text_set(rd, "50 x 50"); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_smart_callback_add(rd, "changed", _cb_size_radio_changed, o_bg); + elm_box_pack_end(hbox, rd); + evas_object_show(rd); + rdg = rd; + + rd = elm_radio_add(win); + elm_radio_state_value_set(rd, 100); + elm_radio_group_add(rd, rdg); + elm_object_text_set(rd, "100 x 100"); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_smart_callback_add(rd, "changed", _cb_size_radio_changed, o_bg); + elm_box_pack_end(hbox, rd); + evas_object_show(rd); + + rd = elm_radio_add(win); + elm_radio_state_value_set(rd, 200); + elm_radio_group_add(rd, rdg); + elm_object_text_set(rd, "200 x 200"); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_smart_callback_add(rd, "changed", _cb_size_radio_changed, o_bg); + elm_box_pack_end(hbox, rd); + evas_object_show(rd); + + elm_radio_value_set(rdg, 200); + + elm_box_pack_end(box, hbox); + evas_object_show(hbox); + + evas_object_show(o_bg); + evas_object_size_hint_min_set(bg, 160, 160); + evas_object_size_hint_max_set(bg, 640, 640); + evas_object_resize(win, 320, 320); + evas_object_show(win); +} + +void +test_bg_options(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bg; + Evas_Object *box, *hbox, *o_bg; + Evas_Object *rd, *rdg; + char buf[PATH_MAX]; + + win = elm_win_add(NULL, "bg-options", ELM_WIN_BASIC); + elm_win_title_set(win, "Bg Options"); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + box = elm_box_add(win); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, box); + evas_object_show(box); + + o_bg = elm_bg_add(win); + snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); + elm_bg_file_set(o_bg, buf, NULL); + evas_object_size_hint_weight_set(o_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(o_bg, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, o_bg); + evas_object_show(o_bg); + + hbox = elm_box_add(win); + elm_box_horizontal_set(hbox, EINA_TRUE); + evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL); + + rd = elm_radio_add(win); + elm_radio_state_value_set(rd, ELM_BG_OPTION_CENTER); + elm_object_text_set(rd, "Center"); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg); + elm_box_pack_end(hbox, rd); + evas_object_show(rd); + rdg = rd; + + rd = elm_radio_add(win); + elm_radio_state_value_set(rd, ELM_BG_OPTION_SCALE); + elm_radio_group_add(rd, rdg); + elm_object_text_set(rd, "Scale"); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg); + elm_box_pack_end(hbox, rd); + evas_object_show(rd); + + rd = elm_radio_add(win); + elm_radio_state_value_set(rd, ELM_BG_OPTION_STRETCH); + elm_radio_group_add(rd, rdg); + elm_object_text_set(rd, "Stretch"); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg); + elm_box_pack_end(hbox, rd); + evas_object_show(rd); + + rd = elm_radio_add(win); + elm_radio_state_value_set(rd, ELM_BG_OPTION_TILE); + elm_radio_group_add(rd, rdg); + elm_object_text_set(rd, "Tile"); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg); + elm_box_pack_end(hbox, rd); + evas_object_show(rd); + + elm_radio_value_set(rdg, ELM_BG_OPTION_SCALE); + + rd = elm_check_add(win); + elm_object_text_set(rd, "Show Overlay"); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_smart_callback_add(rd, "changed", _cb_overlay_changed, o_bg); + elm_box_pack_end(hbox, rd); + evas_object_show(rd); + + /* color choices ... this is ghetto, but we don't have a 'colorpicker' + * widget yet :( */ + rd = elm_spinner_add(win); + elm_object_style_set(rd, "vertical"); + elm_spinner_min_max_set(rd, 1, 4); + elm_spinner_label_format_set(rd, "%.0f"); + elm_spinner_editable_set(rd, EINA_FALSE); + elm_spinner_special_value_add(rd, 1, "White"); + elm_spinner_special_value_add(rd, 2, "Red"); + elm_spinner_special_value_add(rd, 3, "Blue"); + elm_spinner_special_value_add(rd, 4, "Green"); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_smart_callback_add(rd, "changed", _cb_color_changed, o_bg); + elm_box_pack_end(hbox, rd); + evas_object_show(rd); + + elm_box_pack_end(box, hbox); + evas_object_show(hbox); + + evas_object_size_hint_min_set(bg, 160, 160); + evas_object_size_hint_max_set(bg, 640, 640); + evas_object_resize(win, 320, 320); + evas_object_show(win); +} + +#endif diff --git a/libraries/elementary/src/bin/test_box.c b/libraries/elementary/src/bin/test_box.c new file mode 100644 index 0000000..1b191f9 --- /dev/null +++ b/libraries/elementary/src/bin/test_box.c @@ -0,0 +1,706 @@ +#include "test.h" +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +#define ICON_MAX 24 + +typedef enum +{ + BOX_PACK_POSITION_START, + BOX_PACK_POSITION_BEFORE, + BOX_PACK_POSITION_AFTER, + BOX_PACK_POSITION_END +} Box_Pack_Position; + +struct _api_data +{ + unsigned int state; /* What state we are testing */ + void *box; /* Use this to get box content */ +}; +typedef struct _api_data api_data; + +enum _api_state +{ + BOX_PACK_START, + BOX_PACK_BEFORE, + BOX_PACK_AFTER, + BOX_PADDING_SET, + BOX_ALIGN_SET, + BOX_HOMOGENEOUS_SET, + BOX_UNPACK_ALL, + BOX_CLEAR, + API_STATE_LAST +}; +typedef enum _api_state api_state; + +static void +set_api_state(api_data *api) +{ + const Eina_List *items = elm_box_children_get(api->box); + if (!eina_list_count(items)) + return; + + /* use elm_box_children_get() to get list of children */ + switch(api->state) + { /* Put all api-changes under switch */ + case BOX_PACK_START: /* Move last item to begining */ + elm_box_unpack(api->box, eina_list_data_get(eina_list_last(items))); + elm_box_pack_start(api->box, eina_list_data_get(eina_list_last(items))); + break; + + case BOX_PACK_BEFORE: + if (eina_list_count(items) > 1) + { /* Put last item before the one preceeding it */ + elm_box_unpack(api->box, eina_list_data_get(eina_list_last(items))); + elm_box_pack_before(api->box, + eina_list_data_get(eina_list_last(items)), + eina_list_nth(items, eina_list_count(items)-2)); + } + break; + + case BOX_PACK_AFTER: + if (eina_list_count(items) > 1) + { /* Put item before last to last */ + elm_box_unpack(api->box, eina_list_nth(items, + eina_list_count(items)-2)); + elm_box_pack_after(api->box, + eina_list_nth(items, eina_list_count(items)-2), + eina_list_data_get(eina_list_last(items))); + } + break; + + case BOX_PADDING_SET: + elm_box_padding_set(api->box, 30, 15); + break; + + case BOX_ALIGN_SET: + elm_box_align_set(api->box, 0.25, 0.75); + break; + + case BOX_HOMOGENEOUS_SET: + elm_box_homogeneous_set(api->box, EINA_TRUE); + break; + + case BOX_UNPACK_ALL: + { + Eina_List *l; + Evas_Object *data; + elm_box_unpack_all(api->box); + EINA_LIST_REVERSE_FOREACH(items, l, data) + elm_box_pack_end(api->box, data); + } + break; + + case BOX_CLEAR: + elm_box_clear(api->box); + break; + + case API_STATE_LAST: + + break; + default: + return; + } +} + +static void +_api_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ /* Will add here a SWITCH command containing code to modify test-object */ + /* in accordance a->state value. */ + api_data *a = data; + char str[128]; + + printf("clicked event on API Button: api_state=<%d>\n", a->state); + set_api_state(a); + a->state++; + sprintf(str, "Next API function (%u)", a->state); + elm_object_text_set(obj, str); + elm_object_disabled_set(obj, a->state == API_STATE_LAST); +} + +static void +_cleanup_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + free(data); +} + +void +test_box_vert(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *ic, *bxx, *bt; + char buf[PATH_MAX]; + api_data *api = calloc(1, sizeof(api_data)); + + win = elm_win_util_standard_add("box-vert", "Box Vert"); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api); + + bxx = elm_box_add(win); + elm_win_resize_object_add(win, bxx); + evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bxx); + + bx = elm_box_add(win); + api->box = bx; + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Next API function"); + evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api); + elm_box_pack_end(bxx, bt); + elm_object_disabled_set(bt, api->state == API_STATE_LAST); + evas_object_show(bt); + + elm_box_pack_end(bxx, bx); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/icon_01.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_size_hint_align_set(ic, 0.5, 0.5); + elm_box_pack_end(bx, ic); + evas_object_show(ic); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/icon_02.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_size_hint_align_set(ic, 0.0, 0.5); + elm_box_pack_end(bx, ic); + evas_object_show(ic); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/icon_03.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_size_hint_align_set(ic, EVAS_HINT_EXPAND, 0.5); + elm_box_pack_end(bx, ic); + evas_object_show(ic); + + evas_object_show(win); +} + +static void +_del_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + elm_box_unpack(data, obj); + evas_object_move(obj, 0, 0); + evas_object_color_set(obj, 128, 64, 0, 128); +// evas_object_del(obj); +} + +void +test_box_vert2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *bt; + + win = elm_win_util_standard_add("box-vert2", "Box Vert 2"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + elm_win_resize_object_add(win, bx); + elm_box_padding_set(bx, 10, 10); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 1"); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + evas_object_smart_callback_add(bt, "clicked", _del_cb, bx); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 2"); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + evas_object_smart_callback_add(bt, "clicked", _del_cb, bx); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 3"); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + evas_object_smart_callback_add(bt, "clicked", _del_cb, bx); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 4"); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + evas_object_smart_callback_add(bt, "clicked", _del_cb, bx); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 5"); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + evas_object_smart_callback_add(bt, "clicked", _del_cb, bx); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + evas_object_show(win); +} + +void +test_box_horiz(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *ic, *bxx, *bt; + char buf[PATH_MAX]; + api_data *api = calloc(1, sizeof(api_data)); + + win = elm_win_util_standard_add("box-horiz", "Box Horiz"); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api); + + bxx = elm_box_add(win); + elm_win_resize_object_add(win, bxx); + evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bxx); + + bx = elm_box_add(win); + elm_box_horizontal_set(bx, EINA_TRUE); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + api->box = bx; + evas_object_show(bx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Next API function"); + evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api); + elm_box_pack_end(bxx, bt); + elm_object_disabled_set(bt, api->state == API_STATE_LAST); + evas_object_show(bt); + + elm_box_pack_end(bxx, bx); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/icon_01.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_size_hint_align_set(ic, 0.5, 0.5); + elm_box_pack_end(bx, ic); + evas_object_show(ic); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/icon_02.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_size_hint_align_set(ic, 0.5, 0.0); + elm_box_pack_end(bx, ic); + evas_object_show(ic); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/icon_03.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_size_hint_align_set(ic, 0.0, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, ic); + evas_object_show(ic); + + evas_object_show(win); +} + +static Eina_Bool radio_index[ICON_MAX]; + +static int +_index_get(void) +{ + int i; + for (i = 0; i < ICON_MAX; i++) + { + if (!radio_index[i]) + { + radio_index[i] = EINA_TRUE; + return i; + } + + } + return -1; +} + +static void +_index_remove(int i) +{ + if (i >= ICON_MAX) return; + radio_index[i] = EINA_FALSE; +} + +static void +_index_clear() +{ + int i; + for (i = 0; i < ICON_MAX; i++) + radio_index[i] = EINA_FALSE; +} + +static Evas_Object * +_radio_new(Evas_Object *obj) +{ + Evas_Object *ic, *rd; + int idx; + char buf[PATH_MAX]; + Evas_Object *rdg; + + idx = _index_get(); + if (idx == -1) return NULL; + + ic = elm_icon_add(obj); + snprintf(buf, sizeof(buf), "%s/images/icon_%02d.png", + elm_app_data_dir_get(), idx); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + + rd = elm_radio_add(obj); + elm_radio_state_value_set(rd, idx); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, 0.5); + elm_object_part_content_set(rd, "icon", ic); + + rdg = evas_object_data_get(obj, "radio-group"); + if (rdg) elm_radio_group_add(rd, rdg); + + evas_object_show(rd); + evas_object_show(ic); + + return rd; +} + +static void +_pack_start_btn_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *rd; + if (!data) return; + + rd = _radio_new(data); + if (!rd) return; + elm_box_pack_start(data, rd); +} + +static void +_pack_before_btn_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *rd, *selected_rd, *rdg; + if (!data) return; + + rdg = evas_object_data_get(data, "radio-group"); + if (!rdg) return; + + selected_rd = elm_radio_selected_object_get(rdg); + if (!selected_rd || (selected_rd == rdg)) return; + + rd = _radio_new(data); + if (!rd) return; + elm_box_pack_before(data, rd, selected_rd); +} + +static void +_pack_after_btn_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *rd, *selected_rd, *rdg; + if (!data) return; + + rdg = evas_object_data_get(data, "radio-group"); + if (!rdg) return; + + selected_rd = elm_radio_selected_object_get(rdg); + if (!selected_rd || (selected_rd == rdg)) return; + + rd = _radio_new(data); + if (!rd) return; + elm_box_pack_after(data, rd, selected_rd); +} + +static void +_pack_end_btn_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *rd; + if (!data) return; + + rd = _radio_new(data); + if (!rd) return; + elm_box_pack_end(data, rd); +} + +static void +_unpack_btn_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *rdg, *selected_rd; + if (!data) return; + + rdg = evas_object_data_get(data, "radio-group"); + if (!rdg) return; + + selected_rd = elm_radio_selected_object_get(rdg); + if (selected_rd == rdg) return; + + _index_remove(elm_radio_value_get(selected_rd)); + elm_box_unpack(data, selected_rd); + evas_object_del(selected_rd); + elm_radio_value_set(rdg, -1); +} + +static void +_unpack_all_btn_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *radio, *rdg; + Eina_List *rl, *l; + if (!data) return; + + rdg = evas_object_data_get(data, "radio-group"); + if (!rdg) return; + + _index_clear(); + rl = elm_box_children_get(data); + EINA_LIST_FOREACH(rl, l, radio) + { + if (radio != rdg) + evas_object_del(radio); + } + elm_box_unpack_all(data); + elm_radio_value_set(rdg, -1); +} + +void +test_box_pack(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *sc, *bt; + Evas_Object *box, *lbox, *rbox; + Evas_Object *rd, *rdg = NULL; + int i; + + win = elm_win_util_standard_add("box-pack", "Box Pack"); + elm_win_autodel_set(win, EINA_TRUE); + + box = elm_box_add(win); + elm_box_horizontal_set(box, EINA_TRUE); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, box); + evas_object_show(box); + + // left side + lbox = elm_box_add(win); + evas_object_size_hint_weight_set(lbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(lbox, EVAS_HINT_FILL, EVAS_HINT_FILL); + + sc = elm_scroller_add(win); + elm_scroller_bounce_set(sc, EINA_FALSE, EINA_TRUE); + evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL); + + rdg = elm_radio_add(win); /* a radio for easy group handling */ + elm_radio_state_value_set(rdg, -1); + evas_object_data_set(lbox, "radio-group", rdg); + + for (i = 0; i < 3; i++) + { + rd = _radio_new(lbox); + elm_box_pack_end(lbox, rd); + } + + elm_object_content_set(sc, lbox); + evas_object_show(lbox); + elm_box_pack_end(box, sc); + evas_object_show(sc); + + // right side + rbox = elm_box_add(win); + evas_object_size_hint_weight_set(rbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(rbox, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(rbox); + elm_box_pack_end(box, rbox); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Pack Start"); + evas_object_show(bt); + elm_box_pack_end(rbox, bt); + evas_object_smart_callback_add(bt, "clicked", _pack_start_btn_cb, lbox); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Pack Before"); + evas_object_show(bt); + elm_box_pack_end(rbox, bt); + evas_object_smart_callback_add(bt, "clicked", _pack_before_btn_cb, lbox); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Pack After"); + evas_object_show(bt); + elm_box_pack_end(rbox, bt); + evas_object_smart_callback_add(bt, "clicked", _pack_after_btn_cb, lbox); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Pack End"); + evas_object_show(bt); + elm_box_pack_end(rbox, bt); + evas_object_smart_callback_add(bt, "clicked", _pack_end_btn_cb, lbox); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Unpack"); + evas_object_show(bt); + elm_box_pack_end(rbox, bt); + evas_object_smart_callback_add(bt, "clicked", _unpack_btn_cb, lbox); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Unpack All"); + evas_object_show(bt); + elm_box_pack_end(rbox, bt); + evas_object_smart_callback_add(bt, "clicked", _unpack_all_btn_cb, lbox); + + evas_object_resize(win, 320, 320); + evas_object_show(win); +} + +static void +_cb_check_changed(void *data, Evas_Object *obj, void *event __UNUSED__) +{ + Eina_Bool homo; + Evas_Object *box = data; + + homo = elm_check_state_get(obj); + elm_box_homogeneous_set(box, homo); +} + +void +test_box_homo(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win; + Evas_Object *box, *o_bg; + Evas_Object *rd; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("box-homogeneous", "Box Homogeneous"); + elm_win_autodel_set(win, EINA_TRUE); + + box = elm_box_add(win); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, box); + evas_object_show(box); + + o_bg = elm_bg_add(win); + snprintf(buf, sizeof(buf), "%s/images/twofish.jpg", elm_app_data_dir_get()); + elm_bg_file_set(o_bg, buf, NULL); + evas_object_size_hint_weight_set(o_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(o_bg, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, o_bg); + + rd = elm_check_add(win); + elm_object_text_set(rd, "Homogeneous"); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_smart_callback_add(rd, "changed", _cb_check_changed, box); + elm_box_pack_end(box, rd); + evas_object_show(rd); + evas_object_show(o_bg); + + evas_object_resize(win, 320, 320); + evas_object_show(win); +} + +typedef struct +{ + Eina_List *transitions; + Evas_Object *box; + Evas_Object_Box_Layout last_layout; +} Transitions_Data; + +static void +_test_box_transition_change(void *data) +{ + Transitions_Data *tdata = data; + Elm_Box_Transition *layout_data; + Evas_Object_Box_Layout next_layout; + + if (!data) return; + next_layout = eina_list_data_get(tdata->transitions); + layout_data = elm_box_transition_new(2.0, tdata->last_layout, + NULL, NULL, next_layout, NULL, NULL, + _test_box_transition_change, tdata); + elm_box_layout_set(tdata->box, elm_box_layout_transition, layout_data, elm_box_transition_free); + tdata->last_layout = next_layout; + + tdata->transitions = eina_list_demote_list(tdata->transitions, tdata->transitions); +} + +static void +_win_del(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Transitions_Data *tdata = data; + if (!data) return; + free(tdata); +} + +void +test_box_transition(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *bt; + Transitions_Data *tdata; + + win = elm_win_util_standard_add("box-transition", "Box Transition"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + elm_win_resize_object_add(win, bx); + evas_object_size_hint_weight_set(bx, 1.0, 1.0); + evas_object_show(bx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 1"); + evas_object_size_hint_weight_set(bt, 1.0, 1.0); + evas_object_size_hint_align_set(bt, -1.0, -1.0); + evas_object_smart_callback_add(bt, "clicked", _del_cb, bx); + elm_box_pack_end(bx, bt); + evas_object_resize(bt, 100, 100); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 2"); + evas_object_size_hint_weight_set(bt, 1.0, 1.0); + evas_object_size_hint_align_set(bt, -1.0, -1.0); + evas_object_smart_callback_add(bt, "clicked", _del_cb, bx); + elm_box_pack_end(bx, bt); + evas_object_resize(bt, 100, 100); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 3"); + evas_object_size_hint_weight_set(bt, 1.0, 1.0); + evas_object_size_hint_align_set(bt, -1.0, -1.0); + evas_object_smart_callback_add(bt, "clicked", _del_cb, bx); + elm_box_pack_end(bx, bt); + evas_object_resize(bt, 100, 100); + evas_object_show(bt); + + tdata = calloc(1, sizeof(Transitions_Data)); + tdata->box = bx; + tdata->last_layout = evas_object_box_layout_horizontal; + tdata->transitions = eina_list_append(tdata->transitions, + evas_object_box_layout_vertical); + tdata->transitions = eina_list_append(tdata->transitions, + evas_object_box_layout_horizontal); + tdata->transitions = eina_list_append(tdata->transitions, + evas_object_box_layout_stack); + tdata->transitions = eina_list_append(tdata->transitions, + evas_object_box_layout_homogeneous_vertical); + tdata->transitions = eina_list_append(tdata->transitions, + evas_object_box_layout_homogeneous_horizontal); + tdata->transitions = eina_list_append(tdata->transitions, + evas_object_box_layout_flow_vertical); + tdata->transitions = eina_list_append(tdata->transitions, + evas_object_box_layout_flow_horizontal); + tdata->transitions = eina_list_append(tdata->transitions, + evas_object_box_layout_stack); + + evas_object_resize(win, 300, 300); + evas_object_resize(bx, 300, 300); + evas_object_smart_callback_add(win, "delete,request", _win_del, tdata); + evas_object_show(win); + elm_box_layout_set(bx, evas_object_box_layout_horizontal, NULL, NULL); + _test_box_transition_change(tdata); +} +#endif diff --git a/libraries/elementary/src/bin/test_bubble.c b/libraries/elementary/src/bin/test_bubble.c new file mode 100644 index 0000000..01b5ad6 --- /dev/null +++ b/libraries/elementary/src/bin/test_bubble.c @@ -0,0 +1,176 @@ +#include "test.h" +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static void +_print_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("bubble clicked\n"); +} + +struct _api_data +{ + unsigned int state; /* What state we are testing */ + Evas_Object *win; /* Parent Window of widgets */ + void *box; /* Use this to get box content */ +}; +typedef struct _api_data api_data; + +enum _api_state +{ + BUBBLE_SET_CORNER_1, + BUBBLE_SET_CORNER_2, + BUBBLE_SET_ICON_CONTENT, + API_STATE_LAST +}; +typedef enum _api_state api_state; + +static void +set_api_state(api_data *api) +{ + const Eina_List *items = elm_box_children_get(api->box); + if (!eina_list_count(items)) + return; + + switch(api->state) + { /* Put all api-changes under switch */ + case BUBBLE_SET_CORNER_1: + elm_bubble_pos_set(eina_list_nth(items, 0), ELM_BUBBLE_POS_BOTTOM_LEFT); + elm_object_text_set(elm_object_content_get(eina_list_nth(items, 0)), + "Corner: base (bottom-left) - with icon"); + elm_bubble_pos_set(eina_list_nth(items, 1), ELM_BUBBLE_POS_TOP_RIGHT); + elm_object_text_set(elm_object_content_get(eina_list_nth(items, 1)), + "Corner: base (top-right) - no icon"); + break; + + case BUBBLE_SET_CORNER_2: + elm_bubble_pos_set(eina_list_nth(items, 0), ELM_BUBBLE_POS_TOP_RIGHT); + elm_object_text_set(elm_object_content_get(eina_list_nth(items, 0)), + "Corner: base (top-right) - with icon"); + elm_bubble_pos_set(eina_list_nth(items, 1), ELM_BUBBLE_POS_BOTTOM_LEFT); + elm_object_text_set(elm_object_content_get(eina_list_nth(items, 1)), + "Corner: base (bottom-left) - no icon"); + break; + + case BUBBLE_SET_ICON_CONTENT: + { + char buf[PATH_MAX]; + Evas_Object *ct, *ic = elm_icon_add(api->win); + + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + elm_object_content_set(eina_list_nth(items, 0), ic); + ct = elm_label_add(api->win); + elm_object_text_set(ct, "Using icon as top-bubble content"); + elm_object_content_set(eina_list_nth(items, 1), ct); + evas_object_size_hint_align_set(ic, 0.5, 0.5); + evas_object_show(ic); + } + break; + + case API_STATE_LAST: + + break; + default: + return; + } +} + +static void +_api_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ /* Will add here a SWITCH command containing code to modify test-object */ + /* in accordance a->state value. */ + api_data *a = data; + char str[128]; + + printf("clicked event on API Button: api_state=<%d>\n", a->state); + set_api_state(a); + a->state++; + sprintf(str, "Next API function (%u)", a->state); + elm_object_text_set(obj, str); + elm_object_disabled_set(obj, a->state == API_STATE_LAST); +} + +static void +_cleanup_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + free(data); +} + + +void +test_bubble(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *ic, *bb, *ct, *bxx, *bt; + char buf[PATH_MAX]; + api_data *api = calloc(1, sizeof(api_data)); + + win = elm_win_util_standard_add("bubble", "Bubble"); + api->win = win; + elm_win_autodel_set(win, EINA_TRUE); + evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api); + + bxx = elm_box_add(win); + elm_win_resize_object_add(win, bxx); + evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bxx); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + api->box = bx; + evas_object_show(bx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Next API function"); + evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api); + elm_box_pack_end(bxx, bt); + elm_object_disabled_set(bt, api->state == API_STATE_LAST); + evas_object_show(bt); + + elm_box_pack_end(bxx, bx); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1); + + bb = elm_bubble_add(win); + elm_object_text_set(bb, "Message 1"); + elm_object_part_text_set(bb, "info", "Corner: bottom_right"); + elm_object_part_content_set(bb, "icon", ic); + elm_bubble_pos_set(bb, ELM_BUBBLE_POS_BOTTOM_RIGHT); + evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL); + evas_object_show(ic); + evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL); + + ct = elm_label_add(win); + elm_object_text_set(ct, + "\"The future of the art: R or G or B?\", by Rusty"); + elm_object_content_set(bb, ct); + + elm_box_pack_end(bx, bb); + evas_object_show(bb); + + bb = elm_bubble_add(win); + elm_object_text_set(bb, "Message 2"); + elm_object_part_text_set(bb, "info", "10:32 4/11/2008"); + evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL); + evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL); + + ct = elm_label_add(win); + elm_object_text_set(ct, "Corner: base (top-left) - no icon"); + elm_object_content_set(bb, ct); + + elm_box_pack_end(bx, bb); + evas_object_show(bb); + + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_button.c b/libraries/elementary/src/bin/test_button.c new file mode 100644 index 0000000..be5d655 --- /dev/null +++ b/libraries/elementary/src/bin/test_button.c @@ -0,0 +1,169 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +static void +_bt_repeated(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + static int count; + char buf[16]; + + snprintf(buf, sizeof(buf), "count=%d", count++); + if (count >= 10000) + count = 0; + elm_object_text_set(obj, buf); +} + +static void +_bt_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + int param = (int)(long)(data); + + printf("clicked event on Button:%d\n", param); +} + +static void +_bt_unpressed(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + int param = (int)(long)(data); + + printf("unpressed event on Button:%d\n", param); +} + +void +test_button(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *scr, *bx, *ic, *bt; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("buttons", "Buttons"); + elm_win_autodel_set(win, EINA_TRUE); + + scr = elm_scroller_add(win); + elm_scroller_bounce_set(scr, EINA_FALSE, EINA_TRUE); + elm_scroller_policy_set(scr, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); + elm_win_resize_object_add(win, scr); + evas_object_show(scr); + evas_object_size_hint_weight_set(scr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_content_set(scr, bx); + evas_object_show(bx); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + bt = elm_button_add(win); + elm_object_text_set(bt, "Icon sized to button"); + elm_object_part_content_set(bt, "icon", ic); + evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)1); + evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)1); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + evas_object_show(ic); + + ic = elm_icon_add(bx); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + bt = elm_button_add(win); + elm_object_text_set(bt, "Icon no scale"); + elm_object_part_content_set(bt, "icon", ic); + evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)2); + evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)2); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + evas_object_show(ic); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + bt = elm_button_add(win); + elm_object_text_set(bt, "Disabled Button"); + elm_object_part_content_set(bt, "icon", ic); + elm_object_disabled_set(bt, EINA_TRUE); + evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)3); + evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)3); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + evas_object_show(ic); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + bt = elm_button_add(win); + elm_object_part_content_set(bt, "icon", ic); + elm_object_disabled_set(bt, EINA_TRUE); + evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)4); + evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)4); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + evas_object_show(ic); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Label Only"); + evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)5); + evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)5); + elm_box_pack_end(bx, bt); + evas_object_smart_callback_add(bt, "repeated", _bt_repeated, NULL); + elm_button_autorepeat_set(bt, EINA_TRUE); + elm_button_autorepeat_initial_timeout_set(bt, 2.0); + elm_button_autorepeat_gap_timeout_set(bt, 0.5); + evas_object_show(bt); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + bt = elm_button_add(win); + elm_object_part_content_set(bt, "icon", ic); + evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)6); + evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)6); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + evas_object_show(ic); + + bt = elm_button_add(win); + elm_object_style_set(bt, "anchor"); + elm_object_text_set(bt, "Anchor style"); + evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)7); + evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)7); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + bt = elm_button_add(win); + elm_object_style_set(bt, "anchor"); + elm_object_part_content_set(bt, "icon", ic); + evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)8); + evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)8); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + evas_object_show(ic); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + bt = elm_button_add(win); + elm_object_access_info_set(bt, "This is some custom text describing this widget"); + elm_object_style_set(bt, "anchor"); + elm_object_part_content_set(bt, "icon", ic); + elm_object_disabled_set(bt, EINA_TRUE); + evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)9); + evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)9); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + evas_object_show(ic); + evas_object_resize(win, 320, 480); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_calendar.c b/libraries/elementary/src/bin/test_calendar.c new file mode 100644 index 0000000..153cf7e --- /dev/null +++ b/libraries/elementary/src/bin/test_calendar.c @@ -0,0 +1,337 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +struct _api_data +{ + unsigned int state; /* What state we are testing */ + void *box; /* box used in set_api_state */ +}; +typedef struct _api_data api_data; + +enum _api_state +{ + STATE_MARK_MONTHLY, + STATE_MARK_WEEKLY, + STATE_SUNDAY_HIGHLIGHT, + STATE_SELECT_DATE_DISABLED_WITH_MARKS, + STATE_SELECT_DATE_DISABLED_NO_MARKS, + API_STATE_LAST +}; +typedef enum _api_state api_state; + +static void +set_api_state(api_data *api) +{ + const Eina_List *items = elm_box_children_get(api->box); + static Elm_Calendar_Mark *m = NULL; + if (!eina_list_count(items)) + return; + + switch(api->state) + { /* Put all api-changes under switch */ + case STATE_MARK_MONTHLY: + { + Evas_Object *cal = eina_list_nth(items, 0); + time_t sec_per_day = (60*60*24); + time_t sec_per_year = sec_per_day * 365; + time_t the_time = (sec_per_year * 41) + (sec_per_day * 9); /* Set date to DEC 31, 2010 */ + elm_calendar_min_max_year_set(cal, 2010, 2011); + m = elm_calendar_mark_add(cal, "checked", gmtime(&the_time), ELM_CALENDAR_MONTHLY); + elm_calendar_selected_time_set(cal, gmtime(&the_time)); + } + break; + case STATE_MARK_WEEKLY: + { + Evas_Object *cal = eina_list_nth(items, 0); + time_t sec_per_day = (60*60*24); + time_t sec_per_year = sec_per_day * 365; + time_t the_time = (sec_per_year * 41) + (sec_per_day * 4); /* Set date to DEC 26, 2010 */ + elm_calendar_mark_del(m); + m = elm_calendar_mark_add(cal, "checked", gmtime(&the_time), ELM_CALENDAR_WEEKLY); + elm_calendar_selected_time_set(cal, gmtime(&the_time)); + } + break; + case STATE_SUNDAY_HIGHLIGHT: + { + Evas_Object *cal = eina_list_nth(items, 0); + time_t sec_per_day = (60*60*24); + time_t sec_per_year = sec_per_day * 365; + time_t the_time = (sec_per_year * 41) + (sec_per_day * 3); /* Set date to DEC 25, 2010 */ + /* elm_calendar_mark_del(m); */ + m = elm_calendar_mark_add(cal, "holiday", gmtime(&the_time), ELM_CALENDAR_WEEKLY); + elm_calendar_selected_time_set(cal, gmtime(&the_time)); + } + break; + case STATE_SELECT_DATE_DISABLED_WITH_MARKS: + { + Evas_Object *cal = eina_list_nth(items, 0); + time_t sec_per_day = (60*60*24); + time_t sec_per_year = sec_per_day * 365; + time_t the_time = (sec_per_year * 41) + (sec_per_day * 10); /* Set date to JAN 01, 2011 */ + elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_MODE_NONE); + elm_calendar_selected_time_set(cal, gmtime(&the_time)); + } + break; + case STATE_SELECT_DATE_DISABLED_NO_MARKS: + { + Evas_Object *cal = eina_list_nth(items, 0); + time_t sec_per_day = (60*60*24); + time_t sec_per_year = sec_per_day * 365; + time_t the_time = (sec_per_year * 41) + (sec_per_day * 40); /* Set date to FEB 01, 2011 */ + elm_calendar_marks_clear(cal); + elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_MODE_NONE); + elm_calendar_selected_time_set(cal, gmtime(&the_time)); + } + break; + case API_STATE_LAST: + break; + default: + return; + } +} + +static void +_api_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ /* Will add here a SWITCH command containing code to modify test-object */ + /* in accordance a->state value. */ + api_data *a = data; + char str[128]; + + printf("clicked event on API Button: api_state=<%d>\n", a->state); + set_api_state(a); + a->state++; + sprintf(str, "Next API function (%u)", a->state); + elm_object_text_set(obj, str); + elm_object_disabled_set(obj, a->state == API_STATE_LAST); +} + +static void +_cleanup_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + free(data); +} + +/* A simple test, just displaying calendar in it's default state */ +void +test_calendar(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *cal, *bx, *bxx, *bt; + api_data *api = calloc(1, sizeof(api_data)); + + win = elm_win_util_standard_add("calendar", "Calendar"); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api); + + bxx = elm_box_add(win); + elm_win_resize_object_add(win, bxx); + evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bxx); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + api->box = bx; + evas_object_show(bx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Next API function"); + evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api); + elm_box_pack_end(bxx, bt); + elm_object_disabled_set(bt, api->state == API_STATE_LAST); + evas_object_show(bt); + + elm_box_pack_end(bxx, bx); + + cal = elm_calendar_add(win); + elm_calendar_first_day_of_week_set(cal, ELM_DAY_MONDAY); + evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, cal); + + time_t sec_per_day = (60*60*24); + time_t sec_per_year = sec_per_day * 365; + time_t the_time = (sec_per_year * 41) + (sec_per_day * 9); /* Set date to DEC 31, 2010 */ + elm_calendar_selected_time_set(cal, gmtime(&the_time)); + elm_calendar_min_max_year_set(cal, 2010, 2012); + + evas_object_show(cal); + + evas_object_show(win); +} + +void +_print_cal_info(Evas_Object *cal, Evas_Object *en) +{ + char info[1024]; + double interval; + int year_min, year_max; + Eina_Bool sel_enabled; + const char **wds; + struct tm stm; + + if (!elm_calendar_selected_time_get(cal, &stm)) + return; + + interval = elm_calendar_interval_get(cal); + elm_calendar_min_max_year_get(cal, &year_min, &year_max); + sel_enabled = !!(elm_calendar_select_mode_get(cal) != ELM_CALENDAR_SELECT_MODE_NONE); + wds = elm_calendar_weekdays_names_get(cal); + + snprintf(info, sizeof(info), + " Day: %i, Mon: %i, Year %i, WeekDay: %i
" + " Interval: %0.2f, Year_Min: %i, Year_Max %i, Sel Enabled : %i
" + " Weekdays: %s, %s, %s, %s, %s, %s, %s
", + stm.tm_mday, stm.tm_mon, stm.tm_year + 1900, stm.tm_wday, + interval, year_min, year_max, sel_enabled, + wds[0], wds[1], wds[2], wds[3], wds[4], wds[5], wds[6]); + + elm_object_text_set(en, info); +} + +static void +_print_cal_info_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + _print_cal_info(obj, data); +} + +static char * +_format_month_year(struct tm *stm) +{ + char buf[32]; + if (!strftime(buf, sizeof(buf), "%b %y", stm)) return NULL; + return strdup(buf); +} + +/* A test intended to cover all the calendar api and much use cases as + possible */ +void +test_calendar2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *bxh, *cal, *cal2, *cal3, *en; + Elm_Calendar_Mark *mark; + struct tm selected_time; + time_t current_time; + const char *weekdays[] = + { + "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday" + }; + + win = elm_win_util_standard_add("calendar2", "Calendar 2"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + bxh = elm_box_add(win); + elm_box_horizontal_set(bxh, EINA_TRUE); + evas_object_size_hint_weight_set(bxh, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bxh, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bxh); + elm_box_pack_end(bx, bxh); + + cal = elm_calendar_add(win); + evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(cal, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(cal); + elm_box_pack_end(bx, cal); + + cal2 = elm_calendar_add(win); + evas_object_size_hint_weight_set(cal2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(cal2, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_calendar_select_mode_set(cal2, ELM_CALENDAR_SELECT_MODE_NONE); + evas_object_show(cal2); + elm_box_pack_end(bxh, cal2); + + cal3 = elm_calendar_add(win); + evas_object_size_hint_weight_set(cal3, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(cal3, EVAS_HINT_FILL, EVAS_HINT_FILL); + current_time = time(NULL) + 34 * 84600; + localtime_r(¤t_time, &selected_time); + elm_calendar_selected_time_set(cal3, &selected_time); + current_time = time(NULL) + 1 * 84600; + localtime_r(¤t_time, &selected_time); + elm_calendar_mark_add(cal3, "checked", &selected_time, ELM_CALENDAR_UNIQUE); + elm_calendar_marks_clear(cal3); + current_time = time(NULL); + localtime_r(¤t_time, &selected_time); + elm_calendar_mark_add(cal3, "checked", &selected_time, ELM_CALENDAR_DAILY); + elm_calendar_mark_add(cal3, "holiday", &selected_time, ELM_CALENDAR_DAILY); + elm_calendar_marks_draw(cal3); + evas_object_show(cal3); + elm_box_pack_end(bxh, cal3); + + en = elm_entry_add(win); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(en); + elm_box_pack_end(bx, en); + elm_entry_editable_set(en, EINA_FALSE); + evas_object_show(win); + + elm_calendar_min_max_year_set(cal3, -1, -1); + + elm_calendar_weekdays_names_set(cal, weekdays); + elm_calendar_first_day_of_week_set(cal, ELM_DAY_SATURDAY); + elm_calendar_interval_set(cal, 0.4); + elm_calendar_format_function_set(cal, _format_month_year); + elm_calendar_min_max_year_set(cal, 2010, 2020); + + current_time = time(NULL) + 4 * 84600; + localtime_r(¤t_time, &selected_time); + elm_calendar_mark_add(cal, "holiday", &selected_time, ELM_CALENDAR_ANNUALLY); + + current_time = time(NULL) + 1 * 84600; + localtime_r(¤t_time, &selected_time); + elm_calendar_mark_add(cal, "checked", &selected_time, ELM_CALENDAR_UNIQUE); + + current_time = time(NULL) - 363 * 84600; + localtime_r(¤t_time, &selected_time); + elm_calendar_mark_add(cal, "checked", &selected_time, ELM_CALENDAR_MONTHLY); + + current_time = time(NULL) - 5 * 84600; + localtime_r(¤t_time, &selected_time); + mark = elm_calendar_mark_add(cal, "holiday", &selected_time, + ELM_CALENDAR_WEEKLY); + + current_time = time(NULL) + 1 * 84600; + localtime_r(¤t_time, &selected_time); + elm_calendar_mark_add(cal, "holiday", &selected_time, ELM_CALENDAR_WEEKLY); + + elm_calendar_mark_del(mark); + elm_calendar_marks_draw(cal); + + _print_cal_info(cal, en); + evas_object_smart_callback_add(cal, "changed", _print_cal_info_cb, en); +} + + +void +test_calendar3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *cal, *bxx; + api_data *api = calloc(1, sizeof(api_data)); + + win = elm_win_util_standard_add("calendar", "Calendar"); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api); + + bxx = elm_box_add(win); + elm_win_resize_object_add(win, bxx); + evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bxx); + + cal = elm_calendar_add(win); + elm_calendar_first_day_of_week_set(cal, ELM_DAY_THURSDAY); + elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_MODE_ONDEMAND); + evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bxx, cal); + + evas_object_show(cal); + + evas_object_show(win); +} + +#endif diff --git a/libraries/elementary/src/bin/test_check.c b/libraries/elementary/src/bin/test_check.c new file mode 100644 index 0000000..2e8b367 --- /dev/null +++ b/libraries/elementary/src/bin/test_check.c @@ -0,0 +1,193 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static Eina_Bool eb; + +static void +changed_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *ck2 = data; + printf("ck %p to %i\n", obj, elm_check_state_get(obj)); + elm_check_state_set(ck2, elm_check_state_get(obj)); + printf("ck2 %p is now %i\n", ck2, elm_check_state_get(ck2)); +} + +static void +state_changed_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("State Pointer Value: %d\n", eb); +} + +void +test_check(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *ic, *ck, *ck0; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("check", "Check"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + ck = elm_check_add(win); + evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ck, EVAS_HINT_FILL, 0.5); + elm_object_text_set(ck, "Icon sized to check"); + elm_object_part_content_set(ck, "icon", ic); + elm_check_state_set(ck, EINA_TRUE); + elm_box_pack_end(bx, ck); + evas_object_show(ck); + evas_object_show(ic); + + ck0 = ck; + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, EINA_FALSE, EINA_FALSE); + ck = elm_check_add(win); + elm_object_text_set(ck, "Icon not resizable"); + elm_object_part_content_set(ck, "icon", ic); + elm_box_pack_end(bx, ck); + evas_object_show(ck); + evas_object_show(ic); + + evas_object_smart_callback_add(ck, "changed", changed_cb, ck0); + + ck = elm_check_add(win); + elm_object_text_set(ck, "Label Only"); + elm_box_pack_end(bx, ck); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_object_text_set(ck, "Use State Pointer"); + elm_check_state_pointer_set(ck, &eb); + elm_box_pack_end(bx, ck); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_object_text_set(ck, "Print State Pointer Value"); + elm_box_pack_end(bx, ck); + evas_object_show(ck); + evas_object_smart_callback_add(ck, "changed", state_changed_cb, NULL); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + ck = elm_check_add(win); + evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ck, EVAS_HINT_FILL, 0.5); + elm_object_text_set(ck, "Disabled check"); + elm_object_part_content_set(ck, "icon", ic); + elm_check_state_set(ck, EINA_TRUE); + elm_box_pack_end(bx, ck); + elm_object_disabled_set(ck, EINA_TRUE); + evas_object_show(ck); + evas_object_show(ic); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, EINA_FALSE, EINA_FALSE); + ck = elm_check_add(win); + elm_object_part_content_set(ck, "icon", ic); + elm_box_pack_end(bx, ck); + evas_object_show(ck); + evas_object_show(ic); + + evas_object_show(win); +} + +void +test_check_toggle(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *ic, *tg; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("check-toggle", "Check Toggle"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + + tg = elm_check_add(win); + elm_object_style_set(tg, "toggle"); + evas_object_size_hint_weight_set(tg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(tg, EVAS_HINT_FILL, 0.5); + elm_object_text_set(tg, "Icon sized to toggle"); + elm_object_part_content_set(tg, "icon", ic); + elm_check_state_set(tg, EINA_TRUE); + elm_object_part_text_set(tg, "on", "Yes"); + elm_object_part_text_set(tg, "off", "No"); + elm_box_pack_end(bx, tg); + evas_object_show(tg); + evas_object_show(ic); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, EINA_FALSE, EINA_FALSE); + + tg = elm_check_add(win); + elm_object_style_set(tg, "toggle"); + elm_object_text_set(tg, "Icon no scale"); + elm_object_part_content_set(tg, "icon", ic); + elm_box_pack_end(bx, tg); + evas_object_show(tg); + evas_object_show(ic); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, EINA_FALSE, EINA_FALSE); + + tg = elm_check_add(win); + elm_object_style_set(tg, "toggle"); + elm_object_text_set(tg, "Disabled toggle"); + elm_object_part_content_set(tg, "icon", ic); + elm_object_disabled_set(tg, EINA_TRUE); + elm_box_pack_end(bx, tg); + evas_object_show(tg); + evas_object_show(ic); + + tg = elm_check_add(win); + elm_object_style_set(tg, "toggle"); + elm_object_text_set(tg, "Label Only"); + elm_object_part_text_set(tg, "on", "Big long fun times label"); + elm_object_part_text_set(tg, "off", "Small long happy fun label"); + elm_box_pack_end(bx, tg); + evas_object_show(tg); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, EINA_FALSE, EINA_FALSE); + + tg = elm_check_add(win); + elm_object_style_set(tg, "toggle"); + elm_object_part_content_set(tg, "icon", ic); + elm_box_pack_end(bx, tg); + evas_object_show(tg); + evas_object_show(ic); + + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_clock.c b/libraries/elementary/src/bin/test_clock.c new file mode 100644 index 0000000..6e28d21 --- /dev/null +++ b/libraries/elementary/src/bin/test_clock.c @@ -0,0 +1,309 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#include "test.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +struct _api_data +{ + unsigned int state; /* What state we are testing */ + Evas_Object *box; /* Used in set_api_state */ +}; +typedef struct _api_data api_data; + +enum _api_state +{ + CLOCK_HIDE_SEC, + CLOCK_SHOW_AM_PM, + CLOCK_SHOW_SEC, + CLOCK_EDIT_MIN, + CLOCK_EDIT_HOUR, + CLOCK_EDIT_ALL, + CLOCK_EDIT_ALL_ARMY, + API_STATE_LAST +}; +typedef enum _api_state api_state; + +static void +set_api_state(api_data *api) +{ + const Eina_List *items = elm_box_children_get(api->box); + Evas_Object *ck = eina_list_nth(items, 0); + if (!eina_list_count(items)) + return; + + /* use elm_box_children_get() to get list of children */ + switch(api->state) + { /* Put all api-changes under switch */ + case CLOCK_HIDE_SEC: + elm_clock_show_seconds_set(ck, EINA_FALSE); + break; + + case CLOCK_SHOW_AM_PM: + elm_clock_show_am_pm_set(ck, EINA_TRUE); + break; + + case CLOCK_SHOW_SEC: + elm_clock_show_seconds_set(ck, EINA_TRUE); + break; + + case CLOCK_EDIT_MIN: + elm_clock_edit_set(ck, ELM_CLOCK_EDIT_MIN_DECIMAL | ELM_CLOCK_EDIT_MIN_UNIT); + break; + + case CLOCK_EDIT_HOUR: + elm_clock_edit_set(ck, ELM_CLOCK_EDIT_DEFAULT); + elm_clock_edit_set(ck, ELM_CLOCK_EDIT_HOUR_DECIMAL | ELM_CLOCK_EDIT_HOUR_UNIT); + break; + + case CLOCK_EDIT_ALL: + elm_clock_edit_set(ck, ELM_CLOCK_EDIT_ALL); + break; + + case CLOCK_EDIT_ALL_ARMY: + elm_clock_show_am_pm_set(ck, EINA_FALSE); + break; + + case API_STATE_LAST: + + break; + default: + return; + } +} + +static void +_api_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ /* Will add here a SWITCH command containing code to modify test-object */ + /* in accordance a->state value. */ + api_data *a = data; + char str[128]; + + printf("clicked event on API Button: api_state=<%d>\n", a->state); + set_api_state(a); + a->state++; + sprintf(str, "Next API function (%u)", a->state); + elm_object_text_set(obj, str); + elm_object_disabled_set(obj, a->state == API_STATE_LAST); +} + +static void +_cleanup_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + free(data); +} + +void +test_clock(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *ck, *bt, *bxx; + unsigned int digedit; + api_data *api = calloc(1, sizeof(api_data)); + + win = elm_win_util_standard_add("clock", "Clock"); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api); + + bxx = elm_box_add(win); + elm_win_resize_object_add(win, bxx); + evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bxx); + + bx = elm_box_add(win); + elm_win_resize_object_add(win, bx); + api->box = bx; + evas_object_show(bx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Next API function"); + evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api); + elm_box_pack_end(bxx, bt); + elm_object_disabled_set(bt, EINA_TRUE); + evas_object_show(bt); + + elm_box_pack_end(bxx, bx); + + ck = elm_clock_add(win); + elm_box_pack_end(bx, ck); + evas_object_show(ck); + + ck = elm_clock_add(win); + elm_clock_show_am_pm_set(ck, EINA_TRUE); + elm_box_pack_end(bx, ck); + elm_clock_time_set(ck, 17, 25, 0); + evas_object_show(ck); + + ck = elm_clock_add(win); + elm_clock_show_seconds_set(ck, EINA_TRUE); + elm_box_pack_end(bx, ck); + evas_object_show(ck); + + ck = elm_clock_add(win); + elm_clock_show_seconds_set(ck, EINA_TRUE); + elm_clock_show_am_pm_set(ck, EINA_TRUE); + elm_box_pack_end(bx, ck); + elm_clock_time_set(ck, 11, 59, 57); + evas_object_show(ck); + + ck = elm_clock_add(win); + elm_clock_show_seconds_set(ck, EINA_TRUE); + elm_clock_show_am_pm_set(ck, EINA_FALSE); + elm_clock_time_set(ck, 23, 59, 57); + elm_box_pack_end(bx, ck); + evas_object_show(ck); + + ck = elm_clock_add(win); + elm_clock_edit_set(ck, EINA_TRUE); + elm_clock_show_seconds_set(ck, EINA_TRUE); + elm_clock_show_am_pm_set(ck, EINA_TRUE); + elm_clock_time_set(ck, 10, 11, 12); + elm_box_pack_end(bx, ck); + evas_object_show(ck); + + ck = elm_clock_add(win); + elm_clock_show_seconds_set(ck, EINA_TRUE); + elm_clock_edit_set(ck, EINA_TRUE); + digedit = ELM_CLOCK_EDIT_HOUR_UNIT | ELM_CLOCK_EDIT_MIN_UNIT | ELM_CLOCK_EDIT_SEC_UNIT; + elm_clock_edit_mode_set(ck, digedit); + elm_box_pack_end(bx, ck); + elm_clock_time_set(ck, 0, 0, 0); + evas_object_show(ck); + + evas_object_show(win); +} + +static void +_edit_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *ck = data; + + if (!elm_clock_edit_get(ck)) + { + elm_object_text_set(obj, "Done"); + elm_clock_edit_set(ck, EINA_TRUE); + return; + } + elm_object_text_set(obj, "Edit"); + elm_clock_edit_set(ck, EINA_FALSE); +} + +static void +_hmode_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *ck = data; + + if (!elm_clock_show_am_pm_get(ck)) + { + elm_object_text_set(obj, "24h"); + elm_clock_show_am_pm_set(ck, EINA_TRUE); + return; + } + elm_object_text_set(obj, "12h"); + elm_clock_show_am_pm_set(ck, EINA_FALSE); +} + +void +test_clock2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *hbx, *ck, *bt, *bxx; + api_data *api = calloc(1, sizeof(api_data)); + + win = elm_win_util_standard_add("clock2", "Clock 2"); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api); + + bxx = elm_box_add(win); + elm_win_resize_object_add(win, bxx); + evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bxx); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + api->box = bx; + evas_object_show(bx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Next API function"); + evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api); + elm_box_pack_end(bxx, bt); + elm_object_disabled_set(bt, api->state == API_STATE_LAST); + evas_object_show(bt); + + elm_box_pack_end(bxx, bx); + + ck = elm_clock_add(win); + elm_clock_time_set(ck, 0, 15, 3); + elm_clock_edit_mode_set(ck, ELM_CLOCK_EDIT_DEFAULT); + elm_clock_show_seconds_set(ck, EINA_TRUE); + elm_clock_show_am_pm_set(ck, EINA_TRUE); + elm_box_pack_end(bx, ck); + evas_object_show(ck); + + hbx = elm_box_add(win); + evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_horizontal_set(hbx, EINA_TRUE); + elm_box_pack_end(bx, hbx); + evas_object_show(hbx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Edit"); + evas_object_smart_callback_add(bt, "clicked", _edit_bt_clicked, ck); + elm_box_pack_end(hbx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "24h"); + evas_object_smart_callback_add(bt, "clicked", _hmode_bt_clicked, ck); + elm_box_pack_end(hbx, bt); + evas_object_show(bt); + + evas_object_show(win); +} + +void +test_clock3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *ck, *lb; + + win = elm_win_util_standard_add("clock3", "Clock 3"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + lb = elm_label_add(win); + elm_object_text_set(lb, + "Check time updates for an user mouse button hold." + ); + evas_object_size_hint_weight_set(lb, 0.0, 0.0); + evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, lb); + evas_object_show(lb); + + ck = elm_clock_add(win); + elm_clock_show_seconds_set(ck, 1); + elm_clock_edit_set(ck, EINA_TRUE); + elm_clock_first_interval_set(ck, 0.4); + elm_box_pack_end(bx, ck); + evas_object_show(ck); + + ck = elm_clock_add(win); + elm_clock_show_seconds_set(ck, 1); + elm_clock_edit_set(ck, EINA_TRUE); + elm_clock_first_interval_set(ck, 1.2); + elm_box_pack_end(bx, ck); + evas_object_show(ck); + + ck = elm_clock_add(win); + elm_clock_show_seconds_set(ck, 1); + elm_clock_edit_set(ck, EINA_TRUE); + elm_clock_first_interval_set(ck, 2.0); + elm_box_pack_end(bx, ck); + evas_object_show(ck); + + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_cnp.c b/libraries/elementary/src/bin/test_cnp.c new file mode 100644 index 0000000..31aad2d --- /dev/null +++ b/libraries/elementary/src/bin/test_cnp.c @@ -0,0 +1,105 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static Evas_Object *glb; + +static void +_bt_copy_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = (Evas_Object*)(data); + const char *txt = elm_object_text_get(en); + + elm_object_text_set(glb, txt); + elm_cnp_selection_set(elm_object_parent_widget_get(en), ELM_SEL_TYPE_CLIPBOARD, + ELM_SEL_FORMAT_TEXT, txt, strlen(txt)); +} + +static void +_bt_paste_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = (Evas_Object*)(data); + + elm_cnp_selection_get(en, ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_TEXT, + NULL, NULL); +} + +static void +_bt_clear_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = (Evas_Object*)(data); + + elm_object_text_set(glb, ""); + elm_object_cnp_selection_clear(elm_object_parent_widget_get(en), ELM_SEL_TYPE_CLIPBOARD); +} + +void +test_cnp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *gd, *bt, *en, *lb; + + win = elm_win_util_standard_add("copypaste", "CopyPaste"); + elm_win_autodel_set(win, EINA_TRUE); + + gd = elm_grid_add(win); + elm_grid_size_set(gd, 100, 100); + elm_win_resize_object_add(win, gd); + evas_object_size_hint_weight_set(gd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(gd); + + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + elm_entry_line_wrap_set(en, ELM_WRAP_CHAR); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(en, "Elementary provides "); + elm_grid_pack(gd, en, 10, 10, 60, 30); + evas_object_show(en); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Copy from left entry"); + evas_object_smart_callback_add(bt, "clicked", _bt_copy_clicked, en); + elm_grid_pack(gd, bt, 70, 10, 22, 30); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Clear clipboard"); + evas_object_smart_callback_add(bt, "clicked", _bt_clear_clicked, en); + elm_grid_pack(gd, bt, 70, 70, 22, 20); + evas_object_show(bt); + + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + elm_entry_line_wrap_set(en, ELM_WRAP_CHAR); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(en, "rich copying and pasting functionality,"); + elm_grid_pack(gd, en, 10, 40, 60, 30); + evas_object_show(en); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Paste to left entry"); + evas_object_smart_callback_add(bt, "clicked", _bt_paste_clicked, en); + elm_grid_pack(gd, bt, 70, 40, 22, 30); + evas_object_show(bt); + + lb = elm_label_add(win); + elm_object_text_set(lb, "Clipboard:"); + evas_object_size_hint_weight_set(lb, 0.0, 0.0); + evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_grid_pack(gd, lb, 10, 70, 60, 10); + evas_object_show(lb); + + glb = elm_label_add(win); + elm_object_text_set(glb, ""); + evas_object_size_hint_weight_set(glb, 0.0, 0.0); + evas_object_size_hint_align_set(glb, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_grid_pack(gd, glb, 10, 80, 60, 10); + evas_object_show(glb); + + evas_object_resize(win, 480, 200); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_colorselector.c b/libraries/elementary/src/bin/test_colorselector.c new file mode 100644 index 0000000..1878610 --- /dev/null +++ b/libraries/elementary/src/bin/test_colorselector.c @@ -0,0 +1,180 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static void +_colorselector_clicked_cb(void *data, Evas_Object *obj, + void *event_info __UNUSED__) +{ + Evas_Object *re = data; + int r, g, b, a; + + elm_colorselector_color_get(obj, &r, &g, &b, &a); + printf("Current Color [r=%d g=%d b=%d a=%d]\n",r, g, b, a); + + /* Fix Alpha pre multiplication by edje */ + r = (r * a) / 255; + g = (g * a) / 255; + b = (b * a) / 255; + + evas_object_color_set(re, r, g, b, a); +} + +static void +_colorpalette_clicked_cb(void *data, Evas_Object *obj __UNUSED__, + void *event_info) +{ + int r = 0, g = 0, b = 0 ,a = 0; + Elm_Object_Item *color_it = (Elm_Object_Item *) event_info; + elm_colorselector_palette_item_color_get(color_it, &r, &g, &b, &a); + evas_object_color_set((Evas_Object *) data, r, g, b , a); +} + +static void +_colorpalette_longpressed_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, + void *event_info) +{ + int r = 0,g = 0,b = 0 ,a = 0; + Elm_Object_Item *color_it = (Elm_Object_Item *) event_info; + elm_colorselector_palette_item_color_get(color_it, &r, &g, &b, &a); + printf("\ncolor = %d-%d-%d-%d\n", r, g, b, a); +} + +static void +_palette_cb(void *data, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *cs = data; + Evas_Object *win = evas_object_data_get(cs, "win"); + elm_colorselector_mode_set(cs, ELM_COLORSELECTOR_PALETTE); + evas_object_resize(win, 320, 300); +} + +static void +_components_cb(void *data, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *cs = data; + Evas_Object *win = evas_object_data_get(cs, "win"); + elm_colorselector_mode_set(cs, ELM_COLORSELECTOR_COMPONENTS); + evas_object_resize(win, 320, 455); +} + +static void +_both_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *cs = data; + Evas_Object *win = evas_object_data_get(cs, "win"); + elm_colorselector_mode_set(cs, ELM_COLORSELECTOR_BOTH); + evas_object_resize(win, 320, 535); +} + +void +test_colorselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *bx2, *cs, *fr, *re, *bt; + int r, g, b, a; + + win = elm_win_util_standard_add("colorselector", "ColorSelector"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + fr = elm_frame_add(bx); + evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(fr, "Color View"); + elm_box_pack_end(bx, fr); + evas_object_show(fr); + + re = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_size_hint_min_set(re, 1, 100); + evas_object_show(re); + elm_object_content_set(fr, re); + + fr = elm_frame_add(bx); + evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(fr, "Color Selector"); + elm_box_pack_end(bx, fr); + evas_object_show(fr); + + cs = elm_colorselector_add(fr); + elm_colorselector_palette_color_add(cs, 255, 90, 18, 255); + elm_colorselector_palette_color_add(cs, 255, 213, 0, 255); + elm_colorselector_palette_color_add(cs, 146, 255, 11, 255); + elm_colorselector_palette_color_add(cs, 9, 186, 10, 255); + elm_colorselector_palette_color_add(cs, 86, 201, 242, 255); + elm_colorselector_palette_color_add(cs, 18, 83, 128, 255); + elm_colorselector_palette_color_add(cs, 140, 53, 238, 255); + elm_colorselector_palette_color_add(cs, 255, 145, 145, 255); + elm_colorselector_palette_color_add(cs, 255, 59, 119, 255); + elm_colorselector_palette_color_add(cs, 133, 100, 69, 255); + elm_colorselector_palette_color_add(cs, 255, 255, 119, 255); + elm_colorselector_palette_color_add(cs, 133, 100, 255, 255); + + a = 180; + r = 255; + g = 160; + b = 132; + + elm_colorselector_color_set(cs, r, g, b, a); + evas_object_size_hint_weight_set(cs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(cs, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_content_set(fr, cs); + evas_object_show(cs); + evas_object_smart_callback_add(cs, "changed", _colorselector_clicked_cb, re); + evas_object_smart_callback_add(cs, "color,item,selected", + _colorpalette_clicked_cb, re); + evas_object_smart_callback_add(cs, "color,item,longpressed", + _colorpalette_longpressed_cb, re); + evas_object_data_set(cs, "win", win); + + elm_colorselector_color_get(cs, &r, &g, &b, &a); + /* Fix Alpha pre multiplication by edje */ + r = (r * a) / 255; + g = (g * a) / 255; + b = (b * a) / 255; + evas_object_color_set(re, r, g, b, a); + + bx2 = elm_box_add(bx); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bx2); + elm_box_pack_end(bx, bx2); + + bt = elm_button_add(bx2); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_smart_callback_add(bt, "clicked", _palette_cb, cs); + elm_object_text_set(bt, "Palette"); + evas_object_show(bt); + elm_box_pack_end(bx2, bt); + + bt = elm_button_add(bx2); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_smart_callback_add(bt, "clicked", _components_cb, cs); + elm_object_text_set(bt, "Components"); + evas_object_show(bt); + elm_box_pack_end(bx2, bt); + + bt = elm_button_add(bx2); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_smart_callback_add(bt, "clicked", _both_cb, cs); + elm_object_text_set(bt, "Both"); + evas_object_show(bt); + elm_box_pack_end(bx2, bt); + + evas_object_resize(win, 320, 500); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_conform.c b/libraries/elementary/src/bin/test_conform.c new file mode 100644 index 0000000..925a1aa --- /dev/null +++ b/libraries/elementary/src/bin/test_conform.c @@ -0,0 +1,199 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +void +test_conformant(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__) +{ + Evas_Object *win, *conform, *btn, *bx, *en; + + win = elm_win_util_standard_add("conformant", "Conformant"); + elm_win_autodel_set(win, EINA_TRUE); + elm_win_conformant_set(win, EINA_TRUE); + + conform = elm_conformant_add(win); + elm_win_resize_object_add(win, conform); + evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(conform); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + elm_entry_single_line_set(en, EINA_TRUE); + elm_entry_bounce_set(en, EINA_TRUE, EINA_FALSE); + elm_object_text_set(en, "This is the top entry here"); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); + evas_object_show(en); + elm_box_pack_end(bx, en); + + btn = elm_button_add(win); + elm_object_text_set(btn, "Test Conformant"); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, btn); + evas_object_show(btn); + + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + elm_entry_single_line_set(en, EINA_TRUE); + elm_entry_bounce_set(en, EINA_TRUE, EINA_FALSE); + elm_object_text_set(en, "This is the middle entry here"); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); + evas_object_show(en); + elm_box_pack_end(bx, en); + + btn = elm_button_add(win); + elm_object_text_set(btn, "Test Conformant"); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, btn); + evas_object_show(btn); + + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + elm_entry_bounce_set(en, EINA_FALSE, EINA_TRUE); + elm_object_text_set(en, + "This is a multi-line entry at the bottom
" + "This can contain more than 1 line of text and be " + "scrolled around to allow for entering of lots of " + "content. It is also to test to see that autoscroll " + "moves to the right part of a larger multi-line " + "text entry that is inside of a scroller than can be " + "scrolled around, thus changing the expected position " + "as well as cursor changes updating auto-scroll when " + "it is enabled."); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(en); + elm_box_pack_end(bx, en); + + elm_object_content_set(conform, bx); + evas_object_show(bx); + + evas_object_resize(win, 240, 240); + evas_object_show(win); +} + +static void +popobj(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__) +{ + elm_naviframe_item_pop(data); +} + +void +test_conformant2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__) +{ + Evas_Object *win, *conform, *btn, *bx, *en, *pg; + + win = elm_win_util_standard_add("conformant2", "Conformant 2"); + elm_win_autodel_set(win, EINA_TRUE); + elm_win_conformant_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + elm_entry_single_line_set(en, EINA_TRUE); + elm_entry_bounce_set(en, EINA_TRUE, EINA_FALSE); + elm_object_text_set(en, "This is the top entry here"); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, en); + evas_object_show(en); + + btn = elm_button_add(win); + elm_object_focus_allow_set(btn, EINA_FALSE); + elm_object_text_set(btn, "Delete Below"); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, btn); + evas_object_show(btn); + + pg = elm_naviframe_add(win); + evas_object_size_hint_weight_set(pg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(pg, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, pg); + evas_object_show(pg); + + evas_object_smart_callback_add(btn, "clicked", popobj, pg); + + conform = elm_conformant_add(win); + evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(conform, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_naviframe_item_simple_push(pg, conform); + evas_object_show(conform); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + elm_entry_bounce_set(en, EINA_FALSE, EINA_TRUE); + elm_object_text_set(en, "This entry and button below get deleted."); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(en); + elm_box_pack_end(bx, en); + + btn = elm_button_add(win); + elm_object_focus_allow_set(btn, EINA_FALSE); + elm_object_text_set(btn, "Delete this bottom bit 1"); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, btn); + evas_object_show(btn); + + evas_object_smart_callback_add(btn, "clicked", popobj, pg); + + elm_object_content_set(conform, bx); + evas_object_show(bx); + + conform = elm_conformant_add(win); + evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(conform, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_naviframe_item_simple_push(pg, conform); + evas_object_show(conform); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + elm_entry_bounce_set(en, EINA_FALSE, EINA_TRUE); + elm_object_text_set(en, "This entry and button below get deleted."); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(en); + elm_box_pack_end(bx, en); + + btn = elm_button_add(win); + elm_object_focus_allow_set(btn, EINA_FALSE); + elm_object_text_set(btn, "Delete this bottom bit 2"); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, btn); + evas_object_show(btn); + + evas_object_smart_callback_add(btn, "clicked", popobj, pg); + + elm_object_content_set(conform, bx); + evas_object_show(bx); + + evas_object_resize(win, 240, 480); + evas_object_show(win); +} + +#endif diff --git a/libraries/elementary/src/bin/test_ctxpopup.c b/libraries/elementary/src/bin/test_ctxpopup.c new file mode 100644 index 0000000..2933ae4 --- /dev/null +++ b/libraries/elementary/src/bin/test_ctxpopup.c @@ -0,0 +1,321 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + + +static void +_dismissed(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *ctxpopup_data = evas_object_data_get(obj, "im"); + if (ctxpopup_data) evas_object_del(ctxpopup_data); + evas_object_del(obj); +} + +static void +_print_current_dir(Evas_Object *obj) +{ + Elm_Ctxpopup_Direction dir; + dir = elm_ctxpopup_direction_get(obj); + + switch(dir) + { + case ELM_CTXPOPUP_DIRECTION_LEFT: + printf("ctxpopup direction: left!\n"); + break; + case ELM_CTXPOPUP_DIRECTION_RIGHT: + printf("ctxpopup direction: right!\n"); + break; + case ELM_CTXPOPUP_DIRECTION_UP: + printf("ctxpopup direction: up!\n"); + break; + case ELM_CTXPOPUP_DIRECTION_DOWN: + printf("ctxpopup direction: down!\n"); + break; + case ELM_CTXPOPUP_DIRECTION_UNKNOWN: + printf("ctxpopup direction: unknow!\n"); + break; + } +} + +static void +_btn_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + printf("Button Clicked\n"); + + Evas_Object *im; + char buf[PATH_MAX]; + void *ctxpopup_data; + + ctxpopup_data = evas_object_data_get(data, "id"); + if (!ctxpopup_data) return; + + if (!strcmp("list_item_6", (char *) ctxpopup_data)) + { + ctxpopup_data = evas_object_data_get(data, "im"); + if (ctxpopup_data) return; + + im = evas_object_image_filled_add(evas_object_evas_get(obj)); + snprintf(buf, sizeof(buf), "%s/images/%s", + elm_app_data_dir_get(), "twofish.jpg"); + evas_object_image_file_set(im, buf, NULL); + evas_object_move(im, 40, 40); + evas_object_resize(im, 320, 320); + evas_object_show(im); + evas_object_data_set((Evas_Object *)data, "im", im); + + evas_object_raise((Evas_Object *)data); + } +} + +static void +_ctxpopup_item_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + printf("ctxpopup item selected: %s\n", + elm_object_item_text_get(event_info)); +} + +#define ITEM_NEW(_hov, _label, _icon) \ + if (_icon) \ + { \ + ic = elm_icon_add(obj); \ + elm_icon_standard_set(ic, _icon); \ + elm_icon_resizable_set(ic, EINA_FALSE, EINA_FALSE); \ + } \ + else \ + ic = NULL; \ + it = elm_ctxpopup_item_append(_hov, _label, ic, _ctxpopup_item_cb, NULL); \ + +static void +_list_item_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *ctxpopup, *ic; + Elm_Object_Item *it; + Evas_Coord x,y; + + ctxpopup = elm_ctxpopup_add(obj); + evas_object_smart_callback_add(ctxpopup, + "dismissed", + _dismissed, + NULL); + + ITEM_NEW(ctxpopup, "Go to home folder", "home"); + ITEM_NEW(ctxpopup, "Save file", "file"); + ITEM_NEW(ctxpopup, "Delete file", "delete"); + ITEM_NEW(ctxpopup, "Navigate to folder", "folder"); + elm_object_item_disabled_set(it, EINA_TRUE); + ITEM_NEW(ctxpopup, "Edit entry", "edit"); + ITEM_NEW(ctxpopup, "Set date and time", "clock"); + elm_object_item_disabled_set(it, EINA_TRUE); + + evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y); + evas_object_size_hint_max_set(ctxpopup, 240, 240); + evas_object_move(ctxpopup, x, y); + evas_object_show(ctxpopup); + _print_current_dir(ctxpopup); +} + +static void +_list_item_cb2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *ctxpopup, *ic; + Elm_Object_Item *it; + Evas_Coord x,y; + + ctxpopup = elm_ctxpopup_add(obj); + evas_object_smart_callback_add(ctxpopup, + "dismissed", + _dismissed, + NULL); + + ITEM_NEW(ctxpopup, NULL, "home"); + ITEM_NEW(ctxpopup, NULL, "file"); + ITEM_NEW(ctxpopup, NULL, "delete"); + ITEM_NEW(ctxpopup, NULL, "folder"); + ITEM_NEW(ctxpopup, NULL, "edit"); + elm_object_item_disabled_set(it, EINA_TRUE); + ITEM_NEW(ctxpopup, NULL, "clock"); + + evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y); + evas_object_size_hint_max_set(ctxpopup, 240, 240); + evas_object_move(ctxpopup, x, y); + evas_object_show(ctxpopup); + _print_current_dir(ctxpopup); +} + +static void +_list_item_cb3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *ctxpopup, *ic; + Elm_Object_Item *it; + Evas_Coord x,y; + + ctxpopup = elm_ctxpopup_add(obj); + evas_object_smart_callback_add(ctxpopup, + "dismissed", + _dismissed, + NULL); + + ITEM_NEW(ctxpopup, "Eina", NULL); + ITEM_NEW(ctxpopup, "Eet", NULL); + ITEM_NEW(ctxpopup, "Evas", NULL); + ITEM_NEW(ctxpopup, "Ecore", NULL); + elm_object_item_disabled_set(it, EINA_TRUE); + ITEM_NEW(ctxpopup, "Embryo", NULL); + ITEM_NEW(ctxpopup, "Edje", NULL); + + evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y); + evas_object_move(ctxpopup, x, y); + evas_object_show(ctxpopup); + _print_current_dir(ctxpopup); +} + +static void +_list_item_cb4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *ctxpopup, *ic; + Elm_Object_Item *it; + Evas_Coord x,y; + + ctxpopup = elm_ctxpopup_add(obj); + evas_object_smart_callback_add(ctxpopup, + "dismissed", + _dismissed, + NULL); + + elm_ctxpopup_horizontal_set(ctxpopup, EINA_TRUE); + + ITEM_NEW(ctxpopup, NULL, "home"); + ITEM_NEW(ctxpopup, NULL, "file"); + ITEM_NEW(ctxpopup, NULL, "delete"); + ITEM_NEW(ctxpopup, NULL, "folder"); + ITEM_NEW(ctxpopup, NULL, "edit"); + ITEM_NEW(ctxpopup, NULL, "clock"); + + evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y); + evas_object_size_hint_max_set(ctxpopup, 240, 240); + evas_object_move(ctxpopup, x, y); + evas_object_show(ctxpopup); + _print_current_dir(ctxpopup); +} + + +static void +_list_item_cb5(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *ctxpopup, *btn, *sc, *bx; + Evas_Coord x,y; + + bx = elm_box_add(obj); + evas_object_size_hint_min_set(bx, 150, 150); + + sc = elm_scroller_add(bx); + elm_scroller_bounce_set(sc, EINA_FALSE, EINA_TRUE); + evas_object_size_hint_fill_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(sc); + + btn = elm_button_add(sc); + elm_object_text_set(btn, "Enlightenment"); + evas_object_size_hint_min_set(btn, 140, 140); + + elm_object_content_set(sc, btn); + + elm_box_pack_end(bx, sc); + + ctxpopup = elm_ctxpopup_add(obj); + evas_object_smart_callback_add(ctxpopup, + "dismissed", + _dismissed, + NULL); + + elm_object_content_set(ctxpopup, bx); + + evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y); + evas_object_move(ctxpopup, x, y); + evas_object_show(ctxpopup); + _print_current_dir(ctxpopup); + + evas_object_smart_callback_add(btn, "clicked", _btn_clicked, "list_item_5"); +} + +static void +_list_item_cb6(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *ctxpopup, *btn, *sc, *bx; + Evas_Coord x,y; + + bx = elm_box_add(obj); + evas_object_size_hint_min_set(bx, 200, 150); + + sc = elm_scroller_add(bx); + elm_scroller_bounce_set(sc, EINA_FALSE, EINA_TRUE); + evas_object_size_hint_fill_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(sc); + + btn = elm_button_add(sc); + elm_object_text_set(btn, "Ctxpop will be on the top of layer"); + evas_object_size_hint_min_set(btn, 190, 140); + + elm_object_content_set(sc, btn); + + elm_box_pack_end(bx, sc); + + ctxpopup = elm_ctxpopup_add(obj); + evas_object_smart_callback_add(ctxpopup, + "dismissed", + _dismissed, + NULL); + + elm_object_content_set(ctxpopup, bx); + + evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y); + evas_object_move(ctxpopup, x, y); + evas_object_show(ctxpopup); + _print_current_dir(ctxpopup); + + evas_object_data_set(ctxpopup, "id", "list_item_6"); + evas_object_smart_callback_add(btn, "clicked", _btn_clicked, ctxpopup); +} + +static void _list_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + elm_list_item_selected_set(event_info, EINA_FALSE); +} + +void +test_ctxpopup(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *list; + + win = elm_win_util_standard_add("contextual-popup", "Contextual Popup"); + elm_win_autodel_set(win, EINA_TRUE); + + list = elm_list_add(win); + elm_win_resize_object_add(win, list); + evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_list_mode_set(list, ELM_LIST_COMPRESS); + evas_object_smart_callback_add(list, "selected", _list_clicked, NULL); + +#undef ITEM_NEW + elm_list_item_append(list, "Ctxpopup with icons and labels", NULL, NULL, + _list_item_cb, NULL); + elm_list_item_append(list, "Ctxpopup with icons only", NULL, NULL, + _list_item_cb2, NULL); + elm_list_item_append(list, "Ctxpopup with labels only", NULL, NULL, + _list_item_cb3, NULL); + elm_list_item_append(list, "Ctxpopup at horizontal mode", NULL, NULL, + _list_item_cb4, NULL); + elm_list_item_append(list, "Ctxpopup with user content", NULL, NULL, + _list_item_cb5, NULL); + elm_list_item_append(list, "Ctxpopup with restacking", NULL, NULL, + _list_item_cb6, NULL); + evas_object_show(list); + elm_list_go(list); + + evas_object_resize(win, 400, 400); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_cursor.c b/libraries/elementary/src/bin/test_cursor.c new file mode 100644 index 0000000..0150b44 --- /dev/null +++ b/libraries/elementary/src/bin/test_cursor.c @@ -0,0 +1,450 @@ +#include +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +// XXX: show all type of cursors in the elementary_test. this needs to be the first test + +typedef struct _Testitem +{ + Elm_Object_Item *item; + const char *path; + int mode; + int onoff; +} Testitem; + +static Elm_Gengrid_Item_Class gic; + +char * +grd_lbl_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ + const Testitem *ti = data; + char buf[256]; + snprintf(buf, sizeof(buf), "Photo %s", ti->path); + return strdup(buf); +} + +Evas_Object * +grd_content_get(void *data, Evas_Object *obj, const char *part) +{ + const Testitem *ti = data; + if (!strcmp(part, "elm.swallow.icon")) + { + Evas_Object *icon = elm_bg_add(obj); + elm_bg_file_set(icon, ti->path, NULL); + evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, + 1, 1); + evas_object_show(icon); + return icon; + } + return NULL; +} + +static Elm_Genlist_Item_Class itct; + +static void +glt_exp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Object_Item *glit = event_info; + Evas_Object *gl = elm_object_item_widget_get(glit); + int val = (int)(long) elm_object_item_data_get(glit); + Elm_Object_Item *glit1, *glit2, *glit3; + + val *= 10; + glit1 = elm_genlist_item_append(gl, &itct, (void *)(long) (val + 1), glit, + ELM_GENLIST_ITEM_NONE, NULL, NULL); + glit2 = elm_genlist_item_append(gl, &itct, (void *)(long) (val + 2), glit, + ELM_GENLIST_ITEM_NONE, NULL, NULL); + glit3 = elm_genlist_item_append(gl, &itct, (void *)(long) (val + 3), glit, + ELM_GENLIST_ITEM_TREE, NULL, NULL); + + elm_genlist_item_cursor_set(glit1, ELM_CURSOR_HAND2); + elm_genlist_item_cursor_set(glit2, ELM_CURSOR_HAND2); + elm_genlist_item_cursor_set(glit3, ELM_CURSOR_HAND1); + +} + +static void +glt_con(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Object_Item *glit = event_info; + elm_genlist_item_subitems_clear(glit); +} + +static void +glt_exp_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Object_Item *glit = event_info; + elm_genlist_item_expanded_set(glit, EINA_TRUE); +} + +static void +glt_con_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Object_Item *glit = event_info; + elm_genlist_item_expanded_set(glit, EINA_FALSE); +} + +char * +glt_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ + char buf[256]; + snprintf(buf, sizeof(buf), "Item mode %i", (int)(long)data); + return strdup(buf); +} + +void +test_cursor(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bg, *bx, *bt, *list, *entry, *ck; + Elm_Object_Item *lit; + + win = elm_win_add(NULL, "cursor", ELM_WIN_BASIC); + elm_win_title_set(win, "Cursor"); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + elm_object_cursor_set(bg, ELM_CURSOR_CIRCLE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + ck = elm_clock_add(win); + elm_object_cursor_set(ck, ELM_CURSOR_CLOCK); + elm_box_pack_end(bx, ck); + evas_object_show(ck); + + bt = elm_button_add(win); + elm_object_cursor_set(bt, ELM_CURSOR_COFFEE_MUG); + elm_object_text_set(bt, "Coffee Mug"); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_cursor_set(bt, ELM_CURSOR_CLOCK); + elm_object_text_set(bt, "Cursor unset"); + elm_object_cursor_unset(bt); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + list = elm_list_add(win); + elm_box_pack_end(bx, list); + evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_fill_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_cursor_set(list, ELM_CURSOR_WATCH); + lit = elm_list_item_append(list, "watch over list | hand1", NULL, NULL, NULL, + NULL); + elm_object_item_cursor_set(lit, ELM_CURSOR_HAND1); + lit = elm_list_item_append(list, "watch over list | hand2", NULL, NULL, NULL, + NULL); + elm_object_item_cursor_set(lit, ELM_CURSOR_HAND2); + elm_list_go(list); + evas_object_show(list); + + entry = elm_entry_add(win); + elm_entry_scrollable_set(entry, EINA_TRUE); + elm_object_text_set(entry, "Xterm cursor"); + elm_entry_single_line_set(entry, EINA_TRUE); + evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_fill_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, entry); + evas_object_show(entry); + elm_object_cursor_set(entry, ELM_CURSOR_XTERM); + + evas_object_resize(win, 320, 480); + evas_object_show(win); +} + +void +test_cursor2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *o, *grid, *gl; + Elm_Object_Item *glit1, *glit2, *glit3; + Elm_Object_Item *tb_it; + Elm_Object_Item *lit; + char buf[PATH_MAX]; + static Testitem ti[144]; + int i, n; + const char *img[9] = + { + "panel_01.jpg", + "plant_01.jpg", + "rock_01.jpg", + "rock_02.jpg", + "sky_01.jpg", + "sky_02.jpg", + "sky_03.jpg", + "sky_04.jpg", + "wood_01.jpg", + }; + + win = elm_win_util_standard_add("cursor2", "Cursor 2"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + o = elm_toolbar_add(win); + elm_toolbar_homogeneous_set(o, 0); + evas_object_size_hint_weight_set(o, 0.0, 0.0); + evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0); + tb_it = elm_toolbar_item_append(o, NULL, "Bogosity", NULL, NULL); + elm_object_item_cursor_set(tb_it, ELM_CURSOR_BOGOSITY); + tb_it = elm_toolbar_item_append(o, NULL, "Unset", NULL, NULL); + elm_object_item_cursor_set(tb_it, ELM_CURSOR_BOGOSITY); + elm_object_item_cursor_unset(tb_it); + tb_it = elm_toolbar_item_append(o, NULL, "Xterm", NULL, NULL); + elm_object_item_cursor_set(tb_it, ELM_CURSOR_XTERM); + elm_box_pack_end(bx, o); + evas_object_show(o); + + o = elm_list_add(win); + elm_box_pack_end(bx, o); + evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); + lit = elm_list_item_append(o, "cursor bogosity", NULL, NULL, NULL, NULL); + elm_object_item_cursor_set(lit, ELM_CURSOR_BOGOSITY); + lit = elm_list_item_append(o, "cursor unset", NULL, NULL, NULL, NULL); + elm_object_item_cursor_set(lit, ELM_CURSOR_BOGOSITY); + elm_object_item_cursor_unset(lit); + lit = elm_list_item_append(o, "cursor xterm", NULL, NULL, NULL, NULL); + elm_object_item_cursor_set(lit, ELM_CURSOR_XTERM); + elm_list_go(o); + evas_object_show(o); + + gl = elm_genlist_add(win); + evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(gl); + + itct.item_style = "default"; + itct.func.text_get = glt_text_get; + + glit1 = elm_genlist_item_append(gl, &itct, (void *) 1, NULL, + ELM_GENLIST_ITEM_TREE, NULL, NULL); + glit2 = elm_genlist_item_append(gl, &itct, (void *) 2, NULL, + ELM_GENLIST_ITEM_TREE, NULL, NULL); + glit3 = elm_genlist_item_append(gl, &itct, (void *) 3, NULL, + ELM_GENLIST_ITEM_NONE, NULL, NULL); + + elm_genlist_item_cursor_set(glit1, ELM_CURSOR_HAND1); + elm_genlist_item_cursor_set(glit2, ELM_CURSOR_HAND1); + elm_genlist_item_cursor_set(glit3, ELM_CURSOR_CROSS); + + evas_object_smart_callback_add(gl, "expand,request", glt_exp_req, gl); + evas_object_smart_callback_add(gl, "contract,request", glt_con_req, gl); + evas_object_smart_callback_add(gl, "expanded", glt_exp, gl); + evas_object_smart_callback_add(gl, "contracted", glt_con, gl); + + elm_box_pack_end(bx, gl); + + grid = elm_gengrid_add(win); + elm_gengrid_item_size_set(grid, 130, 130); + elm_gengrid_horizontal_set(grid, EINA_FALSE); + elm_gengrid_multi_select_set(grid, EINA_TRUE); + evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_fill_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL); + + gic.item_style = "default"; + gic.func.text_get = grd_lbl_get; + gic.func.content_get = grd_content_get; + + n = 0; + for (i = 0; i < 3 * 3; i++) + { + snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), img[n]); + n = (n + 1) % 9; + ti[i].mode = i; + ti[i].path = eina_stringshare_add(buf); + ti[i].item = elm_gengrid_item_append(grid, &gic, &(ti[i]), NULL, NULL); + if (n % 2) + elm_gengrid_item_cursor_set(ti[i].item, ELM_CURSOR_HAND1); + else + elm_gengrid_item_cursor_set(ti[i].item, ELM_CURSOR_CLOCK); + if (!(i % 5)) + elm_gengrid_item_selected_set(ti[i].item, EINA_TRUE); + } + elm_box_pack_end(bx, grid); + evas_object_show(grid); + + evas_object_resize(win, 320, 480); + evas_object_show(win); +} + +void +test_cursor3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *o; + Elm_Object_Item *lit; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("cursor3", "Cursor 3"); + elm_win_autodel_set(win, EINA_TRUE); + + snprintf(buf, sizeof(buf), "%s/objects/cursors.edj", elm_app_data_dir_get()); + elm_theme_extension_add(NULL, buf); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + o = elm_button_add(win); + elm_object_cursor_set(o, ELM_CURSOR_HAND1); + elm_object_cursor_theme_search_enabled_set(o, EINA_FALSE); + elm_object_text_set(o, "hand1"); + elm_box_pack_end(bx, o); + evas_object_show(o); + + o = elm_button_add(win); + elm_object_cursor_set(o, ELM_CURSOR_HAND2); + elm_object_text_set(o, "hand2 x"); + elm_box_pack_end(bx, o); + evas_object_show(o); + + o = elm_button_add(win); + elm_object_cursor_set(o, ELM_CURSOR_HAND2); + elm_object_cursor_theme_search_enabled_set(o, EINA_FALSE); + elm_object_text_set(o, "hand2"); + elm_box_pack_end(bx, o); + evas_object_show(o); + + o = elm_button_add(win); + elm_object_cursor_set(o, "hand3"); + elm_object_cursor_theme_search_enabled_set(o, EINA_FALSE); + elm_object_text_set(o, "hand3"); + elm_box_pack_end(bx, o); + evas_object_show(o); + + o = elm_button_add(win); + elm_object_cursor_set(o, "hand3"); + elm_object_cursor_theme_search_enabled_set(o, EINA_FALSE); + elm_object_cursor_style_set(o, "transparent"); + elm_object_text_set(o, "hand3 transparent"); + elm_box_pack_end(bx, o); + evas_object_show(o); + + o = elm_button_add(win); + elm_object_cursor_set(o, "hand3"); + elm_object_cursor_theme_search_enabled_set(o, EINA_FALSE); + elm_object_cursor_unset(o); + elm_object_text_set(o, "unset"); + elm_box_pack_end(bx, o); + evas_object_show(o); + + o = elm_button_add(win); + elm_object_cursor_set(o, "hand4"); + elm_object_text_set(o, "not existent"); + elm_box_pack_end(bx, o); + evas_object_show(o); + + elm_config_cursor_engine_only_set(EINA_FALSE); + o = elm_button_add(win); + elm_object_cursor_set(o, "hand2"); + elm_object_text_set(o, "hand 2 engine only config false"); + elm_box_pack_end(bx, o); + evas_object_show(o); + + elm_config_cursor_engine_only_set(EINA_TRUE); + o = elm_button_add(win); + elm_object_cursor_set(o, "hand2"); + elm_object_text_set(o, "hand 2 engine only config true"); + elm_box_pack_end(bx, o); + evas_object_show(o); + + o = elm_list_add(win); + elm_box_pack_end(bx, o); + evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); + lit = elm_list_item_append(o, "cursor hand2 x", NULL, NULL, NULL, NULL); + elm_object_item_cursor_set(lit, ELM_CURSOR_HAND2); + lit = elm_list_item_append(o, "cursor hand2", NULL, NULL, NULL, NULL); + elm_object_item_cursor_set(lit, ELM_CURSOR_HAND2); + elm_object_item_cursor_engine_only_set(lit, EINA_FALSE); + lit = elm_list_item_append(o, "cursor hand3", NULL, NULL, NULL, NULL); + elm_object_item_cursor_set(lit, "hand3"); + elm_object_item_cursor_engine_only_set(lit, EINA_FALSE); + lit = elm_list_item_append(o, "cursor hand3 transparent", NULL, NULL, + NULL, NULL); + elm_object_item_cursor_set(lit, "hand3"); + elm_object_item_cursor_style_set(lit, "transparent"); + elm_object_item_cursor_engine_only_set(lit, EINA_FALSE); + elm_list_go(o); + evas_object_show(o); + + evas_object_resize(win, 320, 480); + evas_object_show(win); +} + +void +test_cursor4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *ly, *bt; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("cursor layout", "Cursor Layout"); + elm_win_autodel_set(win, EINA_TRUE); + + snprintf(buf, sizeof(buf), "%s/objects/cursors.edj", elm_app_data_dir_get()); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + ly = elm_layout_add(win); + elm_layout_file_set(ly, buf, "test/layout/events"); + evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_cursor_set(ly, ELM_CURSOR_HAND1); + elm_box_pack_end(bx, ly); + evas_object_show(ly); + + ly = elm_layout_add(win); + elm_layout_file_set(ly, buf, "test/layout/noevents"); + evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_cursor_set(ly, ELM_CURSOR_XTERM); + elm_layout_part_cursor_set(ly, "top-left", ELM_CURSOR_CROSS); + elm_layout_part_cursor_set(ly, "bottom-left", ELM_CURSOR_PIRATE); + elm_box_pack_end(bx, ly); + evas_object_show(ly); + + ly = elm_layout_add(win); + elm_layout_file_set(ly, buf, "test/layout/parts2"); + evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_layout_part_cursor_set(ly, "top-left", ELM_CURSOR_CROSS); + elm_layout_part_cursor_set(ly, "bottom-left", ELM_CURSOR_PIRATE); + elm_box_pack_end(bx, ly); + evas_object_show(ly); + + ly = elm_layout_add(win); + evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_layout_file_set(ly, buf, "test/layout/swallow"); + bt = elm_button_add(win); + elm_object_text_set(bt, "Cursor over obj"); + elm_object_part_content_set(ly, "swallow1", bt); + elm_object_cursor_set(bt, ELM_CURSOR_PIRATE); + bt = elm_button_add(win); + elm_object_text_set(bt, "Cursor over part"); + elm_object_part_content_set(ly, "swallow2", bt); + elm_layout_part_cursor_set(ly, "swallow2", ELM_CURSOR_PIRATE); + elm_box_pack_end(bx, ly); + evas_object_show(ly); + + evas_object_resize(win, 320, 480); + evas_object_show(win); +} + +#endif diff --git a/libraries/elementary/src/bin/test_datetime.c b/libraries/elementary/src/bin/test_datetime.c new file mode 100644 index 0000000..ffc8608 --- /dev/null +++ b/libraries/elementary/src/bin/test_datetime.c @@ -0,0 +1,75 @@ +#ifdef HAVE_CONFIG_H +#include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +/* A simple test, just displaying datetime in its default format */ + +static void +_changed_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("Datetime value is changed\n"); +} + +void +test_datetime(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *datetime; + time_t t; + struct tm time1; + + win = elm_win_util_standard_add("datetime", "DateTime"); + elm_win_autodel_set(win, 1); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + elm_box_horizontal_set(bx, EINA_FALSE); + evas_object_show(bx); + evas_object_size_hint_min_set(bx, 360, 240); + + datetime = elm_datetime_add(bx); + evas_object_size_hint_weight_set(datetime, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(datetime, EVAS_HINT_FILL, 0.5); + elm_datetime_field_visible_set(datetime, ELM_DATETIME_HOUR, EINA_FALSE); + elm_datetime_field_visible_set(datetime, ELM_DATETIME_MINUTE, EINA_FALSE); + elm_datetime_field_visible_set(datetime, ELM_DATETIME_AMPM, EINA_FALSE); + elm_box_pack_end(bx, datetime); + evas_object_show(datetime); + + datetime = elm_datetime_add(bx); + evas_object_size_hint_weight_set(datetime, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(datetime, EVAS_HINT_FILL, 0.5); + elm_datetime_field_visible_set(datetime, ELM_DATETIME_YEAR, EINA_FALSE); + elm_datetime_field_visible_set(datetime, ELM_DATETIME_MONTH, EINA_FALSE); + elm_datetime_field_visible_set(datetime, ELM_DATETIME_DATE, EINA_FALSE); + elm_box_pack_end(bx, datetime); + evas_object_show(datetime); + + datetime = elm_datetime_add(bx); + evas_object_size_hint_weight_set(datetime, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(datetime, EVAS_HINT_FILL, 0.5); + + // get the current local time + t = time(NULL); + localtime_r(&t, &time1); + // set the max year as 2030 and the remaining fields are equal to current time values + time1.tm_year = 130; + elm_datetime_value_max_set(datetime, &time1); + // set the min time limit as "1980 January 10th 02:30 PM" + time1.tm_year = 80; + time1.tm_mon = 4; + time1.tm_mday = 10; + time1.tm_hour = 14; + time1.tm_min = 30; + elm_datetime_value_min_set(datetime, &time1); + // minutes can be input only in between 15 and 45 + elm_datetime_field_limit_set(datetime, ELM_DATETIME_MINUTE, 15, 45); + evas_object_smart_callback_add(datetime, "changed", _changed_cb, datetime); + elm_box_pack_end(bx, datetime); + evas_object_show(datetime); + + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_dayselector.c b/libraries/elementary/src/bin/test_dayselector.c new file mode 100644 index 0000000..7d5fc55 --- /dev/null +++ b/libraries/elementary/src/bin/test_dayselector.c @@ -0,0 +1,90 @@ +#ifdef HAVE_CONFIG_H +#include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static void _changed_cb(void* data __UNUSED__, Evas_Object* obj, void* event_info) +{ + char buf[256]; + Elm_Dayselector_Day day = (Elm_Dayselector_Day) event_info; + Eina_Bool checked = elm_dayselector_day_selected_get(obj, day); + + switch(day) + { + case ELM_DAYSELECTOR_SUN: + snprintf(buf, sizeof(buf), "%s", "Sun"); + break; + case ELM_DAYSELECTOR_MON: + snprintf(buf, sizeof(buf), "%s", "Mon"); + break; + case ELM_DAYSELECTOR_TUE: + snprintf(buf, sizeof(buf), "%s", "Tue"); + break; + case ELM_DAYSELECTOR_WED: + snprintf(buf, sizeof(buf), "%s", "Wed"); + break; + case ELM_DAYSELECTOR_THU: + snprintf(buf, sizeof(buf), "%s", "Thu"); + break; + case ELM_DAYSELECTOR_FRI: + snprintf(buf, sizeof(buf), "%s", "Fri"); + break; + case ELM_DAYSELECTOR_SAT: + snprintf(buf, sizeof(buf), "%s", "Sat"); + break; + default: + snprintf(buf, sizeof(buf), "%s", "???"); + break; + } + fprintf(stderr, "%s = %d\n", buf, checked); +} + +void +test_dayselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *dayselector, *sunday; + + win = elm_win_util_standard_add("dayselector", "Day Selector"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + elm_win_resize_object_add(win, bx); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bx); + + // Default + dayselector = elm_dayselector_add(win); + evas_object_size_hint_weight_set(dayselector, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(dayselector, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, dayselector); + evas_object_show(dayselector); + evas_object_smart_callback_add(dayselector, "dayselector,changed", _changed_cb, NULL); + + //Sunday first + dayselector = elm_dayselector_add(win); + evas_object_size_hint_weight_set(dayselector, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(dayselector, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, dayselector); + evas_object_show(dayselector); + evas_object_smart_callback_add(dayselector, "dayselector,changed", _changed_cb, NULL); + sunday = elm_object_part_content_get(dayselector, "day0"); + elm_object_signal_emit(sunday, "elm,type,weekend,style1", ""); + + //Monday first + dayselector = elm_dayselector_add(win); + evas_object_size_hint_weight_set(dayselector, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(dayselector, EVAS_HINT_FILL, 0.5); + elm_dayselector_week_start_set(dayselector, ELM_DAYSELECTOR_MON); + elm_box_pack_end(bx, dayselector); + evas_object_show(dayselector); + evas_object_smart_callback_add(dayselector, "dayselector,changed", _changed_cb, NULL); + sunday = elm_object_part_content_get(dayselector, "day0"); + elm_object_signal_emit(sunday, "elm,type,weekend,style1", ""); + + evas_object_resize(win, 350, 120); + evas_object_show(win); +} + +#endif diff --git a/libraries/elementary/src/bin/test_diskselector.c b/libraries/elementary/src/bin/test_diskselector.c new file mode 100644 index 0000000..d62dee4 --- /dev/null +++ b/libraries/elementary/src/bin/test_diskselector.c @@ -0,0 +1,353 @@ +#include "test.h" +#include +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +struct _api_data +{ + unsigned int state; /* What state we are testing */ + void *box; /* Use this to get box content */ +}; +typedef struct _api_data api_data; + +enum _api_state +{ + SCROLLER_POLICY_SET_ON, + SCROLLER_POLICY_SET_OFF, + BOUNCE_SET, + ITEM_LABEL_SET, + TOOLTIP_TEXT_SET, + ITEM_TOOLTIP_UNSET, + ITEM_CURSOR_SET, + ITEM_CURSOR_UNSET, + ITEM_ICON_SET, + SELECTED_SET, + ITEM_PREV_GET, + ITEM_DEL_NOT_SELECTED, + ITEM_DEL, /* delete when selected */ + CLEAR, + API_STATE_LAST +}; +typedef enum _api_state api_state; + +static void +set_api_state(api_data *api) +{ + const Eina_List *disks = elm_box_children_get(api->box); + if (!eina_list_count(disks)) + return; + + switch(api->state) + { /* Put all api-changes under switch */ + case SCROLLER_POLICY_SET_ON: /* 0 */ + { /* Get first disk */ + Evas_Object *disk = eina_list_nth(disks, 0); + elm_diskselector_scroller_policy_set(disk, ELM_SCROLLER_POLICY_ON, ELM_SCROLLER_POLICY_ON); + } + break; + + case SCROLLER_POLICY_SET_OFF: /* 1 */ + { /* Get first disk */ + Evas_Object *disk = eina_list_nth(disks, 0); + elm_diskselector_scroller_policy_set(disk, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + } + break; + + case BOUNCE_SET: /* 2 */ + { /* Get second disk, cancel bounce */ + Evas_Object *disk = eina_list_nth(disks, 1); + elm_diskselector_bounce_set(disk, EINA_FALSE, EINA_FALSE); + } + break; + + case ITEM_LABEL_SET: /* 3 */ + elm_object_item_text_set(elm_diskselector_selected_item_get(eina_list_nth(disks, 0)), "Label from API"); + break; + + case TOOLTIP_TEXT_SET: /* 4 */ + elm_object_item_tooltip_text_set(elm_diskselector_selected_item_get(eina_list_nth(disks, 0)), "Tooltip from API"); + break; + + case ITEM_TOOLTIP_UNSET: /* 5 */ + elm_object_item_tooltip_unset(elm_diskselector_selected_item_get(eina_list_nth(disks, 0))); + break; + + case ITEM_CURSOR_SET: /* 6 */ + elm_object_item_cursor_set(elm_diskselector_selected_item_get(eina_list_nth(disks, 0)), ELM_CURSOR_HAND2); + break; + + case ITEM_CURSOR_UNSET: /* 7 */ + elm_object_item_cursor_unset(elm_diskselector_selected_item_get(eina_list_nth(disks, 0))); + break; + + case ITEM_ICON_SET: /* 8 */ + { /* Set icon of selected item in first disk */ + char buf[PATH_MAX]; + Evas_Object *ic = elm_icon_add(elm_object_parent_widget_get(eina_list_nth(disks, 0))); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_object_item_part_content_set(elm_diskselector_selected_item_get(eina_list_nth(disks, 0)), NULL, ic); + evas_object_show(ic); + } + break; + + case SELECTED_SET: /* 9 */ + { /* Select NEXT item of third disk */ + elm_diskselector_item_selected_set(elm_diskselector_last_item_get(eina_list_nth(disks, 1)), EINA_TRUE); + elm_diskselector_item_selected_set(elm_diskselector_item_next_get(elm_diskselector_selected_item_get(eina_list_nth(disks, 2))), EINA_TRUE); + } + break; + + case ITEM_PREV_GET: /* 10 */ + { /* Select PREV item of third disk */ + elm_diskselector_item_selected_set(elm_diskselector_item_prev_get(elm_diskselector_selected_item_get(eina_list_nth(disks, 2))), EINA_TRUE); + } + break; + + case ITEM_DEL_NOT_SELECTED: /* 11 */ + { /* Remove selected item of third disk */ + elm_object_item_del(elm_diskselector_item_prev_get(elm_diskselector_selected_item_get(eina_list_nth(disks, 2)))); + } + break; + + case ITEM_DEL: /* 12 */ + { /* Remove selected item of first disk */ + elm_object_item_del(elm_diskselector_selected_item_get(eina_list_nth(disks, 1))); + } + break; + + case CLEAR: /* 13 */ + elm_diskselector_clear(eina_list_nth(disks, 0)); + break; + + default: + return; + } +} + +static void +_api_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ /* Will add here a SWITCH command containing code to modify test-object */ + /* in accordance a->state value. */ + api_data *a = data; + char str[128]; + + printf("clicked event on API Button: api_state=<%d>\n", a->state); + set_api_state(a); + a->state++; + sprintf(str, "Next API function (%u)", a->state); + elm_object_text_set(obj, str); + elm_object_disabled_set(obj, a->state == API_STATE_LAST); +} + +static void +_disk_sel(void *data __UNUSED__, Evas_Object * obj __UNUSED__, void *event_info) +{ + Elm_Object_Item *ds_it = event_info; + printf("Equinox: %s\n", elm_object_item_text_get(ds_it)); +} + +static void +_disk_next(void *data __UNUSED__, Evas_Object * obj __UNUSED__, void *event_info) +{ + Elm_Object_Item *next_ds_it, *prev_ds_it, *ds_it = event_info; + prev_ds_it = elm_diskselector_item_prev_get(ds_it); + next_ds_it = elm_diskselector_item_next_get(ds_it); + printf("Prev: %s, Next: %s\n", elm_object_item_text_get(prev_ds_it), + elm_object_item_text_get(next_ds_it)); +} + +static void +_print_disk_info_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Object_Item *ds_it = event_info; + printf("Selected label: %s\n", elm_object_item_text_get(ds_it)); +} + +static Evas_Object * +_disk_create(Evas_Object *win, Eina_Bool rnd) +{ + Elm_Object_Item *ds_it; + Evas_Object *di; + + di = elm_diskselector_add(win); + + elm_diskselector_item_append(di, "January", NULL, NULL, NULL); + elm_diskselector_item_append(di, "February", NULL, _disk_next, NULL); + elm_diskselector_item_append(di, "March", NULL, _disk_sel, NULL); + elm_diskselector_item_append(di, "April", NULL, NULL, NULL); + elm_diskselector_item_append(di, "May", NULL, NULL, NULL); + elm_diskselector_item_append(di, "June", NULL, NULL, NULL); + elm_diskselector_item_append(di, "July", NULL, NULL, NULL); + ds_it = elm_diskselector_item_append(di, "August", NULL, NULL, NULL); + elm_diskselector_item_append(di, "September", NULL, _disk_sel, NULL); + elm_diskselector_item_append(di, "October", NULL, NULL, NULL); + elm_diskselector_item_append(di, "November", NULL, NULL, NULL); + elm_diskselector_item_append(di, "December", NULL, NULL, NULL); + + elm_diskselector_item_selected_set(ds_it, EINA_TRUE); + elm_diskselector_round_enabled_set(di, rnd); + + return di; +} + +static void +_cleanup_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + free(data); +} + +void +test_diskselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *disk, *ic, *bxx, *bt; + Elm_Object_Item *ds_it; + char buf[PATH_MAX]; + api_data *api = calloc(1, sizeof(api_data)); + int idx = 0; + + char *month_list[] = { + "Jan", "Feb", "Mar", + "Apr", "May", "Jun", + "Jul", "Aug", "Sep", + "Oct", "Nov", "Dec" + }; + char date[3]; + + win = elm_win_util_standard_add("diskselector", "Disk Selector"); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api); + + bxx = elm_box_add(win); + elm_win_resize_object_add(win, bxx); + evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bxx); + + bx = elm_box_add(win); + elm_win_resize_object_add(win, bx); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + api->box = bx; + evas_object_show(bx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Next API function"); + evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api); + elm_box_pack_end(bxx, bt); + elm_object_disabled_set(bt, api->state == API_STATE_LAST); + evas_object_show(bt); + + elm_box_pack_end(bxx, bx); + + disk = _disk_create(win, EINA_TRUE); + evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, disk); + evas_object_show(disk); + evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL); + ds_it = elm_diskselector_selected_item_get(disk); + elm_diskselector_item_selected_set(ds_it, EINA_FALSE); + + disk = _disk_create(win, EINA_FALSE); + evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, disk); + evas_object_show(disk); + evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL); + ds_it = elm_diskselector_first_item_get(disk); + ds_it = elm_diskselector_item_next_get(ds_it); + elm_diskselector_item_selected_set(ds_it, EINA_TRUE); + + disk = _disk_create(win, EINA_FALSE); + evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, disk); + evas_object_show(disk); + evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL); + elm_diskselector_side_text_max_length_set(disk, 4); + + disk = elm_diskselector_add(win); + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 1, 1); + elm_diskselector_item_append(disk, "Sunday", ic, NULL, NULL); + elm_diskselector_item_append(disk, "Monday", NULL, NULL, NULL); + elm_diskselector_item_append(disk, "Tuesday", NULL, NULL, NULL); + elm_diskselector_item_append(disk, "Wednesday", NULL, NULL, NULL); + elm_diskselector_item_append(disk, "Thursday", NULL, NULL, NULL); + elm_diskselector_item_append(disk, "Friday", NULL, NULL, NULL); + elm_diskselector_item_append(disk, "Saturday", NULL, NULL, NULL); + elm_diskselector_round_enabled_set(disk, EINA_TRUE); + evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, disk); + evas_object_show(disk); + evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL); + + disk = elm_diskselector_add(win); + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 1, 1); + elm_diskselector_item_append(disk, "머리스타일", ic, NULL, NULL); + elm_diskselector_item_append(disk, "プロが伝授する", NULL, NULL, NULL); + elm_diskselector_item_append(disk, "生上访要求政府", NULL, NULL, NULL); + elm_diskselector_item_append(disk, "English", NULL, NULL, NULL); + elm_diskselector_item_append(disk, "والشريعة", NULL, NULL, NULL); + elm_diskselector_item_append(disk, "עִבְרִית", NULL, NULL, NULL); + elm_diskselector_item_append(disk, "Grüßen", NULL, NULL, NULL); + elm_diskselector_round_enabled_set(disk, EINA_TRUE); + evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, disk); + evas_object_show(disk); + evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL); + + // displayed item number setting example + disk = elm_diskselector_add(win); + elm_diskselector_display_item_num_set(disk, 5); + printf("Number of Items in DiskSelector : %d\n", + elm_diskselector_display_item_num_get(disk)); + + for (idx = 0; idx < (int)(sizeof(month_list) / sizeof(month_list[0])); idx++) + { + ds_it = elm_diskselector_item_append(disk, month_list[idx], NULL, NULL, + NULL); + } + + elm_diskselector_item_selected_set(ds_it, EINA_TRUE); + elm_diskselector_round_enabled_set(disk, EINA_TRUE); + evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, disk); + evas_object_show(disk); + evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL); + + // displayed item number setting example + disk = elm_diskselector_add(win); + elm_diskselector_display_item_num_set(disk, 7); + printf("Number of Items in DiskSelector : %d\n", + elm_diskselector_display_item_num_get(disk)); + + for (idx = 1; idx < 31; idx++) + { + snprintf(date, sizeof(date), "%d", idx); + ds_it = elm_diskselector_item_append(disk, date, NULL, NULL, NULL); + } + + elm_diskselector_item_selected_set(ds_it, EINA_TRUE); + elm_diskselector_round_enabled_set(disk, EINA_TRUE); + evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, disk); + evas_object_show(disk); + evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL); + + evas_object_resize(win, 320, 480); + evas_object_show(win); +} + +#endif diff --git a/libraries/elementary/src/bin/test_eio.c b/libraries/elementary/src/bin/test_eio.c new file mode 100644 index 0000000..7e26a4c --- /dev/null +++ b/libraries/elementary/src/bin/test_eio.c @@ -0,0 +1,182 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#include + +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static Elm_Genlist_Item_Class it_eio; + +static clock_t st_time; +static clock_t en_time; +static struct tms st_cpu; +static struct tms en_cpu; + +static void _sel_file(void *data, Evas_Object *obj, void *event_info); +static Eina_Bool _ls_filter_cb(void *data, Eio_File *handler, const char *file); +static void _ls_main_cb(void *data, Eio_File *handler, const char *file); +static void _ls_done_cb(void *data, Eio_File *handler); +static void _ls_error_cb(void *data, Eio_File *handler, int error); +static void _file_chosen(void *data, Evas_Object *obj, void *event_info); +static char *_gl_text_get(void *data, Evas_Object *obj, const char *part); +static Evas_Object *_gl_content_get(void *data, Evas_Object *obj, const char *part); +static Eina_Bool _gl_state_get(void *data, Evas_Object *obj, const char *part); +static void _gl_del(void *data, Evas_Object *obj); +static void _test_eio_clear(void *data, Evas_Object *obj, void *event); + +static void +_sel_file(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ +} + +static Eina_Bool +_ls_filter_cb(void *data __UNUSED__, Eio_File *handler __UNUSED__, const char *file __UNUSED__) +{ + return EINA_TRUE; +} + +static int +_compare_cb(const void *data1, const void *data2) +{ + Elm_Object_Item *it = (Elm_Object_Item *)data1; + Elm_Object_Item *it2 = (Elm_Object_Item *)data2; + return strcoll(elm_object_item_data_get(it), + elm_object_item_data_get(it2)); +} + +static void +_ls_main_cb(void *data, Eio_File *handler __UNUSED__, const char *file) +{ + elm_genlist_item_sorted_insert(data, + &it_eio, + eina_stringshare_add(file), + NULL, + ELM_GENLIST_ITEM_NONE, + _compare_cb, + _sel_file, + NULL); +} + +static void +_ls_done_cb(void *data __UNUSED__, Eio_File *handler __UNUSED__) +{ + en_time = times(&en_cpu); + fprintf(stderr, "ls done\n"); + fprintf(stderr, "Real Time: %.jd, User Time: %.jd, System Time: %.jd\n", + (intmax_t)(en_time - st_time), + (intmax_t)(en_cpu.tms_utime - st_cpu.tms_utime), + (intmax_t)(en_cpu.tms_stime - st_cpu.tms_stime)); +} + +static void +_ls_error_cb(void *data __UNUSED__, Eio_File *handler __UNUSED__, int error) +{ + fprintf(stderr, "error: [%s]\n", strerror(error)); +} + +static void +_file_chosen(void *data, Evas_Object *obj __UNUSED__, void *event_info) +{ + const char *file = event_info; + if (file) + { + st_time = times(&st_cpu); + eio_file_ls(file, + _ls_filter_cb, + _ls_main_cb, + _ls_done_cb, + _ls_error_cb, + data); + } +} + +static char * +_gl_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ + char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), "Item # %s", (char*)data); + return strdup(buf); +} + +static Evas_Object * +_gl_content_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ + return NULL; +} + +static Eina_Bool +_gl_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ + return EINA_FALSE; +} + +static void +_gl_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__) +{ +} + +static void +_test_eio_clear(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__) +{ + elm_genlist_clear(data); +} + +void +test_eio(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *vbox, *hbox, *ic, *bt, *fs_bt, *gl; + + it_eio.item_style = "default"; + it_eio.func.text_get = _gl_text_get; + it_eio.func.content_get = _gl_content_get; + it_eio.func.state_get = _gl_state_get; + it_eio.func.del = _gl_del; + + win = elm_win_util_standard_add("fileselector-button", "File Selector Button"); + elm_win_autodel_set(win, EINA_TRUE); + + vbox = elm_box_add(win); + elm_win_resize_object_add(win, vbox); + evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(vbox); + + gl = elm_genlist_add(win); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(vbox, gl); + evas_object_show(gl); + + /* file selector button */ + hbox = elm_box_add(win); + elm_box_horizontal_set(hbox, EINA_TRUE); + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "file"); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + fs_bt = elm_fileselector_button_add(win); + elm_object_text_set(fs_bt, "Select a dir"); + elm_object_part_content_set(fs_bt, "icon", ic); + elm_fileselector_button_inwin_mode_set(fs_bt, EINA_TRUE); + elm_fileselector_button_folder_only_set(fs_bt, EINA_TRUE); + + elm_box_pack_end(hbox, fs_bt); + elm_box_pack_end(vbox, hbox); + evas_object_show(fs_bt); + evas_object_show(ic); + + /* attribute setting buttons */ + bt = elm_button_add(win); + elm_object_text_set(bt, "clear"); + evas_object_smart_callback_add(bt, "clicked", _test_eio_clear, gl); + elm_box_pack_end(hbox, bt); + evas_object_show(bt); + evas_object_show(hbox); + + evas_object_smart_callback_add(fs_bt, "file,chosen", _file_chosen, gl); + + evas_object_resize(win, 300, 500); + evas_object_show(win); +} + +#endif diff --git a/libraries/elementary/src/bin/test_entry.c b/libraries/elementary/src/bin/test_entry.c new file mode 100644 index 0000000..3d786c6 --- /dev/null +++ b/libraries/elementary/src/bin/test_entry.c @@ -0,0 +1,2191 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +static void +my_entry_bt_1(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + elm_object_text_set(en, ""); +} + +static void +my_entry_bt_2(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + const char *s = elm_object_text_get(en); + printf("ENTRY:\n"); + if (s) printf("%s\n", s); + printf("ENTRY PLAIN UTF8:\n"); + if (s) + { + s = elm_entry_markup_to_utf8(s); + if (s) + { + printf("%s\n", s); + free((char *)s); + } + } +} + +static void +my_entry_bt_3(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + const char *s = elm_entry_selection_get(en); + printf("SELECTION:\n"); + if (s) printf("%s\n", s); + printf("SELECTION PLAIN UTF8:\n"); + if (s) + { + s = elm_entry_markup_to_utf8(s); + if (s) + { + printf("%s\n", s); + free((char *)s); + } + } +} + +static void +my_entry_bt_4(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + elm_entry_entry_insert(en, "Insert some BOLD text"); +} + +static void +my_entry_bt_5(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + elm_entry_scrollable_set(en, !elm_entry_scrollable_get(en)); +} + +static void +my_entry_bt_6(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + static Elm_Wrap_Type wr = ELM_WRAP_NONE; + + wr++; + if (wr == ELM_WRAP_LAST) wr = ELM_WRAP_NONE; + printf("wr: %i\n", wr); + elm_entry_line_wrap_set(en, wr); +} + +void +test_entry(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *bx2, *bt, *en; + char buf[4096]; + + win = elm_win_util_standard_add("entry", "Entry"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + en = elm_entry_add(win); + elm_entry_line_wrap_set(en, ELM_WRAP_NONE); + snprintf(buf, sizeof(buf), + "This is an entry widget in this window that
" + "uses markup like this for styling and
" + "formatting like this, as well as
" + "links in the text, so enter text
" + "in here to edit it. By the way, links are
" + "called Anchors so you will need
" + "to refer to them this way.
" + "
" + + "Also you can stick in items with (relsize + ascent): " + "" + " (full) " + "" + " (to the left)
" + + "Also (size + ascent): " + "" + " (full) " + "" + " (before this)
" + + "And as well (absize + ascent): " + "" + " (full) " + "" + " or even paths to image files on disk too like: " + "" + " ... end." + , elm_app_data_dir_get() + ); + elm_object_text_set(en, buf); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, en); + evas_object_show(en); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Clr"); + evas_object_smart_callback_add(bt, "clicked", my_entry_bt_1, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Prnt"); + evas_object_smart_callback_add(bt, "clicked", my_entry_bt_2, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Sel"); + evas_object_smart_callback_add(bt, "clicked", my_entry_bt_3, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Ins"); + evas_object_smart_callback_add(bt, "clicked", my_entry_bt_4, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Scrl"); + evas_object_smart_callback_add(bt, "clicked", my_entry_bt_5, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Wr"); + evas_object_smart_callback_add(bt, "clicked", my_entry_bt_6, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + elm_object_focus_set(en, EINA_TRUE); + evas_object_show(win); +} + +static void +my_scrolled_entry_bt_1(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + elm_object_text_set(en, ""); +} + +static void +my_scrolled_entry_bt_2(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + const char *s = elm_object_text_get(en); + printf("ENTRY:\n"); + if (s) printf("%s\n", s); + printf("ENTRY PLAIN UTF8:\n"); + if (s) + { + s = elm_entry_markup_to_utf8(s); + if (s) + { + printf("%s\n", s); + free((char *)s); + } + } +} + +static void +my_scrolled_entry_bt_3(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + const char *s = elm_entry_selection_get(en); + printf("SELECTION:\n"); + if (s) printf("%s\n", s); + printf("SELECTION PLAIN UTF8:\n"); + if (s) + { + s = elm_entry_markup_to_utf8(s); + if (s) + { + printf("%s\n", s); + free((char *)s); + } + } +} + +static void +my_scrolled_entry_bt_4(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + elm_entry_entry_insert(en, "Insert some BOLD text"); +} + +static void +my_scrolled_entry_bt_5(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + const char *s = elm_object_text_get(en); + printf("PASSWORD: '%s'\n", s ? s : ""); +} + +static void +scrolled_anchor_test(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + elm_entry_entry_insert(en, "ANCHOR CLICKED"); +} + +void +test_entry_scrolled(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *bx2, *bt, *en, *en_p, *sp; + static Elm_Entry_Filter_Accept_Set digits_filter_data, digits_filter_data2; + static Elm_Entry_Filter_Limit_Size limit_filter_data, limit_filter_data2; + + win = elm_win_util_standard_add("entry-scrolled", "Entry Scrolled"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + /* disabled entry */ + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); + elm_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + elm_object_text_set(en, "Disabled entry"); + elm_entry_single_line_set(en, EINA_TRUE); + elm_object_disabled_set(en, EINA_TRUE); + evas_object_show(en); + elm_box_pack_end(bx, en); + + /* password entry */ + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); + elm_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + elm_entry_password_set(en, EINA_TRUE); + elm_entry_single_line_set(en, EINA_TRUE); + elm_object_text_set(en, "Access denied, give up!"); + elm_object_disabled_set(en, EINA_TRUE); + evas_object_show(en); + elm_box_pack_end(bx, en); + + /* multi-line disable entry */ + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_ON, ELM_SCROLLER_POLICY_ON); + elm_object_disabled_set(en, EINA_TRUE); + elm_entry_context_menu_item_add(en, "Hello", NULL, ELM_ICON_NONE, NULL, NULL); + elm_entry_context_menu_item_add(en, "World", NULL, ELM_ICON_NONE, NULL, NULL); + elm_object_text_set(en, + "Multi-line disabled entry widget :)
" + "We can use markup like this for styling and
" + "formatting like this, as well as
" + "links in the text," + "but it won't be editable or clickable."); + evas_object_show(en); + elm_box_pack_end(bx, en); + + sp = elm_separator_add(win); + elm_separator_horizontal_set(sp, EINA_TRUE); + elm_box_pack_end(bx, sp); + evas_object_show(sp); + + /* Single line selected entry */ + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); + elm_object_text_set(en, "This is a single line"); + elm_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + elm_entry_single_line_set(en, EINA_TRUE); + elm_entry_select_all(en); + evas_object_show(en); + elm_box_pack_end(bx, en); + + /* Only digits entry */ + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); + elm_object_text_set(en, "01234"); + elm_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + elm_entry_single_line_set(en, EINA_TRUE); + evas_object_show(en); + elm_box_pack_end(bx, en); + + digits_filter_data.accepted = "0123456789"; + digits_filter_data.rejected = NULL; + elm_entry_markup_filter_append(en, elm_entry_filter_accept_set, &digits_filter_data); + + /* No digits entry */ + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); + elm_object_text_set(en, "No numbers here"); + elm_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + elm_entry_single_line_set(en, EINA_TRUE); + evas_object_show(en); + elm_box_pack_end(bx, en); + + digits_filter_data2.accepted = NULL; + digits_filter_data2.rejected = "0123456789"; + elm_entry_markup_filter_append(en, elm_entry_filter_accept_set, &digits_filter_data2); + + /* Size limited entry */ + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); + elm_object_text_set(en, "Just 20 chars"); + elm_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + elm_entry_single_line_set(en, EINA_TRUE); + evas_object_show(en); + elm_box_pack_end(bx, en); + + limit_filter_data.max_char_count = 20; + limit_filter_data.max_byte_count = 0; + elm_entry_markup_filter_append(en, elm_entry_filter_limit_size, &limit_filter_data); + + /* Byte size limited entry */ + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); + elm_object_text_set(en, "And now only 30 bytes"); + elm_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + elm_entry_single_line_set(en, EINA_TRUE); + evas_object_show(en); + elm_box_pack_end(bx, en); + + limit_filter_data2.max_char_count = 0; + limit_filter_data2.max_byte_count = 30; + elm_entry_markup_filter_append(en, elm_entry_filter_limit_size, &limit_filter_data2); + + /* Single line password entry */ + en_p = elm_entry_add(win); + elm_entry_scrollable_set(en_p, EINA_TRUE); + evas_object_size_hint_weight_set(en_p, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(en_p, EVAS_HINT_FILL, 0.5); + elm_entry_scrollbar_policy_set(en_p, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + elm_object_text_set(en_p, "Password here"); + elm_entry_single_line_set(en_p, EINA_TRUE); + elm_entry_password_set(en_p, EINA_TRUE); + evas_object_show(en_p); + elm_box_pack_end(bx, en_p); + + /* entry with icon/end widgets*/ + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + elm_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + elm_entry_single_line_set(en, EINA_TRUE); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + bt = elm_icon_add(win); + elm_icon_standard_set(bt, "home"); + evas_object_size_hint_min_set(bt, 48, 48); + evas_object_color_set(bt, 255, 0, 0, 128); + evas_object_show(bt); + elm_object_part_content_set(en, "icon", bt); + bt = elm_icon_add(win); + elm_icon_standard_set(bt, "delete"); + evas_object_color_set(bt, 255, 0, 0, 128); + evas_object_size_hint_min_set(bt, 48, 48); + evas_object_show(bt); + elm_object_part_content_set(en, "end", bt); + elm_object_text_set(en, "entry with icon and end objects"); + evas_object_show(en); + elm_box_pack_end(bx, en); + + /* markup entry */ + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_ON, ELM_SCROLLER_POLICY_ON); + elm_object_text_set(en, + "This is an entry widget in this window that
" + "uses markup like this for styling and
" + "formatting like this, as well as
" + "links in the text, so enter text
" + "in here to edit it. By them way, links are
" + "called Anchors so you will need
" + "to refer to them this way. At the end here is a really long " + "line to test line wrapping to see if it works. But just in " + "case this line is not long enough I will add more here to " + "really test it out, as Elementary really needs some " + "good testing to see if entry widgets work as advertised."); + evas_object_smart_callback_add(en, "anchor,clicked", scrolled_anchor_test, en); + evas_object_show(en); + elm_box_pack_end(bx, en); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Clear"); + evas_object_smart_callback_add(bt, "clicked", my_scrolled_entry_bt_1, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Print"); + evas_object_smart_callback_add(bt, "clicked", my_scrolled_entry_bt_2, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Print pwd"); + evas_object_smart_callback_add(bt, "clicked", my_scrolled_entry_bt_5, en_p); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Selection"); + evas_object_smart_callback_add(bt, "clicked", my_scrolled_entry_bt_3, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Insert"); + evas_object_smart_callback_add(bt, "clicked", my_scrolled_entry_bt_4, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + evas_object_resize(win, 320, 300); + + elm_object_focus_set(win, EINA_TRUE); + evas_object_show(win); +} + +static void +my_ent_bt_clr(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + elm_object_text_set(en, ""); +} + +static void +my_ent_bt_pri(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + const char *s = elm_object_text_get(en); + printf("ENTRY:\n"); + if (s) printf("%s\n", s); + printf("ENTRY PLAIN UTF8:\n"); + if (s) + { + s = elm_entry_markup_to_utf8(s); + if (s) + { + printf("%s\n", s); + free((char *)s); + } + } +} + +static void +my_ent_bt_sel(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + const char *s = elm_entry_selection_get(en); + printf("SELECTION:\n"); + if (s) printf("%s\n", s); + printf("SELECTION PLAIN UTF8:\n"); + if (s) + { + s = elm_entry_markup_to_utf8(s); + if (s) + { + printf("%s\n", s); + free((char *)s); + } + } +} + +static void +my_ent_bt_all(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + elm_entry_select_all(en); +} + +static void +my_ent_bt_non(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + elm_entry_select_none(en); +} + +static void +my_ent_bt_ins(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + elm_entry_entry_insert(en, "Insert text"); +} + +static void +my_ent_bt_lef(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + elm_entry_cursor_prev(en); +} + +static void +my_ent_bt_rig(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + elm_entry_cursor_next(en); +} + +static void +my_ent_bt_up_(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + elm_entry_cursor_up(en); +} + +static void +my_ent_bt_dow(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + elm_entry_cursor_down(en); +} + +static void +my_ent_bt_beg(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + elm_entry_cursor_begin_set(en); +} + +static void +my_ent_bt_end(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + elm_entry_cursor_end_set(en); +} + +static void +my_ent_bt_lbe(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + elm_entry_cursor_line_begin_set(en); +} + +static void +my_ent_bt_len(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + elm_entry_cursor_line_end_set(en); +} + +static void +my_ent_bt_sbe(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + elm_entry_cursor_selection_begin(en); +} + +static void +my_ent_bt_sen(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + elm_entry_cursor_selection_end(en); +} + +static void +my_ent_bt_fmt(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + printf("IS FORMAT: %i\n", + (int)elm_entry_cursor_is_format_get(en)); +} + +static void +my_ent_bt_vfm(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + printf("IS VISIBLE FORMAT %i\n", + (int)elm_entry_cursor_is_visible_format_get(en)); +} + +static void +my_ent_bt_chr(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + printf("CHAR '%s'\n", elm_entry_cursor_content_get(en)); +} + +static void +my_ent_bt_cut(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + elm_entry_selection_cut(en); +} + +static void +my_ent_bt_cop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + elm_entry_selection_copy(en); +} + +static void +my_ent_bt_pas(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + elm_entry_selection_paste(en); +} + +void +test_entry3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *bx2, *bt, *en; + + win = elm_win_util_standard_add("entry3", "Entry 3"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + /* Single line selected entry */ + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); + elm_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + elm_object_text_set(en, "This is a single line"); + elm_entry_single_line_set(en, EINA_TRUE); + elm_box_pack_end(bx, en); + evas_object_show(en); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Clr"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_clr, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Pri"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_pri, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Sel"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_sel, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "All"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_all, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Non"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_non, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Ins"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_ins, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Lef"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_lef, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Rig"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_rig, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Up "); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_up_, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Dow"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_dow, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Beg"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_beg, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "End"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_end, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "LBe"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_lbe, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "LEn"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_len, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "SBe"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_sbe, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "SEn"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_sen, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Fmt"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_fmt, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "VFm"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_vfm, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Chr"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_chr, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Cut"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_cut, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Cop"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_cop, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Pas"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_pas, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + /* markup entry */ + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(en, + "This is an entry widget in this window that
" + "uses markup like this for styling and
" + "formatting like this, as well as
" + "links in the text, so enter text
" + "in here to edit it. By them way, links are
" + "called Anchors so you will need
" + "to refer to them this way. At the end here is a really long " + "line to test line wrapping to see if it works. But just in " + "case this line is not long enough I will add more here to " + "really test it out, as Elementary really needs some " + "good testing to see if entry widgets work as advertised." + ); + evas_object_smart_callback_add(en, "anchor,clicked", scrolled_anchor_test, en); + elm_box_pack_end(bx, en); + evas_object_show(en); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Clr"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_clr, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Pri"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_pri, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Sel"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_sel, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "All"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_all, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Non"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_non, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Ins"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_ins, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Lef"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_lef, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Rig"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_rig, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Up "); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_up_, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Dow"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_dow, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Beg"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_beg, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "End"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_end, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "LBe"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_lbe, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "LEn"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_len, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "SBe"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_sbe, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "SEn"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_sen, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Fmt"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_fmt, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "VFm"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_vfm, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Chr"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_chr, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Cut"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_cut, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Cop"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_cop, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Pas"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_pas, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + evas_object_resize(win, 320, 480); + + elm_object_focus_set(win, EINA_TRUE); + evas_object_show(win); +} + +void +test_entry4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *ly, *en; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("entry4", "Entry 4"); + elm_win_autodel_set(win, EINA_TRUE); + + ly = elm_layout_add(win); + snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get()); + elm_layout_file_set(ly, buf, "layout"); + evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, ly); + evas_object_show(ly); + + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); + elm_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + elm_object_text_set(en, "This is a single line"); + elm_entry_single_line_set(en, EINA_TRUE); + elm_object_part_content_set(ly, "element1", en); + evas_object_show(en); + + en = elm_entry_add(win); + elm_entry_line_wrap_set(en, ELM_WRAP_NONE); + elm_object_text_set(en, + "This is an entry widget
" + "that uses markup
" + "like this and has
" + "no scroller, so you can
" + "use it more flexibly."); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_part_content_set(ly, "element2", en); + evas_object_show(en); + + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(en, + "This is an entry widget in this window that
" + "uses markup like this for styling and
" + "formatting like this, as well as
" + "links in the text, so enter text
" + "in here to edit it. By them way, links are
" + "called Anchors so you will need
" + "to refer to them this way. At the end here is a really long " + "line to test line wrapping to see if it works. But just in " + "case this line is not long enough I will add more here to " + "really test it out, as Elementary really needs some " + "good testing to see if entry widgets work as advertised." + ); + evas_object_smart_callback_add(en, "anchor,clicked", scrolled_anchor_test, en); + elm_object_part_content_set(ly, "element3", en); + evas_object_show(en); + + evas_object_show(win); +} + +void +test_entry5(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *bx2, *bt, *en; + + win = elm_win_util_standard_add("entry5", "Entry 5"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + elm_entry_line_wrap_set(en, ELM_WRAP_CHAR); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(en, + "This is an entry widget in this window that " + "uses markup like this for styling and " + "formatting like this, as well as " + "to refer to them this way. At the end here is a really long " + "line to test line wrapping to see if it works. But just in " + "case this line is not long enough I will add more here to " + "really test it out, as Elementary really needs some " + "good testing to see if entry widgets work as advertised." + ); + evas_object_smart_callback_add(en, "anchor,clicked", scrolled_anchor_test, en); + elm_box_pack_end(bx, en); + evas_object_show(en); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Clr"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_clr, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Pri"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_pri, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Sel"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_sel, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "All"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_all, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Non"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_non, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Ins"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_ins, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Lef"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_lef, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Rig"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_rig, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Up "); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_up_, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Dow"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_dow, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Beg"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_beg, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "End"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_end, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "LBe"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_lbe, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "LEn"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_len, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "SBe"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_sbe, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "SEn"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_sen, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Fmt"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_fmt, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "VFm"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_vfm, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Chr"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_chr, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Cut"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_cut, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Cop"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_cop, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Pas"); + evas_object_smart_callback_add(bt, "clicked", my_ent_bt_pas, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_propagate_events_set(bt, 0); + elm_object_focus_allow_set(bt, 0); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + evas_object_resize(win, 320, 480); + + elm_object_focus_set(win, EINA_TRUE); + evas_object_show(win); +} + +void +test_entry6(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *en; + + win = elm_win_util_standard_add("entry6", "Entry 6"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + elm_entry_line_wrap_set(en, ELM_WRAP_CHAR); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(en, + "input_panel_enabled: TRUE.
" + "When this entry gets a focus, virtual keyboard will be shown " + "in illume environment."); + elm_box_pack_end(bx, en); + evas_object_show(en); + + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + elm_entry_line_wrap_set(en, ELM_WRAP_CHAR); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(en, + "input_panel_enabled: FALSE.
" + "This entry doesn't allow to show virtual keyboard automatically.
" + "it is used in case that wants its own keypad such as calculator."); + elm_entry_input_panel_enabled_set(en, EINA_FALSE); + elm_box_pack_end(bx, en); + evas_object_show(en); + + evas_object_resize(win, 320, 300); + + elm_object_focus_set(win, EINA_TRUE); + evas_object_show(win); +} + +static void +changed_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *en; + en = (Evas_Object*)data; + + elm_entry_editable_set(en, elm_check_state_get(obj)); +} + +static void +en_changed_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *sp, *en; + sp = (Evas_Object *)data; + en = (Evas_Object *)obj; + elm_spinner_min_max_set(sp, 0, strlen(elm_object_text_get(en))); +} + +static void +sp_changed_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *en, *sp; + en = (Evas_Object *)data; + sp = (Evas_Object *)obj; + elm_entry_cursor_pos_set(en, elm_spinner_value_get(sp)); + elm_object_focus_set(en, EINA_TRUE); +} + +static void +add_bt_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en; + en = (Evas_Object *)data; + + elm_entry_context_menu_item_add(en, "item", NULL, ELM_ICON_NONE, NULL, NULL); +} + +static void +clear_bt_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en; + en = (Evas_Object *)data; + + elm_entry_context_menu_clear(en); +} + +static Evas_Object * +item_provider(void *images __UNUSED__, Evas_Object *en, const char *item) +{ + Evas_Object *o = NULL;; + char buf[1024]; + + if (!strcmp(item, "itemprovider")) + { + snprintf(buf, sizeof(buf), "%s/images/icon_00.png", + elm_app_data_dir_get()); + o = evas_object_image_filled_add(evas_object_evas_get(en)); + evas_object_image_file_set(o, buf, NULL); + } + + return o; +} + +static Evas_Object * +prepend_item_provider(void *images __UNUSED__, Evas_Object *en, const char *item) +{ + Evas_Object *o = NULL;; + char buf[1024]; + + if (!strcmp(item, "itemprovider")) + { + snprintf(buf, sizeof(buf), "%s/images/icon_10.png", + elm_app_data_dir_get()); + o = evas_object_image_filled_add(evas_object_evas_get(en)); + evas_object_image_file_set(o, buf, NULL); + } + + return o; +} + +static void +prepend_bt_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en; + en = (Evas_Object *)data; + + elm_entry_item_provider_prepend(en, prepend_item_provider, NULL); + elm_object_text_set(en, + "Item Provider" + "" + ); +} + +static void +remove_bt_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en; + en = (Evas_Object *)data; + + elm_entry_item_provider_remove(en, item_provider, NULL); + elm_entry_item_provider_remove(en, prepend_item_provider, NULL); + elm_object_text_set(en, + "Item Provider" + "" + ); +} + +static void +enable_changed_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *en; + en = (Evas_Object*)data; + + elm_entry_context_menu_disabled_set(en, elm_check_state_get(obj)); +} + +void +test_entry7(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *gd, *bg, *en, *tg, *lb, *sp; + Evas_Object *bt, *en2; + + win = elm_win_util_standard_add("entry7", "Entry 7"); + elm_win_autodel_set(win, EINA_TRUE); + + gd = elm_grid_add(win); + elm_grid_size_set(gd, 100, 100); + evas_object_size_hint_weight_set(gd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, gd); + evas_object_show(gd); + + /* upper entry group */ + bg = elm_bg_add(win); + elm_bg_color_set(bg, 255, 0, 0); + elm_grid_pack(gd, bg, 10, 10, 60, 30); + evas_object_show(bg); + + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(en, "Editable, Cursor Positioin"); + evas_object_show(en); + elm_grid_pack(gd, en, 10, 10, 60, 30); + + tg = elm_check_add(win); + evas_object_size_hint_weight_set(tg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(tg, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(tg, "Editable"); + elm_check_state_set(tg, EINA_TRUE); + evas_object_smart_callback_add(tg, "changed", changed_cb, en); + elm_grid_pack(gd, tg, 70, 10, 22, 10); + evas_object_show(tg); + + lb = elm_label_add(win); + elm_object_text_set(lb, "Cursor position:"); + evas_object_size_hint_weight_set(lb, 0.0, 0.0); + evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_grid_pack(gd, lb, 70, 25, 25, 5); + evas_object_show(lb); + + sp = elm_spinner_add(win); + elm_spinner_label_format_set(sp, "%1.0f"); + elm_spinner_step_set(sp, 1); + elm_spinner_wrap_set(sp, ELM_WRAP_CHAR); + elm_spinner_min_max_set(sp, 0, strlen(elm_object_text_get(en))); + evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_grid_pack(gd, sp, 70, 30, 25, 10); + evas_object_smart_callback_add(en, "changed", en_changed_cb, sp); + evas_object_smart_callback_add(sp, "delay,changed", sp_changed_cb, en); + evas_object_show(sp); + + /* bottom entry group */ + bg = elm_bg_add(win); + elm_bg_color_set(bg, 0, 255, 0); + elm_grid_pack(gd, bg, 10, 50, 45, 30); + evas_object_show(bg); + + en2 = elm_entry_add(win); + elm_entry_scrollable_set(en2, EINA_TRUE); + evas_object_size_hint_weight_set(en2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en2, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(en2, + "Item Provider" + "" + ); + elm_entry_item_provider_append(en2, item_provider, NULL); + elm_entry_context_menu_disabled_set(en, EINA_TRUE); + elm_grid_pack(gd, en2, 10, 50, 45, 30); + evas_object_show(en2); + + tg = elm_check_add(win); + evas_object_size_hint_weight_set(tg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(tg, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(tg, "Disable Context Menu"); + elm_check_state_set(tg, EINA_TRUE); + evas_object_smart_callback_add(tg, "changed", enable_changed_cb, en2); + elm_grid_pack(gd, tg, 55, 50, 40, 10); + evas_object_show(tg); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Add Context Menu"); + elm_grid_pack(gd, bt, 55, 60, 40, 10); + evas_object_smart_callback_add(bt, "clicked", add_bt_clicked, en2); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Clear Context Menu"); + elm_grid_pack(gd, bt, 55, 70, 40, 10); + evas_object_smart_callback_add(bt, "clicked", clear_bt_clicked, en2); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Prepend Item Provider"); + elm_grid_pack(gd, bt, 10, 80, 45, 10); + evas_object_smart_callback_add(bt, "clicked", prepend_bt_clicked, en2); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Remove Item Provider"); + elm_grid_pack(gd, bt, 55, 80, 40, 10); + evas_object_smart_callback_add(bt, "clicked", remove_bt_clicked, en2); + evas_object_show(bt); + + evas_object_resize(win, 320, 320); + evas_object_show(win); +} + +static void +filter_prepend_bt_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en, *en2; + static Elm_Entry_Filter_Accept_Set digits_filter_data; + + en = (Evas_Object *)data; + en2 = evas_object_data_get(en, "filter-entry"); + digits_filter_data.accepted = elm_object_text_get(en2); + digits_filter_data.rejected = NULL; + + elm_entry_markup_filter_append(en, elm_entry_filter_accept_set, + &digits_filter_data); + elm_object_text_set(en, "Markup Filter Prepend Test:"); +} + +static void +filter_remove_bt_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en; + en = (Evas_Object *)data; + + elm_entry_markup_filter_remove(en, elm_entry_filter_accept_set, NULL); + elm_object_text_set(en, "Markup Filter Prepend Test:"); +} + +static void +icon_visible_changed_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *en; + en = (Evas_Object*)data; + + elm_entry_icon_visible_set(en, elm_check_state_get(obj)); +} + +static void +end_visible_changed_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *en; + en = (Evas_Object*)data; + + elm_entry_end_visible_set(en, elm_check_state_get(obj)); +} + +static void +horizontal_bounce_changed_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *en; + Eina_Bool vb; + Eina_Bool bounce = elm_check_state_get(obj); + en = (Evas_Object*)data; + + elm_entry_bounce_get(en, NULL, &vb); + elm_entry_bounce_set(en, bounce, bounce); +} + +static void +vertical_bounce_changed_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *en; + Eina_Bool hb; + Eina_Bool bounce = elm_check_state_get(obj); + en = (Evas_Object*)data; + + elm_entry_bounce_get(en, &hb, NULL); + elm_entry_bounce_set(en, hb, bounce); +} + +void +test_entry8(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *gd, *rect, *en, *lb; + Evas_Object *bt, *en2; + Evas_Object *ch, *en3, *bx; + Evas_Object *en4; + static Elm_Entry_Filter_Limit_Size limit_filter_data; + + win = elm_win_util_standard_add("entry8", "Entry 8"); + elm_win_autodel_set(win, EINA_TRUE); + + gd = elm_grid_add(win); + elm_grid_size_set(gd, 100, 100); + elm_win_resize_object_add(win, gd); + evas_object_size_hint_weight_set(gd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(gd); + + rect = evas_object_rectangle_add(evas_object_evas_get(win)); + elm_grid_pack(gd, rect, 5, 5, 90, 10); + evas_object_color_set(rect, 125, 125, 255, 255); + evas_object_show(rect); + + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + elm_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(en, "Markup Filter Prepend Test"); + elm_grid_pack(gd, en, 5, 5, 90, 10); + evas_object_show(en); + + lb = elm_label_add(win); + elm_object_text_set(lb, "Markup Filter (20 Characters):"); + evas_object_size_hint_weight_set(lb, 0.0, 0.0); + evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_grid_pack(gd, lb, 5, 15, 50, 10); + evas_object_show(lb); + + rect = evas_object_rectangle_add(evas_object_evas_get(win)); + elm_grid_pack(gd, rect, 55, 15, 40, 10); + evas_object_color_set(rect, 0, 125, 255, 255); + evas_object_show(rect); + + en2 = elm_entry_add(win); + elm_entry_scrollable_set(en2, EINA_TRUE); + elm_entry_scrollbar_policy_set(en2, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + evas_object_size_hint_weight_set(en2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en2, EVAS_HINT_FILL, EVAS_HINT_FILL); + limit_filter_data.max_char_count = 20; + limit_filter_data.max_byte_count = 0; + elm_entry_markup_filter_append(en2, elm_entry_filter_limit_size, &limit_filter_data); + evas_object_data_set(en, "filter-entry", en2); + evas_object_show(en2); + elm_grid_pack(gd, en2, 55, 15, 40, 10); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Markup Filter Prepend"); + elm_grid_pack(gd, bt, 5, 25, 45, 10); + evas_object_smart_callback_add(bt, "clicked", filter_prepend_bt_clicked, en); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Markup Filter Remove"); + elm_grid_pack(gd, bt, 50, 25, 45, 10); + evas_object_smart_callback_add(bt, "clicked", filter_remove_bt_clicked, en); + evas_object_show(bt); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + en3 = elm_entry_add(win); + elm_entry_scrollable_set(en3, EINA_TRUE); + elm_entry_scrollbar_policy_set(en3, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + elm_entry_single_line_set(en3, EINA_TRUE); + evas_object_size_hint_weight_set(en3, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en3, EVAS_HINT_FILL, EVAS_HINT_FILL); + + elm_box_pack_end(bx, en3); + evas_object_show(en3); + elm_grid_pack(gd, bx, 5, 35, 90, 20); + + bt = elm_icon_add(win); + elm_icon_standard_set(bt, "home"); + evas_object_size_hint_min_set(bt, 48, 48); + evas_object_color_set(bt, 128, 0, 0, 128); + evas_object_show(bt); + elm_object_part_content_set(en3, "icon", bt); + + bt = elm_icon_add(win); + elm_icon_standard_set(bt, "delete"); + evas_object_color_set(bt, 128, 0, 0, 128); + evas_object_size_hint_min_set(bt, 48, 48); + evas_object_show(bt); + elm_object_part_content_set(en3, "end", bt); + + ch = elm_check_add(win); + evas_object_size_hint_weight_set(ch, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ch, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(ch, "Icon Visible"); + elm_check_state_set(ch, EINA_TRUE); + evas_object_smart_callback_add(ch, "changed", icon_visible_changed_cb, en3); + elm_grid_pack(gd, ch, 5, 55, 30, 10); + evas_object_show(ch); + + ch = elm_check_add(win); + evas_object_size_hint_weight_set(ch, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ch, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(ch, "End Visible"); + elm_check_state_set(ch, EINA_TRUE); + evas_object_smart_callback_add(ch, "changed", end_visible_changed_cb, en3); + elm_grid_pack(gd, ch, 70, 55, 25, 10); + evas_object_show(ch); + + rect = evas_object_rectangle_add(evas_object_evas_get(win)); + elm_grid_pack(gd, rect, 5, 65, 90, 20); + evas_object_color_set(rect, 255, 125, 125, 255); + evas_object_show(rect); + + en4 = elm_entry_add(win); + elm_object_part_text_set(en4, "guide", "Type in here"); + elm_entry_scrollable_set(en4, EINA_TRUE); + elm_entry_bounce_set(en4, EINA_TRUE, EINA_TRUE); + elm_entry_autocapital_type_set(en4, EINA_TRUE); + evas_object_size_hint_weight_set(en4, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en4, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_grid_pack(gd, en4, 5, 65, 90, 20); + evas_object_show(en4); + + ch = elm_check_add(win); + evas_object_size_hint_weight_set(ch, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ch, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(ch, "Horizontal Bounce Set"); + elm_check_state_set(ch, EINA_TRUE); + evas_object_smart_callback_add(ch, "changed", horizontal_bounce_changed_cb, en4); + elm_grid_pack(gd, ch, 5, 85, 45, 10); + evas_object_show(ch); + + ch = elm_check_add(win); + evas_object_size_hint_weight_set(ch, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ch, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(ch, "Vertical Bounce Set"); + elm_check_state_set(ch, EINA_TRUE); + evas_object_smart_callback_add(ch, "changed", vertical_bounce_changed_cb, en4); + elm_grid_pack(gd, ch, 50, 85, 45, 10); + evas_object_show(ch); + + evas_object_resize(win, 320, 320); + evas_object_show(win); +} + +static void +_scrolled_entry_clear(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + elm_object_text_set(en, ""); +} + +static void +_scrolled_entry_save(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *en = data; + elm_entry_file_save(en); +} + +static void +auto_save_changed_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *en; + en = (Evas_Object*)data; + + elm_entry_autosave_set(en, elm_check_state_get(obj)); +} + +void +test_entry_notepad(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *bx2, *bt, *np, *ch; + + win = elm_win_util_standard_add("entry-notepad", "Entry Notepad"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + np = elm_entry_add(win); + elm_entry_scrollable_set(np, EINA_TRUE); + elm_entry_file_set(np, "note.txt", ELM_TEXT_FORMAT_PLAIN_UTF8); + evas_object_size_hint_weight_set(np, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(np, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, np); + evas_object_show(np); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + elm_box_homogeneous_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Clear"); + evas_object_smart_callback_add(bt, "clicked", _scrolled_entry_clear, np); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Save"); + evas_object_smart_callback_add(bt, "clicked", _scrolled_entry_save, np); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + ch = elm_check_add(win); + evas_object_size_hint_weight_set(ch, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ch, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(ch, "Auto Save"); + elm_check_state_set(ch, EINA_FALSE); + evas_object_smart_callback_add(ch, "changed", auto_save_changed_cb, np); + elm_box_pack_end(bx2, ch); + evas_object_show(ch); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + evas_object_resize(win, 320, 300); + + elm_object_focus_set(win, EINA_TRUE); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_entry_anchor.c b/libraries/elementary/src/bin/test_entry_anchor.c new file mode 100644 index 0000000..759e06b --- /dev/null +++ b/libraries/elementary/src/bin/test_entry_anchor.c @@ -0,0 +1,237 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static void +_print_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("bubble clicked\n"); +} + +static void +my_entry_anchor_bt(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *av = data; + elm_entry_anchor_hover_end(av); +} + +static void +my_entry_anchor(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *av = data; + Elm_Entry_Anchor_Hover_Info *ei = event_info; + Evas_Object *bt, *bx; + + bt = elm_button_add(obj); + elm_object_text_set(bt, ei->anchor_info->name); + elm_object_part_content_set(ei->hover, "middle", bt); + evas_object_show(bt); + + // hints as to where we probably should put hover contents (buttons etc.). + if (ei->hover_top) + { + bx = elm_box_add(obj); + bt = elm_button_add(obj); + elm_object_text_set(bt, "Top 1"); + elm_box_pack_end(bx, bt); + evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av); + evas_object_show(bt); + bt = elm_button_add(obj); + elm_object_text_set(bt, "Top 2"); + elm_box_pack_end(bx, bt); + evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av); + evas_object_show(bt); + bt = elm_button_add(obj); + elm_object_text_set(bt, "Top 3"); + elm_box_pack_end(bx, bt); + evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av); + evas_object_show(bt); + elm_object_part_content_set(ei->hover, "top", bx); + evas_object_show(bx); + } + if (ei->hover_bottom) + { + bt = elm_button_add(obj); + elm_object_text_set(bt, "Bot"); + elm_object_part_content_set(ei->hover, "bottom", bt); + evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av); + evas_object_show(bt); + } + if (ei->hover_left) + { + bt = elm_button_add(obj); + elm_object_text_set(bt, "Left"); + elm_object_part_content_set(ei->hover, "left", bt); + evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av); + evas_object_show(bt); + } + if (ei->hover_right) + { + bt = elm_button_add(obj); + elm_object_text_set(bt, "Right"); + elm_object_part_content_set(ei->hover, "right", bt); + evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av); + evas_object_show(bt); + } +} + +static void +my_entry_anchor_edge_left(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("left\n"); +} + +static void +my_entry_anchor_edge_right(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("right\n"); +} + +static void +my_entry_anchor_edge_top(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("top\n"); +} + +static void +my_entry_anchor_edge_bottom(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("bottom\n"); +} + +static void +my_entry_anchor_scroll(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Coord x, y, w, h, vw, vh; + + elm_scroller_region_get(obj, &x, &y, &w, &h); + elm_scroller_child_size_get(obj, &vw, &vh); + printf("scroll %ix%i +%i+%i in %ix%i\n", w, h, x, y, vw, vh); +} + +void +test_entry_anchor(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *av, *sc, *bx, *bb, *ic; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("entry_anchor", "Anchorblock"); + elm_win_autodel_set(win, EINA_TRUE); + + sc = elm_scroller_add(win); + evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, sc); + + evas_object_smart_callback_add(sc, "edge_left", my_entry_anchor_edge_left, NULL); + evas_object_smart_callback_add(sc, "edge_right", my_entry_anchor_edge_right, NULL); + evas_object_smart_callback_add(sc, "edge_top", my_entry_anchor_edge_top, NULL); + evas_object_smart_callback_add(sc, "edge_bottom", my_entry_anchor_edge_bottom, NULL); + evas_object_smart_callback_add(sc, "scroll", my_entry_anchor_scroll, NULL); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1); + + bb = elm_bubble_add(win); + elm_object_text_set(bb, "Message 3"); + elm_object_part_text_set(bb, "info", "10:32 4/11/2008"); + elm_object_part_content_set(bb, "icon", ic); + evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL); + evas_object_show(ic); + evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL); + av = elm_entry_add(win); + elm_entry_anchor_hover_style_set(av, "popout"); + elm_entry_anchor_hover_parent_set(av, win); + elm_object_text_set(av, + "Hi there. This is the most recent message in the " + "list of messages. It has one +61 432 1234 " + "(phone number) to click on."); + evas_object_smart_callback_add(av, "anchor,hover,opened", + my_entry_anchor, av); + elm_object_content_set(bb, av); + evas_object_show(av); + elm_box_pack_end(bx, bb); + evas_object_show(bb); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + + bb = elm_bubble_add(win); + elm_object_text_set(bb, "Message 2"); + elm_object_part_text_set(bb, "info", "7:16 27/10/2008"); + elm_object_part_content_set(bb, "icon", ic); + evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL); + evas_object_show(ic); + evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL); + av = elm_entry_add(win); + elm_entry_anchor_hover_style_set(av, "popout"); + elm_entry_anchor_hover_parent_set(av, win); + elm_object_text_set(av, + "Hey what are you doing? This is the second last message " + "Hi there. This is the most recent message in the " + "list. It's a longer one so it can wrap more and " + "contains a John contact " + "link in it to test popups on links. The idea is that " + "all SMS's are scanned for things that look like phone " + "numbers or names that are in your contacts list, and " + "if they are, they become clickable links that pop up " + "a menus of obvious actions to perform on this piece " + "of information. This of course can be later explicitly " + "done by links maybe running local apps or even being " + "web URL's too that launch the web browser and point it " + "to that URL. "); + evas_object_smart_callback_add(av, "anchor,hover,opened", my_entry_anchor, av); + elm_object_content_set(bb, av); + evas_object_show(av); + elm_box_pack_end(bx, bb); + evas_object_show(bb); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1); + + bb = elm_bubble_add(win); + elm_object_text_set(bb, "Message 1"); + elm_object_part_text_set(bb, "info", "20:47 18/6/2008"); + elm_object_part_content_set(bb, "icon", ic); + evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL); + evas_object_show(ic); + evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL); + + av = elm_entry_add(win); + elm_entry_anchor_hover_style_set(av, "popout"); + elm_entry_anchor_hover_parent_set(av, win); + elm_object_text_set(av, "This is a short message. "); + evas_object_smart_callback_add(av, "anchor,hover,opened", + my_entry_anchor, av); + elm_object_content_set(bb, av); + evas_object_show(av); + elm_box_pack_end(bx, bb); + evas_object_show(bb); + + elm_object_content_set(sc, bx); + evas_object_show(bx); + + evas_object_show(sc); + + evas_object_resize(win, 320, 300); + + elm_object_focus_set(win, EINA_TRUE); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_entry_anchor2.c b/libraries/elementary/src/bin/test_entry_anchor2.c new file mode 100644 index 0000000..eb1762b --- /dev/null +++ b/libraries/elementary/src/bin/test_entry_anchor2.c @@ -0,0 +1,102 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +static void +my_entry_anchor_bt(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *av = data; + elm_entry_anchor_hover_end(av); +} + +static void +my_anchorview_anchor(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *av = data; + Elm_Entry_Anchor_Hover_Info *ei = event_info; + Evas_Object *bt, *bx; + + bt = elm_button_add(obj); + elm_object_text_set(bt, ei->anchor_info->name); + elm_object_part_content_set(ei->hover, "middle", bt); + evas_object_show(bt); + + // hints as to where we probably should put hover contents (buttons etc.). + if (ei->hover_top) + { + bx = elm_box_add(obj); + bt = elm_button_add(obj); + elm_object_text_set(bt, "Top 1"); + elm_box_pack_end(bx, bt); + evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av); + evas_object_show(bt); + bt = elm_button_add(obj); + elm_object_text_set(bt, "Top 2"); + elm_box_pack_end(bx, bt); + evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av); + evas_object_show(bt); + bt = elm_button_add(obj); + elm_object_text_set(bt, "Top 3"); + elm_box_pack_end(bx, bt); + evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av); + evas_object_show(bt); + elm_object_part_content_set(ei->hover, "top", bx); + evas_object_show(bx); + } + if (ei->hover_bottom) + { + bt = elm_button_add(obj); + elm_object_text_set(bt, "Bot"); + elm_object_part_content_set(ei->hover, "bottom", bt); + evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av); + evas_object_show(bt); + } + if (ei->hover_left) + { + bt = elm_button_add(obj); + elm_object_text_set(bt, "Left"); + elm_object_part_content_set(ei->hover, "left", bt); + evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av); + evas_object_show(bt); + } + if (ei->hover_right) + { + bt = elm_button_add(obj); + elm_object_text_set(bt, "Right"); + elm_object_part_content_set(ei->hover, "right", bt); + evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av); + evas_object_show(bt); + } +} + +void +test_entry_anchor2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *av; + + win = elm_win_util_standard_add("entry_anchor", "Anchorview"); + elm_win_autodel_set(win, EINA_TRUE); + + av = elm_entry_add(win); + elm_entry_anchor_hover_style_set(av, "popout"); + elm_entry_anchor_hover_parent_set(av, win); + elm_object_text_set(av, + "This is an entry widget in this window that
" + "uses markup like this for styling and
" + "formatting like this, as well as
" + "links in the text, so enter text
" + "in here to edit it. By the way, links are
" + "called Anchors so you will need
" + "to refer to them this way. "); + evas_object_size_hint_weight_set(av, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_smart_callback_add(av, "anchor,hover,opened", my_anchorview_anchor, av); + elm_win_resize_object_add(win, av); + evas_object_show(av); + + evas_object_resize(win, 320, 300); + + elm_object_focus_set(win, EINA_TRUE); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_factory.c b/libraries/elementary/src/bin/test_factory.c new file mode 100644 index 0000000..83fcd78 --- /dev/null +++ b/libraries/elementary/src/bin/test_factory.c @@ -0,0 +1,183 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +// 16 ^ 4 = 65k +#define BLOK 16 +// homogenous layout +//#define HOMOG 1 +// aligned to top of box +#define ZEROALIGN 1 +#define DEFSZ 64 + +static void +fac_unrealize(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + // setting factory content to null deletes it + printf("--------DELETE for factory %p [f: %p]\n", elm_object_content_get(obj), obj); + elm_object_content_set(obj, NULL); +} + +static void +fac_realize_end(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + Evas_Object *bx, *bt; + int i; + + bx = elm_box_add(win); + printf(" ADD lv 3 = %p [%i]\n", bx, (BLOK * (int)(long)evas_object_data_get(obj, "num"))); +#ifdef HOMOG + elm_box_homogeneous_set(bx, EINA_TRUE); +#endif +#ifdef ZEROALIGN + elm_box_align_set(bx, 0.0, 0.0); +#endif + + for (i = 0; i < BLOK; i++) + { + char buf[32]; + + snprintf(buf, sizeof(buf), "%i", + (i + (BLOK * (int)(long)evas_object_data_get(obj, "num")))); + + bt = elm_button_add(win); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(bt, buf); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + } + + elm_object_content_set(obj, bx); + evas_object_show(bx); +} + +static void +fac_realize2(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + Evas_Object *bx, *fc; + int i; + + bx = elm_box_add(win); + printf(" ADD lv 2 = %p [%i]\n", bx, (BLOK * (int)(long)evas_object_data_get(obj, "num"))); +#ifdef HOMOG + elm_box_homogeneous_set(bx, EINA_TRUE); +#endif +#ifdef ZEROALIGN + elm_box_align_set(bx, 0.0, 0.0); +#endif + + for (i = 0; i < BLOK; i++) + { + fc = elm_factory_add(win); + elm_factory_maxmin_mode_set(fc, EINA_TRUE); + // initial height per factory of DEFSZ + // scrollbar will be wrong until enough + // children have been realized and the + // real size is known + evas_object_data_set(fc, "num", (void *)(long)(i + (BLOK * (int)(long)evas_object_data_get(obj, "num")))); + evas_object_size_hint_min_set(fc, 0, DEFSZ); + evas_object_size_hint_weight_set(fc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(fc, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_smart_callback_add(fc, "realize", fac_realize_end, win); + evas_object_smart_callback_add(fc, "unrealize", fac_unrealize, win); + elm_box_pack_end(bx, fc); + evas_object_show(fc); + } + + elm_object_content_set(obj, bx); + evas_object_show(bx); +} + +static void +fac_realize1(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + Evas_Object *bx, *fc; + int i; + + bx = elm_box_add(win); + printf(" ADD lv 1 = %p [%i]\n", bx, (BLOK * (int)(long)evas_object_data_get(obj, "num"))); +#ifdef HOMOG + elm_box_homogeneous_set(bx, EINA_TRUE); +#endif +#ifdef ZEROALIGN + elm_box_align_set(bx, 0.0, 0.0); +#endif + + for (i = 0; i < BLOK; i++) + { + fc = elm_factory_add(win); + elm_factory_maxmin_mode_set(fc, EINA_TRUE); + // initial height per factory of DEFSZ + // scrollbar will be wrong until enough + // children have been realized and the + // real size is known + evas_object_data_set(fc, "num", (void *)(long)(i + (BLOK * (int)(long)evas_object_data_get(obj, "num")))); + evas_object_size_hint_min_set(fc, 0, DEFSZ); + evas_object_size_hint_weight_set(fc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(fc, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_smart_callback_add(fc, "realize", fac_realize2, win); +// evas_object_smart_callback_add(fc, "unrealize", fac_unrealize, win); + elm_box_pack_end(bx, fc); + evas_object_show(fc); + } + + elm_object_content_set(obj, bx); + evas_object_show(bx); +} + +void +test_factory(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *sc, *fc; + int i; + + win = elm_win_util_standard_add("factory", "Factory"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); +#ifdef HOMOG + elm_box_homogeneous_set(bx, EINA_TRUE); +#endif +#ifdef ZEROALIGN + elm_box_align_set(bx, 0.0, 0.0); +#endif + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0); + + for (i = 0; i < BLOK; i++) + { + fc = elm_factory_add(win); + elm_factory_maxmin_mode_set(fc, EINA_TRUE); + // initial height per factory of DEFSZ + // scrollbar will be wrong until enough + // children have been realized and the + // real size is known + evas_object_data_set(fc, "num", (void *)(long)i); + evas_object_size_hint_min_set(fc, 0, DEFSZ); + evas_object_size_hint_weight_set(fc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(fc, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_smart_callback_add(fc, "realize", fac_realize1, win); +// evas_object_smart_callback_add(fc, "unrealize", fac_unrealize, win); + elm_box_pack_end(bx, fc); + evas_object_show(fc); + } + + sc = elm_scroller_add(win); + elm_scroller_bounce_set(sc, EINA_FALSE, EINA_TRUE); + evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, sc); + + elm_object_content_set(sc, bx); + evas_object_show(bx); + + evas_object_show(sc); + + evas_object_resize(win, 320, 480); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_fileselector.c b/libraries/elementary/src/bin/test_fileselector.c new file mode 100644 index 0000000..0b2ce21 --- /dev/null +++ b/libraries/elementary/src/bin/test_fileselector.c @@ -0,0 +1,218 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + + +#include +#ifndef ENABLE_NLS +# ifndef setlocale +# define setlocale(c, l) +# endif +# ifndef libintl_setlocale +# define libintl_setlocale(c, l) +# endif +#endif + +#include +#ifndef ELM_LIB_QUICKLAUNCH +static void +my_fileselector_done(void *data, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + /* event_info conatin the full path of the selected file + * or NULL if none is selected or cancel is pressed */ + const char *selected = event_info; + + if (selected) + printf("Selected file: %s\n", selected); + else + evas_object_del(data); /* delete the test window */ +} + +static void +my_fileselector_selected(void *data __UNUSED__, + Evas_Object *obj, + void *event_info) +{ + /* event_info conatin the full path of the selected file */ + const char *selected = event_info; + printf("Selected file: %s\n", selected); + + /* or you can query the selection */ + printf("or: %s\n", elm_fileselector_selected_get(obj)); +} + +static void +_is_save_clicked(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *fs = data; + printf("Toggle Is save\n"); + if (elm_fileselector_is_save_get(fs)) + elm_fileselector_is_save_set(fs, EINA_FALSE); + else + elm_fileselector_is_save_set(fs, EINA_TRUE); +} + +static void +_folder_only_clicked(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *fs = data; + printf("Toggle Folder only\n"); + if (elm_fileselector_folder_only_get(fs)) + elm_fileselector_folder_only_set(fs, EINA_FALSE); + else + elm_fileselector_folder_only_set(fs, EINA_TRUE); +} + +static void +_expandable_clicked(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *fs = data; + printf("Toggle Expandable\n"); + if (elm_fileselector_expandable_get(fs)) + elm_fileselector_expandable_set(fs, EINA_FALSE); + else + elm_fileselector_expandable_set(fs, EINA_TRUE); +} + +static void +_sel_get_clicked(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *fs = data; + printf("Get Selected: %s\n", elm_fileselector_selected_get(fs)); +} + +static void +_path_get_clicked(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *fs = data; + printf("Get Path: %s\n", elm_fileselector_path_get(fs)); +} + +static void +_mode_cycle_clicked(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *fs = data; + Elm_Fileselector_Mode mode; + + mode = (elm_fileselector_mode_get(fs) + 1) % ELM_FILESELECTOR_LAST; + elm_fileselector_mode_set(fs, mode); + + printf("Setting mode to: %d\n", mode); +} + +void +test_fileselector(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *win, *fs, *vbox, *hbox, *bt, *sep; + + /* Set the locale according to the system pref. + * If you dont do so the file selector will order the files list in + * a case sensitive manner + */ + setlocale(LC_ALL, ""); + + elm_need_ethumb(); + + win = elm_win_util_standard_add("fileselector", "File Selector"); + elm_win_autodel_set(win, EINA_TRUE); + + vbox = elm_box_add(win); + elm_win_resize_object_add(win, vbox); + evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(vbox); + + fs = elm_fileselector_add(win); + /* enable the fs file name entry */ + elm_fileselector_is_save_set(fs, EINA_TRUE); + /* make the file list a tree with dir expandable in place */ + elm_fileselector_expandable_set(fs, EINA_FALSE); + /* start the fileselector in the home dir */ + elm_fileselector_path_set(fs, getenv("HOME")); + /* allow fs to expand in x & y */ + evas_object_size_hint_weight_set(fs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(fs, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(vbox, fs); + evas_object_show(fs); // TODO fix this is the widget + + /* the 'done' cb is called when the user press ok/cancel */ + evas_object_smart_callback_add(fs, "done", my_fileselector_done, win); + /* the 'selected' cb is called when the user click on a file/dir */ + evas_object_smart_callback_add(fs, "selected", my_fileselector_selected, + win); + + /* test buttons */ + sep = elm_separator_add(win); + elm_separator_horizontal_set(sep, EINA_TRUE); + elm_box_pack_end(vbox, sep); + evas_object_show(sep); + + hbox = elm_box_add(win); + elm_box_horizontal_set(hbox, EINA_TRUE); + elm_box_pack_end(vbox, hbox); + evas_object_show(hbox); + + bt = elm_check_add(win); + elm_object_text_set(bt, "is save"); + elm_check_state_set(bt, elm_fileselector_is_save_get(fs)); + evas_object_smart_callback_add(bt, "changed", _is_save_clicked, fs); + elm_box_pack_end(hbox, bt); + evas_object_show(bt); + + bt = elm_check_add(win); + elm_object_text_set(bt, "folder only"); + elm_check_state_set(bt, elm_fileselector_folder_only_get(fs)); + evas_object_smart_callback_add(bt, "changed", _folder_only_clicked, fs); + elm_box_pack_end(hbox, bt); + evas_object_show(bt); + + bt = elm_check_add(win); + elm_object_text_set(bt, "expandable"); + elm_check_state_set(bt, elm_fileselector_expandable_get(fs)); + evas_object_smart_callback_add(bt, "changed", _expandable_clicked, fs); + elm_box_pack_end(hbox, bt); + evas_object_show(bt); + + hbox = elm_box_add(win); + elm_box_horizontal_set(hbox, EINA_TRUE); + elm_box_pack_end(vbox, hbox); + evas_object_show(hbox); + + bt = elm_button_add(win); + elm_object_text_set(bt, "selected get"); + evas_object_smart_callback_add(bt, "clicked", _sel_get_clicked, fs); + elm_box_pack_end(hbox, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "path get"); + evas_object_smart_callback_add(bt, "clicked", _path_get_clicked, fs); + elm_box_pack_end(hbox, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "mode cycle"); + evas_object_smart_callback_add(bt, "clicked", _mode_cycle_clicked, fs); + elm_box_pack_end(hbox, bt); + evas_object_show(bt); + + evas_object_resize(win, 240, 350); + evas_object_show(win); +} + +#endif diff --git a/libraries/elementary/src/bin/test_fileselector_button.c b/libraries/elementary/src/bin/test_fileselector_button.c new file mode 100644 index 0000000..969983a --- /dev/null +++ b/libraries/elementary/src/bin/test_fileselector_button.c @@ -0,0 +1,247 @@ +#include "test.h" +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +#include +#ifndef ELM_LIB_QUICKLAUNCH +struct _api_data +{ + unsigned int state; /* What state we are testing */ + Evas_Object *box; /* Additional data defined by test */ + Eina_Bool free_data; /* free data on close */ +}; +typedef struct _api_data api_data; +enum _api_state +{ + ICON_UNSET, + WINDOW_TITLE_SET, + API_STATE_LAST +}; +typedef enum _api_state api_state; + +static void +set_api_state(api_data *api) +{ + const Eina_List *items = elm_box_children_get(api->box); + if (!eina_list_count(items)) + return; + + /* Get first item of list of vbox children */ + Evas_Object *fs_bt = eina_list_nth(items, 0); + + /* use elm_box_children_get() to get list of children */ + switch(api->state) + { /* Put all api-changes under switch */ + case ICON_UNSET: + elm_object_part_content_unset(fs_bt, NULL); + break; + + case WINDOW_TITLE_SET: + elm_fileselector_button_window_title_set(fs_bt, "Custom title from API"); + break; + + case API_STATE_LAST: + + break; + default: + return; + } +} + +static void +_api_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ /* Will add here a SWITCH command containing code to modify test-object */ + /* in accordance a->state value. */ + api_data *a = data; + char str[128]; + + printf("clicked event on API Button: api_state=<%d>\n", a->state); + set_api_state(a); + a->state++; + sprintf(str, "Next API function (%u)", a->state); + elm_object_text_set(obj, str); + elm_object_disabled_set(obj, a->state == API_STATE_LAST); +} + +static void +create_dir_struct(void) +{ + FILE *fp; + mkdir("/tmp/test_fs_bt", S_IRWXU); + fp = fopen("/tmp/test_fs_bt/a_file.txt", "w"); + if (fp) fclose(fp); + fp = fopen("/tmp/test_fs_bt/k_file.txt", "w"); + if (fp) fclose(fp); + fp = fopen("/tmp/test_fs_bt/m_file.txt", "w"); + if (fp) fclose(fp); + + mkdir("/tmp/test_fs_bt/a_subdir", S_IRWXU); + fp = fopen("/tmp/test_fs_bt/a_subdir/d_sub_file.txt", "w"); + if (fp) fclose(fp); + fp = fopen("/tmp/test_fs_bt/a_subdir/j_sub_file.txt", "w"); + if (fp) fclose(fp); +} + +static void +_file_chosen(void *data, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + Evas_Object *entry = data; + const char *file = event_info; + if (file) + { + elm_object_text_set(entry, file); + printf("File chosen: %s\n", file); + } + else + printf("File selection canceled.\n"); +} + +static void +_inwin_mode_toggle(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *fs_bt = data; + Eina_Bool value = elm_fileselector_button_inwin_mode_get(fs_bt); + elm_fileselector_button_inwin_mode_set(fs_bt, !value); + printf("Inwin mode set to: %s\n", value ? "false" : "true"); +} + +static void +_current_sel_toggle(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *fs_bt = data; + Eina_Bool value = elm_fileselector_button_is_save_get(fs_bt); + elm_fileselector_button_is_save_set(fs_bt, !value); + printf("Current selection editable entry set to: %s\n", + value ? "false" : "true"); +} + +static void +_folder_only_toggle(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *fs_bt = data; + Eina_Bool value = elm_fileselector_button_folder_only_get(fs_bt); + elm_fileselector_button_folder_only_set(fs_bt, !value); + printf("Folder only flag set to: %s\n", value ? "false" : "true"); +} + +static void +_expandable_toggle(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *fs_bt = data; + Eina_Bool value = elm_fileselector_button_expandable_get(fs_bt); + elm_fileselector_button_expandable_set(fs_bt, !value); + printf("Expandable flag set to: %s\n", value ? "false" : "true"); +} + +static void +_cleanup_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + free(data); +} + +void +test_fileselector_button(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *win, *vbox, *hbox, *ic, *bt, *fs_bt, *en, *lb, *bxx; + api_data *api = calloc(1, sizeof(api_data)); + + win = elm_win_util_standard_add("fileselector-button", "File Selector Button"); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api); + + bxx = elm_box_add(win); + elm_win_resize_object_add(win, bxx); + evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bxx); + + vbox = elm_box_add(win); + api->box = vbox; + evas_object_show(vbox); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Next API function"); + evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api); + elm_box_pack_end(bxx, bt); + elm_object_disabled_set(bt, api->state == API_STATE_LAST); + evas_object_show(bt); + + elm_box_pack_end(bxx, vbox); + + create_dir_struct(); /* Create a dir struct in /tmp */ + /* file selector button */ + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "file"); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + fs_bt = elm_fileselector_button_add(win); + elm_object_text_set(fs_bt, "Select a file"); + elm_object_part_content_set(fs_bt, "icon", ic); + elm_fileselector_button_path_set(fs_bt, "/tmp/test_fs_bt"); + + elm_box_pack_end(vbox, fs_bt); + evas_object_show(fs_bt); + evas_object_show(ic); + + /* attribute setting buttons */ + hbox = elm_box_add(win); + elm_box_horizontal_set(hbox, EINA_TRUE); + elm_box_pack_end(vbox, hbox); + evas_object_show(hbox); + + bt = elm_check_add(win); + elm_object_style_set(bt, "toggle"); + elm_object_text_set(bt, "current selection text entry"); + evas_object_smart_callback_add(bt, "changed", _current_sel_toggle, fs_bt); + elm_box_pack_end(hbox, bt); + evas_object_show(bt); + + bt = elm_check_add(win); + elm_object_style_set(bt, "toggle"); + elm_object_text_set(bt, "Inwin mode"); + elm_check_state_set (bt, EINA_TRUE); + evas_object_smart_callback_add(bt, "changed", _inwin_mode_toggle, fs_bt); + elm_box_pack_end(hbox, bt); + evas_object_show(bt); + + bt = elm_check_add(win); + elm_object_style_set(bt, "toggle"); + elm_object_text_set(bt, "Folder only mode"); + evas_object_smart_callback_add(bt, "changed", _folder_only_toggle, fs_bt); + elm_box_pack_end(hbox, bt); + evas_object_show(bt); + + bt = elm_check_add(win); + elm_object_style_set(bt, "toggle"); + elm_object_text_set(bt, "Expandable mode"); + evas_object_smart_callback_add(bt, "changed", _expandable_toggle, fs_bt); + elm_box_pack_end(hbox, bt); + evas_object_show(bt); + + lb = elm_label_add(win); + elm_object_text_set(lb, "Last selection:"); + elm_box_pack_end(vbox, lb); + evas_object_show(lb); + + en = elm_entry_add(win); + elm_entry_line_wrap_set(en, ELM_WRAP_NONE); + elm_entry_editable_set(en, EINA_FALSE); + evas_object_smart_callback_add(fs_bt, "file,chosen", _file_chosen, en); + elm_box_pack_end(vbox, en); + evas_object_show(en); + + evas_object_resize(win, 400, 400); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_fileselector_entry.c b/libraries/elementary/src/bin/test_fileselector_entry.c new file mode 100644 index 0000000..98ab423 --- /dev/null +++ b/libraries/elementary/src/bin/test_fileselector_entry.c @@ -0,0 +1,257 @@ +#include "test.h" +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +#include +#ifndef ELM_LIB_QUICKLAUNCH +struct _api_data +{ + unsigned int state; /* What state we are testing */ + void *box; /* Use this to get box content */ +}; +typedef struct _api_data api_data; + +enum _api_state +{ + ICON_UNSET, + WINDOW_TITLE_SET, + API_STATE_LAST +}; +typedef enum _api_state api_state; + +static void +set_api_state(api_data *api) +{ + const Eina_List *items = elm_box_children_get(api->box); + if (!eina_list_count(items)) + return; + + /* Get first item of list of vbox children */ + Evas_Object *fs_bt = eina_list_nth(items, 0); + + /* use elm_box_children_get() to get list of children */ + switch(api->state) + { /* Put all api-changes under switch */ + case ICON_UNSET: + elm_object_part_content_unset(fs_bt, NULL); + break; + + case WINDOW_TITLE_SET: + elm_fileselector_entry_window_title_set(fs_bt, "Custom title from API"); + break; + + case API_STATE_LAST: + + break; + default: + return; + } +} + +static void +_api_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ /* Will add here a SWITCH command containing code to modify test-object */ + /* in accordance a->state value. */ + api_data *a = data; + char str[128]; + + printf("clicked event on API Button: api_state=<%d>\n", a->state); + set_api_state(a); + a->state++; + sprintf(str, "Next API function (%u)", a->state); + elm_object_text_set(obj, str); + elm_object_disabled_set(obj, a->state == API_STATE_LAST); +} + +static void +create_dir_struct(void) +{ + FILE *fp; + mkdir("/tmp/test_fs_bt", S_IRWXU); + fp = fopen("/tmp/test_fs_bt/a_file.txt", "w"); + if (fp) fclose(fp); + fp = fopen("/tmp/test_fs_bt/k_file.txt", "w"); + if (fp) fclose(fp); + fp = fopen("/tmp/test_fs_bt/m_file.txt", "w"); + if (fp) fclose(fp); + + mkdir("/tmp/test_fs_bt/a_subdir", S_IRWXU); + fp = fopen("/tmp/test_fs_bt/a_subdir/d_sub_file.txt", "w"); + if (fp) fclose(fp); + fp = fopen("/tmp/test_fs_bt/a_subdir/j_sub_file.txt", "w"); + if (fp) fclose(fp); +} + +static void +_file_chosen(void *data, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + Evas_Object *entry = data; + char *file = event_info; + elm_object_text_set(entry, file); + printf("File chosen: %s\n", file); +} + +static void +_inwin_mode_toggle(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *fs_en = data; + Eina_Bool value = elm_fileselector_entry_inwin_mode_get(fs_en); + elm_fileselector_entry_inwin_mode_set(fs_en, !value); + printf("Inwin mode set to: %s\n", value ? "false" : "true"); +} + +static void +_folder_only_toggle(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *fs_en = data; + Evas_Object *ic = elm_object_part_content_get(fs_en, "button icon"); + Eina_Bool value = elm_fileselector_entry_folder_only_get(fs_en); + elm_fileselector_entry_folder_only_set(fs_en, !value); + printf("Folder only flag set to: %s\n", value ? "false" : "true"); + if (!value) + { + elm_icon_standard_set(ic, "folder"); + elm_object_text_set(fs_en, "Select a folder"); + } + else + { + elm_icon_standard_set(ic, "file"); + elm_object_text_set(fs_en, "Select a file"); + } +} + +static void +_expandable_toggle(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *fs_en = data; + Eina_Bool value = elm_fileselector_entry_expandable_get(fs_en); + elm_fileselector_entry_expandable_set(fs_en, !value); + printf("Expandable flag set to: %s\n", value ? "false" : "true"); +} + +static void +_disabled_toggle(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *fs_en = data; + Eina_Bool value = elm_object_disabled_get(fs_en); + elm_object_disabled_set(fs_en, !value); + printf("Disabled flag set to: %s\n", value ? "false" : "true"); +} + +static void +_cleanup_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + free(data); +} + +void +test_fileselector_entry(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *win, *vbox, *hbox, *ic, *bt, *fs_en, *en, *lb, *bxx; + api_data *api = calloc(1, sizeof(api_data)); + + win = elm_win_util_standard_add("fileselector-entry", "File Selector Entry"); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api); + + bxx = elm_box_add(win); + elm_win_resize_object_add(win, bxx); + evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bxx); + + vbox = elm_box_add(win); + evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + api->box = vbox; + evas_object_show(vbox); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Next API function"); + evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api); + elm_box_pack_end(bxx, bt); + elm_object_disabled_set(bt, api->state == API_STATE_LAST); + evas_object_show(bt); + + elm_box_pack_end(bxx, vbox); + + create_dir_struct(); /* Create a dir struct in /tmp */ + + /* file selector entry */ + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "file"); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + fs_en = elm_fileselector_entry_add(win); + elm_fileselector_entry_path_set(fs_en, "/tmp/test_fs_bt"); + elm_object_text_set(fs_en, "Select a file"); + elm_object_part_content_set(fs_en, "button icon", ic); + evas_object_size_hint_weight_set(fs_en, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(fs_en, EVAS_HINT_FILL, EVAS_HINT_FILL); + + elm_box_pack_end(vbox, fs_en); + evas_object_show(fs_en); + evas_object_show(ic); + + /* attribute setting buttons */ + hbox = elm_box_add(win); + elm_box_horizontal_set(hbox, EINA_TRUE); + elm_box_pack_end(vbox, hbox); + evas_object_show(hbox); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Toggle inwin mode"); + evas_object_smart_callback_add(bt, "clicked", _inwin_mode_toggle, fs_en); + elm_box_pack_end(hbox, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Toggle folder only mode"); + evas_object_smart_callback_add(bt, "clicked", _folder_only_toggle, fs_en); + elm_box_pack_end(hbox, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Toggle expandable mode"); + evas_object_smart_callback_add(bt, "clicked", _expandable_toggle, fs_en); + elm_box_pack_end(hbox, bt); + evas_object_show(bt); + + lb = elm_label_add(win); + elm_object_text_set(lb, "Last selection:"); + elm_box_pack_end(vbox, lb); + evas_object_show(lb); + + hbox = elm_box_add(win); + elm_box_horizontal_set(hbox, EINA_TRUE); + elm_box_pack_end(vbox, hbox); + evas_object_show(hbox); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Toggle disabled"); + evas_object_smart_callback_add(bt, "clicked", _disabled_toggle, fs_en); + elm_box_pack_end(hbox, bt); + evas_object_show(bt); + + en = elm_entry_add(win); + elm_entry_line_wrap_set(en, ELM_WRAP_NONE); + elm_entry_editable_set(en, EINA_FALSE); + evas_object_smart_callback_add(fs_en, "file,chosen", _file_chosen, en); + elm_box_pack_end(vbox, en); + evas_object_show(en); + + evas_object_resize(win, 400, 500); + evas_object_show(win); +} + +#endif diff --git a/libraries/elementary/src/bin/test_flip.c b/libraries/elementary/src/bin/test_flip.c new file mode 100644 index 0000000..20d4e49 --- /dev/null +++ b/libraries/elementary/src/bin/test_flip.c @@ -0,0 +1,610 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +void +my_fl_1(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *fl = data; + elm_flip_go(fl, ELM_FLIP_ROTATE_Y_CENTER_AXIS); +} + +void +my_fl_2(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *fl = data; + elm_flip_go(fl, ELM_FLIP_ROTATE_X_CENTER_AXIS); +} + +void +my_fl_3(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *fl = data; + elm_flip_go(fl, ELM_FLIP_ROTATE_XZ_CENTER_AXIS); +} + +void +my_fl_4(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *fl = data; + elm_flip_go(fl, ELM_FLIP_ROTATE_YZ_CENTER_AXIS); +} + +void +my_fl_5(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *fl = data; + elm_flip_go(fl, ELM_FLIP_CUBE_LEFT); +} + +void +my_fl_6(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *fl = data; + elm_flip_go(fl, ELM_FLIP_CUBE_RIGHT); +} + +void +my_fl_7(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *fl = data; + elm_flip_go(fl, ELM_FLIP_CUBE_UP); +} + +void +my_fl_8(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *fl = data; + elm_flip_go(fl, ELM_FLIP_CUBE_DOWN); +} + +void +test_flip(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *bx2, *fl, *o, *bt, *ly; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("flip", "Flip"); + elm_win_focus_highlight_enabled_set(win, EINA_TRUE); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + fl = elm_flip_add(win); + evas_object_size_hint_align_set(fl, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(fl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, fl); + + o = elm_bg_add(win); + evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), "sky_01.jpg"); + elm_bg_file_set(o, buf, NULL); + elm_object_part_content_set(fl, "front", o); + evas_object_show(o); + + ly = elm_layout_add(win); + snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get()); + elm_layout_file_set(ly, buf, "layout"); + evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(fl, "back", ly); + evas_object_show(ly); + + bt = elm_button_add(ly); + elm_object_text_set(bt, "Button 1"); + elm_object_part_content_set(ly, "element1", bt); + + bt = elm_button_add(ly); + elm_object_text_set(bt, "Button 2"); + elm_object_part_content_set(ly, "element2", bt); + + bt = elm_button_add(ly); + elm_object_text_set(bt, "Button 3"); + elm_object_part_content_set(ly, "element3", bt); + + evas_object_show(fl); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + + bt = elm_button_add(win); + elm_object_text_set(bt, "1"); + evas_object_smart_callback_add(bt, "clicked", my_fl_1, fl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "2"); + evas_object_smart_callback_add(bt, "clicked", my_fl_2, fl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "3"); + evas_object_smart_callback_add(bt, "clicked", my_fl_3, fl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "4"); + evas_object_smart_callback_add(bt, "clicked", my_fl_4, fl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + + bt = elm_button_add(win); + elm_object_text_set(bt, "5"); + evas_object_smart_callback_add(bt, "clicked", my_fl_5, fl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "6"); + evas_object_smart_callback_add(bt, "clicked", my_fl_6, fl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "7"); + evas_object_smart_callback_add(bt, "clicked", my_fl_7, fl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "8"); + evas_object_smart_callback_add(bt, "clicked", my_fl_8, fl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + evas_object_resize(win, 320, 480); + evas_object_show(win); +} + +void +test_flip2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bg, *bx, *bx2, *fl, *o, *bt, *tb, *li, *en; + char buf[PATH_MAX]; + + win = elm_win_add(NULL, "flip2", ELM_WIN_BASIC); + elm_win_title_set(win, "Flip 2"); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), "sky_01.jpg"); + elm_bg_file_set(bg, buf, NULL); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + fl = elm_flip_add(win); + evas_object_size_hint_align_set(fl, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(fl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, fl); + + o = elm_box_add(win); + evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + tb = elm_toolbar_add(win); + elm_toolbar_homogeneous_set(tb, 0); + evas_object_size_hint_weight_set(tb, 0.0, 0.0); + evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0); + + elm_toolbar_item_append(tb, "arrow_left", "Hello", NULL, NULL); + elm_toolbar_item_append(tb, "arrow_right", "Out", NULL, NULL); + elm_toolbar_item_append(tb, "home", "There", NULL, NULL); + elm_toolbar_item_append(tb, "refresh", "World", NULL, NULL); + + elm_box_pack_end(o, tb); + evas_object_show(tb); + + li = elm_list_add(win); + evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + elm_list_item_append(li, "This is a list", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "Second item", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "3rd", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "Fourth", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "Number five is alive!", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "The quick brown fox jumps over the lazy dog", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "Booyah", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "And another item", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "More of them", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "Get with it", NULL, NULL, NULL, NULL); + + elm_list_go(li); + + elm_box_pack_end(o, li); + evas_object_show(li); + + elm_object_part_content_set(fl, "front", o); + evas_object_show(o); + + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + elm_entry_line_wrap_set(en, ELM_WRAP_NONE); + snprintf(buf, sizeof(buf), + "This is an entry widget in this window that
" + "uses markup like this for styling and
" + "formatting like this, as well as
" + "links in the text, so enter text
" + "in here to edit it. By the way, links are
" + "called Anchors so you will need
" + "to refer to them this way.
" + "
" + + "Also you can stick in items with (relsize + ascent): " + "" + " (full) " + "" + " (to the left)
" + + "Also (size + ascent): " + "" + " (full) " + "" + " (before this)
" + + "And as well (absize + ascent): " + "" + " (full) " + "" + " or even paths to image files on disk too like: " + "" + " ... end." + , elm_app_data_dir_get() + ); + elm_object_text_set(en, buf); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + elm_object_part_content_set(fl, "back", en); + evas_object_show(en); + + evas_object_show(fl); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + + bt = elm_button_add(win); + elm_object_text_set(bt, "1"); + evas_object_smart_callback_add(bt, "clicked", my_fl_1, fl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "2"); + evas_object_smart_callback_add(bt, "clicked", my_fl_2, fl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "3"); + evas_object_smart_callback_add(bt, "clicked", my_fl_3, fl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "4"); + evas_object_smart_callback_add(bt, "clicked", my_fl_4, fl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "5"); + evas_object_smart_callback_add(bt, "clicked", my_fl_5, fl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "6"); + evas_object_smart_callback_add(bt, "clicked", my_fl_6, fl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + evas_object_resize(win, 320, 480); + evas_object_show(win); +} + +void +test_flip3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *bx2, *fl, *fl_f, *fl_b, *o, *bt, *fr; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("flip3", "Flip Flip"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + fl = elm_flip_add(win); + evas_object_size_hint_align_set(fl, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(fl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, fl); + evas_object_show(fl); + + fr = elm_frame_add(win); + elm_object_text_set(fr, "Front"); + evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(fl, "front", fr); + evas_object_show(fr); + + fl_f = elm_flip_add(win); + evas_object_size_hint_align_set(fl_f, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(fl_f, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_content_set(fr, fl_f); + evas_object_show(fl_f); + + o = elm_bg_add(win); + evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), "sky_01.jpg"); + elm_bg_file_set(o, buf, NULL); + elm_object_part_content_set(fl_f, "front", o); + evas_object_show(o); + + o = elm_bg_add(win); + evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), "sky_02.jpg"); + elm_bg_file_set(o, buf, NULL); + elm_object_part_content_set(fl_f, "back", o); + evas_object_show(o); + + fr = elm_frame_add(win); + elm_object_text_set(fr, "Back"); + evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(fl, "back", fr); + evas_object_show(fr); + + fl_b = elm_flip_add(win); + evas_object_size_hint_align_set(fl_b, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(fl_b, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_content_set(fr, fl_b); + evas_object_show(fl_b); + + o = elm_bg_add(win); + evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), "sky_03.jpg"); + elm_bg_file_set(o, buf, NULL); + elm_object_part_content_set(fl_b, "front", o); + evas_object_show(o); + + o = elm_bg_add(win); + evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), "sky_04.jpg"); + elm_bg_file_set(o, buf, NULL); + elm_object_part_content_set(fl_b, "back", o); + evas_object_show(o); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Main Flip"); + evas_object_smart_callback_add(bt, "clicked", my_fl_6, fl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Front Flip"); + evas_object_smart_callback_add(bt, "clicked", my_fl_6, fl_f); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Back Flip"); + evas_object_smart_callback_add(bt, "clicked", my_fl_6, fl_b); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + evas_object_resize(win, 320, 480); + evas_object_show(win); +} + + +static void +my_fl_go(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + Evas_Object *fl = evas_object_data_get(win, "fl"); + elm_flip_go(fl, ELM_FLIP_PAGE_LEFT); +} + +static void +my_fl_ch(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + Evas_Object *fl = evas_object_data_get(win, "fl"); + Evas_Object *rdg = evas_object_data_get(win, "rdg"); + elm_flip_interaction_set(fl, elm_radio_value_get(rdg)); +} + +void +test_flip4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *fl, *im, *li, *bt, *rd, *rdg; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("flip-interactive", "Flip Interactive"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + fl = elm_flip_add(win); + evas_object_size_hint_align_set(fl, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(fl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, fl); + evas_object_data_set(win, "fl", fl); + + elm_flip_interaction_set(fl, ELM_FLIP_INTERACTION_NONE); + elm_flip_interaction_direction_enabled_set(fl, ELM_FLIP_DIRECTION_UP, EINA_TRUE); + elm_flip_interaction_direction_enabled_set(fl, ELM_FLIP_DIRECTION_DOWN, EINA_TRUE); + elm_flip_interaction_direction_enabled_set(fl, ELM_FLIP_DIRECTION_LEFT, EINA_TRUE); + elm_flip_interaction_direction_enabled_set(fl, ELM_FLIP_DIRECTION_RIGHT, EINA_TRUE); + elm_flip_interaction_direction_hitsize_set(fl, ELM_FLIP_DIRECTION_UP, 0.25); + elm_flip_interaction_direction_hitsize_set(fl, ELM_FLIP_DIRECTION_DOWN, 0.25); + elm_flip_interaction_direction_hitsize_set(fl, ELM_FLIP_DIRECTION_LEFT, 0.25); + elm_flip_interaction_direction_hitsize_set(fl, ELM_FLIP_DIRECTION_RIGHT, 0.25); + evas_object_show(fl); + + im = evas_object_image_filled_add(evas_object_evas_get(win)); + evas_object_size_hint_weight_set(im, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + snprintf(buf, sizeof(buf), "%s/images/%s", + elm_app_data_dir_get(), "twofish.jpg"); + evas_object_image_file_set(im, buf, NULL); + elm_object_part_content_set(fl, "front", im); + evas_object_show(im); + +#if 0 + im = evas_object_image_filled_add(evas_object_evas_get(win)); + evas_object_size_hint_weight_set(im, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + snprintf(buf, sizeof(buf), "%s/images/%s", + elm_app_data_dir_get(), "sky_04.jpg"); + evas_object_image_file_set(im, buf, NULL); + elm_object_part_content_set(fl, "back", im); + evas_object_show(im); +#else + li = elm_list_add(win); + evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_list_item_append(li, "Item 0", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "Item 1", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "Item 2", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "Item 3 (Which is very long just for testing purposes)", NULL, NULL, NULL, NULL); + elm_list_go(li); + elm_object_part_content_set(fl, "back", li); + evas_object_show(li); +#endif + + rd = elm_radio_add(win); + evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0); + elm_radio_state_value_set(rd, ELM_FLIP_INTERACTION_NONE); + elm_object_text_set(rd, "None"); + elm_box_pack_end(bx, rd); + evas_object_show(rd); + evas_object_smart_callback_add(rd, "changed", my_fl_ch, win); + rdg = rd; + evas_object_data_set(win, "rdg", rdg); + + rd = elm_radio_add(win); + evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0); + elm_radio_state_value_set(rd, ELM_FLIP_INTERACTION_ROTATE); + elm_object_text_set(rd, "Rotate"); + elm_radio_group_add(rd, rdg); + elm_box_pack_end(bx, rd); + evas_object_show(rd); + evas_object_smart_callback_add(rd, "changed", my_fl_ch, win); + + rd = elm_radio_add(win); + evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0); + elm_radio_state_value_set(rd, ELM_FLIP_INTERACTION_CUBE); + elm_object_text_set(rd, "Cube"); + elm_radio_group_add(rd, rdg); + elm_box_pack_end(bx, rd); + evas_object_show(rd); + evas_object_smart_callback_add(rd, "changed", my_fl_ch, win); + + rd = elm_radio_add(win); + evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0); + elm_radio_state_value_set(rd, ELM_FLIP_INTERACTION_PAGE); + elm_object_text_set(rd, "Page"); + elm_radio_group_add(rd, rdg); + elm_box_pack_end(bx, rd); + evas_object_show(rd); + evas_object_smart_callback_add(rd, "changed", my_fl_ch, win); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Go"); + evas_object_smart_callback_add(bt, "clicked", my_fl_go, win); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + evas_object_resize(win, 320, 480); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_flip_page.c b/libraries/elementary/src/bin/test_flip_page.c new file mode 100644 index 0000000..20cafb3 --- /dev/null +++ b/libraries/elementary/src/bin/test_flip_page.c @@ -0,0 +1,913 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +typedef struct _State State; +typedef struct _Slice Slice; + +typedef struct _Vertex2 Vertex2; +typedef struct _Vertex3 Vertex3; + +struct _State +{ + Evas_Object *front, *back; + Evas_Coord down_x, down_y, x, y; + Eina_Bool down : 1; + Eina_Bool backflip : 1; + + Ecore_Animator *anim; + Ecore_Job *job; + Evas_Coord ox, oy, w, h; + int slices_w, slices_h; + Slice **slices, **slices2; + int dir; // 0 == left, 1 == right, 2 == up, 3 == down + int finish; +}; + +struct _Slice +{ + Evas_Object *obj; + // (0)---(1) + // | | + // | | + // (3)---(2) + double u[4], v[4], x[4], y[4], z[4]; +}; + +struct _Vertex2 +{ + double x, y; +}; + +struct _Vertex3 +{ + double x, y, z; +}; + +static State state = +{ + NULL, NULL, + 0, 0, 0, 0, + 0, + 0, + + NULL, + NULL, + 0, 0, 0, 0, + 0, 0, + NULL, NULL, + -1, + 0 +}; + +static Slice * +_slice_new(State *st __UNUSED__, Evas_Object *obj) +{ + Slice *sl; + + sl = calloc(1, sizeof(Slice)); + if (!sl) return NULL; + sl->obj = evas_object_image_add(evas_object_evas_get(obj)); + evas_object_image_smooth_scale_set(sl->obj, 0); + evas_object_pass_events_set(sl->obj, 1); + evas_object_image_source_set(sl->obj, obj); + return sl; +} + +static void +_slice_free(Slice *sl) +{ + evas_object_del(sl->obj); + free(sl); +} + +static void +_slice_apply(State *st, Slice *sl, + Evas_Coord x __UNUSED__, Evas_Coord y __UNUSED__, Evas_Coord w, Evas_Coord h __UNUSED__, + Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh) +{ + Evas_Map *m; + int i; + + m = evas_map_new(4); + if (!m) return; + evas_map_smooth_set(m, 0); + for (i = 0; i < 4; i++) + { + evas_map_point_color_set(m, i, 255, 255, 255, 255); + if (st->dir == 0) + { + int p[4] = { 0, 1, 2, 3 }; + evas_map_point_coord_set(m, i, ox + sl->x[p[i]], oy + sl->y[p[i]], sl->z[p[i]]); + evas_map_point_image_uv_set(m, i, sl->u[p[i]] , sl->v[p[i]]); + } + else if (st->dir == 1) + { + int p[4] = { 1, 0, 3, 2 }; + evas_map_point_coord_set(m, i, ox + (w - sl->x[p[i]]), oy + sl->y[p[i]], sl->z[p[i]]); + evas_map_point_image_uv_set(m, i, ow - sl->u[p[i]] , sl->v[p[i]]); + } + else if (st->dir == 2) + { + int p[4] = { 1, 0, 3, 2 }; + evas_map_point_coord_set(m, i, ox + sl->y[p[i]], oy + sl->x[p[i]], sl->z[p[i]]); + evas_map_point_image_uv_set(m, i, sl->v[p[i]] , sl->u[p[i]]); + } + else if (st->dir == 3) + { + int p[4] = { 0, 1, 2, 3 }; + evas_map_point_coord_set(m, i, ox + sl->y[p[i]], oy + (w - sl->x[p[i]]), sl->z[p[i]]); + evas_map_point_image_uv_set(m, i, sl->v[p[i]] , oh - sl->u[p[i]]); + } + } + evas_object_map_enable_set(sl->obj, EINA_TRUE); + evas_object_image_fill_set(sl->obj, 0, 0, ow, oh); + evas_object_map_set(sl->obj, m); + evas_map_free(m); +} + +static void +_slice_3d(State *st __UNUSED__, Slice *sl, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) +{ + Evas_Map *m = (Evas_Map *)evas_object_map_get(sl->obj); + int i; + + if (!m) return; + // vanishing point is center of page, and focal dist is 1024 + evas_map_util_3d_perspective(m, x + (w / 2), y + (h / 2), 0, 1024); + for (i = 0; i < 4; i++) + { + Evas_Coord xx, yy, zz; + evas_map_point_coord_get(m, i, &xx, &yy, &zz); + evas_map_point_coord_set(m, i, xx, yy, 0); + } + if (evas_map_util_clockwise_get(m)) evas_object_show(sl->obj); + else evas_object_hide(sl->obj); + evas_object_map_set(sl->obj, m); +} + +static void +_slice_light(State *st __UNUSED__, Slice *sl, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) +{ + Evas_Map *m = (Evas_Map *)evas_object_map_get(sl->obj); + int i; + + if (!m) return; + evas_map_util_3d_lighting(m, + // light position + // (centered over page 10 * h toward camera) + x + (w / 2) , y + (h / 2) , -10000, + 255, 255, 255, // light color + 0 , 0 , 0); // ambient minimum + // multiply brightness by 1.2 to make lightish bits all white so we dont + // add shading where we could otherwise be pure white + for (i = 0; i < 4; i++) + { + int r, g, b, a; + + evas_map_point_color_get(m, i, &r, &g, &b, &a); + r = (double)r * 1.2; if (r > 255) r = 255; + g = (double)g * 1.2; if (g > 255) g = 255; + b = (double)b * 1.2; if (b > 255) b = 255; + evas_map_point_color_set(m, i, r, g, b, a); + } + evas_object_map_set(sl->obj, m); +} + +static void +_slice_xyz(State *st __UNUSED__, Slice *sl, + double xx1, double yy1, double zz1, + double xx2, double yy2, double zz2, + double xx3, double yy3, double zz3, + double xx4, double yy4, double zz4) +{ + sl->x[0] = xx1; sl->y[0] = yy1; sl->z[0] = zz1; + sl->x[1] = xx2; sl->y[1] = yy2; sl->z[1] = zz2; + sl->x[2] = xx3; sl->y[2] = yy3; sl->z[2] = zz3; + sl->x[3] = xx4; sl->y[3] = yy4; sl->z[3] = zz4; +} + +static void +_slice_uv(State *st __UNUSED__, Slice *sl, + double u1, double v1, + double u2, double v2, + double u3, double v3, + double u4, double v4) +{ + sl->u[0] = u1; sl->v[0] = v1; + sl->u[1] = u2; sl->v[1] = v2; + sl->u[2] = u3; sl->v[2] = v3; + sl->u[3] = u4; sl->v[3] = v4; +} + +static void +_deform_point(Vertex2 *vi, Vertex3 *vo, double rho, double theta, double A) +{ + // ^Y + // | + // | X + // +----> + // theta == cone angle (0 -> PI/2) + // A == distance of cone apex from origin + // rho == angle of cone from vertical axis (...-PI/2 to PI/2...) + Vertex3 v1; + double d, r, b; + + d = sqrt((vi->x * vi->x) + pow(vi->y - A, 2)); + r = d * sin(theta); + b = asin(vi->x / d) / sin(theta); + + v1.x = r * sin(b); + v1.y = d + A - (r * (1 - cos(b)) * sin(theta)); + v1.z = r * (1 - cos(b)) * cos(theta); + + vo->x = (v1.x * cos(rho)) - (v1.z * sin(rho)); + vo->y = v1.y; + vo->z = (v1.x * sin(rho)) + (v1.z * cos(rho)); +} + +static void +_interp_point(Vertex3 *vi1, Vertex3 *vi2, Vertex3 *vo, double v) +{ + vo->x = (v * vi2->x) + ((1.0 - v) * vi1->x); + vo->y = (v * vi2->y) + ((1.0 - v) * vi1->y); + vo->z = (v * vi2->z) + ((1.0 - v) * vi1->z); +} + +static void +_state_slices_clear(State *st) +{ + int i, j, num; + + if (st->slices) + { + num = 0; + for (j = 0; j < st->slices_h; j++) + { + for (i = 0; i < st->slices_w; i++) + { + if (st->slices[num]) _slice_free(st->slices[num]); + if (st->slices2[num]) _slice_free(st->slices2[num]); + num++; + } + } + free(st->slices); + free(st->slices2); + st->slices = NULL; + st->slices2 = NULL; + } + st->slices_w = 0; + st->slices_h = 0; +} + +static int +_slice_obj_color_sum(Slice *s, int p, int *r, int *g, int *b, int *a) +{ + Evas_Map *m; + int rr = 0, gg = 0, bb = 0, aa = 0; + + if (!s) return 0; + m = (Evas_Map *)evas_object_map_get(s->obj); + if (!m) return 0; + evas_map_point_color_get(m, p, &rr, &gg, &bb, &aa); + *r += rr; *g += gg; *b += bb; *a += aa; + return 1; +} + +static void +_slice_obj_color_set(Slice *s, int p, int r, int g, int b, int a) +{ + Evas_Map *m; + + if (!s) return; + m = (Evas_Map *)evas_object_map_get(s->obj); + if (!m) return; + evas_map_point_color_set(m, p, r, g, b, a); + evas_object_map_set(s->obj, m); +} + +static void +_slice_obj_vert_color_merge(Slice *s1, int p1, Slice *s2, int p2, + Slice *s3, int p3, Slice *s4, int p4) +{ + int r = 0, g = 0, b = 0, a = 0, n = 0; + + n += _slice_obj_color_sum(s1, p1, &r, &g, &b, &a); + n += _slice_obj_color_sum(s2, p2, &r, &g, &b, &a); + n += _slice_obj_color_sum(s3, p3, &r, &g, &b, &a); + n += _slice_obj_color_sum(s4, p4, &r, &g, &b, &a); + + if (n < 1) return; + r /= n; g /= n; b /= n; a /= n; + + _slice_obj_color_set(s1, p1, r, g, b, a); + _slice_obj_color_set(s2, p2, r, g, b, a); + _slice_obj_color_set(s3, p3, r, g, b, a); + _slice_obj_color_set(s4, p4, r, g, b, a); +} + +static int +_state_update(State *st) +{ + Evas_Coord xx1, yy1, xx2, yy2, mx, my, dst, dx, dy; + Evas_Coord x, y, w, h, ox, oy, ow, oh; + int i, j, num, nn, jump, num2; + Slice *sl; + double b, minv = 0.0, minva, mgrad; + int gx, gy, gszw, gszh, gw, gh, col, row, nw, nh; + double rho, A, theta, perc, percm, n, rhol, Al, thetal; + Vertex3 *tvo, *tvol; + + st->backflip = 0; + + evas_object_geometry_get(st->front, &x, &y, &w, &h); + ox = x; oy = y; ow = w; oh = h; + xx1 = st->down_x; + yy1 = st->down_y; + xx2 = st->x; + yy2 = st->y; + + dx = xx2 - xx1; + dy = yy2 - yy1; + dst = sqrt((dx * dx) + (dy * dy)); + if (st->dir == -1) + { + if (dst < 20) // MAGIC: 20 == drag hysterisis + return 0; + } + if (st->dir == -1) + { + if ((xx1 > (w / 2)) && (dx < 0) && (abs(dx) > abs(dy))) st->dir = 0; // left + else if ((xx1 < (w / 2)) && (dx >= 0) && (abs(dx) > abs(dy))) st->dir = 1; // right + else if ((yy1 > (h / 2)) && (dy < 0) && (abs(dy) >= abs(dx))) st->dir = 2; // up + else if ((yy1 < (h / 2)) && (dy >= 0) && (abs(dy) >= abs(dx))) st->dir = 3; // down + if (st->dir == -1) return 0; + } + if (st->dir == 0) + { + // no nothing. left drag is standard + } + else if (st->dir == 1) + { + xx1 = (w - 1) - xx1; + xx2 = (w - 1) - xx2; + } + else if (st->dir == 2) + { + Evas_Coord tmp; + + tmp = xx1; xx1 = yy1; yy1 = tmp; + tmp = xx2; xx2 = yy2; yy2 = tmp; + tmp = w; w = h; h = tmp; + } + else if (st->dir == 3) + { + Evas_Coord tmp; + + tmp = xx1; xx1 = yy1; yy1 = tmp; + tmp = xx2; xx2 = yy2; yy2 = tmp; + tmp = w; w = h; h = tmp; + xx1 = (w - 1) - xx1; + xx2 = (w - 1) - xx2; + } + + if (xx2 >= xx1) xx2 = xx1 - 1; + mx = (xx1 + xx2) / 2; + my = (yy1 + yy2) / 2; + + if (mx < 0) mx = 0; + else if (mx >= w) mx = w - 1; + if (my < 0) my = 0; + else if (my >= h) my = h - 1; + + mgrad = (double)(yy1 - yy2) / (double)(xx1 - xx2); + + if (mx < 1) mx = 1; // quick hack to keep curl line visible + + if (mgrad == 0.0) // special horizontal case + mgrad = 0.001; // quick dirty hack for now + // else + { + minv = 1.0 / mgrad; + // y = (m * x) + b + b = my + (minv * mx); + } + if ((b >= -5) && (b <= (h + 5))) + { + if (minv > 0.0) // clamp to h + { + minv = (double)(h + 5 - my) / (double)(mx); + b = my + (minv * mx); + } + else // clamp to 0 + { + minv = (double)(-5 - my) / (double)(mx); + b = my + (minv * mx); + } + } + + perc = (double)xx2 / (double)xx1; + percm = (double)mx / (double)xx1; + if (perc < 0.0) perc = 0.0; + else if (perc > 1.0) perc = 1.0; + if (percm < 0.0) percm = 0.0; + else if (percm > 1.0) percm = 1.0; + + minva = atan(minv) / (M_PI / 2); + if (minva < 0.0) minva = -minva; + + // A = apex of cone + if (b <= 0) A = b; + else A = h - b; + if (A < -(h * 20)) A = -h * 20; + //--// + Al = -5; + + // rho = is how much the page is turned + n = 1.0 - perc; + n = 1.0 - cos(n * M_PI / 2.0); + n = n * n; + rho = -(n * M_PI); + //--// + rhol = -(n * M_PI); + + // theta == curliness (how much page culrs in on itself + n = sin((1.0 - perc) * M_PI); + n = n * 1.2; + theta = 7.86 + n; + //--// + n = sin((1.0 - perc) * M_PI); + n = 1.0 - n; + n = n * n; + n = 1.0 - n; + thetal = 7.86 + n; + + nw = 16; + nh = 16; + gszw = w / nw; + gszh = h / nh; + if (gszw < 4) gszw = 4; + if (gszh < 4) gszh = 4; + + nw = (w + gszw - 1) / gszw; + nh = (h + gszh - 1) / gszh; + if ((st->slices_w != nw) || (st->slices_h != nh)) _state_slices_clear(st); + st->slices_w = nw; + st->slices_h = nh; + if (!st->slices) + { + st->slices = calloc(st->slices_w * st->slices_h, sizeof(Slice *)); + if (!st->slices) return 0; + st->slices2 = calloc(st->slices_w * st->slices_h, sizeof(Slice *)); + if (!st->slices2) + { + free(st->slices); + st->slices = NULL; + return 0; + } + } + + num = (st->slices_w + 1) * (st->slices_h + 1); + + tvo = alloca(sizeof(Vertex3) * num); + tvol = alloca(sizeof(Vertex3) * (st->slices_w + 1)); + + for (col = 0, gx = 0; gx <= (w + gszw - 1); gx += gszw, col++) + { + Vertex2 vil; + + vil.x = gx; + vil.y = h - gx; + _deform_point(&vil, &(tvol[col]), rhol, thetal, Al); + } + + n = minva * sin(perc * M_PI); + n = n * n; + + num = 0; + for (col = 0, gx = 0; gx <= (w + gszw - 1); gx += gszw, col++) + { + for (gy = 0; gy <= (h + gszh - 1); gy += gszh) + { + Vertex2 vi; + Vertex3 vo, tvo1; + + if (gx > w) vi.x = w; + else vi.x = gx; + if (gy > h) vi.y = h; + else vi.y = gy; + _deform_point(&vi, &vo, rho, theta, A); + tvo1 = tvol[col]; + if (gy > h) tvo1.y = h; + else tvo1.y = gy; + _interp_point(&vo, &tvo1, &(tvo[num]), n); + num++; + } + } + + jump = st->slices_h + 1; + for (col = 0, gx = 0; gx < w; gx += gszw, col++) + { + num = st->slices_h * col; + num2 = jump * col; + + gw = gszw; + if ((gx + gw) > w) gw = w - gx; + + for (row = 0, gy = 0; gy < h; gy += gszh, row++) + { + Vertex3 vo[4]; + + if (b > 0) nn = num + st->slices_h - row - 1; + else nn = num + row; + + gh = gszh; + if ((gy + gh) > h) gh = h - gy; + + vo[0] = tvo[num2 + row]; + vo[1] = tvo[num2 + row + jump]; + vo[2] = tvo[num2 + row + jump + 1]; + vo[3] = tvo[num2 + row + 1]; +#define SWP(a, b) do {typeof(a) vt; vt = (a); (a) = (b); (b) = vt;} while (0) + if (b > 0) + { + SWP(vo[0], vo[3]); + SWP(vo[1], vo[2]); + vo[0].y = h - vo[0].y; + vo[1].y = h - vo[1].y; + vo[2].y = h - vo[2].y; + vo[3].y = h - vo[3].y; + } + + // FRONT + sl = st->slices[nn]; + if (!sl) + { + sl = _slice_new(st, st->front); + st->slices[nn] = sl; + } + _slice_xyz(st, sl, + vo[0].x, vo[0].y, vo[0].z, + vo[1].x, vo[1].y, vo[1].z, + vo[2].x, vo[2].y, vo[2].z, + vo[3].x, vo[3].y, vo[3].z); + if (b <= 0) + _slice_uv(st, sl, + gx, gy, gx + gw, gy, + gx + gw, gy + gh, gx, gy + gh); + else + _slice_uv(st, sl, + gx, h - (gy + gh), gx + gw, h - (gy + gh), + gx + gw, h - gy, gx, h - gy); + + // BACK + sl = st->slices2[nn]; + if (!sl) + { + sl = _slice_new(st, st->back); + st->slices2[nn] = sl; + } + + _slice_xyz(st, sl, + vo[1].x, vo[1].y, vo[1].z, + vo[0].x, vo[0].y, vo[0].z, + vo[3].x, vo[3].y, vo[3].z, + vo[2].x, vo[2].y, vo[2].z); + if (st->backflip) + { + if (b <= 0) + _slice_uv(st, sl, + gx + gw, gy, gx, gy, + gx, gy + gh, gx + gw, gy + gh); + else + _slice_uv(st, sl, + gx + gw, h - (gy + gh), gx, h - (gy + gh), + gx, h - gy, gx + gw, h - gy); + } + else + { + if (b <= 0) + _slice_uv(st, sl, + w - (gx + gw), gy, w - (gx), gy, + w - (gx), gy + gh, w - (gx + gw), gy + gh); + else + _slice_uv(st, sl, + w - (gx + gw), h - (gy + gh), w - (gx), h - (gy + gh), + w - (gx), h - gy, w - (gx + gw), h - gy); + } + } + } + + num = 0; + for (j = 0; j < st->slices_h; j++) + { + for (i = 0; i < st->slices_w; i++) + { + _slice_apply(st, st->slices[num], x, y, w, h, ox, oy, ow, oh); + _slice_apply(st, st->slices2[num], x, y, w, h, ox, oy, ow, oh); + _slice_light(st, st->slices[num], ox, oy, ow, oh); + _slice_light(st, st->slices2[num], ox, oy, ow, oh); + num++; + } + } + + for (i = 0; i <= st->slices_w; i++) + { + num = i * st->slices_h; + for (j = 0; j <= st->slices_h; j++) + { + Slice *s[4]; + + s[0] = s[1] = s[2] = s[3] = NULL; + if ((i > 0) && (j > 0)) + s[0] = st->slices[num - 1 - st->slices_h]; + if ((i < st->slices_w) && (j > 0)) + s[1] = st->slices[num - 1]; + if ((i > 0) && (j < st->slices_h)) + s[2] = st->slices[num - st->slices_h]; + if ((i < st->slices_w) && (j < st->slices_h)) + s[3] = st->slices[num]; + if (st->dir == 0) + _slice_obj_vert_color_merge(s[0], 2, s[1], 3, + s[2], 1, s[3], 0); + else if (st->dir == 1) + _slice_obj_vert_color_merge(s[0], 3, s[1], 2, + s[2], 0, s[3], 1); + else if (st->dir == 2) + _slice_obj_vert_color_merge(s[0], 3, s[1], 2, + s[2], 0, s[3], 1); + else if (st->dir == 3) + _slice_obj_vert_color_merge(s[0], 2, s[1], 3, + s[2], 1, s[3], 0); + s[0] = s[1] = s[2] = s[3] = NULL; + if ((i > 0) && (j > 0)) + s[0] = st->slices2[num - 1 - st->slices_h]; + if ((i < st->slices_w) && (j > 0)) + s[1] = st->slices2[num - 1]; + if ((i > 0) && (j < st->slices_h)) + s[2] = st->slices2[num - st->slices_h]; + if ((i < st->slices_w) && (j < st->slices_h)) + s[3] = st->slices2[num]; + if (st->dir == 0) + _slice_obj_vert_color_merge(s[0], 3, s[1], 2, + s[2], 0, s[3], 1); + else if (st->dir == 1) + _slice_obj_vert_color_merge(s[0], 2, s[1], 3, + s[2], 1, s[3], 0); + else if (st->dir == 2) + _slice_obj_vert_color_merge(s[0], 2, s[1], 3, + s[2], 1, s[3], 0); + else if (st->dir == 3) + _slice_obj_vert_color_merge(s[0], 3, s[1], 2, + s[2], 0, s[3], 1); + num++; + } + } + + num = 0; + for (i = 0; i < st->slices_w; i++) + { + for (j = 0; j < st->slices_h; j++) + { + _slice_3d(st, st->slices[num], ox, oy, ow, oh); + _slice_3d(st, st->slices2[num], ox, oy, ow, oh); + num++; + } + } + + return 1; +} + +static void +_state_end(State *st) +{ + _state_slices_clear(st); +} + +static Eina_Bool +_state_anim(void *data, double pos) +{ + State *st = data; + double p; + + p = ecore_animator_pos_map(pos, ECORE_POS_MAP_ACCELERATE, 0.0, 0.0); + if (st->finish) + { + if (st->dir == 0) + st->x = st->ox * (1.0 - p); + else if (st->dir == 1) + st->x = st->ox + ((st->w - st->ox) * p); + else if (st->dir == 2) + st->y = st->oy * (1.0 - p); + else if (st->dir == 3) + st->y = st->oy + ((st->h - st->oy) * p); + } + else + { + if (st->dir == 0) + st->x = st->ox + ((st->w - st->ox) * p); + else if (st->dir == 1) + st->x = st->ox * (1.0 - p); + else if (st->dir == 2) + st->y = st->oy + ((st->h - st->oy) * p); + else if (st->dir == 3) + st->y = st->oy * (1.0 - p); + } + _state_update(st); + if (pos < 1.0) return EINA_TRUE; + evas_object_show(st->front); + evas_object_show(st->back); + _state_end(st); + st->anim = NULL; + return EINA_FALSE; +} + +static void +_update_curl_job(void *data) +{ + State *st = data; + st->job = NULL; + if (_state_update(st)) + { + evas_object_hide(st->front); + evas_object_hide(st->back); + } +} + +static void +im_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + State *st = &state; + Evas_Event_Mouse_Down *ev = event_info; + Evas_Coord x, y, w, h; + + if (ev->button != 1) return; + st->front = data; + st->back = evas_object_data_get(data, "im2"); + st->backflip = 1; + st->down = 1; + evas_object_geometry_get(st->front, &x, &y, &w, &h); + st->x = ev->canvas.x - x; + st->y = ev->canvas.y - y; + st->w = w; + st->h = h; + st->down_x = st->x; + st->down_y = st->y; + st->dir = -1; + if (_state_update(st)) + { + evas_object_hide(st->front); + evas_object_hide(st->back); + } +} + +static void +im_up_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + State *st = &state; + Evas_Event_Mouse_Up *ev = event_info; + Evas_Coord x, y, w, h; + double tm = 0.5; + + if (ev->button != 1) return; + st->down = 0; + evas_object_geometry_get(st->front, &x, &y, &w, &h); + st->x = ev->canvas.x - x; + st->y = ev->canvas.y - y; + st->w = w; + st->h = h; + st->ox = st->x; + st->oy = st->y; + if (st->job) + { + ecore_job_del(st->job); + st->job = NULL; + } + if (st->anim) ecore_animator_del(st->anim); + st->finish = 0; + if (st->dir == 0) + { + tm = (double)st->x / (double)st->w; + if (st->x < (st->w / 2)) st->finish = 1; + } + else if (st->dir == 1) + { + if (st->x > (st->w / 2)) st->finish = 1; + tm = 1.0 - ((double)st->x / (double)st->w); + } + else if (st->dir == 2) + { + if (st->y < (st->h / 2)) st->finish = 1; + tm = (double)st->y / (double)st->h; + } + else if (st->dir == 3) + { + if (st->y > (st->h / 2)) st->finish = 1; + tm = 1.0 - ((double)st->y / (double)st->h); + } + if (tm < 0.01) tm = 0.01; + else if (tm > 0.99) tm = 0.99; + if (!st->finish) tm = 1.0 - tm; + tm *= 0.5; + st->anim = ecore_animator_timeline_add(tm, _state_anim, st); + _state_anim(st, 0.0); +} + +static void +im_move_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + State *st = &state; + Evas_Event_Mouse_Move *ev = event_info; + Evas_Coord x, y, w, h; + + if (!st->down) return; + evas_object_geometry_get(st->front, &x, &y, &w, &h); + st->x = ev->cur.canvas.x - x; + st->y = ev->cur.canvas.y - y; + st->w = w; + st->h = h; + if (st->job) ecore_job_del(st->job); + st->job = ecore_job_add(_update_curl_job, st); +} + +void +test_flip_page(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *im, *im2, *rc; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("flip-page", "Flip Page"); + elm_win_focus_highlight_enabled_set(win, EINA_TRUE); + elm_win_autodel_set(win, EINA_TRUE); + + im2 = evas_object_image_filled_add(evas_object_evas_get(win)); + snprintf(buf, sizeof(buf), "%s/images/%s", + elm_app_data_dir_get(), "sky_04.jpg"); + evas_object_image_file_set(im2, buf, NULL); + evas_object_move(im2, 40, 40); + evas_object_resize(im2, 400, 400); + evas_object_show(im2); + +#if 0 + im = elm_layout_add(win); + snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get()); + elm_layout_file_set(im, buf, "layout"); +#else + im = evas_object_image_filled_add(evas_object_evas_get(win)); + snprintf(buf, sizeof(buf), "%s/images/%s", + elm_app_data_dir_get(), "twofish.jpg"); + evas_object_image_file_set(im, buf, NULL); +#endif + evas_object_move(im, 40, 40); + evas_object_resize(im, 400, 400); + evas_object_show(im); + + evas_object_data_set(im, "im2", im2); + + + rc = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(rc, 0, 0, 0, 0); + evas_object_move(rc, 40, 340); + evas_object_resize(rc, 400, 100); + evas_object_show(rc); + + evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_DOWN, im_down_cb, im); + evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_UP, im_up_cb, im); + evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_MOVE, im_move_cb, im); + + rc = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(rc, 0, 0, 0, 0); + evas_object_move(rc, 40, 40); + evas_object_resize(rc, 400, 100); + evas_object_show(rc); + + evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_DOWN, im_down_cb, im); + evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_UP, im_up_cb, im); + evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_MOVE, im_move_cb, im); + + rc = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(rc, 0, 0, 0, 0); + evas_object_move(rc, 340, 40); + evas_object_resize(rc, 100, 400); + evas_object_show(rc); + + evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_DOWN, im_down_cb, im); + evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_UP, im_up_cb, im); + evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_MOVE, im_move_cb, im); + + rc = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(rc, 0, 0, 0, 0); + evas_object_move(rc, 40, 40); + evas_object_resize(rc, 100, 400); + evas_object_show(rc); + + evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_DOWN, im_down_cb, im); + evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_UP, im_up_cb, im); + evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_MOVE, im_move_cb, im); + + evas_object_resize(win, 480, 480); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_flipselector.c b/libraries/elementary/src/bin/test_flipselector.c new file mode 100644 index 0000000..100588d --- /dev/null +++ b/libraries/elementary/src/bin/test_flipselector.c @@ -0,0 +1,178 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +void +_sel_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Object_Item *it; + + it = event_info; + printf("label of selected item is: %s\n", elm_object_item_text_get(it)); +} + +void +_unsel_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Object_Item *it; + Evas_Object *fp = data; + it = elm_flipselector_selected_item_get(fp); + elm_flipselector_item_selected_set(it, EINA_FALSE); +} + +void +_last_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Object_Item *it; + Evas_Object *fp = data; + it = elm_flipselector_last_item_get(fp); + elm_flipselector_item_selected_set(it, EINA_TRUE); +} + +void +_third_from_end_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Object_Item *it; + Evas_Object *fp = data; + it = elm_flipselector_last_item_get(fp); + it = elm_flipselector_item_prev_get(it); + it = elm_flipselector_item_prev_get(it); + elm_flipselector_item_selected_set(it, EINA_TRUE); +} + +void +_underflow_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("underflow!\n"); +} + +void +_overflow_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("overflow!\n"); +} + +void +slider_change_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *fl = (Evas_Object *)data; + + double val = elm_slider_value_get(obj); + elm_flipselector_first_interval_set(fl, val); +} + +void +flip_next_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *fp = data; + elm_flipselector_flip_next(fp); +} + +void +flip_prev_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *fp = data; + elm_flipselector_flip_prev(fp); +} + +void +test_flipselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + char buf[8]; + unsigned int i; + Evas_Object *win, *bx, *fp, *bt, *bx2, *sl; + static const char *lbl[] = { + "Elementary", + "Evas", + "Eina", + "Edje", + "Eet", + "Ecore", + "Efreet", + "Edbus" + }; + + win = elm_win_util_standard_add("flipselector", "Flip Selector"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + fp = elm_flipselector_add(win); + evas_object_size_hint_weight_set(fp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_smart_callback_add(fp, "selected", _sel_cb, NULL); + evas_object_smart_callback_add(fp, "underflowed", _overflow_cb, NULL); + evas_object_smart_callback_add(fp, "overflowed", _underflow_cb, NULL); + for (i = 0; i < sizeof(lbl)/sizeof(char *); i++) + elm_flipselector_item_append(fp, lbl[i], NULL, NULL); + elm_box_pack_end(bx, fp); + evas_object_show(fp); + + bx2 = elm_box_add(win); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_horizontal_set(bx2, EINA_TRUE); + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + fp = elm_flipselector_add(win); + evas_object_smart_callback_add(fp, "underflowed", _overflow_cb, NULL); + evas_object_smart_callback_add(fp, "overflowed", _underflow_cb, NULL); + evas_object_size_hint_weight_set(fp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + for (i = 1990; i <= 2099; i++) + { + snprintf(buf, 8, "%d", i); + elm_flipselector_item_append(fp, buf, _sel_cb, NULL); + } + + bt = elm_button_add(win); + elm_object_text_set(bt, "Flip Prev"); + evas_object_smart_callback_add(bt, "clicked", flip_prev_cb, fp); + + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + elm_box_pack_end(bx2, fp); + evas_object_show(fp); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Flip Next"); + evas_object_smart_callback_add(bt, "clicked", flip_next_cb, fp); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + sl = elm_slider_add(win); + elm_object_text_set(sl, "Flip Iterval:"); + elm_slider_unit_format_set(sl, "%1.2f"); + elm_slider_min_max_set(sl, 0, 3.0); + elm_slider_value_set(sl, 0.85); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sl); + evas_object_show(sl); + evas_object_smart_callback_add(sl, "changed", slider_change_cb, fp); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Select Last"); + evas_object_smart_callback_add(bt, "clicked", _last_cb, fp); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Select 2097"); + evas_object_smart_callback_add(bt, "clicked", _third_from_end_cb, fp); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Unselect year"); + evas_object_smart_callback_add(bt, "clicked", _unsel_cb, fp); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_floating.c b/libraries/elementary/src/bin/test_floating.c new file mode 100644 index 0000000..2e3ac94 --- /dev/null +++ b/libraries/elementary/src/bin/test_floating.c @@ -0,0 +1,103 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +typedef struct _Testitem +{ + Elm_Object_Item *item; + int mode; + int onoff; +} Testitem; + + +static Elm_Genlist_Item_Class itc1; +static char *glf_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ + char buf[256]; + snprintf(buf, sizeof(buf), "Item # %i", (int)(long)data); + return strdup(buf); +} + +static Evas_Object *glf_content_get(void *data __UNUSED__, Evas_Object *obj, const char *part __UNUSED__) +{ + char buf[PATH_MAX]; + Evas_Object *ic = elm_icon_add(obj); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + return ic; +} +static Eina_Bool glf_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ + return EINA_FALSE; +} +static void glf_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__) +{ +} + +static void +gl_sel(void *data, Evas_Object *obj, void *event_info) +{ + printf("sel item data [%p] on genlist obj [%p], item pointer [%p]\n", data, obj, event_info); +} + +static Eina_Bool +anim(void *data) +{ + Evas_Object *gl = data; + Evas_Coord x, y; + + y = 0; + x = (sin(ecore_loop_time_get()) * 500); + evas_object_move(gl, x, y); + return ECORE_CALLBACK_RENEW; +} + +static void +_del(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Animator *ani = data; + + ecore_animator_del(ani); +} + +void +test_floating(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *gl; + int i; + Ecore_Animator *ani; + + win = elm_win_util_standard_add("floating", "Floating"); + elm_win_autodel_set(win, EINA_TRUE); + + gl = elm_genlist_add(win); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_move(gl, 800, 0); + evas_object_resize(gl, 480, 800); + evas_object_show(gl); + + itc1.item_style = "default"; + itc1.func.text_get = glf_text_get; + itc1.func.content_get = glf_content_get; + itc1.func.state_get = glf_state_get; + itc1.func.del = glf_del; + + for (i = 0; i < 20; i++) + { + elm_genlist_item_append(gl, &itc1, + (void *)(long)i/* item data */, + NULL/* parent */, + ELM_GENLIST_ITEM_NONE, + gl_sel/* func */, + (void *)(long)(i * 10)/* func data */); + } + evas_object_resize(win, 480, 800); + evas_object_show(win); + + ani = ecore_animator_add(anim, gl); + evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, _del, ani); +} +#endif diff --git a/libraries/elementary/src/bin/test_focus.c b/libraries/elementary/src/bin/test_focus.c new file mode 100644 index 0000000..af30f30 --- /dev/null +++ b/libraries/elementary/src/bin/test_focus.c @@ -0,0 +1,367 @@ +/* Test for Focus Chain Linear*/ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static Eina_Bool +_event(void *data __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info) +{ + if (type == EVAS_CALLBACK_KEY_DOWN) + printf ("Key Down:"); + else if (type == EVAS_CALLBACK_KEY_UP) + printf ("Key Up:"); + else + return EINA_FALSE; + Evas_Event_Key_Down *ev = event_info; + printf("%s\n", ev->key); + + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; +} + +static void +_on_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *einfo __UNUSED__) +{ + //Evas_Event_Key_Down *event = einfo; + //printf("%s %p Key %s Parent %p\n", evas_object_type_get(obj), + // obj, event->keyname, evas_object_smart_parent_get(obj)); +} + +static void +_disable(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *bt = data; + elm_object_disabled_set(bt, EINA_TRUE); +} + +static void +_enable(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *bt = data; + elm_object_disabled_set(bt, EINA_FALSE); +} + +static inline void +my_show(Evas_Object *obj) +{ + evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, + _on_key_down, NULL); + evas_object_show(obj); +} + +void +test_focus(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win; + unsigned int i, j; + + win = elm_win_util_standard_add("focus", "Focus"); + elm_win_focus_highlight_enabled_set(win, EINA_TRUE); + evas_object_resize(win, 800, 600); + elm_object_event_callback_add(win, _event, NULL); + elm_win_autodel_set(win, EINA_TRUE); + my_show(win); + + Evas_Object *mainbx = elm_box_add(win); + elm_box_horizontal_set(mainbx, EINA_TRUE); + elm_win_resize_object_add(win, mainbx); + evas_object_size_hint_weight_set(mainbx, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + my_show(mainbx); + + { //First Col + Evas_Object *bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_box_pack_end(mainbx, bx); + my_show(bx); + + { + Evas_Object *lb = elm_label_add(win); + elm_object_text_set(lb, "Use Tab or Shift+Tab"); + evas_object_size_hint_weight_set(lb, 0.0, 0.0); + evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, + EVAS_HINT_FILL); + elm_box_pack_end(bx, lb); + my_show(lb); + } + + { + Evas_Object *tg = elm_check_add(win); + elm_object_style_set(tg, "toggle"); + elm_object_part_text_set(tg, "on", "Yes"); + elm_object_part_text_set(tg, "off", "No"); + elm_box_pack_end(bx, tg); + my_show(tg); + } + + { + Evas_Object *en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); + elm_object_text_set(en, "This is a single line"); + elm_entry_single_line_set(en, EINA_TRUE); + elm_box_pack_end(bx, en); + my_show(en); + } + + { + Evas_Object *bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bx2, 0.0, 0.0); + elm_box_pack_end(bx, bx2); + + for (i = 2; i; i--) + { + Evas_Object *bt; + bt = elm_button_add(win); + elm_object_text_set(bt, "Box"); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + if (i%2) + elm_object_disabled_set(bt, EINA_TRUE); + elm_box_pack_end(bx2, bt); + my_show(bt); + } + + { + Evas_Object *sc = elm_scroller_add(win); + evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, + EVAS_HINT_FILL); + elm_scroller_bounce_set(sc, EINA_TRUE, EINA_TRUE); + elm_scroller_content_min_limit(sc, 1, 1); + elm_box_pack_end(bx2, sc); + my_show(sc); + + { + Evas_Object *bt; + bt = elm_button_add(win); + elm_object_text_set(bt, "Scroller"); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + elm_object_event_callback_add(bt, _event, NULL); + elm_object_content_set(sc, bt); + my_show(bt); + elm_object_event_callback_del(bt, _event, NULL); + } + } + + my_show(bx2); + } + + { + Evas_Object *bt; + bt = elm_button_add(win); + elm_object_text_set(bt, "Box"); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + elm_box_pack_end(bx, bt); + my_show(bt); + } + + { + Evas_Object *bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bx2, 0.0, 0.0); + elm_box_pack_end(bx, bx2); + my_show(bx2); + + for (i = 2; i; i--) + { + Evas_Object *bx3 = elm_box_add(win); + evas_object_size_hint_align_set(bx3, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bx3, 0.0, 0.0); + elm_box_pack_end(bx2, bx3); + my_show(bx3); + + for (j = 3; j; j--) + { + Evas_Object *bt; + bt = elm_button_add(win); + elm_object_text_set(bt, "Box"); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + elm_box_pack_end(bx3, bt); + my_show(bt); + } + } + + { + Evas_Object *sc = elm_scroller_add(win); + evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, + EVAS_HINT_FILL); + elm_scroller_bounce_set(sc, EINA_FALSE, EINA_TRUE); + elm_scroller_content_min_limit(sc, 1, 0); + elm_box_pack_end(bx2, sc); + my_show(sc); + + Evas_Object *bx3 = elm_box_add(win); + evas_object_size_hint_align_set(bx3, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bx3, 0.0, 0.0); + elm_object_content_set(sc, bx3); + my_show(bx3); + + for (i = 5; i; i--) + { + Evas_Object *bt; + bt = elm_button_add(win); + elm_object_text_set(bt, "BX Scroller"); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + elm_box_pack_end(bx3, bt); + my_show(bt); + } + } + } + } + + {//Second Col + char buf[PATH_MAX]; + Evas_Object *ly = elm_layout_add(win); + snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get()); + elm_layout_file_set(ly, buf, "twolines"); + evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_box_pack_end(mainbx, ly); + my_show(ly); + + { + Evas_Object *bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bx2, 0.0, 0.0); + elm_object_part_content_set(ly, "element1", bx2); + my_show(bx2); + + for (i = 3; i; i--) + { + Evas_Object *bt; + bt = elm_button_add(win); + elm_object_text_set(bt, "Layout"); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + elm_box_pack_end(bx2, bt); + my_show(bt); + elm_object_focus_custom_chain_prepend(bx2, bt, NULL); + } + } + + { + Evas_Object *bx2 = elm_box_add(win); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bx2, 0.0, 0.0); + elm_object_part_content_set(ly, "element2", bx2); + my_show(bx2); + + { + Evas_Object *bt; + bt = elm_button_add(win); + elm_object_text_set(bt, "Disable"); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_smart_callback_add(bt, "clicked", _disable, bt); + my_show(bt); + elm_object_focus_custom_chain_prepend(bx2, bt, NULL); + + Evas_Object *bt2; + bt2 = elm_button_add(win); + elm_object_text_set(bt2, "Enable"); + evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt2, 0.0, 0.0); + elm_box_pack_end(bx2, bt2); + evas_object_smart_callback_add(bt2, "clicked", _enable, bt); + my_show(bt2); + elm_object_focus_custom_chain_append(bx2, bt2, NULL); + } + + } + } + + {//Third Col + Evas_Object *bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_box_pack_end(mainbx, bx); + my_show(bx); + + { + Evas_Object *fr = elm_frame_add(win); + elm_object_text_set(fr, "Frame"); + elm_box_pack_end(bx, fr); + evas_object_show(fr); + + { + Evas_Object *tb = elm_table_add(win); + evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_content_set(fr, tb); + my_show(tb); + for (j = 0; j < 1; j++) + for (i = 0; i < 2; i++) + { + Evas_Object *bt; + bt = elm_button_add(win); + elm_object_text_set(bt, "Table"); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_table_pack(tb, bt, i, j, 1, 1); + my_show(bt); + } + } + } + + { + Evas_Object *fr = elm_bubble_add(win); + elm_object_text_set(fr, "Bubble"); + evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, + EVAS_HINT_FILL); + elm_box_pack_end(bx, fr); + evas_object_show(fr); + + { + Evas_Object *tb = elm_table_add(win); + evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_content_set(fr, tb); + my_show(tb); + for (j = 0; j < 2; j++) + for (i = 0; i < 1; i++) + { + Evas_Object *bt; + bt = elm_button_add(win); + elm_object_text_set(bt, "Table"); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_table_pack(tb, bt, i, j, 1, 1); + my_show(bt); + } + } + } + } +} +#endif diff --git a/libraries/elementary/src/bin/test_focus2.c b/libraries/elementary/src/bin/test_focus2.c new file mode 100644 index 0000000..81042bd --- /dev/null +++ b/libraries/elementary/src/bin/test_focus2.c @@ -0,0 +1,149 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static void +_focus_in(void *data __UNUSED__, Evas *e __UNUSED__, void *event_info) +{ + const char *type = evas_object_type_get(event_info); + if ((type) && (!strcmp(type, "elm_widget"))) + type = elm_object_widget_type_get(event_info); + printf("Evas_Object focus in: %p %s\n", event_info, type); +} + +static void +_focus_out(void *data __UNUSED__, Evas *e __UNUSED__, void *event_info) +{ + const char *type = evas_object_type_get(event_info); + if ((type) && (!strcmp(type, "elm_widget"))) + type = elm_object_widget_type_get(event_info); + printf("Evas_Object focus out: %p %s\n", event_info, type); +} + +static void +_focus_obj(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *newfocus = data; + const char *type = evas_object_type_get(newfocus); + if ((type) && (!strcmp(type, "elm_widget"))) + type = elm_object_widget_type_get(newfocus); + printf("elm_object_focus_set(%p, EINA_TRUE) %s\n", newfocus, type); + elm_object_focus_set(newfocus, EINA_TRUE); +} + +static void +_focus_layout_part(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *ed = elm_layout_edje_get(data); + + Evas_Object *newfocus = (Evas_Object *)edje_object_part_object_get(ed, "sky"); + const char *type = evas_object_type_get(newfocus); + printf("evas_object_focus_set(%p, EINA_TRUE) %s\n", newfocus, type); + evas_object_focus_set(newfocus, EINA_TRUE);; +} + + +void +test_focus2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *ly, *bt, *en, *bt1; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("focus2", "Focus 2"); + elm_win_autodel_set(win, EINA_TRUE); + elm_win_focus_highlight_enabled_set(win, EINA_TRUE); + + evas_event_callback_add + (evas_object_evas_get(win), EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN, + _focus_in, NULL); + evas_event_callback_add + (evas_object_evas_get(win), EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT, + _focus_out, NULL); + + bx = elm_box_add(win); + elm_win_resize_object_add(win, bx); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bx); + +#define PARENT bx /* this is broken, but should work */ +//#define PARENT win + + en = elm_entry_add(PARENT); + elm_entry_scrollable_set(en, EINA_TRUE); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); + elm_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + elm_object_text_set(en, "Entry that should get focus"); + elm_entry_single_line_set(en, EINA_TRUE); + evas_object_show(en); + elm_box_pack_end(bx, en); + + bt = elm_button_add(PARENT); + elm_object_text_set(bt, "Give focus to entry"); + evas_object_smart_callback_add(bt, "clicked", _focus_obj, en); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + ly = elm_layout_add(PARENT); + snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get()); + elm_layout_file_set(ly, buf, "layout"); + evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, ly); + evas_object_show(ly); + + bt1 = bt = elm_button_add(ly); + elm_object_text_set(bt, "Button 1"); + elm_object_part_content_set(ly, "element1", bt); + + en = elm_entry_add(ly); + elm_entry_scrollable_set(en, EINA_TRUE); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); + elm_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + elm_object_text_set(en, "Scrolled Entry that should get focus"); + elm_entry_single_line_set(en, EINA_TRUE); + elm_object_part_content_set(ly, "element2", en); + + bt = elm_button_add(ly); + elm_object_text_set(bt, "Button 2"); + elm_object_part_content_set(ly, "element3", bt); + + bt = elm_button_add(PARENT); + elm_object_text_set(bt, "Give focus to layout"); + evas_object_smart_callback_add(bt, "clicked", _focus_obj, ly); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(PARENT); + elm_object_text_set(bt, "Give focus to layout part"); + evas_object_smart_callback_add(bt, "clicked", _focus_layout_part, ly); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(PARENT); + elm_object_text_set(bt, "Give focus to layout 'Button 1'"); + evas_object_smart_callback_add(bt, "clicked", _focus_obj, bt1); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(PARENT); + elm_object_text_set(bt, "Give focus to layout 'Entry'"); + evas_object_smart_callback_add(bt, "clicked", _focus_obj, en); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + evas_object_resize(win, 400, 400); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_focus3.c b/libraries/elementary/src/bin/test_focus3.c new file mode 100644 index 0000000..71a5a8a --- /dev/null +++ b/libraries/elementary/src/bin/test_focus3.c @@ -0,0 +1,299 @@ +/* Test for Focus Chain Linear*/ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static Evas_Object *foc = NULL; + +static void +_foc(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + foc = obj; + printf("foc -> %p\n", foc); +} + +static void +_unfoc(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + foc = NULL; + printf("foc -> %p\n", foc); +} + +static void +_add(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *bx = data, *en; + + en = elm_entry_add(elm_object_top_widget_get(bx)); + elm_entry_scrollable_set(en, EINA_TRUE); + elm_object_text_set(en, "An entry"); + evas_object_smart_callback_add(en, "focused", _foc, NULL); + evas_object_smart_callback_add(en, "unfocused", _unfoc, NULL); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); + elm_entry_single_line_set(en, EINA_TRUE); + elm_box_pack_start(bx, en); + evas_object_show(en); +} + +static void +_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + if (foc) evas_object_del(foc); +} + +static void +_hide(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + if (foc) evas_object_hide(foc); +} + +void +test_focus3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *bt, *en; + + win = elm_win_util_standard_add("focus3", "Focus 3"); + elm_win_focus_highlight_enabled_set(win, EINA_TRUE); + evas_object_resize(win, 320, 480); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + elm_object_text_set(en, "An entry"); + evas_object_smart_callback_add(en, "focused", _foc, NULL); + evas_object_smart_callback_add(en, "unfocused", _unfoc, NULL); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); + elm_entry_single_line_set(en, EINA_TRUE); + elm_box_pack_end(bx, en); + evas_object_show(en); + + bt = elm_button_add(win); + elm_object_focus_allow_set(bt, 0); + elm_object_text_set(bt, "Add"); + evas_object_smart_callback_add(bt, "clicked", _add, bx); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_focus_allow_set(bt, 0); + elm_object_text_set(bt, "Del"); + evas_object_smart_callback_add(bt, "clicked", _del, NULL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_focus_allow_set(bt, 0); + elm_object_text_set(bt, "Hide"); + evas_object_smart_callback_add(bt, "clicked", _hide, NULL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + evas_object_show(win); +} + +static void +highlight_enabled_cb(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + elm_config_focus_highlight_enabled_set(elm_check_state_get(obj)); +} + +static void +highlight_animate_cb(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + elm_config_focus_highlight_animate_set(elm_check_state_get(obj)); +} + +static void +custom_chain_unset_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *c, *child = NULL; + Evas_Object *bx = (Evas_Object *)data; + Eina_List *l, *children = NULL, *custom_chain = NULL; + int i = 0; + + if (elm_check_state_get(obj)) + { + children = elm_box_children_get(bx); + EINA_LIST_FOREACH(children, l, c) + { + if (i == 0) + { + child = c; + custom_chain = eina_list_append(custom_chain, c); + elm_object_focus_custom_chain_set(bx, custom_chain); + } + else if (i == 1) elm_object_focus_custom_chain_prepend(bx, c, child); + else if (i == 2) + { + elm_object_focus_custom_chain_append(bx, c, child); + child = c; + } + else if (i == 3) elm_object_focus_custom_chain_prepend(bx, c, child); + i++; + } + } + else + { + if (!elm_object_focus_custom_chain_get(bx)) return; + elm_object_focus_custom_chain_unset(bx); + } +} + +static void +create_win_bt_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *gd, *bt; + + win = elm_win_util_standard_add("test focus", "Test Focus"); + elm_win_autodel_set(win, EINA_TRUE); + + gd = elm_grid_add(win); + elm_grid_size_set(gd, 100, 100); + evas_object_size_hint_weight_set(gd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, gd); + evas_object_show(gd); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 1"); + elm_grid_pack(gd, bt, 10, 10, 80, 20); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 2"); + elm_grid_pack(gd, bt, 10, 30, 80, 20); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 3"); + elm_grid_pack(gd, bt, 10, 50, 80, 20); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 4"); + elm_grid_pack(gd, bt, 10, 70, 80, 20); + evas_object_show(bt); + + evas_object_resize(win, 160, 160); + evas_object_show(win); +} + +void +test_focus4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *gd, *tg, *bt; + Evas_Object *lb, *bt1, *bt2, *bt3, *bt4, *bx; + Eina_List *custom_chain = NULL; + + win = elm_win_util_standard_add("focus4", "Focus 4"); + elm_win_autodel_set(win, EINA_TRUE); + elm_win_focus_highlight_enabled_set(win, EINA_TRUE); + elm_config_focus_highlight_enabled_set(EINA_TRUE); + elm_config_focus_highlight_animate_set(EINA_TRUE); + + /* First Example - Using Focus Highlight */ + gd = elm_grid_add(win); + elm_grid_size_set(gd, 100, 100); + evas_object_size_hint_weight_set(gd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, gd); + evas_object_show(gd); + + tg = elm_check_add(win); + evas_object_size_hint_weight_set(tg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(tg, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(tg, "Focus Highlight Enabled"); + elm_check_state_set(tg, EINA_TRUE); + evas_object_smart_callback_add(tg, "changed", highlight_enabled_cb, NULL); + elm_grid_pack(gd, tg, 10, 10, 50, 10); + evas_object_show(tg); + + tg = elm_check_add(win); + evas_object_size_hint_weight_set(tg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(tg, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(tg, "Focus Highlight Animate"); + elm_check_state_set(tg, EINA_TRUE); + evas_object_smart_callback_add(tg, "changed", highlight_animate_cb, NULL); + elm_grid_pack(gd, tg, 10, 20, 50, 10); + evas_object_show(tg); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Create Window"); + elm_grid_pack(gd, bt, 10, 30, 80, 10); + evas_object_smart_callback_add(bt, "clicked", create_win_bt_clicked, NULL); + evas_object_show(bt); + + /* Second Example - Using Custom Chain */ + lb = elm_label_add(win); + elm_object_text_set(lb, "Custom Chain: Please use tab key to check"); + evas_object_size_hint_weight_set(lb, 0.0, 0.0); + evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_grid_pack(gd, lb, 10, 45, 80, 5); + evas_object_show(lb); + + bx = elm_box_add(win); + elm_box_horizontal_set(bx, EINA_TRUE); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt1 = elm_button_add(win); + elm_object_text_set(bt1, "Button 1"); + evas_object_size_hint_weight_set(bt1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt1, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, bt1); + evas_object_show(bt1); + + bt2 = elm_button_add(win); + elm_object_text_set(bt2, "Button 2"); + evas_object_size_hint_weight_set(bt2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, bt2); + evas_object_show(bt2); + + bt3 = elm_button_add(win); + elm_object_text_set(bt3, "Button 3"); + evas_object_size_hint_weight_set(bt3, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt3, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, bt3); + evas_object_show(bt3); + + bt4 = elm_button_add(win); + elm_object_text_set(bt4, "Button 4"); + evas_object_size_hint_weight_set(bt4, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt4, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, bt4); + evas_object_show(bt4); + + custom_chain = eina_list_append(custom_chain, bt2); + custom_chain = eina_list_append(custom_chain, bt1); + custom_chain = eina_list_append(custom_chain, bt4); + custom_chain = eina_list_append(custom_chain, bt3); + elm_object_focus_custom_chain_set(bx, custom_chain); + + elm_grid_pack(gd, bx, 10, 50, 80, 30); + evas_object_show(bx); + + tg = elm_check_add(win); + elm_object_text_set(tg, "Custom Chain"); + elm_check_state_set(tg, EINA_TRUE); + evas_object_smart_callback_add(tg, "changed", custom_chain_unset_cb, bx); + elm_grid_pack(gd, tg, 10, 80, 40, 10); + evas_object_show(tg); + + evas_object_resize(win, 320, 320); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_gengrid.c b/libraries/elementary/src/bin/test_gengrid.c new file mode 100644 index 0000000..b17c8f9 --- /dev/null +++ b/libraries/elementary/src/bin/test_gengrid.c @@ -0,0 +1,842 @@ +#include +#include "test.h" +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static Elm_Gengrid_Item_Class *gic; +static Elm_Gengrid_Item_Class ggic; + +Evas_Object *grid_content_get(void *data, Evas_Object *obj, const char *part); +char *grid_text_get(void *data, Evas_Object *obj __UNUSED__, + const char *part __UNUSED__); +Eina_Bool grid_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, + const char *part __UNUSED__); +void grid_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__); + +typedef struct _Testitem +{ + Elm_Object_Item *item; + const char *path; + int mode; + int onoff; +} Testitem; + +struct _api_data +{ + unsigned int state; /* What state we are testing */ + Evas_Object *box; /* Use this to get box content */ + Evas_Object *grid; +}; +typedef struct _api_data api_data; + +enum _api_state +{ + GRID_ALIGN_SET, + GRID_BRING_IN, + GRID_NO_SELECT_MODE, + GRID_NO_BOUNCE, + GRID_PAGE_RELATIVE, + GRID_PAGE_SIZE, + GRID_TOOLTIP_SET_TEXT, + GRID_TOOLTIP_UNSET, + GRID_ITEM_CLASS_SET, + GRID_ITEM_UPDATE_SET, + GRID_PAGE_BRING_IN, + GRID_PAGE_SHOW, + GRID_TOOLTIP_CONTENT_CB, + GRID_TOOLTIP_STYLE_SET, + GRID_TOOLTIP_WINDOW_MODE_SET, + API_STATE_LAST +}; +typedef enum _api_state api_state; + +static void +set_api_state(api_data *api) +{ + Evas_Object *grid = api->grid; + + /* use elm_box_children_get() to get list of children */ + switch(api->state) + { /* Put all api-changes under switch */ + case GRID_ALIGN_SET: /* 0 */ + elm_gengrid_align_set(grid, 0.2, 0.8); + break; + + case GRID_BRING_IN: /* 1 */ + elm_gengrid_item_bring_in(elm_gengrid_first_item_get(grid), ELM_GENGRID_ITEM_SCROLLTO_IN); + break; + + case GRID_NO_SELECT_MODE: /* 2 */ + elm_gengrid_select_mode_set(grid, ELM_OBJECT_SELECT_MODE_NONE); + break; + + case GRID_NO_BOUNCE: /* 3 */ + elm_gengrid_bounce_set(grid, EINA_TRUE, EINA_FALSE); + break; + + case GRID_PAGE_RELATIVE: /* 4 */ + elm_gengrid_bounce_set(grid, EINA_TRUE, EINA_TRUE); + elm_gengrid_page_relative_set(grid, 0.5, 0.5); + break; + + case GRID_PAGE_SIZE: /* 5 */ + elm_gengrid_page_size_set(grid, 50, 25); + break; + + case GRID_TOOLTIP_SET_TEXT: /* 6 */ + { + Elm_Object_Item *item = elm_gengrid_first_item_get(grid); + elm_gengrid_item_tooltip_text_set(item, "This is the first item"); + } + break; + + case GRID_TOOLTIP_UNSET: /* 7 */ + { + Elm_Object_Item *item = elm_gengrid_first_item_get(grid); + elm_gengrid_item_tooltip_unset(item); + } + break; + + case API_STATE_LAST: + break; + + default: + return; + } +} + +static void +_api_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ /* Will add here a SWITCH command containing code to modify test-object */ + /* in accordance a->state value. */ + api_data *a = data; + char str[128]; + + printf("clicked event on API Button: api_state=<%d>\n", a->state); + set_api_state(a); + a->state++; + sprintf(str, "Next API function (%u)", a->state); + elm_object_text_set(obj, str); + elm_object_disabled_set(obj, a->state == API_STATE_LAST); +} + +static const char *img[9] = +{ + "panel_01.jpg", + "plant_01.jpg", + "rock_01.jpg", + "rock_02.jpg", + "sky_01.jpg", + "sky_02.jpg", + "sky_03.jpg", + "sky_04.jpg", + "wood_01.jpg", +}; + +static const char *cur[4] = +{ + ELM_CURSOR_CIRCLE, + ELM_CURSOR_CLOCK, + ELM_CURSOR_COFFEE_MUG, + ELM_CURSOR_CROSS, +}; + +static int n_current_pic = 0; +static void +_horizontal_grid(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *grid = data; + elm_gengrid_horizontal_set(grid, elm_check_state_get(obj)); +} + +static void +grid_drag_up(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + printf("Drag up: %p\n", event_info); +} + +static void +grid_drag_right(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + printf("Drag right: %p\n", event_info); +} + +static void +grid_drag_down(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + printf("Drag down: %p\n", event_info); +} + +static void +grid_drag_left(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + printf("Drag left: %p\n", event_info); +} + +static void +grid_drag_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + printf("Drag stop: %p\n", event_info); +} + +static void +grid_selected(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + printf("Selected: %p\n", event_info); +} + +static void +grid_double_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + printf("Double clicked: %p\n", event_info); +} + +static void +grid_longpress(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + printf("longpress %p\n", event_info); +} + +static void +grid_moved(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + printf("moved %p\n", event_info); +} + +static void +grid_item_check_changed(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Testitem *ti = data; + ti->onoff = elm_check_state_get(obj); + printf("item %p onoff = %i\n", ti, ti->onoff); +} + +char * +grid_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ + const Testitem *ti = data; + char buf[256]; + snprintf(buf, sizeof(buf), "Photo %s", ti->path); + return strdup(buf); +} + +Evas_Object * +grid_content_get(void *data, Evas_Object *obj, const char *part) +{ + const Testitem *ti = data; + if (!strcmp(part, "elm.swallow.icon")) + { + Evas_Object *icon = elm_bg_add(obj); + elm_bg_file_set(icon, ti->path, NULL); + evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + evas_object_show(icon); + return icon; + } + else if (!strcmp(part, "elm.swallow.end")) + { + Evas_Object *ck; + ck = elm_check_add(obj); + evas_object_propagate_events_set(ck, 0); + elm_check_state_set(ck, ti->onoff); + evas_object_smart_callback_add(ck, "changed", grid_item_check_changed, data); + evas_object_show(ck); + return ck; + } + return NULL; +} + +Eina_Bool +grid_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ + return EINA_FALSE; +} + +void +grid_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__) +{ +} + +static void +grid_sel(void *data, Evas_Object *obj, void *event_info) +{ + printf("sel item data [%p] on grid obj [%p], pointer [%p]\n", data, obj, event_info); +} + +static void +_cleanup_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + free(data); +} + +static void +always_select_mode_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + api_data *api = data; + if (elm_check_state_get(obj)) + elm_gengrid_select_mode_set(api->grid, ELM_OBJECT_SELECT_MODE_ALWAYS); + else + elm_gengrid_select_mode_set(api->grid, ELM_OBJECT_SELECT_MODE_DEFAULT); +} + +static void +multi_select_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + api_data *api = data; + elm_gengrid_multi_select_set(api->grid, elm_check_state_get(obj)); +} + +static void +clear_bt_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + api_data *api = data; + elm_gengrid_clear(api->grid); +} + +static Evas_Object * +create_gengrid(Evas_Object *obj, int items) +{ + Evas_Object *grid = NULL; + static Testitem ti[144]; + int i, n; + char buf[PATH_MAX]; + + grid = elm_gengrid_add(obj); + elm_gengrid_item_size_set(grid, 150, 150); + elm_gengrid_horizontal_set(grid, EINA_FALSE); + elm_gengrid_multi_select_set(grid, EINA_TRUE); + elm_gengrid_reorder_mode_set(grid, EINA_TRUE); + evas_object_smart_callback_add(grid, "selected", grid_selected, NULL); + evas_object_smart_callback_add(grid, "clicked,double", grid_double_clicked, NULL); + evas_object_smart_callback_add(grid, "longpressed", grid_longpress, NULL); + evas_object_smart_callback_add(grid, "moved", grid_moved, NULL); + evas_object_smart_callback_add(grid, "drag,start,up", grid_drag_up, NULL); + evas_object_smart_callback_add(grid, "drag,start,right", grid_drag_right, NULL); + evas_object_smart_callback_add(grid, "drag,start,down", grid_drag_down, NULL); + evas_object_smart_callback_add(grid, "drag,start,left", grid_drag_left, NULL); + evas_object_smart_callback_add(grid, "drag,stop", grid_drag_stop, NULL); + evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL); + + gic = elm_gengrid_item_class_new(); + gic->item_style = "default"; + gic->func.text_get = grid_text_get; + gic->func.content_get = grid_content_get; + gic->func.state_get = grid_state_get; + gic->func.del = grid_del; + + n = 0; + for (i = 0; i < items; i++) + { + snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), img[n]); + n = (n + 1) % 9; + ti[i].mode = i; + ti[i].path = eina_stringshare_add(buf); + ti[i].item = elm_gengrid_item_append(grid, gic, &(ti[i]), grid_sel, NULL); + if (!(i % 5)) + elm_gengrid_item_selected_set(ti[i].item, EINA_TRUE); + } + elm_gengrid_item_class_free(gic); + + return grid; +} + +static void +restore_bt_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + api_data *api = data; + elm_box_clear(api->box); + api->grid = create_gengrid(obj, (12 * 12)); + elm_box_pack_end(api->box, api->grid); + evas_object_show(api->grid); +} + +static void +filled_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *box = (Evas_Object *)data; + Evas_Object *grid; + + elm_box_clear(box); + grid = create_gengrid(box, 1); + elm_gengrid_filled_set(grid, elm_check_state_get(obj)); + elm_box_pack_end(box, grid); + evas_object_show(grid); +} + +static void +filled_bt_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *box, *content_box, *grid, *tg; + + win = elm_win_util_standard_add("test filled", "Test Filled"); + elm_win_autodel_set(win, EINA_TRUE); + + box = elm_box_add(win); + elm_win_resize_object_add(win, box); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(box); + + content_box = elm_box_add(win); + elm_win_resize_object_add(win, content_box); + evas_object_size_hint_weight_set(content_box, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(content_box, EVAS_HINT_FILL, + EVAS_HINT_FILL); + elm_box_pack_end(box, content_box); + evas_object_show(content_box); + + grid = create_gengrid(win, 1); + elm_box_pack_end(content_box, grid); + evas_object_show(grid); + + tg = elm_check_add(win); + elm_object_text_set(tg, "Filled"); + evas_object_smart_callback_add(tg, "changed", filled_cb, content_box); + elm_box_pack_end(box, tg); + evas_object_show(tg); + + evas_object_resize(win, 450, 200); + evas_object_show(win); +} + +static void +cursor_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *grid = (Evas_Object *)data; + Elm_Object_Item *item = NULL; + int i = 0; + + for ((item = elm_gengrid_first_item_get(grid)); item; + (item = elm_gengrid_item_next_get(item))) + { + if (!elm_check_state_get(obj)) + { + elm_gengrid_item_cursor_unset(item); + continue; + } + + elm_gengrid_item_cursor_set(item, cur[i]); + elm_gengrid_item_cursor_engine_only_set(item, EINA_FALSE); + i++; + } +} + +static void +cursor_bt_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *box, *content_box, *hbox, *grid, *tg; + + win = elm_win_util_standard_add("test cursor", "Test Cursor"); + elm_win_autodel_set(win, EINA_TRUE); + + box = elm_box_add(win); + elm_win_resize_object_add(win, box); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(box); + + content_box = elm_box_add(win); + elm_win_resize_object_add(win, content_box); + evas_object_size_hint_weight_set(content_box, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(content_box, EVAS_HINT_FILL, + EVAS_HINT_FILL); + elm_box_pack_end(box, content_box); + evas_object_show(content_box); + + grid = create_gengrid(win, 4); + elm_box_pack_end(content_box, grid); + evas_object_show(grid); + + hbox = elm_box_add(win); + elm_box_horizontal_set(hbox, EINA_TRUE); + + tg = elm_check_add(win); + elm_object_text_set(tg, "Cursor"); + evas_object_smart_callback_add(tg, "changed", cursor_cb, grid); + elm_box_pack_end(hbox, tg); + evas_object_show(tg); + + elm_box_pack_end(box, hbox); + evas_object_show(hbox); + + evas_object_resize(win, 450, 450); + evas_object_show(win); +} + +void +test_gengrid(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bt, *content_box, *bxx, *bx, *tg; + api_data *api = calloc(1, sizeof(api_data)); + + win = elm_win_util_standard_add("gengrid", "GenGrid"); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api); + + bxx = elm_box_add(win); + api->box = bxx; + elm_win_resize_object_add(win, bxx); + evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bxx); + + content_box = elm_box_add(win); + api->box = content_box; + evas_object_size_hint_weight_set(content_box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(content_box, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(content_box); + + /* Create GenGrid */ + api->grid = create_gengrid(win, (12 * 12)); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Next API function"); + evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, + (void *)api); + elm_box_pack_end(bxx, bt); + elm_object_disabled_set(bt, api->state == API_STATE_LAST); + evas_object_show(bt); + + elm_box_pack_end(content_box, api->grid); + elm_box_pack_end(bxx, content_box); + evas_object_show(api->grid); + + bx = elm_box_add(win); + elm_box_horizontal_set(bx, EINA_TRUE); + elm_box_pack_end(bxx, bx); + evas_object_show(bx); + + /* Gengrid Always Select Mode Test */ + tg = elm_check_add(win); + evas_object_size_hint_weight_set(tg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(tg, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(tg, "Always Select Mode"); + evas_object_smart_callback_add(tg, "changed", always_select_mode_cb, + (void *)api); + elm_box_pack_end(bx, tg); + evas_object_show(tg); + + tg = elm_check_add(win); + evas_object_size_hint_weight_set(tg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(tg, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(tg, "Multi Select Mode"); + elm_check_state_set(tg, EINA_TRUE); + evas_object_smart_callback_add(tg, "changed", multi_select_cb, + (void *)api); + elm_box_pack_end(bx, tg); + evas_object_show(tg); + + /* Gengrid Clear Test */ + bt = elm_button_add(win); + elm_object_text_set(bt, "Clear"); + evas_object_smart_callback_add(bt, "clicked", clear_bt_clicked, + (void *)api); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Restore"); + evas_object_smart_callback_add(bt, "clicked", restore_bt_clicked, + (void *) api); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + /* Gengrid Filled Test */ + bt = elm_button_add(win); + elm_object_text_set(bt, "Check Filled"); + evas_object_smart_callback_add(bt, "clicked", filled_bt_clicked, NULL); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + /* Item Cursor Test */ + bt = elm_button_add(win); + elm_object_text_set(bt, "Check Cursor"); + evas_object_smart_callback_add(bt, "clicked", cursor_bt_clicked, + (void *) api); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + evas_object_resize(win, 600, 600); + evas_object_show(win); +} + +static void +_before_bt_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Testitem *ti; + Evas_Object *grid = data; + Elm_Object_Item *sel; + char buf[PATH_MAX]; + + sel = elm_gengrid_selected_item_get(grid); + if (!sel) + return; + snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), img[n_current_pic]); + n_current_pic = ((n_current_pic +1) % 9); + ti = calloc(1, sizeof(*ti)); + ti->mode = 0; + ti->path = eina_stringshare_add(buf); + ti->item = elm_gengrid_item_insert_before(grid, gic, ti, sel, grid_sel, + NULL); +} + +static int +compare_cb(const void *data1, const void *data2) +{ + Testitem *ti1 = (Testitem *)data1; + Testitem *ti2 = (Testitem *)data2; + return strlen(ti1->path) - strlen(ti2->path); +} + +static void +_sorted_bt_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Testitem *ti; + Evas_Object *grid = data; + char buf[PATH_MAX]; + + snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), img[n_current_pic]); + n_current_pic = ((n_current_pic +1) % 9); + ti = calloc(1, sizeof(*ti)); + ti->mode = 0; + ti->path = eina_stringshare_add(buf); + ti->item = elm_gengrid_item_sorted_insert(grid, gic, ti, compare_cb, grid_sel, + NULL); +} + +static void +_after_bt_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Testitem *ti; + Evas_Object *grid = data; + Elm_Object_Item *sel; + char buf[PATH_MAX]; + + sel = elm_gengrid_selected_item_get(grid); + if (!sel) + return; + snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), img[n_current_pic]); + n_current_pic = ((n_current_pic +1) % 9); + ti = calloc(1, sizeof(*ti)); + ti->mode = 0; + ti->path = eina_stringshare_add(buf); + ti->item = elm_gengrid_item_insert_after(grid, gic, ti, sel, grid_sel, + NULL); +} + +static void +_delete_bt_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *grid = data; + Eina_List *l, *l2, *l3; + Elm_Object_Item *gg_it; + + l = (Eina_List*)elm_gengrid_selected_items_get(grid); + if (!l) return; + EINA_LIST_FOREACH_SAFE(l, l2, l3, gg_it) + elm_object_item_del(gg_it); +} + +static void +_prepend_bt_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Testitem *ti; + Evas_Object *grid = data; + char buf[PATH_MAX]; + + snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), img[n_current_pic]); + n_current_pic = ((n_current_pic +1) % 9); + ti = calloc(1, sizeof(*ti)); + ti->mode = 0; + ti->path = eina_stringshare_add(buf); + ti->item = elm_gengrid_item_prepend(grid, gic, ti, grid_sel, NULL); +} + +static void +_append_bt_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Testitem *ti; + Evas_Object *grid = data; + char buf[PATH_MAX]; + + snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), img[n_current_pic]); + n_current_pic = ((n_current_pic +1) % 9); + ti = calloc(1, sizeof(*ti)); + ti->mode = 0; + ti->path = eina_stringshare_add(buf); + ti->item = elm_gengrid_item_append(grid, gic, ti, grid_sel, NULL); +} + +static void +_size_changed(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *grid = data; + int size = elm_spinner_value_get(obj); + elm_gengrid_item_size_set(grid, size, size); +} + +void +test_gengrid2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *grid, *bx, *hbx, *bt, *ck; + + win = elm_win_util_standard_add("gengrid2", "GenGrid 2"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + grid = elm_gengrid_add(win); + elm_gengrid_item_size_set(grid, 150, 150); + elm_gengrid_horizontal_set(grid, EINA_FALSE); + elm_gengrid_multi_select_set(grid, EINA_FALSE); + evas_object_smart_callback_add(grid, "selected", grid_selected, NULL); + evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_min_set(grid, 600, 500); + elm_box_pack_end(bx, grid); + evas_object_show(grid); + + hbx = elm_box_add(win); + evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_horizontal_set(hbx, EINA_TRUE); + elm_box_pack_end(bx, hbx); + evas_object_show(hbx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Append"); + evas_object_smart_callback_add(bt, "clicked", _append_bt_clicked, grid); + elm_box_pack_end(hbx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Prepend"); + evas_object_smart_callback_add(bt, "clicked", _prepend_bt_clicked, grid); + elm_box_pack_end(hbx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Insert before"); + evas_object_smart_callback_add(bt, "clicked", _before_bt_clicked, grid); + elm_box_pack_end(hbx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Insert after"); + evas_object_smart_callback_add(bt, "clicked", _after_bt_clicked, grid); + elm_box_pack_end(hbx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Sorted insert"); + evas_object_smart_callback_add(bt, "clicked", _sorted_bt_clicked, grid); + elm_box_pack_end(hbx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Delete"); + evas_object_smart_callback_add(bt, "clicked", _delete_bt_clicked, grid); + elm_box_pack_end(hbx, bt); + evas_object_show(bt); + + bt = elm_spinner_add(win); + elm_spinner_min_max_set(bt, 10, 1024); + elm_spinner_value_set(bt, 150); + elm_spinner_label_format_set(bt, "Item size: %.0f"); + evas_object_smart_callback_add(bt, "changed", _size_changed, grid); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(hbx, bt); + evas_object_show(bt); + + ck = elm_check_add(win); + elm_object_text_set(ck, "Horizontal Mode"); + evas_object_smart_callback_add(ck, "changed", _horizontal_grid, grid); + elm_box_pack_end(hbx, ck); + evas_object_show(ck); + + gic = elm_gengrid_item_class_new(); + + gic->item_style = "default"; + gic->func.text_get = grid_text_get; + gic->func.content_get = grid_content_get; + gic->func.state_get = grid_state_get; + gic->func.del = grid_del; + + /* item_class_ref is needed for gic. some items can be added in callbacks */ + elm_gengrid_item_class_ref(gic); + elm_gengrid_item_class_free(gic); + + evas_object_resize(win, 600, 600); + evas_object_show(win); +} + +void +test_gengrid3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *grid; + static Testitem ti[144]; + int i, n; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("gengrid_group", "GenGrid Group"); + elm_win_autodel_set(win, EINA_TRUE); + + grid = elm_gengrid_add(win); + elm_gengrid_item_size_set(grid, 150, 150); + elm_gengrid_group_item_size_set(grid, 31, 31); + //elm_gengrid_horizontal_set(grid, EINA_TRUE); + elm_gengrid_horizontal_set(grid, EINA_FALSE); + elm_gengrid_multi_select_set(grid, EINA_TRUE); + elm_gengrid_reorder_mode_set(grid, EINA_TRUE); + evas_object_smart_callback_add(grid, "selected", grid_selected, NULL); + evas_object_smart_callback_add(grid, "clicked,double", grid_double_clicked, NULL); + evas_object_smart_callback_add(grid, "longpressed", grid_longpress, NULL); + evas_object_smart_callback_add(grid, "moved", grid_moved, NULL); + evas_object_smart_callback_add(grid, "drag,start,up", grid_drag_up, NULL); + evas_object_smart_callback_add(grid, "drag,start,right", grid_drag_right, NULL); + evas_object_smart_callback_add(grid, "drag,start,down", grid_drag_down, NULL); + evas_object_smart_callback_add(grid, "drag,start,left", grid_drag_left, NULL); + evas_object_smart_callback_add(grid, "drag,stop", grid_drag_stop, NULL); + evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + gic = elm_gengrid_item_class_new(); + gic->item_style = "default"; + gic->func.text_get = grid_text_get; + gic->func.content_get = grid_content_get; + gic->func.state_get = grid_state_get; + gic->func.del = grid_del; + + ggic.item_style = "group_index"; + ggic.func.text_get = grid_text_get; + ggic.func.content_get = NULL; + ggic.func.state_get = NULL; + ggic.func.del = NULL; + + n = 0; + for (i = 0; i < 12 * 12; i++) + { + snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), img[n]); + n = (n + 1) % 9; + ti[i].mode = i; + ti[i].path = eina_stringshare_add(buf); + if (i == 0 || i == 18 || i == 53 || i == 100) + //if (i == 0 || i == 18) + ti[i].item = elm_gengrid_item_append(grid, &ggic, &(ti[i]), grid_sel, NULL); + else + ti[i].item = elm_gengrid_item_append(grid, gic, &(ti[i]), grid_sel, NULL); + if (!(i % 5)) + elm_gengrid_item_selected_set(ti[i].item, EINA_TRUE); + } + elm_gengrid_item_class_free(gic); + + evas_object_show(grid); + elm_win_resize_object_add(win, grid); + + evas_object_resize(win, 600, 600); + evas_object_show(win); +} + +#endif diff --git a/libraries/elementary/src/bin/test_genlist.c b/libraries/elementary/src/bin/test_genlist.c new file mode 100644 index 0000000..9e69942 --- /dev/null +++ b/libraries/elementary/src/bin/test_genlist.c @@ -0,0 +1,2814 @@ +#include +#include "test.h" +#ifdef HAVE_CONFIG_H +#include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +struct _api_data +{ + unsigned int state; /* What state we are testing */ + void *box; /* Use this to get box content */ +}; +typedef struct _api_data api_data; + +enum _api_state +{ + HORIZONTAL_SET, + NO_SELECT_MODE_SET, + COMPRESS_MODE_SET, + BOUNCE_SET, + HOMOGENEOUS_SET, + SCROLLER_POLICY_SET, + TOOLTIP_TEXT_SET, + ITEM_CURSOR_SET, + API_STATE_LAST +}; +typedef enum _api_state api_state; + +static void +set_api_state(api_data *api) +{ + const Eina_List *items = elm_box_children_get(api->box); + if (!eina_list_count(items)) + return; + + Evas_Object *gl = eina_list_nth(items, 0); /* Genlist is the first item */ + /* use elm_box_children_get() to get list of children */ + switch(api->state) + {/* Put all api-changes under switch */ + case HORIZONTAL_SET: /* 0 */ + elm_genlist_mode_set(gl, ELM_LIST_LIMIT); + break; + + case NO_SELECT_MODE_SET: /* 1 */ + elm_genlist_select_mode_set(gl, ELM_OBJECT_SELECT_MODE_NONE); + elm_genlist_mode_set(gl, ELM_LIST_SCROLL); /* Back to default */ + break; + + case COMPRESS_MODE_SET: /* 2 */ + elm_genlist_select_mode_set(gl, ELM_OBJECT_SELECT_MODE_DEFAULT); + elm_genlist_mode_set(gl, ELM_LIST_COMPRESS); + break; + + case BOUNCE_SET: /* 3 */ + elm_genlist_bounce_set(gl, EINA_FALSE, EINA_FALSE); + break; + + case HOMOGENEOUS_SET: /* 4 */ + elm_genlist_bounce_set(gl, EINA_TRUE, EINA_TRUE); /* Back to default */ + elm_genlist_homogeneous_set(gl, EINA_TRUE); + break; + + case SCROLLER_POLICY_SET: /* 5 */ + elm_genlist_homogeneous_set(gl, EINA_FALSE); /* Back to default */ + elm_genlist_scroller_policy_set(gl, ELM_SCROLLER_POLICY_ON, ELM_SCROLLER_POLICY_ON); + break; + + case TOOLTIP_TEXT_SET: /* 6 */ + { + elm_genlist_item_tooltip_text_set(elm_genlist_first_item_get(gl), "Tooltip text from API"); + elm_genlist_item_bring_in(elm_genlist_first_item_get(gl), + ELM_GENLIST_ITEM_SCROLLTO_IN); + } + break; + + case ITEM_CURSOR_SET: /* 7 */ + elm_genlist_item_cursor_set(elm_genlist_first_item_get(gl), ELM_CURSOR_HAND2); + break; + + default: + return; + } +} + +static void +_api_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ /* Will add here a SWITCH command containing code to modify test-object */ + /* in accordance a->state value. */ + api_data *a = data; + char str[128]; + + printf("clicked event on API Button: api_state=<%d>\n", a->state); + set_api_state(a); + a->state++; + sprintf(str, "Next API function (%u)", a->state); + elm_object_text_set(obj, str); + elm_object_disabled_set(obj, a->state == API_STATE_LAST); +} +/* Hint: + * In this example some calls to elm_genlist_item_append() are used which give the + * value of an int as 'item data' and 'func data' after casting into (void*). For + * sure this works only on architectures where sizeof(int)==sizeof(void*). + * For real world usage you should hold a data structure or value in your + * application and then give only a pointer to this data as data pointer. + */ + +typedef struct _Testitem +{ + Elm_Object_Item *item; + int mode; + int onoff; + Eina_Bool checked; +} Testitem; + +static Elm_Genlist_Item_Class *itc1; +char *gl_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ + char buf[256]; + snprintf(buf, sizeof(buf), "Item # %i", (int)(long)data); + return strdup(buf); +} + +Evas_Object *gl_content_get(void *data __UNUSED__, Evas_Object *obj, const char *part) +{ + char buf[PATH_MAX]; + Evas_Object *ic = elm_icon_add(obj); + if (!strcmp(part, "elm.swallow.end")) + snprintf(buf, sizeof(buf), "%s/images/bubble.png", elm_app_data_dir_get()); + else + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + return ic; +} + +Eina_Bool gl_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ + return EINA_FALSE; +} + +static void +gl_sel(void *data, Evas_Object *obj, void *event_info) +{ + printf("sel item data [%p] on genlist obj [%p], item pointer [%p]\n", data, obj, event_info); +} + +static void +_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Evas_Object *gl = data; + Evas_Event_Mouse_Move *ev = event_info; + int where = 0; + Elm_Object_Item *gli; + gli = elm_genlist_at_xy_item_get(gl, ev->cur.canvas.x, ev->cur.canvas.y, &where); + if (gli) + printf("over %p, where %i\n", elm_object_item_data_get(gli), where); + else + printf("over none, where %i\n", where); +} + +static void +_bt50_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_genlist_item_bring_in(data, ELM_GENLIST_ITEM_SCROLLTO_IN); +} + +static void +_bt1500_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_genlist_item_bring_in(data, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE); +} + +static void +_gl_selected(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + printf("selected: %p\n", event_info); +} + +static void +_gl_double_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + printf("double clicked: %p\n", event_info); +} + +static void +_gl_longpress(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + printf("longpress %p\n", event_info); +} + +static void +_cleanup_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + free(data); +} + +void +test_genlist(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *gl, *bt_50, *bt_1500, *bx, *bxx, *bt; + Evas_Object *over; + Elm_Object_Item *gli; + int i; + api_data *api = calloc(1, sizeof(api_data)); + + win = elm_win_util_standard_add("genlist", "Genlist"); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api); + + bxx = elm_box_add(win); + elm_win_resize_object_add(win, bxx); + evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bxx); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + api->box = bx; + evas_object_show(bx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Next API function"); + evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api); + elm_box_pack_end(bxx, bt); + elm_object_disabled_set(bt, api->state == API_STATE_LAST); + evas_object_show(bt); + + elm_box_pack_end(bxx, bx); + + gl = elm_genlist_add(win); + evas_object_smart_callback_add(gl, "selected", _gl_selected, NULL); + evas_object_smart_callback_add(gl, "clicked,double", _gl_double_clicked, NULL); + evas_object_smart_callback_add(gl, "longpressed", _gl_longpress, NULL); + // FIXME: This causes genlist to resize the horiz axis very slowly :( + // Reenable this and resize the window horizontally, then try to resize it back + //elm_genlist_mode_set(gl, ELM_LIST_LIMIT); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, gl); + evas_object_show(gl); + + over = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(over, 0, 0, 0, 0); + evas_object_event_callback_add(over, EVAS_CALLBACK_MOUSE_MOVE, _move, gl); + evas_object_repeat_events_set(over, 1); + evas_object_show(over); + evas_object_size_hint_weight_set(over, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, over); + + itc1 = elm_genlist_item_class_new(); + itc1->item_style = "default"; + itc1->func.text_get = gl_text_get; + itc1->func.content_get = gl_content_get; + itc1->func.state_get = gl_state_get; + itc1->func.del = NULL; + + bt_50 = elm_button_add(win); + elm_object_text_set(bt_50, "Go to 50"); + evas_object_show(bt_50); + elm_box_pack_end(bx, bt_50); + + bt_1500 = elm_button_add(win); + elm_object_text_set(bt_1500, "Go to 1500"); + evas_object_show(bt_1500); + elm_box_pack_end(bx, bt_1500); + + for (i = 0; i < 2000; i++) + { + gli = elm_genlist_item_append(gl, itc1, + (void *)(long)i/* item data */, + NULL/* parent */, + ELM_GENLIST_ITEM_NONE, + gl_sel/* func */, + (void *)(long)(i * 10)/* func data */); + if (i == 50) + evas_object_smart_callback_add(bt_50, "clicked", _bt50_cb, gli); + else if (i == 1500) + evas_object_smart_callback_add(bt_1500, "clicked", _bt1500_cb, gli); + } + elm_genlist_item_class_free(itc1); + + evas_object_resize(win, 480, 800); + evas_object_show(win); +} + +/*************/ + +static void +my_gl_clear(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *gl = data; + elm_genlist_clear(gl); +} + +static void +my_gl_add(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *gl = data; + static int i = 0; + + itc1->item_style = "default"; + itc1->func.text_get = gl_text_get; + itc1->func.content_get = gl_content_get; + itc1->func.state_get = gl_state_get; + itc1->func.del = NULL; + + elm_genlist_item_append(gl, itc1, + (void *)(long)i/* item data */, + NULL/* parent */, + ELM_GENLIST_ITEM_NONE, + gl_sel/* func */, + (void *)(long)(i * 10)/* func data */); + i++; +} + +static void +my_gl_insert_before(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *gl = data; + static int i = 0; + Elm_Object_Item *gli_selected; + + itc1->item_style = "default"; + itc1->func.text_get = gl_text_get; + itc1->func.content_get = gl_content_get; + itc1->func.state_get = gl_state_get; + itc1->func.del = NULL; + + gli_selected = elm_genlist_selected_item_get(gl); + if (!gli_selected) + { + printf("no item selected\n"); + return ; + } + + elm_genlist_item_insert_before(gl, itc1, + (void *)(long)i/* item data */, + NULL/* parent */, + gli_selected /* item before */, + ELM_GENLIST_ITEM_NONE, + gl_sel/* func */, + (void *)(long)(i * 10)/* func data */); + i++; +} + +static void +my_gl_insert_after(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *gl = data; + static int i = 0; + Elm_Object_Item *gli_selected; + + itc1->item_style = "default"; + itc1->func.text_get = gl_text_get; + itc1->func.content_get = gl_content_get; + itc1->func.state_get = gl_state_get; + itc1->func.del = NULL; + + gli_selected = elm_genlist_selected_item_get(gl); + if (!gli_selected) + { + printf("no item selected\n"); + return ; + } + + elm_genlist_item_insert_after(gl, itc1, + (void *)(long)i/* item data */, + NULL/* parent */, + gli_selected /* item after */, + ELM_GENLIST_ITEM_NONE, + gl_sel/* func */, + (void *)(long)(i * 10)/* func data */); + i++; +} + +static void +my_gl_del(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *gl = data; + Elm_Object_Item *gli = elm_genlist_selected_item_get(gl); + if (!gli) + { + printf("no item selected\n"); + return; + } + elm_object_item_del(gli); +} + +static void +my_gl_disable(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *gl = data; + Elm_Object_Item *gli = elm_genlist_selected_item_get(gl); + if (!gli) + { + printf("no item selected\n"); + return; + } + elm_object_item_disabled_set(gli, EINA_TRUE); + elm_genlist_item_selected_set(gli, EINA_FALSE); + elm_genlist_item_update(gli); +} + +static void +my_gl_update_all(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *gl = data; + int i = 0; + Elm_Object_Item *it = elm_genlist_first_item_get(gl); + while (it) + { + elm_genlist_item_update(it); + printf("%i\n", i); + i++; + it = elm_genlist_item_next_get(it); + } +} + +static void +my_gl_first(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *gl = data; + Elm_Object_Item *gli = elm_genlist_first_item_get(gl); + if (!gli) return; + elm_genlist_item_show(gli, ELM_GENLIST_ITEM_SCROLLTO_IN); + elm_genlist_item_selected_set(gli, 1); +} + +static void +my_gl_last(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *gl = data; + Elm_Object_Item *gli = elm_genlist_last_item_get(gl); + if (!gli) return; + elm_genlist_item_show(gli, ELM_GENLIST_ITEM_SCROLLTO_IN); + elm_genlist_item_selected_set(gli, 1); +} + +static Eina_Bool +my_gl_flush_delay(void *data __UNUSED__) +{ + elm_cache_all_flush(); + return ECORE_CALLBACK_CANCEL; +} + +static void +my_gl_flush(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + ecore_timer_add(1.2, my_gl_flush_delay, NULL); +} + +void +test_genlist2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bg, *gl, *bx, *bx2, *bx3, *bt; + Elm_Object_Item *gli[10]; + char buf[PATH_MAX]; + + win = elm_win_add(NULL, "genlist2", ELM_WIN_BASIC); + elm_win_title_set(win, "Genlist 2"); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); + elm_bg_file_set(bg, buf, NULL); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + gl = elm_genlist_add(win); + evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(gl); + + itc1 = elm_genlist_item_class_new(); + itc1->item_style = "default"; + itc1->func.text_get = gl_text_get; + itc1->func.content_get = gl_content_get; + itc1->func.state_get = gl_state_get; + itc1->func.del = NULL; + + gli[0] = elm_genlist_item_append(gl, itc1, + (void *)1001/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */, + (void *)1001/* func data */); + gli[1] = elm_genlist_item_append(gl, itc1, + (void *)1002/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */, + (void *)1002/* func data */); + gli[2] = elm_genlist_item_append(gl, itc1, + (void *)1003/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */, + (void *)1003/* func data */); + gli[3] = elm_genlist_item_prepend(gl, itc1, + (void *)1004/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */, + (void *)1004/* func data */); + gli[4] = elm_genlist_item_prepend(gl, itc1, + (void *)1005/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */, + (void *)1005/* func data */); + gli[5] = elm_genlist_item_insert_before(gl, itc1, + (void *)1006/* item data */, NULL/* parent */, gli[2]/* rel */, ELM_GENLIST_ITEM_NONE, + gl_sel/* func */, (void *)1006/* func data */); + gli[6] = elm_genlist_item_insert_after(gl, itc1, + (void *)1007/* item data */, NULL/* parent */, gli[2]/* rel */, ELM_GENLIST_ITEM_NONE, + gl_sel/* func */, (void *)1007/* func data */); + elm_box_pack_end(bx, gl); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + elm_box_homogeneous_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "/\\"); + evas_object_smart_callback_add(bt, "clicked", my_gl_first, gl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "\\/"); + evas_object_smart_callback_add(bt, "clicked", my_gl_last, gl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "#"); + evas_object_smart_callback_add(bt, "clicked", my_gl_disable, gl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "U"); + evas_object_smart_callback_add(bt, "clicked", my_gl_update_all, gl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + elm_box_homogeneous_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "X"); + evas_object_smart_callback_add(bt, "clicked", my_gl_clear, gl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "+"); + evas_object_smart_callback_add(bt, "clicked", my_gl_add, gl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "-"); + evas_object_smart_callback_add(bt, "clicked", my_gl_del, gl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + bx3 = elm_box_add(win); + elm_box_horizontal_set(bx3, EINA_TRUE); + elm_box_homogeneous_set(bx3, EINA_TRUE); + evas_object_size_hint_weight_set(bx3, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx3, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "+ before"); + evas_object_smart_callback_add(bt, "clicked", my_gl_insert_before, gl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx3, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "+ after"); + evas_object_smart_callback_add(bt, "clicked", my_gl_insert_after, gl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx3, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Flush"); + evas_object_smart_callback_add(bt, "clicked", my_gl_flush, gl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx3, bt); + evas_object_show(bt); + + elm_box_pack_end(bx, bx3); + evas_object_show(bx3); + + /* item_class_ref is needed for itc1. some items can be added in callbacks */ + elm_genlist_item_class_ref(itc1); + elm_genlist_item_class_free(itc1); + + evas_object_resize(win, 320, 320); + evas_object_show(win); +} + +/*************/ + +static Elm_Genlist_Item_Class itc2; + +char *gl2_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ + const Testitem *tit = data; + char buf[256]; + snprintf(buf, sizeof(buf), "Item mode %i", tit->mode); + return strdup(buf); +} + +Evas_Object *gl2_content_get(void *data, Evas_Object *obj, const char *part) +{ + const Testitem *tit = data; + char buf[PATH_MAX]; + Evas_Object *ic = elm_icon_add(obj); + if (!strcmp(part, "elm.swallow.icon")) + { + if (!(tit->mode & 0x3)) + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + else if ((tit->mode & 0x3) == 1) + snprintf(buf, sizeof(buf), "%s/images/logo.png", elm_app_data_dir_get()); + else if ((tit->mode & 0x3) == 2) + snprintf(buf, sizeof(buf), "%s/images/panel_01.jpg", elm_app_data_dir_get()); + else if ((tit->mode & 0x3) == 3) + snprintf(buf, sizeof(buf), "%s/images/rock_01.jpg", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + } + else if (!strcmp(part, "elm.swallow.end")) + { + if (!(tit->mode & 0x3)) + snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", elm_app_data_dir_get()); + else if ((tit->mode & 0x3) == 1) + snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", elm_app_data_dir_get()); + else if ((tit->mode & 0x3) == 2) + snprintf(buf, sizeof(buf), "%s/images/sky_03.jpg", elm_app_data_dir_get()); + else if ((tit->mode & 0x3) == 3) + snprintf(buf, sizeof(buf), "%s/images/sky_04.jpg", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + } + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + return ic; +} + +Eina_Bool gl2_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ + return EINA_FALSE; +} + +static void +my_gl_update(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Testitem *tit = data; + tit->mode++; + elm_genlist_item_update(tit->item); +} + +static void +my_gl_labels_update(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Testitem *tit = data; + tit->mode++; + elm_genlist_item_fields_update(tit->item, "*", ELM_GENLIST_ITEM_FIELD_TEXT); +} + +static void +my_gl_contents_update(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Testitem *tit = data; + tit->mode++; + elm_genlist_item_fields_update(tit->item, "*", ELM_GENLIST_ITEM_FIELD_CONTENT); +} + +void +test_genlist3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *gl, *bx, *bx2, *bt; + static Testitem tit[3]; + + win = elm_win_util_standard_add("genlist3", "Genlist 3"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + gl = elm_genlist_add(win); + evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(gl); + + itc2.item_style = "default"; + itc2.func.text_get = gl2_text_get; + itc2.func.content_get = gl2_content_get; + itc2.func.state_get = gl2_state_get; + itc2.func.del = NULL; + + tit[0].mode = 0; + tit[0].item = elm_genlist_item_append(gl, &itc2, + &(tit[0])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */, + NULL/* func data */); + tit[1].mode = 1; + tit[1].item = elm_genlist_item_append(gl, &itc2, + &(tit[1])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */, + NULL/* func data */); + tit[2].mode = 2; + tit[2].item = elm_genlist_item_append(gl, &itc2, + &(tit[2])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */, + NULL/* func data */); + + elm_box_pack_end(bx, gl); + evas_object_show(bx); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + elm_box_homogeneous_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "[1]"); + evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0])); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "labels"); + evas_object_smart_callback_add(bt, "clicked", my_gl_labels_update, &(tit[1])); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "contents"); + evas_object_smart_callback_add(bt, "clicked", my_gl_contents_update, &(tit[2])); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + evas_object_resize(win, 320, 320); + evas_object_show(win); +} + +/*************/ + +static void +my_gl_item_check_changed(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Testitem *tit = data; + tit->onoff = elm_check_state_get(obj); + printf("item %p onoff = %i\n", tit, tit->onoff); +} + +static Elm_Genlist_Item_Class itc3; + +char *gl3_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ + const Testitem *tit = data; + char buf[256]; + snprintf(buf, sizeof(buf), "Item mode %i", tit->mode); + return strdup(buf); +} + +Evas_Object *gl3_content_get(void *data, Evas_Object *obj, const char *part) +{ + const Testitem *tit = data; + if (!strcmp(part, "elm.swallow.icon")) + { + Evas_Object *lb; + + lb = elm_label_add(obj); + elm_label_line_wrap_set(lb, ELM_WRAP_CHAR); + elm_label_wrap_width_set(lb, 201); + elm_object_text_set(lb, "ashj ascjscjh n asjkl hcjlh ls hzshnn zjh sh zxjcjsnd h dfw sdv edev efe fwefvv vsd cvs ws wf fvwf wd fwe f we wef we wfe rfwewef wfv wswf wefg sdfws w wsdcfwcf wsc vdv sdsd sdcd cv wsc sdcv wsc d sdcdcsd sdcdsc wdvd sdcsd wscxcv wssvd sd"); + return lb; + } + else if (!strcmp(part, "elm.swallow.end")) + { + Evas_Object *ck; + ck = elm_check_add(obj); + evas_object_propagate_events_set(ck, EINA_FALSE); + elm_check_state_set(ck, tit->onoff); + evas_object_smart_callback_add(ck, "changed", my_gl_item_check_changed, data); + return ck; + } + return NULL; +} + +Eina_Bool gl3_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ + return EINA_FALSE; +} + +void +test_genlist4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *gl, *bx, *bx2, *bt; + static Testitem tit[3]; + + win = elm_win_util_standard_add("genlist4", "Genlist 4"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + gl = elm_genlist_add(win); + elm_genlist_mode_set(gl, ELM_LIST_COMPRESS); + elm_genlist_multi_select_set(gl, 1); + evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(gl); + + itc3.item_style = "default"; + itc3.func.text_get = gl3_text_get; + itc3.func.content_get = gl3_content_get; + itc3.func.state_get = gl3_state_get; + itc3.func.del = NULL; + + tit[0].mode = 0; + tit[0].item = elm_genlist_item_append(gl, &itc3, + &(tit[0])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */, + NULL/* func data */); + tit[1].mode = 1; + tit[1].item = elm_genlist_item_append(gl, &itc3, + &(tit[1])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */, + NULL/* func data */); + tit[2].mode = 2; + tit[2].item = elm_genlist_item_append(gl, &itc3, + &(tit[2])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */, + NULL/* func data */); + + elm_box_pack_end(bx, gl); + evas_object_show(bx); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + elm_box_homogeneous_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "[1]"); + evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0])); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "[2]"); + evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[1])); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "[3]"); + evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[2])); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + evas_object_resize(win, 320, 320); + evas_object_show(win); +} + + +/*************/ +static void +my_gl_item_check_changed2(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Testitem *tit = data; + tit->onoff = elm_check_state_get(obj); + printf("item %p onoff = %i\n", tit, tit->onoff); +} + +static Elm_Genlist_Item_Class itc5; + +char *gl5_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part) +{ + const Testitem *tit = data; + char buf[256]; + if (!strcmp(part, "elm.text")) + { + snprintf(buf, sizeof(buf), "Item mode %i", tit->mode); + } + else if (!strcmp(part, "elm.text.sub")) + { + snprintf(buf, sizeof(buf), "%i bottles on the wall", tit->mode); + } + return strdup(buf); +} + +Evas_Object *gl5_content_get(void *data, Evas_Object *obj, const char *part) +{ + const Testitem *tit = data; + char buf[PATH_MAX]; + if (!strcmp(part, "elm.swallow.icon")) + { + Evas_Object *bx = elm_box_add(obj); + Evas_Object *ic; + elm_box_horizontal_set(bx, EINA_TRUE); + ic = elm_icon_add(obj); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_show(ic); + elm_box_pack_end(bx, ic); + ic = elm_icon_add(obj); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_show(ic); + elm_box_pack_end(bx, ic); + elm_box_horizontal_set(bx, EINA_TRUE); + evas_object_show(bx); + return bx; + } + else if (!strcmp(part, "elm.swallow.end")) + { + Evas_Object *ck; + ck = elm_check_add(obj); + evas_object_propagate_events_set(ck, EINA_FALSE); + elm_check_state_set(ck, tit->onoff); + evas_object_smart_callback_add(ck, "changed", my_gl_item_check_changed2, data); + evas_object_show(ck); + return ck; + } + return NULL; +} + +Eina_Bool gl5_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ + return EINA_FALSE; +} + +static void +item_drag_up(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("drag up\n"); +} + +static void +item_drag_down(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("drag down\n"); +} + +static void +item_drag_left(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("drag left\n"); +} + +static void +item_drag_right(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("drag right\n"); +} + +static void +scroll_top(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("Top edge!\n"); +} + +static void +scroll_bottom(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("Bottom edge!\n"); +} + +static void +scroll_left(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("Left edge!\n"); +} + +static void +scroll_right(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("Right edge!\n"); +} + +static void +item_drag(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("drag\n"); +} + +static void +item_drag_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("drag stop\n"); +} + +static void +item_longpress(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("longpress\n"); +} + +void +test_genlist5(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *gl, *bx, *bx2, *bt; + static Testitem tit[3]; + + win = elm_win_util_standard_add("genlist5", "Genlist 5"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + gl = elm_genlist_add(win); + elm_genlist_select_mode_set(gl, ELM_OBJECT_SELECT_MODE_ALWAYS); + evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(gl); + itc5.item_style = "double_label"; + itc5.func.text_get = gl5_text_get; + itc5.func.content_get = gl5_content_get; + itc5.func.state_get = gl5_state_get; + itc5.func.del = NULL; + + tit[0].mode = 0; + tit[0].item = elm_genlist_item_append(gl, &itc5, + &(tit[0])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */, + NULL/* func data */); + tit[1].mode = 1; + tit[1].item = elm_genlist_item_append(gl, &itc5, + &(tit[1])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */, + NULL/* func data */); + tit[2].mode = 2; + tit[2].item = elm_genlist_item_append(gl, &itc5, + &(tit[2])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */, + NULL/* func data */); + + elm_box_pack_end(bx, gl); + evas_object_show(bx); + + evas_object_smart_callback_add(gl, "drag,start,up", item_drag_up, NULL); + evas_object_smart_callback_add(gl, "drag,start,down", item_drag_down, NULL); + evas_object_smart_callback_add(gl, "drag,start,left", item_drag_left, NULL); + evas_object_smart_callback_add(gl, "drag,start,right", item_drag_right, NULL); + evas_object_smart_callback_add(gl, "scroll,edge,top", scroll_top, NULL); + evas_object_smart_callback_add(gl, "scroll,edge,bottom", scroll_bottom, NULL); + evas_object_smart_callback_add(gl, "scroll,edge,left", scroll_left, NULL); + evas_object_smart_callback_add(gl, "scroll,edge,right", scroll_right, NULL); + evas_object_smart_callback_add(gl, "drag", item_drag, NULL); + evas_object_smart_callback_add(gl, "drag,stop", item_drag_stop, NULL); + evas_object_smart_callback_add(gl, "longpressed", item_longpress, NULL); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + elm_box_homogeneous_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "[1]"); + evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0])); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "[2]"); + evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[1])); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "[3]"); + evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[2])); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + evas_object_resize(win, 320, 320); + evas_object_show(win); +} + +/*************/ + +static Elm_Genlist_Item_Class *itc4; + +static void +gl4_sel(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Object_Item *glit = event_info; + int depth = elm_genlist_item_expanded_depth_get(glit); + printf("expanded depth for selected item is %d\n", depth); +} + +static void +gl4_exp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Object_Item *glit = event_info; + Evas_Object *gl = elm_object_item_widget_get(glit); + int val = (int)(long) elm_object_item_data_get(glit); + val *= 10; + elm_genlist_item_append(gl, itc4, + (void *)(long) (val + 1)/* item data */, + glit/* parent */, ELM_GENLIST_ITEM_NONE, + gl4_sel/* func */, + NULL/* func data */); + elm_genlist_item_append(gl, itc4, + (void *)(long) (val + 2)/* item data */, + glit/* parent */, ELM_GENLIST_ITEM_NONE, + gl4_sel/* func */, + NULL/* func data */); + elm_genlist_item_append(gl, itc4, + (void *)(long) (val + 3)/* item data */, + glit/* parent */, + ELM_GENLIST_ITEM_TREE, gl4_sel/* func */, + NULL/* func data */); +} +static void +gl4_con(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Object_Item *glit = event_info; + elm_genlist_item_subitems_clear(glit); +} + +static void +gl4_exp_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Object_Item *glit = event_info; + elm_genlist_item_expanded_set(glit, EINA_TRUE); +} + +static void +gl4_con_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Object_Item *glit = event_info; + elm_genlist_item_expanded_set(glit, EINA_FALSE); +} + +char *gl4_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ + char buf[256]; + snprintf(buf, sizeof(buf), "Item mode %i", (int)(long)data); + return strdup(buf); +} + +Evas_Object *gl4_content_get(void *data __UNUSED__, Evas_Object *obj, const char *part) +{ + char buf[PATH_MAX]; + if (!strcmp(part, "elm.swallow.icon")) + { + Evas_Object *ic = elm_icon_add(obj); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + evas_object_show(ic); + return ic; + } + else if (!strcmp(part, "elm.swallow.end")) + { + Evas_Object *ck; + ck = elm_check_add(obj); + evas_object_propagate_events_set(ck, EINA_FALSE); + evas_object_show(ck); + return ck; + } + return NULL; +} + +Eina_Bool gl4_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ + return EINA_FALSE; +} + +void gl4_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__) +{ + printf("item deleted.\n"); +} + +void +test_genlist6(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *gl, *bx, *bx2, *bt; + + win = elm_win_util_standard_add("genlist-tree", "Genlist Tree"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + gl = elm_genlist_add(win); + evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(gl); + + itc4 = elm_genlist_item_class_new(); + itc4->item_style = "default"; + itc4->func.text_get = gl4_text_get; + itc4->func.content_get = gl4_content_get; + itc4->func.state_get = gl4_state_get; + itc4->func.del = gl4_del; + + elm_genlist_item_append(gl, itc4, + (void *)1/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_TREE, gl4_sel/* func */, + NULL/* func data */); + elm_genlist_item_append(gl, itc4, + (void *)2/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_TREE, gl4_sel/* func */, + NULL/* func data */); + elm_genlist_item_append(gl, itc4, + (void *)3/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl4_sel/* func */, + NULL/* func data */); + elm_genlist_item_class_free(itc4); + evas_object_smart_callback_add(gl, "expand,request", gl4_exp_req, gl); + evas_object_smart_callback_add(gl, "contract,request", gl4_con_req, gl); + evas_object_smart_callback_add(gl, "expanded", gl4_exp, gl); + evas_object_smart_callback_add(gl, "contracted", gl4_con, gl); + + elm_box_pack_end(bx, gl); + evas_object_show(bx); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + elm_box_homogeneous_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "[1]"); + // evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0])); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "[2]"); + // evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[1])); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "[3]"); + // evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[2])); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + evas_object_resize(win, 320, 320); + evas_object_show(win); +} + +/*************/ + +struct genlist7_data +{ + Evas_Object *win, *naviframe; +}; + +static Elm_Genlist_Item_Class itc7; + +static void +gl_sel7(void *data, Evas_Object *obj, void *event_info) +{ + if (!event_info) return; + elm_genlist_item_item_class_update(event_info, &itc7); + printf("sel item data [%p] on genlist obj [%p], item pointer [%p], new item style [%s] \n", data, obj, event_info, itc7.item_style); +} + +static void +test_genlist7_back_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + struct genlist7_data *info = data; + if (!info) return; + + elm_naviframe_item_pop(info->naviframe); +} + +static void +test_genlist7_swipe(void *data, Evas_Object *obj __UNUSED__, void *event_info) +{ + struct genlist7_data *info = data; + Evas_Object *box, *entry, *button; + char item_data[] = "Just a simple test"; + + if ((!event_info) || (!data)) return; + + box = elm_box_add(info->win); + elm_box_homogeneous_set(box, EINA_FALSE); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(box); + + entry = elm_entry_add(info->win); + elm_entry_scrollable_set(entry, EINA_TRUE); + elm_entry_editable_set(entry, EINA_FALSE); + elm_object_text_set(entry, item_data); + evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(entry); + + button = elm_button_add(info->win); + elm_object_text_set(button, "back"); + evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(button, EVAS_HINT_FILL, 0); + evas_object_smart_callback_add(button, "clicked", test_genlist7_back_cb, + info); + evas_object_show(button); + + elm_box_pack_start(box, entry); + elm_box_pack_end(box, button); + + elm_naviframe_item_simple_push(info->naviframe, box); +} + +void +test_genlist7(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *gl, *naviframe; + static struct genlist7_data info; + static Testitem tit[3]; + + win = elm_win_util_standard_add("genlist7", "Genlist 7"); + elm_win_autodel_set(win, EINA_TRUE); + info.win = win; + + naviframe = elm_naviframe_add(win); + elm_win_resize_object_add(win, naviframe); + evas_object_size_hint_weight_set(naviframe, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(naviframe, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(naviframe); + info.naviframe = naviframe; + + gl = elm_genlist_add(win); + evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_smart_callback_add(gl, "swipe", test_genlist7_swipe, &info); + evas_object_show(gl); + elm_naviframe_item_simple_push(naviframe, gl); + + itc2.item_style = "default"; + itc2.func.text_get = gl2_text_get; + itc2.func.content_get = gl2_content_get; + itc2.func.state_get = gl2_state_get; + itc2.func.del = NULL; + + itc7.item_style = "double_label"; + itc7.func.text_get = gl5_text_get; + itc7.func.content_get = gl5_content_get; + itc7.func.state_get = gl5_state_get; + itc7.func.del = NULL; + + tit[0].mode = 0; + tit[0].item = elm_genlist_item_append(gl, &itc2, + &(tit[0])/* item data */, NULL/* parent */, + ELM_GENLIST_ITEM_NONE, gl_sel7/* func */, + NULL/* func data */); + tit[1].mode = 1; + tit[1].item = elm_genlist_item_append(gl, &itc2, + &(tit[1])/* item data */, NULL/* parent */, + ELM_GENLIST_ITEM_NONE, gl_sel7/* func */, + NULL/* func data */); + tit[2].mode = 2; + tit[2].item = elm_genlist_item_append(gl, &itc2, + &(tit[2])/* item data */, NULL/* parent */, + ELM_GENLIST_ITEM_NONE, gl_sel7/* func */, + NULL/* func data */); + + evas_object_resize(win, 320, 320); + evas_object_show(win); +} + +/*************/ + +static Elm_Genlist_Item_Class itc_group; + +char *gl8_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ + char buf[256]; + snprintf(buf, sizeof(buf), "Group Index # %i (Item # %i)", (int)((long)data / 10), (int)(long)data); + return strdup(buf); +} + +static void +_bt_show_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_genlist_item_show(data, ELM_GENLIST_ITEM_SCROLLTO_TOP); +} + +static void +_bt_bring_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_genlist_item_bring_in(data, ELM_GENLIST_ITEM_SCROLLTO_TOP); +} + +void +test_genlist8(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *gl, *bt[8], *bx, *bx2, *bx3; + Elm_Object_Item *gli = NULL, *git = NULL; + int i, bt_num; + + win = elm_win_util_standard_add("genlist-group", "Genlist Group"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + gl = elm_genlist_add(win); + evas_object_smart_callback_add(gl, "selected", _gl_selected, NULL); + evas_object_smart_callback_add(gl, "clicked,double", _gl_double_clicked, NULL); + evas_object_smart_callback_add(gl, "longpressed", _gl_longpress, NULL); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, gl); + evas_object_show(gl); + + itc1 = elm_genlist_item_class_new(); + itc1->item_style = "default"; + itc1->func.text_get = gl_text_get; + itc1->func.content_get = gl_content_get; + itc1->func.state_get = gl_state_get; + itc1->func.del = NULL; + + itc_group.item_style = "group_index"; + itc_group.func.text_get = gl8_text_get; + itc_group.func.content_get = NULL; + itc_group.func.state_get = NULL; + itc_group.func.del = NULL; + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + elm_box_homogeneous_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt_num = 0; + bt[bt_num] = elm_button_add(win); + elm_object_text_set(bt[bt_num], "Show 0"); + evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0); + evas_object_show(bt[bt_num]); + elm_box_pack_end(bx2, bt[bt_num]); + + bt[++bt_num] = elm_button_add(win); + elm_object_text_set(bt[bt_num], "Show 26"); + evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0); + evas_object_show(bt[bt_num]); + elm_box_pack_end(bx2, bt[bt_num]); + + bt[++bt_num] = elm_button_add(win); + elm_object_text_set(bt[bt_num], "Show 101"); + evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0); + evas_object_show(bt[bt_num]); + elm_box_pack_end(bx2, bt[bt_num]); + + bt[++bt_num] = elm_button_add(win); + elm_object_text_set(bt[bt_num], "Show 480"); + evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0); + evas_object_show(bt[bt_num]); + elm_box_pack_end(bx2, bt[bt_num]); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + bx3 = elm_box_add(win); + elm_box_horizontal_set(bx3, EINA_TRUE); + elm_box_homogeneous_set(bx3, EINA_TRUE); + evas_object_size_hint_weight_set(bx3, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx3, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt[++bt_num] = elm_button_add(win); + elm_object_text_set(bt[bt_num], "Bring top 0"); + evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0); + evas_object_show(bt[bt_num]); + elm_box_pack_end(bx3, bt[bt_num]); + + bt[++bt_num] = elm_button_add(win); + elm_object_text_set(bt[bt_num], "Bring top 31"); + evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0); + evas_object_show(bt[bt_num]); + elm_box_pack_end(bx3, bt[bt_num]); + + bt[++bt_num] = elm_button_add(win); + elm_object_text_set(bt[bt_num], "Bring top 239"); + evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0); + evas_object_show(bt[bt_num]); + elm_box_pack_end(bx3, bt[bt_num]); + + bt[++bt_num] = elm_button_add(win); + elm_object_text_set(bt[bt_num], "Bring top 477"); + evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0); + evas_object_show(bt[bt_num]); + elm_box_pack_end(bx3, bt[bt_num]); + + elm_box_pack_end(bx, bx3); + evas_object_show(bx3); + + for (i = 0; i < 500; i++) + { + if (!(i % 10)) + { + gli = git = elm_genlist_item_append(gl, &itc_group, + (void *)(long)i/* item data */, + NULL/* parent */, + ELM_GENLIST_ITEM_GROUP, + gl_sel/* func */, + (void *)(long)(i * 10)/* func data */); + elm_genlist_item_select_mode_set(git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + } + else if (git) + { + gli = elm_genlist_item_append(gl, itc1, + (void *)(long)i/* item data */, + git/* parent */, + ELM_GENLIST_ITEM_NONE, + gl_sel/* func */, + (void *)(long)(i * 10)/* func data */); + } + switch (i) + { + case 0: + evas_object_smart_callback_add(bt[0], "clicked", _bt_show_cb, gli); + evas_object_smart_callback_add(bt[4], "clicked", _bt_bring_cb, gli); + break; + case 26: + evas_object_smart_callback_add(bt[1], "clicked", _bt_show_cb, gli); + break; + case 31: + evas_object_smart_callback_add(bt[5], "clicked", _bt_bring_cb, gli); + break; + case 101: + evas_object_smart_callback_add(bt[2], "clicked", _bt_show_cb, gli); + break; + case 239: + evas_object_smart_callback_add(bt[6], "clicked", _bt_bring_cb, gli); + break; + case 477: + evas_object_smart_callback_add(bt[7], "clicked", _bt_bring_cb, gli); + break; + case 480: + evas_object_smart_callback_add(bt[3], "clicked", _bt_show_cb, gli); + break; + } + } + elm_genlist_item_class_free(itc1); + + evas_object_resize(win, 480, 800); + evas_object_show(win); +} + +/*************/ + +static void +gl9_exp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Object_Item *glit = event_info; + Evas_Object *gl = elm_object_item_widget_get(glit); + int val = (int)(long) elm_object_item_data_get(glit); + val *= 10; + elm_genlist_item_append(gl, itc1, + (void *)(long) (val + 1)/* item data */, + glit/* parent */, + ELM_GENLIST_ITEM_NONE, gl4_sel/* func */, + NULL/* func data */); + elm_genlist_item_append(gl, itc1, + (void *)(long) (val + 2)/* item data */, + glit/* parent */, + ELM_GENLIST_ITEM_NONE, gl4_sel/* func */, + NULL/* func data */); + elm_genlist_item_append(gl, itc1, + (void *)(long) (val + 3)/* item data */, + glit/* parent */, + ELM_GENLIST_ITEM_TREE, gl4_sel/* func */, + NULL/* func data */); +} + +static void +gl9_con(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Object_Item *glit = event_info; + elm_genlist_item_subitems_clear(glit); +} + +static void +gl9_exp_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Object_Item *glit = event_info; + elm_genlist_item_expanded_set(glit, EINA_TRUE); +} + +static void +gl9_con_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Object_Item *glit = event_info; + elm_genlist_item_expanded_set(glit, EINA_FALSE); +} + +void +test_genlist9(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *gl, *bx; + Elm_Object_Item *git; + + win = elm_win_util_standard_add("genlist-group-tree", "Genlist Group Tree"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + gl = elm_genlist_add(win); + evas_object_smart_callback_add(gl, "selected", _gl_selected, NULL); + evas_object_smart_callback_add(gl, "clicked,double", _gl_double_clicked, NULL); + evas_object_smart_callback_add(gl, "longpressed", _gl_longpress, NULL); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, gl); + evas_object_show(gl); + + itc1 = elm_genlist_item_class_new(); + itc1->item_style = "default"; + itc1->func.text_get = gl_text_get; + itc1->func.content_get = gl_content_get; + itc1->func.state_get = gl_state_get; + itc1->func.del = NULL; + + itc_group.item_style = "group_index"; + itc_group.func.text_get = gl8_text_get; + itc_group.func.content_get = NULL; + itc_group.func.state_get = NULL; + itc_group.func.del = NULL; + + git = elm_genlist_item_append(gl, &itc_group, + (void *)0/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_GROUP, gl4_sel/* func */, + NULL/* func data */); + elm_genlist_item_select_mode_set(git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + + elm_genlist_item_append(gl, itc1, + (void *)1/* item data */, git/* parent */, ELM_GENLIST_ITEM_TREE, gl4_sel/* func */, + NULL/* func data */); + elm_genlist_item_append(gl, itc1, + (void *)2/* item data */, git/* parent */, ELM_GENLIST_ITEM_NONE, gl4_sel/* func */, + NULL/* func data */); + elm_genlist_item_append(gl, itc1, + (void *)3/* item data */, git/* parent */, ELM_GENLIST_ITEM_TREE, gl4_sel/* func */, + NULL/* func data */); + git = elm_genlist_item_append(gl, &itc_group, + (void *)4/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_GROUP, gl4_sel/* func */, + NULL/* func data */); + elm_genlist_item_select_mode_set(git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + + elm_genlist_item_append(gl, itc1, + (void *)5/* item data */, git/* parent */, ELM_GENLIST_ITEM_TREE, gl4_sel/* func */, + NULL/* func data */); + elm_genlist_item_append(gl, itc1, + (void *)6/* item data */, git/* parent */, ELM_GENLIST_ITEM_NONE, gl4_sel/* func */, + NULL/* func data */); + elm_genlist_item_append(gl, itc1, + (void *)7/* item data */, git/* parent */, ELM_GENLIST_ITEM_TREE, gl4_sel/* func */, + NULL/* func data */); + elm_genlist_item_class_free(itc1); + + evas_object_smart_callback_add(gl, "expand,request", gl9_exp_req, gl); + evas_object_smart_callback_add(gl, "contract,request", gl9_con_req, gl); + evas_object_smart_callback_add(gl, "expanded", gl9_exp, gl); + evas_object_smart_callback_add(gl, "contracted", gl9_con, gl); + + evas_object_resize(win, 480, 800); + evas_object_show(win); +} + +/*************/ + +static Elm_Genlist_Item_Class itc10; +static char *mode_type[] = { "slide", "rotate" }; + +char *gl10_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part) +{ + char buf[256]; + if (!strcmp(part, "elm.text.mode")) + snprintf(buf, sizeof(buf), "Mode # %i", (int)(long)data); + else + snprintf(buf, sizeof(buf), "Item # %i", (int)(long)data); + return strdup(buf); +} + +Evas_Object *gl10_content_get(void *data __UNUSED__, Evas_Object *obj, const char *part) +{ + char buf[PATH_MAX]; + Evas_Object *ic = elm_icon_add(obj); + if (!strcmp(part, "elm.swallow.end")) + snprintf(buf, sizeof(buf), "%s/images/bubble.png", elm_app_data_dir_get()); + else + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + return ic; +} + +static void +_gl_sel10(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + if (!data) return; + int v = elm_radio_value_get(data); + if (v == 1) + elm_genlist_item_decorate_mode_set(event_info, mode_type[v], EINA_TRUE); +} + +static void +_my_gl_mode_right(void *data, Evas_Object *obj __UNUSED__, void *event_info) +{ + if (!data) return; + int v = elm_radio_value_get(data); + if (v == 0) + elm_genlist_item_decorate_mode_set(event_info, mode_type[v], EINA_TRUE); +} + +static void +_my_gl_mode_left(void *data, Evas_Object *obj __UNUSED__, void *event_info) +{ + if (!data) return; + int v = elm_radio_value_get(data); + if (v == 0) + elm_genlist_item_decorate_mode_set(event_info, mode_type[v], EINA_FALSE); +} + +static void +_my_gl_mode_cancel(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + fprintf(stderr, "drag\n"); + if (!data) return; + int v = elm_radio_value_get(data); + Elm_Object_Item *glit = (Elm_Object_Item *) elm_genlist_decorated_item_get(obj); + if (glit) elm_genlist_item_decorate_mode_set(glit, mode_type[v], EINA_FALSE); +} + +void +test_genlist10(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *fr, *bx, *bx2, *rd, *rdg, *gl; + int i; + + win = elm_win_util_standard_add("genlist-decorate-item-mode", "Genlist Decorate Item Mode"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + fr = elm_frame_add(win); + elm_object_text_set(fr, "Decorate Mode Type"); + elm_box_pack_end(bx, fr); + evas_object_show(fr); + + bx2 = elm_box_add(win); + elm_object_content_set(fr, bx2); + evas_object_show(bx2); + + rd = elm_radio_add(win); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_radio_state_value_set(rd, 0); + elm_object_text_set(rd, "Slide : Sweep genlist items to the right."); + evas_object_show(rd); + elm_box_pack_end(bx2, rd); + rdg = rd; + + rd = elm_radio_add(win); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_radio_state_value_set(rd, 1); + elm_object_text_set(rd, "Rotate : Click each item."); + elm_radio_group_add(rd, rdg); + evas_object_show(rd); + elm_box_pack_end(bx2, rd); + + gl = elm_genlist_add(win); + evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_smart_callback_add(gl, "drag,start,right", _my_gl_mode_right, rdg); + evas_object_smart_callback_add(gl, "drag,start,left", _my_gl_mode_left, rdg); + evas_object_smart_callback_add(gl, "drag,start,up", _my_gl_mode_cancel, rdg); + evas_object_smart_callback_add(gl, "drag,start,down", _my_gl_mode_cancel, rdg); + evas_object_show(gl); + + itc10.item_style = "default"; + itc10.decorate_item_style = "mode"; + itc10.func.text_get = gl10_text_get; + itc10.func.content_get = gl10_content_get; + itc10.func.state_get = gl_state_get; + itc10.func.del = NULL; + + for (i = 0; i < 50; i++) + elm_genlist_item_append(gl, + &itc10, + (void *)(long)(1000 + i)/* item data */, + NULL/* parent */, + ELM_GENLIST_ITEM_NONE/* flags */, + _gl_sel10/* func */, + rdg/* func data */); + + elm_box_pack_end(bx, gl); + + evas_object_resize(win, 520, 520); + evas_object_show(win); +} + +/*************/ + +static void +_reorder_tg_changed_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + elm_genlist_reorder_mode_set(data, elm_check_state_get(obj)); +} + +/** + * gl_moved is called after an item was reordered. + * This is only called when reorder mode is enabled. + * + * @param data : the genlist object passed as data. + * @param obj : the genlist object. + * @param item : the moved item. + * + * the item(*item) had been moved + * + */ +static void gl_moved(Evas_Object *data __UNUSED__, Evas_Object *obj __UNUSED__, Elm_Object_Item *item __UNUSED__) +{ + // if needed, add application logic. +} + +/** + * gl_moved_after is called after an item was reordered. + * This is only called when reorder mode is enabled. + * + * @param data : the genlist object passed as data. + * @param obj : the genlist object. + * @param item : the moved item. + * + * the item(*item) had been moved after the given relative item(*rel_item) in list. + * + */ +static void gl_moved_after(Evas_Object *data __UNUSED__, Evas_Object *obj __UNUSED__, Elm_Object_Item *item __UNUSED__) +{ + // if needed, add application logic. + Elm_Object_Item *it; + it = elm_genlist_item_prev_get(item); + printf("it=%p, prev_it=%p\n",item,it); +} + +/** + * gl_moved_before is called after an item was reordered. + * This is only called when reorder mode is enabled. + * + * @param data : the genlist object passed as data. + * @param obj : the genlist object. + * @param item : the moved item. + * + * the item(*item) had been moved before the given relative item(*rel_item) in list. + * + */ +static void gl_moved_before(Evas_Object *data __UNUSED__, Evas_Object *obj __UNUSED__, Elm_Object_Item *item __UNUSED__) +{ + // if needed, add application logic. + Elm_Object_Item *it; + it = elm_genlist_item_next_get(item); + printf("it=%p, next_it=%p\n",item,it); +} + +void +test_genlist11(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *fr, *lb, *bx, *tg, *gl; + int i; + + win = elm_win_util_standard_add("genlist-reorder-mode", "Genlist Reorder Mode"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + fr = elm_frame_add(win); + + elm_object_text_set(fr, "Reorder Mode"); + elm_box_pack_end(bx, fr); + evas_object_show(fr); + + lb = elm_label_add(win); + elm_object_text_set(lb, + "Enable reorder mode if you want to move item.
" + "Then long press and drag item."); + elm_object_content_set(fr, lb); + evas_object_show(lb); + + gl = elm_genlist_add(win); + evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(gl); + + tg = elm_check_add(win); + elm_object_style_set(tg, "toggle"); + elm_object_text_set(tg, "Reorder Mode:"); + elm_check_state_set(tg, elm_config_mirrored_get()); + evas_object_smart_callback_add(tg, "changed", _reorder_tg_changed_cb, gl); + elm_box_pack_end(bx, tg); + evas_object_show(tg); + + itc1 = elm_genlist_item_class_new(); + itc1->item_style = "default"; + itc1->func.text_get = gl_text_get; + itc1->func.content_get = gl_content_get; + itc1->func.state_get = gl_state_get; + itc1->func.del = NULL; + evas_object_smart_callback_add(gl, "moved", (Evas_Smart_Cb)gl_moved, gl); + evas_object_smart_callback_add(gl, "moved,after", (Evas_Smart_Cb)gl_moved_after, gl); + evas_object_smart_callback_add(gl, "moved,before", (Evas_Smart_Cb)gl_moved_before, gl); + + for (i = 0; i < 50; i++) + elm_genlist_item_append(gl, + itc1, + (void *)(long)(1 + i)/* item data */, + NULL/* parent */, + ELM_GENLIST_ITEM_NONE/* flags */, + NULL/* func */, + NULL/* func data */); + + elm_genlist_item_class_free(itc1); + + elm_box_pack_end(bx, gl); + + evas_object_resize(win, 400, 500); + evas_object_show(win); +} + +char *gl12_text_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ + return strdup("Enlightenment is not just a window manager for Linux/X11 and others, but also a whole suite of libraries to help you create beautiful user interfaces with much less work than doing it the old fashioned way and fighting with traditional toolkits, not to mention a traditional window manager. It covers uses from small mobile devices like phones all the way to powerful multi-core desktops (which are the primary development environment)."); +} + +void +test_genlist12(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *gl; + int i; + + win = elm_win_util_standard_add("genlist-textblock", "Genlist Textblock"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + gl = elm_genlist_add(win); + elm_genlist_mode_set(gl, ELM_LIST_COMPRESS); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, gl); + evas_object_show(gl); + + itc1 = elm_genlist_item_class_new(); + itc1->item_style = "message"; + itc1->func.text_get = gl12_text_get; + itc1->func.content_get = gl_content_get; + itc1->func.state_get = gl_state_get; + itc1->func.del = NULL; + + for (i = 0; i < 1000; i++) + { + elm_genlist_item_append(gl, itc1, + (void *)(long)i/* item data */, + NULL/* parent */, + ELM_GENLIST_ITEM_NONE, + gl_sel/* func */, + (void *)(long)(i * 10)/* func data */); + } + elm_genlist_item_class_free(itc1); + + evas_object_resize(win, 400, 500); + evas_object_show(win); +} + +static int +gl13_cmp(const void *pa, const void *pb) +{ + const Elm_Object_Item *ia = pa, *ib = pb; + int a = (int)(long) elm_object_item_data_get(ia); + int b = (int)(long) elm_object_item_data_get(ib); + return a - b; +} + +void +test_genlist13(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Object_Item *pi[6]; + Evas_Object *win, *bx, *gl; int i, base, idx[3] = {1, 10, 15}; + + win = elm_win_util_standard_add("genlist-tree-insert-sorted", "Genlist Tree, Insert Sorted"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + gl = elm_genlist_add(win); + evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(gl); + + itc4 = elm_genlist_item_class_new(); + itc4->item_style = "default"; + itc4->func.text_get = gl4_text_get; + itc4->func.content_get = NULL; + itc4->func.state_get = NULL; + itc4->func.del = NULL; + + /* mixed order to test insert sorted */ + + for (i = 0; i < 3; i++) + { + pi[i] = elm_genlist_item_sorted_insert + (gl, itc4, (void *)(long)idx[i]/* item data */, NULL/* parent */, + ELM_GENLIST_ITEM_TREE, gl13_cmp/* cmp */, + NULL/* func */, NULL/* func data */); + } + + for (i = 0, base = 100; i < 3; i++, base += 100) + { + int j; + for (j = 0; j < 3; j++) + { + elm_genlist_item_sorted_insert + (gl, itc4, (void *)(long)(idx[j] + base)/* item data */, + pi[i]/* parent */, ELM_GENLIST_ITEM_NONE, + gl13_cmp/* cmp */, NULL/* func */, NULL/* func data */); + } + } + + for (i = 0; i < 3; i++) + { + pi[i + 3] = elm_genlist_item_sorted_insert + (gl, itc4, (void *)(long)(idx[i] * 2)/* item data */, NULL/* parent */, + ELM_GENLIST_ITEM_TREE, gl13_cmp/* cmp */, NULL/* func */, + NULL/* func data */); + } + + + for (i = 0, base = 10000; i < 3; i++, base += 10000) + { + int j; + for (j = 0; j < 3; j++) + { + elm_genlist_item_sorted_insert + (gl, itc4, (void *)(long)(idx[j] + base)/* item data */, + pi[i + 3]/* parent */, ELM_GENLIST_ITEM_NONE, + gl13_cmp/* cmp */, NULL/* func */, NULL/* func data */); + } + } + elm_genlist_item_class_free(itc4); + elm_box_pack_end(bx, gl); + evas_object_show(bx); + + evas_object_resize(win, 320, 320); + evas_object_show(win); +} + +static void +my_gl_insert_before_rel(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *gl = data; + static int i = 1000; + Elm_Object_Item *gli_selected; + + itc1->item_style = "default"; + itc1->func.text_get = gl_text_get; + itc1->func.content_get = NULL; + itc1->func.state_get = NULL; + itc1->func.del = NULL; + + gli_selected = elm_genlist_selected_item_get(gl); + if (!gli_selected) + { + printf("no item selected\n"); + return; + } + + elm_genlist_item_insert_before(gl, itc1, + (void *)(long)i/* item data */, + elm_genlist_item_parent_get(gli_selected), + gli_selected/* item before */, + ELM_GENLIST_ITEM_NONE, + NULL/* func */, NULL/* func data */); + i++; +} + +static void +my_gl_insert_after_rel(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *gl = data; + static int i = 0; + Elm_Object_Item *gli_selected; + + itc1->item_style = "default"; + itc1->func.text_get = gl_text_get; + itc1->func.content_get = NULL; + itc1->func.state_get = NULL; + itc1->func.del = NULL; + + gli_selected = elm_genlist_selected_item_get(gl); + if (!gli_selected) + { + printf("no item selected\n"); + return; + } + + elm_genlist_item_insert_after(gl, itc1, + (void *)(long)i/* item data */, + elm_genlist_item_parent_get(gli_selected), + gli_selected/* item after */, + ELM_GENLIST_ITEM_NONE, + NULL/* func */, NULL/* func data */); + i++; +} + +void +test_genlist14(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Object_Item *pi[6]; + Evas_Object *win, *bx, *bx2, *bt, *gl; + int i, base; + /* index: 0, 1, 2, 3, 4, 5 + * items: 1, 15, 11, 2, 33, 21 + * final: 1, 2, 11, 15, 21, 33 + */ + const int idx[6] = {1, 15, 11, 2, 33, 21}; + const int relative[6] = { + 0, /* item '1' - not used */ + 0, /* item '15' - insert after pi[0], item '1' */ + -1, /* item '11' - insert before pi[1], item '15' */ + -2, /* item '2' - insert before pi[2], item '11' */ + 1, /* item '33' - insert after pi[1], item '15' */ + -4 /* item '21' - insert before pi[4], item '33' */ + }; + + win = elm_win_util_standard_add("genlist-tree-insert-relative", "Genlist Tree, Insert Relative"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + gl = elm_genlist_add(win); + evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(gl); + + itc4 = elm_genlist_item_class_new(); + itc4->item_style = "default"; + itc4->func.text_get = gl4_text_get; + itc4->func.content_get = NULL; + itc4->func.state_get = NULL; + itc4->func.del = NULL; + + /* mixed order to test insert sorted */ + + // BUG1: should be able to insert before=NULL, prepend + // BUG2: should be able to insert after=NULL, append + + pi[0] = elm_genlist_item_append + (gl, itc4, (void *)(long)idx[0]/* item data */, + NULL/* parent */, + ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */); + + for (i = 1; i < 3; i++) + { + if (relative[i] < 0) + pi[i] = elm_genlist_item_insert_before + (gl, itc4, (void *)(long)idx[i]/* item data */, + NULL/* parent */, pi[-relative[i]], + ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */); + else + pi[i] = elm_genlist_item_insert_after + (gl, itc4, (void *)(long)idx[i]/* item data */, + NULL/* parent */, pi[relative[i]], + ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */); + } + + for (i = 0; i < 3; i++) + { + Elm_Object_Item *sub_glit[6]; + int j; + + base = 1000 * (int)(long) elm_object_item_data_get(pi[i]); + + sub_glit[0] = elm_genlist_item_append + (gl, itc4, (void *)(long) (idx[0] + base)/* item data */, pi[i]/* parent */, + ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */); + + for (j = 1; j < 6; j++) { + if (relative[j] < 0) + sub_glit[j] = elm_genlist_item_insert_before + (gl, itc4, (void *)(long) (idx[j] + base)/* item data */, + pi[i]/* parent */, sub_glit[-relative[j]], + ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */); + else + sub_glit[j] = elm_genlist_item_insert_after + (gl, itc4, (void *)(long) (idx[j] + base)/* item data */, + pi[i]/* parent */, sub_glit[relative[j]], + ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */); + } + } + + for (i = 3; i < 6; i++) + { + if (relative[i] < 0) + pi[i] = elm_genlist_item_insert_before + (gl, itc4, (void *)(long) idx[i]/* item data */, + NULL/* parent */, pi[-relative[i]], + ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */); + else + pi[i] = elm_genlist_item_insert_after + (gl, itc4, (void *)(long) idx[i]/* item data */, + NULL/* parent */, pi[relative[i]], + ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */); + } + + for (i = 3; i < 6; i++) + { + Elm_Object_Item *sub_glit[6]; + int j; + + base = 1000 * (int)(long) elm_object_item_data_get(pi[i]); + + sub_glit[0] = elm_genlist_item_append + (gl, itc4, (void *)(long) (idx[0] + base)/* item data */, pi[i]/* parent */, + ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */); + + for (j = 1; j < 6; j++) { + if (relative[j] < 0) + sub_glit[j] = elm_genlist_item_insert_before + (gl, itc4, (void *)(long) (idx[j] + base)/* item data */, + pi[i]/* parent */, sub_glit[-relative[j]], + ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */); + else + sub_glit[j] = elm_genlist_item_insert_after + (gl, itc4, (void *)(long) (idx[j] + base)/* item data */, + pi[i]/* parent */, sub_glit[relative[j]], + ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */); + } + } + + elm_box_pack_end(bx, gl); + evas_object_show(bx); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + elm_box_homogeneous_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "+ before"); + evas_object_smart_callback_add(bt, "clicked", my_gl_insert_before_rel, gl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "+ after"); + evas_object_smart_callback_add(bt, "clicked", my_gl_insert_after_rel, gl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + /* item_class_ref is needed for itc4. some items can be added in callbacks */ + elm_genlist_item_class_ref(itc4); + elm_genlist_item_class_free(itc4); + + evas_object_resize(win, 320, 320); + evas_object_show(win); +} + +static void _edit_icon_clicked_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Object_Item *item = (Elm_Object_Item *)data; + elm_object_item_del(item); +} + +char *gl15_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ + const Testitem *tit = data; + char buf[256]; + snprintf(buf, sizeof(buf), "Item #%i", tit->mode); + return strdup(buf); +} + +Evas_Object *gl15_content_get(void *data, Evas_Object *obj, const char *part) +{ + Testitem *tit = data; + char buf[PATH_MAX]; + + // "edit_default" EDC layout is like below. each part is swallow part. + // the existing item is swllowed to elm.swallow.edit.content part. + // -------------------------------------------------------------------- + // | elm.edit.icon.1 | elm.swallow.decorate.content | elm.edit.icon,2 | + // -------------------------------------------------------------------- + + if (!strcmp(part, "elm.swallow.end")) + { + Evas_Object *ic = elm_icon_add(obj); + snprintf(buf, sizeof(buf), "%s/images/bubble.png", PACKAGE_DATA_DIR); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + return ic; + } + else if (!strcmp(part, "elm.edit.icon.1")) + { + Evas_Object *ck; + ck = elm_check_add(obj); + elm_check_state_pointer_set(ck, &tit->checked); + evas_object_propagate_events_set(ck, EINA_FALSE); + evas_object_show(ck); + return ck; + } + else if (!strcmp(part, "elm.edit.icon.2")) + { + Evas_Object *icn = elm_icon_add(obj); + snprintf(buf, sizeof(buf), "%s/images/icon_06.png", PACKAGE_DATA_DIR); + elm_icon_file_set(icn, buf, NULL); + evas_object_propagate_events_set(icn, EINA_FALSE); + evas_object_size_hint_aspect_set(icn, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + evas_object_smart_callback_add(icn, "clicked", _edit_icon_clicked_cb, (void *)tit->item); + return icn; + } + else return NULL; +} + +static void +gl15_sel(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Testitem *tit = data; + if (elm_genlist_decorate_mode_get(obj)) + { + if (!tit->checked) tit->checked = EINA_TRUE; + else tit->checked = EINA_FALSE; + } + elm_genlist_item_update(tit->item); +} + +static void +gl15_deco_all_mode(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_genlist_decorate_mode_set(data, EINA_TRUE); + elm_genlist_select_mode_set(data, ELM_OBJECT_SELECT_MODE_ALWAYS); +} + +static void +gl15_normal_mode(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_genlist_decorate_mode_set(data, EINA_FALSE); + elm_genlist_select_mode_set(data, ELM_OBJECT_SELECT_MODE_DEFAULT); +} + +void gl15_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__) +{ + printf("item deleted.\n"); +} + +static Elm_Genlist_Item_Class *itc15; +void +test_genlist15(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *bx2, *bt, *gl; + int i; + static Testitem tit[100]; + + win = elm_win_util_standard_add("genlist-decorate-all-mode", "Genlist Decorate All Mode"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + gl = elm_genlist_add(win); + evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(gl); + + itc15 = elm_genlist_item_class_new(); + itc15->item_style = "default"; + itc15->func.text_get = gl15_text_get; + itc15->func.content_get = gl15_content_get; + itc15->func.state_get = gl_state_get; + itc15->func.del = gl15_del; + itc15->decorate_all_item_style = "edit"; + + for (i = 0; i < 100; i++) + { + tit[i].mode = i; + tit[i].item = elm_genlist_item_append(gl, itc15, + &(tit[i])/* item data */, + NULL/* parent */, + ELM_GENLIST_ITEM_NONE/* flags */, + gl15_sel/* func */, + (void *)(long)&(tit[i])/* func data */); + } + elm_genlist_item_class_free(itc15); + elm_box_pack_end(bx, gl); + evas_object_show(bx); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + elm_box_homogeneous_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Decorate All mode"); + evas_object_smart_callback_add(bt, "clicked", gl15_deco_all_mode, gl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Normal mode"); + evas_object_smart_callback_add(bt, "clicked", gl15_normal_mode,gl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + evas_object_resize(win, 520, 520); + evas_object_show(win); +} + +static void _flip_icon_clicked_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + const Testitem *tit = data; + + if (elm_genlist_item_flip_get(tit->item)) + elm_genlist_item_flip_set(tit->item, EINA_FALSE); + else + elm_genlist_item_flip_set(tit->item, EINA_TRUE); +} + +char *gl16_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ + const Testitem *tit = data; + char buf[256]; + snprintf(buf, sizeof(buf), "Item #%i", tit->mode); + return strdup(buf); +} + +Evas_Object *gl16_content_get(void *data, Evas_Object *obj, const char *part) +{ + Testitem *tit = data; + char buf[PATH_MAX]; + + if (!strcmp(part, "elm.text.flip")) + { + Evas_Object *btn = elm_button_add(obj); + elm_object_text_set(btn, "flipped content placement"); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0.0); + evas_object_smart_callback_add(btn, "clicked", _flip_icon_clicked_cb, (void *)tit); + evas_object_show(btn); + return btn; + } + else if (!strcmp(part, "elm.edit.icon.1")) + { + Evas_Object *icn = elm_icon_add(obj); + snprintf(buf, sizeof(buf), "%s/images/icon_04.png", PACKAGE_DATA_DIR); + elm_icon_file_set(icn, buf, NULL); + evas_object_propagate_events_set(icn, EINA_FALSE); + evas_object_size_hint_aspect_set(icn, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + return icn; + } + else if (!strcmp(part, "elm.edit.icon.2")) + { + Evas_Object *icn = elm_icon_add(obj); + snprintf(buf, sizeof(buf), "%s/images/icon_09.png", PACKAGE_DATA_DIR); + elm_icon_file_set(icn, buf, NULL); + evas_object_propagate_events_set(icn, EINA_FALSE); + evas_object_size_hint_aspect_set(icn, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + evas_object_smart_callback_add(icn, "clicked", _flip_icon_clicked_cb, (void *)tit); + return icn; + } + else return NULL; +} + +void +test_genlist16(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *gl; + int i; + static Testitem tit[100]; + + win = elm_win_util_standard_add("genlist-flip-mode", "Genlist Flip Mode"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + gl = elm_genlist_add(win); + evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(gl); + + /* note: flip mode can be used with/without edit mode */ + elm_genlist_decorate_mode_set(gl, EINA_TRUE); + elm_genlist_select_mode_set(gl, ELM_OBJECT_SELECT_MODE_ALWAYS); + + itc15 = elm_genlist_item_class_new(); + itc15->item_style = "default"; + itc15->func.text_get = gl16_text_get; + itc15->func.content_get = gl16_content_get; + itc15->func.state_get = gl_state_get; + itc15->func.del = NULL; + itc15->decorate_all_item_style = "edit"; + + for (i = 0; i < 100; i++) + { + tit[i].mode = i; + tit[i].item = elm_genlist_item_append(gl, itc15, + &(tit[i])/* item data */, + NULL/* parent */, + ELM_GENLIST_ITEM_NONE/* flags */, + gl_sel/* func */, + (void *)(long)&(tit[i])/* func data */); + } + elm_genlist_item_class_free(itc15); + elm_box_pack_end(bx, gl); + evas_object_show(bx); + + evas_object_resize(win, 520, 520); + evas_object_show(win); +} + +static Elm_Genlist_Item_Class itc17; + +static void +gl17_sel(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Object_Item *glit = event_info; + int depth = elm_genlist_item_expanded_depth_get(glit); + printf("expanded depth for selected item is %d\n", depth); +} + +static void +gl17_exp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Object_Item *glit = event_info; + Evas_Object *gl = elm_object_item_widget_get(glit); + int val = (int)(long) elm_object_item_data_get(glit); + val *= 10; + elm_genlist_item_append(gl, &itc17, + (void *)(long) (val + 1)/* item data */, + glit/* parent */, + ELM_GENLIST_ITEM_TREE, gl17_sel/* func */, + NULL/* func data */); + elm_genlist_item_append(gl, &itc17, + (void *)(long) (val + 2)/* item data */, + glit/* parent */, + ELM_GENLIST_ITEM_TREE, gl17_sel/* func */, + NULL/* func data */); + elm_genlist_item_append(gl, &itc17, + (void *)(long) (val + 3)/* item data */, + glit/* parent */, + ELM_GENLIST_ITEM_TREE, gl17_sel/* func */, + NULL/* func data */); + elm_genlist_item_append(gl, &itc17, + (void *)(long) (val + 4)/* item data */, + glit/* parent */, + ELM_GENLIST_ITEM_TREE, gl17_sel/* func */, + NULL/* func data */); + elm_genlist_item_append(gl, &itc17, + (void *)(long) (val + 5)/* item data */, + glit/* parent */, + ELM_GENLIST_ITEM_TREE, gl17_sel/* func */, + NULL/* func data */); + elm_genlist_item_append(gl, &itc17, + (void *)(long) (val + 6)/* item data */, + glit/* parent */, + ELM_GENLIST_ITEM_TREE, gl17_sel/* func */, + NULL/* func data */); +} + +static void +gl17_con(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Object_Item *glit = event_info; + elm_genlist_item_subitems_clear(glit); +} + +static void +gl17_exp_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Object_Item *glit = event_info; + elm_genlist_item_expanded_set(glit, EINA_TRUE); +} + +static void +gl17_con_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Object_Item *glit = event_info; + elm_genlist_item_expanded_set(glit, EINA_FALSE); +} + +char *gl17_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ + char buf[256]; + snprintf(buf, sizeof(buf), "Item mode %i", (int)(long)data); + return strdup(buf); +} + +Evas_Object *gl17_content_get(void *data __UNUSED__, Evas_Object *obj, const char *part) +{ + char buf[PATH_MAX]; + if (!strcmp(part, "elm.swallow.icon")) + { + Evas_Object *ic = elm_icon_add(obj); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + evas_object_show(ic); + return ic; + } + else if (!strcmp(part, "elm.swallow.end")) + { + Evas_Object *ck; + ck = elm_check_add(obj); + evas_object_propagate_events_set(ck, EINA_FALSE); + evas_object_show(ck); + return ck; + } + return NULL; +} + +Eina_Bool gl17_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ + return EINA_FALSE; +} + +void gl17_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__) +{ + printf("item deleted.\n"); +} + +static void +gl17_enabled_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_genlist_tree_effect_enabled_set(data, EINA_TRUE); +} + +static void +gl17_disabled_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_genlist_tree_effect_enabled_set(data, EINA_FALSE); +} + +void +test_genlist17(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *gl, *bx, *bx2, *bt; + + win = elm_win_util_standard_add("genlist17", "Genlist Tree Effect"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + gl = elm_genlist_add(win); + evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(gl); + + elm_genlist_tree_effect_enabled_set(gl,EINA_TRUE); + + itc17.item_style = "tree_effect"; + itc17.func.text_get = gl17_text_get; + itc17.func.content_get = gl17_content_get; + itc17.func.state_get = gl17_state_get; + itc17.func.del = gl17_del; + + elm_genlist_item_append(gl, &itc17, + (void *)1/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_TREE, gl17_sel/* func */, + NULL/* func data */); + elm_genlist_item_append(gl, &itc17, + (void *)2/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_TREE, gl17_sel/* func */, + NULL/* func data */); + elm_genlist_item_append(gl, &itc17, + (void *)3/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_TREE, gl17_sel/* func */, + NULL/* func data */); + + evas_object_smart_callback_add(gl, "expand,request", gl17_exp_req, gl); + evas_object_smart_callback_add(gl, "contract,request", gl17_con_req, gl); + evas_object_smart_callback_add(gl, "expanded", gl17_exp, gl); + evas_object_smart_callback_add(gl, "contracted", gl17_con, gl); + + elm_box_pack_end(bx, gl); + evas_object_show(bx); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + elm_box_homogeneous_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Enable"); + evas_object_smart_callback_add(bt, "clicked", gl17_enabled_set, gl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Disable"); + evas_object_smart_callback_add(bt, "clicked", gl17_disabled_set, gl); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + evas_object_resize(win, 320, 320); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_gesture_layer.c b/libraries/elementary/src/bin/test_gesture_layer.c new file mode 100644 index 0000000..5df3970 --- /dev/null +++ b/libraries/elementary/src/bin/test_gesture_layer.c @@ -0,0 +1,406 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +/* We zoom out to this value so we'll be able to use map and have a nice + * resolution when zooming in. */ +#define BASE_ZOOM 0.5 +/* The amount of zoom to do when "lifting" objects. */ +#define LIFT_FACTOR 1.3 +/* The base size of the shadow image. */ +#define SHADOW_W 118 +#define SHADOW_H 118 +#define RAD2DEG(x) ((x) * 57.295779513) + +static double zoom_out_animation_duration = 0.4; + +struct _Photo_Object { + Evas_Object *ic, *shadow; + Evas_Object *hit; + Evas_Object *gl; + Elm_Transit *zoom_out; + /* bx, by - current wanted coordinates of the photo object. + * bw, bh - original size of the "ic" object. + * dx, dy - Used to indicate the distance between the center point + * where we put down our fingers (when started moving the item) to + * the coords of the object, so we'll be able to calculate movement + * correctly. */ + Evas_Coord bx, by, bw, bh, dx, dy; + /* Because gesture layer only knows the amount of rotation/zoom we do + * per gesture, we have to keep the current rotate/zoom factor and the + * one that was before we started the gesture. */ + int base_rotate, rotate; + double base_zoom, zoom; + double shadow_zoom; +}; +typedef struct _Photo_Object Photo_Object; + + +/* This function applies the information from the Photo_Object to the actual + * evas objects. Zoom/rotate factors and etc. */ +static void +apply_changes(Photo_Object *po) +{ + Evas_Map *map; + + map = evas_map_new(4); + evas_map_point_coord_set(map, 0, po->bx, po->by, 0); + evas_map_point_coord_set(map, 1, po->bx + po->bw, po->by, 0); + evas_map_point_coord_set(map, 2, po->bx + po->bw, po->by + po->bh, 0); + evas_map_point_coord_set(map, 3, po->bx, po->by + po->bh, 0); + evas_map_point_image_uv_set(map, 0, 0, 0); + evas_map_point_image_uv_set(map, 1, po->bw, 0); + evas_map_point_image_uv_set(map, 2, po->bw, po->bh); + evas_map_point_image_uv_set(map, 3, 0, po->bh); + evas_map_util_rotate(map, po->rotate, + po->bx + po->bw / 2, po->by + po->bh /2); + evas_map_util_zoom(map, po->zoom, po->zoom, + po->bx + po->bw / 2, po->by + po->bh /2); + evas_object_map_enable_set(po->ic, EINA_TRUE); + evas_object_map_set(po->ic, map); + + { + Evas_Map *shadow_map = evas_map_new(4); + evas_map_point_coord_set(shadow_map, 0, po->bx, po->by, 0); + evas_map_point_coord_set(shadow_map, 1, po->bx + po->bw, po->by, 0); + evas_map_point_coord_set(shadow_map, 2, po->bx + po->bw, po->by + po->bh, 0); + evas_map_point_coord_set(shadow_map, 3, po->bx, po->by + po->bh, 0); + evas_map_point_image_uv_set(shadow_map, 0, 0, 0); + evas_map_point_image_uv_set(shadow_map, 1, SHADOW_W, 0); + evas_map_point_image_uv_set(shadow_map, 2, SHADOW_W, SHADOW_H); + evas_map_point_image_uv_set(shadow_map, 3, 0, SHADOW_H); + evas_map_util_rotate(shadow_map, po->rotate, + po->bx + po->bw / 2, po->by + po->bh /2); + evas_map_util_zoom(shadow_map, po->zoom * po->shadow_zoom, + po->zoom * po->shadow_zoom, + po->bx + (po->bw / 2), po->by + (po->bh / 2)); + evas_object_map_enable_set(po->shadow, EINA_TRUE); + evas_object_map_set(po->shadow, shadow_map); + evas_map_free(shadow_map); + } + + /* Update the position of the hit box */ + { + Evas_Coord minx, miny, maxx, maxy; + int i; + evas_object_polygon_points_clear(po->hit); + evas_map_point_coord_get(map, 0, &minx, &miny, NULL); + maxx = minx; + maxy = miny; + evas_object_polygon_point_add(po->hit, minx, miny); + for (i = 1 ; i <= 3 ; i++) + { + Evas_Coord x, y; + evas_map_point_coord_get(map, i, &x, &y, NULL); + evas_object_polygon_point_add(po->hit, x, y); + if (x < minx) + minx = x; + else if (x > maxx) + maxx = x; + + if (y < miny) + miny = y; + else if (y > maxy) + maxy = y; + } + } + + evas_object_raise(po->shadow); + evas_object_raise(po->ic); + evas_object_raise(po->hit); + evas_map_free(map); +} + +/* Zoom out animation */ +static void +zoom_out_animation_operation(void *_po, Elm_Transit *transit __UNUSED__, + double progress) +{ + Photo_Object *po = (Photo_Object *) _po; + po->zoom = BASE_ZOOM + ((po->base_zoom - BASE_ZOOM) * (1.0 - progress)); + apply_changes(po); +} + +static void +zoom_out_animation_end(void *_po, Elm_Transit *transit __UNUSED__) +{ + Photo_Object *po = (Photo_Object *) _po; + + po->base_zoom = po->zoom = BASE_ZOOM; + apply_changes(po); + + po->zoom_out = NULL; +} + +static Evas_Event_Flags +rotate_move(void *_po, void *event_info) +{ + Photo_Object *po = (Photo_Object *) _po; + Elm_Gesture_Rotate_Info *p = (Elm_Gesture_Rotate_Info *) event_info; + printf("rotate move <%d,%d> base=<%f> <%f>\n", p->x, p->y, RAD2DEG(p->base_angle), RAD2DEG(p->angle)); + po->rotate = po->base_rotate + (int) RAD2DEG(p->base_angle - p->angle); + if (po->rotate < 0) + po->rotate += 360; + apply_changes(po); + return EVAS_EVENT_FLAG_NONE; +} + +static Evas_Event_Flags +rotate_end(void *_po, void *event_info) +{ + Photo_Object *po = (Photo_Object *) _po; + Elm_Gesture_Rotate_Info *p = (Elm_Gesture_Rotate_Info *) event_info; + printf("rotate end/abort <%d,%d> base=<%f> <%f>\n", p->x, p->y, RAD2DEG(p->base_angle), RAD2DEG(p->angle)); + po->base_rotate += (int) RAD2DEG(p->base_angle - p->angle); + if (po->rotate < 0) + po->rotate += 360; + return EVAS_EVENT_FLAG_NONE; +} + +static Evas_Event_Flags +zoom_start(void *_po, void *event_info) +{ + Photo_Object *po = (Photo_Object *) _po; + Elm_Gesture_Zoom_Info *p = (Elm_Gesture_Zoom_Info *) event_info; + printf("zoom start <%d,%d> <%f>\n", p->x, p->y, p->zoom); + + /* If there's an active animator, stop it */ + if (po->zoom_out) + { + elm_transit_del(po->zoom_out); + po->zoom_out = NULL; + } + + /* Give it a "lift" effect right from the start */ + po->base_zoom = BASE_ZOOM * LIFT_FACTOR; + po->zoom = po->base_zoom; + po->shadow_zoom = 1.7; + + apply_changes(po); + return EVAS_EVENT_FLAG_NONE; +} + +static Evas_Event_Flags +zoom_move(void *_po, void *event_info) +{ + Photo_Object *po = (Photo_Object *) _po; + Elm_Gesture_Zoom_Info *p = (Elm_Gesture_Zoom_Info *) event_info; + printf("zoom move <%d,%d> <%f>\n", p->x, p->y, p->zoom); + po->zoom = po->base_zoom * p->zoom; + apply_changes(po); + return EVAS_EVENT_FLAG_NONE; +} + +static Evas_Event_Flags +zoom_end(void *_po, void *event_info) +{ + Photo_Object *po = (Photo_Object *) _po; + Elm_Gesture_Zoom_Info *p = (Elm_Gesture_Zoom_Info *) event_info; + printf("zoom end/abort <%d,%d> <%f>\n", p->x, p->y, p->zoom); + + /* Apply the zoom out animator */ + po->shadow_zoom = 1.3; + po->base_zoom = po->zoom; + po->zoom_out = elm_transit_add(); + elm_transit_duration_set(po->zoom_out, zoom_out_animation_duration); + elm_transit_effect_add(po->zoom_out, zoom_out_animation_operation, po, zoom_out_animation_end); + elm_transit_go(po->zoom_out); + return EVAS_EVENT_FLAG_NONE; +} + +static Evas_Event_Flags +momentum_start(void *_po, void *event_info) +{ + Photo_Object *po = (Photo_Object *) _po; + Elm_Gesture_Momentum_Info *p = (Elm_Gesture_Momentum_Info *) event_info; + printf("momentum_start <%d,%d>\n", p->x2, p->y2); + + po->dx = p->x2 - po->bx; + po->dy = p->y2 - po->by; + apply_changes(po); + + return EVAS_EVENT_FLAG_NONE; +} + +static Evas_Event_Flags +momentum_move(void *_po, void *event_info) +{ + Photo_Object *po = (Photo_Object *) _po; + Elm_Gesture_Momentum_Info *p = (Elm_Gesture_Momentum_Info *) event_info; + printf("momentum move <%d,%d>\n", p->x2, p->y2); + + po->bx = p->x2 - po->dx; + po->by = p->y2 - po->dy; + apply_changes(po); + + return EVAS_EVENT_FLAG_NONE; +} + +static Evas_Event_Flags +momentum_end(void *_po, void *event_info) +{ + Photo_Object *po = (Photo_Object *) _po; + Elm_Gesture_Momentum_Info *p = (Elm_Gesture_Momentum_Info *) event_info; + printf("momentum end/abort <%d,%d> <%d,%d>\n", p->x2, p->y2, p->mx, p->my); + (void) po; + (void) p; + /* Make sure middle is in the screen, if not, fix it. */ + { + /* FIXME: Use actual window sizes instead of the hardcoded + * values */ + Evas_Coord mx, my; + mx = po->bx + (po->bw / 2); + my = po->by + (po->bh / 2); + if (mx < 0) + po->bx = 0 - (po->bw / 2); + else if (mx > 480) + po->bx = 480 - (po->bw / 2); + + if (my < 0) + po->by = 0 - (po->bw / 2); + else if (my > 800) + po->by = 800 - (po->bh / 2); + } + apply_changes(po); + + return EVAS_EVENT_FLAG_NONE; +} + +static void +_win_del_req(void *data, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Photo_Object **photo_array = (Photo_Object **) data; + + if (!photo_array) + return; + + /* The content of the photo object is automatically deleted when the win + * is deleted. */ + for ( ; *photo_array ; photo_array++) + free(*photo_array); + + free(data); +} + + +Photo_Object * +photo_object_add(Evas_Object *parent, Evas_Object *ic, const char *icon, Evas_Coord x, + Evas_Coord y, Evas_Coord w, Evas_Coord h, int angle) +{ + char buf[PATH_MAX]; + Photo_Object *po; + po = calloc(1, sizeof(*po)); + po->base_zoom = po->zoom = BASE_ZOOM; + + if (ic) + { + po->ic = ic; + } + else + { + po->ic = elm_icon_add(parent); + elm_icon_file_set(po->ic, icon, NULL); + } + + po->bx = x; + po->by = y; + po->bw = w; + po->bh = h; + + /* Add shadow */ + { + po->shadow = elm_icon_add(po->ic); + snprintf(buf, sizeof(buf), "%s/images/pol_shadow.png", elm_app_data_dir_get()); + elm_icon_file_set(po->shadow, buf, NULL); + evas_object_resize(po->shadow, SHADOW_W, SHADOW_H); + evas_object_show(po->shadow); + } + + po->hit = evas_object_polygon_add(evas_object_evas_get(parent)); + evas_object_precise_is_inside_set(po->hit, EINA_TRUE); + evas_object_repeat_events_set(po->hit, EINA_TRUE); + evas_object_color_set(po->hit, 0, 0, 0, 0); + + evas_object_resize(po->ic, po->bw, po->bh); + evas_object_show(po->ic); + + evas_object_show(po->hit); + + po->gl = elm_gesture_layer_add(po->ic); + elm_gesture_layer_hold_events_set(po->gl, EINA_TRUE); + elm_gesture_layer_attach(po->gl, po->hit); + + /* FIXME: Add a po->rotate start so we take the first angle!!!! */ + elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_ROTATE, ELM_GESTURE_STATE_MOVE, rotate_move, po); + elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_ROTATE, ELM_GESTURE_STATE_END, rotate_end, po); + elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_ROTATE, ELM_GESTURE_STATE_ABORT, rotate_end, po); + elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_START, zoom_start, po); + elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_MOVE, zoom_move, po); + elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_END, zoom_end, po); + elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_ABORT, zoom_end, po); + elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_MOMENTUM, ELM_GESTURE_STATE_START, momentum_start, po); + elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_MOMENTUM, ELM_GESTURE_STATE_MOVE, momentum_move, po); + elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_MOMENTUM, ELM_GESTURE_STATE_END, momentum_end, po); + elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_MOMENTUM, ELM_GESTURE_STATE_ABORT, momentum_end, po); + + po->rotate = po->base_rotate = angle; + po->shadow_zoom = 1.3; + + apply_changes(po); + return po; +} + +void +test_gesture_layer(void *data __UNUSED__, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Coord w, h; + Evas_Object *win, *bg; + char buf[PATH_MAX]; + int ind = 0; + Photo_Object **photo_array; + photo_array = calloc(sizeof(*photo_array), 4); + + w = 480; + h = 800; + + win = elm_win_add(NULL, "gesture-layer", ELM_WIN_BASIC); + elm_win_title_set(win, "Gesture Layer"); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_resize(win, w, h); + + bg = elm_bg_add(win); + snprintf(buf, sizeof(buf), "%s/images/wood_01.jpg", elm_app_data_dir_get()); + elm_bg_file_set(bg, buf, NULL); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + snprintf(buf, sizeof(buf), "%s/images/pol_sky.png", elm_app_data_dir_get()); + photo_array[ind++] = photo_object_add(win, NULL, buf, 200, 200, 365, 400, 0); + snprintf(buf, sizeof(buf), "%s/images/pol_twofish.png", elm_app_data_dir_get()); + photo_array[ind++] = photo_object_add(win, NULL, buf, 40, 300, 365, 400, 45); + + Evas_Object *en = elm_entry_add(win); + elm_object_text_set(en, "You can use whatever object you want, " + "even entries like this."); + elm_entry_line_wrap_set(en, ELM_WRAP_MIXED); + + Evas_Object *postit = elm_layout_add(win); + snprintf(buf, sizeof(buf), "%s/objects/postit_ent.edj", elm_app_data_dir_get()); + elm_layout_file_set(postit, buf, "main"); + elm_object_part_content_set(postit, "ent", en); + + photo_array[ind++] = photo_object_add(win, postit, NULL, 50, 50, 382, 400, 355); + + photo_array[ind] = NULL; + evas_object_smart_callback_add(win, "delete,request", _win_del_req, + photo_array); + evas_object_show(win); +} + +#endif + diff --git a/libraries/elementary/src/bin/test_gesture_layer2.c b/libraries/elementary/src/bin/test_gesture_layer2.c new file mode 100644 index 0000000..487c84e --- /dev/null +++ b/libraries/elementary/src/bin/test_gesture_layer2.c @@ -0,0 +1,778 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +#define TAP_NAME "tap" +#define DOUBLE_TAP_NAME "double_tap" +#define TRIPLE_TAP_NAME "triple_tap" +#define LONG_TAP_NAME "long_tap" +#define FLICK_NAME "flick" +#define LINE_NAME "line" +#define MOMENTUM_NAME "momentum" +#define ROTATE_NAME "rotate" +#define ZOOM_NAME "zoom" + +#define N_GESTURE_TYPE 9 +#define MAX_DOUBLE_TAP 5 +#define MAX_FLICK 5 +#define MAX_LINE 5 +#define MAX_LONG_TAP 5 +#define MAX_MOMENTUM 5 +#define MAX_ROTATE 1 +#define MAX_TAP 5 +#define MAX_TRIPLE_TAP 5 +#define MAX_ZOOM 1 + +#define TB_PADDING_X 4 +#define TB_PADDING_Y 12 + +#define BX_PADDING_X 0 +#define BX_PADDING_Y 2 + +/* Define initial RGBA values for icons */ +#define INI_R 60 +#define INI_G 66 +#define INI_B 64 +#define INI_A 128 +#define COLOR_STEP 4 + +#define START_COLOR 220, 220, 200, 255 +#define MOVE_COLOR 255, 255, 0, 255 +#define ABORT_COLOR 255, 0, 0, 255 +#define END_COLOR 0, 255, 0, 255 + +struct _icon_properties +{ + Evas_Object *icon; + int r; /* current r */ + int g; + int b; + int a; + + const char *name; +}; +typedef struct _icon_properties icon_properties; + +struct _infra_data +{ /* Some data that is passed aroung between callbacks (replacing globals) */ + icon_properties *icons; + Ecore_Timer *colortimer; + char buf[1024]; +}; +typedef struct _infra_data infra_data; + +void +_infra_data_free(infra_data *infra) +{ + if (infra) + { + if (infra->colortimer) + ecore_timer_del(infra->colortimer); + + if (infra->icons) + free(infra->icons); + + free (infra); + } +} + +infra_data * +_infra_data_alloc(void) +{ + infra_data *infra = malloc(sizeof(infra_data)); + infra->icons = calloc(N_GESTURE_TYPE, sizeof(icon_properties )); + infra->colortimer = NULL; + + return infra; +} + +static void +my_win_del(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ /* called when my_win_main is requested to be deleted */ + _infra_data_free(data); +} + +icon_properties * +_icon_properties_find(icon_properties *icons, char *name) +{ + int n; + + for (n = 0; n < N_GESTURE_TYPE; n++) + if (!strcmp(icons[n].name, name)) + return &icons[n]; + + return NULL; +} + +void +_icon_color_set(icon_properties *i, int r, int g, int b, int a) +{ + i->r = r; + i->g = g; + i->b = b; + i->a = a; + evas_object_color_set(i->icon, i->r, i->g, i->b, i->a); +} + + +static Eina_Bool +_icon_color_set_cb(void *data) +{ +#define INC_COLOR(C, NC) \ + do { \ + if (abs(i->C - NC) < COLOR_STEP) \ + i->C = NC; \ + else \ + i->C += ((i->C < NC) ? COLOR_STEP : (-COLOR_STEP)); \ + } while (0) + + int n; + icon_properties *icons = data; + icon_properties *i; + + for (n = 0; n < N_GESTURE_TYPE; n++) + { + i = &icons[n]; + + INC_COLOR(r,INI_R); + INC_COLOR(g,INI_G); + INC_COLOR(b,INI_B); + INC_COLOR(a,INI_A); + + /* Change Icon color */ + evas_object_color_set(i->icon, i->r, i->g, i->b, i->a); + } + + return ECORE_CALLBACK_RENEW; +} + + +void +_color_and_icon_set(infra_data *infra, char *name, int n, int max, + int r, int g, int b, int a) +{ + icon_properties *i; + int nn = n; + i = _icon_properties_find(infra->icons, name); + if (i) + { + if (n < 1) + nn = 1; + + if (n > max) + nn = max; + + snprintf(infra->buf, sizeof(infra->buf), + "%s/images/g_layer/%s_%d.png", elm_app_data_dir_get(), i->name, nn); + elm_icon_file_set(i->icon, infra->buf, NULL); + _icon_color_set(i, r, g, b, a); + } +} + +/* START - Callbacks for gestures */ +static Evas_Event_Flags +n_finger_tap_start(void *data , void *event_info) +{ + Elm_Gesture_Taps_Info *p = (Elm_Gesture_Taps_Info *) event_info; + _color_and_icon_set(data, TAP_NAME, p->n, MAX_TAP, START_COLOR); + printf("N tap started <%p> x,y=<%d,%d> count=<%d>\n", + event_info, p->x, p->y, p->n); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +n_finger_tap_end(void *data , void *event_info) +{ + Elm_Gesture_Taps_Info *p = (Elm_Gesture_Taps_Info *) event_info; + + printf("N tap ended <%p> x,y=<%d,%d> count=<%d>\n", + event_info, p->x, p->y, p->n); + _color_and_icon_set(data, TAP_NAME, p->n, MAX_TAP, END_COLOR); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +n_finger_tap_abort(void *data , void *event_info) +{ + Elm_Gesture_Taps_Info *p = (Elm_Gesture_Taps_Info *) event_info; + printf("N tap abort\n"); + _color_and_icon_set(data, TAP_NAME, p->n, MAX_TAP, ABORT_COLOR); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +n_long_tap_start(void *data , void *event_info) +{ + Elm_Gesture_Taps_Info *p = (Elm_Gesture_Taps_Info *) event_info; + + printf("N long tap started <%p> x,y=<%d,%d> count=<%d>\n", + event_info, p->x, p->y, p->n); + _color_and_icon_set(data, LONG_TAP_NAME, p->n, MAX_LONG_TAP, START_COLOR); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +n_long_tap_move(void *data , void *event_info) +{ + Elm_Gesture_Taps_Info *p = (Elm_Gesture_Taps_Info *) event_info; + _color_and_icon_set(data, LONG_TAP_NAME, p->n, MAX_LONG_TAP, MOVE_COLOR); + + printf("N long tap moved <%p> x,y=<%d,%d> count=<%d>\n", + event_info, p->x, p->y, p->n); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +n_long_tap_end(void *data , void *event_info) +{ + Elm_Gesture_Taps_Info *p = (Elm_Gesture_Taps_Info *) event_info; + + printf("N long tap ended <%p> x,y=<%d,%d> count=<%d>\n", + event_info, p->x, p->y, p->n); + _color_and_icon_set(data, LONG_TAP_NAME, p->n, MAX_LONG_TAP, END_COLOR); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +n_long_tap_abort(void *data , void *event_info) +{ + Elm_Gesture_Taps_Info *p = (Elm_Gesture_Taps_Info *) event_info; + _color_and_icon_set(data, LONG_TAP_NAME, p->n, MAX_LONG_TAP, ABORT_COLOR); + printf("N long tap abort\n"); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +dbl_click_start(void *data , void *event_info) +{ + Elm_Gesture_Taps_Info *p = (Elm_Gesture_Taps_Info *) event_info; + + _color_and_icon_set(data,DOUBLE_TAP_NAME, p->n, MAX_DOUBLE_TAP, START_COLOR); + printf("Double click started <%p> x,y=<%d,%d> count=<%d>\n", + event_info, p->x, p->y, p->n); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +dbl_click_end(void *data , void *event_info) +{ + Elm_Gesture_Taps_Info *p = (Elm_Gesture_Taps_Info *) event_info; + _color_and_icon_set(data, DOUBLE_TAP_NAME, p->n, MAX_DOUBLE_TAP, END_COLOR); + + printf("Double click ended <%p> x,y=<%d,%d> count=<%d>\n", + event_info, p->x, p->y, p->n); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +dbl_click_abort(void *data , void *event_info) +{ + Elm_Gesture_Taps_Info *p = (Elm_Gesture_Taps_Info *) event_info; + _color_and_icon_set(data,DOUBLE_TAP_NAME, p->n, MAX_DOUBLE_TAP, ABORT_COLOR); + + printf("Double click abort\n"); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +triple_click_start(void *data , void *event_info) +{ + Elm_Gesture_Taps_Info *p = (Elm_Gesture_Taps_Info *) event_info; + _color_and_icon_set(data,TRIPLE_TAP_NAME, p->n, MAX_TRIPLE_TAP, START_COLOR); + + printf("Triple click started <%p> x,y=<%d,%d> count=<%d>\n", + event_info, p->x, p->y, p->n); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +triple_click_end(void *data , void *event_info) +{ + Elm_Gesture_Taps_Info *p = (Elm_Gesture_Taps_Info *) event_info; + + _color_and_icon_set(data, TRIPLE_TAP_NAME, p->n, MAX_TRIPLE_TAP, END_COLOR); + printf("Triple click ended <%p> x,y=<%d,%d> count=<%d>\n", + event_info, p->x, p->y, p->n); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +triple_click_abort(void *data , void *event_info) +{ + Elm_Gesture_Taps_Info *p = (Elm_Gesture_Taps_Info *) event_info; + _color_and_icon_set(data,TRIPLE_TAP_NAME, p->n, MAX_TRIPLE_TAP, ABORT_COLOR); + + printf("Triple click abort\n"); + return EVAS_EVENT_FLAG_ON_HOLD; +} + + +static Evas_Event_Flags +momentum_start(void *data , void *event_info) +{ + Elm_Gesture_Momentum_Info *p = (Elm_Gesture_Momentum_Info *) event_info; + _color_and_icon_set(data, MOMENTUM_NAME, p->n, MAX_MOMENTUM, START_COLOR); + + printf("momentum started x1,y1=<%d,%d> tx,ty=<%u,%u> n=<%u>\n", + p->x1, p->y1, p->tx, p->ty, p->n); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +momentum_end(void *data , void *event_info) +{ + Elm_Gesture_Momentum_Info *p = (Elm_Gesture_Momentum_Info *) event_info; + _color_and_icon_set(data, MOMENTUM_NAME, p->n, MAX_MOMENTUM, END_COLOR); + printf("momentum ended x1,y1=<%d,%d> x2,y2=<%d,%d> tx,ty=<%u,%u> mx=<%d> my=<%d> n=<%u>\n",p->x1, p->y1, p->x2, p->y2, p->tx, p->ty, p->mx, p->my, p->n); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +momentum_abort(void *data , void *event_info) +{ + Elm_Gesture_Momentum_Info *p = (Elm_Gesture_Momentum_Info *) event_info; + printf("momentum abort\n"); + _color_and_icon_set(data, MOMENTUM_NAME, p->n, MAX_MOMENTUM, ABORT_COLOR); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +momentum_move(void *data , void *event_info) +{ + Elm_Gesture_Momentum_Info *p = (Elm_Gesture_Momentum_Info *) event_info; + _color_and_icon_set(data, MOMENTUM_NAME, p->n, MAX_MOMENTUM, MOVE_COLOR); + printf("momentum move x1,y1=<%d,%d> x2,y2=<%d,%d> tx,ty=<%u,%u> mx=<%d> my=<%d> n=<%u>\n", p->x1, p->y1, p->x2, p->y2, p->tx, p->ty, p->mx, p->my, p->n); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +line_start(void *data , void *event_info) +{ + Elm_Gesture_Line_Info *p = (Elm_Gesture_Line_Info *) event_info; + _color_and_icon_set(data, LINE_NAME, p->momentum.n, MAX_LINE, START_COLOR); + + printf("line started x1,y1=<%d,%d> x2,y2=<%d,%d> tx,ty=<%u,%u> n=<%u>\n", p->momentum.x1, p->momentum.y1, p->momentum.x2, p->momentum.y2, p->momentum.tx, p->momentum.ty, p->momentum.n); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +line_move(void *data , void *event_info) +{ + Elm_Gesture_Line_Info *p = (Elm_Gesture_Line_Info *) event_info; + _color_and_icon_set(data, LINE_NAME, p->momentum.n, MAX_LINE, MOVE_COLOR); + printf("line move x1,y1=<%d,%d> x2,y2=<%d,%d> tx,ty=<%u,%u> n=<%u>\n", p->momentum.x1, p->momentum.y1, p->momentum.x2, p->momentum.y2, p->momentum.tx, p->momentum.ty, p->momentum.n); + + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +line_end(void *data , void *event_info) +{ + Elm_Gesture_Line_Info *p = (Elm_Gesture_Line_Info *) event_info; + _color_and_icon_set(data, LINE_NAME, p->momentum.n, MAX_LINE, END_COLOR); + printf("line end x1,y1=<%d,%d> x2,y2=<%d,%d> tx,ty=<%u,%u> n=<%u>\n", p->momentum.x1, p->momentum.y1, p->momentum.x2, p->momentum.y2, p->momentum.tx, p->momentum.ty, p->momentum.n); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +line_abort(void *data , void *event_info) +{ + Elm_Gesture_Line_Info *p = (Elm_Gesture_Line_Info *) event_info; + _color_and_icon_set(data, LINE_NAME, p->momentum.n, MAX_LINE, ABORT_COLOR); + printf("line abort\n"); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +flick_start(void *data , void *event_info) +{ + Elm_Gesture_Line_Info *p = (Elm_Gesture_Line_Info *) event_info; + _color_and_icon_set(data, FLICK_NAME, p->momentum.n, MAX_FLICK, START_COLOR); + + printf("flick started x1,y1=<%d,%d> tx,ty=<%u,%u> n=<%u>\n", + p->momentum.x1, p->momentum.y1, p->momentum.tx, + p->momentum.ty, p->momentum.n); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +flick_end(void *data , void *event_info) +{ + Elm_Gesture_Line_Info *p = (Elm_Gesture_Line_Info *) event_info; + _color_and_icon_set(data, FLICK_NAME, p->momentum.n, MAX_FLICK, END_COLOR); + + printf("flick ended x1,y1=<%d,%d> x2,y2=<%d,%d> tx,ty=<%u,%u> mx=<%d> my=<%d> n=<%u>\n",p->momentum.x1, p->momentum.y1, p->momentum.x2, p->momentum.y2, p->momentum.tx, p->momentum.ty, p->momentum.mx, p->momentum.my, p->momentum.n); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +flick_abort(void *data , void *event_info) +{ + Elm_Gesture_Line_Info *p = (Elm_Gesture_Line_Info *) event_info; + _color_and_icon_set(data, FLICK_NAME, p->momentum.n, MAX_FLICK, ABORT_COLOR); + printf("flick abort\n"); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +zoom_start(void *data , void *event_info) +{ + Elm_Gesture_Zoom_Info *p = (Elm_Gesture_Zoom_Info *) event_info; + _color_and_icon_set(data, ZOOM_NAME, MAX_ZOOM, MAX_ZOOM, START_COLOR); + printf("zoom started <%d,%d> zoom=<%f> radius=<%d> momentum=<%f>\n", + p->x, p->y, p->zoom, p->radius, p->momentum); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +zoom_move(void *data , void *event_info) +{ + Elm_Gesture_Zoom_Info *p = (Elm_Gesture_Zoom_Info *) event_info; + _color_and_icon_set(data, ZOOM_NAME, MAX_ZOOM, MAX_ZOOM, MOVE_COLOR); + printf("zoom move <%d,%d> zoom=<%f> radius=<%d> momentum=<%f>\n", + p->x, p->y, p->zoom, p->radius, p->momentum); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +zoom_end(void *data , void *event_info) +{ + Elm_Gesture_Zoom_Info *p = (Elm_Gesture_Zoom_Info *) event_info; + _color_and_icon_set(data, ZOOM_NAME, MAX_ZOOM, MAX_ZOOM, END_COLOR); + printf("zoom end <%d,%d> zoom=<%f> radius=<%d> momentum=<%f>\n", + p->x, p->y, p->zoom, p->radius, p->momentum); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +zoom_abort(void *data , void *event_info __UNUSED__) +{ + printf("zoom abort\n"); + _color_and_icon_set(data, ZOOM_NAME, MAX_ZOOM, MAX_ZOOM, ABORT_COLOR); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +rotate_start(void *data , void *event_info) +{ + Elm_Gesture_Rotate_Info *p = (Elm_Gesture_Rotate_Info *) event_info; + _color_and_icon_set(data, ROTATE_NAME, MAX_ROTATE, MAX_ROTATE, START_COLOR); + printf("rotate started <%d,%d> base=<%f> angle=<%f> radius=<%d> momentum=<%f>\n", p->x, p->y, p->base_angle, p->angle, p->radius, p->momentum); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +rotate_move(void *data , void *event_info) +{ + Elm_Gesture_Rotate_Info *p = (Elm_Gesture_Rotate_Info *) event_info; + _color_and_icon_set(data, ROTATE_NAME, MAX_ROTATE, MAX_ROTATE, MOVE_COLOR); + printf("rotate move <%d,%d> base=<%f> angle=<%f> radius=<%d> momentum=<%f>\n", p->x, p->y, p->base_angle, p->angle, p->radius, p->momentum); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +rotate_end(void *data , void *event_info) +{ + Elm_Gesture_Rotate_Info *p = (Elm_Gesture_Rotate_Info *) event_info; + _color_and_icon_set(data, ROTATE_NAME, MAX_ROTATE, MAX_ROTATE, END_COLOR); + printf("rotate end <%d,%d> base=<%f> angle=<%f> radius=<%d> momentum=<%f>\n", p->x, p->y, p->base_angle, p->angle, p->radius, p->momentum); + return EVAS_EVENT_FLAG_ON_HOLD; +} + +static Evas_Event_Flags +rotate_abort(void *data , void *event_info __UNUSED__) +{ + _color_and_icon_set(data, ROTATE_NAME, MAX_ROTATE, MAX_ROTATE, ABORT_COLOR); + printf("rotate abort\n"); + return EVAS_EVENT_FLAG_ON_HOLD; +} +/* END - Callbacks for gestures */ + +Evas_Object *create_gesture_box(Evas_Object *win, icon_properties *icons, + int idx, const char *name, const char *lb_txt) +{ /* Creates a box with icon and label, later placed in a table */ + Evas_Object *lb, *bx = elm_box_add(win); + char buf[1024]; + + elm_box_padding_set(bx, BX_PADDING_X, BX_PADDING_Y); + icons[idx].icon = elm_icon_add(win); + icons[idx].name = name; + snprintf(buf, sizeof(buf), "%s/images/g_layer/%s_1.png", + elm_app_data_dir_get(), icons[idx].name); + elm_icon_file_set(icons[idx].icon, buf, NULL); + elm_icon_resizable_set(icons[idx].icon, 0, 0); + evas_object_size_hint_align_set(icons[idx].icon, 0.5, 0.5); + _icon_color_set(&icons[idx], INI_R, INI_G, INI_B, INI_A); + elm_box_pack_end(bx, icons[idx].icon); + evas_object_show(icons[idx].icon); + + lb = elm_label_add(win); + elm_object_text_set(lb, lb_txt); + evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(lb, 0.5, 0.5); + elm_box_pack_end(bx, lb); + evas_object_show(lb); + evas_object_show(bx); + + return bx; +} + +void +test_gesture_layer2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *win, *tb, *lb, *bx; + Evas_Object *r; /* Gesture layer transparent object */ + Evas_Object *g; /* The Gesture Layer object */ + + infra_data *infra = _infra_data_alloc(); + + win = elm_win_util_standard_add("table", "Table"); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_smart_callback_add(win, "delete,request", my_win_del, infra); + + /* START - Building icons table */ + bx = elm_box_add(win); + tb = elm_table_add(win); + elm_box_pack_end(bx, tb); + elm_win_resize_object_add(win, bx); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(tb, 0.5, 0.5); + evas_object_show(tb); + evas_object_show(bx); + + /* Box of Tap icon and label */ + bx = create_gesture_box(win, infra->icons, 0, TAP_NAME, "Tap"); + elm_table_pack(tb, bx, 0, 0, 1, 1); + + /* Box of Double Tap icon and label */ + bx = create_gesture_box(win, infra->icons, 1, DOUBLE_TAP_NAME, "Double Tap"); + elm_table_pack(tb, bx, 1, 0, 1, 1); + + /* Box of Triple Tap icon and label */ + bx = create_gesture_box(win, infra->icons, 2, TRIPLE_TAP_NAME, "Triple Tap"); + elm_table_pack(tb, bx, 2, 0, 1, 1); + + /* Box of Long Tap icon and label */ + bx = create_gesture_box(win, infra->icons, 3, LONG_TAP_NAME, "Long Tap"); + elm_table_pack(tb, bx, 3, 0, 1, 1); + + /* Box of Momentum icon and label */ + bx = create_gesture_box(win, infra->icons, 4, MOMENTUM_NAME, "Momentum"); + elm_table_pack(tb, bx, 0, 2, 1, 1); + + /* Box of Line icon and label */ + bx = create_gesture_box(win, infra->icons, 5, LINE_NAME, "Line"); + elm_table_pack(tb, bx, 1, 2, 1, 1); + + /* Box of Flick icon and label */ + bx = create_gesture_box(win, infra->icons, 6, FLICK_NAME, "Flick"); + elm_table_pack(tb, bx, 2, 2, 1, 1); + + /* Box of Zoom icon and label */ + bx = create_gesture_box(win, infra->icons, 7, ZOOM_NAME, "Zoom"); + elm_table_pack(tb, bx, 0, 3, 1, 1); + + /* Box of Rotate icon and label */ + bx = create_gesture_box(win, infra->icons, 8, ROTATE_NAME, "Rotate"); + elm_table_pack(tb, bx, 1, 3, 1, 1); + + + /* Legend of gestures - states */ + lb = elm_label_add(win); + elm_object_text_set(lb, "Gesture States"); + evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, lb, 0, 6, 4, 2); + evas_object_show(lb); + + r = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_resize(r, 64, 64); + evas_object_color_set(r, INI_R, INI_G, INI_B, INI_A); + evas_object_size_hint_weight_set(r, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(r, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, r, 0, 7, 1, 1); + evas_object_show(r); + + lb = elm_label_add(win); + elm_object_text_set(lb, "Not Started"); + evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, lb, 1, 7, 3, 1); + evas_object_show(lb); + + r = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_resize(r, 64, 64); + evas_object_color_set(r, START_COLOR); + evas_object_size_hint_weight_set(r, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(r, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, r, 0, 8, 1, 1); + evas_object_show(r); + + lb = elm_label_add(win); + elm_object_text_set(lb, "Gesture START"); + evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, lb, 1, 8, 3, 1); + evas_object_show(lb); + + r = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_resize(r, 64, 64); + evas_object_color_set(r, MOVE_COLOR); + evas_object_size_hint_weight_set(r, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(r, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, r, 0, 9, 1, 1); + evas_object_show(r); + + lb = elm_label_add(win); + elm_object_text_set(lb, "Gesture MOVE"); + evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, lb, 1, 9, 3, 1); + evas_object_show(lb); + + r = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_resize(r, 64, 64); + evas_object_color_set(r, END_COLOR); + evas_object_size_hint_weight_set(r, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(r, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, r, 0, 10, 1, 1); + evas_object_show(r); + + lb = elm_label_add(win); + elm_object_text_set(lb, "Gesture END"); + evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, lb, 1, 10, 3, 1); + evas_object_show(lb); + + r = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_resize(r, 64, 64); + evas_object_color_set(r, ABORT_COLOR); + evas_object_size_hint_weight_set(r, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(r, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, r, 0, 11, 1, 1); + evas_object_show(r); + + lb = elm_label_add(win); + elm_object_text_set(lb, "Gesture ABORT"); + evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, lb, 1, 11, 3, 1); + + + elm_table_padding_set(tb, TB_PADDING_X, TB_PADDING_Y); + evas_object_show(lb); + /* END - Building icons table */ + + /* Gesture layer transparent object */ + r = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(r, 0, 0, 0, 0); + elm_win_resize_object_add(win, r); + g = elm_gesture_layer_add(r); + elm_gesture_layer_attach(g, r); + evas_object_show(r); + + /* START - Setting gestures callbacks */ +#if 1 + elm_gesture_layer_cb_set(g, ELM_GESTURE_N_TRIPLE_TAPS, + ELM_GESTURE_STATE_START, triple_click_start, infra); + elm_gesture_layer_cb_set(g, ELM_GESTURE_N_TRIPLE_TAPS, + ELM_GESTURE_STATE_END, triple_click_end, infra); + elm_gesture_layer_cb_set(g, ELM_GESTURE_N_TRIPLE_TAPS, + ELM_GESTURE_STATE_ABORT, triple_click_abort, infra); +#endif + +#if 1 + elm_gesture_layer_cb_set(g, ELM_GESTURE_N_DOUBLE_TAPS, + ELM_GESTURE_STATE_START, dbl_click_start, infra); + elm_gesture_layer_cb_set(g, ELM_GESTURE_N_DOUBLE_TAPS, + ELM_GESTURE_STATE_END, dbl_click_end, infra); + elm_gesture_layer_cb_set(g, ELM_GESTURE_N_DOUBLE_TAPS, + ELM_GESTURE_STATE_ABORT, dbl_click_abort, infra); +#endif + +#if 1 + elm_gesture_layer_cb_set(g, ELM_GESTURE_N_TAPS, + ELM_GESTURE_STATE_START, n_finger_tap_start, infra); + elm_gesture_layer_cb_set(g, ELM_GESTURE_N_TAPS, + ELM_GESTURE_STATE_END, n_finger_tap_end, infra); + elm_gesture_layer_cb_set(g, ELM_GESTURE_N_TAPS, + ELM_GESTURE_STATE_ABORT, n_finger_tap_abort, infra); +#endif + +#if 1 + elm_gesture_layer_cb_set(g, ELM_GESTURE_N_LONG_TAPS, + ELM_GESTURE_STATE_START, n_long_tap_start, infra); + elm_gesture_layer_cb_set(g, ELM_GESTURE_N_LONG_TAPS, + ELM_GESTURE_STATE_MOVE, n_long_tap_move, infra); + elm_gesture_layer_cb_set(g, ELM_GESTURE_N_LONG_TAPS, + ELM_GESTURE_STATE_END, n_long_tap_end, infra); + elm_gesture_layer_cb_set(g, ELM_GESTURE_N_LONG_TAPS, + ELM_GESTURE_STATE_ABORT, n_long_tap_abort, infra); +#endif + +#if 1 + elm_gesture_layer_cb_set(g, ELM_GESTURE_MOMENTUM, + ELM_GESTURE_STATE_START, momentum_start, infra); + elm_gesture_layer_cb_set(g, ELM_GESTURE_MOMENTUM, + ELM_GESTURE_STATE_END, momentum_end, infra); + elm_gesture_layer_cb_set(g, ELM_GESTURE_MOMENTUM, + ELM_GESTURE_STATE_ABORT, momentum_abort, infra); + elm_gesture_layer_cb_set(g, ELM_GESTURE_MOMENTUM, + ELM_GESTURE_STATE_MOVE, momentum_move, infra); +#endif + +#if 1 + elm_gesture_layer_cb_set(g, ELM_GESTURE_N_LINES, + ELM_GESTURE_STATE_START, line_start, infra); + elm_gesture_layer_cb_set(g, ELM_GESTURE_N_LINES, + ELM_GESTURE_STATE_MOVE, line_move, infra); + elm_gesture_layer_cb_set(g, ELM_GESTURE_N_LINES, + ELM_GESTURE_STATE_END, line_end, infra); + elm_gesture_layer_cb_set(g, ELM_GESTURE_N_LINES, + ELM_GESTURE_STATE_ABORT, line_abort, infra); +#endif + +#if 1 + elm_gesture_layer_cb_set(g, ELM_GESTURE_N_FLICKS, + ELM_GESTURE_STATE_START, flick_start, infra); + elm_gesture_layer_cb_set(g, ELM_GESTURE_N_FLICKS, + ELM_GESTURE_STATE_END, flick_end, infra); + elm_gesture_layer_cb_set(g, ELM_GESTURE_N_FLICKS, + ELM_GESTURE_STATE_ABORT, flick_abort, infra); +#endif + +#if 1 + elm_gesture_layer_cb_set(g, ELM_GESTURE_ZOOM, + ELM_GESTURE_STATE_START, zoom_start, infra); + elm_gesture_layer_cb_set(g, ELM_GESTURE_ZOOM, + ELM_GESTURE_STATE_END, zoom_end, infra); + elm_gesture_layer_cb_set(g, ELM_GESTURE_ZOOM, + ELM_GESTURE_STATE_ABORT, zoom_abort, infra); + elm_gesture_layer_cb_set(g, ELM_GESTURE_ZOOM, + ELM_GESTURE_STATE_MOVE, zoom_move, infra); + /* elm_gesture_layer_zoom_step_set(g, 0.2); */ +#endif + +#if 1 + elm_gesture_layer_cb_set(g, ELM_GESTURE_ROTATE, + ELM_GESTURE_STATE_START, rotate_start, infra); + elm_gesture_layer_cb_set(g, ELM_GESTURE_ROTATE, + ELM_GESTURE_STATE_END, rotate_end, infra); + elm_gesture_layer_cb_set(g, ELM_GESTURE_ROTATE, + ELM_GESTURE_STATE_ABORT, rotate_abort, infra); + elm_gesture_layer_cb_set(g, ELM_GESTURE_ROTATE, + ELM_GESTURE_STATE_MOVE, rotate_move, infra); + /* elm_gesture_layer_rotate_step_set(g, 5.2); */ +#endif + /* END - Setting gestures callbacks */ + + /* Update color state 20 times a second */ + infra->colortimer = ecore_timer_add(0.05, _icon_color_set_cb, infra->icons); + + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_gesture_layer3.c b/libraries/elementary/src/bin/test_gesture_layer3.c new file mode 100644 index 0000000..780032e --- /dev/null +++ b/libraries/elementary/src/bin/test_gesture_layer3.c @@ -0,0 +1,589 @@ +#ifdef HAVE_CONFIG_H +#include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +/* We zoom out to this value so we'll be able to use map and have a nice + * resolution when zooming in. */ +#define BASE_ZOOM 0.8 +#define MIN_ZOOM 0.4 +/* The amount of zoom to do when "lifting" objects. */ +#define LIFT_FACTOR 1.3 +/* The base size of the shadow image. */ +#define SHADOW_W 118 +#define SHADOW_H 118 +//#define RAD2DEG(x) ((x) * 57.295779513) + +#define MOMENTUM_FACTOR 30 +#define MOMENTUM_FRICTION 1000 +#define ROTATE_MOMENTUM_FRICTION 30 +#define ZOOM_MOMENTUM_FRICTION 8 +#define TIMER_TICK 0.1 + +struct _Photo_Object { + Evas_Object *ic, *shadow; + Evas_Object *hit; + Evas_Object *gl; + + /* 3 transit object to implement momentum animation */ + Elm_Transit *zoom_momentum; + Ecore_Timer *rot_timer; + Ecore_Timer *mom_timer; + double rot_tot_time; + double rot_progress; + /* bx, by - current wanted coordinates of the photo object. + * bw, bh - original size of the "ic" object. + * dx, dy - Used to indicate the distance between the center point + * m_dx, m_dy - momentum delta to apply with momentum transit + * where we put down our fingers (when started moving the item) to + * the coords of the object, so we'll be able to calculate movement + * correctly. */ + Evas_Coord bx, by, bw, bh, dx, dy, m_dx, m_dy; + /* Because gesture layer only knows the amount of rotation/zoom we do + * per gesture, we have to keep the current rotate/zoom factor and the + * one that was before we started the gesture. */ + int base_rotate, rotate; /* base - initial angle */ + double mx, my; /* momentum on x, y */ + double mom_x_acc, mom_y_acc; + double rot_momentum, zoom_mom; + double mom_tot_time; + double zoom_mom_time; + double base_zoom, zoom; + double shadow_zoom; +}; +typedef struct _Photo_Object Photo_Object; + + +/* This function applies the information from the Photo_Object to the actual + * evas objects. Zoom/rotate factors and etc. */ +static void +apply_changes(Photo_Object *po) +{ + Evas_Map *map; + + map = evas_map_new(4); + evas_map_point_coord_set(map, 0, po->bx, po->by, 0); + evas_map_point_coord_set(map, 1, po->bx + po->bw, po->by, 0); + evas_map_point_coord_set(map, 2, po->bx + po->bw, po->by + po->bh, 0); + evas_map_point_coord_set(map, 3, po->bx, po->by + po->bh, 0); + evas_map_point_image_uv_set(map, 0, 0, 0); + evas_map_point_image_uv_set(map, 1, po->bw, 0); + evas_map_point_image_uv_set(map, 2, po->bw, po->bh); + evas_map_point_image_uv_set(map, 3, 0, po->bh); + evas_map_util_rotate(map, po->rotate, + po->bx + po->bw / 2, po->by + po->bh /2); + evas_map_util_zoom(map, po->zoom, po->zoom, + po->bx + po->bw / 2, po->by + po->bh /2); + evas_object_map_enable_set(po->ic, EINA_TRUE); + evas_object_map_set(po->ic, map); + + { + Evas_Map *shadow_map = evas_map_new(4); + evas_map_point_coord_set(shadow_map, 0, po->bx, po->by, 0); + evas_map_point_coord_set(shadow_map, 1, po->bx + po->bw, po->by, 0); + evas_map_point_coord_set(shadow_map, 2, + po->bx + po->bw, po->by + po->bh, 0); + evas_map_point_coord_set(shadow_map, 3, po->bx, po->by + po->bh, 0); + evas_map_point_image_uv_set(shadow_map, 0, 0, 0); + evas_map_point_image_uv_set(shadow_map, 1, SHADOW_W, 0); + evas_map_point_image_uv_set(shadow_map, 2, SHADOW_W, SHADOW_H); + evas_map_point_image_uv_set(shadow_map, 3, 0, SHADOW_H); + evas_map_util_rotate(shadow_map, po->rotate, + po->bx + po->bw / 2, po->by + po->bh /2); + evas_map_util_zoom(shadow_map, po->zoom * po->shadow_zoom, + po->zoom * po->shadow_zoom, + po->bx + (po->bw / 2), po->by + (po->bh / 2)); + evas_object_map_enable_set(po->shadow, EINA_TRUE); + evas_object_map_set(po->shadow, shadow_map); + evas_map_free(shadow_map); + } + + /* Update the position of the hit box */ + { + Evas_Coord minx, miny, maxx, maxy; + int i; + evas_object_polygon_points_clear(po->hit); + evas_map_point_coord_get(map, 0, &minx, &miny, NULL); + maxx = minx; + maxy = miny; + evas_object_polygon_point_add(po->hit, minx, miny); + for (i = 1 ; i <= 3 ; i++) + { + Evas_Coord x, y; + evas_map_point_coord_get(map, i, &x, &y, NULL); + evas_object_polygon_point_add(po->hit, x, y); + if (x < minx) + minx = x; + else if (x > maxx) + maxx = x; + + if (y < miny) + miny = y; + else if (y > maxy) + maxy = y; + } + } + + evas_object_raise(po->shadow); + evas_object_raise(po->ic); + evas_object_raise(po->hit); + evas_map_free(map); +} + +/* Zoom momentum animation */ +static void +zoom_momentum_animation_operation(void *_po, Elm_Transit *transit __UNUSED__, + double progress) +{ + Photo_Object *po = (Photo_Object *) _po; + double time_prog = po->zoom_mom_time * progress; + double zoom_fric = ZOOM_MOMENTUM_FRICTION; + + if (po->zoom_mom > 0) + zoom_fric *= -1; + + /* Current = rot0 + (rotv0 * t) + (a * t^2 / 2) */ + po->zoom = po->base_zoom + + ((po->zoom_mom * time_prog) + + (zoom_fric * (time_prog * time_prog) / 2)); + printf("%f = %f + (%f + %f)\n", po->zoom, po->base_zoom, + (po->zoom_mom * time_prog), + (zoom_fric * (time_prog * time_prog) / 2)); + + if (po->zoom < MIN_ZOOM) + po->zoom = MIN_ZOOM; + + apply_changes(po); +} + +static void +zoom_momentum_animation_end(void *_po, Elm_Transit *transit __UNUSED__) +{ + Photo_Object *po = (Photo_Object *) _po; + po->base_zoom = po->zoom; + po->zoom_momentum = NULL; +} + +/* Rotate momentum animation */ +static Eina_Bool +rotate_momentum_animation_operation(void *_po) +{ + Eina_Bool rc = ECORE_CALLBACK_RENEW; + int deg_friction = ROTATE_MOMENTUM_FRICTION; + Photo_Object *po = (Photo_Object *) _po; + po->rot_progress += TIMER_TICK; + if (po->rot_progress > po->rot_tot_time) + { + po->rot_timer = NULL; + po->rot_progress = po->rot_tot_time; + rc = ECORE_CALLBACK_CANCEL; + } + + if (po->rot_momentum > 0) + deg_friction *= -1; + + /* Current = rot0 + (rotv0 * t) + (a * t^2 / 2) */ + po->rotate = po->base_rotate - + ((po->rot_momentum * po->rot_progress) + + (deg_friction * (po->rot_progress * po->rot_progress) / 2)); + po->rotate = (po->rotate % 360); + if (po->rotate < 0) + po->rotate += 360; + printf("%d = %d - (%f + %f)\n", po->rotate, po->base_rotate, + (po->rot_momentum * po->rot_progress), + (deg_friction * (po->rot_progress * po->rot_progress) / 2)); + + if (rc == ECORE_CALLBACK_CANCEL) + { + po->base_rotate = po->rotate; + printf("%s po->rotate=<%d>\n", __func__, po->rotate); + } + + apply_changes(po); + return rc; +} + +static void +pic_obj_keep_inframe(void *_po) +{ /* Make sure middle is in the screen, if not, fix it. */ + /* FIXME: Use actual window sizes instead of the hardcoded + * values */ + Photo_Object *po = (Photo_Object *) _po; + + Evas_Coord mx, my; + mx = po->bx + (po->bw / 2); + my = po->by + (po->bh / 2); + if (mx < 0) + po->bx = 0 - (po->bw / 2); + else if (mx > 480) + po->bx = 480 - (po->bw / 2); + + if (my < 0) + po->by = 0 - (po->bw / 2); + else if (my > 800) + po->by = 800 - (po->bh / 2); +} + +static Evas_Event_Flags +rotate_start(void *_po, void *event_info) +{ + Photo_Object *po = (Photo_Object *) _po; + Elm_Gesture_Rotate_Info *p = (Elm_Gesture_Rotate_Info *) event_info; + printf("rotate start <%d,%d> po->rotate=<%d> base=<%f> p->angle=<%f>\n", p->x, p->y, po->rotate, + p->base_angle, p->angle); + + /* If there's an active animator, stop it */ + if (po->rot_timer) + { + po->base_rotate = po->rotate; + ecore_timer_del(po->rot_timer); + po->rot_timer = NULL; + } + + return EVAS_EVENT_FLAG_NONE; +} + +static Evas_Event_Flags +rotate_move(void *_po, void *event_info) +{ + Photo_Object *po = (Photo_Object *) _po; + Elm_Gesture_Rotate_Info *p = (Elm_Gesture_Rotate_Info *) event_info; + printf("rotate move <%d,%d> base=<%f> <%f> m=<%f>\n", p->x, p->y, + p->base_angle, p->angle, p->momentum); + po->rotate = po->base_rotate + (int) (p->angle - p->base_angle); + + if (po->rotate < 0) + po->rotate += 360; + apply_changes(po); + return EVAS_EVENT_FLAG_NONE; +} + +static Evas_Event_Flags +rotate_end(void *_po, void *event_info) +{ + Photo_Object *po = (Photo_Object *) _po; + Elm_Gesture_Rotate_Info *r_info = (Elm_Gesture_Rotate_Info *) event_info; + printf("rotate end <%d,%d> base=<%f> <%f> m=<%f>\n", r_info->x, r_info->y, + r_info->base_angle, r_info->angle, r_info->momentum); + if (po->rotate < 0) + po->rotate += 360; + + po->base_rotate = po->rotate; + + /* Apply the rotate-momentum */ + po->rot_tot_time = fabs(r_info->momentum) / ROTATE_MOMENTUM_FRICTION; + po->rot_momentum = r_info->momentum; + po->rot_progress = 0.0; + if (po->rot_momentum) + { + po->rot_timer = ecore_timer_add(TIMER_TICK, rotate_momentum_animation_operation, po); + } + return EVAS_EVENT_FLAG_NONE; +} + +static Evas_Event_Flags +rotate_abort(void *_po, void *event_info) +{ + Photo_Object *po = (Photo_Object *) _po; + Elm_Gesture_Rotate_Info *p = (Elm_Gesture_Rotate_Info *) event_info; + printf("rotate abort <%d,%d> base=<%f> <%f>\n", p->x, p->y, + p->base_angle, p->angle); + po->base_rotate = po->rotate; + if (po->rotate < 0) + po->rotate += 360; + + return EVAS_EVENT_FLAG_NONE; +} + +static Evas_Event_Flags +zoom_start(void *_po, void *event_info) +{ + Photo_Object *po = (Photo_Object *) _po; + Elm_Gesture_Zoom_Info *p = (Elm_Gesture_Zoom_Info *) event_info; + printf("zoom start <%d,%d> <%f>\n", p->x, p->y, p->zoom); + + /* If there's an active animator, stop it */ + if (po->zoom_momentum) + { + elm_transit_del(po->zoom_momentum); + po->zoom_momentum = NULL; + } + + return EVAS_EVENT_FLAG_NONE; +} + +static Evas_Event_Flags +zoom_move(void *_po, void *event_info) +{ + Photo_Object *po = (Photo_Object *) _po; + Elm_Gesture_Zoom_Info *p = (Elm_Gesture_Zoom_Info *) event_info; + printf("zoom move <%d,%d> <%f> momentum=<%f>\n", p->x, p->y, p->zoom, p->momentum); + po->zoom = po->base_zoom * p->zoom; + apply_changes(po); + return EVAS_EVENT_FLAG_NONE; +} + +static Evas_Event_Flags +zoom_end(void *_po, void *event_info) +{ + Photo_Object *po = (Photo_Object *) _po; + Elm_Gesture_Zoom_Info *p = (Elm_Gesture_Zoom_Info *) event_info; + printf("zoom end/abort <%d,%d> <%f> momentum=<%f>\n", p->x, p->y, + p->zoom, p->momentum); + + /* Apply the zoom-momentum or zoom out animator */ + double tot_time = fabs(p->momentum) / ZOOM_MOMENTUM_FRICTION; + po->zoom_mom_time = tot_time; + po->zoom_mom = p->momentum; + po->base_zoom = po->zoom; + if (po->zoom_mom) + { + po->zoom_momentum = elm_transit_add(); + elm_transit_duration_set(po->zoom_momentum, + tot_time); + elm_transit_effect_add(po->zoom_momentum, + zoom_momentum_animation_operation, po, + zoom_momentum_animation_end); + elm_transit_go(po->zoom_momentum); + } + + return EVAS_EVENT_FLAG_NONE; +} + +static Evas_Event_Flags +momentum_start(void *_po, void *event_info) +{ + Photo_Object *po = (Photo_Object *) _po; + Elm_Gesture_Momentum_Info *p = (Elm_Gesture_Momentum_Info *) event_info; + printf("momentum_start po->rotate=<%d> <%d,%d>\n", po->rotate, p->x2, p->y2); + + /* If there's an active animator, stop it */ + if (po->mom_timer) + { + ecore_timer_del(po->mom_timer); + po->mom_timer = NULL; + } + + po->dx = p->x2 - po->bx; + po->dy = p->y2 - po->by; + apply_changes(po); + + return EVAS_EVENT_FLAG_NONE; +} + +static Evas_Event_Flags +momentum_move(void *_po, void *event_info) +{ + Photo_Object *po = (Photo_Object *) _po; + Elm_Gesture_Momentum_Info *p = (Elm_Gesture_Momentum_Info *) event_info; + printf("momentum move <%d,%d> fingers=<%d> mx,my=<%d,%d>\n", p->x2, p->y2, p->n, p->mx, p->my); + + po->bx = p->x2 - po->dx; + po->by = p->y2 - po->dy; + apply_changes(po); + + return EVAS_EVENT_FLAG_NONE; +} + +/* Momentum animation */ +static Eina_Bool +momentum_animation_operation(void *_po) +{ + Photo_Object *po = (Photo_Object *) _po; + Eina_Bool rc = ECORE_CALLBACK_RENEW; + Evas_Coord x = po->bx; + Evas_Coord y = po->by; + po->mom_tot_time -= TIMER_TICK; + if (po->mom_tot_time <= 0) + { + po->mom_timer = NULL; + rc = ECORE_CALLBACK_CANCEL; + } + + /* x = v0t + 0.5at^2 */ + po->bx += ((po->mx * po->mom_tot_time) + + (0.5 * po->mom_x_acc * (po->mom_tot_time * po->mom_tot_time))); + + po->by += ((po->my * po->mom_tot_time) + + (0.5 * po->mom_y_acc * (po->mom_tot_time * po->mom_tot_time))); + + printf("%s prev_bx-new_bx,y=(%d,%d)\n", __func__, x-po->bx, y-po->by); + if (rc == ECORE_CALLBACK_CANCEL) + pic_obj_keep_inframe(po); + + apply_changes(po); + return rc; +} + +static Evas_Event_Flags +momentum_end(void *_po, void *event_info) +{ + Photo_Object *po = (Photo_Object *) _po; + Elm_Gesture_Momentum_Info *p = (Elm_Gesture_Momentum_Info *) event_info; + printf("momentum end x2,y2=<%d,%d> mx,my=<%d,%d>\n", p->x2, p->y2, p->mx, p->my); + pic_obj_keep_inframe(po); + apply_changes(po); + /* Make up some total-time for the movement */ + po->mom_tot_time = sqrt((p->mx * p->mx) + (p->my * p->my)) + / MOMENTUM_FRICTION; + + if (po->mom_tot_time) + { /* Compute acceleration for both compenents, and launch timer */ + po->mom_x_acc = (p->mx) / po->mom_tot_time; /* a = (v-v0) / t */ + po->mom_y_acc = (p->my) / po->mom_tot_time; /* a = (v-v0) / t */ + po->mom_x_acc /= MOMENTUM_FACTOR; + po->mom_y_acc /= MOMENTUM_FACTOR; + po->mom_timer = ecore_timer_add(TIMER_TICK, momentum_animation_operation, po); + } + + return EVAS_EVENT_FLAG_NONE; +} + +static Evas_Event_Flags +momentum_abort(void *_po, void *event_info) +{ + Photo_Object *po = (Photo_Object *) _po; + Elm_Gesture_Momentum_Info *p = (Elm_Gesture_Momentum_Info *) event_info; + printf("momentum abort <%d,%d> <%d,%d>\n", p->x2, p->y2, p->mx, p->my); + pic_obj_keep_inframe(po); + apply_changes(po); + + return EVAS_EVENT_FLAG_NONE; +} + +static void +_win_del_req(void *data, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Photo_Object **photo_array = (Photo_Object **) data; + + if (!photo_array) + return; + + /* The content of the photo object is automatically deleted when the win + * is deleted. */ + for ( ; *photo_array ; photo_array++) + free(*photo_array); + + free(data); +} + + +static Photo_Object * +photo_object_add(Evas_Object *parent, Evas_Object *ic, const char *icon, + Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, int angle) +{ + char buf[PATH_MAX]; + Photo_Object *po; + po = calloc(1, sizeof(*po)); + po->base_zoom = po->zoom = BASE_ZOOM; + + if (ic) + { + po->ic = ic; + } + else + { + po->ic = elm_icon_add(parent); + elm_icon_file_set(po->ic, icon, NULL); + } + + po->bx = x; + po->by = y; + po->bw = w; + po->bh = h; + + /* Add shadow */ + { + po->shadow = elm_icon_add(po->ic); + snprintf(buf, sizeof(buf), "%s/images/pol_shadow.png", elm_app_data_dir_get()); + elm_icon_file_set(po->shadow, buf, NULL); + evas_object_resize(po->shadow, SHADOW_W, SHADOW_H); + evas_object_show(po->shadow); + } + + po->hit = evas_object_polygon_add(evas_object_evas_get(parent)); + evas_object_precise_is_inside_set(po->hit, EINA_TRUE); + evas_object_repeat_events_set(po->hit, EINA_TRUE); + evas_object_color_set(po->hit, 0, 0, 0, 0); + + evas_object_resize(po->ic, po->bw, po->bh); + evas_object_show(po->ic); + + evas_object_show(po->hit); + + po->gl = elm_gesture_layer_add(po->ic); + elm_gesture_layer_hold_events_set(po->gl, EINA_TRUE); + elm_gesture_layer_attach(po->gl, po->hit); + + /* FIXME: Add a po->rotate start so we take the first angle!!!! */ + elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_MOMENTUM, + ELM_GESTURE_STATE_START, momentum_start, po); + elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_MOMENTUM, + ELM_GESTURE_STATE_MOVE, momentum_move, po); + elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_MOMENTUM, + ELM_GESTURE_STATE_END, momentum_end, po); + elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_MOMENTUM, + ELM_GESTURE_STATE_ABORT, momentum_abort, po); + + elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_ZOOM, + ELM_GESTURE_STATE_START, zoom_start, po); + elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_ZOOM, + ELM_GESTURE_STATE_MOVE, zoom_move, po); + elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_ZOOM, + ELM_GESTURE_STATE_END, zoom_end, po); + elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_ZOOM, + ELM_GESTURE_STATE_ABORT, zoom_end, po); + + elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_ROTATE, + ELM_GESTURE_STATE_START, rotate_start, po); + elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_ROTATE, + ELM_GESTURE_STATE_MOVE, rotate_move, po); + elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_ROTATE, + ELM_GESTURE_STATE_END, rotate_end, po); + elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_ROTATE, + ELM_GESTURE_STATE_ABORT, rotate_abort, po); + + po->rotate = po->base_rotate = angle; + po->shadow_zoom = 1.3; + + apply_changes(po); + return po; +} + +void +test_gesture_layer3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Coord w, h; + Evas_Object *win, *bg; + char buf[PATH_MAX]; + int ind = 0; + Photo_Object **photo_array; + photo_array = calloc(sizeof(*photo_array), 4); + + w = 480; + h = 800; + + win = elm_win_add(NULL, "gesture-layer", ELM_WIN_BASIC); + elm_win_title_set(win, "Gesture Layer"); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_resize(win, w, h); + + bg = elm_bg_add(win); + snprintf(buf, sizeof(buf), "%s/images/wood_01.jpg", elm_app_data_dir_get()); + elm_bg_file_set(bg, buf, NULL); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + snprintf(buf, sizeof(buf), "%s/images/pol_sky.png", elm_app_data_dir_get()); + photo_array[ind++] = photo_object_add(win, NULL, buf, 50, 200, 365, 400, 0); + + photo_array[ind] = NULL; + evas_object_smart_callback_add(win, "delete,request", _win_del_req, + photo_array); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_glview.c b/libraries/elementary/src/bin/test_glview.c new file mode 100644 index 0000000..f8f2767 --- /dev/null +++ b/libraries/elementary/src/bin/test_glview.c @@ -0,0 +1,623 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +#include +#ifndef M_PI +#define M_PI 3.14159265 +#endif + +typedef struct _Gear Gear; +typedef struct _GLData GLData; +struct _Gear +{ + GLfloat *vertices; + GLuint vbo; + int count; +}; + +// GL related data here.. +struct _GLData +{ + Evas_GL_API *glapi; + GLuint program; + GLuint vtx_shader; + GLuint fgmt_shader; + int initialized : 1; + int mouse_down : 1; + + // Gear Stuff + GLfloat view_rotx; + GLfloat view_roty; + GLfloat view_rotz; + + Gear *gear1; + Gear *gear2; + Gear *gear3; + + GLfloat angle; + + GLuint proj_location; + GLuint light_location; + GLuint color_location; + + GLfloat proj[16]; + GLfloat light[3]; +}; + +static void gears_init(GLData *gld); +static void free_gear(Gear *gear); +static void gears_reshape(GLData *gld, int width, int height); +static void render_gears(GLData *gld); + +//--------------------------------// +// Gear Stuff.... +static GLfloat * +vert(GLfloat *p, GLfloat x, GLfloat y, GLfloat z, GLfloat *n) +{ + p[0] = x; + p[1] = y; + p[2] = z; + p[3] = n[0]; + p[4] = n[1]; + p[5] = n[2]; + + return p + 6; +} + +/* Draw a gear wheel. You'll probably want to call this function when + * building a display list since we do a lot of trig here. + * + * Input: inner_radius - radius of hole at center + * outer_radius - radius at center of teeth + * width - width of gear + * teeth - number of teeth + * tooth_depth - depth of tooth + */ +static Gear * +make_gear(GLData *gld, GLfloat inner_radius, GLfloat outer_radius, GLfloat width, + GLint teeth, GLfloat tooth_depth) +{ + GLint i; + GLfloat r0, r1, r2; + GLfloat da; + GLfloat *v; + Gear *gear; + double s[5], c[5]; + GLfloat normal[3]; + const int tris_per_tooth = 20; + Evas_GL_API *gl = gld->glapi; + + gear = (Gear*)malloc(sizeof(Gear)); + if (gear == NULL) + return NULL; + + r0 = inner_radius; + r1 = outer_radius - tooth_depth / 2.0; + r2 = outer_radius + tooth_depth / 2.0; + + da = 2.0 * M_PI / teeth / 4.0; + + gear->vertices = calloc(teeth * tris_per_tooth * 3 * 6, + sizeof *gear->vertices); + s[4] = 0; + c[4] = 1; + v = gear->vertices; + for (i = 0; i < teeth; i++) + { + s[0] = s[4]; + c[0] = c[4]; + s[1] = sin(i * 2.0 * M_PI / teeth + da); + c[1] = cos(i * 2.0 * M_PI / teeth + da); + s[2] = sin(i * 2.0 * M_PI / teeth + da * 2); + c[2] = cos(i * 2.0 * M_PI / teeth + da * 2); + s[3] = sin(i * 2.0 * M_PI / teeth + da * 3); + c[3] = cos(i * 2.0 * M_PI / teeth + da * 3); + s[4] = sin(i * 2.0 * M_PI / teeth + da * 4); + c[4] = cos(i * 2.0 * M_PI / teeth + da * 4); + + normal[0] = 0.0; + normal[1] = 0.0; + normal[2] = 1.0; + + v = vert(v, r2 * c[1], r2 * s[1], width * 0.5, normal); + + v = vert(v, r2 * c[1], r2 * s[1], width * 0.5, normal); + v = vert(v, r2 * c[2], r2 * s[2], width * 0.5, normal); + v = vert(v, r1 * c[0], r1 * s[0], width * 0.5, normal); + v = vert(v, r1 * c[3], r1 * s[3], width * 0.5, normal); + v = vert(v, r0 * c[0], r0 * s[0], width * 0.5, normal); + v = vert(v, r1 * c[4], r1 * s[4], width * 0.5, normal); + v = vert(v, r0 * c[4], r0 * s[4], width * 0.5, normal); + + v = vert(v, r0 * c[4], r0 * s[4], width * 0.5, normal); + v = vert(v, r0 * c[0], r0 * s[0], width * 0.5, normal); + v = vert(v, r0 * c[4], r0 * s[4], -width * 0.5, normal); + v = vert(v, r0 * c[0], r0 * s[0], -width * 0.5, normal); + + normal[0] = 0.0; + normal[1] = 0.0; + normal[2] = -1.0; + + v = vert(v, r0 * c[4], r0 * s[4], -width * 0.5, normal); + + v = vert(v, r0 * c[4], r0 * s[4], -width * 0.5, normal); + v = vert(v, r1 * c[4], r1 * s[4], -width * 0.5, normal); + v = vert(v, r0 * c[0], r0 * s[0], -width * 0.5, normal); + v = vert(v, r1 * c[3], r1 * s[3], -width * 0.5, normal); + v = vert(v, r1 * c[0], r1 * s[0], -width * 0.5, normal); + v = vert(v, r2 * c[2], r2 * s[2], -width * 0.5, normal); + v = vert(v, r2 * c[1], r2 * s[1], -width * 0.5, normal); + + v = vert(v, r1 * c[0], r1 * s[0], width * 0.5, normal); + + v = vert(v, r1 * c[0], r1 * s[0], width * 0.5, normal); + v = vert(v, r1 * c[0], r1 * s[0], -width * 0.5, normal); + v = vert(v, r2 * c[1], r2 * s[1], width * 0.5, normal); + v = vert(v, r2 * c[1], r2 * s[1], -width * 0.5, normal); + v = vert(v, r2 * c[2], r2 * s[2], width * 0.5, normal); + v = vert(v, r2 * c[2], r2 * s[2], -width * 0.5, normal); + v = vert(v, r1 * c[3], r1 * s[3], width * 0.5, normal); + v = vert(v, r1 * c[3], r1 * s[3], -width * 0.5, normal); + v = vert(v, r1 * c[4], r1 * s[4], width * 0.5, normal); + v = vert(v, r1 * c[4], r1 * s[4], -width * 0.5, normal); + + v = vert(v, r1 * c[4], r1 * s[4], -width * 0.5, normal); + } + + gear->count = (v - gear->vertices) / 6; + + gl->glGenBuffers(1, &gear->vbo); + gl->glBindBuffer(GL_ARRAY_BUFFER, gear->vbo); + gl->glBufferData(GL_ARRAY_BUFFER, gear->count * 6 * 4, + gear->vertices, GL_STATIC_DRAW); + + + return gear; +} + +static void +free_gear(Gear *gear) +{ + free(gear->vertices); + free(gear); + gear = NULL; +} + +static void +multiply(GLfloat *m, const GLfloat *n) +{ + GLfloat tmp[16]; + const GLfloat *row, *column; + div_t d; + int i, j; + + for (i = 0; i < 16; i++) + { + tmp[i] = 0; + d = div(i, 4); + row = n + d.quot * 4; + column = m + d.rem; + for (j = 0; j < 4; j++) + tmp[i] += row[j] * column[j * 4]; + } + memcpy(m, &tmp, sizeof tmp); +} + +static void +rotate(GLfloat *m, GLfloat angle, GLfloat x, GLfloat y, GLfloat z) +{ + double s, c; + + s = sin(angle); + c = cos(angle); + GLfloat r[16] = + { + x * x * (1 - c) + c, y * x * (1 - c) + z * s, x * z * (1 - c) - y * s, 0, + x * y * (1 - c) - z * s, y * y * (1 - c) + c, y * z * (1 - c) + x * s, 0, + x * z * (1 - c) + y * s, y * z * (1 - c) - x * s, z * z * (1 - c) + c, 0, + 0, 0, 0, 1 + }; + + multiply(m, r); +} + +static void +translate(GLfloat *m, GLfloat x, GLfloat y, GLfloat z) +{ + GLfloat t[16] = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, z, 1 }; + + multiply(m, t); +} + +static void +draw_gear(GLData *gld, Gear *gear, GLfloat *m, + GLfloat x, GLfloat y, GLfloat angle, const GLfloat *color) +{ + Evas_GL_API *gl = gld->glapi; + GLfloat tmp[16]; + + memcpy(tmp, m, sizeof tmp); + translate(tmp, x, y, 0); + rotate(tmp, 2 * M_PI * angle / 360.0, 0, 0, 1); + gl->glUniformMatrix4fv(gld->proj_location, 1, GL_FALSE, tmp); + gl->glUniform3fv(gld->light_location, 1, gld->light); + gl->glUniform4fv(gld->color_location, 1, color); + + gl->glBindBuffer(GL_ARRAY_BUFFER, gear->vbo); + + gl->glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, + 6 * sizeof(GLfloat), NULL); + gl->glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, + 6 * sizeof(GLfloat), (GLfloat *) 0 + 3); + gl->glEnableVertexAttribArray(0); + gl->glEnableVertexAttribArray(1); + gl->glDrawArrays(GL_TRIANGLE_STRIP, 0, gear->count); +} + +static void +gears_draw(GLData *gld) +{ + Evas_GL_API *gl = gld->glapi; + + static const GLfloat red[4] = { 0.8, 0.1, 0.0, 1.0 }; + static const GLfloat green[4] = { 0.0, 0.8, 0.2, 1.0 }; + static const GLfloat blue[4] = { 0.2, 0.2, 1.0, 1.0 }; + GLfloat m[16]; + + gl->glClearColor(0.8, 0.8, 0.1, 0.5); + gl->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + memcpy(m, gld->proj, sizeof m); + rotate(m, 2 * M_PI * gld->view_rotx / 360.0, 1, 0, 0); + rotate(m, 2 * M_PI * gld->view_roty / 360.0, 0, 1, 0); + rotate(m, 2 * M_PI * gld->view_rotz / 360.0, 0, 0, 1); + + draw_gear(gld, gld->gear1, m, -3.0, -2.0, gld->angle, red); + draw_gear(gld, gld->gear2, m, 3.1, -2.0, -2 * gld->angle - 9.0, green); + draw_gear(gld, gld->gear3, m, -3.1, 4.2, -2 * gld->angle - 25.0, blue); +} + +static void render_gears(GLData *gld) +{ + gears_draw(gld); + + gld->angle += 2.0; +} + +/* new window size or exposure */ +static void +gears_reshape(GLData *gld, int width, int height) +{ + Evas_GL_API *gl = gld->glapi; + + GLfloat ar, m[16] = { + 1.0, 0.0, 0.0, 0.0, + 0.0, 1.0, 0.0, 0.0, + 0.0, 0.0, 0.1, 0.0, + 0.0, 0.0, 0.0, 1.0 + }; + + if (width < height) + ar = width; + else + ar = height; + + m[0] = 0.1 * ar / width; + m[5] = 0.1 * ar / height; + memcpy(gld->proj, m, sizeof gld->proj); + gl->glViewport(0, 0, (GLint) width, (GLint) height); +} + +static const char vertex_shader[] = + "uniform mat4 proj;\n" + "attribute vec4 position;\n" + "attribute vec4 normal;\n" + "varying vec3 rotated_normal;\n" + "varying vec3 rotated_position;\n" + "vec4 tmp;\n" + "void main()\n" + "{\n" + " gl_Position = proj * position;\n" + " rotated_position = gl_Position.xyz;\n" + " tmp = proj * normal;\n" + " rotated_normal = tmp.xyz;\n" + "}\n"; + + static const char fragment_shader[] = + "#ifdef GL_ES\n" + "precision mediump float;\n" + "#endif\n" + "uniform vec4 color;\n" + "uniform vec3 light;\n" + "varying vec3 rotated_normal;\n" + "varying vec3 rotated_position;\n" + "vec3 light_direction;\n" + "vec4 white = vec4(0.5, 0.5, 0.5, 1.0);\n" + "void main()\n" + "{\n" + " light_direction = normalize(light - rotated_position);\n" + " gl_FragColor = color + white * dot(light_direction, rotated_normal);\n" + "}\n"; + +static void +gears_init(GLData *gld) +{ + Evas_GL_API *gl = gld->glapi; + + const char *p; + char msg[512]; + + gl->glEnable(GL_CULL_FACE); + gl->glEnable(GL_DEPTH_TEST); + + p = vertex_shader; + gld->vtx_shader = gl->glCreateShader(GL_VERTEX_SHADER); + gl->glShaderSource(gld->vtx_shader, 1, &p, NULL); + gl->glCompileShader(gld->vtx_shader); + gl->glGetShaderInfoLog(gld->vtx_shader, sizeof msg, NULL, msg); + printf("vertex shader info: %s\n", msg); + + p = fragment_shader; + gld->fgmt_shader = gl->glCreateShader(GL_FRAGMENT_SHADER); + gl->glShaderSource(gld->fgmt_shader, 1, &p, NULL); + gl->glCompileShader(gld->fgmt_shader); + gl->glGetShaderInfoLog(gld->fgmt_shader, sizeof msg, NULL, msg); + printf("fragment shader info: %s\n", msg); + + gld->program = gl->glCreateProgram(); + gl->glAttachShader(gld->program, gld->vtx_shader); + gl->glAttachShader(gld->program, gld->fgmt_shader); + gl->glBindAttribLocation(gld->program, 0, "position"); + gl->glBindAttribLocation(gld->program, 1, "normal"); + + gl->glLinkProgram(gld->program); + gl->glGetProgramInfoLog(gld->program, sizeof msg, NULL, msg); + printf("info: %s\n", msg); + + gl->glUseProgram(gld->program); + gld->proj_location = gl->glGetUniformLocation(gld->program, "proj"); + gld->light_location = gl->glGetUniformLocation(gld->program, "light"); + gld->color_location = gl->glGetUniformLocation(gld->program, "color"); + + /* make the gears */ + gld->gear1 = make_gear(gld, 1.0, 4.0, 1.0, 20, 0.7); + gld->gear2 = make_gear(gld, 0.5, 2.0, 2.0, 10, 0.7); + gld->gear3 = make_gear(gld, 1.3, 2.0, 0.5, 10, 0.7); +} + +static void +gldata_init(GLData *gld) +{ + gld->initialized = 0; + gld->mouse_down = 0; + + gld->view_rotx = -20.0; + gld->view_roty = -30.0; + gld->view_rotz = 0.0; + gld->angle = 0.0; + + gld->light[0] = 1.0; + gld->light[1] = 1.0; + gld->light[2] = -5.0; +} + + +//-------------------------// + +static void +_init_gl(Evas_Object *obj) +{ + GLData *gld = evas_object_data_get(obj, "gld"); + + gears_init(gld); +} + +static void +_del_gl(Evas_Object *obj) +{ + GLData *gld = evas_object_data_get(obj, "gld"); + if (!gld) + { + printf("Unable to get GLData. \n"); + return; + } + Evas_GL_API *gl = gld->glapi; + + gl->glDeleteShader(gld->vtx_shader); + gl->glDeleteShader(gld->fgmt_shader); + gl->glDeleteProgram(gld->program); + gl->glDeleteBuffers(1, &gld->gear1->vbo); + gl->glDeleteBuffers(1, &gld->gear2->vbo); + gl->glDeleteBuffers(1, &gld->gear3->vbo); + + free_gear(gld->gear1); + free_gear(gld->gear2); + free_gear(gld->gear3); + + evas_object_data_del((Evas_Object*)obj, "..gld"); + free(gld); +} + +static void +_resize_gl(Evas_Object *obj) +{ + int w, h; + GLData *gld = evas_object_data_get(obj, "gld"); + + elm_glview_size_get(obj, &w, &h); + + // GL Viewport stuff. you can avoid doing this if viewport is all the + // same as last frame if you want + gears_reshape(gld, w,h); +} + +static void +_draw_gl(Evas_Object *obj) +{ + Evas_GL_API *gl = elm_glview_gl_api_get(obj); + GLData *gld = evas_object_data_get(obj, "gld"); + if (!gld) return; + + render_gears(gld); + gl->glFinish(); +} + +static Eina_Bool +_anim(void *data) +{ + elm_glview_changed_set(data); + return EINA_TRUE; +} + +static void +_on_done(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_del((Evas_Object*)data); +} + +static void +_del(void *data __UNUSED__, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Ecore_Animator *ani = evas_object_data_get(obj, "ani"); + ecore_animator_del(ani); +} + +static void +_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info) +{ + Evas_Event_Key_Down *ev; + ev = (Evas_Event_Key_Down *)event_info; + GLData *gld = evas_object_data_get(obj, "gld"); + + if (strcmp(ev->keyname, "Left") == 0) + { + gld->view_roty += 5.0; + return; + } + + if (strcmp(ev->keyname, "Right") == 0) + { + gld->view_roty -= 5.0; + return; + } + + if (strcmp(ev->keyname, "Up") == 0) + { + gld->view_rotx += 5.0; + return; + } + + if (strcmp(ev->keyname, "Down") == 0) + { + gld->view_rotx -= 5.0; + return; + } + if ((strcmp(ev->keyname, "Escape") == 0) || + (strcmp(ev->keyname, "Return") == 0)) + { + //_on_done(data, obj, event_info); + return; + } +} + +static void +_mouse_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + GLData *gld = evas_object_data_get(obj, "gld"); + gld->mouse_down = 1; +} + +static void +_mouse_move(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Event_Mouse_Move *ev; + ev = (Evas_Event_Mouse_Move *)event_info; + GLData *gld = evas_object_data_get(obj, "gld"); + float dx = 0, dy = 0; + + if (gld->mouse_down) + { + dx = ev->cur.canvas.x - ev->prev.canvas.x; + dy = ev->cur.canvas.y - ev->prev.canvas.y; + + gld->view_roty += -1.0 * dx; + gld->view_rotx += -1.0 * dy; + } +} + +static void +_mouse_up(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + GLData *gld = evas_object_data_get(obj, "gld"); + gld->mouse_down = 0; +} + +void +test_glview(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *bt, *gl; + Ecore_Animator *ani; + GLData *gld = NULL; + + // alloc a data struct to hold our relevant gl info in + if (!(gld = calloc(1, sizeof(GLData)))) return; + gldata_init(gld); + + // new window - do the usual and give it a name, title and delete handler + // Set the engine to opengl_x11 + elm_config_preferred_engine_set("opengl_x11"); + win = elm_win_util_standard_add("glview", "GLView"); + // Set preferred engine back to default from config + elm_config_preferred_engine_set(NULL); + + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + // Add a GLView + gl = elm_glview_add(win); + evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_glview_mode_set(gl, ELM_GLVIEW_ALPHA|ELM_GLVIEW_DEPTH); + elm_glview_resize_policy_set(gl, ELM_GLVIEW_RESIZE_POLICY_RECREATE); + elm_glview_render_policy_set(gl, ELM_GLVIEW_RENDER_POLICY_ALWAYS); + elm_glview_init_func_set(gl, _init_gl); + elm_glview_del_func_set(gl, _del_gl); + elm_glview_resize_func_set(gl, _resize_gl); + elm_glview_render_func_set(gl, (Elm_GLView_Func_Cb)_draw_gl); + elm_box_pack_end(bx, gl); + evas_object_show(gl); + + // Add Mouse/Key Event Callbacks + elm_object_focus_set(gl, EINA_TRUE); + evas_object_event_callback_add(gl, EVAS_CALLBACK_KEY_DOWN, _key_down, gl); + evas_object_event_callback_add(gl, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down, gl); + evas_object_event_callback_add(gl, EVAS_CALLBACK_MOUSE_UP, _mouse_up, gl); + evas_object_event_callback_add(gl, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move, gl); + + // Animator and other vars + ani = ecore_animator_add(_anim, gl); + gld->glapi = elm_glview_gl_api_get(gl); + evas_object_data_set(gl, "ani", ani); + evas_object_data_set(gl, "gld", gld); + evas_object_event_callback_add(gl, EVAS_CALLBACK_DEL, _del, gl); + + /* add an ok button */ + bt = elm_button_add(win); + elm_object_text_set(bt, "OK"); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + evas_object_smart_callback_add(bt, "clicked", _on_done, win); + + evas_object_resize(win, 320, 480); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_glview_simple.c b/libraries/elementary/src/bin/test_glview_simple.c new file mode 100644 index 0000000..fc21ef4 --- /dev/null +++ b/libraries/elementary/src/bin/test_glview_simple.c @@ -0,0 +1,286 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +typedef struct _GLData GLData; + +// GL related data here.. +struct _GLData +{ + Evas_GL_API *glapi; + GLuint program; + GLuint vtx_shader; + GLuint fgmt_shader; + GLuint vbo; + int initialized : 1; +}; + + +static float red = 1.0; + +//--------------------------------// +static GLuint +load_shader( GLData *gld, GLenum type, const char *shader_src ) +{ + Evas_GL_API *gl = gld->glapi; + GLuint shader; + GLint compiled; + + // Create the shader object + shader = gl->glCreateShader(type); + if (shader==0) + return 0; + + // Load/Compile shader source + gl->glShaderSource(shader, 1, &shader_src, NULL); + gl->glCompileShader(shader); + gl->glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled); + + if (!compiled) + { + GLint info_len = 0; + gl->glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &info_len); + if (info_len > 1) + { + char* info_log = malloc(sizeof(char) * info_len); + + gl->glGetShaderInfoLog(shader, info_len, NULL, info_log); + printf("Error compiling shader:\n%s\n======\n%s\n======\n", info_log, shader_src ); + free(info_log); + } + gl->glDeleteShader(shader); + return 0; + } + + return shader; +} + +// Initialize the shader and program object +static int +init_shaders(GLData *gld) +{ + Evas_GL_API *gl = gld->glapi; + GLbyte vShaderStr[] = + "attribute vec4 vPosition; \n" + "void main() \n" + "{ \n" + " gl_Position = vPosition; \n" + "} \n"; + + GLbyte fShaderStr[] = + "#ifdef GL_ES \n" + "precision mediump float; \n" + "#endif \n" + "void main() \n" + "{ \n" + " gl_FragColor = vec4 ( 1.0, 0.0, 0.0, 1.0 );\n" + "} \n"; + + GLint linked; + + // Load the vertex/fragment shaders + gld->vtx_shader = load_shader(gld, GL_VERTEX_SHADER, (const char*)vShaderStr); + gld->fgmt_shader = load_shader(gld, GL_FRAGMENT_SHADER, (const char*)fShaderStr); + + // Create the program object + gld->program = gl->glCreateProgram( ); + if (gld->program==0) + return 0; + + gl->glAttachShader(gld->program, gld->vtx_shader); + gl->glAttachShader(gld->program, gld->fgmt_shader); + + gl->glBindAttribLocation(gld->program, 0, "vPosition"); + gl->glLinkProgram(gld->program); + gl->glGetProgramiv(gld->program, GL_LINK_STATUS, &linked); + + if (!linked) + { + GLint info_len = 0; + gl->glGetProgramiv(gld->program, GL_INFO_LOG_LENGTH, &info_len); + if (info_len > 1) + { + char* info_log = malloc(sizeof(char) * info_len); + + gl->glGetProgramInfoLog(gld->program, info_len, NULL, info_log); + printf("Error linking program:\n%s\n", info_log); + free(info_log); + } + gl->glDeleteProgram(gld->program); + return 0; + } + return 1; +} + + + +// Callbacks +static void +_init_gl(Evas_Object *obj) +{ + GLData *gld = evas_object_data_get(obj, "gld"); + Evas_GL_API *gl = gld->glapi; + GLfloat vVertices[] = { 0.0f, 0.5f, 0.0f, + -0.5f, -0.5f, 0.0f, + 0.5f, -0.5f, 0.0f }; + + if (!init_shaders(gld)) + { + printf("Error Initializing Shaders\n"); + return; + } + + gl->glGenBuffers(1, &gld->vbo); + gl->glBindBuffer(GL_ARRAY_BUFFER, gld->vbo); + gl->glBufferData(GL_ARRAY_BUFFER, 3 * 3 * 4, vVertices, GL_STATIC_DRAW); +} + +static void +_del_gl(Evas_Object *obj) +{ + GLData *gld = evas_object_data_get(obj, "gld"); + if (!gld) + { + printf("Unable to get GLData. \n"); + return; + } + Evas_GL_API *gl = gld->glapi; + + gl->glDeleteShader(gld->vtx_shader); + gl->glDeleteShader(gld->fgmt_shader); + gl->glDeleteProgram(gld->program); + gl->glDeleteBuffers(1, &gld->vbo); + + evas_object_data_del((Evas_Object*)obj, "..gld"); + free(gld); +} + + +static void +_resize_gl(Evas_Object *obj) +{ + int w, h; + GLData *gld = evas_object_data_get(obj, "gld"); + Evas_GL_API *gl = gld->glapi; + + elm_glview_size_get(obj, &w, &h); + + // GL Viewport stuff. you can avoid doing this if viewport is all the + // same as last frame if you want + gl->glViewport(0, 0, w, h); +} + + + +static void +_draw_gl(Evas_Object *obj) +{ + Evas_GL_API *gl = elm_glview_gl_api_get(obj); + GLData *gld = evas_object_data_get(obj, "gld"); + if (!gld) return; + int w, h; + + elm_glview_size_get(obj, &w, &h); + + gl->glViewport(0, 0, w, h); + gl->glClearColor(red,0.8,0.3,1); + gl->glClear(GL_COLOR_BUFFER_BIT); + + // Draw a Triangle + gl->glEnable(GL_BLEND); + + gl->glUseProgram(gld->program); + + gl->glBindBuffer(GL_ARRAY_BUFFER, gld->vbo); + gl->glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, + 0, 0); + gl->glEnableVertexAttribArray(0); + + gl->glDrawArrays(GL_TRIANGLES, 0, 3); + + // Optional - Flush the GL pipeline + gl->glFinish(); + + red -= 0.1; + if (red < 0.0) red = 1.0; +} + +static Eina_Bool +_anim(void *data) +{ + elm_glview_changed_set(data); + return EINA_TRUE; +} + +static void +_on_done(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_del((Evas_Object*)data); +} + + +static void +_del(void *data __UNUSED__, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Ecore_Animator *ani = evas_object_data_get(obj, "ani"); + ecore_animator_del(ani); +} + + +void +test_glview_simple(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *bt, *gl; + Ecore_Animator *ani; + GLData *gld = NULL; + + if (!(gld = calloc(1, sizeof(GLData)))) return; + + // Set the engine to opengl_x11 + elm_config_preferred_engine_set("opengl_x11"); + win = elm_win_util_standard_add("glview simple", "GLView Simple"); + // Set preferred engine back to default from config + elm_config_preferred_engine_set(NULL); + + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + gl = elm_glview_add(win); + evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_glview_mode_set(gl, ELM_GLVIEW_ALPHA | ELM_GLVIEW_DEPTH); + elm_glview_resize_policy_set(gl, ELM_GLVIEW_RESIZE_POLICY_RECREATE); + elm_glview_render_policy_set(gl, ELM_GLVIEW_RENDER_POLICY_ON_DEMAND); + elm_glview_init_func_set(gl, _init_gl); + elm_glview_del_func_set(gl, _del_gl); + elm_glview_resize_func_set(gl, _resize_gl); + elm_glview_render_func_set(gl, _draw_gl); + elm_box_pack_end(bx, gl); + evas_object_show(gl); + + elm_object_focus_set(gl, EINA_TRUE); + + ani = ecore_animator_add(_anim, gl); + gld->glapi = elm_glview_gl_api_get(gl); + evas_object_data_set(gl, "ani", ani); + evas_object_data_set(gl, "gld", gld); + evas_object_event_callback_add(gl, EVAS_CALLBACK_DEL, _del, gl); + + bt = elm_button_add(win); + elm_object_text_set(bt, "OK"); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + evas_object_smart_callback_add(bt, "clicked", _on_done, win); + + evas_object_resize(win, 320, 480); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_grid.c b/libraries/elementary/src/bin/test_grid.c new file mode 100644 index 0000000..f08c060 --- /dev/null +++ b/libraries/elementary/src/bin/test_grid.c @@ -0,0 +1,190 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +struct _Api_Data +{ + Evas_Object *grid; + Evas_Object *child; +}; +typedef struct _Api_Data Api_Data; + +struct _api_data +{ + unsigned int state; /* What state we are testing */ + Api_Data data; +}; +typedef struct _api_data api_data; + +enum _api_state +{ + GRID_PACK_SET, + GRID_UNPACK, + GRID_SIZE, + GRID_CLEAR, + API_STATE_LAST +}; +typedef enum _api_state api_state; + +static void +set_api_state(api_data *api) +{ + Api_Data *dt = &api->data; + int w, h; + + switch(api->state) + { /* Put all api-changes under switch */ + case GRID_PACK_SET: /* 0 */ + elm_grid_pack_set(dt->child, 5, 15, 60, 40); + break; + + case GRID_UNPACK: /* 1 */ + elm_grid_unpack(dt->grid, dt->child); + evas_object_del(dt->child); + break; + + case GRID_SIZE: /* 2 */ + elm_grid_size_get(dt->grid, &w, &h); + printf("size w=<%d> h=<%d>\n", w, h); + w = h = 100; /* grid size returns wrong values */ + w += 30; + h += 10; + + elm_grid_size_set(dt->grid, w, h); + break; + + case GRID_CLEAR: /* 3 */ + elm_grid_clear(dt->grid, EINA_TRUE); + break; + + default: + return; + } +} + +static void +_api_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ /* Will add here a SWITCH command containing code to modify test-object */ + /* in accordance a->state value. */ + api_data *a = data; + char str[128]; + + printf("clicked event on API Button: api_state=<%d>\n", a->state); + set_api_state(a); + a->state++; + sprintf(str, "Next API function (%u)", a->state); + elm_object_text_set(obj, str); + elm_object_disabled_set(obj, a->state == API_STATE_LAST); +} + +static void +_ch_grid(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + int x, y, w, h; + + elm_grid_pack_get(obj, &x, &y, &w, &h); + elm_grid_pack_set(obj, x - 1, y - 1, w + 2, h + 2); +} + +static void +_cleanup_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + free(data); +} + +void +test_grid(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *gd, *bt, *rc, *en; + + win = elm_win_util_standard_add("grid", "Grid"); + elm_win_autodel_set(win, EINA_TRUE); + api_data *api = calloc(1, sizeof(api_data)); + + evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api); + + gd = elm_grid_add(win); + elm_grid_size_set(gd, 100, 100); + elm_win_resize_object_add(win, gd); + evas_object_size_hint_weight_set(gd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + api->data.grid = gd; + evas_object_show(gd); + + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + elm_object_text_set(en, "Entry text"); + elm_entry_single_line_set(en, EINA_TRUE); + elm_grid_pack(gd, en, 50, 10, 40, 10); + evas_object_show(en); + + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + elm_object_text_set(en, "Entry text 2"); + elm_entry_single_line_set(en, EINA_TRUE); + elm_grid_pack(gd, en, 60, 20, 30, 10); + evas_object_show(en); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Next API function"); + evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api); + elm_grid_pack(gd, bt, 30, 0, 40, 10); + elm_object_disabled_set(bt, api->state == API_STATE_LAST); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button"); + elm_grid_pack(gd, bt, 0, 0, 20, 20); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button"); + elm_grid_pack(gd, bt, 10, 10, 40, 20); + api->data.child = bt; + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button"); + elm_grid_pack(gd, bt, 10, 30, 20, 50); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button"); + elm_grid_pack(gd, bt, 80, 80, 20, 20); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Change"); + elm_grid_pack(gd, bt, 40, 40, 20, 20); + evas_object_smart_callback_add(bt, "clicked", _ch_grid, gd); + evas_object_show(bt); + + rc = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(rc, 128, 0, 0, 128); + elm_grid_pack(gd, rc, 40, 70, 20, 10); + evas_object_show(rc); + + rc = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(rc, 0, 128, 0, 128); + elm_grid_pack(gd, rc, 60, 70, 10, 10); + evas_object_show(rc); + + rc = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(rc, 0, 0, 128, 128); + elm_grid_pack(gd, rc, 40, 80, 10, 10); + evas_object_show(rc); + + rc = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(rc, 128, 0, 128, 128); + elm_grid_pack(gd, rc, 50, 80, 10, 10); + evas_object_show(rc); + + rc = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(rc, 128, 64, 0, 128); + elm_grid_pack(gd, rc, 60, 80, 10, 10); + evas_object_show(rc); + + evas_object_resize(win, 480, 480); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_hover.c b/libraries/elementary/src/bin/test_hover.c new file mode 100644 index 0000000..c9a8fc7 --- /dev/null +++ b/libraries/elementary/src/bin/test_hover.c @@ -0,0 +1,181 @@ +#include "elementary_config.h" +#include +#ifndef ELM_LIB_QUICKLAUNCH +static void +my_hover_bt(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *hv = data; + + evas_object_show(hv); +} + +static void +_top_bt_clicked(void *data, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *hv = (Evas_Object *)data; + elm_hover_dismiss(hv); +} + +void +test_hover(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bg, *bx, *bt, *hv, *ic; + char buf[PATH_MAX]; + + win = elm_win_add(NULL, "hover", ELM_WIN_BASIC); + elm_win_title_set(win, "Hover"); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + hv = elm_hover_add(win); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button"); + evas_object_smart_callback_add(bt, "clicked", my_hover_bt, hv); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + elm_hover_parent_set(hv, win); + elm_hover_target_set(hv, bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Popup"); + elm_object_part_content_set(hv, "middle", bt); + evas_object_show(bt); + + bx = elm_box_add(win); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + elm_box_pack_end(bx, ic); + evas_object_show(ic); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Top 1"); + evas_object_smart_callback_add(bt, "clicked", _top_bt_clicked, hv); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + bt = elm_button_add(win); + elm_object_text_set(bt, "Top 2"); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + bt = elm_button_add(win); + elm_object_text_set(bt, "Top 3"); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + evas_object_show(bx); + elm_object_part_content_set(hv, "top", bx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Bottom"); + elm_object_part_content_set(hv, "bottom", bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Left"); + elm_object_part_content_set(hv, "left", bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Right"); + elm_object_part_content_set(hv, "right", bt); + evas_object_show(bt); + + evas_object_size_hint_min_set(bg, 160, 160); + evas_object_size_hint_max_set(bg, 640, 640); + evas_object_resize(win, 440, 440); + evas_object_show(win); +} + +void +test_hover2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bg, *bx, *bt, *hv, *ic; + char buf[PATH_MAX]; + + win = elm_win_add(NULL, "hover2", ELM_WIN_BASIC); + elm_win_title_set(win, "Hover 2"); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + hv = elm_hover_add(win); + elm_object_style_set(hv, "popout"); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button"); + evas_object_smart_callback_add(bt, "clicked", my_hover_bt, hv); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + elm_hover_parent_set(hv, win); + elm_hover_target_set(hv, bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Popup"); + elm_object_part_content_set(hv, "middle", bt); + evas_object_show(bt); + + bx = elm_box_add(win); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + elm_box_pack_end(bx, ic); + evas_object_show(ic); + bt = elm_button_add(win); + elm_object_text_set(bt, "Top 1"); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + bt = elm_button_add(win); + elm_object_text_set(bt, "Top 2"); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + bt = elm_button_add(win); + elm_object_text_set(bt, "Top 3"); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + evas_object_show(bx); + elm_object_part_content_set(hv, "top", bx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Bot"); + elm_object_part_content_set(hv, "bottom", bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Left"); + elm_object_part_content_set(hv, "left", bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Right"); + elm_object_part_content_set(hv, "right", bt); + evas_object_show(bt); + + evas_object_size_hint_min_set(bg, 160, 160); + evas_object_size_hint_max_set(bg, 640, 640); + evas_object_resize(win, 440, 440); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_hoversel.c b/libraries/elementary/src/bin/test_hoversel.c new file mode 100644 index 0000000..d86c3cf --- /dev/null +++ b/libraries/elementary/src/bin/test_hoversel.c @@ -0,0 +1,209 @@ +#include "test.h" +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +struct _api_data +{ + unsigned int state; /* What state we are testing */ + void *box; /* Use this to get box content */ +}; +typedef struct _api_data api_data; + +enum _api_state +{ + HOVERSEL_HORIZ, + HOVERSEL_END, + HOVERSEL_LABAL_SET, + HOVERSEL_ICON_UNSET, + HOVERSEL_CLEAR_OPEN, + HOVERSEL_CLEAR, + API_STATE_LAST +}; +typedef enum _api_state api_state; + +static void +set_api_state(api_data *api) +{ + const Eina_List *items = elm_box_children_get(api->box); + if (!eina_list_count(items)) + return; + + /* use elm_box_children_get() to get list of children */ + switch(api->state) + { /* Put all api-changes under switch */ + case HOVERSEL_HORIZ: /* Make first hover horiz (0) */ + elm_hoversel_horizontal_set(eina_list_nth(items, 0), EINA_TRUE); + elm_hoversel_hover_begin(eina_list_nth(items, 0)); + break; + + case HOVERSEL_END: /* Make first hover horiz (1) */ + elm_hoversel_hover_begin(eina_list_nth(items, 1)); + elm_hoversel_hover_end(eina_list_nth(items, 1)); + break; + + case HOVERSEL_LABAL_SET: /* set second hover label (2) */ + elm_object_text_set(eina_list_nth(items, 1), "Label from API"); + break; + + case HOVERSEL_ICON_UNSET: /* 3 */ + elm_object_text_set(eina_list_nth(items, 5), "Label only"); + elm_object_part_content_unset(eina_list_nth(items, 5), "icon"); + break; + + case HOVERSEL_CLEAR_OPEN: /* 4 */ + elm_hoversel_hover_begin(eina_list_nth(items, 1)); + elm_hoversel_clear(eina_list_nth(items, 1)); + break; + + case HOVERSEL_CLEAR: /* 5 */ + elm_hoversel_clear(eina_list_nth(items, 0)); + break; + + case API_STATE_LAST: + break; + + default: + return; + } +} + +static void +_api_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ /* Will add here a SWITCH command containing code to modify test-object */ + /* in accordance a->state value. */ + api_data *a = data; + char str[128]; + + printf("clicked event on API Button: api_state=<%d>\n", a->state); + set_api_state(a); + a->state++; + sprintf(str, "Next API function (%u)", a->state); + elm_object_text_set(obj, str); + elm_object_disabled_set(obj, a->state == API_STATE_LAST); +} + +static void +_cleanup_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + free(data); +} + +void +test_hoversel(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *bt, *ic, *bxx; + char buf[PATH_MAX]; + api_data *api = calloc(1, sizeof(api_data)); + + win = elm_win_util_standard_add("hoversel", "HoverSel"); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api); + + bxx = elm_box_add(win); + elm_win_resize_object_add(win, bxx); + evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bxx); + + bx = elm_box_add(win); + elm_win_resize_object_add(win, bx); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + api->box = bx; + evas_object_show(bx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Next API function"); + evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api); + elm_box_pack_end(bxx, bt); + elm_object_disabled_set(bt, api->state == API_STATE_LAST); + evas_object_show(bt); + + elm_box_pack_end(bxx, bx); + + bt = elm_hoversel_add(win); +// FIXME: need to add horizontal hoversel theme to default some day +// elm_hoversel_horizontal_set(bt, 1); + elm_hoversel_hover_parent_set(bt, win); + elm_object_text_set(bt, "Labels"); + elm_hoversel_item_add(bt, "Item 1", NULL, ELM_ICON_NONE, NULL, NULL); + elm_hoversel_item_add(bt, "Item 2", NULL, ELM_ICON_NONE, NULL, NULL); + elm_hoversel_item_add(bt, "Item 3", NULL, ELM_ICON_NONE, NULL, NULL); + elm_hoversel_item_add(bt, "Item 4 - Long Label Here", NULL, ELM_ICON_NONE, NULL, NULL); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + evas_object_size_hint_align_set(bt, 0.5, 0.5); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_hoversel_add(win); + elm_hoversel_hover_parent_set(bt, win); + elm_object_text_set(bt, "Some Icons"); + elm_hoversel_item_add(bt, "Item 1", NULL, ELM_ICON_NONE, NULL, NULL); + elm_hoversel_item_add(bt, "Item 2", NULL, ELM_ICON_NONE, NULL, NULL); + elm_hoversel_item_add(bt, "Item 3", "home", ELM_ICON_STANDARD, NULL, NULL); + elm_hoversel_item_add(bt, "Item 4", "close", ELM_ICON_STANDARD, NULL, NULL); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + evas_object_size_hint_align_set(bt, 0.5, 0.5); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_hoversel_add(win); + elm_hoversel_hover_parent_set(bt, win); + elm_object_text_set(bt, "All Icons"); + elm_hoversel_item_add(bt, "Item 1", "apps", ELM_ICON_STANDARD, NULL, NULL); + elm_hoversel_item_add(bt, "Item 2", "arrow_down", ELM_ICON_STANDARD, NULL, NULL); + elm_hoversel_item_add(bt, "Item 3", "home", ELM_ICON_STANDARD, NULL, NULL); + elm_hoversel_item_add(bt, "Item 4", "close", ELM_ICON_STANDARD, NULL, NULL); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + evas_object_size_hint_align_set(bt, 0.5, 0.5); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_hoversel_add(win); + elm_hoversel_hover_parent_set(bt, win); + elm_object_text_set(bt, "All Icons"); + elm_hoversel_item_add(bt, "Item 1", "apps", ELM_ICON_STANDARD, NULL, NULL); + snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", elm_app_data_dir_get()); + elm_hoversel_item_add(bt, "Item 2", buf, ELM_ICON_FILE, NULL, NULL); + elm_hoversel_item_add(bt, "Item 3", "home", ELM_ICON_STANDARD, NULL, NULL); + elm_hoversel_item_add(bt, "Item 4", "close", ELM_ICON_STANDARD, NULL, NULL); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + evas_object_size_hint_align_set(bt, 0.5, 0.5); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_hoversel_add(win); + elm_hoversel_hover_parent_set(bt, win); + elm_object_text_set(bt, "Disabled Hoversel"); + elm_hoversel_item_add(bt, "Item 1", "apps", ELM_ICON_STANDARD, NULL, NULL); + elm_hoversel_item_add(bt, "Item 2", "close", ELM_ICON_STANDARD, NULL, NULL); + elm_object_disabled_set(bt, 1); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + evas_object_size_hint_align_set(bt, 0.5, 0.5); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_hoversel_add(win); + elm_hoversel_hover_parent_set(bt, win); + elm_object_text_set(bt, "Icon + Label"); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/sky_03.jpg", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_object_part_content_set(bt, "icon", ic); + evas_object_show(ic); + + elm_hoversel_item_add(bt, "Item 1", "apps", ELM_ICON_STANDARD, NULL, NULL); + elm_hoversel_item_add(bt, "Item 2", "arrow_down", ELM_ICON_STANDARD, NULL, NULL); + elm_hoversel_item_add(bt, "Item 3", "home", ELM_ICON_STANDARD, NULL, NULL); + elm_hoversel_item_add(bt, "Item 4", "close", ELM_ICON_STANDARD, NULL, NULL); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + evas_object_size_hint_align_set(bt, 0.5, 0.5); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + evas_object_resize(win, 320, 300); + + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_icon.c b/libraries/elementary/src/bin/test_icon.c new file mode 100644 index 0000000..28bda73 --- /dev/null +++ b/libraries/elementary/src/bin/test_icon.c @@ -0,0 +1,159 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static void +aspect_fixed_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *ic = (Evas_Object *)data; + elm_icon_aspect_fixed_set(ic, elm_check_state_get(obj)); +} + +static void +fill_outside_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *ic = (Evas_Object *)data; + elm_icon_fill_outside_set(ic, elm_check_state_get(obj)); +} + +static void +smooth_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *ic = (Evas_Object *)data; + elm_icon_smooth_set(ic, elm_check_state_get(obj)); +} + +static void +bt_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *ic; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("preload-prescale", "Preload & Prescale"); + elm_win_autodel_set(win, EINA_TRUE); + + ic = elm_icon_add(win); + elm_win_resize_object_add(win, ic); + snprintf(buf, sizeof(buf), "%s/images/insanely_huge_test_image.jpg", + elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + + evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ic, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_icon_resizable_set(ic, EINA_TRUE, EINA_TRUE); + elm_icon_aspect_fixed_set(ic, EINA_FALSE); + elm_icon_preload_disabled_set(ic, EINA_TRUE); + elm_icon_prescale_set(ic, EINA_TRUE); + evas_object_show(ic); + + evas_object_resize(win, 350, 350); + evas_object_show(win); +} + +void +test_icon(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *box, *content_box, *hbox, *tg, *bt; + win = elm_win_util_standard_add("icon test", "Icon Test"); + elm_win_autodel_set(win, EINA_TRUE); + + box = elm_box_add(win); + elm_win_resize_object_add(win, box); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(box); + + content_box = elm_box_add(win); + elm_win_resize_object_add(win, content_box); + evas_object_size_hint_weight_set(content_box, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(content_box, EVAS_HINT_FILL, + EVAS_HINT_FILL); + elm_box_pack_end(box, content_box); + evas_object_show(content_box); + + Evas_Object *ic = elm_icon_add(win); + char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), "%s/images/logo.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, EINA_TRUE, EINA_TRUE); + evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ic, EVAS_HINT_FILL, EVAS_HINT_FILL); + + elm_box_pack_end(content_box, ic); + evas_object_show(ic); + + hbox = elm_box_add(win); + elm_box_horizontal_set(hbox, EINA_TRUE); + evas_object_size_hint_weight_set(content_box, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_box_pack_end(box, hbox); + evas_object_show(hbox); + + /* Test Aspect Fixed */ + tg = elm_check_add(win); + elm_object_text_set(tg, "Aspect Fixed"); + elm_check_state_set(tg, EINA_TRUE); + evas_object_smart_callback_add(tg, "changed", aspect_fixed_cb, ic); + elm_box_pack_end(hbox, tg); + evas_object_show(tg); + + /* Test Fill Outside */ + tg = elm_check_add(win); + elm_object_text_set(tg, "Fill Outside"); + evas_object_smart_callback_add(tg, "changed", fill_outside_cb, ic); + elm_box_pack_end(hbox, tg); + evas_object_show(tg); + + /* Test Smooth */ + tg = elm_check_add(win); + elm_object_text_set(tg, "Smooth"); + elm_check_state_set(tg, EINA_TRUE); + evas_object_smart_callback_add(tg, "changed", smooth_cb, ic); + elm_box_pack_end(hbox, tg); + evas_object_show(tg); + + /* Test Preload, Prescale */ + bt = elm_button_add(win); + elm_object_text_set(bt, "Preload & Prescale"); + evas_object_smart_callback_add(bt, "clicked", bt_clicked, NULL); + elm_box_pack_end(hbox, bt); + evas_object_show(bt); + + evas_object_resize(win, 400, 400); + evas_object_show(win); +} + +static void +icon_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("clicked!\n"); +} + +void +test_icon_transparent(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *ic; + char buf[PATH_MAX]; + + win = elm_win_add(NULL, "icon-transparent", ELM_WIN_BASIC); + elm_win_title_set(win, "Icon Transparent"); + elm_win_autodel_set(win, EINA_TRUE); + elm_win_alpha_set(win, EINA_TRUE); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + elm_icon_no_scale_set(ic, 1); + evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_fill_set(ic, 0.5, 0.5); + elm_win_resize_object_add(win, ic); + evas_object_show(ic); + + evas_object_smart_callback_add(ic, "clicked", icon_clicked, NULL); + + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_icon_animated.c b/libraries/elementary/src/bin/test_icon_animated.c new file mode 100644 index 0000000..8d00700 --- /dev/null +++ b/libraries/elementary/src/bin/test_icon_animated.c @@ -0,0 +1,49 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +static void +icon_clicked(void *data , Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *ic; + ic = data; + Eina_Bool rec; + rec = elm_icon_animated_play_get(ic); + rec = !rec; + printf("clicked!rec =%d\n",rec); + elm_icon_animated_play_set(ic, rec); +} + +void +test_icon_animated(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *ic; + char buf[PATH_MAX]; + + win = elm_win_add(NULL, "icon-animated-gif", ELM_WIN_BASIC); + elm_win_title_set(win, "Icon Animated Gif"); + elm_win_autodel_set(win, EINA_TRUE); + elm_win_alpha_set(win, EINA_TRUE); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/animated_logo.gif", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + if (elm_icon_animated_available_get(ic)) + { + printf("============Support animator==============\n"); + elm_icon_animated_set(ic, EINA_TRUE); + elm_icon_animated_play_set(ic, EINA_TRUE); + } + elm_icon_resizable_set(ic, 0, 0); + elm_icon_no_scale_set(ic, 1); + evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_fill_set(ic, 0.5, 0.5); + elm_win_resize_object_add(win, ic); + evas_object_show(ic); + + evas_object_smart_callback_add(ic, "clicked", icon_clicked, ic); + + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_icon_desktops.c b/libraries/elementary/src/bin/test_icon_desktops.c new file mode 100644 index 0000000..aed269a --- /dev/null +++ b/libraries/elementary/src/bin/test_icon_desktops.c @@ -0,0 +1,100 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +static Elm_Genlist_Item_Class it_desk; + +static char * +desk_gl_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ +#ifdef ELM_EFREET + Efreet_Desktop *d = (Efreet_Desktop *)data; + return strdup(d->name); +#else + return NULL; + (void)data; +#endif +} +static Evas_Object * +desk_gl_content_get(void *data, Evas_Object *obj, const char *part) +{ +#ifdef ELM_EFREET + Efreet_Desktop *d = (Efreet_Desktop *)data; + Evas_Object *ic; + + ic = elm_icon_add(obj); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + if (!(!strcmp(part, "elm.swallow.icon"))) return ic; + if (!d->icon) return ic; + elm_icon_standard_set(ic, d->icon); + return ic; +#else + return NULL; + (void)data; + (void)obj; + (void)part; +#endif +} +static void +desk_gl_del(void *data, Evas_Object *obj __UNUSED__) +{ +#ifdef ELM_EFREET + Efreet_Desktop *d = (Efreet_Desktop *)data; + efreet_desktop_free(d); +#else + return; + (void)data; +#endif +} + +#ifdef ELM_EFREET +static void +desktop_sel(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("sel\n"); +} +#endif + +void +test_icon_desktops(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *gl; +#ifdef ELM_EFREET + Eina_List *desktops; +#endif + + win = elm_win_util_standard_add("icon-desktops", "Icon Desktops"); + elm_win_autodel_set(win, EINA_TRUE); + + it_desk.item_style = "default"; + it_desk.func.text_get = desk_gl_text_get; + it_desk.func.content_get = desk_gl_content_get; + it_desk.func.state_get = NULL; + it_desk.func.del = desk_gl_del; + + gl = elm_genlist_add(win); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, gl); + evas_object_show(gl); + +#ifdef ELM_EFREET + if (elm_need_efreet()) + { + desktops = efreet_util_desktop_name_glob_list("*"); + if (desktops) + { + Efreet_Desktop *d; + + EINA_LIST_FREE(desktops, d) + elm_genlist_item_append(gl, &it_desk, d, + NULL, ELM_GENLIST_ITEM_NONE, + desktop_sel, NULL); + } + } +#endif + + evas_object_resize(win, 320, 480); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_index.c b/libraries/elementary/src/bin/test_index.c new file mode 100644 index 0000000..0e3928a --- /dev/null +++ b/libraries/elementary/src/bin/test_index.c @@ -0,0 +1,385 @@ +#include "test.h" +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +struct _Idx_Data_Type +{ + Evas_Object *id; /* Pointer to Index */ + Elm_Object_Item *item; /* Item we use for search */ +}; +typedef struct _Idx_Data_Type Idx_Data_Type; + +struct _api_data +{ + unsigned int state; /* What state we are testing */ + Idx_Data_Type dt; +}; +typedef struct _api_data api_data; + +enum _api_state +{ + INDEX_LEVEL_SET, + INDEX_ACTIVE_SET, + INDEX_APPEND_RELATIVE, + INDEX_PREPEND, + INDEX_ITEM_DEL, + INDEX_ITEM_FIND, + INDEX_HORIZONTAL, + INDEX_INDICATOR_DISABLED, + INDEX_CLEAR, + API_STATE_LAST +}; +typedef enum _api_state api_state; + +static void +set_api_state(api_data *api) +{ + Idx_Data_Type *d = &api->dt; + switch(api->state) + { /* Put all api-changes under switch */ + case INDEX_LEVEL_SET: + elm_index_autohide_disabled_set(d->id, EINA_TRUE); + elm_index_item_level_set(d->id, (elm_index_item_level_get(d->id) ? 0 : 1)); + break; + + case INDEX_ACTIVE_SET: + elm_index_autohide_disabled_set(d->id, EINA_FALSE); + break; + + case INDEX_APPEND_RELATIVE: + elm_index_item_insert_after(d->id, + elm_index_item_find(d->id, d->item), + "W", NULL, d->item); + elm_index_item_insert_before(d->id, + elm_index_item_find(d->id, d->item), + "V", NULL, d->item); + break; + + case INDEX_PREPEND: + elm_index_item_prepend(d->id, "D", NULL, d->item); + break; + + case INDEX_ITEM_DEL: + elm_object_item_del(elm_index_item_find(d->id, d->item)); + break; + + case INDEX_ITEM_FIND: + { + Elm_Object_Item *i = elm_index_item_find(d->id, d->item); + if (i) + { + printf("Item Find - Found Item.\n"); + elm_object_item_del(i); + } + } + break; + + case INDEX_HORIZONTAL: + elm_index_horizontal_set(d->id, EINA_TRUE); + break; + + case INDEX_INDICATOR_DISABLED: + elm_index_indicator_disabled_set(d->id, EINA_TRUE); + break; + + case INDEX_CLEAR: + elm_index_item_clear(d->id); + break; + + case API_STATE_LAST: + break; + + default: + return; + } +} + +static void +_api_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ /* Will add here a SWITCH command containing code to modify test-object */ + /* in accordance a->state value. */ + api_data *a = data; + char str[128]; + + printf("clicked event on API Button: api_state=<%d>\n", a->state); + set_api_state(a); + a->state++; + sprintf(str, "Next API function (%u)", a->state); + elm_object_text_set(obj, str); + elm_object_disabled_set(obj, a->state == API_STATE_LAST); +} + +static Elm_Genlist_Item_Class itci; +char *gli_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ + char buf[256]; + int j = (long)data; + snprintf(buf, sizeof(buf), "%c%c", + 'A' + ((j >> 4) & 0xf), + 'a' + ((j ) & 0xf) + ); + return strdup(buf); +} + +void +_index_delay_changed_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + // called on a change but delayed in case multiple changes happen in a + // short timespan + elm_genlist_item_bring_in(elm_object_item_data_get(event_info), + ELM_GENLIST_ITEM_SCROLLTO_TOP); +} + +void +_index_changed_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + // this is calld on every change, no matter how often + // elm_genlist_item_bring_in(event_info); +} + +void +_index_selected_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + // called on final select + elm_genlist_item_bring_in(elm_object_item_data_get(event_info), + ELM_GENLIST_ITEM_SCROLLTO_TOP); +} + +static void +_cleanup_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + free(data); +} + +static void +id_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + printf("Current Index : %s\n", elm_index_item_letter_get((const Elm_Object_Item *)event_info)); +} + +void +test_index(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bxx, *gl, *id, *bt; + Elm_Object_Item *glit; + int i, j; + api_data *api = calloc(1, sizeof(api_data)); + + win = elm_win_util_standard_add("index", "Index"); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api); + + bxx = elm_box_add(win); + elm_win_resize_object_add(win, bxx); + evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bxx); + + gl = elm_genlist_add(win); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(gl); + + api->dt.id = id = elm_index_add(win); + evas_object_size_hint_weight_set(id, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(id, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, id); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Next API function"); + evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api); + elm_box_pack_end(bxx, bt); + elm_object_disabled_set(bt, api->state == API_STATE_LAST); + evas_object_show(bt); + + elm_box_pack_end(bxx, gl); + + evas_object_show(id); + + itci.item_style = "default"; + itci.func.text_get = gli_text_get; + itci.func.content_get = NULL; + itci.func.state_get = NULL; + itci.func.del = NULL; + + j = 0; + for (i = 0; i < 100; i++) + { + glit = elm_genlist_item_append(gl, &itci, + (void *)(long)j/* item data */, + NULL/* parent */, + ELM_GENLIST_ITEM_NONE, + NULL/* func */, NULL/* func data */); + if (!(j & 0xf)) + { + char buf[32]; + + snprintf(buf, sizeof(buf), "%c", 'A' + ((j >> 4) & 0xf)); + elm_index_item_append(id, buf, id_cb, glit); + if (*buf == 'G') /* Just init dt->item later used in API test */ + api->dt.item = glit; + } + j += 2; + } + evas_object_smart_callback_add(id, "delay,changed", _index_delay_changed_cb, NULL); + evas_object_smart_callback_add(id, "changed", _index_changed_cb, NULL); + evas_object_smart_callback_add(id, "selected", _index_selected_cb, NULL); + elm_index_level_go(id, 0); + evas_object_resize(win, 320, 480); + evas_object_show(win); +} + +/***********/ + +typedef struct _Test_Index2_Elements +{ + Evas_Object *entry, *lst, *id; +} Test_Index2_Elements; + +void +test_index2_del(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + /* FIXME it won't be called if elm_test main window is closed */ + free(data); +} + +int +test_index2_cmp(const void *data1, const void *data2) +{ + const char *label1, *label2; + const Elm_Object_Item *li_it1 = data1; + const Elm_Object_Item *li_it2 = data2; + + label1 = elm_object_item_text_get(li_it1); + label2 = elm_object_item_text_get(li_it2); + + return strcasecmp(label1, label2); +} + +int +test_index2_icmp(const void *data1, const void *data2) +{ + const char *label1, *label2; + const Elm_Object_Item *index_it1 = data1; + const Elm_Object_Item *index_it2 = data2; + + label1 = elm_index_item_letter_get(index_it1); + label2 = elm_index_item_letter_get(index_it2); + + return strcasecmp(label1, label2); +} + +void +test_index2_it_add(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Test_Index2_Elements *gui = data; + Elm_Object_Item *list_it; + const char *label; + char letter[2]; + + label = elm_object_text_get(gui->entry); + snprintf(letter, sizeof(letter), "%c", label[0]); + list_it = elm_list_item_sorted_insert(gui->lst, label, NULL, NULL, NULL, + NULL, test_index2_cmp); + elm_index_item_sorted_insert(gui->id, letter, NULL, list_it, test_index2_icmp, + test_index2_cmp); + elm_list_go(gui->lst); + /* FIXME it's not showing the recently added item */ + elm_list_item_show(list_it); +} + +void +test_index2_it_del(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Test_Index2_Elements *gui = data; + const char *label, *label_next; + Elm_Object_Item *list_it, *list_it_next; + Elm_Object_Item *iit; + + list_it = elm_list_selected_item_get(obj); + list_it_next = elm_list_item_next(list_it); + + if (!list_it_next) + { + iit = elm_index_item_find(gui->id, list_it); + if (iit) elm_object_item_del(iit); + elm_object_item_del(list_it); + return; + } + + label = elm_object_item_text_get(list_it); + label_next = elm_object_item_text_get(list_it_next); + + iit = elm_index_item_find(gui->id, list_it); + if (label[0] == label_next[0]) + elm_object_item_data_set(iit, list_it_next); + else + elm_object_item_del(iit); + + elm_object_item_del(list_it); +} + +void +test_index2_id_changed(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + elm_list_item_show(elm_object_item_data_get(event_info)); +} + +void +test_index2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *box, *bt; + Test_Index2_Elements *gui; + + gui = malloc(sizeof(*gui)); + + win = elm_win_util_standard_add("sorted-index-list", "Sorted Index and List"); + evas_object_smart_callback_add(win, "delete,request", test_index2_del, gui); + elm_win_autodel_set(win, EINA_TRUE); + + box = elm_box_add(win); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, box); + evas_object_show(box); + + gui->id = elm_index_add(win); + evas_object_size_hint_weight_set(gui->id, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, gui->id); + evas_object_smart_callback_add(gui->id, "delay,changed", + test_index2_id_changed, NULL); + evas_object_show(gui->id); + + gui->entry = elm_entry_add(win); + elm_entry_scrollable_set(gui->entry, EINA_TRUE); + elm_object_text_set(gui->entry, "Label"); + elm_entry_single_line_set(gui->entry, EINA_TRUE); + evas_object_size_hint_weight_set(gui->entry, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_fill_set(gui->entry, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, gui->entry); + evas_object_show(gui->entry); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Add"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, bt); + evas_object_smart_callback_add(bt, "clicked", test_index2_it_add, gui); + evas_object_show(bt); + + gui->lst = elm_list_add(win); + elm_box_pack_end(box, gui->lst); + evas_object_size_hint_weight_set(gui->lst, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_fill_set(gui->lst, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_smart_callback_add(gui->lst, "selected", test_index2_it_del, + gui); + elm_list_go(gui->lst); + evas_object_show(gui->lst); + + evas_object_resize(win, 320, 480); + evas_object_show(win); +} + +#endif diff --git a/libraries/elementary/src/bin/test_inwin.c b/libraries/elementary/src/bin/test_inwin.c new file mode 100644 index 0000000..14ab168 --- /dev/null +++ b/libraries/elementary/src/bin/test_inwin.c @@ -0,0 +1,129 @@ +#include "test.h" +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +struct _api_data +{ + unsigned int state; /* What state we are testing */ + void *inwin; +}; +typedef struct _api_data api_data; + +enum _api_state +{ + CONTENT_UNSET, + API_STATE_LAST +}; +typedef enum _api_state api_state; + +static void +set_api_state(api_data *api) +{ + Evas_Object *t; + switch(api->state) + { + case CONTENT_UNSET: + t = elm_win_inwin_content_unset(api->inwin); + evas_object_del(t); + t = elm_label_add(elm_object_parent_widget_get(api->inwin)); + elm_object_text_set(t, "Content was unset.
DONE!"); + elm_win_inwin_content_set(api->inwin, t); + evas_object_show(t); + + default: + return; + } +} + +static void +_api_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ /* Will add here a SWITCH command containing code to modify test-object */ + /* in accordance a->state value. */ + api_data *a = data; + char str[128]; + + printf("clicked event on API Button: api_state=<%d>\n", a->state); + set_api_state(a); + a->state++; + sprintf(str, "Next API function (%u)", a->state); + elm_object_text_set(obj, str); + elm_object_disabled_set(obj, a->state == API_STATE_LAST); +} + +static void +_cleanup_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + free(data); +} + +void +test_inwin(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *inwin, *lb, *bxx, *bt; + api_data *api = calloc(1, sizeof(api_data)); + + win = elm_win_util_standard_add("inwin", "InWin"); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api); + + inwin = elm_win_inwin_add(win); + api->inwin = inwin; + evas_object_show(inwin); + + bxx = elm_box_add(inwin); + evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bxx); + + bt = elm_button_add(inwin); + elm_object_text_set(bt, "Next API function"); + evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api); + elm_box_pack_end(bxx, bt); + elm_object_disabled_set(bt, api->state == API_STATE_LAST); + evas_object_show(bt); + + lb = elm_label_add(win); + elm_object_text_set(lb, + "This is an \"inwin\" - a window in a
" + "window. This is handy for quick popups
" + "you want centered, taking over the window
" + "until dismissed somehow. Unlike hovers they
" + "don't hover over their target."); + elm_box_pack_end(bxx, lb); + elm_win_inwin_content_set(inwin, bxx); + evas_object_show(lb); + + evas_object_resize(win, 320, 240); + evas_object_show(win); +} + +void +test_inwin2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *inwin, *lb; + + win = elm_win_util_standard_add("inwin2", "InWin 2"); + elm_win_autodel_set(win, EINA_TRUE); + + inwin = elm_win_inwin_add(win); + elm_object_style_set(inwin, "minimal_vertical"); + evas_object_show(inwin); + + lb = elm_label_add(win); + elm_object_text_set(lb, + "This is an \"inwin\" - a window in a
" + "window. This is handy for quick popups
" + "you want centered, taking over the window
" + "until dismissed somehow. Unlike hovers they
" + "don't hover over their target.
" + "
" + "This inwin style compacts itself vertically
" + "to the size of its contents minimum size."); + elm_win_inwin_content_set(inwin, lb); + evas_object_show(lb); + + evas_object_resize(win, 320, 240); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_label.c b/libraries/elementary/src/bin/test_label.c new file mode 100644 index 0000000..b217407 --- /dev/null +++ b/libraries/elementary/src/bin/test_label.c @@ -0,0 +1,218 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +enum _slide_style +{ + SLIDE_SHORT, + SLIDE_LONG, + SLIDE_BOUNCE, + SLIDE_STYLE_LAST +}; + +void +test_label(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *lb; + + win = elm_win_util_standard_add("label", "Label"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + + lb = elm_label_add(win); + elm_object_text_set(lb, + "This is a small label" + ); + evas_object_size_hint_weight_set(lb, 0.0, 0.0); + evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, lb); + evas_object_show(lb); + + lb = elm_label_add(win); + elm_object_text_set(lb, + "This is a larger label with newlines
" + "to make it bigger, bit it won't expand or wrap
" + "just be a block of text that can't change its
" + "formatting as it's fixed based on text
" + ); + evas_object_size_hint_weight_set(lb, 0.0, 0.0); + evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, lb); + evas_object_show(lb); + + lb = elm_label_add(win); + elm_label_line_wrap_set(lb, ELM_WRAP_CHAR); + elm_object_text_set(lb, + "" + "This is more text designed to line-wrap here as " + "This object is resized horizontally. As it is " + "resized vertically though, nothing should change. " + "The amount of space allocated vertically should " + "change as horizontal size changes." + "" + ); + evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, lb); + evas_object_show(lb); + + lb = elm_label_add(win); + elm_object_text_set(lb, + "This small label set to wrap" + ); + evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, lb); + evas_object_show(lb); + + + evas_object_resize(win, 320, 300); + + evas_object_show(bx); + evas_object_show(win); + elm_win_resize_object_add(win, bx); +} + +static void +_cb_size_radio_changed(void *data, Evas_Object *obj, void *event __UNUSED__) +{ + Evas_Object *lb = (Evas_Object *)data; + int style = elm_radio_value_get((Evas_Object *)obj); + switch (style) + { + case SLIDE_SHORT: + elm_object_style_set(lb, "slide_short"); + break; + + case SLIDE_LONG: + elm_object_style_set(lb, "slide_long"); + break; + + case SLIDE_BOUNCE: + elm_object_style_set(lb, "slide_bounce"); + break; + + default: + return; + } +} + +static void +_change_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *lb = (Evas_Object *)data; + double val = elm_slider_value_get(obj); + elm_label_slide_set(lb, EINA_FALSE); + elm_label_slide_duration_set(lb, val); + elm_label_slide_set(lb, EINA_TRUE); +} + +void +test_label2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *gd, *rect, *lb, *rd, *rdg, *sl; + + win = elm_win_util_standard_add("label2", "Label 2"); + elm_win_autodel_set(win, EINA_TRUE); + + gd = elm_grid_add(win); + elm_grid_size_set(gd, 100, 100); + evas_object_size_hint_weight_set(gd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, gd); + evas_object_show(gd); + + /* Test Label Ellipsis */ + lb = elm_label_add(win); + elm_object_text_set(lb, "Test Label Ellipsis:"); + elm_label_slide_set(lb, EINA_TRUE); + elm_grid_pack(gd, lb, 5, 5, 90, 10); + evas_object_show(lb); + + rect = evas_object_rectangle_add(evas_object_evas_get(win)); + elm_grid_pack(gd, rect, 5, 15, 90, 10); + evas_object_color_set(rect, 255, 125, 125, 255); + evas_object_show(rect); + + lb = elm_label_add(win); + elm_object_text_set(lb, + "This is a label set to ellipsis. " + "If set ellipsis to true and the text doesn't fit " + "in the label an ellipsis(\"...\") will be shown " + "at the end of the widget." + ); + elm_label_ellipsis_set(lb, EINA_TRUE); + elm_grid_pack(gd, lb, 5, 15, 90, 10); + evas_object_show(lb); + + /* Test Label Slide */ + lb = elm_label_add(win); + elm_object_text_set(lb, "Test Label Slide:"); + elm_label_slide_set(lb, EINA_TRUE); + elm_grid_pack(gd, lb, 5, 30, 90, 10); + evas_object_show(lb); + + rect = evas_object_rectangle_add(evas_object_evas_get(win)); + elm_grid_pack(gd, rect, 5, 40, 90, 10); + evas_object_color_set(rect, 255, 125, 125, 255); + evas_object_show(rect); + + lb = elm_label_add(win); + elm_object_style_set(lb, "slide_short"); + elm_object_text_set(lb, + "This is a label set to slide. " + "If set slide to true the text of the label " + "will slide/scroll through the length of label." + "This only works with the themes \"slide_short\", " + "\"slide_long\" and \"slide_bounce\"." + ); + elm_label_slide_set(lb, EINA_TRUE); + elm_grid_pack(gd, lb, 5, 40, 90, 10); + evas_object_show(lb); + + rd = elm_radio_add(win); + elm_radio_state_value_set(rd, SLIDE_SHORT); + elm_object_text_set(rd, "slide_short"); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_smart_callback_add(rd, "changed", _cb_size_radio_changed, lb); + elm_grid_pack(gd, rd, 5, 50, 30, 10); + evas_object_show(rd); + rdg = rd; + + rd = elm_radio_add(win); + elm_radio_state_value_set(rd, SLIDE_LONG); + elm_radio_group_add(rd, rdg); + elm_object_text_set(rd, "slide_long"); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_smart_callback_add(rd, "changed", _cb_size_radio_changed, lb); + elm_grid_pack(gd, rd, 35, 50, 30, 10); + evas_object_show(rd); + + rd = elm_radio_add(win); + elm_radio_state_value_set(rd, SLIDE_BOUNCE); + elm_radio_group_add(rd, rdg); + elm_object_text_set(rd, "slide_bounce"); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_smart_callback_add(rd, "changed", _cb_size_radio_changed, lb); + elm_grid_pack(gd, rd, 65, 50, 30, 10); + evas_object_show(rd); + + sl = elm_slider_add(win); + elm_object_text_set(sl, "Slide Duration"); + elm_slider_unit_format_set(sl, "%1.1f units"); + elm_slider_min_max_set(sl, 1, 20); + elm_slider_value_set(sl, 10); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_smart_callback_add(sl, "changed", _change_cb, lb); + elm_grid_pack(gd, sl, 5, 60, 90, 10); + evas_object_show(sl); + + evas_object_resize(win, 320, 320); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_launcher.c b/libraries/elementary/src/bin/test_launcher.c new file mode 100644 index 0000000..9c8c594 --- /dev/null +++ b/libraries/elementary/src/bin/test_launcher.c @@ -0,0 +1,922 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static void +mode_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + Evas_Object *mb; + Eina_List *mbs, *l; + + mbs = evas_object_data_get(win, "mbs"); + EINA_LIST_FOREACH(mbs, l, mb) + { + if (elm_mapbuf_enabled_get(mb)) + elm_mapbuf_enabled_set(mb, EINA_FALSE); + else + elm_mapbuf_enabled_set(mb, EINA_TRUE); + } +} + +static void +full_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + elm_win_fullscreen_set(win, !elm_win_fullscreen_get(win)); +} + +static void +alpha_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + Evas_Object *mb; + Eina_List *mbs, *l; + + mbs = evas_object_data_get(win, "mbs"); + EINA_LIST_FOREACH(mbs, l, mb) + { + elm_mapbuf_alpha_set(mb, elm_check_state_get(obj)); + } +} + +static void +smooth_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + Evas_Object *mb; + Eina_List *mbs, *l; + + mbs = evas_object_data_get(win, "mbs"); + EINA_LIST_FOREACH(mbs, l, mb) + { + elm_mapbuf_smooth_set(mb, elm_check_state_get(obj)); + } +} + +static void +close_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_del(data); +} + +static Eina_Bool +tim_cb(void *data) +{ + Evas_Object *tb, *sc, *mb; + Eina_List *list, *l; + + evas_object_data_del(data, "timer"); + tb = evas_object_data_get(data, "tb"); + sc = evas_object_data_get(data, "sc"); + elm_object_scroll_freeze_push(sc); + evas_object_data_set(data, "dragging", (void *)(long)(1)); + evas_object_color_set(data, 255, 255, 255, 255); + list = (Eina_List *)evas_object_data_get + (elm_object_top_widget_get(data), "mbs"); + EINA_LIST_FOREACH(list, l, mb) + evas_object_color_set(mb, 128, 128, 128, 128); + elm_table_unpack(tb, data); + return EINA_FALSE; +} + +static void +ic_del_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Ecore_Timer *tim; + + tim = evas_object_data_get(obj, "timer"); + if (tim) + { + evas_object_data_del(obj, "timer"); + ecore_timer_del(tim); + } +} + +static void +ic_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Down *ev = event_info; + Ecore_Timer *tim; + Evas_Coord x, y, w, h; + + evas_object_color_set(data, 128, 0, 0, 128); + + tim = evas_object_data_get(obj, "timer"); + if (tim) evas_object_data_del(obj, "timer"); + tim = ecore_timer_add(1.0, tim_cb, obj); + evas_object_data_set(obj, "timer", tim); + + evas_object_geometry_get(data, &x, &y, &w, &h); + evas_object_data_set(obj, "x", (void *)(long)(ev->canvas.x)); + evas_object_data_set(obj, "y", (void *)(long)(ev->canvas.y)); + evas_object_data_set(obj, "px", (void *)(long)(x)); + evas_object_data_set(obj, "py", (void *)(long)(y)); + + if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) + { + printf("double click %p\n", obj); + } +} + +static void +ic_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Up *ev = event_info; + Ecore_Timer *tim; + + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; + evas_object_color_set(data, 255, 255, 255, 255); + tim = evas_object_data_get(obj, "timer"); + if (tim) + { + evas_object_data_del(obj, "timer"); + ecore_timer_del(tim); + } + if (evas_object_data_get(obj, "dragging")) + { + Evas_Object *tb, *sc, *mb; + Eina_List *list, *l; + int tbx, tby; + + evas_object_data_del(obj, "dragging"); + tb = evas_object_data_get(obj, "tb"); + sc = evas_object_data_get(obj, "sc"); + elm_object_scroll_freeze_pop(sc); + tbx = (int)(long)evas_object_data_get(obj, "tbx"); + tby = (int)(long)evas_object_data_get(obj, "tby"); + elm_table_pack(tb, obj, tbx, tby, 1, 1); + list = (Eina_List *)evas_object_data_get + (elm_object_top_widget_get(obj), "mbs"); + EINA_LIST_FOREACH(list, l, mb) + evas_object_color_set(mb, 255, 255, 255, 255); + } +} + +static void +ic_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Move *ev = event_info; + if (evas_object_data_get(obj, "dragging")) + { + Evas_Coord x, y, px, py; + + x = (Evas_Coord)(long)evas_object_data_get(obj, "x"); + y = (Evas_Coord)(long)evas_object_data_get(obj, "y"); + px = (Evas_Coord)(long)evas_object_data_get(obj, "px"); + py = (Evas_Coord)(long)evas_object_data_get(obj, "py"); + evas_object_move(obj, + px + ev->cur.canvas.x - x, + py + ev->cur.canvas.y - y); + } + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) + { + Ecore_Timer *tim; + + tim = evas_object_data_get(obj, "timer"); + if (tim) + { + evas_object_data_del(obj, "timer"); + ecore_timer_del(tim); + } + evas_object_color_set(data, 255, 255, 255, 255); + return; + } +} + +void +test_launcher(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bg, *sc, *tb, *pad, *bt, *ic, *lb, *tb2, *mb, *ck, *bx, *bx2; + int i, j, k, n, m; + char buf[PATH_MAX]; + const char *names[] = + { + "Hello", "World", "Spam", "Egg", + "Ham", "Good", "Bad", "Milk", + "Smell", "Of", "Sky", "Gold", + "Hole", "Pig", "And", "Calm" + }; + Eina_List *mbs = NULL; + + win = elm_win_add(NULL, "launcher", ELM_WIN_BASIC); + elm_win_title_set(win, "Launcher"); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + snprintf(buf, sizeof(buf), "%s/images/sky_04.jpg", elm_app_data_dir_get()); + elm_bg_file_set(bg, buf, NULL); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + bx = elm_box_add(win); + elm_box_homogeneous_set(bx, EINA_TRUE); + elm_box_horizontal_set(bx, EINA_TRUE); + + sc = elm_scroller_add(win); + elm_scroller_bounce_set(sc, EINA_TRUE, EINA_FALSE); + elm_scroller_policy_set(sc, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_fill_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL); + + n = 0; m = 0; + for (k = 0 ; k < 8; k++) + { + tb = elm_table_add(win); + evas_object_size_hint_weight_set(tb, 0.0, 0.0); + evas_object_size_hint_align_set(tb, 0.5, 0.5); + + pad = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_size_hint_min_set(pad, 470, 4); + evas_object_size_hint_weight_set(pad, 0.0, 0.0); + evas_object_size_hint_align_set(pad, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, pad, 1, 0, 5, 1); + + pad = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_size_hint_min_set(pad, 470, 4); + evas_object_size_hint_weight_set(pad, 0.0, 0.0); + evas_object_size_hint_align_set(pad, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, pad, 1, 11, 5, 1); + + pad = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_size_hint_min_set(pad, 4, 4); + evas_object_size_hint_weight_set(pad, 0.0, 0.0); + evas_object_size_hint_align_set(pad, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, pad, 0, 1, 1, 10); + + pad = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_size_hint_min_set(pad, 4, 4); + evas_object_size_hint_weight_set(pad, 0.0, 0.0); + evas_object_size_hint_align_set(pad, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, pad, 6, 1, 1, 10); + + mb = elm_mapbuf_add(win); + elm_object_content_set(mb, tb); + evas_object_show(tb); + + for (j = 0; j < 5; j++) + { + for (i = 0; i < 5; i++) + { + ic = elm_icon_add(win); + elm_object_scale_set(ic, 0.5); + snprintf(buf, sizeof(buf), "%s/images/icon_%02i.png", elm_app_data_dir_get(), n); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ic, 0.5, 0.5); + elm_table_pack(tb, ic, 1 + i, 1 + (j * 2), 1, 1); + evas_object_show(ic); + + lb = elm_label_add(win); + elm_object_style_set(lb, "marker"); + elm_object_text_set(lb, names[m]); + evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(lb, 0.5, 0.5); + elm_table_pack(tb, lb, 1 + i, 1 + (j * 2) + 1, 1, 1); + evas_object_show(lb); + + evas_object_event_callback_add(ic, EVAS_CALLBACK_DEL, ic_del_cb, ic); + + evas_object_event_callback_add(ic, EVAS_CALLBACK_MOUSE_DOWN, ic_down_cb, ic); + evas_object_event_callback_add(ic, EVAS_CALLBACK_MOUSE_UP, ic_up_cb, ic); + evas_object_event_callback_add(ic, EVAS_CALLBACK_MOUSE_MOVE, ic_move_cb, ic); + + evas_object_data_set(ic, "lb", lb); + evas_object_data_set(ic, "tb", tb); + evas_object_data_set(ic, "sc", sc); + evas_object_data_set(ic, "bx", bx); + evas_object_data_set(ic, "mb", mb); + evas_object_data_set(ic, "tbx", (void *)(long)(1 + i)); + evas_object_data_set(ic, "tby", (void *)(long)(1 + (j * 2))); + + n++; if (n > 23) n = 0; + m++; if (m > 15) m = 0; + } + } + + elm_box_pack_end(bx, mb); + evas_object_show(mb); + + mbs = eina_list_append(mbs, mb); + } + + // fixme: free mbs + evas_object_data_set(win, "mbs", mbs); + + bx2 = elm_box_add(win); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_horizontal_set(bx2, EINA_FALSE); + elm_win_resize_object_add(win, bx2); + evas_object_show(bx2); + + elm_object_content_set(sc, bx); + evas_object_show(bx); + + elm_scroller_page_relative_set(sc, 1.0, 1.0); + evas_object_show(sc); + + tb2 = elm_table_add(win); + evas_object_size_hint_weight_set(tb2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_fill_set(tb2, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx2, tb2); + + elm_box_pack_end(bx2, sc); + + ck = elm_check_add(win); + elm_object_text_set(ck, "Map"); + elm_check_state_set(ck, EINA_FALSE); + evas_object_smart_callback_add(ck, "changed", mode_cb, win); + evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ck, 0.05, 0.99); + elm_table_pack(tb2, ck, 0, 0, 1, 1); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_object_text_set(ck, "A"); + elm_check_state_set(ck, EINA_TRUE); + evas_object_smart_callback_add(ck, "changed", alpha_cb, win); + evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ck, 0.20, 0.99); + elm_table_pack(tb2, ck, 1, 0, 1, 1); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_object_text_set(ck, "Smo"); + elm_check_state_set(ck, EINA_TRUE); + evas_object_smart_callback_add(ck, "changed", smooth_cb, win); + evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ck, 0.40, 0.99); + elm_table_pack(tb2, ck, 2, 0, 1, 1); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_object_text_set(ck, "FS"); + elm_check_state_set(ck, EINA_FALSE); + evas_object_smart_callback_add(ck, "changed", full_cb, win); + evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ck, 0.5, 0.99); + elm_table_pack(tb2, ck, 3, 0, 1, 1); + evas_object_show(ck); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Close"); + evas_object_smart_callback_add(bt, "clicked", close_cb, win); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, 0.95, 0.99); + elm_table_pack(tb2, bt, 4, 0, 1, 1); + evas_object_show(bt); + + evas_object_show(tb2); + + evas_object_resize(win, 480, 800); + evas_object_show(win); +} + +void +test_launcher2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bg, *sc, *bt, *tb2, *mb, *ck, *bx, *ly; + int k; + char buf[PATH_MAX]; + Eina_List *mbs = NULL; + + win = elm_win_add(NULL, "launcher2", ELM_WIN_BASIC); + elm_win_title_set(win, "Launcher 2"); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + snprintf(buf, sizeof(buf), "%s/images/sky_03.jpg", elm_app_data_dir_get()); + elm_bg_file_set(bg, buf, NULL); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + bx = elm_box_add(win); + elm_box_homogeneous_set(bx, EINA_TRUE); + elm_box_horizontal_set(bx, EINA_TRUE); + + for (k = 0 ; k < 8; k++) + { + ly = elm_layout_add(win); + snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get()); + elm_layout_file_set(ly, buf, "layout"); + evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 1"); + elm_object_part_content_set(ly, "element1", bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 2"); + elm_object_part_content_set(ly, "element2", bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 3"); + elm_object_part_content_set(ly, "element3", bt); + evas_object_show(bt); + + mb = elm_mapbuf_add(win); + elm_object_content_set(mb, ly); + evas_object_show(ly); + + elm_box_pack_end(bx, mb); + evas_object_show(mb); + + mbs = eina_list_append(mbs, mb); + } + + // fixme: free mbs + evas_object_data_set(win, "mbs", mbs); + + sc = elm_scroller_add(win); + elm_scroller_bounce_set(sc, EINA_TRUE, EINA_FALSE); + elm_scroller_policy_set(sc, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, sc); + + elm_object_content_set(sc, bx); + evas_object_show(bx); + + elm_scroller_page_relative_set(sc, 1.0, 1.0); + evas_object_show(sc); + + tb2 = elm_table_add(win); + evas_object_size_hint_weight_set(tb2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, tb2); + + ck = elm_check_add(win); + elm_object_text_set(ck, "Map"); + elm_check_state_set(ck, EINA_FALSE); + evas_object_smart_callback_add(ck, "changed", mode_cb, win); + evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ck, 0.05, 0.99); + elm_table_pack(tb2, ck, 0, 0, 1, 1); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_object_text_set(ck, "A"); + elm_check_state_set(ck, EINA_TRUE); + evas_object_smart_callback_add(ck, "changed", alpha_cb, win); + evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ck, 0.20, 0.99); + elm_table_pack(tb2, ck, 1, 0, 1, 1); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_object_text_set(ck, "Smo"); + elm_check_state_set(ck, EINA_TRUE); + evas_object_smart_callback_add(ck, "changed", smooth_cb, win); + evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ck, 0.40, 0.99); + elm_table_pack(tb2, ck, 2, 0, 1, 1); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_object_text_set(ck, "FS"); + elm_check_state_set(ck, EINA_FALSE); + evas_object_smart_callback_add(ck, "changed", full_cb, win); + evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ck, 0.5, 0.99); + elm_table_pack(tb2, ck, 3, 0, 1, 1); + evas_object_show(ck); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Close"); + evas_object_smart_callback_add(bt, "clicked", close_cb, win); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, 0.95, 0.99); + elm_table_pack(tb2, bt, 4, 0, 1, 1); + evas_object_show(bt); + + evas_object_show(tb2); + + evas_object_resize(win, 480, 800); + evas_object_show(win); +} + +static void +l3_mode_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + Evas_Object *mb; + Eina_List *mbs, *l; + + mbs = evas_object_data_get(win, "mbs"); + EINA_LIST_FOREACH(mbs, l, mb) + { + if (elm_mapbuf_enabled_get(mb)) + elm_mapbuf_enabled_set(mb, EINA_FALSE); + else + elm_mapbuf_enabled_set(mb, 1); + } +} + +static void +l3_full_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + elm_win_fullscreen_set(win, !elm_win_fullscreen_get(win)); +} + +static void +l3_alpha_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + Evas_Object *mb; + Eina_List *mbs, *l; + + mbs = evas_object_data_get(win, "mbs"); + EINA_LIST_FOREACH(mbs, l, mb) + { + elm_mapbuf_alpha_set(mb, elm_check_state_get(obj)); + } +} + +static void +l3_smooth_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + Evas_Object *mb; + Eina_List *mbs, *l; + + mbs = evas_object_data_get(win, "mbs"); + EINA_LIST_FOREACH(mbs, l, mb) + { + elm_mapbuf_smooth_set(mb, elm_check_state_get(obj)); + } +} + +static void +l3_hidden_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + Evas_Object *mb; + Eina_List *mbs, *l; + + mbs = evas_object_data_get(win, "mbs"); + EINA_LIST_FOREACH(mbs, l, mb) + { + if (evas_object_visible_get(mb)) evas_object_hide(mb); + else evas_object_show(mb); + } +} + +static void +l3_close_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_del(data); +} + +static Eina_Bool +l3_tim_cb(void *data) +{ + Evas_Object *ly, *ly2, *sc, *mb; + Eina_List *list, *l; + char buf[256]; + int slx, sly; + + evas_object_data_del(data, "timer"); + ly = evas_object_data_get(data, "ly"); + ly2 = evas_object_data_get(data, "ly2"); + sc = evas_object_data_get(data, "sc"); + elm_object_scroll_freeze_push(sc); + evas_object_data_set(data, "dragging", (void *)(long)1); + evas_object_color_set(data, 255, 255, 255, 255); + list = (Eina_List *)evas_object_data_get + (elm_object_top_widget_get(data), "mbs"); + EINA_LIST_FOREACH(list, l, mb) + evas_object_color_set(mb, 128, 128, 128, 128); + slx = (int)(long)evas_object_data_get(data, "slx"); + sly = (int)(long)evas_object_data_get(data, "sly"); + snprintf(buf, sizeof(buf), "slot.%i.%i", slx, sly); + elm_object_part_content_unset(ly, buf); + edje_object_signal_emit(elm_layout_edje_get(ly2), "drag", "app"); + return EINA_FALSE; +} + +static void +l3_ic_del_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Ecore_Timer *tim; + + tim = evas_object_data_get(obj, "timer"); + if (tim) + { + evas_object_data_del(obj, "timer"); + ecore_timer_del(tim); + } +} + +static void +l3_ic_down_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Down *ev = event_info; + Ecore_Timer *tim; + Evas_Coord x, y, w, h; + Evas_Object *ly2; + + tim = evas_object_data_get(obj, "timer"); + if (tim) evas_object_data_del(obj, "timer"); + tim = ecore_timer_add(1.0, l3_tim_cb, obj); + evas_object_data_set(obj, "timer", tim); + + ly2 = evas_object_data_get(obj, "ly2"); + evas_object_geometry_get(ly2, &x, &y, &w, &h); + evas_object_data_set(obj, "x", (void *)(long)(ev->canvas.x)); + evas_object_data_set(obj, "y", (void *)(long)(ev->canvas.y)); + evas_object_data_set(obj, "px", (void *)(long)(x)); + evas_object_data_set(obj, "py", (void *)(long)(y)); + + edje_object_signal_emit(elm_layout_edje_get(ly2), "click", "app"); + + if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) + { + printf("double click %p\n", obj); + } +} + +static void +l3_ic_up_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Up *ev = event_info; + Ecore_Timer *tim; + Evas_Object *ly2; + + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; + + ly2 = evas_object_data_get(obj, "ly2"); + tim = evas_object_data_get(obj, "timer"); + if (tim) + { + evas_object_data_del(obj, "timer"); + ecore_timer_del(tim); + } + if (evas_object_data_get(obj, "dragging")) + { + Evas_Object *ly, *sc, *mb; + Eina_List *list, *l; + int slx, sly; + char buf[256]; + + evas_object_data_del(obj, "dragging"); + ly = evas_object_data_get(obj, "ly"); + sc = evas_object_data_get(obj, "sc"); + elm_object_scroll_freeze_pop(sc); + slx = (int)(long)evas_object_data_get(obj, "slx"); + sly = (int)(long)evas_object_data_get(obj, "sly"); + snprintf(buf, sizeof(buf), "slot.%i.%i", slx, sly); + elm_object_part_content_set(ly, buf, ly2); + list = (Eina_List *)evas_object_data_get + (elm_object_top_widget_get(obj), "mbs"); + EINA_LIST_FOREACH(list, l, mb) + evas_object_color_set(mb, 255, 255, 255, 255); + edje_object_signal_emit(elm_layout_edje_get(ly2), "drop", "app"); + } + else + edje_object_signal_emit(elm_layout_edje_get(ly2), "unclick", "app"); +} + +static void +l3_ic_move_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Move *ev = event_info; + Evas_Object *ly2; + + ly2 = evas_object_data_get(obj, "ly2"); + + if (evas_object_data_get(obj, "dragging")) + { + Evas_Coord x, y, px, py; + + x = (Evas_Coord)(long)evas_object_data_get(obj, "x"); + y = (Evas_Coord)(long)evas_object_data_get(obj, "y"); + px = (Evas_Coord)(long)evas_object_data_get(obj, "px"); + py = (Evas_Coord)(long)evas_object_data_get(obj, "py"); + evas_object_move(ly2, + px + ev->cur.canvas.x - x, + py + ev->cur.canvas.y - y); + } + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) + { + Ecore_Timer *tim; + + tim = evas_object_data_get(obj, "timer"); + if (tim) + { + evas_object_data_del(obj, "timer"); + ecore_timer_del(tim); + } + edje_object_signal_emit(elm_layout_edje_get(ly2), "cancel", "app"); + return; + } +} + +void +test_launcher3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bg, *sc, *tb, *pad, *bt, *ic, *tb2, *mb, *ck, *bx, *bx2, *ly, *ly2; + int i, j, k, n, m; + char buf[PATH_MAX]; + const char *names[] = + { + "Hello", "World", "Spam", "Egg", + "Ham", "Good", "Bad", "Milk", + "Smell", "Of", "Sky", "Gold", + "Hole", "Pig", "And", "Calm" + }; + Eina_List *mbs = NULL; + + win = elm_win_add(NULL, "launcher", ELM_WIN_BASIC); + elm_win_title_set(win, "Launcher"); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + snprintf(buf, sizeof(buf), "%s/images/sky_04.jpg", elm_app_data_dir_get()); + elm_bg_file_set(bg, buf, NULL); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_homogeneous_set(bx, EINA_TRUE); + elm_box_horizontal_set(bx, EINA_TRUE); + + sc = elm_scroller_add(win); + elm_scroller_bounce_set(sc, EINA_TRUE, EINA_FALSE); + elm_scroller_policy_set(sc, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_fill_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL); + + n = 0; m = 0; + for (k = 0 ; k < 8; k++) + { + tb = elm_table_add(win); + evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL); + + pad = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_size_hint_min_set(pad, 450, 10); + elm_table_pack(tb, pad, 1, 0, 1, 1); + + pad = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_size_hint_min_set(pad, 450, 10); + elm_table_pack(tb, pad, 1, 2, 1, 1); + + pad = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_size_hint_min_set(pad, 10, 450); + elm_table_pack(tb, pad, 0, 1, 1, 1); + + pad = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_size_hint_min_set(pad, 10, 450); + elm_table_pack(tb, pad, 2, 1, 1, 1); + + mb = elm_mapbuf_add(win); + mbs = eina_list_append(mbs, mb); + + elm_object_content_set(mb, tb); + evas_object_show(tb); + elm_box_pack_end(bx, mb); + evas_object_show(mb); + + ly = elm_layout_add(win); + snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get()); + elm_layout_file_set(ly, buf, "launcher_page"); + evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, ly, 1, 1, 1, 1); + evas_object_show(ly); + + for (j = 0; j < 4; j++) + { + for (i = 0; i < 4; i++) + { + ly2 = elm_layout_add(win); + snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get()); + elm_layout_file_set(ly2, buf, "launcher_icon"); + evas_object_size_hint_weight_set(ly2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ly2, EVAS_HINT_FILL, EVAS_HINT_FILL); + edje_object_part_text_set(elm_layout_edje_get(ly2), "label", names[m]); + + ic = elm_icon_add(win); + elm_object_scale_set(ic, 0.5); + snprintf(buf, sizeof(buf), "%s/images/icon_%02i.png", elm_app_data_dir_get(), n); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ic, 0.5, 0.5); + elm_object_part_content_set(ly2, "slot", ic); + evas_object_show(ic); + + evas_object_event_callback_add(ic, EVAS_CALLBACK_DEL, l3_ic_del_cb, ic); + + evas_object_event_callback_add(ic, EVAS_CALLBACK_MOUSE_DOWN, l3_ic_down_cb, ic); + evas_object_event_callback_add(ic, EVAS_CALLBACK_MOUSE_UP, l3_ic_up_cb, ic); + evas_object_event_callback_add(ic, EVAS_CALLBACK_MOUSE_MOVE, l3_ic_move_cb, ic); + + evas_object_data_set(ic, "ly", ly); + evas_object_data_set(ic, "ly2", ly2); + evas_object_data_set(ic, "sc", sc); + evas_object_data_set(ic, "bx", bx); + evas_object_data_set(ic, "mb", mb); + evas_object_data_set(ic, "slx", (void *)(long)(i)); + evas_object_data_set(ic, "sly", (void *)(long)(j)); + + snprintf(buf, sizeof(buf), "slot.%i.%i", i, j); + elm_object_part_content_set(ly, buf, ly2); + evas_object_show(ly2); + + n++; if (n > 23) n = 0; + m++; if (m > 15) m = 0; + } + } + } + + // fixme: free mbs + evas_object_data_set(win, "mbs", mbs); + + bx2 = elm_box_add(win); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_horizontal_set(bx2, EINA_FALSE); + elm_win_resize_object_add(win, bx2); + evas_object_show(bx2); + + elm_object_content_set(sc, bx); + evas_object_show(bx); + + elm_scroller_page_relative_set(sc, 1.0, 1.0); + evas_object_show(sc); + + tb2 = elm_table_add(win); + evas_object_size_hint_weight_set(tb2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_fill_set(tb2, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx2, tb2); + + elm_box_pack_end(bx2, sc); + + ck = elm_check_add(win); + elm_object_text_set(ck, "Map"); + elm_check_state_set(ck, EINA_FALSE); + evas_object_smart_callback_add(ck, "changed", l3_mode_cb, win); + evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ck, 0.05, 0.99); + elm_table_pack(tb2, ck, 0, 0, 1, 1); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_object_text_set(ck, "A"); + elm_check_state_set(ck, 1); + evas_object_smart_callback_add(ck, "changed", l3_alpha_cb, win); + evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ck, 0.20, 0.99); + elm_table_pack(tb2, ck, 1, 0, 1, 1); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_object_text_set(ck, "Smo"); + elm_check_state_set(ck, 1); + evas_object_smart_callback_add(ck, "changed", l3_smooth_cb, win); + evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ck, 0.40, 0.99); + elm_table_pack(tb2, ck, 2, 0, 1, 1); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_object_text_set(ck, "FS"); + elm_check_state_set(ck, EINA_FALSE); + evas_object_smart_callback_add(ck, "changed", l3_full_cb, win); + evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ck, 0.5, 0.99); + elm_table_pack(tb2, ck, 3, 0, 1, 1); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_object_text_set(ck, "Hid"); + elm_check_state_set(ck, EINA_FALSE); + evas_object_smart_callback_add(ck, "changed", l3_hidden_cb, win); + evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ck, 0.5, 0.99); + elm_table_pack(tb2, ck, 4, 0, 1, 1); + evas_object_show(ck); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Close"); + evas_object_smart_callback_add(bt, "clicked", l3_close_cb, win); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, 0.95, 0.99); + elm_table_pack(tb2, bt, 5, 0, 1, 1); + evas_object_show(bt); + + evas_object_show(tb2); + + evas_object_resize(win, 480, 800); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_layout.c b/libraries/elementary/src/bin/test_layout.c new file mode 100644 index 0000000..90826cb --- /dev/null +++ b/libraries/elementary/src/bin/test_layout.c @@ -0,0 +1,257 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +#include + +struct _api_data +{ + unsigned int state; /* What state we are testing */ + Evas_Object *box_layout; + Evas_Object *table_layout; + Evas_Object *ref; + Evas_Object *ref2; +}; +typedef struct _api_data api_data; + +enum _api_state +{ + LAYOUT_BOX_INSERT_AT, + LAYOUT_BOX_INSERT_BEFORE, + LAYOUT_BOX_PREPEND, + LAYOUT_BOX_REMOVE, + LAYOUT_BOX_REMOVE_ALL, + LAYOUT_TABLE_UNPACK, + LAYOUT_TABLE_CLEAR, + API_STATE_LAST +}; + +typedef enum _api_state api_state; +static void +_clicked_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + elm_object_part_text_set(data, "text", elm_object_text_get(obj)); +} + +void +test_layout(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *box, *ly, *bt; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("layout", "Layout"); + elm_win_autodel_set(win, EINA_TRUE); + + box = elm_box_add(win); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, box); + evas_object_show(box); + + ly = elm_layout_add(win); + elm_layout_theme_set(ly, "layout", "application", "titlebar"); + elm_object_text_set(ly, "Some title"); + evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, ly); + evas_object_show(ly); + + bt = elm_icon_add(win); + elm_icon_standard_set(bt, "chat"); + evas_object_size_hint_min_set(bt, 20, 20); + elm_layout_icon_set(ly, bt); + + bt = elm_icon_add(win); + elm_icon_standard_set(bt, "close"); + evas_object_size_hint_min_set(bt, 20, 20); + elm_layout_end_set(ly, bt); + + ly = elm_layout_add(win); + snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get()); + elm_layout_file_set(ly, buf, "layout"); + evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(box, ly); + //elm_win_resize_object_add(win, ly); + evas_object_show(ly); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 1"); + elm_object_part_content_set(ly, "element1", bt); + evas_object_smart_callback_add(bt, "clicked", _clicked_cb, ly); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 2"); + elm_object_part_content_set(ly, "element2", bt); + evas_object_smart_callback_add(bt, "clicked", _clicked_cb, ly); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 3"); + elm_object_part_content_set(ly, "element3", bt); + evas_object_smart_callback_add(bt, "clicked", _clicked_cb, ly); + evas_object_show(bt); + + elm_layout_part_cursor_set(ly, "text", ELM_CURSOR_WATCH); + + evas_object_show(win); +} + +static void +set_api_state(api_data *api) +{ + Evas_Object *box_layout = api->box_layout; + Evas_Object *table_layout = api->table_layout; + Evas_Object *obj; + + /* use elm_box_children_get() to get list of children */ + switch (api->state) + { /* Put all api-changes under switch */ + case LAYOUT_BOX_INSERT_AT: + { + obj = elm_label_add(box_layout); + elm_object_text_set(obj, "elm_layout_box_insert_at(); is called"); + evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_layout_box_insert_at(box_layout, "elm.box.content", obj, 0); + evas_object_show(obj); + break; + } + + case LAYOUT_BOX_INSERT_BEFORE: + { + obj = elm_label_add(box_layout); + elm_object_text_set(obj, "elm_layout_box_insert_before(); is called"); + evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_layout_box_insert_before(box_layout, "elm.box.content", + obj, api->ref); + evas_object_show(obj); + break; + } + + case LAYOUT_BOX_PREPEND: + { + obj = elm_label_add(box_layout); + elm_object_text_set(obj, "elm_layout_box_prepend(); is called"); + evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_layout_box_prepend(box_layout, "elm.box.content", obj); + evas_object_show(obj); + break; + } + + case LAYOUT_BOX_REMOVE: + { + elm_layout_box_remove(box_layout, "elm.box.content", api->ref); + evas_object_del(api->ref); + break; + } + + case LAYOUT_BOX_REMOVE_ALL: + { + elm_layout_box_remove_all(box_layout, "elm.box.content", EINA_TRUE); + break; + } + + case LAYOUT_TABLE_UNPACK: + { + elm_layout_table_unpack(table_layout, "elm.table.content", api->ref2); + evas_object_del(api->ref2); + break; + } + + case LAYOUT_TABLE_CLEAR: + { + elm_layout_table_clear(table_layout, "elm.table.content", EINA_TRUE); + break; + } + + default: return; + } +} + +static void +_api_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ /* Will add here a SWITCH command containing code to modify test-object */ + /* in accordance a->state value. */ + api_data *a = data; + char str[128]; + + printf("clicked event on API Button: api_state=<%d>\n", a->state); + set_api_state(a); + a->state++; + sprintf(str, "Next API function (%u)", a->state); + elm_object_text_set(obj, str); + elm_object_disabled_set(obj, a->state == API_STATE_LAST); +} + +static void +_cleanup_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + free(data); +} + +void +test_layout2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *box, *bt, *ly, *lb; + api_data *api = calloc(1, sizeof(api_data)); + + win = elm_win_util_standard_add("layout2", "Layout 2"); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api); + + box = elm_box_add(win); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, box); + evas_object_show(box); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Next API function"); + evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, + (void *)api); + elm_box_pack_end(box, bt); + elm_object_disabled_set(bt, api->state == API_STATE_LAST); + evas_object_show(bt); + + /* Layout Box Test */ + api->box_layout = ly = elm_layout_add(win); + elm_layout_theme_set(ly, "layout", "application", "toolbar-vbox"); + evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, ly); + evas_object_show(ly); + + api->ref = lb = elm_label_add(win); + elm_object_text_set(lb, "This is a label for the box content"); + evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(lb); + + elm_layout_box_append(ly, "elm.box.content", lb); + + /* Layout Table Test */ + api->table_layout = ly = elm_layout_add(win); + elm_layout_theme_set(ly, "layout", "application", "toolbar-table"); + evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, ly); + evas_object_show(ly); + + lb = elm_label_add(win); + elm_object_text_set(lb, "This is a label for the table content"); + evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(lb); + elm_layout_table_pack(ly, "elm.table.content", lb, 0, 0, 1, 1); + + api->ref2 = lb = elm_label_add(win); + elm_object_text_set(lb, "col = 0, row = 1"); + evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(lb); + elm_layout_table_pack(ly, "elm.table.content", lb, 0, 1, 1, 1); + + evas_object_resize(win, 320, 320); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_list.c b/libraries/elementary/src/bin/test_list.c new file mode 100644 index 0000000..b057815 --- /dev/null +++ b/libraries/elementary/src/bin/test_list.c @@ -0,0 +1,1178 @@ +#include "test.h" +#include +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +struct _api_data +{ + unsigned int state; /* What state we are testing */ + void *list; +}; +typedef struct _api_data api_data; + +enum _api_state +{ + ITEM_PREPEND, /* 0 */ + ITEM_INSERT_BEFORE, /* 1 */ + ITEM_INSERT_AFTER, /* 2 */ + ITEM_SEPARATOR_SET, /* 3 */ + LIST_ITEM_DEL, /* 4 */ + SCROLLER_POLICY_SET_ON, + SCROLLER_POLICY_SET_OFF, /* Back to AUTO next */ + TOOLTIP_TEXT_SET, /* 7 */ + TOOLTIP_UNSET, /* 8 */ + ITEM_CURSOR_SET, /* 9 */ + ITEM_CURSOR_STYLE_SET, + DISABLED_SET, /* 11 */ + MODE_SET_COMPRESS, /* 12 */ + MODE_SET_LIMIT, /* 13 */ + MODE_SET_EXPAND, /* 14 */ + HORIZONTAL_SET, /* 15 */ + BOUNCE_SET, /* 16 */ + LIST_CLEAR, /* 17 */ + API_STATE_LAST +}; +typedef enum _api_state api_state; + +static void +set_api_state(api_data *api) +{ +/** HOW TO TEST ************************ +0 ITEM PREPEND +Scroll to end +1 INSERT BEFORE +Scroll to end +2 INSERT AFTER +3 INSERT SEPERATOR +Scroll to end +4 ITEM DEL +5 POLICY ON, BOUNCE_SET(TRUE, TRUE) +6 POLICY OFF +Scroll to end +7 TOOLTIP last-item +8 Cancel tootip +9 Curosr set on last item +10 Cursor style set last item +11 DISABLE last item +12 MODE COMPRESS +13 MODE LIMIT +14 MODE EXPAND +15 HORIZ SET +16 VERT MODE, BOUNCE(TRUE, FALSE) try to bounce on Y-axis +17 List clear +*** HOW TO TEST ***********************/ + Evas_Object *li = api->list; + + switch(api->state) + { /* Put all api-changes under switch */ + case ITEM_PREPEND: /* 0 */ + { + const Eina_List *items = elm_list_items_get(li); + elm_list_item_prepend(li, "PREPEND", NULL, NULL, NULL, NULL); + elm_list_go(li); + elm_list_item_bring_in(eina_list_nth(items, 0)); + } + break; + + case ITEM_INSERT_BEFORE: /* 1 */ + { + const Eina_List *items = elm_list_items_get(li); + if (eina_list_count(items)) + { + elm_list_item_insert_before(li, + eina_list_nth(items, eina_list_count(items)-1), + "1-before-last", NULL, NULL, NULL, NULL); + elm_list_go(li); + elm_list_item_bring_in(eina_list_data_get(eina_list_last(items))); + } + } + break; + + case ITEM_INSERT_AFTER: /* 2 */ + { + const Eina_List *items = elm_list_items_get(li); + if (eina_list_count(items)) + { + elm_list_item_insert_after(li, + eina_list_nth(items, eina_list_count(items)-2), + "insert-after", NULL, NULL, NULL, NULL); + elm_list_go(li); + elm_list_item_bring_in(eina_list_data_get(eina_list_last(items))); + } + } + break; + + case ITEM_SEPARATOR_SET: /* 3 */ + { + const Eina_List *items = elm_list_items_get(li); + if (eina_list_count(items)) + { + elm_list_item_separator_set(eina_list_nth(items, eina_list_count(items)-3), EINA_TRUE); + elm_list_item_bring_in(eina_list_nth(items, eina_list_count(items)-3)); + elm_list_go(li); + } + } + break; + + case LIST_ITEM_DEL: /* 4 */ + { + const Eina_List *items = elm_list_items_get(li); + if (eina_list_count(items)) + { + elm_object_item_del(eina_list_data_get(eina_list_last(items))); + } + } + break; + + case SCROLLER_POLICY_SET_ON: /* 5 */ + elm_list_bounce_set(li, EINA_TRUE, EINA_TRUE); + elm_list_scroller_policy_set(li, ELM_SCROLLER_POLICY_ON, ELM_SCROLLER_POLICY_ON); + break; + + case SCROLLER_POLICY_SET_OFF: /* Back to AUTO next (6) */ + elm_list_scroller_policy_set(li, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + break; + + case TOOLTIP_TEXT_SET: /* 7 */ + { + const Eina_List *items = elm_list_items_get(li); + if (eina_list_count(items)) + { + elm_object_item_tooltip_text_set(eina_list_data_get(eina_list_last(items)), "Tooltip set from API"); + } + elm_list_scroller_policy_set(li, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_AUTO); + } + break; + + case TOOLTIP_UNSET: /* 8 */ + { + const Eina_List *items = elm_list_items_get(li); + if (eina_list_count(items)) + { + elm_object_item_tooltip_unset(eina_list_data_get(eina_list_last(items))); + } + } + break; + + case ITEM_CURSOR_SET: /* 9 */ + { + const Eina_List *items = elm_list_items_get(li); + if (eina_list_count(items)) + { + elm_object_item_cursor_set(eina_list_data_get(eina_list_last(items)), ELM_CURSOR_HAND2); + } + } + break; + + case ITEM_CURSOR_STYLE_SET: /* 10 */ + { + const Eina_List *items = elm_list_items_get(li); + if (eina_list_count(items)) + { + elm_object_item_cursor_style_set(eina_list_data_get(eina_list_last(items)), "transparent"); + } + } + break; + + case DISABLED_SET: /* 11 */ + { + const Eina_List *items = elm_list_items_get(li); + if (eina_list_count(items)) + { + elm_object_item_disabled_set(eina_list_data_get(eina_list_last(items)), EINA_TRUE); + } + } + break; + + case MODE_SET_COMPRESS: /* 12 */ + elm_list_mode_set(li, ELM_LIST_COMPRESS); + break; + + case MODE_SET_LIMIT: /* 13 */ + elm_list_mode_set(li, ELM_LIST_LIMIT); + break; + + case MODE_SET_EXPAND: /* 14 */ + elm_list_mode_set(li, ELM_LIST_EXPAND); + break; + + case HORIZONTAL_SET: /* 15 */ + elm_list_mode_set(li, ELM_LIST_SCROLL); /* return to default mode */ + elm_list_horizontal_set(li, EINA_TRUE); + break; + + case BOUNCE_SET: /* 16 */ + elm_list_horizontal_set(li, EINA_FALSE); + elm_list_bounce_set(li, EINA_TRUE, EINA_FALSE); + break; + + case LIST_CLEAR: /* 17 */ + elm_list_clear(li); + break; + + case API_STATE_LAST: + break; + + default: + return; + } +} + +static void +_api_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ /* Will add here a SWITCH command containing code to modify test-object */ + /* in accordance a->state value. */ + api_data *a = data; + char str[128]; + + printf("clicked event on API Button: api_state=<%d>\n", a->state); + set_api_state(a); + a->state++; + sprintf(str, "Next API function (%u)", a->state); + elm_object_text_set(obj, str); + elm_object_disabled_set(obj, a->state == API_STATE_LAST); +} + +static void +my_show_it(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + elm_list_item_show(data); +} + +static void +scroll_top(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + printf("Top edge!\n"); +} + +static void +scroll_bottom(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + printf("Bottom edge!\n"); +} + +static void +scroll_left(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + printf("Left edge!\n"); +} + +static void +scroll_right(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + printf("Right edge!\n"); +} + +static void +_cleanup_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + free(data); +} + +void +test_list(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *win, *li, *ic, *ic2, *bx, *tb2, *bt, *bxx; + char buf[PATH_MAX]; + Elm_Object_Item *list_it1, *list_it2, *list_it3, *list_it4, *list_it5; + api_data *api = calloc(1, sizeof(api_data)); + + win = elm_win_util_standard_add("list", "List"); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api); + + bxx = elm_box_add(win); + elm_win_resize_object_add(win, bxx); + evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bxx); + + li = elm_list_add(win); + elm_list_mode_set(li, ELM_LIST_LIMIT); + evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL); + api->list = li; + + bt = elm_button_add(win); + elm_object_text_set(bt, "Next API function"); + evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api); + elm_box_pack_end(bxx, bt); + elm_object_disabled_set(bt, api->state == API_STATE_LAST); + evas_object_show(bt); + + elm_box_pack_end(bxx, li); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 1, 1); + list_it1 = elm_list_item_append(li, "Hello", ic, NULL, NULL, NULL); + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_resizable_set(ic, 0, 0); + elm_icon_file_set(ic, buf, NULL); + elm_list_item_append(li, "world", ic, NULL, NULL, NULL); + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "edit"); + elm_icon_resizable_set(ic, 0, 0); + elm_list_item_append(li, ".", ic, NULL, NULL, NULL); + + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "delete"); + elm_icon_resizable_set(ic, 0, 0); + ic2 = elm_icon_add(win); + elm_icon_standard_set(ic2, "clock"); + elm_icon_resizable_set(ic2, 0, 0); + list_it2 = elm_list_item_append(li, "How", ic, ic2, NULL, NULL); + + bx = elm_box_add(win); + elm_box_horizontal_set(bx, EINA_TRUE); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_size_hint_align_set(ic, 0.5, 0.5); + elm_box_pack_end(bx, ic); + evas_object_show(ic); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_size_hint_align_set(ic, 0.5, 0.0); + elm_box_pack_end(bx, ic); + evas_object_show(ic); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_size_hint_align_set(ic, 0.0, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, ic); + evas_object_show(ic); + elm_list_item_append(li, "are", bx, NULL, NULL, NULL); + + elm_list_item_append(li, "you", NULL, NULL, NULL, NULL); + list_it3 = elm_list_item_append(li, "doing", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "out", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "there", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "today", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "?", NULL, NULL, NULL, NULL); + list_it4 = elm_list_item_append(li, "Here", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "are", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "some", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "more", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "items", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "Is this label long enough?", NULL, NULL, NULL, NULL); + list_it5 = elm_list_item_append(li, "Maybe this one is even longer so we can test long long items.", NULL, NULL, NULL, NULL); + + elm_list_go(li); + + evas_object_show(li); + + tb2 = elm_table_add(win); + evas_object_size_hint_weight_set(tb2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, tb2); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Hello"); + evas_object_smart_callback_add(bt, "clicked", my_show_it, list_it1); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, 0.9, 0.5); + elm_table_pack(tb2, bt, 0, 0, 1, 1); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "How"); + evas_object_smart_callback_add(bt, "clicked", my_show_it, list_it2); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, 0.9, 0.5); + elm_table_pack(tb2, bt, 0, 1, 1, 1); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "doing"); + evas_object_smart_callback_add(bt, "clicked", my_show_it, list_it3); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, 0.9, 0.5); + elm_table_pack(tb2, bt, 0, 2, 1, 1); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Here"); + evas_object_smart_callback_add(bt, "clicked", my_show_it, list_it4); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, 0.9, 0.5); + elm_table_pack(tb2, bt, 0, 3, 1, 1); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Maybe this..."); + evas_object_smart_callback_add(bt, "clicked", my_show_it, list_it5); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, 0.9, 0.5); + elm_table_pack(tb2, bt, 0, 4, 1, 1); + evas_object_show(bt); + + evas_object_show(tb2); + + evas_object_resize(win, 320, 300); + evas_object_show(win); + + evas_object_smart_callback_add(li, "scroll,edge,top", scroll_top, NULL); + evas_object_smart_callback_add(li, "scroll,edge,bottom", scroll_bottom, NULL); + evas_object_smart_callback_add(li, "scroll,edge,left", scroll_left, NULL); + evas_object_smart_callback_add(li, "scroll,edge,right", scroll_right, NULL); +} + +void +test_list_horizontal(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *win, *li, *ic, *ic2, *bx, *tb2, *bt; + char buf[PATH_MAX]; + Elm_Object_Item *list_it1, *list_it2, *list_it3, *list_it4; + + win = elm_win_util_standard_add("list-horizontal", "List Horizontal"); + elm_win_autodel_set(win, EINA_TRUE); + + li = elm_list_add(win); + elm_list_horizontal_set(li, EINA_TRUE); + elm_list_mode_set(li, ELM_LIST_LIMIT); + elm_win_resize_object_add(win, li); + evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 1, 1); + list_it1 = elm_list_item_append(li, "Hello", ic, NULL, NULL, NULL); + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_resizable_set(ic, 0, 0); + elm_icon_file_set(ic, buf, NULL); + elm_list_item_append(li, "world", ic, NULL, NULL, NULL); + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "edit"); + elm_icon_resizable_set(ic, 0, 0); + elm_list_item_append(li, ".", ic, NULL, NULL, NULL); + + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "delete"); + elm_icon_resizable_set(ic, 0, 0); + ic2 = elm_icon_add(win); + elm_icon_standard_set(ic2, "clock"); + elm_icon_resizable_set(ic2, 0, 0); + list_it2 = elm_list_item_append(li, "How", ic, ic2, NULL, NULL); + + bx = elm_box_add(win); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_size_hint_align_set(ic, 0.5, 0.5); + elm_box_pack_end(bx, ic); + evas_object_show(ic); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_size_hint_align_set(ic, 0.5, 0.0); + elm_box_pack_end(bx, ic); + evas_object_show(ic); + + elm_list_item_append(li, "are", bx, NULL, NULL, NULL); + + elm_list_item_append(li, "you", NULL, NULL, NULL, NULL); + list_it3 = elm_list_item_append(li, "doing", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "out", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "there", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "today", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "?", NULL, NULL, NULL, NULL); + + list_it4 = elm_list_item_append(li, "And", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "here", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "we", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "are", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "done", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "with", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "items.", NULL, NULL, NULL, NULL); + + elm_list_go(li); + + evas_object_show(li); + + tb2 = elm_table_add(win); + evas_object_size_hint_weight_set(tb2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, tb2); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Hello"); + evas_object_smart_callback_add(bt, "clicked", my_show_it, list_it1); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, 0.5, 0.9); + elm_table_pack(tb2, bt, 0, 0, 1, 1); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "How"); + evas_object_smart_callback_add(bt, "clicked", my_show_it, list_it2); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, 0.5, 0.9); + elm_table_pack(tb2, bt, 1, 0, 1, 1); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "doing"); + evas_object_smart_callback_add(bt, "clicked", my_show_it, list_it3); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, 0.5, 0.9); + elm_table_pack(tb2, bt, 2, 0, 1, 1); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "And"); + evas_object_smart_callback_add(bt, "clicked", my_show_it, list_it4); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, 0.5, 0.9); + elm_table_pack(tb2, bt, 3, 0, 1, 1); + evas_object_show(bt); + + evas_object_show(tb2); + + evas_object_resize(win, 320, 300); + evas_object_show(win); +} + +/***********/ + +static void +my_li2_clear(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + elm_list_clear(data); +} + +static void +my_li2_sel(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Elm_Object_Item *list_it = elm_list_selected_item_get(obj); + elm_list_item_selected_set(list_it, 0); +} + +void +test_list2(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *win, *bg, *li, *ic, *ic2, *bx, *bx2, *bt; + char buf[PATH_MAX]; + Elm_Object_Item *list_it; + + win = elm_win_add(NULL, "list2", ELM_WIN_BASIC); + elm_win_title_set(win, "List 2"); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); + elm_bg_file_set(bg, buf, NULL); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + li = elm_list_add(win); + evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_list_mode_set(li, ELM_LIST_LIMIT); +// elm_list_multi_select_set(li, 1); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + list_it = elm_list_item_append(li, "Hello", ic, NULL, my_li2_sel, NULL); + elm_list_item_selected_set(list_it, EINA_TRUE); + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_resizable_set(ic, 0, 0); + elm_icon_file_set(ic, buf, NULL); + elm_list_item_append(li, "world", ic, NULL, NULL, NULL); + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "edit"); + elm_icon_resizable_set(ic, 0, 0); + elm_list_item_append(li, ".", ic, NULL, NULL, NULL); + + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "delete"); + elm_icon_resizable_set(ic, 0, 0); + ic2 = elm_icon_add(win); + elm_icon_standard_set(ic2, "clock"); + elm_icon_resizable_set(ic2, 0, 0); + elm_list_item_append(li, "How", ic, ic2, NULL, NULL); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_size_hint_align_set(ic, 0.5, 0.5); + elm_box_pack_end(bx2, ic); + evas_object_show(ic); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_size_hint_align_set(ic, 0.5, 0.0); + elm_box_pack_end(bx2, ic); + evas_object_show(ic); + elm_list_item_append(li, "are", bx2, NULL, NULL, NULL); + + elm_list_item_append(li, "you", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "doing", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "out", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "there", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "today", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "?", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "Here", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "are", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "some", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "more", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "items", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "Longer label.", NULL, NULL, NULL, NULL); + + elm_list_go(li); + + elm_box_pack_end(bx, li); + evas_object_show(li); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + elm_box_homogeneous_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Clear"); + evas_object_smart_callback_add(bt, "clicked", my_li2_clear, li); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + evas_object_resize(win, 320, 300); + evas_object_show(win); +} + +/***********/ + +static void +_bt_clicked(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + printf("button was clicked\n"); +} + +static void +_it_clicked(void *data, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + printf("item was clicked\n"); + if (!data) return; + Evas_Object *li = (Evas_Object *) data; + Evas_Object *lb; + char str[128]; + + Elm_Object_Item *lit = elm_list_selected_item_get(li); + if (!lit) return; + sprintf(str, "%s is selected", elm_object_item_text_get(lit)); + + lb = evas_object_data_get(li, "label"); + elm_object_text_set(lb, str); +} + +void +test_list3(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *win, *li, *ic, *ic2, *bx; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("list3", "List 3"); + elm_win_autodel_set(win, EINA_TRUE); + + li = elm_list_add(win); + elm_win_resize_object_add(win, li); + evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_list_mode_set(li, ELM_LIST_COMPRESS); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_resizable_set(ic, 0, 0); + elm_icon_file_set(ic, buf, NULL); + ic2 = elm_button_add(win); + elm_object_text_set(ic2, "Click me"); + evas_object_smart_callback_add(ic2, "clicked", _bt_clicked, NULL); + evas_object_propagate_events_set(ic2, 0); + elm_list_item_append(li, "Hello", ic, ic2, _it_clicked, NULL); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_resizable_set(ic, 0, 0); + elm_icon_file_set(ic, buf, NULL); + ic2 = elm_button_add(win); + elm_object_text_set(ic2, "Click me"); + evas_object_smart_callback_add(ic2, "clicked", _bt_clicked, NULL); + elm_list_item_append(li, "world", ic, ic2, _it_clicked, NULL); + + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "edit"); + elm_icon_resizable_set(ic, 0, 0); + elm_list_item_append(li, ".", ic, NULL, NULL, NULL); + + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "delete"); + elm_icon_resizable_set(ic, 0, 0); + ic2 = elm_icon_add(win); + elm_icon_standard_set(ic2, "clock"); + elm_icon_resizable_set(ic2, 0, 0); + elm_list_item_append(li, "How", ic, ic2, NULL, NULL); + + bx = elm_box_add(win); + elm_box_horizontal_set(bx, EINA_TRUE); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_size_hint_align_set(ic, 0.5, 0.5); + elm_box_pack_end(bx, ic); + evas_object_show(ic); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_size_hint_align_set(ic, 0.5, 0.0); + elm_box_pack_end(bx, ic); + evas_object_show(ic); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_size_hint_align_set(ic, 0.0, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, ic); + evas_object_show(ic); + + elm_list_item_append(li, "are", bx, NULL, NULL, NULL); + elm_list_item_append(li, "you", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "doing", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "out", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "there", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "today", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "?", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "Here", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "are", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "some", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "more", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "items", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "Is this label long enough?", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "Maybe this one is even longer so we can test long long items.", NULL, NULL, NULL, NULL); + + elm_list_go(li); + + evas_object_show(li); + + evas_object_resize(win, 320, 300); + evas_object_show(win); +} + +/////////////////////////////////////////////////////////////////////////////////////// + +struct Pginfo +{ + Evas_Object *naviframe, *win; +}; + +static void +test_list4_back_cb(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + struct Pginfo *info = data; + if (!info) return; + + elm_naviframe_item_pop(info->naviframe); +} + +static void +test_list4_swipe(void *data, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + Evas_Object *box, *entry, *button; + struct Pginfo *info = data; + char *item_data; + if ((!event_info) || (!data)) return; + + item_data = elm_object_item_data_get(event_info); + + box = elm_box_add(info->win); + elm_box_horizontal_set(box, EINA_FALSE); + elm_box_homogeneous_set(box, EINA_FALSE); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(box); + + entry = elm_entry_add(info->win); + elm_entry_scrollable_set(entry, EINA_TRUE); + elm_entry_editable_set(entry, EINA_FALSE); + elm_object_text_set(entry, item_data); + evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(entry); + + button = elm_button_add(info->win); + elm_object_text_set(button, "back"); + evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(button, EVAS_HINT_FILL, 0); + evas_object_smart_callback_add(button, "clicked", test_list4_back_cb, info); + evas_object_show(button); + + elm_box_pack_start(box, entry); + elm_box_pack_end(box, button); + + elm_naviframe_item_simple_push(info->naviframe, box); +} + +void +test_list4(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *win, *li, *ic, *ic2, *naviframe; + static struct Pginfo info = {NULL, NULL}; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("list4", "List 4"); + elm_win_autodel_set(win, EINA_TRUE); + info.win = win; + + naviframe = elm_naviframe_add(win); + elm_win_resize_object_add(win, naviframe); + evas_object_size_hint_weight_set(naviframe, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(naviframe, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(naviframe); + info.naviframe = naviframe; + + li = elm_list_add(win); + evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_list_mode_set(li, ELM_LIST_COMPRESS); + evas_object_smart_callback_add(li, "swipe", test_list4_swipe, &info); + elm_naviframe_item_simple_push(naviframe, li); + + static char pf_data[] = "Pink Floyd were formed in 1965, and originally consisted of university" \ + "students Roger Waters, Nick Mason, Richard Wright, and Syd Barrett. The group were a popular" \ + "fixture on London's underground music scene, and under Barrett's leadership released two " \ + "charting singles, \"Arnold Layne\" and \"See Emily Play\", and a successful debut album, " \ + "ThePiper at the Gates of Dawn. In 1968, guitarist and singer David Gilmour joined the " \ + "line-up. Barrett was soon removed, due to his increasingly erratic behaviour. Following " \ + "Barrett's departure, bass player and singer Roger Waters became the band's lyricist and " \ + "conceptual leader, with Gilmour assuming lead guitar and much of the vocals. With this " \ + "line-up, Floyd went on to achieve worldwide critical and commercial success with the " \ + "conceptalbums The Dark Side of the Moon, Wish You Were Here, Animals, and The Wall."; + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/mystrale.jpg", elm_app_data_dir_get()); + elm_icon_resizable_set(ic, 0, 0); + elm_icon_file_set(ic, buf, NULL); + elm_list_item_append(li, "Pink Floyd", ic, NULL, NULL, &pf_data); + + static char ds_data[] = "Dire Straits were a British rock band, formed by Mark Knopfler " \ + "(lead vocals and lead guitar), his younger brother David Knopfler (rhythm guitar and " \ + "backing vocals), John Illsley (bass guitar and backing vocals), and Pick Withers (drums " \ + "and percussion), and managed by Ed Bicknell, active between 1977 and 1995. Although the " \ + "band was formed in an era when punk rock was at the forefront, Dire Straits played a more " + "bluesy style, albeit with a stripped-down sound that appealed to audiences weary of the " \ + "overproduced stadium rock of the 1970s.[citation needed] In their early days, Mark and " \ + "David requested that pub owners turn down their sound so that patrons could converse " \ + "while the band played, an indication of their unassuming demeanor. Despite this oddly " \ + "self-effacing approach to rock and roll, Dire Straits soon became hugely successful, with " \ + "their first album going multi-platinum globally."; + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/mystrale_2.jpg", elm_app_data_dir_get()); + elm_icon_resizable_set(ic, 0, 0); + elm_icon_file_set(ic, buf, NULL); + elm_list_item_append(li, "Dire Straits", ic, NULL, NULL, &ds_data); + + static char uh_data[] = "Uriah Heep are an English hard rock band. The band released several " \ + "commercially successful albums in the 1970s such as Uriah Heep Live (1973), but their " \ + "audience declined by the 1980s, to the point where they became essentially a cult band in " \ + "the United States and United Kingdom. Uriah Heep maintain a significant following in " \ + "Germany, the Netherlands, Scandinavia, the Balkans, Japan and Russia, where they still " \ + "perform at stadium-sized venues."; + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/icon_17.png", elm_app_data_dir_get()); + elm_icon_resizable_set(ic, 1, 1); + elm_icon_file_set(ic, buf, NULL); + elm_list_item_append(li, "Uriah Heep", ic, NULL, NULL, &uh_data); + + static char r_data[] = "Rush is a Canadian rock band formed in August 1968, in the Willowdale " \ + "neighbourhood of Toronto, Ontario. The band is composed of bassist, keyboardist, and lead " \ + "vocalist Geddy Lee, guitarist Alex Lifeson, and drummer and lyricist Neil Peart. The band " \ + "and its membership went through a number of re-configurations between 1968 and 1974, " \ + "achieving their current form when Peart replaced original drummer John Rutsey in July 1974, " \ + "two weeks before the group's first United States tour."; + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/icon_21.png", elm_app_data_dir_get()); + elm_icon_resizable_set(ic, 0, 0); + elm_icon_file_set(ic, buf, NULL); + ic2 = elm_icon_add(win); + elm_icon_standard_set(ic2, "clock"); + elm_icon_resizable_set(ic2, 0, 0); + elm_list_item_append(li, "Rush", ic, ic2, NULL, &r_data); + + elm_list_go(li); + + evas_object_show(li); + evas_object_resize(win, 320, 300); + evas_object_show(win); +} + +///////////////////////////////////////////////////////////////////////////////////////// +struct list5_data_cb +{ + Evas_Object *win, *list; +}; + +static void +test_list5_item_del(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + elm_object_item_del(data); +} + +static void +test_list5_swipe(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + Evas_Object *button; + struct list5_data_cb *info = elm_object_item_data_get(event_info); + + if (elm_object_item_part_content_get(event_info, "end")) return; + + button = elm_button_add(info->win); + elm_object_text_set(button, "delete"); + evas_object_propagate_events_set(button, 0); + evas_object_smart_callback_add(button, "clicked", test_list5_item_del, + event_info); + elm_object_item_part_content_set(event_info, "end", button); +} + +void +test_list5(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *win, *li; + static struct list5_data_cb info; + + win = elm_win_util_standard_add("list5", "List 5"); + elm_win_autodel_set(win, EINA_TRUE); + info.win = win; + + li = elm_list_add(win); + evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_list_mode_set(li, ELM_LIST_COMPRESS); + evas_object_smart_callback_add(li, "swipe", test_list5_swipe, NULL); + elm_win_resize_object_add(win, li); + evas_object_show(li); + info.list = li; + + elm_list_item_append(li, "Network", NULL, NULL, NULL, &info); + elm_list_item_append(li, "Audio", NULL, NULL, NULL, &info); + + elm_list_go(li); + evas_object_resize(win, 320, 300); + evas_object_show(win); +} + +static void +_first_bt_clicked(void *data, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + char str[128]; + Evas_Object *li = data, *lb; + Elm_Object_Item *lit = elm_list_first_item_get(li); + if (!lit) return; + + sprintf(str, "%s is selected", elm_object_item_text_get(lit)); + elm_list_item_bring_in(lit); + elm_list_item_selected_set(lit, EINA_TRUE); + + lb = evas_object_data_get(li, "label"); + elm_object_text_set(lb, str); +} + +static void +_prev_bt_clicked(void *data, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + char str[128]; + Evas_Object *li = data, *lb; + + Elm_Object_Item *lit = elm_list_selected_item_get(li); + if (!lit) return; + lit = elm_list_item_prev(lit); + if (!lit) return; + + sprintf(str, "%s is selected", elm_object_item_text_get(lit)); + elm_list_item_bring_in(lit); + elm_list_item_selected_set(lit, EINA_TRUE); + + lb = evas_object_data_get(li, "label"); + elm_object_text_set(lb, str); +} + +static void +_next_bt_clicked(void *data, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + char str[128]; + Evas_Object *li = data, *lb; + + Elm_Object_Item *lit = elm_list_selected_item_get(li); + if (!lit) return; + lit = elm_list_item_next(lit); + if (!lit) return; + + sprintf(str, "%s is selected", elm_object_item_text_get(lit)); + elm_list_item_bring_in(lit); + elm_list_item_selected_set(lit, EINA_TRUE); + + lb = evas_object_data_get(li, "label"); + elm_object_text_set(lb, str); +} + +static void +_last_bt_clicked(void *data, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + char str[128]; + Evas_Object *li = data, *lb; + Elm_Object_Item *lit = elm_list_last_item_get(li); + if (!lit) return; + + sprintf(str, "%s is selected", elm_object_item_text_get(lit)); + elm_list_item_bring_in(lit); + elm_list_item_selected_set(lit, EINA_TRUE); + + lb = evas_object_data_get(li, "label"); + elm_object_text_set(lb, str); +} + +void +test_list6(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *win, *gd, *bt, *li, *lb; + + win = elm_win_util_standard_add("list6", "List 6"); + elm_win_autodel_set(win, EINA_TRUE); + + gd = elm_grid_add(win); + elm_grid_size_set(gd, 100, 100); + elm_win_resize_object_add(win, gd); + evas_object_size_hint_weight_set(gd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + li = elm_list_add(win); + evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_list_mode_set(li, ELM_LIST_COMPRESS); + elm_grid_pack(gd, li, 4, 4, 92, 72); + evas_object_show(li); + + elm_list_item_append(li, "Eina", NULL, NULL, _it_clicked, li); + elm_list_item_append(li, "Eet", NULL, NULL, _it_clicked, li); + elm_list_item_append(li, "Evas", NULL, NULL, _it_clicked, li); + elm_list_item_append(li, "Ecore", NULL, NULL, _it_clicked, li); + elm_list_item_append(li, "Embryo", NULL, NULL, _it_clicked, li); + elm_list_item_append(li, "Edje", NULL, NULL, _it_clicked, li); + elm_list_item_append(li, "Efreet", NULL, NULL, _it_clicked, li); + elm_list_item_append(li, "E_dbus", NULL, NULL, _it_clicked, li); + elm_list_item_append(li, "Eeze", NULL, NULL, _it_clicked, li); + elm_list_item_append(li, "Expedite", NULL, NULL, _it_clicked, li); + elm_list_item_append(li, "Emotion", NULL, NULL, _it_clicked, li); + elm_list_item_append(li, "Ethumb", NULL, NULL, _it_clicked, li); + elm_list_item_append(li, "Elementary", NULL, NULL, _it_clicked, li); + elm_list_go(li); + + bt = elm_button_add(win); + elm_object_text_set(bt, "First"); + evas_object_smart_callback_add(bt, "clicked", _first_bt_clicked, li); + elm_grid_pack(gd, bt, 4, 80, 20, 10); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Prev"); + evas_object_smart_callback_add(bt, "clicked", _prev_bt_clicked, li); + elm_grid_pack(gd, bt, 28, 80, 20, 10); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Next"); + evas_object_smart_callback_add(bt, "clicked", _next_bt_clicked, li); + elm_grid_pack(gd, bt, 52, 80, 20, 10); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Last"); + evas_object_smart_callback_add(bt, "clicked", _last_bt_clicked, li); + elm_grid_pack(gd, bt, 76, 80, 20, 10); + evas_object_show(bt); + + lb = elm_label_add(win); + elm_object_text_set(lb, "Nothing is selected"); + elm_grid_pack(gd, lb, 4, 90, 92, 10); + evas_object_show(lb); + + evas_object_data_set(li, "label", lb); + + evas_object_show(gd); + evas_object_resize(win, 480, 480); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_map.c b/libraries/elementary/src/bin/test_map.c new file mode 100644 index 0000000..d136e83 --- /dev/null +++ b/libraries/elementary/src/bin/test_map.c @@ -0,0 +1,1117 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +#define SOURCE_MAX 10 +#define MARKER_MAX 1000 +#define NAME_ENTRY_TEXT "Enter freeform address" + +typedef struct Overlay_Data +{ + const char *file; +} Overlay_Data; + +typedef struct Map_Source +{ + Evas_Object *map; + Elm_Map_Source_Type type; + char *source_name; +} Map_Source; + +Overlay_Data data1 = {PACKAGE_DATA_DIR"/images/logo.png"}; +Overlay_Data data2 = {PACKAGE_DATA_DIR"/images/logo_small.png"}; +Overlay_Data data3 = {PACKAGE_DATA_DIR"/images/panel_01.jpg"}; +Overlay_Data data4 = {PACKAGE_DATA_DIR"/images/plant_01.jpg"}; +Overlay_Data data5 = {PACKAGE_DATA_DIR"/images/rock_01.jpg"}; +Overlay_Data data6 = {PACKAGE_DATA_DIR"/images/rock_02.jpg"}; +Overlay_Data data7 = {PACKAGE_DATA_DIR"/images/sky_01.jpg"}; +Overlay_Data data8 = {PACKAGE_DATA_DIR"/images/sky_02.jpg"}; +Overlay_Data data9 = {PACKAGE_DATA_DIR"/images/sky_03.jpg"}; +Overlay_Data data10 = {PACKAGE_DATA_DIR"/images/sky_03.jpg"}; +Overlay_Data data11= {PACKAGE_DATA_DIR"/images/wood_01.jpg"}; +Overlay_Data parking= {PACKAGE_DATA_DIR"/images/parking.png"}; +Overlay_Data icon_data = {PACKAGE_DATA_DIR"/images/icon_14.png"}; + +static Elm_Map_Overlay *route_start, *route_end, *route_clas; +static Elm_Map_Overlay *bubble_img; +static Elm_Map_Overlay *bubble_parking; +static Elm_Map_Overlay *route_ovl; +static Elm_Map_Overlay *line_start, *line_end, *line; +static Elm_Map_Overlay *poly; +static Elm_Map_Overlay *circle; +static Elm_Map_Overlay *scale; +static Eina_List *poly_points; + +static Evas_Object *menu, *fs_win; +static Elm_Map_Route *route; +static Elm_Map_Name *name; +static Evas_Object *track; +static Evas_Coord down_x, down_y; +static Evas_Coord old_x, old_y, old_d; +static Map_Source ts[SOURCE_MAX]; +static Map_Source rs[SOURCE_MAX]; +static Map_Source ns[SOURCE_MAX]; + +static void +#ifdef ELM_EMAP +my_map_gpx_fileselector_done(void *data, Evas_Object *obj __UNUSED__, void *event_info) +#else +my_map_gpx_fileselector_done(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +#endif +{ + const char *selected = event_info; + + if (selected) + { + printf("Selected file: %s\n", selected); +#ifdef ELM_EMAP + EMap_Route *emap = emap_route_gpx_new(selected); + track = elm_map_track_add(data, emap); +#else + printf("libEMap is required !\n"); +#endif + } + evas_object_del(fs_win); +} + +static Evas_Object * +_route_icon_get(Evas_Object *obj) +{ + Evas_Object *icon = elm_icon_add(obj); + elm_icon_file_set(icon, PACKAGE_DATA_DIR"/images/bubble.png", NULL); + evas_object_show(icon); + + return icon; +} + +static Evas_Object * +_box_get(Evas_Object *obj, Overlay_Data *data, Elm_Map_Overlay *ovl) +{ + Evas_Object *bx, *img, *label; + double lon, lat; + char buf[256]; + bx = elm_box_add(obj); + evas_object_show(bx); + + img = evas_object_image_add(evas_object_evas_get(obj)); + evas_object_image_file_set(img, data->file, NULL); + evas_object_image_filled_set(img, EINA_TRUE); + evas_object_size_hint_min_set(img, 64, 64); + evas_object_show(img); + elm_box_pack_end(bx, img); + + label = elm_label_add(bx); + elm_map_overlay_region_get(ovl, &lon, &lat); + snprintf(buf, sizeof(buf), "%0.4lf %0.4lf", lon, lat); + elm_object_text_set(label, buf); + evas_object_show(label); + elm_box_pack_end(bx, label); + return bx; +} + +static Evas_Object * +_label_get(Evas_Object *obj) +{ + Evas_Object *label; + label = elm_label_add(obj); + elm_object_text_set(label, "Here is a parking lot."); + return label; +} + +static Evas_Object * +_icon_get(Evas_Object *obj, Overlay_Data *data) +{ + Evas_Object *icon = elm_icon_add(obj); + elm_icon_file_set(icon, data->file, NULL); + evas_object_show(icon); + + return icon; +} + +static void +_overlay_hide(void *data, Evas_Object *obj __UNUSED__, void *ev __UNUSED__) +{ + elm_map_overlay_hide_set(data, EINA_TRUE); +} + +static void +_overlay_pause(void *data, Evas_Object *obj __UNUSED__, void *ev __UNUSED__) +{ + elm_map_overlay_paused_set(data, EINA_TRUE); +} + +static void +_overlay_unpause(void *data, Evas_Object *obj __UNUSED__, void *ev __UNUSED__) +{ + elm_map_overlay_paused_set(data, EINA_FALSE); +} + +static void +_overlay_show(void *data, Evas_Object *obj __UNUSED__, void *ev __UNUSED__) +{ + elm_map_overlay_show(data); +} + +static Evas_Object * +_btn_box_get(Evas_Object *obj, Elm_Map_Overlay *ovl) +{ + Evas_Object *bx, *btn, *btn2, *btn3, *btn4; + bx = elm_box_add(obj); + elm_box_horizontal_set(bx, EINA_TRUE); + evas_object_show(bx); + + btn = elm_button_add(bx); + elm_object_text_set(btn, "Hide"); + evas_object_smart_callback_add(btn, "clicked", _overlay_hide, ovl); + evas_object_show(btn); + elm_box_pack_end(bx, btn); + + btn2 = elm_button_add(bx); + elm_object_text_set(btn2, "Pause"); + evas_object_smart_callback_add(btn2, "clicked", _overlay_pause, ovl); + evas_object_show(btn2); + elm_box_pack_end(bx, btn2); + + btn3 = elm_button_add(bx); + elm_object_text_set(btn3, "Unpause"); + evas_object_smart_callback_add(btn3, "clicked", _overlay_unpause, ovl); + evas_object_show(btn3); + elm_box_pack_end(bx, btn3); + + btn4 = elm_button_add(bx); + elm_object_text_set(btn4, "Show"); + evas_object_smart_callback_add(btn4, "clicked", _overlay_show, ovl); + evas_object_show(btn4); + elm_box_pack_end(bx, btn4); + + return bx; +} + +static void +_bubble_parking_follow(Evas_Object *map) +{ + double lon, lat; + Evas_Coord x, y; + + if (bubble_parking) + { + Elm_Map_Overlay *ovl = elm_map_overlay_data_get(bubble_parking); + elm_map_overlay_region_get(ovl, &lon, &lat); + elm_map_region_to_canvas_convert(map, lon, lat, &x, &y); + elm_map_canvas_to_region_convert(map, x+40, y+50, &lon, &lat); + elm_map_overlay_region_set(bubble_parking, lon, lat); + } +} + +static void +_map_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("clicked\n"); +} + +static void +_map_clicked_double(void *data __UNUSED__, Evas_Object *obj, void *event_info) +{ + printf("clicked,double\n"); + double lon, lat; + Evas_Event_Mouse_Down *down = event_info; + if (!down) return; + if (elm_map_zoom_get(obj) < 5) return; + + elm_map_canvas_to_region_convert(obj, down->canvas.x, down->canvas.y, &lon, &lat); + printf("x:%d, y:%d, lon:%lf, lat:%lf\n", down->canvas.x, down->canvas.y, lon, lat); + + if (!route_clas) + { + route_clas = elm_map_overlay_class_add(obj); + elm_map_overlay_icon_set(route_clas, _route_icon_get(obj)); + elm_map_overlay_displayed_zoom_min_set(route_clas, 5); + } + + if (route_start && route_end) + { + elm_map_overlay_del(route_start); + elm_map_overlay_del(route_end); + elm_map_route_del(route); + route_start = NULL; + route_end = NULL; + route = NULL; + } + + if (!route_start) route_start = elm_map_overlay_add(obj, lon, lat); + else route_end = elm_map_overlay_add(obj, lon, lat); + + if (route_start && route_end) + { + double start_lon, start_lat, end_lon, end_lat; + elm_map_overlay_class_append(route_clas, route_start); + elm_map_overlay_class_append(route_clas, route_end); + elm_map_overlay_region_get(route_start, &start_lon, &start_lat); + elm_map_overlay_region_get(route_end, &end_lon, &end_lat); + route = elm_map_route_add(obj, ELM_MAP_ROUTE_TYPE_MOTOCAR, + ELM_MAP_ROUTE_METHOD_FASTEST, + start_lon, start_lat, end_lon, end_lat, + NULL, NULL); + } +} + +static void +_map_press(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("press\n"); +} + +static void +_map_longpressed(void *data __UNUSED__, Evas_Object *obj, void *event_info) +{ + if (!event_info) return; + double lon, lat; + Evas_Event_Mouse_Down *down = (Evas_Event_Mouse_Down *)event_info; + elm_map_canvas_to_region_convert(obj, down->canvas.x, down->canvas.y, &lon, &lat); + printf("longpressed, x:%d, y:%d, lon:%lf, lat:%lf\n", down->canvas.x, down->canvas.y, lon, lat); + + if (elm_map_zoom_get(obj) < 8) return; + if (name) elm_map_name_del(name); + name = elm_map_name_add(obj, NULL, lon, lat, NULL, NULL); +} + +static void +_map_scroll(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + double lon, lat; + elm_map_region_get(obj, &lon, &lat); + printf("scroll, longitude: %f latitude: %f\n", lon, lat); + _bubble_parking_follow(obj); +} + +static void +_map_drag_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("scroll,drag,start\n"); + evas_object_smart_callback_del(data, "longpressed", _map_longpressed); +} + +static void +_map_drag_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("scroll,drag,stop\n"); + evas_object_smart_callback_add(data, "longpressed", _map_longpressed, data); +} + +static void +_map_anim_start(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("scroll,anim,start\n"); +} + +static void +_map_anim_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("scroll,anim,stop\n"); +} + +static void +_map_zoom_start(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("zoom,start\n"); +} + +static void +_map_zoom_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("zoom,stop\n"); + _bubble_parking_follow(obj); +} + +static void +_map_zoom_change(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("zoom,change\n"); +} + +static void +_map_tile_load(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("tile,load\n"); +} + +static void +_map_tile_loaded(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + int try_num, finish_num; + elm_map_tile_load_status_get(data, &try_num, &finish_num); + printf("tile,loaded: %d / %d\n", finish_num, try_num); +} + +static void +_map_tile_loaded_fail(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + int try_num, finish_num; + elm_map_tile_load_status_get(data, &try_num, &finish_num); + printf("tile,loaded,fail: %d / %d\n", finish_num, try_num); +} + +static void +_map_route_load(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("route,load\n"); +} + +static void +_map_route_loaded(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + printf("route,loaded\n"); + double d; + const char *w, *n; + + d = elm_map_route_distance_get(route); + printf("route distance = %lf km\n", d); + + w = elm_map_route_waypoint_get(route); + if (w) printf("[waypoints]\n%s\n", w); + + n = elm_map_route_node_get(route); + if (n) printf("[nodes]\n%s\n", n); + + if (route_ovl) elm_map_overlay_del(route_ovl); + route_ovl = elm_map_overlay_route_add(obj, route); +} + +static void +_map_route_loaded_fail(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("route,loaded,fail\n"); +} + +static void +_map_name_load(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("name,load\n"); +} + +static void +_map_name_loaded(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("name,loaded\n"); + if (!name) return; + double lon, lat; + const char *addr = elm_map_name_address_get(name); + elm_map_name_region_get(name, &lon, &lat); + if (addr) + { + printf("name of [lon = %lf, lat = %lf] is %s\n", lon, lat, addr); + if ((lon != 0.0) && (lat !=0.0)) + { + Eina_Bool b = elm_map_paused_get(data); + elm_map_paused_set(data, EINA_TRUE); + elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL); + elm_map_zoom_set(data, elm_map_zoom_max_get(data)); + elm_map_region_show(data, lon, lat); + elm_map_paused_set(data, b); + } + } + + elm_map_name_del(name); + name = NULL; +} + +static void +_map_name_loaded_fail(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("name,loaded,fail\n"); +} + +static void +_src_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Map_Source *s = data; + + if (!s) return; + elm_map_source_set(s->map, s->type, s->source_name); +} + +static void +_show_urmatt(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL); + if (elm_map_zoom_get(data) < 12) elm_map_zoom_set(data, 12); + elm_map_region_show(data,7.325201, 48.526813); +} + +static void +_bring_seoul(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL); + if (elm_map_zoom_get(data) < 12) elm_map_zoom_set(data, 12); + elm_map_region_bring_in(data, 126.977969, 37.566535); +} + +static void +_paused_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_map_paused_set(data, EINA_TRUE); +} + +static void +_paused_unset(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_map_paused_set(data, EINA_FALSE); +} + +static void +_zoom_in(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + int zoom; + + zoom = elm_map_zoom_get(data) + 1; + elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL); + elm_map_zoom_set(data, zoom); +} + +static void +_zoom_out(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + int zoom; + + zoom = elm_map_zoom_get(data) - 1; + elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL); + elm_map_zoom_set(data, zoom); +} + +static void +_zoom_fit(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_AUTO_FIT); +} + +static void +_zoom_fill(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_AUTO_FILL); +} + +static void +_zoom_manual(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL); +} + +static void +_track_add(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *fs, *vbox, *hbox, *sep; + char *path = NULL; + + fs_win = elm_win_util_standard_add("fileselector", "File Selector"); + elm_win_autodel_set(fs_win, 1); + + vbox = elm_box_add(fs_win); + elm_win_resize_object_add(fs_win, vbox); + evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(vbox); + + fs = elm_fileselector_add(fs_win); + elm_fileselector_is_save_set(fs, EINA_TRUE); + elm_fileselector_expandable_set(fs, EINA_FALSE); + path = getenv("HOME"); + //if "HOME" is not available, set current dir. path + if (!path) + path = "."; + elm_fileselector_path_set(fs, path); + evas_object_size_hint_weight_set(fs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(fs, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(vbox, fs); + evas_object_show(fs); + + evas_object_smart_callback_add(fs, "done", my_map_gpx_fileselector_done, data); + + sep = elm_separator_add(fs_win); + elm_separator_horizontal_set(sep, EINA_TRUE); + elm_box_pack_end(vbox, sep); + evas_object_show(sep); + + hbox = elm_box_add(fs_win); + elm_box_horizontal_set(hbox, EINA_TRUE); + elm_box_pack_end(vbox, hbox); + evas_object_show(hbox); + + evas_object_resize(fs_win, 240, 350); + evas_object_show(fs_win); +} + + +static void +_track_remove(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_map_track_remove(data, track); +} + +static void +_rotate_cw(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + double d; + Evas_Coord x, y, w, h; + float half_w, half_h; + evas_object_geometry_get(data, &x, &y, &w, &h); + half_w = (float)w * 0.5; + half_h = (float)h * 0.5; + + elm_map_rotate_get(data, &d, NULL, NULL); + d += 15.0; + elm_map_rotate_set(data, d, x + half_w, y + half_h); +} + +static void +_rotate_ccw(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + double d; + Evas_Coord x, y, w, h; + float half_w, half_h; + evas_object_geometry_get(data, &x, &y, &w, &h); + half_w = (float)w * 0.5; + half_h = (float)h * 0.5; + + elm_map_rotate_get(data, &d, NULL, NULL); + d -= 15.0; + elm_map_rotate_set(data, d, x + half_w, y + half_h); +} + +static void +_rotate_reset(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Coord x, y, w, h; + float half_w, half_h; + evas_object_geometry_get(data, &x, &y, &w, &h); + half_w = (float)w * 0.5; + half_h = (float)h * 0.5; + + elm_map_rotate_set(data, 0.0, x + half_w, y + half_h); +} + +static void +_wheel_disable(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_map_wheel_disabled_set(data, EINA_TRUE); +} + +static void +_wheel_enable(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_map_wheel_disabled_set(data, EINA_FALSE); +} + +static void +_zoom_min_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_map_zoom_min_set(data, 1); +} + +static void +_zoom_max_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_map_zoom_max_set(data, 10); +} + +static void +_line_add(void *data, Evas_Object *obj __UNUSED__, void *ei __UNUSED__) +{ + double lon, lat; + + elm_map_canvas_to_region_convert(data, down_x, down_y, &lon, &lat); + printf("line marker: %d %d %lf %lf\n", down_x, down_y, lon, lat); + if (line_start && line_end) + { + elm_map_overlay_del(line_start); + elm_map_overlay_del(line_end); + elm_map_overlay_del(line); + line_start = NULL; + line_end = NULL; + line = NULL; + } + if (!line_start) line_start = elm_map_overlay_add(data, lon, lat); + else if (!line_end) line_end = elm_map_overlay_add(data, lon, lat); + + if (line_start && line_end) + { + double flon, flat, tlon, tlat; + elm_map_overlay_region_get(line_start, &flon, &flat); + elm_map_overlay_region_get(line_end, &tlon, &tlat); + line = elm_map_overlay_line_add(data, flon, flat, tlon, tlat); + printf("line add: (%lf, %lf) --> (%lf, %lf)\n", flon, flat, tlon, tlat); + } +} + +static void +_poly_add(void *data, Evas_Object *obj __UNUSED__, void *ei __UNUSED__) +{ + double lon, lat; + + elm_map_canvas_to_region_convert(data, down_x, down_y, &lon, &lat); + printf("%d %d %lf %lf\n", down_x, down_y, lon, lat); + + if (!poly) poly = elm_map_overlay_polygon_add(data); + poly_points = eina_list_append(poly_points, + elm_map_overlay_add(data, lon, lat)); + elm_map_overlay_polygon_region_add(poly, lon, lat); +} + +static void +_poly_clear(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *ei __UNUSED__) +{ + Elm_Map_Overlay *ovl; + if (poly) elm_map_overlay_del(poly); + EINA_LIST_FREE(poly_points, ovl) elm_map_overlay_del(ovl); + poly = NULL; + poly_points = NULL; +} + +static void +_circle_add(void *data, Evas_Object *obj __UNUSED__, void *ei __UNUSED__) +{ + double radius = 100; + double lon, lat; + + if (circle) elm_map_overlay_del(circle); + elm_map_canvas_to_region_convert(data, down_x, down_y, &lon, &lat); + circle = elm_map_overlay_circle_add(data, lon, lat, radius); +} + +static void +_scale_add(void *data, Evas_Object *obj __UNUSED__, void *ei __UNUSED__) +{ + if (scale) elm_map_overlay_del(scale); + scale = elm_map_overlay_scale_add(data, down_x, down_y); +} + +static void +_submenu_src_add(void *data, Elm_Object_Item *parent) +{ + int idx; + const char **tile_srcs; + const char **route_srcs; + const char **name_srcs; + + if ((!data) || (!parent)) return; + + tile_srcs = elm_map_sources_get(data, ELM_MAP_SOURCE_TYPE_TILE); + route_srcs = elm_map_sources_get(data, ELM_MAP_SOURCE_TYPE_ROUTE); + name_srcs = elm_map_sources_get(data, ELM_MAP_SOURCE_TYPE_NAME); + + for (idx = 0; tile_srcs[idx]; idx++) + { + if (idx >= SOURCE_MAX) break; + ts[idx].map = data; + ts[idx].type = ELM_MAP_SOURCE_TYPE_TILE; + ts[idx].source_name = strdup(tile_srcs[idx]); + elm_menu_item_add(menu, parent, "", tile_srcs[idx], _src_set, &ts[idx]); + } + for (idx = 0; route_srcs[idx]; idx++) + { + if (idx >= SOURCE_MAX) break; + rs[idx].map = data; + rs[idx].type = ELM_MAP_SOURCE_TYPE_ROUTE; + rs[idx].source_name = strdup(route_srcs[idx]); + elm_menu_item_add(menu, parent, "", route_srcs[idx], _src_set, &rs[idx]); + } + for (idx = 0; name_srcs[idx]; idx++) + { + if (idx >= SOURCE_MAX) break; + ns[idx].map = data; + ns[idx].type = ELM_MAP_SOURCE_TYPE_NAME; + ns[idx].source_name = strdup(name_srcs[idx]); + elm_menu_item_add(menu, parent, "", name_srcs[idx], _src_set, &ns[idx]); + } +} + +static void +_submenu_move_add(void *data, Elm_Object_Item *parent) +{ + if ((!data) || (!parent)) return; + elm_menu_item_add(menu, parent, NULL, "Show Urmatt", _show_urmatt, data); + elm_menu_item_add(menu, parent, NULL, "Bring Seoul", _bring_seoul, data); + +} + +static void +_submenu_zoom_add(void *data, Elm_Object_Item *parent) +{ + if ((!data) || (!parent)) return; + elm_menu_item_add(menu, parent, NULL, "Zoom +", _zoom_in, data); + elm_menu_item_add(menu, parent, NULL, "Zoom -", _zoom_out, data); + elm_menu_item_add(menu, parent, NULL, "Zoom Fit", _zoom_fit, data); + elm_menu_item_add(menu, parent, NULL, "Zoom Fill", _zoom_fill, data); + elm_menu_item_add(menu, parent, NULL, "Zoom Manual", _zoom_manual, data); + elm_menu_item_add(menu, parent, NULL, "Zoom Min to 1", _zoom_min_set, data); + elm_menu_item_add(menu, parent, NULL, "Zoom Max to 10", _zoom_max_set, data); +} + +static void +_submenu_prop_add(void *data, Elm_Object_Item *parent) +{ + if ((!data) || (!parent)) return; + elm_menu_item_add(menu, parent, NULL, "Paused Set", _paused_set, data); + elm_menu_item_add(menu, parent, NULL, "Paused Unset", _paused_unset, data); + elm_menu_item_add(menu, parent, NULL, "Rotate CW", _rotate_cw, data); + elm_menu_item_add(menu, parent, NULL, "Rotate CCW", _rotate_ccw, data); + elm_menu_item_add(menu, parent, NULL, "Reset Rotate", _rotate_reset, data); + elm_menu_item_add(menu, parent, NULL, "Disable Wheel", _wheel_disable, data); + elm_menu_item_add(menu, parent, NULL, "Enable Wheel", _wheel_enable, data); +} + +static void +_submenu_track_add(void *data, Elm_Object_Item *parent) +{ + if ((!data) || (!parent)) return; + elm_menu_item_add(menu, parent, NULL, "Add Track", _track_add, data); + elm_menu_item_add(menu, parent, NULL, "Remove Track", _track_remove, data); +} + +static void +_submenu_ovl_add(void *data, Elm_Object_Item *parent) +{ + if ((!data) || (!parent)) return; + elm_menu_item_add(menu, parent, NULL, "Add line", _line_add, data); + elm_menu_item_add(menu, parent, NULL, "Add polygon", _poly_add, data); + elm_menu_item_add(menu, parent, NULL, "Clear polygon", _poly_clear, data); + elm_menu_item_add(menu, parent, NULL, "Add circle", _circle_add, data); + elm_menu_item_add(menu, parent, NULL, "Add scale", _scale_add, data); +} + +static void +_map_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Down *down = event_info; + Elm_Object_Item *menu_it; + if (!down) return; + + if (down->button == 2) + { + old_x = down->canvas.x; + old_y = down->canvas.y; + old_d = 0.0; + } + else if (down->button == 3) + { + down_x = down->canvas.x; + down_y = down->canvas.y; + menu = elm_menu_add(obj); + menu_it = elm_menu_item_add(menu, NULL, "", "Source", NULL, NULL); + _submenu_src_add(data, menu_it); + menu_it = elm_menu_item_add(menu, NULL, "", "Move", NULL, NULL); + _submenu_move_add(data, menu_it); + menu_it = elm_menu_item_add(menu, NULL, "", "Zoom", NULL, NULL); + _submenu_zoom_add(data, menu_it); + menu_it = elm_menu_item_add(menu, NULL, "", "Prop", NULL, NULL); + _submenu_prop_add(data, menu_it); + menu_it = elm_menu_item_add(menu, NULL, "", "Track", NULL, NULL); + _submenu_track_add(data, menu_it); + menu_it = elm_menu_item_add(menu, NULL, "", "Overlay", NULL, NULL); + _submenu_ovl_add(data, menu_it); + + elm_menu_move(menu, down->canvas.x, down->canvas.y); + evas_object_show(menu); + } +} + +static void +_map_mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Evas_Event_Mouse_Move *move = event_info; + Evas_Coord x, y, w, h; + float half_w, half_h; + int d, d_diff; + double cur_d; + if (!move) return; + + if (move->buttons == 2) + { + evas_object_geometry_get(data, &x, &y, &w, &h); + half_w = (float)w * 0.5; + half_h = (float)h * 0.5; + elm_map_rotate_get(data, &cur_d, NULL, NULL); + + d = move->cur.canvas.x - old_x; + if (!old_d) old_d = d; + else + { + d_diff = old_d - d; + if (d_diff > 0) + { + old_d --; + cur_d += 1.0; + } + else if (d_diff < 0) + { + old_d ++; + cur_d -= 1.0; + } + old_d = d; + elm_map_rotate_set(data, cur_d, x + half_w, y + half_h); + } + } +} + +static void +_map_mouse_up(void *data __UNUSED__, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Evas_Event_Mouse_Up *up = event_info; + if (!up) return; + + if (up->button == 2) + { + old_x = 0; + old_y = 0; + } +} + +static void +_overlay_cb(void *data __UNUSED__, Evas_Object *map, void *ev) +{ + printf("Overlay clicked: "); + Elm_Map_Overlay *overlay = ev; + Overlay_Data *od; + Elm_Map_Overlay_Type type = elm_map_overlay_type_get(overlay); + + if (type != ELM_MAP_OVERLAY_TYPE_GROUP && + type != ELM_MAP_OVERLAY_TYPE_DEFAULT) return; + + if (!bubble_img) bubble_img = elm_map_overlay_bubble_add(map); + elm_map_overlay_bubble_follow(bubble_img, overlay); + elm_map_overlay_bubble_content_clear(bubble_img); + + if (type == ELM_MAP_OVERLAY_TYPE_GROUP) + { + Eina_List *l; + Elm_Map_Overlay *memb; + Eina_List *members = elm_map_overlay_group_members_get(overlay); + printf("Group Members Num: %d\n", eina_list_count(members)); + EINA_LIST_FOREACH(members, l, memb) + { + od = elm_map_overlay_data_get(memb); + if (od) + elm_map_overlay_bubble_content_append(bubble_img, + _box_get(map, od, memb)); + } + } + else + { + od = elm_map_overlay_data_get(overlay); + if (od) + elm_map_overlay_bubble_content_append(bubble_img, + _box_get(map, od, overlay)); + elm_map_overlay_bubble_content_append(bubble_img, + _btn_box_get(map, overlay)); + } +} + +static void +_parking_cb(void *data __UNUSED__, Evas_Object *map, Elm_Map_Overlay *ovl) +{ + double lon, lat; + Evas_Coord x, y; + elm_map_overlay_region_get(ovl, &lon, &lat); + elm_map_region_to_canvas_convert(map, lon, lat, &x, &y); + printf("Parking clicked: %lf %lf %d %d\n", lon, lat, x, y); + + elm_map_canvas_to_region_convert(map, x+40, y+50, &lon, &lat); + if (!bubble_parking) + { + Evas_Object *bubble, *label; + bubble = elm_bubble_add(map); + elm_bubble_pos_set(bubble, ELM_BUBBLE_POS_TOP_LEFT); + elm_object_text_set(bubble, "Overlay object"); + elm_object_part_text_set(bubble, "info", "Bubble is overlayed"); + + label = elm_label_add(bubble); + elm_object_text_set(label, "Parking Here !!"); + evas_object_show(label); + elm_object_content_set(bubble, label); + + evas_object_resize(bubble, 125, 50); + evas_object_show(bubble); + + bubble_parking = elm_map_overlay_add(map, lon, lat); + elm_map_overlay_content_set(bubble_parking, bubble); + } + else elm_map_overlay_region_set(bubble_parking, lon, lat); + elm_map_overlay_data_set(bubble_parking, ovl); +} + +static void +_del_map(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *ei __UNUSED__) +{ + if (route_start) elm_map_overlay_del(route_start); + if (route_end) elm_map_overlay_del(route_end); + if (route_clas) elm_map_overlay_del(route_clas); + if (bubble_img) elm_map_overlay_del(bubble_img); + if (bubble_parking) elm_map_overlay_del(bubble_parking); + if (route_ovl) elm_map_overlay_del(route_ovl); + route_start = NULL; + route_end = NULL; + route_clas = NULL; + bubble_img = NULL; + bubble_parking = NULL; + route_ovl = NULL; + + if (route) elm_map_route_del(route); + if (name) elm_map_name_del(name); + route = NULL; + name = NULL; +} + +void +test_map(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *map; + int idx = 0; + const char **tile_srcs; + const char **route_srcs; + const char **name_srcs; + + win = elm_win_util_standard_add("map", "Map"); + elm_win_autodel_set(win, EINA_TRUE); + + map = elm_map_add(win); + if (map) + { + Elm_Map_Overlay *ovl_1, *ovl_2, *ovl_3, *ovl_4, *ovl_5, *ovl_6; + Elm_Map_Overlay *ovl_7, *ovl_8, *ovl_9, *ovl_10, *ovl_11; + Elm_Map_Overlay *parking1, *parking2, *parking3, *parking4, *parking5; + Elm_Map_Overlay *grp1, *grp2, *grp_parking; + + evas_object_event_callback_add(map, EVAS_CALLBACK_DEL, _del_map, NULL); + + srand(time(NULL)); + + tile_srcs = elm_map_sources_get(map, ELM_MAP_SOURCE_TYPE_TILE); + route_srcs = elm_map_sources_get(map, ELM_MAP_SOURCE_TYPE_ROUTE); + name_srcs = elm_map_sources_get(map, ELM_MAP_SOURCE_TYPE_NAME); + + if (!tile_srcs) return; + printf("Tile sources [ "); + for (idx = 0; tile_srcs[idx] ; idx++) printf("%s, ", tile_srcs[idx]); + printf("]\n"); + if (!route_srcs) return; + printf("Route sources [ "); + for (idx = 0; route_srcs[idx] ; idx++) printf("%s, ", route_srcs[idx]); + printf("]\n"); + if (!name_srcs) return; + printf("Name sources [ "); + for (idx = 0; name_srcs[idx] ; idx++) printf("%s, ", name_srcs[idx]); + printf("]\n"); + + evas_object_size_hint_weight_set(map, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, map); + evas_object_data_set(map, "window", win); + + evas_object_event_callback_add(map, EVAS_CALLBACK_MOUSE_DOWN, + _map_mouse_down, map); + evas_object_event_callback_add(map, EVAS_CALLBACK_MOUSE_MOVE, + _map_mouse_move, map); + evas_object_event_callback_add(map, EVAS_CALLBACK_MOUSE_UP, + _map_mouse_up, map); + + evas_object_smart_callback_add(map, "clicked", _map_clicked, map); + evas_object_smart_callback_add(map, "clicked,double", _map_clicked_double, map); + evas_object_smart_callback_add(map, "press", _map_press, map); + evas_object_smart_callback_add(map, "longpressed", _map_longpressed, map); + evas_object_smart_callback_add(map, "scroll", _map_scroll, map); + evas_object_smart_callback_add(map, "scroll,drag,start", _map_drag_start, map); + evas_object_smart_callback_add(map, "scroll,drag,stop", _map_drag_stop, map); + evas_object_smart_callback_add(map, "scroll,anim,start", _map_anim_start, map); + evas_object_smart_callback_add(map, "scroll,anim,stop", _map_anim_stop, map); + evas_object_smart_callback_add(map, "zoom,start", _map_zoom_start, map); + evas_object_smart_callback_add(map, "zoom,stop", _map_zoom_stop, map); + evas_object_smart_callback_add(map, "zoom,change", _map_zoom_change, map); + evas_object_smart_callback_add(map, "tile,load", _map_tile_load, map); + evas_object_smart_callback_add(map, "tile,loaded", _map_tile_loaded, map); + evas_object_smart_callback_add(map, "tile,loaded,fail", _map_tile_loaded_fail, map); + evas_object_smart_callback_add(map, "route,load", _map_route_load, map); + evas_object_smart_callback_add(map, "route,loaded", _map_route_loaded, map); + evas_object_smart_callback_add(map, "route,loaded,fail", _map_route_loaded_fail, map); + evas_object_smart_callback_add(map, "name,load", _map_name_load, map); + evas_object_smart_callback_add(map, "name,loaded", _map_name_loaded, map); + evas_object_smart_callback_add(map, "name,loaded,fail", _map_name_loaded_fail, map); + evas_object_smart_callback_add(map, "overlay,clicked", _overlay_cb, map); + + // Create Overlays + ovl_1 = elm_map_overlay_add(map, 2.352, 48.857); + elm_map_overlay_color_set(ovl_1, 0x00, 0xfa, 0x9a, 0xff); + elm_map_overlay_displayed_zoom_min_set(ovl_1, 5); + ovl_2 = elm_map_overlay_add(map, 3, 48.857); + elm_map_overlay_color_set(ovl_2, 0xff, 0xd7, 0x00, 0xff); + elm_map_overlay_displayed_zoom_min_set(ovl_2, 4); + ovl_3 = elm_map_overlay_add(map, 2.352, 49); + elm_map_overlay_displayed_zoom_min_set(ovl_3, 3); + ovl_4 = elm_map_overlay_add(map, 7.31451, 48.857127); + ovl_5 = elm_map_overlay_add(map, 7.314704, 48.857119); + ovl_6 = elm_map_overlay_add(map, 7.31432, 48.856785); + ovl_7 = elm_map_overlay_add(map, 7.3148, 48.85725); + ovl_8 = elm_map_overlay_add(map, 7.316445, 48.8572210000694); + ovl_9 = elm_map_overlay_add(map, 7.316527000125, 48.85609); + ovl_10 = elm_map_overlay_add(map, 7.3165409990833, 48.856078); + ovl_11 = elm_map_overlay_add(map, 7.319812, 48.856561); + elm_map_overlay_data_set(ovl_1, &data1); + elm_map_overlay_data_set(ovl_2, &data2); + elm_map_overlay_data_set(ovl_3, &data3); + elm_map_overlay_data_set(ovl_4, &data4); + elm_map_overlay_data_set(ovl_5, &data5); + elm_map_overlay_data_set(ovl_6, &data6); + elm_map_overlay_data_set(ovl_7, &data7); + elm_map_overlay_data_set(ovl_8, &data8); + elm_map_overlay_data_set(ovl_9, &data9); + elm_map_overlay_data_set(ovl_10, &data10); + elm_map_overlay_data_set(ovl_11, &data11); + + // Append overlays to groups + grp1 = elm_map_overlay_class_add(map); + elm_map_overlay_class_zoom_max_set(grp1, 6); + elm_map_overlay_class_append(grp1, ovl_1); + elm_map_overlay_class_append(grp1, ovl_2); + elm_map_overlay_class_append(grp1, ovl_3); + elm_map_overlay_class_append(grp1, ovl_4); + elm_map_overlay_class_append(grp1, ovl_5); + elm_map_overlay_class_append(grp1, ovl_6); + + // Append overlays to groups + grp2 = elm_map_overlay_class_add(map); + elm_map_overlay_displayed_zoom_min_set(grp2, 9); + elm_map_overlay_class_append(grp2, ovl_7); + elm_map_overlay_class_append(grp2, ovl_8); + elm_map_overlay_class_append(grp2, ovl_9); + elm_map_overlay_class_append(grp2, ovl_10); + elm_map_overlay_class_append(grp2, ovl_11); + + // Create overlays + parking1 = elm_map_overlay_add(map, 127.04871, 37.25730); + parking2 = elm_map_overlay_add(map, 127.05578, 37.25545); + parking3 = elm_map_overlay_add(map, 127.05515, 37.25439); + parking4 = elm_map_overlay_add(map, 127.05328, 37.25721); + elm_map_overlay_icon_set(parking4, _icon_get(map, &icon_data)); + parking5 = elm_map_overlay_add(map, 127.05431, 37.25873); + elm_map_overlay_content_set(parking5, _label_get(map)); + elm_map_overlay_get_cb_set(parking1, _parking_cb, NULL); + elm_map_overlay_get_cb_set(parking2, _parking_cb, NULL); + elm_map_overlay_get_cb_set(parking3, _parking_cb, NULL); + elm_map_overlay_get_cb_set(parking4, _parking_cb, NULL); + elm_map_overlay_get_cb_set(parking5, _parking_cb, NULL); + + // Append overlays to groups + grp_parking = elm_map_overlay_class_add(map); + elm_map_overlay_icon_set(grp_parking, _icon_get(map, &parking)); + elm_map_overlay_get_cb_set(grp_parking, _parking_cb, NULL); + elm_map_overlay_class_append(grp_parking, parking1); + elm_map_overlay_class_append(grp_parking, parking2); + elm_map_overlay_class_append(grp_parking, parking3); + elm_map_overlay_class_append(grp_parking, parking4); + elm_map_overlay_class_append(grp_parking, parking5); + + evas_object_show(map); + } + + evas_object_resize(win, 800, 800); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_menu.c b/libraries/elementary/src/bin/test_menu.c new file mode 100644 index 0000000..cc940d7 --- /dev/null +++ b/libraries/elementary/src/bin/test_menu.c @@ -0,0 +1,127 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static Evas_Object *menu; + +static void +_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Evas_Event_Mouse_Down *ev = event_info; + elm_menu_move(data, ev->canvas.x, ev->canvas.y); + evas_object_show(data); +} + +static void +_populate_4(Elm_Object_Item *menu_it) +{ + Elm_Object_Item *menu_it2; + + elm_menu_item_add(menu, menu_it, "go-bottom", "menu 2", NULL, NULL); + elm_menu_item_add(menu, menu_it, "go-first", "menu 3", NULL, NULL); + elm_menu_item_separator_add(menu, menu_it); + menu_it2 = elm_menu_item_add(menu, menu_it, "go-last", "Disabled item", NULL, + NULL); + elm_object_item_disabled_set(menu_it2, EINA_TRUE); + menu_it2 = elm_menu_item_add(menu, menu_it, "go-next", "Disabled item", NULL, + NULL); + elm_object_item_disabled_set(menu_it2, EINA_TRUE); + menu_it2 = elm_menu_item_add(menu, menu_it, "go-up", "Disabled item", NULL, + NULL); + elm_object_item_disabled_set(menu_it2, EINA_TRUE); +} + +static void +_populate_3(Elm_Object_Item *menu_it) +{ + Elm_Object_Item *menu_it2; + + elm_menu_item_add(menu, menu_it, "media-eject", "menu 2", NULL, NULL); + elm_menu_item_add(menu, menu_it, "media-playback-start", "menu 3", NULL, + NULL); + elm_menu_item_separator_add(menu, menu_it); + menu_it2 = elm_menu_item_add(menu, menu_it, "media-playback-stop", + "Disabled item", NULL, NULL); + elm_object_item_disabled_set(menu_it2, EINA_TRUE); +} + +static void +_populate_2(Elm_Object_Item *menu_it) +{ + Elm_Object_Item *menu_it2, *menu_it3; + + elm_menu_item_add(menu, menu_it, "system-reboot", "menu 2", NULL, NULL); + menu_it2 = elm_menu_item_add(menu, menu_it, "system-shutdown", "menu 3", + NULL, NULL); + _populate_3(menu_it2); + + elm_menu_item_separator_add(menu, menu_it); + elm_menu_item_separator_add(menu, menu_it); + elm_menu_item_separator_add(menu, menu_it); + elm_menu_item_separator_add(menu, menu_it); + elm_menu_item_separator_add(menu, menu_it); + elm_menu_item_separator_add(menu, menu_it); + elm_menu_item_separator_add(menu, menu_it); + + menu_it2 = elm_menu_item_add(menu, menu_it, "system-lock-screen", "menu 2", + NULL, NULL); + elm_menu_item_separator_add(menu, menu_it); + + menu_it3 = elm_menu_item_add(menu, menu_it, "system-run", "Disabled item", + NULL, NULL); + elm_object_item_disabled_set(menu_it3, EINA_TRUE); + + _populate_4(menu_it2); +} + +static void +_populate_1(Evas_Object *obj, Elm_Object_Item *menu_it) +{ + Elm_Object_Item *menu_it2, *menu_it3; + Evas_Object *radio; + + radio = elm_radio_add(obj); + elm_radio_state_value_set(radio, 0); + elm_radio_value_set(radio, 0); + elm_object_text_set(radio, "radio in menu"); + menu_it2 = elm_menu_item_add(menu, menu_it, "object-rotate-left", "menu 1", + NULL, NULL); + menu_it3 = elm_menu_item_add(menu, menu_it, NULL, NULL, NULL, NULL); + elm_object_item_content_set(menu_it3, radio); + + _populate_2(menu_it2); +} + +void +test_menu(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *rect; + Elm_Object_Item *menu_it; + + win = elm_win_util_standard_add("menu", "Menu"); + elm_win_autodel_set(win, EINA_TRUE); + + rect = evas_object_rectangle_add(evas_object_evas_get(win)); + elm_win_resize_object_add(win, rect); + evas_object_size_hint_weight_set(rect, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_color_set(rect, 0, 0, 0, 0); + evas_object_show(rect); + + menu = elm_menu_add(win); + elm_menu_item_add(menu, NULL, NULL, "first item", NULL, NULL); + + menu_it = elm_menu_item_add(menu, NULL, "mail-reply-all", "second item", + NULL, NULL); + _populate_1(win, menu_it); + + elm_menu_item_add(menu, menu_it, "window-new", "sub menu", NULL, NULL); + + evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_DOWN, _show, menu); + + evas_object_resize(win, 350, 200); + evas_object_show(win); +} + +#endif diff --git a/libraries/elementary/src/bin/test_multi.c b/libraries/elementary/src/bin/test_multi.c new file mode 100644 index 0000000..514f4cd --- /dev/null +++ b/libraries/elementary/src/bin/test_multi.c @@ -0,0 +1,135 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +#define IND_NUM 20 + +static Evas_Object *indicator[IND_NUM]; + +static void +_mouse_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info) +{ + Evas_Event_Mouse_Down *ev = event_info; + + if (ev->button != 1) return; + printf("MOUSE: down @ %4i %4i\n", ev->canvas.x, ev->canvas.y); + evas_object_move(indicator[0], ev->canvas.x, ev->canvas.y); + evas_object_resize(indicator[0], 1, 1); + evas_object_show(indicator[0]); +} + +static void +_mouse_up(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info) +{ + Evas_Event_Mouse_Up *ev = event_info; + if (ev->button != 1) return; + printf("MOUSE: up @ %4i %4i\n", ev->canvas.x, ev->canvas.y); + evas_object_hide(indicator[0]); +} + +static void +_mouse_move(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info) +{ + Evas_Event_Mouse_Move *ev = event_info; + printf("MOUSE: move @ %4i %4i\n", ev->cur.canvas.x, ev->cur.canvas.y); + evas_object_move(indicator[0], ev->cur.canvas.x, ev->cur.canvas.y); + evas_object_resize(indicator[0], 1, 1); +} + +static void +_multi_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info) +{ + Evas_Event_Multi_Down *ev = event_info; + printf("MULTI: down @ %4i %4i | dev: %i\n", ev->canvas.x, ev->canvas.y, ev->device); + if (ev->device >= IND_NUM) return; + evas_object_move(indicator[ev->device], ev->canvas.x, ev->canvas.y); + evas_object_resize(indicator[ev->device], 1, 1); + evas_object_show(indicator[ev->device]); +} + +static void +_multi_up(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info) +{ + Evas_Event_Multi_Up *ev = event_info; + printf("MULTI: up @ %4i %4i | dev: %i\n", ev->canvas.x, ev->canvas.y, ev->device); + if (ev->device >= IND_NUM) return; + evas_object_hide(indicator[ev->device]); +} + +static void +_multi_move(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info) +{ + Evas_Event_Multi_Move *ev = event_info; + printf("MULTI: move @ %4i %4i | dev: %i\n", ev->cur.canvas.x, + ev->cur.canvas.y, ev->device); + if (ev->device >= IND_NUM) return; + evas_object_move(indicator[ev->device], ev->cur.canvas.x, ev->cur.canvas.y); + evas_object_resize(indicator[ev->device], 1, 1); +} + +void +my_bt_rot(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + elm_win_rotation_set(win, elm_win_rotation_get(win) + 90); +} + +void +test_multi(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bg, *r, *bx, *bt; + int i; + + win = elm_win_add(NULL, "bg-plain", ELM_WIN_BASIC); + elm_win_title_set(win, "Bg Plain"); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + r = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_size_hint_weight_set(r, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_color_set(r, 0, 0, 0, 0); + elm_win_resize_object_add(win, r); + evas_object_show(r); + + for (i = 0; i < IND_NUM; i++) + { + char buf[PATH_MAX]; + + snprintf(buf, sizeof(buf), "%s/objects/multip.edj", elm_app_data_dir_get()); + indicator[i] = edje_object_add(evas_object_evas_get(win)); + edje_object_file_set(indicator[i], buf, "point"); + } + + evas_object_event_callback_add(r, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down, win); + evas_object_event_callback_add(r, EVAS_CALLBACK_MOUSE_UP, _mouse_up, win); + evas_object_event_callback_add(r, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move, win); + evas_object_event_callback_add(r, EVAS_CALLBACK_MULTI_DOWN, _multi_down, win); + evas_object_event_callback_add(r, EVAS_CALLBACK_MULTI_UP, _multi_up, win); + evas_object_event_callback_add(r, EVAS_CALLBACK_MULTI_MOVE, _multi_move, win); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Rotate"); + evas_object_smart_callback_add(bt, "clicked", my_bt_rot, win); + evas_object_size_hint_align_set(bt, 0.0, 0.0); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + evas_object_size_hint_min_set(bg, 160, 160); + evas_object_resize(win, 480, 800); + + evas_object_show(win); +} + +#endif diff --git a/libraries/elementary/src/bin/test_multibuttonentry.c b/libraries/elementary/src/bin/test_multibuttonentry.c new file mode 100644 index 0000000..d5d983c --- /dev/null +++ b/libraries/elementary/src/bin/test_multibuttonentry.c @@ -0,0 +1,226 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static void +_item_selected_cb(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + Elm_Object_Item *mbe_it = event_info; + printf("selected item = %s\n", elm_object_item_text_get(mbe_it)); +} + +// "item,added" smart callback of multibuttonentry. +static void +_item_added_cb(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + Elm_Object_Item *mbe_it = event_info; + printf("added item = %s\n", elm_object_item_text_get(mbe_it)); +} + +// "item,deleted" smart callback +static void +_item_deleted_cb(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + printf("deleted item\n"); +} + +// "item,clicked" smart callback +static void +_item_clicked_cb(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info ) +{ + Elm_Object_Item *mbe_it = event_info; + printf("clicked item = %s\n", elm_object_item_text_get(mbe_it)); +} + +static void +_mbe_clicked_cb(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__ ) +{ + //Unset the multibuttonentry to contracted mode of single line + elm_multibuttonentry_expanded_set(obj, EINA_TRUE); + printf("A multibuttonentry is clicked!\n"); + Evas_Object *entry; + entry = elm_multibuttonentry_entry_get(obj); + if (!entry) + { + printf("%s entry is NULL\n", __func__); + } + + Evas_Coord x, y, w, h; + Evas_Coord mbe_x, mbe_y, mbe_w, mbe_h; + evas_object_geometry_get(obj, &mbe_x, &mbe_y, &mbe_w, &mbe_h); + evas_object_geometry_get(entry, &x, &y, &w, &h); + printf("%s mbe x :%d y:%d w :%d h:%d\n", __func__, mbe_x, mbe_y, mbe_w, mbe_h); + printf("%s wd->entry x :%d y:%d w :%d h:%d\n", __func__, x, y, w, h); +} + +static void +_mbe_unfocused_cb(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__ ) +{ + //Set the multibuttonentry to contracted mode of single line + elm_multibuttonentry_expanded_set(obj, EINA_FALSE); + printf("multibuttonentry unfocused!\n"); +} + +static void +_mbe_focused_cb(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__ ) +{ + printf("multibuttonentry focused!\n"); +} + +// "expanded" smart callback +static void +_expanded_cb(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + printf("expanded!\n"); +} + +// "contracted" smart callback +static void +_contracted_cb(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + printf("contracted!\n"); +} + +// "contracted,state,changed" smart callback +static void +_shrink_state_changed_cb(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + printf("contracted state changed! \n"); +} + +// "item verified" confirm callback +static Eina_Bool +_item_filter_cb(Evas_Object *obj __UNUSED__, + const char* item_label, + void *item_data __UNUSED__, + void *data __UNUSED__) +{ + printf("%s, label: %s\n", __func__, item_label); + + return EINA_TRUE; +} + +static void +_button_clicked_cb(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + printf("%s button is clicked\n", __func__); +} + +static Evas_Object* +_add_multibuttonentry(Evas_Object *parent) +{ + Evas_Object *scr = NULL; + Evas_Object *mbe = NULL; + void *data = NULL; + + scr = elm_scroller_add(parent); + elm_scroller_bounce_set(scr, EINA_FALSE, EINA_TRUE); + elm_scroller_policy_set(scr, ELM_SCROLLER_POLICY_OFF,ELM_SCROLLER_POLICY_AUTO); + evas_object_show(scr); + + mbe = elm_multibuttonentry_add(parent); + elm_object_text_set(mbe, "To: "); + elm_object_part_text_set(mbe, "guide", "Tap to add recipient"); + evas_object_size_hint_weight_set(mbe, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(mbe, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_content_set(scr, mbe); + + // Add item verify callback to Multibuttonentry + elm_multibuttonentry_item_filter_append(mbe, _item_filter_cb, data); + + // Add "item,selected","item,added", "item,deleted", "clicked", "unfocused", + // "expanded", "contracted" and "contracted,state,changed" smart callback + evas_object_smart_callback_add(mbe, "item,selected", _item_selected_cb, NULL); + evas_object_smart_callback_add(mbe, "item,added", _item_added_cb, NULL); + evas_object_smart_callback_add(mbe, "item,deleted", _item_deleted_cb, NULL); + evas_object_smart_callback_add(mbe, "item,clicked", _item_clicked_cb, NULL); + + evas_object_smart_callback_add(mbe, "clicked", _mbe_clicked_cb, NULL); + evas_object_smart_callback_add(mbe, "focused", _mbe_focused_cb, NULL); + evas_object_smart_callback_add(mbe, "unfocused", _mbe_unfocused_cb, NULL); + + evas_object_smart_callback_add(mbe, "expanded", _expanded_cb, NULL); + evas_object_smart_callback_add(mbe, "contracted", _contracted_cb, NULL); + evas_object_smart_callback_add(mbe, "shrink,state,changed", _shrink_state_changed_cb, NULL); + + evas_object_resize(mbe, 220, 300); + elm_object_focus_set(mbe, EINA_TRUE); + + return scr; +} + +static Evas_Object* +_add_buttons(Evas_Object *parent) +{ + Evas_Object *bx = NULL; + Evas_Object *btn; + + bx = elm_box_add(parent); + elm_box_horizontal_set(bx, EINA_TRUE); + elm_box_homogeneous_set(bx, EINA_TRUE); + + btn = elm_button_add(parent); + evas_object_smart_callback_add(btn, "clicked", _button_clicked_cb, NULL); + elm_object_text_set(btn, "click"); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, btn); + evas_object_show(btn); + + return bx; +} + +void +test_multibuttonentry(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *win, *sc, *bx; + Evas_Object *ly; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("multibuttonentry", "MultiButtonEntry"); + elm_win_autodel_set(win, EINA_TRUE); + + ly = elm_layout_add(win); + snprintf(buf, sizeof(buf), "%s/objects/multibuttonentry.edj", elm_app_data_dir_get()); + elm_layout_file_set(ly, buf, "multibuttonentry_test"); + evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, ly); + evas_object_show(ly); + + sc = _add_multibuttonentry(ly); + elm_object_part_content_set(ly, "multibuttonentry", sc); + + bx = _add_buttons(ly); + elm_object_part_content_set(ly, "box", bx); + + evas_object_resize(win, 320, 480); + evas_object_show(win); + elm_object_focus_set(sc, EINA_TRUE); +} +#endif diff --git a/libraries/elementary/src/bin/test_naviframe.c b/libraries/elementary/src/bin/test_naviframe.c new file mode 100644 index 0000000..1525da1 --- /dev/null +++ b/libraries/elementary/src/bin/test_naviframe.c @@ -0,0 +1,256 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +#define BUTTON_TEXT_SET(BT, TEXT) \ + elm_object_text_set((BT), (TEXT)); \ + elm_object_tooltip_text_set((BT), (TEXT)); \ + elm_object_tooltip_window_mode_set((BT), EINA_TRUE) + +static const char *img1 = PACKAGE_DATA_DIR "/images/logo.png"; +static const char *img2 = PACKAGE_DATA_DIR "/images/plant_01.jpg"; +static const char *img3 = PACKAGE_DATA_DIR "/images/rock_01.jpg"; +static const char *img4 = PACKAGE_DATA_DIR "/images/rock_02.jpg"; +static const char *img5 = PACKAGE_DATA_DIR "/images/sky_01.jpg"; +static const char *img6 = PACKAGE_DATA_DIR "/images/sky_02.jpg"; +static const char *img7 = PACKAGE_DATA_DIR "/images/sky_03.jpg"; + +Evas_Object * +_content_new(Evas_Object *parent, const char *img) +{ + Evas_Object *photo = elm_photo_add(parent); + elm_photo_file_set(photo, img); + elm_photo_fill_inside_set(photo, EINA_TRUE); + elm_object_style_set(photo, "shadow"); + return photo; +} + +void +_navi_pop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_naviframe_item_pop(data); +} + +void +_navi_it_del(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_object_item_del(data); +} + +void +_title_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("Title Clicked!\n"); +} + +void +_title_visible(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_naviframe_item_title_visible_set(data, + !elm_naviframe_item_title_visible_get(data)); +} + +void +_promote(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_naviframe_item_promote(data); +} + +void +_page7(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *bt, *bt2, *content, *nf = data; + Elm_Object_Item *it; + + bt = elm_button_add(nf); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + BUTTON_TEXT_SET(bt, "Page 6"); + + bt2 = elm_button_add(nf); + evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, EVAS_HINT_FILL); + BUTTON_TEXT_SET(bt2, "Page 1"); + evas_object_smart_callback_add(bt2, "clicked", _promote, + evas_object_data_get(nf, "page1")); + content = _content_new(nf, img6); + it = elm_naviframe_item_push(nf, "Page 7", bt, bt2, content, "overlap"); + elm_object_item_part_text_set(it, "subtitle", "Overlap style!"); + + evas_object_smart_callback_add(bt, "clicked", _navi_pop, nf); +} + +void +_page6(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *bt, *bt2, *content, *nf = data; + Elm_Object_Item *it; + + bt = elm_button_add(nf); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + BUTTON_TEXT_SET(bt, "Page 5"); + + bt2 = elm_button_add(nf); + evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, EVAS_HINT_FILL); + BUTTON_TEXT_SET(bt2, "Page 7"); + evas_object_smart_callback_add(bt2, "clicked", _page7, nf); + + content = _content_new(nf, img7); + it = elm_naviframe_item_push(nf, "Page 6", bt, bt2, content, "overlap"); + elm_object_item_part_text_set(it, "subtitle", "Overlap style!"); + + evas_object_smart_callback_add(bt, "clicked", _navi_pop, nf); +} + +void +_page5(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *bt, *bt2, *content, *nf = data; + Elm_Object_Item *it; + + bt = elm_button_add(nf); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + BUTTON_TEXT_SET(bt, "Page 4"); + + bt2 = elm_button_add(nf); + evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, EVAS_HINT_FILL); + BUTTON_TEXT_SET(bt2, "Page 6"); + evas_object_smart_callback_add(bt2, "clicked", _page6, nf); + + content = _content_new(nf, img5); + it = elm_naviframe_item_insert_after(nf, + elm_naviframe_top_item_get(nf), + "Page 5", + bt, + bt2, + content, + NULL); + elm_object_item_part_text_set(it, "subtitle", "This page is inserted without transition"); + evas_object_smart_callback_add(bt, "clicked", _navi_it_del, it); +} + +void +_page4(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *bt, *ic, *content, *nf = data; + char buf[PATH_MAX]; + Elm_Object_Item *it; + + ic = elm_icon_add(nf); + snprintf(buf, sizeof(buf), "%s/images/icon_right_arrow.png", + elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + + bt = elm_button_add(nf); + evas_object_smart_callback_add(bt, "clicked", _page5, nf); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_part_content_set(bt, "icon", ic); + + content = _content_new(nf, img4); + + it = elm_naviframe_item_push(nf, + "Page 4", + NULL, + bt, + content, + NULL); + elm_object_item_part_text_set(it, "subtitle", "Title area visibility test"); + + ic = elm_icon_add(nf); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", + elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + elm_object_item_part_content_set(it, "icon", ic); + elm_naviframe_item_title_visible_set(it, EINA_FALSE); + evas_object_smart_callback_add(content, "clicked", _title_visible, it); +} + +void +_page3(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *bt, *bt2, *ic, *content, *nf = data; + char buf[PATH_MAX]; + Elm_Object_Item *it; + + bt = elm_button_add(nf); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + BUTTON_TEXT_SET(bt, "Prev"); + evas_object_smart_callback_add(bt, "clicked", _navi_pop, nf); + + bt2 = elm_button_add(nf); + evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, EVAS_HINT_FILL); + BUTTON_TEXT_SET(bt2, "Next"); + evas_object_smart_callback_add(bt2, "clicked", _page4, nf); + + content = _content_new(nf, img3); + + it = elm_naviframe_item_push(nf, + "Page 3", + bt, + bt2, + content, + NULL); + ic = elm_icon_add(nf); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + + elm_object_item_part_content_set(it, "icon", ic); +} + +void +_page2(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *bt, *content, *ic, *nf = data; + char buf[PATH_MAX]; + Elm_Object_Item *it; + + bt = elm_button_add(nf); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_smart_callback_add(bt, "clicked", _page3, nf); + + ic = elm_icon_add(nf); + snprintf(buf, sizeof(buf), "%s/images/icon_right_arrow.png", + elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + elm_object_part_content_set(bt, "icon", ic); + + content = _content_new(nf, img2); + + it = elm_naviframe_item_push(nf, "Page 2", NULL, bt, content, NULL); + elm_object_item_part_text_set(it, "subtitle", "Here is sub-title part!"); +} + +void +test_naviframe(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *nf, *btn, *content; + Elm_Object_Item *it; + + win = elm_win_util_standard_add("naviframe", "Naviframe"); + elm_win_focus_highlight_enabled_set(win, EINA_TRUE); + elm_win_autodel_set(win, EINA_TRUE); + + nf = elm_naviframe_add(win); + evas_object_size_hint_weight_set(nf, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, nf); + evas_object_show(nf); + evas_object_smart_callback_add(nf, "title,clicked", _title_clicked, 0); + + btn = elm_button_add(nf); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_smart_callback_add(btn, "clicked", _page2, nf); + BUTTON_TEXT_SET(btn, "Next"); + evas_object_show(btn); + + content = _content_new(nf, img1); + it = elm_naviframe_item_push(nf, "Page 1", NULL, btn, content, NULL); + evas_object_data_set(nf, "page1", it); + + evas_object_resize(win, 400, 600); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_naviframe_complex.c b/libraries/elementary/src/bin/test_naviframe_complex.c new file mode 100644 index 0000000..eeb33de --- /dev/null +++ b/libraries/elementary/src/bin/test_naviframe_complex.c @@ -0,0 +1,366 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +#define WEIGHT evas_object_size_hint_weight_set +#define ALIGN evas_object_size_hint_align_set +#define EXPAND(X) WEIGHT((X), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND) +#define FILL(X) ALIGN((X), EVAS_HINT_FILL, EVAS_HINT_FILL) + +#define BUTTON_TEXT_SET(BT, TEXT) \ + elm_object_text_set((BT), (TEXT)); \ + elm_object_tooltip_text_set((BT), (TEXT)); \ + elm_object_tooltip_window_mode_set((BT), EINA_TRUE) + +static const char *img1 = PACKAGE_DATA_DIR "/images/logo.png"; +static const char *img2 = PACKAGE_DATA_DIR "/images/plant_01.jpg"; +static const char *img3 = PACKAGE_DATA_DIR "/images/rock_01.jpg"; +static const char *img4 = PACKAGE_DATA_DIR "/images/rock_02.jpg"; +static const char *img5 = PACKAGE_DATA_DIR "/images/sky_01.jpg"; +static const char *img6 = PACKAGE_DATA_DIR "/images/sky_02.jpg"; +static const char *img7 = PACKAGE_DATA_DIR "/images/sky_03.jpg"; + +static char * +gl_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__) +{ + char buf[256]; + snprintf(buf, sizeof(buf), "Item # %i", (int)(long)data); + return strdup(buf); +} + +static Evas_Object * +gl_content_get(void *data __UNUSED__, Evas_Object *obj, const char *part) +{ + char buf[PATH_MAX]; + Evas_Object *ic = elm_icon_add(obj); + if (!strcmp(part, "elm.swallow.end")) + snprintf(buf, sizeof(buf), "%s/images/bubble.png", elm_app_data_dir_get()); + else + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + return ic; +} + +static Elm_Genlist_Item_Class itc = +{ + .version = ELM_GENLIST_ITEM_CLASS_VERSION, + .item_style = "default", + .func = + { + .text_get = gl_text_get, + .content_get = gl_content_get, + .state_get = NULL, + .del = NULL + } +}; + +static Evas_Object * +_content_image_new(Evas_Object *parent, const char *img) +{ + Evas_Object *ic; + + ic = elm_icon_add(parent); + elm_icon_file_set(ic, img, NULL); + elm_icon_fill_outside_set(ic, EINA_FALSE); + return ic; +} + +static void +_gl_selected(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + printf("selected: %p\n", event_info); +} + +static void +_gl_double_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + printf("double clicked: %p\n", event_info); +} + +static void +_gl_longpress(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + printf("longpress %p\n", event_info); +} + +static void +_content_list_populate_cb(Evas_Object *gl) +{ + int i; + for (i = 0; i < 10; i++) + elm_genlist_item_append(gl, &itc, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); + if (elm_genlist_items_count(gl) < 500) + ecore_job_add((Ecore_Cb)_content_list_populate_cb, gl); +} + +static Evas_Object * +_content_list_new(Evas_Object *parent) +{ + Evas_Object *gl; + + gl = elm_genlist_add(parent); + evas_object_smart_callback_add(gl, "selected", _gl_selected, NULL); + evas_object_smart_callback_add(gl, "clicked,double", _gl_double_clicked, NULL); + evas_object_smart_callback_add(gl, "longpressed", _gl_longpress, NULL); + // FIXME: This causes genlist to resize the horiz axis very slowly :( + // Reenable this and resize the window horizontally, then try to resize it back + //elm_genlist_mode_set(gl, ELM_LIST_LIMIT); + + ecore_job_add((Ecore_Cb)_content_list_populate_cb, gl); + return gl; +} + +static void +_navi_pop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_naviframe_item_pop(data); +} + +static void +_navi_it_del(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_object_item_del(data); +} + +static void +_title_visible(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_naviframe_item_title_visible_set(data, + !elm_naviframe_item_title_visible_get(data)); +} + +static void +_promote(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_naviframe_item_promote(data); +} + +static void +_page7(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *bt, *bt2, *content, *nf = data; + Elm_Object_Item *it; + + bt = elm_button_add(nf); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + BUTTON_TEXT_SET(bt, "Page 6"); + + bt2 = elm_button_add(nf); + evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, EVAS_HINT_FILL); + BUTTON_TEXT_SET(bt2, "Page 1"); + evas_object_smart_callback_add(bt2, "clicked", _promote, + evas_object_data_get(nf, "page1")); + content = _content_image_new(nf, img6); + it = elm_naviframe_item_push(nf, "Page 7", bt, bt2, content, "overlap"); + elm_object_item_part_text_set(it, "subtitle", "Overlap style!"); + + evas_object_smart_callback_add(bt, "clicked", _navi_pop, nf); +} + +static void +_page6(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *bt, *bt2, *content, *nf = data; + Elm_Object_Item *it; + + bt = elm_button_add(nf); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + BUTTON_TEXT_SET(bt, "Page 5"); + + bt2 = elm_button_add(nf); + evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, EVAS_HINT_FILL); + BUTTON_TEXT_SET(bt2, "Page 7"); + evas_object_smart_callback_add(bt2, "clicked", _page7, nf); + + content = _content_image_new(nf, img7); + it = elm_naviframe_item_push(nf, "Page 6", bt, bt2, content, "overlap"); + elm_object_item_part_text_set(it, "subtitle", "Overlap style!"); + + evas_object_smart_callback_add(bt, "clicked", _navi_pop, nf); +} + +static void +_page5(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *bt, *bt2, *content, *nf = data; + Elm_Object_Item *it; + + bt = elm_button_add(nf); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + BUTTON_TEXT_SET(bt, "Page 4"); + + bt2 = elm_button_add(nf); + evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, EVAS_HINT_FILL); + BUTTON_TEXT_SET(bt2, "Page 6"); + evas_object_smart_callback_add(bt2, "clicked", _page6, nf); + + content = _content_image_new(nf, img5); + it = elm_naviframe_item_insert_after(nf, + elm_naviframe_top_item_get(nf), + "Page 5", + bt, + bt2, + content, + NULL); + elm_object_item_part_text_set(it, "subtitle", "This page is inserted without transition"); + evas_object_smart_callback_add(bt, "clicked", _navi_it_del, it); +} + +static void +_page4(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *bt, *ic, *content, *nf = data; + char buf[PATH_MAX]; + Elm_Object_Item *it; + + ic = elm_icon_add(nf); + snprintf(buf, sizeof(buf), "%s/images/icon_right_arrow.png", + elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + + bt = elm_button_add(nf); + evas_object_smart_callback_add(bt, "clicked", _page5, nf); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_part_content_set(bt, "icon", ic); + + content = _content_image_new(nf, img4); + + it = elm_naviframe_item_push(nf, + "Page 4", + NULL, + bt, + content, + NULL); + elm_object_item_part_text_set(it, "subtitle", "Title area visibility test"); + + ic = elm_icon_add(nf); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", + elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + elm_object_item_part_content_set(it, "icon", ic); + elm_naviframe_item_title_visible_set(it, EINA_FALSE); + evas_object_smart_callback_add(content, "clicked", _title_visible, it); +} + +static void +_page3(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *bt, *bt2, *ic, *content, *nf = data; + char buf[PATH_MAX]; + Elm_Object_Item *it; + + bt = elm_button_add(nf); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + BUTTON_TEXT_SET(bt, "Prev"); + evas_object_smart_callback_add(bt, "clicked", _navi_pop, nf); + + bt2 = elm_button_add(nf); + evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, EVAS_HINT_FILL); + BUTTON_TEXT_SET(bt2, "Next"); + evas_object_smart_callback_add(bt2, "clicked", _page4, nf); + + content = _content_image_new(nf, img3); + + it = elm_naviframe_item_push(nf, + "Page 3", + bt, + bt2, + content, + NULL); + ic = elm_icon_add(nf); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + + elm_object_item_part_content_set(it, "icon", ic); +} + +static void +_page2(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *bt, *content, *ic, *nf = data; + char buf[PATH_MAX]; + Elm_Object_Item *it; + + bt = elm_button_add(nf); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_smart_callback_add(bt, "clicked", _page3, nf); + + ic = elm_icon_add(nf); + snprintf(buf, sizeof(buf), "%s/images/icon_right_arrow.png", + elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + elm_object_part_content_set(bt, "icon", ic); + + content = _content_image_new(nf, img2); + + it = elm_naviframe_item_push(nf, "Page 2", NULL, bt, content, NULL); + elm_object_item_part_text_set(it, "subtitle", "Here is sub-title part!"); +} + +void +test_naviframe_complex(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *nf, *btn, *box, *content, *tb, *o; + Elm_Object_Item *it; + int x; + + win = elm_win_util_standard_add("naviframe", "Naviframe"); + elm_win_focus_highlight_enabled_set(win, EINA_TRUE); + elm_win_autodel_set(win, EINA_TRUE); + + box = elm_box_add(win); + EXPAND(box); + FILL(box); + elm_box_horizontal_set(box, EINA_TRUE); + elm_win_resize_object_add(win, box); + evas_object_show(box); + + tb = elm_toolbar_add(win); + WEIGHT(tb, 0, EVAS_HINT_EXPAND); + FILL(tb); + elm_toolbar_horizontal_set(tb, EINA_FALSE); + elm_toolbar_select_mode_set(tb, ELM_OBJECT_SELECT_MODE_ALWAYS); + elm_box_pack_end(box, tb); + evas_object_show(tb); + + nf = elm_naviframe_add(win); + EXPAND(nf); + FILL(nf); + elm_box_pack_end(box, nf); + evas_object_show(nf); + + for (x = 0; x < 4; x++) + { + const char *label[] = { "View 1", "View 2", "View 3", "View 4" }; + o = elm_naviframe_add(win); + EXPAND(o); + + btn = elm_button_add(o); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_smart_callback_add(btn, "clicked", _page2, o); + BUTTON_TEXT_SET(btn, "Next"); + evas_object_show(btn); + + if (x % 2) + content = _content_image_new(o, img1); + else + content = _content_list_new(o); + evas_object_data_set(o, "page1", elm_naviframe_item_push(o, "Page 1", NULL, btn, content, NULL)); + + it = elm_naviframe_item_simple_push(nf, o); + it = elm_toolbar_item_append(tb, NULL, label[x], _promote, it); + evas_object_show(o); + } + + elm_toolbar_item_selected_set(elm_toolbar_last_item_get(tb), EINA_TRUE); + evas_object_resize(win, 400, 600); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_notify.c b/libraries/elementary/src/bin/test_notify.c new file mode 100644 index 0000000..dcb387a --- /dev/null +++ b/libraries/elementary/src/bin/test_notify.c @@ -0,0 +1,300 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static void +_bt(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *notify = data; + evas_object_show(notify); +} + +static void +_bt_close(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *notify = data; + evas_object_hide(notify); +} + +static void +_bt_timer_close(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *notify = data; + elm_notify_timeout_set(notify, 2.0); +} + +static void +_notify_timeout(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("Notify timed out!\n"); +} + +static void +_notify_block(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("Notify block area clicked!!\n"); +} + +void +test_notify(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *tb, *notify, *bt, *lb; + + win = elm_win_util_standard_add("notify", "Notify"); + elm_win_autodel_set(win, EINA_TRUE); + + tb = elm_table_add(win); + elm_win_resize_object_add(win, tb); + evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(tb); + + notify = elm_notify_add(win); + evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + bx = elm_box_add(win); + elm_object_content_set(notify, bx); + elm_box_horizontal_set(bx, EINA_TRUE); + evas_object_show(bx); + + lb = elm_label_add(win); + elm_object_text_set(lb, "This position is the default."); + elm_box_pack_end(bx, lb); + evas_object_show(lb); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Close"); + evas_object_smart_callback_add(bt, "clicked", _bt_close, notify); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Top"); + evas_object_smart_callback_add(bt, "clicked", _bt, notify); + elm_table_pack(tb, bt, 1, 0, 1, 1); + evas_object_show(bt); + + notify = elm_notify_add(win); + elm_notify_allow_events_set(notify, EINA_FALSE); + evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM); + elm_notify_timeout_set(notify, 5.0); + evas_object_smart_callback_add(notify, "timeout", _notify_timeout, NULL); + evas_object_smart_callback_add(notify, "block,clicked", _notify_block, NULL); + + bx = elm_box_add(win); + elm_object_content_set(notify, bx); + elm_box_horizontal_set(bx, EINA_TRUE); + evas_object_show(bx); + + lb = elm_label_add(win); + elm_object_text_set(lb, "Bottom position. This notify use a timeout of 5 sec.
" + "The events outside the window are blocked."); + elm_box_pack_end(bx, lb); + evas_object_show(lb); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Close"); + evas_object_smart_callback_add(bt, "clicked", _bt_close, notify); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Bottom"); + evas_object_smart_callback_add(bt, "clicked", _bt, notify); + elm_table_pack(tb, bt, 1, 2, 1, 1); + evas_object_show(bt); + + notify = elm_notify_add(win); + evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_LEFT); + elm_notify_timeout_set(notify, 10.0); + evas_object_smart_callback_add(notify, "timeout", _notify_timeout, NULL); + + bx = elm_box_add(win); + elm_object_content_set(notify, bx); + elm_box_horizontal_set(bx, EINA_TRUE); + evas_object_show(bx); + + lb = elm_label_add(win); + elm_object_text_set(lb, "Left position. This notify use a timeout of 10 sec."); + elm_box_pack_end(bx, lb); + evas_object_show(lb); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Close"); + evas_object_smart_callback_add(bt, "clicked", _bt_close, notify); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Left"); + evas_object_smart_callback_add(bt, "clicked", _bt, notify); + elm_table_pack(tb, bt, 0, 1, 1, 1); + evas_object_show(bt); + + notify = elm_notify_add(win); + evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_CENTER); + elm_notify_timeout_set(notify, 10.0); + evas_object_smart_callback_add(notify, "timeout", _notify_timeout, NULL); + + bx = elm_box_add(win); + elm_object_content_set(notify, bx); + elm_box_horizontal_set(bx, EINA_TRUE); + evas_object_show(bx); + + lb = elm_label_add(win); + elm_object_text_set(lb, "Center position. This notify use a timeout of 10 sec."); + elm_box_pack_end(bx, lb); + evas_object_show(lb); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Close"); + evas_object_smart_callback_add(bt, "clicked", _bt_close, notify); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Center"); + evas_object_smart_callback_add(bt, "clicked", _bt, notify); + elm_table_pack(tb, bt, 1, 1, 1, 1); + evas_object_show(bt); + + notify = elm_notify_add(win); + evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_RIGHT); + + bx = elm_box_add(win); + elm_object_content_set(notify, bx); + elm_box_horizontal_set(bx, EINA_TRUE); + evas_object_show(bx); + + lb = elm_label_add(win); + elm_object_text_set(lb, "Right position."); + elm_box_pack_end(bx, lb); + evas_object_show(lb); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Close"); + evas_object_smart_callback_add(bt, "clicked", _bt_close, notify); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Right"); + evas_object_smart_callback_add(bt, "clicked", _bt, notify); + elm_table_pack(tb, bt, 2, 1, 1, 1); + evas_object_show(bt); + + notify = elm_notify_add(win); + evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_TOP_LEFT); + + bx = elm_box_add(win); + elm_object_content_set(notify, bx); + elm_box_horizontal_set(bx, EINA_TRUE); + evas_object_show(bx); + + lb = elm_label_add(win); + elm_object_text_set(lb, "Top Left position."); + elm_box_pack_end(bx, lb); + evas_object_show(lb); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Close"); + evas_object_smart_callback_add(bt, "clicked", _bt_close, notify); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Top Left"); + evas_object_smart_callback_add(bt, "clicked", _bt, notify); + elm_table_pack(tb, bt, 0, 0, 1, 1); + evas_object_show(bt); + + notify = elm_notify_add(win); + evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_TOP_RIGHT); + + bx = elm_box_add(win); + elm_object_content_set(notify, bx); + elm_box_horizontal_set(bx, EINA_TRUE); + evas_object_show(bx); + + lb = elm_label_add(win); + elm_object_text_set(lb, "Top Right position."); + elm_box_pack_end(bx, lb); + evas_object_show(lb); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Close"); + evas_object_smart_callback_add(bt, "clicked", _bt_close, notify); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Top Right"); + evas_object_smart_callback_add(bt, "clicked", _bt, notify); + elm_table_pack(tb, bt, 2, 0, 1, 1); + evas_object_show(bt); + + notify = elm_notify_add(win); + evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM_LEFT); + + bx = elm_box_add(win); + elm_object_content_set(notify, bx); + elm_box_horizontal_set(bx, EINA_TRUE); + evas_object_show(bx); + + lb = elm_label_add(win); + elm_object_text_set(lb, "Bottom Left position."); + elm_box_pack_end(bx, lb); + evas_object_show(lb); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Close"); + evas_object_smart_callback_add(bt, "clicked", _bt_close, notify); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Bottom Left"); + evas_object_smart_callback_add(bt, "clicked", _bt, notify); + elm_table_pack(tb, bt, 0, 2, 1, 1); + evas_object_show(bt); + + notify = elm_notify_add(win); + evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM_RIGHT); + + bx = elm_box_add(win); + elm_object_content_set(notify, bx); + elm_box_horizontal_set(bx, EINA_TRUE); + evas_object_show(bx); + + lb = elm_label_add(win); + elm_object_text_set(lb, "Bottom Right position."); + elm_box_pack_end(bx, lb); + evas_object_show(lb); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Close in 2s"); + evas_object_smart_callback_add(bt, "clicked", _bt_timer_close, notify); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Bottom Right"); + evas_object_smart_callback_add(bt, "clicked", _bt, notify); + elm_table_pack(tb, bt, 2, 2, 1, 1); + evas_object_show(bt); + + evas_object_show(win); + evas_object_resize(win, 300, 350); +} + +#endif + diff --git a/libraries/elementary/src/bin/test_panel.c b/libraries/elementary/src/bin/test_panel.c new file mode 100644 index 0000000..ee88b8c --- /dev/null +++ b/libraries/elementary/src/bin/test_panel.c @@ -0,0 +1,267 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +#define LIST_ITEM_MAX 20 + +static Elm_Genlist_Item_Class itc; + +static void _bstatus(void *data, Evas_Object *obj, void *event_info); +static void _tstatus(void *data, Evas_Object *obj, void *event_info); +static char *_text_get(void *data, Evas_Object *obj, const char *source); +static Evas_Object *_content_get(void *data, Evas_Object *obj, const char *source); +static Eina_Bool _state_get(void *data, Evas_Object *obj, const char *source); +static void _item_del(void *data, Evas_Object *obj); +static void _fill_list(Evas_Object *obj); +static Eina_Bool _dir_has_subs(const char *path); + +static Eina_List *dirs = NULL; + +static void +_tstatus(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Elm_Object_Item *tb_it; + const char *status; + + if (elm_panel_hidden_get((Evas_Object*)data)) + status = "hidden"; + else + status = "shown"; + printf("The top panel is currently %s\n", status); + tb_it = elm_toolbar_selected_item_get(obj); + elm_toolbar_item_selected_set(tb_it, EINA_FALSE); +} + +static void +_bstatus(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Elm_Object_Item *tb_it; + const char *status; + + if (elm_panel_hidden_get((Evas_Object*)data)) + status = "hidden"; + else + status = "shown"; + printf("The bottom panel is currently %s\n", status); + tb_it = elm_toolbar_selected_item_get(obj); + elm_toolbar_item_selected_set(tb_it, EINA_FALSE); +} + +static char * +_text_get(void *data, Evas_Object *obj __UNUSED__, const char *source __UNUSED__) +{ + return strdup(ecore_file_file_get(data)); +} + +static Evas_Object * +_content_get(void *data, Evas_Object *obj, const char *source) +{ + if (!strcmp(source, "elm.swallow.icon")) + { + Evas_Object *ic; + + ic = elm_icon_add(obj); + if (ecore_file_is_dir((char *)data)) + elm_icon_standard_set(ic, "folder"); + else + elm_icon_standard_set(ic, "file"); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + evas_object_show(ic); + return ic; + } + return NULL; +} + +static Eina_Bool +_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *source __UNUSED__) +{ + return EINA_FALSE; +} + +static void +_item_del(void *data, Evas_Object *obj __UNUSED__) +{ + eina_stringshare_del(data); +} + +static void +_fill_list(Evas_Object *obj) +{ + DIR *d; + struct dirent *de; + Eina_List *l; + char *real; + unsigned int x = 0; + + if (!dirs) + { + if (!(d = opendir(getenv("HOME")))) return; + while ((de = readdir(d)) && (x < LIST_ITEM_MAX)) + { + char buff[PATH_MAX]; + + if (de->d_name[0] == '.') continue; + snprintf(buff, sizeof(buff), "%s/%s", getenv("HOME"), de->d_name); + if (!ecore_file_is_dir(buff)) continue; + x++; + real = ecore_file_realpath(buff); + dirs = eina_list_sorted_insert(dirs, EINA_COMPARE_CB(strcoll), real); + } + closedir(d); + } + EINA_LIST_FOREACH(dirs, l, real) + { + Eina_Bool result = EINA_FALSE; + + result = _dir_has_subs(real); + if (!result) + elm_genlist_item_append(obj, &itc, eina_stringshare_add(real), + NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); + else + elm_genlist_item_append(obj, &itc, eina_stringshare_add(real), + NULL, ELM_GENLIST_ITEM_TREE, + NULL, NULL); + } +} + +static Eina_Bool +_dir_has_subs(const char *path) +{ + DIR *d; + struct dirent *de; + Eina_Bool result = EINA_FALSE; + + if (!path) return result; + if (!(d = opendir(path))) return result; + while ((de = readdir(d))) + { + char buff[PATH_MAX]; + + if (de->d_name[0] == '.') continue; + snprintf(buff, sizeof(buff), "%s/%s", path, de->d_name); + if (ecore_file_is_dir(buff)) + { + result = EINA_TRUE; + break; + } + } + closedir(d); + return result; +} + +void +test_panel(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *panel, *bx, *vbx, *toolbar; + Evas_Object *list; + + win = elm_win_util_standard_add("panel", "Panel"); + elm_win_autodel_set(win, EINA_TRUE); + + vbx = elm_box_add(win); + elm_win_resize_object_add(win, vbx); + evas_object_size_hint_weight_set(vbx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(vbx, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(vbx); + + bx = elm_box_add(win); + elm_box_horizontal_set(bx, EINA_TRUE); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bx); + + panel = elm_panel_add(vbx); + elm_panel_orient_set(panel, ELM_PANEL_ORIENT_TOP); + evas_object_size_hint_weight_set(panel, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(panel, EVAS_HINT_FILL, EVAS_HINT_FILL); + + toolbar = elm_toolbar_add(panel); + elm_toolbar_homogeneous_set(toolbar, 0); + elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_NONE); + evas_object_size_hint_weight_set(toolbar, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(toolbar, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(toolbar); + + elm_toolbar_item_append(toolbar, "home", "Hello", _tstatus, panel); + + elm_object_content_set(panel, toolbar); + elm_box_pack_end(vbx, panel); + evas_object_show(panel); + + panel = elm_panel_add(bx); + elm_panel_orient_set(panel, ELM_PANEL_ORIENT_LEFT); + evas_object_size_hint_weight_set(panel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(panel, 0, EVAS_HINT_FILL); + + itc.item_style = "default"; + itc.func.text_get = _text_get; + itc.func.content_get = _content_get; + itc.func.state_get = _state_get; + itc.func.del = _item_del; + + list = elm_genlist_add(panel); + evas_object_size_hint_min_set(list, 100, -1); + evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(list); + + elm_object_content_set(panel, list); + + elm_box_pack_end(bx, panel); + evas_object_show(panel); + + _fill_list(list); + + panel = elm_panel_add(bx); + elm_panel_orient_set(panel, ELM_PANEL_ORIENT_RIGHT); + evas_object_size_hint_weight_set(panel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(panel, 1, EVAS_HINT_FILL); + elm_panel_hidden_set(panel, EINA_TRUE); + + list = elm_genlist_add(panel); + evas_object_size_hint_min_set(list, 100, -1); + evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(list); + + elm_object_content_set(panel, list); + + elm_box_pack_end(bx, panel); + evas_object_show(panel); + + _fill_list(list); + { + char *dir; + EINA_LIST_FREE(dirs, dir) + free(dir); + } + + elm_box_pack_end(vbx, bx); + + panel = elm_panel_add(vbx); + elm_panel_orient_set(panel, ELM_PANEL_ORIENT_BOTTOM); + evas_object_size_hint_weight_set(panel, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(panel, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_panel_hidden_set(panel, EINA_TRUE); + + toolbar = elm_toolbar_add(panel); + elm_toolbar_homogeneous_set(toolbar, 0); + elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_NONE); + evas_object_size_hint_weight_set(toolbar, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(toolbar, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(toolbar); + + elm_toolbar_item_append(toolbar, "home", "Hello", _bstatus, panel); + + elm_object_content_set(panel, toolbar); + elm_box_pack_end(vbx, panel); + evas_object_show(panel); + + evas_object_resize(win, 320, 400); + evas_object_show(win); +} + + +#endif diff --git a/libraries/elementary/src/bin/test_panes.c b/libraries/elementary/src/bin/test_panes.c new file mode 100644 index 0000000..bf8d091 --- /dev/null +++ b/libraries/elementary/src/bin/test_panes.c @@ -0,0 +1,118 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static double size = 0.0; + +static void +_press(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("press\n"); +} + +static void +_unpress(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + printf("unpress, size : %f\n", elm_panes_content_left_size_get(obj)); +} + +static void +_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("clicked\n"); +} + + +static void +_clicked_double(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + printf("clicked double\n"); + if (elm_panes_content_left_size_get(obj) > 0) + { + size = elm_panes_content_left_size_get(obj); + elm_panes_content_left_size_set(obj, 0.0); + } + else + elm_panes_content_left_size_set(obj, size); +} + + +void +test_panes(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bg, *panes, *panes_h, *bt; + + win = elm_win_add(NULL, "panes", ELM_WIN_BASIC); + elm_win_title_set(win, "Panes"); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + elm_win_focus_highlight_enabled_set(win, EINA_TRUE); + evas_object_show(bg); + + panes = elm_panes_add(win); + elm_win_resize_object_add(win, panes); + evas_object_size_hint_weight_set(panes, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(panes, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(panes); + + evas_object_smart_callback_add(panes, "clicked", _clicked, panes); + evas_object_smart_callback_add(panes, "clicked,double", _clicked_double, panes); + + evas_object_smart_callback_add(panes, "press", _press, panes); + evas_object_smart_callback_add(panes, "unpress", _unpress, panes); + + + // + bt = elm_button_add(win); + elm_object_text_set(bt, "Left"); + evas_object_size_hint_weight_set(bt, 1.0, 1.0); + evas_object_size_hint_align_set(bt, -1.0, -1.0); + evas_object_show(bt); + elm_object_part_content_set(panes, "left", bt); + // + + // + panes_h = elm_panes_add(win); + elm_panes_horizontal_set(panes_h, EINA_TRUE); + evas_object_size_hint_weight_set(panes_h, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(panes_h, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(panes_h); + + evas_object_smart_callback_add(panes_h, "clicked", _clicked, panes_h); + evas_object_smart_callback_add(panes_h, "clicked,double", _clicked_double, panes_h); + + evas_object_smart_callback_add(panes_h, "press", _press, panes_h); + evas_object_smart_callback_add(panes_h, "unpress", _unpress, panes_h); + elm_object_part_content_set(panes, "right", panes_h); + // + + // + bt = elm_button_add(win); + elm_object_text_set(bt, "Up"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bt); + elm_object_part_content_set(panes_h, "left", bt); + // + + // + bt = elm_button_add(win); + elm_object_text_set(bt, "Down"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bt); + elm_object_part_content_set(panes_h, "right", bt); + // + + + evas_object_resize(win, 320, 400); + evas_object_show(win); +} + + +#endif diff --git a/libraries/elementary/src/bin/test_photo.c b/libraries/elementary/src/bin/test_photo.c new file mode 100644 index 0000000..5346b2e --- /dev/null +++ b/libraries/elementary/src/bin/test_photo.c @@ -0,0 +1,108 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static void drop_cb(void *mydata, Evas_Object *obj, void *evdata); +static void drag_stop_cb(void *mydata, Evas_Object *obj, void *evdata); +static void drag_start_cb(void *mydata, Evas_Object *obj, void *evdata); + +void +test_photo(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *sc, *tb, *ph; + int i, j, n; + char buf[PATH_MAX]; + const char *img[9] = + { + "panel_01.jpg", + "mystrale.jpg", + "mystrale_2.jpg", + "rock_02.jpg", + "sky_01.jpg", + "sky_02.jpg", + "sky_03.jpg", + "sky_04.jpg", + "wood_01.jpg" + }; + + elm_need_ethumb(); + + win = elm_win_util_standard_add("photo", "Photo"); + elm_win_autodel_set(win, EINA_TRUE); + + tb = elm_table_add(win); + evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + n = 0; + for (j = 0; j < 12; j++) + { + for (i = 0; i < 12; i++) + { + ph = elm_photo_add(win); + snprintf(buf, sizeof(buf), "%s/images/%s", + elm_app_data_dir_get(), img[n]); + n++; + if (n >= 9) n = 0; + elm_photo_aspect_fixed_set(ph, EINA_FALSE); + elm_photo_size_set(ph, 80); + if (n == 8) + elm_photo_thumb_set(ph, buf, NULL); + else + elm_photo_file_set(ph, buf); + elm_photo_editable_set(ph, EINA_TRUE); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_smart_callback_add(ph, "drop", + drop_cb, NULL); + evas_object_smart_callback_add(ph, "drag,start", + drag_start_cb, NULL); + evas_object_smart_callback_add(ph, "drag,stop", + drag_stop_cb, NULL); + + if ((n == 2) || (n == 3)) + { + elm_photo_fill_inside_set(ph, EINA_TRUE); + elm_object_style_set(ph, "shadow"); + } + elm_table_pack(tb, ph, i, j, 1, 1); + evas_object_show(ph); + } + } + + sc = elm_scroller_add(win); + evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, sc); + + elm_object_content_set(sc, tb); + evas_object_show(tb); + evas_object_show(sc); + + evas_object_resize(win, 300, 300); + evas_object_show(win); +} + +/* Never called, elm_photo never call "drop" smart cb */ +static void +drop_cb(void *mydata __UNUSED__, Evas_Object *obj, void *evdata __UNUSED__) +{ + printf("Drop on obj %p\n", obj); +} + +static void +drag_start_cb(void *mydata __UNUSED__, Evas_Object *obj __UNUSED__, void *evdata __UNUSED__) +{ + +} + +static void +drag_stop_cb(void *mydata __UNUSED__, Evas_Object *obj __UNUSED__, void *evdata __UNUSED__) +{ + +} + +/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/ +#endif diff --git a/libraries/elementary/src/bin/test_photocam.c b/libraries/elementary/src/bin/test_photocam.c new file mode 100644 index 0000000..75431ee --- /dev/null +++ b/libraries/elementary/src/bin/test_photocam.c @@ -0,0 +1,373 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static Evas_Object *rect; + +static void +my_ph_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("clicked\n"); +} + +static void +my_ph_press(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("press\n"); +} + +static void +my_ph_longpressed(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("longpressed\n"); +} + +static void +my_ph_clicked_double(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("clicked,double\n"); +} + +static void +my_ph_load(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("load\n"); +} + +static void +my_ph_loaded(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("loaded\n"); +} + +static void +my_ph_load_details(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("load,details\n"); +} + +static void +my_ph_loaded_details(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("loaded,details\n"); +} + +static void +my_ph_zoom_start(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("zoom,start\n"); +} + +static void +my_ph_zoom_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("zoom,stop\n"); +} + +static void +my_ph_zoom_change(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("zoom,change\n"); +} + +static void +my_ph_anim_start(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("anim,start\n"); +} + +static void +my_ph_anim_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("anim,stop\n"); +} + +static void +my_ph_drag_start(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("drag,start\n"); +} + +static void +my_ph_drag_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + printf("drag_stop\n"); +} + +static void +my_ph_scroll(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + int x, y, w, h; + elm_photocam_image_region_get(obj, &x, &y, &w, &h); + printf("scroll %i %i %ix%i\n", x, y, w, h); +} + +static void +my_bt_open(void *data, Evas_Object *obj __UNUSED__, void *event_info) +{ + Evas_Object *ph = data; + const char *file = event_info; + + if (file) + elm_photocam_file_set(ph, file); +} + +static void +my_bt_show_reg(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_photocam_image_region_show(data, 30, 50, 500, 300); +} + +static void +my_bt_bring_reg(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) + +{ + elm_photocam_image_region_bring_in(data, 800, 300, 500, 300); +} + +static void +my_bt_zoom_in(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + double zoom; + + zoom = elm_photocam_zoom_get(data); + zoom -= 0.5; + elm_photocam_zoom_mode_set(data, ELM_PHOTOCAM_ZOOM_MODE_MANUAL); + if (zoom >= (1.0 / 32.0)) elm_photocam_zoom_set(data, zoom); +} + +static void +my_bt_zoom_out(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + double zoom; + + zoom = elm_photocam_zoom_get(data); + zoom += 0.5; + elm_photocam_zoom_mode_set(data, ELM_PHOTOCAM_ZOOM_MODE_MANUAL); + if (zoom <= 256.0) elm_photocam_zoom_set(data, zoom); +} + +static void +my_bt_pause(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_photocam_paused_set(data, !elm_photocam_paused_get(data)); +} + +static void +my_bt_zoom_fit_in(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_photocam_zoom_mode_set(data, ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT_IN); +} + +static void +my_bt_zoom_fit(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_photocam_zoom_mode_set(data, ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT); +} + +static void +my_bt_zoom_fill(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_photocam_zoom_mode_set(data, ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL); +} + +static void +my_bt_gesture(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_photocam_gesture_enabled_set(data, !elm_photocam_gesture_enabled_get(data)); +} + +static void +_photocam_mouse_wheel_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Evas_Object *photocam = data; + Evas_Event_Mouse_Wheel *ev = (Evas_Event_Mouse_Wheel*) event_info; + int zoom; + double val; + //unset the mouse wheel + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + + zoom = elm_photocam_zoom_get(photocam); + if ((ev->z>0) && (zoom == 1)) return; + + if (ev->z > 0) + zoom /= 2; + else + zoom *= 2; + + val = 1; + int _zoom = zoom; + while (_zoom>1) + { + _zoom /= 2; + val++; + } + + elm_photocam_zoom_mode_set(photocam, ELM_PHOTOCAM_ZOOM_MODE_MANUAL); + if (zoom >= 1) elm_photocam_zoom_set(photocam, zoom); +} + +static void +_photocam_move_resize_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + int x,y,w,h; + + evas_object_geometry_get(data,&x,&y,&w,&h); + evas_object_resize(rect,w,h); + evas_object_move(rect,x,y); +} + +void +test_photocam(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *ph, *tb2, *bt, *box; + // these were just testing - use the "select photo" browser to select one + const char *img[5] = + { + "/home/raster/t1.jpg", // 5 mpixel + "/home/raster/t2.jpg", // 18 mpixel + "/home/raster/t3.jpg", // 39 mpixel + "/home/raster/t4.jpg", // 192 mpixel + "/home/raster/t5.jpg" // 466 mpixel + }; + + win = elm_win_util_standard_add("photocam", "PhotoCam"); + elm_win_autodel_set(win, EINA_TRUE); + + ph = elm_photocam_add(win); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, ph); + evas_object_data_set(ph, "window", win); + + rect = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(rect, 0, 0, 0, 0); + evas_object_repeat_events_set(rect,1); + evas_object_show(rect); + evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_WHEEL, _photocam_mouse_wheel_cb, ph); + evas_object_raise(rect); + + evas_object_event_callback_add(ph, EVAS_CALLBACK_RESIZE, _photocam_move_resize_cb, ph); + evas_object_event_callback_add(ph, EVAS_CALLBACK_MOVE, _photocam_move_resize_cb, ph); + + evas_object_smart_callback_add(ph, "clicked", my_ph_clicked, win); + evas_object_smart_callback_add(ph, "press", my_ph_press, win); + evas_object_smart_callback_add(ph, "longpressed", my_ph_longpressed, win); + evas_object_smart_callback_add(ph, "clicked,double", my_ph_clicked_double, win); + evas_object_smart_callback_add(ph, "load", my_ph_load, win); + evas_object_smart_callback_add(ph, "loaded", my_ph_loaded, win); + evas_object_smart_callback_add(ph, "load,details", my_ph_load_details, win); + evas_object_smart_callback_add(ph, "loaded,details", my_ph_loaded_details, win); + evas_object_smart_callback_add(ph, "zoom,start", my_ph_zoom_start, win); + evas_object_smart_callback_add(ph, "zoom,stop", my_ph_zoom_stop, win); + evas_object_smart_callback_add(ph, "zoom,change", my_ph_zoom_change, win); + evas_object_smart_callback_add(ph, "scroll,anim,start", my_ph_anim_start, win); + evas_object_smart_callback_add(ph, "scroll,anim,stop", my_ph_anim_stop, win); + evas_object_smart_callback_add(ph, "scroll,drag,start", my_ph_drag_start, win); + evas_object_smart_callback_add(ph, "scroll,drag,stop", my_ph_drag_stop, win); + evas_object_smart_callback_add(ph, "scroll", my_ph_scroll, win); + + elm_photocam_file_set(ph, img[1]); + + evas_object_show(ph); + + tb2 = elm_table_add(win); + evas_object_size_hint_weight_set(tb2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, tb2); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Z -"); + evas_object_smart_callback_add(bt, "clicked", my_bt_zoom_out, ph); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, 0.1, 0.1); + elm_table_pack(tb2, bt, 0, 0, 1, 1); + evas_object_show(bt); + + bt = elm_fileselector_button_add(win); + elm_object_text_set(bt, "Select Photo"); + evas_object_smart_callback_add(bt, "file,chosen", my_bt_open, ph); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, 0.5, 0.1); + elm_table_pack(tb2, bt, 1, 0, 1, 1); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Z +"); + evas_object_smart_callback_add(bt, "clicked", my_bt_zoom_in, ph); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, 0.9, 0.1); + elm_table_pack(tb2, bt, 2, 0, 1, 1); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Show 30,50 500x300"); + evas_object_smart_callback_add(bt, "clicked", my_bt_show_reg, ph); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, 0.1, 0.5); + elm_table_pack(tb2, bt, 0, 1, 1, 1); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Bring 800,300 500x300"); + evas_object_smart_callback_add(bt, "clicked", my_bt_bring_reg, ph); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, 0.9, 0.5); + elm_table_pack(tb2, bt, 2, 1, 1, 1); + evas_object_show(bt); + + box = elm_box_add(win); + elm_box_horizontal_set(box, EINA_TRUE); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(box, 0.0, 0.9); + elm_table_pack(tb2, box, 0, 2, 1, 1); + evas_object_show(box); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Pause On/Off"); + evas_object_smart_callback_add(bt, "clicked", my_bt_pause, ph); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(box, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Gesture On/Off"); + evas_object_smart_callback_add(bt, "clicked", my_bt_gesture, ph); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(box, bt); + evas_object_show(bt); + + box = elm_box_add(win); + elm_box_horizontal_set(box, EINA_TRUE); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(box, 0.9, 0.9); + elm_table_pack(tb2, box, 2, 2, 1, 1); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Fit"); + evas_object_smart_callback_add(bt, "clicked", my_bt_zoom_fit, ph); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(box, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Fit_In"); + evas_object_smart_callback_add(bt, "clicked", my_bt_zoom_fit_in, ph); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(box, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Fill"); + evas_object_smart_callback_add(bt, "clicked", my_bt_zoom_fill, ph); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(box, bt); + evas_object_show(bt); + + evas_object_show(box); + evas_object_show(tb2); + + evas_object_resize(win, 800, 800); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_popup.c b/libraries/elementary/src/bin/test_popup.c new file mode 100644 index 0000000..723b3f0 --- /dev/null +++ b/libraries/elementary/src/bin/test_popup.c @@ -0,0 +1,351 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static Evas_Object *g_popup = NULL; +static int times = 0; + +static void +_response_cb(void *data, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *popup_data = evas_object_data_get(data, "im"); + if (popup_data) evas_object_del(popup_data); + evas_object_hide(data); + evas_object_del(data); +} + +static void +_g_popup_response_cb(void *data, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + evas_object_hide(data); +} + +static void +_block_clicked_cb(void *data __UNUSED__, Evas_Object *obj, + void *event_info __UNUSED__) +{ + printf("\nblock,clicked callback\n"); + Evas_Object *popup_data = evas_object_data_get(obj, "im"); + if (popup_data) evas_object_del(popup_data); + evas_object_del(obj); +} + +static void +_item_selected_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, + void *event_info) +{ + printf("popup item selected: %s\n", elm_object_item_text_get(event_info)); +} + +static void +_list_click(void *data __UNUSED__, Evas_Object *obj, + void *event_info __UNUSED__) +{ + Elm_Object_Item *it = elm_list_selected_item_get(obj); + if (!it) return; + elm_list_item_selected_set(it, EINA_FALSE); +} + +static void +_popup_center_text_cb(void *data, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *popup; + + popup = elm_popup_add(data); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_text_set(popup, "This Popup has content area and " + "timeout value is 3 seconds"); + elm_popup_timeout_set(popup, 3.0); + evas_object_smart_callback_add(popup, "timeout", _response_cb, popup); + evas_object_show(popup); +} + +static void +_popup_center_text_1button_cb(void *data, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *popup; + Evas_Object *btn; + + popup = elm_popup_add(data); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_text_set(popup, "This Popup has content area and " + "action area set, action area has one button Close"); + btn = elm_button_add(popup); + elm_object_text_set(btn, "Close"); + elm_object_part_content_set(popup, "button1", btn); + evas_object_smart_callback_add(btn, "clicked", _response_cb, popup); + evas_object_show(popup); +} + +static void +_popup_center_title_text_1button_cb(void *data, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *popup; + Evas_Object *btn; + + popup = elm_popup_add(data); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_text_set(popup, "This Popup has title area, content area and " + "action area set, action area has one button Close"); + elm_object_part_text_set(popup, "title,text", "Title"); + btn = elm_button_add(popup); + elm_object_text_set(btn, "Close"); + elm_object_part_content_set(popup, "button1", btn); + evas_object_smart_callback_add(btn, "clicked", _response_cb, popup); + evas_object_show(popup); +} + +static void +_popup_center_title_text_block_clicked_event_cb(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *popup; + + popup = elm_popup_add(data); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_text_set(popup, "This Popup has title area and content area. " + "When clicked on blocked event region, popup gets " + "deleted"); + elm_object_part_text_set(popup, "title,text", "Title"); + evas_object_smart_callback_add(popup, "block,clicked", _block_clicked_cb, + NULL); + evas_object_show(popup); +} + +static void +_popup_bottom_title_text_3button_cb(void *data, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *popup; + Evas_Object *icon, *btn1, *btn2, *btn3; + char buf[256]; + + popup = elm_popup_add(data); + elm_popup_orient_set(popup, ELM_POPUP_ORIENT_BOTTOM); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_text_set(popup, "This Popup has title area, content area and " + "action area set with content being character wrapped. " + "action area has three buttons OK, Cancel and Close"); + elm_popup_content_text_wrap_type_set(popup, ELM_WRAP_CHAR); + elm_object_part_text_set(popup, "title,text", "Title"); + icon = elm_icon_add(popup); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", + elm_app_data_dir_get()); + elm_icon_file_set(icon, buf, NULL); + elm_object_part_content_set(popup, "title,icon", icon); + btn1 = elm_button_add(popup); + elm_object_text_set(btn1, "OK"); + elm_object_part_content_set(popup, "button1", btn1); + btn2 = elm_button_add(popup); + elm_object_text_set(btn2, "Cancel"); + elm_object_part_content_set(popup, "button2", btn2); + btn3 = elm_button_add(popup); + elm_object_text_set(btn3, "Close"); + elm_object_part_content_set(popup, "button3", btn3); + evas_object_smart_callback_add(btn1, "clicked", _response_cb, popup); + evas_object_smart_callback_add(btn2, "clicked", _response_cb, popup); + evas_object_smart_callback_add(btn3, "clicked", _response_cb, popup); + evas_object_show(popup); +} + +static void +_popup_center_title_content_3button_cb(void *data, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *popup; + Evas_Object *icon, *btn, *btn1, *btn2, *btn3; + char buf[256]; + + popup = elm_popup_add(data); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + btn = elm_button_add(popup); + elm_object_text_set(btn, "Content"); + icon = elm_icon_add(btn); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", + elm_app_data_dir_get()); + elm_icon_file_set(icon, buf, NULL); + elm_object_content_set(btn, icon); + elm_object_content_set(popup, btn); + elm_object_part_text_set(popup, "title,text", "Title"); + btn1 = elm_button_add(popup); + elm_object_text_set(btn1, "OK"); + elm_object_part_content_set(popup, "button1", btn1); + btn2 = elm_button_add(popup); + elm_object_text_set(btn2, "Cancel"); + elm_object_part_content_set(popup, "button2", btn2); + btn3 = elm_button_add(popup); + elm_object_text_set(btn3, "Close"); + elm_object_part_content_set(popup, "button3", btn3); + evas_object_smart_callback_add(btn1, "clicked", _response_cb, popup); + evas_object_smart_callback_add(btn2, "clicked", _response_cb, popup); + evas_object_smart_callback_add(btn3, "clicked", _response_cb, popup); + evas_object_show(popup); +} + +static void +_popup_center_title_item_3button_cb(void *data, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + char buf[256]; + unsigned int i; + Evas_Object *popup, *icon1, *btn1, *btn2, *btn3; + + popup = elm_popup_add(data); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + icon1 = elm_icon_add(popup); + elm_object_part_text_set(popup, "title,text", "Title"); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", + elm_app_data_dir_get()); + elm_icon_file_set(icon1, buf, NULL); + for (i = 0; i < 10; i++) + { + snprintf(buf, sizeof(buf), "Item%u", i+1); + if (i == 3) + elm_popup_item_append(popup, buf, icon1, _item_selected_cb, NULL); + else + elm_popup_item_append(popup, buf, NULL, _item_selected_cb, NULL); + } + btn1 = elm_button_add(popup); + elm_object_text_set(btn1, "OK"); + elm_object_part_content_set(popup, "button1", btn1); + btn2 = elm_button_add(popup); + elm_object_text_set(btn2, "Cancel"); + elm_object_part_content_set(popup, "button2", btn2); + btn3 = elm_button_add(popup); + elm_object_text_set(btn3, "Close"); + elm_object_part_content_set(popup, "button3", btn3); + evas_object_smart_callback_add(btn1, "clicked", _response_cb, popup); + evas_object_smart_callback_add(btn2, "clicked", _response_cb, popup); + evas_object_smart_callback_add(btn3, "clicked", _response_cb, popup); + evas_object_show(popup); +} + +static void +_restack_btn_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *im; + char buf[PATH_MAX]; + void *popup_data; + + popup_data = evas_object_data_get(data, "im"); + if (popup_data) return; + + im = evas_object_image_filled_add(evas_object_evas_get(obj)); + snprintf(buf, sizeof(buf), "%s/images/%s", + elm_app_data_dir_get(), "twofish.jpg"); + evas_object_image_file_set(im, buf, NULL); + evas_object_move(im, 40, 40); + evas_object_resize(im, 320, 320); + evas_object_show(im); + evas_object_data_set((Evas_Object *)data, "im", im); + + evas_object_raise((Evas_Object *)data); +} + +static void +_popup_center_title_text_2button_restack_cb(void *data, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *popup; + Evas_Object *btn, *btn2; + + popup = elm_popup_add(data); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_text_set(popup, "When you click the 'Restack' button, " + "an image will be located under this popup"); + elm_object_part_text_set(popup, "title,text", "Title"); + btn = elm_button_add(popup); + elm_object_text_set(btn, "Restack"); + elm_object_part_content_set(popup, "button1", btn); + evas_object_smart_callback_add(btn, "clicked", _restack_btn_clicked, popup); + evas_object_smart_callback_add(popup, "block,clicked", _block_clicked_cb, + NULL); + + btn2 = elm_button_add(popup); + elm_object_text_set(btn2, "Close"); + elm_object_part_content_set(popup, "button2", btn2); + evas_object_smart_callback_add(btn2, "clicked", _response_cb, popup); + + evas_object_show(popup); +} + +static void +_popup_center_text_1button_hide_show_cb(void *data, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *btn; + char str[128]; + + times++; + if (g_popup) + { + sprintf(str, "You have checked this popup %d times.", times); + elm_object_text_set(g_popup, str); + evas_object_show(g_popup); + return; + } + + g_popup = elm_popup_add(data); + evas_object_size_hint_weight_set(g_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_text_set(g_popup, "Hide this popup by using the button." + "When you click list item again, you can see this popup."); + btn = elm_button_add(g_popup); + elm_object_text_set(btn, "Hide"); + elm_object_part_content_set(g_popup, "button1", btn); + evas_object_smart_callback_add(btn, "clicked", _g_popup_response_cb, g_popup); + + evas_object_show(g_popup); +} + +void +test_popup(void *data __UNUSED__, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *win, *list; + + win = elm_win_util_standard_add("popup", "Popup"); + elm_win_autodel_set(win, EINA_TRUE); + + list = elm_list_add(win); + elm_win_resize_object_add(win, list); + elm_list_mode_set(list, ELM_LIST_LIMIT); + evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_smart_callback_add(list, "selected", _list_click, NULL); + + elm_list_item_append(list, "popup-center-text", NULL, NULL, + _popup_center_text_cb, win); + elm_list_item_append(list, "popup-center-text + 1 button", NULL, NULL, + _popup_center_text_1button_cb, win); + elm_list_item_append(list, "popup-center-title + text + 1 button", NULL, + NULL, _popup_center_title_text_1button_cb, win); + + elm_list_item_append(list, + "popup-center-title + text (block,clicked handling)", + NULL, NULL, + _popup_center_title_text_block_clicked_event_cb, win); + elm_list_item_append(list, "popup-bottom-title + text + 3 buttons", NULL, + NULL, _popup_bottom_title_text_3button_cb, win); + elm_list_item_append(list, "popup-center-title + content + 3 buttons", NULL, + NULL, _popup_center_title_content_3button_cb, win); + elm_list_item_append(list, "popup-center-title + items + 3 buttons", NULL, + NULL, _popup_center_title_item_3button_cb, win); + elm_list_item_append(list, "popup-center-title + text + 2 buttons (check restacking)", NULL, NULL, + _popup_center_title_text_2button_restack_cb, win); + elm_list_item_append(list, "popup-center-text + 1 button (check hide, show)", NULL, NULL, + _popup_center_text_1button_hide_show_cb, win); + elm_list_go(list); + evas_object_show(list); + evas_object_show(win); + evas_object_resize(win, 480, 800); +} + +#endif + diff --git a/libraries/elementary/src/bin/test_progressbar.c b/libraries/elementary/src/bin/test_progressbar.c new file mode 100644 index 0000000..6eed552 --- /dev/null +++ b/libraries/elementary/src/bin/test_progressbar.c @@ -0,0 +1,199 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +typedef struct Progressbar +{ + Evas_Object *pb1; + Evas_Object *pb2; + Evas_Object *pb3; + Evas_Object *pb4; + Evas_Object *pb5; + Evas_Object *pb6; + Evas_Object *pb7; + Eina_Bool run; + Ecore_Timer *timer; +} Progressbar; + +static Progressbar _test_progressbar; + +static Eina_Bool +_my_progressbar_value_set (void *data __UNUSED__) +{ + double progress; + + progress = elm_progressbar_value_get (_test_progressbar.pb1); + if (progress < 1.0) progress += 0.0123; + else progress = 0.0; + elm_progressbar_value_set(_test_progressbar.pb1, progress); + elm_progressbar_value_set(_test_progressbar.pb4, progress); + elm_progressbar_value_set(_test_progressbar.pb3, progress); + elm_progressbar_value_set(_test_progressbar.pb6, progress); + if (progress < 1.0) return ECORE_CALLBACK_RENEW; + _test_progressbar.run = 0; + return ECORE_CALLBACK_CANCEL; +} + +static void +my_progressbar_test_start(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_progressbar_pulse(_test_progressbar.pb2, EINA_TRUE); + elm_progressbar_pulse(_test_progressbar.pb5, EINA_TRUE); + elm_progressbar_pulse(_test_progressbar.pb7, EINA_TRUE); + if (!_test_progressbar.run) + { + _test_progressbar.timer = ecore_timer_add(0.1, _my_progressbar_value_set, NULL); + _test_progressbar.run = EINA_TRUE; + } +} + +static void +my_progressbar_test_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_progressbar_pulse(_test_progressbar.pb2, EINA_FALSE); + elm_progressbar_pulse(_test_progressbar.pb5, EINA_FALSE); + elm_progressbar_pulse(_test_progressbar.pb7, EINA_FALSE); + if (_test_progressbar.run) + { + ecore_timer_del(_test_progressbar.timer); + _test_progressbar.run = EINA_FALSE; + } +} + +static void +my_progressbar_destroy(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + my_progressbar_test_stop(NULL, NULL, NULL); + evas_object_del(obj); +} + +void +test_progressbar(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *pb, *bx, *hbx, *bt, *bt_bx, *ic1, *ic2; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("progressbar", "Progressbar"); + evas_object_smart_callback_add(win, "delete,request", + my_progressbar_destroy, NULL); + + bx = elm_box_add(win); + elm_win_resize_object_add(win, bx); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bx); + + pb = elm_progressbar_add(win); + evas_object_size_hint_weight_set(pb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(pb, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, pb); +// elm_progressbar_horizontal_set(pb, EINA_TRUE); +// elm_object_text_set(pb, "Progression %"); +// elm_progressbar_unit_format_set(pb, NULL); + evas_object_show(pb); + _test_progressbar.pb1 = pb; + + pb = elm_progressbar_add(win); + evas_object_size_hint_align_set(pb, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(pb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_text_set(pb, "Infinite bounce"); + elm_progressbar_pulse_set(pb, EINA_TRUE); + elm_box_pack_end(bx, pb); + evas_object_show(pb); + _test_progressbar.pb2 = pb; + + ic1 = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic1, buf, NULL); + evas_object_size_hint_aspect_set(ic1, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + + pb = elm_progressbar_add(win); + elm_object_text_set(pb, "Label"); + elm_object_part_content_set(pb, "icon", ic1); + elm_progressbar_inverted_set(pb, 1); + elm_progressbar_unit_format_set(pb, "%1.1f units"); + elm_progressbar_span_size_set(pb, 200); + evas_object_size_hint_align_set(pb, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(pb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, pb); + evas_object_show(ic1); + evas_object_show(pb); + _test_progressbar.pb3 = pb; + + hbx = elm_box_add(win); + elm_box_horizontal_set(hbx, EINA_TRUE); + evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(hbx, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, hbx); + evas_object_show(hbx); + + pb = elm_progressbar_add(win); + elm_progressbar_horizontal_set(pb, EINA_FALSE); + evas_object_size_hint_align_set(pb, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(pb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(hbx, pb); + elm_progressbar_span_size_set(pb, 60); + elm_object_text_set(pb, "percent"); + evas_object_show(pb); + _test_progressbar.pb4 = pb; + + pb = elm_progressbar_add(win); + elm_progressbar_horizontal_set(pb, EINA_FALSE); + evas_object_size_hint_align_set(pb, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(pb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_progressbar_span_size_set(pb, 80); + elm_progressbar_pulse_set(pb, EINA_TRUE); + elm_progressbar_unit_format_set(pb, NULL); + elm_object_text_set(pb, "Infinite bounce"); + elm_box_pack_end(hbx, pb); + evas_object_show(pb); + _test_progressbar.pb5 = pb; + + ic2 = elm_icon_add(win); + elm_icon_file_set(ic2, buf, NULL); + evas_object_size_hint_aspect_set(ic2, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1); + + pb = elm_progressbar_add(win); + elm_progressbar_horizontal_set(pb, EINA_FALSE); + elm_object_text_set(pb, "Label"); + elm_object_part_content_set(pb, "icon", ic2); + elm_progressbar_inverted_set(pb, 1); + elm_progressbar_unit_format_set(pb, "%1.2f%%"); + elm_progressbar_span_size_set(pb, 200); + evas_object_size_hint_align_set(pb, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(pb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(hbx, pb); + evas_object_show(ic2); + evas_object_show(pb); + _test_progressbar.pb6 = pb; + + pb = elm_progressbar_add(win); + elm_object_style_set(pb, "wheel"); + elm_object_text_set(pb, "Style: wheel"); + evas_object_size_hint_align_set(pb, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(pb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, pb); + evas_object_show(pb); + _test_progressbar.pb7 = pb; + + bt_bx = elm_box_add(win); + elm_box_horizontal_set(bt_bx, EINA_TRUE); + evas_object_size_hint_weight_set(bt_bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, bt_bx); + evas_object_show(bt_bx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Start"); + evas_object_smart_callback_add(bt, "clicked", my_progressbar_test_start, NULL); + elm_box_pack_end(bt_bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Stop"); + evas_object_smart_callback_add(bt, "clicked", my_progressbar_test_stop, NULL); + elm_box_pack_end(bt_bx, bt); + evas_object_show(bt); + + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_radio.c b/libraries/elementary/src/bin/test_radio.c new file mode 100644 index 0000000..1c822ea --- /dev/null +++ b/libraries/elementary/src/bin/test_radio.c @@ -0,0 +1,96 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +void +test_radio(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *ic, *rd, *rdg; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("radios", "Radios"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + + rd = elm_radio_add(win); + elm_radio_state_value_set(rd, 0); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, 0.5); + elm_object_text_set(rd, "Icon sized to radio"); + elm_object_part_content_set(rd, "icon", ic); + elm_box_pack_end(bx, rd); + evas_object_show(rd); + evas_object_show(ic); + rdg = rd; + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + + rd = elm_radio_add(win); + elm_radio_state_value_set(rd, 1); + elm_radio_group_add(rd, rdg); + elm_object_text_set(rd, "Icon no scale"); + elm_object_part_content_set(rd, "icon", ic); + elm_box_pack_end(bx, rd); + evas_object_show(rd); + evas_object_show(ic); + + rd = elm_radio_add(win); + elm_radio_state_value_set(rd, 2); + elm_radio_group_add(rd, rdg); + elm_object_text_set(rd, "Label Only"); + elm_box_pack_end(bx, rd); + evas_object_show(rd); + + rd = elm_radio_add(win); + elm_radio_state_value_set(rd, 3); + elm_radio_group_add(rd, rdg); + elm_object_text_set(rd, "Disabled"); + elm_object_disabled_set(rd, EINA_TRUE); + elm_box_pack_end(bx, rd); + evas_object_show(rd); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + + rd = elm_radio_add(win); + elm_radio_state_value_set(rd, 4); + elm_radio_group_add(rd, rdg); + elm_object_part_content_set(rd, "icon", ic); + elm_box_pack_end(bx, rd); + evas_object_show(rd); + evas_object_show(ic); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + + rd = elm_radio_add(win); + elm_radio_state_value_set(rd, 5); + elm_radio_group_add(rd, rdg); + elm_object_part_content_set(rd, "icon", ic); + elm_object_disabled_set(rd, EINA_TRUE); + elm_box_pack_end(bx, rd); + evas_object_show(rd); + evas_object_show(ic); + + elm_radio_value_set(rdg, 2); + + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_scaling.c b/libraries/elementary/src/bin/test_scaling.c new file mode 100644 index 0000000..9e5f26e --- /dev/null +++ b/libraries/elementary/src/bin/test_scaling.c @@ -0,0 +1,120 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +void +test_scaling(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *bt; + + win = elm_win_util_standard_add("scaling", "Scaling"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Scale: 0.5"); + elm_object_scale_set(bt, 0.5); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Scale: 0.75"); + elm_object_scale_set(bt, 0.75); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Scale: 1.0"); + elm_object_scale_set(bt, 1.0); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Scale: 1.5"); + elm_object_scale_set(bt, 1.5); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Scale: 2.0"); + elm_object_scale_set(bt, 2.0); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Scale: 3.0"); + elm_object_scale_set(bt, 3.0); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + evas_object_resize(win, 320, 320); + evas_object_show(win); +} + +void +test_scaling2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bg, *bx, *fr, *lb; + + win = elm_win_add(NULL, "scaling2", ELM_WIN_BASIC); + elm_win_title_set(win, "Scaling 2"); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + fr = elm_frame_add(win); + elm_object_scale_set(fr, 0.5); + elm_object_text_set(fr, "Scale: 0.5"); + lb = elm_label_add(win); + elm_object_text_set(lb, + "Parent frame scale
" + "is 0.5. Child should
" + "inherit it."); + elm_object_content_set(fr, lb); + evas_object_show(lb); + elm_box_pack_end(bx, fr); + evas_object_show(fr); + + fr = elm_frame_add(win); + elm_object_text_set(fr, "Scale: 1.0"); + lb = elm_label_add(win); + elm_object_text_set(lb, + "Parent frame scale
" + "is 1.0. Child should
" + "inherit it."); + elm_object_content_set(fr, lb); + evas_object_show(lb); + elm_object_scale_set(fr, 1.0); + elm_box_pack_end(bx, fr); + evas_object_show(fr); + + fr = elm_frame_add(win); + elm_object_text_set(fr, "Scale: 2.0"); + lb = elm_label_add(win); + elm_object_text_set(lb, + "Parent frame scale
" + "is 2.0. Child should
" + "inherit it."); + elm_object_content_set(fr, lb); + evas_object_show(lb); + elm_object_scale_set(fr, 2.0); + elm_box_pack_end(bx, fr); + evas_object_show(fr); + + evas_object_resize(win, 320, 320); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_scroller.c b/libraries/elementary/src/bin/test_scroller.c new file mode 100644 index 0000000..295bd6d --- /dev/null +++ b/libraries/elementary/src/bin/test_scroller.c @@ -0,0 +1,253 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +void +my_bt_go_300_300(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_scroller_region_bring_in((Evas_Object *)data, 300, 300, 318, 318); +} + +void +my_bt_go_900_300(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_scroller_region_bring_in((Evas_Object *)data, 900, 300, 318, 318); +} + +void +my_bt_go_300_900(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_scroller_region_bring_in((Evas_Object *)data, 300, 900, 318, 318); +} + +void +my_bt_go_900_900(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_scroller_region_bring_in((Evas_Object *)data, 900, 900, 318, 318); +} + +void +test_scroller(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bg2, *tb, *tb2, *sc, *bt; + int i, j, n; + char buf[PATH_MAX]; + const char *img[9] = + { + "panel_01.jpg", + "plant_01.jpg", + "rock_01.jpg", + "rock_02.jpg", + "sky_01.jpg", + "sky_02.jpg", + "sky_03.jpg", + "sky_04.jpg", + "wood_01.jpg" + }; + + win = elm_win_util_standard_add("scroller", "Scroller"); + elm_win_autodel_set(win, EINA_TRUE); + + tb = elm_table_add(win); + evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + n = 0; + for (j = 0; j < 12; j++) + { + for (i = 0; i < 12; i++) + { + bg2 = elm_bg_add(win); + snprintf(buf, sizeof(buf), "%s/images/%s", + elm_app_data_dir_get(), img[n]); + n++; + if (n >= 9) n = 0; + elm_bg_file_set(bg2, buf, NULL); + evas_object_size_hint_weight_set(bg2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bg2, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_min_set(bg2, 318, 318); + elm_table_pack(tb, bg2, i, j, 1, 1); + evas_object_show(bg2); + } + } + + sc = elm_scroller_add(win); + evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, sc); + + elm_object_content_set(sc, tb); + evas_object_show(tb); + + elm_scroller_page_relative_set(sc, 1.0, 1.0); + evas_object_show(sc); + + tb2 = elm_table_add(win); + evas_object_size_hint_weight_set(tb2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, tb2); + + bt = elm_button_add(win); + elm_object_text_set(bt, "to 300 300"); + evas_object_smart_callback_add(bt, "clicked", my_bt_go_300_300, sc); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, 0.1, 0.1); + elm_table_pack(tb2, bt, 0, 0, 1, 1); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "to 900 300"); + evas_object_smart_callback_add(bt, "clicked", my_bt_go_900_300, sc); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, 0.9, 0.1); + elm_table_pack(tb2, bt, 1, 0, 1, 1); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "to 300 900"); + evas_object_smart_callback_add(bt, "clicked", my_bt_go_300_900, sc); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, 0.1, 0.9); + elm_table_pack(tb2, bt, 0, 1, 1, 1); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "to 900 900"); + evas_object_smart_callback_add(bt, "clicked", my_bt_go_900_900, sc); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, 0.9, 0.9); + elm_table_pack(tb2, bt, 1, 1, 1, 1); + evas_object_show(bt); + + evas_object_show(tb2); + + evas_object_resize(win, 320, 320); + evas_object_show(win); +} + +void +click_through(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + printf("click went through on %p\n", obj); +} + +void +test_scroller2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bt, *bx, *bx2, *sc, *tb, *tb2, *rc; + int i, j; + + win = elm_win_util_standard_add("scroller2", "Scroller 2"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.0); + + /* { */ + for (i = 0; i < 3; i++) + { + bt = elm_button_add(win); + elm_object_text_set(bt, "Vertical"); + evas_object_smart_callback_add(bt, "clicked", click_through, NULL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + } + /* } */ + + /* { */ + sc = elm_scroller_add(win); + evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, 0.5); + elm_scroller_bounce_set(sc, EINA_TRUE, EINA_FALSE); + elm_scroller_content_min_limit(sc, 0, 1); + elm_box_pack_end(bx, sc); + evas_object_show(sc); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + + for (i = 0; i < 10; i++) + { + bt = elm_button_add(win); + elm_object_text_set(bt, "... Horizontal scrolling ..."); + evas_object_smart_callback_add(bt, "clicked", click_through, NULL); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + } + + elm_object_content_set(sc, bx2); + evas_object_show(bx2); + /* } */ + + /* { */ + for (i = 0; i < 3; i++) + { + bt = elm_button_add(win); + elm_object_text_set(bt, "Vertical"); + evas_object_smart_callback_add(bt, "clicked", click_through, NULL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + } + /* } */ + + /* { */ + tb = elm_table_add(win); + evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, tb); + evas_object_show(tb); + + rc = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_size_hint_min_set(rc, 200, 120); + elm_table_pack(tb, rc, 0, 0, 1, 1); + + sc = elm_scroller_add(win); + evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, sc, 0, 0, 1, 1); + evas_object_show(sc); + + tb2 = elm_table_add(win); + + for (j = 0; j < 16; j++) + { + for (i = 0; i < 16; i++) + { + bt = elm_button_add(win); + elm_object_text_set(bt, "Both"); + evas_object_smart_callback_add(bt, "clicked", click_through, NULL); + elm_table_pack(tb2, bt, i, j, 1, 1); + evas_object_show(bt); + } + } + + elm_object_content_set(sc, tb2); + evas_object_show(tb2); + /* } */ + + for (i = 0; i < 24; i++) + { + bt = elm_button_add(win); + elm_object_text_set(bt, "Vertical"); + evas_object_smart_callback_add(bt, "clicked", click_through, NULL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + } + + sc = elm_scroller_add(win); + evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_scroller_bounce_set(sc, EINA_FALSE, EINA_TRUE); + elm_win_resize_object_add(win, sc); + elm_object_content_set(sc, bx); + evas_object_show(bx); + evas_object_show(sc); + + evas_object_resize(win, 320, 480); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_segment_control.c b/libraries/elementary/src/bin/test_segment_control.c new file mode 100644 index 0000000..48ae35b --- /dev/null +++ b/libraries/elementary/src/bin/test_segment_control.c @@ -0,0 +1,99 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +void +test_segment_control(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *ic, *ic1, *ic2, *ic3, *ic4, *ic5; + Elm_Object_Item *seg_it; + + Evas_Object * in_layout; + Evas_Object *segment1, *segment2, *segment3, *segment4; + char buf[PATH_MAX]; + char buf1[PATH_MAX]; + char buf2[PATH_MAX]; + char buf3[PATH_MAX]; + char buf4[PATH_MAX]; + char buf5[PATH_MAX]; + char buf6[PATH_MAX]; + + win = elm_win_util_standard_add("segmentcontrol", "Segment Control"); + elm_win_autodel_set(win, EINA_TRUE); + + in_layout = elm_layout_add( win ); + elm_win_resize_object_add(win, in_layout); + snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get()); + elm_layout_file_set(in_layout, buf, "segment_test"); + evas_object_size_hint_weight_set(in_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + ic = elm_icon_add(in_layout); + snprintf(buf1, sizeof(buf1), "%s/images/logo.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf1, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1); + + ic1 = elm_icon_add(in_layout); + snprintf(buf2, sizeof(buf2), "%s/images/logo.png", elm_app_data_dir_get()); + elm_icon_file_set(ic1, buf2, NULL); + evas_object_size_hint_aspect_set(ic1, EVAS_ASPECT_CONTROL_BOTH, 1, 1); + + segment1 = elm_segment_control_add(win); + elm_segment_control_item_add(segment1, NULL, "Only Text"); + seg_it = elm_segment_control_item_add(segment1, ic, NULL); + elm_segment_control_item_selected_set(seg_it, EINA_TRUE); + elm_segment_control_item_add(segment1, ic1, "Text_Icon_test"); + elm_segment_control_item_add(segment1, NULL, "Seg4"); + elm_segment_control_item_add(segment1, NULL, "Seg5"); + + segment2 = elm_segment_control_add(win); + elm_segment_control_item_add(segment2, NULL, "SegmentItem"); + seg_it = elm_segment_control_item_add(segment2, NULL, "SegmentItem"); + elm_segment_control_item_selected_set(seg_it, EINA_TRUE); + elm_segment_control_item_add(segment2, NULL, "SegmentControlItem"); + elm_segment_control_item_add(segment2, NULL, "SegmentItem"); + + ic2 = elm_icon_add(in_layout); + snprintf(buf3, sizeof(buf3), "%s/images/logo.png", elm_app_data_dir_get()); + elm_icon_file_set(ic2, buf3, NULL); + evas_object_size_hint_aspect_set(ic2, EVAS_ASPECT_CONTROL_BOTH, 1, 1); + + ic3 = elm_icon_add(in_layout); + snprintf(buf4, sizeof(buf4), "%s/images/logo.png", elm_app_data_dir_get()); + elm_icon_file_set(ic3, buf4, NULL); + evas_object_size_hint_aspect_set(ic3, EVAS_ASPECT_CONTROL_BOTH, 1, 1); + + ic4 = elm_icon_add(in_layout); + snprintf(buf5, sizeof(buf5), "%s/images/logo.png", elm_app_data_dir_get()); + elm_icon_file_set(ic4, buf5, NULL); + evas_object_size_hint_aspect_set(ic4, EVAS_ASPECT_CONTROL_BOTH, 1, 1); + + segment3 = elm_segment_control_add(win); + elm_segment_control_item_add(segment3, ic2, NULL); + seg_it = elm_segment_control_item_add(segment3, ic3, NULL); + elm_segment_control_item_selected_set(seg_it, EINA_TRUE); + elm_segment_control_item_add(segment3, ic4, NULL); + + ic5 = elm_icon_add(in_layout); + snprintf(buf6, sizeof(buf6), "%s/images/logo.png", elm_app_data_dir_get()); + elm_icon_file_set(ic5, buf6, NULL); + evas_object_size_hint_aspect_set(ic5, EVAS_ASPECT_CONTROL_BOTH, 1, 1); + + segment4 = elm_segment_control_add(win); + elm_segment_control_item_add(segment4, NULL, "Disabled"); + seg_it = elm_segment_control_item_add(segment4, ic5, "Disabled"); + elm_segment_control_item_selected_set(seg_it, EINA_TRUE); + elm_segment_control_item_add(segment4, NULL, "Disabled"); + elm_object_disabled_set(segment4, EINA_TRUE); + + elm_object_part_content_set(in_layout, "segment1", segment1); + elm_object_part_content_set(in_layout, "segment2", segment2); + elm_object_part_content_set(in_layout, "segment3", segment3); + elm_object_part_content_set(in_layout, "segment4", segment4); + + evas_object_show(in_layout); + + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_separator.c b/libraries/elementary/src/bin/test_separator.c new file mode 100644 index 0000000..8c1959c --- /dev/null +++ b/libraries/elementary/src/bin/test_separator.c @@ -0,0 +1,68 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +void +test_separator(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx0, *bx, *bt, *sp; + + win = elm_win_util_standard_add("separators", "Separators"); + elm_win_autodel_set(win, EINA_TRUE); + + bx0 = elm_box_add(win); + evas_object_size_hint_weight_set(bx0, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_horizontal_set(bx0, EINA_TRUE); + elm_win_resize_object_add(win, bx0); + evas_object_show(bx0); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx0, bx); + evas_object_show(bx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Left upper corner"); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + sp = elm_separator_add(win); + elm_separator_horizontal_set(sp, EINA_TRUE); // by default, separator is vertical, we must set it horizontal + elm_box_pack_end(bx, sp); + evas_object_show(sp); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Left lower corner"); + elm_object_disabled_set(bt, EINA_TRUE); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + sp = elm_separator_add(win); // now we need vertical separator + elm_box_pack_end(bx0, sp); + evas_object_show(sp); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx0, bx); + evas_object_show(bx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Right upper corner"); + elm_object_disabled_set(bt, EINA_TRUE); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + sp = elm_separator_add(win); + elm_separator_horizontal_set(sp, EINA_TRUE); + elm_box_pack_end(bx, sp); + evas_object_show(sp); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Right lower corner"); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_slider.c b/libraries/elementary/src/bin/test_slider.c new file mode 100644 index 0000000..c10e93c --- /dev/null +++ b/libraries/elementary/src/bin/test_slider.c @@ -0,0 +1,193 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +void +_change_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + double val = elm_slider_value_get(obj); + elm_slider_value_set(data, val); +} + +void +test_slider(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *sl, *ic, *sl1, *bx2; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("slider", "Slider"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + + sl = elm_slider_add(win); + sl1 = sl; + elm_object_text_set(sl, "Horizontal"); + elm_object_part_content_set(sl, "icon", ic); + elm_slider_unit_format_set(sl, "%1.1f units"); + elm_slider_span_size_set(sl, 120); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sl); + evas_object_show(ic); + evas_object_show(sl); + + /* horizontal disable state */ + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + + sl = elm_slider_add(win); + elm_object_text_set(sl, "Disabled"); + elm_object_part_content_set(sl, "icon", ic); + elm_slider_unit_format_set(sl, "%1.1f units"); + elm_slider_span_size_set(sl, 120); + elm_slider_min_max_set(sl, 50, 150); + elm_slider_value_set(sl, 80); + elm_object_disabled_set(sl, EINA_TRUE); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sl); + evas_object_show(ic); + evas_object_show(sl); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + + sl = elm_slider_add(win); + elm_object_text_set(sl, "Horizontal inverted"); + elm_object_part_content_set(sl, "end", ic); + elm_slider_span_size_set(sl, 80); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_slider_indicator_format_set(sl, "%3.0f"); + elm_slider_min_max_set(sl, 50, 150); + elm_slider_value_set(sl, 80); + elm_slider_inverted_set(sl, EINA_TRUE); + evas_object_size_hint_align_set(sl, 0.5, 0.5); + evas_object_size_hint_weight_set(sl, 0.0, 0.0); + elm_box_pack_end(bx, sl); + evas_object_show(ic); + evas_object_show(sl); + + /* label2 disable */ + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + + sl = elm_slider_add(win); + elm_object_text_set(sl, "Disabled inverted"); + elm_object_part_content_set(sl, "end", ic); + elm_slider_span_size_set(sl, 80); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_slider_indicator_format_set(sl, "%3.0f"); + elm_slider_min_max_set(sl, 50, 150); + elm_slider_value_set(sl, 80); + elm_slider_inverted_set(sl, EINA_TRUE); + elm_object_disabled_set(sl, EINA_TRUE); + evas_object_size_hint_align_set(sl, 0.5, 0.5); + evas_object_size_hint_weight_set(sl, 0.0, 0.0); + elm_box_pack_end(bx, sl); + evas_object_show(ic); + evas_object_show(sl); + + sl = elm_slider_add(win); + elm_slider_indicator_show_set(sl, EINA_FALSE); + elm_object_text_set(sl, "Scale doubled"); + elm_slider_unit_format_set(sl, "%3.0f units"); + elm_slider_span_size_set(sl, 40); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_slider_indicator_format_set(sl, "%3.0f"); + elm_slider_min_max_set(sl, 50, 150); + elm_slider_value_set(sl, 80); + elm_slider_inverted_set(sl, EINA_TRUE); + elm_object_scale_set(sl, 2.0); + elm_box_pack_end(bx, sl); + evas_object_show(ic); + evas_object_show(sl); + + bx2 = elm_box_add(win); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_horizontal_set(bx2, EINA_TRUE); + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1); + + sl = elm_slider_add(win); + elm_object_part_content_set(sl, "icon", ic); + elm_object_text_set(sl, "Vertical inverted"); + elm_slider_inverted_set(sl, EINA_TRUE); + elm_slider_unit_format_set(sl, "%1.1f units"); + elm_slider_span_size_set(sl, 60); + evas_object_size_hint_align_set(sl, 0.5, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(sl, 0.0, EVAS_HINT_EXPAND); + elm_slider_indicator_format_set(sl, "%1.1f"); + elm_slider_value_set(sl, 0.2); + elm_object_scale_set(sl, 1.0); + elm_slider_horizontal_set(sl, 0); + elm_box_pack_end(bx2, sl); + evas_object_show(ic); + evas_object_show(sl); + + evas_object_smart_callback_add(sl1, "changed", _change_cb, sl); + + sl = elm_slider_add(win); + elm_object_text_set(sl, "Vertical"); + elm_slider_unit_format_set(sl, "%1.1f units"); + elm_slider_span_size_set(sl, 60); + evas_object_size_hint_align_set(sl, 0.5, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(sl, 0.0, EVAS_HINT_EXPAND); + elm_slider_indicator_format_set(sl, "%1.1f"); + elm_slider_value_set(sl, 0.2); + elm_object_scale_set(sl, 1.0); + elm_slider_horizontal_set(sl, EINA_FALSE); + elm_box_pack_end(bx2, sl); + evas_object_show(ic); + evas_object_show(sl); + + /* vertical disable state */ + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1); + + sl = elm_slider_add(win); + elm_object_part_content_set(sl, "icon", ic); + elm_object_text_set(sl, "Disabled vertical"); + elm_slider_inverted_set(sl, EINA_TRUE); + elm_slider_unit_format_set(sl, "%1.1f units"); + elm_slider_span_size_set(sl, 100); + evas_object_size_hint_align_set(sl, 0.5, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(sl, 0.0, EVAS_HINT_EXPAND); + elm_slider_indicator_format_set(sl, "%1.1f"); + elm_slider_value_set(sl, 0.2); + elm_object_scale_set(sl, 1.0); + elm_slider_horizontal_set(sl, 0); + elm_object_disabled_set(sl, EINA_TRUE); + elm_box_pack_end(bx2, sl); + evas_object_show(ic); + evas_object_show(sl); + + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_slideshow.c b/libraries/elementary/src/bin/test_slideshow.c new file mode 100644 index 0000000..85ae340 --- /dev/null +++ b/libraries/elementary/src/bin/test_slideshow.c @@ -0,0 +1,218 @@ +#include "elementary_config.h" +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static Evas_Object *slideshow, *bt_start, *bt_stop; +static Elm_Slideshow_Item_Class itc; +static const char *img1 = PACKAGE_DATA_DIR"/images/logo.png"; +static const char *img2 = PACKAGE_DATA_DIR"/images/plant_01.jpg"; +static const char *img3 = PACKAGE_DATA_DIR"/images/rock_01.jpg"; +static const char *img4 = PACKAGE_DATA_DIR"/images/rock_02.jpg"; +static const char *img5 = PACKAGE_DATA_DIR"/images/sky_01.jpg"; +static const char *img6 = PACKAGE_DATA_DIR"/images/sky_04.jpg"; +static const char *img7 = PACKAGE_DATA_DIR"/images/wood_01.jpg"; +static const char *img8 = PACKAGE_DATA_DIR"/images/mystrale.jpg"; +static const char *img9 = PACKAGE_DATA_DIR"/images/mystrale_2.jpg"; + +static void +_notify_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_show(data); +} + +static void +_next(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_slideshow_next(data); +} + +static void +_previous(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_slideshow_previous(data); +} + +static void +_mouse_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_notify_timeout_set(data, 0.0); + evas_object_show(data); +} + + +static void +_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_notify_timeout_set(data, 3.0); +} + +static void +_hv_select(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + elm_slideshow_transition_set(slideshow, data); + elm_object_text_set(obj, data); +} + +static void +_layout_select(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + elm_slideshow_layout_set(slideshow, data); + elm_object_text_set(obj, data); +} + +static void +_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_slideshow_timeout_set(slideshow, elm_spinner_value_get(data)); + + elm_object_disabled_set(bt_start, EINA_TRUE); + elm_object_disabled_set(bt_stop, EINA_FALSE); +} + +static void +_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_slideshow_timeout_set(slideshow, 0.0); + elm_object_disabled_set(bt_start, EINA_FALSE); + elm_object_disabled_set(bt_stop, EINA_TRUE); +} + +static void +_spin(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + if (elm_slideshow_timeout_get(slideshow) > 0) + elm_slideshow_timeout_set(slideshow, elm_spinner_value_get(data)); +} + +static Evas_Object * +_get(void *data, Evas_Object *obj) +{ + //Evas_Object *photo = elm_photocam_add(obj); + //elm_photocam_file_set(photo, data); + //elm_photocam_zoom_mode_set(photo, ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT); + + Evas_Object *photo = elm_photo_add(obj); + elm_photo_file_set(photo, data); + elm_photo_fill_inside_set(photo, EINA_TRUE); + elm_object_style_set(photo, "shadow"); + + return photo; +} + +static void +_slide_transition(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Object_Item *slide_it = (Elm_Object_Item *) event_info; + if (data == slide_it) + printf("Reaches to End of slides\n"); +} + +void +test_slideshow(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *notify, *bx, *bt, *hv, *spin; + const Eina_List *l; + const char *transition, *layout; + Elm_Object_Item *slide_last_it; + + win = elm_win_util_standard_add("slideshow", "Slideshow"); + elm_win_autodel_set(win, EINA_TRUE); + + slideshow = elm_slideshow_add(win); + elm_slideshow_loop_set(slideshow, EINA_TRUE); + elm_win_resize_object_add(win, slideshow); + evas_object_size_hint_weight_set(slideshow, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(slideshow); + + itc.func.get = _get; + itc.func.del = NULL; + + elm_slideshow_item_add(slideshow, &itc, img1); + elm_slideshow_item_add(slideshow, &itc, img2); + elm_slideshow_item_add(slideshow, &itc, img3); + elm_slideshow_item_add(slideshow, &itc, img4); + elm_slideshow_item_add(slideshow, &itc, img9); + elm_slideshow_item_add(slideshow, &itc, img5); + elm_slideshow_item_add(slideshow, &itc, img6); + elm_slideshow_item_add(slideshow, &itc, img7); + slide_last_it = elm_slideshow_item_add(slideshow, &itc, img8); + evas_object_smart_callback_add(slideshow, "transition,end", _slide_transition, slide_last_it); + + notify = elm_notify_add(win); + elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM); + evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, notify); + elm_notify_timeout_set(notify, 3.0); + + bx = elm_box_add(win); + elm_box_horizontal_set(bx, EINA_TRUE); + elm_object_content_set(notify, bx); + evas_object_show(bx); + + evas_object_event_callback_add(bx, EVAS_CALLBACK_MOUSE_IN, _mouse_in, + notify); + evas_object_event_callback_add(bx, EVAS_CALLBACK_MOUSE_OUT, _mouse_out, + notify); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Previous"); + evas_object_smart_callback_add(bt, "clicked", _previous, slideshow); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Next"); + evas_object_smart_callback_add(bt, "clicked", _next, slideshow); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + hv = elm_hoversel_add(win); + elm_box_pack_end(bx, hv); + elm_hoversel_hover_parent_set(hv, win); + EINA_LIST_FOREACH(elm_slideshow_transitions_get(slideshow), l, transition) + elm_hoversel_item_add(hv, transition, NULL, 0, _hv_select, transition); + elm_object_text_set(hv, eina_list_data_get(elm_slideshow_transitions_get(slideshow))); + evas_object_show(hv); + + hv = elm_hoversel_add(win); + elm_box_pack_end(bx, hv); + elm_hoversel_hover_parent_set(hv, win); + EINA_LIST_FOREACH(elm_slideshow_layouts_get(slideshow), l, layout) + elm_hoversel_item_add(hv, layout, NULL, 0, _layout_select, layout); + elm_object_text_set(hv, elm_slideshow_layout_get(slideshow)); + evas_object_show(hv); + + spin = elm_spinner_add(win); + elm_spinner_label_format_set(spin, "%2.0f secs."); + evas_object_smart_callback_add(spin, "changed", _spin, spin); + elm_spinner_step_set(spin, 1); + elm_spinner_min_max_set(spin, 1, 30); + elm_spinner_value_set(spin, 3); + elm_box_pack_end(bx, spin); + evas_object_show(spin); + + bt = elm_button_add(win); + bt_start = bt; + elm_object_text_set(bt, "Start"); + evas_object_smart_callback_add(bt, "clicked", _start, spin); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + bt_stop = bt; + elm_object_text_set(bt, "Stop"); + evas_object_smart_callback_add(bt, "clicked", _stop, spin); + elm_box_pack_end(bx, bt); + elm_object_disabled_set(bt, EINA_TRUE); + evas_object_show(bt); + + evas_object_event_callback_add(slideshow, EVAS_CALLBACK_MOUSE_UP, + _notify_show, notify); + evas_object_event_callback_add(slideshow, EVAS_CALLBACK_MOUSE_MOVE, + _notify_show, notify); + + evas_object_resize(win, 500, 400); + evas_object_show(win); +} + +#endif diff --git a/libraries/elementary/src/bin/test_spinner.c b/libraries/elementary/src/bin/test_spinner.c new file mode 100644 index 0000000..17e743a --- /dev/null +++ b/libraries/elementary/src/bin/test_spinner.c @@ -0,0 +1,87 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +void +test_spinner(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *sp; + + win = elm_win_util_standard_add("spinner", "Spinner"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + sp = elm_spinner_add(win); + elm_spinner_label_format_set(sp, "%1.1f units"); + elm_spinner_step_set(sp, 1.3); + elm_spinner_wrap_set(sp, ELM_WRAP_CHAR); + elm_spinner_min_max_set(sp, -50.0, 250.0); + evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sp); + evas_object_show(sp); + + sp = elm_spinner_add(win); + elm_spinner_label_format_set(sp, "Percentage %%%1.2f something"); + elm_spinner_step_set(sp, 5.0); + elm_spinner_wrap_set(sp, ELM_WRAP_CHAR); + elm_spinner_min_max_set(sp, 0.0, 100.0); + evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sp); + evas_object_show(sp); + + sp = elm_spinner_add(win); + elm_spinner_label_format_set(sp, "%1.1f units"); + elm_spinner_step_set(sp, 1.3); + elm_spinner_wrap_set(sp, ELM_WRAP_CHAR); + elm_object_style_set (sp, "vertical"); + elm_spinner_min_max_set(sp, -50.0, 250.0); + evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sp); + evas_object_show(sp); + + sp = elm_spinner_add(win); + elm_spinner_label_format_set(sp, "Disabled %.0f"); + elm_object_disabled_set(sp, EINA_TRUE); + elm_spinner_min_max_set(sp, -50.0, 250.0); + evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sp); + evas_object_show(sp); + + sp = elm_spinner_add(win); + elm_spinner_wrap_set(sp, EINA_TRUE); + elm_spinner_min_max_set(sp, 1, 12); + elm_spinner_value_set(sp, 1); + elm_spinner_step_set(sp, 0.05); + elm_spinner_base_set(sp, 1); + elm_spinner_round_set(sp, 1); + elm_spinner_label_format_set(sp, "%.0f"); + elm_spinner_editable_set(sp, EINA_FALSE); + elm_spinner_special_value_add(sp, 1, "January"); + elm_spinner_special_value_add(sp, 2, "February"); + elm_spinner_special_value_add(sp, 3, "March"); + elm_spinner_special_value_add(sp, 4, "April"); + elm_spinner_special_value_add(sp, 5, "May"); + elm_spinner_special_value_add(sp, 6, "June"); + elm_spinner_special_value_add(sp, 7, "July"); + elm_spinner_special_value_add(sp, 8, "August"); + elm_spinner_special_value_add(sp, 9, "September"); + elm_spinner_special_value_add(sp, 10, "October"); + elm_spinner_special_value_add(sp, 11, "November"); + elm_spinner_special_value_add(sp, 12, "December"); + evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sp); + evas_object_show(sp); + + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_store.c b/libraries/elementary/src/bin/test_store.c new file mode 100644 index 0000000..38e04c5 --- /dev/null +++ b/libraries/elementary/src/bin/test_store.c @@ -0,0 +1,271 @@ +/* NOTE : Before testing elm_store, + email data files should exist in your local storage. + And you can just get example files in enlightenment website. + Use wget to obtain it. It almost 50 Megabytes. + http://www.enlightenment.org/~raster/store.tar.gz + */ + + +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +typedef struct _My_Item My_Item; + +struct _My_Item +{ + char *from, *subject, *date, *head_content; +}; + +// callbacks just to see user interacting with genlist +static void +_st_selected(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + printf("selected: %p\n", event_info); +} + +static void +_st_double_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + printf("double clicked: %p\n", event_info); +} + +static void +_st_longpress(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + printf("longpress %p\n", event_info); +} + +// store callbacks to handle loading/parsing/freeing of store items from src +static Elm_Genlist_Item_Class *itc1; + +static const Elm_Store_Item_Mapping it1_mapping[] = +{ + { + ELM_STORE_ITEM_MAPPING_LABEL, + "elm.title.1", ELM_STORE_ITEM_MAPPING_OFFSET(My_Item, from), + { .empty = { + EINA_TRUE + } } }, + { + ELM_STORE_ITEM_MAPPING_LABEL, + "elm.title.2", ELM_STORE_ITEM_MAPPING_OFFSET(My_Item, subject), + { .empty = { + EINA_TRUE + } } }, + { + ELM_STORE_ITEM_MAPPING_LABEL, + "elm.text", ELM_STORE_ITEM_MAPPING_OFFSET(My_Item, head_content), + { .empty = { + EINA_TRUE + } } }, + { + ELM_STORE_ITEM_MAPPING_ICON, + "elm.swallow.icon", 0, + { .icon = { + 48, 48, + ELM_ICON_LOOKUP_THEME_FDO, + EINA_TRUE, EINA_FALSE, + EINA_TRUE, + EINA_FALSE, EINA_FALSE, + } } }, + { + ELM_STORE_ITEM_MAPPING_CUSTOM, + "elm.swallow.end", 0, + { .custom = { + NULL + } } }, + ELM_STORE_ITEM_MAPPING_END +}; + + +////// **** WARNING *********************************************************** +//// * This function runs inside a thread outside efl mainloop. Be careful! * +// ************************************************************************ +static Eina_Bool +_st_store_list(void *data __UNUSED__, Elm_Store_Item_Info *item_info) +{ + Elm_Store_Item_Info_Filesystem *info = (Elm_Store_Item_Info_Filesystem *)item_info; + int id; + char sort_id[7]; + + // create a sort id based on the filename itself assuming it is a numeric + // value like the id number in mh mail folders which is what this test + // uses as a data source + char *file = strrchr(info->path, '/'); + if (file) file++; + else file = info->path; + id = atoi(file); + sort_id[0] = ((id >> 30) & 0x3f) + 32; + sort_id[1] = ((id >> 24) & 0x3f) + 32; + sort_id[2] = ((id >> 18) & 0x3f) + 32; + sort_id[3] = ((id >> 12) & 0x3f) + 32; + sort_id[4] = ((id >> 6) & 0x3f) + 32; + sort_id[5] = ((id >> 0) & 0x3f) + 32; + sort_id[6] = 0; + info->base.sort_id = strdup(sort_id); + // choose the item genlist item class to use (only item style should be + // provided by the app, store will fill everything else in, so it also + // has to be writable + info->base.item_class = itc1; // based on item info - return the item class wanted (only style field used - rest reset to internal funcs store sets up to get label/icon etc) + info->base.mapping = it1_mapping; + info->base.data = NULL; // if we can already parse and load all of item here and want to - set this + return EINA_TRUE; // return true to include this, false not to +} +// ************************************************************************ +//// * End of separate thread function. * +////// ************************************************************************ + +////// **** WARNING *********************************************************** +//// * This function runs inside a thread outside efl mainloop. Be careful! * +// ************************************************************************ +static void +_st_store_fetch(void *data __UNUSED__, Elm_Store_Item *sti) +{ + const char *path = elm_store_item_filesystem_path_get(sti); + My_Item *myit; + FILE *f; + char buf[4096], *p; + Eina_Bool have_content = EINA_FALSE; + char *content = NULL, *content_pos = NULL, *content_end = NULL; + + // if we already have my item data - skip + if (elm_store_item_data_get(sti)) return; + // open the mail file and parse it + f = fopen(path, "rb"); + if (!f) return; + + // alloc my item in memory that holds data to show in the list + myit = calloc(1, sizeof(My_Item)); + if (!myit) + { + fclose(f); + return; + } + while (fgets(buf, sizeof(buf), f)) + { + if (!have_content) + { + if (!isblank(buf[0])) + { + // get key: From:, Subject: etc. + if (!strncmp(buf, "From:", 5)) + { + p = buf + 5; + while ((*p) && (isblank(*p))) p++; + p = strdup(p); + if (p) + { + myit->from = p; + p = strchr(p, '\n'); + if (p) *p = 0; + } + } + else if (!strncmp(buf, "Subject:", 8)) + { + p = buf + 8; + while ((*p) && (isblank(*p))) p++; + p = strdup(p); + if (p) + { + myit->subject = p; + p = strchr(p, '\n'); + if (p) *p = 0; + } + } + else if (!strncmp(buf, "Date:", 5)) + { + p = buf + 5; + while ((*p) && (isblank(*p))) p++; + p = strdup(p); + if (p) + { + myit->date = p; + p = strchr(p, '\n'); + if (p) *p = 0; + } + } + else if (buf[0] == '\n') // begin of content + have_content = EINA_TRUE; + } + } + else + { + // get first 320 bytes of content/body + if (!content) + { + content = calloc(1, 320); + content_pos = content; + content_end = content + 319; + } + strncat(content_pos, buf, content_end - content_pos - 1); + content_pos = content + strlen(content); + } + } + fclose(f); + myit->head_content = elm_entry_utf8_to_markup(content); + free(content); + elm_store_item_data_set(sti, myit); +} +// ************************************************************************ +//// * End of separate thread function. * +////// ************************************************************************ + +static void +_st_store_unfetch(void *data __UNUSED__, Elm_Store_Item *sti) +{ + My_Item *myit = elm_store_item_data_get(sti); + if (!myit) return; + if (myit->from) free(myit->from); + if (myit->subject) free(myit->subject); + if (myit->date) free(myit->date); + if (myit->head_content) free(myit->head_content); + free(myit); +} + +void +test_store(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *gl, *bx; + Elm_Store *st; + + win = elm_win_util_standard_add("store", "Store"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + gl = elm_genlist_add(win); + elm_genlist_mode_set(gl, ELM_LIST_COMPRESS); + evas_object_smart_callback_add(gl, "selected", _st_selected, NULL); + evas_object_smart_callback_add(gl, "clicked,double", _st_double_clicked, NULL); + evas_object_smart_callback_add(gl, "longpressed", _st_longpress, NULL); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, gl); + evas_object_show(gl); + + itc1 = elm_genlist_item_class_new(); + itc1->item_style = "message"; + + st = elm_store_filesystem_new(); + elm_store_list_func_set(st, _st_store_list, NULL); + elm_store_fetch_func_set(st, _st_store_fetch, NULL); + //elm_store_fetch_thread_set(st, EINA_FALSE); + elm_store_unfetch_func_set(st, _st_store_unfetch, NULL); + elm_store_sorted_set(st, EINA_TRUE); + elm_store_target_genlist_set(st, gl); + elm_store_filesystem_directory_set(st, "./store"); + + /* item_class_ref is needed for itc1. some items can be added in callbacks */ + elm_genlist_item_class_ref(itc1); + elm_genlist_item_class_free(itc1); + + evas_object_resize(win, 480, 800); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_table.c b/libraries/elementary/src/bin/test_table.c new file mode 100644 index 0000000..4f40608 --- /dev/null +++ b/libraries/elementary/src/bin/test_table.c @@ -0,0 +1,392 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +void +test_table(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *tb, *bt; + + win = elm_win_util_standard_add("table", "Table"); + elm_win_autodel_set(win, EINA_TRUE); + + tb = elm_table_add(win); + elm_win_resize_object_add(win, tb); + evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(tb); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 1"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 0, 0, 1, 1); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 2"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 1, 0, 1, 1); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 3"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 2, 0, 1, 1); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 4"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 0, 1, 2, 1); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 5"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 2, 1, 1, 2); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button a"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 0, 2, 2, 1); + evas_object_show(bt); + + evas_object_show(win); +} + +void +test_table2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *tb, *bt; + + win = elm_win_util_standard_add("table2", "Table Homogeneous"); + elm_win_autodel_set(win, EINA_TRUE); + + tb = elm_table_add(win); + elm_table_homogeneous_set(tb, EINA_TRUE); + elm_win_resize_object_add(win, tb); + evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(tb); + + bt = elm_button_add(win); + elm_object_text_set(bt, "A"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 1, 1, 2, 2); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Blah blah blah"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 3, 0, 2, 3); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Hallow"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 0, 3, 10, 1); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "B"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 2, 5, 2, 1); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "C"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 8, 8, 1, 1); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Wide"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 1, 7, 7, 2); + evas_object_show(bt); + + evas_object_show(win); +} + +static void +my_tb_ch(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + Evas_Object *tb = evas_object_data_get(win, "tb"); + Evas_Object *b2 = evas_object_data_get(win, "b2"); + + elm_table_unpack(tb, b2); + elm_table_pack(tb, b2, 1, 0, 1, 2); +} + +void +test_table3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *tb, *bt; + + win = elm_win_util_standard_add("table3", "Table 3"); + elm_win_autodel_set(win, EINA_TRUE); + + tb = elm_table_add(win); + elm_win_resize_object_add(win, tb); + evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_data_set(win, "tb", tb); + evas_object_show(tb); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 1"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 0, 0, 1, 1); + evas_object_data_set(win, "b1", bt); + evas_object_smart_callback_add(bt, "clicked", my_tb_ch, win); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 2"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 1, 0, 1, 1); + evas_object_data_set(win, "b2", bt); + evas_object_smart_callback_add(bt, "clicked", my_tb_ch, win); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 3"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 0, 1, 1, 1); + evas_object_data_set(win, "b3", bt); + evas_object_smart_callback_add(bt, "clicked", my_tb_ch, win); + evas_object_show(bt); + + evas_object_show(win); +} + +void +test_table4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *tb, *bt; + + win = elm_win_util_standard_add("table4", "Table 4"); + elm_win_autodel_set(win, EINA_TRUE); + + tb = elm_table_add(win); + elm_win_resize_object_add(win, tb); + evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_data_set(win, "tb", tb); + evas_object_show(tb); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 1"); + evas_object_size_hint_weight_set(bt, 0.25, 0.25); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 0, 0, 1, 1); + evas_object_data_set(win, "b1", bt); + evas_object_smart_callback_add(bt, "clicked", my_tb_ch, win); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 2"); + evas_object_size_hint_weight_set(bt, 0.75, 0.25); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 1, 0, 1, 1); + evas_object_data_set(win, "b2", bt); + evas_object_smart_callback_add(bt, "clicked", my_tb_ch, win); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 3"); + evas_object_size_hint_weight_set(bt, 0.25, 0.75); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 0, 1, 1, 1); + evas_object_data_set(win, "b3", bt); + evas_object_smart_callback_add(bt, "clicked", my_tb_ch, win); + evas_object_show(bt); + + evas_object_show(win); +} + +void +test_table5(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *tb, *bt; + + win = elm_win_util_standard_add("table5", "Table 5"); + elm_win_autodel_set(win, EINA_TRUE); + + tb = elm_table_add(win); + elm_table_homogeneous_set(tb, EINA_TRUE); + elm_win_resize_object_add(win, tb); + evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(tb); + + bt = elm_button_add(win); + elm_object_text_set(bt, "A"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 33, 0, 34, 33); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "B"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 67, 33, 33, 34); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "C"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 33, 67, 34, 33); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "D"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 0, 33, 33, 34); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "X"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 33, 33, 34, 34); + evas_object_show(bt); + + evas_object_show(win); +} + +void +test_table6(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *tb, *bt; + + win = elm_win_util_standard_add("table6", "Table 6"); + elm_win_autodel_set(win, EINA_TRUE); + + tb = elm_table_add(win); + elm_table_homogeneous_set(tb, EINA_TRUE); + elm_win_resize_object_add(win, tb); + evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(tb); + + bt = elm_button_add(win); + elm_object_text_set(bt, "C"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 1, 1, 2, 2); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "A"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 1, 1, 2, 2); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Blah blah blah"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 3, 0, 2, 3); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Hallow"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 0, 3, 10, 1); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "B"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 1, 1, 1, 1); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Wide"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 1, 7, 7, 2); + evas_object_show(bt); + + evas_object_show(win); +} + +void +test_table7(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *tb, *bt; + + win = elm_win_util_standard_add("table7", "Table 7"); + elm_win_autodel_set(win, EINA_TRUE); + + tb = elm_table_add(win); + elm_table_padding_set(tb, 10, 20); + elm_win_resize_object_add(win, tb); + evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(tb); + + bt = elm_button_add(win); + elm_object_text_set(bt, "C"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 1, 1, 2, 2); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "A"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 1, 1, 2, 2); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Blah blah blah"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 3, 0, 2, 3); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Hallow"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 0, 3, 10, 1); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "B"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 1, 1, 1, 1); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Wide"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(tb, bt, 1, 7, 7, 2); + evas_object_show(bt); + + evas_object_show(win); +} + +#endif diff --git a/libraries/elementary/src/bin/test_thumb.c b/libraries/elementary/src/bin/test_thumb.c new file mode 100644 index 0000000..5a6c04a --- /dev/null +++ b/libraries/elementary/src/bin/test_thumb.c @@ -0,0 +1,66 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +void +test_thumb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *sc, *tb, *th; + int i, j, n; + char buf[PATH_MAX]; + const char *img[11] = + { + "panel_01.jpg", + "plant_01.jpg", + "rock_01.jpg", + "rock_02.jpg", + "sky_01.jpg", + "sky_02.jpg", + "sky_03.jpg", + "sky_04.jpg", + "wood_01.jpg", + "mystrale.jpg", + "mystrale_2.jpg" + }; + + elm_need_ethumb(); + + win = elm_win_util_standard_add("thumb", "Thumb"); + elm_win_autodel_set(win, EINA_TRUE); + + tb = elm_table_add(win); + evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + n = 0; + for (j = 0; j < 12; j++) + { + for (i = 0; i < 12; i++) + { + th = elm_thumb_add(win); + snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), + img[n]); + n = (n + 1) % 11; + elm_thumb_file_set(th, buf, img[n]); + evas_object_size_hint_weight_set(th, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(th, EVAS_HINT_FILL, + EVAS_HINT_FILL); + elm_table_pack(tb, th, i, j, 1, 1); + elm_thumb_editable_set(th, EINA_TRUE); + evas_object_show(th); + } + } + + sc = elm_scroller_add(win); + evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, sc); + + elm_object_content_set(sc, tb); + evas_object_show(tb); + evas_object_show(sc); + + evas_object_resize(win, 600, 600); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_toolbar.c b/libraries/elementary/src/bin/test_toolbar.c new file mode 100644 index 0000000..e9ffdd1 --- /dev/null +++ b/libraries/elementary/src/bin/test_toolbar.c @@ -0,0 +1,905 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +static void +tb_1(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), "%s/images/panel_01.jpg", elm_app_data_dir_get()); + elm_photo_file_set(data, buf); +} + +static void +tb_2(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), "%s/images/rock_01.jpg", elm_app_data_dir_get()); + elm_photo_file_set(data, buf); +} + +static void +tb_3(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), "%s/images/wood_01.jpg", elm_app_data_dir_get()); + elm_photo_file_set(data, buf); +} + +static void +tb_3a(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + tb_3(data, obj, event_info); + elm_toolbar_item_state_set(event_info, elm_toolbar_item_state_next(event_info)); +} + +static void +tb_3b(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + tb_3(data, obj, event_info); + elm_toolbar_item_state_unset(event_info); +} + +static void +tb_4(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), "%s/images/sky_03.jpg", elm_app_data_dir_get()); + elm_photo_file_set(data, buf); +} + +static void +tb_4a(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_toolbar_item_state_set(event_info, elm_toolbar_item_state_prev(event_info)); +} + +static void +tb_5(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_photo_file_set(data, NULL); +} + +void +test_toolbar(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *tb, *ph, *menu; + Evas_Object *ph1, *ph2, *ph3, *ph4; + Elm_Object_Item *tb_it; + Elm_Object_Item *menu_it; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("toolbar", "Toolbar"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + elm_win_resize_object_add(win, bx); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bx); + + tb = elm_toolbar_add(win); + elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_MENU); + evas_object_size_hint_weight_set(tb, 0.0, 0.0); + evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0); + elm_object_scale_set(tb, 0.9); + + ph1 = elm_photo_add(win); + ph2 = elm_photo_add(win); + ph3 = elm_photo_add(win); + ph4 = elm_photo_add(win); + + tb_it = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1); + elm_object_item_disabled_set(tb_it, EINA_TRUE); + elm_toolbar_item_priority_set(tb_it, 100); + + tb_it = elm_toolbar_item_append(tb, "folder-new", "World", tb_2, ph1); + elm_toolbar_item_priority_set(tb_it, -100); + + tb_it = elm_toolbar_item_append(tb, "object-rotate-right", "H", tb_3, ph4); + elm_toolbar_item_priority_set(tb_it, 150); + + tb_it = elm_toolbar_item_append(tb, "mail-send", "Comes", tb_4, ph4); + elm_toolbar_item_priority_set(tb_it, 0); + + tb_it = elm_toolbar_item_append(tb, "clock", "Elementary", tb_5, ph4); + elm_toolbar_item_priority_set(tb_it, -200); + + tb_it = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL); + elm_toolbar_item_menu_set(tb_it, EINA_TRUE); + elm_toolbar_item_priority_set(tb_it, -999999); + elm_toolbar_menu_parent_set(tb, win); + menu = elm_toolbar_item_menu_get(tb_it); + + elm_menu_item_add(menu, NULL, "edit-cut", "Shrink", tb_3, ph4); + menu_it = elm_menu_item_add(menu, NULL, "edit-copy", "Mode", tb_4, ph4); + elm_menu_item_add(menu, menu_it, "edit-paste", "is set to", tb_4, ph4); + elm_menu_item_add(menu, NULL, "edit-delete", "Menu", tb_5, ph4); + + elm_box_pack_end(bx, tb); + evas_object_show(tb); + + tb = elm_table_add(win); + //elm_table_homogeneous_set(tb, 1); + evas_object_size_hint_weight_set(tb, 0.0, EVAS_HINT_EXPAND); + evas_object_size_hint_fill_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL); + + ph = ph1; + elm_photo_size_set(ph, 40); + snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); + elm_photo_file_set(ph, buf); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 0, 0, 1, 1); + evas_object_show(ph); + + ph = ph2; + elm_photo_size_set(ph, 80); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 1, 0, 1, 1); + evas_object_show(ph); + + ph = ph3; + elm_photo_size_set(ph, 20); + snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", elm_app_data_dir_get()); + elm_photo_file_set(ph, buf); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 0, 1, 1, 1); + evas_object_show(ph); + + ph = ph4; + elm_photo_size_set(ph, 60); + snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", elm_app_data_dir_get()); + elm_photo_file_set(ph, buf); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 1, 1, 1, 1); + evas_object_show(ph); + + elm_box_pack_end(bx, tb); + evas_object_show(tb); + + evas_object_resize(win, 320, 300); + evas_object_show(win); +} + +void +test_toolbar2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *tb, *ph, *menu; + Evas_Object *ph1, *ph2, *ph3, *ph4; + Elm_Object_Item *item; + Elm_Object_Item *menu_it; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("toolbar2", "Toolbar 2"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + elm_win_resize_object_add(win, bx); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bx); + + tb = elm_toolbar_add(win); + elm_toolbar_homogeneous_set(tb, 0); + elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_SCROLL); + evas_object_size_hint_weight_set(tb, 0.0, 0.0); + evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0); + + ph1 = elm_photo_add(win); + ph2 = elm_photo_add(win); + ph3 = elm_photo_add(win); + ph4 = elm_photo_add(win); + + item = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1); + elm_object_item_disabled_set(item, EINA_TRUE); + elm_toolbar_item_priority_set(item, -100); + + item = elm_toolbar_item_append(tb, "folder-new", "World", tb_2, ph1); + elm_toolbar_item_priority_set(item, 100); + + item = elm_toolbar_item_append(tb, "object-rotate-right", "H", tb_3, ph4); + elm_toolbar_item_priority_set(item, -150); + + item = elm_toolbar_item_append(tb, "mail-send", "Comes", tb_4, ph4); + elm_toolbar_item_priority_set(item, -200); + + item = elm_toolbar_item_append(tb, "clock", "Elementary", tb_5, ph4); + elm_toolbar_item_priority_set(item, 0); + + item = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL); + elm_toolbar_item_menu_set(item, EINA_TRUE); + elm_toolbar_item_priority_set(item, -999999); + elm_toolbar_menu_parent_set(tb, win); + menu = elm_toolbar_item_menu_get(item); + + elm_menu_item_add(menu, NULL, "edit-cut", "Shrink", tb_3, ph4); + menu_it = elm_menu_item_add(menu, NULL, "edit-copy", "Mode", tb_4, ph4); + elm_menu_item_add(menu, menu_it, "edit-paste", "is set to", tb_4, ph4); + elm_menu_item_add(menu, NULL, "edit-delete", "Scroll", tb_5, ph4); + + elm_box_pack_end(bx, tb); + evas_object_show(tb); + + tb = elm_table_add(win); + //elm_table_homogeneous_set(tb, 1); + evas_object_size_hint_weight_set(tb, 0.0, EVAS_HINT_EXPAND); + evas_object_size_hint_fill_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL); + + ph = ph1; + elm_photo_size_set(ph, 40); + snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); + elm_photo_file_set(ph, buf); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 0, 0, 1, 1); + evas_object_show(ph); + + ph = ph2; + elm_photo_size_set(ph, 80); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 1, 0, 1, 1); + evas_object_show(ph); + + ph = ph3; + elm_photo_size_set(ph, 20); + snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", elm_app_data_dir_get()); + elm_photo_file_set(ph, buf); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 0, 1, 1, 1); + evas_object_show(ph); + + ph = ph4; + elm_photo_size_set(ph, 60); + snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", elm_app_data_dir_get()); + elm_photo_file_set(ph, buf); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 1, 1, 1, 1); + evas_object_show(ph); + + elm_box_pack_end(bx, tb); + evas_object_show(tb); + + evas_object_resize(win, 320, 300); + evas_object_show(win); +} + +void +test_toolbar3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *tb, *ph, *menu; + Evas_Object *ph1, *ph2, *ph3, *ph4; + Elm_Object_Item *tb_it; + Elm_Object_Item *menu_it; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("toolbar3", "Toolbar 3"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + elm_win_resize_object_add(win, bx); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bx); + + tb = elm_toolbar_add(win); + elm_toolbar_homogeneous_set(tb, EINA_FALSE); + elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_NONE); + evas_object_size_hint_weight_set(tb, 0.0, 0.0); + evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0); + + ph1 = elm_photo_add(win); + ph2 = elm_photo_add(win); + ph3 = elm_photo_add(win); + ph4 = elm_photo_add(win); + + tb_it = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1); + elm_object_item_disabled_set(tb_it, EINA_TRUE); + elm_toolbar_item_priority_set(tb_it, EINA_FALSE); + + tb_it = elm_toolbar_item_append(tb, "folder-new", "World", tb_2, ph1); + elm_toolbar_item_priority_set(tb_it, -200); + + tb_it = elm_toolbar_item_append(tb, "object-rotate-right", "H", tb_3, ph4); + elm_toolbar_item_priority_set(tb_it, EINA_TRUE); + + tb_it = elm_toolbar_item_append(tb, "mail-send", "Comes", tb_4, ph4); + elm_toolbar_item_priority_set(tb_it, -10); + + tb_it = elm_toolbar_item_append(tb, "clock", "Elementary", tb_5, ph4); + elm_toolbar_item_priority_set(tb_it, 50); + + tb_it = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL); + elm_toolbar_item_menu_set(tb_it, EINA_TRUE); + elm_toolbar_item_priority_set(tb_it, 999999); + elm_toolbar_menu_parent_set(tb, win); + menu = elm_toolbar_item_menu_get(tb_it); + + elm_menu_item_add(menu, NULL, "edit-cut", "Shrink", tb_3, ph4); + menu_it = elm_menu_item_add(menu, NULL, "edit-copy", "Mode", tb_4, ph4); + elm_menu_item_add(menu, menu_it, "edit-paste", "is set to", tb_4, ph4); + elm_menu_item_add(menu, NULL, "edit-delete", "None", tb_5, ph4); + + elm_box_pack_end(bx, tb); + evas_object_show(tb); + + tb = elm_table_add(win); + evas_object_size_hint_weight_set(tb, 0.0, EVAS_HINT_EXPAND); + evas_object_size_hint_fill_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL); + + ph = ph1; + elm_photo_size_set(ph, 40); + snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); + elm_photo_file_set(ph, buf); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 0, 0, 1, 1); + evas_object_show(ph); + + ph = ph2; + elm_photo_size_set(ph, 80); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 1, 0, 1, 1); + evas_object_show(ph); + + ph = ph3; + elm_photo_size_set(ph, 20); + snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", elm_app_data_dir_get()); + elm_photo_file_set(ph, buf); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 0, 1, 1, 1); + evas_object_show(ph); + + ph = ph4; + elm_photo_size_set(ph, 60); + snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", elm_app_data_dir_get()); + elm_photo_file_set(ph, buf); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 1, 1, 1, 1); + evas_object_show(ph); + + elm_box_pack_end(bx, tb); + evas_object_show(tb); + + evas_object_resize(win, 320, 300); + evas_object_show(win); +} + +/* The same test of toolbar, but using hide shrink mode instead of menu */ +void +test_toolbar4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *tb, *ph, *menu; + Evas_Object *ph1, *ph2, *ph3, *ph4; + Elm_Object_Item *tb_it; + Elm_Object_Item *menu_it; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("toolbar4", "Toolbar 4"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + elm_win_resize_object_add(win, bx); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bx); + + tb = elm_toolbar_add(win); + elm_toolbar_homogeneous_set(tb, 0); + elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_HIDE); + evas_object_size_hint_weight_set(tb, 0.0, 0.0); + evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0); + + ph1 = elm_photo_add(win); + ph2 = elm_photo_add(win); + ph3 = elm_photo_add(win); + ph4 = elm_photo_add(win); + + tb_it = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1); + elm_object_item_disabled_set(tb_it, EINA_TRUE); + elm_toolbar_item_priority_set(tb_it, 100); + + tb_it = elm_toolbar_item_append(tb, "folder-new", "World", tb_2, ph1); + elm_toolbar_item_priority_set(tb_it, -100); + + tb_it = elm_toolbar_item_append(tb, "object-rotate-right", "H", tb_3, ph4); + elm_toolbar_item_priority_set(tb_it, 150); + + tb_it = elm_toolbar_item_append(tb, "mail-send", "Comes", tb_4, ph4); + elm_toolbar_item_priority_set(tb_it, 0); + + tb_it = elm_toolbar_item_append(tb, "clock", "Elementary", tb_5, ph4); + elm_toolbar_item_priority_set(tb_it, -200); + + tb_it = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL); + elm_toolbar_item_menu_set(tb_it, EINA_TRUE); + elm_toolbar_item_priority_set(tb_it, -999999); + elm_toolbar_menu_parent_set(tb, win); + menu = elm_toolbar_item_menu_get(tb_it); + + elm_menu_item_add(menu, NULL, "edit-cut", "Shrink", tb_3, ph4); + menu_it = elm_menu_item_add(menu, NULL, "edit-copy", "Mode", tb_4, ph4); + elm_menu_item_add(menu, menu_it, "edit-paste", "is set to", tb_4, ph4); + elm_menu_item_add(menu, NULL, "edit-delete", "Menu", tb_5, ph4); + + elm_box_pack_end(bx, tb); + evas_object_show(tb); + + tb = elm_table_add(win); + evas_object_size_hint_weight_set(tb, 0.0, EVAS_HINT_EXPAND); + evas_object_size_hint_fill_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL); + + ph = ph1; + elm_photo_size_set(ph, 40); + snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); + elm_photo_file_set(ph, buf); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 0, 0, 1, 1); + evas_object_show(ph); + + ph = ph2; + elm_photo_size_set(ph, 80); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 1, 0, 1, 1); + evas_object_show(ph); + + ph = ph3; + elm_photo_size_set(ph, 20); + snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", elm_app_data_dir_get()); + elm_photo_file_set(ph, buf); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 0, 1, 1, 1); + evas_object_show(ph); + + ph = ph4; + elm_photo_size_set(ph, 60); + snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", elm_app_data_dir_get()); + elm_photo_file_set(ph, buf); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 1, 1, 1, 1); + evas_object_show(ph); + + elm_box_pack_end(bx, tb); + evas_object_show(tb); + + evas_object_resize(win, 320, 300); + evas_object_show(win); +} + +/* Toolbar with multiple state buttons */ +void +test_toolbar5(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *tb, *ph, *menu; + Evas_Object *ph1, *ph2, *ph3, *ph4; + Elm_Object_Item *tb_it; + Elm_Object_Item *menu_it; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("toolbar5", "Toolbar 5"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + elm_win_resize_object_add(win, bx); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bx); + + tb = elm_toolbar_add(win); + elm_toolbar_homogeneous_set(tb, 0); + elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_MENU); + evas_object_size_hint_weight_set(tb, 0.0, 0.0); + evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0); + elm_toolbar_select_mode_set(tb, ELM_OBJECT_SELECT_MODE_NONE); + + ph1 = elm_photo_add(win); + ph2 = elm_photo_add(win); + ph3 = elm_photo_add(win); + ph4 = elm_photo_add(win); + + tb_it = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1); + elm_object_item_disabled_set(tb_it, EINA_TRUE); + elm_toolbar_item_priority_set(tb_it, 100); + + snprintf(buf, sizeof(buf), "%s/images/icon_04.pngj", elm_app_data_dir_get()); + tb_it = elm_toolbar_item_append(tb, buf, "World", tb_2, ph1); + elm_toolbar_item_priority_set(tb_it, -100); + + tb_it = elm_toolbar_item_append(tb, "object-rotate-right", "H", tb_3a, ph4); + elm_toolbar_item_state_add(tb_it, "object-rotate-left", "H2", tb_3b, ph4); + elm_toolbar_item_priority_set(tb_it, 150); + + tb_it = elm_toolbar_item_append(tb, "mail-send", "Comes", tb_4a, ph4); + elm_toolbar_item_state_add(tb_it, "emptytrash", "Comes2", tb_4a, ph4); + elm_toolbar_item_state_add(tb_it, "trashcan_full", "Comes3", tb_4a, ph4); + elm_toolbar_item_priority_set(tb_it, 0); + + tb_it = elm_toolbar_item_append(tb, "clock", "Elementary", tb_5, ph4); + elm_toolbar_item_priority_set(tb_it, -200); + + tb_it = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL); + elm_toolbar_item_menu_set(tb_it, EINA_TRUE); + elm_toolbar_item_priority_set(tb_it, -999999); + elm_toolbar_menu_parent_set(tb, win); + menu = elm_toolbar_item_menu_get(tb_it); + + elm_menu_item_add(menu, NULL, "edit-cut", "Shrink", tb_3, ph4); + menu_it = elm_menu_item_add(menu, NULL, "edit-copy", "Mode", tb_4, ph4); + elm_menu_item_add(menu, menu_it, "edit-paste", "is set to", tb_4, ph4); + elm_menu_item_add(menu, NULL, "edit-delete", "Menu", tb_5, ph4); + + elm_box_pack_end(bx, tb); + evas_object_show(tb); + + tb = elm_table_add(win); + evas_object_size_hint_weight_set(tb, 0.0, EVAS_HINT_EXPAND); + evas_object_size_hint_fill_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL); + + ph = ph1; + elm_photo_size_set(ph, 40); + snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); + elm_photo_file_set(ph, buf); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 0, 0, 1, 1); + evas_object_show(ph); + + ph = ph2; + elm_photo_size_set(ph, 80); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 1, 0, 1, 1); + evas_object_show(ph); + + ph = ph3; + elm_photo_size_set(ph, 20); + snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", elm_app_data_dir_get()); + elm_photo_file_set(ph, buf); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 0, 1, 1, 1); + evas_object_show(ph); + + ph = ph4; + elm_photo_size_set(ph, 60); + snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", elm_app_data_dir_get()); + elm_photo_file_set(ph, buf); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 1, 1, 1, 1); + evas_object_show(ph); + + elm_box_pack_end(bx, tb); + evas_object_show(tb); + + evas_object_resize(win, 320, 300); + evas_object_show(win); +} + +void +test_toolbar6(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *tb, *ph, *menu; + Evas_Object *ph1, *ph2, *ph3, *ph4; + Elm_Object_Item *tb_it; + Elm_Object_Item *menu_it; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("toolbar6", "Toolbar 6"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + elm_win_resize_object_add(win, bx); + elm_box_horizontal_set(bx, EINA_TRUE); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bx); + + tb = elm_toolbar_add(win); + elm_toolbar_horizontal_set(tb, EINA_FALSE); + elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_MENU); + evas_object_size_hint_weight_set(tb, 0.0, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL); + + ph1 = elm_photo_add(win); + ph2 = elm_photo_add(win); + ph3 = elm_photo_add(win); + ph4 = elm_photo_add(win); + + tb_it = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1); + elm_object_item_disabled_set(tb_it, EINA_TRUE); + elm_toolbar_item_priority_set(tb_it, 100); + + tb_it = elm_toolbar_item_append(tb, "folder-new", "World", tb_2, ph1); + elm_toolbar_item_priority_set(tb_it, -100); + + tb_it = elm_toolbar_item_append(tb, "object-rotate-right", "H", tb_3, ph4); + elm_toolbar_item_priority_set(tb_it, 150); + + tb_it = elm_toolbar_item_append(tb, "mail-send", "Comes", tb_4, ph4); + elm_toolbar_item_priority_set(tb_it, 0); + + tb_it = elm_toolbar_item_append(tb, "clock", "Elementary", tb_5, ph4); + elm_toolbar_item_priority_set(tb_it, -200); + + tb_it = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL); + elm_toolbar_item_menu_set(tb_it, EINA_TRUE); + elm_toolbar_item_priority_set(tb_it, -999999); + elm_toolbar_menu_parent_set(tb, win); + menu = elm_toolbar_item_menu_get(tb_it); + + elm_menu_item_add(menu, NULL, "edit-cut", "Shrink", tb_3, ph4); + menu_it = elm_menu_item_add(menu, NULL, "edit-copy", "Mode", tb_4, ph4); + elm_menu_item_add(menu, menu_it, "edit-paste", "is set to", tb_4, ph4); + elm_menu_item_add(menu, NULL, "edit-delete", "Menu", tb_5, ph4); + + elm_box_pack_end(bx, tb); + evas_object_show(tb); + + tb = elm_table_add(win); + evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_fill_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL); + + ph = ph1; + elm_photo_size_set(ph, 40); + snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); + elm_photo_file_set(ph, buf); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 0, 0, 1, 1); + evas_object_show(ph); + + ph = ph2; + elm_photo_size_set(ph, 80); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 1, 0, 1, 1); + evas_object_show(ph); + + ph = ph3; + elm_photo_size_set(ph, 20); + snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", elm_app_data_dir_get()); + elm_photo_file_set(ph, buf); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 0, 1, 1, 1); + evas_object_show(ph); + + ph = ph4; + elm_photo_size_set(ph, 60); + snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", elm_app_data_dir_get()); + elm_photo_file_set(ph, buf); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 1, 1, 1, 1); + evas_object_show(ph); + + elm_box_pack_end(bx, tb); + evas_object_show(tb); + + evas_object_resize(win, 320, 300); + evas_object_show(win); +} + +void +test_toolbar7(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *tb, *ph, *menu; + Evas_Object *ph1, *ph2, *ph3, *ph4; + Elm_Object_Item *tb_it; + Elm_Object_Item *menu_it; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("toolbar7", "Toolbar 7"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + elm_win_resize_object_add(win, bx); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bx); + + tb = elm_toolbar_add(win); + elm_object_style_set(tb, "item_horizontal"); + elm_toolbar_homogeneous_set(tb, 0); + elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_MENU); + evas_object_size_hint_weight_set(tb, 0.0, 0.0); + evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0); + + ph1 = elm_photo_add(win); + ph2 = elm_photo_add(win); + ph3 = elm_photo_add(win); + ph4 = elm_photo_add(win); + + tb_it = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1); + elm_object_item_disabled_set(tb_it, EINA_TRUE); + elm_toolbar_item_priority_set(tb_it, 100); + + tb_it = elm_toolbar_item_append(tb, "folder-new", "World", tb_2, ph1); + elm_toolbar_item_priority_set(tb_it, -100); + + tb_it = elm_toolbar_item_append(tb, "object-rotate-right", "H", tb_3, ph4); + elm_toolbar_item_priority_set(tb_it, 150); + + tb_it = elm_toolbar_item_append(tb, "mail-send", "Comes", tb_4, ph4); + elm_toolbar_item_priority_set(tb_it, 0); + + tb_it = elm_toolbar_item_append(tb, "clock", "Elementary", tb_5, ph4); + elm_toolbar_item_priority_set(tb_it, -200); + + tb_it = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL); + elm_toolbar_item_menu_set(tb_it, EINA_TRUE); + elm_toolbar_item_priority_set(tb_it, -999999); + elm_toolbar_menu_parent_set(tb, win); + menu = elm_toolbar_item_menu_get(tb_it); + + elm_menu_item_add(menu, NULL, "edit-cut", "Shrink", tb_3, ph4); + menu_it = elm_menu_item_add(menu, NULL, "edit-copy", "Mode", tb_4, ph4); + elm_menu_item_add(menu, menu_it, "edit-paste", "is set to", tb_4, ph4); + elm_menu_item_add(menu, NULL, "edit-delete", "Menu", tb_5, ph4); + + elm_box_pack_end(bx, tb); + evas_object_show(tb); + + tb = elm_table_add(win); + //elm_table_homogeneous_set(tb, 1); + evas_object_size_hint_weight_set(tb, 0.0, EVAS_HINT_EXPAND); + evas_object_size_hint_fill_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL); + + ph = ph1; + elm_photo_size_set(ph, 40); + snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); + elm_photo_file_set(ph, buf); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 0, 0, 1, 1); + evas_object_show(ph); + + ph = ph2; + elm_photo_size_set(ph, 80); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 1, 0, 1, 1); + evas_object_show(ph); + + ph = ph3; + elm_photo_size_set(ph, 20); + snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", elm_app_data_dir_get()); + elm_photo_file_set(ph, buf); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 0, 1, 1, 1); + evas_object_show(ph); + + ph = ph4; + elm_photo_size_set(ph, 60); + snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", elm_app_data_dir_get()); + elm_photo_file_set(ph, buf); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 1, 1, 1, 1); + evas_object_show(ph); + + elm_box_pack_end(bx, tb); + evas_object_show(tb); + + evas_object_resize(win, 320, 300); + evas_object_show(win); +} + +void +test_toolbar8(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *tb, *ph, *sl, *menu; + Evas_Object *ph1, *ph2, *ph3, *ph4; + Elm_Object_Item *item; + Elm_Object_Item *menu_it; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("toolbar8", "Toolbar 8"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + elm_win_resize_object_add(win, bx); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bx); + + tb = elm_toolbar_add(win); + elm_toolbar_homogeneous_set(tb, EINA_FALSE); + elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_EXPAND); + evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL); + + ph1 = elm_photo_add(win); + ph2 = elm_photo_add(win); + ph3 = elm_photo_add(win); + ph4 = elm_photo_add(win); + + item = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1); + elm_object_item_disabled_set(item, EINA_TRUE); + elm_toolbar_item_priority_set(item, -100); + + item = elm_toolbar_item_append(tb, "folder-new", "World", tb_2, ph1); + elm_toolbar_item_priority_set(item, 100); + + item = elm_toolbar_item_append(tb, "object-rotate-right", "H", tb_3, ph4); + elm_toolbar_item_priority_set(item, -150); + + sl = elm_slider_add(win); + evas_object_size_hint_min_set(sl, 100, 50); + item = elm_toolbar_item_append(tb, NULL, NULL, NULL, NULL); + elm_object_item_part_content_set(item, "object", sl); + + item = elm_toolbar_item_append(tb, "mail-send", "Comes", tb_4, ph4); + elm_toolbar_item_priority_set(item, -200); + + item = elm_toolbar_item_append(tb, "clock", "Elementary", tb_5, ph4); + elm_toolbar_item_priority_set(item, 0); + + item = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL); + elm_toolbar_item_menu_set(item, EINA_TRUE); + elm_toolbar_item_priority_set(item, -999999); + elm_toolbar_menu_parent_set(tb, win); + menu = elm_toolbar_item_menu_get(item); + + elm_menu_item_add(menu, NULL, "edit-cut", "Shrink", tb_3, ph4); + menu_it = elm_menu_item_add(menu, NULL, "edit-copy", "Mode", tb_4, ph4); + elm_menu_item_add(menu, menu_it, "edit-paste", "is set to", tb_4, ph4); + elm_menu_item_add(menu, NULL, "edit-delete", "Scroll", tb_5, ph4); + + elm_box_pack_end(bx, tb); + evas_object_show(tb); + + tb = elm_table_add(win); + evas_object_size_hint_weight_set(tb, 0.0, EVAS_HINT_EXPAND); + evas_object_size_hint_fill_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL); + + ph = ph1; + elm_photo_size_set(ph, 40); + snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); + elm_photo_file_set(ph, buf); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 0, 0, 1, 1); + evas_object_show(ph); + + ph = ph2; + elm_photo_size_set(ph, 80); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 1, 0, 1, 1); + evas_object_show(ph); + + ph = ph3; + elm_photo_size_set(ph, 20); + snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", elm_app_data_dir_get()); + elm_photo_file_set(ph, buf); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 0, 1, 1, 1); + evas_object_show(ph); + + ph = ph4; + elm_photo_size_set(ph, 60); + snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", elm_app_data_dir_get()); + elm_photo_file_set(ph, buf); + evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ph, 0.5, 0.5); + elm_table_pack(tb, ph, 1, 1, 1, 1); + evas_object_show(ph); + + elm_box_pack_end(bx, tb); + evas_object_show(tb); + + evas_object_resize(win, 420, 250); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_tooltip.c b/libraries/elementary/src/bin/test_tooltip.c new file mode 100644 index 0000000..7d4cb97 --- /dev/null +++ b/libraries/elementary/src/bin/test_tooltip.c @@ -0,0 +1,605 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +typedef struct _Testitem +{ + Elm_Object_Item *item; + const char *path; + int mode; + int onoff; +} Testitem; + +static Elm_Gengrid_Item_Class gic; + +char * +grdt_lbl_get(void *data, + Evas_Object *obj __UNUSED__, + const char *part __UNUSED__) +{ + const Testitem *ti = data; + char buf[256]; + snprintf(buf, sizeof(buf), "Photo %s", ti->path); + return strdup(buf); +} + +Evas_Object * +grdt_content_get(void *data, + Evas_Object *obj, + const char *part) +{ + const Testitem *ti = data; + if (!strcmp(part, "elm.swallow.icon")) + { + Evas_Object *icon = elm_bg_add(obj); + elm_bg_file_set(icon, ti->path, NULL); + evas_object_size_hint_aspect_set(icon, + EVAS_ASPECT_CONTROL_VERTICAL, + 1, 1); + evas_object_show(icon); + return icon; + } + return NULL; +} + +static Elm_Genlist_Item_Class itct; + +static void +gltt_exp(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + Elm_Object_Item *glit = event_info; + Evas_Object *gl = elm_object_item_widget_get(glit); + int val = (int)(long) elm_object_item_data_get(glit); + Elm_Object_Item *glit1, *glit2, *glit3; + + val *= 10; + glit1 = elm_genlist_item_append(gl, &itct, (void *)(long) (val + 1), glit, + ELM_GENLIST_ITEM_NONE, NULL, NULL); + glit2 = elm_genlist_item_append(gl, &itct, (void *)(long) (val + 2), glit, + ELM_GENLIST_ITEM_NONE, NULL, NULL); + glit3 = elm_genlist_item_append(gl, &itct, (void *)(long) (val + 3), glit, + ELM_GENLIST_ITEM_TREE, NULL, NULL); + + elm_genlist_item_tooltip_text_set(glit1, "Testing A"); + elm_genlist_item_tooltip_text_set(glit2, "Testing B"); + elm_genlist_item_tooltip_text_set(glit3, "Testing C"); +} + +static void +gltt_con(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + Elm_Object_Item *glit = event_info; + elm_genlist_item_subitems_clear(glit); +} + +static void +gltt_exp_req(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + Elm_Object_Item *glit = event_info; + elm_genlist_item_expanded_set(glit, EINA_TRUE); +} + +static void +gltt_con_req(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + Elm_Object_Item *glit = event_info; + elm_genlist_item_expanded_set(glit, EINA_FALSE); +} + +char * +gltt_text_get(void *data, + Evas_Object *obj __UNUSED__, + const char *part __UNUSED__) +{ + char buf[256]; + snprintf(buf, sizeof(buf), "Item mode %i", (int)(long)data); + return strdup(buf); +} + +static Evas_Object * +_tt_item_icon(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + Evas_Object *tt, + void *item __UNUSED__) +{ + Evas_Object *ic = elm_icon_add(tt); + char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", + elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_resize(ic, 64, 64); + return ic; +} + +static Evas_Object * +_tt_item_icon2(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + Evas_Object *tt, + void *item __UNUSED__) +{ + Evas_Object *ic = elm_icon_add(tt); + char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), "%s/images/logo.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + return ic; +} + +static Evas_Object * +_tt_item_icon3(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + Evas_Object *tt, + void *item __UNUSED__) +{ + int w, h, sw, sh; + Evas_Object *ic = elm_icon_add(tt); + + char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), "%s/images/insanely_huge_test_image.jpg", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_size_get(ic, &w, &h); + elm_icon_resizable_set(ic, 0, 0); + elm_win_screen_size_get(tt, NULL, NULL, &sw, &sh); + if ((w > sw) || (h > sh)) + { + float sc = 0; + if ((float)w / (float)sw >= 0.8) + sc = ((float)sw * 0.8) / (float)w; + else if ((float)h / (float)sh >= 0.8) + sc = ((float)sh * 0.8) / (float)h; + if (sc) elm_object_scale_set(ic, sc); + } + return ic; +} + +static Evas_Object * +_tt_item_label(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + Evas_Object *tt, + void *item __UNUSED__) +{ + Evas_Object *l = elm_label_add(tt); + elm_object_text_set(l, "Something useful here?" + "No probably not, but this is a super long label" + "which probably breaks on your system, now doesn't it?" + "Yeah, I thought so."); + elm_label_line_wrap_set(l, ELM_WRAP_MIXED); + return l; +} + +static void +_tt_item_icon_del(void *data, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + // test to check for del_cb behavior! + printf("_tt_icon_del: data=%ld (== 456?), event_info=%p\n", + (long)data, event_info); +} + +static void +_tt_text_replace(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + static int count = 0; + char buf[64]; + snprintf(buf, sizeof(buf), "count=%d", count); + count++; + elm_object_tooltip_text_set(obj, buf); +} + +static void +_tt_timer_del(void *data __UNUSED__, + Evas *e __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Ecore_Timer *timer = evas_object_data_del(obj, "test-timer"); + if (!timer) return; + ecore_timer_del(timer); +} + +static Eina_Bool +_tt_text_replace_timer_cb(void *data) +{ + _tt_text_replace(NULL, data, NULL); + return EINA_TRUE; +} + +static void +_tt_text_replace_timed(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Ecore_Timer *timer = evas_object_data_get(obj, "test-timer"); + if (timer) + { + ecore_timer_del(timer); + evas_object_data_del(obj, "test-timer"); + elm_object_text_set(obj, "Simple text tooltip, click to start" + " changed timed"); + return; + } + + timer = ecore_timer_add(1.5, _tt_text_replace_timer_cb, obj); + evas_object_data_set(obj, "test-timer", timer); + elm_object_text_set(obj, "Simple text tooltip, click to stop changed" + " timed"); +} + +static Evas_Object * +_tt_icon(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + Evas_Object *tt) +{ + Evas_Object *ic = elm_icon_add(tt); + char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", + elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_resize(ic, 64, 64); + return ic; +} + +static Evas_Object * +_tt_icon2(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + Evas_Object *tt) +{ + Evas_Object *ic = elm_icon_add(tt); + char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), "%s/images/icon_00.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_resize(ic, 64, 64); + return ic; +} + +static void +_tt_icon_del(void *data, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + // test to check for del_cb behavior! + printf("_tt_icon_del: data=%ld (== 123?), event_info=%p\n", + (long)data, event_info); +} + +static Eina_Bool +_tt_icon_replace_timer_cb(void *data) +{ + static int current = 0; + + elm_object_tooltip_content_cb_set + (data, current ? _tt_icon2 : _tt_icon, NULL, NULL); + + current = !current; + return EINA_TRUE; +} + +static void +_tt_icon_replace_timed(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Ecore_Timer *timer = evas_object_data_get(obj, "test-timer"); + if (timer) + { + ecore_timer_del(timer); + evas_object_data_del(obj, "test-timer"); + elm_object_text_set(obj, "Icon tooltip, click to start changed" + " timed"); + return; + } + + timer = ecore_timer_add(1.5, _tt_icon_replace_timer_cb, obj); + evas_object_data_set(obj, "test-timer", timer); + elm_object_text_set(obj, "Icon tooltip, click to stop changed timed"); +} + +static Eina_Bool +_tt_style_replace_timer_cb(void *data) +{ + static int current = 0; + elm_object_tooltip_style_set(data, current ? NULL : "transparent"); + current = !current; + return EINA_TRUE; +} + +static void +_tt_style_replace_timed(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Ecore_Timer *timer = evas_object_data_get(obj, "test-timer"); + if (timer) + { + ecore_timer_del(timer); + evas_object_data_del(obj, "test-timer"); + elm_object_text_set(obj, "Icon tooltip style, click to start" + " changed timed"); + return; + } + + timer = ecore_timer_add(1.5, _tt_style_replace_timer_cb, obj); + evas_object_data_set(obj, "test-timer", timer); + elm_object_text_set(obj, "Icon tooltip style, click to stop changed" + " timed"); +} + +static void +_tt_visible_lock_toggle(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + static int locked = 0; + + locked = !locked; + if (locked) + { + elm_object_text_set(obj, "Locked tooltip visibility"); + elm_object_tooltip_text_set(obj, "This tooltip is locked" + " visible,
click the button" + " to unlock!"); + elm_object_tooltip_show(obj); + } + else + { + elm_object_text_set(obj, "Unlocked tooltip visibility"); + elm_object_tooltip_text_set(obj, "This tooltip is unlocked" + " visible,
click the button" + " to lock!"); + elm_object_tooltip_hide(obj); + } +} + +void +test_tooltip(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *tb, *bt, *se, *lst; + Elm_Object_Item *tb_it; + Elm_Object_Item *lit; + + win = elm_win_util_standard_add("tooltip", "Tooltip"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + tb = elm_toolbar_add(win); + elm_toolbar_homogeneous_set(tb, 0); + evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0); + elm_box_pack_end(bx, tb); + evas_object_show(tb); + + tb_it = elm_toolbar_item_append(tb, NULL, "Open", NULL, NULL); + elm_object_item_tooltip_text_set(tb_it, "Opens a file"); + + tb_it = elm_toolbar_item_append(tb, NULL, "Icon", NULL, NULL); + elm_object_item_tooltip_content_cb_set + (tb_it, _tt_item_icon, (void *)456L, _tt_item_icon_del); + elm_object_item_tooltip_style_set(tb_it, "transparent"); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Simple text tooltip"); + elm_object_tooltip_text_set(bt, "Simple text tooltip"); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Simple text tooltip, click to change"); + elm_object_tooltip_text_set(bt, "Initial"); + evas_object_smart_callback_add(bt, "clicked", _tt_text_replace, NULL); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Simple text tooltip, click to start" + " changed timed"); + elm_object_tooltip_text_set(bt, "Initial"); + evas_object_smart_callback_add(bt, "clicked", _tt_text_replace_timed, + NULL); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + evas_object_event_callback_add(bt, EVAS_CALLBACK_DEL, _tt_timer_del, + NULL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Icon tooltip"); + elm_object_tooltip_content_cb_set(bt, _tt_icon, (void *)123L, + _tt_icon_del); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Icon tooltip, click to start changed timed"); + elm_object_tooltip_content_cb_set(bt, _tt_icon, NULL, NULL); + evas_object_smart_callback_add(bt, "clicked", _tt_icon_replace_timed, + NULL); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + evas_object_event_callback_add(bt, EVAS_CALLBACK_DEL, _tt_timer_del, + NULL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Transparent Icon tooltip"); + elm_object_tooltip_content_cb_set(bt, _tt_icon, NULL, NULL); + elm_object_tooltip_style_set(bt, "transparent"); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Icon tooltip style, click to start changed" + " timed"); + elm_object_tooltip_content_cb_set(bt, _tt_icon, NULL, NULL); + evas_object_smart_callback_add(bt, "clicked", _tt_style_replace_timed, + NULL); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + evas_object_event_callback_add(bt, EVAS_CALLBACK_DEL, _tt_timer_del, + NULL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Unlocked tooltip visibility"); + elm_object_tooltip_text_set(bt, "This tooltip is unlocked visible,
" + " click the button to lock!"); + evas_object_smart_callback_add(bt, "clicked", _tt_visible_lock_toggle, + NULL); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + se = elm_entry_add(win); + elm_entry_scrollable_set(se, EINA_TRUE); + evas_object_size_hint_weight_set(se, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(se, EVAS_HINT_FILL, 0.5); + elm_entry_scrollbar_policy_set(se, ELM_SCROLLER_POLICY_OFF, + ELM_SCROLLER_POLICY_OFF); + elm_object_text_set(se, "Hello, some entry here!"); + elm_object_tooltip_text_set(se, "Type something here!"); + elm_entry_single_line_set(se, EINA_TRUE); + elm_box_pack_end(bx, se); + evas_object_show(se); + + lst = elm_list_add(win); + lit = elm_list_item_append(lst, "Hello", NULL, NULL, NULL, NULL); + elm_object_item_tooltip_content_cb_set(lit, _tt_item_label, NULL, NULL); + elm_object_item_tooltip_window_mode_set(lit, EINA_TRUE); + lit = elm_list_item_append(lst, "Icon Tooltip", NULL, NULL, NULL, NULL); + elm_object_item_tooltip_content_cb_set(lit, _tt_item_icon, NULL, NULL); + lit = elm_list_item_append(lst, "Big Icon Tooltip", NULL, NULL, NULL, NULL); + elm_object_item_tooltip_content_cb_set(lit, _tt_item_icon2, NULL, NULL); + elm_object_item_tooltip_style_set(lit, "transparent"); + elm_object_item_tooltip_window_mode_set(lit, EINA_TRUE); + lit = elm_list_item_append(lst, "Insanely Big Icon Tooltip", NULL, NULL, NULL, NULL); + elm_object_item_tooltip_content_cb_set(lit, _tt_item_icon3, NULL, NULL); + elm_object_item_tooltip_style_set(lit, "transparent"); + elm_object_item_tooltip_window_mode_set(lit, EINA_TRUE); + evas_object_size_hint_weight_set(lst, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(lst, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_min_set(lst, 100, 100); + elm_list_go(lst); + elm_box_pack_end(bx, lst); + evas_object_show(lst); + + evas_object_resize(win, 320, 580); + evas_object_show(win); +} + +void +test_tooltip2(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *grid, *gl; + Elm_Object_Item *glit1, *glit2, *glit3; + static Testitem ti[144]; + int i, n; + char buf[PATH_MAX]; + const char *img[9] = + { + "panel_01.jpg", + "plant_01.jpg", + "rock_01.jpg", + "rock_02.jpg", + "sky_01.jpg", + "sky_02.jpg", + "sky_03.jpg", + "sky_04.jpg", + "wood_01.jpg", + }; + + win = elm_win_util_standard_add("tooltip2", "Tooltip 2"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + grid = elm_gengrid_add(win); + elm_gengrid_item_size_set(grid, 100, 100); + elm_gengrid_horizontal_set(grid, EINA_FALSE); + elm_gengrid_multi_select_set(grid, EINA_TRUE); + evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + + gic.item_style = "default"; + gic.func.text_get = grdt_lbl_get; + gic.func.content_get = grdt_content_get; + + n = 0; + for (i = 0; i < 9; i++) + { + snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), + img[n]); + n++; + ti[i].mode = i; + ti[i].path = eina_stringshare_add(buf); + ti[i].item = elm_gengrid_item_append(grid, &gic, &(ti[i]), NULL, + NULL); + if (n % 2) + elm_gengrid_item_tooltip_text_set(ti[i].item, "Testing X"); + else + elm_gengrid_item_tooltip_text_set(ti[i].item, "Testing Y"); + if (!(i % 5)) + elm_gengrid_item_selected_set(ti[i].item, EINA_TRUE); + } + + elm_box_pack_end(bx, grid); + evas_object_show(grid); + + gl = elm_genlist_add(win); + evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + + itct.item_style = "default"; + itct.func.text_get = gltt_text_get; + + glit1 = elm_genlist_item_append(gl, &itct, (void *)1, NULL, + ELM_GENLIST_ITEM_TREE, NULL, NULL); + glit2 = elm_genlist_item_append(gl, &itct, (void *)2, NULL, + ELM_GENLIST_ITEM_TREE, NULL, NULL); + glit3 = elm_genlist_item_append(gl, &itct, (void *)3, NULL, + ELM_GENLIST_ITEM_NONE, NULL, NULL); + + elm_genlist_item_tooltip_text_set(glit1, "Testing 1"); + elm_genlist_item_tooltip_text_set(glit2, "Testing 2"); + elm_genlist_item_tooltip_text_set(glit3, "Testing 3"); + + evas_object_smart_callback_add(gl, "expand,request", gltt_exp_req, gl); + evas_object_smart_callback_add(gl, "contract,request", gltt_con_req, + gl); + evas_object_smart_callback_add(gl, "expanded", gltt_exp, gl); + evas_object_smart_callback_add(gl, "contracted", gltt_con, gl); + + elm_box_pack_end(bx, gl); + evas_object_show(gl); + + evas_object_resize(win, 320, 480); + evas_object_show(win); +} + +#endif diff --git a/libraries/elementary/src/bin/test_transit.c b/libraries/elementary/src/bin/test_transit.c new file mode 100644 index 0000000..7596d01 --- /dev/null +++ b/libraries/elementary/src/bin/test_transit.c @@ -0,0 +1,558 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +typedef struct _Custom_Effect Custom_Effect; + +struct _Custom_Effect +{ + struct _size + { + Evas_Coord w, h; + } from, to; +}; + +static void +_custom_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress) +{ + if (!effect) return; + Evas_Coord w, h; + Evas_Object *obj; + const Eina_List *elist; + + Custom_Effect *custom_effect = effect; + const Eina_List *objs = elm_transit_objects_get(transit); + + if (progress < 0.5) + { + h = custom_effect->from.h + (custom_effect->to.h * progress * 2); + w = custom_effect->from.w; + } + else + { + h = custom_effect->from.h + custom_effect->to.h; + w = custom_effect->from.w + \ + (custom_effect->to.w * (progress - 0.5) * 2); + } + + EINA_LIST_FOREACH(objs, elist, obj) + evas_object_resize(obj, w, h); +} + +static Elm_Transit_Effect * +_custom_context_new(Evas_Coord from_w, Evas_Coord from_h, Evas_Coord to_w, Evas_Coord to_h) +{ + Custom_Effect *custom_effect; + + custom_effect = calloc(1, sizeof(Custom_Effect)); + if (!custom_effect) return NULL; + + custom_effect->from.w = from_w; + custom_effect->from.h = from_h; + custom_effect->to.w = to_w - from_w; + custom_effect->to.h = to_h - from_h; + + return custom_effect; +} + +static void +_custom_context_free(Elm_Transit_Effect *effect, Elm_Transit *transit __UNUSED__) +{ + Custom_Effect *custom_effect = effect; + free(custom_effect); +} + +static void +_transit_rotation_translation_color(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Elm_Transit *trans; + + trans = elm_transit_add(); + elm_transit_object_add(trans, obj); + elm_transit_auto_reverse_set(trans, EINA_TRUE); + elm_transit_repeat_times_set(trans, 2); + + /* Translation Effect */ + elm_transit_effect_translation_add(trans, -70.0, -150.0, 70.0, 150.0); + + /* Color Effect */ + elm_transit_effect_color_add(trans, 100, 255, 100, 255, 50, 30, 50, 50); + + /* Rotation Effect */ + elm_transit_effect_rotation_add(trans, 0.0, 135.0); + + elm_transit_duration_set(trans, 5.0); + elm_transit_go(trans); +} + +static void +_transit_wipe(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Elm_Transit *trans; + + trans = elm_transit_add(); + elm_transit_object_add(trans, obj); + elm_transit_auto_reverse_set(trans, EINA_TRUE); + + elm_transit_effect_wipe_add(trans, + ELM_TRANSIT_EFFECT_WIPE_TYPE_HIDE, + ELM_TRANSIT_EFFECT_WIPE_DIR_RIGHT); + + elm_transit_duration_set(trans, 5.0); + elm_transit_go(trans); +} + +static void +_transit_del_cb(void *data, Elm_Transit *transit __UNUSED__) +{ + evas_object_freeze_events_set(data, EINA_FALSE); +} + +static void +_transit_image_animation(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Eina_List *images = NULL; + char buf[PATH_MAX]; + Elm_Transit *trans; + Evas_Object *ic = data; + + snprintf(buf, sizeof(buf), "%s/images/icon_19.png", elm_app_data_dir_get()); + images = eina_list_append(images, eina_stringshare_add(buf)); + + snprintf(buf, sizeof(buf), "%s/images/icon_00.png", elm_app_data_dir_get()); + images = eina_list_append(images, eina_stringshare_add(buf)); + + snprintf(buf, sizeof(buf), "%s/images/icon_11.png", elm_app_data_dir_get()); + images = eina_list_append(images, eina_stringshare_add(buf)); + + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + images = eina_list_append(images, eina_stringshare_add(buf)); + + trans = elm_transit_add(); + elm_transit_del_cb_set(trans, _transit_del_cb, obj); + elm_transit_object_add(trans, ic); + elm_transit_effect_image_animation_add(trans, images); + elm_transit_duration_set(trans, 5.0); + elm_transit_go(trans); + + evas_object_freeze_events_set(obj, EINA_TRUE); +} + +static void +_transit_resizing(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Transit *trans; + + trans = elm_transit_add(); + elm_transit_object_add(trans, obj); + + elm_transit_effect_resizing_add(trans, 100, 50, 300, 150); + + elm_transit_duration_set(trans, 5.0); + elm_transit_go(trans); +} + +static void +_transit_flip(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Elm_Transit *trans; + Evas_Object *obj2 = data; + + trans = elm_transit_add(); + elm_transit_object_add(trans, obj); + elm_transit_object_add(trans, obj2); + + elm_transit_effect_flip_add(trans, ELM_TRANSIT_EFFECT_FLIP_AXIS_X, EINA_TRUE); + + elm_transit_duration_set(trans, 5.0); + elm_transit_go(trans); +} + +static void +_transit_zoom(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Transit *trans; + + trans = elm_transit_add(); + elm_transit_object_add(trans, obj); + + elm_transit_effect_zoom_add(trans, 1.0, 3.0); + + elm_transit_duration_set(trans, 5.0); + elm_transit_go(trans); +} + +static void +_transit_blend(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Elm_Transit *trans; + Evas_Object *obj2 = data; + + trans = elm_transit_add(); + elm_transit_object_add(trans, obj); + elm_transit_object_add(trans, obj2); + + elm_transit_effect_blend_add(trans); + + elm_transit_duration_set(trans, 5.0); + elm_transit_go(trans); +} + +static void +_transit_fade(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Elm_Transit *trans; + Evas_Object *obj2 = data; + + trans = elm_transit_add(); + elm_transit_object_add(trans, obj); + elm_transit_object_add(trans, obj2); + + elm_transit_effect_fade_add(trans); + + elm_transit_duration_set(trans, 5.0); + elm_transit_go(trans); +} + +static void +_transit_resizable_flip(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Elm_Transit *trans; + Evas_Object *obj2 = data; + + trans = elm_transit_add(); + elm_transit_object_add(trans, obj); + elm_transit_object_add(trans, obj2); + + elm_transit_effect_resizable_flip_add(trans, ELM_TRANSIT_EFFECT_FLIP_AXIS_Y, EINA_TRUE); + + elm_transit_duration_set(trans, 5.0); + elm_transit_go(trans); +} + +/* Translation, Rotation, Color, Wipe, ImagemAnimation Effect */ +void +test_transit(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *bt, *ic; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("transit", "Transit"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_size_hint_min_set(bx, 318, 318); + evas_object_show(bx); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/icon_11.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + + bt = elm_button_add(win); + elm_object_text_set(bt, "ImageAnimation Effect"); + elm_object_part_content_set(bt, "icon", ic); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + evas_object_show(ic); + evas_object_smart_callback_add(bt, "clicked", _transit_image_animation, ic); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Color, Rotation and Translation"); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + evas_object_smart_callback_add(bt, "clicked", + _transit_rotation_translation_color, NULL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Wipe Effect"); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + evas_object_smart_callback_add(bt, "clicked", _transit_wipe, NULL); + + evas_object_show(win); +} + +/* Resizing Effect */ +void +test_transit2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bt; + + win = elm_win_util_standard_add("transit2", "Transit 2"); + elm_win_autodel_set(win, EINA_TRUE); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Resizing Effect"); + evas_object_show(bt); + evas_object_move(bt, 50, 100); + evas_object_resize(bt, 100, 50); + evas_object_smart_callback_add(bt, "clicked", _transit_resizing, NULL); + + evas_object_resize(win, 400, 400); + evas_object_show(win); +} + +/* Flip Effect */ +void +test_transit3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bt, *bt2; + + win = elm_win_util_standard_add("transit3", "Transit 3"); + elm_win_autodel_set(win, EINA_TRUE); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Front Button - Flip Effect"); + evas_object_show(bt); + evas_object_move(bt, 50, 50); + evas_object_resize(bt, 200, 200); + + bt2 = elm_button_add(win); + elm_object_text_set(bt2, "Back Button - Flip Effect"); + evas_object_move(bt2, 50, 50); + evas_object_resize(bt2, 200, 200); + + evas_object_resize(win, 300, 300); + evas_object_show(win); + + evas_object_smart_callback_add(bt, "clicked", _transit_flip, bt2); + evas_object_smart_callback_add(bt2, "clicked", _transit_flip, bt); +} + +/* Zoom Effect */ +void +test_transit4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bt; + + win = elm_win_util_standard_add("transit4", "Transit 4"); + elm_win_autodel_set(win, EINA_TRUE); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Zoom Effect"); + evas_object_resize(bt, 100, 50); + evas_object_move(bt, 100, 125); + evas_object_show(bt); + + evas_object_smart_callback_add(bt, "clicked", _transit_zoom, NULL); + + evas_object_resize(win, 300, 300); + evas_object_show(win); +} + +/* Blend Effect */ +void +test_transit5(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bt, *bt2, *ic; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("transit5", "Transit 5"); + elm_win_autodel_set(win, EINA_TRUE); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/rock_01.jpg", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_max_set(ic, 50, 50); + + bt = elm_button_add(win); + elm_object_part_content_set(bt, "icon", ic); + elm_object_text_set(bt, "Before Button - Blend Effect"); + evas_object_move(bt, 25, 125); + evas_object_resize(bt, 250, 50); + evas_object_show(bt); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/rock_02.jpg", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_max_set(ic, 50, 50); + + bt2 = elm_button_add(win); + elm_object_part_content_set(bt2, "icon", ic); + elm_object_text_set(bt2, "After Button - Blend Effect"); + evas_object_move(bt2, 25, 125); + evas_object_resize(bt2, 250, 50); + + evas_object_resize(win, 300, 300); + evas_object_show(win); + + evas_object_smart_callback_add(bt, "clicked", _transit_blend, bt2); + evas_object_smart_callback_add(bt2, "clicked", _transit_blend, bt); +} + +/* Fade Effect */ +void +test_transit6(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bt, *bt2, *ic; + char buf[PATH_MAX]; + + win = elm_win_util_standard_add("transit6","Transit 6"); + elm_win_autodel_set(win, EINA_TRUE); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/rock_01.jpg", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_max_set(ic, 50, 50); + + bt = elm_button_add(win); + elm_object_part_content_set(bt, "icon", ic); + elm_object_text_set(bt, "Before Button - Fade Effect"); + evas_object_move(bt, 25, 125); + evas_object_resize(bt, 250, 50); + evas_object_show(bt); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/rock_02.jpg", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_max_set(ic, 50, 50); + + bt2 = elm_button_add(win); + elm_object_part_content_set(bt2, "icon", ic); + elm_object_text_set(bt2, "After Button - Fade Effect"); + evas_object_move(bt2, 25, 125); + evas_object_resize(bt2, 250, 50); + + evas_object_resize(win, 300, 300); + evas_object_show(win); + + evas_object_smart_callback_add(bt, "clicked", _transit_fade, bt2); + evas_object_smart_callback_add(bt2, "clicked", _transit_fade, bt); +} + +/* Resizable Flip Effect */ +void +test_transit7(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bt, *bt2; + + win = elm_win_util_standard_add("transit7", "Transit 7"); + elm_win_autodel_set(win, EINA_TRUE); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Front Button - Resizable Flip Effect"); + evas_object_show(bt); + evas_object_move(bt, 50, 100); + evas_object_resize(bt, 250, 30); + + bt2 = elm_button_add(win); + elm_object_text_set(bt2, "Back Button - Resizable Flip Effect"); + evas_object_move(bt2, 50, 100); + evas_object_resize(bt2, 300, 200); + + evas_object_resize(win, 400, 400); + evas_object_show(win); + + evas_object_smart_callback_add(bt, "clicked", _transit_resizable_flip, bt2); + evas_object_smart_callback_add(bt2, "clicked", _transit_resizable_flip, bt); +} + +/* Custom Effect */ +void +test_transit8(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bt; + Elm_Transit *trans; + Elm_Transit_Effect *effect_context; + + win = elm_win_util_standard_add("transit8", "Transit 8"); + elm_win_autodel_set(win, EINA_TRUE); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button - Custom Effect"); + evas_object_show(bt); + evas_object_move(bt, 50, 50); + evas_object_resize(bt, 150, 150); + + /* Adding Transit */ + trans = elm_transit_add(); + elm_transit_auto_reverse_set(trans, EINA_TRUE); + elm_transit_tween_mode_set(trans, ELM_TRANSIT_TWEEN_MODE_DECELERATE); + effect_context = _custom_context_new(150, 150, 50, 50); + elm_transit_object_add(trans, bt); + elm_transit_effect_add(trans, + _custom_op, effect_context, + _custom_context_free); + elm_transit_duration_set(trans, 5.0); + elm_transit_repeat_times_set(trans, -1); + elm_transit_go(trans); + + evas_object_resize(win, 400, 400); + evas_object_show(win); +} + +/* Chain Transit Effect */ +void +test_transit9(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bt, *bt2, *bt3, *bt4; + Elm_Transit *trans, *trans2, *trans3, *trans4; + + win = elm_win_util_standard_add("transit9", "Transit 9"); + elm_win_autodel_set(win, EINA_TRUE); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Chain 1"); + evas_object_resize(bt, 100, 100); + evas_object_move(bt, 0, 0); + evas_object_show(bt); + + bt2 = elm_button_add(win); + elm_object_text_set(bt2, "Chain 2"); + evas_object_resize(bt2, 100, 100); + evas_object_move(bt2, 300, 0); + evas_object_show(bt2); + + bt3 = elm_button_add(win); + elm_object_text_set(bt3, "Chain 3"); + evas_object_resize(bt3, 100, 100); + evas_object_move(bt3, 300, 300); + evas_object_show(bt3); + + bt4 = elm_button_add(win); + elm_object_text_set(bt4, "Chain 4"); + evas_object_resize(bt4, 100, 100); + evas_object_move(bt4, 0, 300); + evas_object_show(bt4); + + trans = elm_transit_add(); + elm_transit_tween_mode_set(trans, ELM_TRANSIT_TWEEN_MODE_ACCELERATE); + elm_transit_effect_translation_add(trans, 0, 0, 300, 0); + elm_transit_object_add(trans, bt); + elm_transit_duration_set(trans, 1); + elm_transit_objects_final_state_keep_set(trans, EINA_TRUE); + elm_transit_go(trans); + + trans2 = elm_transit_add(); + elm_transit_tween_mode_set(trans2, ELM_TRANSIT_TWEEN_MODE_ACCELERATE); + elm_transit_effect_translation_add(trans2, 0, 0, 0, 300); + elm_transit_object_add(trans2, bt2); + elm_transit_duration_set(trans2, 1); + elm_transit_objects_final_state_keep_set(trans2, EINA_TRUE); + elm_transit_chain_transit_add(trans, trans2); + + trans3 = elm_transit_add(); + elm_transit_tween_mode_set(trans3, ELM_TRANSIT_TWEEN_MODE_ACCELERATE); + elm_transit_effect_translation_add(trans3, 0, 0, -300, 0); + elm_transit_object_add(trans3, bt3); + elm_transit_duration_set(trans3, 1); + elm_transit_objects_final_state_keep_set(trans3, EINA_TRUE); + elm_transit_chain_transit_add(trans2, trans3); + + trans4 = elm_transit_add(); + elm_transit_tween_mode_set(trans4, ELM_TRANSIT_TWEEN_MODE_ACCELERATE); + elm_transit_effect_translation_add(trans4, 0, 0, 0, -300); + elm_transit_object_add(trans4, bt4); + elm_transit_duration_set(trans4, 1); + elm_transit_objects_final_state_keep_set(trans4, EINA_TRUE); + elm_transit_chain_transit_add(trans3, trans4); + + evas_object_resize(win, 400, 400); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_video.c b/libraries/elementary/src/bin/test_video.c new file mode 100644 index 0000000..1b9e7b9 --- /dev/null +++ b/libraries/elementary/src/bin/test_video.c @@ -0,0 +1,91 @@ + +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static void +my_bt_open(void *data, Evas_Object *obj __UNUSED__, void *event_info) +{ + Evas_Object *video = data; + const char *file = event_info; + + if (file) + { + elm_video_file_set(video, file); + elm_video_play(video); + } +} + +static void +_notify_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_show(data); +} + +static void +_notify_block(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_notify_timeout_set(data, 0); + evas_object_show(data); +} + +static void +_notify_unblock(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_notify_timeout_set(data, 3.0); + evas_object_show(data); +} + +void +test_video(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bg, *video, *bt, *tb, *notify, *player; + + win = elm_win_add(NULL, "video", ELM_WIN_BASIC); + elm_win_title_set(win, "Video"); + elm_win_autodel_set(win, EINA_TRUE); + elm_win_alpha_set(win, EINA_TRUE); /* Needed to turn video fast path on */ + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + video = elm_video_add(win); + evas_object_size_hint_weight_set(video, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, video); + evas_object_show(video); + + notify = elm_notify_add(win); + elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM); + elm_notify_timeout_set(notify, 3.0); + + player = elm_player_add(win); + elm_object_content_set(player, video); + elm_object_content_set(notify, player); + evas_object_show(player); + + tb = elm_table_add(win); + evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, tb); + + bt = elm_fileselector_button_add(win); + elm_object_text_set(bt, "Select Video"); + evas_object_smart_callback_add(bt, "file,chosen", my_bt_open, video); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, 0.5, 0.1); + elm_table_pack(tb, bt, 0, 0, 1, 1); + evas_object_show(bt); + + evas_object_show(tb); + + evas_object_event_callback_add(video, EVAS_CALLBACK_MOUSE_MOVE, _notify_show, notify); + evas_object_event_callback_add(video, EVAS_CALLBACK_MOUSE_IN, _notify_block, notify); + evas_object_event_callback_add(video, EVAS_CALLBACK_MOUSE_OUT, _notify_unblock, notify); + + evas_object_resize(win, 800, 800); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_weather.c b/libraries/elementary/src/bin/test_weather.c new file mode 100644 index 0000000..062a9a0 --- /dev/null +++ b/libraries/elementary/src/bin/test_weather.c @@ -0,0 +1,170 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +#ifdef HAVE_ELEMENTARY_EWEATHER +# include "EWeather_Smart.h" +#endif + +#ifdef HAVE_ELEMENTARY_EWEATHER +static Evas_Object *en, *hv, *fl; +static Evas_Object *weather[2]; +static int current = 0; +static Eina_Module *module[2]; + +static void +_first_city_cb(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__) +{ + if (!current) return; + current = 0; + elm_flip_go(fl, ELM_FLIP_ROTATE_YZ_CENTER_AXIS); +} + +static void +_second_city_cb(void *dat __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__) +{ + if (current) return; + current = 1; + elm_flip_go(fl, ELM_FLIP_ROTATE_XZ_CENTER_AXIS); +} + +static void _apply_cb(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__) +{ + EWeather *eweather = eweather_object_eweather_get(weather[current]); + + if (module[current]) + eweather_plugin_set(eweather, module[current]); + eweather_code_set(eweather, elm_object_text_get(en)); + printf("CURRENT %d %p %p\n", current, module[current], eweather); +} + +static void +_hover_select_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + EWeather *eweather = eweather_object_eweather_get(weather[0]); + module[0] = eweather_plugin_search(eweather, elm_object_item_text_get(event_info)); + + eweather = eweather_object_eweather_get(weather[1]); + module[1] = eweather_plugin_search(eweather, elm_object_item_text_get(event_info)); + printf("%p %p\n", module[0], module[1]); +} +#endif + +void +test_weather(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win; +#ifdef HAVE_ELEMENTARY_EWEATHER + Evas_Object *bx, *bx0, *bt; + EWeather *eweather; + Eina_Array_Iterator it; + Eina_Array *array; + Eina_Module *m; + unsigned int i; +#endif + + win = elm_win_util_standard_add("weather", "Weather"); + elm_win_autodel_set(win, EINA_TRUE); + +#ifdef HAVE_ELEMENTARY_EWEATHER + bx = elm_box_add(win); + elm_win_resize_object_add(win, bx); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bx); + + fl = elm_flip_add(win); + evas_object_size_hint_align_set(fl, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(fl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, fl); + + current = 0; + + module[0] = NULL; + weather[0] = eweather_object_add(evas_object_evas_get(win)); + evas_object_size_hint_weight_set(weather[0], EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(weather[0], -1.0, -1.0); + elm_object_part_content_set(fl, "front", weather[0]); + evas_object_show(weather[0]); + + module[1] = NULL; + weather[1] = eweather_object_add(evas_object_evas_get(win)); + eweather = eweather_object_eweather_get(weather[1]); + evas_object_size_hint_weight_set(weather[1], EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(weather[1], -1.0, -1.0); + elm_object_part_content_set(fl, "back", weather[1]); + evas_object_show(weather[1]); + + evas_object_show(fl); + + // + bx0 = elm_box_add(win); + elm_box_horizontal_set(bx0, EINA_TRUE); + evas_object_size_hint_weight_set(bx0, 1.0, 0.0); + elm_box_pack_end(bx, bx0); + evas_object_show(bx0); + + bt = elm_button_add(win); + elm_object_text_set(bt, "First city"); + evas_object_show(bt); + elm_box_pack_end(bx0, bt); + evas_object_smart_callback_add(bt, "clicked", _first_city_cb, NULL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Second city"); + evas_object_show(bt); + elm_box_pack_end(bx0, bt); + evas_object_smart_callback_add(bt, "clicked", _second_city_cb, NULL); + // + + // + bx0 = elm_box_add(win); + elm_box_horizontal_set(bx0, EINA_TRUE); + evas_object_size_hint_weight_set(bx0, 1.0, 0.0); + elm_box_pack_end(bx, bx0); + evas_object_show(bx0); + + hv = elm_hoversel_add(win); + elm_hoversel_hover_parent_set(hv, win); + elm_object_text_set(hv, "data source"); + evas_object_size_hint_weight_set(hv, 0.0, 0.0); + evas_object_size_hint_align_set(hv, 0.5, 0.5); + elm_box_pack_end(bx0, hv); + evas_object_show(hv); + + array = eweather_plugins_list_get(eweather); + + EINA_ARRAY_ITER_NEXT(array, i, m, it) + elm_hoversel_item_add(hv, eweather_plugin_name_get(eweather, i), NULL, ELM_ICON_NONE, _hover_select_cb, NULL); + + en = elm_entry_add(win); + elm_entry_line_wrap_set(en, ELM_WRAP_NONE); + elm_entry_single_line_set(en, EINA_TRUE); + elm_object_text_set(en, "Paris"); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx0, en); + evas_object_show(en); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Apply"); + evas_object_show(bt); + elm_box_pack_end(bx0, bt); + evas_object_smart_callback_add(bt, "clicked", _apply_cb, NULL); + // + + +#else + Evas_Object *lbl; + + lbl = elm_label_add(win); + elm_win_resize_object_add(win, lbl); + elm_object_text_set(lbl, "libeweather is required to display the forecast."); + evas_object_show(lbl); +#endif + + evas_object_resize(win, 244, 388); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_web.c b/libraries/elementary/src/bin/test_web.c new file mode 100644 index 0000000..32c533f --- /dev/null +++ b/libraries/elementary/src/bin/test_web.c @@ -0,0 +1,501 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +typedef struct +{ + Evas_Object *web; + Evas_Object *btn_back; + Evas_Object *btn_fwd; + Evas_Object *url_entry; + Eina_List *sub_wins; + const char* user_agent; + Eina_Bool js_hooks : 1; +} Web_Test; + +static void +_btn_back_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *web = data; + + elm_web_back(web); +} + +static void +_btn_fwd_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *web = data; + + elm_web_forward(web); +} + +static void +_btn_reload_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *web = data; + + elm_web_reload(web); +} + +static void +_url_change_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *web = data; + const char *uri = elm_object_text_get(obj); + + elm_web_uri_set(web, uri); +} + +static void +_toggle_inwin_mode_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_web_inwin_mode_set(data, !elm_web_inwin_mode_get(data)); +} + +static void +_title_changed_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info) +{ + char buf[512]; + snprintf(buf, sizeof(buf), "Web - %s", (const char *)event_info); + elm_win_title_set(data, buf); +} + +static void +_uri_changed_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info) +{ + Web_Test *wt = data; + + elm_object_text_set(wt->url_entry, event_info); + + elm_object_disabled_set(wt->btn_back, !elm_web_back_possible_get(wt->web)); + elm_object_disabled_set(wt->btn_fwd, !elm_web_forward_possible_get(wt->web)); +} + +static void +_new_win_del_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Web_Test *wt = data; + wt->sub_wins = eina_list_remove(wt->sub_wins, obj); +} + +static void +_web_win_close_request_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_del(data); +} + +static Evas_Object * +_new_window_hook(void *data, Evas_Object *obj __UNUSED__, Eina_Bool js __UNUSED__, const Elm_Web_Window_Features *wf __UNUSED__) +{ + Web_Test *wt = data; + Evas_Object *new_win, *new_web; + + new_win = elm_win_util_standard_add("elm-web-test-popup", "Elm Web Test Popup"); + elm_win_autodel_set(new_win, EINA_TRUE); + evas_object_resize(new_win, 300, 300); + evas_object_show(new_win); + + new_web = elm_web_add(new_win); + elm_web_useragent_set(new_web, wt->user_agent); + evas_object_size_hint_weight_set(new_web, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_win_resize_object_add(new_win, new_web); + evas_object_show(new_web); + + evas_object_smart_callback_add(new_win, "delete,request", _new_win_del_cb, + wt); + evas_object_smart_callback_add(new_web, "windows,close,request", + _web_win_close_request_cb, new_win); + wt->sub_wins = eina_list_append(wt->sub_wins, new_win); + + return new_web; +} + +static void +_alert_del(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + evas_object_del(obj); +} + +static Evas_Object * +_alert_hook(void *data __UNUSED__, Evas_Object *obj, const char *message) +{ + Evas_Object *popup, *label; + + popup = elm_notify_add(obj); + elm_notify_orient_set(popup, ELM_NOTIFY_ORIENT_CENTER); + // Using the timeout doesn't seem to go well with the second main loop + //elm_notify_timeout_set(popup, 2.0); + elm_notify_allow_events_set(popup, EINA_FALSE); + evas_object_show(popup); + + evas_object_smart_callback_add(popup, "block,clicked", _alert_del, NULL); + + label = elm_label_add(obj); + elm_object_text_set(label, message); + elm_object_content_set(popup, label); + evas_object_show(label); + + return popup; +} + +static void +_confirm_ok_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Eina_Bool *response = data; + *response = EINA_TRUE; +} + +static void +_confirm_cancel_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Eina_Bool *response = data; + *response = EINA_FALSE; +} + +static void +_confirm_dismiss_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_del(data); +} + +static Evas_Object * +_confirm_hook(void *data __UNUSED__, Evas_Object *obj, const char *message, Eina_Bool *response) +{ + Evas_Object *popup, *box, *box2, *label, *btn_ok, *btn_cancel; + + popup = elm_notify_add(obj); + elm_notify_orient_set(popup, ELM_NOTIFY_ORIENT_CENTER); + elm_notify_allow_events_set(popup, EINA_FALSE); + evas_object_show(popup); + + box = elm_box_add(obj); + elm_object_content_set(popup, box); + evas_object_show(box); + + label = elm_label_add(obj); + elm_object_text_set(label, message); + elm_box_pack_end(box, label); + evas_object_show(label); + + box2 = elm_box_add(obj); + elm_box_horizontal_set(box2, EINA_TRUE); + elm_box_pack_end(box, box2); + evas_object_show(box2); + + btn_ok = elm_button_add(obj); + elm_object_text_set(btn_ok, "Ok"); + elm_box_pack_end(box2, btn_ok); + evas_object_show(btn_ok); + + btn_cancel = elm_button_add(obj); + elm_object_text_set(btn_cancel, "Cancel"); + elm_box_pack_end(box2, btn_cancel); + evas_object_show(btn_cancel); + + evas_object_smart_callback_add(btn_ok, "clicked", _confirm_dismiss_cb, + popup); + evas_object_smart_callback_add(btn_cancel, "clicked", _confirm_dismiss_cb, + popup); + evas_object_smart_callback_add(btn_ok, "clicked", _confirm_ok_cb, response); + evas_object_smart_callback_add(btn_cancel, "clicked", _confirm_cancel_cb, + response); + + return popup; +} + +static Evas_Object * +_prompt_hook(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *message __UNUSED__, const char *default_value, char **value, Eina_Bool *response) +{ + *response = EINA_TRUE; + *value = default_value ? strdup(default_value) : "No default!"; + return NULL; +} + +static Evas_Object * +_file_selector_hook(void *data __UNUSED__, Evas_Object *obj __UNUSED__, Eina_Bool allow_multiple __UNUSED__, Eina_List *accept_types __UNUSED__, Eina_List **selected_files, Eina_Bool *response) +{ + *selected_files = eina_list_append(NULL, + strdup("/path/to/non_existing_file")); + *response = EINA_TRUE; + return NULL; +} + +static void +_console_message_hook(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *message, unsigned int line_number, const char *source_id) +{ + printf("CONSOLE: %s:%d:%s\n", source_id, line_number, message); +} + +static void +_js_popup_hooks_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Web_Test *wt = data; + + wt->js_hooks = !wt->js_hooks; + if (wt->js_hooks) + { + elm_web_dialog_alert_hook_set(wt->web, _alert_hook, NULL); + elm_web_dialog_confirm_hook_set(wt->web, _confirm_hook, NULL); + elm_web_dialog_prompt_hook_set(wt->web, _prompt_hook, NULL); + elm_web_dialog_file_selector_hook_set(wt->web, _file_selector_hook, + NULL); + elm_web_console_message_hook_set(wt->web, _console_message_hook, NULL); + } + else + { + elm_web_dialog_alert_hook_set(wt->web, NULL, NULL); + elm_web_dialog_confirm_hook_set(wt->web, NULL, NULL); + elm_web_dialog_prompt_hook_set(wt->web, NULL, NULL); + elm_web_dialog_file_selector_hook_set(wt->web, NULL, NULL); + elm_web_console_message_hook_set(wt->web, NULL, NULL); + } +} + +static void +_zoom_out_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Web_Test *wt = data; + double zoom; + + zoom = elm_web_zoom_get(wt->web); + if (zoom > 1) + zoom -= .5; + else + zoom /= 2; + if (zoom < .05) + zoom = .05; + elm_web_zoom_set(wt->web, zoom); +} + +static void +_zoom_in_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Web_Test *wt = data; + double zoom; + + zoom = elm_web_zoom_get(wt->web); + + if (zoom < 1) + zoom *= 2; + else + zoom += .5; + if (zoom > 4) + zoom = 4; + elm_web_zoom_set(wt->web, zoom); +} + +static void +_zoom_mode_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info) +{ + Web_Test *wt = data; + Elm_Object_Item *hoversel_it = event_info; + const char *lbl = elm_object_item_text_get(hoversel_it); + + if (!strcmp(lbl, "Manual")) + elm_web_zoom_mode_set(wt->web, ELM_WEB_ZOOM_MODE_MANUAL); + else if (!strcmp(lbl, "Fit")) + elm_web_zoom_mode_set(wt->web, ELM_WEB_ZOOM_MODE_AUTO_FIT); + else + elm_web_zoom_mode_set(wt->web, ELM_WEB_ZOOM_MODE_AUTO_FILL); +} + +static void +_show_region_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Web_Test *wt = data; + elm_web_region_show(wt->web, 300, 300, 1, 1); +} + +static void +_bring_in_region_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Web_Test *wt = data; + elm_web_region_bring_in(wt->web, 50, 0, 1, 1); +} + +static void +_main_web_del_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Web_Test *wt = data; + Evas_Object *sub_win; + + EINA_LIST_FREE(wt->sub_wins, sub_win) + evas_object_del(sub_win); + + free(wt); +} + +void +test_web(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__, Eina_Bool mobile) +{ + const char user_agent_firefox[] = "Mozilla/5.0 (X11; Linux x86_64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1"; + const char user_agent_mobile[] = "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3"; + Evas_Object *win, *bx, *bx2, *bt, *web, *url; + Web_Test *wt; + + elm_need_web(); + + wt = calloc(1, sizeof(*wt)); + + if (mobile == EINA_TRUE) + { + win = elm_win_util_standard_add("web-mobile", "Web Mobile"); + wt->user_agent = user_agent_mobile; + } + else + { + win = elm_win_util_standard_add("web", "Web"); + wt->user_agent = user_agent_firefox; + } + + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + elm_win_resize_object_add(win, bx); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bx); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, 0.0); + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + web = elm_web_add(win); + elm_web_useragent_set(web, wt->user_agent); + printf("elm_web useragent: %s\n", elm_web_useragent_get(web)); + evas_object_size_hint_weight_set(web, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(web, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, web); + evas_object_show(web); + + bt = elm_button_add(win); + elm_object_text_set(bt, "<"); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + evas_object_smart_callback_add(bt, "clicked", _btn_back_cb, web); + wt->btn_back = bt; + + bt = elm_button_add(win); + elm_object_text_set(bt, "R"); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + evas_object_smart_callback_add(bt, "clicked", _btn_reload_cb, web); + + bt = elm_button_add(win); + elm_object_text_set(bt, ">"); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + evas_object_smart_callback_add(bt, "clicked", _btn_fwd_cb, web); + wt->btn_fwd = bt; + + url = elm_entry_add(win); + elm_entry_single_line_set(url, EINA_TRUE); + elm_entry_scrollable_set(url, EINA_TRUE); + evas_object_size_hint_weight_set(url, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(url, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx2, url); + evas_object_show(url); + + evas_object_smart_callback_add(url, "activated", _url_change_cb, web); + wt->url_entry = url; + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, 0); + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Inwin Mode"); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + evas_object_smart_callback_add(bt, "clicked", _toggle_inwin_mode_cb, web); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Custom Hooks"); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + evas_object_smart_callback_add(bt, "clicked", _js_popup_hooks_set, wt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "-"); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + evas_object_smart_callback_add(bt, "clicked", _zoom_out_cb, wt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "+"); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + evas_object_smart_callback_add(bt, "clicked", _zoom_in_cb, wt); + + bt = elm_hoversel_add(win); + elm_object_text_set(bt, "Zoom Mode"); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + elm_hoversel_item_add(bt, "Manual", NULL, ELM_ICON_NONE, _zoom_mode_cb, wt); + elm_hoversel_item_add(bt, "Fit", NULL, ELM_ICON_NONE, _zoom_mode_cb, wt); + elm_hoversel_item_add(bt, "Fill", NULL, ELM_ICON_NONE, _zoom_mode_cb, wt); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, 0); + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Show 300, 300"); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + evas_object_smart_callback_add(bt, "clicked", _show_region_cb, wt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Bring in 50, 0"); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + evas_object_smart_callback_add(bt, "clicked", _bring_in_region_cb, wt); + + evas_object_smart_callback_add(web, "title,changed", _title_changed_cb, win); + evas_object_smart_callback_add(web, "uri,changed", _uri_changed_cb, wt); + + evas_object_event_callback_add(web, EVAS_CALLBACK_DEL, _main_web_del_cb, wt); + + wt->web = web; + + elm_web_uri_set(web, "http://www.enlightenment.org"); + + elm_web_window_create_hook_set(web, _new_window_hook, wt); + + evas_object_resize(win, 320, 480); + evas_object_show(win); +} + +void +test_web_normal(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + test_web(data, obj, event_info, EINA_FALSE); +} + +void +test_web_mobile(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + test_web(data, obj, event_info, EINA_TRUE); +} +#endif diff --git a/libraries/elementary/src/bin/test_win_inline.c b/libraries/elementary/src/bin/test_win_inline.c new file mode 100644 index 0000000..a8aed99 --- /dev/null +++ b/libraries/elementary/src/bin/test_win_inline.c @@ -0,0 +1,246 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static void +fill(Evas_Object *win, Eina_Bool do_bg) +{ + Evas_Object *bg, *sc, *bx, *ic, *bb, *av, *en; + char buf[PATH_MAX]; + + if (do_bg) + { + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + } + + sc = elm_scroller_add(win); + evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, sc); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); + elm_object_text_set(en, "This is a single line"); + elm_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + elm_entry_single_line_set(en, EINA_TRUE); + evas_object_show(en); + elm_box_pack_end(bx, en); + + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); + elm_object_text_set(en, "Entry 2"); + elm_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + elm_entry_single_line_set(en, EINA_TRUE); + evas_object_show(en); + elm_box_pack_end(bx, en); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1); + + bb = elm_bubble_add(win); + elm_object_text_set(bb, "Message 3"); + elm_object_part_text_set(bb, "info", "10:32 4/11/2008"); + elm_object_part_content_set(bb, "icon", ic); + evas_object_show(ic); + evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL); + av = elm_entry_add(win); + elm_entry_anchor_hover_style_set(av, "popout"); + elm_entry_anchor_hover_parent_set(av, win); + elm_object_text_set(av, + "Hi there. This is the most recent message in the " + "list of messages. It has one +61 432 1234 " + "(phone number) to click on."); + elm_object_content_set(bb, av); + evas_object_show(av); + elm_box_pack_end(bx, bb); + evas_object_show(bb); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + + bb = elm_bubble_add(win); + elm_object_text_set(bb, "Message 2"); + elm_object_part_text_set(bb, "info", "7:16 27/10/2008"); + elm_object_part_content_set(bb, "icon", ic); + evas_object_show(ic); + evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL); + av = elm_entry_add(win); + elm_entry_anchor_hover_style_set(av, "popout"); + elm_entry_anchor_hover_parent_set(av, win); + elm_object_text_set(av, + "Hey what are you doing? This is the second last message " + "Hi there. This is the most recent message in the " + "list. It's a longer one so it can wrap more and " + "contains a John contact " + "link in it to test popups on links. The idea is that " + "all SMS's are scanned for things that look like phone " + "numbers or names that are in your contacts list, and " + "if they are, they become clickable links that pop up " + "a menus of obvious actions to perform on this piece " + "of information. This of course can be later explicitly " + "done by links maybe running local apps or even being " + "web URL's too that launch the web browser and point it " + "to that URL. "); + elm_object_content_set(bb, av); + evas_object_show(av); + elm_box_pack_end(bx, bb); + evas_object_show(bb); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1); + + bb = elm_bubble_add(win); + elm_object_text_set(bb, "Message 1"); + elm_object_part_text_set(bb, "info", "20:47 18/6/2008"); + elm_object_part_content_set(bb, "icon", ic); + evas_object_show(ic); + evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL); + + av = elm_entry_add(win); + elm_entry_anchor_hover_style_set(av, "popout"); + elm_entry_anchor_hover_parent_set(av, win); + elm_object_text_set(av, "This is a short message. "); + elm_object_content_set(bb, av); + evas_object_show(av); + elm_box_pack_end(bx, bb); + evas_object_show(bb); + + elm_object_content_set(sc, bx); + evas_object_show(bx); + + evas_object_show(sc); +} + +static void +cb_mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Move *ev = event_info; + Evas_Object *orig = data; + Evas_Coord x, y; + Evas_Map *p; + int i, w, h; + + if (!ev->buttons) return; + evas_object_geometry_get(obj, &x, &y, NULL, NULL); + evas_object_move(obj, + x + (ev->cur.canvas.x - ev->prev.output.x), + y + (ev->cur.canvas.y - ev->prev.output.y)); + evas_object_image_size_get(orig, &w, &h); + p = evas_map_new(4); + evas_object_map_enable_set(orig, EINA_TRUE); + evas_object_raise(orig); + for (i = 0; i < 4; i++) + { + Evas_Object *hand; + char key[32]; + + snprintf(key, sizeof(key), "h-%i\n", i); + hand = evas_object_data_get(orig, key); + evas_object_raise(hand); + evas_object_geometry_get(hand, &x, &y, NULL, NULL); + x += 15; + y += 15; + evas_map_point_coord_set(p, i, x, y, 0); + if (i == 0) evas_map_point_image_uv_set(p, i, 0, 0); + else if (i == 1) evas_map_point_image_uv_set(p, i, w, 0); + else if (i == 2) evas_map_point_image_uv_set(p, i, w, h); + else if (i == 3) evas_map_point_image_uv_set(p, i, 0, h); + } + evas_object_map_set(orig, p); + evas_map_free(p); +} + +static void +create_handles(Evas_Object *obj) +{ + int i; + Evas_Coord x, y, w, h; + + evas_object_geometry_get(obj, &x, &y, &w, &h); + for (i = 0; i < 4; i++) + { + Evas_Object *hand; + char buf[PATH_MAX]; + char key[32]; + + hand = evas_object_image_filled_add(evas_object_evas_get(obj)); + evas_object_resize(hand, 31, 31); + snprintf(buf, sizeof(buf), "%s/images/pt.png", elm_app_data_dir_get()); + evas_object_image_file_set(hand, buf, NULL); + if (i == 0) evas_object_move(hand, x - 15, y - 15); + else if (i == 1) evas_object_move(hand, x + w - 15, y - 15); + else if (i == 2) evas_object_move(hand, x + w - 15, y + h - 15); + else if (i == 3) evas_object_move(hand, x - 15, y + h - 15); + evas_object_event_callback_add(hand, EVAS_CALLBACK_MOUSE_MOVE, cb_mouse_move, obj); + evas_object_show(hand); + snprintf(key, sizeof(key), "h-%i\n", i); + evas_object_data_set(obj, key, hand); + } +} + +void +test_win_inline(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bg, *win2, *win3; + char buf[PATH_MAX]; + + win = elm_win_add(NULL, "window-inline", ELM_WIN_BASIC); + elm_win_title_set(win, "Window Inline"); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); + elm_bg_file_set(bg, buf, NULL); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + win2 = elm_win_add(win, "inlined", ELM_WIN_INLINED_IMAGE); + fill(win2, EINA_TRUE); + + evas_object_move(win2, 20, 60); + evas_object_resize(win2, 300, 200); + // image object for win2 is unlinked to its pos/size - so manual control + // this allows also for using map and other things with it. + evas_object_move(elm_win_inlined_image_object_get(win2), 20, 40); + evas_object_resize(elm_win_inlined_image_object_get(win2), 200, 320); + evas_object_show(win2); + + win3 = elm_win_add(win, "inlined", ELM_WIN_INLINED_IMAGE); + elm_win_alpha_set(win3, EINA_TRUE); + fill(win3, EINA_FALSE); + + evas_object_resize(win3, 300, 200); + evas_object_move(elm_win_inlined_image_object_get(win3), 80, 180); + evas_object_resize(elm_win_inlined_image_object_get(win3), 300, 200); + evas_object_show(win3); + + create_handles(elm_win_inlined_image_object_get(win3)); + + evas_object_resize(win, 400, 600); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_win_plug.c b/libraries/elementary/src/bin/test_win_plug.c new file mode 100644 index 0000000..8d88bc4 --- /dev/null +++ b/libraries/elementary/src/bin/test_win_plug.c @@ -0,0 +1,108 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + + +static void +cb_mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Move *ev = event_info; + Evas_Object *orig = data; + Evas_Coord x, y; + Evas_Map *p; + int i, w, h; + + if (!ev->buttons) return; + evas_object_geometry_get(obj, &x, &y, NULL, NULL); + evas_object_move(obj, + x + (ev->cur.canvas.x - ev->prev.output.x), + y + (ev->cur.canvas.y - ev->prev.output.y)); + evas_object_image_size_get(orig, &w, &h); + p = evas_map_new(4); + evas_object_map_enable_set(orig, EINA_TRUE); + evas_object_raise(orig); + for (i = 0; i < 4; i++) + { + Evas_Object *hand; + char key[32]; + + snprintf(key, sizeof(key), "h-%i\n", i); + hand = evas_object_data_get(orig, key); + evas_object_raise(hand); + evas_object_geometry_get(hand, &x, &y, NULL, NULL); + x += 15; + y += 15; + evas_map_point_coord_set(p, i, x, y, 0); + if (i == 0) evas_map_point_image_uv_set(p, i, 0, 0); + else if (i == 1) evas_map_point_image_uv_set(p, i, w, 0); + else if (i == 2) evas_map_point_image_uv_set(p, i, w, h); + else if (i == 3) evas_map_point_image_uv_set(p, i, 0, h); + } + evas_object_map_set(orig, p); + evas_map_free(p); +} + +static void +create_handles(Evas_Object *obj) +{ + int i; + Evas_Coord x, y, w, h; + + evas_object_geometry_get(obj, &x, &y, &w, &h); + for (i = 0; i < 4; i++) + { + Evas_Object *hand; + char buf[PATH_MAX]; + char key[32]; + + hand = evas_object_image_filled_add(evas_object_evas_get(obj)); + evas_object_resize(hand, 31, 31); + snprintf(buf, sizeof(buf), "%s/images/pt.png", elm_app_data_dir_get()); + evas_object_image_file_set(hand, buf, NULL); + if (i == 0) evas_object_move(hand, x - 15, y - 15); + else if (i == 1) evas_object_move(hand, x + w - 15, y - 15); + else if (i == 2) evas_object_move(hand, x + w - 15, y + h - 15); + else if (i == 3) evas_object_move(hand, x - 15, y + h - 15); + evas_object_event_callback_add(hand, EVAS_CALLBACK_MOUSE_MOVE, cb_mouse_move, obj); + evas_object_show(hand); + snprintf(key, sizeof(key), "h-%i\n", i); + evas_object_data_set(obj, key, hand); + } +} + +void +test_win_plug(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bg, *plug; + char buf[PATH_MAX]; + + win = elm_win_add(NULL, "window-inline", ELM_WIN_BASIC); + elm_win_title_set(win, "Window Inline"); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); + elm_bg_file_set(bg, buf, NULL); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + plug = elm_plug_add(win); + if (!elm_plug_connect(plug, "ello", 0, EINA_FALSE)) + { + printf("Cannot connect plug\n"); + return; + } + + evas_object_resize(plug, 380, 500); + evas_object_move(plug, 10, 10); + evas_object_show(plug); + + create_handles(elm_plug_image_object_get(plug)); + + evas_object_resize(win, 400, 600); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/bin/test_win_socket.c b/libraries/elementary/src/bin/test_win_socket.c new file mode 100644 index 0000000..223bb57 --- /dev/null +++ b/libraries/elementary/src/bin/test_win_socket.c @@ -0,0 +1,205 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH + +static void +_win_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *socket_win = data; + evas_object_del(socket_win); +} + +static void +fill(Evas_Object *win, Eina_Bool do_bg) +{ + Evas_Object *bg, *sc, *bx, *ic, *bb, *av, *en; + char buf[PATH_MAX]; + + if (do_bg) + { + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + } + + sc = elm_scroller_add(win); + evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, sc); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); + elm_object_text_set(en, "This is a single line"); + elm_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + elm_entry_single_line_set(en, EINA_TRUE); + evas_object_show(en); + elm_box_pack_end(bx, en); + + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); + elm_object_text_set(en, "Entry 2"); + elm_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); + elm_entry_single_line_set(en, EINA_TRUE); + evas_object_show(en); + elm_box_pack_end(bx, en); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1); + + bb = elm_bubble_add(win); + elm_object_text_set(bb, "Message 3"); + elm_object_part_text_set(bb, "info", "10:32 4/11/2008"); + elm_object_part_content_set(bb, "icon", ic); + evas_object_show(ic); + evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL); + av = elm_entry_add(win); + elm_entry_anchor_hover_style_set(av, "popout"); + elm_entry_anchor_hover_parent_set(av, win); + elm_object_text_set(av, + "Hi there. This is the most recent message in the " + "list of messages. It has one +61 432 1234 " + "(phone number) to click on."); + elm_object_content_set(bb, av); + evas_object_show(av); + elm_box_pack_end(bx, bb); + evas_object_show(bb); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + + bb = elm_bubble_add(win); + elm_object_text_set(bb, "Message 2"); + elm_object_part_text_set(bb, "info", "7:16 27/10/2008"); + elm_object_part_content_set(bb, "icon", ic); + evas_object_show(ic); + evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL); + av = elm_entry_add(win); + elm_entry_anchor_hover_style_set(av, "popout"); + elm_entry_anchor_hover_parent_set(av, win); + elm_object_text_set(av, + "Hey what are you doing? This is the second last message " + "Hi there. This is the most recent message in the " + "list. It's a longer one so it can wrap more and " + "contains a John contact " + "link in it to test popups on links. The idea is that " + "all SMS's are scanned for things that look like phone " + "numbers or names that are in your contacts list, and " + "if they are, they become clickable links that pop up " + "a menus of obvious actions to perform on this piece " + "of information. This of course can be later explicitly " + "done by links maybe running local apps or even being " + "web URL's too that launch the web browser and point it " + "to that URL. "); + elm_object_content_set(bb, av); + evas_object_show(av); + elm_box_pack_end(bx, bb); + evas_object_show(bb); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic, buf, NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1); + + bb = elm_bubble_add(win); + elm_object_text_set(bb, "Message 1"); + elm_object_part_text_set(bb, "info", "20:47 18/6/2008"); + elm_object_part_content_set(bb, "icon", ic); + evas_object_show(ic); + evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL); + + av = elm_entry_add(win); + elm_entry_anchor_hover_style_set(av, "popout"); + elm_entry_anchor_hover_parent_set(av, win); + elm_object_text_set(av, "This is a short message. "); + elm_object_content_set(bb, av); + evas_object_show(av); + elm_box_pack_end(bx, bb); + evas_object_show(bb); + + elm_object_content_set(sc, bx); + evas_object_show(bx); + + evas_object_show(sc); +} + +void +test_win_socket(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bx, *lb; + Evas_Object *win_socket; + + /* for socket info window */ + win = elm_win_util_standard_add("win-socket", "Win Socket"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + + lb = elm_label_add(win); + elm_object_text_set(lb, + "This is a small label" + ); + evas_object_size_hint_weight_set(lb, 0.0, 0.0); + evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, lb); + evas_object_show(lb); + + lb = elm_label_add(win); + elm_object_text_set(lb, + "If you runs more than Window Plug Program
" + "you can see each plug programs shared same
" + "canvas
" + ); + evas_object_size_hint_weight_set(lb, 0.0, 0.0); + evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, lb); + evas_object_show(lb); + + evas_object_resize(win, 320, 300); + + evas_object_show(bx); + evas_object_show(win); + elm_win_resize_object_add(win, bx); + + /* for socket window */ + win_socket = elm_win_add(NULL, "Window Socket", ELM_WIN_SOCKET_IMAGE); + + if (!elm_win_socket_listen(win_socket, "ello", 0, EINA_FALSE)) + { + printf("Fail to elm win socket listen \n"); + evas_object_del(win_socket); + evas_object_del(win); + return; + } + elm_win_title_set(win_socket, "Window Socket"); + elm_win_autodel_set(win_socket, EINA_TRUE); + + fill(win_socket, EINA_TRUE); + + evas_object_resize(win_socket, 400, 600); + evas_object_show(win_socket); + + evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, _win_del, + win_socket); +} +#endif diff --git a/libraries/elementary/src/bin/test_win_state.c b/libraries/elementary/src/bin/test_win_state.c new file mode 100644 index 0000000..e0fb8cc --- /dev/null +++ b/libraries/elementary/src/bin/test_win_state.c @@ -0,0 +1,369 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#ifndef ELM_LIB_QUICKLAUNCH +typedef struct _Testitem +{ + Elm_Object_Item *item; + int mode, onoff; +} Testitem; + +static int rotate_with_resize = 0; + +static void +my_bt_38_alpha_on(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + Evas_Object *bg = evas_object_data_get(win, "bg"); + evas_object_hide(bg); + elm_win_alpha_set(win, EINA_TRUE); +} + +static void +my_bt_38_alpha_off(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + Evas_Object *bg = evas_object_data_get(win, "bg"); + evas_object_show(bg); + elm_win_alpha_set(win, EINA_FALSE); +} + +static void +my_ck_38_resize(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ +// Evas_Object *win = data; + rotate_with_resize = elm_check_state_get(obj); +} + +static void +my_bt_38_rot_0(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + if (rotate_with_resize) + elm_win_rotation_with_resize_set(win, 0); + else + elm_win_rotation_set(win, 0); +} + +static void +my_bt_38_rot_90(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + if (rotate_with_resize) + elm_win_rotation_with_resize_set(win, 90); + else + elm_win_rotation_set(win, 90); +} + +static void +my_bt_38_rot_180(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + if (rotate_with_resize) + elm_win_rotation_with_resize_set(win, 180); + else + elm_win_rotation_set(win, 180); +} + +static void +my_bt_38_rot_270(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win = data; + if (rotate_with_resize) + elm_win_rotation_with_resize_set(win, 270); + else + elm_win_rotation_set(win, 270); +} + +static void +my_win_move(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Coord x, y; + elm_win_screen_position_get(obj, &x, &y); + printf("MOVE - win geom: %4i %4i\n", x, y); +} + +static void +_win_resize(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Coord w, h; + evas_object_geometry_get(obj, NULL, NULL, &w, &h); + printf("RESIZE - win geom: %4ix%4i\n", w, h); +} + +static void +_win_foc_in(void *data __UNUSED__, Evas *e __UNUSED__, void *event_info __UNUSED__) +{ + printf("FOC IN\n"); +} + +static void +_win_foc_out(void *data __UNUSED__, Evas *e __UNUSED__, void *event_info __UNUSED__) +{ + printf("FOC OUT\n"); +} + +static void +_close_win(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_del(data); +} + +void +test_win_state(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bg, *sl, *bx, *bx2, *bt, *ck; + + win = elm_win_add(NULL, "window-states", ELM_WIN_BASIC); + elm_win_title_set(win, "Window States"); + evas_object_smart_callback_add(win, "moved", my_win_move, NULL); + evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE, _win_resize, NULL); + evas_event_callback_add(evas_object_evas_get(win), EVAS_CALLBACK_CANVAS_FOCUS_IN, _win_foc_in, NULL); + evas_event_callback_add(evas_object_evas_get(win), EVAS_CALLBACK_CANVAS_FOCUS_OUT, _win_foc_out, NULL); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + evas_object_data_set(win, "bg", bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + elm_box_homogeneous_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_fill_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Alpha On"); + evas_object_smart_callback_add(bt, "clicked", my_bt_38_alpha_on, win); + evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Alpha Off"); + evas_object_smart_callback_add(bt, "clicked", my_bt_38_alpha_off, win); + evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + elm_box_homogeneous_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_fill_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + sl = elm_slider_add(win); + elm_object_text_set(sl, "Test"); + elm_slider_span_size_set(sl, 100); + evas_object_size_hint_align_set(sl, 0.5, 0.5); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_slider_indicator_format_set(sl, "%3.0f"); + elm_slider_min_max_set(sl, 50, 150); + elm_slider_value_set(sl, 50); + elm_slider_inverted_set(sl, EINA_TRUE); + elm_box_pack_end(bx2, sl); + evas_object_show(sl); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + ck = elm_check_add(win); + elm_object_text_set(ck, "resize"); + elm_check_state_set(ck, rotate_with_resize); + evas_object_smart_callback_add(ck, "changed", my_ck_38_resize, win); + evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ck, 0.02, 0.99); + evas_object_show(ck); + elm_box_pack_end(bx, ck); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + elm_box_homogeneous_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_fill_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Rot 0"); + evas_object_smart_callback_add(bt, "clicked", my_bt_38_rot_0, win); + evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Rot 90"); + evas_object_smart_callback_add(bt, "clicked", my_bt_38_rot_90, win); + evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Rot 180"); + evas_object_smart_callback_add(bt, "clicked", my_bt_38_rot_180, win); + evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Rot 270"); + evas_object_smart_callback_add(bt, "clicked", my_bt_38_rot_270, win); + evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + evas_object_resize(win, 280, 400); + evas_object_show(win); +} + +void +test_win_state2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *win, *bg, *sl, *bx, *bx2, *bt, *ck; + char buf[PATH_MAX]; + + win = elm_win_add(NULL, "window-states2", ELM_WIN_BASIC); + elm_win_override_set(win, EINA_TRUE); + evas_object_smart_callback_add(win, "moved", my_win_move, NULL); + evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE, _win_resize, NULL); + elm_win_title_set(win, "Window States 2"); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", elm_app_data_dir_get()); + elm_bg_file_set(bg, buf, NULL); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + evas_object_data_set(win, "bg", bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_fill_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Alpha On"); + evas_object_smart_callback_add(bt, "clicked", my_bt_38_alpha_on, win); + evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Alpha Off"); + evas_object_smart_callback_add(bt, "clicked", my_bt_38_alpha_off, win); + evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, 0.0, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Close"); + evas_object_smart_callback_add(bt, "clicked", _close_win, win); + evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + elm_box_homogeneous_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_fill_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + sl = elm_slider_add(win); + elm_object_text_set(sl, "Override Redirect"); + elm_slider_span_size_set(sl, 100); + evas_object_size_hint_align_set(sl, 0.5, 0.5); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_slider_indicator_format_set(sl, "%3.0f"); + elm_slider_min_max_set(sl, 50, 150); + elm_slider_value_set(sl, 50); + elm_slider_inverted_set(sl, EINA_TRUE); + elm_box_pack_end(bx2, sl); + evas_object_show(sl); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + ck = elm_check_add(win); + elm_object_text_set(ck, "resize"); + elm_check_state_set(ck, rotate_with_resize); + evas_object_smart_callback_add(ck, "changed", my_ck_38_resize, win); + evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ck, 0.02, 0.99); + evas_object_show(ck); + elm_box_pack_end(bx, ck); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + elm_box_homogeneous_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_fill_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Rot 0"); + evas_object_smart_callback_add(bt, "clicked", my_bt_38_rot_0, win); + evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Rot 90"); + evas_object_smart_callback_add(bt, "clicked", my_bt_38_rot_90, win); + evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Rot 180"); + evas_object_smart_callback_add(bt, "clicked", my_bt_38_rot_180, win); + evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Rot 270"); + evas_object_smart_callback_add(bt, "clicked", my_bt_38_rot_270, win); + evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + evas_object_show(bt); + + elm_box_pack_end(bx, bx2); + evas_object_show(bx2); + + evas_object_resize(win, 320, 480); + evas_object_show(win); +} +#endif diff --git a/libraries/elementary/src/edje_externals/Makefile.am b/libraries/elementary/src/edje_externals/Makefile.am new file mode 100644 index 0000000..ba9c9c7 --- /dev/null +++ b/libraries/elementary/src/edje_externals/Makefile.am @@ -0,0 +1,69 @@ +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-DELM_INTERNAL_API_ARGESFSDFEFC=1 \ +-I. \ +-I$(top_builddir) \ +-I$(top_srcdir) \ +-I$(top_srcdir)/src/lib \ +-I$(top_builddir)/src/lib \ +-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ +-DPACKAGE_LIB_DIR=\"$(libdir)\" \ +@ELEMENTARY_CFLAGS@ \ +@ELEMENTARY_X_CFLAGS@ \ +@ELEMENTARY_FB_CFLAGS@ \ +@ELEMENTARY_WIN32_CFLAGS@ \ +@ELEMENTARY_WINCE_CFLAGS@ \ +@ELEMENTARY_EDBUS_CFLAGS@ \ +@ELEMENTARY_EFREET_CFLAGS@ \ +@ELEMENTARY_ETHUMB_CFLAGS@ \ +@ELEMENTARY_EMAP_CFLAGS@ + +if ELEMENTARY_WINDOWS_BUILD +AM_CPPFLAGS += -DELEMENTARY_BUILD +endif + +pkgdir = $(libdir)/edje/modules/elm/$(MODULE_EDJE) +pkg_LTLIBRARIES = module.la + +module_la_SOURCES = private.h \ +modules.inc \ +elm.c \ +elm_actionslider.c \ +elm_bubble.c \ +elm_button.c \ +elm_calendar.c \ +elm_check.c \ +elm_clock.c \ +elm_entry.c \ +elm_fileselector.c \ +elm_fileselector_button.c \ +elm_fileselector_entry.c \ +elm_frame.c \ +elm_gengrid.c \ +elm_genlist.c \ +elm_hoversel.c \ +elm_icon.c \ +elm_index.c \ +elm_label.c \ +elm_list.c \ +elm_map.c \ +elm_multibuttonentry.c \ +elm_naviframe.c \ +elm_notify.c \ +elm_panes.c \ +elm_photocam.c \ +elm_progressbar.c \ +elm_radio.c \ +elm_scroller.c \ +elm_segment_control.c \ +elm_slider.c \ +elm_slideshow.c \ +elm_spinner.c \ +elm_thumb.c \ +elm_toolbar.c \ +elm_video.c \ +elm_web.c + +module_la_LIBADD = @ELEMENTARY_LIBS@ $(top_builddir)/src/lib/libelementary.la +module_la_LDFLAGS = -no-undefined -module -avoid-version -shared -fPIC diff --git a/libraries/elementary/src/edje_externals/Makefile.in b/libraries/elementary/src/edje_externals/Makefile.in new file mode 100644 index 0000000..ed6cc8f --- /dev/null +++ b/libraries/elementary/src/edje_externals/Makefile.in @@ -0,0 +1,739 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@ELEMENTARY_WINDOWS_BUILD_TRUE@am__append_1 = -DELEMENTARY_BUILD +subdir = src/edje_externals +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/efl_binary.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/elementary_config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(pkgdir)" +LTLIBRARIES = $(pkg_LTLIBRARIES) +module_la_DEPENDENCIES = $(top_builddir)/src/lib/libelementary.la +am_module_la_OBJECTS = elm.lo elm_actionslider.lo elm_bubble.lo \ + elm_button.lo elm_calendar.lo elm_check.lo elm_clock.lo \ + elm_entry.lo elm_fileselector.lo elm_fileselector_button.lo \ + elm_fileselector_entry.lo elm_frame.lo elm_gengrid.lo \ + elm_genlist.lo elm_hoversel.lo elm_icon.lo elm_index.lo \ + elm_label.lo elm_list.lo elm_map.lo elm_multibuttonentry.lo \ + elm_naviframe.lo elm_notify.lo elm_panes.lo elm_photocam.lo \ + elm_progressbar.lo elm_radio.lo elm_scroller.lo \ + elm_segment_control.lo elm_slider.lo elm_slideshow.lo \ + elm_spinner.lo elm_thumb.lo elm_toolbar.lo elm_video.lo \ + elm_web.lo +module_la_OBJECTS = $(am_module_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +module_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(module_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(module_la_SOURCES) +DIST_SOURCES = $(module_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EIO_CFLAGS = @EIO_CFLAGS@ +EIO_LIBS = @EIO_LIBS@ +ELEMENTARY_CFLAGS = @ELEMENTARY_CFLAGS@ +ELEMENTARY_COCOA_CFLAGS = @ELEMENTARY_COCOA_CFLAGS@ +ELEMENTARY_COCOA_LIBS = @ELEMENTARY_COCOA_LIBS@ +ELEMENTARY_CONFIG_PRG = @ELEMENTARY_CONFIG_PRG@ +ELEMENTARY_ECORE_CON_CFLAGS = @ELEMENTARY_ECORE_CON_CFLAGS@ +ELEMENTARY_ECORE_CON_INC = @ELEMENTARY_ECORE_CON_INC@ +ELEMENTARY_ECORE_CON_LIBS = @ELEMENTARY_ECORE_CON_LIBS@ +ELEMENTARY_ECORE_IMF_CFLAGS = @ELEMENTARY_ECORE_IMF_CFLAGS@ +ELEMENTARY_ECORE_IMF_INC = @ELEMENTARY_ECORE_IMF_INC@ +ELEMENTARY_ECORE_IMF_LIBS = @ELEMENTARY_ECORE_IMF_LIBS@ +ELEMENTARY_EDBUS_CFLAGS = @ELEMENTARY_EDBUS_CFLAGS@ +ELEMENTARY_EDBUS_LIBS = @ELEMENTARY_EDBUS_LIBS@ +ELEMENTARY_EFREET_CFLAGS = @ELEMENTARY_EFREET_CFLAGS@ +ELEMENTARY_EFREET_LIBS = @ELEMENTARY_EFREET_LIBS@ +ELEMENTARY_EMAP_CFLAGS = @ELEMENTARY_EMAP_CFLAGS@ +ELEMENTARY_EMAP_LIBS = @ELEMENTARY_EMAP_LIBS@ +ELEMENTARY_ETHUMB_CFLAGS = @ELEMENTARY_ETHUMB_CFLAGS@ +ELEMENTARY_ETHUMB_LIBS = @ELEMENTARY_ETHUMB_LIBS@ +ELEMENTARY_EWEATHER_CFLAGS = @ELEMENTARY_EWEATHER_CFLAGS@ +ELEMENTARY_EWEATHER_LIBS = @ELEMENTARY_EWEATHER_LIBS@ +ELEMENTARY_FB_CFLAGS = @ELEMENTARY_FB_CFLAGS@ +ELEMENTARY_FB_LIBS = @ELEMENTARY_FB_LIBS@ +ELEMENTARY_LIBS = @ELEMENTARY_LIBS@ +ELEMENTARY_PSL1GHT_CFLAGS = @ELEMENTARY_PSL1GHT_CFLAGS@ +ELEMENTARY_PSL1GHT_LIBS = @ELEMENTARY_PSL1GHT_LIBS@ +ELEMENTARY_SDL_CFLAGS = @ELEMENTARY_SDL_CFLAGS@ +ELEMENTARY_SDL_LIBS = @ELEMENTARY_SDL_LIBS@ +ELEMENTARY_TEST_PRG = @ELEMENTARY_TEST_PRG@ +ELEMENTARY_WEB_CFLAGS = @ELEMENTARY_WEB_CFLAGS@ +ELEMENTARY_WEB_LIBS = @ELEMENTARY_WEB_LIBS@ +ELEMENTARY_WIN32_CFLAGS = @ELEMENTARY_WIN32_CFLAGS@ +ELEMENTARY_WIN32_LIBS = @ELEMENTARY_WIN32_LIBS@ +ELEMENTARY_WINCE_CFLAGS = @ELEMENTARY_WINCE_CFLAGS@ +ELEMENTARY_WINCE_LIBS = @ELEMENTARY_WINCE_LIBS@ +ELEMENTARY_X_CFLAGS = @ELEMENTARY_X_CFLAGS@ +ELEMENTARY_X_LIBS = @ELEMENTARY_X_LIBS@ +ELM_ALLOCA_H_DEF = @ELM_ALLOCA_H_DEF@ +ELM_DEBUG_DEF = @ELM_DEBUG_DEF@ +ELM_DIRENT_H_DEF = @ELM_DIRENT_H_DEF@ +ELM_EDBUS_DEF = @ELM_EDBUS_DEF@ +ELM_EFREET_DEF = @ELM_EFREET_DEF@ +ELM_EMAP_DEF = @ELM_EMAP_DEF@ +ELM_ETHUMB_DEF = @ELM_ETHUMB_DEF@ +ELM_EWEATHER_DEF = @ELM_EWEATHER_DEF@ +ELM_LIBINTL_H_DEF = @ELM_LIBINTL_H_DEF@ +ELM_UNIX_DEF = @ELM_UNIX_DEF@ +ELM_WEB_DEF = @ELM_WEB_DEF@ +ELM_WIN32_DEF = @ELM_WIN32_DEF@ +ELM_WINCE_DEF = @ELM_WINCE_DEF@ +EMOTION_CFLAGS = @EMOTION_CFLAGS@ +EMOTION_LIBS = @EMOTION_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALE_DIR = @LOCALE_DIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MODULE_ARCH = @MODULE_ARCH@ +MODULE_EDJE = @MODULE_EDJE@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +VMIN = @VMIN@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +edje_cc = @edje_cc@ +eet_eet = @eet_eet@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +my_libs = @my_libs@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirement_elm = @requirement_elm@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = -DELM_INTERNAL_API_ARGESFSDFEFC=1 -I. -I$(top_builddir) \ + -I$(top_srcdir) -I$(top_srcdir)/src/lib \ + -I$(top_builddir)/src/lib \ + -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ + -DPACKAGE_LIB_DIR=\"$(libdir)\" @ELEMENTARY_CFLAGS@ \ + @ELEMENTARY_X_CFLAGS@ @ELEMENTARY_FB_CFLAGS@ \ + @ELEMENTARY_WIN32_CFLAGS@ @ELEMENTARY_WINCE_CFLAGS@ \ + @ELEMENTARY_EDBUS_CFLAGS@ @ELEMENTARY_EFREET_CFLAGS@ \ + @ELEMENTARY_ETHUMB_CFLAGS@ @ELEMENTARY_EMAP_CFLAGS@ \ + $(am__append_1) +pkgdir = $(libdir)/edje/modules/elm/$(MODULE_EDJE) +pkg_LTLIBRARIES = module.la +module_la_SOURCES = private.h \ +modules.inc \ +elm.c \ +elm_actionslider.c \ +elm_bubble.c \ +elm_button.c \ +elm_calendar.c \ +elm_check.c \ +elm_clock.c \ +elm_entry.c \ +elm_fileselector.c \ +elm_fileselector_button.c \ +elm_fileselector_entry.c \ +elm_frame.c \ +elm_gengrid.c \ +elm_genlist.c \ +elm_hoversel.c \ +elm_icon.c \ +elm_index.c \ +elm_label.c \ +elm_list.c \ +elm_map.c \ +elm_multibuttonentry.c \ +elm_naviframe.c \ +elm_notify.c \ +elm_panes.c \ +elm_photocam.c \ +elm_progressbar.c \ +elm_radio.c \ +elm_scroller.c \ +elm_segment_control.c \ +elm_slider.c \ +elm_slideshow.c \ +elm_spinner.c \ +elm_thumb.c \ +elm_toolbar.c \ +elm_video.c \ +elm_web.c + +module_la_LIBADD = @ELEMENTARY_LIBS@ $(top_builddir)/src/lib/libelementary.la +module_la_LDFLAGS = -no-undefined -module -avoid-version -shared -fPIC +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/edje_externals/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/edje_externals/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(pkgdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdir)" + @list='$(pkg_LTLIBRARIES)'; test -n "$(pkgdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkgdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkgdir)"; \ + } + +uninstall-pkgLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(pkg_LTLIBRARIES)'; test -n "$(pkgdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$f"; \ + done + +clean-pkgLTLIBRARIES: + -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) + @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +module.la: $(module_la_OBJECTS) $(module_la_DEPENDENCIES) + $(AM_V_CCLD)$(module_la_LINK) -rpath $(pkgdir) $(module_la_OBJECTS) $(module_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_actionslider.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_bubble.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_button.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_calendar.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_check.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_clock.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_entry.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_fileselector.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_fileselector_button.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_fileselector_entry.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_frame.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_gengrid.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_genlist.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_hoversel.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_icon.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_index.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_label.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_list.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_map.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_multibuttonentry.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_naviframe.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_notify.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_panes.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_photocam.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_progressbar.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_radio.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_scroller.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_segment_control.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_slider.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_slideshow.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_spinner.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_thumb.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_toolbar.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_video.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elm_web.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(pkgdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-pkgLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pkgLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-pkgLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-pkgLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-pkgLTLIBRARIES install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-pkgLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/elementary/src/edje_externals/elm.c b/libraries/elementary/src/edje_externals/elm.c new file mode 100644 index 0000000..ced69b8 --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm.c @@ -0,0 +1,319 @@ +#include "Elementary.h" +#include "private.h" + +int _elm_ext_log_dom = -1; + +static int init_count = 0; + +void +external_elm_init(void) +{ + int argc = 0; + char **argv = NULL; + + init_count++; + DBG("elm_real_init\n"); + if (init_count > 1) return; + ecore_app_args_get(&argc, &argv); + elm_init(argc, argv); +} + +static void +external_elm_shutdown(void) +{ + init_count--; + DBG("elm_real_shutdown\n"); + if (init_count > 0) return; + elm_shutdown(); +} + +static void +_external_obj_del(void *data __UNUSED__, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + evas_object_event_callback_del(obj, EVAS_CALLBACK_DEL, + _external_obj_del); + external_elm_shutdown(); +} + +void +external_signal(void *data __UNUSED__, Evas_Object *obj, const char *sig, const char *source) +{ + char *_signal = strdup(sig); + char *p = _signal; + Evas_Object *content; + + while ((*p!='\0') && (*p!=']')) + p++; + + + if ((*p=='\0') || (*(p+1)!=':')) + { + ERR("Invalid External Signal received: '%s' '%s'\n", sig, source); + free(_signal); + return ; + } + + *p = '\0'; + p+=2; //jump ']' and ':' + + Edje_External_Type *type = evas_object_data_get(obj, "Edje_External_Type"); + if (!type->content_get) + { + ERR("external type '%s' from module '%s' does not provide content_get()", + type->module_name, type->module); + free(_signal); + return ; + } + + content = type->content_get(type->data, obj, _signal); + free(_signal); + if (content) + edje_object_signal_emit(content, sig + (p - _signal), source); +} + +const char * +external_translate(void *data __UNUSED__, const char *orig) +{ + // in future, mark all params as translatable and use dgettext() + // with "elementary" text domain here. + return orig; +} + +typedef struct { + const char *emission; + const char *source; + Evas_Object *edje; +} Elm_External_Signals_Proxy_Context; + +static void +_external_signal_proxy_free_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_External_Signals_Proxy_Context *ctxt = data; + free(ctxt); +} + +static void +_external_signal_proxy_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_External_Signals_Proxy_Context *ctxt = data; + // TODO: Is it worth to check Evas_Smart_Cb_Description and do something + // TODO: with event_info given its description? + edje_object_signal_emit(ctxt->edje, ctxt->emission, ctxt->source); +} + +Eina_Bool +external_common_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "style")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_object_style_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "disabled")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_object_disabled_get(obj); + return EINA_TRUE; + } + } + return EINA_FALSE; +} + +Eina_Bool +external_common_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "style")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_object_style_set(obj, param->s); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "disabled")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_object_disabled_set(obj, param->i); + return EINA_TRUE; + } + } + return EINA_FALSE; +} + +void +external_signals_proxy(Evas_Object *obj, Evas_Object *edje, const char *part_name) +{ + const Evas_Smart_Cb_Description **cls_descs, **inst_descs; + unsigned int cls_count, inst_count, total; + Elm_External_Signals_Proxy_Context *ctxt; + + evas_object_smart_callbacks_descriptions_get + (obj, &cls_descs, &cls_count, &inst_descs, &inst_count); + + total = cls_count + inst_count; + if (!total) return; + ctxt = malloc(sizeof(Elm_External_Signals_Proxy_Context) * total); + if (!ctxt) return; + evas_object_event_callback_add + (obj, EVAS_CALLBACK_FREE, _external_signal_proxy_free_cb, ctxt); + + for (; cls_count > 0; cls_count--, cls_descs++, ctxt++) + { + const Evas_Smart_Cb_Description *d = *cls_descs; + ctxt->emission = d->name; + ctxt->source = part_name; + ctxt->edje = edje; + evas_object_smart_callback_add + (obj, d->name, _external_signal_proxy_cb, ctxt); + } + + for (; inst_count > 0; inst_count--, inst_descs++, ctxt++) + { + const Evas_Smart_Cb_Description *d = *inst_descs; + ctxt->emission = d->name; + ctxt->source = part_name; + ctxt->edje = edje; + evas_object_smart_callback_add + (obj, d->name, _external_signal_proxy_cb, ctxt); + } + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, + _external_obj_del, NULL); +} + +void +external_common_params_parse(void *mem, void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params) +{ + Elm_Params *p; + const Eina_List *l; + Edje_External_Param *param; + + p = mem; + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "style")) + p->style = eina_stringshare_add(param->s); + else if (!strcmp(param->name, "disabled")) + { + p->disabled = param->i; + p->disabled_exists = EINA_TRUE; + } + } +} + +void +external_common_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params *p; + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->style) + elm_object_style_set(obj, p->style); + if (p->disabled_exists) + elm_object_disabled_set(obj, p->disabled); +} + +Evas_Object * +external_common_param_icon_get(Evas_Object *obj, const Edje_External_Param *p) +{ + Evas_Object *edje, *parent_widget, *icon; + const char *file; + + if ((!p) || (!p->s) || (p->type != EDJE_EXTERNAL_PARAM_TYPE_STRING)) + return NULL; + + edje = evas_object_smart_parent_get(obj); + edje_object_file_get(edje, &file, NULL); + + parent_widget = elm_widget_parent_widget_get(obj); + if (!parent_widget) + parent_widget = edje; + icon = elm_icon_add(parent_widget); + + if (elm_icon_file_set(icon, file, p->s)) + return icon; + if (elm_icon_standard_set(icon, p->s)) + return icon; + + evas_object_del(icon); + return NULL; +} + +void +external_common_icon_param_parse(Evas_Object **icon, Evas_Object *obj, const Eina_List *params) +{ + Edje_External_Param *p = edje_external_param_find(params, "icon"); + *icon = external_common_param_icon_get(obj, p); +} + +Evas_Object * +external_common_param_edje_object_get(Evas_Object *obj, const Edje_External_Param *p) +{ + Evas_Object *edje, *parent_widget, *ret; + const char *file; + + if ((!p) || (!p->s) || (p->type != EDJE_EXTERNAL_PARAM_TYPE_STRING)) + return NULL; + + edje = evas_object_smart_parent_get(obj); + edje_object_file_get(edje, &file, NULL); + + parent_widget = elm_widget_parent_widget_get(obj); + if (!parent_widget) + parent_widget = edje; + + ret = edje_object_add(evas_object_evas_get(parent_widget)); + + if (edje_object_file_set(ret, file, p->s)) + return ret; + + evas_object_del(ret); + return NULL; +} + +void +external_common_params_free(void *params) +{ + Elm_Params *p = params; + if (p->style) + eina_stringshare_del(p->style); +} + +#define DEFINE_TYPE(type_name) \ + extern const Edje_External_Type external_##type_name##_type; +#include "modules.inc" +#undef DEFINE_TYPE + +static Edje_External_Type_Info elm_external_types[] = +{ +#define DEFINE_TYPE(type_name) \ + {"elm/"#type_name, &external_##type_name##_type}, +#include "modules.inc" +#undef DEFINE_TYPE + {NULL, NULL} +}; + +static Eina_Bool +elm_mod_init(void) +{ + _elm_ext_log_dom = eina_log_domain_register("elm-externals", EINA_COLOR_LIGHTBLUE); + edje_external_type_array_register(elm_external_types); + return EINA_TRUE; +} + +static void +elm_mod_shutdown(void) +{ + edje_external_type_array_unregister(elm_external_types); + if (_elm_ext_log_dom >= 0) eina_log_domain_unregister(_elm_ext_log_dom); + _elm_ext_log_dom = -1; +} + +EINA_MODULE_INIT(elm_mod_init); +EINA_MODULE_SHUTDOWN(elm_mod_shutdown); diff --git a/libraries/elementary/src/edje_externals/elm_actionslider.c b/libraries/elementary/src/edje_externals/elm_actionslider.c new file mode 100644 index 0000000..aeef27e --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_actionslider.c @@ -0,0 +1,99 @@ +#include "private.h" + +typedef struct _Elm_Params_Actionslider +{ + Elm_Params base; + const char *label; +} Elm_Params_Actionslider; + +static void +external_actionslider_state_set(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Actionslider *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->label) + elm_object_text_set(obj, p->label); +} + +static Eina_Bool +external_actionslider_param_set(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Edje_External_Param *param) +{ + if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + && (!strcmp(param->name, "label"))) + { + elm_object_text_set(obj, param->s); + return EINA_TRUE; + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_actionslider_param_get(void *data __UNUSED__, const Evas_Object *obj __UNUSED__, Edje_External_Param *param) +{ + if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + && (!strcmp(param->name, "label"))) + { + param->s = elm_object_text_get(obj); + return EINA_TRUE; + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_actionslider_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params) +{ + Elm_Params_Actionslider *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = ELM_NEW(Elm_Params_Actionslider); + if (!mem) + return NULL; + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "label")) + { + mem->label = eina_stringshare_add(param->s); + break; + } + } + + return mem; +} + +static Evas_Object *external_actionslider_content_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("No content."); + return NULL; +} + +static void +external_actionslider_params_free(void *params) +{ + Elm_Params_Actionslider *mem = params; + if (mem->label) + eina_stringshare_del(mem->label); + free(mem); +} + +static Edje_External_Param_Info external_actionslider_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(actionslider, "actionslider") +DEFINE_EXTERNAL_TYPE_SIMPLE(actionslider, "Actionslider"); diff --git a/libraries/elementary/src/edje_externals/elm_bubble.c b/libraries/elementary/src/edje_externals/elm_bubble.c new file mode 100644 index 0000000..ee43e07 --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_bubble.c @@ -0,0 +1,168 @@ +#include "private.h" + +typedef struct _Elm_Params_Bubble +{ + Elm_Params base; + const char *label; + Evas_Object *icon; + const char *info; + Evas_Object *content; /* part name whose obj is to be set as content */ +} Elm_Params_Bubble; + +static void +external_bubble_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Bubble *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->label) elm_object_text_set(obj, p->label); + if (p->icon) + elm_object_part_content_set(obj, "icon", p->icon); + if (p->info) elm_object_part_text_set(obj, "info", p->info); + if (p->content) elm_object_content_set(obj, p->content); +} + +static Eina_Bool +external_bubble_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "label")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_object_text_set(obj, param->s); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "icon")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + Evas_Object *icon = external_common_param_icon_get(obj, param); + if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE; + elm_object_part_content_set(obj, "icon", icon); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "info")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_object_part_text_set(obj, "info", param->s); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "content")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + Evas_Object *content = \ + external_common_param_edje_object_get(obj, param); + if ((strcmp(param->s, "")) && (!content)) return EINA_FALSE; + elm_object_content_set(obj, content); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_bubble_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "label")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_object_text_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "icon")) + { + /* not easy to get icon name back from live object */ + return EINA_FALSE; + } + else if (!strcmp(param->name, "info")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_object_part_text_get(obj, "info"); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "content")) + { + /* not easy to get content name back from live object */ + return EINA_FALSE; + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_bubble_params_parse(void *data __UNUSED__, Evas_Object *obj, const Eina_List *params) +{ + Elm_Params_Bubble *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = calloc(1, sizeof(Elm_Params_Bubble)); + if (!mem) + return NULL; + + external_common_icon_param_parse(&mem->icon, obj, params); + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "info")) + mem->info = eina_stringshare_add(param->s); + else if (!strcmp(param->name, "content")) + mem->content = external_common_param_edje_object_get(obj, param); + else if (!strcmp(param->name, "label")) + mem->label = eina_stringshare_add(param->s); + } + + return mem; +} + +static Evas_Object *external_bubble_content_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + if (!strcmp(content, "content")) + return elm_object_content_get(obj); + ERR("unknown content '%s'", content); + return NULL; +} + +static void +external_bubble_params_free(void *params) +{ + Elm_Params_Bubble *mem = params; + + if (mem->info) + eina_stringshare_del(mem->info); + if (mem->label) + eina_stringshare_del(mem->label); + free(params); +} + +static Edje_External_Param_Info external_bubble_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_STRING("label"), + EDJE_EXTERNAL_PARAM_INFO_STRING("icon"), + EDJE_EXTERNAL_PARAM_INFO_STRING("info"), + EDJE_EXTERNAL_PARAM_INFO_STRING("content"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(bubble, "bubble"); +DEFINE_EXTERNAL_TYPE_SIMPLE(bubble, "Bubble"); diff --git a/libraries/elementary/src/edje_externals/elm_button.c b/libraries/elementary/src/edje_externals/elm_button.c new file mode 100644 index 0000000..9d056df --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_button.c @@ -0,0 +1,200 @@ +#include "private.h" + +typedef struct _Elm_Params_Button +{ + Elm_Params base; + const char *label; + Evas_Object *icon; + double autorepeat_initial; + double autorepeat_gap; + Eina_Bool autorepeat:1; + Eina_Bool autorepeat_exists:1; + Eina_Bool autorepeat_gap_exists:1; + Eina_Bool autorepeat_initial_exists:1; +} Elm_Params_Button; + +static void +external_button_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Button *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->label) + elm_object_text_set(obj, p->label); + if (p->icon) + elm_object_part_content_set(obj, "icon", p->icon); + if (p->autorepeat_gap_exists) + elm_button_autorepeat_gap_timeout_set(obj, p->autorepeat_gap); + if (p->autorepeat_initial_exists) + elm_button_autorepeat_initial_timeout_set(obj, p->autorepeat_initial); + if (p->autorepeat_exists) + elm_button_autorepeat_set(obj, p->autorepeat); +} + +static Eina_Bool +external_button_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "label")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_object_text_set(obj, param->s); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "icon")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + Evas_Object *icon = external_common_param_icon_get(obj, param); + if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE; + elm_object_part_content_set(obj, "icon", icon); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "autorepeat_initial")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + elm_button_autorepeat_initial_timeout_set(obj, param->d); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "autorepeat_gap")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + elm_button_autorepeat_gap_timeout_set(obj, param->d); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "autorepeat")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_button_autorepeat_set(obj, param->i); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_button_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "label")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_object_text_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "icon")) + { + /* not easy to get icon name back from live object */ + return EINA_FALSE; + } + else if (!strcmp(param->name, "autorepeat_initial")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + param->d = elm_button_autorepeat_initial_timeout_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "autorepeat_gap")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + param->d = elm_button_autorepeat_gap_timeout_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "autorepeat")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_button_autorepeat_get(obj); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_button_params_parse(void *data __UNUSED__, Evas_Object *obj, const Eina_List *params) +{ + Elm_Params_Button *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = ELM_NEW(Elm_Params_Button); + if (!mem) + return NULL; + + external_common_icon_param_parse(&mem->icon, obj, params); + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "autorepeat_initial")) + { + mem->autorepeat_initial = param->d; + mem->autorepeat_initial_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "autorepeat_gap")) + { + mem->autorepeat_gap = param->d; + mem->autorepeat_gap_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "autorepeat")) + { + mem->autorepeat = !!param->i; + mem->autorepeat_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "label")) + mem->label = eina_stringshare_add(param->s); + } + + return mem; +} + +static Evas_Object *external_button_content_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("No content."); + return NULL; +} + +static void +external_button_params_free(void *params) +{ + Elm_Params_Button *mem = params; + if (mem->label) + eina_stringshare_del(mem->label); + free(params); +} + +static Edje_External_Param_Info external_button_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_STRING("label"), + EDJE_EXTERNAL_PARAM_INFO_STRING("icon"), + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("autorepeat_initial"), + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("autorepeat_gap"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("autorepeat"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(button, "button"); +DEFINE_EXTERNAL_TYPE_SIMPLE(button, "Button"); diff --git a/libraries/elementary/src/edje_externals/elm_calendar.c b/libraries/elementary/src/edje_externals/elm_calendar.c new file mode 100644 index 0000000..d3a3ea2 --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_calendar.c @@ -0,0 +1,200 @@ +#include + +#include "private.h" + +typedef struct _Elm_Params_Calendar +{ + Elm_Params base; + int year_min; + int year_max; + const char *select_mode; + +} Elm_Params_Calendar; + +#define SELECT_MODE_GET(CHOICES, STR) \ + unsigned int i; \ + for (i = 0; i < (sizeof(CHOICES) / sizeof(CHOICES[0])); ++i) \ + if (!strcmp(STR, CHOICES[i])) \ + return i; + + +static const char *_calendar_select_modes[] = {"default", "always", "none", + "ondemand", NULL}; + +static Elm_Calendar_Select_Mode +_calendar_select_mode_get(const char *select_mode) +{ + assert(sizeof(_calendar_select_modes) / + sizeof(_calendar_select_modes[0]) + == ELM_CALENDAR_SELECT_MODE_ONDEMAND + 2); + SELECT_MODE_GET(_calendar_select_modes, select_mode); + return -1; +} + +static void +external_calendar_state_set(void *data __UNUSED__, Evas_Object *obj, + const void *from_params, const void *to_params, + float pos __UNUSED__) +{ + const Elm_Params_Calendar *p; + Elm_Calendar_Select_Mode select_mode; + int min,max; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->year_min) + { + elm_calendar_min_max_year_get(obj, NULL, &max); + elm_calendar_min_max_year_set(obj, p->year_min, max); + } + if (p->year_max) + { + elm_calendar_min_max_year_get(obj, &min, NULL); + elm_calendar_min_max_year_set(obj, min, p->year_max); + } + if (p->select_mode) + { + select_mode = _calendar_select_mode_get(p->select_mode); + elm_calendar_select_mode_set(obj, select_mode); + } +} + +static Eina_Bool +external_calendar_param_set(void *data __UNUSED__, Evas_Object *obj, + const Edje_External_Param *param) +{ + int min,max; + + if (!strcmp(param->name, "year_min")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT) + { + elm_calendar_min_max_year_get(obj, NULL, &max); + elm_calendar_min_max_year_set(obj, param->i, max); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "year_max")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT) + { + elm_calendar_min_max_year_get(obj, &min, NULL); + elm_calendar_min_max_year_set(obj, min,param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "select_mode")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + Elm_Calendar_Select_Mode select_mode; + select_mode = _calendar_select_mode_get(param->s); + elm_calendar_select_mode_set(obj, select_mode); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_calendar_param_get(void *data __UNUSED__, const Evas_Object *obj, + Edje_External_Param *param) +{ + int min, max; + + if (!strcmp(param->name, "year_min")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT) + { + elm_calendar_min_max_year_get(obj, &(param->i) ,&max); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "year_max")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT) + { + elm_calendar_min_max_year_get(obj, &min,&(param->i)); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "select_mode")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + Elm_Calendar_Select_Mode mode; + mode = elm_calendar_select_mode_get(obj); + param->s = _calendar_select_modes[mode]; + return EINA_TRUE; + } + } + + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_calendar_params_parse(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + const Eina_List *params) +{ + Elm_Params_Calendar *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = calloc(1, sizeof(Elm_Params_Calendar)); + if (!mem) + return NULL; + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "year_min")) + mem->year_min = param->i; + + else if (!strcmp(param->name, "year_max")) + mem->year_max = param->i; + + else if (!strcmp(param->name, "select_mode")) + mem->select_mode = eina_stringshare_add(param->s); + } + + return mem; +} + +static Evas_Object * +external_calendar_content_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, + const char *content __UNUSED__) +{ + ERR("No content."); + return NULL; +} + +static void +external_calendar_params_free(void *params) +{ + Elm_Params_Calendar *mem = params; + if (mem->select_mode) + eina_stringshare_del(mem->select_mode); + free(params); +} + +static Edje_External_Param_Info external_calendar_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_INT("year_min"), + EDJE_EXTERNAL_PARAM_INFO_INT("year_max"), + EDJE_EXTERNAL_PARAM_INFO_STRING("select_mode"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(calendar, "calendar"); +DEFINE_EXTERNAL_TYPE_SIMPLE(calendar, "Calendar"); diff --git a/libraries/elementary/src/edje_externals/elm_check.c b/libraries/elementary/src/edje_externals/elm_check.c new file mode 100644 index 0000000..287b734 --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_check.c @@ -0,0 +1,148 @@ +#include "private.h" + +typedef struct _Elm_Params_Check +{ + Elm_Params base; + const char *label; + Evas_Object *icon; + Eina_Bool state:1; + Eina_Bool state_exists:1; +} Elm_Params_Check; + +static void +external_check_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Check *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->label) + elm_object_text_set(obj, p->label); + if (p->icon) + elm_object_part_content_set(obj, "icon", p->icon); + if (p->state_exists) + elm_check_state_set(obj, p->state); +} + +static Eina_Bool +external_check_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "label")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_object_text_set(obj, param->s); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "icon")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + Evas_Object *icon = external_common_param_icon_get(obj, param); + if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE; + elm_object_part_content_set(obj, "icon", icon); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "state")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_check_state_set(obj, param->i); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_check_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "label")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_object_text_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "icon")) + { + /* not easy to get icon name back from live object */ + return EINA_FALSE; + } + else if (!strcmp(param->name, "state")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_check_state_get(obj); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_check_params_parse(void *data __UNUSED__, Evas_Object *obj, const Eina_List *params) +{ + Elm_Params_Check *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = calloc(1, sizeof(Elm_Params_Check)); + if (!mem) + return NULL; + + external_common_icon_param_parse(&mem->icon, obj, params); + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "state")) + { + mem->state = !!param->i; + mem->state_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "label")) + mem->label = eina_stringshare_add(param->s); + } + + return mem; +} + +static Evas_Object *external_check_content_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("No content."); + return NULL; +} + +static void +external_check_params_free(void *params) +{ + Elm_Params_Check *mem = params; + if (mem->label) + eina_stringshare_del(mem->label); + free(params); +} + +static Edje_External_Param_Info external_check_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_STRING("label"), + EDJE_EXTERNAL_PARAM_INFO_STRING("icon"), + EDJE_EXTERNAL_PARAM_INFO_BOOL_FULL("state", 0, "unchecked", "checked"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(check, "check") +DEFINE_EXTERNAL_TYPE_SIMPLE(check, "Check") diff --git a/libraries/elementary/src/edje_externals/elm_clock.c b/libraries/elementary/src/edje_externals/elm_clock.c new file mode 100644 index 0000000..c4bf9d2 --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_clock.c @@ -0,0 +1,241 @@ +#include "private.h" + +typedef struct _Elm_Params_Clock +{ + Elm_Params base; + int hrs, min, sec; + Eina_Bool hrs_exists:1; + Eina_Bool min_exists:1; + Eina_Bool sec_exists:1; + Eina_Bool edit:1; + Eina_Bool ampm:1; + Eina_Bool seconds:1; +} Elm_Params_Clock; + +static void +external_clock_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Clock *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if ((p->hrs_exists) && (p->min_exists) && (p->sec_exists)) + elm_clock_time_set(obj, p->hrs, p->min, p->sec); + else if ((p->hrs_exists) || (p->min_exists) || (p->sec_exists)) + { + int hrs, min, sec; + elm_clock_time_get(obj, &hrs, &min, &sec); + if (p->hrs_exists) + hrs = p->hrs; + if (p->min_exists) + min = p->min; + if (p->sec_exists) + sec = p->sec; + elm_clock_time_set(obj, hrs, min, sec); + } + if (p->edit) + elm_clock_edit_set(obj, p->edit); + if (p->ampm) + elm_clock_show_am_pm_set(obj, p->ampm); + if (p->seconds) + elm_clock_show_seconds_set(obj, p->seconds); +} + +static Eina_Bool +external_clock_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "hours")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT) + { + int hrs, min, sec; + elm_clock_time_get(obj, &hrs, &min, &sec); + elm_clock_time_set(obj, param->d, min, sec); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "minutes")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT) + { + int hrs, min, sec; + elm_clock_time_get(obj, &hrs, &min, &sec); + elm_clock_time_set(obj, hrs, param->d, sec); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "seconds")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT) + { + int hrs, min, sec; + elm_clock_time_get(obj, &hrs, &min, &sec); + elm_clock_time_set(obj, hrs, min, param->d); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "editable")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_clock_edit_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "am/pm")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_clock_show_am_pm_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "show seconds")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_clock_show_seconds_set(obj, param->i); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_clock_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "hours")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT) + { + int hrs, min, sec; + elm_clock_time_get(obj, &hrs, &min, &sec); + param->i = hrs; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "minutes")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT) + { + int hrs, min, sec; + elm_clock_time_get(obj, &hrs, &min, &sec); + param->i = min; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "seconds")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT) + { + int hrs, min, sec; + elm_clock_time_get(obj, &hrs, &min, &sec); + param->i = sec; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "editable")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_clock_edit_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "am/pm")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_clock_show_am_pm_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "show seconds")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_clock_show_seconds_get(obj); + return EINA_TRUE; + } + } + + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_clock_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params) +{ + Elm_Params_Clock *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = calloc(1, sizeof(Elm_Params_Clock)); + if (!mem) + return NULL; + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "hours")) + { + mem->hrs = param->i; + mem->hrs_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "minutes")) + { + mem->min = param->i; + mem->min_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "seconds")) + { + mem->sec = param->i; + mem->sec_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "editable")) + mem->edit = !!param->i; + else if (!strcmp(param->name, "am/pm")) + mem->ampm = !!param->i; + else if (!strcmp(param->name, "show seconds")) + mem->seconds = !!param->i; + } + + return mem; +} + +static Evas_Object *external_clock_content_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("No content."); + return NULL; +} + +static void +external_clock_params_free(void *params) +{ + Elm_Params_Clock *mem = params; + + free(mem); +} + +static Edje_External_Param_Info external_clock_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_INT("hours"), + EDJE_EXTERNAL_PARAM_INFO_INT("minutes"), + EDJE_EXTERNAL_PARAM_INFO_INT("seconds"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("editable"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("am/pm"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("show seconds"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(clock, "clock") +DEFINE_EXTERNAL_TYPE_SIMPLE(clock, "Clock") diff --git a/libraries/elementary/src/edje_externals/elm_entry.c b/libraries/elementary/src/edje_externals/elm_entry.c new file mode 100644 index 0000000..910746f --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_entry.c @@ -0,0 +1,376 @@ +#include + +#include "private.h" + +typedef struct _Elm_Params_Entry +{ + Elm_Params base; + const char *label; + const char *entry; + Evas_Object *icon; + Eina_Bool scrollable:1; + Eina_Bool scrollable_exists:1; + Eina_Bool single_line:1; + Eina_Bool single_line_exists:1; + Eina_Bool password:1; + Eina_Bool password_exists:1; + Eina_Bool horizontal_bounce:1; + Eina_Bool horizontal_bounce_exists:1; + Eina_Bool vertical_bounce:1; + Eina_Bool vertical_bounce_exists:1; + Eina_Bool editable:1; + Eina_Bool editable_exists:1; + const char *line_wrap; +} Elm_Params_Entry; + +#define CHOICE_GET(CHOICES, STR) \ + unsigned int i; \ + for (i = 0; i < sizeof(CHOICES)/sizeof (CHOICES)[0]; i++) \ + if (strcmp((STR), (CHOICES)[i]) == 0) \ + return i + + +static const char *entry_line_wrap_choices[] = {"none", "char", "word", + "mixed", NULL}; + +static Elm_Wrap_Type +_entry_line_wrap_choices_setting_get(const char *line_wrap_str) +{ + assert(sizeof(entry_line_wrap_choices)/ + sizeof(entry_line_wrap_choices[0]) == ELM_WRAP_LAST + 1); + CHOICE_GET(entry_line_wrap_choices, line_wrap_str); + return ELM_WRAP_LAST; +} + +static void +external_entry_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Entry *p; + Eina_Bool hbounce, vbounce; + Elm_Wrap_Type line_wrap; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->label) + elm_object_text_set(obj, p->label); + if (p->icon) + elm_object_part_content_set(obj, "icon", p->icon); + if (p->entry) + elm_object_text_set(obj, p->entry); + if (p->scrollable_exists) + elm_entry_scrollable_set(obj, p->scrollable); + if (p->single_line_exists) + elm_entry_single_line_set(obj, p->single_line); + if (p->password_exists) + elm_entry_password_set(obj, p->password); + if (p->horizontal_bounce_exists && p->vertical_bounce_exists) + elm_entry_bounce_set(obj, p->horizontal_bounce, p->vertical_bounce); + else if (p->horizontal_bounce_exists || p->vertical_bounce_exists) + { + elm_entry_bounce_get(obj, &hbounce, &vbounce); + if (p->horizontal_bounce_exists) + elm_entry_bounce_set(obj, p->horizontal_bounce, vbounce); + else + elm_entry_bounce_set(obj, hbounce, p->vertical_bounce); + } + if (p->editable_exists) + elm_entry_editable_set(obj, p->editable); + if (p->line_wrap) + { + line_wrap = _entry_line_wrap_choices_setting_get(p->line_wrap); + elm_entry_line_wrap_set(obj, line_wrap); + } +} + +static Eina_Bool +external_entry_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "label")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_object_text_set(obj, param->s); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "icon")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + Evas_Object *icon = external_common_param_icon_get(obj, param); + elm_object_part_content_set(obj, "icon", icon); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "entry")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_object_text_set(obj, param->s); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "scrollable")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_entry_scrollable_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "single line")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_entry_single_line_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "password")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_entry_password_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "horizontal bounce")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + Eina_Bool hbounce, vbounce; + elm_entry_bounce_get(obj, NULL, &vbounce); + hbounce = !!param->i; + elm_entry_bounce_set(obj, hbounce, vbounce); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "vertical bounce")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + Eina_Bool hbounce, vbounce; + elm_entry_bounce_get(obj, &hbounce, NULL); + vbounce = !!param->i; + elm_entry_bounce_set(obj, hbounce, vbounce); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "editable")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_entry_editable_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "line wrap")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + Elm_Wrap_Type line_wrap; + line_wrap = _entry_line_wrap_choices_setting_get(param->s); + if (line_wrap == ELM_WRAP_LAST) return EINA_FALSE; + elm_entry_line_wrap_set(obj, line_wrap); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_entry_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "label")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_object_text_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "icon")) + { + /* not easy to get icon name back from live object */ + return EINA_FALSE; + } + else if (!strcmp(param->name, "entry")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_object_text_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "scrollable")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_entry_scrollable_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "single line")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_entry_single_line_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "password")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_entry_password_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "horizontal bounce")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + Eina_Bool hbounce; + elm_entry_bounce_get(obj, &hbounce, NULL); + param->i = hbounce; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "vertical bounce")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + Eina_Bool vbounce; + elm_entry_bounce_get(obj, NULL, &vbounce); + param->i = vbounce; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "editable")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_entry_editable_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "line wrap")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + Elm_Wrap_Type line_wrap; + line_wrap = elm_entry_line_wrap_get(obj); + param->s = entry_line_wrap_choices[line_wrap]; + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_entry_params_parse(void *data __UNUSED__, Evas_Object *obj, const Eina_List *params) +{ + Elm_Params_Entry *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = ELM_NEW(Elm_Params_Entry); + if (!mem) + return NULL; + + external_common_icon_param_parse(&mem->icon, obj, params); + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "label")) + { + mem->label = eina_stringshare_add(param->s); + } + else if (!strcmp(param->name, "entry")) + { + mem->entry = eina_stringshare_add(param->s); + } + else if (!strcmp(param->name, "scrollable")) + { + mem->scrollable = !!param->i; + mem->scrollable_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "single line")) + { + mem->single_line = !!param->i; + mem->single_line_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "password")) + { + mem->password = !!param->i; + mem->password_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "horizontal bounce")) + { + mem->horizontal_bounce = !!param->i; + mem->horizontal_bounce_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "vertical bounce")) + { + mem->vertical_bounce = !!param->i; + mem->vertical_bounce_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "editable")) + { + mem->editable = !!param->i; + mem->editable_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "line wrap")) + mem->line_wrap = eina_stringshare_add(param->s); + } + + return mem; +} + +static Evas_Object *external_entry_content_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("No content."); + return NULL; +} + +static void +external_entry_params_free(void *params) +{ + Elm_Params_Entry *mem = params; + if (mem->label) + eina_stringshare_del(mem->label); + if (mem->entry) + eina_stringshare_del(mem->entry); + if (mem->line_wrap) + eina_stringshare_del(mem->line_wrap); + free(params); +} + +static Edje_External_Param_Info external_entry_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_STRING("label"), + EDJE_EXTERNAL_PARAM_INFO_STRING("icon"), + EDJE_EXTERNAL_PARAM_INFO_STRING("entry"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("scrollable"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("single line"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("password"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("horizontal bounce"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("vertical bounce"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("editable"), + EDJE_EXTERNAL_PARAM_INFO_STRING("line_wrap"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(entry, "entry"); +DEFINE_EXTERNAL_TYPE_SIMPLE(entry, "Entry"); diff --git a/libraries/elementary/src/edje_externals/elm_fileselector.c b/libraries/elementary/src/edje_externals/elm_fileselector.c new file mode 100644 index 0000000..246698c --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_fileselector.c @@ -0,0 +1,185 @@ +#include + +#include "private.h" + +typedef struct _Elm_Params_Fileselector +{ + Elm_Params base; + Eina_Bool is_save:1; + Eina_Bool is_save_set:1; + Eina_Bool folder_only:1; + Eina_Bool folder_only_set:1; + Eina_Bool show_buttons:1; + Eina_Bool show_buttons_set:1; + Eina_Bool expandable:1; + Eina_Bool expandable_set:1; +} Elm_Params_Fileselector; + +static void +external_fileselector_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Fileselector *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if ((p->is_save_set) && (p->is_save)) + elm_fileselector_is_save_set(obj, p->is_save); + if (p->folder_only_set) + elm_fileselector_folder_only_set(obj, p->folder_only); + if (p->show_buttons_set) + elm_fileselector_buttons_ok_cancel_set(obj, p->show_buttons); + if (p->expandable_set) + elm_fileselector_expandable_set(obj, p->expandable); +} + +static Eina_Bool +external_fileselector_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "save")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_fileselector_is_save_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "folder only")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_fileselector_folder_only_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "show buttons")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_fileselector_buttons_ok_cancel_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "expandable")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_fileselector_expandable_set(obj, param->i); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_fileselector_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "save")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_fileselector_is_save_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "folder only")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_fileselector_folder_only_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "show buttons")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_fileselector_buttons_ok_cancel_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "expandable")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_fileselector_expandable_get(obj); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_fileselector_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params) +{ + Elm_Params_Fileselector *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = calloc(1, sizeof(Elm_Params_Fileselector)); + if (!mem) + return NULL; + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "save")) + { + mem->is_save = !!param->i; + mem->is_save_set = EINA_TRUE; + } + else if (!strcmp(param->name, "folder only")) + { + mem->folder_only = !!param->i; + mem->folder_only_set = EINA_TRUE; + } + else if (!strcmp(param->name, "show buttons")) + { + mem->show_buttons = !!param->i; + mem->show_buttons_set = EINA_TRUE; + } + else if (!strcmp(param->name, "expandable")) + { + mem->expandable = !!param->i; + mem->expandable_set = EINA_TRUE; + } + } + + return mem; +} + +static Evas_Object *external_fileselector_content_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("No content."); + return NULL; +} + +static void +external_fileselector_params_free(void *params) +{ + Elm_Params_Fileselector *mem = params; + free(mem); +} + +static Edje_External_Param_Info external_fileselector_params[] = + { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_BOOL("save"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("folder only"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("show buttons"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("expandable"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL + }; + +DEFINE_EXTERNAL_ICON_ADD(fileselector, "fileselector") +DEFINE_EXTERNAL_TYPE_SIMPLE(fileselector, "File Selector") + diff --git a/libraries/elementary/src/edje_externals/elm_fileselector_button.c b/libraries/elementary/src/edje_externals/elm_fileselector_button.c new file mode 100644 index 0000000..53aad85 --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_fileselector_button.c @@ -0,0 +1,251 @@ +#include "private.h" + +typedef struct _Elm_Params_fileselector_button +{ + Elm_Params base; + const char *label; + Evas_Object *icon; + + struct { + const char *path; + Eina_Bool is_save:1; + Eina_Bool is_save_set:1; + Eina_Bool folder_only:1; + Eina_Bool folder_only_set:1; + Eina_Bool expandable:1; + Eina_Bool expandable_set:1; + Eina_Bool inwin_mode:1; + Eina_Bool inwin_mode_set:1; + } fs; +} Elm_Params_fileselector_button; + +static void +external_fileselector_button_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_fileselector_button *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->label) + elm_object_text_set(obj, p->label); + if (p->icon) elm_object_part_content_set(obj, "icon", p->icon); + if (p->fs.path) elm_fileselector_button_path_set(obj, p->fs.path); + if (p->fs.is_save_set) + elm_fileselector_button_is_save_set(obj, p->fs.is_save); + if (p->fs.folder_only_set) + elm_fileselector_button_folder_only_set(obj, p->fs.folder_only); + if (p->fs.expandable_set) + elm_fileselector_button_expandable_set(obj, p->fs.expandable); + if (p->fs.inwin_mode_set) + elm_fileselector_button_inwin_mode_set(obj, p->fs.inwin_mode); +} + +static Eina_Bool +external_fileselector_button_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "label")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_object_text_set(obj, param->s); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "icon")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + Evas_Object *icon = external_common_param_icon_get(obj, param); + if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE; + elm_object_part_content_set(obj, "icon", icon); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "path")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_fileselector_button_path_set(obj, param->s); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "save")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_fileselector_button_is_save_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "folder only")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_fileselector_button_folder_only_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "expandable")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_fileselector_button_expandable_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "inwin mode")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_fileselector_button_inwin_mode_set(obj, param->i); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_fileselector_button_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "label")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_object_text_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "icon")) + { + /* not easy to get icon name back from live object */ + return EINA_FALSE; + } + else if (!strcmp(param->name, "path")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_fileselector_button_path_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "save")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_fileselector_button_is_save_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "folder only")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_fileselector_button_folder_only_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "expandable")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_fileselector_button_expandable_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "inwin mode")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_fileselector_button_inwin_mode_get(obj); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_fileselector_button_params_parse(void *data __UNUSED__, Evas_Object *obj, const Eina_List *params) +{ + Elm_Params_fileselector_button *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = calloc(1, sizeof(Elm_Params_fileselector_button)); + if (!mem) + return NULL; + + external_common_icon_param_parse(&mem->icon, obj, params); + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "path")) + mem->fs.path = eina_stringshare_add(param->s); + else if (!strcmp(param->name, "save")) + { + mem->fs.is_save = !!param->i; + mem->fs.is_save_set = EINA_TRUE; + } + else if (!strcmp(param->name, "folder only")) + { + mem->fs.folder_only = !!param->i; + mem->fs.folder_only_set = EINA_TRUE; + } + else if (!strcmp(param->name, "expandable")) + { + mem->fs.expandable = !!param->i; + mem->fs.expandable_set = EINA_TRUE; + } + else if (!strcmp(param->name, "inwin mode")) + { + mem->fs.inwin_mode = !!param->i; + mem->fs.inwin_mode_set = EINA_TRUE; + } + else if (!strcmp(param->name, "label")) + mem->label = eina_stringshare_add(param->s); + } + + return mem; +} + +static Evas_Object *external_fileselector_button_content_get(void *data __UNUSED__, const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("No content."); + return NULL; +} + + static void +external_fileselector_button_params_free(void *params) +{ + Elm_Params_fileselector_button *mem = params; + + if (mem->fs.path) + eina_stringshare_del(mem->fs.path); + if (mem->label) + eina_stringshare_del(mem->label); + free(params); +} + +static Edje_External_Param_Info external_fileselector_button_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_STRING("label"), + EDJE_EXTERNAL_PARAM_INFO_STRING("icon"), + EDJE_EXTERNAL_PARAM_INFO_STRING("path"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("save"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("folder only"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("expandable"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("inwin mode"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(fileselector_button, "fileselector_button"); +DEFINE_EXTERNAL_TYPE_SIMPLE(fileselector_button, "File Selector Button"); diff --git a/libraries/elementary/src/edje_externals/elm_fileselector_entry.c b/libraries/elementary/src/edje_externals/elm_fileselector_entry.c new file mode 100644 index 0000000..11bd1fe --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_fileselector_entry.c @@ -0,0 +1,252 @@ +#include "private.h" + +typedef struct _Elm_Params_fileselector_entry +{ + Elm_Params base; + const char *label; + Evas_Object *icon; + + struct { + const char *path; + Eina_Bool is_save:1; + Eina_Bool is_save_set:1; + Eina_Bool folder_only:1; + Eina_Bool folder_only_set:1; + Eina_Bool expandable:1; + Eina_Bool expandable_set:1; + Eina_Bool inwin_mode:1; + Eina_Bool inwin_mode_set:1; + } fs; +} Elm_Params_fileselector_entry; + +static void +external_fileselector_entry_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_fileselector_entry *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->label) + elm_object_text_set(obj, p->label); + if (p->icon) elm_object_part_content_set(obj, "button icon", p->icon); + if (p->fs.path) elm_fileselector_entry_selected_set(obj, p->fs.path); + if (p->fs.is_save_set) + elm_fileselector_entry_is_save_set(obj, p->fs.is_save); + if (p->fs.folder_only_set) + elm_fileselector_entry_folder_only_set(obj, p->fs.folder_only); + if (p->fs.expandable_set) + elm_fileselector_entry_expandable_set(obj, p->fs.expandable); + if (p->fs.inwin_mode_set) + elm_fileselector_entry_inwin_mode_set(obj, p->fs.inwin_mode); +} + +static Eina_Bool +external_fileselector_entry_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "label")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_object_text_set(obj, param->s); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "icon")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + Evas_Object *icon = external_common_param_icon_get(obj, param); + if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE; + elm_object_part_content_set(obj, "button icon", icon); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "path")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_fileselector_entry_selected_set(obj, param->s); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "save")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_fileselector_entry_is_save_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "folder only")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_fileselector_entry_folder_only_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "expandable")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_fileselector_entry_expandable_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "inwin mode")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_fileselector_entry_inwin_mode_set(obj, param->i); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_fileselector_entry_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "label")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_object_text_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "icon")) + { + /* not easy to get icon name back from live object */ + return EINA_FALSE; + } + else if (!strcmp(param->name, "path")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_fileselector_entry_selected_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "save")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_fileselector_entry_is_save_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "folder only")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_fileselector_entry_folder_only_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "expandable")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_fileselector_entry_expandable_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "inwin mode")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_fileselector_entry_inwin_mode_get(obj); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_fileselector_entry_params_parse(void *data __UNUSED__, Evas_Object *obj, const Eina_List *params) +{ + Elm_Params_fileselector_entry *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = calloc(1, sizeof(Elm_Params_fileselector_entry)); + if (!mem) + return NULL; + + external_common_icon_param_parse(&mem->icon, obj, params); + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "path")) + mem->fs.path = eina_stringshare_add(param->s); + else if (!strcmp(param->name, "save")) + { + mem->fs.is_save = !!param->i; + mem->fs.is_save_set = EINA_TRUE; + } + else if (!strcmp(param->name, "folder only")) + { + mem->fs.folder_only = !!param->i; + mem->fs.folder_only_set = EINA_TRUE; + } + else if (!strcmp(param->name, "expandable")) + { + mem->fs.expandable = !!param->i; + mem->fs.expandable_set = EINA_TRUE; + } + else if (!strcmp(param->name, "inwin mode")) + { + mem->fs.inwin_mode = !!param->i; + mem->fs.inwin_mode_set = EINA_TRUE; + } + else if (!strcmp(param->name, "label")) + mem->label = eina_stringshare_add(param->s); + } + + return mem; +} + +static Evas_Object *external_fileselector_entry_content_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("No content."); + return NULL; +} + +static void +external_fileselector_entry_params_free(void *params) +{ + Elm_Params_fileselector_entry *mem = params; + + if (mem->fs.path) + eina_stringshare_del(mem->fs.path); + if (mem->label) + eina_stringshare_del(mem->label); + free(params); +} + +static Edje_External_Param_Info external_fileselector_entry_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_STRING("label"), + EDJE_EXTERNAL_PARAM_INFO_STRING("icon"), + EDJE_EXTERNAL_PARAM_INFO_STRING("path"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("save"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("folder only"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("expandable"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("inwin mode"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(fileselector_entry, "fileselector_entry"); +DEFINE_EXTERNAL_TYPE_SIMPLE(fileselector_entry, "File Selector Entry"); diff --git a/libraries/elementary/src/edje_externals/elm_frame.c b/libraries/elementary/src/edje_externals/elm_frame.c new file mode 100644 index 0000000..22a4b34 --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_frame.c @@ -0,0 +1,125 @@ +#include "private.h" + +typedef struct _Elm_Params_Frame +{ + Elm_Params base; + const char *label; + Evas_Object *content; /* part name whose obj is to be set as content */ +} Elm_Params_Frame; + +static void +external_frame_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Frame *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->label) elm_object_text_set(obj, p->label); + if (p->content) elm_object_content_set(obj, p->content); +} + +static Eina_Bool +external_frame_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "label")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_object_text_set(obj, param->s); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "content")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + Evas_Object *content = + external_common_param_edje_object_get(obj,param); + if ((strcmp(param->s, "")) && (!content)) return EINA_FALSE; + elm_object_content_set(obj, content); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_frame_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "label")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_object_text_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "content")) + { + /* not easy to get content name back from live object */ + return EINA_FALSE; + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_frame_params_parse(void *data __UNUSED__, Evas_Object *obj, const Eina_List *params) +{ + Elm_Params_Frame *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = calloc(1, sizeof(Elm_Params_Frame)); + if (!mem) + return NULL; + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "content")) + mem->content = external_common_param_edje_object_get(obj, param); + else if (!strcmp(param->name, "label")) + mem->label = eina_stringshare_add(param->s); + } + + return mem; +} + +static Evas_Object *external_frame_content_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + if (!strcmp(content, "content")) + return elm_object_content_get(obj); + + ERR("unknown content '%s'", content); + return NULL; +} + +static void +external_frame_params_free(void *params) +{ + Elm_Params_Frame *mem = params; + + if (mem->label) + eina_stringshare_del(mem->label); + free(params); +} + +static Edje_External_Param_Info external_frame_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_STRING("label"), + EDJE_EXTERNAL_PARAM_INFO_STRING("content"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(frame, "frame"); +DEFINE_EXTERNAL_TYPE_SIMPLE(frame, "Frame"); diff --git a/libraries/elementary/src/edje_externals/elm_gengrid.c b/libraries/elementary/src/edje_externals/elm_gengrid.c new file mode 100644 index 0000000..9319d5e --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_gengrid.c @@ -0,0 +1,468 @@ +#include + +#include "private.h" + +typedef struct _Elm_Params_Gengrid +{ + Elm_Params base; + Eina_Bool multi : 1; + Eina_Bool multi_exists : 1; + Eina_Bool no_select : 1; + Eina_Bool no_select_exists : 1; + Eina_Bool always_select : 1; + Eina_Bool always_select_exists : 1; + Eina_Bool h_bounce:1; + Eina_Bool h_bounce_exists:1; + Eina_Bool v_bounce:1; + Eina_Bool v_bounce_exists:1; + double h_pagerel; + Eina_Bool h_pagerel_exists : 1; + double v_pagerel; + Eina_Bool v_pagerel_exists : 1; + int h_itemsize; + Eina_Bool h_itemsize_exists : 1; + int v_itemsize; + Eina_Bool v_itemsize_exists : 1; + Eina_Bool horizontal : 1; + Eina_Bool horizontal_exists : 1; + Eina_Bool align_x_exists; + double align_x; + Eina_Bool align_y_exists; + double align_y; +} Elm_Params_Gengrid; + +static void +external_gengrid_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Gengrid *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->multi_exists) + elm_gengrid_multi_select_set(obj, p->multi); + if (p->no_select_exists) + { + if (p->no_select) + elm_gengrid_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_NONE); + else + elm_gengrid_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_DEFAULT); + } + if (p->always_select_exists) + { + if (p->always_select) + elm_gengrid_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_ALWAYS); + else + elm_gengrid_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_DEFAULT); + } + if (p->h_bounce_exists) + { + Eina_Bool h_bounce, v_bounce; + elm_gengrid_bounce_get(obj, &h_bounce, &v_bounce); + elm_gengrid_bounce_set(obj, p->h_bounce, v_bounce); + } + if (p->v_bounce_exists) + { + Eina_Bool h_bounce, v_bounce; + elm_gengrid_bounce_get(obj, &h_bounce, &v_bounce); + elm_gengrid_bounce_set(obj, h_bounce, p->v_bounce); + } + if (p->h_pagerel_exists) + { + double h_pagerel, v_pagerel; + elm_gengrid_page_relative_get(obj, &h_pagerel, &v_pagerel); + elm_gengrid_page_relative_set(obj, h_pagerel, p->v_pagerel); + } + if (p->v_pagerel_exists) + { + double h_pagerel, v_pagerel; + elm_gengrid_page_relative_get(obj, &h_pagerel, &v_pagerel); + elm_gengrid_page_relative_set(obj, p->h_pagerel, v_pagerel); + } + if (p->h_itemsize_exists) + { + int h_itemsize, v_itemsize; + elm_gengrid_item_size_get(obj, &h_itemsize, &v_itemsize); + elm_gengrid_item_size_set(obj, h_itemsize, p->v_itemsize); + } + if (p->v_itemsize_exists) + { + int h_itemsize, v_itemsize; + elm_gengrid_item_size_get(obj, &h_itemsize, &v_itemsize); + elm_gengrid_item_size_set(obj, p->h_itemsize, v_itemsize); + } + else if (p->align_x_exists || p->align_y_exists) + { + double x, y; + elm_gengrid_align_get(obj, &x, &y); + if (p->align_x_exists) + elm_gengrid_align_set(obj, p->align_x, y); + else + elm_gengrid_align_set(obj, x, p->align_y); + } + if (p->horizontal_exists) + { + elm_gengrid_horizontal_set(obj, p->horizontal); + } +} + +static Eina_Bool +external_gengrid_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "multi select")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_gengrid_multi_select_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "no selected")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + if (param->i) + elm_gengrid_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_NONE); + else + elm_gengrid_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_DEFAULT); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "always select")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + if (param->i) + elm_gengrid_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_ALWAYS); + else + elm_gengrid_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_DEFAULT); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "height bounce")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + Eina_Bool h_bounce, v_bounce; + elm_gengrid_bounce_get(obj, &h_bounce, &v_bounce); + elm_gengrid_bounce_set(obj, param->i, v_bounce); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "width bounce")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + Eina_Bool h_bounce, v_bounce; + elm_gengrid_bounce_get(obj, &h_bounce, &v_bounce); + elm_gengrid_bounce_set(obj, h_bounce, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "horizontal page relative")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + double h_pagerel, v_pagerel; + elm_gengrid_page_relative_get(obj, &h_pagerel, &v_pagerel); + elm_gengrid_page_relative_set(obj, param->d, v_pagerel); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "vertical page relative")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + double h_pagerel, v_pagerel; + elm_gengrid_page_relative_get(obj, &h_pagerel, &v_pagerel); + elm_gengrid_page_relative_set(obj, h_pagerel, param->d); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "horizontal item size")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT) + { + int h_itemsize, v_itemsize; + elm_gengrid_item_size_get(obj, &h_itemsize, &v_itemsize); + elm_gengrid_item_size_set(obj, param->i, v_itemsize); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "vertical item size")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT) + { + int h_itemsize, v_itemsize; + elm_gengrid_item_size_get(obj, &h_itemsize, &v_itemsize); + elm_gengrid_item_size_set(obj, h_itemsize, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "horizontal")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_gengrid_horizontal_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "align x") + && param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + double x, y; + elm_gengrid_align_get(obj, &x, &y); + elm_gengrid_align_set(obj, param->d, y); + return EINA_TRUE; + } + else if (!strcmp(param->name, "align y") + && param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + double x, y; + elm_gengrid_align_get(obj, &x, &y); + elm_gengrid_align_set(obj, x, param->d); + return EINA_TRUE; + } + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_gengrid_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "multi select")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_gengrid_multi_select_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "no selected")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + if (elm_gengrid_select_mode_get (obj) == + ELM_OBJECT_SELECT_MODE_NONE) + param->i = EINA_TRUE; + else + param->i = EINA_FALSE; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "always select")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + if (elm_gengrid_select_mode_get (obj) == + ELM_OBJECT_SELECT_MODE_ALWAYS) + param->i = EINA_TRUE; + else + param->i = EINA_FALSE; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "height bounce")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + Eina_Bool h_bounce, v_bounce; + elm_gengrid_bounce_get(obj, &h_bounce, &v_bounce); + param->i = h_bounce; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "width bounce")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + Eina_Bool h_bounce, v_bounce; + elm_gengrid_bounce_get(obj, &h_bounce, &v_bounce); + param->i = v_bounce; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "horizontal page relative")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + double h_pagerel, v_pagerel; + elm_gengrid_page_relative_get(obj, &h_pagerel, &v_pagerel); + param->d = h_pagerel; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "vertical page relative")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + double h_pagerel, v_pagerel; + elm_gengrid_page_relative_get(obj, &h_pagerel, &v_pagerel); + param->d = v_pagerel; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "horizontal item size")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT) + { + int h_itemsize, v_itemsize; + elm_gengrid_item_size_get(obj, &h_itemsize, &v_itemsize); + param->i = h_itemsize; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "vertical item size")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT) + { + int h_itemsize, v_itemsize; + elm_gengrid_item_size_get(obj, &h_itemsize, &v_itemsize); + param->i = v_itemsize; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "horizontal")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_gengrid_horizontal_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "align x") + && param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + double x, y; + elm_gengrid_align_get(obj, &x, &y); + param->d = x; + return EINA_TRUE; + } + else if (!strcmp(param->name, "align y") + && param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + double x, y; + elm_gengrid_align_get(obj, &x, &y); + param->d = y; + return EINA_TRUE; + } + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_gengrid_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params) +{ + Elm_Params_Gengrid *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = ELM_NEW(Elm_Params_Gengrid); + if (!mem) + return NULL; + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "multi select")) + { + mem->multi = !!param->i; + mem->multi_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "no selected")) + { + mem->no_select = !!param->i; + mem->no_select_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "always select")) + { + mem->always_select = !!param->i; + mem->always_select_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "height bounce")) + { + mem->h_bounce = !!param->i; + mem->h_bounce_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "width bounce")) + { + mem->v_bounce = !!param->i; + mem->v_bounce_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "horizontal page relative")) + { + mem->h_pagerel = param->d; + mem->h_pagerel_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "vertical page relative")) + { + mem->v_pagerel = param->d; + mem->v_pagerel_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "horizontal item size")) + { + mem->h_itemsize = param->i; + mem->h_itemsize_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "vertical item size")) + { + mem->v_itemsize = param->i; + mem->v_itemsize_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "horizontal")) + { + mem->horizontal = !!param->i; + mem->horizontal_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "align x")) + { + mem->align_x = param->d; + mem->align_x_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "align y")) + { + mem->align_y = param->d; + mem->align_y_exists = EINA_TRUE; + } + } + + return mem; +} + +static Evas_Object * +external_gengrid_content_get(void *data __UNUSED__, const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("No content."); + return NULL; +} + +static void +external_gengrid_params_free(void *params) +{ + Elm_Params_Gengrid *mem = params; + free(mem); +} + +static Edje_External_Param_Info external_gengrid_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_BOOL("multi select"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("no select"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("always select"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("height bounce"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("width bounce"), + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("horizontal page relative"), + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("vertical page relative"), + EDJE_EXTERNAL_PARAM_INFO_INT("horizontal item size"), + EDJE_EXTERNAL_PARAM_INFO_INT("vertical item size"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("horizontal"), + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("align x"), + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("align y"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(gengrid, "gengrid"); +DEFINE_EXTERNAL_TYPE_SIMPLE(gengrid, "Generic Grid"); diff --git a/libraries/elementary/src/edje_externals/elm_genlist.c b/libraries/elementary/src/edje_externals/elm_genlist.c new file mode 100644 index 0000000..2ef2b96 --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_genlist.c @@ -0,0 +1,332 @@ +#include + +#include "private.h" + +typedef struct _Elm_Params_Genlist +{ + Elm_Params base; + const char *horizontal; + Eina_Bool multi:1; + Eina_Bool multi_exists:1; + Eina_Bool always_select:1; + Eina_Bool always_select_exists:1; + Eina_Bool no_select:1; + Eina_Bool no_select_exists:1; + Eina_Bool compress_exists:1; + Eina_Bool homogeneous:1; + Eina_Bool homogeneous_exists:1; + Eina_Bool h_bounce:1; + Eina_Bool h_bounce_exists:1; + Eina_Bool v_bounce:1; + Eina_Bool v_bounce_exists:1; +} Elm_Params_Genlist; + +static const char* list_horizontal_choices[] = {"compress", "scroll", "limit", "expand", NULL}; + +static Elm_List_Mode +_list_horizontal_setting_get(const char *horizontal_str) +{ + unsigned int i; + + assert(sizeof(list_horizontal_choices)/sizeof(list_horizontal_choices[0]) == ELM_LIST_LAST + 1); + + for (i = 0; i < ELM_LIST_LAST; i++) + { + if (!strcmp(horizontal_str, list_horizontal_choices[i])) + return i; + } + return ELM_LIST_LAST; +} + +static void +external_genlist_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Genlist *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->horizontal) + { + Elm_List_Mode set = _list_horizontal_setting_get(p->horizontal); + + if (set != ELM_LIST_LAST) + elm_genlist_mode_set(obj, set); + } + if (p->multi_exists) + elm_genlist_multi_select_set(obj, p->multi); + if (p->no_select_exists) + { + if (p->no_select) + elm_genlist_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_NONE); + else + elm_genlist_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_DEFAULT); + } + if (p->always_select_exists) + { + if (p->always_select) + elm_genlist_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_ALWAYS); + else + elm_genlist_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_DEFAULT); + } + if (p->homogeneous_exists) + elm_genlist_homogeneous_set(obj, p->homogeneous); + if ((p->h_bounce_exists) && (p->v_bounce_exists)) + elm_genlist_bounce_set(obj, p->h_bounce, p->v_bounce); + else if ((p->h_bounce_exists) || (p->v_bounce_exists)) + { + Eina_Bool h_bounce, v_bounce; + + elm_genlist_bounce_get(obj, &h_bounce, &v_bounce); + if (p->h_bounce_exists) + elm_genlist_bounce_set(obj, p->h_bounce, v_bounce); + else + elm_genlist_bounce_set(obj, h_bounce, p->v_bounce); + } +} + +static Eina_Bool +external_genlist_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "horizontal mode")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE) + { + Elm_List_Mode set = _list_horizontal_setting_get(param->s); + + if (set == ELM_LIST_LAST) return EINA_FALSE; + elm_genlist_mode_set(obj, set); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "multi select")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_genlist_multi_select_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "always select")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + if (param->i) + elm_genlist_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_ALWAYS); + else + elm_genlist_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_DEFAULT); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "no select")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + if (param->i) + elm_genlist_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_NONE); + else + elm_genlist_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_DEFAULT); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "homogeneous")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_genlist_homogeneous_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "height bounce")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + Eina_Bool h_bounce, v_bounce; + elm_genlist_bounce_get(obj, &h_bounce, &v_bounce); + elm_genlist_bounce_set(obj, param->i, v_bounce); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "width bounce")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + Eina_Bool h_bounce, v_bounce; + elm_genlist_bounce_get(obj, &h_bounce, &v_bounce); + elm_genlist_bounce_set(obj, h_bounce, param->i); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_genlist_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "horizontal mode")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE) + { + Elm_List_Mode list_horizontal_set = elm_genlist_mode_get(obj); + + if (list_horizontal_set == ELM_LIST_LAST) + return EINA_FALSE; + + param->s = list_horizontal_choices[list_horizontal_set]; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "multi select")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_genlist_multi_select_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "always select")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + if (elm_genlist_select_mode_get (obj) == + ELM_OBJECT_SELECT_MODE_ALWAYS) + param->i = EINA_TRUE; + else + param->i = EINA_FALSE; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "no select")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + if (elm_genlist_select_mode_get (obj) == + ELM_OBJECT_SELECT_MODE_NONE) + param->i = EINA_TRUE; + else + param->i = EINA_FALSE; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "homogeneous")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_genlist_homogeneous_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "height bounce")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + Eina_Bool h_bounce, v_bounce; + elm_genlist_bounce_get(obj, &h_bounce, &v_bounce); + param->i = h_bounce; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "width bounce")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + Eina_Bool h_bounce, v_bounce; + elm_genlist_bounce_get(obj, &h_bounce, &v_bounce); + param->i = v_bounce; + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_genlist_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params) +{ + Elm_Params_Genlist *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = ELM_NEW(Elm_Params_Genlist); + if (!mem) + return NULL; + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "horizontal mode")) + mem->horizontal = eina_stringshare_add(param->s); + else if (!strcmp(param->name, "multi select")) + { + mem->multi = !!param->i; + mem->multi_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "always select")) + { + mem->always_select = !!param->i; + mem->always_select_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "no select")) + { + mem->no_select = !!param->i; + mem->no_select_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "homogeneous")) + { + mem->homogeneous = !!param->i; + mem->homogeneous_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "height bounce")) + { + mem->h_bounce = !!param->i; + mem->h_bounce_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "width bounce")) + { + mem->v_bounce = !!param->i; + mem->v_bounce_exists = EINA_TRUE; + } + } + + return mem; +} + +static Evas_Object *external_genlist_content_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("No content."); + return NULL; +} + +static void +external_genlist_params_free(void *params) +{ + Elm_Params_Genlist *mem = params; + + if (mem->horizontal) + eina_stringshare_del(mem->horizontal); + + free(mem); +} + +static Edje_External_Param_Info external_genlist_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("horizontal mode", "scroll", list_horizontal_choices), + EDJE_EXTERNAL_PARAM_INFO_BOOL("multi select"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("always select"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("no select"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("homogeneous"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("height bounce"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("width bounce"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(genlist, "genlist"); +DEFINE_EXTERNAL_TYPE_SIMPLE(genlist, "Generic List"); diff --git a/libraries/elementary/src/edje_externals/elm_hoversel.c b/libraries/elementary/src/edje_externals/elm_hoversel.c new file mode 100644 index 0000000..d345316 --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_hoversel.c @@ -0,0 +1,148 @@ +#include "private.h" + +typedef struct _Elm_Params_Hoversel +{ + Elm_Params base; + const char *label; + Evas_Object *icon; + Eina_Bool horizontal:1; + Eina_Bool horizontal_exists:1; +} Elm_Params_Hoversel; + +static void +external_hoversel_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Hoversel *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->label) + elm_object_text_set(obj, p->label); + if (p->icon) + elm_object_part_content_set(obj, "icon", p->icon); + if (p->horizontal_exists) + elm_hoversel_horizontal_set(obj, p->horizontal); +} + +static Eina_Bool +external_hoversel_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "label")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_object_text_set(obj, param->s); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "icon")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + Evas_Object *icon = external_common_param_icon_get(obj, param); + if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE; + elm_object_part_content_set(obj, "icon", icon); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "horizontal")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_hoversel_horizontal_set(obj, param->i); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_hoversel_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "label")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_object_text_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "icon")) + { + /* not easy to get icon name back from live object */ + return EINA_FALSE; + } + else if (!strcmp(param->name, "horizontal")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_hoversel_horizontal_get(obj); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_hoversel_params_parse(void *data __UNUSED__, Evas_Object *obj, const Eina_List *params) +{ + Elm_Params_Hoversel *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = calloc(1, sizeof(Elm_Params_Hoversel)); + if (!mem) + return NULL; + + external_common_icon_param_parse(&mem->icon, obj, params); + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "horizontal")) + { + mem->horizontal = !!param->i; + mem->horizontal_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "label")) + mem->label = eina_stringshare_add(param->s); + } + + return mem; +} + +static Evas_Object *external_hoversel_content_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("No content."); + return NULL; +} + + static void +external_hoversel_params_free(void *params) +{ + Elm_Params_Hoversel *mem = params; + if (mem->label) + eina_stringshare_del(mem->label); + free(params); +} + +static Edje_External_Param_Info external_hoversel_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_STRING("label"), + EDJE_EXTERNAL_PARAM_INFO_STRING("icon"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("horizontal"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(hoversel, "hoversel"); +DEFINE_EXTERNAL_TYPE_SIMPLE(hoversel, "Hoversel"); diff --git a/libraries/elementary/src/edje_externals/elm_icon.c b/libraries/elementary/src/edje_externals/elm_icon.c new file mode 100644 index 0000000..fbd1c5f --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_icon.c @@ -0,0 +1,322 @@ +#include +#include "private.h" + +typedef struct _Elm_Params_Icon +{ + const char *file; + Eina_Bool scale_up_exists; + Eina_Bool scale_up : 1; + Eina_Bool scale_down_exists; + Eina_Bool scale_down : 1; + Eina_Bool smooth_exists; + Eina_Bool smooth : 1; + Eina_Bool fill_outside_exists; + Eina_Bool fill_outside : 1; + Eina_Bool no_scale_exists; + Eina_Bool no_scale : 1; + Eina_Bool prescale_size_exists; + int prescale_size; + Elm_Params base; + const char *icon; +} Elm_Params_Icon; + +static Elm_Params_Icon *param_icon; + +static void +external_icon_state_set(void *data __UNUSED__, Evas_Object *obj, + const void *from_params, const void *to_params, + float pos __UNUSED__) +{ + const Elm_Params_Icon *p; + Evas_Object *edje; + const char *file; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->file) + { + elm_icon_file_set(obj, p->file, NULL); + param_icon->file = p->file; + } + if (p->smooth_exists) + { + elm_icon_smooth_set(obj, p->smooth); + param_icon->smooth = p->smooth; + } + if (p->no_scale_exists) + { + elm_icon_no_scale_set(obj, p->no_scale); + param_icon->no_scale = p->no_scale; + } + if (p->scale_up_exists && p->scale_down_exists) + { + elm_icon_resizable_set(obj, p->scale_up, p->scale_down); + param_icon->scale_up = p->scale_up; + param_icon->scale_down = p->scale_down; + } + else if (p->scale_up_exists || p->scale_down_exists) + { + if (p->scale_up_exists) + { + elm_icon_resizable_set(obj, p->scale_up, param_icon->scale_down); + param_icon->scale_up = p->scale_up; + } + else + { + elm_icon_resizable_set(obj, param_icon->scale_up, p->scale_down); + param_icon->scale_down = p->scale_down; + } + } + if (p->fill_outside_exists) + { + elm_icon_fill_outside_set(obj, p->fill_outside); + param_icon->fill_outside = p->fill_outside; + } + if (p->prescale_size_exists) + { + elm_icon_prescale_set(obj, p->prescale_size); + param_icon->prescale_size = p->prescale_size; + } + if (p->icon) + { + edje = evas_object_smart_parent_get(obj); + edje_object_file_get(edje, &file, NULL); + + if (!elm_icon_file_set(obj, file, p->icon)) + elm_icon_standard_set(obj, p->icon); + } +} + +static Eina_Bool +external_icon_param_set(void *data __UNUSED__, Evas_Object *obj, + const Edje_External_Param *param) +{ + Evas_Object *edje; + const char *file; + + if (!strcmp(param->name, "file") + && param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + Eina_Bool ret = elm_icon_file_set(obj, param->s, NULL); + if (ret) + param_icon->file = param->s; + return ret; + } + else if (!strcmp(param->name, "smooth") + && param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_icon_smooth_set(obj, param->i); + param_icon->smooth = param->i; + return EINA_TRUE; + } + else if (!strcmp(param->name, "no scale") + && param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_icon_no_scale_set(obj, param->i); + param_icon->no_scale = param->i; + return EINA_TRUE; + } + else if (!strcmp(param->name, "scale up") + && param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_icon_resizable_set(obj, param->i, param_icon->scale_down); + param_icon->scale_up = param->i; + return EINA_TRUE; + } + else if (!strcmp(param->name, "scale down") + && param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_icon_resizable_set(obj, param_icon->scale_up, param->i); + param_icon->scale_down = param->i; + return EINA_TRUE; + } + else if (!strcmp(param->name, "fill outside") + && param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_icon_fill_outside_set(obj, param->i); + param_icon->fill_outside = param->i; + return EINA_TRUE; + } + else if (!strcmp(param->name, "prescale") + && param->type == EDJE_EXTERNAL_PARAM_TYPE_INT) + { + elm_icon_prescale_set(obj, param->i); + param_icon->prescale_size = param->i; + return EINA_TRUE; + } + else if (!strcmp(param->name, "icon")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + edje = evas_object_smart_parent_get(obj); + edje_object_file_get(edje, &file, NULL); + + if (!elm_icon_file_set(obj, file, param->s)) + elm_icon_standard_set(obj, param->s); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_icon_param_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, + Edje_External_Param *param) +{ + if (!strcmp(param->name, "file") + && param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = param_icon->file; + return EINA_TRUE; + } + else if (!strcmp(param->name, "smooth") + && param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = param_icon->smooth; + return EINA_TRUE; + } + else if (!strcmp(param->name, "no scale") + && param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = param_icon->no_scale; + return EINA_TRUE; + } + else if (!strcmp(param->name, "scale up") + && param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = param_icon->scale_up; + return EINA_TRUE; + } + else if (!strcmp(param->name, "scale down") + && param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = param_icon->scale_down; + return EINA_TRUE; + } + else if (!strcmp(param->name, "fill outside") + && param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = param_icon->fill_outside; + return EINA_TRUE; + } + else if (!strcmp(param->name, "prescale") + && param->type == EDJE_EXTERNAL_PARAM_TYPE_INT) + { + param->i = param_icon->prescale_size; + return EINA_TRUE; + } + else if (!strcmp(param->name, "icon")) + { + /* not easy to get icon name back from live object */ + return EINA_FALSE; + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_icon_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, + const Eina_List *params) +{ + Elm_Params_Icon *mem; + Edje_External_Param *param; + const Eina_List *l; + param_icon = calloc(1, sizeof(Elm_Params_Icon)); + mem = ELM_NEW(Elm_Params_Icon); + if (!mem) + return NULL; + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "file")) + mem->file = eina_stringshare_add(param->s); + else if (!strcmp(param->name, "smooth")) + { + mem->smooth = param->i; + mem->smooth_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "no scale")) + { + mem->no_scale = param->i; + mem->no_scale_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "scale up")) + { + mem->scale_up = param->i; + mem->scale_up_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "scale down")) + { + mem->scale_down = param->i; + mem->scale_down_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "fill outside")) + { + mem->fill_outside = param->i; + mem->fill_outside_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "prescale")) + { + mem->prescale_size = param->i; + mem->prescale_size_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "icon")) + { + mem->icon = eina_stringshare_add(param->s); + } + } + + return mem; +} + +static Evas_Object * +external_icon_content_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, + const char *content __UNUSED__) +{ + ERR("no content"); + return NULL; +} + +static void +external_icon_params_free(void *params) +{ + Elm_Params_Icon *mem = params; + + if (mem->file) + eina_stringshare_del(mem->file); + + if (param_icon->file) + eina_stringshare_del(param_icon->file); + free(param_icon); + + if (mem->icon) + eina_stringshare_del(mem->icon); + free(mem); +} + +static Edje_External_Param_Info external_icon_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_STRING("icon"), + EDJE_EXTERNAL_PARAM_INFO_STRING("file"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("smooth"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("no scale"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("scale up"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("scale down"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("fill outside"), + EDJE_EXTERNAL_PARAM_INFO_INT("prescale"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(icon, "icon"); +DEFINE_EXTERNAL_TYPE_SIMPLE(icon, "Icon"); diff --git a/libraries/elementary/src/edje_externals/elm_index.c b/libraries/elementary/src/edje_externals/elm_index.c new file mode 100644 index 0000000..b516602 --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_index.c @@ -0,0 +1,104 @@ +#include "private.h" + +typedef struct _Elm_Params_Index +{ + Elm_Params base; + Eina_Bool active:1; + Eina_Bool active_exists:1; + +} Elm_Params_Index; + +static void +external_index_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Index *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->active_exists) + elm_index_autohide_disabled_set(obj, p->active_exists); +} + +static Eina_Bool +external_index_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "active")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_index_autohide_disabled_set(obj, param->i); + return EINA_TRUE; + } + } + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_index_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "active")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_index_autohide_disabled_get(obj); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_index_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params) +{ + Elm_Params_Index *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = calloc(1, sizeof(Elm_Params_Index)); + if (!mem) + return NULL; + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "active")) + { + mem->active = !!param->i; + mem->active_exists = EINA_TRUE; + } + + } + + return mem; +} + +static Evas_Object *external_index_content_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("No content."); + return NULL; +} + +static void +external_index_params_free(void *params) +{ + Elm_Params_Index *mem = params; + free(mem); +} + +static Edje_External_Param_Info external_index_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_BOOL("active"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(index, "index"); +DEFINE_EXTERNAL_TYPE_SIMPLE(index, "index"); diff --git a/libraries/elementary/src/edje_externals/elm_label.c b/libraries/elementary/src/edje_externals/elm_label.c new file mode 100644 index 0000000..39a3afe --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_label.c @@ -0,0 +1,100 @@ +#include "private.h" + +typedef struct _Elm_Params_Label +{ + Elm_Params base; + const char* label; +} Elm_Params_Label; + +static void +external_label_state_set(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Label *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->label) elm_object_text_set(obj, p->label); +} + +static Eina_Bool +external_label_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "label")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_object_text_set(obj, param->s); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_label_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "label")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_object_text_get(obj); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_label_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params __UNUSED__) +{ + Elm_Params_Label *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = ELM_NEW(Elm_Params_Label); + if (!mem) + return NULL; + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "label")) + mem->label = eina_stringshare_add(param->s); + } + + return mem; +} + +static Evas_Object *external_label_content_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("no content"); + return NULL; +} + +static void +external_label_params_free(void *params) +{ + Elm_Params_Label *mem = params; + if (mem->label) + eina_stringshare_del(mem->label); + free(params); +} + +static Edje_External_Param_Info external_label_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_STRING("label"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(label, "label"); +DEFINE_EXTERNAL_TYPE_SIMPLE(label, "label"); diff --git a/libraries/elementary/src/edje_externals/elm_list.c b/libraries/elementary/src/edje_externals/elm_list.c new file mode 100644 index 0000000..25b38aa --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_list.c @@ -0,0 +1,317 @@ +#include + +#include "private.h" + +typedef struct _Elm_Params_List +{ + Elm_Params base; + const char *policy_h; + const char *policy_v; + const char *mode; + Eina_Bool h_mode : 1; + Eina_Bool h_mode_exists : 1; + Eina_Bool multi : 1; + Eina_Bool multi_exists : 1; + Eina_Bool always_select : 1; + Eina_Bool always_select_exists : 1; +} Elm_Params_List; + +#define CHOICE_GET(CHOICES, STR) \ + unsigned int i; \ + for (i = 0; i < (sizeof(CHOICES)/sizeof(CHOICES[0])); i++) \ + if (strcmp(STR, CHOICES[i]) == 0) \ + return i + +static const char *scroller_policy_choices[] = {"auto", "on", "off", NULL}; +static const char *list_mode_choices[] = {"compress", "scroll", "limit", + "expand", NULL}; + +static Elm_Scroller_Policy +_scroller_policy_choices_setting_get(const char *policy_str) +{ + assert(sizeof(scroller_policy_choices)/ + sizeof(scroller_policy_choices[0]) == ELM_SCROLLER_POLICY_LAST + 1); + CHOICE_GET(scroller_policy_choices, policy_str); + return ELM_SCROLLER_POLICY_LAST; +} + +static Elm_List_Mode +_list_mode_setting_get(const char *mode_str) +{ + assert(sizeof(list_mode_choices)/sizeof(list_mode_choices[0]) == + ELM_LIST_LAST + 1); + CHOICE_GET(list_mode_choices, mode_str); + return ELM_LIST_LAST; +} + +static void +external_list_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_List *p; + Elm_Scroller_Policy policy_h, policy_v; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->mode) + { + Elm_List_Mode set = _list_mode_setting_get(p->mode); + + if (set != ELM_LIST_LAST) + elm_list_mode_set(obj, set); + } + + if ((p->policy_h) && (p->policy_v)) + { + policy_h = _scroller_policy_choices_setting_get(p->policy_h); + policy_v = _scroller_policy_choices_setting_get(p->policy_v); + elm_list_scroller_policy_set(obj, policy_h, policy_v); + } + else if ((p->policy_h) || (p->policy_v)) + { + elm_list_scroller_policy_get(obj, &policy_h, &policy_v); + if (p->policy_h) + { + policy_h = _scroller_policy_choices_setting_get(p->policy_h); + elm_list_scroller_policy_set(obj, policy_h, policy_v); + } + else + { + policy_v = _scroller_policy_choices_setting_get(p->policy_v); + elm_list_scroller_policy_set(obj, policy_h, policy_v); + } + } + + if (p->h_mode_exists) + elm_list_horizontal_set(obj, p->h_mode); + if (p->multi_exists) + elm_list_multi_select_set(obj, p->multi); + if (p->always_select_exists) + { + if (p->always_select) + elm_list_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_ALWAYS); + else + elm_list_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_DEFAULT); + } +} + +static Eina_Bool +external_list_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "list mode")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE) + { + Elm_List_Mode set = _list_mode_setting_get(param->s); + if (set == ELM_LIST_LAST) return EINA_FALSE; + elm_list_mode_set(obj, set); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "horizontal scroll")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE) + { + Elm_Scroller_Policy h, v; + elm_list_scroller_policy_get(obj, &h, &v); + h = _scroller_policy_choices_setting_get(param->s); + if (h == ELM_SCROLLER_POLICY_LAST) return EINA_FALSE; + elm_list_scroller_policy_set(obj, h, v); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "vertical scroll")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE) + { + Elm_Scroller_Policy h, v; + elm_list_scroller_policy_get(obj, &h, &v); + v = _scroller_policy_choices_setting_get(param->s); + if (v == ELM_SCROLLER_POLICY_LAST) return EINA_FALSE; + elm_list_scroller_policy_set(obj, h, v); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "horizontal mode")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_list_horizontal_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "multi-select mode")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_list_multi_select_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "always-select mode")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + if (param->i) + elm_list_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_ALWAYS); + else + elm_list_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_DEFAULT); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_list_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "horizontal mode")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_list_horizontal_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "multi-select mode")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_list_multi_select_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "always-select mode")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + if (elm_list_select_mode_get (obj) == + ELM_OBJECT_SELECT_MODE_ALWAYS) + param->i = EINA_TRUE; + else + param->i = EINA_FALSE; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "horizontal scroll")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE) + { + Elm_Scroller_Policy h, v; + elm_list_scroller_policy_get(obj, &h, &v); + + param->s = scroller_policy_choices[h]; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "vertical scroll")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE) + { + Elm_Scroller_Policy h, v; + elm_list_scroller_policy_get(obj, &h, &v); + + param->s = scroller_policy_choices[v]; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "list mode")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE) + { + Elm_List_Mode m = elm_list_mode_get(obj); + + if (m == ELM_LIST_LAST) + return EINA_FALSE; + + param->s = list_mode_choices[m]; + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_list_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params) +{ + Elm_Params_List *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = ELM_NEW(Elm_Params_List); + if (!mem) + return NULL; + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "horizontal mode")) + { + mem->h_mode = param->i; + mem->h_mode_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "multi-select mode")) + { + mem->multi = param->i; + mem->multi_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "always-select mode")) + { + mem->always_select = param->i; + mem->always_select_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "horizontal scroll")) + mem->policy_h = eina_stringshare_add(param->s); + else if (!strcmp(param->name, "vertical scroll")) + mem->policy_v = eina_stringshare_add(param->s); + else if (!strcmp(param->name, "list mode")) + mem->mode = eina_stringshare_add(param->s); + } + return mem; +} + +static Evas_Object *external_list_content_get(void *data __UNUSED__, const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("No content."); + return NULL; +} + +static void +external_list_params_free(void *params) +{ + Elm_Params_List *mem = params; + + if (mem->mode) + eina_stringshare_del(mem->mode); + if (mem->policy_h) + eina_stringshare_del(mem->policy_h); + if (mem->policy_v) + eina_stringshare_del(mem->policy_v); + + free(mem); +} + +static Edje_External_Param_Info external_list_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("list mode", "scroll", + list_mode_choices), + EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("horizontal scroll", "auto", + scroller_policy_choices), + EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("vertical scroll", "auto", + scroller_policy_choices), + EDJE_EXTERNAL_PARAM_INFO_BOOL("horizontal mode"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("multi-select mode"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("always-select mode"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(list, "list") +DEFINE_EXTERNAL_TYPE_SIMPLE(list, "List"); diff --git a/libraries/elementary/src/edje_externals/elm_map.c b/libraries/elementary/src/edje_externals/elm_map.c new file mode 100644 index 0000000..11c0ece --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_map.c @@ -0,0 +1,185 @@ +#include + +#include "private.h" + +typedef struct _Elm_Params_Map +{ + Elm_Params base; + const char *map_source; + const char *zoom_mode; + double zoom; + Eina_Bool zoom_set:1; +} Elm_Params_Map; + +static const char *zoom_choices[] = {"manual", "auto fit", "auto fill", NULL}; + +static const char *source_choices[] = + {"Mapnik", "Osmarender", "CycleMap", "Maplint"}; + +static Elm_Map_Zoom_Mode +_zoom_mode_get(const char *map_src) +{ + unsigned int i; + + assert(sizeof(zoom_choices)/sizeof(zoom_choices[0]) == + ELM_MAP_ZOOM_MODE_LAST + 1); + + for (i = 0; i < ELM_MAP_ZOOM_MODE_LAST; i++) + if (!strcmp(map_src, zoom_choices[i])) return i; + + return ELM_MAP_ZOOM_MODE_LAST; +} + +static void +external_map_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Map *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->map_source) + { + elm_map_source_set(obj, ELM_MAP_SOURCE_TYPE_TILE, p->map_source); + } + if (p->zoom_mode) + { + Elm_Map_Zoom_Mode set = _zoom_mode_get(p->zoom_mode); + if (set == ELM_MAP_ZOOM_MODE_LAST) return; + elm_map_zoom_mode_set(obj, set); + } + if (p->zoom_set) elm_map_zoom_set(obj, p->zoom); +} + +static Eina_Bool +external_map_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "map source")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE) + { + elm_map_source_set(obj, ELM_MAP_SOURCE_TYPE_TILE, param->s); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "zoom mode")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE) + { + Elm_Map_Zoom_Mode set = _zoom_mode_get(param->s); + if (set == ELM_MAP_ZOOM_MODE_LAST) return EINA_FALSE; + elm_map_zoom_mode_set(obj, set); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "zoom level")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + elm_map_zoom_set(obj, param->d); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_map_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "map source")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE) + { + const char *set = elm_map_source_get(obj, ELM_MAP_SOURCE_TYPE_TILE); + param->s = set; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "zoom mode")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE) + { + Elm_Map_Zoom_Mode set = elm_map_zoom_mode_get(obj); + if (set == ELM_MAP_ZOOM_MODE_LAST) return EINA_FALSE; + param->s = zoom_choices[set]; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "zoom level")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + param->d = elm_map_zoom_get(obj); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_map_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params) +{ + Elm_Params_Map *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = calloc(1, sizeof(Elm_Params_Map)); + if (!mem) + return NULL; + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "map source")) + mem->map_source = eina_stringshare_add(param->s); + if (!strcmp(param->name, "zoom mode")) + mem->zoom_mode = eina_stringshare_add(param->s); + else if (!strcmp(param->name, "zoom level")) + { + mem->zoom = param->d; + mem->zoom_set = EINA_TRUE; + } + } + + return mem; +} + +static Evas_Object *external_map_content_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("No content."); + return NULL; +} + +static void +external_map_params_free(void *params) +{ + Elm_Params_Map *mem = params; + + if (mem->map_source) + eina_stringshare_del(mem->map_source); + if (mem->zoom_mode) + eina_stringshare_del(mem->zoom_mode); + free(mem); +} + +static Edje_External_Param_Info external_map_params[] = + { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("map source", "Mapnik", source_choices), + EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("zoom mode", "manual", zoom_choices), + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("zoom level"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL + }; + +DEFINE_EXTERNAL_ICON_ADD(map, "map") +DEFINE_EXTERNAL_TYPE_SIMPLE(map, "Map") + diff --git a/libraries/elementary/src/edje_externals/elm_multibuttonentry.c b/libraries/elementary/src/edje_externals/elm_multibuttonentry.c new file mode 100644 index 0000000..63ed57a --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_multibuttonentry.c @@ -0,0 +1,125 @@ +#include "private.h" + +typedef struct _Elm_Params_Multibuttonentry +{ + const char *label; + const char *guide_text; +} Elm_Params_Multibuttonentry; + +static void +external_multibuttonentry_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Multibuttonentry *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->label) + elm_object_text_set(obj, p->label); + if (p->guide_text) + elm_object_part_text_set(obj, "guide", p->guide_text); +} + +static Eina_Bool +external_multibuttonentry_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "label")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_object_text_set(obj, param->s); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "guide text")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_object_part_text_set(obj, "guide", param->s); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_multibuttonentry_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "label")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_object_text_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "guide text")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_object_part_text_get(obj, "guide"); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_multibuttonentry_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params) +{ + Elm_Params_Multibuttonentry *mem = NULL; + Edje_External_Param *param; + const Eina_List *l; + + //mem = external_common_params_parse(Elm_Params_Multibuttonentry, data, obj, params); + if (!mem) + return NULL; + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "label")) + mem->label = eina_stringshare_add(param->s); + else if (!strcmp(param->name, "guide text")) + mem->guide_text = eina_stringshare_add(param->s); + } + + return mem; +} + +static Evas_Object *external_multibuttonentry_content_get(void *data __UNUSED__, const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("so content"); + return NULL; +} + +static void +external_multibuttonentry_params_free(void *params) +{ + Elm_Params_Multibuttonentry *mem = params; + + if (mem->label) + eina_stringshare_del(mem->label); + if (mem->guide_text) + eina_stringshare_del(mem->guide_text); + external_common_params_free(params); +} + +static Edje_External_Param_Info external_multibuttonentry_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_STRING("label"), + EDJE_EXTERNAL_PARAM_INFO_STRING("guide text"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(multibuttonentry, "multibuttonentry") +DEFINE_EXTERNAL_TYPE_SIMPLE(multibuttonentry, "Multibuttonentry") + diff --git a/libraries/elementary/src/edje_externals/elm_naviframe.c b/libraries/elementary/src/edje_externals/elm_naviframe.c new file mode 100644 index 0000000..60211a8 --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_naviframe.c @@ -0,0 +1,133 @@ +#include "private.h" + +typedef struct _Elm_Params_Naviframe +{ + Elm_Params base; + Eina_Bool preserve_on_pop:1; + Eina_Bool preserve_on_pop_exists:1; + Eina_Bool prev_btn_auto_push:1; + Eina_Bool prev_btn_auto_push_exists:1; +} Elm_Params_Naviframe; + +static void +external_naviframe_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, + const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Naviframe *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->preserve_on_pop_exists) + elm_naviframe_content_preserve_on_pop_set(obj, p->preserve_on_pop); + if (p->prev_btn_auto_push_exists) + elm_naviframe_prev_btn_auto_pushed_set(obj, p->prev_btn_auto_push); +} + +static Eina_Bool +external_naviframe_param_set(void *data __UNUSED__, Evas_Object *obj, + const Edje_External_Param *param) +{ + if (!strcmp(param->name, "preserve on pop")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_naviframe_content_preserve_on_pop_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "prev btn auto push")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_naviframe_prev_btn_auto_pushed_set(obj, param->i); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_naviframe_param_get(void *data __UNUSED__, const Evas_Object *obj, + Edje_External_Param *param) +{ + if (!strcmp(param->name, "preserve on pop")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_naviframe_content_preserve_on_pop_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "prev btn auto push")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_naviframe_prev_btn_auto_pushed_get(obj); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_naviframe_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, + const Eina_List *params) +{ + Elm_Params_Naviframe *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = ELM_NEW(Elm_Params_Naviframe); + if (!mem) + return NULL; + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "preserve on pop")) + { + mem->preserve_on_pop = !!param->i; + mem->preserve_on_pop_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "prev btn auto push")) + { + mem->prev_btn_auto_push = !!param->i; + mem->prev_btn_auto_push_exists = EINA_TRUE; + } + } + + return mem; +} + +static Evas_Object *external_naviframe_content_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("No content."); + return NULL; +} + +static void +external_naviframe_params_free(void *params) +{ + Elm_Params_Naviframe *mem = params; + free(mem); +} + +static Edje_External_Param_Info external_naviframe_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_BOOL("preserve on pop"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("prev btn auto push"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(naviframe, "naviframe"); +DEFINE_EXTERNAL_TYPE_SIMPLE(naviframe, "Naviframe"); diff --git a/libraries/elementary/src/edje_externals/elm_notify.c b/libraries/elementary/src/edje_externals/elm_notify.c new file mode 100644 index 0000000..d44b3f3 --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_notify.c @@ -0,0 +1,199 @@ +#include "private.h" +#include + + +typedef struct _Elm_Params_Notify Elm_Params_Notify; + +struct _Elm_Params_Notify { + Elm_Params base; + Evas_Object *content; /* part name whose obj is to be set as content */ + Eina_Bool allow_events_exists; + Eina_Bool allow_events; + Eina_Bool timeout_exists; + double timeout; + + const char *orient; +}; + + +static const char *orients[] = { + "top", + "center", + "bottom", + "left", + "right", + "top_left", + "top_right", + "bottom_left", + "bottom_right", + NULL +}; + +static Elm_Notify_Orient _orient_get(const char *orient) +{ + unsigned int i; + + assert(sizeof(orients)/sizeof(orients[0]) == + ELM_NOTIFY_ORIENT_LAST + 1); + + for (i = 0; i < ELM_NOTIFY_ORIENT_LAST; i++) + if (!strcmp(orient, orients[i])) return i; + + return ELM_NOTIFY_ORIENT_LAST; +} + +static void external_notify_state_set(void *data __UNUSED__, + Evas_Object *obj, const void *from_params, + const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Notify *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->content) { + elm_object_content_set(obj, p->content); + } + if (p->allow_events_exists) + elm_notify_allow_events_set(obj, p->allow_events); + if (p->timeout_exists) + elm_notify_timeout_set(obj, p->timeout); + if (p->orient) + { + Elm_Notify_Orient set = _orient_get(p->orient); + if (set == ELM_NOTIFY_ORIENT_LAST) return; + elm_notify_orient_set(obj, set); + } +} + +static Eina_Bool external_notify_param_set(void *data __UNUSED__, + Evas_Object *obj, const Edje_External_Param *param) +{ + if ((!strcmp(param->name, "content")) + && (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)) + { + Evas_Object *content = external_common_param_edje_object_get(obj, param); + if ((strcmp(param->s, "")) && (!content)) + return EINA_FALSE; + elm_object_content_set(obj, content); + return EINA_TRUE; + } + else if ((!strcmp(param->name, "allow_events")) + && (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)) + { + elm_notify_allow_events_set(obj, param->i); + return EINA_TRUE; + } + else if ((!strcmp(param->name, "timeout")) + && (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)) + { + elm_notify_timeout_set(obj, param->d); + return EINA_TRUE; + } + else if ((!strcmp(param->name, "orient")) + && (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE)) + { + Elm_Notify_Orient set = _orient_get(param->s); + if (set == ELM_NOTIFY_ORIENT_LAST) return EINA_FALSE; + elm_notify_orient_set(obj, set); + return EINA_TRUE; + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool external_notify_param_get(void *data __UNUSED__, + const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "content")) + { + /* not easy to get content name back from live object */ + return EINA_FALSE; + } + else if ((!strcmp(param->name, "allow_events")) + && (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)) + { + param->i = elm_notify_allow_events_get(obj); + return EINA_TRUE; + } + else if ((!strcmp(param->name, "timeout")) + && (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)) + { + param->d = elm_notify_timeout_get(obj); + return EINA_TRUE; + } + else if ((!strcmp(param->name, "orient")) + && (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE)) + { + Elm_Notify_Orient set = elm_notify_orient_get(obj); + if (set == ELM_NOTIFY_ORIENT_LAST) return EINA_FALSE; + param->s = orients[set]; + return EINA_TRUE; + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * external_notify_params_parse(void *data __UNUSED__, Evas_Object *obj, + const Eina_List *params) { + Elm_Params_Notify *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = calloc(1, sizeof(Elm_Params_Notify)); + if (!mem) + return NULL; + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "content")) + mem->content = external_common_param_edje_object_get(obj, param); + else if (!strcmp(param->name, "timeout")) + { + mem->timeout = param->d; + mem->timeout_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "allow_events")) + { + mem->allow_events = param->i; + mem->allow_events_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "orient")) + mem->orient = eina_stringshare_add(param->s); + } + + return mem; +} + +static Evas_Object *external_notify_content_get(void *data __UNUSED__, + const Evas_Object *obj, const char *content) +{ + if (!strcmp(content, "content")) + return elm_object_content_get(obj); + + ERR("unknown content '%s'", content); + return NULL; +} + +static void external_notify_params_free(void *params) { + free(params); +} + +static Edje_External_Param_Info external_notify_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_STRING("content"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("allow_events"), + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("timeout"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(notify, "notify"); +DEFINE_EXTERNAL_TYPE_SIMPLE(notify, "Notify") +; diff --git a/libraries/elementary/src/edje_externals/elm_panes.c b/libraries/elementary/src/edje_externals/elm_panes.c new file mode 100644 index 0000000..3b96303 --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_panes.c @@ -0,0 +1,198 @@ +#include "private.h" +#include + + +typedef struct _Elm_Params_Panes Elm_Params_Panes; + +struct _Elm_Params_Panes { + Elm_Params base; + Evas_Object *content_left; + Evas_Object *content_right; + Eina_Bool is_horizontal; + Eina_Bool horizontal; + Eina_Bool is_left_size; + double left_size; + Eina_Bool is_fixed; + Eina_Bool fixed; +}; + +static void external_panes_state_set(void *data __UNUSED__, + Evas_Object *obj, const void *from_params, + const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Panes *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->content_left) + elm_object_part_content_set(obj, "left", p->content_left); + + if (p->content_right) + elm_object_part_content_set(obj, "right", p->content_right); + + if (p->is_left_size) + elm_panes_content_left_size_set(obj, p->left_size); + + if (p->is_horizontal) + elm_panes_horizontal_set(obj, p->horizontal); + + if (p->is_fixed) + elm_panes_fixed_set(obj, p->fixed); +} + +static Eina_Bool external_panes_param_set(void *data __UNUSED__, + Evas_Object *obj, const Edje_External_Param *param) +{ + if ((!strcmp(param->name, "content left")) + && (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)) + { + Evas_Object *content = external_common_param_edje_object_get(obj, param); + if ((strcmp(param->s, "")) && (!content)) + return EINA_FALSE; + elm_object_part_content_set(obj, "left", content); + return EINA_TRUE; + } + else if ((!strcmp(param->name, "content right")) + && (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)) + { + Evas_Object *content = external_common_param_edje_object_get(obj, param); + if ((strcmp(param->s, "")) && (!content)) + return EINA_FALSE; + elm_object_part_content_set(obj, "right", content); + return EINA_TRUE; + } + else if ((!strcmp(param->name, "horizontal")) + && (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)) + { + elm_panes_horizontal_set(obj, param->i); + return EINA_TRUE; + } + else if ((!strcmp(param->name, "left size")) + && (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)) + { + elm_panes_content_left_size_set(obj, param->d); + return EINA_TRUE; + } + else if ((!strcmp(param->name, "fixed")) + && (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)) + { + elm_panes_fixed_set(obj, param->i); + return EINA_TRUE; + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_panes_param_get(void *data __UNUSED__, const Evas_Object *obj, + Edje_External_Param *param) +{ + if (!strcmp(param->name, "content left")) + { + /* not easy to get content name back from live object */ + return EINA_FALSE; + } + else if (!strcmp(param->name, "content right")) + { + /* not easy to get content name back from live object */ + return EINA_FALSE; + } + else if ((!strcmp(param->name, "horizontal")) + && (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)) + { + param->i = elm_panes_horizontal_get(obj); + return EINA_TRUE; + } + else if ((!strcmp(param->name, "left size")) + && (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)) + { + param->d = elm_panes_content_left_size_get(obj); + return EINA_TRUE; + } + else if ((!strcmp(param->name, "fixed")) + && (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)) + { + param->i = elm_panes_fixed_get(obj); + return EINA_TRUE; + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_panes_params_parse(void *data __UNUSED__, Evas_Object *obj, + const Eina_List *params) +{ + Elm_Params_Panes *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = calloc(1, sizeof(Elm_Params_Panes)); + if (!mem) + return NULL; + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "content left")) + mem->content_left = external_common_param_edje_object_get(obj, param); + else if (!strcmp(param->name, "content right")) + mem->content_right = external_common_param_edje_object_get(obj, param); + else if (!strcmp(param->name, "horizontal")) + { + mem->is_horizontal = EINA_TRUE; + mem->horizontal = param->i; + } + else if (!strcmp(param->name, "left size")) + { + mem->is_left_size = EINA_TRUE; + mem->left_size = param->d; + } + else if (!strcmp(param->name, "fixed")) + { + mem->is_fixed = EINA_TRUE; + mem->fixed = param->i; + } + } + + return mem; +} + +static Evas_Object * +external_panes_content_get(void *data __UNUSED__, const Evas_Object *obj, + const char *content) +{ + if (!strcmp(content, "left")) + return elm_object_part_content_get(obj, "left"); + else if (!strcmp(content, "right")) + return elm_object_part_content_get(obj, "right"); + + ERR("unknown content '%s'", content); + + return NULL; +} + +static void external_panes_params_free(void *params) +{ + free(params); +} + +static Edje_External_Param_Info external_panes_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_STRING("content left"), + EDJE_EXTERNAL_PARAM_INFO_STRING("content right"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("horizontal"), + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("left size"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("fixed"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(panes, "panes"); +DEFINE_EXTERNAL_TYPE_SIMPLE(panes, "panes"); diff --git a/libraries/elementary/src/edje_externals/elm_photocam.c b/libraries/elementary/src/edje_externals/elm_photocam.c new file mode 100644 index 0000000..b4711c7 --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_photocam.c @@ -0,0 +1,208 @@ +#include + +#include "private.h" + +typedef struct _Elm_Params_Photocam +{ + Elm_Params base; + const char *file; + double zoom; + const char *zoom_mode; + Eina_Bool paused:1; + Eina_Bool paused_exists:1; + Eina_Bool zoom_exists:1; +} Elm_Params_Photocam; + +static const char* choices[] = {"manual", "auto fit", "auto fill", NULL}; + +static Elm_Photocam_Zoom_Mode +_zoom_mode_setting_get(const char *zoom_mode_str) +{ + unsigned int i; + + assert(sizeof(choices)/sizeof(choices[0]) == ELM_PHOTOCAM_ZOOM_MODE_LAST + 1); + + for (i = 0; i < ELM_PHOTOCAM_ZOOM_MODE_LAST; i++) + { + if (!strcmp(zoom_mode_str, choices[i])) + return i; + } + return ELM_PHOTOCAM_ZOOM_MODE_LAST; +} + +static void +external_photocam_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Photocam *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->file) + elm_photocam_file_set(obj, p->file); + if (p->zoom_exists) + elm_photocam_zoom_set(obj, p->zoom); + if (p->zoom_mode) + { + Elm_Photocam_Zoom_Mode set = _zoom_mode_setting_get(p->zoom_mode); + if (set == ELM_PHOTOCAM_ZOOM_MODE_LAST) return; + elm_photocam_zoom_mode_set(obj, set); + } + if (p->paused_exists) + elm_photocam_paused_set(obj, p->paused); +} + +static Eina_Bool +external_photocam_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "file")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_photocam_file_set(obj, param->s); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "zoom")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + elm_photocam_zoom_set(obj, param->d); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "zoom mode")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + Elm_Photocam_Zoom_Mode set = _zoom_mode_setting_get(param->s); + if (set == ELM_PHOTOCAM_ZOOM_MODE_LAST) return EINA_FALSE; + elm_photocam_zoom_mode_set(obj, set); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "paused")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_photocam_paused_set(obj, param->i); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_photocam_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "file")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_photocam_file_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "zoom")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + param->d = elm_photocam_zoom_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "zoom mode")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + Elm_Photocam_Zoom_Mode zoom_mode_set = elm_photocam_zoom_mode_get(obj); + + if (zoom_mode_set == ELM_PHOTOCAM_ZOOM_MODE_LAST) + return EINA_FALSE; + + param->s = choices[zoom_mode_set]; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "paused")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_photocam_paused_get(obj); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_photocam_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params) +{ + Elm_Params_Photocam *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = calloc(1, sizeof(Elm_Params_Photocam)); + if (!mem) + return NULL; + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "file")) + mem->file = eina_stringshare_add(param->s); + else if (!strcmp(param->name, "zoom")) + { + mem->zoom = param->d; + mem->zoom_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "zoom mode")) + mem->zoom_mode = eina_stringshare_add(param->s); + else if (!strcmp(param->name, "paused")) + { + mem->paused = !!param->i; + mem->paused_exists = EINA_TRUE; + } + } + + return mem; +} + +static Evas_Object *external_photocam_content_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("No content."); + return NULL; +} + +static void +external_photocam_params_free(void *params) +{ + Elm_Params_Photocam *mem = params; + + if (mem->file) + eina_stringshare_del(mem->file); + if (mem->zoom_mode) + eina_stringshare_del(mem->zoom_mode); + free(mem); +} + +static Edje_External_Param_Info external_photocam_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_STRING("file"), + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("zoom"), + EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("zoom mode", "manual", choices), + EDJE_EXTERNAL_PARAM_INFO_BOOL("paused"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(photocam, "photocam"); +DEFINE_EXTERNAL_TYPE_SIMPLE(photocam, "Photocam"); diff --git a/libraries/elementary/src/edje_externals/elm_progressbar.c b/libraries/elementary/src/edje_externals/elm_progressbar.c new file mode 100644 index 0000000..c202fb4 --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_progressbar.c @@ -0,0 +1,251 @@ +#include "private.h" + +typedef struct _Elm_Params_Progressbar +{ + Elm_Params base; + const char *label; + Evas_Object *icon; + const char *unit; + double value; + Evas_Coord span; + Eina_Bool value_exists:1; + Eina_Bool span_exists:1; + Eina_Bool inverted:1; + Eina_Bool inverted_exists:1; + Eina_Bool horizontal:1; + Eina_Bool horizontal_exists:1; +} Elm_Params_Progressbar; + +static void +external_progressbar_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Progressbar *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->label) + elm_object_text_set(obj, p->label); + if (p->icon) + elm_object_part_content_set(obj, "icon", p->icon); + if (p->span_exists) + elm_progressbar_span_size_set(obj, p->span); + if (p->value_exists) + elm_progressbar_value_set(obj, p->value); + if (p->inverted_exists) + elm_progressbar_inverted_set(obj, p->inverted); + if (p->horizontal_exists) + elm_progressbar_horizontal_set(obj, p->horizontal); + if (p->unit) + elm_progressbar_unit_format_set(obj, p->unit); +} + +static Eina_Bool +external_progressbar_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "label")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_object_text_set(obj, param->s); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "icon")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + Evas_Object *icon = external_common_param_icon_get(obj, param); + if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE; + elm_object_part_content_set(obj, "icon", icon); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "value")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + elm_progressbar_value_set(obj, param->d); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "horizontal")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_progressbar_horizontal_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "inverted")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_progressbar_inverted_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "span")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT) + { + elm_progressbar_span_size_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "unit format")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_progressbar_unit_format_set(obj, param->s); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_progressbar_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "label")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_object_text_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "icon")) + { + /* not easy to get icon name back from live object */ + return EINA_FALSE; + } + else if (!strcmp(param->name, "value")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + param->d = elm_progressbar_value_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "horizontal")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_progressbar_horizontal_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "inverted")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_progressbar_inverted_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "span")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT) + { + param->i = elm_progressbar_span_size_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "unit format")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_progressbar_unit_format_get(obj); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_progressbar_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params) +{ + Elm_Params_Progressbar *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = calloc(1, sizeof(Elm_Params_Progressbar)); + if (!mem) + return NULL; + + external_common_icon_param_parse(&mem->icon, obj, params); + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "span")) + { + mem->span = param->i; + mem->span_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "value")) + { + mem->value = param->d; + mem->value_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "inverted")) + { + mem->inverted = !!param->i; + mem->inverted_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "horizontal")) + { + mem->horizontal = !!param->i; + mem->horizontal_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "unit format")) + mem->unit = eina_stringshare_add(param->s); + else if (!strcmp(param->name, "label")) + mem->label = eina_stringshare_add(param->s); + } + + return mem; +} + +static Evas_Object *external_progressbar_content_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("No content."); + return NULL; +} + +static void +external_progressbar_params_free(void *params) +{ + Elm_Params_Progressbar *mem = params; + + if (mem->unit) + eina_stringshare_del(mem->unit); + if (mem->label) + eina_stringshare_del(mem->label); + free(params); +} + +static Edje_External_Param_Info external_progressbar_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_STRING("label"), + EDJE_EXTERNAL_PARAM_INFO_STRING("icon"), + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("value"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("horizontal"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("inverted"), + EDJE_EXTERNAL_PARAM_INFO_INT("span"), + EDJE_EXTERNAL_PARAM_INFO_STRING_DEFAULT("unit format", "%1.2f"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(progressbar, "progressbar") +DEFINE_EXTERNAL_TYPE_SIMPLE(progressbar, "Progressbar") diff --git a/libraries/elementary/src/edje_externals/elm_radio.c b/libraries/elementary/src/edje_externals/elm_radio.c new file mode 100644 index 0000000..6d5ee5d --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_radio.c @@ -0,0 +1,176 @@ +#include "private.h" + +typedef struct _Elm_Params_Radio +{ + Elm_Params base; + const char *label; + Evas_Object *icon; + const char* group_name; + int value; + Eina_Bool value_exists:1; +} Elm_Params_Radio; + +static void +external_radio_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Radio *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->label) + elm_object_text_set(obj, p->label); + if (p->icon) + elm_object_part_content_set(obj, "icon", p->icon); + if (p->value_exists) + elm_radio_state_value_set(obj, p->value); + if (p->group_name) + { + Evas_Object *ed = evas_object_smart_parent_get(obj); + Evas_Object *group = edje_object_part_swallow_get(ed, p->group_name); + elm_radio_group_add(obj, group); + } +} + +static Eina_Bool +external_radio_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "label")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_object_text_set(obj, param->s); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "icon")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + Evas_Object *icon = external_common_param_icon_get(obj, param); + if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE; + elm_object_part_content_set(obj, "icon", icon); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "value")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT) + { + elm_radio_value_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "group")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + Evas_Object *ed = evas_object_smart_parent_get(obj); + Evas_Object *group = edje_object_part_swallow_get(ed, param->s); + elm_radio_group_add(obj, group); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_radio_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "label")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_object_text_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "icon")) + { + /* not easy to get icon name back from live object */ + return EINA_FALSE; + } + else if (!strcmp(param->name, "value")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT) + { + param->i = elm_radio_value_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "group")) + { + /* not easy to get group name back from live object */ + return EINA_FALSE; + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_radio_params_parse(void *data __UNUSED__, Evas_Object *obj, const Eina_List *params) +{ + Elm_Params_Radio *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = calloc(1, sizeof(Elm_Params_Radio)); + if (!mem) + return NULL; + + external_common_icon_param_parse(&mem->icon, obj, params); + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "group")) + mem->group_name = eina_stringshare_add(param->s); + else if (!strcmp(param->name, "value")) + { + mem->value = param->i; + mem->value_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "label")) + mem->label = eina_stringshare_add(param->s); + } + + return mem; +} + +static Evas_Object *external_radio_content_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("No content."); + return NULL; +} + +static void +external_radio_params_free(void *params) +{ + Elm_Params_Radio *mem = params; + + if (mem->group_name) + eina_stringshare_del(mem->group_name); + if (mem->label) + eina_stringshare_del(mem->label); + free(params); +} + +static Edje_External_Param_Info external_radio_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_STRING("label"), + EDJE_EXTERNAL_PARAM_INFO_STRING("icon"), + EDJE_EXTERNAL_PARAM_INFO_STRING("group"), + EDJE_EXTERNAL_PARAM_INFO_INT("value"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(radio, "radio") +DEFINE_EXTERNAL_TYPE_SIMPLE(radio, "Radio") diff --git a/libraries/elementary/src/edje_externals/elm_scroller.c b/libraries/elementary/src/edje_externals/elm_scroller.c new file mode 100644 index 0000000..2173e3c --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_scroller.c @@ -0,0 +1,104 @@ +#include "private.h" +#include + + +typedef struct _Elm_Params_Scroller Elm_Params_Scroller; + +struct _Elm_Params_Scroller { + Elm_Params base; + Evas_Object *content; +}; + + + +static void external_scroller_state_set(void *data __UNUSED__, + Evas_Object *obj, const void *from_params, + const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Scroller *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->content) { + elm_object_content_set(obj, p->content); + } +} + +static Eina_Bool external_scroller_param_set(void *data __UNUSED__, + Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "content") + && param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + Evas_Object *content = external_common_param_edje_object_get(obj, param); + if ((strcmp(param->s, "")) && (!content)) + return EINA_FALSE; + elm_object_content_set(obj, content); + return EINA_TRUE; + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool external_scroller_param_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, Edje_External_Param *param) +{ + if (!strcmp(param->name, "content")) + { + /* not easy to get content name back from live object */ + return EINA_FALSE; + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * external_scroller_params_parse(void *data __UNUSED__, Evas_Object *obj, + const Eina_List *params) { + Elm_Params_Scroller *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = ELM_NEW(Elm_Params_Scroller); + if (!mem) + return NULL; + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "content")) + mem->content = external_common_param_edje_object_get(obj, param); + } + + return mem; +} + +static Evas_Object *external_scroller_content_get(void *data __UNUSED__, + const Evas_Object *obj, const char *content) +{ + if (!strcmp(content, "content")) + return elm_object_content_get(obj); + + ERR("unknown content '%s'", content); + return NULL; +} + +static void external_scroller_params_free(void *params) { + external_common_params_free(params); +} + +static Edje_External_Param_Info external_scroller_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_STRING("content"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(scroller, "scroller"); +DEFINE_EXTERNAL_TYPE_SIMPLE(scroller, "Scroller") +; diff --git a/libraries/elementary/src/edje_externals/elm_segment_control.c b/libraries/elementary/src/edje_externals/elm_segment_control.c new file mode 100644 index 0000000..953feb5 --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_segment_control.c @@ -0,0 +1,75 @@ +#include "private.h" + +typedef struct _Elm_Params_Segment_Control +{ + Elm_Params base; +} Elm_Params_Segment_Control; + +static void +external_segment_control_state_set(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Segment_Control *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; +} + +static Eina_Bool +external_segment_control_param_set(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Edje_External_Param *param) +{ + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_segment_control_param_get(void *data __UNUSED__, const Evas_Object *obj __UNUSED__, Edje_External_Param *param) +{ + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_segment_control_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params __UNUSED__) +{ + Elm_Params_Segment_Control *mem; + //Edje_External_Param *param; + //const Eina_List *l; + + mem = calloc(1, sizeof(Elm_Params_Segment_Control)); + if (!mem) + return NULL; + + /* + EINA_LIST_FOREACH(params, l, param) + { + } + */ + return mem; +} + +static Evas_Object *external_segment_control_content_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("No content."); + return NULL; +} + +static void +external_segment_control_params_free(void *params) +{ + Elm_Params_Segment_Control *mem = params; + free(mem); +} + +static Edje_External_Param_Info external_segment_control_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(segment_control, "segment_control"); +DEFINE_EXTERNAL_TYPE_SIMPLE(segment_control, "segment_control"); diff --git a/libraries/elementary/src/edje_externals/elm_slider.c b/libraries/elementary/src/edje_externals/elm_slider.c new file mode 100644 index 0000000..3b349ce --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_slider.c @@ -0,0 +1,339 @@ +#include "private.h" + +typedef struct _Elm_Params_Slider +{ + Elm_Params base; + const char *label; + Evas_Object *icon; + const char *indicator, *unit; + double min, max, value; + Eina_Bool min_exists:1; + Eina_Bool max_exists:1; + Eina_Bool value_exists:1; + Eina_Bool inverted:1; + Eina_Bool inverted_exists:1; + Eina_Bool span:1; + Eina_Bool span_exists:1; + Eina_Bool horizontal:1; + Eina_Bool horizontal_exists:1; +} Elm_Params_Slider; + +static void +external_slider_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Slider *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->label) + elm_object_text_set(obj, p->label); + if (p->icon) + elm_object_part_content_set(obj, "icon", p->icon); + if (p->span_exists) + elm_slider_span_size_set(obj, p->span); + if ((p->min_exists) && (p->max_exists)) + elm_slider_min_max_set(obj, p->min, p->max); + else if ((p->min_exists) || (p->max_exists)) + { + double min, max; + elm_slider_min_max_get(obj, &min, &max); + if (p->min_exists) + elm_slider_min_max_set(obj, p->min, max); + else + elm_slider_min_max_set(obj, min, p->max); + } + if (p->value_exists) + elm_slider_value_set(obj, p->value); + if (p->inverted_exists) + elm_slider_inverted_set(obj, p->inverted); + if (p->horizontal_exists) + elm_slider_horizontal_set(obj, p->horizontal); + if (p->indicator) + elm_slider_indicator_format_set(obj, p->indicator); + if (p->unit) + elm_slider_unit_format_set(obj, p->unit); +} + +static Eina_Bool +external_slider_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "label")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_object_text_set(obj, param->s); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "icon")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + Evas_Object *icon = external_common_param_icon_get(obj, param); + if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE; + elm_object_part_content_set(obj, "icon", icon); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "min")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + double min, max; + elm_slider_min_max_get(obj, &min, &max); + elm_slider_min_max_set(obj, param->d, max); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "max")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + double min, max; + elm_slider_min_max_get(obj, &min, &max); + elm_slider_min_max_set(obj, min, param->d); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "value")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + elm_slider_value_set(obj, param->d); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "horizontal")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_slider_horizontal_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "inverted")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_slider_inverted_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "span")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT) + { + elm_slider_span_size_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "unit format")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_slider_unit_format_set(obj, param->s); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "indicator format")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_slider_indicator_format_set(obj, param->s); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_slider_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "label")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_object_text_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "icon")) + { + /* not easy to get icon name back from live object */ + return EINA_FALSE; + } + else if (!strcmp(param->name, "min")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + double min, max; + elm_slider_min_max_get(obj, &min, &max); + param->d = min; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "max")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + double min, max; + elm_slider_min_max_get(obj, &min, &max); + param->d = max; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "value")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + param->d = elm_slider_value_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "horizontal")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_slider_horizontal_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "inverted")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_slider_inverted_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "span")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT) + { + param->i = elm_slider_span_size_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "unit format")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_slider_unit_format_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "indicator format")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_slider_indicator_format_get(obj); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_slider_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params) +{ + Elm_Params_Slider *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = calloc(1, sizeof(Elm_Params_Slider)); + if (!mem) + return NULL; + + external_common_icon_param_parse(&mem->icon, obj, params); + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "span")) + { + mem->span = param->i; + mem->span_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "min")) + { + mem->min = param->d; + mem->min_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "max")) + { + mem->max = param->d; + mem->max_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "value")) + { + mem->value = param->d; + mem->value_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "inverted")) + { + mem->inverted = param->i; + mem->inverted_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "horizontal")) + { + mem->horizontal = param->i; + mem->horizontal_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "unit format")) + mem->unit = eina_stringshare_add(param->s); + else if (!strcmp(param->name, "indicator format")) + mem->indicator = eina_stringshare_add(param->s); + else if (!strcmp(param->name, "label")) + mem->label = eina_stringshare_add(param->s); + } + + return mem; +} + +static Evas_Object *external_slider_content_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("No content."); + return NULL; +} + +static void +external_slider_params_free(void *params) +{ + Elm_Params_Slider *mem = params; + + if (mem->unit) + eina_stringshare_del(mem->unit); + if (mem->indicator) + eina_stringshare_del(mem->indicator); + if (mem->label) + eina_stringshare_del(mem->label); + free(params); +} + +static Edje_External_Param_Info external_slider_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_STRING("label"), + EDJE_EXTERNAL_PARAM_INFO_STRING("icon"), + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("min"), + EDJE_EXTERNAL_PARAM_INFO_DOUBLE_DEFAULT("max", 10.0), + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("value"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("horizontal"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("inverted"), + EDJE_EXTERNAL_PARAM_INFO_INT("span"), + EDJE_EXTERNAL_PARAM_INFO_STRING_DEFAULT("unit format", "%1.2f"), + EDJE_EXTERNAL_PARAM_INFO_STRING_DEFAULT("indicator format", "%1.2f"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(slider, "slider") +DEFINE_EXTERNAL_TYPE_SIMPLE(slider, "Slider") diff --git a/libraries/elementary/src/edje_externals/elm_slideshow.c b/libraries/elementary/src/edje_externals/elm_slideshow.c new file mode 100644 index 0000000..ca4b7f9 --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_slideshow.c @@ -0,0 +1,182 @@ +#include "private.h" + +typedef struct _Elm_Params_Slideshow +{ + Elm_Params base; + double timeout; + const char *transition; + const char *layout; + Eina_Bool loop:1; + Eina_Bool timeout_exists:1; + Eina_Bool loop_exists:1; +} Elm_Params_Slideshow; + +static const char *transitions[] = { "fade", "black_fade", "horizontal", + "vertical", "square", NULL}; +static const char *layout[] = { "fullscreen", "not_fullscreen", NULL}; + +static void +external_slideshow_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Slideshow *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->timeout_exists) + elm_slideshow_timeout_set(obj , p->timeout); + if (p->loop_exists) + elm_slideshow_loop_set(obj, p->loop); + if (p->transition) { + elm_slideshow_transition_set(obj, p->transition); + } + if (p->layout) { + elm_slideshow_layout_set(obj, p->layout); + } +} + +static Eina_Bool +external_slideshow_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "timeout")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + elm_slideshow_timeout_set(obj, param->d); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "loop")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_slideshow_loop_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "transition")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_slideshow_transition_set(obj, param->s); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "layout")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_slideshow_layout_set(obj, param->s); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_slideshow_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "timeout")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + param->d = elm_slideshow_timeout_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "loop")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_slideshow_loop_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "transition")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_slideshow_transition_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "layout")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_slideshow_layout_get(obj); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_slideshow_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params) +{ + Elm_Params_Slideshow *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = calloc(1, sizeof(Elm_Params_Slideshow)); + if (!mem) + return NULL; + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "timeout")) + { + mem->timeout = param->d; + mem->timeout_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "loop")) + { + mem->loop = param->i; + mem->loop_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "transition")) + { + mem->transition = param->s; + } + else if (!strcmp(param->name, "layout")) + { + mem->layout = param->s; + } + } + + return mem; +} + +static Evas_Object *external_slideshow_content_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("No content."); + return NULL; +} + +static void +external_slideshow_params_free(void *params __UNUSED__) +{ + return; +} + +static Edje_External_Param_Info external_slideshow_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("timeout"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("loop"), + EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("transition", "fade", transitions), + EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("layout", "fullscreen", layout), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(slideshow, "slideshow"); +DEFINE_EXTERNAL_TYPE_SIMPLE(slideshow, "Slideshow"); diff --git a/libraries/elementary/src/edje_externals/elm_spinner.c b/libraries/elementary/src/edje_externals/elm_spinner.c new file mode 100644 index 0000000..8978cb6 --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_spinner.c @@ -0,0 +1,244 @@ +#include "private.h" + +typedef struct _Elm_Params_Spinner +{ + Elm_Params base; + const char *label_format; + double min, max, step, value; + Eina_Bool min_exists:1; + Eina_Bool max_exists:1; + Eina_Bool step_exists:1; + Eina_Bool value_exists:1; + Eina_Bool wrap_exists:1; + Eina_Bool wrap:1; +} Elm_Params_Spinner; + +static void +external_spinner_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Spinner *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->label_format) + elm_spinner_label_format_set(obj, p->label_format); + if ((p->min_exists) && (p->max_exists)) + elm_spinner_min_max_set(obj, p->min, p->max); + else if ((p->min_exists) || (p->max_exists)) + { + double min, max; + elm_spinner_min_max_get(obj, &min, &max); + if (p->min_exists) + elm_spinner_min_max_set(obj, p->min, max); + else + elm_spinner_min_max_set(obj, min, p->max); + } + if (p->step_exists) + elm_spinner_step_set(obj, p->step); + if (p->value_exists) + elm_spinner_value_set(obj, p->value); + if (p->wrap_exists) + elm_spinner_wrap_set(obj, p->wrap); +} + +static Eina_Bool +external_spinner_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "label format")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_spinner_label_format_set(obj, param->s); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "min")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + double min, max; + elm_spinner_min_max_get(obj, &min, &max); + elm_spinner_min_max_set(obj, param->d, max); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "max")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + double min, max; + elm_spinner_min_max_get(obj, &min, &max); + elm_spinner_min_max_set(obj, min, param->d); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "step")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + elm_spinner_step_set(obj, param->d); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "value")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + elm_spinner_value_set(obj, param->d); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "wrap")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_spinner_wrap_set(obj, param->i); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_spinner_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "label format")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_spinner_label_format_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "min")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + double min, max; + elm_spinner_min_max_get(obj, &min, &max); + param->d = min; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "max")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + double min, max; + elm_spinner_min_max_get(obj, &min, &max); + param->d = max; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "step")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + param->d = elm_spinner_step_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "value")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + param->d = elm_spinner_value_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "wrap")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_spinner_value_get(obj); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_spinner_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params) +{ + Elm_Params_Spinner *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = calloc(1, sizeof(Elm_Params_Spinner)); + if (!mem) + return NULL; + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "label format")) + mem->label_format = eina_stringshare_add(param->s); + else if (!strcmp(param->name, "min")) + { + mem->min = param->d; + mem->min_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "max")) + { + mem->max = param->d; + mem->max_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "step")) + { + mem->step = param->d; + mem->step_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "value")) + { + mem->value = param->d; + mem->value_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "wrap")) + { + mem->wrap = param->i; + mem->wrap_exists = EINA_TRUE; + } + } + + return mem; +} + +static Evas_Object *external_spinner_content_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("No content."); + return NULL; +} + +static void +external_spinner_params_free(void *params) +{ + Elm_Params_Spinner *mem = params; + + if (mem->label_format) + eina_stringshare_del(mem->label_format); + free(mem); +} + +static Edje_External_Param_Info external_spinner_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_STRING_DEFAULT("label format", "%1.2f"), + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("min"), + EDJE_EXTERNAL_PARAM_INFO_DOUBLE_DEFAULT("max", 100.0), + EDJE_EXTERNAL_PARAM_INFO_DOUBLE_DEFAULT("step", 1.0), + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("value"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("wrap"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(spinner, "spinner") +DEFINE_EXTERNAL_TYPE_SIMPLE(spinner, "Spinner") diff --git a/libraries/elementary/src/edje_externals/elm_thumb.c b/libraries/elementary/src/edje_externals/elm_thumb.c new file mode 100644 index 0000000..08e3ee0 --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_thumb.c @@ -0,0 +1,146 @@ +#include + +#include "private.h" + +typedef struct _Elm_Params_Thumb +{ + Elm_Params base; + const char *animate; +} Elm_Params_Thumb; + +static const char* choices[] = {"loop", "start", "stop", NULL}; + +static Elm_Thumb_Animation_Setting +_anim_setting_get(const char *anim_str) +{ + unsigned int i; + + assert(sizeof(choices)/sizeof(choices[0]) == ELM_THUMB_ANIMATION_LAST + 1); + + for (i = 0; i < ELM_THUMB_ANIMATION_LAST; i++) + { + if (!strcmp(anim_str, choices[i])) + return i; + } + return ELM_THUMB_ANIMATION_LAST; +} + +static void +external_thumb_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Thumb *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->animate) + { + Elm_Thumb_Animation_Setting set = _anim_setting_get(p->animate); + if (set != ELM_THUMB_ANIMATION_LAST) + elm_thumb_animate_set(obj, set); + } +} + +static Eina_Bool +external_thumb_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "animate")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE) + { + Elm_Thumb_Animation_Setting set = _anim_setting_get(param->s); + if (set == ELM_THUMB_ANIMATION_LAST) return EINA_FALSE; + elm_thumb_animate_set(obj, set); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_thumb_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "animate")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE) + { + Elm_Thumb_Animation_Setting anim_set = elm_thumb_animate_get(obj); + + if (anim_set == ELM_THUMB_ANIMATION_LAST) + return EINA_FALSE; + + param->s = choices[anim_set]; + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_thumb_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params) +{ + Elm_Params_Thumb *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = calloc(1, sizeof(Elm_Params_Thumb)); + if (!mem) + return NULL; + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "animate")) + mem->animate = eina_stringshare_add(param->s); + } + + return mem; +} + +static Evas_Object *external_thumb_content_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("No content."); + return NULL; +} + +static void +external_thumb_params_free(void *params) +{ + Elm_Params_Thumb *mem = params; + + if (mem->animate) + eina_stringshare_del(mem->animate); + free(mem); +} + +static Edje_External_Param_Info external_thumb_params[] = + { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("animate", "loop", choices), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL + }; + +DEFINE_EXTERNAL_ICON_ADD(thumb, "thumb") + +static Evas_Object * +external_thumb_add(void *data __UNUSED__, Evas *evas __UNUSED__, Evas_Object *edje, const Eina_List *params __UNUSED__, const char *part_name) +{ + Evas_Object *parent, *obj; + external_elm_init(); + parent = elm_widget_parent_widget_get(edje); + if (!parent) parent = edje; + elm_need_ethumb(); /* extra command needed */ + obj = elm_thumb_add(parent); + external_signals_proxy(obj, edje, part_name); + return obj; +} +DEFINE_EXTERNAL_TYPE(thumb, "Thumbnail") diff --git a/libraries/elementary/src/edje_externals/elm_toolbar.c b/libraries/elementary/src/edje_externals/elm_toolbar.c new file mode 100644 index 0000000..a3fe781 --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_toolbar.c @@ -0,0 +1,311 @@ +#include + +#include "private.h" + +typedef struct _Elm_Params_Toolbar +{ + Elm_Params base; + int icon_size; + Eina_Bool icon_size_exists:1; + double align; + const char *shrink_mode; + Eina_Bool align_exists:1; + Eina_Bool always_select:1; + Eina_Bool always_select_exists:1; + Eina_Bool no_select:1; + Eina_Bool no_select_exists:1; + Eina_Bool horizontal:1; + Eina_Bool horizontal_exists:1; + Eina_Bool homogeneous:1; + Eina_Bool homogeneous_exists:1; +} Elm_Params_Toolbar; + +#define SHRINK_GET(CHOICES, STR) \ + unsigned int i; \ + for (i = 0; i < (sizeof(CHOICES) / sizeof(CHOICES[0])); ++i) \ + if (!strcmp(STR, CHOICES[i])) \ + return i; + +static const char *_toolbar_shrink_modes[] = {"none", "hide", + "scroll", "menu", NULL}; + +static Elm_Toolbar_Shrink_Mode +_toolbar_shrink_choices_setting_get(const char *shrink_mode_str) +{ + assert(sizeof(_toolbar_shrink_modes) / + sizeof(_toolbar_shrink_modes[0]) == ELM_TOOLBAR_SHRINK_LAST + 1); + SHRINK_GET(_toolbar_shrink_modes, shrink_mode_str); + return ELM_TOOLBAR_SHRINK_LAST; +} + +static void +external_toolbar_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Toolbar *p; + Elm_Toolbar_Shrink_Mode shrink_mode; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->icon_size_exists) + elm_toolbar_icon_size_set(obj, p->icon_size); + if (p->align_exists) + elm_toolbar_align_set(obj, p->align); + if (p->no_select_exists) + { + if (p->no_select) + elm_toolbar_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_NONE); + else + elm_toolbar_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_DEFAULT); + } + if (p->always_select_exists) + { + if (p->always_select) + elm_toolbar_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_ALWAYS); + else + elm_toolbar_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_DEFAULT); + } + if (p->horizontal_exists) + elm_toolbar_horizontal_set(obj, p->horizontal); + if (p->homogeneous_exists) + elm_toolbar_homogeneous_set(obj, p->homogeneous); + if (p->shrink_mode) + { + shrink_mode = _toolbar_shrink_choices_setting_get(p->shrink_mode); + elm_toolbar_shrink_mode_set(obj, shrink_mode); + } +} + +static Eina_Bool +external_toolbar_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + Elm_Toolbar_Shrink_Mode shrink_mode; + + if (!strcmp(param->name, "icon size")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT) + { + elm_toolbar_icon_size_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "align")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + elm_toolbar_align_set(obj, param->d); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "always select")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + if (param->i) + elm_toolbar_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_ALWAYS); + else + elm_toolbar_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_DEFAULT); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "no select")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + if (param->i) + elm_toolbar_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_NONE); + else + elm_toolbar_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_DEFAULT); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "horizontal")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_toolbar_horizontal_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "homogeneous")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_toolbar_homogeneous_set(obj, param->i); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "shrink")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + shrink_mode = _toolbar_shrink_choices_setting_get(param->s); + elm_toolbar_shrink_mode_set(obj, shrink_mode); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_toolbar_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "icon size")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT) + { + param->i = elm_toolbar_icon_size_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "align")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + param->d = elm_toolbar_align_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "always select")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + if (elm_toolbar_select_mode_get (obj) == + ELM_OBJECT_SELECT_MODE_ALWAYS) + param->d = EINA_TRUE; + else + param->d = EINA_FALSE; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "no select")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + if (elm_toolbar_select_mode_get (obj) == + ELM_OBJECT_SELECT_MODE_NONE) + param->i = EINA_TRUE; + else + param->i = EINA_FALSE; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "horizontal")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_toolbar_horizontal_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "homogeneous")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_toolbar_homogeneous_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "shrink")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + Elm_Toolbar_Shrink_Mode shrink_mode; + shrink_mode = elm_toolbar_shrink_mode_get(obj); + param->s = _toolbar_shrink_modes[shrink_mode]; + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_toolbar_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params) +{ + Elm_Params_Toolbar *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = calloc(1, sizeof(Elm_Params_Toolbar)); + if (!mem) + return NULL; + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "icon size")) + { + mem->icon_size = param->i; + mem->icon_size_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "align")) + { + mem->align = param->d; + mem->align_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "always select")) + { + mem->always_select = param->i; + mem->always_select_exists = param->i; + } + else if (!strcmp(param->name, "no select")) + { + mem->no_select = param->i; + mem->no_select_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "horizontal")) + { + mem->horizontal = param->i; + mem->horizontal_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "homogeneous")) + { + mem->homogeneous = param->i; + mem->homogeneous_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "shrink")) + mem->shrink_mode = eina_stringshare_add(param->s); + } + + return mem; +} + +static Evas_Object *external_toolbar_content_get(void *data __UNUSED__, + const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("No content."); + return NULL; +} + +static void +external_toolbar_params_free(void *params) +{ + Elm_Params_Toolbar *mem = params; + if (mem->shrink_mode) + eina_stringshare_del(mem->shrink_mode); + free(mem); +} + +static Edje_External_Param_Info external_toolbar_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, + EDJE_EXTERNAL_PARAM_INFO_STRING("shrink"), + EDJE_EXTERNAL_PARAM_INFO_INT("icon size"), + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("align"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("always select"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("no select"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("horizontal"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("homogeneous"), + + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(toolbar, "toolbar"); +DEFINE_EXTERNAL_TYPE_SIMPLE(toolbar, "Toolbar"); diff --git a/libraries/elementary/src/edje_externals/elm_video.c b/libraries/elementary/src/edje_externals/elm_video.c new file mode 100644 index 0000000..e869afe --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_video.c @@ -0,0 +1,261 @@ +#include "private.h" + +typedef struct _Elm_Params_Video +{ + Elm_Params base; + const char *file; + const char *uri; + Eina_Bool play:1; + Eina_Bool play_exists:1; + Eina_Bool pause:1; + Eina_Bool pause_exists:1; + Eina_Bool stop:1; + Eina_Bool stop_exists:1; + Eina_Bool audio_mute:1; + Eina_Bool audio_mute_exists:1; + double audio_level; + Eina_Bool audio_level_exists:1; + double play_position; + Eina_Bool play_position_exists:1; + Eina_Bool remember_position:1; + Eina_Bool remember_position_exists:1; +} Elm_Params_Video; + +static void +external_video_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Video *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->file) elm_video_file_set(obj, p->file); + if (p->uri) elm_video_file_set(obj, p->uri); + if (p->play_exists && p->play) elm_video_play(obj); + if (p->pause_exists && p->pause) elm_video_pause(obj); + if (p->stop_exists && p->stop) elm_video_stop(obj); + if (p->audio_mute_exists) elm_video_audio_mute_set(obj, p->audio_mute); + if (p->audio_level_exists) elm_video_audio_level_set(obj, p->audio_level); + if (p->play_position_exists) + elm_video_play_position_set(obj, p->play_position); + if (p->remember_position_exists) + elm_video_remember_position_set(obj, p->remember_position); +} + +static Eina_Bool +external_video_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + && (!strcmp(param->name, "file"))) + { + elm_video_file_set(obj, param->s); + return EINA_TRUE; + } + else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + && (!strcmp(param->name, "uri"))) + { + elm_video_file_set(obj, param->s); + return EINA_TRUE; + } + else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + && (!strcmp(param->name, "play"))) + { + if (param->i) + elm_video_play(obj); + return EINA_TRUE; + } + else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + && (!strcmp(param->name, "pause"))) + { + if (param->i) + elm_video_pause(obj); + return EINA_TRUE; + } + else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + && (!strcmp(param->name, "stop"))) + { + if (param->i) + elm_video_stop(obj); + return EINA_TRUE; + } + else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + && (!strcmp(param->name, "audio mute"))) + { + elm_video_audio_mute_set(obj, param->i); + return EINA_TRUE; + } + else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + && (!strcmp(param->name, "audio level"))) + { + elm_video_audio_level_set(obj, param->d); + return EINA_TRUE; + } + else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + && (!strcmp(param->name, "play position"))) + { + elm_video_play_position_set(obj, param->d); + return EINA_TRUE; + } + else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + && (!strcmp(param->name, "remember position"))) + { + elm_video_remember_position_set(obj, param->i); + return EINA_TRUE; + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_video_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + && (!strcmp(param->name, "file"))) + { + // param->s = elm_video_file_get(obj); + // return EINA_TRUE; + return EINA_FALSE; + } + else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + && (!strcmp(param->name, "uri"))) + { + // elm_video_uri_get(obj, param->s); + // return EINA_TRUE; + return EINA_FALSE; + } + else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + && (!strcmp(param->name, "play"))) + { + // param->i = elm_video_play_get(obj); return EINA_TRUE; + return EINA_FALSE; + } + else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + && (!strcmp(param->name, "pause"))) + { + // param->i = elm_video_pause_get(obj); return EINA_TRUE; + return EINA_FALSE; + } + else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + && (!strcmp(param->name, "stop"))) + { + // param->i = elm_video_stop_get(obj); return EINA_TRUE; + return EINA_FALSE; + } + else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + && (!strcmp(param->name, "audio mute"))) + { + param->i = elm_video_audio_mute_get(obj); + return EINA_TRUE; + } + else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) && + (!strcmp(param->name, "audio level"))) + { + param->d = elm_video_audio_level_get(obj); + return EINA_TRUE; + } + else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + && (!strcmp(param->name, "play position"))) + { + param->d = elm_video_play_position_get(obj); + return EINA_TRUE; + } + else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + && (!strcmp(param->name, "remember position"))) + { + param->i = elm_video_remember_position_get(obj); + return EINA_TRUE; + } + + ERR("unknown parameter '%s' of type '%s'", param->name, + edje_external_param_type_str(param->type)); + + return EINA_FALSE; } + +static void * external_video_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params) +{ + Elm_Params_Video *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = calloc(1, sizeof(Elm_Params_Video)); + if (!mem) return NULL; + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "file")) + mem->file = eina_stringshare_add(param->s); + else if (!strcmp(param->name, "uri")) + mem->uri = eina_stringshare_add(param->s); + else if (!strcmp(param->name, "play")) + { + mem->play = param->i; + mem->play_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "pause")) + { + mem->pause = param->i; + mem->pause_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "stop")) + { + mem->stop = param->i; + mem->stop_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "audio mute")) + { + mem->audio_mute = param->i; + mem->audio_mute_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "audio level")) + { + mem->audio_level = param->d; + mem->audio_level_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "play position")) + { + mem->play_position = param->d; + mem->play_position_exists = EINA_TRUE; + } + else if (!strcmp(param->name, "remember position")) + { + mem->remember_position = param->i; + mem->remember_position = EINA_TRUE; + } + } + return mem; +} + +static Evas_Object *external_video_content_get(void *data __UNUSED__, const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + ERR("No content."); + return NULL; +} + +static void external_video_params_free(void *params) +{ + Elm_Params_Video *mem = params; + + if (mem->file) eina_stringshare_del(mem->file); + if (mem->uri) eina_stringshare_del(mem->uri); + free(params); +} + +static Edje_External_Param_Info external_video_params[] = { + DEFINE_EXTERNAL_COMMON_PARAMS, EDJE_EXTERNAL_PARAM_INFO_STRING("file"), + EDJE_EXTERNAL_PARAM_INFO_STRING("uri"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("play"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("pause"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("stop"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("audio mute"), + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("audio level"), + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("play position"), + EDJE_EXTERNAL_PARAM_INFO_BOOL("remember position"), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +DEFINE_EXTERNAL_ICON_ADD(video, "video"); +DEFINE_EXTERNAL_TYPE_SIMPLE(video, "Video"); diff --git a/libraries/elementary/src/edje_externals/elm_web.c b/libraries/elementary/src/edje_externals/elm_web.c new file mode 100644 index 0000000..64fd373 --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_web.c @@ -0,0 +1,208 @@ +#include "private.h" + +typedef struct _Elm_Params_Web +{ + Elm_Params base; + const char *uri; + double zoom; + Elm_Web_Zoom_Mode zoom_mode; + Eina_Bool inwin_mode; + Eina_Bool zoom_set:1; + Eina_Bool inwin_mode_set:1; +} Elm_Params_Web; + +static const char *zoom_choices[] = {"manual", "auto fit", "auto fill", NULL}; + +static Elm_Web_Zoom_Mode +_zoom_mode_get(const char *zoom) +{ + unsigned int i; + + for (i = 0; i < ELM_WEB_ZOOM_MODE_LAST; i++) + if (!strcmp(zoom, zoom_choices[i])) return i; + + return ELM_WEB_ZOOM_MODE_LAST; +} + +static void +external_web_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) +{ + const Elm_Params_Web *p; + + if (to_params) p = to_params; + else if (from_params) p = from_params; + else return; + + if (p->uri) + elm_web_uri_set(obj, p->uri); + if (p->zoom_mode < ELM_WEB_ZOOM_MODE_LAST) + elm_web_zoom_mode_set(obj, p->zoom_mode); + if (p->zoom_set) + elm_web_zoom_set(obj, p->zoom); + if (p->inwin_mode_set) + elm_web_inwin_mode_set(obj, p->inwin_mode); +} + +static Eina_Bool +external_web_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param) +{ + if (!strcmp(param->name, "uri")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + elm_web_uri_set(obj, param->s); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "zoom level")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + elm_web_zoom_set(obj, param->d); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "zoom mode")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE) + { + Elm_Web_Zoom_Mode mode = _zoom_mode_get(param->s); + if (mode == ELM_WEB_ZOOM_MODE_LAST) + return EINA_FALSE; + elm_web_zoom_mode_set(obj, mode); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "inwin mode")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + elm_web_inwin_mode_set(obj, !!param->i); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static Eina_Bool +external_web_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param) +{ + if (!strcmp(param->name, "uri")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) + { + param->s = elm_web_uri_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "zoom level")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + { + param->d = elm_web_zoom_get(obj); + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "zoom mode")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE) + { + Elm_Web_Zoom_Mode mode = elm_web_zoom_mode_get(obj); + if (mode == ELM_WEB_ZOOM_MODE_LAST) + return EINA_FALSE; + param->s = zoom_choices[mode]; + return EINA_TRUE; + } + } + else if (!strcmp(param->name, "inwin mode")) + { + if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + { + param->i = elm_web_inwin_mode_get(obj); + return EINA_TRUE; + } + } + + ERR("unknown parameter '%s' of type '%s'", + param->name, edje_external_param_type_str(param->type)); + + return EINA_FALSE; +} + +static void * +external_web_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params) +{ + Elm_Params_Web *mem; + Edje_External_Param *param; + const Eina_List *l; + + mem = calloc(1, sizeof(Elm_Params_Web)); + if (!mem) return NULL; + + mem->zoom_mode = ELM_WEB_ZOOM_MODE_LAST; + + EINA_LIST_FOREACH(params, l, param) + { + if (!strcmp(param->name, "zoom level")) + { + mem->zoom = param->d; + mem->zoom_set = EINA_TRUE; + } + else if (!strcmp(param->name, "zoom mode")) + mem->zoom_mode = _zoom_mode_get(param->s); + else if (!strcmp(param->name, "uri")) + mem->uri = eina_stringshare_add(param->s); + else if (!strcmp(param->name, "inwin mode")) + { + mem->inwin_mode = !!param->i; + mem->inwin_mode_set = EINA_TRUE; + } + } + + return mem; +} + +static void +external_web_params_free(void *params) +{ + Elm_Params_Web *mem = params; + + if (mem->uri) + eina_stringshare_del(mem->uri); + free(mem); +} + +static Evas_Object * +external_web_content_get(void *data __UNUSED__, const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) +{ + return NULL; +} + +static Edje_External_Param_Info external_web_params[] = +{ + EDJE_EXTERNAL_PARAM_INFO_STRING("uri"), + EDJE_EXTERNAL_PARAM_INFO_DOUBLE_DEFAULT("zoom level", 1.0), + EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("zoom mode", "manual", zoom_choices), + EDJE_EXTERNAL_PARAM_INFO_BOOL_DEFAULT("inwin mode", EINA_FALSE), + EDJE_EXTERNAL_PARAM_INFO_SENTINEL +}; + +static Evas_Object * +external_web_add(void *data __UNUSED__, Evas *evas __UNUSED__, Evas_Object *edje, const Eina_List *params __UNUSED__, const char *part_name) +{ + Evas_Object *parent, *obj; + external_elm_init(); + parent = elm_widget_parent_widget_get(edje); + if (!parent) parent = edje; + elm_need_web(); /* extra command needed */ + obj = elm_web_add(parent); + external_signals_proxy(obj, edje, part_name); + return obj; +} + +DEFINE_EXTERNAL_ICON_ADD(web, "web") +DEFINE_EXTERNAL_TYPE(web, "Web") diff --git a/libraries/elementary/src/edje_externals/modules.inc b/libraries/elementary/src/edje_externals/modules.inc new file mode 100644 index 0000000..81e804d --- /dev/null +++ b/libraries/elementary/src/edje_externals/modules.inc @@ -0,0 +1,35 @@ +DEFINE_TYPE(actionslider) +DEFINE_TYPE(bubble) +DEFINE_TYPE(button) +DEFINE_TYPE(calendar) +DEFINE_TYPE(check) +DEFINE_TYPE(clock) +DEFINE_TYPE(entry) +DEFINE_TYPE(fileselector) +DEFINE_TYPE(fileselector_button) +DEFINE_TYPE(fileselector_entry) +DEFINE_TYPE(frame) +DEFINE_TYPE(gengrid) +DEFINE_TYPE(genlist) +DEFINE_TYPE(hoversel) +DEFINE_TYPE(icon) +DEFINE_TYPE(index) +DEFINE_TYPE(label) +DEFINE_TYPE(list) +DEFINE_TYPE(map) +DEFINE_TYPE(multibuttonentry) +DEFINE_TYPE(naviframe) +DEFINE_TYPE(notify) +DEFINE_TYPE(panes) +DEFINE_TYPE(photocam) +DEFINE_TYPE(progressbar) +DEFINE_TYPE(radio) +DEFINE_TYPE(scroller) +DEFINE_TYPE(segment_control) +DEFINE_TYPE(slider) +DEFINE_TYPE(slideshow) +DEFINE_TYPE(spinner) +DEFINE_TYPE(thumb) +DEFINE_TYPE(toolbar) +DEFINE_TYPE(video) +DEFINE_TYPE(web) diff --git a/libraries/elementary/src/edje_externals/private.h b/libraries/elementary/src/edje_externals/private.h new file mode 100644 index 0000000..4d63b0c --- /dev/null +++ b/libraries/elementary/src/edje_externals/private.h @@ -0,0 +1,135 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include "Elementary.h" +#include "elm_priv.h" + +#undef CRITICAL +#undef ERR +#undef WRN +#undef INF +#undef DBG + +#define CRITICAL(...) EINA_LOG_DOM_CRIT(_elm_ext_log_dom, __VA_ARGS__) +#define ERR(...) EINA_LOG_DOM_ERR (_elm_ext_log_dom, __VA_ARGS__) +#define WRN(...) EINA_LOG_DOM_WARN(_elm_ext_log_dom, __VA_ARGS__) +#define INF(...) EINA_LOG_DOM_INFO(_elm_ext_log_dom, __VA_ARGS__) +#define DBG(...) EINA_LOG_DOM_DBG (_elm_ext_log_dom, __VA_ARGS__) + +typedef struct { + const char *style; + Eina_Bool disabled:1; + Eina_Bool disabled_exists:1; +} Elm_Params; + +extern int _elm_ext_log_dom; + +void external_elm_init(void); +void external_signal(void *data, Evas_Object *obj, const char *signal, const char *source); +void external_signals_proxy(Evas_Object *obj, Evas_Object *edje, const char *part_name); +const char *external_translate(void *data, const char *orig); +void external_common_params_free(void *params); +void *external_common_params_parse_internal(size_t params_size, void *data, Evas_Object *obj, const Eina_List *params); +Evas_Object *external_common_param_icon_get(Evas_Object *obj, const Edje_External_Param *param); +Evas_Object *external_common_param_edje_object_get(Evas_Object *obj, const Edje_External_Param *p); +void external_common_icon_param_parse(Evas_Object **icon, Evas_Object *obj, const Eina_List *params); +Eina_Bool external_common_param_get(void *data, const Evas_Object *obj, Edje_External_Param *param); +Eina_Bool external_common_param_set(void *data, Evas_Object *obj, const Edje_External_Param *param); +void external_common_state_set(void *data, Evas_Object *obj, const void *from_params, const void *to_params, float pos); +void external_common_params_parse(void *mem, void *data, Evas_Object *obj, const Eina_List *params); + +#define DEFINE_EXTERNAL_TYPE(type_name, name) \ +static Eina_Bool \ +_external_##type_name##_param_set(void *data, Evas_Object *obj, const Edje_External_Param *param) \ +{ \ + if (external_common_param_set(data, obj, param)) \ + return EINA_TRUE; \ + return external_##type_name##_param_set(data, obj, param); \ +} \ +static Eina_Bool \ +_external_##type_name##_param_get(void *data, const Evas_Object *obj, Edje_External_Param *param) \ +{ \ + if (external_common_param_get(data, obj, param)) \ + return EINA_TRUE; \ + return external_##type_name##_param_get(data, obj, param); \ +} \ +static const char * \ +external_##type_name##_label_get(void *data __UNUSED__) \ +{ \ + return name; \ +} \ + \ +static void \ +_external_##type_name##_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) \ +{ \ + external_common_state_set(data, obj, from_params, to_params, pos); \ + external_##type_name##_state_set(data, obj, from_params, to_params, pos); \ +} \ + \ +static void * \ +_external_##type_name##_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params) \ +{ \ + void *mem = external_##type_name##_params_parse(data, obj, params); \ + external_common_params_parse(mem, data, obj, params); \ + return mem; \ +} \ +static void \ +_external_##type_name##_params_free(void *params) \ +{ \ + external_common_params_free(params); \ + external_##type_name##_params_free(params); \ +} \ + \ +const Edje_External_Type external_##type_name##_type = {\ + .abi_version = EDJE_EXTERNAL_TYPE_ABI_VERSION, \ + .module = "elm", \ + .module_name = "Elementary", \ + .add = external_##type_name##_add, \ + .state_set = _external_##type_name##_state_set, \ + .signal_emit = external_signal, \ + .param_set = _external_##type_name##_param_set, \ + .param_get = _external_##type_name##_param_get, \ + .params_parse = _external_##type_name##_params_parse,\ + .params_free = _external_##type_name##_params_free, \ + .label_get = external_##type_name##_label_get, \ + .content_get = external_##type_name##_content_get, \ + .description_get = NULL, \ + .icon_add = external_##type_name##_icon_add, \ + .preview_add = NULL, \ + .translate = external_translate, \ + .parameters_info = external_##type_name##_params, \ + .data = NULL \ +}; + +#define DEFINE_EXTERNAL_TYPE_SIMPLE(type_name, name) \ +static Evas_Object * \ +external_##type_name##_add(void *data __UNUSED__, Evas *evas __UNUSED__, Evas_Object *edje, const Eina_List *params __UNUSED__, const char *part_name) \ +{ \ + Evas_Object *parent, *obj; \ + external_elm_init(); \ + parent = elm_widget_parent_widget_get(edje); \ + if (!parent) parent = edje; \ + obj = elm_##type_name##_add(parent); \ + external_signals_proxy(obj, edje, part_name); \ + return obj; \ +} \ + \ +DEFINE_EXTERNAL_TYPE(type_name, name) + +#define DEFINE_EXTERNAL_ICON_ADD(type_name, name) \ +Evas_Object * \ +external_##type_name##_icon_add(void *data __UNUSED__, Evas *e) { \ + Evas_Object *ic; \ + int w = 20, h = 10; \ + \ + ic = edje_object_add(e); \ + edje_object_file_set(ic, PACKAGE_DATA_DIR"/edje_externals/icons.edj", "ico_"name);\ + evas_object_size_hint_min_set(ic, w, h); \ + evas_object_size_hint_max_set(ic, w, h); \ + \ + return ic; \ +} + +#define DEFINE_EXTERNAL_COMMON_PARAMS \ + EDJE_EXTERNAL_PARAM_INFO_STRING_DEFAULT("style", "default"), \ + EDJE_EXTERNAL_PARAM_INFO_BOOL_DEFAULT("disabled", EINA_FALSE) diff --git a/libraries/elementary/src/examples/Makefile.am b/libraries/elementary/src/examples/Makefile.am new file mode 100644 index 0000000..966d64a --- /dev/null +++ b/libraries/elementary/src/examples/Makefile.am @@ -0,0 +1,361 @@ +MAINTAINERCLEANFILES = Makefile.in + +.PHONY: screenshots + +examplesdir = $(pkgdatadir)/examples +filesdir = $(pkgdatadir)/examples +files_DATA = + +AM_CPPFLAGS = \ +-Wno-unused-parameter \ +-I. \ +-I$(top_srcdir)/src/lib \ +-I$(top_builddir)/src/lib \ +-DPACKAGE_DATA_DIR="\"$(pkgdatadir)\"" \ +-DPACKAGE_BIN_DIR=\"$(bindir)\" \ +-DPACKAGE_LIB_DIR=\"$(libdir)\" \ +@ELEMENTARY_EDBUS_CFLAGS@ \ +@ELEMENTARY_EFREET_CFLAGS@ \ +@ELEMENTARY_ETHUMB_CFLAGS@ \ +@ELEMENTARY_EMAP_CFLAGS@ \ +@ELEMENTARY_X_CFLAGS@ \ +@ELEMENTARY_CFLAGS@ + +LDADD = \ +@ELEMENTARY_LIBS@ \ +@ELEMENTARY_ETHUMB_LIBS@ \ +@ELEMENTARY_X_LIBS@ \ +$(top_builddir)/src/lib/libelementary.la + +EDJE_CC = @edje_cc@ +EDJE_FLAGS_VERBOSE_ = +EDJE_FLAGS_VERBOSE_0 = +EDJE_FLAGS_VERBOSE_1 = -v +EDJE_FLAGS = $(EDJE_FLAGS_$(V)) + +SRCS = \ +actionslider_example_01.c \ +bg_example_01.c \ +bg_example_02.c \ +bg_example_03.c \ +box_example_02.c \ +bubble_example_01.c \ +button_example_00.c \ +button_example_01.c \ +calendar_example_01.c \ +calendar_example_02.c \ +calendar_example_03.c \ +calendar_example_04.c \ +calendar_example_05.c \ +calendar_example_06.c \ +check_example_01.c \ +clock_example.c \ +colorselector_example_01.c \ +conformant_example_01.c \ +conformant_example_02.c \ +ctxpopup_example_01.c \ +datetime_example.c \ +dayselector_example.c \ +diskselector_example_01.c \ +diskselector_example_02.c \ +efl_thread_1.c \ +efl_thread_2.c \ +efl_thread_3.c \ +efl_thread_4.c \ +efl_thread_5.c \ +efl_thread_6.c \ +efl_thread_win32_1.c \ +efl_thread_win32_2.c \ +efl_thread_win32_3.c \ +efl_thread_win32_4.c \ +entry_example.c \ +fileselector_button_example.c \ +fileselector_entry_example.c \ +fileselector_example.c \ +flip_example_01.c \ +flipselector_example.c \ +frame_example_01.c \ +general_funcs_example.c \ +gengrid_example.c \ +genlist_example_01.c \ +genlist_example_02.c \ +genlist_example_03.c \ +genlist_example_04.c \ +genlist_example_05.c \ +hover_example_01.c \ +hoversel_example_01.c \ +icon_example_01.c \ +image_example_01.c \ +index_example_01.c \ +index_example_02.c \ +inwin_example.c \ +label_example_01.c \ +layout_example.edc \ +layout_example_01.c \ +layout_example_02.c \ +layout_example_03.c \ +list_example_01.c \ +list_example_02.c \ +list_example_03.c \ +map_example_01.c \ +map_example_02.c \ +map_example_03.c \ +mapbuf_example.c \ +menu_example_01.c \ +notify_example_01.c \ +panes_example.c \ +panel_example_01.c \ +photocam_example_01.c \ +popup_example_01.c \ +popup_example_02.c \ +popup_example_03.c \ +progressbar_example.c \ +radio_example_01.c \ +segment_control_example.c \ +separator_example_01.c \ +slider_example.c \ +slideshow_example.c \ +spinner_example.c \ +scroller_example_01.c \ +table_example_01.c \ +table_example_02.c \ +theme_example.edc \ +theme_example_01.c \ +theme_example_02.c \ +thumb_example_01.c \ +toolbar_example_01.c \ +toolbar_example_02.c \ +toolbar_example_03.c \ +transit_example_01.c \ +transit_example_02.c \ +transit_example_03.c \ +transit_example_04.c \ +web_example.c \ +win_example.c + +.edc.edj: + $(EDJE_CC) $(EDJE_FLAGS) $< $@ + +if EFL_INSTALL_EXAMPLES +files_DATA += $(SRCS) \ + dict.txt +endif + +if EFL_BUILD_EXAMPLES +files_DATA += \ + theme_example.edj \ + layout_example.edj + +clean-local: + rm -f *.edj + +examples_PROGRAMS = \ +actionslider_example_01 \ +bg_example_01 \ +bg_example_02 \ +bg_example_03 \ +box_example_02 \ +bubble_example_01 \ +button_example_00 \ +button_example_01 \ +calendar_example_01 \ +calendar_example_02 \ +calendar_example_03 \ +calendar_example_04 \ +calendar_example_05 \ +calendar_example_06 \ +check_example_01 \ +clock_example \ +colorselector_example_01 \ +conformant_example_01 \ +conformant_example_02 \ +ctxpopup_example_01 \ +datetime_example \ +dayselector_example \ +diskselector_example_01 \ +diskselector_example_02 \ +efl_thread_1 \ +efl_thread_2 \ +efl_thread_3 \ +efl_thread_4 \ +efl_thread_5 \ +efl_thread_6 \ +entry_example \ +fileselector_button_example \ +fileselector_entry_example \ +fileselector_example \ +flip_example_01 \ +flipselector_example \ +frame_example_01 \ +general_funcs_example \ +gengrid_example \ +genlist_example_01 \ +genlist_example_02 \ +genlist_example_03 \ +genlist_example_04 \ +genlist_example_05 \ +hover_example_01 \ +hoversel_example_01 \ +icon_example_01 \ +image_example_01 \ +index_example_01 \ +index_example_02 \ +inwin_example \ +label_example_01 \ +layout_example_01 \ +layout_example_02 \ +layout_example_03 \ +list_example_01 \ +list_example_02 \ +list_example_03 \ +map_example_01 \ +map_example_02 \ +map_example_03 \ +mapbuf_example \ +menu_example_01 \ +notify_example_01 \ +panes_example \ +panel_example_01 \ +photocam_example_01 \ +popup_example_01 \ +popup_example_02 \ +popup_example_03 \ +progressbar_example \ +radio_example_01 \ +segment_control_example \ +separator_example_01 \ +slider_example \ +slideshow_example \ +spinner_example \ +scroller_example_01 \ +table_example_01 \ +table_example_02 \ +theme_example_01 \ +theme_example_02 \ +thumb_example_01 \ +toolbar_example_01 \ +toolbar_example_02 \ +toolbar_example_03 \ +transit_example_01 \ +transit_example_02 \ +transit_example_03 \ +transit_example_04 \ +web_example \ +win_example + +if ELEMENTARY_WINDOWS_BUILD +efl_thread_1_SOURCES = efl_thread_win32_1.c +efl_thread_2_SOURCES = efl_thread_win32_2.c +efl_thread_3_SOURCES = efl_thread_win32_3.c +efl_thread_4_SOURCES = efl_thread_win32_4.c +else +efl_thread_1_SOURCES = efl_thread_1.c +efl_thread_2_SOURCES = efl_thread_2.c +efl_thread_3_SOURCES = efl_thread_3.c +efl_thread_4_SOURCES = efl_thread_4.c +endif + +# This variable will hold the list of screenshots that will be made +# by "make screenshots". Each item in the list is of the form: +# :: +SCREENSHOTS = \ +actionslider_example_01:actionslider_01.png:0.0 \ +bg_example_02:bg_01.png:0.0 \ +box_example_02:box_example_02.png:1.3 \ +bubble_example_01:bubble_example_01.png:0.0 \ +button_example_00:button_00.png:0.0 \ +button_example_01:button_01.png:0.0 \ +check_example_01:check_example_01.png:0.0 \ +colorselector_example_01:colorselector_example_01.png:0.0 \ +animator_example_01:animator_example_01.png:0.2 \ +animator_example_01:animator_example_02.png:0.5 \ +animator_example_01:animator_example_03.png:0.9 \ +flip_example_01:flip_example_01.png:0.0 \ +frame_example_01:frame_example_01.png:0.0 \ +hover_example_01:hover_example_01.png:0.0 \ +hoversel_example_01:hoversel_example_01.png:0.0 \ +label_example_01:label_example_01.png:0.0 \ +theme_example_01:theme_example_01.png:0.0 \ +conformant_example_01:conformant_example_01.png:0.0 \ +conformant_example_02:conformant_example_02.png:0.0 \ +calendar_example_01:calendar_example_01.png:0.0 \ +calendar_example_02:calendar_example_02.png:0.0 \ +calendar_example_03:calendar_example_03.png:0.0 \ +calendar_example_04:calendar_example_04.png:0.0 \ +calendar_example_05:calendar_example_05.png:0.0 \ +calendar_example_06:calendar_example_06.png:0.0 \ +datetime_example:datetime_example.png:0.0 \ +map_example_01:map_example_01.png:2 \ +map_example_02:map_example_02.png:2.5 \ +map_example_03:map_example_03.png:2 \ +toolbar_example_01:toolbar_example_01.png:0.0 \ +toolbar_example_02:toolbar_example_02.png:1 \ +toolbar_example_03:toolbar_example_03.png:1 \ +spinner_example:spinner_example.png:0.0 \ +clock_example:clock_example.png:0.5 \ +dayselector_example:dayselector_example.png:0.0 \ +mapbuf_example:mapbuf_example.png:0.0 \ +image_example_01:image_example_01.png:0.0 \ +diskselector_example_01:diskselector_example_01.png:0.2 \ +diskselector_example_02:diskselector_example_02.png:0.2 \ +icon_example_01:icon_example_01.png:0.0 \ +layout_example_01:layout_example_01.png:0.0 \ +layout_example_02:layout_example_02.png:0.0 \ +layout_example_03:layout_example_03.png:0.0 \ +list_example_01:list_example_01.png:0.0 \ +list_example_02:list_example_02.png:0.0 \ +list_example_03:list_example_03.png:0.0 \ +segment_control_example:segment_control_example.png:0.0 \ +flipselector_example:flipselector_example.png:0.0 \ +fileselector_example:fileselector_example.png:0.0 \ +index_example_02:index_example_03.png:0.3 \ +slider_example:slider_example.png:0.0 \ +panes_example:panes_example.png:0.0 \ +ctxpopup_example_01:ctxpopup_example_01.png:0.0 \ +separator_example_01:separator_example_01.png:0.0 \ +radio_example_01:radio_example_01.png:0.0 \ +panel_example_01:panel_example_01.png:0.0 \ +gengrid_example:gengrid_example.png:0.0 \ +genlist_example_01:genlist_example_01.png:0.1 \ +genlist_example_02:genlist_example_02.png:0.1 \ +genlist_example_03:genlist_example_03.png:0.1 \ +genlist_example_04:genlist_example_04.png:0.1 \ +genlist_example_05:genlist_example_05.png:0.1 \ +thumb_example_01:thumb_example_01.png:0.5 \ +entry_example:entry_example.png:0.0 \ +progressbar_example:progressbar_example.png:0.0 \ +notify_example_01:notify_example_01.png:0.0 \ +notify_example_01:notify_example_01_a.png:6.0 \ +popup_example_01:popup_example_01.png:1.0 \ +popup_example_01:popup_example_01_a.png:6.0 \ +popup_example_02:popup_example_02.png:0.2 \ +popup_example_03:popup_example_03.png:0.2 \ +slideshow_example:slideshow_example.png:1.0 \ +photocam_example_01:photocam_example_01.png:3 \ +scroller_example_01:scroller_example_01.png:0.0 \ +inwin_example:inwin_example.png:0.0 \ +inwin_example:inwin_example_a.png:0.2 \ +table_example_01:table_example_01.png:0.0 \ +table_example_02:table_example_02.png:0.0 \ +menu_example_01:menu_example_01.png:0.5 + +HTML_SS_DIR=$(top_builddir)/doc/html/screenshots +LATEX_SS_DIR=$(top_builddir)/doc/latex/screenshots +screenshots: all + @mkdir -p $(HTML_SS_DIR) + @mkdir -p $(LATEX_SS_DIR) + @for ss in $(SCREENSHOTS); do \ + SS_ENTRY=($${ss//:/ }) ; \ + EXAMPLE=$${SS_ENTRY[0]} ; \ + SS_FILE=$${SS_ENTRY[1]} ; \ + SS_DELAY=$${SS_ENTRY[2]} ; \ + ILLUME_KBD=0,0,240,123 ILLUME_IND=0,0,240,32 ILLUME_STK=0,288,240,32 ELM_ENGINE="shot:delay=$${SS_DELAY}:file=$(HTML_SS_DIR)/$${SS_FILE}" ./$${EXAMPLE} ; \ + convert $(HTML_SS_DIR)/$${SS_FILE} $(LATEX_SS_DIR)/$${SS_FILE/.png/.eps} ; \ + done + +else + +screenshots: + @echo "Examples are not built. Run \"./configure --enable-build-examples\" first." + +endif diff --git a/libraries/elementary/src/examples/Makefile.in b/libraries/elementary/src/examples/Makefile.in new file mode 100644 index 0000000..d75244c --- /dev/null +++ b/libraries/elementary/src/examples/Makefile.in @@ -0,0 +1,1909 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@EFL_INSTALL_EXAMPLES_TRUE@am__append_1 = $(SRCS) \ +@EFL_INSTALL_EXAMPLES_TRUE@ dict.txt + +@EFL_BUILD_EXAMPLES_TRUE@am__append_2 = \ +@EFL_BUILD_EXAMPLES_TRUE@ theme_example.edj \ +@EFL_BUILD_EXAMPLES_TRUE@ layout_example.edj + +@EFL_BUILD_EXAMPLES_TRUE@examples_PROGRAMS = \ +@EFL_BUILD_EXAMPLES_TRUE@ actionslider_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ bg_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ bg_example_02$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ bg_example_03$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ box_example_02$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ bubble_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ button_example_00$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ button_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ calendar_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ calendar_example_02$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ calendar_example_03$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ calendar_example_04$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ calendar_example_05$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ calendar_example_06$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ check_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ clock_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ colorselector_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ conformant_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ conformant_example_02$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ ctxpopup_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ datetime_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ dayselector_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ diskselector_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ diskselector_example_02$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ efl_thread_1$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ efl_thread_2$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ efl_thread_3$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ efl_thread_4$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ efl_thread_5$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ efl_thread_6$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ entry_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ fileselector_button_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ fileselector_entry_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ fileselector_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ flip_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ flipselector_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ frame_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ general_funcs_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ gengrid_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ genlist_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ genlist_example_02$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ genlist_example_03$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ genlist_example_04$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ genlist_example_05$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ hover_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ hoversel_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ icon_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ image_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ index_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ index_example_02$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ inwin_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ label_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ layout_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ layout_example_02$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ layout_example_03$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ list_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ list_example_02$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ list_example_03$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ map_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ map_example_02$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ map_example_03$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ mapbuf_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ menu_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ notify_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ panes_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ panel_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ photocam_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ popup_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ popup_example_02$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ popup_example_03$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ progressbar_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ radio_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ segment_control_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ separator_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ slider_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ slideshow_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ spinner_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ scroller_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ table_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ table_example_02$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ theme_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ theme_example_02$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ thumb_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ toolbar_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ toolbar_example_02$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ toolbar_example_03$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ transit_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ transit_example_02$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ transit_example_03$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ transit_example_04$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ web_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ win_example$(EXEEXT) +subdir = src/examples +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/efl_binary.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/elementary_config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(examplesdir)" "$(DESTDIR)$(filesdir)" +PROGRAMS = $(examples_PROGRAMS) +actionslider_example_01_SOURCES = actionslider_example_01.c +actionslider_example_01_OBJECTS = actionslider_example_01.$(OBJEXT) +actionslider_example_01_LDADD = $(LDADD) +actionslider_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +bg_example_01_SOURCES = bg_example_01.c +bg_example_01_OBJECTS = bg_example_01.$(OBJEXT) +bg_example_01_LDADD = $(LDADD) +bg_example_01_DEPENDENCIES = $(top_builddir)/src/lib/libelementary.la +bg_example_02_SOURCES = bg_example_02.c +bg_example_02_OBJECTS = bg_example_02.$(OBJEXT) +bg_example_02_LDADD = $(LDADD) +bg_example_02_DEPENDENCIES = $(top_builddir)/src/lib/libelementary.la +bg_example_03_SOURCES = bg_example_03.c +bg_example_03_OBJECTS = bg_example_03.$(OBJEXT) +bg_example_03_LDADD = $(LDADD) +bg_example_03_DEPENDENCIES = $(top_builddir)/src/lib/libelementary.la +box_example_02_SOURCES = box_example_02.c +box_example_02_OBJECTS = box_example_02.$(OBJEXT) +box_example_02_LDADD = $(LDADD) +box_example_02_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +bubble_example_01_SOURCES = bubble_example_01.c +bubble_example_01_OBJECTS = bubble_example_01.$(OBJEXT) +bubble_example_01_LDADD = $(LDADD) +bubble_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +button_example_00_SOURCES = button_example_00.c +button_example_00_OBJECTS = button_example_00.$(OBJEXT) +button_example_00_LDADD = $(LDADD) +button_example_00_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +button_example_01_SOURCES = button_example_01.c +button_example_01_OBJECTS = button_example_01.$(OBJEXT) +button_example_01_LDADD = $(LDADD) +button_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +calendar_example_01_SOURCES = calendar_example_01.c +calendar_example_01_OBJECTS = calendar_example_01.$(OBJEXT) +calendar_example_01_LDADD = $(LDADD) +calendar_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +calendar_example_02_SOURCES = calendar_example_02.c +calendar_example_02_OBJECTS = calendar_example_02.$(OBJEXT) +calendar_example_02_LDADD = $(LDADD) +calendar_example_02_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +calendar_example_03_SOURCES = calendar_example_03.c +calendar_example_03_OBJECTS = calendar_example_03.$(OBJEXT) +calendar_example_03_LDADD = $(LDADD) +calendar_example_03_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +calendar_example_04_SOURCES = calendar_example_04.c +calendar_example_04_OBJECTS = calendar_example_04.$(OBJEXT) +calendar_example_04_LDADD = $(LDADD) +calendar_example_04_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +calendar_example_05_SOURCES = calendar_example_05.c +calendar_example_05_OBJECTS = calendar_example_05.$(OBJEXT) +calendar_example_05_LDADD = $(LDADD) +calendar_example_05_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +calendar_example_06_SOURCES = calendar_example_06.c +calendar_example_06_OBJECTS = calendar_example_06.$(OBJEXT) +calendar_example_06_LDADD = $(LDADD) +calendar_example_06_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +check_example_01_SOURCES = check_example_01.c +check_example_01_OBJECTS = check_example_01.$(OBJEXT) +check_example_01_LDADD = $(LDADD) +check_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +clock_example_SOURCES = clock_example.c +clock_example_OBJECTS = clock_example.$(OBJEXT) +clock_example_LDADD = $(LDADD) +clock_example_DEPENDENCIES = $(top_builddir)/src/lib/libelementary.la +colorselector_example_01_SOURCES = colorselector_example_01.c +colorselector_example_01_OBJECTS = colorselector_example_01.$(OBJEXT) +colorselector_example_01_LDADD = $(LDADD) +colorselector_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +conformant_example_01_SOURCES = conformant_example_01.c +conformant_example_01_OBJECTS = conformant_example_01.$(OBJEXT) +conformant_example_01_LDADD = $(LDADD) +conformant_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +conformant_example_02_SOURCES = conformant_example_02.c +conformant_example_02_OBJECTS = conformant_example_02.$(OBJEXT) +conformant_example_02_LDADD = $(LDADD) +conformant_example_02_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +ctxpopup_example_01_SOURCES = ctxpopup_example_01.c +ctxpopup_example_01_OBJECTS = ctxpopup_example_01.$(OBJEXT) +ctxpopup_example_01_LDADD = $(LDADD) +ctxpopup_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +datetime_example_SOURCES = datetime_example.c +datetime_example_OBJECTS = datetime_example.$(OBJEXT) +datetime_example_LDADD = $(LDADD) +datetime_example_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +dayselector_example_SOURCES = dayselector_example.c +dayselector_example_OBJECTS = dayselector_example.$(OBJEXT) +dayselector_example_LDADD = $(LDADD) +dayselector_example_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +diskselector_example_01_SOURCES = diskselector_example_01.c +diskselector_example_01_OBJECTS = diskselector_example_01.$(OBJEXT) +diskselector_example_01_LDADD = $(LDADD) +diskselector_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +diskselector_example_02_SOURCES = diskselector_example_02.c +diskselector_example_02_OBJECTS = diskselector_example_02.$(OBJEXT) +diskselector_example_02_LDADD = $(LDADD) +diskselector_example_02_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +am__efl_thread_1_SOURCES_DIST = efl_thread_1.c efl_thread_win32_1.c +@EFL_BUILD_EXAMPLES_TRUE@@ELEMENTARY_WINDOWS_BUILD_FALSE@am_efl_thread_1_OBJECTS = efl_thread_1.$(OBJEXT) +@EFL_BUILD_EXAMPLES_TRUE@@ELEMENTARY_WINDOWS_BUILD_TRUE@am_efl_thread_1_OBJECTS = efl_thread_win32_1.$(OBJEXT) +efl_thread_1_OBJECTS = $(am_efl_thread_1_OBJECTS) +efl_thread_1_LDADD = $(LDADD) +efl_thread_1_DEPENDENCIES = $(top_builddir)/src/lib/libelementary.la +am__efl_thread_2_SOURCES_DIST = efl_thread_2.c efl_thread_win32_2.c +@EFL_BUILD_EXAMPLES_TRUE@@ELEMENTARY_WINDOWS_BUILD_FALSE@am_efl_thread_2_OBJECTS = efl_thread_2.$(OBJEXT) +@EFL_BUILD_EXAMPLES_TRUE@@ELEMENTARY_WINDOWS_BUILD_TRUE@am_efl_thread_2_OBJECTS = efl_thread_win32_2.$(OBJEXT) +efl_thread_2_OBJECTS = $(am_efl_thread_2_OBJECTS) +efl_thread_2_LDADD = $(LDADD) +efl_thread_2_DEPENDENCIES = $(top_builddir)/src/lib/libelementary.la +am__efl_thread_3_SOURCES_DIST = efl_thread_3.c efl_thread_win32_3.c +@EFL_BUILD_EXAMPLES_TRUE@@ELEMENTARY_WINDOWS_BUILD_FALSE@am_efl_thread_3_OBJECTS = efl_thread_3.$(OBJEXT) +@EFL_BUILD_EXAMPLES_TRUE@@ELEMENTARY_WINDOWS_BUILD_TRUE@am_efl_thread_3_OBJECTS = efl_thread_win32_3.$(OBJEXT) +efl_thread_3_OBJECTS = $(am_efl_thread_3_OBJECTS) +efl_thread_3_LDADD = $(LDADD) +efl_thread_3_DEPENDENCIES = $(top_builddir)/src/lib/libelementary.la +am__efl_thread_4_SOURCES_DIST = efl_thread_4.c efl_thread_win32_4.c +@EFL_BUILD_EXAMPLES_TRUE@@ELEMENTARY_WINDOWS_BUILD_FALSE@am_efl_thread_4_OBJECTS = efl_thread_4.$(OBJEXT) +@EFL_BUILD_EXAMPLES_TRUE@@ELEMENTARY_WINDOWS_BUILD_TRUE@am_efl_thread_4_OBJECTS = efl_thread_win32_4.$(OBJEXT) +efl_thread_4_OBJECTS = $(am_efl_thread_4_OBJECTS) +efl_thread_4_LDADD = $(LDADD) +efl_thread_4_DEPENDENCIES = $(top_builddir)/src/lib/libelementary.la +efl_thread_5_SOURCES = efl_thread_5.c +efl_thread_5_OBJECTS = efl_thread_5.$(OBJEXT) +efl_thread_5_LDADD = $(LDADD) +efl_thread_5_DEPENDENCIES = $(top_builddir)/src/lib/libelementary.la +efl_thread_6_SOURCES = efl_thread_6.c +efl_thread_6_OBJECTS = efl_thread_6.$(OBJEXT) +efl_thread_6_LDADD = $(LDADD) +efl_thread_6_DEPENDENCIES = $(top_builddir)/src/lib/libelementary.la +entry_example_SOURCES = entry_example.c +entry_example_OBJECTS = entry_example.$(OBJEXT) +entry_example_LDADD = $(LDADD) +entry_example_DEPENDENCIES = $(top_builddir)/src/lib/libelementary.la +fileselector_button_example_SOURCES = fileselector_button_example.c +fileselector_button_example_OBJECTS = \ + fileselector_button_example.$(OBJEXT) +fileselector_button_example_LDADD = $(LDADD) +fileselector_button_example_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +fileselector_entry_example_SOURCES = fileselector_entry_example.c +fileselector_entry_example_OBJECTS = \ + fileselector_entry_example.$(OBJEXT) +fileselector_entry_example_LDADD = $(LDADD) +fileselector_entry_example_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +fileselector_example_SOURCES = fileselector_example.c +fileselector_example_OBJECTS = fileselector_example.$(OBJEXT) +fileselector_example_LDADD = $(LDADD) +fileselector_example_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +flip_example_01_SOURCES = flip_example_01.c +flip_example_01_OBJECTS = flip_example_01.$(OBJEXT) +flip_example_01_LDADD = $(LDADD) +flip_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +flipselector_example_SOURCES = flipselector_example.c +flipselector_example_OBJECTS = flipselector_example.$(OBJEXT) +flipselector_example_LDADD = $(LDADD) +flipselector_example_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +frame_example_01_SOURCES = frame_example_01.c +frame_example_01_OBJECTS = frame_example_01.$(OBJEXT) +frame_example_01_LDADD = $(LDADD) +frame_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +general_funcs_example_SOURCES = general_funcs_example.c +general_funcs_example_OBJECTS = general_funcs_example.$(OBJEXT) +general_funcs_example_LDADD = $(LDADD) +general_funcs_example_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +gengrid_example_SOURCES = gengrid_example.c +gengrid_example_OBJECTS = gengrid_example.$(OBJEXT) +gengrid_example_LDADD = $(LDADD) +gengrid_example_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +genlist_example_01_SOURCES = genlist_example_01.c +genlist_example_01_OBJECTS = genlist_example_01.$(OBJEXT) +genlist_example_01_LDADD = $(LDADD) +genlist_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +genlist_example_02_SOURCES = genlist_example_02.c +genlist_example_02_OBJECTS = genlist_example_02.$(OBJEXT) +genlist_example_02_LDADD = $(LDADD) +genlist_example_02_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +genlist_example_03_SOURCES = genlist_example_03.c +genlist_example_03_OBJECTS = genlist_example_03.$(OBJEXT) +genlist_example_03_LDADD = $(LDADD) +genlist_example_03_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +genlist_example_04_SOURCES = genlist_example_04.c +genlist_example_04_OBJECTS = genlist_example_04.$(OBJEXT) +genlist_example_04_LDADD = $(LDADD) +genlist_example_04_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +genlist_example_05_SOURCES = genlist_example_05.c +genlist_example_05_OBJECTS = genlist_example_05.$(OBJEXT) +genlist_example_05_LDADD = $(LDADD) +genlist_example_05_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +hover_example_01_SOURCES = hover_example_01.c +hover_example_01_OBJECTS = hover_example_01.$(OBJEXT) +hover_example_01_LDADD = $(LDADD) +hover_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +hoversel_example_01_SOURCES = hoversel_example_01.c +hoversel_example_01_OBJECTS = hoversel_example_01.$(OBJEXT) +hoversel_example_01_LDADD = $(LDADD) +hoversel_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +icon_example_01_SOURCES = icon_example_01.c +icon_example_01_OBJECTS = icon_example_01.$(OBJEXT) +icon_example_01_LDADD = $(LDADD) +icon_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +image_example_01_SOURCES = image_example_01.c +image_example_01_OBJECTS = image_example_01.$(OBJEXT) +image_example_01_LDADD = $(LDADD) +image_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +index_example_01_SOURCES = index_example_01.c +index_example_01_OBJECTS = index_example_01.$(OBJEXT) +index_example_01_LDADD = $(LDADD) +index_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +index_example_02_SOURCES = index_example_02.c +index_example_02_OBJECTS = index_example_02.$(OBJEXT) +index_example_02_LDADD = $(LDADD) +index_example_02_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +inwin_example_SOURCES = inwin_example.c +inwin_example_OBJECTS = inwin_example.$(OBJEXT) +inwin_example_LDADD = $(LDADD) +inwin_example_DEPENDENCIES = $(top_builddir)/src/lib/libelementary.la +label_example_01_SOURCES = label_example_01.c +label_example_01_OBJECTS = label_example_01.$(OBJEXT) +label_example_01_LDADD = $(LDADD) +label_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +layout_example_01_SOURCES = layout_example_01.c +layout_example_01_OBJECTS = layout_example_01.$(OBJEXT) +layout_example_01_LDADD = $(LDADD) +layout_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +layout_example_02_SOURCES = layout_example_02.c +layout_example_02_OBJECTS = layout_example_02.$(OBJEXT) +layout_example_02_LDADD = $(LDADD) +layout_example_02_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +layout_example_03_SOURCES = layout_example_03.c +layout_example_03_OBJECTS = layout_example_03.$(OBJEXT) +layout_example_03_LDADD = $(LDADD) +layout_example_03_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +list_example_01_SOURCES = list_example_01.c +list_example_01_OBJECTS = list_example_01.$(OBJEXT) +list_example_01_LDADD = $(LDADD) +list_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +list_example_02_SOURCES = list_example_02.c +list_example_02_OBJECTS = list_example_02.$(OBJEXT) +list_example_02_LDADD = $(LDADD) +list_example_02_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +list_example_03_SOURCES = list_example_03.c +list_example_03_OBJECTS = list_example_03.$(OBJEXT) +list_example_03_LDADD = $(LDADD) +list_example_03_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +map_example_01_SOURCES = map_example_01.c +map_example_01_OBJECTS = map_example_01.$(OBJEXT) +map_example_01_LDADD = $(LDADD) +map_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +map_example_02_SOURCES = map_example_02.c +map_example_02_OBJECTS = map_example_02.$(OBJEXT) +map_example_02_LDADD = $(LDADD) +map_example_02_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +map_example_03_SOURCES = map_example_03.c +map_example_03_OBJECTS = map_example_03.$(OBJEXT) +map_example_03_LDADD = $(LDADD) +map_example_03_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +mapbuf_example_SOURCES = mapbuf_example.c +mapbuf_example_OBJECTS = mapbuf_example.$(OBJEXT) +mapbuf_example_LDADD = $(LDADD) +mapbuf_example_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +menu_example_01_SOURCES = menu_example_01.c +menu_example_01_OBJECTS = menu_example_01.$(OBJEXT) +menu_example_01_LDADD = $(LDADD) +menu_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +notify_example_01_SOURCES = notify_example_01.c +notify_example_01_OBJECTS = notify_example_01.$(OBJEXT) +notify_example_01_LDADD = $(LDADD) +notify_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +panel_example_01_SOURCES = panel_example_01.c +panel_example_01_OBJECTS = panel_example_01.$(OBJEXT) +panel_example_01_LDADD = $(LDADD) +panel_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +panes_example_SOURCES = panes_example.c +panes_example_OBJECTS = panes_example.$(OBJEXT) +panes_example_LDADD = $(LDADD) +panes_example_DEPENDENCIES = $(top_builddir)/src/lib/libelementary.la +photocam_example_01_SOURCES = photocam_example_01.c +photocam_example_01_OBJECTS = photocam_example_01.$(OBJEXT) +photocam_example_01_LDADD = $(LDADD) +photocam_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +popup_example_01_SOURCES = popup_example_01.c +popup_example_01_OBJECTS = popup_example_01.$(OBJEXT) +popup_example_01_LDADD = $(LDADD) +popup_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +popup_example_02_SOURCES = popup_example_02.c +popup_example_02_OBJECTS = popup_example_02.$(OBJEXT) +popup_example_02_LDADD = $(LDADD) +popup_example_02_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +popup_example_03_SOURCES = popup_example_03.c +popup_example_03_OBJECTS = popup_example_03.$(OBJEXT) +popup_example_03_LDADD = $(LDADD) +popup_example_03_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +progressbar_example_SOURCES = progressbar_example.c +progressbar_example_OBJECTS = progressbar_example.$(OBJEXT) +progressbar_example_LDADD = $(LDADD) +progressbar_example_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +radio_example_01_SOURCES = radio_example_01.c +radio_example_01_OBJECTS = radio_example_01.$(OBJEXT) +radio_example_01_LDADD = $(LDADD) +radio_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +scroller_example_01_SOURCES = scroller_example_01.c +scroller_example_01_OBJECTS = scroller_example_01.$(OBJEXT) +scroller_example_01_LDADD = $(LDADD) +scroller_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +segment_control_example_SOURCES = segment_control_example.c +segment_control_example_OBJECTS = segment_control_example.$(OBJEXT) +segment_control_example_LDADD = $(LDADD) +segment_control_example_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +separator_example_01_SOURCES = separator_example_01.c +separator_example_01_OBJECTS = separator_example_01.$(OBJEXT) +separator_example_01_LDADD = $(LDADD) +separator_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +slider_example_SOURCES = slider_example.c +slider_example_OBJECTS = slider_example.$(OBJEXT) +slider_example_LDADD = $(LDADD) +slider_example_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +slideshow_example_SOURCES = slideshow_example.c +slideshow_example_OBJECTS = slideshow_example.$(OBJEXT) +slideshow_example_LDADD = $(LDADD) +slideshow_example_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +spinner_example_SOURCES = spinner_example.c +spinner_example_OBJECTS = spinner_example.$(OBJEXT) +spinner_example_LDADD = $(LDADD) +spinner_example_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +table_example_01_SOURCES = table_example_01.c +table_example_01_OBJECTS = table_example_01.$(OBJEXT) +table_example_01_LDADD = $(LDADD) +table_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +table_example_02_SOURCES = table_example_02.c +table_example_02_OBJECTS = table_example_02.$(OBJEXT) +table_example_02_LDADD = $(LDADD) +table_example_02_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +theme_example_01_SOURCES = theme_example_01.c +theme_example_01_OBJECTS = theme_example_01.$(OBJEXT) +theme_example_01_LDADD = $(LDADD) +theme_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +theme_example_02_SOURCES = theme_example_02.c +theme_example_02_OBJECTS = theme_example_02.$(OBJEXT) +theme_example_02_LDADD = $(LDADD) +theme_example_02_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +thumb_example_01_SOURCES = thumb_example_01.c +thumb_example_01_OBJECTS = thumb_example_01.$(OBJEXT) +thumb_example_01_LDADD = $(LDADD) +thumb_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +toolbar_example_01_SOURCES = toolbar_example_01.c +toolbar_example_01_OBJECTS = toolbar_example_01.$(OBJEXT) +toolbar_example_01_LDADD = $(LDADD) +toolbar_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +toolbar_example_02_SOURCES = toolbar_example_02.c +toolbar_example_02_OBJECTS = toolbar_example_02.$(OBJEXT) +toolbar_example_02_LDADD = $(LDADD) +toolbar_example_02_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +toolbar_example_03_SOURCES = toolbar_example_03.c +toolbar_example_03_OBJECTS = toolbar_example_03.$(OBJEXT) +toolbar_example_03_LDADD = $(LDADD) +toolbar_example_03_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +transit_example_01_SOURCES = transit_example_01.c +transit_example_01_OBJECTS = transit_example_01.$(OBJEXT) +transit_example_01_LDADD = $(LDADD) +transit_example_01_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +transit_example_02_SOURCES = transit_example_02.c +transit_example_02_OBJECTS = transit_example_02.$(OBJEXT) +transit_example_02_LDADD = $(LDADD) +transit_example_02_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +transit_example_03_SOURCES = transit_example_03.c +transit_example_03_OBJECTS = transit_example_03.$(OBJEXT) +transit_example_03_LDADD = $(LDADD) +transit_example_03_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +transit_example_04_SOURCES = transit_example_04.c +transit_example_04_OBJECTS = transit_example_04.$(OBJEXT) +transit_example_04_LDADD = $(LDADD) +transit_example_04_DEPENDENCIES = \ + $(top_builddir)/src/lib/libelementary.la +web_example_SOURCES = web_example.c +web_example_OBJECTS = web_example.$(OBJEXT) +web_example_LDADD = $(LDADD) +web_example_DEPENDENCIES = $(top_builddir)/src/lib/libelementary.la +win_example_SOURCES = win_example.c +win_example_OBJECTS = win_example.$(OBJEXT) +win_example_LDADD = $(LDADD) +win_example_DEPENDENCIES = $(top_builddir)/src/lib/libelementary.la +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = actionslider_example_01.c bg_example_01.c bg_example_02.c \ + bg_example_03.c box_example_02.c bubble_example_01.c \ + button_example_00.c button_example_01.c calendar_example_01.c \ + calendar_example_02.c calendar_example_03.c \ + calendar_example_04.c calendar_example_05.c \ + calendar_example_06.c check_example_01.c clock_example.c \ + colorselector_example_01.c conformant_example_01.c \ + conformant_example_02.c ctxpopup_example_01.c \ + datetime_example.c dayselector_example.c \ + diskselector_example_01.c diskselector_example_02.c \ + $(efl_thread_1_SOURCES) $(efl_thread_2_SOURCES) \ + $(efl_thread_3_SOURCES) $(efl_thread_4_SOURCES) efl_thread_5.c \ + efl_thread_6.c entry_example.c fileselector_button_example.c \ + fileselector_entry_example.c fileselector_example.c \ + flip_example_01.c flipselector_example.c frame_example_01.c \ + general_funcs_example.c gengrid_example.c genlist_example_01.c \ + genlist_example_02.c genlist_example_03.c genlist_example_04.c \ + genlist_example_05.c hover_example_01.c hoversel_example_01.c \ + icon_example_01.c image_example_01.c index_example_01.c \ + index_example_02.c inwin_example.c label_example_01.c \ + layout_example_01.c layout_example_02.c layout_example_03.c \ + list_example_01.c list_example_02.c list_example_03.c \ + map_example_01.c map_example_02.c map_example_03.c \ + mapbuf_example.c menu_example_01.c notify_example_01.c \ + panel_example_01.c panes_example.c photocam_example_01.c \ + popup_example_01.c popup_example_02.c popup_example_03.c \ + progressbar_example.c radio_example_01.c scroller_example_01.c \ + segment_control_example.c separator_example_01.c \ + slider_example.c slideshow_example.c spinner_example.c \ + table_example_01.c table_example_02.c theme_example_01.c \ + theme_example_02.c thumb_example_01.c toolbar_example_01.c \ + toolbar_example_02.c toolbar_example_03.c transit_example_01.c \ + transit_example_02.c transit_example_03.c transit_example_04.c \ + web_example.c win_example.c +DIST_SOURCES = actionslider_example_01.c bg_example_01.c \ + bg_example_02.c bg_example_03.c box_example_02.c \ + bubble_example_01.c button_example_00.c button_example_01.c \ + calendar_example_01.c calendar_example_02.c \ + calendar_example_03.c calendar_example_04.c \ + calendar_example_05.c calendar_example_06.c check_example_01.c \ + clock_example.c colorselector_example_01.c \ + conformant_example_01.c conformant_example_02.c \ + ctxpopup_example_01.c datetime_example.c dayselector_example.c \ + diskselector_example_01.c diskselector_example_02.c \ + $(am__efl_thread_1_SOURCES_DIST) \ + $(am__efl_thread_2_SOURCES_DIST) \ + $(am__efl_thread_3_SOURCES_DIST) \ + $(am__efl_thread_4_SOURCES_DIST) efl_thread_5.c efl_thread_6.c \ + entry_example.c fileselector_button_example.c \ + fileselector_entry_example.c fileselector_example.c \ + flip_example_01.c flipselector_example.c frame_example_01.c \ + general_funcs_example.c gengrid_example.c genlist_example_01.c \ + genlist_example_02.c genlist_example_03.c genlist_example_04.c \ + genlist_example_05.c hover_example_01.c hoversel_example_01.c \ + icon_example_01.c image_example_01.c index_example_01.c \ + index_example_02.c inwin_example.c label_example_01.c \ + layout_example_01.c layout_example_02.c layout_example_03.c \ + list_example_01.c list_example_02.c list_example_03.c \ + map_example_01.c map_example_02.c map_example_03.c \ + mapbuf_example.c menu_example_01.c notify_example_01.c \ + panel_example_01.c panes_example.c photocam_example_01.c \ + popup_example_01.c popup_example_02.c popup_example_03.c \ + progressbar_example.c radio_example_01.c scroller_example_01.c \ + segment_control_example.c separator_example_01.c \ + slider_example.c slideshow_example.c spinner_example.c \ + table_example_01.c table_example_02.c theme_example_01.c \ + theme_example_02.c thumb_example_01.c toolbar_example_01.c \ + toolbar_example_02.c toolbar_example_03.c transit_example_01.c \ + transit_example_02.c transit_example_03.c transit_example_04.c \ + web_example.c win_example.c +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +DATA = $(files_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EIO_CFLAGS = @EIO_CFLAGS@ +EIO_LIBS = @EIO_LIBS@ +ELEMENTARY_CFLAGS = @ELEMENTARY_CFLAGS@ +ELEMENTARY_COCOA_CFLAGS = @ELEMENTARY_COCOA_CFLAGS@ +ELEMENTARY_COCOA_LIBS = @ELEMENTARY_COCOA_LIBS@ +ELEMENTARY_CONFIG_PRG = @ELEMENTARY_CONFIG_PRG@ +ELEMENTARY_ECORE_CON_CFLAGS = @ELEMENTARY_ECORE_CON_CFLAGS@ +ELEMENTARY_ECORE_CON_INC = @ELEMENTARY_ECORE_CON_INC@ +ELEMENTARY_ECORE_CON_LIBS = @ELEMENTARY_ECORE_CON_LIBS@ +ELEMENTARY_ECORE_IMF_CFLAGS = @ELEMENTARY_ECORE_IMF_CFLAGS@ +ELEMENTARY_ECORE_IMF_INC = @ELEMENTARY_ECORE_IMF_INC@ +ELEMENTARY_ECORE_IMF_LIBS = @ELEMENTARY_ECORE_IMF_LIBS@ +ELEMENTARY_EDBUS_CFLAGS = @ELEMENTARY_EDBUS_CFLAGS@ +ELEMENTARY_EDBUS_LIBS = @ELEMENTARY_EDBUS_LIBS@ +ELEMENTARY_EFREET_CFLAGS = @ELEMENTARY_EFREET_CFLAGS@ +ELEMENTARY_EFREET_LIBS = @ELEMENTARY_EFREET_LIBS@ +ELEMENTARY_EMAP_CFLAGS = @ELEMENTARY_EMAP_CFLAGS@ +ELEMENTARY_EMAP_LIBS = @ELEMENTARY_EMAP_LIBS@ +ELEMENTARY_ETHUMB_CFLAGS = @ELEMENTARY_ETHUMB_CFLAGS@ +ELEMENTARY_ETHUMB_LIBS = @ELEMENTARY_ETHUMB_LIBS@ +ELEMENTARY_EWEATHER_CFLAGS = @ELEMENTARY_EWEATHER_CFLAGS@ +ELEMENTARY_EWEATHER_LIBS = @ELEMENTARY_EWEATHER_LIBS@ +ELEMENTARY_FB_CFLAGS = @ELEMENTARY_FB_CFLAGS@ +ELEMENTARY_FB_LIBS = @ELEMENTARY_FB_LIBS@ +ELEMENTARY_LIBS = @ELEMENTARY_LIBS@ +ELEMENTARY_PSL1GHT_CFLAGS = @ELEMENTARY_PSL1GHT_CFLAGS@ +ELEMENTARY_PSL1GHT_LIBS = @ELEMENTARY_PSL1GHT_LIBS@ +ELEMENTARY_SDL_CFLAGS = @ELEMENTARY_SDL_CFLAGS@ +ELEMENTARY_SDL_LIBS = @ELEMENTARY_SDL_LIBS@ +ELEMENTARY_TEST_PRG = @ELEMENTARY_TEST_PRG@ +ELEMENTARY_WEB_CFLAGS = @ELEMENTARY_WEB_CFLAGS@ +ELEMENTARY_WEB_LIBS = @ELEMENTARY_WEB_LIBS@ +ELEMENTARY_WIN32_CFLAGS = @ELEMENTARY_WIN32_CFLAGS@ +ELEMENTARY_WIN32_LIBS = @ELEMENTARY_WIN32_LIBS@ +ELEMENTARY_WINCE_CFLAGS = @ELEMENTARY_WINCE_CFLAGS@ +ELEMENTARY_WINCE_LIBS = @ELEMENTARY_WINCE_LIBS@ +ELEMENTARY_X_CFLAGS = @ELEMENTARY_X_CFLAGS@ +ELEMENTARY_X_LIBS = @ELEMENTARY_X_LIBS@ +ELM_ALLOCA_H_DEF = @ELM_ALLOCA_H_DEF@ +ELM_DEBUG_DEF = @ELM_DEBUG_DEF@ +ELM_DIRENT_H_DEF = @ELM_DIRENT_H_DEF@ +ELM_EDBUS_DEF = @ELM_EDBUS_DEF@ +ELM_EFREET_DEF = @ELM_EFREET_DEF@ +ELM_EMAP_DEF = @ELM_EMAP_DEF@ +ELM_ETHUMB_DEF = @ELM_ETHUMB_DEF@ +ELM_EWEATHER_DEF = @ELM_EWEATHER_DEF@ +ELM_LIBINTL_H_DEF = @ELM_LIBINTL_H_DEF@ +ELM_UNIX_DEF = @ELM_UNIX_DEF@ +ELM_WEB_DEF = @ELM_WEB_DEF@ +ELM_WIN32_DEF = @ELM_WIN32_DEF@ +ELM_WINCE_DEF = @ELM_WINCE_DEF@ +EMOTION_CFLAGS = @EMOTION_CFLAGS@ +EMOTION_LIBS = @EMOTION_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALE_DIR = @LOCALE_DIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MODULE_ARCH = @MODULE_ARCH@ +MODULE_EDJE = @MODULE_EDJE@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +VMIN = @VMIN@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +edje_cc = @edje_cc@ +eet_eet = @eet_eet@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +my_libs = @my_libs@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirement_elm = @requirement_elm@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +MAINTAINERCLEANFILES = Makefile.in +examplesdir = $(pkgdatadir)/examples +filesdir = $(pkgdatadir)/examples +files_DATA = $(am__append_1) $(am__append_2) +AM_CPPFLAGS = \ +-Wno-unused-parameter \ +-I. \ +-I$(top_srcdir)/src/lib \ +-I$(top_builddir)/src/lib \ +-DPACKAGE_DATA_DIR="\"$(pkgdatadir)\"" \ +-DPACKAGE_BIN_DIR=\"$(bindir)\" \ +-DPACKAGE_LIB_DIR=\"$(libdir)\" \ +@ELEMENTARY_EDBUS_CFLAGS@ \ +@ELEMENTARY_EFREET_CFLAGS@ \ +@ELEMENTARY_ETHUMB_CFLAGS@ \ +@ELEMENTARY_EMAP_CFLAGS@ \ +@ELEMENTARY_X_CFLAGS@ \ +@ELEMENTARY_CFLAGS@ + +LDADD = \ +@ELEMENTARY_LIBS@ \ +@ELEMENTARY_ETHUMB_LIBS@ \ +@ELEMENTARY_X_LIBS@ \ +$(top_builddir)/src/lib/libelementary.la + +EDJE_CC = @edje_cc@ +EDJE_FLAGS_VERBOSE_ = +EDJE_FLAGS_VERBOSE_0 = +EDJE_FLAGS_VERBOSE_1 = -v +EDJE_FLAGS = $(EDJE_FLAGS_$(V)) +SRCS = \ +actionslider_example_01.c \ +bg_example_01.c \ +bg_example_02.c \ +bg_example_03.c \ +box_example_02.c \ +bubble_example_01.c \ +button_example_00.c \ +button_example_01.c \ +calendar_example_01.c \ +calendar_example_02.c \ +calendar_example_03.c \ +calendar_example_04.c \ +calendar_example_05.c \ +calendar_example_06.c \ +check_example_01.c \ +clock_example.c \ +colorselector_example_01.c \ +conformant_example_01.c \ +conformant_example_02.c \ +ctxpopup_example_01.c \ +datetime_example.c \ +dayselector_example.c \ +diskselector_example_01.c \ +diskselector_example_02.c \ +efl_thread_1.c \ +efl_thread_2.c \ +efl_thread_3.c \ +efl_thread_4.c \ +efl_thread_5.c \ +efl_thread_6.c \ +efl_thread_win32_1.c \ +efl_thread_win32_2.c \ +efl_thread_win32_3.c \ +efl_thread_win32_4.c \ +entry_example.c \ +fileselector_button_example.c \ +fileselector_entry_example.c \ +fileselector_example.c \ +flip_example_01.c \ +flipselector_example.c \ +frame_example_01.c \ +general_funcs_example.c \ +gengrid_example.c \ +genlist_example_01.c \ +genlist_example_02.c \ +genlist_example_03.c \ +genlist_example_04.c \ +genlist_example_05.c \ +hover_example_01.c \ +hoversel_example_01.c \ +icon_example_01.c \ +image_example_01.c \ +index_example_01.c \ +index_example_02.c \ +inwin_example.c \ +label_example_01.c \ +layout_example.edc \ +layout_example_01.c \ +layout_example_02.c \ +layout_example_03.c \ +list_example_01.c \ +list_example_02.c \ +list_example_03.c \ +map_example_01.c \ +map_example_02.c \ +map_example_03.c \ +mapbuf_example.c \ +menu_example_01.c \ +notify_example_01.c \ +panes_example.c \ +panel_example_01.c \ +photocam_example_01.c \ +popup_example_01.c \ +popup_example_02.c \ +popup_example_03.c \ +progressbar_example.c \ +radio_example_01.c \ +segment_control_example.c \ +separator_example_01.c \ +slider_example.c \ +slideshow_example.c \ +spinner_example.c \ +scroller_example_01.c \ +table_example_01.c \ +table_example_02.c \ +theme_example.edc \ +theme_example_01.c \ +theme_example_02.c \ +thumb_example_01.c \ +toolbar_example_01.c \ +toolbar_example_02.c \ +toolbar_example_03.c \ +transit_example_01.c \ +transit_example_02.c \ +transit_example_03.c \ +transit_example_04.c \ +web_example.c \ +win_example.c + +@EFL_BUILD_EXAMPLES_TRUE@@ELEMENTARY_WINDOWS_BUILD_FALSE@efl_thread_1_SOURCES = efl_thread_1.c +@EFL_BUILD_EXAMPLES_TRUE@@ELEMENTARY_WINDOWS_BUILD_TRUE@efl_thread_1_SOURCES = efl_thread_win32_1.c +@EFL_BUILD_EXAMPLES_TRUE@@ELEMENTARY_WINDOWS_BUILD_FALSE@efl_thread_2_SOURCES = efl_thread_2.c +@EFL_BUILD_EXAMPLES_TRUE@@ELEMENTARY_WINDOWS_BUILD_TRUE@efl_thread_2_SOURCES = efl_thread_win32_2.c +@EFL_BUILD_EXAMPLES_TRUE@@ELEMENTARY_WINDOWS_BUILD_FALSE@efl_thread_3_SOURCES = efl_thread_3.c +@EFL_BUILD_EXAMPLES_TRUE@@ELEMENTARY_WINDOWS_BUILD_TRUE@efl_thread_3_SOURCES = efl_thread_win32_3.c +@EFL_BUILD_EXAMPLES_TRUE@@ELEMENTARY_WINDOWS_BUILD_FALSE@efl_thread_4_SOURCES = efl_thread_4.c +@EFL_BUILD_EXAMPLES_TRUE@@ELEMENTARY_WINDOWS_BUILD_TRUE@efl_thread_4_SOURCES = efl_thread_win32_4.c + +# This variable will hold the list of screenshots that will be made +# by "make screenshots". Each item in the list is of the form: +# :: +@EFL_BUILD_EXAMPLES_TRUE@SCREENSHOTS = \ +@EFL_BUILD_EXAMPLES_TRUE@actionslider_example_01:actionslider_01.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@bg_example_02:bg_01.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@box_example_02:box_example_02.png:1.3 \ +@EFL_BUILD_EXAMPLES_TRUE@bubble_example_01:bubble_example_01.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@button_example_00:button_00.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@button_example_01:button_01.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@check_example_01:check_example_01.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@colorselector_example_01:colorselector_example_01.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@animator_example_01:animator_example_01.png:0.2 \ +@EFL_BUILD_EXAMPLES_TRUE@animator_example_01:animator_example_02.png:0.5 \ +@EFL_BUILD_EXAMPLES_TRUE@animator_example_01:animator_example_03.png:0.9 \ +@EFL_BUILD_EXAMPLES_TRUE@flip_example_01:flip_example_01.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@frame_example_01:frame_example_01.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@hover_example_01:hover_example_01.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@hoversel_example_01:hoversel_example_01.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@label_example_01:label_example_01.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@theme_example_01:theme_example_01.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@conformant_example_01:conformant_example_01.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@conformant_example_02:conformant_example_02.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@calendar_example_01:calendar_example_01.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@calendar_example_02:calendar_example_02.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@calendar_example_03:calendar_example_03.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@calendar_example_04:calendar_example_04.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@calendar_example_05:calendar_example_05.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@calendar_example_06:calendar_example_06.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@datetime_example:datetime_example.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@map_example_01:map_example_01.png:2 \ +@EFL_BUILD_EXAMPLES_TRUE@map_example_02:map_example_02.png:2.5 \ +@EFL_BUILD_EXAMPLES_TRUE@map_example_03:map_example_03.png:2 \ +@EFL_BUILD_EXAMPLES_TRUE@toolbar_example_01:toolbar_example_01.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@toolbar_example_02:toolbar_example_02.png:1 \ +@EFL_BUILD_EXAMPLES_TRUE@toolbar_example_03:toolbar_example_03.png:1 \ +@EFL_BUILD_EXAMPLES_TRUE@spinner_example:spinner_example.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@clock_example:clock_example.png:0.5 \ +@EFL_BUILD_EXAMPLES_TRUE@dayselector_example:dayselector_example.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@mapbuf_example:mapbuf_example.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@image_example_01:image_example_01.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@diskselector_example_01:diskselector_example_01.png:0.2 \ +@EFL_BUILD_EXAMPLES_TRUE@diskselector_example_02:diskselector_example_02.png:0.2 \ +@EFL_BUILD_EXAMPLES_TRUE@icon_example_01:icon_example_01.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@layout_example_01:layout_example_01.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@layout_example_02:layout_example_02.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@layout_example_03:layout_example_03.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@list_example_01:list_example_01.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@list_example_02:list_example_02.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@list_example_03:list_example_03.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@segment_control_example:segment_control_example.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@flipselector_example:flipselector_example.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@fileselector_example:fileselector_example.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@index_example_02:index_example_03.png:0.3 \ +@EFL_BUILD_EXAMPLES_TRUE@slider_example:slider_example.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@panes_example:panes_example.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@ctxpopup_example_01:ctxpopup_example_01.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@separator_example_01:separator_example_01.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@radio_example_01:radio_example_01.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@panel_example_01:panel_example_01.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@gengrid_example:gengrid_example.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@genlist_example_01:genlist_example_01.png:0.1 \ +@EFL_BUILD_EXAMPLES_TRUE@genlist_example_02:genlist_example_02.png:0.1 \ +@EFL_BUILD_EXAMPLES_TRUE@genlist_example_03:genlist_example_03.png:0.1 \ +@EFL_BUILD_EXAMPLES_TRUE@genlist_example_04:genlist_example_04.png:0.1 \ +@EFL_BUILD_EXAMPLES_TRUE@genlist_example_05:genlist_example_05.png:0.1 \ +@EFL_BUILD_EXAMPLES_TRUE@thumb_example_01:thumb_example_01.png:0.5 \ +@EFL_BUILD_EXAMPLES_TRUE@entry_example:entry_example.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@progressbar_example:progressbar_example.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@notify_example_01:notify_example_01.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@notify_example_01:notify_example_01_a.png:6.0 \ +@EFL_BUILD_EXAMPLES_TRUE@popup_example_01:popup_example_01.png:1.0 \ +@EFL_BUILD_EXAMPLES_TRUE@popup_example_01:popup_example_01_a.png:6.0 \ +@EFL_BUILD_EXAMPLES_TRUE@popup_example_02:popup_example_02.png:0.2 \ +@EFL_BUILD_EXAMPLES_TRUE@popup_example_03:popup_example_03.png:0.2 \ +@EFL_BUILD_EXAMPLES_TRUE@slideshow_example:slideshow_example.png:1.0 \ +@EFL_BUILD_EXAMPLES_TRUE@photocam_example_01:photocam_example_01.png:3 \ +@EFL_BUILD_EXAMPLES_TRUE@scroller_example_01:scroller_example_01.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@inwin_example:inwin_example.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@inwin_example:inwin_example_a.png:0.2 \ +@EFL_BUILD_EXAMPLES_TRUE@table_example_01:table_example_01.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@table_example_02:table_example_02.png:0.0 \ +@EFL_BUILD_EXAMPLES_TRUE@menu_example_01:menu_example_01.png:0.5 + +@EFL_BUILD_EXAMPLES_TRUE@HTML_SS_DIR = $(top_builddir)/doc/html/screenshots +@EFL_BUILD_EXAMPLES_TRUE@LATEX_SS_DIR = $(top_builddir)/doc/latex/screenshots +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .edc .edj .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/examples/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/examples/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-examplesPROGRAMS: $(examples_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(examplesdir)" || $(MKDIR_P) "$(DESTDIR)$(examplesdir)" + @list='$(examples_PROGRAMS)'; test -n "$(examplesdir)" || list=; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(examplesdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(examplesdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-examplesPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(examples_PROGRAMS)'; test -n "$(examplesdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(examplesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(examplesdir)" && rm -f $$files + +clean-examplesPROGRAMS: + @list='$(examples_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +actionslider_example_01$(EXEEXT): $(actionslider_example_01_OBJECTS) $(actionslider_example_01_DEPENDENCIES) + @rm -f actionslider_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(actionslider_example_01_OBJECTS) $(actionslider_example_01_LDADD) $(LIBS) +bg_example_01$(EXEEXT): $(bg_example_01_OBJECTS) $(bg_example_01_DEPENDENCIES) + @rm -f bg_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(bg_example_01_OBJECTS) $(bg_example_01_LDADD) $(LIBS) +bg_example_02$(EXEEXT): $(bg_example_02_OBJECTS) $(bg_example_02_DEPENDENCIES) + @rm -f bg_example_02$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(bg_example_02_OBJECTS) $(bg_example_02_LDADD) $(LIBS) +bg_example_03$(EXEEXT): $(bg_example_03_OBJECTS) $(bg_example_03_DEPENDENCIES) + @rm -f bg_example_03$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(bg_example_03_OBJECTS) $(bg_example_03_LDADD) $(LIBS) +box_example_02$(EXEEXT): $(box_example_02_OBJECTS) $(box_example_02_DEPENDENCIES) + @rm -f box_example_02$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(box_example_02_OBJECTS) $(box_example_02_LDADD) $(LIBS) +bubble_example_01$(EXEEXT): $(bubble_example_01_OBJECTS) $(bubble_example_01_DEPENDENCIES) + @rm -f bubble_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(bubble_example_01_OBJECTS) $(bubble_example_01_LDADD) $(LIBS) +button_example_00$(EXEEXT): $(button_example_00_OBJECTS) $(button_example_00_DEPENDENCIES) + @rm -f button_example_00$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(button_example_00_OBJECTS) $(button_example_00_LDADD) $(LIBS) +button_example_01$(EXEEXT): $(button_example_01_OBJECTS) $(button_example_01_DEPENDENCIES) + @rm -f button_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(button_example_01_OBJECTS) $(button_example_01_LDADD) $(LIBS) +calendar_example_01$(EXEEXT): $(calendar_example_01_OBJECTS) $(calendar_example_01_DEPENDENCIES) + @rm -f calendar_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(calendar_example_01_OBJECTS) $(calendar_example_01_LDADD) $(LIBS) +calendar_example_02$(EXEEXT): $(calendar_example_02_OBJECTS) $(calendar_example_02_DEPENDENCIES) + @rm -f calendar_example_02$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(calendar_example_02_OBJECTS) $(calendar_example_02_LDADD) $(LIBS) +calendar_example_03$(EXEEXT): $(calendar_example_03_OBJECTS) $(calendar_example_03_DEPENDENCIES) + @rm -f calendar_example_03$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(calendar_example_03_OBJECTS) $(calendar_example_03_LDADD) $(LIBS) +calendar_example_04$(EXEEXT): $(calendar_example_04_OBJECTS) $(calendar_example_04_DEPENDENCIES) + @rm -f calendar_example_04$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(calendar_example_04_OBJECTS) $(calendar_example_04_LDADD) $(LIBS) +calendar_example_05$(EXEEXT): $(calendar_example_05_OBJECTS) $(calendar_example_05_DEPENDENCIES) + @rm -f calendar_example_05$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(calendar_example_05_OBJECTS) $(calendar_example_05_LDADD) $(LIBS) +calendar_example_06$(EXEEXT): $(calendar_example_06_OBJECTS) $(calendar_example_06_DEPENDENCIES) + @rm -f calendar_example_06$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(calendar_example_06_OBJECTS) $(calendar_example_06_LDADD) $(LIBS) +check_example_01$(EXEEXT): $(check_example_01_OBJECTS) $(check_example_01_DEPENDENCIES) + @rm -f check_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(check_example_01_OBJECTS) $(check_example_01_LDADD) $(LIBS) +clock_example$(EXEEXT): $(clock_example_OBJECTS) $(clock_example_DEPENDENCIES) + @rm -f clock_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(clock_example_OBJECTS) $(clock_example_LDADD) $(LIBS) +colorselector_example_01$(EXEEXT): $(colorselector_example_01_OBJECTS) $(colorselector_example_01_DEPENDENCIES) + @rm -f colorselector_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(colorselector_example_01_OBJECTS) $(colorselector_example_01_LDADD) $(LIBS) +conformant_example_01$(EXEEXT): $(conformant_example_01_OBJECTS) $(conformant_example_01_DEPENDENCIES) + @rm -f conformant_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(conformant_example_01_OBJECTS) $(conformant_example_01_LDADD) $(LIBS) +conformant_example_02$(EXEEXT): $(conformant_example_02_OBJECTS) $(conformant_example_02_DEPENDENCIES) + @rm -f conformant_example_02$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(conformant_example_02_OBJECTS) $(conformant_example_02_LDADD) $(LIBS) +ctxpopup_example_01$(EXEEXT): $(ctxpopup_example_01_OBJECTS) $(ctxpopup_example_01_DEPENDENCIES) + @rm -f ctxpopup_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ctxpopup_example_01_OBJECTS) $(ctxpopup_example_01_LDADD) $(LIBS) +datetime_example$(EXEEXT): $(datetime_example_OBJECTS) $(datetime_example_DEPENDENCIES) + @rm -f datetime_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(datetime_example_OBJECTS) $(datetime_example_LDADD) $(LIBS) +dayselector_example$(EXEEXT): $(dayselector_example_OBJECTS) $(dayselector_example_DEPENDENCIES) + @rm -f dayselector_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(dayselector_example_OBJECTS) $(dayselector_example_LDADD) $(LIBS) +diskselector_example_01$(EXEEXT): $(diskselector_example_01_OBJECTS) $(diskselector_example_01_DEPENDENCIES) + @rm -f diskselector_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(diskselector_example_01_OBJECTS) $(diskselector_example_01_LDADD) $(LIBS) +diskselector_example_02$(EXEEXT): $(diskselector_example_02_OBJECTS) $(diskselector_example_02_DEPENDENCIES) + @rm -f diskselector_example_02$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(diskselector_example_02_OBJECTS) $(diskselector_example_02_LDADD) $(LIBS) +efl_thread_1$(EXEEXT): $(efl_thread_1_OBJECTS) $(efl_thread_1_DEPENDENCIES) + @rm -f efl_thread_1$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(efl_thread_1_OBJECTS) $(efl_thread_1_LDADD) $(LIBS) +efl_thread_2$(EXEEXT): $(efl_thread_2_OBJECTS) $(efl_thread_2_DEPENDENCIES) + @rm -f efl_thread_2$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(efl_thread_2_OBJECTS) $(efl_thread_2_LDADD) $(LIBS) +efl_thread_3$(EXEEXT): $(efl_thread_3_OBJECTS) $(efl_thread_3_DEPENDENCIES) + @rm -f efl_thread_3$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(efl_thread_3_OBJECTS) $(efl_thread_3_LDADD) $(LIBS) +efl_thread_4$(EXEEXT): $(efl_thread_4_OBJECTS) $(efl_thread_4_DEPENDENCIES) + @rm -f efl_thread_4$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(efl_thread_4_OBJECTS) $(efl_thread_4_LDADD) $(LIBS) +efl_thread_5$(EXEEXT): $(efl_thread_5_OBJECTS) $(efl_thread_5_DEPENDENCIES) + @rm -f efl_thread_5$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(efl_thread_5_OBJECTS) $(efl_thread_5_LDADD) $(LIBS) +efl_thread_6$(EXEEXT): $(efl_thread_6_OBJECTS) $(efl_thread_6_DEPENDENCIES) + @rm -f efl_thread_6$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(efl_thread_6_OBJECTS) $(efl_thread_6_LDADD) $(LIBS) +entry_example$(EXEEXT): $(entry_example_OBJECTS) $(entry_example_DEPENDENCIES) + @rm -f entry_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(entry_example_OBJECTS) $(entry_example_LDADD) $(LIBS) +fileselector_button_example$(EXEEXT): $(fileselector_button_example_OBJECTS) $(fileselector_button_example_DEPENDENCIES) + @rm -f fileselector_button_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(fileselector_button_example_OBJECTS) $(fileselector_button_example_LDADD) $(LIBS) +fileselector_entry_example$(EXEEXT): $(fileselector_entry_example_OBJECTS) $(fileselector_entry_example_DEPENDENCIES) + @rm -f fileselector_entry_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(fileselector_entry_example_OBJECTS) $(fileselector_entry_example_LDADD) $(LIBS) +fileselector_example$(EXEEXT): $(fileselector_example_OBJECTS) $(fileselector_example_DEPENDENCIES) + @rm -f fileselector_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(fileselector_example_OBJECTS) $(fileselector_example_LDADD) $(LIBS) +flip_example_01$(EXEEXT): $(flip_example_01_OBJECTS) $(flip_example_01_DEPENDENCIES) + @rm -f flip_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(flip_example_01_OBJECTS) $(flip_example_01_LDADD) $(LIBS) +flipselector_example$(EXEEXT): $(flipselector_example_OBJECTS) $(flipselector_example_DEPENDENCIES) + @rm -f flipselector_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(flipselector_example_OBJECTS) $(flipselector_example_LDADD) $(LIBS) +frame_example_01$(EXEEXT): $(frame_example_01_OBJECTS) $(frame_example_01_DEPENDENCIES) + @rm -f frame_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(frame_example_01_OBJECTS) $(frame_example_01_LDADD) $(LIBS) +general_funcs_example$(EXEEXT): $(general_funcs_example_OBJECTS) $(general_funcs_example_DEPENDENCIES) + @rm -f general_funcs_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(general_funcs_example_OBJECTS) $(general_funcs_example_LDADD) $(LIBS) +gengrid_example$(EXEEXT): $(gengrid_example_OBJECTS) $(gengrid_example_DEPENDENCIES) + @rm -f gengrid_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gengrid_example_OBJECTS) $(gengrid_example_LDADD) $(LIBS) +genlist_example_01$(EXEEXT): $(genlist_example_01_OBJECTS) $(genlist_example_01_DEPENDENCIES) + @rm -f genlist_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(genlist_example_01_OBJECTS) $(genlist_example_01_LDADD) $(LIBS) +genlist_example_02$(EXEEXT): $(genlist_example_02_OBJECTS) $(genlist_example_02_DEPENDENCIES) + @rm -f genlist_example_02$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(genlist_example_02_OBJECTS) $(genlist_example_02_LDADD) $(LIBS) +genlist_example_03$(EXEEXT): $(genlist_example_03_OBJECTS) $(genlist_example_03_DEPENDENCIES) + @rm -f genlist_example_03$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(genlist_example_03_OBJECTS) $(genlist_example_03_LDADD) $(LIBS) +genlist_example_04$(EXEEXT): $(genlist_example_04_OBJECTS) $(genlist_example_04_DEPENDENCIES) + @rm -f genlist_example_04$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(genlist_example_04_OBJECTS) $(genlist_example_04_LDADD) $(LIBS) +genlist_example_05$(EXEEXT): $(genlist_example_05_OBJECTS) $(genlist_example_05_DEPENDENCIES) + @rm -f genlist_example_05$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(genlist_example_05_OBJECTS) $(genlist_example_05_LDADD) $(LIBS) +hover_example_01$(EXEEXT): $(hover_example_01_OBJECTS) $(hover_example_01_DEPENDENCIES) + @rm -f hover_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(hover_example_01_OBJECTS) $(hover_example_01_LDADD) $(LIBS) +hoversel_example_01$(EXEEXT): $(hoversel_example_01_OBJECTS) $(hoversel_example_01_DEPENDENCIES) + @rm -f hoversel_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(hoversel_example_01_OBJECTS) $(hoversel_example_01_LDADD) $(LIBS) +icon_example_01$(EXEEXT): $(icon_example_01_OBJECTS) $(icon_example_01_DEPENDENCIES) + @rm -f icon_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(icon_example_01_OBJECTS) $(icon_example_01_LDADD) $(LIBS) +image_example_01$(EXEEXT): $(image_example_01_OBJECTS) $(image_example_01_DEPENDENCIES) + @rm -f image_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(image_example_01_OBJECTS) $(image_example_01_LDADD) $(LIBS) +index_example_01$(EXEEXT): $(index_example_01_OBJECTS) $(index_example_01_DEPENDENCIES) + @rm -f index_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(index_example_01_OBJECTS) $(index_example_01_LDADD) $(LIBS) +index_example_02$(EXEEXT): $(index_example_02_OBJECTS) $(index_example_02_DEPENDENCIES) + @rm -f index_example_02$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(index_example_02_OBJECTS) $(index_example_02_LDADD) $(LIBS) +inwin_example$(EXEEXT): $(inwin_example_OBJECTS) $(inwin_example_DEPENDENCIES) + @rm -f inwin_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(inwin_example_OBJECTS) $(inwin_example_LDADD) $(LIBS) +label_example_01$(EXEEXT): $(label_example_01_OBJECTS) $(label_example_01_DEPENDENCIES) + @rm -f label_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(label_example_01_OBJECTS) $(label_example_01_LDADD) $(LIBS) +layout_example_01$(EXEEXT): $(layout_example_01_OBJECTS) $(layout_example_01_DEPENDENCIES) + @rm -f layout_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(layout_example_01_OBJECTS) $(layout_example_01_LDADD) $(LIBS) +layout_example_02$(EXEEXT): $(layout_example_02_OBJECTS) $(layout_example_02_DEPENDENCIES) + @rm -f layout_example_02$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(layout_example_02_OBJECTS) $(layout_example_02_LDADD) $(LIBS) +layout_example_03$(EXEEXT): $(layout_example_03_OBJECTS) $(layout_example_03_DEPENDENCIES) + @rm -f layout_example_03$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(layout_example_03_OBJECTS) $(layout_example_03_LDADD) $(LIBS) +list_example_01$(EXEEXT): $(list_example_01_OBJECTS) $(list_example_01_DEPENDENCIES) + @rm -f list_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(list_example_01_OBJECTS) $(list_example_01_LDADD) $(LIBS) +list_example_02$(EXEEXT): $(list_example_02_OBJECTS) $(list_example_02_DEPENDENCIES) + @rm -f list_example_02$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(list_example_02_OBJECTS) $(list_example_02_LDADD) $(LIBS) +list_example_03$(EXEEXT): $(list_example_03_OBJECTS) $(list_example_03_DEPENDENCIES) + @rm -f list_example_03$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(list_example_03_OBJECTS) $(list_example_03_LDADD) $(LIBS) +map_example_01$(EXEEXT): $(map_example_01_OBJECTS) $(map_example_01_DEPENDENCIES) + @rm -f map_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(map_example_01_OBJECTS) $(map_example_01_LDADD) $(LIBS) +map_example_02$(EXEEXT): $(map_example_02_OBJECTS) $(map_example_02_DEPENDENCIES) + @rm -f map_example_02$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(map_example_02_OBJECTS) $(map_example_02_LDADD) $(LIBS) +map_example_03$(EXEEXT): $(map_example_03_OBJECTS) $(map_example_03_DEPENDENCIES) + @rm -f map_example_03$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(map_example_03_OBJECTS) $(map_example_03_LDADD) $(LIBS) +mapbuf_example$(EXEEXT): $(mapbuf_example_OBJECTS) $(mapbuf_example_DEPENDENCIES) + @rm -f mapbuf_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(mapbuf_example_OBJECTS) $(mapbuf_example_LDADD) $(LIBS) +menu_example_01$(EXEEXT): $(menu_example_01_OBJECTS) $(menu_example_01_DEPENDENCIES) + @rm -f menu_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(menu_example_01_OBJECTS) $(menu_example_01_LDADD) $(LIBS) +notify_example_01$(EXEEXT): $(notify_example_01_OBJECTS) $(notify_example_01_DEPENDENCIES) + @rm -f notify_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(notify_example_01_OBJECTS) $(notify_example_01_LDADD) $(LIBS) +panel_example_01$(EXEEXT): $(panel_example_01_OBJECTS) $(panel_example_01_DEPENDENCIES) + @rm -f panel_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(panel_example_01_OBJECTS) $(panel_example_01_LDADD) $(LIBS) +panes_example$(EXEEXT): $(panes_example_OBJECTS) $(panes_example_DEPENDENCIES) + @rm -f panes_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(panes_example_OBJECTS) $(panes_example_LDADD) $(LIBS) +photocam_example_01$(EXEEXT): $(photocam_example_01_OBJECTS) $(photocam_example_01_DEPENDENCIES) + @rm -f photocam_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(photocam_example_01_OBJECTS) $(photocam_example_01_LDADD) $(LIBS) +popup_example_01$(EXEEXT): $(popup_example_01_OBJECTS) $(popup_example_01_DEPENDENCIES) + @rm -f popup_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(popup_example_01_OBJECTS) $(popup_example_01_LDADD) $(LIBS) +popup_example_02$(EXEEXT): $(popup_example_02_OBJECTS) $(popup_example_02_DEPENDENCIES) + @rm -f popup_example_02$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(popup_example_02_OBJECTS) $(popup_example_02_LDADD) $(LIBS) +popup_example_03$(EXEEXT): $(popup_example_03_OBJECTS) $(popup_example_03_DEPENDENCIES) + @rm -f popup_example_03$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(popup_example_03_OBJECTS) $(popup_example_03_LDADD) $(LIBS) +progressbar_example$(EXEEXT): $(progressbar_example_OBJECTS) $(progressbar_example_DEPENDENCIES) + @rm -f progressbar_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(progressbar_example_OBJECTS) $(progressbar_example_LDADD) $(LIBS) +radio_example_01$(EXEEXT): $(radio_example_01_OBJECTS) $(radio_example_01_DEPENDENCIES) + @rm -f radio_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(radio_example_01_OBJECTS) $(radio_example_01_LDADD) $(LIBS) +scroller_example_01$(EXEEXT): $(scroller_example_01_OBJECTS) $(scroller_example_01_DEPENDENCIES) + @rm -f scroller_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(scroller_example_01_OBJECTS) $(scroller_example_01_LDADD) $(LIBS) +segment_control_example$(EXEEXT): $(segment_control_example_OBJECTS) $(segment_control_example_DEPENDENCIES) + @rm -f segment_control_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(segment_control_example_OBJECTS) $(segment_control_example_LDADD) $(LIBS) +separator_example_01$(EXEEXT): $(separator_example_01_OBJECTS) $(separator_example_01_DEPENDENCIES) + @rm -f separator_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(separator_example_01_OBJECTS) $(separator_example_01_LDADD) $(LIBS) +slider_example$(EXEEXT): $(slider_example_OBJECTS) $(slider_example_DEPENDENCIES) + @rm -f slider_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(slider_example_OBJECTS) $(slider_example_LDADD) $(LIBS) +slideshow_example$(EXEEXT): $(slideshow_example_OBJECTS) $(slideshow_example_DEPENDENCIES) + @rm -f slideshow_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(slideshow_example_OBJECTS) $(slideshow_example_LDADD) $(LIBS) +spinner_example$(EXEEXT): $(spinner_example_OBJECTS) $(spinner_example_DEPENDENCIES) + @rm -f spinner_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(spinner_example_OBJECTS) $(spinner_example_LDADD) $(LIBS) +table_example_01$(EXEEXT): $(table_example_01_OBJECTS) $(table_example_01_DEPENDENCIES) + @rm -f table_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(table_example_01_OBJECTS) $(table_example_01_LDADD) $(LIBS) +table_example_02$(EXEEXT): $(table_example_02_OBJECTS) $(table_example_02_DEPENDENCIES) + @rm -f table_example_02$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(table_example_02_OBJECTS) $(table_example_02_LDADD) $(LIBS) +theme_example_01$(EXEEXT): $(theme_example_01_OBJECTS) $(theme_example_01_DEPENDENCIES) + @rm -f theme_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(theme_example_01_OBJECTS) $(theme_example_01_LDADD) $(LIBS) +theme_example_02$(EXEEXT): $(theme_example_02_OBJECTS) $(theme_example_02_DEPENDENCIES) + @rm -f theme_example_02$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(theme_example_02_OBJECTS) $(theme_example_02_LDADD) $(LIBS) +thumb_example_01$(EXEEXT): $(thumb_example_01_OBJECTS) $(thumb_example_01_DEPENDENCIES) + @rm -f thumb_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(thumb_example_01_OBJECTS) $(thumb_example_01_LDADD) $(LIBS) +toolbar_example_01$(EXEEXT): $(toolbar_example_01_OBJECTS) $(toolbar_example_01_DEPENDENCIES) + @rm -f toolbar_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(toolbar_example_01_OBJECTS) $(toolbar_example_01_LDADD) $(LIBS) +toolbar_example_02$(EXEEXT): $(toolbar_example_02_OBJECTS) $(toolbar_example_02_DEPENDENCIES) + @rm -f toolbar_example_02$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(toolbar_example_02_OBJECTS) $(toolbar_example_02_LDADD) $(LIBS) +toolbar_example_03$(EXEEXT): $(toolbar_example_03_OBJECTS) $(toolbar_example_03_DEPENDENCIES) + @rm -f toolbar_example_03$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(toolbar_example_03_OBJECTS) $(toolbar_example_03_LDADD) $(LIBS) +transit_example_01$(EXEEXT): $(transit_example_01_OBJECTS) $(transit_example_01_DEPENDENCIES) + @rm -f transit_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(transit_example_01_OBJECTS) $(transit_example_01_LDADD) $(LIBS) +transit_example_02$(EXEEXT): $(transit_example_02_OBJECTS) $(transit_example_02_DEPENDENCIES) + @rm -f transit_example_02$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(transit_example_02_OBJECTS) $(transit_example_02_LDADD) $(LIBS) +transit_example_03$(EXEEXT): $(transit_example_03_OBJECTS) $(transit_example_03_DEPENDENCIES) + @rm -f transit_example_03$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(transit_example_03_OBJECTS) $(transit_example_03_LDADD) $(LIBS) +transit_example_04$(EXEEXT): $(transit_example_04_OBJECTS) $(transit_example_04_DEPENDENCIES) + @rm -f transit_example_04$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(transit_example_04_OBJECTS) $(transit_example_04_LDADD) $(LIBS) +web_example$(EXEEXT): $(web_example_OBJECTS) $(web_example_DEPENDENCIES) + @rm -f web_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(web_example_OBJECTS) $(web_example_LDADD) $(LIBS) +win_example$(EXEEXT): $(win_example_OBJECTS) $(win_example_DEPENDENCIES) + @rm -f win_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(win_example_OBJECTS) $(win_example_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/actionslider_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bg_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bg_example_02.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bg_example_03.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/box_example_02.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bubble_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/button_example_00.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/button_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/calendar_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/calendar_example_02.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/calendar_example_03.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/calendar_example_04.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/calendar_example_05.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/calendar_example_06.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clock_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/colorselector_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conformant_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conformant_example_02.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctxpopup_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/datetime_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dayselector_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskselector_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diskselector_example_02.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/efl_thread_1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/efl_thread_2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/efl_thread_3.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/efl_thread_4.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/efl_thread_5.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/efl_thread_6.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/efl_thread_win32_1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/efl_thread_win32_2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/efl_thread_win32_3.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/efl_thread_win32_4.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/entry_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileselector_button_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileselector_entry_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileselector_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flip_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flipselector_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frame_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/general_funcs_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gengrid_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genlist_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genlist_example_02.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genlist_example_03.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genlist_example_04.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genlist_example_05.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hover_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hoversel_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icon_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/image_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/index_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/index_example_02.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inwin_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/label_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/layout_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/layout_example_02.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/layout_example_03.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list_example_02.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list_example_03.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/map_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/map_example_02.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/map_example_03.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mapbuf_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/menu_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/notify_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/panel_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/panes_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/photocam_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/popup_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/popup_example_02.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/popup_example_03.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/progressbar_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/radio_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scroller_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/segment_control_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/separator_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/slider_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/slideshow_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spinner_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/table_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/table_example_02.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/theme_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/theme_example_02.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thumb_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/toolbar_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/toolbar_example_02.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/toolbar_example_03.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transit_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transit_example_02.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transit_example_03.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transit_example_04.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/web_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/win_example.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-filesDATA: $(files_DATA) + @$(NORMAL_INSTALL) + test -z "$(filesdir)" || $(MKDIR_P) "$(DESTDIR)$(filesdir)" + @list='$(files_DATA)'; test -n "$(filesdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(filesdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(filesdir)" || exit $$?; \ + done + +uninstall-filesDATA: + @$(NORMAL_UNINSTALL) + @list='$(files_DATA)'; test -n "$(filesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(filesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(filesdir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(examplesdir)" "$(DESTDIR)$(filesdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +@EFL_BUILD_EXAMPLES_FALSE@clean-local: +clean: clean-am + +clean-am: clean-examplesPROGRAMS clean-generic clean-libtool \ + clean-local mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-examplesPROGRAMS install-filesDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-examplesPROGRAMS uninstall-filesDATA + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean \ + clean-examplesPROGRAMS clean-generic clean-libtool clean-local \ + ctags distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am \ + install-examplesPROGRAMS install-exec install-exec-am \ + install-filesDATA install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-examplesPROGRAMS \ + uninstall-filesDATA + + +.PHONY: screenshots + +.edc.edj: + $(EDJE_CC) $(EDJE_FLAGS) $< $@ + +@EFL_BUILD_EXAMPLES_TRUE@clean-local: +@EFL_BUILD_EXAMPLES_TRUE@ rm -f *.edj +@EFL_BUILD_EXAMPLES_TRUE@screenshots: all +@EFL_BUILD_EXAMPLES_TRUE@ @mkdir -p $(HTML_SS_DIR) +@EFL_BUILD_EXAMPLES_TRUE@ @mkdir -p $(LATEX_SS_DIR) +@EFL_BUILD_EXAMPLES_TRUE@ @for ss in $(SCREENSHOTS); do \ +@EFL_BUILD_EXAMPLES_TRUE@ SS_ENTRY=($${ss//:/ }) ; \ +@EFL_BUILD_EXAMPLES_TRUE@ EXAMPLE=$${SS_ENTRY[0]} ; \ +@EFL_BUILD_EXAMPLES_TRUE@ SS_FILE=$${SS_ENTRY[1]} ; \ +@EFL_BUILD_EXAMPLES_TRUE@ SS_DELAY=$${SS_ENTRY[2]} ; \ +@EFL_BUILD_EXAMPLES_TRUE@ ILLUME_KBD=0,0,240,123 ILLUME_IND=0,0,240,32 ILLUME_STK=0,288,240,32 ELM_ENGINE="shot:delay=$${SS_DELAY}:file=$(HTML_SS_DIR)/$${SS_FILE}" ./$${EXAMPLE} ; \ +@EFL_BUILD_EXAMPLES_TRUE@ convert $(HTML_SS_DIR)/$${SS_FILE} $(LATEX_SS_DIR)/$${SS_FILE/.png/.eps} ; \ +@EFL_BUILD_EXAMPLES_TRUE@ done + +@EFL_BUILD_EXAMPLES_FALSE@screenshots: +@EFL_BUILD_EXAMPLES_FALSE@ @echo "Examples are not built. Run \"./configure --enable-build-examples\" first." + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/elementary/src/examples/actionslider_example_01.c b/libraries/elementary/src/examples/actionslider_example_01.c new file mode 100644 index 0000000..3e31347 --- /dev/null +++ b/libraries/elementary/src/examples/actionslider_example_01.c @@ -0,0 +1,148 @@ +//Compile with: +//gcc -g actionslider_example_01.c -o actionslider_example_01 `pkg-config --cflags --libs elementary` + +#include + +static void _pos_selected_cb(void *data, Evas_Object *obj, void *event_info) +{ + printf("Selection: %s\n", (char *)event_info); + printf("Label selected: %s\n", elm_actionslider_selected_label_get(obj)); +} + +static void +_position_change_magnetic_cb(void *data, Evas_Object * obj, void *event_info) +{ + if (!strcmp((char *)event_info, "left")) + elm_actionslider_magnet_pos_set(obj, ELM_ACTIONSLIDER_LEFT); + else if (!strcmp((char *)event_info, "right")) + elm_actionslider_magnet_pos_set(obj, ELM_ACTIONSLIDER_RIGHT); +} + +static void +_magnet_enable_disable_cb(void *data, Evas_Object *obj, void *event_info) +{ + if (!strcmp((char *)event_info, "left")) + elm_actionslider_magnet_pos_set(obj, ELM_ACTIONSLIDER_CENTER); + else if (!strcmp((char *)event_info, "right")) + elm_actionslider_magnet_pos_set(obj, ELM_ACTIONSLIDER_NONE); +} + +static void +on_done(void *data, Evas_Object *obj, void *event_info) +{ + elm_exit(); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *bx, *as; + + win = elm_win_add(NULL, "actionslider", ELM_WIN_BASIC); + elm_win_title_set(win, "Actionslider"); + evas_object_smart_callback_add(win, "delete,request", on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, 0); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + as = elm_actionslider_add(win); + evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0); + elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_RIGHT); + elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_RIGHT); + elm_object_part_text_set(as, "left", "Snooze"); + elm_object_part_text_set(as, "right", "Stop"); + elm_actionslider_enabled_pos_set(as, ELM_ACTIONSLIDER_LEFT | + ELM_ACTIONSLIDER_RIGHT); + evas_object_smart_callback_add(as, "pos_changed", + _position_change_magnetic_cb, NULL); + evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL); + evas_object_show(as); + elm_box_pack_end(bx, as); + + as = elm_actionslider_add(win); + evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0); + elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_CENTER); + elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_CENTER); + elm_object_part_text_set(as, "left", "Snooze"); + elm_object_part_text_set(as, "right", "Stop"); + elm_actionslider_enabled_pos_set(as, ELM_ACTIONSLIDER_LEFT | + ELM_ACTIONSLIDER_RIGHT); + evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL); + evas_object_show(as); + elm_box_pack_end(bx, as); + + as = elm_actionslider_add(win); + elm_object_style_set(as, "bar"); + evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0); + elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_LEFT); + elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_CENTER| + ELM_ACTIONSLIDER_RIGHT); + elm_actionslider_enabled_pos_set(as, ELM_ACTIONSLIDER_CENTER | + ELM_ACTIONSLIDER_RIGHT); + elm_object_part_text_set(as, "center", "Accept"); + elm_object_part_text_set(as, "right", "Reject"); + evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL); + evas_object_show(as); + elm_box_pack_end(bx, as); + + as = elm_actionslider_add(win); + elm_object_style_set(as, "bar"); + evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0); + elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_LEFT); + elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_LEFT); + elm_object_part_text_set(as, "center", "Accept"); + elm_object_part_text_set(as, "right", "Reject"); + elm_object_text_set(as, "Go"); + evas_object_smart_callback_add(as, "pos_changed", + _position_change_magnetic_cb, NULL); + evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL); + evas_object_show(as); + elm_box_pack_end(bx, as); + + + as = elm_actionslider_add(win); + evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0); + elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_LEFT); + elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_ALL); + elm_object_part_text_set(as, "left", "Left"); + elm_object_part_text_set(as, "center", "Center"); + elm_object_part_text_set(as, "right", "Right"); + elm_object_text_set(as, "Go"); + evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL); + evas_object_show(as); + elm_box_pack_end(bx, as); + + as = elm_actionslider_add(win); + evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0); + elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_CENTER); + elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_CENTER); + elm_object_part_text_set(as, "left", "Enable"); + elm_object_part_text_set(as, "center", "Magnet"); + elm_object_part_text_set(as, "right", "Disable"); + evas_object_smart_callback_add(as, "pos_changed", + _magnet_enable_disable_cb, NULL); + evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL); + evas_object_show(as); + elm_box_pack_end(bx, as); + + evas_object_resize(win, 320, 400); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/bg_example_01.c b/libraries/elementary/src/examples/bg_example_01.c new file mode 100644 index 0000000..307f11a --- /dev/null +++ b/libraries/elementary/src/examples/bg_example_01.c @@ -0,0 +1,50 @@ +//Compile with: +//gcc -o bg_example_01 bg_example_01.c -g `pkg-config --cflags --libs elementary` + +#include + +static void +on_done(void *data, Evas_Object *obj, void *event_info) +{ + /* quit the mainloop (elm_run) */ + elm_exit(); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg; + + win = elm_win_add(NULL, "bg-plain", ELM_WIN_BASIC); + elm_win_title_set(win, "Bg Plain"); + evas_object_smart_callback_add(win, "delete,request", on_done, NULL); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + /* allow bg to expand in x & y */ + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + /* set size hints. a minimum size for the bg. this should propagate back + * to the window thus limiting its size based off the bg as the bg is one + * of the window's resize objects. */ + evas_object_size_hint_min_set(bg, 160, 160); + /* and set a maximum size. not needed very often. normally used together + * with evas_object_size_hint_min_set() at the same size to make a + * window not resizable */ + evas_object_size_hint_max_set(bg, 640, 640); + /* and now just resize the window to a size you want. normally widgets + * will determine the initial size though */ + evas_object_resize(win, 320, 320); + /* and show the window */ + evas_object_show(win); + + elm_run(); /* and run the program now, starting to handle all + * events, etc. */ + elm_shutdown(); /* clean up and shut down */ + + /* exit code */ + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/bg_example_02.c b/libraries/elementary/src/examples/bg_example_02.c new file mode 100644 index 0000000..eec6101 --- /dev/null +++ b/libraries/elementary/src/examples/bg_example_02.c @@ -0,0 +1,45 @@ +//Compile with: +//gcc -o bg_example_02 bg_example_02.c -g `pkg-config --cflags --libs elementary` +//where directory is the a path where images/plant_01.jpg can be found. + +#include + +static void +on_done(void *data, Evas_Object *obj, void *event_info) +{ + /* quit the mainloop (elm_run) */ + elm_exit(); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg; + char buf[PATH_MAX]; + + elm_app_info_set(elm_main, "elementary", "images/plant_01.jpg"); + win = elm_win_add(NULL, "bg-image", ELM_WIN_BASIC); + elm_win_title_set(win, "Bg Image"); + evas_object_smart_callback_add(win, "delete,request", on_done, NULL); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + elm_bg_load_size_set(bg, 20, 20); + elm_bg_option_set(bg, ELM_BG_OPTION_CENTER); + snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); + elm_bg_file_set(bg, buf, NULL); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + evas_object_size_hint_min_set(bg, 160, 160); + evas_object_size_hint_max_set(bg, 640, 640); + evas_object_resize(win, 320, 320); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/bg_example_03.c b/libraries/elementary/src/examples/bg_example_03.c new file mode 100644 index 0000000..0ffe185 --- /dev/null +++ b/libraries/elementary/src/examples/bg_example_03.c @@ -0,0 +1,172 @@ +//Compile with: +//gcc -o bg_example_03 bg_example_03.c -g `pkg-config --cflags --libs elementary` +//where directory is the a path where images/plant_01.jpg can be found. + +#include + +static void +on_done(void *data, Evas_Object *obj, void *event_info) +{ + /* quit the mainloop (elm_run) */ + elm_exit(); +} + +static void +_cb_radio_changed(void *data, Evas_Object *obj, void *event) +{ + Evas_Object *o_bg = data; + + elm_bg_option_set(o_bg, elm_radio_value_get((Evas_Object *)obj)); +} + +static void +_cb_overlay_changed(void *data, Evas_Object *obj, void *event) +{ + Evas_Object *o_bg = data; + + if (elm_check_state_get(obj)) + { + Evas_Object *parent, *over; + char buff[PATH_MAX]; + + snprintf(buff, sizeof(buff), "%s/objects/test.edj", elm_app_data_dir_get()); + parent = elm_object_parent_widget_get(o_bg); + over = edje_object_add(evas_object_evas_get(parent)); + edje_object_file_set(over, buff, "bg_overlay"); + elm_object_part_content_set(o_bg, "overlay", over); + } + else + elm_object_part_content_set(o_bg, "overlay", NULL); +} + +static void +_cb_color_changed(void *data, Evas_Object *obj, void *event) +{ + Evas_Object *o_bg = data; + double val = 0.0; + + val = elm_spinner_value_get(obj); + if (val == 1.0) + elm_bg_color_set(o_bg, 255, 255, 255); + else if (val == 2.0) + elm_bg_color_set(o_bg, 255, 0, 0); + else if (val == 3.0) + elm_bg_color_set(o_bg, 0, 0, 255); + else if (val == 4.0) + elm_bg_color_set(o_bg, 0, 255, 0); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg; + Evas_Object *box, *hbox, *o_bg; + Evas_Object *rd, *rdg; + char buf[PATH_MAX]; + + elm_app_info_set(elm_main, "elementary", "objects/test.edj"); + win = elm_win_add(NULL, "bg-options", ELM_WIN_BASIC); + elm_win_title_set(win, "Bg Options"); + evas_object_smart_callback_add(win, "delete,request", on_done, NULL); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + box = elm_box_add(win); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, box); + evas_object_show(box); + + o_bg = elm_bg_add(win); + snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); + elm_bg_file_set(o_bg, buf, NULL); + evas_object_size_hint_weight_set(o_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(o_bg, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, o_bg); + evas_object_show(o_bg); + + hbox = elm_box_add(win); + elm_box_horizontal_set(hbox, EINA_TRUE); + evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL); + + rd = elm_radio_add(win); + elm_radio_state_value_set(rd, ELM_BG_OPTION_CENTER); + elm_object_text_set(rd, "Center"); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg); + elm_box_pack_end(hbox, rd); + evas_object_show(rd); + rdg = rd; + + rd = elm_radio_add(win); + elm_radio_state_value_set(rd, ELM_BG_OPTION_SCALE); + elm_radio_group_add(rd, rdg); + elm_object_text_set(rd, "Scale"); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg); + elm_box_pack_end(hbox, rd); + evas_object_show(rd); + + rd = elm_radio_add(win); + elm_radio_state_value_set(rd, ELM_BG_OPTION_STRETCH); + elm_radio_group_add(rd, rdg); + elm_object_text_set(rd, "Stretch"); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg); + elm_box_pack_end(hbox, rd); + evas_object_show(rd); + + rd = elm_radio_add(win); + elm_radio_state_value_set(rd, ELM_BG_OPTION_TILE); + elm_radio_group_add(rd, rdg); + elm_object_text_set(rd, "Tile"); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg); + elm_box_pack_end(hbox, rd); + evas_object_show(rd); + + elm_radio_value_set(rdg, ELM_BG_OPTION_SCALE); + + rd = elm_check_add(win); + elm_object_text_set(rd, "Show Overlay"); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_smart_callback_add(rd, "changed", _cb_overlay_changed, o_bg); + elm_box_pack_end(hbox, rd); + evas_object_show(rd); + + /* color choices ... this is ghetto, but we don't have a 'colorpicker' + * widget yet :( */ + rd = elm_spinner_add(win); + elm_object_style_set(rd, "vertical"); + elm_spinner_min_max_set(rd, 1, 4); + elm_spinner_label_format_set(rd, "%.0f"); + elm_spinner_editable_set(rd, EINA_FALSE); + elm_spinner_special_value_add(rd, 1, "White"); + elm_spinner_special_value_add(rd, 2, "Red"); + elm_spinner_special_value_add(rd, 3, "Blue"); + elm_spinner_special_value_add(rd, 4, "Green"); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_smart_callback_add(rd, "changed", _cb_color_changed, o_bg); + elm_box_pack_end(hbox, rd); + evas_object_show(rd); + + elm_box_pack_end(box, hbox); + evas_object_show(hbox); + + evas_object_size_hint_min_set(bg, 160, 160); + evas_object_size_hint_max_set(bg, 640, 640); + evas_object_resize(win, 460, 320); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} + +ELM_MAIN() diff --git a/libraries/elementary/src/examples/box_example_02.c b/libraries/elementary/src/examples/box_example_02.c new file mode 100644 index 0000000..48e470b --- /dev/null +++ b/libraries/elementary/src/examples/box_example_02.c @@ -0,0 +1,169 @@ +//Compile with: +//gcc -g box_example_02.c -o box_example_02 `pkg-config --cflags --libs elementary` + +#include + +typedef struct +{ + Eina_List *transitions; + Evas_Object *box; + Evas_Object_Box_Layout last_layout; +} Transitions_Data; + +static void +_add_cb(void *data, Evas_Object *obj, void *ev) +{ + Evas_Object *btn; + Eina_List *children; + Transitions_Data *tdata = data; + + btn = elm_button_add(tdata->box); + elm_object_text_set(btn, "I do nothing"); + children = (Eina_List *)elm_box_children_get(tdata->box); + if (children) + { + elm_box_pack_after(tdata->box, btn, (Evas_Object *)children->data); + eina_list_free(children); + } + else + elm_box_pack_end(tdata->box, btn); + evas_object_show(btn); +} + +static void +_clear_cb(void *data, Evas_Object *obj, void *ev) +{ + Transitions_Data *tdata = data; + elm_box_clear(tdata->box); +} + +static void +_unpack_cb(void *data, Evas_Object *obj, void *ev) +{ + Transitions_Data *tdata = data; + elm_box_unpack(tdata->box, obj); + evas_object_move(obj, 0, 50); + evas_object_color_set(obj, 128, 64, 0, 128); +} + +static void +_test_box_transition_change(void *data) +{ + Transitions_Data *tdata = data; + Elm_Box_Transition *layout_data; + Evas_Object_Box_Layout next_layout; + + if (!data) return; + next_layout = eina_list_data_get(tdata->transitions); + layout_data = elm_box_transition_new(2.0, tdata->last_layout, + NULL, NULL, next_layout, NULL, NULL, + _test_box_transition_change, tdata); + elm_box_layout_set(tdata->box, elm_box_layout_transition, layout_data, + elm_box_transition_free); + tdata->last_layout = next_layout; + + tdata->transitions = eina_list_demote_list(tdata->transitions, + tdata->transitions); +} + +EAPI_MAIN int +elm_main(int argc, char *argv[]) +{ + Evas_Object *win, *bg, *bigbox, *bx, *bt; + static Transitions_Data tdata = { + .transitions = NULL, + .box = NULL, + .last_layout = NULL + }; + + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + win = elm_win_add(NULL, "box-transition", ELM_WIN_BASIC); + elm_win_title_set(win, "Box Transition"); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_resize(win, 300, 320); + evas_object_show(win); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bigbox = elm_box_add(win); + evas_object_size_hint_weight_set(bigbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bigbox); + evas_object_show(bigbox); + + bx = elm_box_add(win); + elm_box_horizontal_set(bx, EINA_TRUE); + elm_box_pack_end(bigbox, bx); + evas_object_show(bx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Add"); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + evas_object_smart_callback_add(bt, "clicked", _add_cb, &tdata); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Clear"); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + evas_object_smart_callback_add(bt, "clicked", _clear_cb, &tdata); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bigbox, bx); + evas_object_show(bx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 1"); + evas_object_smart_callback_add(bt, "clicked", _unpack_cb, &tdata); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 2"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bt, 1.0, 0.5); + evas_object_smart_callback_add(bt, "clicked", _unpack_cb, &tdata); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Button 3"); + evas_object_smart_callback_add(bt, "clicked", _unpack_cb, &tdata); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + tdata.box = bx; + tdata.last_layout = evas_object_box_layout_horizontal; + tdata.transitions = eina_list_append(tdata.transitions, + evas_object_box_layout_vertical); + tdata.transitions = eina_list_append(tdata.transitions, + evas_object_box_layout_horizontal); + tdata.transitions = eina_list_append(tdata.transitions, + evas_object_box_layout_stack); + tdata.transitions = eina_list_append(tdata.transitions, + evas_object_box_layout_homogeneous_vertical); + tdata.transitions = eina_list_append(tdata.transitions, + evas_object_box_layout_homogeneous_horizontal); + tdata.transitions = eina_list_append(tdata.transitions, + evas_object_box_layout_flow_vertical); + tdata.transitions = eina_list_append(tdata.transitions, + evas_object_box_layout_flow_horizontal); + tdata.transitions = eina_list_append(tdata.transitions, + evas_object_box_layout_stack); + + elm_box_layout_set(bx, evas_object_box_layout_horizontal, NULL, NULL); + _test_box_transition_change(&tdata); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/bubble_example_01.c b/libraries/elementary/src/examples/bubble_example_01.c new file mode 100644 index 0000000..c3e2cff --- /dev/null +++ b/libraries/elementary/src/examples/bubble_example_01.c @@ -0,0 +1,68 @@ +//Compile with: +//gcc -o bubble_example_01 bubble_example_01.c -g `pkg-config --cflags --libs elementary` + +#include + +void +_bla(void *data, Evas_Object *obj, void *event_info) +{ + static unsigned char corner = 0; + ++corner; + if (corner > 3) + elm_bubble_pos_set(obj, ELM_BUBBLE_POS_TOP_LEFT); + else + elm_bubble_pos_set(obj, corner); + +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *bubble, *label, *icon; + + win = elm_win_add(NULL, "bubble", ELM_WIN_BASIC); + elm_win_title_set(win, "Bubble"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + evas_object_resize(win, 300, 200); + evas_object_show(win); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + label = elm_label_add(win); + elm_object_text_set(label, "This is the CONTENT of our bubble"); + evas_object_show(label); + + icon = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(icon, 0, 0, 255, 255); + evas_object_show(icon); + + bubble = elm_bubble_add(win); + elm_object_part_content_set(bubble, "icon", icon); + elm_object_part_text_set(bubble, "info", "INFO"); + elm_object_text_set(bubble, "LABEL"); + elm_object_content_set(bubble, label); + evas_object_resize(bubble, 300, 100); + evas_object_show(bubble); + + evas_object_smart_callback_add(bubble, "clicked", _bla, NULL); + + label = elm_label_add(win); + elm_object_text_set(label, "Bubble with no icon, info or label"); + evas_object_show(label); + + bubble = elm_bubble_add(win); + elm_object_content_set(bubble, label); + evas_object_resize(bubble, 200, 50); + evas_object_move(bubble, 0, 110); + evas_object_show(bubble); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/button_example_00.c b/libraries/elementary/src/examples/button_example_00.c new file mode 100644 index 0000000..d9f37b1 --- /dev/null +++ b/libraries/elementary/src/examples/button_example_00.c @@ -0,0 +1,49 @@ +/* + * gcc -o button_example_00 button_example_00.c `pkg-config --cflags --libs elementary` + */ +#include + +static void +on_click(void *data, Evas_Object *obj, void *event_info) +{ + elm_exit(); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win = NULL; + Evas_Object *bg = NULL; + Evas_Object *btn = NULL; + + /* Create an win, associate it with a canvas and */ + /* turn it visible on WM (Window Manager). */ + win = elm_win_add(NULL, "Greetings", ELM_WIN_BASIC); + elm_win_title_set(win, "Hello, World!"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + evas_object_resize(win, 240, 60); + evas_object_show(win); + + /* Create a bg, associate it to an win */ + /* and turn it visible on WM. */ + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + /* Create a btn, associate to a function, associate */ + /* to win, give a dimension and position. */ + btn = elm_button_add(win); + elm_object_text_set(btn, "Good-Bye, World!"); + evas_object_smart_callback_add(btn, "clicked", on_click, NULL); + evas_object_resize(btn, 120, 30); + evas_object_move(btn, 60, 15); + evas_object_show(btn); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/button_example_01.c b/libraries/elementary/src/examples/button_example_01.c new file mode 100644 index 0000000..4005662 --- /dev/null +++ b/libraries/elementary/src/examples/button_example_01.c @@ -0,0 +1,265 @@ +/* + * gcc -o button_example_01 button_example_01.c `pkg-config --cflags --libs elementary` + */ +#include + +typedef struct +{ + Evas_Object *mid; + Evas_Object *icon_still; + struct { + Evas_Object *up; + Evas_Object *down; + Evas_Object *left; + Evas_Object *right; + } cursors; +} App_Data; + +static void +_btn_cursors_release_cb(void *data, Evas_Object *btn, void *ev) +{ + App_Data *app = data; + elm_object_part_content_set(app->mid, "icon", app->icon_still); + app->icon_still = NULL; +} + +static void +_btn_cursors_move_cb(void *data, Evas_Object *btn, void *ev) +{ + App_Data *app = data; + double ax, ay; + + if (!app->icon_still) + { + Evas_Object *icon; + app->icon_still = elm_object_content_unset(app->mid); + evas_object_hide(app->icon_still); + icon = elm_icon_add(app->mid); + elm_icon_standard_set(icon, "chat"); + elm_object_part_content_set(app->mid, "icon", icon); + } + + evas_object_size_hint_align_get(app->mid, &ax, &ay); + if (btn == app->cursors.up) + { + ay -= 0.05; + if (ay < 0.0) + ay = 0.0; + } + else if (btn == app->cursors.down) + { + ay += 0.05; + if (ay > 1.0) + ay = 1.0; + } + else if (btn == app->cursors.left) + { + ax -= 0.05; + if (ax < 0.0) + ax = 0.0; + } + else if (btn == app->cursors.right) + { + ax += 0.05; + if (ax > 1.0) + ax = 1.0; + } + evas_object_size_hint_align_set(app->mid, ax, ay); +} + +static void +_btn_options_cb(void *data, Evas_Object *btn, void *ev) +{ + char *ptr; + double t; + App_Data *app = data; + const char *lbl = elm_object_text_get(btn); + + ptr = strchr(lbl, ':'); + ptr += 2; + t = strtod(ptr, NULL); + + if (!strncmp(lbl, "Initial", 7)) + { + elm_button_autorepeat_initial_timeout_set(app->cursors.up, t); + elm_button_autorepeat_initial_timeout_set(app->cursors.down, t); + elm_button_autorepeat_initial_timeout_set(app->cursors.left, t); + elm_button_autorepeat_initial_timeout_set(app->cursors.right, t); + } + else if (!strncmp(lbl, "Gap", 3)) + { + elm_button_autorepeat_gap_timeout_set(app->cursors.up, t); + elm_button_autorepeat_gap_timeout_set(app->cursors.down, t); + elm_button_autorepeat_gap_timeout_set(app->cursors.left, t); + elm_button_autorepeat_gap_timeout_set(app->cursors.right, t); + } +} + +EAPI_MAIN int +elm_main(int argc, char *argv[]) +{ + Evas_Object *win, *bg, *box, *box2, *btn, *icon; + static App_Data data; + + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + win = elm_win_add(NULL, "Button example", ELM_WIN_BASIC); + elm_win_title_set(win, "Button example"); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_resize(win, 300, 320); + evas_object_show(win); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + box = elm_box_add(win); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, box); + evas_object_show(box); + + box2 = elm_box_add(win); + elm_box_horizontal_set(box2, EINA_TRUE); + evas_object_size_hint_weight_set(box2, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(box, box2); + evas_object_show(box2); + + btn = elm_button_add(win); + elm_object_text_set(btn, "Initial: 0.0"); + elm_box_pack_end(box2, btn); + evas_object_show(btn); + evas_object_smart_callback_add(btn, "clicked", _btn_options_cb, &data); + + btn = elm_button_add(win); + elm_object_text_set(btn, "Initial: 1.0"); + elm_box_pack_end(box2, btn); + evas_object_show(btn); + evas_object_smart_callback_add(btn, "clicked", _btn_options_cb, &data); + + btn = elm_button_add(win); + elm_object_text_set(btn, "Initial: 5.0"); + elm_box_pack_end(box2, btn); + evas_object_show(btn); + evas_object_smart_callback_add(btn, "clicked", _btn_options_cb, &data); + + box2 = elm_box_add(win); + elm_box_horizontal_set(box2, EINA_TRUE); + evas_object_size_hint_weight_set(box2, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(box, box2); + evas_object_show(box2); + + btn = elm_button_add(win); + elm_object_text_set(btn, "Gap: 0.1"); + elm_box_pack_end(box2, btn); + evas_object_show(btn); + evas_object_smart_callback_add(btn, "clicked", _btn_options_cb, &data); + + btn = elm_button_add(win); + elm_object_text_set(btn, "Gap: 0.5"); + elm_box_pack_end(box2, btn); + evas_object_show(btn); + evas_object_smart_callback_add(btn, "clicked", _btn_options_cb, &data); + + btn = elm_button_add(win); + elm_object_text_set(btn, "Gap: 1.0"); + elm_box_pack_end(box2, btn); + evas_object_show(btn); + evas_object_smart_callback_add(btn, "clicked", _btn_options_cb, &data); + + btn = elm_button_add(win); + elm_button_autorepeat_set(btn, EINA_TRUE); + elm_button_autorepeat_initial_timeout_set(btn, 1.0); + elm_button_autorepeat_gap_timeout_set(btn, 0.5); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0.0); + elm_box_pack_end(box, btn); + evas_object_show(btn); + evas_object_smart_callback_add(btn, "repeated", _btn_cursors_move_cb, &data); + evas_object_smart_callback_add(btn, "unpressed", _btn_cursors_release_cb, + &data); + + icon = elm_icon_add(win); + elm_icon_standard_set(icon, "arrow_up"); + elm_object_part_content_set(btn, "icon", icon); + + data.cursors.up = btn; + + box2 = elm_box_add(win); + elm_box_horizontal_set(box2, EINA_TRUE); + evas_object_size_hint_weight_set(box2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(box2, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, box2); + evas_object_show(box2); + + btn = elm_button_add(win); + elm_button_autorepeat_set(btn, EINA_TRUE); + elm_button_autorepeat_initial_timeout_set(btn, 1.0); + elm_button_autorepeat_gap_timeout_set(btn, 0.5); + evas_object_size_hint_weight_set(btn, 0.0, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(btn, 0.0, EVAS_HINT_FILL); + elm_box_pack_end(box2, btn); + evas_object_show(btn); + evas_object_smart_callback_add(btn, "repeated", _btn_cursors_move_cb, &data); + evas_object_smart_callback_add(btn, "unpressed", _btn_cursors_release_cb, + &data); + + icon = elm_icon_add(win); + elm_icon_standard_set(icon, "arrow_left"); + elm_object_part_content_set(btn, "icon", icon); + + data.cursors.left = btn; + + btn = elm_button_add(win); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(box2, btn); + evas_object_show(btn); + + icon = elm_icon_add(win); + elm_icon_standard_set(icon, "close"); + elm_object_part_content_set(btn, "icon", icon); + + data.mid = btn; + + btn = elm_button_add(win); + elm_button_autorepeat_set(btn, EINA_TRUE); + elm_button_autorepeat_initial_timeout_set(btn, 1.0); + elm_button_autorepeat_gap_timeout_set(btn, 0.5); + evas_object_size_hint_weight_set(btn, 0.0, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(btn, 0.0, EVAS_HINT_FILL); + elm_box_pack_end(box2, btn); + evas_object_show(btn); + evas_object_smart_callback_add(btn, "repeated", _btn_cursors_move_cb, &data); + evas_object_smart_callback_add(btn, "unpressed", _btn_cursors_release_cb, + &data); + + icon = elm_icon_add(win); + elm_icon_standard_set(icon, "arrow_right"); + elm_object_part_content_set(btn, "icon", icon); + + data.cursors.right = btn; + + btn = elm_button_add(win); + elm_button_autorepeat_set(btn, EINA_TRUE); + elm_button_autorepeat_initial_timeout_set(btn, 1.0); + elm_button_autorepeat_gap_timeout_set(btn, 0.5); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0.0); + elm_box_pack_end(box, btn); + evas_object_show(btn); + evas_object_smart_callback_add(btn, "repeated", _btn_cursors_move_cb, &data); + evas_object_smart_callback_add(btn, "unpressed", _btn_cursors_release_cb, + &data); + + icon = elm_icon_add(win); + elm_icon_standard_set(icon, "arrow_down"); + elm_object_part_content_set(btn, "icon", icon); + + data.cursors.down = btn; + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/calendar_example_01.c b/libraries/elementary/src/examples/calendar_example_01.c new file mode 100644 index 0000000..f00cfc4 --- /dev/null +++ b/libraries/elementary/src/examples/calendar_example_01.c @@ -0,0 +1,41 @@ +/** + * Simple Elementary's calendar widget example, illustrating its + * creation. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -o calendar_example_01 calendar_example_01.c -g `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *cal; + + win = elm_win_add(NULL, "calendar", ELM_WIN_BASIC); + elm_win_title_set(win, "Calendar Creation Example"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + cal = elm_calendar_add(win); + elm_win_resize_object_add(win, cal); + evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(cal); + + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/calendar_example_02.c b/libraries/elementary/src/examples/calendar_example_02.c new file mode 100644 index 0000000..8978451 --- /dev/null +++ b/libraries/elementary/src/examples/calendar_example_02.c @@ -0,0 +1,59 @@ +/** + * Elementary's calendar widget example, demonstrates how to modify + * layout strings, using functions to set weekdays names and to format + * month and year label. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -o calendar_example_02 calendar_example_02.c -g `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +static char * +_format_month_year(struct tm *format_time) +{ + char buf[32]; + /* abbreviates month and year */ + if (!strftime(buf, sizeof(buf), "%b %y", format_time)) return NULL; + return strdup(buf); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *cal; + const char *weekdays[] = + { + "S", "M", "T", "W", "T", "F", "S" + }; + + win = elm_win_add(NULL, "calendar", ELM_WIN_BASIC); + elm_win_title_set(win, "Calendar Layout Formatting Example"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + cal = elm_calendar_add(win); + elm_win_resize_object_add(win, cal); + evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + elm_calendar_format_function_set(cal, _format_month_year); + elm_calendar_weekdays_names_set(cal, weekdays); + + evas_object_show(cal); + + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/calendar_example_03.c b/libraries/elementary/src/examples/calendar_example_03.c new file mode 100644 index 0000000..2e86be5 --- /dev/null +++ b/libraries/elementary/src/examples/calendar_example_03.c @@ -0,0 +1,43 @@ +/** + * Simple Elementary's calendar widget example, illustrating minimum + * and maximum years restriction. User will see a calendar of years + * 2020, 2021 and 2022. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -o calendar_example_03 calendar_example_03.c -g `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *cal; + + win = elm_win_add(NULL, "calendar", ELM_WIN_BASIC); + elm_win_title_set(win, "Calendar Min/Max Year Example"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + cal = elm_calendar_add(win); + elm_win_resize_object_add(win, cal); + evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_calendar_min_max_year_set(cal, 2020, 2022); + evas_object_show(cal); + + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/calendar_example_04.c b/libraries/elementary/src/examples/calendar_example_04.c new file mode 100644 index 0000000..ff170ba --- /dev/null +++ b/libraries/elementary/src/examples/calendar_example_04.c @@ -0,0 +1,62 @@ +/** + * Elementary's calendar widget example, regarding date selection. + * Shows how to disable day selection by user and how to select a date. + * It selects two days from current day. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -o calendar_example_04 calendar_example_04.c -g `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +#define SECS_DAY 86400 + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *bx, *cal, *cal2; + struct tm selected_time; + time_t current_time; + + win = elm_win_add(NULL, "calendar", ELM_WIN_BASIC); + elm_win_title_set(win, "Calendar Day Selection Example"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + elm_win_resize_object_add(win, bx); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bx); + + cal = elm_calendar_add(win); + evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(cal, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_calendar_day_selection_disabled_set(cal, EINA_TRUE); + evas_object_show(cal); + elm_box_pack_end(bx, cal); + + cal2 = elm_calendar_add(win); + evas_object_size_hint_weight_set(cal2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(cal2, EVAS_HINT_FILL, EVAS_HINT_FILL); + current_time = time(NULL) + 2 * SECS_DAY; + localtime_r(¤t_time, &selected_time); + elm_calendar_selected_time_set(cal2, &selected_time); + evas_object_show(cal2); + elm_box_pack_end(bx, cal2); + + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/calendar_example_05.c b/libraries/elementary/src/examples/calendar_example_05.c new file mode 100644 index 0000000..6f752b1 --- /dev/null +++ b/libraries/elementary/src/examples/calendar_example_05.c @@ -0,0 +1,69 @@ +/** + * Elementary's calendar widget example, illustrating smart callback + * registry and getters usage. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -o calendar_example_05 calendar_example_05.c -g `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +static void +_print_cal_info_cb(void *data, Evas_Object *obj, void *event_info) +{ + int year_min, year_max; + Eina_Bool sel_enabled; + const char **wds; + struct tm sel_time; + double interval; + + if (!elm_calendar_selected_time_get(obj, &sel_time)) + return; + + interval = elm_calendar_interval_get(obj); + elm_calendar_min_max_year_get(obj, &year_min, &year_max); + sel_enabled = !elm_calendar_day_selection_disabled_get(obj); + wds = elm_calendar_weekdays_names_get(obj); + + printf("Day: %i, Mon: %i, Year %i, WeekDay: %i
\n" + "Interval: %0.2f, Year_Min: %i, Year_Max %i, Sel Enabled : %i
\n" + "Weekdays: %s, %s, %s, %s, %s, %s, %s
\n\n", + sel_time.tm_mday, sel_time.tm_mon, sel_time.tm_year + 1900, sel_time.tm_wday, + interval, year_min, year_max, sel_enabled, + wds[0], wds[1], wds[2], wds[3], wds[4], wds[5], wds[6]); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *cal; + + win = elm_win_add(NULL, "calendar", ELM_WIN_BASIC); + elm_win_title_set(win, "Calendar Getters Example"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + cal = elm_calendar_add(win); + elm_win_resize_object_add(win, cal); + evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + /* Add callback to display calendar information every time user + * selects a new date */ + evas_object_smart_callback_add(cal, "changed", _print_cal_info_cb, NULL); + evas_object_show(cal); + + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/calendar_example_06.c b/libraries/elementary/src/examples/calendar_example_06.c new file mode 100644 index 0000000..192aed3 --- /dev/null +++ b/libraries/elementary/src/examples/calendar_example_06.c @@ -0,0 +1,96 @@ +/** + * Elementary's calendar widget example to add / del / clear marks. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -o calendar_example_06 calendar_example_06.c -g `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +#define SECS_DAY 86400 + +static void +_btn_clear_cb(void *data, Evas_Object *btn, void *ev) +{ + Evas_Object *cal = data; + elm_calendar_marks_clear(cal); + elm_calendar_marks_draw(cal); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *bt, *bx, *cal; + Elm_Calendar_Mark *mark; + struct tm selected_time; + time_t current_time; + struct tm sunday = { 0, 0, 12, 7, 0, 0, 0, 0, -1, 0, NULL }; + /* tm {sec, min, hour, mday, mon, year, wday, yday, isdst } */ + /* weekdays since Sunday, range 0 to 6 */ + struct tm christmas; + christmas.tm_mday = 25; + /* months since Jan, in the range 0 to 11 */ + christmas.tm_mon = 11; + + win = elm_win_add(NULL, "calendar", ELM_WIN_BASIC); + elm_win_title_set(win, "Calendar Marks Example"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + elm_win_resize_object_add(win, bx); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bx); + + cal = elm_calendar_add(win); + evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(cal, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, cal); + evas_object_show(cal); + + /* check today - we'll remove it later */ + current_time = time(NULL); + localtime_r(¤t_time, &selected_time); + mark = elm_calendar_mark_add(cal, "checked", &selected_time, + ELM_CALENDAR_UNIQUE); + + /* check tomorrow */ + current_time = time(NULL) + 1 * SECS_DAY; + localtime_r(¤t_time, &selected_time); + elm_calendar_mark_add(cal, "checked", &selected_time, ELM_CALENDAR_UNIQUE); + + /* mark christmas as holiday */ + elm_calendar_mark_add(cal, "holiday", &christmas, ELM_CALENDAR_ANNUALLY); + + /* mark Sundays as holidays */ + elm_calendar_mark_add(cal, "holiday", &sunday, ELM_CALENDAR_WEEKLY); + + /* ok, let's remove today's check */ + elm_calendar_mark_del(mark); + + elm_calendar_marks_draw(cal); + + bt = elm_button_add(win); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(bt, "Clear marks"); + evas_object_smart_callback_add(bt, "clicked", _btn_clear_cb, cal); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/check_example_01.c b/libraries/elementary/src/examples/check_example_01.c new file mode 100644 index 0000000..d8ae334 --- /dev/null +++ b/libraries/elementary/src/examples/check_example_01.c @@ -0,0 +1,59 @@ +//Compile with: +//gcc -o check_example_01 check_example_01.c -g `pkg-config --cflags --libs elementary` + +#include + +static void _print(void *data, Evas_Object *obj, void *event_info); + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *cb, *cb2, *icon; + Eina_Bool value; + + win = elm_win_add(NULL, "check", ELM_WIN_BASIC); + elm_win_title_set(win, "Check"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + cb = elm_check_add(win); + elm_object_text_set(cb, "checkbox"); + elm_check_state_pointer_set(cb, &value); + evas_object_smart_callback_add(cb, "changed", _print, &value); + evas_object_move(cb, 10, 10); + evas_object_resize(cb, 200, 30); + evas_object_show(cb); + + icon = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(icon, 0, 255, 0, 255); + evas_object_resize(icon, 20, 20); + evas_object_show(icon); + + cb2 = elm_check_add(win); + elm_object_text_set(cb2, "another checkbox"); + elm_check_state_set(cb2, EINA_TRUE); + elm_object_part_content_set(cb2, "icon", icon); + evas_object_move(cb2, 10, 50); + evas_object_resize(cb2, 200, 30); + evas_object_show(cb2); + + evas_object_resize(win, 200, 100); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() + +static void +_print(void *data, Evas_Object *obj, void *event_info) +{ + printf("check %smarked\n", *((Eina_Bool*)data) ? "" : "un"); +} diff --git a/libraries/elementary/src/examples/clock_example.c b/libraries/elementary/src/examples/clock_example.c new file mode 100644 index 0000000..7f32cad --- /dev/null +++ b/libraries/elementary/src/examples/clock_example.c @@ -0,0 +1,85 @@ +/** + * Simple Elementary's clock widget example, illustrating its + * usage and API. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g clock_example.c -o clock_example `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +static void +_on_done(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_exit(); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *bx, *ck; + unsigned int digedit; + + win = elm_win_add(NULL, "clock", ELM_WIN_BASIC); + elm_win_title_set(win, "Clock Example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + /* pristine (no seconds, military time) */ + ck = elm_clock_add(win); + elm_box_pack_end(bx, ck); + evas_object_show(ck); + + /* am/pm */ + ck = elm_clock_add(win); + elm_clock_show_am_pm_set(ck, EINA_TRUE); + elm_box_pack_end(bx, ck); + evas_object_show(ck); + + /* with seconds and custom time */ + ck = elm_clock_add(win); + elm_clock_show_seconds_set(ck, EINA_TRUE); + elm_clock_time_set(ck, 10, 11, 12); + elm_box_pack_end(bx, ck); + evas_object_show(ck); + + /* in edition mode, with seconds, custom time and am/pm set */ + ck = elm_clock_add(win); + elm_clock_edit_set(ck, EINA_TRUE); + elm_clock_show_seconds_set(ck, EINA_TRUE); + elm_clock_show_am_pm_set(ck, EINA_TRUE); + elm_clock_time_set(ck, 10, 11, 12); + elm_box_pack_end(bx, ck); + evas_object_show(ck); + + /* in edition mode, with seconds, but only some digits editable */ + ck = elm_clock_add(win); + elm_clock_show_seconds_set(ck, EINA_TRUE); + elm_clock_edit_set(ck, EINA_TRUE); + digedit = ELM_CLOCK_EDIT_HOUR_UNIT | ELM_CLOCK_EDIT_MIN_UNIT | ELM_CLOCK_EDIT_SEC_UNIT; + elm_clock_edit_mode_set(ck, digedit); + elm_box_pack_end(bx, ck); + evas_object_show(ck); + + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/colorselector_example_01.c b/libraries/elementary/src/examples/colorselector_example_01.c new file mode 100644 index 0000000..93ea32b --- /dev/null +++ b/libraries/elementary/src/examples/colorselector_example_01.c @@ -0,0 +1,95 @@ +//Compile with: +//gcc -g colorselector_example_01.c -o colorselector_example_01 `pkg-config --cflags --libs elementary` + +#include + +static void _change_color(void *data, Evas_Object *obj, void *event_info); +static void _colorpalette_clicked_cb(void *data, Evas_Object *obj, void *event_info); +static void _colorpalette_longpressed_cb(void *data, Evas_Object *obj, void *event_info); + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *cs, *rect, *bx, *fr; + + win = elm_win_add(NULL, "color selector", ELM_WIN_BASIC); + elm_win_title_set(win, "Color selector"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + fr = elm_frame_add(win); + evas_object_size_hint_weight_set(fr, 1.0, 0.5); + evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(fr, "Color View"); + elm_box_pack_end(bx, fr); + evas_object_show(fr); + + rect = evas_object_rectangle_add(evas_object_evas_get(win)); + elm_object_content_set(fr, rect); + evas_object_color_set(rect, 255, 90, 18, 255); + evas_object_show(rect); + + fr = elm_frame_add(win); + evas_object_size_hint_weight_set(fr, 1.0, 0.5); + evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(fr, "Color Selector"); + elm_box_pack_end(bx, fr); + evas_object_show(fr); + + cs = elm_colorselector_add(win); + elm_colorselector_palette_name_set(cs, "painting"); + evas_object_size_hint_weight_set(cs, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(cs, EVAS_HINT_FILL, 0.0); + elm_colorselector_color_set(cs, 255, 90, 18, 255); + evas_object_show(cs); + evas_object_smart_callback_add(cs, "changed", _change_color, rect); + evas_object_smart_callback_add(cs, "color,item,selected", _colorpalette_clicked_cb, rect); + evas_object_smart_callback_add(cs, "color,item,longpressed", _colorpalette_longpressed_cb, rect); + elm_object_content_set(fr, cs); + + evas_object_resize(win, 320, 480); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() + +static void +_change_color(void *data, Evas_Object *obj, void *event_info) +{ + int r, g, b, a; + elm_colorselector_color_get(obj, &r, &g, &b, &a); + evas_object_color_set(data, r, g, b, a); +} + +static void +_colorpalette_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + int r = 0, g = 0, b = 0 ,a = 0; + Elm_Object_Item *color_it = (Elm_Object_Item *) event_info; + elm_colorselector_palette_item_color_get(color_it, &r, &g, &b, &a); + evas_object_color_set(data, r, g, b, a); +} + +static void +_colorpalette_longpressed_cb(void *data, Evas_Object *obj, void *event_info) +{ + int r = 0,g = 0,b = 0 ,a = 0; + Elm_Object_Item *color_it = (Elm_Object_Item *) event_info; + elm_colorselector_palette_item_color_get(color_it, &r, &g, &b, &a); + printf("\ncolor = %d-%d-%d-%d\n", r, g, b, a); +} diff --git a/libraries/elementary/src/examples/conformant_example_01.c b/libraries/elementary/src/examples/conformant_example_01.c new file mode 100644 index 0000000..426bea4 --- /dev/null +++ b/libraries/elementary/src/examples/conformant_example_01.c @@ -0,0 +1,76 @@ +/** + * Simple Elementary's conformant widget example, illustrating its + * usage and API. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -o conformant_example_01 conformant_example_01.c -g `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *btn, *bx, *en; + + win = elm_win_add(NULL, "conformant", ELM_WIN_BASIC); + elm_win_title_set(win, "Conformant Example"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + elm_win_resize_object_add(win, bx); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + + btn = elm_button_add(win); + elm_object_text_set(btn, "Test Conformant"); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0); + elm_box_pack_end(bx, btn); + evas_object_show(btn); + + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + elm_object_text_set(en, + "This is a multi-line entry at the bottom
" + "This can contain more than 1 line of text and be " + "scrolled around to allow for entering of lots of " + "content. It is also to test to see that autoscroll " + "moves to the right part of a larger multi-line " + "text entry that is inside of a scroller than can be " + "scrolled around, thus changing the expected position " + "as well as cursor changes updating auto-scroll when " + "it is enabled."); + + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(en); + elm_box_pack_end(bx, en); + + btn = elm_button_add(win); + elm_object_text_set(btn, "Test Conformant"); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0); + elm_box_pack_end(bx, btn); + evas_object_show(btn); + + evas_object_show(bx); + + evas_object_resize(win, 240, 480); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/conformant_example_02.c b/libraries/elementary/src/examples/conformant_example_02.c new file mode 100644 index 0000000..aba7c95 --- /dev/null +++ b/libraries/elementary/src/examples/conformant_example_02.c @@ -0,0 +1,82 @@ +/** + * Simple Elementary's conformant widget example, illustrating its + * usage and API. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g conformant_example_02.c -o conformant_example_02 `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *conform, *btn, *bx, *en; + + win = elm_win_add(NULL, "conformant", ELM_WIN_BASIC); + elm_win_title_set(win, "Conformant Example"); + elm_win_autodel_set(win, EINA_TRUE); + + elm_win_conformant_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + conform = elm_conformant_add(win); + elm_win_resize_object_add(win, conform); + evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(conform); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + + btn = elm_button_add(win); + elm_object_text_set(btn, "Test Conformant"); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0); + elm_box_pack_end(bx, btn); + evas_object_show(btn); + + en = elm_entry_add(win); + elm_entry_scrollable_set(en, EINA_TRUE); + elm_object_text_set(en, + "This is a multi-line entry at the bottom
" + "This can contain more than 1 line of text and be " + "scrolled around to allow for entering of lots of " + "content. It is also to test to see that autoscroll " + "moves to the right part of a larger multi-line " + "text entry that is inside of a scroller than can be " + "scrolled around, thus changing the expected position " + "as well as cursor changes updating auto-scroll when " + "it is enabled."); + + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(en); + elm_box_pack_end(bx, en); + + btn = elm_button_add(win); + elm_object_text_set(btn, "Test Conformant"); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0); + elm_box_pack_end(bx, btn); + evas_object_show(btn); + + elm_object_content_set(conform, bx); + evas_object_show(bx); + + evas_object_resize(win, 240, 480); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/ctxpopup_example_01.c b/libraries/elementary/src/examples/ctxpopup_example_01.c new file mode 100644 index 0000000..763d71d --- /dev/null +++ b/libraries/elementary/src/examples/ctxpopup_example_01.c @@ -0,0 +1,106 @@ +//Compile with: +//gcc -o ctxpopup_example_01 ctxpopup_example_01.c -g `pkg-config --cflags --libs elementary` + +#include + +static void +_ctxpopup_item_cb(void *data, Evas_Object *obj, void *event_info) +{ + printf("ctxpopup item selected: %s\n", elm_object_item_text_get(event_info)); +} + +Elm_Object_Item *item_new(Evas_Object *ctxpopup, const char * label, const char *icon) +{ + Evas_Object *ic = elm_icon_add(ctxpopup); + elm_icon_standard_set(ic, icon); + elm_icon_resizable_set(ic, EINA_FALSE, EINA_FALSE); + return elm_ctxpopup_item_append(ctxpopup, label, ic, _ctxpopup_item_cb, NULL); +} + +static void +_list_item_cb(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *ctxpopup; + Elm_Object_Item *it; + Evas_Coord x,y; + + ctxpopup = elm_ctxpopup_add(obj); + + item_new(ctxpopup, "Go to home folder", "home"); + item_new(ctxpopup, "Save file", "file"); + item_new(ctxpopup, "Delete file", "delete"); + it = item_new(ctxpopup, "Navigate to folder", "folder"); + elm_object_item_disabled_set(it, EINA_TRUE); + item_new(ctxpopup, "Edit entry", "edit"); + it = item_new(ctxpopup, "Set date and time", "clock"); + elm_object_item_disabled_set(it, EINA_TRUE); + + evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y); + evas_object_size_hint_max_set(ctxpopup, 240, 240); + evas_object_move(ctxpopup, x, y); + evas_object_show(ctxpopup); + + elm_list_item_selected_set(event_info, EINA_FALSE); +} + +static void +_list_item_cb2(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *ctxpopup; + Elm_Object_Item *it; + Evas_Coord x,y; + + ctxpopup = elm_ctxpopup_add(obj); + elm_ctxpopup_horizontal_set(ctxpopup, EINA_TRUE); + + item_new(ctxpopup, NULL, "home"); + item_new(ctxpopup, NULL, "file"); + item_new(ctxpopup, NULL, "delete"); + item_new(ctxpopup, NULL, "folder"); + it = item_new(ctxpopup, NULL, "edit"); + elm_object_item_disabled_set(it, EINA_TRUE); + item_new(ctxpopup, NULL, "clock"); + + evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y); + evas_object_size_hint_max_set(ctxpopup, 380, 40); + evas_object_move(ctxpopup, x, y); + evas_object_show(ctxpopup); + + elm_list_item_selected_set(event_info, EINA_FALSE); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *list; + + win = elm_win_add(NULL, "Contextual Popup", ELM_WIN_BASIC); + elm_win_title_set(win, "Contextual Popup"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + evas_object_resize(win, 400, 400); + evas_object_show(win); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + list = elm_list_add(win); + evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, list); + elm_list_mode_set(list, ELM_LIST_COMPRESS); + + elm_list_item_append(list, "Ctxpopup with icons and labels", NULL, NULL, + _list_item_cb, NULL); + elm_list_item_append(list, "Ctxpopup with icons only", NULL, NULL, + _list_item_cb2, NULL); + evas_object_show(list); + elm_list_go(list); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/datetime_example.c b/libraries/elementary/src/examples/datetime_example.c new file mode 100644 index 0000000..9b443fe --- /dev/null +++ b/libraries/elementary/src/examples/datetime_example.c @@ -0,0 +1,69 @@ +//Compile with: +//gcc -g datetime_example.c -o datetime_example `pkg-config --cflags --libs elementary` + +#include + +static void +_on_done(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_exit(); +} + +EAPI_MAIN int +elm_main(int argc, char *argv[]) +{ + Evas_Object *win, *bg, *bx, *datetime; + + win = elm_win_add(NULL, "Datetime", ELM_WIN_BASIC); + elm_win_title_set(win, "Datetime"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + elm_box_horizontal_set(bx, EINA_FALSE); + evas_object_show(bx); + evas_object_size_hint_min_set(bx, 360, 200); + + //datetime showing only DATE + datetime = elm_datetime_add(bx); + evas_object_size_hint_weight_set(datetime, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(datetime, EVAS_HINT_FILL, 0.5); + elm_datetime_field_visible_set(datetime, ELM_DATETIME_HOUR, EINA_FALSE); + elm_datetime_field_visible_set(datetime, ELM_DATETIME_MINUTE, EINA_FALSE); + elm_datetime_field_visible_set(datetime, ELM_DATETIME_AMPM, EINA_FALSE); + elm_box_pack_end(bx, datetime); + evas_object_show(datetime); + + //datetime showing only TIME + datetime = elm_datetime_add(bx); + evas_object_size_hint_weight_set(datetime, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(datetime, EVAS_HINT_FILL, 0.5); + elm_datetime_field_visible_set(datetime, ELM_DATETIME_YEAR, EINA_FALSE); + elm_datetime_field_visible_set(datetime, ELM_DATETIME_MONTH, EINA_FALSE); + elm_datetime_field_visible_set(datetime, ELM_DATETIME_DATE, EINA_FALSE); + elm_box_pack_end(bx, datetime); + evas_object_show(datetime); + + //datetime showing both DATE and TIME + datetime = elm_datetime_add(bx); + evas_object_size_hint_weight_set(datetime, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(datetime, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, datetime); + evas_object_show(datetime); + + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/dayselector_example.c b/libraries/elementary/src/examples/dayselector_example.c new file mode 100644 index 0000000..56fdea5 --- /dev/null +++ b/libraries/elementary/src/examples/dayselector_example.c @@ -0,0 +1,92 @@ +/** + * Simple Elementary's dayselector widget example, illustrating its + * usage and API. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g dayselector_example.c -o dayselector_example `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +static void +_on_done(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_exit(); +} + +/* Callback function when a day is clicked. */ +static void _changed_cb(void* data, Evas_Object* obj, void* event_info) +{ + char buf[256]; + Elm_Dayselector_Day day; + Eina_Bool selected; + + /* get which day's state is changed */ + day = (Elm_Dayselector_Day) event_info; + /* get the state of corresponding day's check object */ + selected = elm_dayselector_day_selected_get(obj, day); + switch(day) + { + case ELM_DAYSELECTOR_SUN: snprintf(buf, sizeof(buf), "%s", "Sun"); break; + case ELM_DAYSELECTOR_MON: snprintf(buf, sizeof(buf), "%s", "Mon"); break; + case ELM_DAYSELECTOR_TUE: snprintf(buf, sizeof(buf), "%s", "Tue"); break; + case ELM_DAYSELECTOR_WED: snprintf(buf, sizeof(buf), "%s", "Wed"); break; + case ELM_DAYSELECTOR_THU: snprintf(buf, sizeof(buf), "%s", "Thu"); break; + case ELM_DAYSELECTOR_FRI: snprintf(buf, sizeof(buf), "%s", "Fri"); break; + case ELM_DAYSELECTOR_SAT: snprintf(buf, sizeof(buf), "%s", "Sat"); break; + default: snprintf(buf, sizeof(buf), "%s", "???"); break; + } + fprintf(stderr, "%s state is %d\n", buf, selected); +} +/* End of clicked callback */ + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *bx, *dayselector; + + win = elm_win_add(NULL, "dayselector", ELM_WIN_BASIC); + elm_win_title_set(win, "Dayselector Example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + /* add a dayselector widget showing weekdays starting from Sunday */ + dayselector = elm_dayselector_add(win); + evas_object_size_hint_weight_set(dayselector, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(dayselector, EVAS_HINT_FILL, 0.5); + evas_object_smart_callback_add(dayselector, "dayselector,changed", _changed_cb, NULL); + elm_box_pack_end(bx, dayselector); + evas_object_show(dayselector); + + /* add a dayselector widget showing weekdays starting from Monday */ + dayselector = elm_dayselector_add(win); + evas_object_size_hint_weight_set(dayselector, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(dayselector, EVAS_HINT_FILL, 0.5); + evas_object_smart_callback_add(dayselector, "dayselector,changed", _changed_cb, NULL); + elm_object_style_set(dayselector, "mon_first"); + elm_box_pack_end(bx, dayselector); + evas_object_show(dayselector); + + evas_object_resize(win, 350, 120); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/diskselector_example_01.c b/libraries/elementary/src/examples/diskselector_example_01.c new file mode 100644 index 0000000..c8ad75b --- /dev/null +++ b/libraries/elementary/src/examples/diskselector_example_01.c @@ -0,0 +1,104 @@ +/** + * Simple Elementary's diskselector widget example, illustrating its + * usage and API. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g diskselector_example_01.c -o diskselector_example_01 `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +static void +_on_done(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_exit(); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *bx, *ds; + unsigned int i; + static const char *lbl[] = + { + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday" + }; + + win = elm_win_add(NULL, "diskselector", ELM_WIN_BASIC); + elm_win_title_set(win, "Diskselector Example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + /* default */ + ds = elm_diskselector_add(win); + evas_object_size_hint_weight_set(ds, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ds, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, ds); + for (i = 0; i < sizeof(lbl) / sizeof(lbl[0]); i++) + elm_diskselector_item_append(ds, lbl[i], NULL, NULL, NULL); + evas_object_show(ds); + + /* set round mode and define side label length */ + ds = elm_diskselector_add(win); + evas_object_size_hint_weight_set(ds, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ds, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, ds); + for (i = 0; i < sizeof(lbl) / sizeof(lbl[0]); i++) + elm_diskselector_item_append(ds, lbl[i], NULL, NULL, NULL); + elm_diskselector_round_enabled_set(ds, EINA_TRUE); + elm_diskselector_side_text_max_length_set(ds, 2); + evas_object_show(ds); + + /* display more than 3 items */ + ds = elm_diskselector_add(win); + evas_object_size_hint_weight_set(ds, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ds, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, ds); + for (i = 0; i < sizeof(lbl) / sizeof(lbl[0]); i++) + elm_diskselector_item_append(ds, lbl[i], NULL, NULL, NULL); + elm_diskselector_display_item_num_set(ds, 5); + printf("Number of Items in DiskSelector : %d\n", elm_diskselector_display_item_num_get(ds)); + evas_object_show(ds); + + /* set bounce and scroller policy */ + ds = elm_diskselector_add(win); + evas_object_size_hint_weight_set(ds, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ds, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, ds); + for (i = 0; i < sizeof(lbl) / sizeof(lbl[0]); i++) + elm_diskselector_item_append(ds, lbl[i], NULL, NULL, NULL); + elm_diskselector_bounce_set(ds, EINA_TRUE, EINA_TRUE); + elm_diskselector_scroller_policy_set(ds, ELM_SCROLLER_POLICY_AUTO, + ELM_SCROLLER_POLICY_ON); + evas_object_show(ds); + + evas_object_resize(win, 320, 480); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/diskselector_example_02.c b/libraries/elementary/src/examples/diskselector_example_02.c new file mode 100644 index 0000000..443a868 --- /dev/null +++ b/libraries/elementary/src/examples/diskselector_example_02.c @@ -0,0 +1,349 @@ +/** + * Elementary's diskselector widget example, illustrating its + * covering most of item functions. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g diskselector_example_02.c -o diskselector_example_02 `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +static int counter = 3; + +static void +_on_done(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_exit(); +} + +static void +_add_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *ds_it; + Evas_Object *ds = data; + char label[32]; + + snprintf(label, sizeof(label), "Item %i", counter++); + ds_it = elm_diskselector_item_append(ds, label, NULL, NULL, NULL); + if (!ds_it) printf("Error adding item\n"); +} + +static void +_add_ic_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *ds_it; + Evas_Object *ic, *ds = data; + char label[32]; + + snprintf(label, sizeof(label), "Item %i", counter++); + ic = elm_icon_add(ds); + elm_icon_standard_set(ic, "home"); + + ds_it = elm_diskselector_item_append(ds, label, ic, NULL, NULL); + if (!ds_it) printf("Error adding item with icon\n"); +} + +static void +_sel_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *ds_it = event_info; + printf("Selected label: %s\n", elm_object_item_text_get(ds_it)); +} + +static void +_add_func_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *ds_it; + Evas_Object *ds = data; + char label[32]; + + snprintf(label, sizeof(label), "Item %i", counter++); + ds_it = elm_diskselector_item_append(ds, label, NULL, _sel_cb, NULL); + if (!ds_it) printf("Error adding item\n"); +} + +static void +_sel_data_cb(void *data, Evas_Object *obj, void *event_info) +{ + char *content = data; + Elm_Object_Item *ds_it = event_info; + printf("Selected label: %s with data: %s\n", + elm_object_item_text_get(ds_it), content); +} + +static void +_free_data(void *data, Evas_Object *obj, void *event_info) +{ + free(data); +} + +static void +_add_data_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *ds_it; + Evas_Object *ds = data; + char label[32]; + char *content = malloc(sizeof(char) * 32); + + snprintf(content, 32, "Item content %i", counter); + snprintf(label, sizeof(label), "Item %i", counter++); + ds_it = elm_diskselector_item_append(ds, label, NULL, _sel_data_cb, content); + if (!ds_it) { + printf("Error adding item\n"); + return; + } + elm_object_item_del_cb_set(ds_it, _free_data); +} + +static void +_del_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *selected_ds_it; + Evas_Object *ds = data; + + selected_ds_it = elm_diskselector_selected_item_get(ds); + elm_object_item_del(selected_ds_it); +} + +static void +_unselect_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *selected_ds_it; + Evas_Object *ds = data; + + selected_ds_it = elm_diskselector_selected_item_get(ds); + elm_diskselector_item_selected_set(selected_ds_it, EINA_FALSE); +} + +static void +_print_cb(void *data, Evas_Object *obj, void *event_info) +{ + const Eina_List *l, *items; + Elm_Object_Item *ds_it; + Evas_Object *ds = data; + + items = elm_diskselector_items_get(ds); + EINA_LIST_FOREACH(items, l, ds_it) + printf("%s\n", elm_object_item_text_get(ds_it)); +} + +static void +_clear_cb(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *ds = data; + elm_diskselector_clear(ds); +} + +static void +_select_first_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *first_ds_it; + Evas_Object *ds = data; + + first_ds_it = elm_diskselector_first_item_get(ds); + if (first_ds_it) + elm_diskselector_item_selected_set(first_ds_it, EINA_TRUE); +} + +static void +_select_last_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *last_ds_it; + Evas_Object *ds = data; + + last_ds_it = elm_diskselector_last_item_get(ds); + if (last_ds_it) + elm_diskselector_item_selected_set(last_ds_it, EINA_TRUE); +} + +static void +_select_next_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *selected_ds_it, *next_ds_it; + Evas_Object *ds = data; + + selected_ds_it = elm_diskselector_selected_item_get(ds); + if (!selected_ds_it) return; + + next_ds_it = elm_diskselector_item_next_get(selected_ds_it); + if (next_ds_it) + elm_diskselector_item_selected_set(next_ds_it, EINA_TRUE); +} + +static void +_select_prev_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *selected_ds_it, *prev_ds_it; + Evas_Object *ds = data; + + selected_ds_it = elm_diskselector_selected_item_get(ds); + if (!selected_ds_it) return; + + prev_ds_it = elm_diskselector_item_prev_get(selected_ds_it); + if (prev_ds_it) + elm_diskselector_item_selected_set(prev_ds_it, EINA_TRUE); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *bx, *hbx, *ds, *bt; + + win = elm_win_add(NULL, "diskselector", ELM_WIN_BASIC); + elm_win_title_set(win, "Diskselector Items Example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + ds = elm_diskselector_add(win); + evas_object_size_hint_weight_set(ds, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ds, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, ds); + evas_object_show(ds); + + elm_diskselector_item_append(ds, "Item 0", NULL, NULL, NULL); + elm_diskselector_item_append(ds, "Item 1", NULL, NULL, NULL); + elm_diskselector_item_append(ds, "Item 2", NULL, NULL, NULL); + + hbx = elm_box_add(win); + elm_box_horizontal_set(hbx, EINA_TRUE); + evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(hbx, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, hbx); + evas_object_show(hbx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Append item"); + evas_object_smart_callback_add(bt, "clicked", _add_cb, ds); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Append with icon"); + evas_object_smart_callback_add(bt, "clicked", _add_ic_cb, ds); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Append with selected function"); + evas_object_smart_callback_add(bt, "clicked", _add_func_cb, ds); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Append with data"); + evas_object_smart_callback_add(bt, "clicked", _add_data_cb, ds); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bt); + + hbx = elm_box_add(win); + elm_box_horizontal_set(hbx, EINA_TRUE); + evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(hbx, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, hbx); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(hbx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Delete item"); + evas_object_smart_callback_add(bt, "clicked", _del_cb, ds); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Unselect item"); + evas_object_smart_callback_add(bt, "clicked", _unselect_cb, ds); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Print items"); + evas_object_smart_callback_add(bt, "clicked", _print_cb, ds); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Clear"); + evas_object_smart_callback_add(bt, "clicked", _clear_cb, ds); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bt); + + hbx = elm_box_add(win); + elm_box_horizontal_set(hbx, EINA_TRUE); + evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(hbx, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, hbx); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(hbx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Select first item"); + evas_object_smart_callback_add(bt, "clicked", _select_first_cb, ds); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Select last item"); + evas_object_smart_callback_add(bt, "clicked", _select_last_cb, ds); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Select next item"); + evas_object_smart_callback_add(bt, "clicked", _select_next_cb, ds); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Select previous item"); + evas_object_smart_callback_add(bt, "clicked", _select_prev_cb, ds); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bt); + + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/efl_thread_1.c b/libraries/elementary/src/examples/efl_thread_1.c new file mode 100644 index 0000000..0f18539 --- /dev/null +++ b/libraries/elementary/src/examples/efl_thread_1.c @@ -0,0 +1,79 @@ +//Compile with: +//gcc -o efl_thread_1 efl_thread_1.c -g `pkg-config --cflags --libs elementary` +#include +#include + +static Evas_Object *win = NULL; +static Evas_Object *rect = NULL; + +static pthread_t thread_id; + +// BEGIN - code running in my custom pthread instance +// +static void * +my_thread_run(void *arg) +{ + double t = 0.0; + + for (;;) + { + ecore_thread_main_loop_begin(); // begin critical + { // indented for illustration of "critical" block + Evas_Coord x, y; + + x = 200 + (200 * sin(t)); + y = 200 + (200 * cos(t)); + evas_object_move(rect, x - 50, y - 50); + } + ecore_thread_main_loop_end(); // end critical + usleep(1000); + t += 0.02; + } + return NULL; +} +// +// END - code running in my custom pthread instance + +static void +my_thread_new(void) +{ + pthread_attr_t attr; + + if (pthread_attr_init(&attr) != 0) + perror("pthread_attr_init"); + if (pthread_create(&thread_id, &attr, my_thread_run, NULL) != 0) + perror("pthread_create"); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *o, *bg; + + win = elm_win_add(NULL, "efl-thread-1", ELM_WIN_BASIC); + elm_win_title_set(win, "EFL Thread 1"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + evas_object_resize(win, 400, 400); + evas_object_show(win); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + o = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(o, 50, 80, 180, 255); + evas_object_resize(o, 100, 100); + evas_object_show(o); + rect = o; + + // create custom thread to do some "work on the side" + my_thread_new(); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/efl_thread_2.c b/libraries/elementary/src/examples/efl_thread_2.c new file mode 100644 index 0000000..ceedc75 --- /dev/null +++ b/libraries/elementary/src/examples/efl_thread_2.c @@ -0,0 +1,95 @@ +//Compile with: +//gcc -o efl_thread_2 efl_thread_2.c -g `pkg-config --cflags --libs elementary` +#include +#include + +static Evas_Object *win = NULL; +static Evas_Object *rect = NULL; + +struct info +{ + double x, y; +}; + +static void *my_thread_mainloop_code(void *data); + +static pthread_t thread_id; + +// BEGIN - code running in my custom pthread instance +// +static void * +my_thread_run(void *arg) +{ + double t = 0.0; + + for (;;) + { + struct info *inf = malloc(sizeof(struct info)); + + if (inf) + { + inf->x = 200 + (200 * sin(t)); + inf->y = 200 + (200 * cos(t)); + ecore_main_loop_thread_safe_call_sync + (my_thread_mainloop_code, inf); + } + // and sleep and loop + usleep(1000); + t += 0.02; + } + return NULL; +} +// +// END - code running in my custom pthread instance +static void +my_thread_new(void) +{ + pthread_attr_t attr; + + if (pthread_attr_init(&attr) != 0) + perror("pthread_attr_init"); + if (pthread_create(&thread_id, &attr, my_thread_run, NULL) != 0) + perror("pthread_create"); +} + +static void * +my_thread_mainloop_code(void *data) +{ + struct info *inf = data; + evas_object_move(rect, inf->x - 50, inf->y - 50); + free(inf); + return NULL; +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *o, *bg; + + win = elm_win_add(NULL, "efl-thread-2", ELM_WIN_BASIC); + elm_win_title_set(win, "EFL Thread 2"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + evas_object_resize(win, 400, 400); + evas_object_show(win); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + o = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(o, 50, 80, 180, 255); + evas_object_resize(o, 100, 100); + evas_object_show(o); + rect = o; + + // create custom thread to do some "work on the side" + my_thread_new(); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/efl_thread_3.c b/libraries/elementary/src/examples/efl_thread_3.c new file mode 100644 index 0000000..cbc2c67 --- /dev/null +++ b/libraries/elementary/src/examples/efl_thread_3.c @@ -0,0 +1,97 @@ +//Compile with: +//gcc -o efl_thread_3 efl_thread_3.c -g `pkg-config --cflags --libs elementary` +#include +#include + +static Evas_Object *win = NULL; +static Evas_Object *rect = NULL; + +struct info +{ + double x, y; +}; + +static void my_thread_mainloop_code(void *data); + +static pthread_t thread_id; + +// BEGIN - code running in my custom pthread instance +// +static void * +my_thread_run(void *arg) +{ + double t = 0.0; + + // inside the pthread function lets loop forever incrimenting a time point + for (;;) + { + struct info *inf = malloc(sizeof(struct info)); + + if (inf) + { + inf->x = 200 + (200 * sin(t)); + inf->y = 200 + (200 * cos(t)); + // now call a function in the mainloop and pass it our allocated + // data that it will free when it gets it + ecore_main_loop_thread_safe_call_async + (my_thread_mainloop_code, inf); + } + // and sleep and loop + usleep(1000); + t += 0.02; + } + return NULL; +} +// +// END - code running in my custom pthread instance +static void +my_thread_new(void) +{ + pthread_attr_t attr; + + if (pthread_attr_init(&attr) != 0) + perror("pthread_attr_init"); + if (pthread_create(&thread_id, &attr, my_thread_run, NULL) != 0) + perror("pthread_create"); +} + +static void +my_thread_mainloop_code(void *data) +{ + struct info *inf = data; + evas_object_move(rect, inf->x - 50, inf->y - 50); + free(inf); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *o, *bg; + + win = elm_win_add(NULL, "efl-thread-3", ELM_WIN_BASIC); + elm_win_title_set(win, "EFL Thread 3"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + evas_object_resize(win, 400, 400); + evas_object_show(win); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + o = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(o, 50, 80, 180, 255); + evas_object_resize(o, 100, 100); + evas_object_show(o); + rect = o; + + // create custom thread to do some "work on the side" + my_thread_new(); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/efl_thread_4.c b/libraries/elementary/src/examples/efl_thread_4.c new file mode 100644 index 0000000..2f565aa --- /dev/null +++ b/libraries/elementary/src/examples/efl_thread_4.c @@ -0,0 +1,120 @@ +//Compile with: +//gcc -o efl_thread_4 efl_thread_4.c -g `pkg-config --cflags --libs elementary` +#include +#include + +static Evas_Object *win = NULL; +static Evas_Object *rect = NULL; + +struct info +{ + double x, y; +}; + +static void my_thread_mainloop_code(void *data); + +static pthread_t thread_id; +static pthread_mutex_t th_lock; +static int th_exit = 0; + +// BEGIN - code running in my custom pthread instance +// +static void * +my_thread_run(void *arg) +{ + double t = 0.0; + + // inside the pthread function lets loop forever incrimenting a time point + for (;;) + { + struct info *inf = malloc(sizeof(struct info)); + int do_exit; + + if (inf) + { + inf->x = 200 + (200 * sin(t)); + inf->y = 200 + (200 * cos(t)); + // now call a function in the mainloop and pass it our allocated + // data that it will free when it gets it + ecore_main_loop_thread_safe_call_async + (my_thread_mainloop_code, inf); + } + // and sleep and loop + usleep(1000); + t += 0.02; + // in case someone has asked us to cancel - then cancel this loop + // co-operatively (cancelling is co-operative) + pthread_mutex_lock(&th_lock); + do_exit = th_exit; + pthread_mutex_unlock(&th_lock); + if (do_exit) break; + } + return NULL; +} +// +// END - code running in my custom pthread instance + +static void +my_thread_new(void) +{ + pthread_attr_t attr; + + pthread_mutex_init(&th_lock, NULL); + if (pthread_attr_init(&attr) != 0) + perror("pthread_attr_init"); + if (pthread_create(&thread_id, &attr, my_thread_run, NULL) != 0) + perror("pthread_create"); +} + +static void +my_thread_mainloop_code(void *data) +{ + struct info *inf = data; + evas_object_move(rect, inf->x - 50, inf->y - 50); + free(inf); +} + +// just test cancelling the thread +static void +down(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + pthread_mutex_lock(&th_lock); + th_exit = 1; + pthread_mutex_unlock(&th_lock); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *o, *bg; + + win = elm_win_add(NULL, "efl-thread-4", ELM_WIN_BASIC); + elm_win_title_set(win, "EFL Thread 4"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + evas_object_resize(win, 400, 400); + evas_object_show(win); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + o = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(o, 50, 80, 180, 255); + evas_object_resize(o, 100, 100); + evas_object_show(o); + // new in the examples - we have a mouse down on the blue box cancel + // the thread + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, down, NULL); + rect = o; + + // create custom thread to do some "work on the side" + my_thread_new(); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/efl_thread_5.c b/libraries/elementary/src/examples/efl_thread_5.c new file mode 100644 index 0000000..4e53dd0 --- /dev/null +++ b/libraries/elementary/src/examples/efl_thread_5.c @@ -0,0 +1,104 @@ +//Compile with: +//gcc -o efl_thread_5 efl_thread_5.c -g `pkg-config --cflags --libs elementary` +#include + +static Ecore_Thread *thr = NULL; + +static Evas_Object *win = NULL; +static Evas_Object *rect = NULL; + +struct info +{ + double x, y; +}; + +// BEGIN - code running in my custom thread instance +// +static void +th_do(void *data, Ecore_Thread *th) +{ + double t = 0.0; + + // inside our "do" function for the ecore thread, lets do the real work + for (;;) + { + struct info *inf = malloc(sizeof(struct info)); + + if (inf) + { + inf->x = 200 + (200 * sin(t)); + inf->y = 200 + (200 * cos(t)); + // now we have recorded the timepoint we pass it as feedback + // back to the mainloop. it will free it when done + ecore_thread_feedback(th, inf); + } + // and sleep and loop + usleep(1000); + t += 0.02; + // in case someone has asked us to cancel - then cancel this loop + // co-operatively (cancelling is co-operative) + if (ecore_thread_check(th)) break; + } +} +// +// END - code running in my custom thread instance + +static void // when mainloop gets feedback from worker +th_feedback(void *data, Ecore_Thread *th, void *msg) +{ + struct info *inf = msg; + evas_object_move(rect, inf->x - 50, inf->y - 50); + free(inf); +} + +// BONUS (optional): called after th_do returns and has NOT been cancelled +static void th_end(void *data, Ecore_Thread *th) { printf("thread ended\n"); } +// BONUS (optional): called in mainloop AFTER thread has finished cancelling +static void th_cancel(void *data, Ecore_Thread *th) { printf("thread cancelled\n"); } + +// just test cancelling the thread worker +static void +down(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + ecore_thread_cancel(thr); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *o, *bg; + + win = elm_win_add(NULL, "efl-thread-5", ELM_WIN_BASIC); + elm_win_title_set(win, "EFL Thread 5"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + evas_object_resize(win, 400, 400); + evas_object_show(win); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + o = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(o, 50, 80, 180, 255); + evas_object_resize(o, 100, 100); + evas_object_show(o); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, down, NULL); + rect = o; + + // explicitly create ecore thread to do some "work on the side" and pass + // in NULL as data ptr to callbacks and true at the end means to actually + // make a new thread and not use the thread pool (there is a thread pool + // with as many thread workers as there are cpu's so this means you do not + // overload the cpu's with more work than you actually have processing + // units *IF* your threads do actually spend their time doing actual + // heavy computation) + thr = ecore_thread_feedback_run(th_do, th_feedback, th_end, th_cancel, + NULL, EINA_TRUE); + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/efl_thread_6.c b/libraries/elementary/src/examples/efl_thread_6.c new file mode 100644 index 0000000..df355d6 --- /dev/null +++ b/libraries/elementary/src/examples/efl_thread_6.c @@ -0,0 +1,165 @@ +//Compile with: +//gcc -o efl_thread_6 efl_thread_6.c -g `pkg-config --cflags --libs elementary` +#include + +static Evas_Object *win = NULL; + +struct info +{ + Evas_Object *obj; + int *pix; +}; + +// BEGIN - code running in my custom thread instance +// +static void +mandel(int *pix, int w, int h) +{ + double x, xx, y, cx, cy, cox, coy; + int iteration, hx, hy, val, r, g, b, rr, gg, bb; + int itermax = 10000; + double magnify = 0.02; + + // this mandel calc is run in the worker threads so it's here. it is + // just here to calculate something and consume cpu to demonstrate the + // ecore thread worker queue. don't pay much attention to the below code + magnify += ((double)(rand() % 100) / 100.0) / 4.0; + cox = (double)(rand() % 100) / 100.0; + coy = (double)(rand() % 100) / 100.0; + cox /= (magnify * 3.0); + r = rand() % 255; g = rand() % 255; b = rand() % 255; + for (hy = 0; hy < h; hy++) + { + for (hx = 0; hx < w; hx++) + { + cx = (((float)hx) / ((float)w) - 0.5) / (magnify * 3.0); + cy = (((float)hy) / ((float)h) - 0.5) / (magnify * 3.0); + cx += cox; + cy += coy; + x = 0.0; + y = 0.0; + for (iteration = 1; iteration < itermax; iteration++) + { + xx = (x * x) - (y * y) + cx; + y = (2.0 * x * y) + cy; + x = xx; + if (((x * x) + (y * y)) > 100.0) iteration = 999999; + } + val = (((x * x) + (y * y)) * 2.55) / 100.0; + if (val > 255) val = 255; + if (iteration >= 99999) + { + rr = (r * val) / 255; + gg = (g * val) / 255; + bb = (b * val) / 255; + pix[(hy * w) + hx] = + (val << 24) | (rr << 16) | (gg << 8) | (bb); + } + else + pix[(hy * w) + hx] = 0xffffffff; + } + } +} + +static void +th_do(void *data, Ecore_Thread *th) +{ + struct info *inf = data; + // CANNOT TOUCH inf->obj here! just inf->pix which is 256x256 @ 32bpp + // quick and dirty to consume some cpu - do a mandelbrot calc + mandel(inf->pix, 256, 256); +} +// +// END - code running in my custom thread instance + +static void // thread job finished - collect results and put in img obj +th_end(void *data, Ecore_Thread *th) +{ + struct info *inf = data; + + // copy data to object, free calculated data and info struc + evas_object_image_data_copy_set(inf->obj, inf->pix); + evas_object_show(inf->obj); + free(inf->pix); + free(inf); +} + +static void // if the thread is cancelled - free pix, keep obj tho +th_cancel(void *data, Ecore_Thread *th) +{ + struct info *inf = data; + + // just free pixel data and info struct + free(inf->pix); + free(inf); +} + +static Eina_Bool // animate the objects so you see all the madels move +anim(void *data) +{ + Evas_Object *o = data; + double t, z; + int w, h, v; + Evas_Coord x, y; + + // just calculate some position using the pointer value of the object as + // a seed value to make different objects go into different places over time + v = ((int)o) & 0xff; + t = ecore_loop_time_get(); + w = 100 + ((v * 100) >> 8); + h = 100 + ((v * 100) >> 8); + z = (double)(v) / 100.0; + x = (w * sin(t)); + y = (h * cos(t + z)); + // do the actual move + evas_object_move(o, 200 + x - 128, 200 + y - 128); + // keep looping - return true + return EINA_TRUE; +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *o, *bg; + int i; + + win = elm_win_add(NULL, "efl-thread-6", ELM_WIN_BASIC); + elm_win_title_set(win, "EFL Thread 6"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + evas_object_resize(win, 400, 400); + evas_object_show(win); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + // queue up 64 mandel generation thread jobs + for (i = 0; i < 64; i++) + { + struct info *inf; + + // create ecore thread to do some threaded job inside the worker pool + inf = malloc(sizeof(struct info)); + if (inf) + { + o = evas_object_image_filled_add(evas_object_evas_get(win)); + evas_object_image_size_set(o, 256, 256); + evas_object_image_alpha_set(o, EINA_TRUE); + evas_object_resize(o, 256, 256); + inf->obj = o; + inf->pix = malloc(256 * 256 * sizeof(int)); + ecore_thread_run(th_do, th_end, th_cancel, inf); + // bonus - slide the objects around all the time with an + // animator that ticks off every frame. + ecore_animator_add(anim, o); + } + } + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/efl_thread_win32_1.c b/libraries/elementary/src/examples/efl_thread_win32_1.c new file mode 100644 index 0000000..1a1d579 --- /dev/null +++ b/libraries/elementary/src/examples/efl_thread_win32_1.c @@ -0,0 +1,84 @@ +//Compile with: +//gcc -o efl_thread_1 efl_thread_win32_1.c -g `pkg-config --cflags --libs elementary` +#include +#define WIN32_LEAN_AND_MEAN +#include + +static Evas_Object *win = NULL; +static Evas_Object *rect = NULL; + +static HANDLE thread; + +// BEGIN - code running in my custom win32 thread instance +// +static DWORD WINAPI +my_thread_run(LPVOID arg) +{ + double t = 0.0; + + for (;;) + { + ecore_thread_main_loop_begin(); // begin critical + { // indented for illustration of "critical" block + Evas_Coord x, y; + + x = 200 + (200 * sin(t)); + y = 200 + (200 * cos(t)); + evas_object_move(rect, x - 50, y - 50); + } + ecore_thread_main_loop_end(); // end critical + usleep(1000); + t += 0.02; + } + return 0; +} +// +// END - code running in my custom win32 thread instance + +static void +my_thread_new(void) +{ + thread = CreateThread(NULL, 0, my_thread_run, NULL, 0, NULL); + if (!thread) + { + char *str = evil_last_error_get(); + if (str) + { + fprintf("thread creation failed: %s\n", str); + free(str); + } + } +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *o, *bg; + + win = elm_win_add(NULL, "efl-thread-1", ELM_WIN_BASIC); + elm_win_title_set(win, "EFL Thread 1"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + evas_object_resize(win, 400, 400); + evas_object_show(win); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + o = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(o, 50, 80, 180, 255); + evas_object_resize(o, 100, 100); + evas_object_show(o); + rect = o; + + // create custom thread to do some "work on the side" + my_thread_new(); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/efl_thread_win32_2.c b/libraries/elementary/src/examples/efl_thread_win32_2.c new file mode 100644 index 0000000..d1cad15 --- /dev/null +++ b/libraries/elementary/src/examples/efl_thread_win32_2.c @@ -0,0 +1,100 @@ +//Compile with: +//gcc -o efl_thread_2 efl_thread_win32_2.c -g `pkg-config --cflags --libs elementary` +#include +#define WIN32_LEAN_AND_MEAN +#include + +static Evas_Object *win = NULL; +static Evas_Object *rect = NULL; + +struct info +{ + double x, y; +}; + +static void *my_thread_mainloop_code(void *data); + +static HANDLE thread; + +// BEGIN - code running in my custom win32 thread instance +// +static DWORD WINAPI +my_thread_run(LPVOID arg) +{ + double t = 0.0; + + for (;;) + { + struct info *inf = malloc(sizeof(struct info)); + + if (inf) + { + inf->x = 200 + (200 * sin(t)); + inf->y = 200 + (200 * cos(t)); + ecore_main_loop_thread_safe_call_sync + (my_thread_mainloop_code, inf); + } + // and sleep and loop + usleep(1000); + t += 0.02; + } + return 0; +} +// +// END - code running in my custom win32 thread instance +static void +my_thread_new(void) +{ + thread = CreateThread(NULL, 0, my_thread_run, NULL, 0, NULL); + if (!thread) + { + char *str = evil_last_error_get(); + if (str) + { + fprintf("thread creation failed: %s\n", str); + free(str); + } + } +} + +static void * +my_thread_mainloop_code(void *data) +{ + struct info *inf = data; + evas_object_move(rect, inf->x - 50, inf->y - 50); + free(inf); + return NULL; +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *o, *bg; + + win = elm_win_add(NULL, "efl-thread-2", ELM_WIN_BASIC); + elm_win_title_set(win, "EFL Thread 2"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + evas_object_resize(win, 400, 400); + evas_object_show(win); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + o = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(o, 50, 80, 180, 255); + evas_object_resize(o, 100, 100); + evas_object_show(o); + rect = o; + + // create custom thread to do some "work on the side" + my_thread_new(); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/efl_thread_win32_3.c b/libraries/elementary/src/examples/efl_thread_win32_3.c new file mode 100644 index 0000000..e80be8c --- /dev/null +++ b/libraries/elementary/src/examples/efl_thread_win32_3.c @@ -0,0 +1,102 @@ +//Compile with: +//gcc -o efl_thread_3 efl_thread_win32_3.c -g `pkg-config --cflags --libs elementary` +#include +#define WIN32_LEAN_AND_MEAN +#include + +static Evas_Object *win = NULL; +static Evas_Object *rect = NULL; + +struct info +{ + double x, y; +}; + +static void my_thread_mainloop_code(void *data); + +static HANDLE thread; + +// BEGIN - code running in my custom win32 thread instance +// +static DWORD WINAPI +my_thread_run(LPVOID arg) +{ + double t = 0.0; + + // inside the thread function lets loop forever incrimenting a time point + for (;;) + { + struct info *inf = malloc(sizeof(struct info)); + + if (inf) + { + inf->x = 200 + (200 * sin(t)); + inf->y = 200 + (200 * cos(t)); + // now call a function in the mainloop and pass it our allocated + // data that it will free when it gets it + ecore_main_loop_thread_safe_call_async + (my_thread_mainloop_code, inf); + } + // and sleep and loop + usleep(1000); + t += 0.02; + } + return NULL; +} +// +// END - code running in my custom win32 thread instance +static void +my_thread_new(void) +{ + thread = CreateThread(NULL, 0, my_thread_run, NULL, 0, NULL); + if (!thread) + { + char *str = evil_last_error_get(); + if (str) + { + fprintf("thread creation failed: %s\n", str); + free(str); + } + } +} + +static void +my_thread_mainloop_code(void *data) +{ + struct info *inf = data; + evas_object_move(rect, inf->x - 50, inf->y - 50); + free(inf); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *o, *bg; + + win = elm_win_add(NULL, "efl-thread-3", ELM_WIN_BASIC); + elm_win_title_set(win, "EFL Thread 3"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + evas_object_resize(win, 400, 400); + evas_object_show(win); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + o = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(o, 50, 80, 180, 255); + evas_object_resize(o, 100, 100); + evas_object_show(o); + rect = o; + + // create custom thread to do some "work on the side" + my_thread_new(); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/efl_thread_win32_4.c b/libraries/elementary/src/examples/efl_thread_win32_4.c new file mode 100644 index 0000000..957c1c1 --- /dev/null +++ b/libraries/elementary/src/examples/efl_thread_win32_4.c @@ -0,0 +1,126 @@ +//Compile with: +//gcc -o efl_thread_4 efl_thread_win32_4.c -g `pkg-config --cflags --libs elementary` +#include +#define WIN32_LEAN_AND_MEAN +#include + +static Evas_Object *win = NULL; +static Evas_Object *rect = NULL; + +struct info +{ + double x, y; +}; + +static void my_thread_mainloop_code(void *data); + +static HANDLE thread; +static CRITICAL_SECTION lock; +static int th_exit = 0; + +// BEGIN - code running in my custom win32 thread instance +// +static DWORD WINAPI +my_thread_run(LPVOID arg) +{ + double t = 0.0; + + // inside the thread function lets loop forever incrimenting a time point + for (;;) + { + struct info *inf = malloc(sizeof(struct info)); + int do_exit; + + if (inf) + { + inf->x = 200 + (200 * sin(t)); + inf->y = 200 + (200 * cos(t)); + // now call a function in the mainloop and pass it our allocated + // data that it will free when it gets it + ecore_main_loop_thread_safe_call_async + (my_thread_mainloop_code, inf); + } + // and sleep and loop + usleep(1000); + t += 0.02; + // in case someone has asked us to cancel - then cancel this loop + // co-operatively (cancelling is co-operative) + EnterCriticalSection(&lock); + do_exit = th_exit; + LeaveCriticalSection(&lock); + if (do_exit) break; + } + DeleteCriticalSection(&lock); + return NULL; +} +// +// END - code running in my custom win32 thread instance + +static void +my_thread_new(void) +{ + InitializeCriticalSection(&lock); + thread = CreateThread(NULL, 0, my_thread_run, NULL, 0, NULL); + if (!thread) + { + char *str = evil_last_error_get(); + if (str) + { + fprintf("thread creation failed: %s\n", str); + free(str); + } + } +} + +static void +my_thread_mainloop_code(void *data) +{ + struct info *inf = data; + evas_object_move(rect, inf->x - 50, inf->y - 50); + free(inf); +} + +// just test cancelling the thread +static void +down(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + EnterCriticalSection(&lock); + th_exit = 1; + LeaveCriticalSection(&lock); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *o, *bg; + + win = elm_win_add(NULL, "efl-thread-4", ELM_WIN_BASIC); + elm_win_title_set(win, "EFL Thread 4"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + evas_object_resize(win, 400, 400); + evas_object_show(win); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + o = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(o, 50, 80, 180, 255); + evas_object_resize(o, 100, 100); + evas_object_show(o); + // new in the examples - we have a mouse down on the blue box cancel + // the thread + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, down, NULL); + rect = o; + + // create custom thread to do some "work on the side" + my_thread_new(); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/entry_example.c b/libraries/elementary/src/examples/entry_example.c new file mode 100644 index 0000000..b28b76c --- /dev/null +++ b/libraries/elementary/src/examples/entry_example.c @@ -0,0 +1,580 @@ +/* + * gcc -o entry_example entry_example.c `pkg-config --cflags --libs elementary` + */ +#include + +typedef struct +{ + Evas_Object *win; + Evas_Object *edit_buffer; +} App_Data; + +typedef struct +{ + Evas_Object *inwin; + Evas_Object *naviframe; + Evas_Object *grid; + Evas_Object *settings; + + int size; + int vsize; + int width, height; + + const char *emo; + + App_Data *ad; +} App_Inwin_Data; + +static void +_edit_buffer_insert(Evas_Object *e, const char *text) +{ + elm_entry_entry_insert(e, text); + elm_object_focus_set(e, EINA_TRUE); +} + +static void +_it_sel_cb(void *data, Evas_Object *obj, void *event) +{ + App_Inwin_Data *aid = data; + Elm_Object_Item *gg_it = event; + + aid->emo = elm_object_item_data_get(gg_it); + + elm_naviframe_item_simple_promote(aid->naviframe, aid->settings); +} + +static char * +_emo_label_get(void *data, Evas_Object *obj, const char *part) +{ + return strdup(data); +} + +static Evas_Object * +_emo_content_get(void *data, Evas_Object *obj, const char *part) +{ + Evas_Object *o; + + if (strcmp(part, "elm.swallow.icon")) + return NULL; + o = elm_layout_add(obj); + elm_layout_theme_set(o, "entry/emoticon", data, "default"); + return o; +} + +static void +_emo_del(void *data, Evas_Object *obj) +{ + free(data); +} + +static Evas_Object * +_page_grid_add(Evas_Object *parent, App_Inwin_Data *aid) +{ + Evas_Object *grid; + char *theme, *emo; + Eina_List *emos, *it; + static Elm_Gengrid_Item_Class *it_class; + it_class = elm_gengrid_item_class_new(); + it_class->item_style = "default"; + it_class->func.text_get = _emo_label_get; + it_class->func.content_get = _emo_content_get; + it_class->func.del = _emo_del; + + theme = elm_theme_list_item_path_get("default", NULL); + if (!theme) return NULL; + emos = edje_file_collection_list(theme); + free(theme); + if (!emos) return NULL; + + grid = elm_gengrid_add(parent); + elm_gengrid_item_size_set(grid, 64, 80); + evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL); + + EINA_LIST_FOREACH(emos, it, emo) + { + char name[512]; + + if (strncmp(emo, "elm/entry/emoticon/", 19)) + continue; + sscanf(emo, "elm/entry/emoticon/%[^/]/default", name); + elm_gengrid_item_append(grid, it_class, strdup(name), _it_sel_cb, aid); + } + edje_file_collection_list_free(emos); + elm_gengrid_item_class_free(it_class); + + return grid; +} + +static void +_btn_insert_cb(void *data, Evas_Object *obj, void *event) +{ + App_Inwin_Data *aid = data; + const char *size[] = { + "size", + "absize", + "relsize" + }; + const char *vsize[] = { + "full", + "ascent" + }; + char buf[512]; + + snprintf(buf, sizeof(buf), "" + "", size[aid->size], aid->width, aid->height, + vsize[aid->vsize], aid->emo); + _edit_buffer_insert(aid->ad->edit_buffer, buf); + + evas_object_del(aid->inwin); +} + +static void +_width_changed_cb(void *data, Evas_Object *obj, void *event) +{ + App_Inwin_Data *aid = data; + + aid->width = atoi(elm_object_text_get(obj)); +} + +static void +_height_changed_cb(void *data, Evas_Object *obj, void *event) +{ + App_Inwin_Data *aid = data; + + aid->height = atoi(elm_object_text_get(obj)); +} + +static Evas_Object * +_page_settings_add(Evas_Object *parent, App_Inwin_Data *aid) +{ + Evas_Object *box, *sizeopts, *box2, *sizebox, *vsizebox, + *rsize, *rabsize, *rrelsize, *rvfull, *rvascent, + *fwidth, *ewidth, *fheight, *eheight, + *binsert; + char buf[100]; + static Elm_Entry_Filter_Accept_Set accept_set = { + .accepted = "0123456789", + .rejected = NULL + }; + static Elm_Entry_Filter_Limit_Size limit_size = { + .max_char_count = 5, + .max_byte_count = 0 + }; + + box = elm_box_add(parent); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); + + sizeopts = elm_frame_add(parent); + elm_object_text_set(sizeopts, "Size"); + evas_object_size_hint_weight_set(sizeopts, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sizeopts, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, sizeopts); + evas_object_show(sizeopts); + + box2 = elm_box_add(parent); + evas_object_size_hint_weight_set(box2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(box2, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_content_set(sizeopts, box2); + evas_object_show(box2); + + sizebox = elm_box_add(parent); + elm_box_horizontal_set(sizebox, EINA_TRUE); + evas_object_size_hint_weight_set(sizebox, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(sizebox, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box2, sizebox); + evas_object_show(sizebox); + + rsize = elm_radio_add(parent); + elm_object_text_set(rsize, "Scale adjusted (size)"); + elm_radio_state_value_set(rsize, 0); + elm_radio_value_pointer_set(rsize, &aid->size); + elm_box_pack_end(sizebox, rsize); + evas_object_show(rsize); + + rabsize = elm_radio_add(parent); + elm_object_text_set(rabsize, "Absolute size (absize)"); + elm_radio_state_value_set(rabsize, 1); + elm_radio_value_pointer_set(rabsize, &aid->size); + elm_radio_group_add(rabsize, rsize); + elm_box_pack_end(sizebox, rabsize); + evas_object_show(rabsize); + + rrelsize = elm_radio_add(parent); + elm_object_text_set(rrelsize, "Relative to line (relsize)"); + elm_radio_state_value_set(rrelsize, 2); + elm_radio_value_pointer_set(rrelsize, &aid->size); + elm_radio_group_add(rrelsize, rsize); + elm_box_pack_end(sizebox, rrelsize); + evas_object_show(rrelsize); + + vsizebox = elm_box_add(parent); + elm_box_horizontal_set(vsizebox, EINA_TRUE); + evas_object_size_hint_weight_set(vsizebox, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(vsizebox, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box2, vsizebox); + evas_object_show(vsizebox); + + rvfull = elm_radio_add(parent); + elm_object_text_set(rvfull, "Full height (vsize=full)"); + elm_radio_state_value_set(rvfull, 0); + elm_radio_value_pointer_set(rvfull, &aid->vsize); + elm_box_pack_end(vsizebox, rvfull); + evas_object_show(rvfull); + + rvascent = elm_radio_add(parent); + elm_object_text_set(rvascent, "Ascent only (vsize=ascent)"); + elm_radio_state_value_set(rvascent, 1); + elm_radio_value_pointer_set(rvascent, &aid->vsize); + elm_radio_group_add(rvascent, rvfull); + elm_box_pack_end(vsizebox, rvascent); + evas_object_show(rvascent); + + fwidth = elm_frame_add(parent); + elm_object_text_set(fwidth, "Width"); + evas_object_size_hint_weight_set(fwidth, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(fwidth, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box2, fwidth); + evas_object_show(fwidth); + + snprintf(buf, sizeof(buf), "%d", aid->width); + ewidth = elm_entry_add(parent); + elm_entry_single_line_set(ewidth, EINA_TRUE); + elm_entry_markup_filter_append(ewidth, elm_entry_filter_accept_set, + &accept_set); + elm_entry_markup_filter_append(ewidth, elm_entry_filter_limit_size, + &limit_size); + elm_object_text_set(ewidth, buf); + evas_object_size_hint_weight_set(ewidth, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(ewidth, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_content_set(fwidth, ewidth); + evas_object_show(ewidth); + + evas_object_smart_callback_add(ewidth, "changed", _width_changed_cb, aid); + + fheight = elm_frame_add(parent); + elm_object_text_set(fheight, "Height"); + evas_object_size_hint_weight_set(fheight, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(fheight, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box2, fheight); + evas_object_show(fheight); + + snprintf(buf, sizeof(buf), "%d", aid->height); + eheight = elm_entry_add(parent); + elm_entry_single_line_set(eheight, EINA_TRUE); + elm_entry_markup_filter_append(eheight, elm_entry_filter_accept_set, + &accept_set); + elm_entry_markup_filter_append(eheight, elm_entry_filter_limit_size, + &limit_size); + elm_object_text_set(eheight, buf); + evas_object_size_hint_weight_set(eheight, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(eheight, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_content_set(fheight, eheight); + evas_object_show(eheight); + + evas_object_smart_callback_add(eheight, "changed", _height_changed_cb, aid); + + binsert = elm_button_add(parent); + elm_object_text_set(binsert, "Insert"); + elm_box_pack_end(box, binsert); + evas_object_show(binsert); + + evas_object_smart_callback_add(binsert, "clicked", _btn_insert_cb, aid); + + return box; +} + +static void +_insert_cancel_cb(void *data, Evas_Object *obj, void *event) +{ + App_Inwin_Data *aid = data; + + evas_object_del(aid->inwin); +} + +static void +_inwin_del_cb(void *data, Evas *e, Evas_Object *obj, void *event) +{ + free(data); +} + +static void +_image_insert_cb(void *data, Evas_Object *obj, void *event) +{ + App_Data *ad = data; + App_Inwin_Data *aid; + Evas_Object *inwin, *box, *box2, *naviframe, *o; + + aid = calloc(1, sizeof(App_Inwin_Data)); + if (!aid) return; + + aid->ad = ad; + aid->size = 1; + aid->vsize = 1; + aid->width = 64; + aid->height = 64; + + inwin = elm_win_inwin_add(ad->win); + evas_object_size_hint_weight_set(inwin, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(inwin, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(inwin); + + evas_object_event_callback_add(inwin, EVAS_CALLBACK_DEL, _inwin_del_cb, + aid); + + box = elm_box_add(ad->win); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_inwin_content_set(inwin, box); + evas_object_show(box); + + naviframe = elm_naviframe_add(ad->win); + evas_object_size_hint_weight_set(naviframe, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(naviframe, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, naviframe); + evas_object_show(naviframe); + + o = _page_grid_add(ad->win, aid); + elm_naviframe_item_simple_push(naviframe, o); + aid->grid = o; + + o = _page_settings_add(ad->win, aid); + elm_naviframe_item_simple_push(naviframe, o); + aid->settings = o; + + elm_naviframe_item_simple_promote(naviframe, aid->grid); + + box2 = elm_box_add(ad->win); + elm_box_horizontal_set(box2, EINA_TRUE); + evas_object_size_hint_weight_set(box2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(box2, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, box2); + evas_object_show(box2); + + o = elm_button_add(ad->win); + elm_object_text_set(o, "Cancel"); + evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box2, o); + evas_object_show(o); + + evas_object_smart_callback_add(o, "clicked", _insert_cancel_cb, aid); + + aid->inwin = inwin; + aid->naviframe = naviframe; +} + +static void +_format_change_cb(void *data, Evas_Object *obj, void *event) +{ + App_Data *ad = data; + char fmt_open[5], fmt_close[6]; + const char *sel; + int cursor; + char *s; + const char *ptr, *what; + Eina_Strbuf *buf = NULL; + + sel = elm_object_text_get(obj); + snprintf(fmt_open, sizeof(fmt_open), "<%s>", sel); + snprintf(fmt_close, sizeof(fmt_close), "", sel); + + buf = eina_strbuf_new(); + + cursor = elm_entry_cursor_pos_get(ad->edit_buffer); + elm_entry_cursor_begin_set(ad->edit_buffer); + elm_entry_cursor_selection_begin(ad->edit_buffer); + elm_entry_cursor_pos_set(ad->edit_buffer, cursor); + elm_entry_cursor_selection_end(ad->edit_buffer); + sel = elm_entry_selection_get(ad->edit_buffer); + if (!sel || !sel[0]) + { + eina_strbuf_append(buf, fmt_open); + goto all_done; + } + what = fmt_open; + ptr = sel; + while ((s = strstr(ptr, what))) + { + ptr = s + strlen(what); + if (what == fmt_open) what = fmt_close; + else what = fmt_open; + } + eina_strbuf_append(buf, what); + if (what == fmt_close) + { + elm_entry_cursor_selection_begin(ad->edit_buffer); + elm_entry_cursor_end_set(ad->edit_buffer); + elm_entry_cursor_selection_end(ad->edit_buffer); + sel = elm_entry_selection_get(ad->edit_buffer); + if (sel) + { + Eina_Strbuf *buf2 = eina_strbuf_new(); + eina_strbuf_append(buf2, sel); + eina_strbuf_replace_first(buf2, fmt_close, ""); + elm_entry_entry_insert(ad->edit_buffer, + eina_strbuf_string_get(buf2)); + eina_strbuf_free(buf2); + } + } + elm_entry_select_none(ad->edit_buffer); + elm_entry_cursor_pos_set(ad->edit_buffer, cursor); + +all_done: + _edit_buffer_insert(ad->edit_buffer, eina_strbuf_string_get(buf)); + eina_strbuf_free(buf); +} + +static void +_autosave_change_cb(void *data, Evas_Object *obj, void *event) +{ + App_Data *ad = data; + Eina_Bool state = elm_check_state_get(obj); + + elm_entry_autosave_set(ad->edit_buffer, state); + if (state) elm_entry_file_save(ad->edit_buffer); +} + +static void +_edit_dblclick_cb(void *data, Evas_Object *obj, void *event) +{ + int current_cursor; + + current_cursor = elm_entry_cursor_pos_get(obj); + + while (elm_entry_cursor_prev(obj)) + { + const char *content; + if (elm_entry_cursor_is_visible_format_get(obj)) + break; + content = elm_entry_cursor_content_get(obj); + if (content && (content[0] == ' ')) + break; + } + + if (current_cursor == elm_entry_cursor_pos_get(obj)) + return; + + elm_entry_cursor_next(obj); + elm_entry_cursor_selection_begin(obj); + elm_entry_cursor_pos_set(obj, current_cursor); + while (elm_entry_cursor_next(obj)) + { + const char *content; + if (elm_entry_cursor_is_visible_format_get(obj)) + break; + content = elm_entry_cursor_content_get(obj); + if (content && (content[0] == ' ')) + break; + } + elm_entry_cursor_selection_end(obj); +} + +static void +_edit_tplclick_cb(void *data, Evas_Object *obj, void *event) +{ + elm_entry_cursor_line_begin_set(obj); + elm_entry_cursor_selection_begin(obj); + elm_entry_cursor_line_end_set(obj); + elm_entry_cursor_selection_end(obj); +} + +static void +_win_del_cb(void *data, Evas_Object *obj, void *event) +{ + evas_object_del(obj); + elm_exit(); +} + +EAPI_MAIN int +elm_main(int argc, char *argv[]) +{ + Evas_Object *win, *bg, *box, *tb, *en, *o, *icon; + App_Data app; + + memset(&app, 0, sizeof(app)); + + win = elm_win_add(NULL, "entry-example", ELM_WIN_BASIC); + elm_win_title_set(win, "Emacs Lite"); + evas_object_show(win); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + box = elm_box_add(win); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, box); + evas_object_show(box); + + tb = elm_box_add(win); + elm_box_horizontal_set(tb, EINA_TRUE); + evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_weight_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, tb); + evas_object_show(tb); + + o = elm_check_add(win); + elm_check_state_set(o, EINA_FALSE); + elm_object_text_set(o, "Autosave"); + elm_box_pack_end(tb, o); + evas_object_show(o); + + evas_object_smart_callback_add(o, "changed", _autosave_change_cb, &app); + + o = elm_button_add(win); + elm_object_text_set(o, "b"); + elm_box_pack_end(tb, o); + evas_object_show(o); + + evas_object_smart_callback_add(o, "clicked", _format_change_cb, &app); + + o = elm_button_add(win); + elm_object_text_set(o, "em"); + elm_box_pack_end(tb, o); + evas_object_show(o); + + evas_object_smart_callback_add(o, "clicked", _format_change_cb, &app); + + o = elm_button_add(win); + elm_box_pack_end(tb, o); + evas_object_show(o); + + icon = elm_layout_add(win); + elm_layout_theme_set(icon, "entry", "emoticon/haha", "default"); + elm_object_part_content_set(o, "icon", icon); + + evas_object_smart_callback_add(o, "clicked", _image_insert_cb, &app); + + en = elm_entry_add(win); + elm_entry_autosave_set(en, EINA_FALSE); + elm_entry_file_set(en, "/tmp/da_test.txt", ELM_TEXT_FORMAT_MARKUP_UTF8); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, en); + evas_object_show(en); + + app.win = win; + app.edit_buffer = en; + + evas_object_smart_callback_add(en, "clicked,double", _edit_dblclick_cb, + NULL); + evas_object_smart_callback_add(en, "clicked,triple", _edit_tplclick_cb, + NULL); + + evas_object_smart_callback_add(win, "delete,request", _win_del_cb, &app); + + elm_object_focus_set(app.edit_buffer, EINA_TRUE); + + evas_object_resize(win, 300, 780); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/fileselector_button_example.c b/libraries/elementary/src/examples/fileselector_button_example.c new file mode 100644 index 0000000..7858388 --- /dev/null +++ b/libraries/elementary/src/examples/fileselector_button_example.c @@ -0,0 +1,181 @@ +/** + * Simple Elementary's file selector button widget example, + * illustrating its usage and API. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g file selector_button_example.c -o file selector_button_example `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +static void +_on_done(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_exit(); +} + +static void /* hook on the sole smart callback */ +_file_chosen(void *data, + Evas_Object *obj, + void *event_info) +{ + Evas_Object *entry = data; + const char *file = event_info; + if (file) + { + elm_object_text_set(entry, file); + printf("File chosen: %s\n", file); + } + else + printf("File selection canceled.\n"); +} + +/* toggle inwin mode */ +static void +_inwin_mode_toggle(void *data, + Evas_Object *obj, + void *event_info) +{ + Evas_Object *fs_bt = data; + Eina_Bool old_val = elm_fileselector_button_inwin_mode_get(fs_bt); + + elm_fileselector_button_inwin_mode_set(fs_bt, !old_val); + printf("Inwin mode set to: %s\n", old_val ? "false" : "true"); +} + +static void +_current_sel_toggle(void *data, + Evas_Object *obj, + void *event_info) +{ + Evas_Object *fs_bt = data; + Eina_Bool old_val = elm_fileselector_button_is_save_get(fs_bt); + elm_fileselector_button_is_save_set(fs_bt, !old_val); + + printf("%s text entry with selected item's name\n", + old_val ? "Disabling" : "Enabling"); +} + +static void +_folder_only_toggle(void *data, + Evas_Object *obj, + void *event_info) +{ + Evas_Object *fs_bt = data; + Eina_Bool old_val = elm_fileselector_button_folder_only_get(fs_bt); + elm_fileselector_button_folder_only_set(fs_bt, !old_val); + + printf("Folder only mode set to: %s\n", old_val ? "false" : "true"); +} + +static void +_expandable_toggle(void *data, + Evas_Object *obj, + void *event_info) +{ + Evas_Object *fs_bt = data; + Eina_Bool old_val = elm_fileselector_button_expandable_get(fs_bt); + elm_fileselector_button_expandable_set(fs_bt, !old_val); + + printf("Expandable folders mode set to: %s\n", old_val ? "false" : "true"); +} + +EAPI_MAIN int +elm_main(int argc, + char **argv) +{ + Evas_Object *win, *bg, *vbox, *hbox, *ic, *ck, *fs_bt, *en, *lb, *sep; + + win = elm_win_add(NULL, "fileselector-button", ELM_WIN_BASIC); + elm_win_title_set(win, "File Selector Button Example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + vbox = elm_box_add(win); + elm_win_resize_object_add(win, vbox); + evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(vbox); + + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "file"); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + + /* file selector button */ + fs_bt = elm_fileselector_button_add(win); + elm_fileselector_button_path_set(fs_bt, "/tmp"); + elm_object_text_set(fs_bt, "Select a file"); + elm_object_part_content_set(fs_bt, "icon", ic); + + elm_box_pack_end(vbox, fs_bt); + evas_object_show(fs_bt); + evas_object_show(ic); + + /* attribute setting knobs */ + sep = elm_separator_add(win); + elm_separator_horizontal_set(sep, EINA_TRUE); + elm_box_pack_end(vbox, sep); + evas_object_show(sep); + + hbox = elm_box_add(win); + elm_box_horizontal_set(hbox, EINA_TRUE); + elm_box_pack_end(vbox, hbox); + evas_object_show(hbox); + + ck = elm_check_add(win); + elm_object_text_set(ck, "editable selection"); + elm_check_state_set(ck, elm_fileselector_button_is_save_get(fs_bt)); + evas_object_smart_callback_add(ck, "changed", _current_sel_toggle, fs_bt); + elm_box_pack_end(hbox, ck); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_object_text_set(ck, "\"inwin\" mode"); + elm_check_state_set(ck, elm_fileselector_button_inwin_mode_get(fs_bt)); + evas_object_smart_callback_add(ck, "changed", _inwin_mode_toggle, fs_bt); + elm_box_pack_end(hbox, ck); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_object_text_set(ck, "folders only"); + elm_check_state_set(ck, elm_fileselector_button_folder_only_get(fs_bt)); + evas_object_smart_callback_add(ck, "changed", _folder_only_toggle, fs_bt); + elm_box_pack_end(hbox, ck); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_object_text_set(ck, "expandable"); + elm_check_state_set(ck, elm_fileselector_button_expandable_get(fs_bt)); + evas_object_smart_callback_add(ck, "changed", _expandable_toggle, fs_bt); + elm_box_pack_end(hbox, ck); + evas_object_show(ck); + + lb = elm_label_add(win); + elm_object_text_set(lb, "Last selection:"); + elm_box_pack_end(vbox, lb); + evas_object_show(lb); + + en = elm_entry_add(win); + elm_entry_line_wrap_set(en, EINA_FALSE); + elm_entry_editable_set(en, EINA_FALSE); + evas_object_smart_callback_add(fs_bt, "file,chosen", _file_chosen, en); + elm_box_pack_end(vbox, en); + evas_object_show(en); + + evas_object_resize(win, 400, 400); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/fileselector_entry_example.c b/libraries/elementary/src/examples/fileselector_entry_example.c new file mode 100644 index 0000000..eafe80b --- /dev/null +++ b/libraries/elementary/src/examples/fileselector_entry_example.c @@ -0,0 +1,170 @@ +/** + * Simple Elementary's file selector entry widget example, + * illustrating its usage and API. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g file selector_entry_example.c -o file selector_entry_example `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +static void +_on_done(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_exit(); +} + +/* hook on the file,chosen smart callback */ +static void +_file_chosen(void *data, + Evas_Object *obj, + void *event_info) +{ + const char *file = event_info; + + if (file) + printf("File chosen: %s\n", file); + else + printf("File selection canceled.\n"); +} + +/* toggle inwin mode */ +static void +_inwin_mode_toggle(void *data, + Evas_Object *obj, + void *event_info) +{ + Evas_Object *fs_entry = data; + Eina_Bool old_val = elm_fileselector_entry_inwin_mode_get(fs_entry); + + elm_fileselector_entry_inwin_mode_set(fs_entry, !old_val); + printf("Inwin mode set to: %s\n", old_val ? "false" : "true"); +} + +static void +_current_sel_toggle(void *data, + Evas_Object *obj, + void *event_info) +{ + Evas_Object *fs_entry = data; + Eina_Bool old_val = elm_fileselector_entry_is_save_get(fs_entry); + elm_fileselector_entry_is_save_set(fs_entry, !old_val); + + printf("%s text entry with selected item's name\n", + old_val ? "Disabling" : "Enabling"); +} + +static void +_folder_only_toggle(void *data, + Evas_Object *obj, + void *event_info) +{ + Evas_Object *fs_entry = data; + Eina_Bool old_val = elm_fileselector_entry_folder_only_get(fs_entry); + elm_fileselector_entry_folder_only_set(fs_entry, !old_val); + + printf("Folder only mode set to: %s\n", old_val ? "false" : "true"); +} + +static void +_expandable_toggle(void *data, + Evas_Object *obj, + void *event_info) +{ + Evas_Object *fs_entry = data; + Eina_Bool old_val = elm_fileselector_entry_expandable_get(fs_entry); + elm_fileselector_entry_expandable_set(fs_entry, !old_val); + + printf("Expandable folders mode set to: %s\n", old_val ? "false" : "true"); +} + +EAPI_MAIN int +elm_main(int argc, + char **argv) +{ + Evas_Object *win, *bg, *vbox, *hbox, *ic, *ck, *fs_entry, *sep; + + win = elm_win_add(NULL, "fileselector-entry", ELM_WIN_BASIC); + elm_win_title_set(win, "File Selector Entry Example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + vbox = elm_box_add(win); + elm_win_resize_object_add(win, vbox); + evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(vbox); + + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "file"); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + + /* file selector entry */ + fs_entry = elm_fileselector_entry_add(win); + evas_object_size_hint_align_set(fs_entry, EVAS_HINT_FILL, 0); + elm_fileselector_entry_path_set(fs_entry, "/tmp"); + elm_object_text_set(fs_entry, "Select a file"); + elm_object_part_content_set(fs_entry, "button icon", ic); + + elm_box_pack_end(vbox, fs_entry); + evas_object_show(fs_entry); + evas_object_show(ic); + + /* attribute setting knobs */ + sep = elm_separator_add(win); + elm_separator_horizontal_set(sep, EINA_TRUE); + elm_box_pack_end(vbox, sep); + evas_object_show(sep); + + hbox = elm_box_add(win); + elm_box_horizontal_set(hbox, EINA_TRUE); + elm_box_pack_end(vbox, hbox); + evas_object_show(hbox); + + ck = elm_check_add(win); + elm_object_text_set(ck, "editable selection"); + elm_check_state_set(ck, elm_fileselector_entry_is_save_get(fs_entry)); + evas_object_smart_callback_add(ck, "changed", _current_sel_toggle, fs_entry); + elm_box_pack_end(hbox, ck); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_object_text_set(ck, "\"inwin\" mode"); + elm_check_state_set(ck, elm_fileselector_entry_inwin_mode_get(fs_entry)); + evas_object_smart_callback_add(ck, "changed", _inwin_mode_toggle, fs_entry); + elm_box_pack_end(hbox, ck); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_object_text_set(ck, "folders only"); + elm_check_state_set(ck, elm_fileselector_entry_folder_only_get(fs_entry)); + evas_object_smart_callback_add(ck, "changed", _folder_only_toggle, fs_entry); + elm_box_pack_end(hbox, ck); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_object_text_set(ck, "expandable"); + elm_check_state_set(ck, elm_fileselector_entry_expandable_get(fs_entry)); + evas_object_smart_callback_add(ck, "changed", _expandable_toggle, fs_entry); + elm_box_pack_end(hbox, ck); + evas_object_show(ck); + + evas_object_smart_callback_add(fs_entry, "file,chosen", _file_chosen, NULL); + + evas_object_resize(win, 400, 400); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/fileselector_example.c b/libraries/elementary/src/examples/fileselector_example.c new file mode 100644 index 0000000..7d91979 --- /dev/null +++ b/libraries/elementary/src/examples/fileselector_example.c @@ -0,0 +1,240 @@ +/** + * Simple Elementary's file selector widget example, + * illustrating its usage and API. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g file selector_example.c -o file selector_example `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +static void +_on_done(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_exit(); +} + +/* 'done' cb */ +static void +_fs_done(void *data, + Evas_Object *obj, + void *event_info) +{ + const char *selected = event_info; + /* event_info contains the full path of the selected file or NULL + * if none is selected (or cancel is pressed) */ + + printf("We're done! Selected file is: %s\n", + selected ? selected : "*none!*"); + + _on_done(NULL, NULL, NULL); +} + +/* 'selected' cb */ +static void +_fs_selected(void *data, + Evas_Object *obj, + void *event_info) +{ + const char *selected = event_info; + /* event_info contains the full path of the selected file */ + + printf("There's been a selection: %s\n", selected); +} + +static void +_is_save_clicked(void *data, + Evas_Object *obj, + void *event_info) +{ + Evas_Object *fs = data; + Eina_Bool old_val = elm_fileselector_is_save_get(fs); + + printf("%s text entry with selected item's name\n", + old_val ? "Disabling" : "Enabling"); + + elm_fileselector_is_save_set(fs, !old_val); +} + +static void +_folder_only_clicked(void *data, + Evas_Object *obj, + void *event_info) +{ + Evas_Object *fs = data; + Eina_Bool old_val = elm_fileselector_folder_only_get(fs); + + printf("%s folder-only mode\n", + old_val ? "Disabling" : "Enabling"); + + elm_fileselector_folder_only_set(fs, !old_val); +} + +static void +_expandable_clicked(void *data, + Evas_Object *obj, + void *event_info) +{ + Evas_Object *fs = data; + Eina_Bool old_val = elm_fileselector_expandable_get(fs); + + printf("%s tree-view mode\n", + old_val ? "Disabling" : "Enabling"); + + elm_fileselector_expandable_set(fs, !old_val); +} + +static void +_sel_get_clicked(void *data, + Evas_Object *obj, + void *event_info) +{ + Evas_Object *fs = data; + printf("Current selection is: %s\n", elm_fileselector_selected_get(fs)); +} + +static void +_path_get_clicked(void *data, + Evas_Object *obj, + void *event_info) +{ + Evas_Object *fs = data; + printf("Current selection's directory path is: %s\n", + elm_fileselector_path_get(fs)); +} + +EAPI_MAIN int +elm_main(int argc, + char **argv) +{ + Evas_Object *win, *fs, *bg, *vbox, *buttons_bx, *bt, *sep, *bx; + + /* Set the locale according to the system pref. If you dont do so + * the file selector will order the files list in a case sensitive + * manner + */ + setlocale(LC_ALL, ""); + + elm_need_ethumb(); /* let's have thumbnails of images on grid view */ + + win = elm_win_add(NULL, "fileselector", ELM_WIN_BASIC); + elm_win_title_set(win, "File Selector Example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + elm_win_resize_object_add(win, bx); + elm_box_horizontal_set(bx, EINA_TRUE); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + /* evas_object_size_hint_align_set(fs, EVAS_HINT_FILL, EVAS_HINT_FILL); */ + evas_object_show(bx); + + vbox = elm_box_add(win); + evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(vbox, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(vbox); + elm_box_pack_end(bx, vbox); + + /* first file selector, in list mode */ + fs = elm_fileselector_add(win); + /* enable the fs file name entry */ + elm_fileselector_is_save_set(fs, EINA_TRUE); + /* custom list view */ + elm_fileselector_expandable_set(fs, EINA_FALSE); + /* start the fileselector in the /tmp/ dir */ + elm_fileselector_path_set(fs, "/tmp"); + + evas_object_size_hint_weight_set(fs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(fs, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(vbox, fs); + evas_object_show(fs); + + /* the 'done' cb is called when the user presses ok/cancel */ + evas_object_smart_callback_add(fs, "done", _fs_done, win); + /* the 'selected' cb is called when the user clicks on a file/dir */ + evas_object_smart_callback_add(fs, "selected", _fs_selected, win); + + /* test buttons */ + sep = elm_separator_add(win); + elm_separator_horizontal_set(sep, EINA_TRUE); + elm_box_pack_end(vbox, sep); + evas_object_show(sep); + + buttons_bx = elm_box_add(win); + elm_box_horizontal_set(buttons_bx, EINA_TRUE); + elm_box_pack_end(vbox, buttons_bx); + evas_object_show(buttons_bx); + + bt = elm_check_add(win); + elm_object_text_set(bt, "editable selection"); + elm_check_state_set(bt, elm_fileselector_is_save_get(fs)); + evas_object_smart_callback_add(bt, "changed", _is_save_clicked, fs); + elm_box_pack_end(buttons_bx, bt); + evas_object_show(bt); + + bt = elm_check_add(win); + elm_object_text_set(bt, "folders only"); + elm_check_state_set(bt, elm_fileselector_folder_only_get(fs)); + evas_object_smart_callback_add(bt, "changed", _folder_only_clicked, fs); + elm_box_pack_end(buttons_bx, bt); + evas_object_show(bt); + + bt = elm_check_add(win); + elm_object_text_set(bt, "expandable"); + elm_check_state_set(bt, elm_fileselector_expandable_get(fs)); + evas_object_smart_callback_add(bt, "changed", _expandable_clicked, fs); + elm_box_pack_end(buttons_bx, bt); + evas_object_show(bt); + + buttons_bx = elm_box_add(win); + elm_box_horizontal_set(buttons_bx, EINA_TRUE); + elm_box_pack_end(vbox, buttons_bx); + evas_object_show(buttons_bx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Print selection"); + evas_object_smart_callback_add(bt, "clicked", _sel_get_clicked, fs); + elm_box_pack_end(buttons_bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Print path"); + evas_object_smart_callback_add(bt, "clicked", _path_get_clicked, fs); + elm_box_pack_end(buttons_bx, bt); + evas_object_show(bt); + + sep = elm_separator_add(win); + elm_separator_horizontal_set(sep, EINA_FALSE); + elm_box_pack_end(bx, sep); + evas_object_show(sep); + + /* second file selector, now with grid view */ + fs = elm_fileselector_add(win); + elm_fileselector_is_save_set(fs, EINA_TRUE); + elm_fileselector_mode_set(fs, ELM_FILESELECTOR_GRID); + elm_fileselector_buttons_ok_cancel_set(fs, EINA_FALSE); + elm_fileselector_path_set(fs, "/tmp"); + + evas_object_size_hint_weight_set(fs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(fs, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, fs); + evas_object_show(fs); + + evas_object_resize(win, 800, 600); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/flip_example_01.c b/libraries/elementary/src/examples/flip_example_01.c new file mode 100644 index 0000000..41a0ef6 --- /dev/null +++ b/libraries/elementary/src/examples/flip_example_01.c @@ -0,0 +1,91 @@ +//Compile with: +//gcc -o flip_example_01 flip_example_01.c -g `pkg-config --cflags --libs elementary` + +#include + +static void _change_interaction(void *data, Evas_Object *obj, void *event_info); + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *rect, *rect2, *flip, *radio, *radio2, *radio3; + + win = elm_win_add(NULL, "flip", ELM_WIN_BASIC); + elm_win_title_set(win, "Flip"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + rect = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_resize(rect, 150, 150); + evas_object_color_set(rect, 0, 0, 255, 255); + evas_object_show(rect); + + rect2 = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(rect2, 0, 255, 0, 255); + evas_object_show(rect2); + + flip = elm_flip_add(win); + elm_object_part_content_set(flip, "front", rect); + elm_object_part_content_set(flip, "back", rect2); + evas_object_resize(flip, 150, 150); + evas_object_move(flip, 10, 10); + evas_object_show(flip); + + elm_flip_interaction_set(flip, ELM_FLIP_INTERACTION_PAGE); + elm_flip_interaction_direction_enabled_set(flip, ELM_FLIP_DIRECTION_UP, EINA_TRUE); + elm_flip_interaction_direction_enabled_set(flip, ELM_FLIP_DIRECTION_DOWN, EINA_TRUE); + elm_flip_interaction_direction_enabled_set(flip, ELM_FLIP_DIRECTION_LEFT, EINA_TRUE); + elm_flip_interaction_direction_enabled_set(flip, ELM_FLIP_DIRECTION_RIGHT, EINA_TRUE); + elm_flip_interaction_direction_hitsize_set(flip, ELM_FLIP_DIRECTION_UP, 1); + elm_flip_interaction_direction_hitsize_set(flip, ELM_FLIP_DIRECTION_DOWN, 1); + elm_flip_interaction_direction_hitsize_set(flip, ELM_FLIP_DIRECTION_LEFT, 1); + elm_flip_interaction_direction_hitsize_set(flip, ELM_FLIP_DIRECTION_RIGHT, 1); + + radio = elm_radio_add(win); + elm_object_text_set(radio, "page"); + elm_radio_value_set(radio, ELM_FLIP_INTERACTION_PAGE); + elm_radio_state_value_set(radio, ELM_FLIP_INTERACTION_PAGE); + evas_object_resize(radio, 55, 30); + evas_object_move(radio, 10, 160); + evas_object_show(radio); + evas_object_smart_callback_add(radio, "changed", _change_interaction, flip); + + radio2 = elm_radio_add(win); + elm_object_text_set(radio2, "cube"); + elm_radio_state_value_set(radio2, ELM_FLIP_INTERACTION_CUBE); + elm_radio_group_add(radio2, radio); + evas_object_resize(radio2, 55, 30); + evas_object_move(radio2, 75, 160); + evas_object_show(radio2); + evas_object_smart_callback_add(radio2, "changed", _change_interaction, flip); + + radio3 = elm_radio_add(win); + elm_object_text_set(radio3, "rotate"); + elm_radio_state_value_set(radio3, ELM_FLIP_INTERACTION_ROTATE); + elm_radio_group_add(radio3, radio); + evas_object_resize(radio3, 55, 30); + evas_object_move(radio3, 140, 160); + evas_object_show(radio3); + evas_object_smart_callback_add(radio3, "changed", _change_interaction, flip); + + evas_object_resize(win, 200, 200); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() + +static void +_change_interaction(void *data, Evas_Object *obj, void *event_info) +{ + elm_flip_interaction_set(data, elm_radio_state_value_get(obj)); + elm_flip_go(data, ELM_FLIP_ROTATE_XZ_CENTER_AXIS); +} diff --git a/libraries/elementary/src/examples/flipselector_example.c b/libraries/elementary/src/examples/flipselector_example.c new file mode 100644 index 0000000..209c3bf --- /dev/null +++ b/libraries/elementary/src/examples/flipselector_example.c @@ -0,0 +1,206 @@ +/** + * Simple Elementary's flip selector widget example, illustrating its + * usage and API. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g flipselector_example.c -o flipselector_example `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +static const char *commands = \ + "commands are:\n" + "\tn - flip to next item\n" + "\tp - flip to previous item\n" + "\tf - print first item's label\n" + "\tl - print last item's label\n" + "\ts - print selected item's label\n" + "\th - print help\n"; + +static void +_on_done(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_exit(); +} + +void /* unselect the item shown in the flip selector */ +_unsel_cb(void *data, + Evas_Object *obj, + void *event_info) +{ + Elm_Object_Item *it; + Evas_Object *fp = data; + + it = elm_flipselector_selected_item_get(fp); + elm_flipselector_item_selected_set(it, EINA_FALSE); +} + +void /* delete the item shown in the flip selector */ +_del_cb(void *data, + Evas_Object *obj, + void *event_info) +{ + Elm_Object_Item *it; + Evas_Object *fp = data; + + it = elm_flipselector_selected_item_get(fp); + if (it) elm_object_item_del(it); +} + +void /* underflow callback */ +_underflow_cb(void *data, + Evas_Object *obj, + void *event_info) +{ + fprintf(stdout, "Underflow!\n"); +} + +void /* overflow callback */ +_overflow_cb(void *data, + Evas_Object *obj, + void *event_info) +{ + fprintf(stdout, "Overflow!\n"); +} + +static void +_on_keydown(void *data, + Evas_Object *object, + Evas_Object *src, + Evas_Callback_Type type, + void *event_info) +{ + Evas_Object *fs = data; + Evas_Event_Key_Down *ev = event_info; + + if (type != EVAS_CALLBACK_KEY_DOWN) return; + + if (strcmp(ev->keyname, "h") == 0) /* print help */ + { + fprintf(stdout, "%s", commands); + return; + } + + if (strcmp(ev->keyname, "n") == 0) /* flip to next item */ + { + elm_flipselector_flip_next(fs); + + fprintf(stdout, "Flipping to next item\n"); + + return; + } + + if (strcmp(ev->keyname, "p") == 0) /* flip to previous item */ + { + elm_flipselector_flip_prev(fs); + + fprintf(stdout, "Flipping to previous item\n"); + + return; + } + + if (strcmp(ev->keyname, "f") == 0) /* print first item's label */ + { + Elm_Object_Item *it; + + it = elm_flipselector_first_item_get(fs); + + fprintf(stdout, "Flip selector's first item is: %s\n", it ? + elm_object_item_text_get(it) : "none"); + + return; + } + + if (strcmp(ev->keyname, "l") == 0) /* print last item's label */ + { + Elm_Object_Item *it; + + it = elm_flipselector_last_item_get(fs); + + fprintf(stdout, "Flip selector's last item is: %s\n", it ? + elm_object_item_text_get(it) : "none"); + + return; + } + + if (strcmp(ev->keyname, "s") == 0) /* print selected item's label */ + { + Elm_Object_Item *it; + + it = elm_flipselector_selected_item_get(fs); + + fprintf(stdout, "Flip selector's selected item is: %s\n", it ? + elm_object_item_text_get(it) : "none"); + + return; + } +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + unsigned int i; + Evas_Object *win, *bg, *bx, *fp, *bt; + static const char *lbl[] = + { + "Elementary", + "Evas", + "Eina", + "Edje", + "Eet", + "Ecore", + "Efreet", + "Edbus" + }; + + win = elm_win_add(NULL, "flipselector", ELM_WIN_BASIC); + elm_win_title_set(win, "Flip Selector Example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + fp = elm_flipselector_add(win); + evas_object_size_hint_weight_set(fp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_smart_callback_add(fp, "underflowed", _overflow_cb, NULL); + evas_object_smart_callback_add(fp, "overflowed", _underflow_cb, NULL); + for (i = 0; i < sizeof(lbl) / sizeof(lbl[0]); i++) + elm_flipselector_item_append(fp, lbl[i], NULL, NULL); + elm_box_pack_end(bx, fp); + evas_object_show(fp); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Unselect item"); + evas_object_smart_callback_add(bt, "clicked", _unsel_cb, fp); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Delete item"); + evas_object_smart_callback_add(bt, "clicked", _del_cb, fp); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + elm_object_event_callback_add(win, (Elm_Event_Cb)_on_keydown, fp); + + evas_object_show(win); + + fprintf(stdout, "%s", commands); + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/frame_example_01.c b/libraries/elementary/src/examples/frame_example_01.c new file mode 100644 index 0000000..ed862b9 --- /dev/null +++ b/libraries/elementary/src/examples/frame_example_01.c @@ -0,0 +1,77 @@ +//Compile with: +//gcc -o frame_example_01 frame_example_01.c -g `pkg-config --cflags --libs elementary` + +#include + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg; + Evas_Object *f1, *r1, *f2, *r2, *f3, *r3, *f4, *r4; + + win = elm_win_add(NULL, "frame", ELM_WIN_BASIC); + elm_win_title_set(win, "Frame"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + r1 = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(r1, 255, 0, 0, 255); + evas_object_show(r1); + + f1= elm_frame_add(win); + elm_object_content_set(f1, r1); + elm_object_text_set(f1, "Default frame"); + evas_object_resize(f1, 100, 100); + evas_object_move(f1, 25, 25); + evas_object_show(f1); + + r2 = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(r2, 0, 255, 0, 255); + evas_object_show(r2); + + f2 = elm_frame_add(win); + elm_object_content_set(f2, r2); + elm_object_text_set(f2, "Padding frame"); + evas_object_resize(f2, 100, 100); + evas_object_move(f2, 150, 25); + elm_object_style_set(f2, "pad_small"); + evas_object_show(f2); + + r3 = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(r3, 0, 0, 255, 255); + evas_object_show(r3); + + f3 = elm_frame_add(win); + elm_object_content_set(f3, r3); + elm_object_text_set(f3, "Top outdent frame"); + evas_object_resize(f3, 100, 100); + evas_object_move(f3, 25, 150); + elm_object_style_set(f3, "outdent_top"); + evas_object_show(f3); + + r4 = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(r4, 0, 0, 0, 255); + evas_object_show(r4); + + f4 = elm_frame_add(win); + elm_object_content_set(f4, r4); + elm_object_text_set(f4, "Bottom outdent frame"); + evas_object_resize(f4, 100, 100); + evas_object_move(f4, 150, 150); + elm_object_style_set(f4, "outdent_bottom"); + evas_object_show(f4); + + evas_object_resize(win, 275, 275); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/general_funcs_example.c b/libraries/elementary/src/examples/general_funcs_example.c new file mode 100644 index 0000000..626c272 --- /dev/null +++ b/libraries/elementary/src/examples/general_funcs_example.c @@ -0,0 +1,188 @@ +/* Compile with: + * gcc -g general_funcs_example.c -o general_funcs_example `pkg-config --cflags --libs elementary` + */ + +#include + +#define BIN_DIR "/usr/bin" +#define LIB_DIR "/usr/lib" +#define DATA_DIR "/usr/local/share/elementary" + +#define WIDTH 300 +#define HEIGHT 300 + +struct test_data +{ + Evas_Object *btn; + Eina_Bool btn_enabled; + Eina_Bool btn_gets_focus; +}; + +struct test_data d = {NULL, EINA_TRUE, EINA_TRUE}; + +static void +_btn_enabled_cb(void *data, + Evas_Object *obj, + void *event) +{ + elm_object_disabled_set(d.btn, !d.btn_enabled); +} + +static void +/* focus callback */ +_btn_focus_cb(void *data, + Evas_Object *obj, + void *event) +{ + elm_object_focus_set(d.btn, EINA_TRUE); +} + +static void +/* unfocus callback */ +_btn_unfocus_cb(void *data, + Evas_Object *obj, + void *event) +{ + elm_object_focus_set(d.btn, EINA_FALSE); +} + +static void +/* focus allow callback */ +_btn_focus_allow_cb(void *data, + Evas_Object *obj, + void *event) +{ + elm_object_focus_allow_set(d.btn, d.btn_gets_focus); +} + +static void /* scaling callback */ +_btn_scale_cb(void *data, + Evas_Object *obj, + void *event) +{ + elm_object_scale_set(d.btn, elm_slider_value_get(obj)); +} + +EAPI_MAIN int +elm_main(int argc, + char **argv) +{ + int h; + Evas_Object *win, *bg, *box, *frame, *check, *b, *slider; + + /* tell elm about our app so it can figure out where to get files */ + elm_app_compile_bin_dir_set(BIN_DIR); + elm_app_compile_data_dir_set(DATA_DIR); + elm_app_compile_lib_dir_set(LIB_DIR); + elm_app_info_set(elm_main, "elementary", "images/logo.png"); + + fprintf(stdout, "prefix was set to: %s\n", elm_app_prefix_dir_get()); + fprintf(stdout, "data directory is: %s\n", elm_app_data_dir_get()); + fprintf(stdout, "library directory is: %s\n", elm_app_lib_dir_get()); + fprintf(stdout, "locale directory is: %s\n", elm_app_locale_dir_get()); + + win = elm_win_add(NULL, "top-level-funcs-example", ELM_WIN_BASIC); + elm_win_title_set(win, "Elementary Top-level Functions Example"); + + /* by using this policy value, we avoid having to + * evas_object_smart_callback_add(win, "delete,request", _on_exit, NULL), + * calling elm_exit() on that callback ourselves. + */ + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + evas_object_size_hint_min_set(bg, 160, 160); + + /* outer box */ + box = elm_box_add(win); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, box); + evas_object_show(box); + + frame = elm_frame_add(win); + elm_object_text_set(frame, "Button"); + evas_object_size_hint_align_set(frame, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(frame); + elm_box_pack_end(box, frame); + + d.btn = elm_button_add(win); + elm_object_text_set(d.btn, "Click me"); + elm_object_content_set(frame, d.btn); + + fprintf(stdout, "Elementary's finger size is set to %d pixels\n.", + elm_config_finger_size_get()); + elm_coords_finger_size_adjust(0, NULL, 3, &h); + /* so, button will be 3 fingers tall */ + evas_object_size_hint_min_set(d.btn, 0, h); + evas_object_show(d.btn); + + b = elm_box_add(win); + elm_box_horizontal_set(b, EINA_FALSE); + evas_object_size_hint_weight_set(b, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(b, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, b); + elm_box_pack_end(box, b); + evas_object_show(b); + + check = elm_check_add(win); + evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(check, 0.0, 0.0); + elm_object_text_set(check, "Button enabled"); + elm_check_state_pointer_set(check, &d.btn_enabled); + evas_object_smart_callback_add(check, "changed", _btn_enabled_cb, NULL); + elm_box_pack_end(box, check); + evas_object_show(check); + + b = elm_button_add(win); + evas_object_size_hint_weight_set(b, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(b, 0.0, 0.0); + elm_object_text_set(b, "Focus top button"); + evas_object_smart_callback_add(b, "clicked", _btn_focus_cb, NULL); + elm_box_pack_end(box, b); + evas_object_show(b); + + b = elm_button_add(win); + evas_object_size_hint_weight_set(b, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(b, 0.0, 0.0); + elm_object_text_set(b, "Unfocus top button"); + evas_object_smart_callback_add(b, "clicked", _btn_unfocus_cb, NULL); + elm_box_pack_end(box, b); + evas_object_show(b); + + check = elm_check_add(win); + evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(check, 0.0, 0.0); + elm_object_text_set(check, "Button gets focus"); + elm_check_state_pointer_set(check, &d.btn_gets_focus); + evas_object_smart_callback_add(check, "changed", _btn_focus_allow_cb, NULL); + elm_box_pack_end(box, check); + evas_object_show(check); + + slider = elm_slider_add(win); + elm_slider_min_max_set(slider, 0, 4); + elm_slider_unit_format_set(slider, "%1.1f"); + elm_slider_indicator_format_set(slider, "%1.1f"); + evas_object_size_hint_weight_set( + slider, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(slider, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_smart_callback_add(slider, "changed", _btn_scale_cb, NULL); + elm_box_pack_end(box, slider); + evas_object_show(slider); + + evas_object_resize(win, WIDTH, HEIGHT); + elm_win_focus_highlight_enabled_set(win, EINA_TRUE); + evas_object_show(win); + + elm_run(); /* and run the program now, starting to handle all + * events, etc. */ + elm_shutdown(); /* clean up and shut down */ + + /* exit code */ + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/gengrid_example.c b/libraries/elementary/src/examples/gengrid_example.c new file mode 100644 index 0000000..e3b345d --- /dev/null +++ b/libraries/elementary/src/examples/gengrid_example.c @@ -0,0 +1,630 @@ +/** + * Simple Elementary's gengrid widget example, illustrating its + * usage and API. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g gengrid_example.c -o gengrid_example `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +typedef struct _Example_Item +{ + const char *path; +} Example_Item; + +static const char *imgs[9] = +{ + "panel_01.jpg", + "plant_01.jpg", + "rock_01.jpg", + "rock_02.jpg", + "sky_01.jpg", + "sky_02.jpg", + "sky_03.jpg", + "sky_04.jpg", + "wood_01.jpg", +}; + +static Elm_Gengrid_Item_Class *gic = NULL; +static Evas_Object *before_bt, *after_bt; + +static void +_on_done(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_exit(); +} + +/* change layouting mode */ +static void +_horizontal_grid(void *data, + Evas_Object *obj, + void *event_info) +{ + Evas_Object *grid = data; + + elm_gengrid_horizontal_set(grid, elm_check_state_get(obj)); +} + +/* "always select" callback */ +static void +_always_select_change(void *data, + Evas_Object *obj, + void *event_info) +{ + Evas_Object *grid = data; + Eina_Bool always = elm_check_state_get(obj); + + if (always) + elm_gengrid_select_mode_set(grid, ELM_OBJECT_SELECT_MODE_ALWAYS); + else + elm_gengrid_select_mode_set(grid, ELM_OBJECT_SELECT_MODE_DEFAULT); + + fprintf(stdout, "\"Always select\" mode for gengrid items is now %s\n", + always ? "on" : "off"); +} + +/* "bouncing mode" callback */ +static void +_bouncing_change(void *data, + Evas_Object *obj, + void *event_info) +{ + Evas_Object *grid = data; + Eina_Bool bounce = elm_check_state_get(obj); + + elm_gengrid_bounce_set(grid, bounce, bounce); + + fprintf(stdout, "Bouncing effect for gengrid is now %s\n", + bounce ? "on" : "off"); +} + +/* multi-selection callback */ +static void +_multi_change(void *data, + Evas_Object *obj, + void *event_info) +{ + Evas_Object *grid = data; + Eina_Bool multi = elm_check_state_get(obj); + + elm_gengrid_multi_select_set(grid, multi); + + fprintf(stdout, "Multi-selection for gengrid is now %s\n", + multi ? "on" : "off"); + + elm_object_disabled_set(before_bt, multi); + elm_object_disabled_set(after_bt, multi); + + if (!multi) + { + Elm_Object_Item *gg_it; + const Eina_List *selected = elm_gengrid_selected_items_get(grid), *l; + EINA_LIST_FOREACH(selected, l, gg_it) + elm_gengrid_item_selected_set(gg_it, EINA_FALSE); + } +} + +/* no selection callback */ +static void +_no_sel_change(void *data, + Evas_Object *obj, + void *event_info) +{ + Evas_Object *grid = data; + Eina_Bool no_sel = elm_check_state_get(obj); + + if (no_sel) + elm_gengrid_select_mode_set(grid, ELM_OBJECT_SELECT_MODE_NONE); + else + elm_gengrid_select_mode_set(grid, ELM_OBJECT_SELECT_MODE_DEFAULT); + + fprintf(stdout, "Selection for gengrid items is now %s\n", + no_sel ? "disabled" : "enabled"); +} + +/* item selection callback */ +static void +_grid_sel(void *data, + Evas_Object *obj, + void *event_info) +{ + unsigned int x, y; + Example_Item *it = elm_object_item_data_get(event_info); + + elm_gengrid_item_pos_get(event_info, &x, &y); + + fprintf(stdout, "Item [%p], with data [%p], path %s, at position (%d, %d)," + " has been selected\n", event_info, data, it->path, x, y); +} + +/* new item with random path */ +static Example_Item * +_item_new(void) +{ + Example_Item *it; + + it = malloc(sizeof(*it)); + it->path = eina_stringshare_add(imgs[rand() % (sizeof(imgs) / + sizeof(imgs[0]))]); + return it; +} + +/* "insert before" callback */ +static void +_before_bt_clicked(void *data, + Evas_Object *obj, + void *event_info) +{ + Example_Item *it; + Evas_Object *grid = data; + Elm_Object_Item *sel; + + sel = elm_gengrid_selected_item_get(grid); + if (!sel) + return; + + it = _item_new(); + elm_gengrid_item_insert_before(grid, gic, it, sel, _grid_sel, NULL); +} + +/* "insert after" callback */ +static void +_after_bt_clicked(void *data, + Evas_Object *obj, + void *event_info) +{ + Example_Item *it; + Evas_Object *grid = data; + Elm_Object_Item *sel; + + sel = elm_gengrid_selected_item_get(grid); + if (!sel) + return; + + it = _item_new(); + elm_gengrid_item_insert_after(grid, gic, it, sel, _grid_sel, NULL); +} + +/* prepend an item */ +static void +_prepend_bt_clicked(void *data, + Evas_Object *obj, + void *event_info) +{ + Example_Item *it; + Evas_Object *grid = data; + + it = _item_new(); + elm_gengrid_item_prepend(grid, gic, it, _grid_sel, NULL); +} + +/* append an item */ +static void +_append_bt_clicked(void *data, + Evas_Object *obj, + void *event_info) +{ + Evas_Object *grid = data; + Example_Item *it = _item_new(); + + elm_gengrid_item_append(grid, gic, it, _grid_sel, NULL); +} + +/* delete items */ +static void +_clear_cb(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_gengrid_clear(data); + + fprintf(stdout, "Clearing the grid!\n"); +} + +/* bring in 1st item */ +static void +_bring_1st_clicked(void *data, + Evas_Object *obj, + void *event_info) +{ + Elm_Object_Item *gg_it = elm_gengrid_first_item_get(data); + + if (!gg_it) return; + + elm_gengrid_item_bring_in(gg_it, ELM_GENGRID_ITEM_SCROLLTO_IN); +} + +/* show last item */ +static void +_show_last_clicked(void *data, + Evas_Object *obj, + void *event_info) +{ + Elm_Object_Item *gg_it = elm_gengrid_last_item_get(data); + + if (!gg_it) return; + + elm_gengrid_item_show(gg_it, ELM_GENGRID_ITEM_SCROLLTO_IN); +} + +/* disable selected item */ +static void +_toggle_disabled_cb(void *data, + Evas_Object *obj, + void *event_info) +{ + Elm_Object_Item *gg_it = elm_gengrid_selected_item_get(data); + + if (!gg_it) return; + + elm_gengrid_item_selected_set(gg_it, EINA_FALSE); + elm_object_item_disabled_set(gg_it, EINA_TRUE); +} + +/* change items' size */ +static void +_size_changed(void *data, + Evas_Object *obj, + void *event_info) +{ + Evas_Object *grid = data; + int size = elm_spinner_value_get(obj); + + elm_gengrid_item_size_set(grid, size, size); +} + +/* item double click callback */ +static void +_double_click(void *data, + Evas_Object *obj, + void *event_info) +{ + fprintf(stdout, "Double click on item with handle %p\n", event_info); +} + +/* item long press callback */ +static void +_long_pressed(void *data, + Evas_Object *obj, + void *event_info) +{ + fprintf(stdout, "Long press on item with handle %p\n", event_info); +} + + +/* label fetching callback */ +static char * +_grid_label_get(void *data, + Evas_Object *obj, + const char *part) +{ + const Example_Item *it = data; + char buf[256]; + + snprintf(buf, sizeof(buf), "Photo %s", it->path); + return strdup(buf); +} + +/* icon fetching callback */ +static Evas_Object * +_grid_content_get(void *data, + Evas_Object *obj, + const char *part) +{ + const Example_Item *it = data; + + if (!strcmp(part, "elm.swallow.icon")) + { + Evas_Object *icon = elm_bg_add(obj); + char buf[PATH_MAX]; + + snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), + it->path); + + elm_bg_file_set(icon, buf, NULL); + evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, + 1); + evas_object_show(icon); + return icon; + } + else if (!strcmp(part, "elm.swallow.end")) + { + Evas_Object *ck; + ck = elm_check_add(obj); + evas_object_propagate_events_set(ck, EINA_FALSE); + evas_object_show(ck); + return ck; + } + + return NULL; +} + +/* state fetching callback */ +static Eina_Bool +_grid_state_get(void *data, + Evas_Object *obj, + const char *part) +{ + return EINA_FALSE; +} + +/* deletion callback */ +static void +_grid_del(void *data, + Evas_Object *obj) +{ + Example_Item *it = data; + + eina_stringshare_del(it->path); + free(it); +} + +/* scrolling animation stopped callback */ +static void +_grid_scroll_stopped_cb(void *data, + Evas_Object *obj, + void *event_info) +{ + int h_pagenumber = 0, v_pagenumber = 0; + elm_gengrid_current_page_get(obj, &h_pagenumber, &v_pagenumber); + fprintf(stdout, "Grid current horiz page is %d, vert page is %d\n", + h_pagenumber, v_pagenumber); +} + +/* items grid horizontal alignment change */ +static void +_h_align_change_cb(void *data, + Evas_Object *obj, + void *event_info) +{ + double v_align; + double val = elm_slider_value_get(obj); + + elm_gengrid_align_get(data, NULL, &v_align); + + fprintf(stdout, "Setting horizontal alignment to %f\n", val); + elm_gengrid_align_set(data, val, v_align); +} + +static void +_v_align_change_cb(void *data, + Evas_Object *obj, + void *event_info) +{ + double h_align; + double val = elm_slider_value_get(obj); + + elm_gengrid_align_get(data, &h_align, NULL); + + fprintf(stdout, "Setting vertical alignment to %f\n", val); + elm_gengrid_align_set(data, h_align, val); +} + +/* page relative size change */ +static void +_page_change_cb(void *data, + Evas_Object *obj, + void *event_info) +{ + double val = elm_slider_value_get(obj); + + elm_gengrid_page_relative_set(data, val, val); + + fprintf(stdout, "Setting grid page's relative size to %f\n", val); +} + +EAPI_MAIN int +elm_main(int argc, + char **argv) +{ + Evas_Object *win, *bg, *grid, *bx, *hbx_1, *hbx_2, *hbx_3, *bt, *ck, *sl, + *sp; + Eina_Bool bounce; + double h, v; + + srand(time(NULL)); + + elm_app_info_set(elm_main, "elementary", "images"); + win = elm_win_add(NULL, "gengrid", ELM_WIN_BASIC); + elm_win_title_set(win, "Generic Grid Example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + grid = elm_gengrid_add(win); + elm_gengrid_item_size_set(grid, 150, 150); + evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_min_set(grid, 600, 500); + elm_box_pack_end(bx, grid); + evas_object_smart_callback_add(grid, "clicked,double", _double_click, NULL); + evas_object_smart_callback_add(grid, "longpressed", _long_pressed, NULL); + evas_object_show(grid); + + hbx_1 = elm_box_add(win); + evas_object_size_hint_weight_set(hbx_1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_horizontal_set(hbx_1, EINA_TRUE); + elm_box_pack_end(bx, hbx_1); + evas_object_show(hbx_1); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Append"); + evas_object_smart_callback_add(bt, "clicked", _append_bt_clicked, grid); + elm_box_pack_end(hbx_1, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Prepend"); + evas_object_smart_callback_add(bt, "clicked", _prepend_bt_clicked, grid); + elm_box_pack_end(hbx_1, bt); + evas_object_show(bt); + + before_bt = elm_button_add(win); + elm_object_text_set(before_bt, "Insert before"); + evas_object_smart_callback_add(before_bt, "clicked", _before_bt_clicked, + grid); + elm_box_pack_end(hbx_1, before_bt); + evas_object_show(before_bt); + + after_bt = elm_button_add(win); + elm_object_text_set(after_bt, "Insert after"); + evas_object_smart_callback_add(after_bt, "clicked", _after_bt_clicked, grid); + elm_box_pack_end(hbx_1, after_bt); + evas_object_show(after_bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Clear"); + evas_object_smart_callback_add(bt, "clicked", _clear_cb, grid); + elm_box_pack_end(hbx_1, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Bring in 1st"); + evas_object_smart_callback_add(bt, "clicked", _bring_1st_clicked, grid); + elm_box_pack_end(hbx_1, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Show last"); + evas_object_smart_callback_add(bt, "clicked", _show_last_clicked, grid); + elm_box_pack_end(hbx_1, bt); + evas_object_show(bt); + + sp = elm_spinner_add(win); + elm_spinner_min_max_set(sp, 10, 1024); + elm_spinner_value_set(sp, 150); + elm_spinner_label_format_set(sp, "Item size: %.0f"); + evas_object_smart_callback_add(sp, "changed", _size_changed, grid); + evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(hbx_1, sp); + evas_object_show(sp); + + hbx_2 = elm_box_add(win); + evas_object_size_hint_weight_set(hbx_2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_horizontal_set(hbx_2, EINA_TRUE); + elm_box_pack_end(bx, hbx_2); + evas_object_show(hbx_2); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Disable item"); + evas_object_smart_callback_add(bt, "clicked", _toggle_disabled_cb, grid); + elm_box_pack_end(hbx_2, bt); + evas_object_show(bt); + + ck = elm_check_add(win); + elm_object_text_set(ck, "Horizontal mode"); + evas_object_smart_callback_add(ck, "changed", _horizontal_grid, grid); + elm_box_pack_end(hbx_2, ck); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_object_text_set(ck, "Always select"); + evas_object_smart_callback_add(ck, "changed", _always_select_change, grid); + elm_box_pack_end(hbx_2, ck); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_gengrid_bounce_get(grid, &bounce, NULL); + elm_object_text_set(ck, "Bouncing"); + elm_check_state_set(ck, bounce); + evas_object_smart_callback_add(ck, "changed", _bouncing_change, grid); + elm_box_pack_end(hbx_2, ck); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_object_text_set(ck, "Multi-selection"); + elm_check_state_set(ck, elm_gengrid_multi_select_get(grid)); + evas_object_smart_callback_add(ck, "changed", _multi_change, grid); + elm_box_pack_end(hbx_2, ck); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_object_text_set(ck, "No selection"); + evas_object_smart_callback_add(ck, "changed", _no_sel_change, grid); + elm_box_pack_end(hbx_2, ck); + evas_object_show(ck); + + hbx_3 = elm_box_add(win); + evas_object_size_hint_weight_set(hbx_3, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_horizontal_set(hbx_3, EINA_TRUE); + elm_box_pack_end(bx, hbx_3); + evas_object_show(hbx_3); + + elm_gengrid_align_get(grid, &h, &v); + evas_object_smart_callback_add(grid, "scroll,anim,stop", _grid_scroll_stopped_cb, NULL); + + sl = elm_slider_add(win); + elm_object_text_set(sl, "Horiz. alignment"); + elm_slider_span_size_set(sl, 100); + evas_object_size_hint_align_set(sl, 0.5, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(sl, 0.0, EVAS_HINT_EXPAND); + elm_slider_indicator_format_set(sl, "%1.1f"); + elm_slider_value_set(sl, h); + elm_box_pack_end(hbx_3, sl); + evas_object_show(sl); + + evas_object_smart_callback_add(sl, "changed", _h_align_change_cb, grid); + + sl = elm_slider_add(win); + elm_object_text_set(sl, "Vert. alignment"); + elm_slider_span_size_set(sl, 100); + evas_object_size_hint_align_set(sl, 0.5, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(sl, 0.0, EVAS_HINT_EXPAND); + elm_slider_indicator_format_set(sl, "%1.1f"); + elm_slider_value_set(sl, v); + elm_box_pack_end(hbx_3, sl); + evas_object_show(sl); + + evas_object_smart_callback_add(sl, "changed", _v_align_change_cb, grid); + + elm_gengrid_align_get(grid, &h, &v); + + sl = elm_slider_add(win); + elm_object_text_set(sl, "Page rel. size"); + elm_slider_span_size_set(sl, 100); + evas_object_size_hint_align_set(sl, 0.5, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(sl, 0.0, EVAS_HINT_EXPAND); + elm_slider_indicator_format_set(sl, "%1.1f"); + elm_slider_value_set(sl, h); + elm_box_pack_end(hbx_3, sl); + evas_object_show(sl); + + _page_change_cb(grid, sl, NULL); + evas_object_smart_callback_add(sl, "changed", _page_change_cb, grid); + + if (!gic) + { + gic = elm_gengrid_item_class_new(); + gic->item_style = "default"; + gic->func.text_get = _grid_label_get; + gic->func.content_get = _grid_content_get; + gic->func.state_get = _grid_state_get; + gic->func.del = _grid_del; + } // we only create the first time its needed. we dont unref/free + + _append_bt_clicked(grid, NULL, NULL); + _append_bt_clicked(grid, NULL, NULL); + _append_bt_clicked(grid, NULL, NULL); + + evas_object_resize(win, 600, 600); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/genlist_example_01.c b/libraries/elementary/src/examples/genlist_example_01.c new file mode 100644 index 0000000..a03ace1 --- /dev/null +++ b/libraries/elementary/src/examples/genlist_example_01.c @@ -0,0 +1,89 @@ +//Compile with: +//gcc -g genlist_example_01.c -o genlist_example_01 `pkg-config --cflags --libs elementary` + +#include + +#define N_ITEMS 30 + +static Elm_Genlist_Item_Class *_itc = NULL; + +static char * +_item_label_get(void *data, Evas_Object *obj, const char *part) +{ + char buf[256]; + snprintf(buf, sizeof(buf), "Item # %i", (int)(long)data); + return strdup(buf); +} + +static Evas_Object * +_item_content_get(void *data, Evas_Object *obj, const char *part) +{ + Evas_Object *ic = elm_icon_add(obj); + + if (!strcmp(part, "elm.swallow.icon")) + elm_icon_standard_set(ic, "clock"); + + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + return ic; +} + +static void +_item_sel_cb(void *data, Evas_Object *obj, void *event_info) +{ + printf("sel item data [%p] on genlist obj [%p], item pointer [%p]\n", + data, obj, event_info); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg; + Evas_Object *list; + int i; + + win = elm_win_add(NULL, "icon", ELM_WIN_BASIC); + elm_win_title_set(win, "Icon"); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + elm_bg_color_set(bg, 255,255 ,255); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + if (!_itc) + { + _itc = elm_genlist_item_class_new(); + _itc->item_style = "default"; + _itc->func.text_get = _item_label_get; + _itc->func.content_get = _item_content_get; + _itc->func.state_get = NULL; + _itc->func.del = NULL; + } + + list = elm_genlist_add(win); + + for (i = 0; i < N_ITEMS; i++) + { + elm_genlist_item_append(list, _itc, + (void *)(long)i, NULL, + ELM_GENLIST_ITEM_NONE, + _item_sel_cb, NULL); + } + + evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, list); + evas_object_show(list); + + evas_object_size_hint_min_set(bg, 160, 160); + evas_object_size_hint_max_set(bg, 640, 640); + evas_object_resize(win, 320, 320); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/genlist_example_02.c b/libraries/elementary/src/examples/genlist_example_02.c new file mode 100644 index 0000000..a773ff2 --- /dev/null +++ b/libraries/elementary/src/examples/genlist_example_02.c @@ -0,0 +1,203 @@ +//Compile with: +//gcc -g genlist_example_02.c -o genlist_example_02 `pkg-config --cflags --libs elementary` + +#include +#include + +#define N_ITEMS 300 + +static Elm_Genlist_Item_Class *_itc = NULL; + +static char * +_item_label_get(void *data, Evas_Object *obj, const char *part) +{ + time_t t = (time_t)ecore_time_unix_get(); + char buf[256]; + int i = (int)(long)data; + if (i % 2) + { + int n; + snprintf(buf, sizeof(buf), "Very Long Item # %i - realized at %s", i, ctime(&t)); + n = strlen(buf); + buf[n - 1] = '\0'; + } + else + snprintf(buf, sizeof(buf), "short item # %i", i); + return strdup(buf); +} + +static Evas_Object * +_item_content_get(void *data, Evas_Object *obj, const char *part) +{ + Evas_Object *ic = elm_icon_add(obj); + + if (!strcmp(part, "elm.swallow.icon")) + elm_icon_standard_set(ic, "clock"); + + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + return ic; +} + +static void +_item_sel_cb(void *data, Evas_Object *obj, void *event_info) +{ + printf("sel item data [%p] on genlist obj [%p], item pointer [%p]\n", + data, obj, event_info); +} + +static void +_show_status_cb(void *data, Evas_Object *o, void *event_info) +{ + Evas_Object *list = data; + Evas_Coord x, y, w, h, mx, my; + Elm_Object_Item *glit = elm_genlist_selected_item_get(list); + + const Eina_List *selected, *l, *realized; + printf("\nfirst selected item: %p\n", glit); + + selected = elm_genlist_selected_items_get(list); + printf("all selected items (%d): ", eina_list_count(selected)); + EINA_LIST_FOREACH(selected, l, glit) + printf("%p ", glit); + printf("\n"); + + realized = elm_genlist_realized_items_get(list); + printf("realized items (%d): ", eina_list_count(realized)); + EINA_LIST_FOREACH(realized, l, glit) + printf("%p ", glit); + printf("\n"); + printf("genlist mode: %d\n", elm_genlist_decorate_mode_get(list)); + printf("mode item: %p\n", elm_genlist_decorated_item_get(list)); + + evas_object_geometry_get(list, &x, &y, &w, &h); + mx = w / 2 + x; + my = h / 2 + y; + glit = elm_genlist_at_xy_item_get(list, mx, my, NULL); + printf("item in the middle of the screen: %p\n", glit); +} + +static void +_realize_cb(void *data, Evas_Object *o, void *event_info) +{ + Evas_Object *list = data; + elm_genlist_realized_items_update(list); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *box, *hbox; + Evas_Object *list, *btn; + int i; + + win = elm_win_add(NULL, "genlist", ELM_WIN_BASIC); + elm_win_title_set(win, "Genlist - simple"); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + elm_bg_color_set(bg, 255,255 ,255); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + box = elm_box_add(win); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, box); + evas_object_show(box); + + list = elm_genlist_add(win); + + if (!_itc) + { + _itc = elm_genlist_item_class_new(); + _itc->item_style = "default"; + _itc->func.text_get = _item_label_get; + _itc->func.content_get = _item_content_get; + _itc->func.state_get = NULL; + _itc->func.del = NULL; + } + + Eina_Bool hbounce, vbounce, always, no_sel; + Elm_Scroller_Policy hp, vp; + Elm_Object_Select_Mode sel_mode; + + always = no_sel = EINA_FALSE; + sel_mode = elm_genlist_select_mode_get(list); + if (sel_mode == ELM_OBJECT_SELECT_MODE_ALWAYS) + always = EINA_TRUE; + else if (sel_mode == ELM_OBJECT_SELECT_MODE_NONE) + no_sel = EINA_TRUE; + + printf("default values:\n"); + printf("always select: %d\n", always); + elm_genlist_bounce_get(list, &hbounce, &vbounce); + printf("bounce - horizontal: %d, vertical: %d\n", hbounce, vbounce); + printf("homogeneous: %d\n", elm_genlist_homogeneous_get(list)); + printf("horizontal mode: %d\n", elm_genlist_mode_get(list)); + printf("longpress timeout: %0.3f\n", + elm_genlist_longpress_timeout_get(list)); + printf("multi selection: %d\n", elm_genlist_multi_select_get(list)); + printf("no selection mode: %d\n", no_sel); + elm_genlist_scroller_policy_get(list, &hp, &vp); + printf("scroller policy - horizontal: %d, vertical: %d\n", hp, vp); + printf("block count: %d\n", elm_genlist_block_count_get(list)); + printf("\n"); + + elm_genlist_bounce_set(list, EINA_FALSE, EINA_FALSE); + elm_genlist_homogeneous_set(list, EINA_FALSE); + elm_genlist_mode_set(list, ELM_LIST_LIMIT); + elm_genlist_multi_select_set(list, EINA_TRUE); + elm_genlist_select_mode_set(list, ELM_OBJECT_SELECT_MODE_DEFAULT); + elm_genlist_scroller_policy_set(list, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_ON); + elm_genlist_longpress_timeout_set(list, 0.5); + elm_genlist_block_count_set(list, 16); + + for (i = 0; i < N_ITEMS; i++) + { + elm_genlist_item_append(list, _itc, + (void *)(long)i, NULL, + ELM_GENLIST_ITEM_NONE, + _item_sel_cb, NULL); + } + + evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, list); + evas_object_show(list); + + hbox = elm_box_add(win); + elm_box_horizontal_set(hbox, EINA_TRUE); + evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, hbox); + evas_object_show(hbox); + + btn = elm_button_add(win); + elm_object_text_set(btn, "Show status"); + evas_object_size_hint_weight_set(btn, 0, 0); + evas_object_size_hint_align_set(btn, 0.5, 0.5); + evas_object_smart_callback_add(btn, "clicked", _show_status_cb, list); + elm_box_pack_end(hbox, btn); + evas_object_show(btn); + + btn = elm_button_add(win); + elm_object_text_set(btn, "Realize"); + evas_object_size_hint_weight_set(btn, 0, 0); + evas_object_size_hint_align_set(btn, 0.5, 0.5); + evas_object_smart_callback_add(btn, "clicked", _realize_cb, list); + elm_box_pack_end(hbox, btn); + evas_object_show(btn); + + evas_object_size_hint_min_set(bg, 160, 160); + evas_object_size_hint_max_set(bg, 200, 640); + evas_object_resize(win, 200, 320); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/genlist_example_03.c b/libraries/elementary/src/examples/genlist_example_03.c new file mode 100644 index 0000000..6264266 --- /dev/null +++ b/libraries/elementary/src/examples/genlist_example_03.c @@ -0,0 +1,131 @@ +//Compile with: +//gcc -g genlist_example_03.c -o genlist_example_03 `pkg-config --cflags --libs elementary` + +#include + +#define N_ITEMS 30 + +static Elm_Genlist_Item_Class *_itc = NULL; + +static char * +_item_label_get(void *data, Evas_Object *obj, const char *part) +{ + time_t t = (time_t)ecore_time_unix_get(); + char buf[256]; + int i = (int)(long)data; + + if (!strcmp(part, "elm.text")) + snprintf(buf, sizeof(buf), "Item # %i", i); + else + { + int n; + snprintf(buf, sizeof(buf), "created at %s", ctime(&t)); + n = strlen(buf); + buf[n - 1] = '\0'; + } + + return strdup(buf); +} + +static Evas_Object * +_item_content_get(void *data, Evas_Object *obj, const char *part) +{ + Evas_Object *ic = elm_icon_add(obj); + + if (!strcmp(part, "elm.swallow.icon")) + elm_icon_standard_set(ic, "clock"); + + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + return ic; +} + +static void +_item_sel_cb(void *data, Evas_Object *obj, void *event_info) +{ + printf("sel item data [%p] on genlist obj [%p], item pointer [%p]\n", + data, obj, event_info); +} + +static Evas_Object * +_genlist_add(Evas_Object *box) +{ + Evas_Object *list = elm_genlist_add(elm_object_parent_widget_get(box)); + evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_min_set(list, 200, 160); + elm_box_pack_end(box, list); + evas_object_show(list); + + return list; +} + +static void +_genlist_fill(Evas_Object *list) +{ + int i; + + for (i = 0; i < N_ITEMS; i++) + { + elm_genlist_item_append(list, _itc, + (void *)(long)i, NULL, + ELM_GENLIST_ITEM_NONE, + _item_sel_cb, NULL); + } +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *box; + Evas_Object *list; + + win = elm_win_add(NULL, "icon", ELM_WIN_BASIC); + elm_win_title_set(win, "Icon"); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + elm_bg_color_set(bg, 255,255 ,255); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + box = elm_box_add(win); + elm_box_horizontal_set(box, EINA_TRUE); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, box); + evas_object_show(box); + + if (!_itc) + { + _itc = elm_genlist_item_class_new(); + _itc->item_style = "double_label"; + _itc->func.text_get = _item_label_get; + _itc->func.content_get = _item_content_get; + _itc->func.state_get = NULL; + _itc->func.del = NULL; + } + + list = _genlist_add(box); + _genlist_fill(list); + + list = _genlist_add(box); + elm_genlist_mode_set(list, ELM_LIST_LIMIT); + _genlist_fill(list); + + list = _genlist_add(box); + elm_genlist_mode_set(list, ELM_LIST_COMPRESS); + _genlist_fill(list); + + evas_object_size_hint_min_set(bg, 800, 160); + evas_object_size_hint_max_set(bg, 800, 640); + evas_object_resize(win, 800, 320); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/genlist_example_04.c b/libraries/elementary/src/examples/genlist_example_04.c new file mode 100644 index 0000000..3e2d62c --- /dev/null +++ b/libraries/elementary/src/examples/genlist_example_04.c @@ -0,0 +1,364 @@ +//Compile with: +//gcc -g genlist_example_04.c -o genlist_example_04 `pkg-config --cflags --libs elementary` + +#include + +#define N_ITEMS 300 + +static Elm_Genlist_Item_Class *_itc = NULL; +static Elm_Genlist_Item_Class *_itc_group = NULL; +static int nitems = 0; + +static char * +_item_label_get(void *data, Evas_Object *obj, const char *part) +{ + time_t t = (time_t)ecore_time_unix_get(); + char buf[256]; + int i = (int)(long)data; + + if (!strcmp(part, "elm.text")) + snprintf(buf, sizeof(buf), "Item # %i", i); + else + { + int n; + snprintf(buf, sizeof(buf), "realized at %s", ctime(&t)); + n = strlen(buf); + buf[n - 1] = '\0'; + } + + return strdup(buf); +} + +static Evas_Object * +_item_content_get(void *data, Evas_Object *obj, const char *part) +{ + Evas_Object *ic = elm_icon_add(obj); + + if (!strcmp(part, "elm.swallow.icon")) + elm_icon_standard_set(ic, "clock"); + + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + return ic; +} + +static void +_item_sel_cb(void *data, Evas_Object *obj, void *event_info) +{ + printf("sel item data [%p] on genlist obj [%p], item pointer [%p]\n", + data, obj, event_info); +} + +static char * +_group_label_get(void *data, Evas_Object *obj, const char *part) +{ + char buf[256]; + int i = (int)(long)data; + + snprintf(buf, sizeof(buf), "Group %d (item #%d)", i / 7, i); + + return strdup(buf); +} + +static Evas_Object * +_group_content_get(void *data, Evas_Object *obj, const char *part) +{ + Evas_Object *ic = elm_icon_add(obj); + + if (!strcmp(part, "elm.swallow.icon")) + elm_icon_standard_set(ic, "home"); + + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + return ic; +} + +static void +_append_cb(void *data, Evas_Object *o, void *event_info) +{ + Evas_Object *list = data; + + elm_genlist_item_append(list, _itc, + (void *)(long)nitems++, NULL, + ELM_GENLIST_ITEM_NONE, + _item_sel_cb, NULL); + +} + +static void +_prepend_cb(void *data, Evas_Object *o, void *event_info) +{ + Evas_Object *list = data; + + elm_genlist_item_prepend(list, _itc, + (void *)(long)nitems++, NULL, + ELM_GENLIST_ITEM_NONE, + _item_sel_cb, NULL); + +} + +static void +_insert_before_cb(void *data, Evas_Object *o, void *event_info) +{ + Evas_Object *list = data; + Elm_Object_Item *glit = elm_genlist_selected_item_get(list); + + if (!glit) return; + + elm_genlist_item_insert_before(list, _itc, + (void *)(long)nitems++, NULL, + glit, ELM_GENLIST_ITEM_NONE, + _item_sel_cb, NULL); + +} + +static void +_insert_after_cb(void *data, Evas_Object *o, void *event_info) +{ + Evas_Object *list = data; + Elm_Object_Item *glit = elm_genlist_selected_item_get(list); + + if (!glit) return; + + elm_genlist_item_insert_after(list, _itc, + (void *)(long)nitems++, NULL, + glit, ELM_GENLIST_ITEM_NONE, + _item_sel_cb, NULL); + +} + +static void +_next_cb(void *data, Evas_Object *o, void *event_info) +{ + Evas_Object *list = data; + Elm_Object_Item *glit = elm_genlist_selected_item_get(list); + + if (glit) glit = elm_genlist_item_next_get(glit); + if (!glit) glit = elm_genlist_first_item_get(list); + + elm_genlist_item_selected_set(glit, EINA_TRUE); + elm_genlist_item_show(glit, ELM_GENLIST_ITEM_SCROLLTO_IN); +} + +static void +_prev_cb(void *data, Evas_Object *o, void *event_info) +{ + Evas_Object *list = data; + Elm_Object_Item *glit = elm_genlist_selected_item_get(list); + + if (glit) glit = elm_genlist_item_prev_get(glit); + if (!glit) glit = elm_genlist_last_item_get(list); + + elm_genlist_item_selected_set(glit, EINA_TRUE); + elm_genlist_item_show(glit, ELM_GENLIST_ITEM_SCROLLTO_IN); +} + +static void +_bring_in_cb(void *data, Evas_Object *o, void *event_info) +{ + Elm_Object_Item *glit = data; + if (!glit) return; + + elm_genlist_item_bring_in(glit, ELM_GENLIST_ITEM_SCROLLTO_IN); +} + +static void +_show_cb(void *data, Evas_Object *o, void *event_info) +{ + Elm_Object_Item *glit = data; + if (!glit) return; + + elm_genlist_item_show(glit, ELM_GENLIST_ITEM_SCROLLTO_IN); +} + +static void +_middle_in_cb(void *data, Evas_Object *o, void *event_info) +{ + Elm_Object_Item *glit = data; + if (!glit) return; + + elm_genlist_item_bring_in(glit, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE); +} + +static void +_middle_show_cb(void *data, Evas_Object *o, void *event_info) +{ + Elm_Object_Item *glit = data; + if (!glit) return; + + elm_genlist_item_show(glit, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE); +} + +static void +_top_in_cb(void *data, Evas_Object *o, void *event_info) +{ + Elm_Object_Item *glit = data; + if (!glit) return; + + elm_genlist_item_bring_in(glit, ELM_GENLIST_ITEM_SCROLLTO_TOP); +} + +static void +_top_show_cb(void *data, Evas_Object *o, void *event_info) +{ + Elm_Object_Item *glit = data; + if (!glit) return; + + elm_genlist_item_show(glit, ELM_GENLIST_ITEM_SCROLLTO_TOP); +} + +static void +_realize_cb(void *data, Evas_Object *o, void *event_info) +{ + Evas_Object *list = data; + Elm_Object_Item *glit = elm_genlist_selected_item_get(list); + if (!glit) return; + + elm_genlist_item_update(glit); +} + +static Evas_Object * +_button_add(Evas_Object *list, Evas_Object *box, const char *label, Evas_Smart_Cb cb) +{ + Evas_Object *bt; + + bt = elm_button_add(elm_object_parent_widget_get(list)); + elm_object_text_set(bt, label); + elm_box_pack_end(box, bt); + evas_object_show(bt); + + if (cb) + evas_object_smart_callback_add(bt, "clicked", cb, list); + + return bt; +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *box, *fbox; + Evas_Object *list; + Evas_Object *bt_bring_in, *bt_show; + Evas_Object *bt_middle_in, *bt_middle_show; + Evas_Object *bt_top_in, *bt_top_show; + int i; + + win = elm_win_add(NULL, "icon", ELM_WIN_BASIC); + elm_win_title_set(win, "Icon"); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + elm_bg_color_set(bg, 255,255 ,255); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + box = elm_box_add(win); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, box); + evas_object_show(box); + + if (!_itc) + { + _itc = elm_genlist_item_class_new(); + _itc->item_style = "default"; + _itc->func.text_get = _item_label_get; + _itc->func.content_get = _item_content_get; + _itc->func.state_get = NULL; + _itc->func.del = NULL; + } + + if (!_itc_group) + { + _itc_group = elm_genlist_item_class_new(); + _itc_group->item_style = "group_index"; + _itc_group->func.text_get = _group_label_get; + _itc_group->func.content_get = _group_content_get; + _itc_group->func.state_get = NULL; + _itc_group->func.del = NULL; + } + list = elm_genlist_add(win); + + evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, list); + evas_object_show(list); + + fbox = elm_box_add(win); + elm_box_layout_set(fbox, evas_object_box_layout_flow_horizontal, + NULL, NULL); + evas_object_size_hint_weight_set(fbox, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(fbox, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, fbox); + evas_object_show(fbox); + + _button_add(list, fbox, "prepend", _prepend_cb); + _button_add(list, fbox, "append", _append_cb); + _button_add(list, fbox, "insert before", _insert_before_cb); + _button_add(list, fbox, "insert after", _insert_after_cb); + _button_add(list, fbox, "prev", _prev_cb); + _button_add(list, fbox, "next", _next_cb); + _button_add(list, fbox, "realize", _realize_cb); + bt_bring_in = _button_add(list, fbox, "bring #50", NULL); + bt_show = _button_add(list, fbox, "show #50", NULL); + bt_middle_in = _button_add(list, fbox, "bring to middle #200", NULL); + bt_middle_show = _button_add(list, fbox, "show in middle #200", NULL); + bt_top_in = _button_add(list, fbox, "bring to top #250", NULL); + bt_top_show = _button_add(list, fbox, "show in top #250", NULL); + + for (i = 0; i < N_ITEMS; i++) + { + Elm_Object_Item *gli, *glg; + + if (i % 7 == 0) + { + glg = gli = elm_genlist_item_append(list, _itc_group, + (void *)(long)nitems++, NULL, + ELM_GENLIST_ITEM_GROUP, + _item_sel_cb, NULL); + elm_genlist_item_select_mode_set(gli, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + } + else + { + gli = elm_genlist_item_append(list, _itc, + (void *)(long)nitems++, glg, + ELM_GENLIST_ITEM_NONE, + _item_sel_cb, NULL); + } + + switch (i) + { + case 3: + elm_object_item_disabled_set(gli, EINA_TRUE); + break; + case 50: + evas_object_smart_callback_add( + bt_bring_in, "clicked", _bring_in_cb, gli); + evas_object_smart_callback_add( + bt_show, "clicked", _show_cb, gli); + break; + case 200: + evas_object_smart_callback_add( + bt_middle_in, "clicked", _middle_in_cb, gli); + evas_object_smart_callback_add( + bt_middle_show, "clicked", _middle_show_cb, gli); + break; + case 250: + evas_object_smart_callback_add( + bt_top_in, "clicked", _top_in_cb, gli); + evas_object_smart_callback_add( + bt_top_show, "clicked", _top_show_cb, gli); + } + } + + evas_object_size_hint_min_set(bg, 160, 160); + evas_object_size_hint_max_set(bg, 640, 640); + evas_object_resize(win, 420, 320); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/genlist_example_05.c b/libraries/elementary/src/examples/genlist_example_05.c new file mode 100644 index 0000000..9cfd3b5 --- /dev/null +++ b/libraries/elementary/src/examples/genlist_example_05.c @@ -0,0 +1,425 @@ +//Compile with: +//gcc -g genlist_example_05.c -o genlist_example_05 `pkg-config --cflags --libs elementary` + +#include + +#define N_ITEMS 6 + +typedef struct _Node_Data { + Eina_List *children; + int value; + int level; + Eina_Bool favorite; +} Node_Data; + +static Elm_Genlist_Item_Class *_itc = NULL; +static Elm_Genlist_Item_Class *_itp = NULL; +static Elm_Genlist_Item_Class *_itfav = NULL; +static int nitems = 0; + +static char * +_item_label_get(void *data, Evas_Object *obj, const char *part) +{ + char buf[256]; + Node_Data *d = data; + + if (!strcmp(part, "elm.text")) + snprintf(buf, sizeof(buf), "Item # %i (level %i)", d->value, d->level); + + return strdup(buf); +} + +static Evas_Object * +_item_content_get(void *data, Evas_Object *obj, const char *part) +{ + Evas_Object *ic = elm_icon_add(obj); + + if (!strcmp(part, "elm.swallow.icon")) + elm_icon_standard_set(ic, "file"); + + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + return ic; +} + +static void +_item_sel_cb(void *data, Evas_Object *obj, void *event_info) +{ + printf("sel item data [%p] on genlist obj [%p], item pointer [%p]\n", + data, obj, event_info); +} + +static char * +_parent_label_get(void *data, Evas_Object *obj, const char *part) +{ + char buf[256]; + Node_Data *d = data; + + snprintf(buf, sizeof(buf), "Group %d (%d items)", d->value / 7, + eina_list_count(d->children)); + + return strdup(buf); +} + +static Evas_Object * +_parent_content_get(void *data, Evas_Object *obj, const char *part) +{ + Evas_Object *ic = elm_icon_add(obj); + + if (!strcmp(part, "elm.swallow.icon")) + elm_icon_standard_set(ic, "folder"); + + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + return ic; +} + +static char * +_favorite_label_get(void *data, Evas_Object *obj, const char *part) +{ + char buf[256]; + Node_Data *d = data; + + if (!strcmp(part, "elm.text")) + snprintf(buf, sizeof(buf), "Favorite # %i", d->value); + + return strdup(buf); +} + +static Evas_Object * +_favorite_content_get(void *data, Evas_Object *obj, const char *part) +{ + Evas_Object *ic = elm_icon_add(obj); + + if (!strcmp(part, "elm.swallow.icon")) + elm_icon_standard_set(ic, "apps"); + + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + return ic; +} + +static void +_append_cb(void *data, Evas_Object *o, void *event_info) +{ + Evas_Object *list = data; + Elm_Object_Item *glit, *parent = NULL; + Node_Data *pdata, *d = malloc(sizeof(*d)); + + d->children = NULL; + d->value = nitems++; + d->favorite = EINA_FALSE; + + glit = elm_genlist_selected_item_get(list); + if (glit) + parent = elm_genlist_item_parent_get(glit); + + if (parent) + { + d->level = elm_genlist_item_expanded_depth_get(parent) + 1; + pdata = elm_object_item_data_get(parent); + pdata->children = eina_list_append(pdata->children, d); + } + else + d->level = 0; + + elm_genlist_item_append(list, _itc, + d, parent, + ELM_GENLIST_ITEM_NONE, + _item_sel_cb, NULL); +} + +static void +_favorite_cb(void *data, Evas_Object *o, void *event_info) +{ + Evas_Object *list = data; + Elm_Object_Item *glit = elm_genlist_selected_item_get(list); + + if (!glit) return; + + Node_Data *d = elm_object_item_data_get(glit); + d->favorite = !d->favorite; + if (d->favorite) + elm_genlist_item_item_class_update(glit, _itfav); + else + { + if (d->children) + elm_genlist_item_item_class_update(glit, _itp); + else + elm_genlist_item_item_class_update(glit, _itc); + } + + elm_genlist_item_update(glit); +} + +static void +_add_child_cb(void *data, Evas_Object *o, void *event_info) +{ + Evas_Object *list = data; + Elm_Object_Item *glit = elm_genlist_selected_item_get(list); + Elm_Object_Item *glit_prev, *glit_parent; + + if (!glit) return; + + Node_Data *d = elm_object_item_data_get(glit); + glit_prev = elm_genlist_item_prev_get(glit); + glit_parent = elm_genlist_item_parent_get(glit); + + Eina_Bool change_item = !d->children; + + // creating new item data + Node_Data *ndata = malloc(sizeof(*ndata)); + ndata->value = nitems++; + ndata->children = NULL; + ndata->favorite = EINA_FALSE; + ndata->level = elm_genlist_item_expanded_depth_get(glit) + 1; + d->children = eina_list_append(d->children, ndata); + + // Changing leaf item to parent item + if (change_item) + { + elm_object_item_del(glit); + + if (glit_prev != glit_parent) + glit = elm_genlist_item_insert_after(list, _itp, d, glit_parent, + glit_prev, + ELM_GENLIST_ITEM_TREE, + _item_sel_cb, NULL); + else + glit = elm_genlist_item_prepend(list, _itp, d, glit_parent, + ELM_GENLIST_ITEM_TREE, + _item_sel_cb, NULL); + elm_genlist_item_expanded_set(glit, EINA_FALSE); + elm_genlist_item_selected_set(glit, EINA_TRUE); + } + else if (elm_genlist_item_expanded_get(glit)) + { + elm_genlist_item_append(list, _itc, ndata, glit, + ELM_GENLIST_ITEM_NONE, _item_sel_cb, NULL); + } + + elm_genlist_item_update(glit); + +} + +static void +_clear_list(Node_Data *d) +{ + Node_Data *tmp; + + EINA_LIST_FREE(d->children, tmp) + _clear_list(tmp); + free(d); +} + +static void +_del_item_cb(void *data, Evas_Object *o, void *event_info) +{ + Evas_Object *list = data; + Elm_Object_Item *glit = elm_genlist_selected_item_get(list); + Elm_Object_Item *glit_parent = NULL; + + if (!glit) return; + + Node_Data *pdata, *d = elm_object_item_data_get(glit); + glit_parent = elm_genlist_item_parent_get(glit); + elm_genlist_item_subitems_clear(glit); + elm_object_item_del(glit); + + _clear_list(d); + + if (!glit_parent) return; + + pdata = elm_object_item_data_get(glit_parent); + pdata->children = eina_list_remove(pdata->children, d); + elm_genlist_item_update(glit_parent); +} + +static void +_expand_request_cb(void *data, Evas_Object *o, void *event_info) +{ + Elm_Object_Item *glit = event_info; + printf("expand request on item: %p\n", event_info); + elm_genlist_item_expanded_set(glit, EINA_TRUE); +} + +static void +_contract_request_cb(void *data, Evas_Object *o, void *event_info) +{ + Elm_Object_Item *glit = event_info; + printf("contract request on item: %p\n", event_info); + elm_genlist_item_expanded_set(glit, EINA_FALSE); +} + +static void +_expanded_cb(void *data, Evas_Object *o, void *event_info) +{ + Eina_List *l; + Elm_Object_Item *glit = event_info; + Node_Data *it_data, *d = elm_object_item_data_get(glit); + Evas_Object *list = elm_object_item_widget_get(glit); + + Elm_Genlist_Item_Class *ic; + + EINA_LIST_FOREACH(d->children, l, it_data) + { + Elm_Object_Item *nitem; + Elm_Genlist_Item_Type type = ELM_GENLIST_ITEM_NONE; + printf("expanding item: #%d from parent #%d\n", it_data->value, d->value); + if (it_data->favorite) + ic = _itfav; + else if (it_data->children) + { + ic = _itp; + type = ELM_GENLIST_ITEM_TREE; + } + else + ic = _itc; + + nitem = elm_genlist_item_append(list, ic, it_data, glit, + type, _item_sel_cb, NULL); + elm_genlist_item_expanded_set(nitem, EINA_FALSE); + } +} + +static void +_contracted_cb(void *data, Evas_Object *o, void *event_info) +{ + Elm_Object_Item *glit = event_info; + elm_genlist_item_subitems_clear(glit); +} + +static Evas_Object * +_button_add(Evas_Object *list, Evas_Object *box, const char *label, Evas_Smart_Cb cb) +{ + Evas_Object *bt; + + bt = elm_button_add(elm_object_parent_widget_get(list)); + elm_object_text_set(bt, label); + elm_box_pack_end(box, bt); + evas_object_show(bt); + + if (cb) + evas_object_smart_callback_add(bt, "clicked", cb, list); + + return bt; +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *box, *fbox; + Evas_Object *list; + int i; + + win = elm_win_add(NULL, "icon", ELM_WIN_BASIC); + elm_win_title_set(win, "Icon"); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + elm_bg_color_set(bg, 255,255 ,255); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + box = elm_box_add(win); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, box); + evas_object_show(box); + + if (!_itc) + { + _itc = elm_genlist_item_class_new(); + _itc->item_style = "default"; + _itc->func.text_get = _item_label_get; + _itc->func.content_get = _item_content_get; + _itc->func.state_get = NULL; + _itc->func.del = NULL; + } + + if (!_itp) + { + _itp = elm_genlist_item_class_new(); + _itp->item_style = "default"; + _itp->func.text_get = _parent_label_get; + _itp->func.content_get = _parent_content_get; + _itp->func.state_get = NULL; + _itp->func.del = NULL; + } + + if (!_itfav) + { + _itfav = elm_genlist_item_class_new(); + _itfav->item_style = "default"; + _itfav->func.text_get = _favorite_label_get; + _itfav->func.content_get = _favorite_content_get; + _itfav->func.state_get = NULL; + _itfav->func.del = NULL; + } + + list = elm_genlist_add(win); + + evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, list); + evas_object_show(list); + + fbox = elm_box_add(win); + elm_box_layout_set(fbox, evas_object_box_layout_flow_horizontal, + NULL, NULL); + evas_object_size_hint_weight_set(fbox, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(fbox, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, fbox); + evas_object_show(fbox); + + _button_add(list, fbox, "append item", _append_cb); + _button_add(list, fbox, "favorite", _favorite_cb); + _button_add(list, fbox, "add child", _add_child_cb); + _button_add(list, fbox, "del item", _del_item_cb); + + for (i = 0; i < N_ITEMS; i++) + { + Elm_Object_Item *gli, *glg; + Node_Data *data = malloc(sizeof(*data)); // data for this item + data->children = NULL; + data->value = i; + data->favorite = EINA_FALSE; + nitems++; + + Node_Data *pdata; // data for the parent of the group + + printf("creating item: #%d\n", data->value); + if (i % 3 == 0) + { + glg = gli = elm_genlist_item_append(list, _itp, data, NULL, + ELM_GENLIST_ITEM_TREE, + _item_sel_cb, NULL); + elm_genlist_item_expanded_set(glg, EINA_TRUE); + pdata = data; + data->level = 0; + } + else + { + gli = elm_genlist_item_append(list, _itc, data, glg, + ELM_GENLIST_ITEM_NONE, + _item_sel_cb, NULL); + pdata->children = eina_list_append(pdata->children, data); + data->level = 1; + } + } + + evas_object_smart_callback_add(list, "expand,request", _expand_request_cb, list); + evas_object_smart_callback_add(list, "contract,request", _contract_request_cb, list); + evas_object_smart_callback_add(list, "expanded", _expanded_cb, list); + evas_object_smart_callback_add(list, "contracted", _contracted_cb, list); + + evas_object_size_hint_min_set(bg, 160, 160); + evas_object_size_hint_max_set(bg, 640, 800); + evas_object_resize(win, 420, 600); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/hover_example_01.c b/libraries/elementary/src/examples/hover_example_01.c new file mode 100644 index 0000000..e426200 --- /dev/null +++ b/libraries/elementary/src/examples/hover_example_01.c @@ -0,0 +1,80 @@ +//Compile with: +//gcc -o hover_example_01 hover_example_01.c -g `pkg-config --cflags --libs elementary` + +#include + +static void +_show_hover(void *data, Evas_Object *obj, void *event_info) +{ + evas_object_show(data); +} + +static void +_hide_hover(void *data, Evas_Object *obj, void *event_info) +{ + evas_object_hide(data); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *bt, *bt2, *rect, *rect2, *rect3, *hover; + + win = elm_win_add(NULL, "hover", ELM_WIN_BASIC); + elm_win_title_set(win, "Hover"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + rect = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_size_hint_min_set(rect, 25, 25); + evas_object_color_set(rect, 255, 0, 0, 255); + evas_object_show(rect); + + rect2 = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_size_hint_min_set(rect2, 25, 25); + evas_object_color_set(rect2, 0, 255, 0, 255); + evas_object_show(rect2); + + rect3 = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_size_hint_min_set(rect3, 25, 25); + evas_object_color_set(rect3, 0, 0, 255, 255); + evas_object_show(rect3); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Show hover"); + evas_object_move(bt, 60, 90); + evas_object_resize(bt, 80, 20); + evas_object_show(bt); + + bt2 = elm_button_add(win); + elm_object_text_set(bt2, "Hide hover"); + evas_object_show(bt2); + + hover = elm_hover_add(win); + elm_hover_parent_set(hover, win); + elm_hover_target_set(hover, bt); + + elm_object_style_set(hover, "popout"); + + elm_object_part_content_set(hover, "left", rect); + elm_object_part_content_set(hover, "top", rect2); + elm_object_part_content_set(hover, "right", rect3); + elm_object_part_content_set(hover, "middle", bt2); + + evas_object_smart_callback_add(bt, "clicked", _show_hover, hover); + evas_object_smart_callback_add(bt2, "clicked", _hide_hover, hover); + + evas_object_resize(win, 200, 200); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/hoversel_example_01.c b/libraries/elementary/src/examples/hoversel_example_01.c new file mode 100644 index 0000000..412bf43 --- /dev/null +++ b/libraries/elementary/src/examples/hoversel_example_01.c @@ -0,0 +1,103 @@ +//Compile with: +//gcc -o hoversel_example_01 hoversel_example_01.c -g `pkg-config --cflags --libs elementary` + +#include + +static void _print_items(void *data, Evas_Object *obj, void *event_info); +static void _rm_items(void *data, Evas_Object *obj, void *event_info); +static void _sel(void *data, Evas_Object *obj, void *event_info); +static void _free(void *data, Evas_Object *obj, void *event_info); +static void _add_item(void *data, Evas_Object *obj, void *event_info); + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *rect, *hoversel; + Elm_Object_Item *hoversel_it; + + win = elm_win_add(NULL, "hoversel", ELM_WIN_BASIC); + elm_win_title_set(win, "Hoversel"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + evas_object_resize(win, 200, 300); + evas_object_show(win); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + rect = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(rect, 255, 0, 0, 255); + evas_object_show(rect); + + hoversel = elm_hoversel_add(win); + elm_hoversel_hover_parent_set(hoversel, win); + elm_hoversel_horizontal_set(hoversel, EINA_FALSE); + elm_object_text_set(hoversel, "Hoversel"); + elm_object_part_content_set(hoversel, "icon", rect); + elm_hoversel_item_add(hoversel, "Print items", NULL, ELM_ICON_NONE, + _print_items, NULL); + elm_hoversel_item_add(hoversel, "Option 2", "home", ELM_ICON_STANDARD, NULL, + NULL); + hoversel_it = elm_hoversel_item_add(hoversel, "Clear all items", "close", + ELM_ICON_STANDARD, _rm_items, NULL); + evas_object_smart_callback_add(hoversel, "selected", _sel, hoversel_it); + evas_object_smart_callback_add(hoversel, "clicked", _add_item, NULL); + + evas_object_resize(hoversel, 180, 30); + evas_object_move(hoversel, 10, 10); + evas_object_show(hoversel); + + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() + +static void +_print_items(void *data, Evas_Object *obj, void *event_info) +{ + const Eina_List *items = elm_hoversel_items_get(obj); + const Eina_List *l; + Elm_Object_Item *hoversel_it; + + EINA_LIST_FOREACH(items, l, hoversel_it) + printf("%s\n", elm_object_item_text_get(hoversel_it)); +} + +static void +_rm_items(void *data, Evas_Object *obj, void *event_info) +{ + if (!elm_hoversel_expanded_get(obj)) + elm_hoversel_clear(obj); +} + +static void +_sel(void *data, Evas_Object *obj, void *event_info) +{ + if (!elm_hoversel_expanded_get(obj) && event_info != data) + elm_object_item_del(event_info); +} + +static void +_add_item(void *data, Evas_Object *obj, void *event_info) +{ + static int num = 0; + char *str = malloc(sizeof(char) * 10); + Elm_Object_Item *hoversel_it; + + snprintf(str, 10, "item %d", ++num); + + hoversel_it = elm_hoversel_item_add(obj, str, NULL, ELM_ICON_NONE, NULL, + str); + elm_object_item_del_cb_set(hoversel_it, _free); +} + +static void +_free(void *data, Evas_Object *obj, void *event_info) +{ + free(data); +} diff --git a/libraries/elementary/src/examples/icon_example_01.c b/libraries/elementary/src/examples/icon_example_01.c new file mode 100644 index 0000000..daad19f --- /dev/null +++ b/libraries/elementary/src/examples/icon_example_01.c @@ -0,0 +1,53 @@ +//Compile with: +//gcc -g image_example_01.c -o image_example_01 `pkg-config --cflags --libs elementary` + +#include + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *icon; + const char *path, *group, *name; + + win = elm_win_add(NULL, "icon", ELM_WIN_BASIC); + elm_win_title_set(win, "Icon"); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + elm_bg_color_set(bg, 255,255 ,255); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + icon = elm_icon_add(win); + elm_icon_order_lookup_set(icon, ELM_ICON_LOOKUP_THEME_FDO); + elm_icon_standard_set(icon, "home"); + + path = NULL; + group = NULL; + name = NULL; + elm_icon_file_get(icon, &path, &group); + name = elm_icon_standard_get(icon); + printf("path = %s, group = %s, name = %s\n", path, group, name); + + elm_icon_no_scale_set(icon, EINA_TRUE); + elm_icon_resizable_set(icon, EINA_FALSE, EINA_TRUE); + elm_icon_smooth_set(icon, EINA_FALSE); + elm_icon_fill_outside_set(icon, EINA_TRUE); + + evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, icon); + evas_object_show(icon); + + evas_object_size_hint_min_set(bg, 160, 160); + evas_object_size_hint_max_set(bg, 640, 640); + evas_object_resize(win, 320, 320); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/image_example_01.c b/libraries/elementary/src/examples/image_example_01.c new file mode 100644 index 0000000..c61f76c --- /dev/null +++ b/libraries/elementary/src/examples/image_example_01.c @@ -0,0 +1,55 @@ +//Compile with: +//gcc -g image_example_01.c -o image_example_01 `pkg-config --cflags --libs elementary` + +#include + +int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *image; + char buf[PATH_MAX]; + + elm_app_info_set(elm_main, "elementary", "images/plant_01.jpg"); + win = elm_win_add(NULL, "image", ELM_WIN_BASIC); + elm_win_title_set(win, "Image"); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + elm_bg_color_set(bg, 255,255 ,255); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); + + image = elm_image_add(win); + if (!elm_image_file_set(image, buf, NULL)) + { + printf("error: could not load image \"%s\"\n", buf); + return -1; + } + + elm_image_no_scale_set(image, EINA_TRUE); + elm_image_resizable_set(image, EINA_FALSE, EINA_TRUE); + elm_image_smooth_set(image, EINA_FALSE); + elm_image_orient_set(image, ELM_IMAGE_FLIP_HORIZONTAL); + elm_image_aspect_fixed_set(image, EINA_TRUE); + elm_image_fill_outside_set(image, EINA_TRUE); + elm_image_editable_set(image, EINA_TRUE); + + evas_object_size_hint_weight_set(image, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, image); + evas_object_show(image); + + evas_object_size_hint_min_set(bg, 160, 160); + evas_object_size_hint_max_set(bg, 640, 640); + evas_object_resize(win, 320, 320); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/index_example_01.c b/libraries/elementary/src/examples/index_example_01.c new file mode 100644 index 0000000..682a5e7 --- /dev/null +++ b/libraries/elementary/src/examples/index_example_01.c @@ -0,0 +1,209 @@ +/** + * Simple Elementary's index widget example, illustrating its + * usage and API. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g index_example.c -o index_example `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +struct example_data +{ + Evas_Object *list, *index; +}; + +struct example_data d = {NULL, NULL}; + +static const char *dict[] = \ +{ +#include "dict.txt" +}; + +static void +_index_item_del(void *data, + Evas_Object *obj, + void *event_info) +{ + fprintf(stdout, "Deleting associated list node (%s). Comparing index " + "item data reported via callback with the one returned by " + "index's API on items: %s.\n", + elm_object_item_text_get(data), + data == elm_object_item_data_get(event_info) ? "OK" : + "FAIL, something went wrong"); + + elm_object_item_del(data); +} + +/* delete an index item */ +static void +_item_del(void *data, + Evas_Object *obj, + void *event_info) +{ + Elm_Object_Item *iit; + Elm_Object_Item *lit = elm_index_selected_item_get(d.index, 0); + + iit = elm_index_item_find(d.index, lit); + + if (!iit) return; + + fprintf(stdout, "Deleting last selected index item, which had letter" + " %s (pointing to %s)\n", elm_index_item_letter_get(iit), + elm_object_item_text_get(lit)); + + elm_object_item_del(lit); +} + +static void +_item_del_all(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_index_item_clear(d.index); +} + +static void +_active_set(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_index_autohide_disabled_set(d.index, !elm_index_autohide_disabled_get(d.index)); + + fprintf(stdout, "Toggling index programmatically.\n"); +} + +/* "delay,changed" hook */ +static void +_index_changed(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_list_item_bring_in(event_info); +} + +static void +_index_selected(void *data, + Evas_Object *obj, + void *event_info) +{ + Elm_Object_Item *lit = event_info; + + fprintf(stdout, "New index item selected. Comparing item reported" + " via callback with the selection returned by the API: " + "%s.\n", lit == elm_index_selected_item_get(obj, 0) ? "OK" : + "FAIL, something went wrong"); +} + +static void +_on_done(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_exit(); +} + +EAPI_MAIN int +elm_main(int argc, + char **argv) +{ + Evas_Object *win, *bg, *hbox, *vbox, *bt, *sep; + Elm_Object_Item *lit; + unsigned int i; + char curr = 0; + + win = elm_win_add(NULL, "index", ELM_WIN_BASIC); + elm_win_title_set(win, "Index Example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + vbox = elm_box_add(win); + elm_win_resize_object_add(win, vbox); + evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(vbox); + + d.list = elm_list_add(win); + evas_object_size_hint_weight_set(d.list, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(d.list, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(d.list); + elm_box_pack_end(vbox, d.list); + + d.index = elm_index_add(win); + elm_win_resize_object_add(win, d.index); + evas_object_size_hint_weight_set(d.index, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(d.list, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(d.index); + + for (i = 0; i < (sizeof(dict) / sizeof(dict[0])); i++) + { + lit = elm_list_item_append(d.list, dict[i], NULL, NULL, NULL, NULL); + + if (curr != dict[i][0]) + { + Elm_Object_Item *index_it; + char buf[32]; + + curr = dict[i][0]; + /* indexing by first letters */ + + snprintf(buf, sizeof(buf), "%c", curr); + elm_index_item_append(d.index, buf, NULL, lit); + index_it = elm_index_item_find(d.index, lit); + + elm_object_item_del_cb_set(index_it, _index_item_del); + } + } + + evas_object_smart_callback_add(d.index, "delay,changed", _index_changed, + NULL); + evas_object_smart_callback_add(d.index, "selected", _index_selected, NULL); + + /* attribute setting knobs */ + sep = elm_separator_add(win); + elm_separator_horizontal_set(sep, EINA_TRUE); + elm_box_pack_end(vbox, sep); + evas_object_show(sep); + + hbox = elm_box_add(win); + elm_box_horizontal_set(hbox, EINA_TRUE); + evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_fill_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(vbox, hbox); + evas_object_show(hbox); + + bt = elm_button_add(win); + elm_object_text_set(bt, "bring in index"); + evas_object_smart_callback_add(bt, "clicked", _active_set, NULL); + elm_box_pack_end(hbox, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "delete last selected item"); + evas_object_smart_callback_add(bt, "clicked", _item_del, NULL); + elm_box_pack_end(hbox, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "delete all items"); + evas_object_smart_callback_add(bt, "clicked", _item_del_all, NULL); + elm_box_pack_end(hbox, bt); + evas_object_show(bt); + + evas_object_resize(win, 320, 600); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/index_example_02.c b/libraries/elementary/src/examples/index_example_02.c new file mode 100644 index 0000000..ff2acde --- /dev/null +++ b/libraries/elementary/src/examples/index_example_02.c @@ -0,0 +1,152 @@ +/** + * Simple Elementary's index widget example, illustrating its + * usage and API -- now with sorted insertions. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g index_example.c -o index_example `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +static const char *items[] = \ +{ + "Judith", + "Paulina", + "Cathy", + "Vendella", + "Naomi", + "Ashley", + "Stacey", + "Gail" +}; + +static void +_index_changed(void *data, + Evas_Object *obj, + void *event_info) +{ + Elm_Object_Item *item = elm_object_item_data_get(event_info); + elm_gengrid_item_bring_in(item, ELM_GENGRID_ITEM_SCROLLTO_IN); +} + +static void +_on_done(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_exit(); +} + +static char * +_grid_label_get(void *data, + Evas_Object *obj, + const char *part) +{ + int idx = (int)data; + return strdup(items[idx]); +} + +Evas_Object * +_grid_content_get(void *data, + Evas_Object *obj, + const char *part) +{ + if (!strcmp(part, "elm.swallow.icon")) + { + char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), + "sky_01.jpg"); + + Evas_Object *icon = elm_bg_add(obj); + elm_bg_file_set(icon, buf, NULL); + evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, + 1); + evas_object_show(icon); + return icon; + } + + return NULL; +} + +/* ordering alphabetically */ +static int +_index_icmp(const void *data1, + const void *data2) +{ + const char *label1, *label2; + + const Elm_Object_Item *index_it1 = data1; + const Elm_Object_Item *index_it2 = data2; + + label1 = elm_index_item_letter_get(index_it1); + label2 = elm_index_item_letter_get(index_it2); + + return strcasecmp(label1, label2); +} + +EAPI_MAIN int +elm_main(int argc, + char **argv) +{ + Evas_Object *win, *bg, *grid, *idx; + Elm_Object_Item *gg_it; + unsigned int i; + + Elm_Gengrid_Item_Class gic; + + elm_app_info_set(elm_main, "elementary", "images"); + win = elm_win_add(NULL, "index", ELM_WIN_BASIC); + elm_win_title_set(win, "Index Example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + grid = elm_gengrid_add(win); + elm_gengrid_item_size_set(grid, 150, 150); + + gic.item_style = "default"; + gic.func.text_get = _grid_label_get; + gic.func.content_get = _grid_content_get; + gic.func.state_get = NULL; + gic.func.del = NULL; + + evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, grid); + evas_object_show(grid); + + idx = elm_index_add(win); + evas_object_size_hint_weight_set(idx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, idx); + + evas_object_show(idx); + + for (i = 0; i < (sizeof(items) / sizeof(items[0])); i++) + { + char buf[32]; + + gg_it = elm_gengrid_item_append(grid, &gic, (void *)i, NULL, NULL); + + /* indexing by first letters */ + snprintf(buf, sizeof(buf), "%c", items[i][0]); + elm_index_item_sorted_insert(idx, buf, NULL, gg_it, _index_icmp, NULL); + } + + evas_object_smart_callback_add(idx, "delay,changed", _index_changed, NULL); + + evas_object_resize(win, 320, 300); + evas_object_show(win); + + elm_index_autohide_disabled_set(idx, EINA_FALSE); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/inwin_example.c b/libraries/elementary/src/examples/inwin_example.c new file mode 100644 index 0000000..df7f679 --- /dev/null +++ b/libraries/elementary/src/examples/inwin_example.c @@ -0,0 +1,152 @@ +/* + * gcc -o inwin_example inwin_example.c `pkg-config --cflags --libs elementary` + */ +#include + +static Evas_Object *inwin = NULL; +static const char *styles[] = { + "default", + "minimal", + "minimal_vertical" +}; +static int current_style = 0; + +static void +_inwin_hide(void *data, Evas_Object *obj, void *event) +{ + if (inwin) + { + evas_object_hide(inwin); + return; + } + elm_object_text_set(obj, "No inwin!"); + elm_object_disabled_set(obj, EINA_TRUE); +} + +static void +_inwin_destroy(void *data, Evas_Object *obj, void *event) +{ + if (inwin) + { + evas_object_del(inwin); + inwin = NULL; + return; + } + elm_object_text_set(obj, "No inwin!"); + elm_object_disabled_set(obj, EINA_TRUE); +} + +static void +_btn_click_cb(void *data, Evas_Object *obj, void *event) +{ + Evas_Object *o, *parent; + + if (inwin) + { + elm_win_inwin_activate(inwin); + return; + } + + parent = elm_object_top_widget_get(obj); + inwin = elm_win_inwin_add(parent); + elm_object_style_set(inwin, styles[current_style]); + evas_object_show(inwin); + + current_style = (current_style + 1) % 3; + + o = elm_box_add(parent); + evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_inwin_content_set(inwin, o); + evas_object_show(o); + + o = elm_label_add(parent); + elm_object_text_set(o, "Click on the first button to hide the Inwin." + "Second to destroy it"); + evas_object_show(o); + + elm_box_pack_end(elm_win_inwin_content_get(inwin), o); + + o = elm_button_add(parent); + elm_object_text_set(o, "Hide"); + evas_object_show(o); + + evas_object_smart_callback_add(o, "clicked", _inwin_hide, NULL); + + elm_box_pack_end(elm_win_inwin_content_get(inwin), o); + + o = elm_button_add(parent); + elm_object_text_set(o, "Destroy"); + evas_object_show(o); + + evas_object_smart_callback_add(o, "clicked", _inwin_destroy, NULL); + + elm_box_pack_end(elm_win_inwin_content_get(inwin), o); +} + +static void +_win_del_cb(void *data, Evas_Object *obj, void *event) +{ + if (inwin) + { + Evas_Object *hover, *o = elm_win_inwin_content_unset(inwin); + evas_object_del(inwin); + inwin = NULL; + hover = elm_hover_add(obj); + elm_hover_target_set(hover, obj); + elm_object_part_content_set(hover, "middle", o); + evas_object_show(hover); + return; + } + evas_object_del(obj); +} + +static Eina_Bool +_screenshot_hack_cb(void *data) +{ + _btn_click_cb(NULL, data, NULL); + return EINA_FALSE; +} + +EAPI_MAIN int +elm_main(int argc, char *argv[]) +{ + Evas_Object *win, *bg, *box, *o; + + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + win = elm_win_add(NULL, "inwin-example", ELM_WIN_BASIC); + elm_win_title_set(win, "Inwin Example"); + evas_object_resize(win, 400, 400); + evas_object_show(win); + + evas_object_smart_callback_add(win, "delete,request", _win_del_cb, NULL); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + box = elm_box_add(win); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, box); + evas_object_show(box); + + o = elm_button_add(win); + elm_object_text_set(o, "Inwin!"); + evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(o, 0.0, 0.0); + elm_box_pack_end(box, o); + evas_object_show(o); + + evas_object_smart_callback_add(o, "clicked", _btn_click_cb, NULL); + + if (!strncmp(elm_config_engine_get(), "shot", 4)) + ecore_timer_add(0.1, _screenshot_hack_cb, o); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/label_example_01.c b/libraries/elementary/src/examples/label_example_01.c new file mode 100644 index 0000000..343f40e --- /dev/null +++ b/libraries/elementary/src/examples/label_example_01.c @@ -0,0 +1,80 @@ +//Compile with: +//gcc -o label_example_01 label_example_01.c -g `pkg-config --cflags --libs elementary` + +#include + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *label, *label2, *label3, *label4, *label5, *label6; + + win = elm_win_add(NULL, "label", ELM_WIN_BASIC); + elm_win_title_set(win, "Label"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + label = elm_label_add(win); + elm_object_text_set(label, "Some long text for our label, that is long but " + "not too long."); + elm_label_slide_duration_set(label, 3); + elm_label_slide_set(label, EINA_TRUE); + elm_object_style_set(label, "slide_bounce"); + evas_object_resize(label, 200, 15); + evas_object_show(label); + + label2 = elm_label_add(win); + elm_object_text_set(label2, "This is the text for our second label, which is" + " much longer than the previous one, maybe even " + "too long, but maybe not."); + elm_label_ellipsis_set(label2, EINA_TRUE); + evas_object_resize(label2, 200, 15); + evas_object_move(label2, 0, 15); + evas_object_show(label2); + + label3 = elm_label_add(win); + elm_object_text_set(label3, "Some more long text much as before, long but " + "not too long."); + elm_label_line_wrap_set(label3, ELM_WRAP_CHAR); + elm_label_ellipsis_set(label3, EINA_TRUE); + evas_object_resize(label3, 200, 15); + evas_object_move(label3, 0, 30); + evas_object_show(label3); + + label4 = elm_label_add(win); + elm_object_text_set(label4, "And for this label we choose a different text, " + "for no reason other than that we can."); + elm_label_line_wrap_set(label4, ELM_WRAP_CHAR); + evas_object_resize(label4, 200, 30); + evas_object_move(label4, 0, 45); + evas_object_show(label4); + + label5 = elm_label_add(win); + elm_object_text_set(label5, "And for this label we choose a different text, " + "for no reason other than that we can."); + elm_label_line_wrap_set(label5, ELM_WRAP_WORD); + evas_object_resize(label5, 200, 30); + evas_object_move(label5, 0, 75); + evas_object_show(label5); + + label6 = elm_label_add(win); + elm_object_text_set(label6, "Short text"); + elm_object_style_set(label6, "marker"); + evas_object_color_set(label6, 255, 0, 0, 255); + evas_object_resize(label6, 200, 15); + evas_object_move(label6, 0, 105); + evas_object_show(label6); + + evas_object_resize(win, 200, 125); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/layout_example_01.c b/libraries/elementary/src/examples/layout_example_01.c new file mode 100644 index 0000000..dfe3865 --- /dev/null +++ b/libraries/elementary/src/examples/layout_example_01.c @@ -0,0 +1,150 @@ +//Compile with: +//gcc -g layout_example_01.c -o layout_example_01 `pkg-config --cflags --libs elementary` + +#include + +#define TABLE "example/table" +#define BOX "example/box" +#define TITLE "example/title" +#define SWALLOW "example/custom" + +static int _box_buttons = 0; + +static void +_tbl_btn_cb(void *data, Evas_Object *btn, void *event_info) +{ + Evas_Object *layout = data; + + elm_layout_table_unpack(layout, TABLE, btn); + evas_object_del(btn); +} + +static void +_box_btn_cb(void *data, Evas_Object *btn, void *event_info) +{ + Evas_Object *layout = data; + Evas_Object *item; + char buf[30]; + + snprintf(buf, sizeof(buf), "Button %02d", _box_buttons++); + + item = elm_button_add(elm_object_parent_widget_get(layout)); + elm_object_text_set(item, buf); + evas_object_size_hint_weight_set(item, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(item, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_min_set(item, 100, 50); + elm_layout_box_insert_before(layout, BOX, item, btn); + evas_object_smart_callback_add(item, "clicked", _box_btn_cb, layout); + evas_object_show(item); +} + +static void +_swallow_btn_cb(void *data, Evas_Object *btn, void *event_info) +{ + Evas_Object *layout = data; + Evas_Object *item; + + elm_layout_table_clear(layout, TABLE, EINA_TRUE); + elm_layout_box_remove_all(layout, BOX, EINA_TRUE); + item = elm_object_part_content_unset(layout, SWALLOW); + evas_object_del(item); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *icon, *icon2, *bt, *bt2, *layout; + Evas_Object *clk; + Evas_Object *item; + char buf[PATH_MAX]; + + elm_app_info_set(elm_main, "elementary", "examples/layout_example.edj"); + win = elm_win_add(NULL, "layout", ELM_WIN_BASIC); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + elm_bg_color_set(bg, 255,255 ,255); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + // Adding layout and filling it with widgets + layout = elm_layout_add(win); + evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, layout); + snprintf(buf, sizeof(buf), "%s/examples/layout_example.edj", elm_app_data_dir_get()); + elm_layout_file_set(layout, buf, "example/mylayout"); + evas_object_show(layout); + + // Setting title + const char *title = elm_layout_data_get(layout, "title"); + if (title) + { + elm_win_title_set(win, title); + elm_object_part_text_set(layout, TITLE, title); + } + + // Add icon, clock and button to the table + icon = elm_icon_add(win); + elm_icon_standard_set(icon, "home"); + evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_layout_table_pack(layout, TABLE, icon, 0, 0, 1, 1); + evas_object_show(icon); + + icon2 = elm_icon_add(win); + elm_icon_standard_set(icon2, "close"); + evas_object_size_hint_weight_set(icon2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(icon2, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_layout_table_pack(layout, TABLE, icon2, 1, 0, 1, 1); + evas_object_show(icon2); + + clk = elm_clock_add(win); + evas_object_size_hint_weight_set(clk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(clk, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_layout_table_pack(layout, TABLE, clk, 2, 0, 1, 1); + evas_object_show(clk); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Click me!"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_layout_table_pack(layout, TABLE, bt, 0, 1, 3, 1); + evas_object_smart_callback_add(bt, "clicked", _tbl_btn_cb, layout); + evas_object_show(bt); + + item = elm_button_add(win); + elm_object_text_set(item, "Position 0"); + evas_object_size_hint_weight_set(item, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(item, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_min_set(item, 100, 50); + elm_layout_box_insert_at(layout, BOX, item, 0); + evas_object_smart_callback_add(item, "clicked", _box_btn_cb, layout); + evas_object_show(item); + + item = elm_button_add(win); + elm_object_text_set(item, "Prepended"); + evas_object_size_hint_weight_set(item, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(item, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_min_set(item, 100, 50); + elm_layout_box_prepend(layout, BOX, item); + evas_object_smart_callback_add(item, "clicked", _box_btn_cb, layout); + evas_object_show(item); + + bt2 = elm_button_add(win); + elm_object_text_set(bt2, "Delete All"); + elm_object_part_content_set(layout, SWALLOW, bt2); + evas_object_smart_callback_add(bt2, "clicked", _swallow_btn_cb, layout); + + evas_object_size_hint_min_set(bg, 160, 160); + evas_object_size_hint_max_set(bg, 640, 640); + evas_object_resize(win, 320, 320); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/layout_example_02.c b/libraries/elementary/src/examples/layout_example_02.c new file mode 100644 index 0000000..ed112e0 --- /dev/null +++ b/libraries/elementary/src/examples/layout_example_02.c @@ -0,0 +1,83 @@ +//Compile with: +//gcc -g layout_example_02.c -o layout_example_02 `pkg-config --cflags --libs elementary` + +#include + +#define TABLE "example/table" +#define BOX "example/box" +#define TITLE "example/title" +#define SWALLOW "example/custom" + +static const char *images[] = { "home", "close", "arrow_up", "arrow_down", NULL }; + +struct _App { + int current; +}; + +static void +_signal_cb(void *data, Evas_Object *o, const char *emission, const char *source) +{ + struct _App *app = data; + Evas_Object *icon = elm_object_part_content_get(o, "elm.swallow.content"); + + printf("signal received\n"); + + if (!strcmp("elm,action,back", emission)) + app->current--; + else if (!strcmp("elm,action,next", emission)) + app->current++; + + if (app->current < 0) + app->current = sizeof(images) - 1; + else if (images[app->current] == NULL) + app->current = 0; + + elm_icon_standard_set(icon, images[app->current]); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *layout, *icon; + struct _App app; + + app.current = 0; + + win = elm_win_add(NULL, "layout", ELM_WIN_BASIC); + elm_win_title_set(win, "Layout"); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + elm_bg_color_set(bg, 255, 255, 255); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + // Adding layout and filling it with widgets + layout = elm_layout_add(win); + evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, layout); + elm_layout_theme_set( + layout, "layout", "application", "content-back-next"); + evas_object_show(layout); + + icon = elm_icon_add(win); + elm_icon_standard_set(icon, images[app.current]); + evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(layout, "elm.swallow.content", icon); + + elm_object_signal_callback_add(layout, "elm,action,back", "", _signal_cb, &app); + elm_object_signal_callback_add(layout, "elm,action,next", "", _signal_cb, &app); + + evas_object_size_hint_min_set(bg, 160, 160); + evas_object_size_hint_max_set(bg, 640, 640); + evas_object_resize(win, 320, 320); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/layout_example_03.c b/libraries/elementary/src/examples/layout_example_03.c new file mode 100644 index 0000000..8c4c7b7 --- /dev/null +++ b/libraries/elementary/src/examples/layout_example_03.c @@ -0,0 +1,94 @@ +//Compile with: +//gcc -g layout_example_03.c -o layout_example_03 `pkg-config --cflags --libs elementary` + +#include + +#define TITLE "example/title" +#define SWALLOW "example/custom" + +static Eina_Bool _btn_large = EINA_FALSE; + +static void +_swallow_btn_cb(void *data, Evas_Object *btn, void *event_info) +{ + Evas_Object *layout = data; + + if (_btn_large == EINA_FALSE) + { + _btn_large = EINA_TRUE; + elm_object_signal_emit(layout, "button,enlarge", ""); + elm_object_text_set(btn, "Reduce me!"); + } + else + { + _btn_large = EINA_FALSE; + elm_object_signal_emit(layout, "button,reduce", ""); + elm_object_text_set(btn, "Enlarge me!"); + } +} + +static void +_size_changed_cb(void *data, Evas_Object *layout, const char *emission, const char *source) +{ + Evas_Object *edje; + Evas_Coord w, h; + + elm_layout_sizing_eval(layout); + edje = elm_layout_edje_get(layout); + edje_object_size_min_calc(edje, &w, &h); + printf("Minimum size for this theme: %dx%d\n", w, h); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *btn, *layout; + char buf[PATH_MAX]; + + elm_app_info_set(elm_main, "elementary", "examples/layout_example.edj"); + win = elm_win_add(NULL, "layout", ELM_WIN_BASIC); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + elm_bg_color_set(bg, 255,255 ,255); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + // Adding layout + layout = elm_layout_add(win); + evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, layout); + snprintf(buf, sizeof(buf), "%s/examples/layout_example.edj", elm_app_data_dir_get()); + elm_layout_file_set(layout, buf, "example/mylayout3"); + evas_object_show(layout); + + elm_object_signal_callback_add(layout, "size,changed", "", _size_changed_cb, layout); + + // Setting title + const char *title = elm_layout_data_get(layout, "title"); + if (title) + { + elm_win_title_set(win, title); + elm_object_part_text_set(layout, TITLE, title); + } + + btn = elm_button_add(win); + elm_object_text_set(btn, "Enlarge me!"); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_part_content_set(layout, SWALLOW, btn); + evas_object_smart_callback_add(btn, "clicked", _swallow_btn_cb, layout); + + evas_object_size_hint_min_set(bg, 160, 160); + evas_object_size_hint_max_set(bg, 640, 640); + evas_object_resize(win, 160, 160); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/list_example_01.c b/libraries/elementary/src/examples/list_example_01.c new file mode 100644 index 0000000..4520859 --- /dev/null +++ b/libraries/elementary/src/examples/list_example_01.c @@ -0,0 +1,71 @@ +/** + * Simple Elementary's list widget example, illustrating its + * creation. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g list_example_01.c -o list_example_01 `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +static void +_on_done(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_exit(); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *bx, *li; + unsigned int i; + static const char *lbl[] = + { + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday" + }; + + win = elm_win_add(NULL, "list", ELM_WIN_BASIC); + elm_win_title_set(win, "List Example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + li = elm_list_add(win); + evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, li); + for (i = 0; i < sizeof(lbl) / sizeof(lbl[0]); i++) + elm_list_item_append(li, lbl[i], NULL, NULL, NULL, NULL); + + evas_object_show(li); + elm_list_go(li); + + evas_object_resize(win, 320, 240); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/list_example_02.c b/libraries/elementary/src/examples/list_example_02.c new file mode 100644 index 0000000..3360131 --- /dev/null +++ b/libraries/elementary/src/examples/list_example_02.c @@ -0,0 +1,85 @@ +/** + * Elementary's list widget example, illustrating its + * usage and API. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g list_example_02.c -o list_example_02 `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +static void +_on_done(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_exit(); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *bx, *li; + unsigned int i; + static const char *lbl[] = + { + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday" + }; + + win = elm_win_add(NULL, "list", ELM_WIN_BASIC); + elm_win_title_set(win, "List Example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + /* default */ + li = elm_list_add(win); + evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, li); + for (i = 0; i < sizeof(lbl) / sizeof(lbl[0]); i++) + elm_list_item_append(li, lbl[i], NULL, NULL, NULL, NULL); + + /* display horizontally and set compress mode */ + elm_list_horizontal_set(li, EINA_TRUE); + elm_list_mode_set(li, ELM_LIST_COMPRESS); + + /* enable multiple selection and always select */ + elm_list_multi_select_set(li, EINA_TRUE); + elm_list_select_mode_set(li, ELM_OBJECT_SELECT_MODE_ALWAYS); + + /* set bounce and scroller policy */ + elm_list_bounce_set(li, EINA_TRUE, EINA_TRUE); + elm_list_scroller_policy_set(li, ELM_SCROLLER_POLICY_AUTO, + ELM_SCROLLER_POLICY_ON); + + elm_list_go(li); + evas_object_show(li); + + evas_object_resize(win, 320, 120); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/list_example_03.c b/libraries/elementary/src/examples/list_example_03.c new file mode 100644 index 0000000..cc1549a --- /dev/null +++ b/libraries/elementary/src/examples/list_example_03.c @@ -0,0 +1,441 @@ +/** + * Elementary's list widget example, illustrating its API, + * covering most of item functions. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g list_example_03.c -o list_example_03 `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +static int counter = 3; + +static void +_on_done(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_exit(); +} + +static void +_prepend_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *list_it; + Evas_Object *li = data; + char label[32]; + + snprintf(label, sizeof(label), "Item %i", counter++); + list_it = elm_list_item_prepend(li, label, NULL, NULL, NULL, NULL); + if (!list_it) + printf("Error adding item\n"); +} + +static void +_add_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *list_it; + Evas_Object *li = data; + char label[32]; + + snprintf(label, sizeof(label), "Item %i", counter++); + list_it = elm_list_item_append(li, label, NULL, NULL, NULL, NULL); + if (!list_it) + printf("Error adding item\n"); +} + +static void +_add_ic_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *list_it; + Evas_Object *ic, *li = data; + char label[32]; + + snprintf(label, sizeof(label), "Item %i", counter++); + ic = elm_icon_add(li); + elm_icon_standard_set(ic, "home"); + elm_icon_resizable_set(ic, EINA_FALSE, EINA_FALSE); + + list_it = elm_list_item_append(li, label, ic, NULL, NULL, NULL); + if (!list_it) + printf("Error adding item with icon\n"); +} + +static void +_sel_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *list_it = event_info; + printf("Selected label: %s\n", elm_object_item_text_get(list_it)); +} + +static void +_add_func_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *list_it; + Evas_Object *li = data; + char label[32]; + + snprintf(label, sizeof(label), "Item %i", counter++); + list_it = elm_list_item_append(li, label, NULL, NULL, _sel_cb, NULL); + if (!list_it) + printf("Error adding item\n"); +} + +static void +_sel_data_cb(void *data, Evas_Object *obj, void *event_info) +{ + char *content = data; + Elm_Object_Item *list_it = event_info; + printf("Selected label: %s with data: %s\n", + elm_object_item_text_get(list_it), content); +} + +static void +_free_data(void *data, Evas_Object *obj, void *event_info) +{ + free(data); +} + +static void +_add_data_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *list_it; + Evas_Object *li = data; + char label[32]; + char *content = malloc(sizeof(char) * 32); + + snprintf(content, 32, "Item content %i", counter); + snprintf(label, sizeof(label), "Item %i", counter++); + list_it = elm_list_item_append(li, label, NULL, NULL, _sel_data_cb, content); + if (!list_it) { + printf("Error adding item\n"); + return; + } + elm_object_item_del_cb_set(list_it, _free_data); +} + +static void +_del_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *selected_item; + Evas_Object *li = data; + + selected_item = elm_list_selected_item_get(li); + elm_object_item_del(selected_item); +} + +static void +_unselect_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *selected_item; + Evas_Object *li = data; + + selected_item = elm_list_selected_item_get(li); + elm_list_item_selected_set(selected_item, EINA_FALSE); +} + +static void +_print_cb(void *data, Evas_Object *obj, void *event_info) +{ + const Eina_List *l, *items; + Elm_Object_Item *list_it; + Evas_Object *li = data; + + items = elm_list_items_get(li); + EINA_LIST_FOREACH(items, l, list_it) + printf("%s\n", elm_object_item_text_get(list_it)); +} + +static void +_clear_cb(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *li = data; + elm_list_clear(li); +} + +static void +_select_next_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *selected_item, *next_item; + Evas_Object *li = data; + + selected_item = elm_list_selected_item_get(li); + if (!selected_item) return; + + next_item = elm_list_item_next(selected_item); + if (next_item) + elm_list_item_selected_set(next_item, EINA_TRUE); +} + +static void +_insert_after_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *selected_item, *list_it; + Evas_Object *li = data; + char label[32]; + + selected_item = elm_list_selected_item_get(li); + if (!selected_item) return; + + snprintf(label, sizeof(label), "Item %i", counter++); + list_it = elm_list_item_insert_after(li, selected_item, label, NULL, NULL, + NULL, NULL); + if (!list_it) + printf("Error adding item\n"); +} + +static void +_select_prev_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *selected_item, *prev_item; + Evas_Object *li = data; + + selected_item = elm_list_selected_item_get(li); + if (!selected_item) return; + + prev_item = elm_list_item_prev(selected_item); + if (prev_item) + elm_list_item_selected_set(prev_item, EINA_TRUE); +} + +static void +_insert_before_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *selected_item, *list_it; + Evas_Object *li = data; + char label[32]; + + selected_item = elm_list_selected_item_get(li); + if (!selected_item) return; + + snprintf(label, sizeof(label), "Item %i", counter++); + list_it = elm_list_item_insert_before(li, selected_item, label, NULL, NULL, + NULL, NULL); + if (!list_it) + printf("Error adding item\n"); +} + +static void +_set_separator_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *selected_item; + Evas_Object *li = data; + + selected_item = elm_list_selected_item_get(li); + if (!selected_item) return; + elm_list_item_separator_set(selected_item, EINA_TRUE); +} + +static void +_disable_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *selected_item; + Evas_Object *li = data; + + selected_item = elm_list_selected_item_get(li); + if (!selected_item) return; + elm_object_item_disabled_set(selected_item, EINA_TRUE); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *bx, *hbx, *li, *bt; + + win = elm_win_add(NULL, "list", ELM_WIN_BASIC); + elm_win_title_set(win, "List Items Example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + li = elm_list_add(win); + evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, li); + + elm_list_item_append(li, "Item 0", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "Item 1", NULL, NULL, NULL, NULL); + elm_list_item_append(li, "Item 2", NULL, NULL, NULL, NULL); + + hbx = elm_box_add(win); + elm_box_horizontal_set(hbx, EINA_TRUE); + evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(hbx, EVAS_HINT_FILL, 0); + elm_box_pack_end(bx, hbx); + evas_object_show(hbx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Prepend item"); + evas_object_smart_callback_add(bt, "clicked", _prepend_cb, li); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Append item"); + evas_object_smart_callback_add(bt, "clicked", _add_cb, li); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0); + evas_object_show(bt); + + hbx = elm_box_add(win); + elm_box_horizontal_set(hbx, EINA_TRUE); + evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(hbx, EVAS_HINT_FILL, 0); + elm_box_pack_end(bx, hbx); + evas_object_show(hbx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Append with icon"); + evas_object_smart_callback_add(bt, "clicked", _add_ic_cb, li); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Append with selected function"); + evas_object_smart_callback_add(bt, "clicked", _add_func_cb, li); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Append with data"); + evas_object_smart_callback_add(bt, "clicked", _add_data_cb, li); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0); + evas_object_show(bt); + + hbx = elm_box_add(win); + elm_box_horizontal_set(hbx, EINA_TRUE); + evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(hbx, EVAS_HINT_FILL, 0); + elm_box_pack_end(bx, hbx); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0); + evas_object_show(hbx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Delete item"); + evas_object_smart_callback_add(bt, "clicked", _del_cb, li); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Unselect item"); + evas_object_smart_callback_add(bt, "clicked", _unselect_cb, li); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Print items"); + evas_object_smart_callback_add(bt, "clicked", _print_cb, li); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Clear"); + evas_object_smart_callback_add(bt, "clicked", _clear_cb, li); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0); + evas_object_show(bt); + + hbx = elm_box_add(win); + elm_box_horizontal_set(hbx, EINA_TRUE); + evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(hbx, EVAS_HINT_FILL, 0); + elm_box_pack_end(bx, hbx); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0); + evas_object_show(hbx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Select next item"); + evas_object_smart_callback_add(bt, "clicked", _select_next_cb, li); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Insert after item"); + evas_object_smart_callback_add(bt, "clicked", _insert_after_cb, li); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Select previous item"); + evas_object_smart_callback_add(bt, "clicked", _select_prev_cb, li); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Insert before item"); + evas_object_smart_callback_add(bt, "clicked", _insert_before_cb, li); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0); + evas_object_show(bt); + + hbx = elm_box_add(win); + elm_box_horizontal_set(hbx, EINA_TRUE); + evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(hbx, EVAS_HINT_FILL, 0); + elm_box_pack_end(bx, hbx); + evas_object_show(hbx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Set as separator"); + evas_object_smart_callback_add(bt, "clicked", _set_separator_cb, li); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Disable item"); + evas_object_smart_callback_add(bt, "clicked", _disable_cb, li); + elm_box_pack_end(hbx, bt); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0); + evas_object_show(bt); + + elm_list_go(li); + evas_object_show(li); + + evas_object_resize(win, 320, 600); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/map_example_01.c b/libraries/elementary/src/examples/map_example_01.c new file mode 100644 index 0000000..3c549b2 --- /dev/null +++ b/libraries/elementary/src/examples/map_example_01.c @@ -0,0 +1,121 @@ +/** + * Simple Elementary's map widget example, illustrating its + * creation. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g map_example_01.c -o map_example_01 `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +static void +_bt_zoom_in(void *data, Evas_Object *obj, void *ev) +{ + int zoom; + elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL); + zoom = elm_map_zoom_get(data); + elm_map_zoom_set(data, zoom + 1); +} + +static void +_bt_zoom_out(void *data, Evas_Object *obj, void *ev) +{ + int zoom; + elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL); + zoom = elm_map_zoom_get(data); + elm_map_zoom_set(data, zoom - 1); +} + +static void +_bt_zoom_fit(void *data, Evas_Object *obj, void *event_info) +{ + elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_AUTO_FIT); +} + +static void +_bt_zoom_fill(void *data, Evas_Object *obj, void *event_info) +{ + elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_AUTO_FILL); +} + +static void +_on_done(void *data, Evas_Object *obj, void *event_info) +{ + elm_exit(); +} + +/* FIXME: it shouldn't be required. For unknown reason map won't call + * pan_calculate until shot delay time, but then it will take a screenshot + * when the map isn't loaded yet (actually it won't be downloaded, because + * after the SS it will kill the example). */ +static Eina_Bool +_nasty_hack(void *data) +{ + Evas_Object *o = data; + Evas *e = evas_object_evas_get(o); + evas_smart_objects_calculate(e); + return ECORE_CALLBACK_CANCEL; +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *map, *box, *bt; + + win = elm_win_add(NULL, "map", ELM_WIN_BASIC); + elm_win_title_set(win, "Map Creation Example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + map = elm_map_add(win); + elm_win_resize_object_add(win, map); + evas_object_size_hint_weight_set(map, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(map); + + box = elm_box_add(win); + evas_object_show(box); + + bt = elm_button_add(win); + elm_object_text_set(bt, "+"); + elm_box_pack_end(box, bt); + evas_object_show(bt); + evas_object_smart_callback_add(bt, "clicked", _bt_zoom_in, map); + + bt = elm_button_add(win); + elm_object_text_set(bt, "-"); + elm_box_pack_end(box, bt); + evas_object_show(bt); + evas_object_smart_callback_add(bt, "clicked", _bt_zoom_out, map); + + bt = elm_button_add(win); + elm_object_text_set(bt, "X"); + elm_box_pack_end(box, bt); + evas_object_show(bt); + evas_object_smart_callback_add(bt, "clicked", _bt_zoom_fit, map); + + bt = elm_button_add(win); + elm_object_text_set(bt, "#"); + elm_box_pack_end(box, bt); + evas_object_show(bt); + evas_object_smart_callback_add(bt, "clicked", _bt_zoom_fill, map); + + elm_map_zoom_set(map, 12); + elm_map_region_show(map, -43.2, -22.9); + evas_object_resize(win, 512, 512); + evas_object_show(win); + + ecore_timer_add(0.5, _nasty_hack, win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/map_example_02.c b/libraries/elementary/src/examples/map_example_02.c new file mode 100644 index 0000000..43e300a --- /dev/null +++ b/libraries/elementary/src/examples/map_example_02.c @@ -0,0 +1,277 @@ +/** + * Simple Elementary's map widget example, illustrating overlays + * usage. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g map_example_02.c -o map_example_02 `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +typedef struct _Overlay_Data +{ + const char *name; + const char *file; +} Overlay_Data; + +Overlay_Data data_argentina = {"Argentina", NULL}; +Overlay_Data data_chile = {"Chile", NULL}; +Overlay_Data data_sampa = {"São Paulo", NULL}; +Overlay_Data data_rio = {"Rio de Janeiro", NULL}; +Overlay_Data data_brasilia = {"Brasília", NULL}; + +static Elm_Map_Overlay *bubble; +const char *data_dir; + +static Evas_Object * +_icon_get(Evas_Object *obj, const char *file) +{ + Evas_Object *icon = elm_icon_add(obj); + elm_icon_file_set(icon, file, NULL); + evas_object_show(icon); + return icon; +} + +static Evas_Object * +_city_icon_get(Evas_Object *obj) +{ + char buf[256]; + snprintf(buf, sizeof(buf), "%s/images/icon_07.png", data_dir); + return _icon_get(obj, buf); +} + +static Evas_Object * +_clas_city_icon_get(Evas_Object *obj) +{ + char buf[256]; + snprintf(buf, sizeof(buf), "%s/images/icon_05.png", data_dir); + return _icon_get(obj, buf); +} + +static Evas_Object * +_country_icon_get(Evas_Object *obj) +{ + char buf[256]; + snprintf(buf, sizeof(buf), "%s/images/icon_06.png", data_dir); + return _icon_get(obj, buf); +} + +static Evas_Object * +_clas_country_icon_get(Evas_Object *obj) +{ + char buf[256]; + snprintf(buf, sizeof(buf), "%s/images/icon_04.png", data_dir); + return _icon_get(obj, buf); +} + +static Evas_Object * +_box_get(Evas_Object *obj, Overlay_Data *data) +{ + Evas_Object *bx, *img, *label; + bx = elm_box_add(obj); + evas_object_show(bx); + + img = evas_object_image_add(evas_object_evas_get(obj)); + evas_object_image_file_set(img, data->file, NULL); + evas_object_image_filled_set(img, EINA_TRUE); + evas_object_size_hint_min_set(img, 64, 64); + evas_object_show(img); + elm_box_pack_end(bx, img); + + label = elm_label_add(obj); + elm_object_text_set(label, data->name); + evas_object_show(label); + elm_box_pack_end(bx, label); + return bx; +} + +static void +_overlay_cb(void *data, Evas_Object *map, void *ev) +{ + printf("Overlay clicked\n"); + Elm_Map_Overlay *overlay = ev; + Evas_Object *bx; + + // prevent duplication + if (!bubble) bubble = elm_map_overlay_bubble_add(map); + + elm_map_overlay_bubble_follow(bubble, overlay); + elm_map_overlay_bubble_content_clear(bubble); + bx = _box_get(map, elm_map_overlay_data_get(overlay)); + elm_map_overlay_bubble_content_append(bubble, bx); +} + +static void +_bt_zoom_in(void *data, Evas_Object *obj, void *ev) +{ + Evas_Object *map = data; + int zoom; + + elm_map_zoom_mode_set(map, ELM_MAP_ZOOM_MODE_MANUAL); + zoom = elm_map_zoom_get(map); + elm_map_zoom_set(map, zoom + 1); +} + +static void +_bt_zoom_out(void *data, Evas_Object *obj, void *ev) +{ + Evas_Object *map = data; + int zoom; + + elm_map_zoom_mode_set(map, ELM_MAP_ZOOM_MODE_MANUAL); + zoom = elm_map_zoom_get(map); + elm_map_zoom_set(map, zoom - 1); +} + +static void +_bt_zoom_fit(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *map = data; + elm_map_zoom_mode_set(map, ELM_MAP_ZOOM_MODE_AUTO_FIT); +} + +static void +_bt_zoom_fill(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *map = data; + elm_map_zoom_mode_set(map, ELM_MAP_ZOOM_MODE_AUTO_FILL); +} + +static void +_on_done(void *data, Evas_Object *obj, void *event_info) +{ + elm_exit(); +} + +/* FIXME: it shouldn't be required. For unknown reason map won't call + * pan_calculate until shot delay time, but then it will take a screenshot + * when the map isn't loaded yet (actually it won't be downloaded, because + * after the SS it will kill the example). */ +static Eina_Bool +_nasty_hack(void *data) +{ + Evas_Object *o = data; + Evas *e = evas_object_evas_get(o); + evas_smart_objects_calculate(e); + return ECORE_CALLBACK_CANCEL; +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *map, *box, *bt; + Eina_List *ovls = NULL; + Elm_Map_Overlay *ovl, *city_clas, *country_clas; + char buf[255]; + + elm_app_info_set(elm_main, "elementary", "images"); + data_dir = elm_app_data_dir_get(); + + snprintf(buf, sizeof(buf), "%s/images/rock_01.jpg", "sdf"); + data_argentina.file = strdup(buf); + snprintf(buf, sizeof(buf), "%s/images/rock_02.jpg", "sdf"); + data_chile.file = strdup(buf); + snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", "sdf"); + data_sampa.file = strdup(buf); + snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", "sdf"); + data_rio.file = strdup(buf); + snprintf(buf, sizeof(buf), "%s/images/sky_03.jpg", "sdf"); + data_brasilia.file = strdup(buf); + + win = elm_win_add(NULL, "map", ELM_WIN_BASIC); + elm_win_title_set(win, "Map Overlay Example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + map = elm_map_add(win); + elm_win_resize_object_add(win, map); + evas_object_size_hint_weight_set(map, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(map); + + box = elm_box_add(win); + evas_object_show(box); + + bt = elm_button_add(win); + elm_object_text_set(bt, "+"); + elm_box_pack_end(box, bt); + evas_object_show(bt); + evas_object_smart_callback_add(bt, "clicked", _bt_zoom_in, map); + + bt = elm_button_add(win); + elm_object_text_set(bt, "-"); + elm_box_pack_end(box, bt); + evas_object_show(bt); + evas_object_smart_callback_add(bt, "clicked", _bt_zoom_out, map); + + bt = elm_button_add(win); + elm_object_text_set(bt, "X"); + elm_box_pack_end(box, bt); + evas_object_show(bt); + evas_object_smart_callback_add(bt, "clicked", _bt_zoom_fit, map); + + bt = elm_button_add(win); + elm_object_text_set(bt, "#"); + elm_box_pack_end(box, bt); + evas_object_show(bt); + evas_object_smart_callback_add(bt, "clicked", _bt_zoom_fill, map); + + evas_object_smart_callback_add(map, "overlay,clicked", _overlay_cb, NULL); + + city_clas = elm_map_overlay_class_add(map); + elm_map_overlay_displayed_zoom_min_set(city_clas, 3); + elm_map_overlay_icon_set(city_clas, _clas_city_icon_get(map)); + + country_clas = elm_map_overlay_class_add(map); + elm_map_overlay_displayed_zoom_min_set(country_clas, 1); + elm_map_overlay_icon_set(country_clas, _clas_country_icon_get(map)); + + ovl = elm_map_overlay_add(map, -43.2, -22.9); + elm_map_overlay_icon_set(ovl, _city_icon_get(map)); + elm_map_overlay_data_set(ovl, &data_rio); + elm_map_overlay_class_append(city_clas, ovl); + ovls = eina_list_append(ovls, ovl); + + ovl = elm_map_overlay_add(map, -46.63, -23.55); + elm_map_overlay_icon_set(ovl, _city_icon_get(map)); + elm_map_overlay_data_set(ovl, &data_sampa); + elm_map_overlay_class_append(city_clas, ovl); + ovls = eina_list_append(ovls, ovl); + + ovl = elm_map_overlay_add(map, -47.88, -15.78); + elm_map_overlay_icon_set(ovl, _city_icon_get(map)); + elm_map_overlay_data_set(ovl, &data_brasilia); + elm_map_overlay_class_append(city_clas, ovl); + ovls = eina_list_append(ovls, ovl); + + ovl = elm_map_overlay_add(map, -65.23, -35.1); + elm_map_overlay_icon_set(ovl, _country_icon_get(map)); + elm_map_overlay_data_set(ovl, &data_argentina); + elm_map_overlay_class_append(country_clas, ovl); + ovls = eina_list_append(ovls, ovl); + + ovl = elm_map_overlay_add(map, -71.3, -31.75); + elm_map_overlay_icon_set(ovl, _country_icon_get(map)); + elm_map_overlay_data_set(ovl, &data_chile); + elm_map_overlay_class_append(country_clas, ovl); + ovls = eina_list_append(ovls, ovl); + + elm_map_overlays_show(ovls); + + evas_object_resize(win, 512, 512); + evas_object_show(win); + + ecore_timer_add(1, _nasty_hack, win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/map_example_03.c b/libraries/elementary/src/examples/map_example_03.c new file mode 100644 index 0000000..2263707 --- /dev/null +++ b/libraries/elementary/src/examples/map_example_03.c @@ -0,0 +1,208 @@ +/** + * Simple Elementary's map widget example, illustrating route and + * name usage. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g map_example_03.c -o map_example_03 `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +typedef struct _Example_Data +{ + Evas_Object *map, *entry; + Elm_Map_Route *route; + double start_lon, start_lat, dest_lon, dest_lat; + Elm_Map_Name *name; + Elm_Map_Overlay *route_ovl; +} Example_Data; + +static Example_Data example_data; + +static void +_route_loaded(void *data, Evas_Object *obj, void *ev) +{ + Example_Data *exam_data = data; + + exam_data->route_ovl = elm_map_overlay_route_add(obj, exam_data->route); + elm_map_overlay_color_set(exam_data->route_ovl, 0, 255, 0, 255); +} + +static void +_name_loaded(void *data, Evas_Object *obj, void *ev) +{ + Example_Data *exam_data = data; + Evas_Object *map = obj; + + if (exam_data->route) + elm_map_route_del(exam_data->route); + + elm_map_name_region_get(exam_data->name, &(exam_data->dest_lon), + &(exam_data->dest_lat)); + + exam_data->route = elm_map_route_add(map, ELM_MAP_ROUTE_TYPE_FOOT, + ELM_MAP_ROUTE_METHOD_SHORTEST, + exam_data->start_lon, exam_data->start_lat, + exam_data->dest_lon, exam_data->dest_lat, + NULL, NULL); +} + +static void +_bt_route(void *data, Evas_Object *obj, void *ev) +{ + Example_Data *exam_data = data; + Evas_Object *map; + char *address; + + map = exam_data->map; + address = (char *)elm_object_text_get(exam_data->entry); + + exam_data->name = elm_map_name_add(map, address, 0, 0, NULL, NULL); + + evas_object_smart_callback_add(map, "name,loaded", _name_loaded, data); + evas_object_smart_callback_add(map, "route,loaded", _route_loaded, data); +} + +static void +_bt_zoom_in(void *data, Evas_Object *obj, void *ev) +{ + int zoom; + elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL); + zoom = elm_map_zoom_get(data); + elm_map_zoom_set(data, zoom + 1); +} + +static void +_bt_zoom_out(void *data, Evas_Object *obj, void *ev) +{ + int zoom; + elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL); + zoom = elm_map_zoom_get(data); + elm_map_zoom_set(data, zoom - 1); +} + +static void +_bt_zoom_fit(void *data, Evas_Object *obj, void *event_info) +{ + elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_AUTO_FIT); +} + +static void +_bt_zoom_fill(void *data, Evas_Object *obj, void *event_info) +{ + elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_AUTO_FILL); +} + +static void +_on_done(void *data, Evas_Object *obj, void *event_info) +{ + elm_exit(); +} + +/* FIXME: it shouldn't be required. For unknown reason map won't call + * pan_calculate until shot delay time, but then it will take a screenshot + * when the map isn't loaded yet (actually it won't be downloaded, because + * after the SS it will kill the example). */ +static Eina_Bool +_nasty_hack(void *data) +{ + Evas_Object *o = data; + Evas *e = evas_object_evas_get(o); + evas_smart_objects_calculate(e); + return ECORE_CALLBACK_CANCEL; +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *map, *box, *bt, *entry; + + win = elm_win_add(NULL, "map", ELM_WIN_BASIC); + elm_win_title_set(win, "Map Route Example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + map = elm_map_add(win); + elm_win_resize_object_add(win, map); + evas_object_size_hint_weight_set(map, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(map); + + box = elm_box_add(win); + evas_object_show(box); + + bt = elm_button_add(win); + elm_object_text_set(bt, "+"); + elm_box_pack_end(box, bt); + evas_object_show(bt); + evas_object_smart_callback_add(bt, "clicked", _bt_zoom_in, map); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0); + + bt = elm_button_add(win); + elm_object_text_set(bt, "-"); + elm_box_pack_end(box, bt); + evas_object_show(bt); + evas_object_smart_callback_add(bt, "clicked", _bt_zoom_out, map); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0); + + bt = elm_button_add(win); + elm_object_text_set(bt, "X"); + elm_box_pack_end(box, bt); + evas_object_show(bt); + evas_object_smart_callback_add(bt, "clicked", _bt_zoom_fit, map); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0); + + bt = elm_button_add(win); + elm_object_text_set(bt, "#"); + elm_box_pack_end(box, bt); + evas_object_show(bt); + evas_object_smart_callback_add(bt, "clicked", _bt_zoom_fill, map); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0); + + elm_box_horizontal_set(box, EINA_TRUE); + elm_win_resize_object_add(win, box); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0); + + entry = elm_entry_add(win); + elm_entry_scrollable_set(entry, EINA_TRUE); + elm_entry_single_line_set(entry, EINA_TRUE); + elm_object_text_set(entry, "Jockey Club Brasileiro"); + evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, 0); + elm_box_pack_end(box, entry); + evas_object_show(entry); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Route"); + elm_box_pack_end(box, bt); + evas_object_show(bt); + evas_object_smart_callback_add(bt, "clicked", _bt_route, &example_data); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0); + + example_data.map = map; + example_data.entry = entry; + example_data.route = NULL; + example_data.start_lon = -43.175; + example_data.start_lat = -22.97; + + elm_map_zoom_set(map, 12); + elm_map_region_show(map, example_data.start_lon, example_data.start_lat); + + evas_object_resize(win, 512, 512); + evas_object_show(win); + + ecore_timer_add(0.5, _nasty_hack, win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/mapbuf_example.c b/libraries/elementary/src/examples/mapbuf_example.c new file mode 100644 index 0000000..03603be --- /dev/null +++ b/libraries/elementary/src/examples/mapbuf_example.c @@ -0,0 +1,126 @@ +/** + * Simple Elementary's mapbuf widget example, illustrating its API. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g mapbuf_example.c -o mapbuf_example `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +static void +_on_done(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_exit(); +} + +static void +_enabled_cb(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *mb = data; + elm_mapbuf_enabled_set(mb, elm_check_state_get(obj)); +} + +static void +_alpha_cb(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *mb = data; + elm_mapbuf_alpha_set(mb, elm_check_state_get(obj)); +} + +static void +_smooth_cb(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *mb = data; + elm_mapbuf_smooth_set(mb, elm_check_state_get(obj)); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *bx, *hbx, *tg, *ck, *mb, *tb, *ic; + unsigned int i, j; + + win = elm_win_add(NULL, "mapbuf", ELM_WIN_BASIC); + elm_win_title_set(win, "Mapbuf Example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + mb = elm_mapbuf_add(win); + evas_object_size_hint_weight_set(mb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(mb, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, mb); + + tb = elm_table_add(win); + evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(tb); + + for (i = 0; i < 8; i++) + { + for (j = 0; j < 8; j++) + { + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "home"); + elm_icon_resizable_set(ic, EINA_FALSE, EINA_FALSE); + evas_object_show(ic); + elm_table_pack(tb, ic, i, j, 1, 1); + } + } + + elm_object_content_set(mb, tb); + evas_object_show(mb); + + hbx = elm_box_add(win); + elm_box_horizontal_set(hbx, EINA_TRUE); + evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(hbx, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, hbx); + evas_object_show(hbx); + + tg = elm_check_add(win); + elm_object_style_set(tg, "toggle"); + elm_object_part_text_set(tg, "on", "Enabled"); + elm_object_part_text_set(tg, "off", "Disabled"); + elm_object_text_set(tg, "Map"); + evas_object_smart_callback_add(tg, "changed", _enabled_cb, mb); + elm_box_pack_end(hbx, tg); + evas_object_show(tg); + + ck = elm_check_add(win); + elm_object_text_set(ck, "Alpha"); + elm_check_state_set(ck, EINA_TRUE); + evas_object_smart_callback_add(ck, "changed", _alpha_cb, mb); + elm_box_pack_end(hbx, ck); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_object_text_set(ck, "Smooth"); + elm_check_state_set(ck, EINA_TRUE); + evas_object_smart_callback_add(ck, "changed", _smooth_cb, mb); + elm_box_pack_end(hbx, ck); + evas_object_show(ck); + + evas_object_resize(win, 240, 320); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/menu_example_01.c b/libraries/elementary/src/examples/menu_example_01.c new file mode 100644 index 0000000..bb64f29 --- /dev/null +++ b/libraries/elementary/src/examples/menu_example_01.c @@ -0,0 +1,73 @@ +//Compile with: +//gcc -g menu_example_01.c -o menu_example_01 `pkg-config --cflags --libs elementary` + +#include + +static void +_del_it(void *data, Evas_Object *obj, void *event_info) +{ + const Eina_List *l; + Elm_Object_Item *menu_it = elm_menu_first_item_get(data); + menu_it = elm_menu_item_next_get(menu_it); + l = elm_menu_item_subitems_get(menu_it); + elm_object_item_del(eina_list_data_get(l)); +} + +static void +_show(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Down *ev = event_info; + elm_menu_move(data, ev->canvas.x, ev->canvas.y); + evas_object_show(data); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *menu, *button, *rect; + Elm_Object_Item *menu_it, *menu_it1; + + win = elm_win_add(NULL, "menu", ELM_WIN_BASIC); + elm_win_title_set(win, "Menu"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + rect = evas_object_rectangle_add(evas_object_evas_get(win)); + elm_win_resize_object_add(win, rect); + evas_object_color_set(rect, 0, 0, 0, 0); + evas_object_show(rect); + + menu = elm_menu_add(win); + elm_menu_item_add(menu, NULL, NULL, "first item", NULL, NULL); + menu_it = elm_menu_item_add(menu, NULL, "mail-reply-all", "second item", NULL, NULL); + + elm_menu_item_add(menu, menu_it, "object-rotate-left", "menu 1", NULL, NULL); + button = elm_button_add(win); + elm_object_text_set(button, "button - delete items"); + menu_it1 = elm_menu_item_add(menu, menu_it, NULL, NULL, NULL, NULL); + elm_object_item_content_set(menu_it1, button); + evas_object_smart_callback_add(button, "clicked", _del_it, menu); + elm_menu_item_separator_add(menu, menu_it); + elm_menu_item_add(menu, menu_it, NULL, "third item", NULL, NULL); + elm_menu_item_add(menu, menu_it, NULL, "fourth item", NULL, NULL); + elm_menu_item_add(menu, menu_it, "window-new", "sub menu", NULL, NULL); + + menu_it = elm_menu_item_add(menu, NULL, NULL, "third item", NULL, NULL); + elm_object_item_disabled_set(menu_it, EINA_TRUE); + + evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_DOWN, _show, menu); + evas_object_show(menu); + + evas_object_resize(win, 250, 350); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/notify_example_01.c b/libraries/elementary/src/examples/notify_example_01.c new file mode 100644 index 0000000..28456f8 --- /dev/null +++ b/libraries/elementary/src/examples/notify_example_01.c @@ -0,0 +1,79 @@ +//Compile with: +//gcc -o notify_example_01 notify_example_01.c -g `pkg-config --cflags --libs elementary` + +#include + +static void _hide(void *data, Evas_Object *obj, void *event_info); + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *bx, *notify, *content; + + win = elm_win_add(NULL, "notify", ELM_WIN_BASIC); + elm_win_title_set(win, "Notify"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + bx = elm_box_add(win); + elm_box_horizontal_set(bx, EINA_FALSE); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + content = elm_label_add(win); + elm_object_text_set(content, "default"); + evas_object_show(content); + + notify = elm_notify_add(win); + elm_notify_allow_events_set(notify, EINA_FALSE); + elm_notify_timeout_set(notify, 5); + elm_object_content_set(notify, content); + evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(notify); + elm_box_pack_end(bx, notify); + evas_object_smart_callback_add(notify, "block,clicked", _hide, NULL); + + content = elm_label_add(win); + elm_object_text_set(content, "bottom"); + evas_object_show(content); + + notify = elm_notify_add(win); + elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM); + elm_object_content_set(notify, content); + evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(notify); + elm_box_pack_end(bx, notify); + + content = elm_label_add(win); + elm_object_text_set(content, "center"); + evas_object_show(content); + + notify = elm_notify_add(win); + elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_CENTER); + elm_object_content_set(notify, content); + evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(notify); + elm_box_pack_end(bx, notify); + + evas_object_resize(win, 100, 200); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() + +static void +_hide(void *data, Evas_Object *obj, void *event_info) +{ + evas_object_hide(obj); +} diff --git a/libraries/elementary/src/examples/panel_example_01.c b/libraries/elementary/src/examples/panel_example_01.c new file mode 100644 index 0000000..ec9276c --- /dev/null +++ b/libraries/elementary/src/examples/panel_example_01.c @@ -0,0 +1,75 @@ +//Compile with: +//gcc -g panel_example_01.c -o panel_example_01 `pkg-config --cflags --libs elementary` + +#include + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *bx, *panel, *content; + + win = elm_win_add(NULL, "panel", ELM_WIN_BASIC); + elm_win_title_set(win, "Panel"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + bx = elm_box_add(win); + elm_box_horizontal_set(bx, EINA_FALSE); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + panel = elm_panel_add(win); + elm_panel_orient_set(panel, ELM_PANEL_ORIENT_TOP); + elm_panel_toggle(panel); + evas_object_size_hint_weight_set(panel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(panel, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(panel); + elm_box_pack_end(bx, panel); + + content = elm_label_add(win); + elm_object_text_set(content, "content"); + evas_object_show(content); + evas_object_size_hint_min_set(content, 100, 30); + elm_object_content_set(panel, content); + + panel = elm_panel_add(win); + elm_panel_orient_set(panel, ELM_PANEL_ORIENT_RIGHT); + elm_panel_hidden_set(panel, EINA_TRUE); + evas_object_size_hint_weight_set(panel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(panel, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(panel); + elm_box_pack_end(bx, panel); + + content = elm_label_add(win); + elm_object_text_set(content, "content2"); + evas_object_show(content); + evas_object_size_hint_min_set(content, 100, 30); + elm_object_content_set(panel, content); + + panel = elm_panel_add(win); + evas_object_size_hint_weight_set(panel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(panel, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(panel); + elm_box_pack_end(bx, panel); + + content = elm_label_add(win); + elm_object_text_set(content, "content2"); + evas_object_show(content); + evas_object_size_hint_min_set(content, 100, 30); + elm_object_content_set(panel, content); + + + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/panes_example.c b/libraries/elementary/src/examples/panes_example.c new file mode 100644 index 0000000..b8314ca --- /dev/null +++ b/libraries/elementary/src/examples/panes_example.c @@ -0,0 +1,122 @@ +/** + * Simple Elementary's panes widget example, illustrating its + * usage and API. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g panes_example.c -o panes_example `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +static void +_on_done(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_exit(); +} + +static double size = 0.0; + +static void +_press(void *data, Evas_Object *obj, void *event_info) +{ + printf("Pressed\n"); +} + +static void +_unpress(void *data, Evas_Object *obj, void *event_info) +{ + printf("Unpressed, size : %f\n", elm_panes_content_left_size_get(obj)); +} + +static void +_clicked(void *data, Evas_Object *obj, void *event_info) +{ + printf("Clicked\n"); +} + +static void +_clicked_double(void *data, Evas_Object *obj, void *event_info) +{ + if (elm_panes_content_left_size_get(obj) > 0) + { + size = elm_panes_content_left_size_get(obj); + elm_panes_content_left_size_set(obj, 0.0); + printf("Double clicked, hidding.\n"); + } + else + { + elm_panes_content_left_size_set(obj, size); + printf("Double clicked, restoring size.\n"); + } +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *panes, *panes_h, *bt; + + win = elm_win_add(NULL, "panes", ELM_WIN_BASIC); + elm_win_title_set(win, "Panes Example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_focus_highlight_enabled_set(win, EINA_TRUE); + evas_object_show(bg); + + panes = elm_panes_add(win); + elm_win_resize_object_add(win, panes); + evas_object_size_hint_weight_set(panes, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(panes, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(panes); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Left"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bt); + elm_object_part_content_set(panes, "left", bt); + + panes_h = elm_panes_add(win); + elm_panes_horizontal_set(panes_h, EINA_TRUE); + evas_object_size_hint_weight_set(panes_h, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(panes_h, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(panes_h); + elm_object_part_content_set(panes, "right", panes_h); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Up"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bt); + elm_object_part_content_set(panes_h, "left", bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Down"); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bt); + elm_object_part_content_set(panes_h, "right", bt); + + evas_object_smart_callback_add(panes, "clicked", _clicked, panes); + evas_object_smart_callback_add(panes, "clicked,double", _clicked_double, + panes); + evas_object_smart_callback_add(panes, "press", _press, panes); + evas_object_smart_callback_add(panes, "unpress", _unpress, panes); + + evas_object_resize(win, 320, 400); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/photocam_example_01.c b/libraries/elementary/src/examples/photocam_example_01.c new file mode 100644 index 0000000..3bdec8e --- /dev/null +++ b/libraries/elementary/src/examples/photocam_example_01.c @@ -0,0 +1,96 @@ +//Compile with: +//gcc -o photocam_example_01 photocam_example_01.c -g `pkg-config --cflags --libs elementary` -DDATA_DIR="\"\"" +//where directory is the path where images/insanely_huge_test_image.jpg can be found. + +#include + +static void _fit(void *data, Evas_Object *obj, void *event_info); +static void _unfit(void *data, Evas_Object *obj, void *event_info); +static void _zoom(void *data, Evas_Object *obj, void *event_info); +static void _bring_in(void *data, Evas_Object *obj, void *event_info); + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *obj, *photocam; + char buf[PATH_MAX]; + + elm_app_info_set(elm_main, "elementary", "images/insanely_huge_test_image.jpg"); + win = elm_win_add(NULL, "photocam", ELM_WIN_BASIC); + elm_win_title_set(win, "Photocam"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + photocam = elm_photocam_add(win); + snprintf(buf, sizeof(buf), "%s/images/insanely_huge_test_image.jpg", elm_app_data_dir_get()); + elm_photocam_file_set(photocam, buf); + elm_photocam_bounce_set(photocam, EINA_FALSE, EINA_TRUE); + evas_object_smart_callback_add(photocam, "loaded,detail", _bring_in, NULL); + evas_object_resize(photocam, 500, 400); + evas_object_show(photocam); + + obj = elm_button_add(win); + elm_object_text_set(obj, "Fit"); + evas_object_show(obj); + evas_object_resize(obj, 50, 30); + evas_object_move(obj, 10, 410); + evas_object_smart_callback_add(obj, "clicked", _fit, photocam); + + obj = elm_button_add(win); + elm_object_text_set(obj, "Unfit"); + evas_object_show(obj); + evas_object_resize(obj, 70, 30); + evas_object_move(obj, 70, 410); + evas_object_smart_callback_add(obj, "clicked", _unfit, photocam); + + obj = elm_slider_add(win); + elm_object_text_set(obj, "Zoom"); + evas_object_show(obj); + evas_object_resize(obj, 300, 30); + evas_object_move(obj, 150, 410); + evas_object_smart_callback_add(obj, "changed", _zoom, photocam); + + evas_object_resize(win, 500, 440); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() + +static void +_bring_in(void *data, Evas_Object *obj, void *event_info) +{ + int w, h; + elm_photocam_image_size_get(obj, &w, &h); + elm_photocam_image_region_bring_in(obj, w/2, h/2, 500, 400); +} + +static void +_fit(void *data, Evas_Object *obj, void *event_info) +{ + int x, y, w, h; + elm_photocam_image_region_get(data, &x, &y, &w, &h); + printf("region: {%d, %d, %d, %d}\n", x, y, w, h); + elm_photocam_zoom_mode_set(data, ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT); +} + +static void +_unfit(void *data, Evas_Object *obj, void *event_info) +{ + elm_photocam_zoom_mode_set(data, ELM_PHOTOCAM_ZOOM_MODE_MANUAL); +} + +static void +_zoom(void *data, Evas_Object *obj, void *event_info) +{ + double z = elm_slider_value_get(obj) * 8; + elm_photocam_zoom_set(data, z); +} diff --git a/libraries/elementary/src/examples/popup_example_01.c b/libraries/elementary/src/examples/popup_example_01.c new file mode 100644 index 0000000..ee98726 --- /dev/null +++ b/libraries/elementary/src/examples/popup_example_01.c @@ -0,0 +1,60 @@ +//Compile with: +//gcc -o popup_example_01 popup_example_01.c -g `pkg-config --cflags --libs elementary` + +#include + +static void _block_clicked(void *data, Evas_Object *obj, void *event_info); +static void _timeout(void *data, Evas_Object *obj, void *event_info); + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *popup, *content; + + win = elm_win_add(NULL, "popup", ELM_WIN_BASIC); + elm_win_title_set(win, "Popup"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + bg = elm_bg_add(win); + elm_bg_color_set(bg, 128, 128, 128); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + content = elm_label_add(win); + elm_object_text_set(content, "Content"); + + popup = elm_popup_add(win); + elm_popup_timeout_set(popup, 3.0); + evas_object_smart_callback_add(popup, "timeout", _timeout, NULL); + + //Setting popup content + elm_object_content_set(popup, content); + //Seting popup title-text + elm_object_part_text_set(popup, "title,text", "Title"); + evas_object_show(popup); + evas_object_smart_callback_add(popup, "block,clicked", _block_clicked, NULL); + + evas_object_show(win); + evas_object_resize(win, 480, 800); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() + +static void +_block_clicked(void *data, Evas_Object *obj, + void *event_info) +{ + evas_object_hide(obj); +} + +static void +_timeout(void *data, Evas_Object *obj, void *event_info) +{ + evas_object_hide(obj); +} diff --git a/libraries/elementary/src/examples/popup_example_02.c b/libraries/elementary/src/examples/popup_example_02.c new file mode 100644 index 0000000..b66e05f --- /dev/null +++ b/libraries/elementary/src/examples/popup_example_02.c @@ -0,0 +1,83 @@ +//Compile with: +//gcc -o popup_example_02 popup_example_02.c -g `pkg-config --cflags --libs elementary` + +#include + +static void _response_cb(void *data, Evas_Object *obj, void *event_info); + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *popup, *btn1, *btn2, *btn3, *icon1; + char buf[256]; + + elm_app_info_set(elm_main, "elementary", "images/logo_small.png"); + win = elm_win_add(NULL, "popup", ELM_WIN_BASIC); + elm_win_title_set(win, "Popup"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + popup = elm_popup_add(win); + + // Setting popup content-text + elm_object_text_set(popup, "This is the Content-Text for popup. The wrap" + "for the content-text is character wrapping"); + // Setting the wrapping type to character wrapping + elm_popup_content_text_wrap_type_set(popup, ELM_WRAP_CHAR); + + // Seting popup title-text + elm_object_part_text_set(popup, "title,text", "Title"); + + icon1 = elm_icon_add(popup); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(icon1, buf, NULL); + //Setting popup title-icon + elm_object_part_content_set(popup, "title,icon", icon1); + + // Creating the first action button + btn1 = elm_button_add(popup); + elm_object_text_set(btn1, "OK"); + + // Setting the fist action button + elm_object_part_content_set(popup, "button1", btn1); + evas_object_smart_callback_add(btn1, "clicked", _response_cb, popup); + + // Creating the second action button + btn2 = elm_button_add(popup); + elm_object_text_set(btn2, "Cancel"); + + // Setting the second action button + elm_object_part_content_set(popup, "button2", btn2); + evas_object_smart_callback_add(btn2, "clicked", _response_cb, popup); + + btn3 = elm_button_add(popup); + elm_object_text_set(btn3, "Close"); + // Setting this action button + elm_object_part_content_set(popup, "button3", btn3); + // Setting the orientation of popup to Top + elm_popup_orient_set(popup, ELM_POPUP_ORIENT_TOP); + // Display the popup object + evas_object_show(popup); + + evas_object_resize(win, 480, 800); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() + +static void +_response_cb(void *data, Evas_Object *obj, + void *event_info) +{ + evas_object_del(data); +} + diff --git a/libraries/elementary/src/examples/popup_example_03.c b/libraries/elementary/src/examples/popup_example_03.c new file mode 100644 index 0000000..97f09c9 --- /dev/null +++ b/libraries/elementary/src/examples/popup_example_03.c @@ -0,0 +1,99 @@ +//Compile with: +//gcc -o popup_example_03 popup_example_03.c -g `pkg-config --cflags --libs elementary` + +#include + +static void _item_selected_cb(void *data, Evas_Object *obj, void *event_info); +static void _response_cb(void *data, Evas_Object *obj, void *event_info); + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *popup, *btn1, *btn2, *icon1; + Elm_Object_Item *popup_it1; + char buf[256]; + + elm_app_info_set(elm_main, "elementary", "images/logo_small.png"); + win = elm_win_add(NULL, "popup", ELM_WIN_BASIC); + elm_win_title_set(win, "Popup"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + popup = elm_popup_add(win); + + icon1 = elm_icon_add(popup); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(icon1, buf, NULL); + + //Seting popup title-text + elm_object_part_text_set(popup, "title,text", "Title"); + + //Appending popup content-items + elm_popup_item_append(popup, "Message", NULL, _item_selected_cb, NULL); + elm_popup_item_append(popup, "Email", NULL, _item_selected_cb, NULL); + elm_popup_item_append(popup, "Contacts", NULL, _item_selected_cb, NULL); + elm_popup_item_append(popup, "Video", NULL, _item_selected_cb, NULL); + elm_popup_item_append(popup, "Music", NULL, _item_selected_cb, NULL); + elm_popup_item_append(popup, "Memo", NULL, _item_selected_cb, NULL); + popup_it1 = elm_popup_item_append(popup, "Radio", NULL, _item_selected_cb, + NULL); + + //Changing the label of the item + elm_object_item_text_set(popup_it1, "FM"); + elm_popup_item_append(popup, "Messenger", NULL, _item_selected_cb, NULL); + elm_popup_item_append(popup, "Settings", NULL, _item_selected_cb, NULL); + elm_popup_item_append(popup, "App Installer", NULL, _item_selected_cb, NULL); + elm_popup_item_append(popup, "Browser", NULL, _item_selected_cb, NULL); + elm_popup_item_append(popup, "Weather", icon1, _item_selected_cb, NULL); + elm_popup_item_append(popup, "News Feeds", NULL, _item_selected_cb, NULL); + + //Seting popup title-text + elm_object_part_text_set(popup, "title,text", "Title"); + + // Creating the first action button + btn1 = elm_button_add(popup); + elm_object_text_set(btn1, "OK"); + + //Appending the fist action button + elm_object_part_content_set(popup, "button1", btn1); + evas_object_smart_callback_add(btn1, "clicked", _response_cb, popup); + + //Creating the second action button + btn2 = elm_button_add(popup); + elm_object_text_set(btn2, "Cancel"); + evas_object_smart_callback_add(btn2, "clicked", _response_cb, popup); + + //Appending the second action button + elm_object_part_content_set(popup, "button1", btn2); + + //Display the popup object + evas_object_show(popup); + + evas_object_resize(win, 480, 800); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() + +static void +_item_selected_cb(void *data, Evas_Object *obj, + void *event_info) +{ + printf("popup item selected: %s\n", elm_object_item_text_get(event_info)); +} + +static void +_response_cb(void *data, Evas_Object *obj, + void *event_info) +{ + evas_object_hide(data); +} diff --git a/libraries/elementary/src/examples/progressbar_example.c b/libraries/elementary/src/examples/progressbar_example.c new file mode 100644 index 0000000..f7341a2 --- /dev/null +++ b/libraries/elementary/src/examples/progressbar_example.c @@ -0,0 +1,239 @@ +/** + * Simple Elementary's progress bar widget example, illustrating its + * usage and API. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g progressbar_example.c -o progressbar_example `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +typedef struct Progressbar_Example +{ + Evas_Object *pb1; + Evas_Object *pb2; /* pulsing */ + Evas_Object *pb3; + Evas_Object *pb4; + Evas_Object *pb5; /* pulsing */ + Evas_Object *pb6; + Evas_Object *pb7; /* pulsing */ + + Eina_Bool run; + Ecore_Timer *timer; +} Progressbar_Example; + +static Progressbar_Example example_data; + +static Eina_Bool +_progressbar_example_value_set(void *data) +{ + double progress; + + progress = elm_progressbar_value_get(example_data.pb1); + if (progress < 1.0) progress += 0.0123; + else progress = 0.0; + + /* just the non-pulsing ones need an update */ + elm_progressbar_value_set(example_data.pb1, progress); + elm_progressbar_value_set(example_data.pb3, progress); + elm_progressbar_value_set(example_data.pb4, progress); + elm_progressbar_value_set(example_data.pb6, progress); + + if (progress < 1.0) return ECORE_CALLBACK_RENEW; + + example_data.run = 0; + return ECORE_CALLBACK_CANCEL; +} + +static void +_progressbar_example_start(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_progressbar_pulse(example_data.pb2, EINA_TRUE); + elm_progressbar_pulse(example_data.pb5, EINA_TRUE); + elm_progressbar_pulse(example_data.pb7, EINA_TRUE); + + if (!example_data.run) + { + example_data.timer = ecore_timer_add( + 0.1, _progressbar_example_value_set, NULL); + example_data.run = EINA_TRUE; + } +} + +/* end of show */ +static void +_progressbar_example_stop(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_progressbar_pulse(example_data.pb2, EINA_FALSE); + elm_progressbar_pulse(example_data.pb5, EINA_FALSE); + elm_progressbar_pulse(example_data.pb7, EINA_FALSE); + + if (example_data.run) + { + ecore_timer_del(example_data.timer); + example_data.run = EINA_FALSE; + } +} + +static void +_on_done(void *data, + Evas_Object *obj, + void *event_info) +{ + _progressbar_example_stop(NULL, NULL, NULL); + elm_exit(); +} + +EAPI_MAIN int +elm_main(int argc, + char **argv) +{ + Evas_Object *win, *bg, *pb, *bx, *hbx, *bt, *bt_bx, *ic1, *ic2; + char buf[PATH_MAX]; + + elm_app_info_set(elm_main, "elementary", "images/logo_small.png"); + win = elm_win_add(NULL, "progressbar", ELM_WIN_BASIC); + elm_win_title_set(win, "Progress bar example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + elm_win_resize_object_add(win, bx); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bx); + + /* pb with no label, default unit label and no icon */ + pb = elm_progressbar_add(win); + evas_object_size_hint_weight_set(pb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(pb, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, pb); + evas_object_show(pb); + example_data.pb1 = pb; + + /* pb with label, and set to pulse */ + pb = elm_progressbar_add(win); + evas_object_size_hint_align_set(pb, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(pb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_text_set(pb, "Infinite bounce"); + elm_progressbar_pulse_set(pb, EINA_TRUE); + elm_box_pack_end(bx, pb); + evas_object_show(pb); + example_data.pb2 = pb; + + ic1 = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + elm_icon_file_set(ic1, buf, NULL); + evas_object_size_hint_aspect_set(ic1, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + + /* pb with label, icon, custom unit label and span size set */ + pb = elm_progressbar_add(win); + elm_object_text_set(pb, "Label"); + elm_object_part_content_set(pb, "icon", ic1); + elm_progressbar_inverted_set(pb, EINA_TRUE); + elm_progressbar_unit_format_set(pb, "%1.1f units"); + elm_progressbar_span_size_set(pb, 200); + evas_object_size_hint_align_set(pb, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(pb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, pb); + evas_object_show(ic1); + evas_object_show(pb); + example_data.pb3 = pb; + + hbx = elm_box_add(win); + elm_box_horizontal_set(hbx, EINA_TRUE); + evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(hbx, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, hbx); + evas_object_show(hbx); + + /* vertical pb */ + pb = elm_progressbar_add(win); + elm_progressbar_horizontal_set(pb, EINA_FALSE); + evas_object_size_hint_align_set(pb, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(pb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(hbx, pb); + elm_object_text_set(pb, "percent"); + evas_object_show(pb); + example_data.pb4 = pb; + + /* vertical pb, with pulse and custom (small) span size */ + pb = elm_progressbar_add(win); + elm_progressbar_horizontal_set(pb, EINA_FALSE); + evas_object_size_hint_align_set(pb, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(pb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_progressbar_span_size_set(pb, 80); + elm_progressbar_pulse_set(pb, EINA_TRUE); + elm_progressbar_unit_format_set(pb, NULL); + elm_object_text_set(pb, "Infinite bounce"); + elm_box_pack_end(hbx, pb); + evas_object_show(pb); + example_data.pb5 = pb; + + ic2 = elm_icon_add(win); + elm_icon_file_set(ic2, buf, NULL); + evas_object_size_hint_aspect_set(ic2, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1); + + /* vertical pb, inverted, with custom unit format and icon*/ + pb = elm_progressbar_add(win); + elm_progressbar_horizontal_set(pb, EINA_FALSE); + elm_object_text_set(pb, "Label"); + elm_object_part_content_set(pb, "icon", ic2); + elm_progressbar_inverted_set(pb, EINA_TRUE); + elm_progressbar_unit_format_set(pb, "%1.2f%%"); + elm_progressbar_span_size_set(pb, 200); + evas_object_size_hint_align_set(pb, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(pb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(hbx, pb); + evas_object_show(ic2); + evas_object_show(pb); + example_data.pb6 = pb; + + /* "wheel" style progress bar */ + pb = elm_progressbar_add(win); + elm_object_style_set(pb, "wheel"); + elm_object_text_set(pb, "Style: wheel"); + evas_object_size_hint_align_set(pb, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(pb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, pb); + evas_object_show(pb); + example_data.pb7 = pb; + + bt_bx = elm_box_add(win); + elm_box_horizontal_set(bt_bx, EINA_TRUE); + evas_object_size_hint_weight_set(bt_bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, bt_bx); + evas_object_show(bt_bx); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Start"); + evas_object_smart_callback_add(bt, "clicked", _progressbar_example_start, + NULL); + elm_box_pack_end(bt_bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Stop"); + evas_object_smart_callback_add(bt, "clicked", _progressbar_example_stop, + NULL); + elm_box_pack_end(bt_bx, bt); + evas_object_show(bt); + + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/radio_example_01.c b/libraries/elementary/src/examples/radio_example_01.c new file mode 100644 index 0000000..0d6b276 --- /dev/null +++ b/libraries/elementary/src/examples/radio_example_01.c @@ -0,0 +1,90 @@ +//Compile with: +//gcc -g radio_example_01.c -o radio_example_01 `pkg-config --cflags --libs elementary` + +#include + +static int val = 1; + +static void _cb(void *data, Evas_Object *obj, void *event_info); + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *bx, *radio, *group, *ic; + + win = elm_win_add(NULL, "radio", ELM_WIN_BASIC); + elm_win_title_set(win, "Radio"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + bx = elm_box_add(win); + elm_box_horizontal_set(bx, EINA_TRUE); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + group = radio = elm_radio_add(win); + elm_object_text_set(radio, "Radio 1"); + elm_radio_state_value_set(radio, 1); + elm_radio_value_pointer_set(radio, &val); + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "home"); + elm_object_part_content_set(radio, "icon", ic); + elm_box_pack_end(bx, radio); + evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(radio); + evas_object_smart_callback_add(radio, "changed", _cb, NULL); + + radio = elm_radio_add(win); + elm_object_text_set(radio, "Radio 2"); + elm_radio_state_value_set(radio, 2); + elm_radio_value_pointer_set(radio, &val); + elm_radio_group_add(radio, group); + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "file"); + elm_object_part_content_set(radio, "icon", ic); + elm_box_pack_end(bx, radio); + evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(radio); + evas_object_smart_callback_add(radio, "changed", _cb, NULL); + + radio = elm_radio_add(win); + elm_object_text_set(radio, "Radio 3"); + elm_radio_state_value_set(radio, 3); + elm_radio_value_pointer_set(radio, &val); + elm_radio_group_add(radio, group); + elm_box_pack_end(bx, radio); + evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(radio); + evas_object_smart_callback_add(radio, "changed", _cb, NULL); + + radio = elm_radio_add(win); + elm_object_text_set(radio, "Radio 4"); + elm_radio_state_value_set(radio, 4); + elm_box_pack_end(bx, radio); + evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(radio); + + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() + +static void +_cb(void *data, Evas_Object *obj, void *event_info) +{ + printf("val is now: %d\n", val); +} diff --git a/libraries/elementary/src/examples/scroller_example_01.c b/libraries/elementary/src/examples/scroller_example_01.c new file mode 100644 index 0000000..782892b --- /dev/null +++ b/libraries/elementary/src/examples/scroller_example_01.c @@ -0,0 +1,142 @@ +//Compile with: +//gcc -g scroller_example_01.c -o scroller_example_01 `pkg-config --cflags --libs elementary` + +#include + +static const char *text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse bibendum, nibh eget vehicula tempus, libero dui aliquam dui, eget pellentesque nulla est id mi. Sed orci nisl, mattis vitae dignissim scelerisque, imperdiet vel arcu. Integer ut libero id massa commodo dignissim sed at orci. Quisque sollicitudin eleifend malesuada. Donec orci orci, mollis quis euismod vel, tincidunt nec ipsum. Sed ut nulla ligula, ut commodo tellus. Duis non felis in odio fringilla venenatis eget in metus. Mauris molestie ipsum tortor. Suspendisse potenti. Curabitur facilisis ultricies cursus. In euismod viverra risus sit amet pharetra. Sed mauris lorem, volutpat a vehicula quis, interdum nec erat. Suspendisse auctor bibendum fringilla. Curabitur tincidunt sem risus.\ +
\ +Vestibulum laoreet, leo ut sollicitudin viverra, odio enim tempor est, at ullamcorper augue massa sit amet lacus. Phasellus eget orci sit amet sem condimentum semper. Quisque imperdiet purus vitae lacus bibendum ultricies sollicitudin metus interdum. Phasellus aliquam sem vitae mi imperdiet eu cursus ipsum euismod. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam sed tellus non ligula commodo porta sagittis id augue. Vestibulum faucibus vehicula purus, sit amet porttitor ligula lacinia ac. Morbi ipsum libero, rhoncus id dapibus tincidunt, sagittis eget tellus. Proin vehicula accumsan velit cursus pharetra. Nullam pellentesque erat fringilla diam elementum fringilla. Nam lobortis ultricies suscipit. Pellentesque ut ipsum a nisi placerat rutrum id vitae justo. Fusce blandit ligula mollis est auctor scelerisque. Suspendisse luctus nibh vitae nibh congue rutrum. Nunc vulputate diam vel est lacinia a imperdiet purus scelerisque. Maecenas et nisl mauris. Aenean molestie dolor nec lacus laoreet ac dictum sem condimentum. Integer sit amet enim lorem, vitae tincidunt justo. Ut vulputate ullamcorper tortor, eu pharetra nulla aliquet in. Vestibulum ultrices sapien a ligula venenatis eu gravida lacus fermentum.\ +
\ +Etiam dignissim libero sed velit rhoncus ultricies. Aenean porta erat sit amet orci auctor auctor. Suspendisse aliquet arcu ut est ultrices ut venenatis dui scelerisque. Nulla vitae leo massa. Nullam scelerisque felis lectus, sed faucibus mi. Pellentesque hendrerit libero nec metus viverra lobortis. Nulla facilisi. Sed fermentum aliquet velit non imperdiet. Vestibulum nec ante imperdiet dolor convallis ornare sit amet interdum mi. In tellus lorem, lobortis vitae consectetur ac, mattis sed enim. Vivamus nibh enim, convallis sed rutrum sit amet, scelerisque ullamcorper ipsum. Mauris dignissim posuere sagittis. Fusce volutpat hendrerit augue ut dapibus. Aenean eu hendrerit lorem. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;\ +
\ +Nullam orci eros, mattis at gravida sed, iaculis et dolor. Pellentesque sagittis sollicitudin malesuada. Sed tincidunt, sapien in mollis semper, quam enim gravida neque, eu blandit lacus ligula sit amet nisl. Aenean quam nulla, dapibus at venenatis vel, accumsan id dolor. Nam varius urna id nisi tempus ut dignissim nunc ultricies. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Integer lacus tortor, pellentesque auctor venenatis sed, laoreet eget erat. Nunc erat est, pharetra vestibulum luctus et, commodo eu quam. In hac habitasse platea dictumst. In hac habitasse platea dictumst. Nam posuere diam vel felis scelerisque iaculis. Maecenas laoreet ipsum ac orci tempus lobortis.\ +
\ +Sed id massa metus, lobortis porta ipsum. Nullam pellentesque augue sit amet neque hendrerit vehicula eu quis elit. In nec ante massa. Praesent at pulvinar tortor. In laoreet molestie lectus, ut interdum lorem lobortis vitae. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vestibulum ligula sem, interdum eget gravida in, fringilla in sem. Phasellus orci felis, semper rhoncus pharetra a, pellentesque egestas elit. Ut bibendum, est vel gravida tincidunt, enim massa consectetur arcu, vitae pretium sem erat ac nisi. Ut eget erat nisl, eget laoreet arcu. Vivamus risus ipsum, aliquam non ornare et, ornare vel libero. Cras vel ipsum ut magna sagittis interdum at id risus. Morbi justo nulla, volutpat at molestie vel, mollis vitae nisl. Curabitur non erat elit, eu vehicula turpis. Sed eget feugiat neque.\ +
\ +Nulla facilisi. Donec sit amet ante sed lacus adipiscing hendrerit. Vivamus enim nibh, mollis eget elementum vitae, congue non sapien. Maecenas interdum magna vel velit faucibus tempus. Nullam nec nunc risus, lobortis imperdiet magna. Suspendisse potenti. Duis fringilla sodales massa eget egestas. Ut tincidunt adipiscing ante, quis consequat mauris venenatis vitae. Suspendisse mattis sollicitudin accumsan. Duis varius ornare dui ac interdum. Sed molestie elit sit amet dolor varius vel congue nibh varius. Donec semper risus placerat dolor blandit tempus. Etiam id leo sit amet nulla gravida suscipit ut ut metus. Curabitur non elit sit amet sem dapibus interdum ut dictum nunc. Integer ultrices tincidunt faucibus. Nam mollis turpis vitae nulla pulvinar in sodales purus lobortis. Cras nisl lectus, tincidunt a suscipit id, sodales nec nulla. Nulla faucibus pretium feugiat. Nam ullamcorper, ante nec ullamcorper eleifend, nisl est dictum magna, ac rhoncus quam lacus eu neque.\ +
\ +Cras sodales eros eget ligula porttitor tincidunt. Vivamus ac justo non nulla placerat tempor. Quisque ullamcorper venenatis lacus id mollis. Fusce tempor dui ut justo pretium at volutpat velit malesuada. In tellus diam, mattis sit amet viverra eu, porta sit amet metus. Pellentesque ante risus, dictum a rhoncus ut, hendrerit sed nisi. Donec congue dolor eu orci imperdiet id vulputate nulla eleifend. In vel risus urna, sit amet laoreet augue. Donec fringilla massa nec augue scelerisque eget fermentum augue mollis. Maecenas eu eros nulla. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam lobortis, dui id sagittis vestibulum, magna ipsum venenatis sem, vel dapibus leo enim a elit.\ +
\ +Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin lectus felis, aliquet id euismod ac, vestibulum vel leo. Donec venenatis, nunc ornare dictum aliquet, dui purus ullamcorper massa, nec vehicula odio orci nec tortor. Cras sapien ante, laoreet ut placerat nec, mattis in velit. In hac habitasse platea dictumst. Vivamus viverra consectetur augue lobortis dignissim. Ut est nibh, varius at fringilla vitae, viverra at massa. Vivamus mattis bibendum lacus, at dignissim sapien auctor ac. Donec quis mauris lacus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Phasellus vel turpis quis ipsum mattis congue. Integer gravida semper eros vitae tempus. Maecenas volutpat mi vitae purus feugiat volutpat. Praesent ut diam lorem. Maecenas ultrices, felis a vestibulum auctor, neque dui tristique enim, id mollis nunc arcu eget dui. Sed rhoncus, ligula non elementum aliquet, ligula nisi lacinia sapien, sed mattis ipsum nibh et felis.\ +
\ +Nam libero diam, aliquam vel pharetra eu, fringilla sit amet lacus. Nullam varius eros vitae arcu porta ut accumsan massa ultrices. Donec at convallis magna. Proin sit amet dolor et enim fermentum blandit. In urna ligula, molestie lobortis varius eget, aliquam id justo. Maecenas ac viverra lacus. Quisque eros nisl, varius a sollicitudin at, auctor sit amet ligula. Nam in erat non leo volutpat pulvinar. Nulla quis turpis sit amet augue pharetra placerat non vel nunc. In at justo felis, ultrices congue lacus. Etiam sed est velit. Sed elementum, justo sit amet placerat porttitor, elit urna consectetur neque, eget scelerisque dui nisi quis magna. Donec condimentum sollicitudin augue eu volutpat. Etiam vel tempus mauris. Donec et leo eu nisl tempus malesuada sit amet in massa.\ +
\ +In in nulla eu justo venenatis hendrerit a ac ante. Mauris sollicitudin metus at eros volutpat eu tincidunt justo pharetra. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Suspendisse potenti. Nunc purus velit, ornare sit amet pretium eu, congue tincidunt nunc. Maecenas sollicitudin augue sed magna tempor non rhoncus lorem pulvinar. Mauris scelerisque fringilla accumsan. Aliquam et ligula nec lectus dapibus hendrerit. Etiam cursus metus eget odio consectetur sit amet egestas turpis pulvinar. Aenean nec risus vel ante condimentum condimentum. Quisque convallis nunc porta mauris vulputate imperdiet. Etiam varius, nunc sit amet hendrerit convallis, est purus cursus libero, et varius eros leo eget est. Vestibulum a augue nulla, a convallis lacus. Mauris gravida metus ac enim mattis tempor. Etiam accumsan tempor mattis. Fusce dignissim urna at leo pellentesque a blandit nisl faucibus. Fusce consequat auctor nisi ut sodales. Etiam imperdiet velit quis magna consequat placerat. Sed nisl purus, condimentum ac adipiscing vitae, consectetur placerat neque. Morbi molestie sapien sed ante sagittis ullamcorper vel sed erat.\ +
\ +Nunc at risus nec dui viverra imperdiet vitae quis velit. Mauris ornare consectetur lorem, vel blandit risus lacinia vitae. Integer gravida, neque porta malesuada malesuada, leo urna egestas urna, at elementum ligula ipsum non diam. Maecenas lobortis, est eget interdum eleifend, tellus leo suscipit orci, sed fringilla eros nisl at erat. Proin bibendum dictum varius. Sed lectus leo, feugiat quis sollicitudin sit amet, egestas quis lacus. Donec vel est nec leo porttitor sagittis non quis lectus. Nunc in ullamcorper urna. Mauris sit amet porttitor dolor. Praesent eu dui nisi, quis aliquet tortor.\ +
\ +Duis auctor ornare nibh, non mollis augue cursus vitae. Suspendisse accumsan commodo felis, vitae convallis eros volutpat a. Fusce tincidunt, purus laoreet bibendum dignissim, justo felis iaculis velit, ac feugiat tortor turpis non velit. Integer tristique ultricies dolor, at condimentum nunc rutrum vel. Nam a velit nisl, quis hendrerit erat. Nulla sit amet metus pellentesque nulla consectetur venenatis. Nunc auctor, dolor eu ultricies adipiscing, augue dui sollicitudin arcu, ut dictum nisi felis ac leo. Donec tempor erat at nisi aliquam pulvinar. Etiam rutrum massa vitae libero gravida ac ornare justo molestie. Pellentesque non nisl varius nisl laoreet convallis sed porta sem. Donec rhoncus sapien tempus ligula placerat interdum.\ +
\ +Donec varius posuere lorem, a fermentum est molestie eu. Maecenas metus ligula, faucibus ac pharetra vel, accumsan quis mauris. Nulla ultrices, nunc ut tincidunt suscipit, elit dolor bibendum ante, at gravida nisl mi dictum purus. Integer vulputate facilisis nisi, quis porttitor mi iaculis sed. Aenean semper facilisis quam, ut dictum mauris vehicula sed. Sed non sem quis magna ornare egestas ut quis velit. Suspendisse ut quam est, euismod facilisis magna. Etiam mattis pulvinar augue, eget tristique purus porttitor non. Sed egestas dui ac odio auctor convallis. Sed posuere ornare iaculis. Aenean ac nulla ipsum, molestie facilisis eros. Phasellus tincidunt nunc diam. Aliquam malesuada, velit et tincidunt interdum, dolor mi hendrerit velit, quis facilisis ligula dui ac elit. In viverra pretium enim vel tempus.\ +
\ +Morbi at adipiscing nisi. Fusce vel turpis vel libero commodo mollis id iaculis urna. Nullam et elit non lectus egestas semper. Curabitur sodales turpis sit amet metus fringilla quis fermentum orci lacinia. Aenean lacinia feugiat hendrerit. Vivamus nec nisi nec neque lacinia rhoncus ut id erat. Suspendisse luctus tortor sed arcu interdum sit amet aliquet neque vehicula. Curabitur eget nunc vitae libero vulputate dictum. Etiam volutpat fermentum felis fringilla euismod. In scelerisque gravida dolor id molestie. Nam faucibus sapien id neque vehicula semper. Nulla egestas urna vitae sem scelerisque rhoncus. In hac habitasse platea dictumst. Nulla vitae lacus in diam aliquet sollicitudin vel nec leo. Sed ornare pellentesque nibh, a malesuada erat imperdiet et.\ +
\ +Maecenas adipiscing diam a urna interdum pharetra. Phasellus vitae turpis urna, ac consectetur sem. Sed porttitor nulla in nulla mattis tincidunt non eu lacus. Aliquam quis metus turpis. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Pellentesque at sapien quis purus bibendum lobortis. Donec in tincidunt nisl. Phasellus interdum tellus non leo aliquet ut vulputate nisl aliquam. Aliquam faucibus lorem ut lorem convallis non lobortis felis consequat. Phasellus nec leo ac turpis egestas laoreet. Cras venenatis odio et diam faucibus pellentesque. Quisque eu orci magna, quis lacinia tellus.\ +
\ +Aliquam nisl purus, aliquam quis tristique nec, varius eget risus. Nam sed ipsum leo. Proin congue sapien quis libero porta ornare. Mauris vel orci odio. Nam nec felis nibh, non congue odio. Duis vel mattis enim. Maecenas at dui eget ipsum pharetra consequat ac in massa. Proin fringilla arcu non enim feugiat accumsan. Proin tincidunt ligula mattis risus hendrerit in scelerisque risus aliquam. Vivamus libero sapien, ornare ut fringilla ullamcorper, sodales mattis purus. Quisque mauris sem, fermentum vitae adipiscing non, ultricies id mauris. Donec tincidunt, odio vel luctus hendrerit, dui mauris posuere erat, at interdum arcu nunc tincidunt dui. Pellentesque diam orci, malesuada a pellentesque nec, rhoncus at tellus.\ +
\ +Morbi in lacus nunc. Proin congue nisi at nunc gravida imperdiet. Duis et elementum arcu. Cras pretium, tortor in ultrices pharetra, sem ante condimentum elit, at dapibus augue lectus ac est. Pellentesque gravida rutrum pulvinar. Nulla nunc odio, dictum id tempus sit amet, faucibus volutpat nunc. Vestibulum ut ultricies tellus. Donec eget tortor metus, pellentesque placerat eros. Suspendisse ut lacus ipsum, sed fermentum est. Sed interdum ornare augue, sit amet bibendum ligula molestie eget. Aenean ac elit diam, eget ultricies nunc. Nullam quis nibh vitae diam pellentesque viverra. Aliquam ultricies elementum enim tristique malesuada. Vivamus rhoncus faucibus nunc, a pharetra enim sollicitudin ac. Suspendisse ultricies sodales metus vel rhoncus. Integer feugiat euismod molestie. Phasellus iaculis magna imperdiet erat consequat et pretium orci tincidunt.\ +
\ +Morbi tristique cursus consequat. Morbi posuere lacinia odio quis auctor. Nulla dui nisi, tincidunt condimentum aliquam sed, adipiscing cursus sem. Nullam eleifend lacus tempor nisl semper quis cursus velit vehicula. Morbi aliquam, sem at sollicitudin laoreet, nibh erat congue nisi, a pulvinar nulla orci vulputate orci. Morbi eu orci enim, quis aliquam ante. Nam ultricies laoreet varius. Proin vehicula sem vitae dolor ullamcorper et rhoncus lacus cursus. Nullam sit amet mauris sapien, vitae condimentum justo. Cras eu arcu magna. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Phasellus vulputate erat ac diam sagittis dignissim non nec tellus. Vivamus tristique quam vel velit mollis in congue nulla malesuada. Phasellus hendrerit egestas urna vitae egestas. Morbi vitae enim magna. Proin quam tellus, tincidunt ut mollis ut, semper a mi. Vivamus nec pharetra purus. Aenean at lorem mauris, sed facilisis quam. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.\ +
\ +Cras tempor, enim in ullamcorper dignissim, elit eros sodales augue, vel molestie velit tellus sed risus. Suspendisse fermentum, augue id facilisis hendrerit, magna dolor euismod lectus, gravida consequat neque turpis lacinia nisi. Etiam id mi nulla, nec ultrices leo. Aliquam et mi tortor. Duis ullamcorper enim a tellus gravida ornare. Sed interdum, felis eu consequat sagittis, lectus neque ultricies velit, eget egestas ligula quam et mauris. Nunc eu quam enim. Duis tempus, arcu at tristique tristique, justo est gravida orci, vitae hendrerit risus tellus eu urna. Nunc vitae nunc vitae augue malesuada viverra. Etiam nec diam sit amet augue commodo pharetra. Fusce lectus urna, aliquam eget rhoncus tempor, ultrices et lacus.\ +
\ +Phasellus tincidunt, diam et ultricies ornare, ante tortor pretium elit, vitae viverra urna ipsum vel ipsum. Duis semper magna ac mauris rutrum facilisis. Suspendisse mi velit, auctor at rutrum sit amet, lacinia at orci. Phasellus diam magna, vulputate ac accumsan non, ultricies et lorem. Etiam nisi purus, tempor vel aliquet in, egestas sit amet massa. Quisque auctor, dui quis aliquet condimentum, ligula urna rhoncus mi, non vehicula velit sapien eu libero. Nam et elit elit, nec semper enim. Sed quis nulla ut ipsum consequat placerat. Nullam eros risus, congue et tincidunt et, ornare ac nibh. Aliquam vitae neque ac orci tincidunt pharetra. Quisque ac augue iaculis nisi lacinia laoreet. Etiam dolor magna, convallis eu bibendum vel, pellentesque non mi. Etiam eget nibh in metus venenatis hendrerit sit amet ac ligula. Nullam laoreet lobortis fringilla.\ +
\ +Donec non nunc sit amet sem consectetur sodales. Donec nisi ipsum, imperdiet sed commodo nec, placerat ac eros. Sed ac orci sit amet nisl molestie vestibulum. Nam sollicitudin mauris ac eros consequat iaculis. Nam aliquet lobortis ligula, at tempor libero hendrerit id. Vivamus at nisl eget sem dapibus dapibus quis at enim. Nam eget nisi urna. Nam ultrices, nibh ac vehicula dapibus, ante odio vestibulum ante, ut volutpat orci lectus in mi. Aliquam venenatis fermentum condimentum. Aliquam ac lacus elementum nisl molestie auctor ullamcorper sed orci. Nullam tristique metus sit amet purus commodo vulputate. Ut ante turpis, congue non lobortis non, vehicula non diam. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Mauris lobortis magna ac est facilisis in congue orci semper. Etiam et lacus eget elit viverra dictum eu ut neque. Vestibulum diam erat, posuere ut sagittis at, ultrices sed turpis. Cras justo risus, tempus eu facilisis vel, tempus scelerisque est. Vestibulum sagittis mauris ac turpis malesuada tincidunt. Proin et eros eget augue pellentesque tristique non in justo. Integer in leo sit amet lectus convallis rhoncus vitae eu quam.\ +
\ +Nulla eleifend hendrerit sem, vel feugiat mauris pellentesque vel. Vivamus ut lectus enim. Vestibulum nulla lacus, vestibulum et viverra sed, malesuada vitae urna. Integer consectetur, ante eget cursus tristique, lectus felis dignissim ipsum, non mollis arcu dui eu lacus. Integer sed ante ut magna euismod molestie sit amet ut leo. Quisque nec leo dui. Nunc sit amet ligula mi. Etiam sagittis scelerisque neque, ac lobortis lacus feugiat pellentesque. Donec ultricies est vel est tempus non volutpat turpis feugiat. Suspendisse potenti. Vestibulum et velit vitae nisi eleifend tincidunt quis eu odio. Nunc a massa arcu, ut ultrices sem. In eu tempor enim. Praesent aliquam arcu eleifend metus accumsan non pharetra dui ornare. Cras lorem leo, scelerisque sed suscipit at, semper porta magna. Vestibulum pellentesque, erat congue euismod fermentum, mauris purus blandit ligula, at luctus nisl magna in metus. Sed pulvinar, ipsum eget hendrerit egestas, lacus odio posuere tortor, in euismod libero purus id orci. In hac habitasse platea dictumst. Curabitur feugiat semper varius. Aliquam mauris metus, rhoncus in rhoncus non, blandit eget magna.\ +
\ +Cras sapien odio, facilisis id accumsan ut, laoreet sit amet felis. Duis et velit sed tellus volutpat porttitor. Praesent sagittis hendrerit sapien sit amet scelerisque. Vivamus vitae justo at mi venenatis cursus. Nulla est purus, lobortis vel rutrum vel, aliquam in ligula. Sed tortor mauris, pulvinar eget luctus id, faucibus at justo. Phasellus massa quam, tincidunt vel condimentum a, varius vitae tortor. Cras gravida ullamcorper mauris, vel condimentum neque sollicitudin sit amet. Nullam quis justo elit, facilisis dapibus orci. Ut ullamcorper, velit a fermentum elementum, erat erat posuere lacus, egestas iaculis nulla ante eget nibh. Nam ullamcorper leo at diam consectetur molestie. Suspendisse porttitor, eros ac euismod vulputate, tortor libero tempor urna, non pharetra nisl nunc quis sapien. Mauris commodo venenatis risus, eu commodo neque ultricies adipiscing. Nullam ac nunc tortor. Sed consectetur placerat luctus. Curabitur non risus lacus, tristique fermentum quam. Pellentesque viverra, nulla in imperdiet accumsan, eros erat ultrices enim, at adipiscing massa sapien vitae elit. Praesent libero tellus, pharetra et placerat sed, facilisis ut mauris. Phasellus nisl justo, consectetur quis eleifend eget, pulvinar eget erat.\ +
\ +Integer placerat tellus vitae leo luctus ac cursus velit varius. Fusce pulvinar iaculis purus, placerat blandit est imperdiet sit amet. Nulla tincidunt pellentesque tortor ac consequat. Morbi hendrerit, elit non sollicitudin lobortis, massa nunc rhoncus eros, vel egestas felis dolor non nunc. Praesent vel sagittis elit. Mauris pretium leo molestie purus ornare at volutpat risus suscipit. Integer quis orci et magna dapibus gravida. Maecenas metus est, egestas eu interdum nec, suscipit et turpis. Pellentesque eu sagittis ligula. Aenean interdum sem purus. Maecenas interdum nibh aliquam libero aliquam laoreet. Morbi mollis, ligula id vehicula malesuada, velit ipsum euismod nisi, quis mattis turpis neque eu odio. Praesent ultrices vestibulum nisl, non eleifend dui convallis vitae. Pellentesque id sem enim. Morbi eu turpis massa, non fringilla erat. Mauris at metus ut urna luctus rutrum vel in lorem. Donec vel facilisis nisi.\ +
\ +Phasellus sed facilisis mi. Suspendisse mollis sapien vitae lectus tincidunt a molestie nisl feugiat. Etiam sagittis lectus ut risus tempus consectetur. Phasellus non dolor massa, ac consequat mauris. In suscipit, purus sed pretium lacinia, odio tortor vestibulum leo, ac facilisis libero est eget neque. Nullam vel sem sem, vel egestas purus. Etiam tempus sem sit amet purus tempus hendrerit. Sed bibendum lacinia dapibus. In magna ipsum, molestie id mattis ut, posuere semper velit. Fusce ut lectus felis. Vivamus sagittis aliquam leo, ut facilisis tortor iaculis vel. Praesent egestas placerat est, ut congue justo vestibulum sed. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Ut id pellentesque nisi. Fusce bibendum urna eget leo porttitor tincidunt. Nunc blandit condimentum hendrerit. Nullam placerat, risus sed condimentum rhoncus, nisl neque imperdiet metus, condimentum lacinia ipsum elit non felis. Donec sit amet felis et diam adipiscing mattis.\ +
\ +Nulla et nisi ante. Duis ac nisi ut nibh mattis fringilla. Duis sapien lectus, consequat ut feugiat a, feugiat ut nisi. Aenean enim leo, gravida non bibendum id, vulputate eu magna. Suspendisse sed tortor faucibus eros sollicitudin fermentum. Ut cursus tellus ut dolor fermentum et iaculis mauris egestas. Donec sit amet massa leo, eget dignissim ante. Nam dignissim massa a risus lacinia at varius ligula tempus. Vivamus dignissim sem in enim consectetur sagittis. Aenean aliquam hendrerit urna eu aliquet. Donec luctus suscipit odio, ut accumsan neque suscipit vitae. Integer hendrerit facilisis orci feugiat commodo. Praesent vestibulum orci et turpis vehicula vulputate. Sed in purus sit amet tortor sagittis lacinia. Nam nibh justo, rhoncus et ultrices non, venenatis nec ligula. Suspendisse eget lacus sapien, et consequat erat. Ut auctor condimentum magna, ac condimentum magna laoreet volutpat. Sed urna urna, ultricies eget venenatis nec, adipiscing nec tellus.\ +
\ +Praesent viverra dui eget nisl lobortis in malesuada nunc sollicitudin. Aenean bibendum scelerisque metus ac facilisis. Donec est neque, egestas eu aliquet commodo, dictum eu metus. Quisque vel purus in sapien tristique euismod vitae nec eros. Aliquam tincidunt viverra odio. Aenean euismod lectus rutrum eros tempus ut lacinia eros pharetra. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Cras at sapien augue. Sed posuere, dolor nec ullamcorper venenatis, est est pulvinar urna, vel placerat nulla ligula sed eros. Pellentesque nec enim magna. Ut pharetra quam a lectus dapibus eu tristique ante porta. Aliquam vel augue eu risus mollis blandit sit amet vel arcu. Donec lobortis lacinia magna nec aliquet. Suspendisse fermentum magna eget est posuere nec pellentesque enim accumsan.\ +
\ +Vivamus commodo urna sit amet enim iaculis vel accumsan odio interdum. Etiam est lectus, fringilla in fermentum nec, imperdiet sit amet sapien. Suspendisse vitae lacus vel elit convallis iaculis non eu tellus. In nec dolor diam. Mauris sed tortor id ligula vestibulum mollis sit amet a neque. In hac habitasse platea dictumst. Donec a velit vel nunc ornare euismod sit amet vitae risus. Sed ultrices semper nibh, quis gravida magna dapibus ac. Fusce ut ligula velit. Aenean non mollis augue. Proin ut ligula nisi. Duis nec consequat dui. Praesent vel mauris orci. Nullam est nunc, ultrices ultricies suscipit et, adipiscing in augue. Sed porttitor mi in nunc euismod tincidunt.\ +
\ +Quisque laoreet congue augue quis cursus. Donec sed nisl odio. Etiam rhoncus fermentum lacus, quis pharetra urna semper vitae. Quisque non nisi at nunc volutpat porttitor. Donec ligula massa, suscipit non facilisis vitae, lacinia sit amet lacus. Fusce vel turpis orci. Etiam quis ligula eu nibh tincidunt posuere. Mauris sit amet quam leo, porta interdum diam. Nullam purus metus, facilisis quis ullamcorper vitae, mattis ultrices ante. Sed tincidunt lorem aliquet magna ultrices eleifend. In non nisi orci. In imperdiet, tellus eget fringilla elementum, lorem magna faucibus libero, id placerat turpis enim eget erat. Ut eros justo, ullamcorper ut sagittis eu, condimentum in arcu. Proin vel nisi ligula, vitae hendrerit purus. Vestibulum dignissim pulvinar consectetur. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Suspendisse ac eros risus.\ +
\ +Cras at massa quam. Cras eget dolor tortor. Mauris non nisl sapien. Maecenas dictum tincidunt erat nec tincidunt. Maecenas vestibulum lobortis varius. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin adipiscing tincidunt mauris quis fringilla. Maecenas sit amet ligula vitae neque tincidunt pulvinar quis id orci. Pellentesque sagittis tellus eget leo dapibus tempor. Duis eu diam non justo tincidunt gravida. Cras eros dolor, sodales eget elementum et, adipiscing in enim. Suspendisse at elit elit, id dignissim nisl. Donec imperdiet, quam vitae mattis hendrerit, leo arcu sagittis massa, a placerat urna sapien viverra tortor. Integer auctor, felis non condimentum ultrices, lectus ligula vestibulum eros, non pharetra libero purus eu purus. Duis ornare lacinia erat vitae sagittis. Sed fringilla volutpat magna, id auctor nisi elementum ut. Nulla facilisi. Quisque ut quam elit, ac consequat ligula.\ +
\ +Etiam fringilla lobortis mauris, in ullamcorper elit vestibulum eu. Ut dolor nisi, egestas vel consequat sit amet, faucibus vel nulla. Etiam vitae nibh ut dui imperdiet accumsan vel quis arcu. Suspendisse potenti. Ut vitae tellus risus, eu imperdiet eros. Nam vitae lacus a leo pulvinar feugiat. Donec augue mauris, suscipit porta euismod at, viverra vel magna. Cras luctus viverra neque, sit amet venenatis mi consequat id. Nulla consequat consequat nunc, eget mattis nisl tempor id. Praesent mattis sagittis tortor sed feugiat. Nunc vitae nisl est, a feugiat orci. Fusce in ipsum mauris. Etiam mattis sollicitudin nisi eu imperdiet. Duis in laoreet libero. Aenean eleifend est sit amet purus ultricies pretium. Morbi id nisl ut purus tempus sollicitudin quis non tellus. Donec sed quam ac nisl cursus euismod eu euismod eros.\ +
\ +Suspendisse mattis elementum sapien. Aliquam erat volutpat. Sed a tortor vitae nisi ornare vehicula. Praesent id faucibus sem. Mauris luctus ornare ipsum, id euismod lorem fermentum id. Maecenas egestas, mi sit amet porta facilisis, erat elit pretium nunc, ut mollis ipsum metus iaculis ligula. Duis semper ligula rhoncus nibh vehicula in scelerisque diam rhoncus. Vivamus quam magna, ultricies et posuere sed, mollis tristique est. Vivamus consectetur cursus diam, vitae pharetra nisi aliquam et. Nulla tortor sem, molestie quis pellentesque nec, tincidunt a libero. Proin tincidunt purus ut purus ornare dictum. Proin vehicula orci eu eros aliquam eu posuere turpis lobortis. Vivamus dapibus bibendum tristique. Donec facilisis fringilla mauris nec consequat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse ac nunc nec lacus interdum adipiscing eget vel quam. Duis rhoncus urna quis nisl elementum laoreet. Integer euismod tincidunt pulvinar.\ +
\ +Sed congue scelerisque blandit. Nam pharetra, nisi at auctor elementum, dolor elit bibendum mauris, congue feugiat arcu turpis non tortor. Cras tincidunt tellus sit amet nulla fermentum adipiscing. Mauris imperdiet purus vel nulla tempor vel elementum metus tempor. Aliquam eu dolor ut risus scelerisque commodo. Ut adipiscing nisl eget nisl mollis semper. Vestibulum arcu augue, sodales convallis venenatis ac, egestas euismod metus. Cras luctus elit sed nisl faucibus at accumsan lectus pharetra. Nunc rhoncus turpis est, vitae luctus turpis. Mauris tempus, velit sit amet feugiat consequat, tortor diam scelerisque urna, sit amet convallis est nisi quis dolor. Vivamus facilisis tellus quis sapien dapibus at sodales elit feugiat. Cras varius laoreet urna, eu tincidunt orci iaculis in. Sed quis lacus ac ligula aliquam egestas. Nam mattis massa sed magna lacinia pharetra. Sed semper faucibus mauris, ut consectetur libero tristique nec.\ +
\ +Proin vel elit id ante lacinia molestie quis in lectus. Nunc in ante nulla. Nam nec sem sed felis placerat rutrum. Sed pharetra molestie metus facilisis ornare. In sed nunc vel tellus volutpat dictum. Nunc risus enim, congue vel fermentum sed, varius eget elit. Proin vitae mi tortor. Pellentesque ut justo ligula. Nunc nibh elit, mattis at iaculis ac, pretium fermentum dui. Praesent in quam turpis. Quisque id velit eros. Nulla facilisi. Maecenas commodo dignissim libero nec pharetra. Praesent eget augue nec odio scelerisque sagittis. Donec nec dui dolor. Donec est nisi, faucibus vitae ultricies quis, cursus vel lorem. Nulla suscipit ultricies dui, vitae volutpat risus fermentum sit amet.\ +
\ +Morbi eu libero urna. Aliquam et nunc nec risus varius aliquet. Aenean semper sem sed purus ornare aliquam. Maecenas lobortis tristique nibh, id fermentum est egestas vel. Nam ut tortor pharetra augue rhoncus vulputate et et nisl. Donec scelerisque aliquet convallis. Quisque felis tellus, aliquet eu fermentum sed, mollis et lorem. Vivamus imperdiet, mauris at imperdiet tempor, elit justo aliquet purus, vitae vulputate dui elit euismod nulla. Nam nisl sem, laoreet at fermentum eu, eleifend vel quam. Duis venenatis hendrerit felis eget viverra. Aenean tincidunt ultrices pulvinar. Duis at risus tellus, sed euismod ipsum. Donec sit amet dui quam. Praesent at nunc a turpis sollicitudin faucibus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam tincidunt accumsan lacinia. Nunc blandit gravida urna, quis venenatis metus mollis vel. Cras a nunc ac tortor aliquam fermentum ac sed purus. Etiam porttitor tincidunt risus, et scelerisque velit egestas vitae. Nulla at arcu sed sapien vehicula laoreet.\ +
\ +Pellentesque rhoncus odio id ante porttitor mollis. Nullam non mi vel erat suscipit lobortis. Vivamus urna neque, gravida ac interdum eget, commodo sit amet nunc. Maecenas libero nisl, bibendum eget tristique eget, laoreet vitae arcu. Maecenas porta diam vel libero tempus fermentum. Aenean molestie fringilla magna, tincidunt condimentum nunc aliquam nec. Mauris congue commodo lacus, in condimentum orci posuere id. Maecenas in ultrices ipsum. Nam sit amet orci nisi, ac lacinia nibh. Nullam molestie lorem eget felis interdum nec semper neque ultrices. Nunc et leo eu leo faucibus euismod. Suspendisse potenti. Vivamus id enim sed augue rutrum volutpat.\ +
\ +Curabitur facilisis placerat mi nec consectetur. Sed sed ante orci. Aliquam dapibus egestas dapibus. Aliquam feugiat urna ut libero adipiscing sed consectetur nulla mollis. Donec lacinia condimentum libero a egestas. Vivamus vestibulum ipsum ante, vitae fermentum libero. In hac habitasse platea dictumst. Ut sed quam libero. Aliquam bibendum sollicitudin faucibus. Nam elit felis, pulvinar vitae convallis id, fermentum sed leo. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec dolor neque, vehicula commodo vulputate et, faucibus id nisi.\ +
\ +Vestibulum id metus in lectus iaculis aliquet rhoncus sit amet justo. Phasellus ac arcu ac felis auctor volutpat vitae nec mauris. Integer convallis, eros vel molestie tempor, odio enim posuere libero, quis iaculis elit ipsum eu eros. Sed metus diam, elementum ut scelerisque eu, scelerisque suscipit tellus. Aliquam congue fringilla sapien, vitae viverra arcu egestas sed. Donec quis lacus ipsum, ac faucibus eros. Suspendisse potenti. Cras non ipsum et dui tristique interdum. Vivamus ultrices vestibulum augue. Donec ac lacus quam, nec commodo eros. Quisque ac lacus lorem, vitae pellentesque nisl. Aliquam nec justo augue, quis porta tortor. Cras sit amet egestas eros. Duis neque ante, vulputate vel faucibus eu, sodales nec justo. Sed sagittis egestas orci sed lobortis. Donec eget consectetur nulla.\ +
\ +Vivamus mollis sodales ligula non imperdiet. Duis eget volutpat velit. Nunc eu dolor felis. Vestibulum massa augue, convallis in facilisis eget, vestibulum in mi. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Duis non ante enim, non volutpat massa. Mauris nunc turpis, dignissim non egestas vel, tristique id sem. Phasellus magna purus, scelerisque eget varius in, convallis id enim. Sed eu dolor neque, nec porta odio. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed aliquam pharetra diam id pharetra. Nulla lectus orci, condimentum sed malesuada vulputate, dictum quis purus.\ +
\ +Pellentesque quis lorem orci, commodo faucibus lectus. Nullam cursus, purus in porttitor tincidunt, enim ligula sagittis urna, eu fermentum velit eros a sapien. Maecenas ornare, mi eget faucibus malesuada, leo justo lobortis erat, et lobortis massa dolor ac augue. Nulla pulvinar malesuada lorem, id venenatis nulla pulvinar non. Praesent ac augue tortor, a feugiat risus. Vestibulum molestie ultrices felis vel fermentum. Maecenas feugiat eros non libero tempus condimentum sed sed metus. Sed sagittis metus et dui facilisis vitae vehicula massa convallis. Morbi sed ante nulla, nec posuere lorem. Donec euismod fringilla diam, in suscipit libero eleifend nec. Donec tristique scelerisque nibh sed euismod. Ut sed felis erat, ullamcorper vehicula sapien. Nunc pharetra interdum pretium. Nunc a mauris orci. Cras eu quam justo.\ +
\ +Proin ultricies dolor sit amet eros sollicitudin nec pulvinar tortor luctus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin imperdiet turpis sit amet libero placerat in mattis quam molestie. Quisque luctus sem libero, vel venenatis purus. Ut vehicula egestas risus in pulvinar. Etiam ut vehicula est. Quisque commodo erat id est mattis pretium. Ut lobortis mauris a magna eleifend ultrices. Donec lacinia pharetra nisi, nec laoreet lacus varius et. Morbi risus diam, pulvinar a convallis id, blandit in lorem. Mauris quis tempor mi. Integer at nisi sapien. Integer dignissim consectetur tellus id rutrum. Nulla odio augue, sagittis in vestibulum ac, viverra convallis purus. Aliquam commodo mi id nibh bibendum vel viverra arcu consequat. Proin ipsum velit, ultrices id egestas nec, gravida eu dolor. Duis facilisis orci eu turpis feugiat ullamcorper. Integer venenatis metus non erat facilisis vel consectetur lectus varius. Nunc ac leo magna, a aliquet felis. Curabitur malesuada, arcu quis interdum lacinia, sapien sem condimentum ante, ac lacinia purus metus at orci.\ +
\ +Sed venenatis neque eu arcu bibendum imperdiet. Maecenas eget augue quis enim pretium cursus vitae venenatis dolor. Maecenas sit amet mauris mi. Aliquam luctus, dolor varius rhoncus rhoncus, diam turpis bibendum dui, eu hendrerit arcu nibh nec orci. Praesent condimentum, leo et commodo vulputate, purus odio interdum est, sed aliquam tellus lectus ut justo. Aenean pulvinar luctus dapibus. Nulla tempus, ante vel dictum ultricies, massa urna tincidunt libero, ut rhoncus risus turpis eget arcu. Morbi auctor commodo libero, in pretium quam vestibulum nec. Aenean ac tincidunt nulla. Cras vel orci enim. Praesent non metus ipsum.\ +
\ +Praesent ligula nulla, aliquam in tincidunt eu, lacinia eget neque. Integer tincidunt neque in risus malesuada gravida. Nullam ornare viverra nisl vel interdum. Nullam eget lectus a ipsum condimentum aliquam sit amet eu felis. Nam eu nisl enim. In pulvinar tincidunt ultrices. Morbi mi ipsum, placerat sit amet mollis vel, tincidunt vel nisi. In sed eros non magna sodales convallis pulvinar non turpis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Fusce volutpat egestas elit, in lobortis urna egestas vitae. Nulla non tincidunt massa. Praesent ut convallis nunc. Morbi quis massa non lacus lobortis tempor non id libero. Proin turpis ante, porta et ullamcorper sit amet, malesuada vitae nisl. Suspendisse faucibus, ipsum quis varius porta, tellus augue porta arcu, nec posuere massa libero sed enim. Sed id suscipit ante. Ut fringilla sagittis orci porta tincidunt. Proin non massa sem. Nullam sollicitudin mauris et lorem euismod ut eleifend neque tempus.\ +
\ +Duis est est, rhoncus vel feugiat sed, iaculis id arcu. Donec ultrices lacinia dapibus. Fusce accumsan malesuada dolor, vitae viverra quam condimentum et. Sed id tellus lacus, ut sollicitudin turpis. Donec egestas ante et nunc consequat dapibus. Duis rutrum scelerisque orci, sollicitudin congue lectus condimentum non. In quis lacus et justo pellentesque vehicula. Nulla accumsan hendrerit lectus, non ornare nibh vehicula vitae. Sed iaculis dapibus laoreet. Nunc rutrum eleifend mi, ac interdum augue egestas nec. Morbi feugiat tincidunt eros, sit amet congue nisl ultricies sed. Nulla id est non dolor mattis lacinia. Mauris quis faucibus libero. Phasellus facilisis, massa a dapibus elementum, augue magna auctor tellus, nec placerat lorem lacus in purus. Morbi congue ipsum in dui euismod eleifend auctor eros eleifend. Pellentesque porttitor tincidunt pharetra. Maecenas quis tellus sed arcu convallis ultrices mollis ut neque.\ +
\ +Duis non sem ut mi facilisis pretium sit amet a erat. Suspendisse dignissim nisl nec risus tincidunt vitae ultrices arcu bibendum. Donec condimentum ullamcorper ipsum at vehicula. Donec interdum, odio vel blandit aliquet, nisi urna iaculis ligula, a ullamcorper mi ligula nec ligula. Curabitur pellentesque, augue id volutpat aliquet, lorem enim auctor sem, at tempus nibh augue ac diam. Etiam interdum lorem non nisi tempus vestibulum ut convallis elit. Cras cursus facilisis velit eget consectetur. Duis faucibus nulla sed leo accumsan et pharetra turpis aliquet. Curabitur ullamcorper tincidunt sapien lacinia suscipit. Curabitur consectetur, urna nec tempor lobortis, massa lectus accumsan turpis, vitae semper erat leo at dui. Sed ut facilisis velit. Ut vestibulum dapibus gravida. Quisque pellentesque auctor tortor eu malesuada. Vestibulum mauris dolor, tristique sit amet varius sit amet, varius eget neque. Curabitur in urna sit amet mi cursus pharetra sit amet at odio. Vivamus enim neque, tincidunt id adipiscing ac, volutpat non massa. Quisque gravida malesuada felis, eu aliquam nulla vestibulum id. Nullam eleifend ultricies cursus.\ +
\ +Pellentesque rutrum elementum orci, nec feugiat nisl vehicula nec. Suspendisse quis turpis ipsum. Maecenas eleifend nibh sit amet nisi auctor at auctor libero auctor. Suspendisse potenti. Morbi nec orci quis quam porttitor malesuada. Curabitur blandit luctus lacinia. Cras id turpis neque, a luctus justo. Morbi nec turpis risus. Fusce posuere urna sed nisl scelerisque mattis. Cras leo neque, dignissim ut vestibulum at, viverra in magna. Proin tellus leo, cursus eu porta id, eleifend in purus. Integer ut sapien leo, sed aliquet diam. Proin hendrerit imperdiet tincidunt.\ +
\ +Quisque rutrum urna non mi commodo vitae vestibulum velit tincidunt. Pellentesque vitae dolor et leo porta consectetur. Fusce semper eleifend tincidunt. In hac habitasse platea dictumst. Nulla mollis, dui in malesuada feugiat, sapien sapien porttitor nulla, at congue metus turpis vel arcu. Phasellus quis enim eu quam varius interdum quis lobortis magna. Quisque augue orci, suscipit eu malesuada ac, convallis id tortor. Fusce et tortor a mi fringilla congue. Praesent iaculis justo vel leo fringilla sodales. Nullam egestas, orci scelerisque placerat sagittis, diam tellus semper libero, in imperdiet neque sapien eget magna. Etiam eget massa orci, at interdum neque. Integer molestie enim eu sapien pellentesque lobortis a ac urna. Donec eu elit sit amet nunc bibendum faucibus et vel orci. Sed fringilla tristique sollicitudin. Donec rutrum pellentesque velit luctus suscipit. Aliquam lobortis sollicitudin ante at consectetur. Praesent nulla sapien, condimentum quis ornare quis, consequat sit amet arcu. Suspendisse potenti.\ +
\ +Ut volutpat lorem in lorem malesuada ultricies. Nunc nec eros lorem, ac iaculis velit. Donec vel metus lorem, a suscipit odio. Aliquam tincidunt nulla sit amet urna porttitor pulvinar. Cras adipiscing venenatis nibh a viverra. Etiam a metus nibh. Praesent sodales feugiat dolor, in scelerisque purus dapibus commodo. Mauris non mi metus. Fusce a aliquet ante. Aliquam erat volutpat. Praesent nec condimentum elit. Sed posuere orci et tortor volutpat sollicitudin. Vestibulum bibendum convallis dolor, non hendrerit velit consectetur eu. Aenean pharetra neque ac felis sollicitudin a ornare nunc accumsan. Aenean luctus dolor non purus lobortis sodales eget eget libero. Vivamus risus quam, vestibulum in ullamcorper et, vestibulum sit amet nunc. Ut odio felis, condimentum eget venenatis ut, suscipit ac sem. Nulla sit amet leo a metus hendrerit vehicula at vitae ante.\ +
\ +Aliquam diam leo, ultrices a sodales sed, laoreet id purus. Nullam eleifend leo vitae nisi euismod ac posuere elit tempus. Phasellus sed tellus est, eget fringilla diam. Aenean tempor enim quis nisi congue vitae placerat turpis vehicula. Proin congue, risus in pretium euismod, lacus tellus porttitor nulla, eget egestas lacus orci id orci. Proin nulla mauris, feugiat imperdiet consectetur id, condimentum ac libero. Donec consectetur leo a elit tincidunt vitae luctus nisl porta. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent sit amet orci quis dolor molestie commodo. Integer placerat risus neque. Phasellus non laoreet tellus. Nam pulvinar pellentesque nibh, egestas suscipit nisl gravida ac. Quisque sodales lorem imperdiet orci consequat ultricies. Phasellus fringilla diam id neque facilisis pharetra.\ +
\ +Nam scelerisque nulla ut neque tempor blandit volutpat nisl vehicula. Nam orci enim, luctus ut venenatis et, egestas id nunc. Phasellus risus sem, scelerisque sed vestibulum a, aliquam at sem. Sed venenatis tristique nisi id eleifend. Morbi urna tellus, cursus ac porttitor rhoncus, commodo at mi. Mauris ac magna nisi. Maecenas rutrum lobortis sapien, sed dapibus neque hendrerit a. Aliquam fringilla lectus nec arcu tempor et molestie dui suscipit. Proin et felis velit, vel pellentesque ligula. Donec tempus, mi at mollis porttitor, mauris urna congue elit, at varius nisi elit et est. Quisque eu libero lorem, eget tincidunt velit. Nullam hendrerit metus quis urna adipiscing quis tristique tortor condimentum. Integer iaculis scelerisque sem, vitae consectetur lorem facilisis eu. Phasellus consectetur blandit auctor. Morbi eleifend mollis ipsum, id facilisis leo euismod ut. Nunc id est tellus."; + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *label, *scroller; + + win = elm_win_add(NULL, "scroller", ELM_WIN_BASIC); + elm_win_title_set(win, "Scroller"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + label = elm_label_add(win); + elm_object_text_set(label, text); + evas_object_show(label); + + scroller = elm_scroller_add(win); + elm_win_resize_object_add(win, scroller); + evas_object_show(scroller); + elm_object_content_set(scroller, label); + elm_scroller_bounce_set(scroller, EINA_TRUE, EINA_FALSE); + elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_ON, ELM_SCROLLER_POLICY_ON); + elm_scroller_propagate_events_set(scroller, EINA_TRUE); + elm_scroller_page_relative_set(scroller, 0, 1); + elm_scroller_region_show(scroller, 50, 50, 200, 200); + + evas_object_resize(win, 400, 400); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/segment_control_example.c b/libraries/elementary/src/examples/segment_control_example.c new file mode 100644 index 0000000..bd98037 --- /dev/null +++ b/libraries/elementary/src/examples/segment_control_example.c @@ -0,0 +1,83 @@ +/** + * Simple Elementary's segment_control widget example, illustrating its + * usage and API. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g segment_control_example.c -o segment_control_example `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +static void +_on_done(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_exit(); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *sc, *ic; + Elm_Object_Item *seg_it; + int count, idx; + + win = elm_win_add(NULL, "segment_control", ELM_WIN_BASIC); + elm_win_title_set(win, "Segment Control Example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + sc = elm_segment_control_add(win); + evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, sc); + evas_object_show(sc); + + elm_segment_control_item_add(sc, NULL, "only text"); + + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "close"); + elm_segment_control_item_add(sc, ic, NULL); + + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "home"); + elm_segment_control_item_add(sc, ic, "Home"); + + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "close"); + elm_segment_control_item_add(sc, ic, ""); + + count = elm_segment_control_item_count_get(sc); + elm_segment_control_item_insert_at(sc, NULL, "Inserted at", count - 1); + + seg_it = elm_segment_control_item_insert_at(sc, NULL, "To be deleted", 2); + elm_object_item_del(seg_it); + + elm_segment_control_item_insert_at(sc, NULL, "To be deleted", 2); + elm_segment_control_item_del_at(sc, 2); + + seg_it = elm_segment_control_item_get(sc, 0); + elm_object_item_text_set(seg_it, "Only Text"); + + count = elm_segment_control_item_count_get(sc); + seg_it = elm_segment_control_item_get(sc, count / 2); + elm_segment_control_item_selected_set(seg_it, EINA_TRUE); + seg_it = elm_segment_control_item_selected_get(sc); + idx = elm_segment_control_item_index_get(seg_it); + printf("Item selected: %i\n", idx); + + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/separator_example_01.c b/libraries/elementary/src/examples/separator_example_01.c new file mode 100644 index 0000000..344784d --- /dev/null +++ b/libraries/elementary/src/examples/separator_example_01.c @@ -0,0 +1,55 @@ +//Compile with: +//gcc -g separator_example_01.c -o separator_example_01 `pkg-config --cflags --libs elementary` + +#include + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *bx, *rect, *separator; + + win = elm_win_add(NULL, "separator", ELM_WIN_BASIC); + elm_win_title_set(win, "Separator"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + bx = elm_box_add(win); + elm_box_horizontal_set(bx, EINA_TRUE); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + rect = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(rect, 0, 255, 0, 255); + evas_object_size_hint_min_set(rect, 90, 200); + evas_object_size_hint_weight_set(rect, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(rect, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(rect); + elm_box_pack_end(bx, rect); + + separator = elm_separator_add(win); + elm_separator_horizontal_set(separator, EINA_TRUE); + evas_object_show(separator); + elm_box_pack_end(bx, separator); + + rect = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(rect, 0, 0, 255, 255); + evas_object_size_hint_min_set(rect, 90, 200); + evas_object_size_hint_weight_set(rect, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(rect, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(rect); + elm_box_pack_end(bx, rect); + + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/slider_example.c b/libraries/elementary/src/examples/slider_example.c new file mode 100644 index 0000000..14d70c0 --- /dev/null +++ b/libraries/elementary/src/examples/slider_example.c @@ -0,0 +1,149 @@ +/** + * Simple Elementary's slider widget example, illustrating its + * usage and API. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g slider_example.c -o slider_example `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +static void +_on_done(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_exit(); +} + +static void +_changed_cb(void *data, Evas_Object *obj, void *event_info) +{ + double val = elm_slider_value_get(obj); + printf("Changed to %1.2f\n", val); +} + +static void +_delay_changed_cb(void *data, Evas_Object *obj, void *event_info) +{ + double val = elm_slider_value_get(obj); + printf("Delay changed to %1.2f\n", val); +} + +static char* +_indicator_format(double val) +{ + char *indicator = malloc(sizeof(char) * 32); + snprintf(indicator, 32, "%1.2f u", val); + return indicator; +} + +static void +_indicator_free(char *str) +{ + free(str); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *bx, *sl, *ic; + + win = elm_win_add(NULL, "slider", ELM_WIN_BASIC); + elm_win_title_set(win, "Slider Example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + /* default */ + sl = elm_slider_add(win); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sl); + evas_object_show(sl); + + /* with icon, end and label */ + sl = elm_slider_add(win); + elm_object_text_set(sl, "Counter"); + + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "home"); + elm_icon_resizable_set(ic, EINA_FALSE, EINA_FALSE); + elm_object_part_content_set(sl, "icon", ic); + + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "folder"); + elm_icon_resizable_set(ic, EINA_FALSE, EINA_FALSE); + elm_object_part_content_set(sl, "end", ic); + + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sl); + evas_object_show(sl); + + /* value set and span size */ + sl = elm_slider_add(win); + elm_slider_value_set(sl, 1); + elm_slider_span_size_set(sl, 200); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sl); + evas_object_show(sl); + + /* with unit label and min - max */ + sl = elm_slider_add(win); + elm_slider_unit_format_set(sl, "%1.0f units"); + elm_slider_min_max_set(sl, 0, 100); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sl); + evas_object_show(sl); + + /* with indicator label and inverted */ + sl = elm_slider_add(win); + elm_slider_indicator_format_set(sl, "%1.2f"); + elm_slider_inverted_set(sl, EINA_TRUE); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sl); + evas_object_show(sl); + + /* vertical with indicator format func */ + sl = elm_slider_add(win); + elm_slider_horizontal_set(sl, EINA_FALSE); + elm_slider_indicator_format_function_set(sl, _indicator_format, + _indicator_free); + evas_object_size_hint_align_set(sl, 0.5, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(sl, 0, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sl); + evas_object_show(sl); + + /* callbacks */ + sl = elm_slider_add(win); + elm_slider_unit_format_set(sl, "%1.3f units"); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sl); + evas_object_show(sl); + evas_object_smart_callback_add(sl, "changed", _changed_cb, NULL); + evas_object_smart_callback_add(sl, "delay,changed", _delay_changed_cb, NULL); + + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/slideshow_example.c b/libraries/elementary/src/examples/slideshow_example.c new file mode 100644 index 0000000..db011b8 --- /dev/null +++ b/libraries/elementary/src/examples/slideshow_example.c @@ -0,0 +1,323 @@ +/** + * Simple Elementary's slide show widget example, illustrating its + * usage and API. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -o slideshow_example slideshow_example.c -g `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +static void +_on_done(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_exit(); +} + +static Evas_Object *slideshow, *bt_start, *bt_stop; +static Elm_Slideshow_Item_Class itc; + +static char img1[256], img2[256], img3[256], img4[256], img5[256], img6[256], img7[256], img8[256], img9[256]; + +static void +_notify_show(void *data, + Evas *e, + Evas_Object *obj, + void *event_info) +{ + evas_object_show(data); +} + +/* jump to next item, cyclically */ +static void +_next(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_slideshow_next(data); +} + +static void +_previous(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_slideshow_previous(data); +} + +static void +_first(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_slideshow_item_show(data); +} + +static void +_last(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_slideshow_item_show(data); +} + +static void +_mouse_in(void *data, + Evas *e, + Evas_Object *obj, + void *event_info) +{ + elm_notify_timeout_set(data, 0.0); + evas_object_show(data); +} + +static void +_mouse_out(void *data, + Evas *e, + Evas_Object *obj, + void *event_info) +{ + elm_notify_timeout_set(data, 3.0); +} + +/* transition changed */ +static void +_transition_select(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_slideshow_transition_set(slideshow, data); + elm_object_text_set(obj, data); +} + +static void +_layout_select(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_slideshow_layout_set(slideshow, data); + elm_object_text_set(obj, data); +} + +/* start the show! */ +static void +_start(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_slideshow_timeout_set(slideshow, elm_spinner_value_get(data)); + + elm_object_disabled_set(bt_start, EINA_TRUE); + elm_object_disabled_set(bt_stop, EINA_FALSE); +} + +static void +_stop(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_slideshow_timeout_set(slideshow, 0.0); + elm_object_disabled_set(bt_start, EINA_FALSE); + elm_object_disabled_set(bt_stop, EINA_TRUE); +} + +/* slideshow transition time has changed */ +static void +_spin(void *data, + Evas_Object *obj, + void *event_info) +{ + if (elm_slideshow_timeout_get(slideshow) > 0) + elm_slideshow_timeout_set(slideshow, elm_spinner_value_get(data)); +} + +/* get our images to make slideshow items */ +static Evas_Object * +_get(void *data, + Evas_Object *obj) +{ + Evas_Object *photo = elm_photo_add(obj); + elm_photo_file_set(photo, data); + elm_photo_fill_inside_set(photo, EINA_TRUE); + elm_object_style_set(photo, "shadow"); + + return photo; +} + +/* ordering alphabetically */ +static int +_cmp_func(const void *data1, + const void *data2) +{ + const char *img_path1, *img_path2; + + const Elm_Object_Item *slide_it1 = data1; + const Elm_Object_Item *slide_it2 = data2; + + img_path1 = elm_object_item_data_get(slide_it1); + img_path2 = elm_object_item_data_get(slide_it2); + + return strcasecmp(img_path1, img_path2); +} + +EAPI_MAIN int +elm_main(int argc, + char **argv) +{ + Evas_Object *win, *bg, *notify, *bx, *bt, *hv, *spin; + Elm_Object_Item *slide_first, *slide_last, *slide_it; + const char *transition, *layout; + const Eina_List *l, *list; + const char *data_dir; + + elm_app_info_set(elm_main, "elementary", "images"); + data_dir = elm_app_data_dir_get(); + snprintf(img1, sizeof(img1), "%s/images/logo.png", data_dir); + snprintf(img2, sizeof(img2), "%s/images/plant_01.jpg", data_dir); + snprintf(img3, sizeof(img3), "%s/images/rock_01.jpg", data_dir); + snprintf(img4, sizeof(img4), "%s/images/rock_02.jpg", data_dir); + snprintf(img5, sizeof(img5), "%s/images/sky_01.jpg", data_dir); + snprintf(img6, sizeof(img6), "%s/images/sky_04.jpg", data_dir); + snprintf(img7, sizeof(img7), "%s/images/wood_01.jpg", data_dir); + snprintf(img8, sizeof(img8), "%s/images/mystrale.jpg", data_dir); + snprintf(img9, sizeof(img9), "%s/images/mystrale_2.jpg", data_dir); + + win = elm_win_add(NULL, "slideshow", ELM_WIN_BASIC); + elm_win_title_set(win, "Slideshow example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + evas_object_resize(win, 600, 400); + evas_object_show(win); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + slideshow = elm_slideshow_add(win); + elm_slideshow_loop_set(slideshow, EINA_TRUE); + evas_object_size_hint_weight_set(slideshow, + EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, slideshow); + evas_object_show(slideshow); + + itc.func.get = _get; + itc.func.del = NULL; + + slide_first = elm_slideshow_item_sorted_insert(slideshow, &itc, img1, _cmp_func); + elm_slideshow_item_sorted_insert(slideshow, &itc, img2, _cmp_func); + elm_slideshow_item_sorted_insert(slideshow, &itc, img3, _cmp_func); + elm_slideshow_item_sorted_insert(slideshow, &itc, img4, _cmp_func); + elm_slideshow_item_sorted_insert(slideshow, &itc, img5, _cmp_func); + elm_slideshow_item_sorted_insert(slideshow, &itc, img6, _cmp_func); + elm_slideshow_item_sorted_insert(slideshow, &itc, img7, _cmp_func); + elm_slideshow_item_sorted_insert(slideshow, &itc, img8, _cmp_func); + slide_last = elm_slideshow_item_add(slideshow, &itc, img9); + + list = elm_slideshow_items_get(slideshow); + fprintf(stdout, "List of items in the slideshow:\n"); + EINA_LIST_FOREACH(list, l, slide_it) + fprintf(stdout, "\t%s\n", + (const char *)elm_object_item_data_get(slide_it)); + + notify = elm_notify_add(win); + elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM); + evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, notify); + elm_notify_timeout_set(notify, 3.0); + + bx = elm_box_add(win); + elm_box_horizontal_set(bx, EINA_TRUE); + elm_object_content_set(notify, bx); + evas_object_show(bx); + + evas_object_event_callback_add(bx, EVAS_CALLBACK_MOUSE_IN, _mouse_in, + notify); + evas_object_event_callback_add(bx, EVAS_CALLBACK_MOUSE_OUT, _mouse_out, + notify); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Previous"); + evas_object_smart_callback_add(bt, "clicked", _previous, slideshow); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Next"); + evas_object_smart_callback_add(bt, "clicked", _next, slideshow); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "First"); + evas_object_smart_callback_add(bt, "clicked", _first, slide_first); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Last"); + evas_object_smart_callback_add(bt, "clicked", _last, slide_last); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + hv = elm_hoversel_add(win); + elm_box_pack_end(bx, hv); + elm_hoversel_hover_parent_set(hv, win); + EINA_LIST_FOREACH(elm_slideshow_transitions_get(slideshow), l, transition) + elm_hoversel_item_add(hv, transition, NULL, 0, _transition_select, + transition); + elm_object_text_set(hv, eina_list_data_get( + elm_slideshow_transitions_get(slideshow))); + evas_object_show(hv); + + hv = elm_hoversel_add(win); + elm_box_pack_end(bx, hv); + elm_hoversel_hover_parent_set(hv, win); + EINA_LIST_FOREACH(elm_slideshow_layouts_get(slideshow), l, layout) + elm_hoversel_item_add(hv, layout, NULL, 0, _layout_select, layout); + elm_object_text_set(hv, elm_slideshow_layout_get(slideshow)); + evas_object_show(hv); + + spin = elm_spinner_add(win); + elm_spinner_label_format_set(spin, "%2.0f s"); + evas_object_smart_callback_add(spin, "changed", _spin, spin); + elm_spinner_step_set(spin, 1); + elm_spinner_min_max_set(spin, 1, 30); + elm_spinner_value_set(spin, 3); + elm_box_pack_end(bx, spin); + evas_object_show(spin); + + bt = elm_button_add(win); + bt_start = bt; + elm_object_text_set(bt, "Start"); + evas_object_smart_callback_add(bt, "clicked", _start, spin); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + bt_stop = bt; + elm_object_text_set(bt, "Stop"); + evas_object_smart_callback_add(bt, "clicked", _stop, spin); + elm_box_pack_end(bx, bt); + elm_object_disabled_set(bt, EINA_TRUE); + evas_object_show(bt); + + evas_object_event_callback_add(slideshow, EVAS_CALLBACK_MOUSE_UP, + _notify_show, notify); + evas_object_event_callback_add(slideshow, EVAS_CALLBACK_MOUSE_MOVE, + _notify_show, notify); + + _notify_show(notify, NULL, NULL, NULL); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/spinner_example.c b/libraries/elementary/src/examples/spinner_example.c new file mode 100644 index 0000000..de18047 --- /dev/null +++ b/libraries/elementary/src/examples/spinner_example.c @@ -0,0 +1,132 @@ +/** + * Simple Elementary's spinner widget example, illustrating its + * usage and API. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g spinner_example.c -o spinner_example `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +static void +_on_done(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_exit(); +} + +static void +_changed_cb(void *data, Evas_Object *obj, void *event_info) +{ + printf("Value changed to %0.f\n", elm_spinner_value_get(obj)); +} + +static void +_delay_changed_cb(void *data, Evas_Object *obj, void *event_info) +{ + printf("Value delay changed to %0.f\n", elm_spinner_value_get(obj)); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *bx, *sp; + + win = elm_win_add(NULL, "spinner", ELM_WIN_BASIC); + elm_win_title_set(win, "Spinner Example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + /* default */ + sp = elm_spinner_add(win); + evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sp); + evas_object_show(sp); + + /* format */ + sp = elm_spinner_add(win); + elm_spinner_label_format_set(sp, "Percentage %%%1.2f something"); + evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sp); + evas_object_show(sp); + + /* min max, step and wrap */ + sp = elm_spinner_add(win); + elm_spinner_label_format_set(sp, "%1.1f units"); + elm_spinner_step_set(sp, 1.5); + elm_spinner_wrap_set(sp, EINA_TRUE); + elm_spinner_min_max_set(sp, -50.0, 250.0); + evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sp); + evas_object_show(sp); + + /* vertical */ + sp = elm_spinner_add(win); + elm_object_style_set(sp, "vertical"); + elm_spinner_interval_set(sp, 0.2); + evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sp); + evas_object_show(sp); + + /* disabled edition */ + sp = elm_spinner_add(win); + elm_spinner_editable_set(sp, EINA_FALSE); + evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sp); + evas_object_show(sp); + + /* special values */ + sp = elm_spinner_add(win); + elm_spinner_editable_set(sp, EINA_FALSE); + elm_spinner_min_max_set(sp, 1, 12); + elm_spinner_special_value_add(sp, 1, "January"); + elm_spinner_special_value_add(sp, 2, "February"); + elm_spinner_special_value_add(sp, 3, "March"); + elm_spinner_special_value_add(sp, 4, "April"); + elm_spinner_special_value_add(sp, 5, "May"); + elm_spinner_special_value_add(sp, 6, "June"); + elm_spinner_special_value_add(sp, 7, "July"); + elm_spinner_special_value_add(sp, 8, "August"); + elm_spinner_special_value_add(sp, 9, "September"); + elm_spinner_special_value_add(sp, 10, "October"); + elm_spinner_special_value_add(sp, 11, "November"); + elm_spinner_special_value_add(sp, 12, "December"); + evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sp); + evas_object_show(sp); + + sp = elm_spinner_add(win); + evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(bx, sp); + evas_object_show(sp); + evas_object_smart_callback_add(sp, "changed", _changed_cb, NULL); + evas_object_smart_callback_add(sp, "delay,changed", _delay_changed_cb, NULL); + + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/table_example_01.c b/libraries/elementary/src/examples/table_example_01.c new file mode 100644 index 0000000..16d6036 --- /dev/null +++ b/libraries/elementary/src/examples/table_example_01.c @@ -0,0 +1,53 @@ +//Compile with: +//gcc -g table_example_01.c -o table_example_01 `pkg-config --cflags --libs elementary` + +#include + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *label, *table; + + win = elm_win_add(NULL, "table", ELM_WIN_BASIC); + elm_win_title_set(win, "Table"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + table = elm_table_add(win); + elm_win_resize_object_add(win, table); + evas_object_show(table); + elm_table_padding_set(table, 5, 5); + elm_table_homogeneous_set(table, EINA_TRUE); + + label = elm_label_add(win); + elm_object_text_set(label, "label 0"); + evas_object_show(label); + elm_table_pack(table, label, 0, 0, 1, 1); + + label = elm_label_add(win); + elm_object_text_set(label, "label 1"); + evas_object_show(label); + elm_table_pack(table, label, 1, 0, 1, 1); + + label = elm_label_add(win); + elm_object_text_set(label, "label 2"); + evas_object_show(label); + elm_table_pack(table, label, 0, 1, 1, 1); + + label = elm_label_add(win); + elm_object_text_set(label, "label 3"); + evas_object_show(label); + elm_table_pack(table, label, 1, 1, 1, 1); + + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/table_example_02.c b/libraries/elementary/src/examples/table_example_02.c new file mode 100644 index 0000000..d466fe8 --- /dev/null +++ b/libraries/elementary/src/examples/table_example_02.c @@ -0,0 +1,56 @@ +//Compile with: +//gcc -g table_example_02.c -o table_example_02 `pkg-config --cflags --libs elementary` + +#include + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *rect, *table; + + win = elm_win_add(NULL, "table", ELM_WIN_BASIC); + elm_win_title_set(win, "Table"); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + table = elm_table_add(win); + elm_win_resize_object_add(win, table); + evas_object_show(table); + elm_table_homogeneous_set(table, EINA_FALSE); + + rect = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(rect, 255, 0, 0, 255); + evas_object_size_hint_min_set(rect, 100, 50); + evas_object_show(rect); + elm_table_pack(table, rect, 0, 0, 2, 1); + + rect = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(rect, 0, 255, 0, 255); + evas_object_size_hint_min_set(rect, 50, 100); + evas_object_show(rect); + elm_table_pack(table, rect, 0, 1, 1, 2); + + rect = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(rect, 0, 0, 255, 255); + evas_object_size_hint_min_set(rect, 50, 50); + evas_object_show(rect); + elm_table_pack(table, rect, 1, 1, 1, 1); + + rect = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(rect, 255, 255, 0, 255); + evas_object_size_hint_min_set(rect, 50, 50); + evas_object_show(rect); + elm_table_pack(table, rect, 1, 2, 1, 1); + + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/theme_example_01.c b/libraries/elementary/src/examples/theme_example_01.c new file mode 100644 index 0000000..e848297 --- /dev/null +++ b/libraries/elementary/src/examples/theme_example_01.c @@ -0,0 +1,79 @@ +/* + * gcc -o theme_example_01 theme_example_01.c `pkg-config --cflags --libs elementary` + */ +#include + +static void +btn_extension_click_cb(void *data, Evas_Object *btn, void *ev) +{ + const char *lbl = elm_object_text_get(btn); + + if (!strncmp(lbl, "Load", 4)) + { + elm_theme_extension_add(NULL, "./theme_example.edj"); + elm_object_text_set(btn, "Unload extension"); + } + else if (!strncmp(lbl, "Unload", 6)) + { + elm_theme_extension_del(NULL, "./theme_example.edj"); + elm_object_text_set(btn, "Load extension"); + } +} + +static void +btn_style_click_cb(void *data, Evas_Object *btn, void *ev) +{ + const char *styles[] = { + "chucknorris", + "default", + "anchor" + }; + static int sel_style = 0; + + sel_style = (sel_style + 1) % 3; + elm_object_style_set(btn, styles[sel_style]); +} + +EAPI_MAIN int +elm_main(int argc, char *argv[]) +{ + Evas_Object *win, *bg, *box, *btn; + + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + elm_theme_extension_add(NULL, "./theme_example.edj"); + + win = elm_win_add(NULL, "Theme example", ELM_WIN_BASIC); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_resize(win, 300, 320); + evas_object_show(win); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + box = elm_box_add(win); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, box); + evas_object_show(box); + + btn = elm_button_add(win); + elm_object_text_set(btn, "Unload extension"); + elm_box_pack_end(box, btn); + evas_object_show(btn); + evas_object_smart_callback_add(btn, "clicked", btn_extension_click_cb, NULL); + + btn = elm_button_add(win); + elm_object_text_set(btn, "Switch style"); + elm_object_style_set(btn, "chucknorris"); + elm_box_pack_end(box, btn); + evas_object_show(btn); + evas_object_smart_callback_add(btn, "clicked", btn_style_click_cb, NULL); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/theme_example_02.c b/libraries/elementary/src/examples/theme_example_02.c new file mode 100644 index 0000000..acab9d7 --- /dev/null +++ b/libraries/elementary/src/examples/theme_example_02.c @@ -0,0 +1,70 @@ +/* + * gcc -o theme_example_02 theme_example_02.c `pkg-config --cflags --libs elememntaru` + */ +#include + +static void +_btn_clicked_cb(void *data, Evas_Object *obj, void *ev) +{ + static int loaded = 1; + if (loaded) + elm_theme_overlay_del(NULL, "./theme_example.edj"); + else + elm_theme_overlay_add(NULL, "./theme_example.edj"); + loaded = 1 - loaded; +} + +EAPI_MAIN int +elm_main(int argc, char *argv[]) +{ + Evas_Object *win, *bg, *box, *btn; + + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + elm_theme_overlay_add(NULL, "./theme_example.edj"); + + win = elm_win_add(NULL, "Theme example", ELM_WIN_BASIC); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_resize(win, 300, 320); + evas_object_show(win); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + box = elm_box_add(win); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, box); + evas_object_show(box); + + btn = elm_button_add(win); + elm_object_text_set(btn, "Button 1"); + elm_box_pack_end(box, btn); + evas_object_show(btn); + evas_object_smart_callback_add(btn, "clicked", _btn_clicked_cb, NULL); + + btn = elm_button_add(win); + elm_object_text_set(btn, "Button 2"); + elm_box_pack_end(box, btn); + evas_object_show(btn); + evas_object_smart_callback_add(btn, "clicked", _btn_clicked_cb, NULL); + + btn = elm_button_add(win); + elm_object_text_set(btn, "Button 3"); + elm_box_pack_end(box, btn); + evas_object_show(btn); + evas_object_smart_callback_add(btn, "clicked", _btn_clicked_cb, NULL); + + btn = elm_button_add(win); + elm_object_text_set(btn, "Button 4"); + elm_box_pack_end(box, btn); + evas_object_show(btn); + evas_object_smart_callback_add(btn, "clicked", _btn_clicked_cb, NULL); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/thumb_example_01.c b/libraries/elementary/src/examples/thumb_example_01.c new file mode 100644 index 0000000..eaf0ec2 --- /dev/null +++ b/libraries/elementary/src/examples/thumb_example_01.c @@ -0,0 +1,83 @@ +//Compile with: +//gcc -g thumb_example_01.c -o thumb_example_01 `pkg-config --cflags --libs elementary` + +#include + +static void +_generation_started_cb(void *data, Evas_Object *o, void *event_info) +{ + printf("thumbnail generation started.\n"); +} + +static void +_generation_finished_cb(void *data, Evas_Object *o, void *event_info) +{ + printf("thumbnail generation finished.\n"); +} + +static void +_generation_error_cb(void *data, Evas_Object *o, void *event_info) +{ + printf("thumbnail generation error.\n"); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg; + Evas_Object *thumb; + char buf[PATH_MAX]; +#ifdef ELM_ETHUMB + Ethumb_Client *client; +#endif + + elm_need_ethumb(); + + elm_app_info_set(elm_main, "elementary", "images/plant_01.jpg"); + win = elm_win_add(NULL, "thumb", ELM_WIN_BASIC); + elm_win_title_set(win, "Thumbnailer"); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + +#ifdef ELM_ETHUMB + client = elm_thumb_ethumb_client_get(); + if (!client) + { + printf("error: could not get Ethumb client.\n"); + return 1; + } + ethumb_client_size_set(client, 160, 160); +#endif + + thumb = elm_thumb_add(win); + + evas_object_smart_callback_add(thumb, "generate,start", _generation_started_cb, NULL); + evas_object_smart_callback_add(thumb, "generate,stop", _generation_finished_cb, NULL); + evas_object_smart_callback_add(thumb, "generate,error", _generation_error_cb, NULL); + + elm_thumb_editable_set(thumb, EINA_FALSE); + snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); + elm_thumb_file_set(thumb, buf, NULL); + elm_thumb_reload(thumb); + + evas_object_size_hint_weight_set(thumb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, thumb); + evas_object_show(thumb); + + evas_object_size_hint_min_set(bg, 160, 160); + evas_object_size_hint_max_set(bg, 640, 640); + evas_object_resize(win, 320, 320); + evas_object_show(win); + + elm_run(); /* and run the program now, starting to handle all + * events, etc. */ + elm_shutdown(); /* clean up and shut down */ + /* exit code */ + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/toolbar_example_01.c b/libraries/elementary/src/examples/toolbar_example_01.c new file mode 100644 index 0000000..867172d --- /dev/null +++ b/libraries/elementary/src/examples/toolbar_example_01.c @@ -0,0 +1,97 @@ +/** + * Simple Elementary's toolbar widget example, illustrating its + * usage and API. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g toolbar_example_01.c -o toolbar_example_01 `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +static void +_on_done(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_exit(); +} + +static void +_item_1_pressed(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *bt = data; + elm_object_text_set(bt, "Print Document"); +} + +static void +_item_2_pressed(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *bt = data; + elm_object_text_set(bt, "Create new folder"); +} + +static void +_item_3_pressed(void *data, Evas_Object *obj, void *event_info) +{ + /* This function won't be called because we disabled item that call it */ + Evas_Object *bt = data; + elm_object_text_set(bt, "Create and send email"); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *bx, *tb, *bt; + Elm_Object_Item *tb_it; + + win = elm_win_add(NULL, "toolbar", ELM_WIN_BASIC); + elm_win_title_set(win, "Toolbar Example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + elm_win_resize_object_add(win, bx); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bx); + + bt = elm_button_add(win); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(bt, "Button"); + evas_object_show(bt); + + tb = elm_toolbar_add(win); + elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_SCROLL); + evas_object_size_hint_weight_set(tb, 0.0, 0.0); + evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0); + evas_object_show(tb); + + elm_toolbar_item_append(tb, "document-print", "Print", _item_1_pressed, bt); + elm_toolbar_item_append(tb, "folder-new", "New Folder", _item_2_pressed, bt); + + tb_it = elm_toolbar_item_append(tb, "mail-send", "Create and send email", + _item_3_pressed, bt); + elm_object_item_disabled_set(tb_it, EINA_TRUE); + + elm_toolbar_homogeneous_set(tb, EINA_FALSE); + + elm_box_pack_end(bx, tb); + elm_box_pack_end(bx, bt); + + evas_object_resize(win, 200, 200); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/toolbar_example_02.c b/libraries/elementary/src/examples/toolbar_example_02.c new file mode 100644 index 0000000..273fe47 --- /dev/null +++ b/libraries/elementary/src/examples/toolbar_example_02.c @@ -0,0 +1,88 @@ +/** + * Simple Elementary's toolbar widget example, illustrating its + * usage and API. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g toolbar_example_02.c -o toolbar_example_02 `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +static void +_on_done(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_exit(); +} + +static void +_item_pressed(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *tb_it = event_info; + elm_toolbar_item_state_set(tb_it, elm_toolbar_item_state_next(tb_it)); + elm_toolbar_item_selected_set(tb_it, EINA_FALSE); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *bx, *tb, *bt; + Elm_Object_Item *tb_it; + + win = elm_win_add(NULL, "toolbar", ELM_WIN_BASIC); + elm_win_title_set(win, "Toolbar Example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + elm_win_resize_object_add(win, bx); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bx); + + bt = elm_button_add(win); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(bt, "Button"); + evas_object_show(bt); + + tb = elm_toolbar_add(win); + elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_HIDE); + evas_object_size_hint_weight_set(tb, 0.0, 0.0); + evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0); + evas_object_show(tb); + + elm_toolbar_item_append(tb, "document-print", "Print", NULL, NULL); + elm_toolbar_item_append(tb, "folder-new", "Folder", NULL, NULL); + elm_toolbar_item_append(tb, "clock", "Clock", NULL, NULL); + elm_toolbar_item_append(tb, "refresh", "Update", NULL, NULL); + + tb_it = elm_toolbar_item_append(tb, "mail-send", "Send Mail", + _item_pressed, NULL); + elm_toolbar_item_state_add(tb_it, "emptytrash", "Empty Trash", + _item_pressed, NULL); + elm_toolbar_item_state_add(tb_it, "trashcan_full", "Full Trash", + _item_pressed, NULL); + + elm_toolbar_item_priority_set(tb_it, 10); + + elm_box_pack_end(bx, tb); + elm_box_pack_end(bx, bt); + + evas_object_resize(win, 230, 200); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/toolbar_example_03.c b/libraries/elementary/src/examples/toolbar_example_03.c new file mode 100644 index 0000000..8af248b --- /dev/null +++ b/libraries/elementary/src/examples/toolbar_example_03.c @@ -0,0 +1,81 @@ +/** + * Simple Elementary's toolbar widget example, illustrating its + * usage and API. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g toolbar_example_03.c -o toolbar_example_03 `pkg-config --cflags --libs elementary` + * @endverbatim + */ + +#include + +static void +_on_done(void *data, + Evas_Object *obj, + void *event_info) +{ + elm_exit(); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *bx, *tb, *bt, *menu; + Elm_Object_Item *tb_it; + + win = elm_win_add(NULL, "toolbar", ELM_WIN_BASIC); + elm_win_title_set(win, "Toolbar Example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + bx = elm_box_add(win); + elm_win_resize_object_add(win, bx); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bx); + + bt = elm_button_add(win); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(bt, "Button"); + evas_object_show(bt); + + tb = elm_toolbar_add(win); + evas_object_size_hint_weight_set(tb, 0.0, 0.0); + evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0); + evas_object_show(tb); + + elm_toolbar_item_append(tb, "document-print", "Print", NULL, NULL); + elm_toolbar_item_append(tb, "folder-new", "Folder", NULL, NULL); + elm_toolbar_item_append(tb, "clock", "Clock", NULL, NULL); + elm_toolbar_item_append(tb, "refresh", "Update", NULL, NULL); + + elm_toolbar_menu_parent_set(tb, win); + + tb_it = elm_toolbar_item_append(tb, "mail-send", "Send Mail", NULL, NULL); + elm_toolbar_item_menu_set(tb_it, EINA_TRUE); + + menu = elm_toolbar_item_menu_get(tb_it); + elm_menu_item_add(menu, NULL, "emptytrash", "Empty Trash", NULL, NULL); + elm_menu_item_add(menu, NULL, "trashcan_full", "Full Trash", NULL, NULL); + + elm_toolbar_item_priority_set(tb_it, 10); + + elm_box_pack_end(bx, tb); + elm_box_pack_end(bx, bt); + + evas_object_resize(win, 230, 200); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/transit_example_01.c b/libraries/elementary/src/examples/transit_example_01.c new file mode 100644 index 0000000..26323c9 --- /dev/null +++ b/libraries/elementary/src/examples/transit_example_01.c @@ -0,0 +1,52 @@ +//Compile with: +//gcc -o transit_example_01 transit_example_01.c `pkg-config --cflags --libs elementary` + +#include + +static void +on_done(void *data, Evas_Object *obj, void *event_info) +{ + /* quit the mainloop (elm_run) */ + elm_exit(); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *bt; + Elm_Transit *trans; + + win = elm_win_add(NULL, "transit-basic", ELM_WIN_BASIC); + elm_win_title_set(win, "Transit - Basic"); + evas_object_smart_callback_add(win, "delete,request", on_done, NULL); + elm_win_autodel_set(win, EINA_TRUE); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + evas_object_resize(win, 400, 400); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Resizing Effect"); + evas_object_show(bt); + evas_object_move(bt, 50, 100); + evas_object_resize(bt, 100, 50); + + evas_object_show(win); + + trans = elm_transit_add(); + elm_transit_object_add(trans, bt); + + elm_transit_effect_resizing_add(trans, 100, 50, 300, 150); + + elm_transit_duration_set(trans, 5.0); + elm_transit_go(trans); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/transit_example_02.c b/libraries/elementary/src/examples/transit_example_02.c new file mode 100644 index 0000000..c00e83a --- /dev/null +++ b/libraries/elementary/src/examples/transit_example_02.c @@ -0,0 +1,85 @@ +//Compile with: +//gcc -o transit_example_02 transit_example_02.c `pkg-config --cflags --libs elementary` + +#include + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *bt, *bt2, *bt3, *bt4; + Elm_Transit *trans, *trans2, *trans3, *trans4; + + win = elm_win_add(NULL, "transit9", ELM_WIN_BASIC); + elm_win_title_set(win, "Transit 9"); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_resize(win, 400, 400); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + evas_object_show(win); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Chain 1"); + evas_object_resize(bt, 100, 100); + evas_object_move(bt, 0, 0); + evas_object_show(bt); + + bt2 = elm_button_add(win); + elm_object_text_set(bt2, "Chain 2"); + evas_object_resize(bt2, 100, 100); + evas_object_move(bt2, 300, 0); + evas_object_show(bt2); + + bt3 = elm_button_add(win); + elm_object_text_set(bt3, "Chain 3"); + evas_object_resize(bt3, 100, 100); + evas_object_move(bt3, 300, 300); + evas_object_show(bt3); + + bt4 = elm_button_add(win); + elm_object_text_set(bt4, "Chain 4"); + evas_object_resize(bt4, 100, 100); + evas_object_move(bt4, 0, 300); + evas_object_show(bt4); + + trans = elm_transit_add(); + elm_transit_tween_mode_set(trans, ELM_TRANSIT_TWEEN_MODE_ACCELERATE); + elm_transit_effect_translation_add(trans, 0, 0, 300, 0); + elm_transit_object_add(trans, bt); + elm_transit_duration_set(trans, 1); + elm_transit_objects_final_state_keep_set(trans, EINA_TRUE); + elm_transit_go(trans); + + trans2 = elm_transit_add(); + elm_transit_tween_mode_set(trans2, ELM_TRANSIT_TWEEN_MODE_ACCELERATE); + elm_transit_effect_translation_add(trans2, 0, 0, 0, 300); + elm_transit_object_add(trans2, bt2); + elm_transit_duration_set(trans2, 1); + elm_transit_objects_final_state_keep_set(trans2, EINA_TRUE); + elm_transit_chain_transit_add(trans, trans2); + + trans3 = elm_transit_add(); + elm_transit_tween_mode_set(trans3, ELM_TRANSIT_TWEEN_MODE_ACCELERATE); + elm_transit_effect_translation_add(trans3, 0, 0, -300, 0); + elm_transit_object_add(trans3, bt3); + elm_transit_duration_set(trans3, 1); + elm_transit_objects_final_state_keep_set(trans3, EINA_TRUE); + elm_transit_chain_transit_add(trans2, trans3); + + trans4 = elm_transit_add(); + elm_transit_tween_mode_set(trans4, ELM_TRANSIT_TWEEN_MODE_ACCELERATE); + elm_transit_effect_translation_add(trans4, 0, 0, 0, -300); + elm_transit_object_add(trans4, bt4); + elm_transit_duration_set(trans4, 1); + elm_transit_objects_final_state_keep_set(trans4, EINA_TRUE); + elm_transit_chain_transit_add(trans3, trans4); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/transit_example_03.c b/libraries/elementary/src/examples/transit_example_03.c new file mode 100644 index 0000000..0bfc8fd --- /dev/null +++ b/libraries/elementary/src/examples/transit_example_03.c @@ -0,0 +1,332 @@ +//Compile with: +//gcc -o transit_example_03 transit_example_03.c `pkg-config --cflags --libs elementary` -DDATA_DIR="\"\"" +//where directory is the a path where images/icon_07.png can be found. + +#include + +/* structure to hold context for many callbacks */ +struct Context { + Eina_Bool events_enabled; + Eina_Bool auto_reverse; + Eina_Bool final_state_keep; + int repeat_times; + Elm_Transit_Tween_Mode tween_mode; + Evas_Object *obj; +}; + +static void +_transit_translation(Elm_Transit *trans) +{ + /* considering the original position (x0, y0), moves the object from + * (x0 - 20, y0 - 50) to (x0 + 70, y0 + 150) */ + elm_transit_effect_translation_add(trans, -20, -50, 70, 150); +} + +static void +_transit_color(Elm_Transit *trans) +{ + /* changes the object color from 100, 255, 100, 255 to + * 200, 50, 200, 50 */ + elm_transit_effect_color_add(trans, 100, 255, 100, 255, 200, 50, 200, 50); +} + +static void +_transit_rotation(Elm_Transit *trans) +{ + /* rotates the object from its original angle to 135 degrees to the right */ + elm_transit_effect_rotation_add(trans, 0.0, 135.0); +} + +static void +_transit_wipe(Elm_Transit *trans) +{ + /* hide the object clipping it from the left to the right */ + elm_transit_effect_wipe_add(trans, + ELM_TRANSIT_EFFECT_WIPE_TYPE_HIDE, + ELM_TRANSIT_EFFECT_WIPE_DIR_RIGHT); +} + +static void +_transit_zoom(Elm_Transit *trans) +{ + /* zoom the object from its original size to 2x */ + elm_transit_effect_zoom_add(trans, 1.0, 2.0); +} + +static void +_transit_resizing(Elm_Transit *trans) +{ + /* resize the object from 250x100 to 400x160 */ + elm_transit_effect_resizing_add(trans, 250, 100, 400, 160); +} + + +/* helper structure that will hold the transit checkboxes string, callbacks + * and checked statuses */ +static struct { + const char *label; + void (*transition_add_cb)(Elm_Transit *); + Eina_Bool checked; +} _transitions[] = { + { "Translation", _transit_translation, EINA_FALSE }, + { "Color", _transit_color, EINA_FALSE }, + { "Rotation", _transit_rotation, EINA_FALSE }, + { "Wipe", _transit_wipe, EINA_FALSE }, + { "Zoom", _transit_zoom, EINA_FALSE }, + { "Resizing", _transit_resizing, EINA_FALSE }, + { NULL, NULL, EINA_FALSE } +}; + +static void +on_done(void *data, Evas_Object *obj, void *event_info) +{ + /* quit the mainloop (elm_run) */ + elm_exit(); +} + +/* add a checkbox to the box with the given label, and uses the checked + * pointer as state_pointer to this checkbox */ +static void +_checkbox_transition_add(Evas_Object *box, const char *label, Eina_Bool *checked) +{ + Evas_Object *check = elm_check_add(elm_object_parent_widget_get(box)); + evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(check, 0.0, 0.0); + elm_object_text_set(check, label); + elm_check_state_pointer_set(check, checked); + elm_box_pack_end(box, check); + evas_object_show(check); +} + +static void +_transit_start(void *data, Evas_Object *o, void *event_info) +{ + Elm_Transit *trans = NULL; + int i; + struct Context *ctxt = data; + Evas_Object *obj = ctxt->obj; // the object on which the transition will be + // applied + + // FIXME: Should check if there's another transit going before starting a new + // one + + /* initialization: create the transition and add the object to it */ + trans = elm_transit_add(); + elm_transit_object_add(trans, obj); + + /* from our helper structure and array, check if the specified transition is + * checked and use its callback to add this transition to trans */ + for (i = 0; _transitions[i].label; i++) + { + if (_transitions[i].checked) + _transitions[i].transition_add_cb(trans); + } + + /* get the various options for this transition from the context structure */ + elm_transit_event_enabled_set(trans, ctxt->events_enabled); + elm_transit_auto_reverse_set(trans, ctxt->auto_reverse); + elm_transit_objects_final_state_keep_set(trans, ctxt->final_state_keep); + elm_transit_tween_mode_set(trans, ctxt->tween_mode); + elm_transit_repeat_times_set(trans, ctxt->repeat_times); + + /* set the transition time to 2 seconds and start it */ + elm_transit_duration_set(trans, 2.0); + elm_transit_go(trans); +} + +/* callback useful just to know whether we can receive events from the + * object or not */ +static void +_object_clicked(void *data, Evas_Object *o, void *event_info) +{ + printf("object clicked!\n"); +} + +/* update our context with the given value for repeat count */ +static void +_cb_repeat_changed(void *data, Evas_Object *obj, void *event) +{ + int *repeat_cnt = data; + + *repeat_cnt = elm_spinner_value_get(obj); +} + +/* update our context with the given tween mode for the transition */ +static void +_cb_tween_changed(void *data, Evas_Object *obj, void *event) +{ + Elm_Transit_Tween_Mode *mode = data; + double val = 0.0; + + val = elm_spinner_value_get(obj); + if (val == 1.0) + *mode = ELM_TRANSIT_TWEEN_MODE_LINEAR; + else if (val == 2.0) + *mode = ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL; + else if (val == 3.0) + *mode = ELM_TRANSIT_TWEEN_MODE_DECELERATE; + else if (val == 4.0) + *mode = ELM_TRANSIT_TWEEN_MODE_ACCELERATE; +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *obj, *icon, *box, *vbox, *vbox2, *hbox, *btn; + Evas_Object *cbox, *dummy, *spinner; + char buf[PATH_MAX]; + int i; + struct Context context; + + /* initialize our context */ + context.events_enabled = EINA_FALSE; + context.auto_reverse = EINA_FALSE; + context.final_state_keep = EINA_FALSE; + context.repeat_times = 0; + context.tween_mode = ELM_TRANSIT_TWEEN_MODE_LINEAR; + + elm_app_info_set(elm_main, "elementary", "images/icon_07.png"); + + /* add a window */ + win = elm_win_add(NULL, "transit", ELM_WIN_BASIC); + elm_win_title_set(win, "Transit Example"); + evas_object_smart_callback_add(win, "delete,request", on_done, NULL); + elm_win_autodel_set(win, EINA_TRUE); + + /* add a scalable white background to this window */ + bg = elm_bg_add(win); + elm_bg_color_set(bg, 255, 255, 255); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_min_set(bg, 640, 640); + evas_object_size_hint_max_set(bg, 640, 640); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + /* add a vertical box that will hold everything */ + box = elm_box_add(win); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, box); + evas_object_show(box); + + /* a dummy background to create some space for the animation */ + dummy = elm_bg_add(win); + evas_object_size_hint_weight_set(dummy, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(box, dummy); + evas_object_show(dummy); + + /* add an object that we are going to play with */ + /* this object isn't packed inside the box because we don't want it to have + * its size, position, aspect or anything else controled by the container */ + obj = elm_button_add(win); + elm_object_text_set(obj, "Transformed object!"); + icon = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/icon_07.png", elm_app_data_dir_get()); + elm_icon_file_set(icon, buf, NULL); + elm_object_part_content_set(obj, "icon", icon); + evas_object_move(obj, 160, 60); + evas_object_resize(obj, 250, 100); + evas_object_show(obj); + context.obj = obj; + + /* a callback to know if clicks are being received */ + evas_object_smart_callback_add(obj, "clicked", _object_clicked, NULL); + + /* button to start our transition */ + btn = elm_button_add(win); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_text_set(btn, "Transit!"); + elm_box_pack_end(box, btn); + evas_object_show(btn); + evas_object_smart_callback_add(btn, "clicked", _transit_start, &context); + + /* horizontal box to help visual organization */ + hbox = elm_box_add(win); + elm_box_horizontal_set(hbox, EINA_TRUE); + evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, 0.0); + elm_box_pack_end(box, hbox); + evas_object_show(hbox); + + /* horizontal box that will hold the many transition checkboxes */ + vbox = elm_box_add(win); + evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_size_hint_align_set(vbox, EVAS_HINT_FILL, 0.0); + + /* create the respective checkboxes based on our helper structure and + * array */ + for (i = 0; _transitions[i].label; i++) + _checkbox_transition_add(vbox, _transitions[i].label, + &_transitions[i].checked); + + elm_box_pack_end(hbox, vbox); + evas_object_show(vbox); + + /* vertical box that will hold the many transition option checkboxes */ + vbox2 = elm_box_add(win); + evas_object_size_hint_weight_set(vbox2, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_size_hint_align_set(vbox2, EVAS_HINT_FILL, 0.0); + elm_box_pack_end(hbox, vbox2); + evas_object_show(vbox2); + + /* the rest of this code adds widgets to control some of the behavior of + * the transitions */ + cbox = elm_check_add(win); + evas_object_size_hint_weight_set(cbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(cbox, 0.0, 0.0); + elm_object_text_set(cbox, "Events enabled"); + elm_check_state_pointer_set(cbox, &context.events_enabled); + elm_box_pack_end(vbox2, cbox); + evas_object_show(cbox); + + cbox = elm_check_add(win); + evas_object_size_hint_weight_set(cbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(cbox, 0.0, 0.0); + elm_object_text_set(cbox, "Auto reverse"); + elm_check_state_pointer_set(cbox, &context.auto_reverse); + elm_box_pack_end(vbox2, cbox); + evas_object_show(cbox); + + cbox = elm_check_add(win); + evas_object_size_hint_weight_set(cbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(cbox, 0.0, 0.0); + elm_object_text_set(cbox, "Keep final state"); + elm_check_state_pointer_set(cbox, &context.final_state_keep); + elm_box_pack_end(vbox2, cbox); + evas_object_show(cbox); + + spinner = elm_spinner_add(win); + elm_object_style_set(spinner, "vertical"); + elm_spinner_min_max_set(spinner, 0, 4); + elm_spinner_label_format_set(spinner, "%.0f"); + elm_spinner_editable_set(spinner, EINA_FALSE); + evas_object_size_hint_weight_set(spinner, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(spinner, 0.0, EVAS_HINT_FILL); + evas_object_smart_callback_add(spinner, "changed", _cb_repeat_changed, &context.repeat_times); + elm_box_pack_end(vbox2, spinner); + evas_object_show(spinner); + + spinner = elm_spinner_add(win); + elm_object_style_set(spinner, "vertical"); + elm_spinner_min_max_set(spinner, 1, 4); + elm_spinner_label_format_set(spinner, "%.0f"); + elm_spinner_editable_set(spinner, EINA_FALSE); + elm_spinner_special_value_add(spinner, 1, "linear"); + elm_spinner_special_value_add(spinner, 2, "sinusoidal"); + elm_spinner_special_value_add(spinner, 3, "decelerate"); + elm_spinner_special_value_add(spinner, 4, "accelerate"); + evas_object_size_hint_weight_set(spinner, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(spinner, 0.0, EVAS_HINT_FILL); + evas_object_size_hint_min_set(spinner, 200, 30); + evas_object_smart_callback_add(spinner, "changed", _cb_tween_changed, &context.tween_mode); + elm_box_pack_end(vbox2, spinner); + evas_object_show(spinner); + + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/transit_example_04.c b/libraries/elementary/src/examples/transit_example_04.c new file mode 100644 index 0000000..cf0338f --- /dev/null +++ b/libraries/elementary/src/examples/transit_example_04.c @@ -0,0 +1,173 @@ +//Compile with: +//gcc -o transit_example_04 transit_example_04.c `pkg-config --cflags --libs elementary` -DDATA_DIR="\"\"" +//where directory is the a path where images/icon_07.png can be found. + +#include + +static void +_transit_flip(Elm_Transit *trans) +{ + elm_transit_effect_flip_add(trans, ELM_TRANSIT_EFFECT_FLIP_AXIS_X, EINA_TRUE); +} + +static void +_transit_blend(Elm_Transit *trans) +{ + elm_transit_effect_blend_add(trans); +} + +static void +_transit_fade(Elm_Transit *trans) +{ + elm_transit_effect_fade_add(trans); +} + +static void +_transit_resizable_flip(Elm_Transit *trans) +{ + elm_transit_effect_resizable_flip_add( + trans, ELM_TRANSIT_EFFECT_FLIP_AXIS_Y, EINA_TRUE); +} + +static struct { + const char *label; + void (*transition_add_cb)(Elm_Transit *); + Eina_Bool checked; +} _transitions[] = { + { "Flip", _transit_flip, EINA_FALSE }, + { "Blend", _transit_blend, EINA_FALSE }, + { "Fade", _transit_fade, EINA_FALSE }, + { "Resizable Flip", _transit_resizable_flip, EINA_FALSE }, + { NULL, NULL, EINA_FALSE } +}; + +static void +on_done(void *data, Evas_Object *obj, void *event_info) +{ + /* quit the mainloop (elm_run) */ + elm_exit(); +} + +static void +_checkbox_transition_add(Evas_Object *box, const char *label, Eina_Bool *checked) +{ + Evas_Object *check = elm_check_add(elm_object_parent_widget_get(box)); + evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(check, 0.0, 0.0); + elm_object_text_set(check, label); + elm_check_state_pointer_set(check, checked); + elm_box_pack_end(box, check); + evas_object_show(check); +} + +static void +_transit_start(void *data, Evas_Object *o, void *event_info) +{ + Elm_Transit *trans = NULL; + Eina_List *objs = data, *l; + Evas_Object *obj; + int i; + + trans = elm_transit_add(); + EINA_LIST_FOREACH(objs, l, obj) + elm_transit_object_add(trans, obj); + + // FIXME: Should check if there's another transit going before starting a new + // one + + for (i = 0; _transitions[i].label; i++) + { + if (_transitions[i].checked) + _transitions[i].transition_add_cb(trans); + } + + elm_transit_duration_set(trans, 2.0); + elm_transit_go(trans); +} + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + Evas_Object *win, *bg, *obj, *icon, *box, *vbox, *btn, *dummy; + Eina_List *objs = NULL; + char buf[PATH_MAX]; + int i; + + elm_app_info_set(elm_main, "elementary", "images/icon_07.png"); + /* add a window */ + win = elm_win_add(NULL, "transit", ELM_WIN_BASIC); + elm_win_title_set(win, "Transit Example"); + evas_object_smart_callback_add(win, "delete,request", on_done, NULL); + elm_win_autodel_set(win, EINA_TRUE); + + /* add a scalable white background to this window */ + bg = elm_bg_add(win); + elm_bg_color_set(bg, 255, 255, 255); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_min_set(bg, 640, 640); + evas_object_size_hint_max_set(bg, 640, 640); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + box = elm_box_add(win); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, box); + evas_object_show(box); + + dummy = elm_bg_add(win); + evas_object_size_hint_weight_set(dummy, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(box, dummy); + evas_object_show(dummy); + + /* add an object that we are going to play with */ + obj = elm_button_add(win); + elm_object_text_set(obj, "Transformed object!"); + icon = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/icon_07.png", elm_app_data_dir_get()); + elm_icon_file_set(icon, buf, NULL); + elm_object_part_content_set(obj, "icon", icon); + evas_object_move(obj, 160, 60); + evas_object_resize(obj, 250, 100); + evas_object_show(obj); + + objs = eina_list_append(objs, obj); + + /* add another object that we are going to play with */ + obj = elm_button_add(win); + elm_object_text_set(obj, "Another object!"); + icon = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/icon_08.png", elm_app_data_dir_get()); + elm_icon_file_set(icon, buf, NULL); + elm_object_part_content_set(obj, "icon", icon); + evas_object_move(obj, 160, 60); + evas_object_resize(obj, 250, 100); + + objs = eina_list_append(objs, obj); + + btn = elm_button_add(win); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_text_set(btn, "Transit!"); + elm_box_pack_end(box, btn); + evas_object_show(btn); + + evas_object_smart_callback_add(btn, "clicked", _transit_start, objs); + + vbox = elm_box_add(win); + evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_size_hint_align_set(vbox, EVAS_HINT_FILL, 0.0); + + for (i = 0; _transitions[i].label; i++) + _checkbox_transition_add(vbox, _transitions[i].label, &_transitions[i].checked); + + elm_box_pack_end(box, vbox); + evas_object_show(vbox); + + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/web_example.c b/libraries/elementary/src/examples/web_example.c new file mode 100644 index 0000000..0158315 --- /dev/null +++ b/libraries/elementary/src/examples/web_example.c @@ -0,0 +1,623 @@ +/* + * gcc -o web_example web_example.c `pkg-config --cflags --libs elementary ewebkit` -D_GNU_SOURCE + */ + +#define _GNU_SOURCE +#include +#ifdef HAVE_ELEMENTARY_WEB +#include +#endif + +typedef struct _Tab_Data Tab_Data; + +typedef struct +{ + Evas_Object *win; + Evas_Object *main_box; + Evas_Object *naviframe; + Evas_Object *url; + Evas_Object *default_web; + Evas_Object *tabs; + Evas_Object *close_tab; + Evas_Object *search_box; + Evas_Object *search_entry; + + struct { + Evas_Object *back; + Evas_Object *fwd; + Evas_Object *refresh; + } nav; + + Tab_Data *current_tab; + + Eina_Bool exiting : 1; +} App_Data; + +struct _Tab_Data +{ + Evas_Object *web; + App_Data *app; + Elm_Object_Item *tab; +}; + +static Evas_Object * _web_create_window_cb(void *data, Evas_Object *obj, Eina_Bool js, const Elm_Web_Window_Features *wf); + +static void +nav_button_update(App_Data *ad) +{ + Eina_Bool back, fwd; + + back = !elm_web_back_possible_get(ad->current_tab->web); + fwd = !elm_web_forward_possible_get(ad->current_tab->web); + + elm_object_disabled_set(ad->nav.back, back); + elm_object_disabled_set(ad->nav.fwd, fwd); +} + +static void +tab_current_set(Tab_Data *td) +{ + const char *uri; + + if (td == td->app->current_tab) + return; + + td->app->current_tab = td; + + uri = elm_web_uri_get(td->web); + elm_object_text_set(td->app->url, uri); + + nav_button_update(td->app); + elm_entry_icon_visible_set(td->app->url, EINA_TRUE); + + elm_naviframe_item_simple_promote(td->app->naviframe, td->web); +} + +static void +_tab_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + Tab_Data *td = data; + /* the first toolbar_item_append() calls the select callback before the item + * is assigned, so we need a workaround for that. */ + if (!td->tab) + td->tab = event_info; + tab_current_set(td); +} + +static void +_title_changed_cb(void *data, Evas_Object *obj, void *event_info) +{ + Tab_Data *td = data; + const char *title = event_info; + char buf[20] = ""; + + if (title) + strncpy(buf, title, sizeof(buf) - 1); + elm_object_item_text_set(td->tab, buf); +} + +static void +_uri_changed_cb(void *data, Evas_Object *obj, void *event_info) +{ + Tab_Data *td = data; + const char *uri = event_info; + + if (td != td->app->current_tab) + return; + + nav_button_update(td->app); + elm_object_text_set(td->app->url, uri); +} + +static void +_web_free_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + Tab_Data *td = data; + + if (td->tab) + elm_object_item_del(td->tab); + + free(td); +} + +static void +_tb_item_del_cb(void *data, Evas_Object *obj, void *event_info) +{ + Tab_Data *td = data; + if (!td->app->exiting && !elm_toolbar_selected_item_get(obj)) + { + td->app->current_tab = NULL; + elm_entry_icon_visible_set(td->app->url, EINA_FALSE); + if (td->app->search_box) + evas_object_del(td->app->search_box); + } + td->tab = NULL; +} + +Tab_Data * +tab_add(App_Data *ad) +{ + Tab_Data *td; + + td = calloc(1, sizeof(Tab_Data)); + if (!td) return NULL; + + td->web = elm_web_add(ad->win); + elm_web_window_create_hook_set(td->web, _web_create_window_cb, ad); + elm_web_inwin_mode_set(td->web, EINA_TRUE); + evas_object_size_hint_weight_set(td->web, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(td->web, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_naviframe_item_simple_push(ad->naviframe, td->web); + + td->app = ad; + td->tab = elm_toolbar_item_append(td->app->tabs, NULL, "New tab", + _tab_clicked_cb, td); + elm_object_item_del_cb_set(td->tab, _tb_item_del_cb); + + evas_object_data_set(td->web, "tab_data", td); + + evas_object_smart_callback_add(td->web, "title,changed", _title_changed_cb, + td); + evas_object_smart_callback_add(td->web, "uri,changed", _uri_changed_cb, td); + evas_object_event_callback_add(td->web, EVAS_CALLBACK_FREE, _web_free_cb, + td); + + elm_toolbar_item_selected_set(td->tab, EINA_TRUE); + return td; +} + +static char * +uri_sanitize(const char *uri) +{ + char *fixed_uri; + char *schema; + char *tmp; + + if (!uri || !*uri) return NULL; + + tmp = strstr(uri, "://"); + if (!tmp || (tmp == uri) || (tmp > (uri + 15))) + { + char *new_uri = NULL; + if (ecore_file_exists(uri)) + { + schema = "file"; + new_uri = ecore_file_realpath(uri); + } + else + schema = "http"; + + if (asprintf(&fixed_uri, "%s://%s", schema, new_uri ? new_uri : uri) > + 0) + { + free(new_uri); + return fixed_uri; + } + free(new_uri); + } + else + return strdup(uri); + + return NULL; +} + +static void +tab_uri_set(Tab_Data *td, const char *uri) +{ + char *sane_uri = uri_sanitize(uri); + elm_web_uri_set(td->web, sane_uri); + free(sane_uri); +} + +static void +_url_activated_cb(void *data, Evas_Object *obj, void *event_info) +{ + App_Data *ad = data; + Tab_Data *td; + const char *uri = eina_stringshare_ref(elm_object_text_get(obj)); + + if (!ad->current_tab) + td = tab_add(ad); + else + td = ad->current_tab; + tab_uri_set(td, uri); + eina_stringshare_del(uri); +} + +static void +_nav_back_cb(void *data, Evas_Object *obj, void *event_info) +{ + App_Data *ad = data; + + elm_web_back(ad->current_tab->web); +} + +static void +_nav_refresh_cb(void *data, Evas_Object *obj, void *event_info) +{ + App_Data *ad = data; + const Evas_Modifier *mods = evas_key_modifier_get(evas_object_evas_get(obj)); + + if (evas_key_modifier_is_set(mods, "Shift")) + elm_web_reload_full(ad->current_tab->web); + else + elm_web_reload(ad->current_tab->web); +} + +static void +_nav_fwd_cb(void *data, Evas_Object *obj, void *event_info) +{ + App_Data *ad = data; + + elm_web_forward(ad->current_tab->web); +} + +static void +_close_tab_cb(void *data, Evas_Object *obj, void *event_info) +{ + App_Data *ad = data; + + if (!ad->current_tab) + return; + evas_object_del(ad->current_tab->web); +} + +static void +_add_tab_cb(void *data, Evas_Object *obj, void *event_info) +{ + App_Data *ad = data; + tab_add(ad); + elm_object_focus_set(ad->url, EINA_TRUE); +} + +static Evas_Object * +_web_create_window_cb(void *data, Evas_Object *obj, Eina_Bool js, const Elm_Web_Window_Features *wf) +{ + App_Data *ad = data; + Tab_Data *td; + + td = tab_add(ad); + return td->web; +} + +static void +_win_del_request_cb(void *data, Evas_Object *obj, void *event_info) +{ + App_Data *ad = data; + ad->exiting = EINA_TRUE; +} + +static void +_win_free_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + free(data); +} + +static void +_search_entry_changed_cb(void *data, Evas_Object *obj, void *event_info) +{ + App_Data *ad = data; + const char *text; + + text = elm_object_text_get(obj); + elm_web_text_search(ad->current_tab->web, text, EINA_FALSE, EINA_TRUE, + EINA_TRUE); + elm_web_text_matches_unmark_all(ad->current_tab->web); + elm_web_text_matches_mark(ad->current_tab->web, text, EINA_FALSE, EINA_TRUE, + 0); +} + +static void +_search_entry_activate_cb(void *data, Evas_Object *obj, void *event_info) +{ + App_Data *ad = data; + const char *text; + + text = elm_object_text_get(obj); + elm_web_text_search(ad->current_tab->web, text, EINA_FALSE, EINA_TRUE, + EINA_TRUE); +} + +static void +_search_next_cb(void *data, Evas_Object *obj, void *event_info) +{ + App_Data *ad = data; + const char *text; + + text = elm_object_text_get(ad->search_entry); + elm_web_text_search(ad->current_tab->web, text, EINA_FALSE, EINA_TRUE, + EINA_TRUE); +} + +static void +_search_prev_cb(void *data, Evas_Object *obj, void *event_info) +{ + App_Data *ad = data; + const char *text; + + text = elm_object_text_get(ad->search_entry); + elm_web_text_search(ad->current_tab->web, text, EINA_FALSE, EINA_FALSE, + EINA_TRUE); +} + +static void +_search_close_cb(void *data, Evas_Object *obj, void *event_info) +{ + App_Data *ad = data; + evas_object_del(ad->search_box); +} + +static void +_search_box_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + App_Data *ad = data; + ad->search_box = NULL; + ad->search_entry = NULL; +} + +static void +_win_search_trigger_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + Evas_Event_Key_Down *ev = event_info; + App_Data *ad = data; + Evas_Object *box, *box2, *entry, *btn, *ic; + + if (strcmp(ev->keyname, "f") || + !evas_key_modifier_is_set(ev->modifiers, "Control")) + return; + if (ad->search_box || !ad->current_tab) + return; + + box = elm_box_add(ad->win); + elm_box_horizontal_set(box, EINA_TRUE); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_after(ad->main_box, box, ad->url); + evas_object_show(box); + + evas_object_event_callback_add(box, EVAS_CALLBACK_DEL, _search_box_del_cb, + ad); + + entry = elm_entry_add(ad->win); + elm_entry_single_line_set(entry, EINA_TRUE); + elm_entry_scrollable_set(entry, EINA_TRUE); + evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, entry); + evas_object_show(entry); + + evas_object_smart_callback_add(entry, "changed", _search_entry_changed_cb, + ad); + evas_object_smart_callback_add(entry, "activated", _search_entry_activate_cb, + ad); + + box2 = elm_box_add(ad->win); + elm_box_horizontal_set(box2, EINA_TRUE); + elm_object_part_content_set(entry, "end", box2); + + btn = elm_button_add(ad->win); + elm_box_pack_end(box2, btn); + evas_object_show(btn); + + ic = elm_icon_add(ad->win); + elm_icon_standard_set(ic, "arrow_up"); + elm_object_part_content_set(btn, "icon", ic); + + evas_object_smart_callback_add(btn, "clicked", _search_prev_cb, ad); + + btn = elm_button_add(ad->win); + elm_box_pack_end(box2, btn); + evas_object_show(btn); + + ic = elm_icon_add(ad->win); + elm_icon_standard_set(ic, "arrow_down"); + elm_object_part_content_set(btn, "icon", ic); + + evas_object_smart_callback_add(btn, "clicked", _search_next_cb, ad); + + btn = elm_button_add(ad->win); + elm_box_pack_end(box, btn); + evas_object_show(btn); + + ic = elm_icon_add(ad->win); + elm_icon_standard_set(ic, "close"); + elm_object_part_content_set(btn, "icon", ic); + + evas_object_smart_callback_add(btn, "clicked", _search_close_cb, ad); + + ad->search_box = box; + ad->search_entry = entry; + + elm_object_focus_set(entry, EINA_TRUE); +} + +static void +default_content_set(Evas_Object *web) +{ +#ifdef HAVE_ELEMENTARY_WEB + Evas_Object *view, *frame; + const char contents[] = "" + "\n" + " \n" + " Nothing to see here, move along\n" + " \n" + " \n" + " E\n" + "
\n" + " Google\n" + "
\n" + " \n" + "\n"; + + view = elm_web_webkit_view_get(web); + frame = ewk_view_frame_main_get(view); + ewk_frame_contents_set(frame, contents, sizeof(contents) - 1, "text/html", + "UTF-8", NULL); +#else + (void) web; +#endif +} + +EAPI_MAIN int +elm_main(int argc, char *argv[]) +{ + Evas_Object *win, *bg, *box, *box2, *btn, *ic, *url, *naviframe, *tabs, *web; + Evas *e; + Evas_Modifier_Mask ctrl_mask; + App_Data *ad; + + if (!elm_need_web()) + return -1; + + ad = calloc(1, sizeof(App_Data)); + if (!ad) return -1; + + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + + win = elm_win_add(NULL, "example-web", ELM_WIN_BASIC); + elm_win_autodel_set(win, EINA_TRUE); + + e = evas_object_evas_get(win); + ctrl_mask = evas_key_modifier_mask_get(e, "Control"); + if (!evas_object_key_grab(win, "f", ctrl_mask, 0, EINA_TRUE)) + fprintf(stderr, "Could not grab trigger for search dialog\n"); + + evas_object_smart_callback_add(win, "delete,request", _win_del_request_cb, + ad); + evas_object_event_callback_add(win, EVAS_CALLBACK_KEY_DOWN, + _win_search_trigger_cb, ad); + evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _win_free_cb, ad); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + box = elm_box_add(win); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, box); + evas_object_show(box); + + url = elm_entry_add(win); + elm_entry_single_line_set(url, EINA_TRUE); + elm_entry_scrollable_set(url, EINA_TRUE); + evas_object_size_hint_weight_set(url, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(url, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, url); + evas_object_show(url); + + evas_object_smart_callback_add(url, "activated", _url_activated_cb, ad); + + box2 = elm_box_add(win); + elm_box_horizontal_set(box2, EINA_TRUE); + elm_object_part_content_set(url, "icon", box2); + elm_entry_icon_visible_set(url, EINA_FALSE); + + btn = elm_button_add(win); + elm_box_pack_end(box2, btn); + evas_object_show(btn); + + ad->nav.back = btn; + + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "arrow_left"); + elm_object_part_content_set(btn, "icon", ic); + + evas_object_smart_callback_add(btn, "clicked", _nav_back_cb, ad); + + btn = elm_button_add(win); + elm_box_pack_end(box2, btn); + evas_object_show(btn); + + ad->nav.refresh = btn; + + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "refresh"); + elm_object_part_content_set(btn, "icon", ic); + + evas_object_smart_callback_add(btn, "clicked", _nav_refresh_cb, ad); + + btn = elm_button_add(win); + elm_box_pack_end(box2, btn); + evas_object_show(btn); + + ad->nav.fwd = btn; + + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "arrow_right"); + elm_object_part_content_set(btn, "icon", ic); + + evas_object_smart_callback_add(btn, "clicked", _nav_fwd_cb, ad); + + box2 = elm_box_add(win); + elm_box_horizontal_set(box2, EINA_TRUE); + evas_object_size_hint_weight_set(box2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(box2, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, box2); + evas_object_show(box2); + + btn = elm_button_add(win); + elm_box_pack_end(box2, btn); + evas_object_show(btn); + + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "file"); + elm_object_part_content_set(btn, "icon", ic); + + evas_object_smart_callback_add(btn, "clicked", _add_tab_cb, ad); + + tabs = elm_toolbar_add(win); + elm_toolbar_align_set(tabs, 0.0); + elm_toolbar_select_mode_set(tabs, ELM_OBJECT_SELECT_MODE_ALWAYS); + elm_toolbar_homogeneous_set(tabs, EINA_FALSE); + elm_toolbar_shrink_mode_set(tabs, ELM_TOOLBAR_SHRINK_MENU); + evas_object_size_hint_weight_set(tabs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(tabs, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box2, tabs); + evas_object_show(tabs); + + btn = elm_button_add(win); + elm_box_pack_end(box2, btn); + evas_object_show(btn); + + evas_object_smart_callback_add(btn, "clicked", _close_tab_cb, ad); + + ic = elm_icon_add(win); + elm_icon_standard_set(ic, "close"); + elm_object_part_content_set(btn, "icon", ic); + + naviframe = elm_naviframe_add(win); + evas_object_size_hint_weight_set(naviframe, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(naviframe, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, naviframe); + evas_object_show(naviframe); + + elm_toolbar_menu_parent_set(tabs, naviframe); + + web = elm_web_add(win); + elm_web_window_create_hook_set(web, _web_create_window_cb, ad); + elm_web_history_enabled_set(web, EINA_FALSE); + evas_object_size_hint_weight_set(web, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(web, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_naviframe_item_simple_push(naviframe, web); + + default_content_set(web); + + ad->win = win; + ad->main_box = box; + ad->naviframe = naviframe; + ad->url = url; + ad->default_web = web; + ad->tabs = tabs; + ad->close_tab = btn; + + evas_object_resize(win, 480, 640); + evas_object_show(win); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/examples/win_example.c b/libraries/elementary/src/examples/win_example.c new file mode 100644 index 0000000..87e985d --- /dev/null +++ b/libraries/elementary/src/examples/win_example.c @@ -0,0 +1,327 @@ +/* + * gcc -o win_example win_example.c `pkg-config --cflags --libs elementary ecore-x` + */ +#ifdef HAVE_ELEMENTARY_X +# include +#endif + +#include + +static void +_btn_activate_cb(void *data, Evas_Object *obj, void *event) +{ + elm_win_activate(data); +} + +static void +_btn_lower_cb(void *data, Evas_Object *obj, void *event) +{ + elm_win_lower(data); +} + +static void +_btn_raise_cb(void *data, Evas_Object *obj, void *event) +{ + elm_win_raise(data); +} + +static void +_btn_borderless_cb(void *data, Evas_Object *obj, void *event) +{ + Eina_Bool flag = elm_win_borderless_get(data); + elm_win_borderless_set(data, !flag); +} + +static void +_btn_shaped_cb(void *data, Evas_Object *obj, void *event) +{ + Eina_Bool flag = elm_win_shaped_get(data); + elm_win_shaped_set(data, !flag); +} + +static void +_btn_alpha_cb(void *data, Evas_Object *obj, void *event) +{ + Eina_Bool flag = elm_win_alpha_get(data); + elm_win_alpha_set(data, !flag); +} + +static void +_btn_fullscreen_cb(void *data, Evas_Object *obj, void *event) +{ + Eina_Bool flag = elm_win_fullscreen_get(data); + elm_win_fullscreen_set(data, !flag); +} + +static void +_btn_maximized_cb(void *data, Evas_Object *obj, void *event) +{ + Eina_Bool flag = elm_win_maximized_get(data); + elm_win_maximized_set(data, !flag); +} + +static void +_btn_iconified_cb(void *data, Evas_Object *obj, void *event) +{ + Eina_Bool flag = elm_win_iconified_get(data); + elm_win_iconified_set(data, !flag); +} + +static void +_btn_rotation_cb(void *data, Evas_Object *obj, void *event) +{ + int angle = elm_win_rotation_get(data); + angle = (angle + 90) % 360; + elm_win_rotation_set(data, angle); +} + +static void +_btn_rotation_resize_cb(void *data, Evas_Object *obj, void *event) +{ + int angle = elm_win_rotation_get(data); + angle = (angle + 90) % 360; + elm_win_rotation_with_resize_set(data, angle); +} + +static void +_btn_sticky_cb(void *data, Evas_Object *obj, void *event) +{ + Eina_Bool flag = elm_win_sticky_get(data); + elm_win_sticky_set(data, !flag); +} + +static void +_yes_quit_cb(void *data, Evas_Object *obj, void *event) +{ + elm_exit(); +} + +static void +_no_quit_cb(void *data, Evas_Object *obj, void *event) +{ + evas_object_del(data); +} + +static void +_main_win_del_cb(void *data, Evas_Object *obj, void *event) +{ + Evas_Object *msg, *box, *box2, *btn, *lbl, *sep; + + msg = elm_notify_add(obj); + elm_notify_orient_set(msg, ELM_NOTIFY_ORIENT_CENTER); + elm_notify_allow_events_set(msg, EINA_FALSE); + evas_object_show(msg); + + box = elm_box_add(obj); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_content_set(msg, box); + evas_object_show(box); + + lbl = elm_label_add(obj); + elm_object_text_set(lbl, "Really want quit?"); + evas_object_size_hint_weight_set(lbl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(lbl, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, lbl); + evas_object_show(lbl); + + sep = elm_separator_add(obj); + elm_separator_horizontal_set(sep, EINA_TRUE); + elm_box_pack_end(box, sep); + evas_object_show(sep); + + box2 = elm_box_add(obj); + elm_box_horizontal_set(box2, EINA_TRUE); + evas_object_size_hint_weight_set(box2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(box2, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, box2); + evas_object_show(box2); + + btn = elm_button_add(obj); + elm_object_text_set(btn, "Yes"); + elm_box_pack_end(box2, btn); + evas_object_show(btn); + + evas_object_smart_callback_add(btn, "clicked", _yes_quit_cb, NULL); + + btn = elm_button_add(obj); + elm_object_text_set(btn, "No"); + elm_box_pack_end(box2, btn); + evas_object_show(btn); + + evas_object_smart_callback_add(btn, "clicked", _no_quit_cb, msg); +} + +static void +_force_focus_cb(void *data, Evas_Object *obj, void *event) +{ +#ifdef HAVE_ELEMENTARY_X + Ecore_X_Window xwin = elm_win_xwindow_get(data); + ecore_x_window_focus(xwin); +#endif +} + +static void +_win_focused_cb(void *data, Evas_Object *obj, void *event) +{ + const char *name = data; + printf("Window focused: %s\n", name); +} + +EAPI_MAIN int +elm_main(int argc, char *argv[]) +{ + Evas_Object *win, *win2, *bg, *bigbox, *box, *btn, *o; + char buf[256]; + + elm_app_info_set(elm_main, "elementary", "images/logo.png"); + win = elm_win_add(NULL, "win-example", ELM_WIN_BASIC); + elm_win_title_set(win, "Elm_Win Example"); + elm_win_focus_highlight_enabled_set(win, EINA_TRUE); + evas_object_resize(win, 400, 400); + evas_object_show(win); + + evas_object_smart_callback_add(win, "focus,in", _win_focused_cb, "mainwin"); + + evas_object_smart_callback_add(win, "delete,request", _main_win_del_cb, + NULL); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + bigbox = elm_box_add(win); + elm_box_horizontal_set(bigbox, EINA_TRUE); + evas_object_size_hint_weight_set(bigbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bigbox); + evas_object_show(bigbox); + + box = elm_box_add(win); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bigbox, box); + evas_object_show(box); + + win2 = elm_win_add(NULL, "sub-win-example", ELM_WIN_DIALOG_BASIC); + elm_win_autodel_set(win2, EINA_TRUE); + elm_win_title_set(win2, "Managed window"); + evas_object_show(win2); + + evas_object_smart_callback_add(win2, "focus,in", _win_focused_cb, "managed"); + + o = elm_icon_add(win2); + sprintf(buf, "%s/images/logo.png", elm_app_data_dir_get()); + elm_icon_file_set(o, buf, NULL); + elm_icon_resizable_set(o, 0, 0); + elm_icon_no_scale_set(o, EINA_TRUE); + elm_win_resize_object_add(win2, o); + evas_object_show(o); + + o = elm_label_add(win); + elm_object_text_set(o, "Managed Window"); + elm_box_pack_end(box, o); + evas_object_show(o); + +#define WIN_ACTION(name) \ + do { \ + btn = elm_button_add(win); \ + elm_object_text_set(btn, #name); \ + elm_box_pack_end(box, btn); \ + evas_object_show(btn); \ + evas_object_smart_callback_add(btn, "clicked", _btn_##name##_cb, win2); \ + } while (0) + + WIN_ACTION(activate); + WIN_ACTION(lower); + WIN_ACTION(raise); + WIN_ACTION(borderless); + WIN_ACTION(shaped); + WIN_ACTION(alpha); + WIN_ACTION(fullscreen); + WIN_ACTION(maximized); + WIN_ACTION(iconified); + WIN_ACTION(rotation); + WIN_ACTION(rotation_resize); + WIN_ACTION(sticky); + + box = elm_box_add(win); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bigbox, box); + evas_object_show(box); + + win2 = elm_win_add(NULL, "sub-win-example2", ELM_WIN_BASIC); + elm_win_autodel_set(win2, EINA_TRUE); + elm_win_title_set(win2, "Non-managed window"); + elm_win_override_set(win2, EINA_TRUE); + evas_object_show(win2); + + evas_object_smart_callback_add(win2, "focus,in", _win_focused_cb, + "override"); + + o = elm_bg_add(win2); + evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win2, o); + evas_object_show(o); + + bigbox = elm_box_add(win2); + evas_object_size_hint_weight_set(bigbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win2, bigbox); + evas_object_show(bigbox); + + o = elm_label_add(win2); + elm_object_text_set(o, "This window should have no borders or titlebar." + "It was set in override mode, so the Window Manager" + "should ignore everything about it." + "It's up to the program to handle it properly, and some" + "of the actions performed on it may not have any effect." + ); + elm_box_pack_end(bigbox, o); + evas_object_show(o); + + o = elm_entry_add(win2); + elm_object_text_set(o, "See if you can focus me"); + elm_entry_single_line_set(o, EINA_TRUE); + elm_entry_scrollable_set(o, EINA_TRUE); + evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bigbox, o); + evas_object_show(o); + + o = elm_separator_add(win2); + elm_separator_horizontal_set(o, EINA_TRUE); + elm_box_pack_end(bigbox, o); + evas_object_show(o); + + o = elm_button_add(win2); + elm_object_text_set(o, "Focus me"); + elm_box_pack_end(bigbox, o); + evas_object_show(o); + + evas_object_smart_callback_add(o, "clicked", _force_focus_cb, win2); + + o = elm_label_add(win); + elm_object_text_set(o, "Override Window"); + elm_box_pack_end(box, o); + evas_object_show(o); + + WIN_ACTION(activate); + WIN_ACTION(lower); + WIN_ACTION(raise); + WIN_ACTION(borderless); + WIN_ACTION(shaped); + WIN_ACTION(alpha); + WIN_ACTION(fullscreen); + WIN_ACTION(maximized); + WIN_ACTION(iconified); + WIN_ACTION(rotation); + WIN_ACTION(rotation_resize); + WIN_ACTION(sticky); + + elm_run(); + elm_shutdown(); + + return 0; +} +ELM_MAIN() diff --git a/libraries/elementary/src/lib/Elementary.h b/libraries/elementary/src/lib/Elementary.h new file mode 100644 index 0000000..1ffa87a --- /dev/null +++ b/libraries/elementary/src/lib/Elementary.h @@ -0,0 +1,258 @@ +/* This is the primary Elementary header file that includes all other useful + * headers. + * + * Elementary is distributed under the LGPLv2 license. Please see the COPYING + * file that was distributed with this source. + */ +#ifndef ELEMENTARY_H +#define ELEMENTARY_H + +#define ELM_UNIX +#undef ELM_WIN32 +#undef ELM_WINCE +#define ELM_EDBUS +#define ELM_EFREET +#define ELM_ETHUMB +#undef ELM_WEB +#undef ELM_EMAP +#undef ELM_DEBUG +#define ELM_ALLOCA_H +#define ELM_LIBINTL_H +#define ELM_DIRENT_H + +/* Standard headers for standard system calls etc. */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef ELM_DIRENT_H +#include +#endif +#include +#include + +#ifdef ELM_UNIX +#include +#ifdef ELM_LIBINTL_H +#include +#endif +#include +#include +#include +#endif + +#ifdef ELM_ALLOCA_H +#include +#endif + +#if defined (ELM_WIN32) || defined (ELM_WINCE) +#include +#ifndef alloca +#define alloca _alloca +#endif +#endif + +/* EFL headers */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef ELM_EDBUS +#include +#endif + +#ifdef ELM_EFREET +#include +#include +#include +#endif + +#ifdef ELM_ETHUMB +#include +#endif + +#ifdef ELM_EMAP +#include +#endif + +#ifdef EAPI +# undef EAPI +#endif + +#ifdef _WIN32 +# ifdef ELEMENTARY_BUILD +# ifdef DLL_EXPORT +# define EAPI __declspec(dllexport) +# else +# define EAPI +# endif /* ! DLL_EXPORT */ +# else +# define EAPI __declspec(dllimport) +# endif /* ! EFL_EVAS_BUILD */ +#else +# ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# else +# define EAPI +# endif +# else +# define EAPI +# endif +#endif /* ! _WIN32 */ + +#ifdef _WIN32 +# define EAPI_MAIN +#else +# define EAPI_MAIN EAPI +#endif + +/* allow usage from c++ */ +#ifdef __cplusplus +extern "C" +{ +#endif + +/* docs */ +#include // OK +#include // OK +#include // OK + +#define ELM_VERSION_MAJOR 1 +#define ELM_VERSION_MINOR 0 + +typedef struct _Elm_Version +{ + int major; + int minor; + int micro; + int revision; +} Elm_Version; + +EAPI extern Elm_Version *elm_version; + +/* include these first for general used definitions */ +#include // OK +#include // OK +#include // OK + +/* special widgets - types used elsewhere */ +#include // OK +#include // OK +#include // OK +#include // OK + +/* other includes */ +// Tom Hacohen +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK + +// Daniel Juyung Seo +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK + +// Chuneon Park +//#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK + +// Woohyun Jung +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK + +// SanjeevBA +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK + +// Carsten Haitzler +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include +#include // OK + +/* include deprecated calls last of all */ +#include // OK + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libraries/elementary/src/lib/Elementary.h.in b/libraries/elementary/src/lib/Elementary.h.in new file mode 100644 index 0000000..37ce93b --- /dev/null +++ b/libraries/elementary/src/lib/Elementary.h.in @@ -0,0 +1,258 @@ +/* This is the primary Elementary header file that includes all other useful + * headers. + * + * Elementary is distributed under the LGPLv2 license. Please see the COPYING + * file that was distributed with this source. + */ +#ifndef ELEMENTARY_H +#define ELEMENTARY_H + +@ELM_UNIX_DEF@ ELM_UNIX +@ELM_WIN32_DEF@ ELM_WIN32 +@ELM_WINCE_DEF@ ELM_WINCE +@ELM_EDBUS_DEF@ ELM_EDBUS +@ELM_EFREET_DEF@ ELM_EFREET +@ELM_ETHUMB_DEF@ ELM_ETHUMB +@ELM_WEB_DEF@ ELM_WEB +@ELM_EMAP_DEF@ ELM_EMAP +@ELM_DEBUG_DEF@ ELM_DEBUG +@ELM_ALLOCA_H_DEF@ ELM_ALLOCA_H +@ELM_LIBINTL_H_DEF@ ELM_LIBINTL_H +@ELM_DIRENT_H_DEF@ ELM_DIRENT_H + +/* Standard headers for standard system calls etc. */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef ELM_DIRENT_H +#include +#endif +#include +#include + +#ifdef ELM_UNIX +#include +#ifdef ELM_LIBINTL_H +#include +#endif +#include +#include +#include +#endif + +#ifdef ELM_ALLOCA_H +#include +#endif + +#if defined (ELM_WIN32) || defined (ELM_WINCE) +#include +#ifndef alloca +#define alloca _alloca +#endif +#endif + +/* EFL headers */ +#include +#include +#include +#include +#include +#include +#include +@ELEMENTARY_ECORE_IMF_INC@ +@ELEMENTARY_ECORE_CON_INC@ +#include + +#ifdef ELM_EDBUS +#include +#endif + +#ifdef ELM_EFREET +#include +#include +#include +#endif + +#ifdef ELM_ETHUMB +#include +#endif + +#ifdef ELM_EMAP +#include +#endif + +#ifdef EAPI +# undef EAPI +#endif + +#ifdef _WIN32 +# ifdef ELEMENTARY_BUILD +# ifdef DLL_EXPORT +# define EAPI __declspec(dllexport) +# else +# define EAPI +# endif /* ! DLL_EXPORT */ +# else +# define EAPI __declspec(dllimport) +# endif /* ! EFL_EVAS_BUILD */ +#else +# ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# else +# define EAPI +# endif +# else +# define EAPI +# endif +#endif /* ! _WIN32 */ + +#ifdef _WIN32 +# define EAPI_MAIN +#else +# define EAPI_MAIN EAPI +#endif + +/* allow usage from c++ */ +#ifdef __cplusplus +extern "C" +{ +#endif + +/* docs */ +#include // OK +#include // OK +#include // OK + +#define ELM_VERSION_MAJOR @VMAJ@ +#define ELM_VERSION_MINOR @VMIN@ + +typedef struct _Elm_Version +{ + int major; + int minor; + int micro; + int revision; +} Elm_Version; + +EAPI extern Elm_Version *elm_version; + +/* include these first for general used definitions */ +#include // OK +#include // OK +#include // OK + +/* special widgets - types used elsewhere */ +#include // OK +#include // OK +#include // OK +#include // OK + +/* other includes */ +// Tom Hacohen +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK + +// Daniel Juyung Seo +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK + +// Chuneon Park +//#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK + +// Woohyun Jung +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK + +// SanjeevBA +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK + +// Carsten Haitzler +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include // OK +#include +#include // OK + +/* include deprecated calls last of all */ +#include // OK + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libraries/elementary/src/lib/Elementary_Cursor.h b/libraries/elementary/src/lib/Elementary_Cursor.h new file mode 100644 index 0000000..f77154b --- /dev/null +++ b/libraries/elementary/src/lib/Elementary_Cursor.h @@ -0,0 +1,87 @@ +#ifndef _ELM_CURSOR_H +#define _ELM_CURSOR_H + +/** + * @file + * @brief Defines the various cursor types for the X Windows system. + */ + +#define ELM_CURSOR_X "x" +#define ELM_CURSOR_ARROW "arrow" +#define ELM_CURSOR_BASED_ARROW_DOWN "based_arrow_down" +#define ELM_CURSOR_BASED_ARROW_UP "based_arrow_up" +#define ELM_CURSOR_BOAT "boat" +#define ELM_CURSOR_BOGOSITY "bogosity" +#define ELM_CURSOR_BOTTOM_LEFT_CORNER "bottom_left_corner" +#define ELM_CURSOR_BOTTOM_RIGHT_CORNER "bottom_right_corner" +#define ELM_CURSOR_BOTTOM_SIDE "bottom_side" +#define ELM_CURSOR_BOTTOM_TEE "bottom_tee" +#define ELM_CURSOR_BOX_SPIRAL "box_spiral" +#define ELM_CURSOR_CENTER_PTR "center_ptr" +#define ELM_CURSOR_CIRCLE "circle" +#define ELM_CURSOR_CLOCK "clock" +#define ELM_CURSOR_COFFEE_MUG "coffee_mug" +#define ELM_CURSOR_CROSS "cross" +#define ELM_CURSOR_CROSS_REVERSE "cross_reverse" +#define ELM_CURSOR_CROSSHAIR "crosshair" +#define ELM_CURSOR_DIAMOND_CROSS "diamond_cross" +#define ELM_CURSOR_DOT "dot" +#define ELM_CURSOR_DOT_BOX_MASK "dot_box_mask" +#define ELM_CURSOR_DOUBLE_ARROW "double_arrow" +#define ELM_CURSOR_DRAFT_LARGE "draft_large" +#define ELM_CURSOR_DRAFT_SMALL "draft_small" +#define ELM_CURSOR_DRAPED_BOX "draped_box" +#define ELM_CURSOR_EXCHANGE "exchange" +#define ELM_CURSOR_FLEUR "fleur" +#define ELM_CURSOR_GOBBLER "gobbler" +#define ELM_CURSOR_GUMBY "gumby" +#define ELM_CURSOR_HAND1 "hand1" +#define ELM_CURSOR_HAND2 "hand2" +#define ELM_CURSOR_HEART "heart" +#define ELM_CURSOR_ICON "icon" +#define ELM_CURSOR_IRON_CROSS "iron_cross" +#define ELM_CURSOR_LEFT_PTR "left_ptr" +#define ELM_CURSOR_LEFT_SIDE "left_side" +#define ELM_CURSOR_LEFT_TEE "left_tee" +#define ELM_CURSOR_LEFTBUTTON "leftbutton" +#define ELM_CURSOR_LL_ANGLE "ll_angle" +#define ELM_CURSOR_LR_ANGLE "lr_angle" +#define ELM_CURSOR_MAN "man" +#define ELM_CURSOR_MIDDLEBUTTON "middlebutton" +#define ELM_CURSOR_MOUSE "mouse" +#define ELM_CURSOR_PENCIL "pencil" +#define ELM_CURSOR_PIRATE "pirate" +#define ELM_CURSOR_PLUS "plus" +#define ELM_CURSOR_QUESTION_ARROW "question_arrow" +#define ELM_CURSOR_RIGHT_PTR "right_ptr" +#define ELM_CURSOR_RIGHT_SIDE "right_side" +#define ELM_CURSOR_RIGHT_TEE "right_tee" +#define ELM_CURSOR_RIGHTBUTTON "rightbutton" +#define ELM_CURSOR_RTL_LOGO "rtl_logo" +#define ELM_CURSOR_SAILBOAT "sailboat" +#define ELM_CURSOR_SB_DOWN_ARROW "sb_down_arrow" +#define ELM_CURSOR_SB_H_DOUBLE_ARROW "sb_h_double_arrow" +#define ELM_CURSOR_SB_LEFT_ARROW "sb_left_arrow" +#define ELM_CURSOR_SB_RIGHT_ARROW "sb_right_arrow" +#define ELM_CURSOR_SB_UP_ARROW "sb_up_arrow" +#define ELM_CURSOR_SB_V_DOUBLE_ARROW "sb_v_double_arrow" +#define ELM_CURSOR_SHUTTLE "shuttle" +#define ELM_CURSOR_SIZING "sizing" +#define ELM_CURSOR_SPIDER "spider" +#define ELM_CURSOR_SPRAYCAN "spraycan" +#define ELM_CURSOR_STAR "star" +#define ELM_CURSOR_TARGET "target" +#define ELM_CURSOR_TCROSS "tcross" +#define ELM_CURSOR_TOP_LEFT_ARROW "top_left_arrow" +#define ELM_CURSOR_TOP_LEFT_CORNER "top_left_corner" +#define ELM_CURSOR_TOP_RIGHT_CORNER "top_right_corner" +#define ELM_CURSOR_TOP_SIDE "top_side" +#define ELM_CURSOR_TOP_TEE "top_tee" +#define ELM_CURSOR_TREK "trek" +#define ELM_CURSOR_UL_ANGLE "ul_angle" +#define ELM_CURSOR_UMBRELLA "umbrella" +#define ELM_CURSOR_UR_ANGLE "ur_angle" +#define ELM_CURSOR_WATCH "watch" +#define ELM_CURSOR_XTERM "xterm" + +#endif // ifndef _ELM_CURSOR_H diff --git a/libraries/elementary/src/lib/Makefile.am b/libraries/elementary/src/lib/Makefile.am new file mode 100644 index 0000000..844f481 --- /dev/null +++ b/libraries/elementary/src/lib/Makefile.am @@ -0,0 +1,253 @@ +AUTOMAKE_OPTIONS = 1.4 foreign +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-DELM_INTERNAL_API_ARGESFSDFEFC=1 \ +-DMODULES_PATH=\"$(libdir)/elementary/modules\" \ +-I. \ +-I$(top_builddir) \ +-I$(top_srcdir) \ +-I$(top_srcdir)/src/lib \ +-I$(top_builddir)/src/lib \ +-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ +-DLOCALE_DIR=\"@LOCALE_DIR@\" \ +-DPACKAGE_LIB_DIR=\"$(libdir)\" \ +@ELEMENTARY_CFLAGS@ \ +@ELEMENTARY_X_CFLAGS@ \ +@ELEMENTARY_FB_CFLAGS@ \ +@ELEMENTARY_SDL_CFLAGS@ \ +@ELEMENTARY_WIN32_CFLAGS@ \ +@ELEMENTARY_WINCE_CFLAGS@ \ +@ELEMENTARY_EDBUS_CFLAGS@ \ +@ELEMENTARY_EFREET_CFLAGS@ \ +@ELEMENTARY_ETHUMB_CFLAGS@ \ +@ELEMENTARY_WEB_CFLAGS@ \ +@ELEMENTARY_EMAP_CFLAGS@ \ +@ELEMENTARY_ECORE_CON_CFLAGS@ \ +@ELEMENTARY_ECORE_IMF_CFLAGS@ \ +@EVIL_CFLAGS@ \ +@EIO_CFLAGS@ \ +@EMOTION_CFLAGS@ + +if ELEMENTARY_WINDOWS_BUILD +AM_CPPFLAGS += -DELEMENTARY_BUILD +endif + +lib_LTLIBRARIES = libelementary.la + +includes_HEADERS = \ +Elementary.h \ +Elementary_Cursor.h +includesdir = $(includedir)/elementary-@VMAJ@ + +includesunstable_HEADERS = \ +elm_widget.h +includesunstabledir = $(includedir)/elementary-@VMAJ@ + +includesub_HEADERS = \ +elc_ctxpopup.h \ +elc_dayselector.h \ +elc_fileselector_button.h \ +elc_fileselector_entry.h \ +elc_fileselector.h \ +elc_hoversel.h \ +elc_multibuttonentry.h \ +elc_naviframe.h \ +elc_popup.h \ +elm_actionslider.h \ +elm_app.h \ +elm_authors.h \ +elm_bg.h \ +elm_box.h \ +elm_bubble.h \ +elm_button.h \ +elm_cache.h \ +elm_calendar.h \ +elm_check.h \ +elm_clock.h \ +elm_cnp.h \ +elm_colorselector.h \ +elm_config.h \ +elm_conform.h \ +elm_cursor.h \ +elm_datetime.h \ +elm_debug.h \ +elm_deprecated.h \ +elm_diskselector.h \ +elm_entry.h \ +elm_finger.h \ +elm_flip.h \ +elm_flipselector.h \ +elm_focus.h \ +elm_font.h \ +elm_frame.h \ +elm_gen.h \ +elm_general.h \ +elm_gengrid.h \ +elm_genlist.h \ +elm_gesture_layer.h \ +elm_getting_started.h \ +elm_glview.h \ +elm_grid.h \ +elm_hover.h \ +elm_icon.h \ +elm_image.h \ +elm_plug.h \ +elm_index.h \ +elm_intro.h \ +elm_label.h \ +elm_layout.h \ +elm_list.h \ +elm_macros.h \ +elm_mapbuf.h \ +elm_map.h \ +elm_menu.h \ +elm_mirroring.h \ +elm_need.h \ +elm_notify.h \ +elm_object.h \ +elm_object_item.h \ +elm_panel.h \ +elm_panes.h \ +elm_photocam.h \ +elm_photo.h \ +elm_progressbar.h \ +elm_radio.h \ +elm_route.h \ +elm_scale.h \ +elm_scroller.h \ +elm_scroll.h \ +elm_segment_control.h \ +elm_separator.h \ +elm_slider.h \ +elm_slideshow.h \ +elm_spinner.h \ +elm_store.h \ +elm_table.h \ +elm_theme.h \ +elm_thumb.h \ +elm_toolbar.h \ +elm_tooltip.h \ +elm_transit.h \ +elm_video.h \ +elm_web.h \ +elm_win.h +includesubdir = $(includedir)/elementary-@VMAJ@/ + +libelementary_la_SOURCES = \ +elm_priv.h \ +elc_ctxpopup.c \ +elc_dayselector.c \ +elc_popup.c \ +elc_fileselector_button.c \ +elc_fileselector.c \ +elc_fileselector_entry.c \ +elc_hoversel.c \ +elc_naviframe.c \ +elc_multibuttonentry.c \ +elc_player.c \ +elc_scrolled_entry.c \ +elm_access.c \ +elm_actionslider.c \ +elm_bg.c \ +elm_box.c \ +elm_bubble.c \ +elm_button.c \ +elm_calendar.c \ +elm_check.c \ +elm_clock.c \ +elm_cnp.c \ +elm_colorselector.c \ +elm_config.c \ +elm_conform.c \ +elm_datetime.c \ +elm_diskselector.c \ +elm_entry.c \ +elm_flip.c \ +elm_flipselector.c \ +elm_font.c \ +elm_frame.c \ +elm_gengrid.c \ +elm_genlist.c \ +elm_gen_common.h \ +elm_gesture_layer.c \ +elm_glview.c \ +elm_grid.c \ +elm_hover.c \ +elm_icon.c \ +elm_image.c \ +elm_plug.c \ +elm_index.c \ +elm_label.c \ +elm_layout.c \ +elm_list.c \ +elm_main.c \ +elm_mapbuf.c \ +elm_map.c \ +elm_menu.c \ +elm_module.c \ +elm_notify.c \ +elm_panel.c \ +elm_panes.c \ +elm_photo.c \ +elm_photocam.c \ +elm_progressbar.c \ +elm_radio.c \ +elm_route.c \ +elm_scroller.c \ +elm_segment_control.c \ +elm_separator.c \ +elm_slider.c \ +elm_slideshow.c \ +elm_spinner.c \ +elm_store.c \ +elm_table.c \ +elm_theme.c \ +elm_thumb.c \ +elm_toolbar.c \ +elm_transit.c \ +elm_util.c \ +elm_video.c \ +elm_web.c \ +elm_widget.c \ +elm_win.c \ +els_box.c \ +els_box.h \ +els_cursor.c \ +els_icon.c \ +els_icon.h \ +els_pan.c \ +els_pan.h \ +els_scroller.c \ +els_scroller.h \ +els_tooltip.c \ +elu_ews_wm.c + +libelementary_la_CFLAGS = +libelementary_la_LIBADD = \ +@my_libs@ \ +@dlopen_libs@ \ +@ELEMENTARY_LIBS@ \ +@ELEMENTARY_X_LIBS@ \ +@ELEMENTARY_FB_LIBS@ \ +@ELEMENTARY_SDL_LIBS@ \ +@ELEMENTARY_WIN32_LIBS@ \ +@ELEMENTARY_WINCE_LIBS@ \ +@ELEMENTARY_EDBUS_LIBS@ \ +@ELEMENTARY_EFREET_LIBS@ \ +@ELEMENTARY_ETHUMB_LIBS@ \ +@ELEMENTARY_WEB_LIBS@ \ +@ELEMENTARY_EMAP_LIBS@ \ +@ELEMENTARY_ECORE_IMF_LIBS@ \ +@ELEMENTARY_ECORE_CON_LIBS@ \ +@EVIL_LIBS@ \ +@EIO_LIBS@ \ +@EMOTION_LIBS@ + +libelementary_la_LDFLAGS = \ +-no-undefined @lt_enable_auto_import@ \ +-version-info @version_info@ @release_info@ + +EXTRA_DIST = \ +elm_factory.h \ +elm_factory.c diff --git a/libraries/elementary/src/lib/Makefile.in b/libraries/elementary/src/lib/Makefile.in new file mode 100644 index 0000000..f53e41b --- /dev/null +++ b/libraries/elementary/src/lib/Makefile.in @@ -0,0 +1,1731 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@ELEMENTARY_WINDOWS_BUILD_TRUE@am__append_1 = -DELEMENTARY_BUILD +subdir = src/lib +DIST_COMMON = $(includes_HEADERS) $(includesub_HEADERS) \ + $(includesunstable_HEADERS) $(srcdir)/Elementary.h.in \ + $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/efl_binary.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/elementary_config.h +CONFIG_CLEAN_FILES = Elementary.h +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" \ + "$(DESTDIR)$(includesubdir)" \ + "$(DESTDIR)$(includesunstabledir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libelementary_la_DEPENDENCIES = +am_libelementary_la_OBJECTS = libelementary_la-elc_ctxpopup.lo \ + libelementary_la-elc_dayselector.lo \ + libelementary_la-elc_popup.lo \ + libelementary_la-elc_fileselector_button.lo \ + libelementary_la-elc_fileselector.lo \ + libelementary_la-elc_fileselector_entry.lo \ + libelementary_la-elc_hoversel.lo \ + libelementary_la-elc_naviframe.lo \ + libelementary_la-elc_multibuttonentry.lo \ + libelementary_la-elc_player.lo \ + libelementary_la-elc_scrolled_entry.lo \ + libelementary_la-elm_access.lo \ + libelementary_la-elm_actionslider.lo \ + libelementary_la-elm_bg.lo libelementary_la-elm_box.lo \ + libelementary_la-elm_bubble.lo libelementary_la-elm_button.lo \ + libelementary_la-elm_calendar.lo libelementary_la-elm_check.lo \ + libelementary_la-elm_clock.lo libelementary_la-elm_cnp.lo \ + libelementary_la-elm_colorselector.lo \ + libelementary_la-elm_config.lo libelementary_la-elm_conform.lo \ + libelementary_la-elm_datetime.lo \ + libelementary_la-elm_diskselector.lo \ + libelementary_la-elm_entry.lo libelementary_la-elm_flip.lo \ + libelementary_la-elm_flipselector.lo \ + libelementary_la-elm_font.lo libelementary_la-elm_frame.lo \ + libelementary_la-elm_gengrid.lo \ + libelementary_la-elm_genlist.lo \ + libelementary_la-elm_gesture_layer.lo \ + libelementary_la-elm_glview.lo libelementary_la-elm_grid.lo \ + libelementary_la-elm_hover.lo libelementary_la-elm_icon.lo \ + libelementary_la-elm_image.lo libelementary_la-elm_plug.lo \ + libelementary_la-elm_index.lo libelementary_la-elm_label.lo \ + libelementary_la-elm_layout.lo libelementary_la-elm_list.lo \ + libelementary_la-elm_main.lo libelementary_la-elm_mapbuf.lo \ + libelementary_la-elm_map.lo libelementary_la-elm_menu.lo \ + libelementary_la-elm_module.lo libelementary_la-elm_notify.lo \ + libelementary_la-elm_panel.lo libelementary_la-elm_panes.lo \ + libelementary_la-elm_photo.lo libelementary_la-elm_photocam.lo \ + libelementary_la-elm_progressbar.lo \ + libelementary_la-elm_radio.lo libelementary_la-elm_route.lo \ + libelementary_la-elm_scroller.lo \ + libelementary_la-elm_segment_control.lo \ + libelementary_la-elm_separator.lo \ + libelementary_la-elm_slider.lo \ + libelementary_la-elm_slideshow.lo \ + libelementary_la-elm_spinner.lo libelementary_la-elm_store.lo \ + libelementary_la-elm_table.lo libelementary_la-elm_theme.lo \ + libelementary_la-elm_thumb.lo libelementary_la-elm_toolbar.lo \ + libelementary_la-elm_transit.lo libelementary_la-elm_util.lo \ + libelementary_la-elm_video.lo libelementary_la-elm_web.lo \ + libelementary_la-elm_widget.lo libelementary_la-elm_win.lo \ + libelementary_la-els_box.lo libelementary_la-els_cursor.lo \ + libelementary_la-els_icon.lo libelementary_la-els_pan.lo \ + libelementary_la-els_scroller.lo \ + libelementary_la-els_tooltip.lo libelementary_la-elu_ews_wm.lo +libelementary_la_OBJECTS = $(am_libelementary_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +libelementary_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libelementary_la_CFLAGS) $(CFLAGS) \ + $(libelementary_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libelementary_la_SOURCES) +DIST_SOURCES = $(libelementary_la_SOURCES) +HEADERS = $(includes_HEADERS) $(includesub_HEADERS) \ + $(includesunstable_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EIO_CFLAGS = @EIO_CFLAGS@ +EIO_LIBS = @EIO_LIBS@ +ELEMENTARY_CFLAGS = @ELEMENTARY_CFLAGS@ +ELEMENTARY_COCOA_CFLAGS = @ELEMENTARY_COCOA_CFLAGS@ +ELEMENTARY_COCOA_LIBS = @ELEMENTARY_COCOA_LIBS@ +ELEMENTARY_CONFIG_PRG = @ELEMENTARY_CONFIG_PRG@ +ELEMENTARY_ECORE_CON_CFLAGS = @ELEMENTARY_ECORE_CON_CFLAGS@ +ELEMENTARY_ECORE_CON_INC = @ELEMENTARY_ECORE_CON_INC@ +ELEMENTARY_ECORE_CON_LIBS = @ELEMENTARY_ECORE_CON_LIBS@ +ELEMENTARY_ECORE_IMF_CFLAGS = @ELEMENTARY_ECORE_IMF_CFLAGS@ +ELEMENTARY_ECORE_IMF_INC = @ELEMENTARY_ECORE_IMF_INC@ +ELEMENTARY_ECORE_IMF_LIBS = @ELEMENTARY_ECORE_IMF_LIBS@ +ELEMENTARY_EDBUS_CFLAGS = @ELEMENTARY_EDBUS_CFLAGS@ +ELEMENTARY_EDBUS_LIBS = @ELEMENTARY_EDBUS_LIBS@ +ELEMENTARY_EFREET_CFLAGS = @ELEMENTARY_EFREET_CFLAGS@ +ELEMENTARY_EFREET_LIBS = @ELEMENTARY_EFREET_LIBS@ +ELEMENTARY_EMAP_CFLAGS = @ELEMENTARY_EMAP_CFLAGS@ +ELEMENTARY_EMAP_LIBS = @ELEMENTARY_EMAP_LIBS@ +ELEMENTARY_ETHUMB_CFLAGS = @ELEMENTARY_ETHUMB_CFLAGS@ +ELEMENTARY_ETHUMB_LIBS = @ELEMENTARY_ETHUMB_LIBS@ +ELEMENTARY_EWEATHER_CFLAGS = @ELEMENTARY_EWEATHER_CFLAGS@ +ELEMENTARY_EWEATHER_LIBS = @ELEMENTARY_EWEATHER_LIBS@ +ELEMENTARY_FB_CFLAGS = @ELEMENTARY_FB_CFLAGS@ +ELEMENTARY_FB_LIBS = @ELEMENTARY_FB_LIBS@ +ELEMENTARY_LIBS = @ELEMENTARY_LIBS@ +ELEMENTARY_PSL1GHT_CFLAGS = @ELEMENTARY_PSL1GHT_CFLAGS@ +ELEMENTARY_PSL1GHT_LIBS = @ELEMENTARY_PSL1GHT_LIBS@ +ELEMENTARY_SDL_CFLAGS = @ELEMENTARY_SDL_CFLAGS@ +ELEMENTARY_SDL_LIBS = @ELEMENTARY_SDL_LIBS@ +ELEMENTARY_TEST_PRG = @ELEMENTARY_TEST_PRG@ +ELEMENTARY_WEB_CFLAGS = @ELEMENTARY_WEB_CFLAGS@ +ELEMENTARY_WEB_LIBS = @ELEMENTARY_WEB_LIBS@ +ELEMENTARY_WIN32_CFLAGS = @ELEMENTARY_WIN32_CFLAGS@ +ELEMENTARY_WIN32_LIBS = @ELEMENTARY_WIN32_LIBS@ +ELEMENTARY_WINCE_CFLAGS = @ELEMENTARY_WINCE_CFLAGS@ +ELEMENTARY_WINCE_LIBS = @ELEMENTARY_WINCE_LIBS@ +ELEMENTARY_X_CFLAGS = @ELEMENTARY_X_CFLAGS@ +ELEMENTARY_X_LIBS = @ELEMENTARY_X_LIBS@ +ELM_ALLOCA_H_DEF = @ELM_ALLOCA_H_DEF@ +ELM_DEBUG_DEF = @ELM_DEBUG_DEF@ +ELM_DIRENT_H_DEF = @ELM_DIRENT_H_DEF@ +ELM_EDBUS_DEF = @ELM_EDBUS_DEF@ +ELM_EFREET_DEF = @ELM_EFREET_DEF@ +ELM_EMAP_DEF = @ELM_EMAP_DEF@ +ELM_ETHUMB_DEF = @ELM_ETHUMB_DEF@ +ELM_EWEATHER_DEF = @ELM_EWEATHER_DEF@ +ELM_LIBINTL_H_DEF = @ELM_LIBINTL_H_DEF@ +ELM_UNIX_DEF = @ELM_UNIX_DEF@ +ELM_WEB_DEF = @ELM_WEB_DEF@ +ELM_WIN32_DEF = @ELM_WIN32_DEF@ +ELM_WINCE_DEF = @ELM_WINCE_DEF@ +EMOTION_CFLAGS = @EMOTION_CFLAGS@ +EMOTION_LIBS = @EMOTION_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALE_DIR = @LOCALE_DIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MODULE_ARCH = @MODULE_ARCH@ +MODULE_EDJE = @MODULE_EDJE@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +VMIN = @VMIN@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +edje_cc = @edje_cc@ +eet_eet = @eet_eet@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +my_libs = @my_libs@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirement_elm = @requirement_elm@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +AUTOMAKE_OPTIONS = 1.4 foreign +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = -DELM_INTERNAL_API_ARGESFSDFEFC=1 \ + -DMODULES_PATH=\"$(libdir)/elementary/modules\" -I. \ + -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/src/lib \ + -I$(top_builddir)/src/lib \ + -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ + -DLOCALE_DIR=\"@LOCALE_DIR@\" -DPACKAGE_LIB_DIR=\"$(libdir)\" \ + @ELEMENTARY_CFLAGS@ @ELEMENTARY_X_CFLAGS@ \ + @ELEMENTARY_FB_CFLAGS@ @ELEMENTARY_SDL_CFLAGS@ \ + @ELEMENTARY_WIN32_CFLAGS@ @ELEMENTARY_WINCE_CFLAGS@ \ + @ELEMENTARY_EDBUS_CFLAGS@ @ELEMENTARY_EFREET_CFLAGS@ \ + @ELEMENTARY_ETHUMB_CFLAGS@ @ELEMENTARY_WEB_CFLAGS@ \ + @ELEMENTARY_EMAP_CFLAGS@ @ELEMENTARY_ECORE_CON_CFLAGS@ \ + @ELEMENTARY_ECORE_IMF_CFLAGS@ @EVIL_CFLAGS@ @EIO_CFLAGS@ \ + @EMOTION_CFLAGS@ $(am__append_1) +lib_LTLIBRARIES = libelementary.la +includes_HEADERS = \ +Elementary.h \ +Elementary_Cursor.h + +includesdir = $(includedir)/elementary-@VMAJ@ +includesunstable_HEADERS = \ +elm_widget.h + +includesunstabledir = $(includedir)/elementary-@VMAJ@ +includesub_HEADERS = \ +elc_ctxpopup.h \ +elc_dayselector.h \ +elc_fileselector_button.h \ +elc_fileselector_entry.h \ +elc_fileselector.h \ +elc_hoversel.h \ +elc_multibuttonentry.h \ +elc_naviframe.h \ +elc_popup.h \ +elm_actionslider.h \ +elm_app.h \ +elm_authors.h \ +elm_bg.h \ +elm_box.h \ +elm_bubble.h \ +elm_button.h \ +elm_cache.h \ +elm_calendar.h \ +elm_check.h \ +elm_clock.h \ +elm_cnp.h \ +elm_colorselector.h \ +elm_config.h \ +elm_conform.h \ +elm_cursor.h \ +elm_datetime.h \ +elm_debug.h \ +elm_deprecated.h \ +elm_diskselector.h \ +elm_entry.h \ +elm_finger.h \ +elm_flip.h \ +elm_flipselector.h \ +elm_focus.h \ +elm_font.h \ +elm_frame.h \ +elm_gen.h \ +elm_general.h \ +elm_gengrid.h \ +elm_genlist.h \ +elm_gesture_layer.h \ +elm_getting_started.h \ +elm_glview.h \ +elm_grid.h \ +elm_hover.h \ +elm_icon.h \ +elm_image.h \ +elm_plug.h \ +elm_index.h \ +elm_intro.h \ +elm_label.h \ +elm_layout.h \ +elm_list.h \ +elm_macros.h \ +elm_mapbuf.h \ +elm_map.h \ +elm_menu.h \ +elm_mirroring.h \ +elm_need.h \ +elm_notify.h \ +elm_object.h \ +elm_object_item.h \ +elm_panel.h \ +elm_panes.h \ +elm_photocam.h \ +elm_photo.h \ +elm_progressbar.h \ +elm_radio.h \ +elm_route.h \ +elm_scale.h \ +elm_scroller.h \ +elm_scroll.h \ +elm_segment_control.h \ +elm_separator.h \ +elm_slider.h \ +elm_slideshow.h \ +elm_spinner.h \ +elm_store.h \ +elm_table.h \ +elm_theme.h \ +elm_thumb.h \ +elm_toolbar.h \ +elm_tooltip.h \ +elm_transit.h \ +elm_video.h \ +elm_web.h \ +elm_win.h + +includesubdir = $(includedir)/elementary-@VMAJ@/ +libelementary_la_SOURCES = \ +elm_priv.h \ +elc_ctxpopup.c \ +elc_dayselector.c \ +elc_popup.c \ +elc_fileselector_button.c \ +elc_fileselector.c \ +elc_fileselector_entry.c \ +elc_hoversel.c \ +elc_naviframe.c \ +elc_multibuttonentry.c \ +elc_player.c \ +elc_scrolled_entry.c \ +elm_access.c \ +elm_actionslider.c \ +elm_bg.c \ +elm_box.c \ +elm_bubble.c \ +elm_button.c \ +elm_calendar.c \ +elm_check.c \ +elm_clock.c \ +elm_cnp.c \ +elm_colorselector.c \ +elm_config.c \ +elm_conform.c \ +elm_datetime.c \ +elm_diskselector.c \ +elm_entry.c \ +elm_flip.c \ +elm_flipselector.c \ +elm_font.c \ +elm_frame.c \ +elm_gengrid.c \ +elm_genlist.c \ +elm_gen_common.h \ +elm_gesture_layer.c \ +elm_glview.c \ +elm_grid.c \ +elm_hover.c \ +elm_icon.c \ +elm_image.c \ +elm_plug.c \ +elm_index.c \ +elm_label.c \ +elm_layout.c \ +elm_list.c \ +elm_main.c \ +elm_mapbuf.c \ +elm_map.c \ +elm_menu.c \ +elm_module.c \ +elm_notify.c \ +elm_panel.c \ +elm_panes.c \ +elm_photo.c \ +elm_photocam.c \ +elm_progressbar.c \ +elm_radio.c \ +elm_route.c \ +elm_scroller.c \ +elm_segment_control.c \ +elm_separator.c \ +elm_slider.c \ +elm_slideshow.c \ +elm_spinner.c \ +elm_store.c \ +elm_table.c \ +elm_theme.c \ +elm_thumb.c \ +elm_toolbar.c \ +elm_transit.c \ +elm_util.c \ +elm_video.c \ +elm_web.c \ +elm_widget.c \ +elm_win.c \ +els_box.c \ +els_box.h \ +els_cursor.c \ +els_icon.c \ +els_icon.h \ +els_pan.c \ +els_pan.h \ +els_scroller.c \ +els_scroller.h \ +els_tooltip.c \ +elu_ews_wm.c + +libelementary_la_CFLAGS = +libelementary_la_LIBADD = \ +@my_libs@ \ +@dlopen_libs@ \ +@ELEMENTARY_LIBS@ \ +@ELEMENTARY_X_LIBS@ \ +@ELEMENTARY_FB_LIBS@ \ +@ELEMENTARY_SDL_LIBS@ \ +@ELEMENTARY_WIN32_LIBS@ \ +@ELEMENTARY_WINCE_LIBS@ \ +@ELEMENTARY_EDBUS_LIBS@ \ +@ELEMENTARY_EFREET_LIBS@ \ +@ELEMENTARY_ETHUMB_LIBS@ \ +@ELEMENTARY_WEB_LIBS@ \ +@ELEMENTARY_EMAP_LIBS@ \ +@ELEMENTARY_ECORE_IMF_LIBS@ \ +@ELEMENTARY_ECORE_CON_LIBS@ \ +@EVIL_LIBS@ \ +@EIO_LIBS@ \ +@EMOTION_LIBS@ + +libelementary_la_LDFLAGS = \ +-no-undefined @lt_enable_auto_import@ \ +-version-info @version_info@ @release_info@ + +EXTRA_DIST = \ +elm_factory.h \ +elm_factory.c + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/lib/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/lib/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +Elementary.h: $(top_builddir)/config.status $(srcdir)/Elementary.h.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libelementary.la: $(libelementary_la_OBJECTS) $(libelementary_la_DEPENDENCIES) + $(AM_V_CCLD)$(libelementary_la_LINK) -rpath $(libdir) $(libelementary_la_OBJECTS) $(libelementary_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elc_ctxpopup.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elc_dayselector.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elc_fileselector.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elc_fileselector_button.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elc_fileselector_entry.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elc_hoversel.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elc_multibuttonentry.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elc_naviframe.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elc_player.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elc_popup.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elc_scrolled_entry.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_access.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_actionslider.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_bg.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_box.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_bubble.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_button.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_calendar.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_check.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_clock.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_cnp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_colorselector.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_config.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_conform.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_datetime.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_diskselector.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_entry.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_flip.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_flipselector.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_font.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_frame.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_gengrid.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_genlist.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_gesture_layer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_glview.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_grid.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_hover.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_icon.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_image.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_index.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_label.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_layout.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_list.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_main.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_map.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_mapbuf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_menu.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_module.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_notify.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_panel.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_panes.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_photo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_photocam.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_plug.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_progressbar.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_radio.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_route.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_scroller.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_segment_control.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_separator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_slider.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_slideshow.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_spinner.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_store.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_table.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_theme.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_thumb.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_toolbar.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_transit.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_util.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_video.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_web.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_widget.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elm_win.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-els_box.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-els_cursor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-els_icon.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-els_pan.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-els_scroller.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-els_tooltip.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libelementary_la-elu_ews_wm.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +libelementary_la-elc_ctxpopup.lo: elc_ctxpopup.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elc_ctxpopup.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elc_ctxpopup.Tpo -c -o libelementary_la-elc_ctxpopup.lo `test -f 'elc_ctxpopup.c' || echo '$(srcdir)/'`elc_ctxpopup.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elc_ctxpopup.Tpo $(DEPDIR)/libelementary_la-elc_ctxpopup.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elc_ctxpopup.c' object='libelementary_la-elc_ctxpopup.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elc_ctxpopup.lo `test -f 'elc_ctxpopup.c' || echo '$(srcdir)/'`elc_ctxpopup.c + +libelementary_la-elc_dayselector.lo: elc_dayselector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elc_dayselector.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elc_dayselector.Tpo -c -o libelementary_la-elc_dayselector.lo `test -f 'elc_dayselector.c' || echo '$(srcdir)/'`elc_dayselector.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elc_dayselector.Tpo $(DEPDIR)/libelementary_la-elc_dayselector.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elc_dayselector.c' object='libelementary_la-elc_dayselector.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elc_dayselector.lo `test -f 'elc_dayselector.c' || echo '$(srcdir)/'`elc_dayselector.c + +libelementary_la-elc_popup.lo: elc_popup.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elc_popup.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elc_popup.Tpo -c -o libelementary_la-elc_popup.lo `test -f 'elc_popup.c' || echo '$(srcdir)/'`elc_popup.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elc_popup.Tpo $(DEPDIR)/libelementary_la-elc_popup.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elc_popup.c' object='libelementary_la-elc_popup.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elc_popup.lo `test -f 'elc_popup.c' || echo '$(srcdir)/'`elc_popup.c + +libelementary_la-elc_fileselector_button.lo: elc_fileselector_button.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elc_fileselector_button.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elc_fileselector_button.Tpo -c -o libelementary_la-elc_fileselector_button.lo `test -f 'elc_fileselector_button.c' || echo '$(srcdir)/'`elc_fileselector_button.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elc_fileselector_button.Tpo $(DEPDIR)/libelementary_la-elc_fileselector_button.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elc_fileselector_button.c' object='libelementary_la-elc_fileselector_button.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elc_fileselector_button.lo `test -f 'elc_fileselector_button.c' || echo '$(srcdir)/'`elc_fileselector_button.c + +libelementary_la-elc_fileselector.lo: elc_fileselector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elc_fileselector.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elc_fileselector.Tpo -c -o libelementary_la-elc_fileselector.lo `test -f 'elc_fileselector.c' || echo '$(srcdir)/'`elc_fileselector.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elc_fileselector.Tpo $(DEPDIR)/libelementary_la-elc_fileselector.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elc_fileselector.c' object='libelementary_la-elc_fileselector.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elc_fileselector.lo `test -f 'elc_fileselector.c' || echo '$(srcdir)/'`elc_fileselector.c + +libelementary_la-elc_fileselector_entry.lo: elc_fileselector_entry.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elc_fileselector_entry.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elc_fileselector_entry.Tpo -c -o libelementary_la-elc_fileselector_entry.lo `test -f 'elc_fileselector_entry.c' || echo '$(srcdir)/'`elc_fileselector_entry.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elc_fileselector_entry.Tpo $(DEPDIR)/libelementary_la-elc_fileselector_entry.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elc_fileselector_entry.c' object='libelementary_la-elc_fileselector_entry.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elc_fileselector_entry.lo `test -f 'elc_fileselector_entry.c' || echo '$(srcdir)/'`elc_fileselector_entry.c + +libelementary_la-elc_hoversel.lo: elc_hoversel.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elc_hoversel.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elc_hoversel.Tpo -c -o libelementary_la-elc_hoversel.lo `test -f 'elc_hoversel.c' || echo '$(srcdir)/'`elc_hoversel.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elc_hoversel.Tpo $(DEPDIR)/libelementary_la-elc_hoversel.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elc_hoversel.c' object='libelementary_la-elc_hoversel.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elc_hoversel.lo `test -f 'elc_hoversel.c' || echo '$(srcdir)/'`elc_hoversel.c + +libelementary_la-elc_naviframe.lo: elc_naviframe.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elc_naviframe.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elc_naviframe.Tpo -c -o libelementary_la-elc_naviframe.lo `test -f 'elc_naviframe.c' || echo '$(srcdir)/'`elc_naviframe.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elc_naviframe.Tpo $(DEPDIR)/libelementary_la-elc_naviframe.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elc_naviframe.c' object='libelementary_la-elc_naviframe.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elc_naviframe.lo `test -f 'elc_naviframe.c' || echo '$(srcdir)/'`elc_naviframe.c + +libelementary_la-elc_multibuttonentry.lo: elc_multibuttonentry.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elc_multibuttonentry.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elc_multibuttonentry.Tpo -c -o libelementary_la-elc_multibuttonentry.lo `test -f 'elc_multibuttonentry.c' || echo '$(srcdir)/'`elc_multibuttonentry.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elc_multibuttonentry.Tpo $(DEPDIR)/libelementary_la-elc_multibuttonentry.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elc_multibuttonentry.c' object='libelementary_la-elc_multibuttonentry.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elc_multibuttonentry.lo `test -f 'elc_multibuttonentry.c' || echo '$(srcdir)/'`elc_multibuttonentry.c + +libelementary_la-elc_player.lo: elc_player.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elc_player.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elc_player.Tpo -c -o libelementary_la-elc_player.lo `test -f 'elc_player.c' || echo '$(srcdir)/'`elc_player.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elc_player.Tpo $(DEPDIR)/libelementary_la-elc_player.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elc_player.c' object='libelementary_la-elc_player.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elc_player.lo `test -f 'elc_player.c' || echo '$(srcdir)/'`elc_player.c + +libelementary_la-elc_scrolled_entry.lo: elc_scrolled_entry.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elc_scrolled_entry.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elc_scrolled_entry.Tpo -c -o libelementary_la-elc_scrolled_entry.lo `test -f 'elc_scrolled_entry.c' || echo '$(srcdir)/'`elc_scrolled_entry.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elc_scrolled_entry.Tpo $(DEPDIR)/libelementary_la-elc_scrolled_entry.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elc_scrolled_entry.c' object='libelementary_la-elc_scrolled_entry.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elc_scrolled_entry.lo `test -f 'elc_scrolled_entry.c' || echo '$(srcdir)/'`elc_scrolled_entry.c + +libelementary_la-elm_access.lo: elm_access.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_access.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_access.Tpo -c -o libelementary_la-elm_access.lo `test -f 'elm_access.c' || echo '$(srcdir)/'`elm_access.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_access.Tpo $(DEPDIR)/libelementary_la-elm_access.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_access.c' object='libelementary_la-elm_access.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_access.lo `test -f 'elm_access.c' || echo '$(srcdir)/'`elm_access.c + +libelementary_la-elm_actionslider.lo: elm_actionslider.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_actionslider.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_actionslider.Tpo -c -o libelementary_la-elm_actionslider.lo `test -f 'elm_actionslider.c' || echo '$(srcdir)/'`elm_actionslider.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_actionslider.Tpo $(DEPDIR)/libelementary_la-elm_actionslider.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_actionslider.c' object='libelementary_la-elm_actionslider.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_actionslider.lo `test -f 'elm_actionslider.c' || echo '$(srcdir)/'`elm_actionslider.c + +libelementary_la-elm_bg.lo: elm_bg.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_bg.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_bg.Tpo -c -o libelementary_la-elm_bg.lo `test -f 'elm_bg.c' || echo '$(srcdir)/'`elm_bg.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_bg.Tpo $(DEPDIR)/libelementary_la-elm_bg.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_bg.c' object='libelementary_la-elm_bg.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_bg.lo `test -f 'elm_bg.c' || echo '$(srcdir)/'`elm_bg.c + +libelementary_la-elm_box.lo: elm_box.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_box.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_box.Tpo -c -o libelementary_la-elm_box.lo `test -f 'elm_box.c' || echo '$(srcdir)/'`elm_box.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_box.Tpo $(DEPDIR)/libelementary_la-elm_box.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_box.c' object='libelementary_la-elm_box.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_box.lo `test -f 'elm_box.c' || echo '$(srcdir)/'`elm_box.c + +libelementary_la-elm_bubble.lo: elm_bubble.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_bubble.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_bubble.Tpo -c -o libelementary_la-elm_bubble.lo `test -f 'elm_bubble.c' || echo '$(srcdir)/'`elm_bubble.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_bubble.Tpo $(DEPDIR)/libelementary_la-elm_bubble.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_bubble.c' object='libelementary_la-elm_bubble.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_bubble.lo `test -f 'elm_bubble.c' || echo '$(srcdir)/'`elm_bubble.c + +libelementary_la-elm_button.lo: elm_button.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_button.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_button.Tpo -c -o libelementary_la-elm_button.lo `test -f 'elm_button.c' || echo '$(srcdir)/'`elm_button.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_button.Tpo $(DEPDIR)/libelementary_la-elm_button.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_button.c' object='libelementary_la-elm_button.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_button.lo `test -f 'elm_button.c' || echo '$(srcdir)/'`elm_button.c + +libelementary_la-elm_calendar.lo: elm_calendar.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_calendar.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_calendar.Tpo -c -o libelementary_la-elm_calendar.lo `test -f 'elm_calendar.c' || echo '$(srcdir)/'`elm_calendar.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_calendar.Tpo $(DEPDIR)/libelementary_la-elm_calendar.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_calendar.c' object='libelementary_la-elm_calendar.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_calendar.lo `test -f 'elm_calendar.c' || echo '$(srcdir)/'`elm_calendar.c + +libelementary_la-elm_check.lo: elm_check.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_check.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_check.Tpo -c -o libelementary_la-elm_check.lo `test -f 'elm_check.c' || echo '$(srcdir)/'`elm_check.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_check.Tpo $(DEPDIR)/libelementary_la-elm_check.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_check.c' object='libelementary_la-elm_check.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_check.lo `test -f 'elm_check.c' || echo '$(srcdir)/'`elm_check.c + +libelementary_la-elm_clock.lo: elm_clock.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_clock.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_clock.Tpo -c -o libelementary_la-elm_clock.lo `test -f 'elm_clock.c' || echo '$(srcdir)/'`elm_clock.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_clock.Tpo $(DEPDIR)/libelementary_la-elm_clock.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_clock.c' object='libelementary_la-elm_clock.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_clock.lo `test -f 'elm_clock.c' || echo '$(srcdir)/'`elm_clock.c + +libelementary_la-elm_cnp.lo: elm_cnp.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_cnp.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_cnp.Tpo -c -o libelementary_la-elm_cnp.lo `test -f 'elm_cnp.c' || echo '$(srcdir)/'`elm_cnp.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_cnp.Tpo $(DEPDIR)/libelementary_la-elm_cnp.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_cnp.c' object='libelementary_la-elm_cnp.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_cnp.lo `test -f 'elm_cnp.c' || echo '$(srcdir)/'`elm_cnp.c + +libelementary_la-elm_colorselector.lo: elm_colorselector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_colorselector.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_colorselector.Tpo -c -o libelementary_la-elm_colorselector.lo `test -f 'elm_colorselector.c' || echo '$(srcdir)/'`elm_colorselector.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_colorselector.Tpo $(DEPDIR)/libelementary_la-elm_colorselector.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_colorselector.c' object='libelementary_la-elm_colorselector.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_colorselector.lo `test -f 'elm_colorselector.c' || echo '$(srcdir)/'`elm_colorselector.c + +libelementary_la-elm_config.lo: elm_config.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_config.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_config.Tpo -c -o libelementary_la-elm_config.lo `test -f 'elm_config.c' || echo '$(srcdir)/'`elm_config.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_config.Tpo $(DEPDIR)/libelementary_la-elm_config.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_config.c' object='libelementary_la-elm_config.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_config.lo `test -f 'elm_config.c' || echo '$(srcdir)/'`elm_config.c + +libelementary_la-elm_conform.lo: elm_conform.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_conform.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_conform.Tpo -c -o libelementary_la-elm_conform.lo `test -f 'elm_conform.c' || echo '$(srcdir)/'`elm_conform.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_conform.Tpo $(DEPDIR)/libelementary_la-elm_conform.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_conform.c' object='libelementary_la-elm_conform.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_conform.lo `test -f 'elm_conform.c' || echo '$(srcdir)/'`elm_conform.c + +libelementary_la-elm_datetime.lo: elm_datetime.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_datetime.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_datetime.Tpo -c -o libelementary_la-elm_datetime.lo `test -f 'elm_datetime.c' || echo '$(srcdir)/'`elm_datetime.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_datetime.Tpo $(DEPDIR)/libelementary_la-elm_datetime.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_datetime.c' object='libelementary_la-elm_datetime.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_datetime.lo `test -f 'elm_datetime.c' || echo '$(srcdir)/'`elm_datetime.c + +libelementary_la-elm_diskselector.lo: elm_diskselector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_diskselector.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_diskselector.Tpo -c -o libelementary_la-elm_diskselector.lo `test -f 'elm_diskselector.c' || echo '$(srcdir)/'`elm_diskselector.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_diskselector.Tpo $(DEPDIR)/libelementary_la-elm_diskselector.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_diskselector.c' object='libelementary_la-elm_diskselector.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_diskselector.lo `test -f 'elm_diskselector.c' || echo '$(srcdir)/'`elm_diskselector.c + +libelementary_la-elm_entry.lo: elm_entry.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_entry.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_entry.Tpo -c -o libelementary_la-elm_entry.lo `test -f 'elm_entry.c' || echo '$(srcdir)/'`elm_entry.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_entry.Tpo $(DEPDIR)/libelementary_la-elm_entry.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_entry.c' object='libelementary_la-elm_entry.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_entry.lo `test -f 'elm_entry.c' || echo '$(srcdir)/'`elm_entry.c + +libelementary_la-elm_flip.lo: elm_flip.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_flip.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_flip.Tpo -c -o libelementary_la-elm_flip.lo `test -f 'elm_flip.c' || echo '$(srcdir)/'`elm_flip.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_flip.Tpo $(DEPDIR)/libelementary_la-elm_flip.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_flip.c' object='libelementary_la-elm_flip.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_flip.lo `test -f 'elm_flip.c' || echo '$(srcdir)/'`elm_flip.c + +libelementary_la-elm_flipselector.lo: elm_flipselector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_flipselector.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_flipselector.Tpo -c -o libelementary_la-elm_flipselector.lo `test -f 'elm_flipselector.c' || echo '$(srcdir)/'`elm_flipselector.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_flipselector.Tpo $(DEPDIR)/libelementary_la-elm_flipselector.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_flipselector.c' object='libelementary_la-elm_flipselector.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_flipselector.lo `test -f 'elm_flipselector.c' || echo '$(srcdir)/'`elm_flipselector.c + +libelementary_la-elm_font.lo: elm_font.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_font.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_font.Tpo -c -o libelementary_la-elm_font.lo `test -f 'elm_font.c' || echo '$(srcdir)/'`elm_font.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_font.Tpo $(DEPDIR)/libelementary_la-elm_font.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_font.c' object='libelementary_la-elm_font.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_font.lo `test -f 'elm_font.c' || echo '$(srcdir)/'`elm_font.c + +libelementary_la-elm_frame.lo: elm_frame.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_frame.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_frame.Tpo -c -o libelementary_la-elm_frame.lo `test -f 'elm_frame.c' || echo '$(srcdir)/'`elm_frame.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_frame.Tpo $(DEPDIR)/libelementary_la-elm_frame.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_frame.c' object='libelementary_la-elm_frame.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_frame.lo `test -f 'elm_frame.c' || echo '$(srcdir)/'`elm_frame.c + +libelementary_la-elm_gengrid.lo: elm_gengrid.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_gengrid.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_gengrid.Tpo -c -o libelementary_la-elm_gengrid.lo `test -f 'elm_gengrid.c' || echo '$(srcdir)/'`elm_gengrid.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_gengrid.Tpo $(DEPDIR)/libelementary_la-elm_gengrid.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_gengrid.c' object='libelementary_la-elm_gengrid.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_gengrid.lo `test -f 'elm_gengrid.c' || echo '$(srcdir)/'`elm_gengrid.c + +libelementary_la-elm_genlist.lo: elm_genlist.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_genlist.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_genlist.Tpo -c -o libelementary_la-elm_genlist.lo `test -f 'elm_genlist.c' || echo '$(srcdir)/'`elm_genlist.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_genlist.Tpo $(DEPDIR)/libelementary_la-elm_genlist.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_genlist.c' object='libelementary_la-elm_genlist.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_genlist.lo `test -f 'elm_genlist.c' || echo '$(srcdir)/'`elm_genlist.c + +libelementary_la-elm_gesture_layer.lo: elm_gesture_layer.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_gesture_layer.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_gesture_layer.Tpo -c -o libelementary_la-elm_gesture_layer.lo `test -f 'elm_gesture_layer.c' || echo '$(srcdir)/'`elm_gesture_layer.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_gesture_layer.Tpo $(DEPDIR)/libelementary_la-elm_gesture_layer.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_gesture_layer.c' object='libelementary_la-elm_gesture_layer.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_gesture_layer.lo `test -f 'elm_gesture_layer.c' || echo '$(srcdir)/'`elm_gesture_layer.c + +libelementary_la-elm_glview.lo: elm_glview.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_glview.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_glview.Tpo -c -o libelementary_la-elm_glview.lo `test -f 'elm_glview.c' || echo '$(srcdir)/'`elm_glview.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_glview.Tpo $(DEPDIR)/libelementary_la-elm_glview.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_glview.c' object='libelementary_la-elm_glview.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_glview.lo `test -f 'elm_glview.c' || echo '$(srcdir)/'`elm_glview.c + +libelementary_la-elm_grid.lo: elm_grid.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_grid.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_grid.Tpo -c -o libelementary_la-elm_grid.lo `test -f 'elm_grid.c' || echo '$(srcdir)/'`elm_grid.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_grid.Tpo $(DEPDIR)/libelementary_la-elm_grid.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_grid.c' object='libelementary_la-elm_grid.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_grid.lo `test -f 'elm_grid.c' || echo '$(srcdir)/'`elm_grid.c + +libelementary_la-elm_hover.lo: elm_hover.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_hover.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_hover.Tpo -c -o libelementary_la-elm_hover.lo `test -f 'elm_hover.c' || echo '$(srcdir)/'`elm_hover.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_hover.Tpo $(DEPDIR)/libelementary_la-elm_hover.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_hover.c' object='libelementary_la-elm_hover.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_hover.lo `test -f 'elm_hover.c' || echo '$(srcdir)/'`elm_hover.c + +libelementary_la-elm_icon.lo: elm_icon.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_icon.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_icon.Tpo -c -o libelementary_la-elm_icon.lo `test -f 'elm_icon.c' || echo '$(srcdir)/'`elm_icon.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_icon.Tpo $(DEPDIR)/libelementary_la-elm_icon.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_icon.c' object='libelementary_la-elm_icon.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_icon.lo `test -f 'elm_icon.c' || echo '$(srcdir)/'`elm_icon.c + +libelementary_la-elm_image.lo: elm_image.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_image.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_image.Tpo -c -o libelementary_la-elm_image.lo `test -f 'elm_image.c' || echo '$(srcdir)/'`elm_image.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_image.Tpo $(DEPDIR)/libelementary_la-elm_image.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_image.c' object='libelementary_la-elm_image.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_image.lo `test -f 'elm_image.c' || echo '$(srcdir)/'`elm_image.c + +libelementary_la-elm_plug.lo: elm_plug.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_plug.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_plug.Tpo -c -o libelementary_la-elm_plug.lo `test -f 'elm_plug.c' || echo '$(srcdir)/'`elm_plug.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_plug.Tpo $(DEPDIR)/libelementary_la-elm_plug.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_plug.c' object='libelementary_la-elm_plug.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_plug.lo `test -f 'elm_plug.c' || echo '$(srcdir)/'`elm_plug.c + +libelementary_la-elm_index.lo: elm_index.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_index.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_index.Tpo -c -o libelementary_la-elm_index.lo `test -f 'elm_index.c' || echo '$(srcdir)/'`elm_index.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_index.Tpo $(DEPDIR)/libelementary_la-elm_index.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_index.c' object='libelementary_la-elm_index.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_index.lo `test -f 'elm_index.c' || echo '$(srcdir)/'`elm_index.c + +libelementary_la-elm_label.lo: elm_label.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_label.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_label.Tpo -c -o libelementary_la-elm_label.lo `test -f 'elm_label.c' || echo '$(srcdir)/'`elm_label.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_label.Tpo $(DEPDIR)/libelementary_la-elm_label.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_label.c' object='libelementary_la-elm_label.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_label.lo `test -f 'elm_label.c' || echo '$(srcdir)/'`elm_label.c + +libelementary_la-elm_layout.lo: elm_layout.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_layout.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_layout.Tpo -c -o libelementary_la-elm_layout.lo `test -f 'elm_layout.c' || echo '$(srcdir)/'`elm_layout.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_layout.Tpo $(DEPDIR)/libelementary_la-elm_layout.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_layout.c' object='libelementary_la-elm_layout.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_layout.lo `test -f 'elm_layout.c' || echo '$(srcdir)/'`elm_layout.c + +libelementary_la-elm_list.lo: elm_list.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_list.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_list.Tpo -c -o libelementary_la-elm_list.lo `test -f 'elm_list.c' || echo '$(srcdir)/'`elm_list.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_list.Tpo $(DEPDIR)/libelementary_la-elm_list.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_list.c' object='libelementary_la-elm_list.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_list.lo `test -f 'elm_list.c' || echo '$(srcdir)/'`elm_list.c + +libelementary_la-elm_main.lo: elm_main.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_main.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_main.Tpo -c -o libelementary_la-elm_main.lo `test -f 'elm_main.c' || echo '$(srcdir)/'`elm_main.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_main.Tpo $(DEPDIR)/libelementary_la-elm_main.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_main.c' object='libelementary_la-elm_main.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_main.lo `test -f 'elm_main.c' || echo '$(srcdir)/'`elm_main.c + +libelementary_la-elm_mapbuf.lo: elm_mapbuf.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_mapbuf.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_mapbuf.Tpo -c -o libelementary_la-elm_mapbuf.lo `test -f 'elm_mapbuf.c' || echo '$(srcdir)/'`elm_mapbuf.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_mapbuf.Tpo $(DEPDIR)/libelementary_la-elm_mapbuf.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_mapbuf.c' object='libelementary_la-elm_mapbuf.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_mapbuf.lo `test -f 'elm_mapbuf.c' || echo '$(srcdir)/'`elm_mapbuf.c + +libelementary_la-elm_map.lo: elm_map.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_map.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_map.Tpo -c -o libelementary_la-elm_map.lo `test -f 'elm_map.c' || echo '$(srcdir)/'`elm_map.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_map.Tpo $(DEPDIR)/libelementary_la-elm_map.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_map.c' object='libelementary_la-elm_map.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_map.lo `test -f 'elm_map.c' || echo '$(srcdir)/'`elm_map.c + +libelementary_la-elm_menu.lo: elm_menu.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_menu.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_menu.Tpo -c -o libelementary_la-elm_menu.lo `test -f 'elm_menu.c' || echo '$(srcdir)/'`elm_menu.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_menu.Tpo $(DEPDIR)/libelementary_la-elm_menu.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_menu.c' object='libelementary_la-elm_menu.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_menu.lo `test -f 'elm_menu.c' || echo '$(srcdir)/'`elm_menu.c + +libelementary_la-elm_module.lo: elm_module.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_module.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_module.Tpo -c -o libelementary_la-elm_module.lo `test -f 'elm_module.c' || echo '$(srcdir)/'`elm_module.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_module.Tpo $(DEPDIR)/libelementary_la-elm_module.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_module.c' object='libelementary_la-elm_module.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_module.lo `test -f 'elm_module.c' || echo '$(srcdir)/'`elm_module.c + +libelementary_la-elm_notify.lo: elm_notify.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_notify.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_notify.Tpo -c -o libelementary_la-elm_notify.lo `test -f 'elm_notify.c' || echo '$(srcdir)/'`elm_notify.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_notify.Tpo $(DEPDIR)/libelementary_la-elm_notify.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_notify.c' object='libelementary_la-elm_notify.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_notify.lo `test -f 'elm_notify.c' || echo '$(srcdir)/'`elm_notify.c + +libelementary_la-elm_panel.lo: elm_panel.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_panel.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_panel.Tpo -c -o libelementary_la-elm_panel.lo `test -f 'elm_panel.c' || echo '$(srcdir)/'`elm_panel.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_panel.Tpo $(DEPDIR)/libelementary_la-elm_panel.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_panel.c' object='libelementary_la-elm_panel.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_panel.lo `test -f 'elm_panel.c' || echo '$(srcdir)/'`elm_panel.c + +libelementary_la-elm_panes.lo: elm_panes.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_panes.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_panes.Tpo -c -o libelementary_la-elm_panes.lo `test -f 'elm_panes.c' || echo '$(srcdir)/'`elm_panes.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_panes.Tpo $(DEPDIR)/libelementary_la-elm_panes.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_panes.c' object='libelementary_la-elm_panes.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_panes.lo `test -f 'elm_panes.c' || echo '$(srcdir)/'`elm_panes.c + +libelementary_la-elm_photo.lo: elm_photo.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_photo.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_photo.Tpo -c -o libelementary_la-elm_photo.lo `test -f 'elm_photo.c' || echo '$(srcdir)/'`elm_photo.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_photo.Tpo $(DEPDIR)/libelementary_la-elm_photo.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_photo.c' object='libelementary_la-elm_photo.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_photo.lo `test -f 'elm_photo.c' || echo '$(srcdir)/'`elm_photo.c + +libelementary_la-elm_photocam.lo: elm_photocam.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_photocam.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_photocam.Tpo -c -o libelementary_la-elm_photocam.lo `test -f 'elm_photocam.c' || echo '$(srcdir)/'`elm_photocam.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_photocam.Tpo $(DEPDIR)/libelementary_la-elm_photocam.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_photocam.c' object='libelementary_la-elm_photocam.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_photocam.lo `test -f 'elm_photocam.c' || echo '$(srcdir)/'`elm_photocam.c + +libelementary_la-elm_progressbar.lo: elm_progressbar.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_progressbar.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_progressbar.Tpo -c -o libelementary_la-elm_progressbar.lo `test -f 'elm_progressbar.c' || echo '$(srcdir)/'`elm_progressbar.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_progressbar.Tpo $(DEPDIR)/libelementary_la-elm_progressbar.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_progressbar.c' object='libelementary_la-elm_progressbar.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_progressbar.lo `test -f 'elm_progressbar.c' || echo '$(srcdir)/'`elm_progressbar.c + +libelementary_la-elm_radio.lo: elm_radio.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_radio.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_radio.Tpo -c -o libelementary_la-elm_radio.lo `test -f 'elm_radio.c' || echo '$(srcdir)/'`elm_radio.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_radio.Tpo $(DEPDIR)/libelementary_la-elm_radio.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_radio.c' object='libelementary_la-elm_radio.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_radio.lo `test -f 'elm_radio.c' || echo '$(srcdir)/'`elm_radio.c + +libelementary_la-elm_route.lo: elm_route.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_route.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_route.Tpo -c -o libelementary_la-elm_route.lo `test -f 'elm_route.c' || echo '$(srcdir)/'`elm_route.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_route.Tpo $(DEPDIR)/libelementary_la-elm_route.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_route.c' object='libelementary_la-elm_route.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_route.lo `test -f 'elm_route.c' || echo '$(srcdir)/'`elm_route.c + +libelementary_la-elm_scroller.lo: elm_scroller.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_scroller.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_scroller.Tpo -c -o libelementary_la-elm_scroller.lo `test -f 'elm_scroller.c' || echo '$(srcdir)/'`elm_scroller.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_scroller.Tpo $(DEPDIR)/libelementary_la-elm_scroller.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_scroller.c' object='libelementary_la-elm_scroller.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_scroller.lo `test -f 'elm_scroller.c' || echo '$(srcdir)/'`elm_scroller.c + +libelementary_la-elm_segment_control.lo: elm_segment_control.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_segment_control.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_segment_control.Tpo -c -o libelementary_la-elm_segment_control.lo `test -f 'elm_segment_control.c' || echo '$(srcdir)/'`elm_segment_control.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_segment_control.Tpo $(DEPDIR)/libelementary_la-elm_segment_control.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_segment_control.c' object='libelementary_la-elm_segment_control.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_segment_control.lo `test -f 'elm_segment_control.c' || echo '$(srcdir)/'`elm_segment_control.c + +libelementary_la-elm_separator.lo: elm_separator.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_separator.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_separator.Tpo -c -o libelementary_la-elm_separator.lo `test -f 'elm_separator.c' || echo '$(srcdir)/'`elm_separator.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_separator.Tpo $(DEPDIR)/libelementary_la-elm_separator.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_separator.c' object='libelementary_la-elm_separator.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_separator.lo `test -f 'elm_separator.c' || echo '$(srcdir)/'`elm_separator.c + +libelementary_la-elm_slider.lo: elm_slider.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_slider.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_slider.Tpo -c -o libelementary_la-elm_slider.lo `test -f 'elm_slider.c' || echo '$(srcdir)/'`elm_slider.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_slider.Tpo $(DEPDIR)/libelementary_la-elm_slider.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_slider.c' object='libelementary_la-elm_slider.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_slider.lo `test -f 'elm_slider.c' || echo '$(srcdir)/'`elm_slider.c + +libelementary_la-elm_slideshow.lo: elm_slideshow.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_slideshow.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_slideshow.Tpo -c -o libelementary_la-elm_slideshow.lo `test -f 'elm_slideshow.c' || echo '$(srcdir)/'`elm_slideshow.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_slideshow.Tpo $(DEPDIR)/libelementary_la-elm_slideshow.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_slideshow.c' object='libelementary_la-elm_slideshow.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_slideshow.lo `test -f 'elm_slideshow.c' || echo '$(srcdir)/'`elm_slideshow.c + +libelementary_la-elm_spinner.lo: elm_spinner.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_spinner.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_spinner.Tpo -c -o libelementary_la-elm_spinner.lo `test -f 'elm_spinner.c' || echo '$(srcdir)/'`elm_spinner.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_spinner.Tpo $(DEPDIR)/libelementary_la-elm_spinner.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_spinner.c' object='libelementary_la-elm_spinner.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_spinner.lo `test -f 'elm_spinner.c' || echo '$(srcdir)/'`elm_spinner.c + +libelementary_la-elm_store.lo: elm_store.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_store.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_store.Tpo -c -o libelementary_la-elm_store.lo `test -f 'elm_store.c' || echo '$(srcdir)/'`elm_store.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_store.Tpo $(DEPDIR)/libelementary_la-elm_store.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_store.c' object='libelementary_la-elm_store.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_store.lo `test -f 'elm_store.c' || echo '$(srcdir)/'`elm_store.c + +libelementary_la-elm_table.lo: elm_table.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_table.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_table.Tpo -c -o libelementary_la-elm_table.lo `test -f 'elm_table.c' || echo '$(srcdir)/'`elm_table.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_table.Tpo $(DEPDIR)/libelementary_la-elm_table.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_table.c' object='libelementary_la-elm_table.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_table.lo `test -f 'elm_table.c' || echo '$(srcdir)/'`elm_table.c + +libelementary_la-elm_theme.lo: elm_theme.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_theme.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_theme.Tpo -c -o libelementary_la-elm_theme.lo `test -f 'elm_theme.c' || echo '$(srcdir)/'`elm_theme.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_theme.Tpo $(DEPDIR)/libelementary_la-elm_theme.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_theme.c' object='libelementary_la-elm_theme.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_theme.lo `test -f 'elm_theme.c' || echo '$(srcdir)/'`elm_theme.c + +libelementary_la-elm_thumb.lo: elm_thumb.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_thumb.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_thumb.Tpo -c -o libelementary_la-elm_thumb.lo `test -f 'elm_thumb.c' || echo '$(srcdir)/'`elm_thumb.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_thumb.Tpo $(DEPDIR)/libelementary_la-elm_thumb.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_thumb.c' object='libelementary_la-elm_thumb.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_thumb.lo `test -f 'elm_thumb.c' || echo '$(srcdir)/'`elm_thumb.c + +libelementary_la-elm_toolbar.lo: elm_toolbar.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_toolbar.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_toolbar.Tpo -c -o libelementary_la-elm_toolbar.lo `test -f 'elm_toolbar.c' || echo '$(srcdir)/'`elm_toolbar.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_toolbar.Tpo $(DEPDIR)/libelementary_la-elm_toolbar.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_toolbar.c' object='libelementary_la-elm_toolbar.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_toolbar.lo `test -f 'elm_toolbar.c' || echo '$(srcdir)/'`elm_toolbar.c + +libelementary_la-elm_transit.lo: elm_transit.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_transit.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_transit.Tpo -c -o libelementary_la-elm_transit.lo `test -f 'elm_transit.c' || echo '$(srcdir)/'`elm_transit.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_transit.Tpo $(DEPDIR)/libelementary_la-elm_transit.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_transit.c' object='libelementary_la-elm_transit.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_transit.lo `test -f 'elm_transit.c' || echo '$(srcdir)/'`elm_transit.c + +libelementary_la-elm_util.lo: elm_util.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_util.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_util.Tpo -c -o libelementary_la-elm_util.lo `test -f 'elm_util.c' || echo '$(srcdir)/'`elm_util.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_util.Tpo $(DEPDIR)/libelementary_la-elm_util.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_util.c' object='libelementary_la-elm_util.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_util.lo `test -f 'elm_util.c' || echo '$(srcdir)/'`elm_util.c + +libelementary_la-elm_video.lo: elm_video.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_video.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_video.Tpo -c -o libelementary_la-elm_video.lo `test -f 'elm_video.c' || echo '$(srcdir)/'`elm_video.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_video.Tpo $(DEPDIR)/libelementary_la-elm_video.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_video.c' object='libelementary_la-elm_video.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_video.lo `test -f 'elm_video.c' || echo '$(srcdir)/'`elm_video.c + +libelementary_la-elm_web.lo: elm_web.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_web.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_web.Tpo -c -o libelementary_la-elm_web.lo `test -f 'elm_web.c' || echo '$(srcdir)/'`elm_web.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_web.Tpo $(DEPDIR)/libelementary_la-elm_web.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_web.c' object='libelementary_la-elm_web.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_web.lo `test -f 'elm_web.c' || echo '$(srcdir)/'`elm_web.c + +libelementary_la-elm_widget.lo: elm_widget.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_widget.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_widget.Tpo -c -o libelementary_la-elm_widget.lo `test -f 'elm_widget.c' || echo '$(srcdir)/'`elm_widget.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_widget.Tpo $(DEPDIR)/libelementary_la-elm_widget.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_widget.c' object='libelementary_la-elm_widget.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_widget.lo `test -f 'elm_widget.c' || echo '$(srcdir)/'`elm_widget.c + +libelementary_la-elm_win.lo: elm_win.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elm_win.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elm_win.Tpo -c -o libelementary_la-elm_win.lo `test -f 'elm_win.c' || echo '$(srcdir)/'`elm_win.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elm_win.Tpo $(DEPDIR)/libelementary_la-elm_win.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elm_win.c' object='libelementary_la-elm_win.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elm_win.lo `test -f 'elm_win.c' || echo '$(srcdir)/'`elm_win.c + +libelementary_la-els_box.lo: els_box.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-els_box.lo -MD -MP -MF $(DEPDIR)/libelementary_la-els_box.Tpo -c -o libelementary_la-els_box.lo `test -f 'els_box.c' || echo '$(srcdir)/'`els_box.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-els_box.Tpo $(DEPDIR)/libelementary_la-els_box.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='els_box.c' object='libelementary_la-els_box.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-els_box.lo `test -f 'els_box.c' || echo '$(srcdir)/'`els_box.c + +libelementary_la-els_cursor.lo: els_cursor.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-els_cursor.lo -MD -MP -MF $(DEPDIR)/libelementary_la-els_cursor.Tpo -c -o libelementary_la-els_cursor.lo `test -f 'els_cursor.c' || echo '$(srcdir)/'`els_cursor.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-els_cursor.Tpo $(DEPDIR)/libelementary_la-els_cursor.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='els_cursor.c' object='libelementary_la-els_cursor.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-els_cursor.lo `test -f 'els_cursor.c' || echo '$(srcdir)/'`els_cursor.c + +libelementary_la-els_icon.lo: els_icon.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-els_icon.lo -MD -MP -MF $(DEPDIR)/libelementary_la-els_icon.Tpo -c -o libelementary_la-els_icon.lo `test -f 'els_icon.c' || echo '$(srcdir)/'`els_icon.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-els_icon.Tpo $(DEPDIR)/libelementary_la-els_icon.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='els_icon.c' object='libelementary_la-els_icon.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-els_icon.lo `test -f 'els_icon.c' || echo '$(srcdir)/'`els_icon.c + +libelementary_la-els_pan.lo: els_pan.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-els_pan.lo -MD -MP -MF $(DEPDIR)/libelementary_la-els_pan.Tpo -c -o libelementary_la-els_pan.lo `test -f 'els_pan.c' || echo '$(srcdir)/'`els_pan.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-els_pan.Tpo $(DEPDIR)/libelementary_la-els_pan.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='els_pan.c' object='libelementary_la-els_pan.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-els_pan.lo `test -f 'els_pan.c' || echo '$(srcdir)/'`els_pan.c + +libelementary_la-els_scroller.lo: els_scroller.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-els_scroller.lo -MD -MP -MF $(DEPDIR)/libelementary_la-els_scroller.Tpo -c -o libelementary_la-els_scroller.lo `test -f 'els_scroller.c' || echo '$(srcdir)/'`els_scroller.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-els_scroller.Tpo $(DEPDIR)/libelementary_la-els_scroller.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='els_scroller.c' object='libelementary_la-els_scroller.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-els_scroller.lo `test -f 'els_scroller.c' || echo '$(srcdir)/'`els_scroller.c + +libelementary_la-els_tooltip.lo: els_tooltip.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-els_tooltip.lo -MD -MP -MF $(DEPDIR)/libelementary_la-els_tooltip.Tpo -c -o libelementary_la-els_tooltip.lo `test -f 'els_tooltip.c' || echo '$(srcdir)/'`els_tooltip.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-els_tooltip.Tpo $(DEPDIR)/libelementary_la-els_tooltip.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='els_tooltip.c' object='libelementary_la-els_tooltip.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-els_tooltip.lo `test -f 'els_tooltip.c' || echo '$(srcdir)/'`els_tooltip.c + +libelementary_la-elu_ews_wm.lo: elu_ews_wm.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -MT libelementary_la-elu_ews_wm.lo -MD -MP -MF $(DEPDIR)/libelementary_la-elu_ews_wm.Tpo -c -o libelementary_la-elu_ews_wm.lo `test -f 'elu_ews_wm.c' || echo '$(srcdir)/'`elu_ews_wm.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libelementary_la-elu_ews_wm.Tpo $(DEPDIR)/libelementary_la-elu_ews_wm.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elu_ews_wm.c' object='libelementary_la-elu_ews_wm.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libelementary_la_CFLAGS) $(CFLAGS) -c -o libelementary_la-elu_ews_wm.lo `test -f 'elu_ews_wm.c' || echo '$(srcdir)/'`elu_ews_wm.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includesHEADERS: $(includes_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ + done + +uninstall-includesHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includesdir)" && rm -f $$files +install-includesubHEADERS: $(includesub_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includesubdir)" || $(MKDIR_P) "$(DESTDIR)$(includesubdir)" + @list='$(includesub_HEADERS)'; test -n "$(includesubdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesubdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesubdir)" || exit $$?; \ + done + +uninstall-includesubHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(includesub_HEADERS)'; test -n "$(includesubdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includesubdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includesubdir)" && rm -f $$files +install-includesunstableHEADERS: $(includesunstable_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includesunstabledir)" || $(MKDIR_P) "$(DESTDIR)$(includesunstabledir)" + @list='$(includesunstable_HEADERS)'; test -n "$(includesunstabledir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesunstabledir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesunstabledir)" || exit $$?; \ + done + +uninstall-includesunstableHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(includesunstable_HEADERS)'; test -n "$(includesunstabledir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includesunstabledir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includesunstabledir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" "$(DESTDIR)$(includesubdir)" "$(DESTDIR)$(includesunstabledir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includesHEADERS install-includesubHEADERS \ + install-includesunstableHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includesHEADERS uninstall-includesubHEADERS \ + uninstall-includesunstableHEADERS uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includesHEADERS \ + install-includesubHEADERS install-includesunstableHEADERS \ + install-info install-info-am install-libLTLIBRARIES \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-includesHEADERS \ + uninstall-includesubHEADERS uninstall-includesunstableHEADERS \ + uninstall-libLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/elementary/src/lib/elc_ctxpopup.c b/libraries/elementary/src/lib/elc_ctxpopup.c new file mode 100644 index 0000000..31f57a8 --- /dev/null +++ b/libraries/elementary/src/lib/elc_ctxpopup.c @@ -0,0 +1,1433 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; +typedef struct _Elm_Ctxpopup_Item Elm_Ctxpopup_Item; + +struct _Elm_Ctxpopup_Item +{ + ELM_WIDGET_ITEM; + Elm_Object_Item *list_item; +}; + +struct _Widget_Data +{ + Evas_Object *parent; + Evas_Object *base; + Evas_Object *content; + Evas_Object *list; + Evas_Object *box; + Evas_Object *arrow; + Evas_Object *bg; + Elm_Ctxpopup_Direction dir; + Elm_Ctxpopup_Direction dir_priority[4]; + Eina_Bool horizontal:1; + Eina_Bool visible:1; + Eina_Bool list_visible:1; + Eina_Bool finished:1; +}; + +static const char *widtype = NULL; + +static void _freeze_on(void *data, Evas_Object *obj, void *event_info); +static void _freeze_off(void *data, Evas_Object *obj, void *event_info); +static void _hold_on(void *data, Evas_Object *obj, void *event_info); +static void _hold_off(void *data, Evas_Object *obj, void *event_info); +static void _on_focus_hook(void *data, Evas_Object *obj); +static Eina_Bool _event_hook(Evas_Object *obj, + Evas_Object *src, + Evas_Callback_Type type, + void *event_info); +static void _parent_cut_off(Evas_Object *obj); +static void _parent_resize(void *data, + Evas *e, + Evas_Object *obj, + void *event_info); +static void _parent_move(void *data, + Evas *e, + Evas_Object *obj, + void *event_info); +static void _parent_del(void *data, + Evas *e, + Evas_Object *obj, + void *event_info); +static void _adjust_pos_x(Evas_Coord_Point *pos, + Evas_Coord_Point *base_size, + Evas_Coord_Rectangle *hover_area); +static void _adjust_pos_y(Evas_Coord_Point *pos, + Evas_Coord_Point *base_size, + Evas_Coord_Rectangle *hover_area); +static Elm_Ctxpopup_Direction _calc_base_geometry(Evas_Object *obj, + Evas_Coord_Rectangle *rect); +static void _update_arrow(Evas_Object *obj, + Elm_Ctxpopup_Direction dir, + Evas_Coord_Rectangle rect); +static void _sizing_eval(Evas_Object *obj); +static void _hide_signal_emit(Evas_Object *obj, + Elm_Ctxpopup_Direction dir); +static void _show_signal_emit(Evas_Object *obj, + Elm_Ctxpopup_Direction dir); +static void _shift_base_by_arrow(Evas_Object *arrow, + Elm_Ctxpopup_Direction dir, + Evas_Coord_Rectangle *rect); +static void _del_pre_hook(Evas_Object *obj); +static void _del_hook(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); +static void _content_set_hook(Evas_Object *obj, + const char *part, + Evas_Object *content); +static Evas_Object * _content_unset_hook(Evas_Object *obj, + const char *part__); +static Evas_Object * _content_get_hook(const Evas_Object *obj, + const char *part); +static void _item_text_set_hook(Elm_Object_Item *it, + const char *part, + const char *label); +static const char * _item_text_get_hook(const Elm_Object_Item *it, + const char *part); +static void _item_content_set_hook(Elm_Object_Item *it, + const char *part, + Evas_Object *content); +static Evas_Object * _item_content_get_hook(const Elm_Object_Item *it, + const char *part); +static void _item_disable_hook(Elm_Object_Item *it); +static void _item_signal_emit_hook(Elm_Object_Item *it, + const char *emission, + const char *source); +static void _bg_clicked_cb(void *data, Evas_Object *obj, + const char *emission, + const char *source); +static void _ctxpopup_show(void *data, + Evas *e, + Evas_Object *obj, + void *event_info); +static void _hide_finished(void *data, + Evas_Object *obj, + const char *emission, + const char *source __UNUSED__); +static void _ctxpopup_hide(void *data, + Evas *e, + Evas_Object *obj, + void *event_info); +static void _content_resize(void *data, + Evas *e, + Evas_Object *obj, + void *event_info); +static void _ctxpopup_move(void *data, + Evas *e, + Evas_Object *obj, + void *event_info); +static void _restack(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _content_del(void *data, + Evas *e, + Evas_Object *obj, + void *event_info); +static void _list_del(Widget_Data *wd); +static void _disable_hook(Evas_Object *obj); +static void _signal_emit_hook(Evas_Object *obj, const char *emission, const char *source); +static void _signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data); +static void _signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data); + +static const char SIG_DISMISSED[] = "dismissed"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_DISMISSED, ""}, + {NULL, NULL} +}; + +static void +_freeze_on(void *data __UNUSED__, Evas_Object *obj, + void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if ((!wd) || (!wd->list)) return; + elm_widget_scroll_freeze_push(wd->list); +} + +static void +_freeze_off(void *data __UNUSED__, Evas_Object *obj, + void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if ((!wd) || (!wd->list)) return; + elm_widget_scroll_freeze_pop(wd->list); +} + +static void +_hold_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if ((!wd) || (!wd->list)) return; + elm_widget_scroll_hold_push(wd->list); +} + +static void +_hold_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if ((!wd) || (!wd->list)) return; + elm_widget_scroll_hold_pop(wd->list); +} + +static void +_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + + if (elm_widget_focus_get(obj)) + { + //FIXME: + } + else + { + //FIXME: + } +} + +static Eina_Bool +_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, + Evas_Callback_Type type, void *event_info) +{ + Evas_Event_Key_Down *ev; + Widget_Data *wd; + + if (type != EVAS_CALLBACK_KEY_DOWN) + return EINA_FALSE; + wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + ev = event_info; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; + if (strcmp(ev->keyname, "Escape")) return EINA_FALSE; + + evas_object_hide(obj); + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; +} + +static void +_parent_cut_off(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + + evas_object_event_callback_del_full(wd->parent, + EVAS_CALLBACK_DEL, + _parent_del, + obj); + evas_object_event_callback_del_full(wd->parent, + EVAS_CALLBACK_MOVE, + _parent_move, + obj); + evas_object_event_callback_del_full(wd->parent, + EVAS_CALLBACK_RESIZE, + _parent_resize, + obj); + + elm_widget_sub_object_del(wd->parent, obj); +} + +static void +_parent_resize(void *data, + Evas *e __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + + wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; + + evas_object_hide(data); +} + +static void +_parent_move(void *data, + Evas *e __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + + if (!wd) return; + + wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; + + if (wd->visible) + { + _sizing_eval(obj); + } +} + +static void +_parent_del(void *data, + Evas *e __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + evas_object_del(data); +} + +static void +_adjust_pos_x(Evas_Coord_Point *pos, Evas_Coord_Point *base_size, + Evas_Coord_Rectangle *hover_area) +{ + pos->x -= (base_size->x / 2); + + if (pos->x < hover_area->x) + pos->x = hover_area->x; + else if ((pos->x + base_size->x) > (hover_area->x + hover_area->w)) + pos->x = (hover_area->x + hover_area->w) - base_size->x; + + if (base_size->x > hover_area->w) + base_size->x -= (base_size->x - hover_area->w); + + if (pos->x < hover_area->x) + pos->x = hover_area->x; +} + +static void +_adjust_pos_y(Evas_Coord_Point *pos, Evas_Coord_Point *base_size, + Evas_Coord_Rectangle *hover_area) +{ + pos->y -= (base_size->y / 2); + + if (pos->y < hover_area->y) + pos->y = hover_area->y; + else if ((pos->y + base_size->y) > (hover_area->y + hover_area->h)) + pos->y = hover_area->y + hover_area->h - base_size->y; + + if (base_size->y > hover_area->h) + base_size->y -= (base_size->y - hover_area->h); + + if (pos->y < hover_area->y) + pos->y = hover_area->y; +} + +static Elm_Ctxpopup_Direction +_calc_base_geometry(Evas_Object *obj, Evas_Coord_Rectangle *rect) +{ + Widget_Data *wd; + Evas_Coord_Point pos = {0, 0}; + Evas_Coord_Point base_size; + Evas_Coord_Point max_size; + Evas_Coord_Point min_size; + Evas_Coord_Rectangle hover_area; + Evas_Coord_Point arrow_size; + Elm_Ctxpopup_Direction dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; + Evas_Coord_Point temp; + int idx; + + wd = elm_widget_data_get(obj); + + if ((!wd) || (!rect)) + return ELM_CTXPOPUP_DIRECTION_DOWN; + + edje_object_part_geometry_get(wd->arrow, "ctxpopup_arrow", NULL, NULL, + &arrow_size.x, &arrow_size.y); + evas_object_resize(wd->arrow, arrow_size.x, arrow_size.y); + + //Initialize Area Rectangle. + evas_object_geometry_get(wd->parent, + &hover_area.x, + &hover_area.y, + &hover_area.w, + &hover_area.h); + + evas_object_geometry_get(obj, &pos.x, &pos.y, NULL, NULL); + + //recalc the edje + edje_object_size_min_calc(wd->base, &base_size.x, &base_size.y); + evas_object_smart_calculate(wd->base); + + //Limit to Max Size + evas_object_size_hint_max_get(obj, &max_size.x, &max_size.y); + + if ((max_size.y > 0) && (base_size.y > max_size.y)) + base_size.y = max_size.y; + + if ((max_size.x > 0) && (base_size.x > max_size.x)) + base_size.x = max_size.x; + + + //Limit to Min Size + evas_object_size_hint_min_get(obj, &min_size.x, &min_size.y); + + if ((min_size.y > 0) && (base_size.y < min_size.y)) + base_size.y = min_size.y; + + if ((min_size.x > 0) && (base_size.x < min_size.x)) + base_size.x = min_size.x; + + //Check the Which direction is available. + //If find a avaialble direction, it adjusts position and size. + for (idx = 0; idx < 4; idx++) + { + switch (wd->dir_priority[idx]) + { + case ELM_CTXPOPUP_DIRECTION_UNKNOWN: + case ELM_CTXPOPUP_DIRECTION_UP: + temp.y = (pos.y - base_size.y); + if ((temp.y - arrow_size.y) < hover_area.y) + continue; + _adjust_pos_x(&pos, &base_size, &hover_area); + pos.y -= base_size.y; + dir = ELM_CTXPOPUP_DIRECTION_UP; + break; + case ELM_CTXPOPUP_DIRECTION_LEFT: + temp.x = (pos.x - base_size.x); + if ((temp.x - arrow_size.x) < hover_area.x) + continue; + _adjust_pos_y(&pos, &base_size, &hover_area); + pos.x -= base_size.x; + dir = ELM_CTXPOPUP_DIRECTION_LEFT; + break; + case ELM_CTXPOPUP_DIRECTION_RIGHT: + temp.x = (pos.x + base_size.x); + if ((temp.x + arrow_size.x) > + (hover_area.x + hover_area.w)) + continue; + _adjust_pos_y(&pos, &base_size, &hover_area); + dir = ELM_CTXPOPUP_DIRECTION_RIGHT; + break; + case ELM_CTXPOPUP_DIRECTION_DOWN: + temp.y = (pos.y + base_size.y); + if ((temp.y + arrow_size.y) > + (hover_area.y + hover_area.h)) + continue; + _adjust_pos_x(&pos, &base_size, &hover_area); + dir = ELM_CTXPOPUP_DIRECTION_DOWN; + break; + default: + break; + } + break; + } + + //In this case, all directions are invalid because of lack of space. + if (idx == 4) + { + Evas_Coord length[2]; + + if (!wd->horizontal) + { + length[0] = pos.y - hover_area.y; + length[1] = (hover_area.y + hover_area.h) - pos.y; + + // ELM_CTXPOPUP_DIRECTION_UP + if (length[0] > length[1]) + { + _adjust_pos_x(&pos, &base_size, &hover_area); + pos.y -= base_size.y; + dir = ELM_CTXPOPUP_DIRECTION_UP; + if (pos.y < (hover_area.y + arrow_size.y)) + { + base_size.y -= ((hover_area.y + arrow_size.y) - pos.y); + pos.y = hover_area.y + arrow_size.y; + } + } + //ELM_CTXPOPUP_DIRECTION_DOWN + else + { + _adjust_pos_x(&pos, &base_size, &hover_area); + dir = ELM_CTXPOPUP_DIRECTION_DOWN; + if ((pos.y + arrow_size.y + base_size.y) > + (hover_area.y + hover_area.h)) + base_size.y -= + ((pos.y + arrow_size.y + base_size.y) - + (hover_area.y + hover_area.h)); + } + } + else + { + length[0] = pos.x - hover_area.x; + length[1] = (hover_area.x + hover_area.w) - pos.x; + + //ELM_CTXPOPUP_DIRECTION_LEFT + if (length[0] > length[1]) + { + _adjust_pos_y(&pos, &base_size, &hover_area); + pos.x -= base_size.x; + dir = ELM_CTXPOPUP_DIRECTION_LEFT; + if (pos.x < (hover_area.x + arrow_size.x)) + { + base_size.x -= ((hover_area.x + arrow_size.x) - pos.x); + pos.x = hover_area.x + arrow_size.x; + } + } + //ELM_CTXPOPUP_DIRECTION_RIGHT + else + { + _adjust_pos_y(&pos, &base_size, &hover_area); + dir = ELM_CTXPOPUP_DIRECTION_RIGHT; + if (pos.x + (arrow_size.x + base_size.x) > + hover_area.x + hover_area.w) + base_size.x -= + ((pos.x + arrow_size.x + base_size.x) - + (hover_area.x + hover_area.w)); + } + } + } + + //Final position and size. + rect->x = pos.x; + rect->y = pos.y; + rect->w = base_size.x; + rect->h = base_size.y; + + return dir; +} + +static void +_update_arrow(Evas_Object *obj, Elm_Ctxpopup_Direction dir, + Evas_Coord_Rectangle base_size) +{ + Evas_Coord x, y; + Evas_Coord_Rectangle arrow_size; + Widget_Data *wd; + double drag; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + evas_object_geometry_get(obj, &x, &y, NULL, NULL); + evas_object_geometry_get(wd->arrow, NULL, NULL, &arrow_size.w, + &arrow_size.h); + + //edje_object_part_unswallow(wd->base, wd->arrow); + + switch (dir) + { + case ELM_CTXPOPUP_DIRECTION_RIGHT: + edje_object_signal_emit(wd->arrow, "elm,state,left", "elm"); + edje_object_part_swallow(wd->base, + "elm.swallow.arrow_left", + wd->arrow); + if (base_size.h > 0) + { + if (y < ((arrow_size.h * 0.5) + base_size.y)) + y = 0; + else if (y > base_size.y + base_size.h - (arrow_size.h * 0.5)) + y = base_size.h - arrow_size.h; + else + y = y - base_size.y - (arrow_size.h * 0.5); + drag = (double) (y) / (double) (base_size.h - arrow_size.h); + edje_object_part_drag_value_set(wd->base, + "elm.swallow.arrow_left", + 1, + drag); + } + break; + case ELM_CTXPOPUP_DIRECTION_LEFT: + edje_object_signal_emit(wd->arrow, "elm,state,right", "elm"); + edje_object_part_swallow(wd->base, + "elm.swallow.arrow_right", + wd->arrow); + if (base_size.h > 0) + { + if (y < ((arrow_size.h * 0.5) + base_size.y)) + y = 0; + else if (y > (base_size.y + base_size.h - (arrow_size.h * 0.5))) + y = base_size.h - arrow_size.h; + else + y = y - base_size.y - (arrow_size.h * 0.5); + drag = (double) (y) / (double) (base_size.h - arrow_size.h); + edje_object_part_drag_value_set(wd->base, + "elm.swallow.arrow_right", + 0, + drag); + } + break; + case ELM_CTXPOPUP_DIRECTION_DOWN: + edje_object_signal_emit(wd->arrow, "elm,state,top", "elm"); + edje_object_part_swallow(wd->base, "elm.swallow.arrow_up", wd->arrow); + if (base_size.w > 0) + { + if (x < ((arrow_size.w * 0.5) + base_size.x)) + x = 0; + else if (x > (base_size.x + base_size.w - (arrow_size.w * 0.5))) + x = base_size.w - arrow_size.w; + else + x = x - base_size.x - (arrow_size.w * 0.5); + drag = (double) (x) / (double) (base_size.w - arrow_size.w); + edje_object_part_drag_value_set(wd->base, + "elm.swallow.arrow_up", + drag, + 1); + } + break; + case ELM_CTXPOPUP_DIRECTION_UP: + edje_object_signal_emit(wd->arrow, "elm,state,bottom", "elm"); + edje_object_part_swallow(wd->base, + "elm.swallow.arrow_down", + wd->arrow); + if (base_size.w > 0) + { + if (x < ((arrow_size.w * 0.5) + base_size.x)) + x = 0; + else if (x > (base_size.x + base_size.w - (arrow_size.w * 0.5))) + x = base_size.w - arrow_size.w; + else x = x - base_size.x - (arrow_size.w * 0.5); + drag = (double) (x) / (double) (base_size.w - arrow_size.w); + edje_object_part_drag_value_set(wd->base, + "elm.swallow.arrow_down", + drag, + 0); + } + break; + default: + break; + } + + //should be here for getting accurate geometry value + evas_object_smart_calculate(wd->base); +} + +static void +_hide_signal_emit(Evas_Object *obj, Elm_Ctxpopup_Direction dir) +{ + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd->visible) return; + + switch (dir) + { + case ELM_CTXPOPUP_DIRECTION_UP: + edje_object_signal_emit(wd->base, "elm,state,hide,up", "elm"); + break; + case ELM_CTXPOPUP_DIRECTION_LEFT: + edje_object_signal_emit(wd->base, "elm,state,hide,left", "elm"); + break; + case ELM_CTXPOPUP_DIRECTION_RIGHT: + edje_object_signal_emit(wd->base, "elm,state,hide,right", "elm"); + break; + case ELM_CTXPOPUP_DIRECTION_DOWN: + edje_object_signal_emit(wd->base, "elm,state,hide,down", "elm"); + break; + default: + break; + } + + edje_object_signal_emit(wd->bg, "elm,state,hide", "elm"); +} + +static void +_show_signal_emit(Evas_Object *obj, Elm_Ctxpopup_Direction dir) +{ + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd->visible) return; + if ((wd->list) && (!wd->list_visible)) return; + + switch (dir) + { + case ELM_CTXPOPUP_DIRECTION_UP: + edje_object_signal_emit(wd->base, "elm,state,show,up", "elm"); + break; + case ELM_CTXPOPUP_DIRECTION_LEFT: + edje_object_signal_emit(wd->base, "elm,state,show,left", "elm"); + break; + case ELM_CTXPOPUP_DIRECTION_RIGHT: + edje_object_signal_emit(wd->base, "elm,state,show,right", "elm"); + break; + case ELM_CTXPOPUP_DIRECTION_DOWN: + edje_object_signal_emit(wd->base, "elm,state,show,down", "elm"); + break; + default: + break; + } + edje_object_signal_emit(wd->bg, "elm,state,show", "elm"); + edje_object_signal_emit(wd->base, "elm,state,show", "elm"); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd; + Evas_Coord_Rectangle rect = { 0, 0, 1, 1 }; + Evas_Coord_Point list_size = { 0, 0 }; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + //Base + wd->dir = _calc_base_geometry(obj, &rect); + _update_arrow(obj, wd->dir, rect); + _shift_base_by_arrow(wd->arrow, wd->dir, &rect); + + if ((wd->list) && (wd->list_visible)) + { + evas_object_geometry_get(wd->list, 0, 0, &list_size.x, &list_size.y); + if ((list_size.x >= rect.w) || (list_size.y >= rect.h)) + { + elm_list_mode_set(wd->list, ELM_LIST_COMPRESS); + evas_object_size_hint_min_set(wd->box, rect.w, rect.h); + evas_object_size_hint_min_set(obj, rect.w, rect.h); + } + } + + evas_object_move(wd->base, rect.x, rect.y); + evas_object_resize(wd->base, rect.w, rect.h); + _show_signal_emit(obj, wd->dir); +} + +static void +_shift_base_by_arrow(Evas_Object *arrow, Elm_Ctxpopup_Direction dir, + Evas_Coord_Rectangle *rect) +{ + Evas_Coord arrow_w, arrow_h; + + evas_object_geometry_get(arrow, NULL, NULL, &arrow_w, &arrow_h); + switch (dir) + { + case ELM_CTXPOPUP_DIRECTION_RIGHT: + rect->x += arrow_w; + break; + case ELM_CTXPOPUP_DIRECTION_LEFT: + rect->x -= arrow_w; + break; + case ELM_CTXPOPUP_DIRECTION_DOWN: + rect->y += arrow_h; + break; + case ELM_CTXPOPUP_DIRECTION_UP: + rect->y -= arrow_h; + break; + default: + break; + } +} + +static void +_del_pre_hook(Evas_Object *obj) +{ + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + evas_object_event_callback_del_full(wd->box, EVAS_CALLBACK_RESIZE, + _content_resize, obj); + _parent_cut_off(obj); +} + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + elm_ctxpopup_clear(obj); + evas_object_del(wd->arrow); + evas_object_del(wd->base); + free(wd); +} + +//FIXME: lost the content size when theme hook is called. +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd; + Eina_Bool rtl; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + _elm_widget_mirrored_reload(obj); + rtl = elm_widget_mirrored_get(obj); + + _elm_theme_object_set(obj, wd->bg, "ctxpopup", "bg", + elm_widget_style_get(obj)); + _elm_theme_object_set(obj, wd->base, "ctxpopup", "base", + elm_widget_style_get(obj)); + _elm_theme_object_set(obj, wd->arrow, "ctxpopup", "arrow", + elm_widget_style_get(obj)); + + if (wd->list) + { + if (!strncmp(elm_object_style_get(obj), "default", strlen("default"))) + elm_object_style_set(wd->list, "ctxpopup"); + else + elm_object_style_set(wd->list, elm_object_style_get(obj)); + } + + wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; + + if (wd->visible) + { + _sizing_eval(obj); + } +} + +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Evas_Coord min_w = -1, min_h = -1; + Widget_Data *wd; + if ((part) && (strcmp(part, "default"))) return; + wd = elm_widget_data_get(obj); + if ((!wd) || (!content)) return; + if (content == wd->content) return; + + //TODO: wd->list + if (wd->content) evas_object_del(wd->content); + + //Use Box + wd->box = elm_box_add(obj); + evas_object_size_hint_weight_set(wd->box, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_fill_set(content, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_show(content); + evas_object_size_hint_min_get(content, &min_w, &min_h); + evas_object_size_hint_min_set(wd->box, min_w, min_h); + elm_box_pack_end(wd->box, content); + + evas_object_event_callback_add(wd->box, EVAS_CALLBACK_RESIZE, + _content_resize, obj); + evas_object_event_callback_add(wd->box, EVAS_CALLBACK_DEL, + _content_del, obj); + + elm_widget_sub_object_add(obj, wd->box); + edje_object_part_swallow(wd->base, "elm.swallow.content", wd->box); + + wd->content = content; + wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; + + if (wd->visible) + _sizing_eval(obj); +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + + Widget_Data *wd; + Evas_Object *content; + if ((part) && (strcmp(part, "default"))) return NULL; + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + content = wd->content; + if ((!content) || (!wd->box)) return NULL; + + edje_object_part_unswallow(wd->base, wd->box); + elm_widget_sub_object_del(obj, wd->box); + evas_object_event_callback_del(wd->box, EVAS_CALLBACK_DEL, _content_del); + edje_object_signal_emit(wd->base, "elm,state,content,disable", "elm"); + + evas_object_del(wd->box); + wd->box = NULL; + wd->content = NULL; + wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; + + return content; +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + if ((part) && (strcmp(part, "default"))) return NULL; + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->content; +} + +static void +_item_text_set_hook(Elm_Object_Item *it, const char *part, const char *label) +{ + Widget_Data *wd; + Elm_Ctxpopup_Item *ctxpopup_it; + + if ((part) && (strcmp(part, "default"))) return; + + ctxpopup_it = (Elm_Ctxpopup_Item *)it; + + wd = elm_widget_data_get(WIDGET(ctxpopup_it)); + if (!wd) return; + + elm_object_item_part_text_set(ctxpopup_it->list_item, "default", label); + wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; + + if (wd->visible) + { + _sizing_eval(WIDGET(ctxpopup_it)); + } +} + +static const char * +_item_text_get_hook(const Elm_Object_Item *it, const char *part) +{ + Elm_Ctxpopup_Item *ctxpopup_it; + if (part && strcmp(part, "default")) return NULL; + ctxpopup_it = (Elm_Ctxpopup_Item *)it; + return elm_object_item_part_text_get(ctxpopup_it->list_item, "default"); +} + +static void +_item_content_set_hook(Elm_Object_Item *it, + const char *part, + Evas_Object *content) +{ + Widget_Data *wd; + Elm_Ctxpopup_Item *ctxpopup_it; + + if ((part) && (strcmp(part, "icon")) + && (strcmp(part, "start")) + && (strcmp(part, "end"))) return; + + ctxpopup_it = (Elm_Ctxpopup_Item *)it; + + wd = elm_widget_data_get(WIDGET(ctxpopup_it)); + if (!wd) return; + + if ((part) && (!strcmp(part, "end"))) + elm_object_item_part_content_set(ctxpopup_it->list_item, "end", content); + else + elm_object_item_part_content_set(ctxpopup_it->list_item, "start", content); + + wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; + + if (wd->visible) + { + _sizing_eval(WIDGET(ctxpopup_it)); + } +} + +static Evas_Object * +_item_content_get_hook(const Elm_Object_Item *it, const char *part) +{ + Elm_Ctxpopup_Item *ctxpopup_it; + + if (part && strcmp(part, "icon") && strcmp(part, "start") + && strcmp(part, "end")) return NULL; + + ctxpopup_it = (Elm_Ctxpopup_Item *)it; + + if (part && !strcmp(part, "end")) + return elm_object_item_part_content_get(ctxpopup_it->list_item, "end"); + else + return elm_object_item_part_content_get(ctxpopup_it->list_item, "start"); +} + +static void +_item_disable_hook(Elm_Object_Item *it) +{ + Widget_Data *wd; + Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *)it; + + wd = elm_widget_data_get(WIDGET(ctxpopup_it)); + if (!wd) return; + + elm_object_item_disabled_set(ctxpopup_it->list_item, + elm_widget_item_disabled_get(ctxpopup_it)); +} + +static void +_item_signal_emit_hook(Elm_Object_Item *it, const char *emission, + const char *source) +{ + Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *)it; + elm_object_item_signal_emit(ctxpopup_it->list_item, emission, source); +} + +static void +_bg_clicked_cb(void *data, Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + _hide_signal_emit(data, wd->dir); +} + +static void +_ctxpopup_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, + void *event_info __UNUSED__) +{ + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + if ((!wd->list) && (!wd->content)) return; + + if (wd->list) + { + elm_list_go(wd->list); + wd->visible = EINA_TRUE; + return; + } + + wd->visible = EINA_TRUE; + + evas_object_show(wd->bg); + evas_object_show(wd->base); + evas_object_show(wd->arrow); + + edje_object_signal_emit(wd->bg, "elm,state,show", "elm"); + edje_object_signal_emit(wd->base, "elm,state,show", "elm"); + + _sizing_eval(obj); + + elm_object_focus_set(obj, EINA_TRUE); +} + +static void +_hide_finished(void *data, Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, const char *source __UNUSED__) +{ + evas_object_hide(data); + evas_object_smart_callback_call(data, SIG_DISMISSED, NULL); +} + +static void +_ctxpopup_hide(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, + void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (!wd->visible)) return; + + evas_object_hide(wd->bg); + evas_object_hide(wd->arrow); + evas_object_hide(wd->base); + + wd->visible = EINA_FALSE; + wd->list_visible = EINA_FALSE; +} + +static void +_content_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + elm_box_recalculate(wd->box); + _sizing_eval(data); +} + +static void +_list_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, + void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + if (!wd->visible) return; + if (wd->list_visible) return; + + wd->list_visible = EINA_TRUE; + + evas_object_show(wd->bg); + evas_object_show(wd->base); + evas_object_show(wd->arrow); + _sizing_eval(obj); +} + +static void +_ctxpopup_move(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, + void *event_info __UNUSED__) +{ + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + + if (!wd) return; + + if (wd->visible) + evas_object_show(wd->arrow); + + _sizing_eval(obj); +} + +static void +_restack(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_layer_set(wd->bg, + evas_object_layer_get(obj)); + evas_object_layer_set(wd->base, + evas_object_layer_get(obj)); +} + +static void +_content_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + elm_object_content_unset(data); +} + +static void +_list_del(Widget_Data *wd) +{ + if (!wd->list) return; + + edje_object_part_unswallow(wd->base, wd->box); + elm_box_unpack(wd->box, wd->list); + evas_object_del(wd->list); + wd->list = NULL; + wd->box = NULL; +} + +static Eina_Bool +_item_del_pre_hook(Elm_Object_Item *it) +{ + Evas_Object *list; + Widget_Data *wd; + Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *)it; + + wd = elm_widget_data_get(WIDGET(ctxpopup_it)); + if (!wd) return EINA_FALSE; + + wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; + + list = elm_object_item_widget_get(ctxpopup_it->list_item); + + if (eina_list_count(elm_list_items_get(list)) < 2) + { + elm_object_item_del(ctxpopup_it->list_item); + evas_object_hide(WIDGET(ctxpopup_it)); + return EINA_TRUE; + } + + elm_object_item_del(ctxpopup_it->list_item); + if (wd->list_visible) + _sizing_eval(WIDGET(ctxpopup_it)); + + return EINA_TRUE; +} + +static void +_disable_hook(Evas_Object *obj) +{ + //TODO: elm_object_disabled_set(); does not ignite this part + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + elm_object_disabled_set(wd->list, elm_widget_disabled_get(obj)); +} + +static void +_signal_emit_hook(Evas_Object *obj, const char *emission, const char *source) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_signal_emit(wd->base, emission, source); +} + +static void +_signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_signal_callback_add(wd->base, emission, source, func_cb, data); +} + +static void +_signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_signal_callback_del_full(wd->base, emission, source, func_cb, data); +} + +EAPI Evas_Object * +elm_ctxpopup_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "ctxpopup"); + elm_widget_type_set(obj, "ctxpopup"); + elm_widget_data_set(obj, wd); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_can_focus_set(obj, EINA_TRUE); + elm_widget_event_hook_set(obj, _event_hook); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_disable_hook_set(obj, _disable_hook); + elm_widget_signal_emit_hook_set(obj, _signal_emit_hook); + elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook); + elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook); + + //Background + wd->bg = edje_object_add(e); + elm_widget_sub_object_add(obj, wd->bg); + _elm_theme_object_set(obj, wd->bg, "ctxpopup", "bg", "default"); + edje_object_signal_callback_add(wd->bg, + "elm,action,click", + "", + _bg_clicked_cb, + obj); + //Base + wd->base = edje_object_add(e); + elm_widget_sub_object_add(obj, wd->base); + _elm_theme_object_set(obj, wd->base, "ctxpopup", "base", "default"); + edje_object_signal_callback_add(wd->base, "elm,action,hide,finished", "", + _hide_finished, obj); + + //Arrow + wd->arrow = edje_object_add(e); + elm_widget_sub_object_add(obj, wd->arrow); + _elm_theme_object_set(obj, wd->arrow, "ctxpopup", "arrow", "default"); + + wd->dir_priority[0] = ELM_CTXPOPUP_DIRECTION_UP; + wd->dir_priority[1] = ELM_CTXPOPUP_DIRECTION_LEFT; + wd->dir_priority[2] = ELM_CTXPOPUP_DIRECTION_RIGHT; + wd->dir_priority[3] = ELM_CTXPOPUP_DIRECTION_DOWN; + wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; + + evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _ctxpopup_show, + NULL); + evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _ctxpopup_hide, + NULL); + evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _ctxpopup_move, + NULL); + evas_object_event_callback_add(obj, EVAS_CALLBACK_RESTACK, _restack, obj); + evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj); + evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj); + evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj); + evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj); + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + //default parent is to be hover parent + elm_ctxpopup_hover_parent_set(obj, parent); + + return obj; +} + +EAPI void +elm_ctxpopup_hover_parent_set(Evas_Object *obj, Evas_Object *parent) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + + Widget_Data *wd; + Evas_Coord x, y, w, h; + + wd = elm_widget_data_get(obj); + if ((!wd) || (!parent)) return; + + _parent_cut_off(obj); + + if (parent) + { + evas_object_event_callback_add(parent, + EVAS_CALLBACK_DEL, + _parent_del, + obj); + evas_object_event_callback_add(parent, + EVAS_CALLBACK_MOVE, + _parent_move, + obj); + evas_object_event_callback_add(parent, + EVAS_CALLBACK_RESIZE, + _parent_resize, + obj); + } + + elm_widget_sub_object_add(parent, obj); + wd->parent = parent; + + //Update Background + evas_object_geometry_get(parent, &x, &y, &w, &h); + evas_object_move(wd->bg, x, y); + evas_object_resize(wd->bg, w, h); + + if (wd->visible) _sizing_eval(obj); +} + +EAPI Evas_Object * +elm_ctxpopup_hover_parent_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + return wd->parent; +} + +EAPI void +elm_ctxpopup_clear(Evas_Object * obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + _list_del(wd); + wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; +} + +EAPI void +elm_ctxpopup_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + wd->horizontal = !!horizontal; + + if ((!wd->list)) + return; + + if (!horizontal) + { + elm_list_horizontal_set(wd->list, wd->horizontal); + } + else + { + elm_list_horizontal_set(wd->list, wd->horizontal); + } + + wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; + + if (wd->visible) + _sizing_eval(obj); +} + +EAPI Eina_Bool +elm_ctxpopup_horizontal_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + return wd->horizontal; +} + +EAPI Elm_Object_Item * +elm_ctxpopup_item_append(Evas_Object *obj, const char *label, + Evas_Object *icon, Evas_Smart_Cb func, + const void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + + Widget_Data *wd; + Elm_Ctxpopup_Item *item; + + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + item = elm_widget_item_new(obj, Elm_Ctxpopup_Item); + if (!item) return NULL; + + elm_widget_item_del_pre_hook_set(item, _item_del_pre_hook); + elm_widget_item_disable_hook_set(item, _item_disable_hook); + elm_widget_item_text_set_hook_set(item, _item_text_set_hook); + elm_widget_item_text_get_hook_set(item, _item_text_get_hook); + elm_widget_item_content_set_hook_set(item, _item_content_set_hook); + elm_widget_item_content_get_hook_set(item, _item_content_get_hook); + elm_widget_item_signal_emit_hook_set(item, _item_signal_emit_hook); + + if (!wd->list) + { + //The first item is appended. + wd->list = elm_list_add(obj); + elm_list_mode_set(wd->list, ELM_LIST_EXPAND); + elm_list_horizontal_set(wd->list, wd->horizontal); + evas_object_event_callback_add(wd->list, EVAS_CALLBACK_RESIZE, + _list_resize, obj); + _content_set_hook(obj, "default", wd->list); + } + + item->list_item = elm_list_item_append(wd->list, label, icon, NULL, func, data); + + wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; + + if (wd->visible) _sizing_eval(obj); + + return (Elm_Object_Item *)item; +} + +EAPI void +elm_ctxpopup_direction_priority_set(Evas_Object *obj, + Elm_Ctxpopup_Direction first, + Elm_Ctxpopup_Direction second, + Elm_Ctxpopup_Direction third, + Elm_Ctxpopup_Direction fourth) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + wd->dir_priority[0] = first; + wd->dir_priority[1] = second; + wd->dir_priority[2] = third; + wd->dir_priority[3] = fourth; + + if (wd->visible) + _sizing_eval(obj); +} + +EAPI void +elm_ctxpopup_direction_priority_get(Evas_Object *obj, + Elm_Ctxpopup_Direction *first, + Elm_Ctxpopup_Direction *second, + Elm_Ctxpopup_Direction *third, + Elm_Ctxpopup_Direction *fourth) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + if (first) *first = wd->dir_priority[0]; + if (second) *second = wd->dir_priority[1]; + if (third) *third = wd->dir_priority[2]; + if (fourth) *fourth = wd->dir_priority[3]; +} + +EAPI Elm_Ctxpopup_Direction +elm_ctxpopup_direction_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_CTXPOPUP_DIRECTION_UNKNOWN; + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return ELM_CTXPOPUP_DIRECTION_UNKNOWN; + return wd->dir; +} + +EAPI void +elm_ctxpopup_dismiss(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _hide_signal_emit(obj, wd->dir); +} diff --git a/libraries/elementary/src/lib/elc_ctxpopup.h b/libraries/elementary/src/lib/elc_ctxpopup.h new file mode 100644 index 0000000..67a7b9f --- /dev/null +++ b/libraries/elementary/src/lib/elc_ctxpopup.h @@ -0,0 +1,211 @@ +/** + * @defgroup Ctxpopup Ctxpopup + * @ingroup Elementary + * + * @image html img/widget/ctxpopup/preview-00.png + * @image latex img/widget/ctxpopup/preview-00.eps + * + * @brief Context popup widget. + * + * A ctxpopup is a widget that, when shown, pops up a list of items. + * It automatically chooses an area inside its parent object's view + * (set via elm_ctxpopup_add() and elm_ctxpopup_hover_parent_set()) to + * optimally fit into it. In the default theme, it will also point an + * arrow to it's top left position at the time one shows it. Ctxpopup + * items have a label and/or an icon. It is intended for a small + * number of items (hence the use of list, not genlist). + * + * @note Ctxpopup is a specialization of @ref Hover. + * + * Signals that you can add callbacks for are: + * "dismissed" - the ctxpopup was dismissed + * + * Default content parts of the ctxpopup widget that you can use for are: + * @li "default" - A content of the ctxpopup + * + * Default content parts of the ctxpopup items that you can use for are: + * @li "icon" - An icon in the title area + * + * Default text parts of the ctxpopup items that you can use for are: + * @li "default" - Title label in the title area + * + * Supported elm_object common APIs. + * @li @ref elm_object_disabled_set + * @li @ref elm_object_disabled_get + * @li @ref elm_object_part_content_set + * @li @ref elm_object_part_content_get + * @li @ref elm_object_part_content_unset + * @li @ref elm_object_signal_emit + * @li @ref elm_object_signal_callback_add + * @li @ref elm_object_signal_callback_del + * + * Supported elm_object_item common APIs. + * @li @ref elm_object_item_disabled_set + * @li @ref elm_object_item_disabled_get + * @li @ref elm_object_item_part_text_set + * @li @ref elm_object_item_part_text_get + * @li @ref elm_object_item_part_content_set + * @li @ref elm_object_item_part_content_get + * @li @ref elm_object_item_signal_emit + * + * @ref tutorial_ctxpopup shows the usage of a good deal of the API. + * @{ + */ + +typedef enum +{ + ELM_CTXPOPUP_DIRECTION_DOWN, /**< ctxpopup show appear below clicked area */ + ELM_CTXPOPUP_DIRECTION_RIGHT, /**< ctxpopup show appear to the right of the clicked area */ + ELM_CTXPOPUP_DIRECTION_LEFT, /**< ctxpopup show appear to the left of the clicked area */ + ELM_CTXPOPUP_DIRECTION_UP, /**< ctxpopup show appear above the clicked area */ + ELM_CTXPOPUP_DIRECTION_UNKNOWN, /**< ctxpopup does not determine it's direction yet*/ +} Elm_Ctxpopup_Direction; /**< Direction in which to show the popup */ + +/** + * @brief Add a new Ctxpopup object to the parent. + * + * @param parent Parent object + * @return New object or @c NULL, if it cannot be created + * + * @ingroup Ctxpopup + */ +EAPI Evas_Object *elm_ctxpopup_add(Evas_Object *parent); + +/** + * @brief Set the Ctxpopup's parent + * + * @param obj The ctxpopup object + * @param parent The parent to use + * + * Set the parent object. + * + * @note elm_ctxpopup_add() will automatically call this function + * with its @c parent argument. + * + * @see elm_ctxpopup_add() + * @see elm_hover_parent_set() + * + * @ingroup Ctxpopup + */ +EAPI void elm_ctxpopup_hover_parent_set(Evas_Object *obj, Evas_Object *parent); + +/** + * @brief Get the Ctxpopup's parent + * + * @param obj The ctxpopup object + * + * @see elm_ctxpopup_hover_parent_set() for more information + * + * @ingroup Ctxpopup + */ +EAPI Evas_Object *elm_ctxpopup_hover_parent_get(const Evas_Object *obj); + +/** + * @brief Clear all items in the given ctxpopup object. + * + * @param obj Ctxpopup object + * + * @ingroup Ctxpopup + */ +EAPI void elm_ctxpopup_clear(Evas_Object *obj); + +/** + * @brief Change the ctxpopup's orientation to horizontal or vertical. + * + * @param obj Ctxpopup object + * @param horizontal @c EINA_TRUE for horizontal mode, @c EINA_FALSE for vertical + * + * @ingroup Ctxpopup + */ +EAPI void elm_ctxpopup_horizontal_set(Evas_Object *obj, Eina_Bool horizontal); + +/** + * @brief Get the value of current ctxpopup object's orientation. + * + * @param obj Ctxpopup object + * @return @c EINA_TRUE for horizontal mode, @c EINA_FALSE for vertical mode (or errors) + * + * @see elm_ctxpopup_horizontal_set() + * + * @ingroup Ctxpopup + */ +EAPI Eina_Bool elm_ctxpopup_horizontal_get(const Evas_Object *obj); + +/** + * @brief Add a new item to a ctxpopup object. + * + * @param obj Ctxpopup object + * @param icon Icon to be set on new item + * @param label The Label of the new item + * @param func Convenience function called when item selected + * @param data Data passed to @p func + * @return A handle to the item added or @c NULL, on errors + * + * @warning Ctxpopup can't hold both an item list and a content at the same + * time. When an item is added, any previous content will be removed. + * + * @see elm_object_content_set() + * + * @ingroup Ctxpopup + */ +EAPI Elm_Object_Item *elm_ctxpopup_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data); + +/** + * @brief Set the direction priority of a ctxpopup. + * + * @param obj Ctxpopup object + * @param first 1st priority of direction + * @param second 2nd priority of direction + * @param third 3th priority of direction + * @param fourth 4th priority of direction + * + * This functions gives a chance to user to set the priority of ctxpopup + * showing direction. This doesn't guarantee the ctxpopup will appear in the + * requested direction. + * + * @see Elm_Ctxpopup_Direction + * + * @ingroup Ctxpopup + */ +EAPI void elm_ctxpopup_direction_priority_set(Evas_Object *obj, Elm_Ctxpopup_Direction first, Elm_Ctxpopup_Direction second, Elm_Ctxpopup_Direction third, Elm_Ctxpopup_Direction fourth); + +/** + * @brief Get the direction priority of a ctxpopup. + * + * @param obj Ctxpopup object + * @param first 1st priority of direction to be returned + * @param second 2nd priority of direction to be returned + * @param third 3th priority of direction to be returned + * @param fourth 4th priority of direction to be returned + * + * @see elm_ctxpopup_direction_priority_set() for more information. + * + * @ingroup Ctxpopup + */ +EAPI void elm_ctxpopup_direction_priority_get(Evas_Object *obj, Elm_Ctxpopup_Direction *first, Elm_Ctxpopup_Direction *second, Elm_Ctxpopup_Direction *third, Elm_Ctxpopup_Direction *fourth); + +/** + * @brief Get the current direction of a ctxpopup. + * + * @param obj Ctxpopup object + * @return current direction of a ctxpopup + * + * @warning Once the ctxpopup showed up, the direction would be determined + * + * @ingroup Ctxpopup + */ +EAPI Elm_Ctxpopup_Direction elm_ctxpopup_direction_get(const Evas_Object *obj); + +/** + * @brief Dismiss a ctxpopup object + * + * @param obj The ctxpopup object + * Use this function to simulate clicking outside the ctxpopup to dismiss it. + * In this way, the ctxpopup will be hidden and the "clicked" signal will be + * emitted. + */ +EAPI void elm_ctxpopup_dismiss(Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elc_dayselector.c b/libraries/elementary/src/lib/elc_dayselector.c new file mode 100644 index 0000000..68f351b --- /dev/null +++ b/libraries/elementary/src/lib/elc_dayselector.c @@ -0,0 +1,669 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; +typedef struct _Elm_Dayselector_Item Elm_Dayselector_Item; + +/* signals to edc */ +#define ITEM_TYPE_WEEKDAY_DEFAULT "elm,type,weekday,default" +#define ITEM_TYPE_WEEKDAY_STYLE1 "elm,type,weekday,style1" +#define ITEM_TYPE_WEEKEND_DEFAULT "elm,type,weekend,default" +#define ITEM_TYPE_WEEKEND_STYLE1 "elm,type,weekend,style1" +#define ITEM_POS_LEFT "elm,pos,check,left" +#define ITEM_POS_RIGHT "elm,pos,check,right" +#define ITEM_POS_MIDDLE "elm,pos,check,middle" + +struct _Widget_Data +{ + Evas_Object *base; + Eina_List *items; + Elm_Dayselector_Day week_start; + Elm_Dayselector_Day weekend_start; + unsigned int weekend_len; +}; + +struct _Elm_Dayselector_Item +{ + ELM_WIDGET_ITEM; + Elm_Dayselector_Day day; + const char *day_style; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object* obj); +static void _dayselector_resize(void *data, Evas *e __UNUSED__, + Evas_Object *obj __UNUSED__, void *event_info __UNUSED__); +static void _disable_hook(Evas_Object *obj); +static Eina_Bool _focus_next_hook(const Evas_Object *obj, + Elm_Focus_Direction dir __UNUSED__, + Evas_Object **next __UNUSED__); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); +static void _translate_hook(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); +static void _item_text_set_hook(Evas_Object *obj, const char *item, + const char *label); +static const char *_item_text_get_hook(const Evas_Object *obj, + const char *item); +static void _content_set_hook(Evas_Object *obj, const char *item, + Evas_Object *content); +static Evas_Object *_content_get_hook(const Evas_Object *obj, const char *item); +static Evas_Object *_content_unset_hook(Evas_Object *obj, const char *item); +static void _signal_emit_cb(void *data, Evas_Object *obj, const char *emission, + const char *source __UNUSED__); +static void _item_clicked_cb(void *data, Evas_Object *obj, + void *event_info __UNUSED__); +static Elm_Dayselector_Item * _item_find(const Evas_Object *obj, + Elm_Dayselector_Day day); +static void _items_style_set(Evas_Object *obj); +static void _update_items(Evas_Object *obj); +static void _create_items(Evas_Object *obj); + +static const char SIG_CHANGED[] = "dayselector,changed"; +static const char SIG_LANG_CHANGED[] = "language,changed"; +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CHANGED, ""}, + {SIG_LANG_CHANGED, ""}, + {NULL, NULL} +}; + +static void +_del_hook(Evas_Object *obj) +{ + Elm_Dayselector_Item *it; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + EINA_LIST_FREE(wd->items, it) + { + wd->items = eina_list_remove(wd->items, it); + eina_stringshare_del(it->day_style); + elm_widget_item_free(it); + } + free(wd); +} + +static void +_sizing_eval(Evas_Object* obj) +{ + Evas_Coord min_w = -1, min_h = -1; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + elm_coords_finger_size_adjust(ELM_DAYSELECTOR_MAX, &min_w, 1, &min_h); + edje_object_size_min_restricted_calc(wd->base, &min_w, &min_h, min_w, min_h); + elm_coords_finger_size_adjust(ELM_DAYSELECTOR_MAX, &min_w, 1, &min_h); + evas_object_size_hint_min_set(obj, min_w, min_h); +} + +static void +_dayselector_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + _sizing_eval(data); +} + +static void +_disable_hook(Evas_Object *obj) +{ + Widget_Data* wd = elm_widget_data_get(obj); + if (!wd) return; + + if (elm_widget_disabled_get(obj)) + edje_object_signal_emit(wd->base, "elm,state,disabled", "elm"); + else + edje_object_signal_emit(wd->base, "elm,state,enabled", "elm"); +} + +static Eina_Bool +_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir __UNUSED__, + Evas_Object **next __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + /* TODO: Focus switch support to Elm_widget_Item is not supported yet.*/ + return EINA_FALSE; +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + edje_object_mirrored_set(wd->base, rtl); +} + +static void +_translate_hook(Evas_Object *obj) +{ + Eina_List *l; + Elm_Dayselector_Item *it; + struct tm time_daysel; + time_t t; + char buf[1024]; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + t = time(NULL); + localtime_r(&t, &time_daysel); + EINA_LIST_FOREACH(wd->items, l, it) + { + time_daysel.tm_wday = it->day; + strftime(buf, sizeof(buf), "%a", &time_daysel); + elm_object_text_set(VIEW(it), buf); + } + evas_object_smart_callback_call(obj, SIG_LANG_CHANGED, NULL); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Eina_List *l; + Elm_Dayselector_Item *it; + char buf[1024]; + unsigned int loc; + Widget_Data* wd = elm_widget_data_get(obj); + if (!wd) return; + + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _elm_theme_object_set(obj, wd->base, "dayselector", "base", + elm_widget_style_get(obj)); + + EINA_LIST_FOREACH(wd->items, l, it) + { + snprintf(buf, sizeof(buf), "dayselector/%s", elm_object_style_get(obj)); + elm_object_style_set(VIEW(it), buf); + loc = (ELM_DAYSELECTOR_MAX - wd->week_start + it->day) % ELM_DAYSELECTOR_MAX; + snprintf(buf, sizeof(buf), "day%d,visible", loc); + edje_object_signal_emit(wd->base, buf, "elm"); + snprintf(buf, sizeof(buf), "day%d", loc); + edje_object_part_swallow(wd->base, buf, VIEW(it)); + } + _update_items(obj); + _sizing_eval(obj); +} + +static void +_item_del_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, + void *event_info __UNUSED__) +{ + ELM_CHECK_WIDTYPE(data, widtype); + Eina_List *l; + Elm_Dayselector_Item *it; + char buf[1024]; + unsigned int loc = 0; + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + + EINA_LIST_FOREACH(wd->items, l, it) + { + if (obj == VIEW(it)) + { + wd->items = eina_list_remove(wd->items, it); + eina_stringshare_del(it->day_style); + evas_object_smart_callback_del(VIEW(it), "changed", _item_clicked_cb); + evas_object_event_callback_del(VIEW(it), EVAS_CALLBACK_DEL, _item_del_cb); + edje_object_part_unswallow(wd->base, VIEW(it)); + loc = (ELM_DAYSELECTOR_MAX - wd->week_start + it->day) % ELM_DAYSELECTOR_MAX; + snprintf(buf, sizeof(buf), "day%d,default", loc); + edje_object_signal_emit(wd->base, buf, "elm"); + elm_widget_item_free(it); + _sizing_eval(obj); + break; + } + } +} + +static void +_signal_emit_cb(void *data, Evas_Object *obj, const char *emission, const char *source __UNUSED__) +{ + Eina_List *l; + Elm_Dayselector_Item *it; + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + + EINA_LIST_FOREACH(wd->items, l, it) + { + if (obj == VIEW(it)) + { + eina_stringshare_replace(&it->day_style, emission); + return ; + } + } +} + +static void +_item_text_set_hook(Evas_Object *obj, const char *item, const char *label) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Eina_List *l; + Elm_Dayselector_Item *it; + char buf[1024]; + Widget_Data *wd = elm_widget_data_get(obj); + if (item && !strcmp(item, "default")) return; + if (!wd) return; + + EINA_LIST_FOREACH(wd->items, l, it) + { + snprintf(buf, sizeof(buf), "day%d", it->day); + if (!strncmp(buf, item, sizeof(buf))) + { + elm_object_text_set(VIEW(it), label); + _sizing_eval(obj); + break; + } + } +} + +static const char * +_item_text_get_hook(const Evas_Object *obj, const char *item) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Eina_List *l; + Elm_Dayselector_Item *it; + char buf[1024]; + Widget_Data *wd = elm_widget_data_get(obj); + if (item && !strcmp(item, "default")) return NULL; + if (!wd) return NULL; + + EINA_LIST_FOREACH(wd->items, l, it) + { + snprintf(buf, sizeof(buf), "day%d", it->day); + if (!strncmp(buf, item, sizeof(buf))) + return elm_object_text_get(VIEW(it)); + } + return NULL; +} + +static void +_content_set_hook(Evas_Object *obj, const char *item, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Eina_List *l; + Elm_Dayselector_Item *it; + char buf[1024]; + unsigned int idx, loc; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd || !content) return; + if (item && !strcmp(item, "default")) return; + if (strcmp(elm_object_widget_type_get(content), "check")) return; + + EINA_LIST_FOREACH(wd->items, l, it) + { + snprintf(buf, sizeof(buf), "day%d", it->day); + if (!strncmp(buf, item, sizeof(buf))) + { + if (VIEW(it)) evas_object_del(VIEW(it)); + break; + } + } + for (idx = 0; idx < ELM_DAYSELECTOR_MAX; idx++) + { + snprintf(buf, sizeof(buf), "day%d", idx); + if (!strncmp(buf, item, sizeof(buf))) + { + it = elm_widget_item_new(obj, Elm_Dayselector_Item); + if (!it) continue; + VIEW(it) = content; + it->day = idx; + wd->items = eina_list_append(wd->items, it); + elm_widget_sub_object_add(obj, content); + loc = (ELM_DAYSELECTOR_MAX - wd->week_start + idx) % ELM_DAYSELECTOR_MAX; + snprintf(buf, sizeof(buf), "day%d", loc); + edje_object_part_swallow(wd->base, buf, VIEW(it)); + snprintf(buf, sizeof(buf), "day%d,visible", loc); + edje_object_signal_emit(wd->base, buf, "elm"); + evas_object_smart_callback_add(VIEW(it), "changed", _item_clicked_cb, obj); + evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_DEL, _item_del_cb, obj); + elm_object_signal_callback_add(VIEW(it), ITEM_TYPE_WEEKDAY_DEFAULT, "", _signal_emit_cb, obj); + elm_object_signal_callback_add(VIEW(it), ITEM_TYPE_WEEKDAY_STYLE1, "", _signal_emit_cb, obj); + elm_object_signal_callback_add(VIEW(it), ITEM_TYPE_WEEKEND_DEFAULT, "", _signal_emit_cb, obj); + elm_object_signal_callback_add(VIEW(it), ITEM_TYPE_WEEKEND_STYLE1, "", _signal_emit_cb, obj); + _sizing_eval(obj); + _update_items(obj); + break; + } + } +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *item) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Eina_List *l; + Elm_Dayselector_Item *it; + char buf[1024]; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (item && !strcmp(item, "default")) return NULL; + + EINA_LIST_FOREACH(wd->items, l, it) + { + snprintf(buf, sizeof(buf), "day%d", it->day); + if (!strncmp(buf, item, sizeof(buf))) return VIEW(it); + } + return NULL; +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *item) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Eina_List *l; + Elm_Dayselector_Item *it; + Evas_Object *content; + char buf[1024]; + unsigned int loc; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (item && !strcmp(item, "default")) return NULL; + + EINA_LIST_FOREACH(wd->items, l, it) + { + snprintf(buf, sizeof(buf), "day%d", it->day); + if (!strncmp(buf, item, sizeof(buf))) + { + content = VIEW(it); + wd->items = eina_list_remove(wd->items, it); + elm_widget_sub_object_del(obj, VIEW(it)); + evas_object_smart_callback_del(VIEW(it), "changed", _item_clicked_cb); + evas_object_event_callback_del(VIEW(it), EVAS_CALLBACK_DEL, _item_del_cb); + edje_object_part_unswallow(wd->base, VIEW(it)); + loc = (ELM_DAYSELECTOR_MAX - wd->week_start + it->day) % ELM_DAYSELECTOR_MAX; + snprintf(buf, sizeof(buf), "day%d,default", loc); + edje_object_signal_emit(wd->base, buf, "elm"); + _sizing_eval(obj); + return content; + } + } + return NULL; +} + +static void +_item_clicked_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Eina_List *l; + Elm_Dayselector_Item *it; + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + + EINA_LIST_FOREACH(wd->items, l, it) + { + if (obj != VIEW(it)) continue; + evas_object_smart_callback_call(data, SIG_CHANGED, (void *)it->day); + return; + } +} + +static Elm_Dayselector_Item * +_item_find(const Evas_Object *obj, Elm_Dayselector_Day day) +{ + Eina_List *l; + Elm_Dayselector_Item *it; + Widget_Data* wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + EINA_LIST_FOREACH(wd->items, l, it) + if (day == it->day) return it; + + return NULL; +} + +static void +_items_style_set(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Eina_List *l; + Elm_Dayselector_Item *it; + unsigned int weekend_last; + Widget_Data* wd = elm_widget_data_get(obj); + if (!wd) return; + + weekend_last = wd->weekend_start + wd->weekend_len - 1; + if (weekend_last >= ELM_DAYSELECTOR_MAX) + weekend_last = weekend_last % ELM_DAYSELECTOR_MAX; + + EINA_LIST_FOREACH(wd->items, l, it) + { + if (weekend_last >= wd->weekend_start) + { + if ((it->day >= wd->weekend_start) && (it->day <= weekend_last)) + eina_stringshare_replace(&it->day_style, + ITEM_TYPE_WEEKEND_DEFAULT); + else + eina_stringshare_replace(&it->day_style, + ITEM_TYPE_WEEKDAY_DEFAULT); + } + else + { + if ((it->day >= wd->weekend_start) || (it->day <= weekend_last)) + eina_stringshare_replace(&it->day_style, + ITEM_TYPE_WEEKEND_DEFAULT); + else + eina_stringshare_replace(&it->day_style, + ITEM_TYPE_WEEKDAY_DEFAULT); + } + } +} + +static void +_update_items(Evas_Object *obj) +{ + Eina_List *l; + Elm_Dayselector_Item *it; + unsigned int last_day; + Eina_Bool rtl; + Widget_Data* wd = elm_widget_data_get(obj); + if (!wd) return; + + last_day = wd->week_start + ELM_DAYSELECTOR_MAX - 1; + if (last_day >= ELM_DAYSELECTOR_MAX) + last_day = last_day % ELM_DAYSELECTOR_MAX; + + rtl = elm_widget_mirrored_get(obj); + EINA_LIST_FOREACH(wd->items, l, it) + { + elm_object_signal_emit(VIEW(it), it->day_style, ""); + if (it->day == wd->week_start) + { + if (rtl) elm_object_signal_emit(VIEW(it), ITEM_POS_RIGHT, "elm"); + else elm_object_signal_emit(VIEW(it), ITEM_POS_LEFT, "elm"); + } + else if (it->day == last_day) + { + if (rtl) elm_object_signal_emit(VIEW(it), ITEM_POS_LEFT, "elm"); + else elm_object_signal_emit(VIEW(it), ITEM_POS_RIGHT, "elm"); + } + else + elm_object_signal_emit(VIEW(it), ITEM_POS_MIDDLE, "elm"); + } +} + +static void +_create_items(Evas_Object *obj) +{ + Elm_Dayselector_Item *it; + struct tm time_daysel; + time_t t; + char buf[1024]; + unsigned int idx, loc; + Widget_Data* wd = elm_widget_data_get(obj); + if (!wd) return; + + t = time(NULL); + localtime_r(&t, &time_daysel); + + for (idx = 0; idx < ELM_DAYSELECTOR_MAX; idx++) + { + it = elm_widget_item_new(obj, Elm_Dayselector_Item); + if (!it) continue; + VIEW(it) = elm_check_add(wd->base); + elm_widget_sub_object_add(obj, VIEW(it)); + wd->items = eina_list_append(wd->items, it); + elm_object_style_set(VIEW(it), "dayselector/default"); + time_daysel.tm_wday = idx; + strftime(buf, sizeof(buf), "%a", &time_daysel); + elm_object_text_set(VIEW(it), buf); + it->day = idx; + loc = (ELM_DAYSELECTOR_MAX - wd->week_start + idx) % ELM_DAYSELECTOR_MAX; + snprintf(buf, sizeof(buf), "day%d", loc); + edje_object_part_swallow(wd->base, buf, VIEW(it)); + snprintf(buf, sizeof(buf), "day%d,visible", idx); + edje_object_signal_emit(wd->base, buf, "elm"); + evas_object_smart_callback_add(VIEW(it), "changed", _item_clicked_cb, + obj); + evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_DEL, + _item_del_cb, obj); + elm_object_signal_callback_add(VIEW(it), ITEM_TYPE_WEEKDAY_DEFAULT, "", + _signal_emit_cb, obj); + elm_object_signal_callback_add(VIEW(it), ITEM_TYPE_WEEKDAY_STYLE1, "", + _signal_emit_cb, obj); + elm_object_signal_callback_add(VIEW(it), ITEM_TYPE_WEEKEND_DEFAULT, "", + _signal_emit_cb, obj); + elm_object_signal_callback_add(VIEW(it), ITEM_TYPE_WEEKEND_STYLE1, "", + _signal_emit_cb, obj); + } + _items_style_set(obj); + _update_items(obj); +} + +EAPI Evas_Object * +elm_dayselector_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "dayselector"); + elm_widget_type_set(obj, widtype); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_disable_hook_set(obj, _disable_hook); + elm_widget_focus_next_hook_set(obj, _focus_next_hook); + elm_widget_translate_hook_set(obj, _translate_hook); + elm_widget_text_set_hook_set(obj, _item_text_set_hook); + elm_widget_text_get_hook_set(obj, _item_text_get_hook); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); + + wd->base = edje_object_add(e); + _elm_theme_object_set(obj, wd->base, "dayselector", "base", "default"); + elm_object_style_set(wd->base, "dayselector"); + elm_widget_resize_object_set(obj, wd->base); + + wd->week_start = _elm_config->week_start; + wd->weekend_start = _elm_config->weekend_start; + wd->weekend_len = _elm_config->weekend_len; + printf("%d %d %d\n", wd->week_start, wd->weekend_start, wd->weekend_len); + _create_items(obj); + + evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, + _dayselector_resize, obj); + evas_object_smart_callbacks_descriptions_set(obj, _signals); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _sizing_eval(obj); + return obj; +} + +EAPI void +elm_dayselector_day_selected_set(Evas_Object *obj, Elm_Dayselector_Day day, Eina_Bool selected) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data* wd = elm_widget_data_get(obj); + if (!wd) return; + + elm_check_state_set(VIEW(_item_find(obj, day)), selected); +} + +EAPI Eina_Bool +elm_dayselector_day_selected_get(const Evas_Object *obj, Elm_Dayselector_Day day) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data* wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + return elm_check_state_get(VIEW(_item_find(obj, day))); +} + +EAPI void +elm_dayselector_week_start_set(Evas_Object *obj, Elm_Dayselector_Day day) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Eina_List *l; + Elm_Dayselector_Item *it; + char buf[1024]; + unsigned int loc; + Widget_Data* wd = elm_widget_data_get(obj); + if (!wd) return; + + wd->week_start = day; + EINA_LIST_FOREACH(wd->items, l, it) + { + loc = (ELM_DAYSELECTOR_MAX - wd->week_start + it->day) % ELM_DAYSELECTOR_MAX; + snprintf(buf, sizeof(buf), "day%d", loc); + edje_object_part_swallow(wd->base, buf, VIEW(it)); + } + _update_items(obj); +} + +EAPI Elm_Dayselector_Day +elm_dayselector_week_start_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_DAYSELECTOR_MAX; + Widget_Data* wd = elm_widget_data_get(obj); + if (!wd) return ELM_DAYSELECTOR_MAX; + + return wd->week_start; +} + +EAPI void +elm_dayselector_weekend_start_set(Evas_Object *obj, Elm_Dayselector_Day day) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data* wd = elm_widget_data_get(obj); + if (!wd) return; + + wd->weekend_start = day; + _items_style_set(obj); + _update_items(obj); +} + +EAPI Elm_Dayselector_Day +elm_dayselector_weekend_start_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_DAYSELECTOR_MAX; + Widget_Data* wd = elm_widget_data_get(obj); + if (!wd) return ELM_DAYSELECTOR_MAX; + + return wd->weekend_start; +} + +EAPI void +elm_dayselector_weekend_length_set(Evas_Object *obj, unsigned int length) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data* wd = elm_widget_data_get(obj); + if (!wd) return; + + wd->weekend_len = length; + _items_style_set(obj); + _update_items(obj); +} + +EAPI unsigned int +elm_dayselector_weekend_length_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + Widget_Data* wd = elm_widget_data_get(obj); + if (!wd) return 0; + + return wd->weekend_len; +} diff --git a/libraries/elementary/src/lib/elc_dayselector.h b/libraries/elementary/src/lib/elc_dayselector.h new file mode 100644 index 0000000..6b1497d --- /dev/null +++ b/libraries/elementary/src/lib/elc_dayselector.h @@ -0,0 +1,207 @@ +/** + * @defgroup Dayselector Dayselector + * @ingroup Elementary + * + * @image html img/widget/dayselector/preview-00.png + * @image latex img/widget/dayselector/preview-00.eps + * + * @brief Dayselector widget: + * + *"elm_dayselector" is a day selection widget. It displays all seven days of + * the week and allows the user to select multiple days. + * + * The selection can be toggle by just clicking on the day. + * + * Dayselector also provides the functionality to check whether a day is + * selected or not. + * + * First day of the week is taken from config settings by default. It can be + * altered by using the API elm_dayselector_week_start_set() API. + * + * APIs are provided for setting the duration of weekend + * elm_dayselector_weekend_start_set() and elm_dayselector_weekend_length_set() + * does this job. + * + * Two styles of weekdays and weekends are supported in Dayselector. + * Application can emit signals on individual check objects for setting the + * weekday, weekend styles. + * + * Once the weekend start day or weekend length changes, all the weekday & + * weekend styles will be reset to default style. It's the application's + * responsibility to set the styles again by sending corresponding signals. + * + * Supported elm_object_item common APIs. + * + * @li @ref elm_object_part_text_set, + * @li @ref elm_object_part_text_get, + * @li @ref elm_object_part_content_set, + * @li @ref elm_object_part_content_get, + * @li @ref elm_object_part_content_unset + * + * @li "day0" indicates Sunday, "day1" indicates Monday etc. continues and so, + * "day6" indicates the Saturday part name. + * + * Application can change individual day display string by using the API + * elm_object_part_text_set(). + * + * elm_object_part_content_set() API sets the individual day object only if + * the passed one is a Check widget. + * + * Check object representing a day can be set/get by the application by using + * the elm_object_part_content_set/get APIs thus providing a way to handle + * the different check styles for individual days. + * + * The widget emits the following signals: + * @li "dayselector,changed" - when the user changes the state of a day. + * @li "language,changed" - the program's language changed + * + * Available styles for dayselector are: + * @li default + * + * This example shows the usage of the widget. + * @li @ref dayselector_example + * + */ + +/** + * @addtogroup Dayselector + * @{ + */ + +/** + * Identifies the day of the week. + * API can call the selection/unselection of day with this as a parameter. + * + * @see elm_dayselector_day_selected_set() + * @see elm_dayselector_day_selected_get() + */ +typedef enum +{ + ELM_DAYSELECTOR_SUN = 0,/**< indicates Sunday */ + ELM_DAYSELECTOR_MON, /**< indicates Monday */ + ELM_DAYSELECTOR_TUE, /**< indicates Tuesday */ + ELM_DAYSELECTOR_WED, /**< indicates Wednesday */ + ELM_DAYSELECTOR_THU, /**< indicates Thursday */ + ELM_DAYSELECTOR_FRI, /**< indicates Friday */ + ELM_DAYSELECTOR_SAT, /**< indicates Saturday */ + ELM_DAYSELECTOR_MAX /**< Sentinel value, @b don't use */ +} Elm_Dayselector_Day; + +/** + * Add the dayselector. + * + * @param parent Parent object + * @return New dayselector object or @c NULL, if it cannot be created + * + * @ingroup Dayselector + */ +EAPI Evas_Object *elm_dayselector_add(Evas_Object *parent); + +/** + * Set the state of given Dayselector_Day. + * + * @param obj Dayselector object + * @param day Dayselector_Day that the user want to set state. + * @param selected state of the day. @c EINA_TRUE is selected. + * + * @see Elm_Dayselector_Day + * @see elm_dayselector_day_selected_get() + * + * @ingroup Dayselector + */ +EAPI void elm_dayselector_day_selected_set(Evas_Object *obj, Elm_Dayselector_Day day, Eina_Bool selected); + +/** + * Get the state of given Dayselector_Day. + * + * @param obj Dayselector object + * @param day Dayselector_Day that the user want to know state. + * @return @c EINA_TRUE, if the Day is selected + * + * @see Elm_Dayselector_Day + * @see elm_dayselector_day_selected_set() + * + * @ingroup Dayselector + */ +EAPI Eina_Bool elm_dayselector_day_selected_get(const Evas_Object *obj, Elm_Dayselector_Day day); + +/** + * Set the starting day of Dayselector. + * + * @param obj Dayselector object + * @param day Dayselector_Day the first day that the user wants to display. + * + * @see Elm_Dayselector_Day + * @see elm_dayselector_week_start_get() + * + * @ingroup Dayselector + */ +EAPI void elm_dayselector_week_start_set(Evas_Object *obj, Elm_Dayselector_Day day); + +/** + * Get the starting day of Dayselector. + * + * @param obj Dayselector object + * @return Day from where Dayselector displays all the weekdays in order. + * + * @see Elm_Dayselector_Day + * @see elm_dayselector_week_start_set() + * + * @ingroup Dayselector + */ +EAPI Elm_Dayselector_Day elm_dayselector_week_start_get(const Evas_Object *obj); + +/** + * Set the weekend starting day of Dayselector. + * + * @param obj Dayselector object + * @param day Dayselector_Day the first day from where weekend starts. + * + * @see Elm_Dayselector_Day + * @see elm_dayselector_weekend_start_get() + * + * @ingroup Dayselector + */ +EAPI void elm_dayselector_weekend_start_set(Evas_Object *obj, Elm_Dayselector_Day day); + +/** + * Get the weekend starting day of Dayselector. + * + * @param obj Dayselector object + * @return Elm_Dayselector_Day Day from where weekend starts. + * + * @see Elm_Dayselector_Day + * @see elm_dayselector_weekend_start_set() + * + * @ingroup Dayselector + */ +EAPI Elm_Dayselector_Day elm_dayselector_weekend_start_get(const Evas_Object *obj); + +/** + * Set the weekend length of Dayselector. + * + * @param obj Dayselector object + * @param length Weekend length, number of days as an integer. + * + * @see elm_dayselector_weekend_length_get() + * + * @ingroup Dayselector + */ +EAPI void elm_dayselector_weekend_length_set(Evas_Object *obj, unsigned int length); + +/** + * Get the weekend length of Dayselector. + * + * @param obj Dayselector object + * @return Number of days marked as a weekend. + * + * @see Elm_Dayselector_Day + * @see elm_dayselector_weekend_length_set() + * + * @ingroup Dayselector + */ +EAPI unsigned int elm_dayselector_weekend_length_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elc_fileselector.c b/libraries/elementary/src/lib/elc_fileselector.c new file mode 100644 index 0000000..148c73d --- /dev/null +++ b/libraries/elementary/src/lib/elc_fileselector.c @@ -0,0 +1,1249 @@ +/* + * TODO: + * - child elements focusing support + * - user defined icon/label cb + * - show/hide/add buttons ??? + * - show/hide hidden files + * - double click to choose a file + * - multi-selection + * - make variable/function names that are sensible + * - Filter support + */ + +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +#ifdef HAVE_EIO +# include +#endif + +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + EINA_REFCOUNT; + + Evas_Object *edje; + Evas_Object *filename_entry; + Evas_Object *path_entry; + Evas_Object *files_list; + Evas_Object *files_grid; + Evas_Object *up_button; + Evas_Object *home_button; + + Evas_Object *ok_button; + Evas_Object *cancel_button; + + const char *path; + const char *selection; + Ecore_Idler *sel_idler; + + const char *path_separator; + +#ifdef HAVE_EIO + Eio_File *current; +#endif + + Elm_Fileselector_Mode mode; + + Eina_Bool only_folder : 1; + Eina_Bool expand : 1; +}; + +struct sel_data +{ + Evas_Object *fs; + const char *path; +}; + +typedef struct _Widget_Request Widget_Request; +struct _Widget_Request +{ + Widget_Data *wd; + Elm_Object_Item *parent; + + Evas_Object *obj; + const char *path; + Eina_Bool first : 1; +}; + +typedef enum { + ELM_DIRECTORY = 0, + ELM_FILE_IMAGE = 1, + ELM_FILE_UNKNOW = 2, + ELM_FILE_LAST +} Elm_Fileselector_Type; + +static Elm_Genlist_Item_Class *list_itc[ELM_FILE_LAST]; +static Elm_Gengrid_Item_Class *grid_itc[ELM_FILE_LAST]; + +static const char *widtype = NULL; + +static const char SIG_DIRECTORY_OPEN[] = "directory,open"; +static const char SIG_DONE[] = "done"; +static const char SIG_SELECTED[] = "selected"; +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_DIRECTORY_OPEN, "s"}, + {SIG_DONE, "s"}, + {SIG_SELECTED, "s"}, + {NULL, NULL} +}; + +static void _populate(Evas_Object *obj, + const char *path, + Elm_Object_Item *parent); +static void _do_anchors(Evas_Object *obj, + const char *path); + +/*** ELEMENTARY WIDGET ***/ +static void +_widget_data_free(Widget_Data *wd) +{ + if (wd->path) eina_stringshare_del(wd->path); + if (wd->selection) eina_stringshare_del(wd->selection); + if (wd->sel_idler) + { + void *sd; + + sd = ecore_idler_del(wd->sel_idler); + free(sd); + } + free(wd); +} + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd; + int i; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + for (i = 0; i < ELM_FILE_LAST; ++i) + { + elm_genlist_item_class_free(list_itc[i]); + elm_gengrid_item_class_free(grid_itc[i]); + } + +#ifdef HAVE_EIO + if (wd->current) + eio_file_cancel(wd->current); +#endif + + wd->files_list = NULL; + wd->files_grid = NULL; + + EINA_REFCOUNT_UNREF(wd) + _widget_data_free(wd); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1; + if (!wd) return; + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + edje_object_size_min_restricted_calc(wd->edje, &minw, &minh, minw, minh); + evas_object_size_hint_min_set(obj, minw, minh); +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_widget_mirrored_set(wd->cancel_button, rtl); + elm_widget_mirrored_set(wd->ok_button, rtl); + elm_widget_mirrored_set(wd->files_list, rtl); + elm_widget_mirrored_set(wd->up_button, rtl); + elm_widget_mirrored_set(wd->home_button, rtl); + edje_object_mirrored_set(wd->edje, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + const char *style = elm_widget_style_get(obj); + const char *data; + char buf[1024]; + + if (!wd) return; + _elm_widget_mirrored_reload(obj); + + _elm_theme_object_set(obj, wd->edje, "fileselector", "base", style); + + if (elm_object_disabled_get(obj)) + edje_object_signal_emit(wd->edje, "elm,state,disabled", "elm"); + + data = edje_object_data_get(wd->edje, "path_separator"); + if (data) + wd->path_separator = data; + else + wd->path_separator = "/"; + + if (!style) style = "default"; + snprintf(buf, sizeof(buf), "fileselector/%s", style); + +#define SWALLOW(part_name, object_ptn) \ + if (object_ptn) \ + { \ + elm_widget_style_set(object_ptn, buf); \ + if (edje_object_part_swallow(wd->edje, part_name, object_ptn)) \ + evas_object_show(object_ptn); \ + else \ + evas_object_hide(object_ptn); \ + } + SWALLOW("elm.swallow.up", wd->up_button); + SWALLOW("elm.swallow.home", wd->home_button); + + if (wd->mode == ELM_FILESELECTOR_LIST) + { + if (edje_object_part_swallow(wd->edje, "elm.swallow.files", + wd->files_list)) + { + evas_object_show(wd->files_list); + evas_object_hide(wd->files_grid); + } + else + evas_object_hide(wd->files_list); + } + else + { + if (edje_object_part_swallow(wd->edje, "elm.swallow.files", + wd->files_grid)) + { + evas_object_show(wd->files_grid); + evas_object_hide(wd->files_list); + } + else + evas_object_hide(wd->files_grid); + } + + SWALLOW("elm.swallow.filename", wd->filename_entry); + SWALLOW("elm.swallow.path", wd->path_entry); + + snprintf(buf, sizeof(buf), "fileselector/actions/%s", style); + SWALLOW("elm.swallow.cancel", wd->cancel_button); + SWALLOW("elm.swallow.ok", wd->ok_button); +#undef SWALLOW + + edje_object_message_signal_process(wd->edje); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + edje_object_scale_set + (wd->edje, elm_widget_scale_get(obj) * _elm_config->scale); + _sizing_eval(obj); +} + +/*** GENLIST "MODEL" ***/ +static char * +_itc_text_get(void *data, + Evas_Object *obj __UNUSED__, + const char *source __UNUSED__) +{ + return elm_entry_utf8_to_markup(ecore_file_file_get(data)); /* NOTE this will be + * free() by the + * caller */ +} + +static Evas_Object * +_itc_icon_folder_get(void *data __UNUSED__, + Evas_Object *obj, + const char *source) +{ + Evas_Object *ic; + + if (strcmp(source, "elm.swallow.icon")) return NULL; + + ic = elm_icon_add(obj); + elm_icon_standard_set(ic, "folder"); + + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, + 1, 1); + return ic; +} + +static Evas_Object * +_itc_icon_image_get(void *data, + Evas_Object *obj, + const char *source) +{ + const char *filename = data; + Evas_Object *ic; + + if (strcmp(source, "elm.swallow.icon")) return NULL; + + ic = elm_icon_add(obj); + elm_icon_standard_set(ic, "image"); + elm_icon_thumb_set(ic, filename, NULL); + + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, + 1, 1); + return ic; +} + +static Evas_Object * +_itc_icon_file_get(void *data __UNUSED__, + Evas_Object *obj, + const char *source) +{ + Evas_Object *ic; + + if (strcmp(source, "elm.swallow.icon")) return NULL; + + ic = elm_icon_add(obj); + elm_icon_standard_set(ic, "file"); + + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, + 1, 1); + return ic; +} + +static Eina_Bool +_itc_state_get(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + const char *source __UNUSED__) +{ + return EINA_FALSE; +} + +static void +_itc_del(void *data, + Evas_Object *obj __UNUSED__) +{ + eina_stringshare_del(data); +} + +static void +_expand_done(void *data, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + Elm_Object_Item *it = event_info; + const char *path = elm_object_item_data_get(it); + _populate(data, path, it); +} + +static void +_contract_done(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + Elm_Object_Item *it = event_info; + elm_genlist_item_subitems_clear(it); +} + +static void +_expand_req(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + Elm_Object_Item *it = event_info; + elm_genlist_item_expanded_set(it, EINA_TRUE); +} + +static void +_contract_req(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + Elm_Object_Item *it = event_info; + elm_genlist_item_expanded_set(it, EINA_FALSE); +} + +/*** PRIVATES ***/ +static Eina_Bool +_sel_do(void *data) +{ + struct sel_data *sd; + const char *path; + Widget_Data *wd; + const char *p; + + sd = data; + wd = elm_widget_data_get(sd->fs); + path = sd->path; + + if ((!wd->only_folder) && ecore_file_is_dir(path)) + { + if (wd->expand && wd->mode == ELM_FILESELECTOR_LIST) + { + _do_anchors(sd->fs, path); + elm_object_text_set(wd->filename_entry, ""); + } + else + { + /* keep a ref to path 'couse it will be destroyed by _populate */ + p = eina_stringshare_add(path); + _populate(sd->fs, p, NULL); + eina_stringshare_del(p); + } + goto end; + } + else /* navigating through folders only or file is not a dir. */ + { + char *s; + + if (wd->expand && wd->mode == ELM_FILESELECTOR_LIST) + _do_anchors(sd->fs, path); + else if (wd->only_folder) + { + /* keep a ref to path 'couse it will be destroyed by _populate */ + p = eina_stringshare_add(path); + _populate(sd->fs, p, NULL); + eina_stringshare_del(p); + } + s = elm_entry_utf8_to_markup(ecore_file_file_get(path)); + if (s) + { + elm_object_text_set(wd->filename_entry, s); + free(s); + } + else + elm_object_text_set(wd->filename_entry, ""); + } + + evas_object_smart_callback_call(sd->fs, SIG_SELECTED, (void *)path); + +end: + wd->sel_idler = NULL; + free(sd); + return ECORE_CALLBACK_CANCEL; +} + +static void +_sel(void *data, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + struct sel_data *sd; + Widget_Data *wd; + void *old_sd; + char *dir; + //This event_info could be a list or gengrid item + Elm_Object_Item *it = event_info; + + wd = elm_widget_data_get(data); + if (!wd) return; + + sd = malloc(sizeof(*sd)); + sd->fs = data; + sd->path = elm_object_item_data_get(it); + + if (!sd->path) + { + eina_stringshare_replace(&wd->path, ""); + goto end; + } + + dir = wd->only_folder ? strdup(sd->path) : ecore_file_dir_get(sd->path); + if (dir) + { + eina_stringshare_replace(&wd->path, dir); + free(dir); + } + else + { + eina_stringshare_replace(&wd->path, ""); + } + +end: + if (wd->sel_idler) + { + old_sd = ecore_idler_del(wd->sel_idler); + free(old_sd); + } + wd->sel_idler = ecore_idler_add(_sel_do, sd); +} + +static void +_up(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *fs = data; + char *parent; + + Widget_Data *wd = elm_widget_data_get(fs); + if (!wd) return; + parent = ecore_file_dir_get(wd->path); + _populate(fs, parent, NULL); + free(parent); +} + +static void +_home(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *fs = data; + _populate(fs, getenv("HOME"), NULL); +} + +static void +_ok(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *fs = data; + evas_object_smart_callback_call(fs, SIG_DONE, + (void *)elm_fileselector_selected_get(fs)); +} + +static void +_canc(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *fs = data; + evas_object_smart_callback_call(fs, SIG_DONE, NULL); +} + +static void +_anchor_clicked(void *data, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + Evas_Object *fs = data; + Widget_Data *wd = elm_widget_data_get(fs); + Elm_Entry_Anchor_Info *info = event_info; + const char *p; + if (!wd) return; + // keep a ref to path 'couse it will be destroyed by _populate + p = eina_stringshare_add(info->name); + _populate(fs, p, NULL); + evas_object_smart_callback_call(data, SIG_SELECTED, (void *)p); + eina_stringshare_del(p); +} + +static void +_do_anchors(Evas_Object *obj, + const char *path) +{ + Widget_Data *wd = elm_widget_data_get(obj); + char **tok, buf[PATH_MAX * 3], *s; + int i, j; + + if (!wd) return; + s = elm_entry_utf8_to_markup(path); + if (!s) return; + buf[0] = '\0'; + tok = eina_str_split(s, "/", 0); + free(s); + eina_strlcat(buf, "root", sizeof(buf)); + for (i = 0; tok[i]; i++) + { + if ((!tok[i]) || (!tok[i][0])) continue; + eina_strlcat(buf, wd->path_separator, sizeof(buf)); + eina_strlcat(buf, "", sizeof(buf)); + eina_strlcat(buf, tok[i], sizeof(buf)); + eina_strlcat(buf, "", sizeof(buf)); + } + free(tok[0]); + free(tok); + + elm_object_text_set(wd->path_entry, buf); +} + +#ifdef HAVE_EIO +static Eina_Bool +_filter_cb(void *data __UNUSED__, Eio_File *handler, const Eina_File_Direct_Info *info) +{ + const char *filename; + + if (info->path[info->name_start] == '.') + return EINA_FALSE; + + filename = eina_stringshare_add(info->path); + eio_file_associate_direct_add(handler, "filename", filename, EINA_FREE_CB(eina_stringshare_del)); + + if (info->type == EINA_FILE_DIR) + { + eio_file_associate_direct_add(handler, "type/grid", grid_itc[ELM_DIRECTORY], NULL); + eio_file_associate_direct_add(handler, "type/list", list_itc[ELM_DIRECTORY], NULL); + } + else + { + if (evas_object_image_extension_can_load_get(info->path + info->name_start)) + { + eio_file_associate_direct_add(handler, "type/grid", grid_itc[ELM_FILE_IMAGE], NULL); + eio_file_associate_direct_add(handler, "type/list", list_itc[ELM_FILE_IMAGE], NULL); + } + else + { + eio_file_associate_direct_add(handler, "type/grid", grid_itc[ELM_FILE_UNKNOW], NULL); + eio_file_associate_direct_add(handler, "type/list", list_itc[ELM_FILE_UNKNOW], NULL); + } + } + + return EINA_TRUE; +} + +static int +_file_grid_cmp(const void *a, const void *b) +{ + const Elm_Object_Item *ga = a; + const Elm_Object_Item *gb = b; + const Elm_Gengrid_Item_Class *ca = elm_gengrid_item_item_class_get(ga); + const Elm_Gengrid_Item_Class *cb = elm_gengrid_item_item_class_get(gb); + + if (ca == grid_itc[ELM_DIRECTORY]) + { + if (cb != grid_itc[ELM_DIRECTORY]) + return -1; + } + else if (cb == grid_itc[ELM_DIRECTORY]) + { + return 1; + } + + return strcoll(elm_object_item_data_get(ga), elm_object_item_data_get(gb)); +} + +static int +_file_list_cmp(const void *a, const void *b) +{ + const Elm_Object_Item *la = a; + const Elm_Object_Item *lb = b; + const Elm_Genlist_Item_Class *ca = elm_genlist_item_item_class_get(la); + const Elm_Genlist_Item_Class *cb = elm_genlist_item_item_class_get(lb); + + if (ca == list_itc[ELM_DIRECTORY]) + { + if (cb != list_itc[ELM_DIRECTORY]) + return -1; + } + else if (cb == list_itc[ELM_DIRECTORY]) + { + return 1; + } + + return strcoll(elm_object_item_data_get(la), elm_object_item_data_get(lb)); +} + +static void +_signal_first(Widget_Request *wr) +{ + if (!wr->first) return ; + evas_object_smart_callback_call(wr->obj, SIG_DIRECTORY_OPEN, (void *)wr->path); + if (!wr->parent) + { + elm_genlist_clear(wr->wd->files_list); + elm_gengrid_clear(wr->wd->files_grid); + eina_stringshare_replace(&wr->wd->path, wr->path); + _do_anchors(wr->obj, wr->path); + } + + if (wr->wd->filename_entry) elm_object_text_set(wr->wd->filename_entry, ""); + + wr->first = EINA_FALSE; +} + +static void +_main_cb(void *data, Eio_File *handler, const Eina_File_Direct_Info *info __UNUSED__) +{ + Widget_Request *wr = data; + + if (eio_file_check(handler)) + return ; + if (!wr->wd->files_list || !wr->wd->files_grid || wr->wd->current != handler) + { + eio_file_cancel(handler); + return ; + } + + _signal_first(wr); + + if (wr->wd->mode == ELM_FILESELECTOR_LIST) + { + Eina_Bool is_dir = (eio_file_associate_find(handler, "type/list") == list_itc[ELM_DIRECTORY]); + + elm_genlist_item_sorted_insert(wr->wd->files_list, eio_file_associate_find(handler, "type/list"), + eina_stringshare_ref(eio_file_associate_find(handler, "filename")), + wr->parent, wr->wd->expand && is_dir ? ELM_GENLIST_ITEM_TREE : ELM_GENLIST_ITEM_NONE, + _file_list_cmp, NULL, NULL); + } + else if (wr->wd->mode == ELM_FILESELECTOR_GRID) + elm_gengrid_item_sorted_insert(wr->wd->files_grid, eio_file_associate_find(handler, "type/grid"), + eina_stringshare_ref(eio_file_associate_find(handler, "filename")), + _file_grid_cmp, NULL, NULL); +} + +static void +_widget_request_cleanup(Widget_Request *wr) +{ + EINA_REFCOUNT_UNREF(wr->wd) + _widget_data_free(wr->wd); + + eina_stringshare_del(wr->path); + free(wr); +} + +static void +_done_cb(void *data, Eio_File *handler __UNUSED__) +{ + Widget_Request *wr = data; + + _signal_first(wr); + + wr->wd->current = NULL; + _widget_request_cleanup(wr); +} + +static void +_error_cb(void *data, Eio_File *handler, int error __UNUSED__) +{ + Widget_Request *wr = data; + + if (wr->wd->current == handler) + wr->wd->current = NULL; + _widget_request_cleanup(wr); +} + +#endif + +static void +_populate(Evas_Object *obj, + const char *path, + Elm_Object_Item *parent) +{ + Widget_Data *wd = elm_widget_data_get(obj); +#ifdef HAVE_EIO + Widget_Request *wr; +#else + Eina_File_Direct_Info *file; + Eina_Iterator *it; + const char *real; + Eina_List *files = NULL, *dirs = NULL; +#endif + + if (!wd) return; +#ifndef HAVE_EIO + if (!ecore_file_is_dir(path)) return ; + it = eina_file_stat_ls(path); + if (!it) return ; + evas_object_smart_callback_call(obj, SIG_DIRECTORY_OPEN, (void *)path); + if (!parent) + { + elm_genlist_clear(wd->files_list); + elm_gengrid_clear(wd->files_grid); + eina_stringshare_replace(&wd->path, path); + _do_anchors(obj, path); + } + + if (wd->filename_entry) elm_object_text_set(wd->filename_entry, ""); + EINA_ITERATOR_FOREACH(it, file) + { + const char *filename; + + if (file->path[file->name_start] == '.') + continue ; + + filename = eina_stringshare_add(file->path); + if (file->type == EINA_FILE_DIR) + dirs = eina_list_append(dirs, filename); + else if (!wd->only_folder) + files = eina_list_append(files, filename); + } + eina_iterator_free(it); + + files = eina_list_sort(files, eina_list_count(files), + EINA_COMPARE_CB(strcoll)); + dirs = eina_list_sort(dirs, eina_list_count(dirs), EINA_COMPARE_CB(strcoll)); + EINA_LIST_FREE(dirs, real) + { + if (wd->mode == ELM_FILESELECTOR_LIST) + elm_genlist_item_append(wd->files_list, list_itc[ELM_DIRECTORY], + real, /* item data */ + parent, + wd->expand ? ELM_GENLIST_ITEM_TREE : + ELM_GENLIST_ITEM_NONE, + NULL, NULL); + else if (wd->mode == ELM_FILESELECTOR_GRID) + elm_gengrid_item_append(wd->files_grid, grid_itc[ELM_DIRECTORY], + real, /* item data */ + NULL, NULL); + } + + EINA_LIST_FREE(files, real) + { + Elm_Fileselector_Type type = evas_object_image_extension_can_load_fast_get(real) ? + ELM_FILE_IMAGE : ELM_FILE_UNKNOW; + + if (wd->mode == ELM_FILESELECTOR_LIST) + elm_genlist_item_append(wd->files_list, list_itc[type], + real, /* item data */ + parent, ELM_GENLIST_ITEM_NONE, + NULL, NULL); + else if (wd->mode == ELM_FILESELECTOR_GRID) + elm_gengrid_item_append(wd->files_grid, grid_itc[type], + real, /* item data */ + NULL, NULL); + } +#else + if (wd->expand && wd->current) return ; + if (wd->current) + eio_file_cancel(wd->current); + wr = malloc(sizeof (Widget_Request)); + if (!wr) return ; + wr->wd = wd; + EINA_REFCOUNT_REF(wr->wd); + wr->parent = parent; /* FIXME: should we refcount the parent ? */ + wr->obj = obj; + wr->path = eina_stringshare_add(path); + wr->first = EINA_TRUE; + + wd->current = eio_file_stat_ls(path, + _filter_cb, + _main_cb, + _done_cb, + _error_cb, + wr); +#endif +} + +/*** API ***/ + +EAPI Evas_Object * +elm_fileselector_add(Evas_Object *parent) +{ + Evas *e; + Evas_Object *obj, *ic, *bt, *li, *en, *grid; + Widget_Data *wd; + unsigned int i; + int s; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + EINA_REFCOUNT_INIT(wd); + + ELM_SET_WIDTYPE(widtype, "fileselector"); + elm_widget_type_set(obj, "fileselector"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); + + wd->expand = !!_elm_config->fileselector_expand_enable; + + wd->edje = edje_object_add(e); + _elm_theme_object_set(obj, wd->edje, "fileselector", "base", "default"); + elm_widget_resize_object_set(obj, wd->edje); + + // up btn + ic = elm_icon_add(parent); + elm_icon_standard_set(ic, "arrow_up"); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + bt = elm_button_add(parent); + elm_widget_mirrored_automatic_set(bt, EINA_FALSE); + elm_object_part_content_set(bt, "icon", ic); + elm_object_domain_translatable_text_set(bt, PACKAGE, N_("Up")); + evas_object_size_hint_align_set(bt, 0.0, 0.0); + + evas_object_smart_callback_add(bt, "clicked", _up, obj); + + elm_widget_sub_object_add(obj, bt); + wd->up_button = bt; + + // home btn + ic = elm_icon_add(parent); + elm_icon_standard_set(ic, "home"); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + bt = elm_button_add(parent); + elm_widget_mirrored_automatic_set(bt, EINA_FALSE); + elm_object_part_content_set(bt, "icon", ic); + elm_object_domain_translatable_text_set(bt, PACKAGE, N_("Home")); + evas_object_size_hint_align_set(bt, 0.0, 0.0); + + evas_object_smart_callback_add(bt, "clicked", _home, obj); + + elm_widget_sub_object_add(obj, bt); + wd->home_button = bt; + + for (i = 0; i < ELM_FILE_LAST; ++i) + { + list_itc[i] = elm_genlist_item_class_new(); + grid_itc[i] = elm_gengrid_item_class_new(); + + list_itc[i]->item_style = "default"; + list_itc[i]->func.text_get = grid_itc[i]->func.text_get = _itc_text_get; + list_itc[i]->func.state_get = grid_itc[i]->func.state_get = _itc_state_get; + list_itc[i]->func.del = grid_itc[i]->func.del = _itc_del; + } + + list_itc[ELM_DIRECTORY]->func.content_get = + grid_itc[ELM_DIRECTORY]->func.content_get = _itc_icon_folder_get; + list_itc[ELM_FILE_IMAGE]->func.content_get = + grid_itc[ELM_FILE_IMAGE]->func.content_get = _itc_icon_image_get; + list_itc[ELM_FILE_UNKNOW]->func.content_get = + grid_itc[ELM_FILE_UNKNOW]->func.content_get = _itc_icon_file_get; + + li = elm_genlist_add(parent); + elm_widget_mirrored_automatic_set(li, EINA_FALSE); + evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_min_set(li, 100, 100); + + grid = elm_gengrid_add(parent); + elm_widget_mirrored_automatic_set(grid, EINA_FALSE); + evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + // XXX: will fail for dynamic finger size changing + s = _elm_config->finger_size * 2; + elm_gengrid_item_size_set(grid, s, s); + elm_gengrid_align_set(grid, 0.0, 0.0); + + evas_object_smart_callback_add(li, "selected", _sel, obj); + evas_object_smart_callback_add(li, "expand,request", _expand_req, obj); + evas_object_smart_callback_add(li, "contract,request", _contract_req, obj); + evas_object_smart_callback_add(li, "expanded", _expand_done, obj); + evas_object_smart_callback_add(li, "contracted", _contract_done, obj); + + evas_object_smart_callback_add(grid, "selected", _sel, obj); + + elm_widget_sub_object_add(obj, li); + elm_widget_sub_object_add(obj, grid); + wd->files_list = li; + wd->files_grid = grid; + + // path entry + en = elm_entry_add(parent); + elm_entry_scrollable_set(en, EINA_TRUE); + elm_widget_mirrored_automatic_set(en, EINA_FALSE); + elm_entry_editable_set(en, EINA_FALSE); + elm_entry_single_line_set(en, EINA_TRUE); + elm_entry_line_wrap_set(en, ELM_WRAP_CHAR); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + + evas_object_smart_callback_add(en, "anchor,clicked", _anchor_clicked, obj); + + elm_widget_sub_object_add(obj, en); + wd->path_entry = en; + + // filename entry + en = elm_entry_add(parent); + elm_entry_scrollable_set(en, EINA_TRUE); + elm_widget_mirrored_automatic_set(en, EINA_FALSE); + elm_entry_editable_set(en, EINA_TRUE); + elm_entry_single_line_set(en, EINA_TRUE); + elm_entry_line_wrap_set(en, ELM_WRAP_CHAR); + evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); + + elm_widget_sub_object_add(obj, en); + wd->filename_entry = en; + + elm_fileselector_buttons_ok_cancel_set(obj, EINA_TRUE); + elm_fileselector_is_save_set(obj, EINA_FALSE); + + _theme_hook(obj); + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + return obj; +} + +EAPI void +elm_fileselector_is_save_set(Evas_Object *obj, + Eina_Bool is_save) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + elm_object_disabled_set(wd->filename_entry, !is_save); + + if (is_save) + edje_object_signal_emit(wd->edje, "elm,state,save,on", "elm"); + else + edje_object_signal_emit(wd->edje, "elm,state,save,off", "elm"); +} + +EAPI Eina_Bool +elm_fileselector_is_save_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return !elm_object_disabled_get(wd->filename_entry); +} + +EAPI void +elm_fileselector_folder_only_set(Evas_Object *obj, + Eina_Bool only) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->only_folder == only) return; + wd->only_folder = !!only; + if (wd->path) _populate(obj, wd->path, NULL); +} + +EAPI Eina_Bool +elm_fileselector_folder_only_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->only_folder; +} + +EAPI void +elm_fileselector_buttons_ok_cancel_set(Evas_Object *obj, + Eina_Bool visible) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *bt; + if (!wd) return; + + if (visible) + { + // cancel btn + bt = elm_button_add(obj); + elm_widget_mirrored_automatic_set(bt, EINA_FALSE); + elm_object_domain_translatable_text_set(bt, PACKAGE, N_("Cancel")); + + evas_object_smart_callback_add(bt, "clicked", _canc, obj); + + elm_widget_sub_object_add(obj, bt); + wd->cancel_button = bt; + + // ok btn + bt = elm_button_add(obj); + elm_widget_mirrored_automatic_set(bt, EINA_FALSE); + elm_object_domain_translatable_text_set(bt, PACKAGE, N_("OK")); + + evas_object_smart_callback_add(bt, "clicked", _ok, obj); + + elm_widget_sub_object_add(obj, bt); + wd->ok_button = bt; + + _theme_hook(obj); + } + else + { + evas_object_del(wd->cancel_button); + wd->cancel_button = NULL; + evas_object_del(wd->ok_button); + wd->ok_button = NULL; + } +} + +EAPI Eina_Bool +elm_fileselector_buttons_ok_cancel_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->ok_button ? EINA_TRUE : EINA_FALSE; +} + +EAPI void +elm_fileselector_expandable_set(Evas_Object *obj, + Eina_Bool expand) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + wd->expand = !!expand; + + if (wd->path) _populate(obj, wd->path, NULL); +} + +EAPI Eina_Bool +elm_fileselector_expandable_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->expand; +} + +EAPI void +elm_fileselector_path_set(Evas_Object *obj, + const char *_path) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + char *path; + path = ecore_file_realpath(_path); + _populate(obj, path, NULL); + free(path); +} + +EAPI const char * +elm_fileselector_path_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->path; +} + +EAPI void +elm_fileselector_mode_set(Evas_Object *obj, + Elm_Fileselector_Mode mode) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (mode == wd->mode) return; + + if (mode == ELM_FILESELECTOR_LIST) + { + if (edje_object_part_swallow(wd->edje, "elm.swallow.files", + wd->files_list)) + { + evas_object_show(wd->files_list); + evas_object_hide(wd->files_grid); + } + else + evas_object_hide(wd->files_list); + } + else + { + if (edje_object_part_swallow(wd->edje, "elm.swallow.files", + wd->files_grid)) + { + evas_object_show(wd->files_grid); + evas_object_hide(wd->files_list); + } + else + evas_object_hide(wd->files_grid); + } + + wd->mode = mode; + + _populate(obj, wd->path, NULL); +} + +EAPI Elm_Fileselector_Mode +elm_fileselector_mode_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_FILESELECTOR_LAST; + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return ELM_FILESELECTOR_LAST; + + return wd->mode; +} + +EAPI const char * +elm_fileselector_selected_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + if (!wd->path) return NULL; + + if (wd->filename_entry) + { + const char *name; + char buf[PATH_MAX]; + char *dir, *s; + + dir = wd->only_folder ? ecore_file_dir_get(wd->path) : strdup(wd->path); + name = elm_object_text_get(wd->filename_entry); + if (name) + { + s = elm_entry_markup_to_utf8(name); + if (s) + { + snprintf(buf, sizeof(buf), "%s/%s", dir, s); + free(s); + } + else + snprintf(buf, sizeof(buf), "%s", dir); + } + else + { + snprintf(buf, sizeof(buf), "%s", dir); + } + if (wd->only_folder && !ecore_file_is_dir(buf)) + eina_stringshare_replace(&wd->selection, ecore_file_dir_get(buf)); + else + eina_stringshare_replace(&wd->selection, buf); + if (dir) free(dir); + return wd->selection; + } + + if (wd->mode == ELM_FILESELECTOR_LIST) + { + Elm_Object_Item *gl_it = elm_genlist_selected_item_get(wd->files_list); + if (gl_it) return elm_object_item_data_get(gl_it); + } + else + { + Elm_Object_Item *gg_it = elm_gengrid_selected_item_get(wd->files_grid); + if (gg_it) return elm_object_item_data_get(gg_it); + } + + return wd->path; +} + +EAPI Eina_Bool +elm_fileselector_selected_set(Evas_Object *obj, + const char *_path) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + Eina_Bool ret = EINA_TRUE; + char *path; + path = ecore_file_realpath(_path); + + if (ecore_file_is_dir(path)) + _populate(obj, path, NULL); + else + { + if (!ecore_file_exists(path)) + { + ret = EINA_FALSE; + goto clean_up; + } + + _populate(obj, ecore_file_dir_get(path), NULL); + if (wd->filename_entry) + { + char *s; + + s = elm_entry_utf8_to_markup(ecore_file_file_get(path)); + if (s) + { + elm_object_text_set(wd->filename_entry, s); + free(s); + } + else + elm_object_text_set(wd->filename_entry, ""); + eina_stringshare_replace(&wd->selection, path); + } + } + +clean_up: + free(path); + return ret; +} + diff --git a/libraries/elementary/src/lib/elc_fileselector.h b/libraries/elementary/src/lib/elc_fileselector.h new file mode 100644 index 0000000..bf11c67 --- /dev/null +++ b/libraries/elementary/src/lib/elc_fileselector.h @@ -0,0 +1,313 @@ +/** + * @defgroup Fileselector File Selector + * @ingroup Elementary + * + * @image html img/widget/fileselector/preview-00.png + * @image latex img/widget/fileselector/preview-00.eps + * + * A file selector is a widget that allows a user to navigate + * through a file system, reporting file selections back via its + * API. + * + * It contains shortcut buttons for home directory (@c ~) and to + * jump one directory upwards (..), as well as cancel/ok buttons to + * confirm/cancel a given selection. After either one of those two + * former actions, the file selector will issue its @c "done" smart + * callback. + * + * There's a text entry on it, too, showing the name of the current + * selection. There's the possibility of making it editable, so it + * is useful on file saving dialogs on applications, where one + * gives a file name to save contents to, in a given directory in + * the system. This custom file name will be reported on the @c + * "done" smart callback (explained in sequence). + * + * Finally, it has a view to display file system items into in two + * possible forms: + * - list + * - grid + * + * If Elementary is built with support of the Ethumb thumbnailing + * library, the second form of view will display preview thumbnails + * of files which it supports. + * + * Smart callbacks one can register to: + * + * - @c "selected" - the user has clicked on a file (when not in + * folders-only mode) or directory (when in folders-only mode) + * - @c "directory,open" - the list has been populated with new + * content (@c event_info is a pointer to the directory's + * path, a @b stringshared string) + * - @c "done" - the user has clicked on the "ok" or "cancel" + * buttons (@c event_info is a pointer to the selection's + * path, a @b stringshared string) + * + * Here is an example on its usage: + * @li @ref fileselector_example + */ + +/** + * @addtogroup Fileselector + * @{ + */ + +/** + * Defines how a file selector widget is to layout its contents + * (file system entries). + */ +typedef enum +{ + ELM_FILESELECTOR_LIST = 0, /**< layout as a list */ + ELM_FILESELECTOR_GRID, /**< layout as a grid */ + ELM_FILESELECTOR_LAST /**< sentinel (helper) value, not used */ +} Elm_Fileselector_Mode; + +/** + * Add a new file selector widget to the given parent Elementary + * (container) object + * + * @param parent The parent object + * @return a new file selector widget handle or @c NULL, on errors + * + * This function inserts a new file selector widget on the canvas. + * + * @ingroup Fileselector + */ +EAPI Evas_Object *elm_fileselector_add(Evas_Object *parent); + +/** + * Enable/disable the file name entry box where the user can type + * in a name for a file, in a given file selector widget + * + * @param obj The file selector object + * @param is_save @c EINA_TRUE to make the file selector a "saving + * dialog", @c EINA_FALSE otherwise + * + * Having the entry editable is useful on file saving dialogs on + * applications, where one gives a file name to save contents to, + * in a given directory in the system. This custom file name will + * be reported on the @c "done" smart callback. + * + * @see elm_fileselector_is_save_get() + * + * @ingroup Fileselector + */ +EAPI void elm_fileselector_is_save_set(Evas_Object *obj, Eina_Bool is_save); + +/** + * Get whether the given file selector is in "saving dialog" mode + * + * @param obj The file selector object + * @return @c EINA_TRUE, if the file selector is in "saving dialog" + * mode, @c EINA_FALSE otherwise (and on errors) + * + * @see elm_fileselector_is_save_set() for more details + * + * @ingroup Fileselector + */ +EAPI Eina_Bool elm_fileselector_is_save_get(const Evas_Object *obj); + +/** + * Enable/disable folder-only view for a given file selector widget + * + * @param obj The file selector object + * @param only @c EINA_TRUE to make @p obj only display + * directories, @c EINA_FALSE to make files to be displayed in it + * too + * + * If enabled, the widget's view will only display folder items, + * naturally. + * + * @see elm_fileselector_folder_only_get() + * + * @ingroup Fileselector + */ +EAPI void elm_fileselector_folder_only_set(Evas_Object *obj, Eina_Bool only); + +/** + * Get whether folder-only view is set for a given file selector + * widget + * + * @param obj The file selector object + * @return only @c EINA_TRUE if @p obj is only displaying + * directories, @c EINA_FALSE if files are being displayed in it + * too (and on errors) + * + * @see elm_fileselector_folder_only_get() + * + * @ingroup Fileselector + */ +EAPI Eina_Bool elm_fileselector_folder_only_get(const Evas_Object *obj); + +/** + * Enable/disable the "ok" and "cancel" buttons on a given file + * selector widget + * + * @param obj The file selector object + * @param buttons @c EINA_TRUE to show buttons, @c EINA_FALSE to hide. + * + * @note A file selector without those buttons will never emit the + * @c "done" smart event, and is only usable if one is just hooking + * to the other two events. + * + * @see elm_fileselector_buttons_ok_cancel_get() + * + * @ingroup Fileselector + */ +EAPI void elm_fileselector_buttons_ok_cancel_set(Evas_Object *obj, Eina_Bool buttons); + +/** + * Get whether the "ok" and "cancel" buttons on a given file + * selector widget are being shown. + * + * @param obj The file selector object + * @return @c EINA_TRUE if they are being shown, @c EINA_FALSE + * otherwise (and on errors) + * + * @see elm_fileselector_buttons_ok_cancel_set() for more details + * + * @ingroup Fileselector + */ +EAPI Eina_Bool elm_fileselector_buttons_ok_cancel_get(const Evas_Object *obj); + +/** + * Enable/disable a tree view in the given file selector widget, + * if it's in @c #ELM_FILESELECTOR_LIST mode + * + * @param obj The file selector object + * @param expand @c EINA_TRUE to enable tree view, @c EINA_FALSE to + * disable + * + * In a tree view, arrows are created on the sides of directories, + * allowing them to expand in place. + * + * @note If it's in other mode, the changes made by this function + * will only be visible when one switches back to "list" mode. + * + * @see elm_fileselector_expandable_get() + * + * @ingroup Fileselector + */ +EAPI void elm_fileselector_expandable_set(Evas_Object *obj, Eina_Bool expand); + +/** + * Get whether tree view is enabled for the given file selector + * widget + * + * @param obj The file selector object + * @return @c EINA_TRUE if @p obj is in tree view, @c EINA_FALSE + * otherwise (and or errors) + * + * @see elm_fileselector_expandable_set() for more details + * + * @ingroup Fileselector + */ +EAPI Eina_Bool elm_fileselector_expandable_get(const Evas_Object *obj); + +/** + * Set, programmatically, the @b directory that a given file + * selector widget will display contents from + * + * @param obj The file selector object + * @param path The path to display in @p obj + * + * This will change the @b directory that @p obj is displaying. It + * will also clear the text entry area on the @p obj object, which + * displays select files' names. + * + * @see elm_fileselector_path_get() + * + * @ingroup Fileselector + */ +EAPI void elm_fileselector_path_set(Evas_Object *obj, const char *path); + +/** + * Get the parent directory's path that a given file selector + * widget is displaying + * + * @param obj The file selector object + * @return The (full) path of the directory the file selector is + * displaying, a @b stringshared string + * + * @see elm_fileselector_path_set() + * + * @ingroup Fileselector + */ +EAPI const char *elm_fileselector_path_get(const Evas_Object *obj); + +/** + * Set, programmatically, the currently selected file/directory in + * the given file selector widget + * + * @param obj The file selector object + * @param path The (full) path to a file or directory + * @return @c EINA_TRUE on success, @c EINA_FALSE on failure. The + * latter case occurs if the directory or file pointed to do not + * exist. + * + * @see elm_fileselector_selected_get() + * + * @ingroup Fileselector + */ +EAPI Eina_Bool elm_fileselector_selected_set(Evas_Object *obj, const char *path); + +/** + * Get the currently selected item's (full) path, in the given file + * selector widget + * + * @param obj The file selector object + * @return The absolute path of the selected item, a @b + * stringshared string + * + * @note Custom editions on @p obj object's text entry, if made, + * will appear on the return string of this function, naturally. + * + * @see elm_fileselector_selected_set() for more details + * + * @ingroup Fileselector + */ +EAPI const char *elm_fileselector_selected_get(const Evas_Object *obj); + +/** + * Set the mode in which a given file selector widget will display + * (layout) file system entries in its view + * + * @param obj The file selector object + * @param mode The mode of the fileselector, being it one of + * #ELM_FILESELECTOR_LIST (default) or #ELM_FILESELECTOR_GRID. The + * first one, naturally, will display the files in a list. The + * latter will make the widget to display its entries in a grid + * form. + * + * @note By using elm_fileselector_expandable_set(), the user may + * trigger a tree view for that list. + * + * @note If Elementary is built with support of the Ethumb + * thumbnailing library, the second form of view will display + * preview thumbnails of files which it supports. You must have + * elm_need_ethumb() called in your Elementary for thumbnailing to + * work, though. + * + * @see elm_fileselector_expandable_set(). + * @see elm_fileselector_mode_get(). + * + * @ingroup Fileselector + */ +EAPI void elm_fileselector_mode_set(Evas_Object *obj, Elm_Fileselector_Mode mode); + +/** + * Get the mode in which a given file selector widget is displaying + * (layouting) file system entries in its view + * + * @param obj The fileselector object + * @return The mode in which the fileselector is at + * + * @see elm_fileselector_mode_set() for more details + * + * @ingroup Fileselector + */ +EAPI Elm_Fileselector_Mode elm_fileselector_mode_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elc_fileselector_button.c b/libraries/elementary/src/lib/elc_fileselector_button.c new file mode 100644 index 0000000..452498d --- /dev/null +++ b/libraries/elementary/src/lib/elc_fileselector_button.c @@ -0,0 +1,520 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *self, *btn, *fs, *fsw; + const char *window_title; + Evas_Coord w, h; + struct + { + const char *path; + Eina_Bool expandable : 1; + Eina_Bool folder_only : 1; + Eina_Bool is_save : 1; + } fsd; + Eina_Bool inwin_mode : 1; +}; + +#define DEFAULT_WINDOW_TITLE "Select a file" + +static const char *widtype = NULL; + +static void _del_pre_hook(Evas_Object *obj); +static void _del_hook(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); +static void _disable_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _changed_size_hints(void *data, + Evas *e, + Evas_Object *obj, + void *event_info); +static void _button_clicked(void *data, + Evas_Object *obj, + void *event_info); +static void _on_focus_hook(void *data, + Evas_Object *obj); +static void _selection_done(void *data, + Evas_Object *obj, + void *event_info); +static void _activate(Widget_Data *wd); + +static const char SIG_FILE_CHOSEN[] = "file,chosen"; +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_FILE_CHOSEN, "s"}, + {NULL, NULL} +}; + +static void +_del_pre_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_event_callback_del_full(wd->btn, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + evas_object_smart_callback_del(wd->btn, "clicked", _button_clicked); +} + +static void +_del_hook(Evas_Object *obj) +{ + Evas_Object *win; + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + if (wd->window_title) eina_stringshare_del(wd->window_title); + if (wd->fsd.path) eina_stringshare_del(wd->fsd.path); + if (wd->fs) + { + win = evas_object_data_del(obj, "win"); + evas_object_del(win); + } + free(wd); +} + +static void +_on_focus_hook(void *data __UNUSED__, + Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (elm_widget_focus_get(obj)) + elm_widget_focus_steal(wd->btn); +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_widget_mirrored_set(wd->btn, rtl); + elm_widget_mirrored_set(wd->fs, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + char buf[4096]; + if (!wd) return; + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + + snprintf(buf, sizeof(buf), "fileselector_button/%s", + elm_widget_style_get(obj)); + elm_object_style_set(wd->btn, buf); + _sizing_eval(obj); +} + +static void +_disable_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_widget_disabled_set(wd->btn, elm_widget_disabled_get(obj)); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; + if (!wd) return; + evas_object_size_hint_min_get(wd->btn, &minw, &minh); + evas_object_size_hint_max_get(wd->btn, &maxw, &maxh); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, maxw, maxh); +} + +static void +_changed_size_hints(void *data, + Evas *e __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + _sizing_eval(data); +} + +static void +_activate_hook(Evas_Object *obj) +{ + Widget_Data *wd; + wd = elm_widget_data_get(obj); + if (!wd) return; + _activate(wd); +} + +static void +_button_clicked(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + _activate(data); +} + +static Evas_Object * +_parent_win_get(Evas_Object *obj) +{ + while ((obj) && (strcmp(elm_widget_type_get(obj), "win"))) + obj = elm_object_parent_widget_get(obj); + + return obj; +} + +static Evas_Object * +_new_window_add(Widget_Data *wd) +{ + Evas_Object *win, *bg; + + win = elm_win_add(NULL, "fileselector_button", ELM_WIN_DIALOG_BASIC); + elm_win_title_set(win, wd->window_title); + elm_win_autodel_set(win, EINA_TRUE); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(bg); + + evas_object_resize(win, wd->w, wd->h); + return win; +} + +static void +_activate(Widget_Data *wd) +{ + Eina_Bool is_inwin = EINA_FALSE; + + if (wd->fs) return; + + if (wd->inwin_mode) + { + wd->fsw = _parent_win_get(wd->self); + + if (!wd->fsw) + wd->fsw = _new_window_add(wd); + else + { + wd->fsw = elm_win_inwin_add(wd->fsw); + is_inwin = EINA_TRUE; + } + } + else + wd->fsw = _new_window_add(wd); + + wd->fs = elm_fileselector_add(wd->fsw); + elm_widget_mirrored_set(wd->fs, elm_widget_mirrored_get(wd->self)); + elm_widget_mirrored_automatic_set(wd->fs, EINA_FALSE); + elm_fileselector_expandable_set(wd->fs, wd->fsd.expandable); + elm_fileselector_folder_only_set(wd->fs, wd->fsd.folder_only); + elm_fileselector_is_save_set(wd->fs, wd->fsd.is_save); + elm_fileselector_selected_set(wd->fs, wd->fsd.path); + evas_object_size_hint_weight_set(wd->fs, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(wd->fs, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_smart_callback_add(wd->fs, "done", _selection_done, wd); + evas_object_show(wd->fs); + + if (is_inwin) + { + elm_win_inwin_content_set(wd->fsw, wd->fs); + elm_win_inwin_activate(wd->fsw); + } + else + { + elm_win_resize_object_add(wd->fsw, wd->fs); + evas_object_show(wd->fsw); + } +} + +static void +_selection_done(void *data, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + const char *file = event_info; + Widget_Data *wd = data; + Evas_Object *del; + if (!wd) return; + + if (file) eina_stringshare_replace(&wd->fsd.path, file); + + del = wd->fsw; + wd->fs = NULL; + wd->fsw = NULL; + evas_object_del(del); + + evas_object_smart_callback_call(wd->self, SIG_FILE_CHOSEN, + (void *)wd->fsd.path); +} + +static void +_elm_fileselector_button_label_set(Evas_Object *obj, const char *item, + const char *label) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + if (item && strcmp(item, "default")) return; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_object_text_set(wd->btn, label); +} + +static const char * +_elm_fileselector_button_label_get(const Evas_Object *obj, const char *item) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (item && strcmp(item, "default")) return NULL; + if (!wd) return NULL; + return elm_object_text_get(wd->btn); +} + +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_object_part_content_set(wd->btn, part, content); +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return elm_object_part_content_get(wd->btn, part); +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return elm_object_part_content_unset(wd->btn, part); +} + +EAPI Evas_Object * +elm_fileselector_button_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "fileselector_button"); + elm_widget_type_set(obj, "fileselector_button"); + elm_widget_sub_object_add(parent, obj); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_data_set(obj, wd); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_disable_hook_set(obj, _disable_hook); + elm_widget_can_focus_set(obj, EINA_TRUE); + elm_widget_activate_hook_set(obj, _activate_hook); + elm_widget_text_set_hook_set(obj, _elm_fileselector_button_label_set); + elm_widget_text_get_hook_set(obj, _elm_fileselector_button_label_get); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); + + wd->self = obj; + wd->window_title = eina_stringshare_add(DEFAULT_WINDOW_TITLE); + if (getenv("HOME")) wd->fsd.path = eina_stringshare_add(getenv("HOME")); + else wd->fsd.path = eina_stringshare_add("/"); + wd->fsd.expandable = _elm_config->fileselector_expand_enable; + wd->inwin_mode = _elm_config->inwin_dialogs_enable; + wd->w = 400; + wd->h = 400; + + wd->btn = elm_button_add(parent); + elm_widget_mirrored_automatic_set(wd->btn, EINA_FALSE); + elm_widget_resize_object_set(obj, wd->btn); + evas_object_event_callback_add(wd->btn, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + evas_object_smart_callback_add(wd->btn, "clicked", _button_clicked, wd); + elm_widget_sub_object_add(obj, wd->btn); + + _theme_hook(obj); + evas_object_smart_callbacks_descriptions_set(obj, _signals); + return obj; +} + + +EAPI void +elm_fileselector_button_window_title_set(Evas_Object *obj, + const char *title) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + eina_stringshare_replace(&wd->window_title, title); + + if (wd->fsw) + elm_win_title_set(wd->fsw, wd->window_title); +} + +EAPI const char * +elm_fileselector_button_window_title_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return NULL; + return wd->window_title; +} + +EAPI void +elm_fileselector_button_window_size_set(Evas_Object *obj, + Evas_Coord width, + Evas_Coord height) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + wd->w = width; + wd->h = height; + + if (wd->fsw) + evas_object_resize(wd->fsw, wd->w, wd->h); +} + +EAPI void +elm_fileselector_button_window_size_get(const Evas_Object *obj, + Evas_Coord *width, + Evas_Coord *height) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + if (width) *width = wd->w; + if (height) *height = wd->h; +} + +EAPI void +elm_fileselector_button_path_set(Evas_Object *obj, + const char *path) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + eina_stringshare_replace(&wd->fsd.path, path); + + if (wd->fs) + elm_fileselector_selected_set(wd->fs, wd->fsd.path); +} + +EAPI const char * +elm_fileselector_button_path_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->fsd.path; +} + +EAPI void +elm_fileselector_button_expandable_set(Evas_Object *obj, + Eina_Bool value) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + wd->fsd.expandable = value; + + if (wd->fs) + elm_fileselector_expandable_set(wd->fs, wd->fsd.expandable); +} + +EAPI Eina_Bool +elm_fileselector_button_expandable_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return EINA_FALSE; + return wd->fsd.expandable; +} + +EAPI void +elm_fileselector_button_folder_only_set(Evas_Object *obj, + Eina_Bool value) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + wd->fsd.folder_only = value; + + if (wd->fs) + elm_fileselector_folder_only_set(wd->fs, wd->fsd.folder_only); +} + +EAPI Eina_Bool +elm_fileselector_button_folder_only_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return EINA_FALSE; + return wd->fsd.folder_only; +} + +EAPI void +elm_fileselector_button_is_save_set(Evas_Object *obj, + Eina_Bool value) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + wd->fsd.is_save = value; + + if (wd->fs) + elm_fileselector_is_save_set(wd->fs, wd->fsd.is_save); +} + +EAPI Eina_Bool +elm_fileselector_button_is_save_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return EINA_FALSE; + return wd->fsd.is_save; +} + +EAPI void +elm_fileselector_button_inwin_mode_set(Evas_Object *obj, + Eina_Bool value) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + wd->inwin_mode = value; +} + +EAPI Eina_Bool +elm_fileselector_button_inwin_mode_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return EINA_FALSE; + return wd->inwin_mode; +} diff --git a/libraries/elementary/src/lib/elc_fileselector_button.h b/libraries/elementary/src/lib/elc_fileselector_button.h new file mode 100644 index 0000000..3eab292 --- /dev/null +++ b/libraries/elementary/src/lib/elc_fileselector_button.h @@ -0,0 +1,306 @@ +/** + * @defgroup File_Selector_Button File Selector Button + * @ingroup Elementary + * + * @image html img/widget/fileselector_button/preview-00.png + * @image latex img/widget/fileselector_button/preview-00.eps + * @image html img/widget/fileselector_button/preview-01.png + * @image latex img/widget/fileselector_button/preview-01.eps + * @image html img/widget/fileselector_button/preview-02.png + * @image latex img/widget/fileselector_button/preview-02.eps + * + * This is a button that, when clicked, creates an Elementary + * window (or inner window) with a @ref Fileselector "file + * selector widget" within. When a file is chosen, the (inner) + * window is closed and the button emits a signal having the + * selected file as it's @c event_info. + * + * This widget encapsulates operations on its internal file + * selector on its own API. There is less control over its file + * selector than that one would have instantiating one directly. + * + * The following styles are available for this button: + * @li @c "default" + * @li @c "anchor" + * @li @c "hoversel_vertical" + * @li @c "hoversel_vertical_entry" + * + * Smart callbacks one can register to: + * - @c "file,chosen" - the user has selected a path, whose string + * pointer comes as the @c event_info data (a stringshared + * string) + * + * Default text parts of the fileselector_button widget that you can use for + * are: + * @li "default" - Label of the fileselector_button + * + * Default content parts of the fileselector_button widget that you can use for + * are: + * @li "icon" - Icon of the fileselector_button + * + * Supported elm_object common APIs. + * @li @ref elm_object_part_text_set + * @li @ref elm_object_part_text_get + * @li @ref elm_object_part_content_set + * @li @ref elm_object_part_content_get + * @li @ref elm_object_part_content_unset + * @li @ref elm_object_disabled_set + * @li @ref elm_object_disabled_get + * + * Here is an example on its usage: + * @li @ref fileselector_button_example + * + * @see @ref File_Selector_Entry for a similar widget. + * @{ + */ + +/** + * Add a new file selector button widget to the given parent + * Elementary (container) object + * + * @param parent The parent object + * @return a new file selector button widget handle or @c NULL, on + * errors + * + * @ingroup File_Selector_Button + */ +EAPI Evas_Object *elm_fileselector_button_add(Evas_Object *parent); + +/** + * Set the title for a given file selector button widget's window + * + * @param obj The file selector button widget + * @param title The title string + * + * This will change the popup window's title, when the file selector pops + * out after a click on the button. Those windows have the default + * (unlocalized) value of @c "Select a file" as titles. + * + * @note It will only take effect if the file selector + * button widget is @b not under "inwin mode". + * + * @see elm_fileselector_button_window_title_get() + * + * @ingroup File_Selector_Button + */ +EAPI void elm_fileselector_button_window_title_set(Evas_Object *obj, const char *title); + +/** + * Get the title for a given file selector button widget's + * window + * + * @param obj The file selector button widget + * @return Title of the file selector button's window + * + * @see elm_fileselector_button_window_title_get() for more details + * + * @ingroup File_Selector_Button + */ +EAPI const char *elm_fileselector_button_window_title_get(const Evas_Object *obj); + +/** + * Set the size of a given file selector button widget's window, + * holding the file selector itself. + * + * @param obj The file selector button widget + * @param width The window's width + * @param height The window's height + * + * @note it will only take any effect if the file selector button + * widget is @b not under "inwin mode". The default size for the + * window (when applicable) is 400x400 pixels. + * + * @see elm_fileselector_button_window_size_get() + * + * @ingroup File_Selector_Button + */ +EAPI void elm_fileselector_button_window_size_set(Evas_Object *obj, Evas_Coord width, Evas_Coord height); + +/** + * Get the size of a given file selector button widget's window, + * holding the file selector itself. + * + * @param obj The file selector button widget + * @param width Pointer into which to store the width value + * @param height Pointer into which to store the height value + * + * @note Use @c NULL pointers on the size values you're not + * interested in: they'll be ignored by the function. + * + * @see elm_fileselector_button_window_size_set(), for more details + * + * @ingroup File_Selector_Button + */ +EAPI void elm_fileselector_button_window_size_get(const Evas_Object *obj, Evas_Coord *width, Evas_Coord *height); + +/** + * Set the initial file system path for a given file selector + * button widget + * + * @param obj The file selector button widget + * @param path The path string + * + * It must be a directory path, which will have the contents + * displayed initially in the file selector's view, when invoked + * from @p obj. The default initial path is the @c "HOME" + * environment variable's value. + * + * @see elm_fileselector_button_path_get() + * + * @ingroup File_Selector_Button + */ +EAPI void elm_fileselector_button_path_set(Evas_Object *obj, const char *path); + +/** + * Get the initial file system path set for a given file selector + * button widget + * + * @param obj The file selector button widget + * @return path The path string + * + * @see elm_fileselector_button_path_set() for more details + * + * @ingroup File_Selector_Button + */ +EAPI const char *elm_fileselector_button_path_get(const Evas_Object *obj); + +/** + * Enable/disable a tree view in the given file selector button + * widget's internal file selector + * + * @param obj The file selector button widget + * @param value @c EINA_TRUE to enable tree view, @c EINA_FALSE to + * disable + * + * This has the same effect as elm_fileselector_expandable_set(), + * but now applied to a file selector button's internal file + * selector. + * + * @note There's no way to put a file selector button's internal + * file selector in "grid mode", as one may do with "pure" file + * selectors. + * + * @see elm_fileselector_expandable_get() + * + * @ingroup File_Selector_Button + */ +EAPI void elm_fileselector_button_expandable_set(Evas_Object *obj, Eina_Bool value); + +/** + * Get whether tree view is enabled for the given file selector + * button widget's internal file selector + * + * @param obj The file selector button widget + * @return @c EINA_TRUE if @p obj widget's internal file selector + * is in tree view, @c EINA_FALSE otherwise (and or errors) + * + * @see elm_fileselector_expandable_set() for more details + * + * @ingroup File_Selector_Button + */ +EAPI Eina_Bool elm_fileselector_button_expandable_get(const Evas_Object *obj); + +/** + * Set whether a given file selector button widget's internal file + * selector is to display folders only or the directory contents, + * as well. + * + * @param obj The file selector button widget + * @param value @c EINA_TRUE to make @p obj widget's internal file + * selector only display directories, @c EINA_FALSE to make files + * to be displayed in it too + * + * This has the same effect as elm_fileselector_folder_only_set(), + * but now applied to a file selector button's internal file + * selector. + * + * @see elm_fileselector_folder_only_get() + * + * @ingroup File_Selector_Button + */ +EAPI void elm_fileselector_button_folder_only_set(Evas_Object *obj, Eina_Bool value); + +/** + * Get whether a given file selector button widget's internal file + * selector is displaying folders only or the directory contents, + * as well. + * + * @param obj The file selector button widget + * @return @c EINA_TRUE if @p obj widget's internal file + * selector is only displaying directories, @c EINA_FALSE if files + * are being displayed in it too (and on errors) + * + * @see elm_fileselector_button_folder_only_set() for more details + * + * @ingroup File_Selector_Button + */ +EAPI Eina_Bool elm_fileselector_button_folder_only_get(const Evas_Object *obj); + +/** + * Enable/disable the file name entry box where the user can type + * in a name for a file, in a given file selector button widget's + * internal file selector. + * + * @param obj The file selector button widget + * @param value @c EINA_TRUE to make @p obj widget's internal + * file selector a "saving dialog", @c EINA_FALSE otherwise + * + * This has the same effect as elm_fileselector_is_save_set(), + * but now applied to a file selector button's internal file + * selector. + * + * @see elm_fileselector_is_save_get() + * + * @ingroup File_Selector_Button + */ +EAPI void elm_fileselector_button_is_save_set(Evas_Object *obj, Eina_Bool value); + +/** + * Get whether the given file selector button widget's internal + * file selector is in "saving dialog" mode + * + * @param obj The file selector button widget + * @return @c EINA_TRUE, if @p obj widget's internal file selector + * is in "saving dialog" mode, @c EINA_FALSE otherwise (and on + * errors) + * + * @see elm_fileselector_button_is_save_set() for more details + * + * @ingroup File_Selector_Button + */ +EAPI Eina_Bool elm_fileselector_button_is_save_get(const Evas_Object *obj); + +/** + * Set whether a given file selector button widget's internal file + * selector will raise an Elementary "inner window", instead of a + * dedicated Elementary window. By default, it won't. + * + * @param obj The file selector button widget + * @param value @c EINA_TRUE to make it use an inner window, @c + * EINA_TRUE to make it use a dedicated window + * + * @see elm_win_inwin_add() for more information on inner windows + * @see elm_fileselector_button_inwin_mode_get() + * + * @ingroup File_Selector_Button + */ +EAPI void elm_fileselector_button_inwin_mode_set(Evas_Object *obj, Eina_Bool value); + +/** + * Get whether a given file selector button widget's internal file + * selector will raise an Elementary "inner window", instead of a + * dedicated Elementary window. + * + * @param obj The file selector button widget + * @return @c EINA_TRUE if will use an inner window, @c EINA_TRUE + * if it will use a dedicated window + * + * @see elm_fileselector_button_inwin_mode_set() for more details + * + * @ingroup File_Selector_Button + */ +EAPI Eina_Bool elm_fileselector_button_inwin_mode_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elc_fileselector_entry.c b/libraries/elementary/src/lib/elc_fileselector_entry.c new file mode 100644 index 0000000..7c78e2a --- /dev/null +++ b/libraries/elementary/src/lib/elc_fileselector_entry.c @@ -0,0 +1,508 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *edje; + Evas_Object *button; + Evas_Object *entry; + char *path; +}; + +static const char *widtype = NULL; + +static const char SIG_CHANGED[] = "changed"; +static const char SIG_ACTIVATED[] = "activated"; +static const char SIG_PRESS[] = "press"; +static const char SIG_LONGPRESSED[] = "longpressed"; +static const char SIG_CLICKED[] = "clicked"; +static const char SIG_CLICKED_DOUBLE[] = "clicked,double"; +static const char SIG_FOCUSED[] = "focused"; +static const char SIG_UNFOCUSED[] = "unfocused"; +static const char SIG_SELECTION_PASTE[] = "selection,paste"; +static const char SIG_SELECTION_COPY[] = "selection,copy"; +static const char SIG_SELECTION_CUT[] = "selection,cut"; +static const char SIG_UNPRESSED[] = "unpressed"; +static const char SIG_FILE_CHOSEN[] = "file,chosen"; +static const Evas_Smart_Cb_Description _signals[] = +{ + {SIG_CHANGED, ""}, + {SIG_ACTIVATED, ""}, + {SIG_PRESS, ""}, + {SIG_LONGPRESSED, ""}, + {SIG_CLICKED, ""}, + {SIG_CLICKED_DOUBLE, ""}, + {SIG_FOCUSED, ""}, + {SIG_UNFOCUSED, ""}, + {SIG_SELECTION_PASTE, ""}, + {SIG_SELECTION_COPY, ""}, + {SIG_SELECTION_CUT, ""}, + {SIG_UNPRESSED, ""}, + {SIG_FILE_CHOSEN, "s"}, + {NULL, NULL} +}; + +#define SIG_FWD(name) \ +static void \ +_##name##_fwd(void *data, Evas_Object *obj __UNUSED__, void *event_info) \ +{ \ + evas_object_smart_callback_call(data, SIG_##name, event_info); \ +} +SIG_FWD(CHANGED) +SIG_FWD(PRESS) +SIG_FWD(LONGPRESSED) +SIG_FWD(CLICKED) +SIG_FWD(CLICKED_DOUBLE) +SIG_FWD(FOCUSED) +SIG_FWD(UNFOCUSED) +SIG_FWD(SELECTION_PASTE) +SIG_FWD(SELECTION_COPY) +SIG_FWD(SELECTION_CUT) +SIG_FWD(UNPRESSED) +#undef SIG_FWD + +static void _del_pre_hook(Evas_Object *obj); +static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); + +static void +_FILE_CHOSEN_fwd(void *data, Evas_Object *obj __UNUSED__, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(data); + const char *file = event_info; + char *s; + + s = elm_entry_utf8_to_markup(file); + if (!s) return; + elm_object_text_set(wd->entry, s); + free(s); + evas_object_smart_callback_call(data, SIG_FILE_CHOSEN, event_info); +} + +static void +_ACTIVATED_fwd(void *data, Evas_Object *obj __UNUSED__, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(data); + const char *file = elm_object_text_get(wd->entry); + elm_fileselector_button_path_set(wd->button, file); + evas_object_smart_callback_call(data, SIG_ACTIVATED, event_info); +} + +static void +_del_pre_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_event_callback_del_full + (wd->button, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj); + evas_object_event_callback_del_full + (wd->entry, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj); +} + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (wd->path) free(wd->path); + free(wd); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1; + if (!wd) return; + edje_object_size_min_calc(wd->edje, &minw, &minh); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, -1, -1); +} + +static Eina_Bool +_elm_fileselector_entry_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) + return EINA_FALSE; + + Evas_Object *chain[2]; + + /* Direction */ + if (dir == ELM_FOCUS_PREVIOUS) + { + chain[0] = wd->button; + chain[1] = wd->entry; + } + else if (dir == ELM_FOCUS_NEXT) + { + chain[0] = wd->entry; + chain[1] = wd->button; + } + else + return EINA_FALSE; + + unsigned char i = elm_widget_focus_get(chain[1]); + + if (elm_widget_focus_next_get(chain[i], dir, next)) + return EINA_TRUE; + + i = !i; + + Evas_Object *to_focus; + if (elm_widget_focus_next_get(chain[i], dir, &to_focus)) + { + *next = to_focus; + return !!i; + } + + return EINA_FALSE; +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_widget_mirrored_set(wd->button, rtl); + edje_object_mirrored_set(wd->edje, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + const char *style = elm_widget_style_get(obj); + char buf[1024]; + + if (!wd) return; + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + + _elm_theme_object_set(obj, wd->edje, "fileselector_entry", "base", style); + if (elm_object_disabled_get(obj)) + edje_object_signal_emit(wd->edje, "elm,state,disabled", "elm"); + + if (!style) style = "default"; + snprintf(buf, sizeof(buf), "fileselector_entry/%s", style); + elm_widget_style_set(wd->button, buf); + elm_widget_style_set(wd->entry, buf); + + edje_object_part_swallow(obj, "elm.swallow.button", wd->button); + edje_object_part_swallow(obj, "elm.swallow.entry", wd->entry); + + edje_object_message_signal_process(wd->edje); + edje_object_scale_set + (wd->edje, elm_widget_scale_get(obj) * _elm_config->scale); + _sizing_eval(obj); +} + +static void +_disable_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Eina_Bool val = elm_widget_disabled_get(obj); + if (!wd) return; + if (val) + edje_object_signal_emit(wd->edje, "elm,state,disabled", "elm"); + else + edje_object_signal_emit(wd->edje, "elm,state,enabled", "elm"); + + elm_widget_disabled_set(wd->button, val); + elm_widget_disabled_set(wd->entry, val); +} + +static void +_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _sizing_eval(data); +} + +static void +_elm_fileselector_entry_button_label_set(Evas_Object *obj, const char *item, const char *label) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (item && strcmp(item, "default")) return; + if (!wd) return; + elm_object_text_set(wd->button, label); +} + +static const char * +_elm_fileselector_entry_button_label_get(const Evas_Object *obj, const char *item) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (item && strcmp(item, "default")) return NULL; + if (!wd) return NULL; + return elm_object_text_get(wd->button); +} + +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (part && strcmp(part, "button icon")) return; + elm_object_part_content_set(wd->button, NULL, content); +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (part && strcmp(part, "button icon")) return NULL; + return elm_object_part_content_get(wd->button, NULL); +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (part && strcmp(part, "button icon")) return NULL; + return elm_object_part_content_unset(wd->button, NULL); +} + +EAPI Evas_Object * +elm_fileselector_entry_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "fileselector_entry"); + elm_widget_type_set(obj, "fileselector_entry"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_disable_hook_set(obj, _disable_hook); + elm_widget_focus_next_hook_set(obj, _elm_fileselector_entry_focus_next_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_text_set_hook_set(obj, _elm_fileselector_entry_button_label_set); + elm_widget_text_get_hook_set(obj, _elm_fileselector_entry_button_label_get); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); + + wd->edje = edje_object_add(e); + _elm_theme_object_set(obj, wd->edje, "fileselector_entry", "base", "default"); + elm_widget_resize_object_set(obj, wd->edje); + + wd->button = elm_fileselector_button_add(obj); + elm_widget_mirrored_automatic_set(wd->button, EINA_FALSE); + ELM_SET_WIDTYPE(widtype, "fileselector_entry"); + elm_widget_style_set(wd->button, "fileselector_entry/default"); + edje_object_part_swallow(wd->edje, "elm.swallow.button", wd->button); + elm_widget_sub_object_add(obj, wd->button); + evas_object_event_callback_add + (wd->button, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj); + elm_fileselector_button_expandable_set(wd->button, + _elm_config->fileselector_expand_enable); + +#define SIG_FWD(name) \ + evas_object_smart_callback_add(wd->button, SIG_##name, _##name##_fwd, obj) + SIG_FWD(CLICKED); + SIG_FWD(UNPRESSED); + SIG_FWD(FILE_CHOSEN); +#undef SIG_FWD + + wd->entry = elm_entry_add(obj); + elm_entry_scrollable_set(wd->entry, EINA_TRUE); + elm_widget_mirrored_automatic_set(wd->entry, EINA_FALSE); + elm_widget_style_set(wd->entry, "fileselector_entry/default"); + elm_entry_single_line_set(wd->entry, EINA_TRUE); + elm_entry_editable_set(wd->entry, EINA_TRUE); + edje_object_part_swallow(wd->edje, "elm.swallow.entry", wd->entry); + elm_widget_sub_object_add(obj, wd->entry); + evas_object_event_callback_add + (wd->entry, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj); + +#define SIG_FWD(name) \ + evas_object_smart_callback_add(wd->entry, SIG_##name, _##name##_fwd, obj) + SIG_FWD(CHANGED); + SIG_FWD(ACTIVATED); + SIG_FWD(PRESS); + SIG_FWD(LONGPRESSED); + SIG_FWD(CLICKED); + SIG_FWD(CLICKED_DOUBLE); + SIG_FWD(FOCUSED); + SIG_FWD(UNFOCUSED); + SIG_FWD(SELECTION_PASTE); + SIG_FWD(SELECTION_COPY); + SIG_FWD(SELECTION_CUT); +#undef SIG_FWD + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _sizing_eval(obj); + + // TODO: convert Elementary to subclassing of Evas_Smart_Class + // TODO: and save some bytes, making descriptions per-class and not instance! + evas_object_smart_callbacks_descriptions_set(obj, _signals); + return obj; +} + +EAPI void +elm_fileselector_entry_selected_set(Evas_Object *obj, const char *path) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_fileselector_button_path_set(wd->button, path); +} + +EAPI const char * +elm_fileselector_entry_selected_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return elm_fileselector_button_path_get(wd->button); +} + +EAPI void +elm_fileselector_entry_window_title_set(Evas_Object *obj, const char *title) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_fileselector_button_window_title_set(wd->button, title); +} + +EAPI const char * +elm_fileselector_entry_window_title_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return elm_fileselector_button_window_title_get(wd->button); +} + +EAPI void +elm_fileselector_entry_window_size_set(Evas_Object *obj, Evas_Coord width, Evas_Coord height) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_fileselector_button_window_size_set(wd->button, width, height); +} + +EAPI void +elm_fileselector_entry_window_size_get(const Evas_Object *obj, Evas_Coord *width, Evas_Coord *height) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_fileselector_button_window_size_get(wd->button, width, height); +} + +EAPI void +elm_fileselector_entry_path_set(Evas_Object *obj, const char *path) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + char *s; + + if (!wd) return; + elm_fileselector_button_path_set(wd->button, path); + s = elm_entry_utf8_to_markup(path); + if (s) + { + elm_object_text_set(wd->entry, s); + free(s); + } +} + +EAPI const char * +elm_fileselector_entry_path_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return NULL; + if (wd->path) free(wd->path); + wd->path = elm_entry_markup_to_utf8(elm_object_text_get(wd->entry)); + return wd->path; +} + +EAPI void +elm_fileselector_entry_expandable_set(Evas_Object *obj, Eina_Bool value) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_fileselector_button_expandable_set(wd->button, value); +} + +EAPI Eina_Bool +elm_fileselector_entry_expandable_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return elm_fileselector_button_expandable_get(wd->button); +} + +EAPI void +elm_fileselector_entry_folder_only_set(Evas_Object *obj, Eina_Bool value) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_fileselector_button_folder_only_set(wd->button, value); +} + +EAPI Eina_Bool +elm_fileselector_entry_folder_only_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return elm_fileselector_button_folder_only_get(wd->button); +} + +EAPI void +elm_fileselector_entry_is_save_set(Evas_Object *obj, Eina_Bool value) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_fileselector_button_is_save_set(wd->button, value); +} + +EAPI Eina_Bool +elm_fileselector_entry_is_save_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return elm_fileselector_button_is_save_get(wd->button); +} + +EAPI void +elm_fileselector_entry_inwin_mode_set(Evas_Object *obj, Eina_Bool value) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_fileselector_button_inwin_mode_set(wd->button, value); +} + +EAPI Eina_Bool +elm_fileselector_entry_inwin_mode_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return elm_fileselector_button_inwin_mode_get(wd->button); +} diff --git a/libraries/elementary/src/lib/elc_fileselector_entry.h b/libraries/elementary/src/lib/elc_fileselector_entry.h new file mode 100644 index 0000000..8703e42 --- /dev/null +++ b/libraries/elementary/src/lib/elc_fileselector_entry.h @@ -0,0 +1,349 @@ +/** + * @defgroup File_Selector_Entry File Selector Entry + * @ingroup Elementary + * + * @image html img/widget/fileselector_entry/preview-00.png + * @image latex img/widget/fileselector_entry/preview-00.eps + * + * This is an entry made to be filled with or display a file + * system path string. Besides the entry itself, the widget has + * a @ref File_Selector_Button "file selector button" on its side, + * which will raise an internal @ref Fileselector "file selector widget", + * when clicked, for path selection aided by file system + * navigation. + * + * This file selector may appear in an Elementary window or in an + * inner window. When a file is chosen from it, the (inner) window + * is closed and the selected file's path string is exposed both as + * a smart event and as the new text on the entry. + * + * This widget encapsulates operations on its internal file + * selector on its own API. There is less control over its file + * selector than that one would have instantiating one directly. + * + * Smart callbacks one can register to: + * - @c "changed" - The text within the entry was changed + * - @c "activated" - The entry has had editing finished and + * changes are to be "committed" + * - @c "press" - The entry has been clicked + * - @c "longpressed" - The entry has been clicked (and held) for a + * couple seconds + * - @c "clicked" - The entry has been clicked + * - @c "clicked,double" - The entry has been double clicked + * - @c "focused" - The entry has received focus + * - @c "unfocused" - The entry has lost focus + * - @c "selection,paste" - A paste action has occurred on the + * entry + * - @c "selection,copy" - A copy action has occurred on the entry + * - @c "selection,cut" - A cut action has occurred on the entry + * - @c "unpressed" - The file selector entry's button was released + * after being pressed. + * - @c "file,chosen" - The user has selected a path via the file + * selector entry's internal file selector, whose string pointer + * comes as the @c event_info data (a stringshared string) + * + * Default text parts of the fileselector_button widget that you can use for + * are: + * @li "default" - Label of the fileselector_button + * + * Default content parts of the fileselector_entry widget that you can use for + * are: + * @li "button icon" - Button icon of the fileselector_entry + * + * Supported elm_object common APIs. + * @li @ref elm_object_part_text_set + * @li @ref elm_object_part_text_get + * @li @ref elm_object_part_content_set + * @li @ref elm_object_part_content_get + * @li @ref elm_object_part_content_unset + * @li @ref elm_object_disabled_set + * @li @ref elm_object_disabled_get + * + * Here is an example on its usage: + * @li @ref fileselector_entry_example + * + * @see @ref File_Selector_Button for a similar widget. + * @{ + */ + +/** + * Add a new file selector entry widget to the given parent + * Elementary (container) object + * + * @param parent The parent object + * @return a new file selector entry widget handle or @c NULL, on + * errors + * + * @ingroup File_Selector_Entry + */ +EAPI Evas_Object *elm_fileselector_entry_add(Evas_Object *parent); + +/** + * Set the title for a given file selector entry widget's window + * + * @param obj The file selector entry widget + * @param title The title string + * + * This will change the window's title, when the file selector pops + * out after a click on the entry's button. Those windows have the + * default (unlocalized) value of @c "Select a file" as titles. + * + * @note It will only take any effect if the file selector + * entry widget is @b not under "inwin mode". + * + * @see elm_fileselector_entry_window_title_get() + * + * @ingroup File_Selector_Entry + */ +EAPI void elm_fileselector_entry_window_title_set(Evas_Object *obj, const char *title); + +/** + * Get the title set for a given file selector entry widget's + * window + * + * @param obj The file selector entry widget + * @return Title of the file selector entry's window + * + * @see elm_fileselector_entry_window_title_get() for more details + * + * @ingroup File_Selector_Entry + */ +EAPI const char *elm_fileselector_entry_window_title_get(const Evas_Object *obj); + +/** + * Set the size of a given file selector entry widget's window, + * holding the file selector itself. + * + * @param obj The file selector entry widget + * @param width The window's width + * @param height The window's height + * + * @note it will only take any effect if the file selector entry + * widget is @b not under "inwin mode". The default size for the + * window (when applicable) is 400x400 pixels. + * + * @see elm_fileselector_entry_window_size_get() + * + * @ingroup File_Selector_Entry + */ +EAPI void elm_fileselector_entry_window_size_set(Evas_Object *obj, Evas_Coord width, Evas_Coord height); + +/** + * Get the size of a given file selector entry widget's window, + * holding the file selector itself. + * + * @param obj The file selector entry widget + * @param width Pointer into which to store the width value + * @param height Pointer into which to store the height value + * + * @note Use @c NULL pointers on the size values you're not + * interested in: they'll be ignored by the function. + * + * @see elm_fileselector_entry_window_size_set(), for more details + * + * @ingroup File_Selector_Entry + */ +EAPI void elm_fileselector_entry_window_size_get(const Evas_Object *obj, Evas_Coord *width, Evas_Coord *height); + +/** + * Set the initial file system path and the entry's path string for + * a given file selector entry widget + * + * @param obj The file selector entry widget + * @param path The path string + * + * It must be a directory path, which will have the contents + * displayed initially in the file selector's view, when invoked + * from @p obj. The default initial path is the @c "HOME" + * environment variable's value. + * + * @see elm_fileselector_entry_path_get() + * + * @ingroup File_Selector_Entry + */ +EAPI void elm_fileselector_entry_path_set(Evas_Object *obj, const char *path); + +/** + * Get the entry's path string for a given file selector entry + * widget + * + * @param obj The file selector entry widget + * @return path The path string + * + * @see elm_fileselector_entry_path_set() for more details + * + * @ingroup File_Selector_Entry + */ +EAPI const char *elm_fileselector_entry_path_get(const Evas_Object *obj); + +/** + * Enable/disable a tree view in the given file selector entry + * widget's internal file selector + * + * @param obj The file selector entry widget + * @param value @c EINA_TRUE to enable tree view, @c EINA_FALSE to disable + * + * This has the same effect as elm_fileselector_expandable_set(), + * but now applied to a file selector entry's internal file + * selector. + * + * @note There's no way to put a file selector entry's internal + * file selector in "grid mode", as one may do with "pure" file + * selectors. + * + * @see elm_fileselector_expandable_get() + * + * @ingroup File_Selector_Entry + */ +EAPI void elm_fileselector_entry_expandable_set(Evas_Object *obj, Eina_Bool value); + +/** + * Get whether tree view is enabled for the given file selector + * entry widget's internal file selector + * + * @param obj The file selector entry widget + * @return @c EINA_TRUE if @p obj widget's internal file selector + * is in tree view, @c EINA_FALSE otherwise (and or errors) + * + * @see elm_fileselector_expandable_set() for more details + * + * @ingroup File_Selector_Entry + */ +EAPI Eina_Bool elm_fileselector_entry_expandable_get(const Evas_Object *obj); + +/** + * Set whether a given file selector entry widget's internal file + * selector is to display folders only or the directory contents, + * as well. + * + * @param obj The file selector entry widget + * @param value @c EINA_TRUE to make @p obj widget's internal file + * selector only display directories, @c EINA_FALSE to make files + * to be displayed in it too + * + * This has the same effect as elm_fileselector_folder_only_set(), + * but now applied to a file selector entry's internal file + * selector. + * + * @see elm_fileselector_folder_only_get() + * + * @ingroup File_Selector_Entry + */ +EAPI void elm_fileselector_entry_folder_only_set(Evas_Object *obj, Eina_Bool value); + +/** + * Get whether a given file selector entry widget's internal file + * selector is displaying folders only or the directory contents, + * as well. + * + * @param obj The file selector entry widget + * @return @c EINA_TRUE if @p obj widget's internal file + * selector is only displaying directories, @c EINA_FALSE if files + * are being displayed in it too (and on errors) + * + * @see elm_fileselector_entry_folder_only_set() for more details + * + * @ingroup File_Selector_Entry + */ +EAPI Eina_Bool elm_fileselector_entry_folder_only_get(const Evas_Object *obj); + +/** + * Enable/disable the file name entry box where the user can type + * in a name for a file, in a given file selector entry widget's + * internal file selector. + * + * @param obj The file selector entry widget + * @param value @c EINA_TRUE to make @p obj widget's internal + * file selector a "saving dialog", @c EINA_FALSE otherwise + * + * This has the same effect as elm_fileselector_is_save_set(), + * but now applied to a file selector entry's internal file + * selector. + * + * @see elm_fileselector_is_save_get() + * + * @ingroup File_Selector_Entry + */ +EAPI void elm_fileselector_entry_is_save_set(Evas_Object *obj, Eina_Bool value); + +/** + * Get whether the given file selector entry widget's internal + * file selector is in "saving dialog" mode + * + * @param obj The file selector entry widget + * @return @c EINA_TRUE, if @p obj widget's internal file selector + * is in "saving dialog" mode, @c EINA_FALSE otherwise (and on + * errors) + * + * @see elm_fileselector_entry_is_save_set() for more details + * + * @ingroup File_Selector_Entry + */ +EAPI Eina_Bool elm_fileselector_entry_is_save_get(const Evas_Object *obj); + +/** + * Set whether a given file selector entry widget's internal file + * selector will raise an Elementary "inner window", instead of a + * dedicated Elementary window. By default, it won't. + * + * @param obj The file selector entry widget + * @param value @c EINA_TRUE to make it use an inner window, @c + * EINA_TRUE to make it use a dedicated window + * + * @see elm_win_inwin_add() for more information on inner windows + * @see elm_fileselector_entry_inwin_mode_get() + * + * @ingroup File_Selector_Entry + */ +EAPI void elm_fileselector_entry_inwin_mode_set(Evas_Object *obj, Eina_Bool value); + +/** + * Get whether a given file selector entry widget's internal file + * selector will raise an Elementary "inner window", instead of a + * dedicated Elementary window. + * + * @param obj The file selector entry widget + * @return @c EINA_TRUE if will use an inner window, @c EINA_TRUE + * if it will use a dedicated window + * + * @see elm_fileselector_entry_inwin_mode_set() for more details + * + * @ingroup File_Selector_Entry + */ +EAPI Eina_Bool elm_fileselector_entry_inwin_mode_get(const Evas_Object *obj); + +/** + * Set the initial file system path for a given file selector entry + * widget + * + * @param obj The file selector entry widget + * @param path The path string + * + * It must be a directory path, which will have the contents + * displayed initially in the file selector's view, when invoked + * from @p obj. The default initial path is the @c "HOME" + * environment variable's value. + * + * @see elm_fileselector_entry_path_get() + * + * @ingroup File_Selector_Entry + */ +EAPI void elm_fileselector_entry_selected_set(Evas_Object *obj, const char *path); + +/** + * Get the parent directory's path to the latest file selection on + * a given filer selector entry widget + * + * @param obj The file selector object + * @return The (full) path of the directory of the last selection + * on @p obj widget, a @b stringshared string + * + * @see elm_fileselector_entry_path_set() + * + * @ingroup File_Selector_Entry + */ +EAPI const char *elm_fileselector_entry_selected_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elc_hoversel.c b/libraries/elementary/src/lib/elc_hoversel.c new file mode 100644 index 0000000..fb07d78 --- /dev/null +++ b/libraries/elementary/src/lib/elc_hoversel.c @@ -0,0 +1,507 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; +typedef struct _Elm_Hoversel_Item Elm_Hoversel_Item; + +struct _Widget_Data +{ + Evas_Object *btn, *hover; + Evas_Object *hover_parent; + Eina_List *items; + Eina_Bool horizontal : 1; + Eina_Bool expanded : 1; +}; + +struct _Elm_Hoversel_Item +{ + ELM_WIDGET_ITEM; + const char *label; + const char *icon_file; + const char *icon_group; + Elm_Icon_Type icon_type; + Evas_Smart_Cb func; +}; + +static const char *widtype = NULL; +static void _del_pre_hook(Evas_Object *obj); +static void _del_hook(Evas_Object *obj); +static void _activate(Evas_Object *obj); +static void _activate_hook(Evas_Object *obj); +static void _disable_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info); + +static const char SIG_CLICKED[] = "clicked"; +static const char SIG_SELECTED[] = "selected"; +static const char SIG_DISMISSED[] = "dismissed"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CLICKED, ""}, + {SIG_SELECTED, ""}, + {SIG_DISMISSED, ""}, + {NULL, NULL} +}; + +static void +_del_pre_hook(Evas_Object *obj) +{ + Elm_Hoversel_Item *item; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_event_callback_del_full(wd->btn, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + elm_hoversel_hover_end(obj); + elm_hoversel_hover_parent_set(obj, NULL); + EINA_LIST_FREE(wd->items, item) + { + eina_stringshare_del(item->label); + eina_stringshare_del(item->icon_file); + eina_stringshare_del(item->icon_group); + elm_widget_item_free(item); + } +} + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + free(wd); +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_widget_mirrored_set(wd->btn, rtl); + elm_widget_mirrored_set(wd->hover, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + char buf[4096]; + if (!wd) return; + _elm_widget_mirrored_reload(obj); + + elm_hoversel_hover_end(obj); + if (wd->horizontal) + snprintf(buf, sizeof(buf), "hoversel_horizontal/%s", elm_widget_style_get(obj)); + else + snprintf(buf, sizeof(buf), "hoversel_vertical/%s", elm_widget_style_get(obj)); + elm_object_style_set(wd->btn, buf); + elm_object_disabled_set(wd->btn, elm_widget_disabled_get(obj)); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); +} + +static void +_disable_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_object_disabled_set(wd->btn, elm_widget_disabled_get(obj)); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; + if (!wd) return; + evas_object_size_hint_min_get(wd->btn, &minw, &minh); + evas_object_size_hint_max_get(wd->btn, &maxw, &maxh); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, maxw, maxh); +} + +static void +_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (elm_widget_focus_get(obj)) + elm_widget_focus_steal(wd->btn); +} + +static void +_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _sizing_eval(data); +} + +static void +_hover_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_hoversel_hover_end(data); +} + +static void +_item_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Hoversel_Item *item = data; + Evas_Object *obj2 = WIDGET(item); + + elm_hoversel_hover_end(obj2); + if (item->func) item->func((void *)item->base.data, obj2, item); + evas_object_smart_callback_call(obj2, SIG_SELECTED, item); +} + +static void +_activate(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *bt, *bx, *ic; + const Eina_List *l; + const Elm_Hoversel_Item *item; + char buf[4096]; + + if (!wd) return; + if (wd->expanded) + { + elm_hoversel_hover_end(obj); + return; + } + wd->expanded = EINA_TRUE; + + if (elm_widget_disabled_get(obj)) return; + wd->hover = elm_hover_add(obj); + elm_widget_mirrored_automatic_set(wd->hover, EINA_FALSE); + if (wd->horizontal) + snprintf(buf, sizeof(buf), "hoversel_horizontal/%s", elm_widget_style_get(obj)); + else + snprintf(buf, sizeof(buf), "hoversel_vertical/%s", elm_widget_style_get(obj)); + elm_object_style_set(wd->hover, buf); + evas_object_smart_callback_add(wd->hover, "clicked", _hover_clicked, obj); + elm_hover_parent_set(wd->hover, wd->hover_parent); + elm_hover_target_set(wd->hover, wd->btn); + + bx = elm_box_add(wd->hover); + elm_widget_mirrored_automatic_set(bx, EINA_FALSE); + elm_box_homogeneous_set(bx, 1); + + elm_box_horizontal_set(bx, wd->horizontal); + + if (wd->horizontal) + snprintf(buf, sizeof(buf), "hoversel_horizontal_entry/%s", + elm_widget_style_get(obj)); + else + snprintf(buf, sizeof(buf), "hoversel_vertical_entry/%s", + elm_widget_style_get(obj)); + EINA_LIST_FOREACH(wd->items, l, item) + { + bt = elm_button_add(wd->hover); + elm_widget_mirrored_automatic_set(bt, EINA_FALSE); + elm_widget_mirrored_set(bt, elm_widget_mirrored_get(obj)); + elm_object_style_set(bt, buf); + elm_object_text_set(bt, item->label); + if (item->icon_file) + { + ic = elm_icon_add(obj); + elm_icon_resizable_set(ic, EINA_FALSE, EINA_TRUE); + if (item->icon_type == ELM_ICON_FILE) + elm_icon_file_set(ic, item->icon_file, item->icon_group); + else if (item->icon_type == ELM_ICON_STANDARD) + elm_icon_standard_set(ic, item->icon_file); + elm_object_part_content_set(bt, "icon", ic); + evas_object_show(ic); + } + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(bx, bt); + evas_object_smart_callback_add(bt, "clicked", _item_clicked, item); + evas_object_show(bt); + } + + if (wd->horizontal) + elm_object_part_content_set(wd->hover, + elm_hover_best_content_location_get(wd->hover, + ELM_HOVER_AXIS_HORIZONTAL), + bx); + else + elm_object_part_content_set(wd->hover, + elm_hover_best_content_location_get(wd->hover, + ELM_HOVER_AXIS_VERTICAL), + bx); + evas_object_show(bx); + + evas_object_show(wd->hover); + evas_object_smart_callback_call(obj, SIG_CLICKED, NULL); + + // if (wd->horizontal) evas_object_hide(wd->btn); +} + +static void +_activate_hook(Evas_Object *obj) +{ + _activate(obj); +} + +static void +_button_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _activate(data); +} + +static void +_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + wd->hover_parent = NULL; +} + +static void +_elm_hoversel_label_set(Evas_Object *obj, const char *item, const char *label) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (item && strcmp(item, "default")) return; + if (!wd) return; + elm_object_text_set(wd->btn, label); +} + +static const char * +_elm_hoversel_label_get(const Evas_Object *obj, const char *item) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (item && strcmp(item, "default")) return NULL; + if ((!wd) || (!wd->btn)) return NULL; + return elm_object_text_get(wd->btn); +} + +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + elm_object_part_content_set(wd->btn, part, content); +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (!wd->btn)) return NULL; + return elm_object_part_content_get(wd->btn, part); +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (!wd->btn)) return NULL; + return elm_object_part_content_unset(wd->btn, part); +} + +static const char * +_item_text_get_hook(const Elm_Object_Item *it, const char *part) +{ + if (part && strcmp(part, "default")) return NULL; + return ((Elm_Hoversel_Item *)it)->label; +} + +static Eina_Bool +_item_del_pre_hook(Elm_Object_Item *it) +{ + Widget_Data *wd; + Elm_Hoversel_Item *item = (Elm_Hoversel_Item *)it; + wd = elm_widget_data_get(WIDGET(item)); + if (!wd) return EINA_FALSE; + elm_hoversel_hover_end(WIDGET(item)); + wd->items = eina_list_remove(wd->items, item); + eina_stringshare_del(item->label); + eina_stringshare_del(item->icon_file); + eina_stringshare_del(item->icon_group); + + return EINA_TRUE; +} + +EAPI Evas_Object * +elm_hoversel_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "hoversel"); + elm_widget_type_set(obj, "hoversel"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_disable_hook_set(obj, _disable_hook); + elm_widget_activate_hook_set(obj, _activate_hook); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_can_focus_set(obj, EINA_TRUE); + elm_widget_text_set_hook_set(obj, _elm_hoversel_label_set); + elm_widget_text_get_hook_set(obj, _elm_hoversel_label_get); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); + + wd->btn = elm_button_add(parent); + elm_widget_mirrored_automatic_set(wd->btn, EINA_FALSE); + wd->expanded = EINA_FALSE; + elm_widget_resize_object_set(obj, wd->btn); + evas_object_event_callback_add(wd->btn, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + evas_object_smart_callback_add(wd->btn, "clicked", _button_clicked, obj); + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + elm_widget_sub_object_add(obj, wd->btn); + + elm_hoversel_hover_parent_set(obj, parent); + _theme_hook(obj); + + return obj; +} + +EAPI void +elm_hoversel_hover_parent_set(Evas_Object *obj, Evas_Object *parent) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->hover_parent) + evas_object_event_callback_del_full(wd->hover_parent, EVAS_CALLBACK_DEL, + _parent_del, obj); + wd->hover_parent = parent; + if (wd->hover_parent) + evas_object_event_callback_add(wd->hover_parent, EVAS_CALLBACK_DEL, + _parent_del, obj); +} + +EAPI Evas_Object * +elm_hoversel_hover_parent_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->hover_parent; +} + +EAPI void +elm_hoversel_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->horizontal = !!horizontal; +} + +EAPI Eina_Bool +elm_hoversel_horizontal_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->horizontal; +} + +EAPI void +elm_hoversel_hover_begin(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->hover) return; + _activate(obj); +} + +EAPI void +elm_hoversel_hover_end(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (!wd->hover) return; + wd->expanded = EINA_FALSE; + evas_object_del(wd->hover); + wd->hover = NULL; + evas_object_smart_callback_call(obj, SIG_DISMISSED, NULL); +} + +EAPI Eina_Bool +elm_hoversel_expanded_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return (wd->hover) ? EINA_TRUE : EINA_FALSE; +} + +EAPI void +elm_hoversel_clear(Evas_Object *obj) +{ + Elm_Object_Item *it; + Eina_List *l, *ll; + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + EINA_LIST_FOREACH_SAFE(wd->items, l, ll, it) + { + _item_del_pre_hook(it); + elm_widget_item_free(it); + } +} + +EAPI const Eina_List * +elm_hoversel_items_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->items; +} + +EAPI Elm_Object_Item * +elm_hoversel_item_add(Evas_Object *obj, const char *label, const char *icon_file, Elm_Icon_Type icon_type, Evas_Smart_Cb func, const void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + Elm_Hoversel_Item *item = elm_widget_item_new(obj, Elm_Hoversel_Item); + if (!item) return NULL; + elm_widget_item_del_pre_hook_set(item, _item_del_pre_hook); + elm_widget_item_text_get_hook_set(item, _item_text_get_hook); + wd->items = eina_list_append(wd->items, item); + item->label = eina_stringshare_add(label); + item->icon_file = eina_stringshare_add(icon_file); + item->icon_type = icon_type; + item->func = func; + item->base.data = data; + return (Elm_Object_Item *)item; +} + +EAPI void +elm_hoversel_item_icon_set(Elm_Object_Item *it, const char *icon_file, const char *icon_group, Elm_Icon_Type icon_type) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Hoversel_Item *item = (Elm_Hoversel_Item *)it; + eina_stringshare_replace(&item->icon_file, icon_file); + eina_stringshare_replace(&item->icon_group, icon_group); + item->icon_type = icon_type; +} + +EAPI void +elm_hoversel_item_icon_get(const Elm_Object_Item *it, const char **icon_file, const char **icon_group, Elm_Icon_Type *icon_type) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Hoversel_Item *item = (Elm_Hoversel_Item *)it; + if (icon_file) *icon_file = item->icon_file; + if (icon_group) *icon_group = item->icon_group; + if (icon_type) *icon_type = item->icon_type; +} + diff --git a/libraries/elementary/src/lib/elc_hoversel.h b/libraries/elementary/src/lib/elc_hoversel.h new file mode 100644 index 0000000..1f60849 --- /dev/null +++ b/libraries/elementary/src/lib/elc_hoversel.h @@ -0,0 +1,224 @@ +/** + * @defgroup Hoversel Hoversel + * @ingroup Elementary + * + * @image html img/widget/hoversel/preview-00.png + * @image latex img/widget/hoversel/preview-00.eps + * + * A hoversel is a button that pops up a list of items (automatically + * choosing the direction to display) that have a label and, optionally, an + * icon to select from. It is a convenience widget to avoid the need to do + * all the piecing together yourself. It is intended for a small number of + * items in the hoversel menu (no more than 8), though is capable of many + * more. + * + * Signals that you can add callbacks for are: + * "clicked" - the user clicked the hoversel button and popped up the sel + * "selected" - an item in the hoversel list is selected. event_info is the item + * "dismissed" - the hover is dismissed + * + * Default content parts of the hoversel widget that you can use for are: + * @li "icon" - An icon of the hoversel + * + * Default text parts of the hoversel widget that you can use for are: + * @li "default" - Label of the hoversel + * + * Supported elm_object common APIs. + * @li @ref elm_object_disabled_set + * @li @ref elm_object_disabled_get + * @li @ref elm_object_part_text_set + * @li @ref elm_object_part_text_get + * @li @ref elm_object_part_content_set + * @li @ref elm_object_part_content_unset + * + * Supported elm_object_item common APIs. + * @li elm_object_item_part_text_get + * + * See @ref tutorial_hoversel for an example. + * @{ + */ + +/** + * @brief Add a new Hoversel object + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * @ingroup Hoversel + */ +EAPI Evas_Object *elm_hoversel_add(Evas_Object *parent); + +/** + * @brief This sets the hoversel to expand horizontally. + * + * @param obj The hoversel object + * @param horizontal If true, the hover will expand horizontally to the + * right. + * + * @note The initial button will display horizontally regardless of this + * setting. + * + * @ingroup Hoversel + */ +EAPI void elm_hoversel_horizontal_set(Evas_Object *obj, Eina_Bool horizontal); + +/** + * @brief This returns whether the hoversel is set to expand horizontally. + * + * @param obj The hoversel object + * @return If true, the hover will expand horizontally to the right. + * + * @see elm_hoversel_horizontal_set() + * + * @ingroup Hoversel + */ +EAPI Eina_Bool elm_hoversel_horizontal_get(const Evas_Object *obj); + +/** + * @brief Set the Hover parent + * + * @param obj The hoversel object + * @param parent The parent to use + * + * Sets the hover parent object, the area that will be darkened when the + * hoversel is clicked. Should probably be the window that the hoversel is + * in. See @ref Hover objects for more information. + * + * @ingroup Hoversel + */ +EAPI void elm_hoversel_hover_parent_set(Evas_Object *obj, Evas_Object *parent); + +/** + * @brief Get the Hover parent + * + * @param obj The hoversel object + * @return The used parent + * + * Gets the hover parent object. + * + * @see elm_hoversel_hover_parent_set() + * + * @ingroup Hoversel + */ +EAPI Evas_Object *elm_hoversel_hover_parent_get(const Evas_Object *obj); + +/** + * @brief This triggers the hoversel popup from code, the same as if the user + * had clicked the button. + * + * @param obj The hoversel object + * + * @ingroup Hoversel + */ +EAPI void elm_hoversel_hover_begin(Evas_Object *obj); + +/** + * @brief This dismisses the hoversel popup as if the user had clicked + * outside the hover. + * + * @param obj The hoversel object + * + * @ingroup Hoversel + */ +EAPI void elm_hoversel_hover_end(Evas_Object *obj); + +/** + * @brief Returns whether the hoversel is expanded. + * + * @param obj The hoversel object + * @return This will return EINA_TRUE if the hoversel is expanded or + * EINA_FALSE if it is not expanded. + * + * @ingroup Hoversel + */ +EAPI Eina_Bool elm_hoversel_expanded_get(const Evas_Object *obj); + +/** + * @brief This will remove all the children items from the hoversel. + * + * @param obj The hoversel object + * + * @warning Should @b not be called while the hoversel is active; use + * elm_hoversel_expanded_get() to check first. + * + * @see elm_object_item_del() + * + * @ingroup Hoversel + */ +EAPI void elm_hoversel_clear(Evas_Object *obj); + +/** + * @brief Get the list of items within the given hoversel. + * + * @param obj The hoversel object + * @return Returns a list of Elm_Object_Item* + * + * @see elm_hoversel_item_add() + * + * @ingroup Hoversel + */ +EAPI const Eina_List *elm_hoversel_items_get(const Evas_Object *obj); + +/** + * @brief Add an item to the hoversel button + * + * @param obj The hoversel object + * @param label The text label to use for the item (NULL if not desired) + * @param icon_file An image file path on disk to use for the icon or standard + * icon name (NULL if not desired) + * @param icon_type The icon type if relevant + * @param func Convenience function to call when this item is selected + * @param data Data to pass to item-related functions + * @return A handle to the item added. + * + * This adds an item to the hoversel to show when it is clicked. Note: if you + * need to use an icon from an edje file then use + * elm_hoversel_item_icon_set() right after this function, and set + * icon_file to NULL here. + * + * For more information on what @p icon_file and @p icon_type are, see the + * @ref Icon "icon documentation". + * + * @ingroup Hoversel + */ +EAPI Elm_Object_Item *elm_hoversel_item_add(Evas_Object *obj, const char *label, const char *icon_file, Elm_Icon_Type icon_type, Evas_Smart_Cb func, const void *data); + +/** + * @brief This sets the icon for the given hoversel item. + * + * @param it The item to set the icon + * @param icon_file An image file path on disk to use for the icon or standard + * icon name + * @param icon_group The edje group to use if @p icon_file is an edje file. Set this + * to NULL if the icon is not an edje file + * @param icon_type The icon type + * + * The icon can be loaded from the standard set, from an image file, or from + * an edje file. + * + * @see elm_hoversel_item_add() + * + * @ingroup Hoversel + */ +EAPI void elm_hoversel_item_icon_set(Elm_Object_Item *it, const char *icon_file, const char *icon_group, Elm_Icon_Type icon_type); + +/** + * @brief Get the icon object of the hoversel item + * + * @param it The item to get the icon from + * @param icon_file The image file path on disk used for the icon or standard + * icon name + * @param icon_group The edje group used if @p icon_file is an edje file. NULL + * if the icon is not an edje file + * @param icon_type The icon type + * + * @see elm_hoversel_item_icon_set() + * @see elm_hoversel_item_add() + * + * @ingroup Hoversel + */ +EAPI void elm_hoversel_item_icon_get(const Elm_Object_Item *it, const char **icon_file, const char **icon_group, Elm_Icon_Type *icon_type); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elc_multibuttonentry.c b/libraries/elementary/src/lib/elc_multibuttonentry.c new file mode 100644 index 0000000..c9ab83c --- /dev/null +++ b/libraries/elementary/src/lib/elc_multibuttonentry.c @@ -0,0 +1,1742 @@ +#include +#include "elm_priv.h" + +#define MAX_STR 256 +#define MIN_W_ENTRY 10 + +typedef enum _Multibuttonentry_Pos + { + MULTIBUTTONENTRY_POS_START, + MULTIBUTTONENTRY_POS_END, + MULTIBUTTONENTRY_POS_BEFORE, + MULTIBUTTONENTRY_POS_AFTER, + } Multibuttonentry_Pos; + +typedef enum _Multibuttonentry_Button_State + { + MULTIBUTTONENTRY_BUTTON_STATE_DEFAULT, + MULTIBUTTONENTRY_BUTTON_STATE_SELECTED, + } Multibuttonentry_Button_State; + + +typedef enum _MultiButtonEntry_Closed_Button_Type + { + MULTIBUTTONENTRY_CLOSED_IMAGE, + MULTIBUTTONENTRY_CLOSED_LABEL + } MultiButtonEntry_Closed_Button_Type; + +typedef enum _Multibuttonentry_View_State + { + MULTIBUTTONENTRY_VIEW_NONE, + MULTIBUTTONENTRY_VIEW_GUIDETEXT, + MULTIBUTTONENTRY_VIEW_ENTRY, + MULTIBUTTONENTRY_VIEW_SHRINK + } Multibuttonentry_View_State; + +typedef struct _Widget_Data Widget_Data; +typedef struct _Multibuttonentry_Item Elm_Multibuttonentry_Item; + +struct _Multibuttonentry_Item + { + ELM_WIDGET_ITEM; + Evas_Object *button; + Evas_Coord vw, rw; // vw: visual width, real width + Eina_Bool visible: 1; + Evas_Smart_Cb func; + }; + +typedef struct _Elm_Multibuttonentry_Item_Filter + { + Elm_Multibuttonentry_Item_Filter_Cb callback_func; + void *data; + } Elm_Multibuttonentry_Item_Filter; + +struct _Widget_Data + { + Evas_Object *base; + Evas_Object *box; + Evas_Object *entry; + Evas_Object *label; + Evas_Object *guidetext; + Evas_Object *end; // used to represent the total number of invisible buttons + + Evas_Object *rect_for_end; + MultiButtonEntry_Closed_Button_Type end_type; + + Eina_List *items; + Eina_List *filter_list; + Elm_Object_Item *selected_it; /* selected item */ + + const char *labeltxt, *guidetexttxt; + + int n_str; + Multibuttonentry_View_State view_state; + + Evas_Coord w_box, h_box; + int shrink; + Eina_Bool focused: 1; + Eina_Bool last_btn_select: 1; + Elm_Multibuttonentry_Item_Filter_Cb add_callback; + void *add_callback_data; + }; + +static void _del_hook(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); +static void _on_focus_hook(void *data __UNUSED__, Evas_Object *obj); +static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src, Evas_Callback_Type type, void *event_info); +static void _sizing_eval(Evas_Object *obj); +static void _changed_size_hint_cb(void *data, Evas *evas, Evas_Object *obj, void *event); +static void _resize_cb(void *data, Evas *evas, Evas_Object *obj, void *event); +static void _event_init(Evas_Object *obj); +static void _shrink_mode_set(Evas_Object *obj, Eina_Bool shrink); +static void _view_update(Evas_Object *obj); +static void _set_label(Evas_Object *obj, const char *str); +static void _change_current_button_state(Evas_Object *obj, Multibuttonentry_Button_State state); +static void _change_current_button(Evas_Object *obj, Evas_Object *btn); +static void _button_clicked(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _del_button_obj(Evas_Object *obj, Evas_Object *btn); +static void _del_button_item(Elm_Multibuttonentry_Item *item); +static void _select_button(Evas_Object *obj, Evas_Object *btn); +static Elm_Object_Item *_add_button_item(Evas_Object *obj, const char *str, Multibuttonentry_Pos pos, const void *ref, Evas_Smart_Cb func, void *data); +static void _evas_mbe_key_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _entry_changed_cb(void *data, Evas_Object *obj, void *event_info); +static void _entry_key_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _entry_key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _entry_resized_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info); +static void _entry_focus_in_cb(void *data, Evas_Object *obj, void *event_info); +static void _entry_focus_out_cb(void *data, Evas_Object *obj, void *event_info); +static void _entry_clicked_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__); +static void _view_init(Evas_Object *obj); +static void _set_vis_guidetext(Evas_Object *obj); +static void _calculate_box_min_size(Evas_Object *box, Evas_Object_Box_Data *priv); +static Evas_Coord _calculate_item_max_height(Evas_Object *box, Evas_Object_Box_Data *priv, int obj_index); +static void _box_layout_cb(Evas_Object *o, Evas_Object_Box_Data *priv, void *data); +static void _item_text_set_hook(Elm_Object_Item *it, + const char *part, + const char *label); +static const char *_item_text_get_hook(const Elm_Object_Item *it, + const char *part); + +static const char *widtype = NULL; + +//widget signals +static const char SIG_ITEM_SELECTED[] = "item,selected"; +static const char SIG_ITEM_ADDED[] = "item,added"; +static const char SIG_ITEM_DELETED[] = "item,deleted"; +static const char SIG_ITEM_CLICKED[] = "item,clicked"; +static const char SIG_CLICKED[] = "clicked"; +static const char SIG_FOCUSED[] = "focused"; +static const char SIG_UNFOCUSED[] = "unfocused"; +static const char SIG_EXPANDED[] = "expanded"; +static const char SIG_CONTRACTED[] = "contracted"; +static const char SIG_EXPAND_STATE_CHANGED[] = "expand,state,changed"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_ITEM_SELECTED, ""}, + {SIG_ITEM_ADDED, ""}, + {SIG_ITEM_DELETED, ""}, + {SIG_ITEM_CLICKED, ""}, + {SIG_CLICKED, ""}, + {SIG_FOCUSED, ""}, + {SIG_UNFOCUSED, ""}, + {SIG_EXPANDED, ""}, + {SIG_CONTRACTED, ""}, + {SIG_EXPAND_STATE_CHANGED, ""}, + {NULL, NULL} +}; + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + if (wd->items) + { + Elm_Multibuttonentry_Item *item; + EINA_LIST_FREE(wd->items, item) + { + _del_button_obj(obj, item->button); + free(item); + } + wd->items = NULL; + } + wd->selected_it = NULL; + + if (wd->labeltxt) eina_stringshare_del(wd->labeltxt); + if (wd->guidetexttxt) eina_stringshare_del(wd->guidetexttxt); + if (wd->entry) evas_object_del(wd->entry); + if (wd->label) evas_object_del(wd->label); + if (wd->guidetext) evas_object_del(wd->guidetext); + if (wd->end) evas_object_del(wd->end); + if (wd->rect_for_end) evas_object_del(wd->rect_for_end); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Eina_List *l; + Elm_Multibuttonentry_Item *item; + + if (!wd) return; + + _elm_theme_object_set(obj, wd->base, "multibuttonentry", "base", elm_widget_style_get(obj)); + if (wd->box) edje_object_part_swallow(wd->base, "box.swallow", wd->box); + edje_object_scale_set(wd->base, elm_widget_scale_get(obj) * _elm_config->scale); + + EINA_LIST_FOREACH(wd->items, l, item) + { + if (item->button) + _elm_theme_object_set(obj, item->button, "multibuttonentry", "btn", elm_widget_style_get(obj)); + edje_object_scale_set(item->button, elm_widget_scale_get(obj) * _elm_config->scale); + } + + _sizing_eval(obj); +} + +static void +_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + + if (elm_widget_focus_get(obj)) + { + if ((wd->selected_it)) + { + elm_entry_input_panel_show(wd->entry); + } + else if (((!wd->selected_it) || (!eina_list_count(wd->items)))) + { + if (wd->entry) elm_entry_cursor_end_set(wd->entry); + _view_update(obj); + elm_entry_input_panel_show(wd->entry); + } + wd->focused = EINA_TRUE; + evas_object_smart_callback_call(obj, SIG_FOCUSED, NULL); + } + else + { + wd->focused = EINA_FALSE; + _view_update(obj); + + elm_entry_input_panel_hide(wd->entry); + evas_object_smart_callback_call(obj, SIG_UNFOCUSED, NULL); + } +} + +static Eina_Bool +_event_hook(Evas_Object *obj __UNUSED__, Evas_Object *src __UNUSED__, Evas_Callback_Type type __UNUSED__, void *event_info __UNUSED__) +{ + return EINA_TRUE; +} + +static void +_signal_emit_hook(Evas_Object *obj, const char *emission, const char *source) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + edje_object_signal_emit(wd->base, emission, source); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1; + Evas_Coord left, right, top, bottom; + + if (!wd) return; + evas_object_size_hint_min_get(wd->box, &minw, &minh); + edje_object_part_geometry_get(wd->base, "top.left.pad", NULL, NULL, &left, &top); + edje_object_part_geometry_get(wd->base, "bottom.right.pad", NULL, NULL, &right, &bottom); + + minw += (left + right); + minh += (top + bottom); + + evas_object_size_hint_min_set(obj, minw, minh); +} + +static void +_signal_mouse_clicked(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + + if (!wd || !wd->base) return; + wd->focused = EINA_TRUE; + _view_update(data); + + elm_entry_input_panel_show(wd->entry); + + evas_object_smart_callback_call(data, SIG_CLICKED, NULL); +} + +static void +_changed_size_hint_cb(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__) +{ + Evas_Object *eo = (Evas_Object *)data; + Widget_Data *wd = elm_widget_data_get(data); + + if (!wd) return; + _sizing_eval(eo); +} + +static void +_resize_cb(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + Evas_Coord w, h; + + if (!wd) return; + evas_object_geometry_get(wd->box, NULL, NULL, &w, &h); + + if (wd->h_box < h) evas_object_smart_callback_call(data, SIG_EXPANDED, NULL); + else if (wd->h_box > h) + evas_object_smart_callback_call(data, SIG_CONTRACTED, NULL); + + wd->w_box = w; + wd->h_box = h; + + _view_update(data); +} + +static void +_event_init(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd || !wd->base) return; + if (wd->base) + { + edje_object_signal_callback_add(wd->base, "mouse,clicked,1", "*", _signal_mouse_clicked, obj); + evas_object_event_callback_add(wd->base, EVAS_CALLBACK_KEY_UP, _evas_mbe_key_up_cb, obj); + } + + if (wd->box) + { + evas_object_event_callback_add(wd->box, EVAS_CALLBACK_RESIZE, _resize_cb, obj); + evas_object_event_callback_add(wd->box, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hint_cb, obj); + } + + if (wd->entry) + { + evas_object_event_callback_add(wd->entry, EVAS_CALLBACK_KEY_UP, _entry_key_up_cb, obj); + evas_object_event_callback_add(wd->entry, EVAS_CALLBACK_KEY_DOWN, _entry_key_down_cb, obj); + evas_object_event_callback_add(wd->entry, EVAS_CALLBACK_RESIZE, _entry_resized_cb, obj); + evas_object_smart_callback_add(wd->entry, "changed", _entry_changed_cb, obj); + evas_object_smart_callback_add(wd->entry, "focused", _entry_focus_in_cb, obj); + evas_object_smart_callback_add(wd->entry, "unfocused", _entry_focus_out_cb, obj); + evas_object_smart_callback_add(wd->entry, "clicked", _entry_clicked_cb, obj); + } +} + +static void +_set_vis_guidetext(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + elm_box_unpack(wd->box, wd->guidetext); + elm_box_unpack(wd->box, wd->entry); + if (wd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK) return; + + if (!wd->focused) + elm_object_focus_set(wd->entry, EINA_FALSE); + + if (wd && (!eina_list_count(wd->items)) && wd->guidetext + && (!elm_widget_focus_get(obj)) && (!wd->focused) && (!wd->n_str)) + { + evas_object_hide(wd->entry); + elm_box_pack_end(wd->box, wd->guidetext); + evas_object_show(wd->guidetext); + wd->view_state = MULTIBUTTONENTRY_VIEW_GUIDETEXT; + } + else + { + evas_object_hide(wd->guidetext); + elm_box_pack_end(wd->box, wd->entry); + evas_object_show(wd->entry); + if (elm_widget_focus_get(obj) || wd->focused) + if (!wd->selected_it) + elm_object_focus_set(wd->entry, EINA_TRUE); + wd->view_state = MULTIBUTTONENTRY_VIEW_ENTRY; + } +} + +static void +_shrink_mode_set(Evas_Object *obj, Eina_Bool shrink) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Eina_List *l; + Elm_Multibuttonentry_Item *item; + + if (!wd || !wd->box) return; + if (wd->view_state == MULTIBUTTONENTRY_VIEW_ENTRY) + evas_object_hide(wd->entry); + else if (wd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT) + evas_object_hide(wd->guidetext); + else if (wd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK) + { + evas_object_hide(wd->rect_for_end); + evas_object_hide(wd->end); + wd->view_state = MULTIBUTTONENTRY_VIEW_NONE; + } + + if (shrink == EINA_TRUE) + { + Evas_Coord w = 0, w_tmp = 0; + Evas_Coord box_inner_item_width_padding = 0; + + elm_box_padding_get(wd->box, &box_inner_item_width_padding, NULL); + // unpack all items and entry + elm_box_unpack_all(wd->box); + EINA_LIST_FOREACH(wd->items, l, item) + { + if (item) + { + evas_object_hide(item->button); + item->visible = EINA_FALSE; + } + } + // pack buttons only 1line + w = wd->w_box; + + if (wd->label) + { + elm_box_pack_end(wd->box, wd->label); + evas_object_size_hint_min_get(wd->label, &w_tmp, NULL); + w -= w_tmp; + w -= box_inner_item_width_padding; + } + + item = NULL; + int count = eina_list_count(wd->items); + Evas_Coord button_min_width = 0; + /* Evas_Coord button_min_height = 0; */ + if (wd->end_type == MULTIBUTTONENTRY_CLOSED_IMAGE) + { + const char *size_str; + size_str = edje_object_data_get(wd->end, "closed_button_width"); + if (size_str) button_min_width = (Evas_Coord)atoi(size_str); + /* it use for later + size_str = edje_object_data_get(wd->end, "closed_button_height"); + if (size_str) button_min_width = (Evas_Coord)atoi(size_str); + */ + } + + EINA_LIST_FOREACH(wd->items, l, item) + { + if (item) + { + int w_label_count = 0; + char buf[MAX_STR]; + + elm_box_pack_end(wd->box, item->button); + evas_object_show(item->button); + item->visible = EINA_TRUE; + + w -= item->vw; + w -= box_inner_item_width_padding; + count--; + + if (wd->end_type == MULTIBUTTONENTRY_CLOSED_LABEL) + { + if (count > 0) + { + snprintf(buf, sizeof(buf), "... + %d", count); + elm_object_text_set(wd->end, buf); + evas_object_size_hint_min_get(wd->end, &w_label_count, NULL); + } + + if (w < 0 || w < w_label_count) + { + elm_box_unpack(wd->box, item->button); + evas_object_hide(item->button); + item->visible = EINA_FALSE; + + count++; + snprintf(buf, sizeof(buf), "... + %d", count); + elm_object_text_set(wd->end, buf); + evas_object_size_hint_min_get(wd->end, &w_label_count, NULL); + + elm_box_pack_end(wd->box, wd->end); + evas_object_show(wd->end); + + wd->view_state = MULTIBUTTONENTRY_VIEW_SHRINK; + evas_object_smart_callback_call(obj, SIG_EXPAND_STATE_CHANGED, (void *)1); + break; + } + } + else if (wd->end_type == MULTIBUTTONENTRY_CLOSED_IMAGE) + { + if (w < button_min_width) + { + Evas_Coord rectSize; + Evas_Coord closed_height = 0; + const char *height_str = edje_object_data_get(wd->base, "closed_height"); + + if (height_str) closed_height = (Evas_Coord)atoi(height_str); + elm_box_unpack(wd->box, item->button); + evas_object_hide(item->button); + item->visible = EINA_FALSE; + + w += item->vw; + rectSize = w - button_min_width; + if (!wd->rect_for_end) + { + Evas *e = evas_object_evas_get(obj); + wd->rect_for_end = evas_object_rectangle_add(e); + evas_object_color_set(wd->rect_for_end, 0, 0, 0, 0); + } + evas_object_size_hint_min_set(wd->rect_for_end, rectSize, closed_height * _elm_config->scale); + elm_box_pack_end(wd->box, wd->rect_for_end); + evas_object_show(wd->rect_for_end); + + elm_box_pack_end(wd->box, wd->end); + evas_object_show(wd->end); + + wd->view_state = MULTIBUTTONENTRY_VIEW_SHRINK; + evas_object_smart_callback_call(obj, SIG_EXPAND_STATE_CHANGED, (void *)0); + break; + } + } + } + } + } + else + { + // unpack all items and entry + elm_box_unpack_all(wd->box); + EINA_LIST_FOREACH(wd->items, l, item) + { + if (item) + { + evas_object_hide(item->button); + item->visible = EINA_FALSE; + } + } + evas_object_hide(wd->end); + + if (wd->rect_for_end) evas_object_hide(wd->rect_for_end); + + // pack buttons only 1line + + if (wd->label) elm_box_pack_end(wd->box, wd->label); + + // pack remain btns + item = NULL; + EINA_LIST_FOREACH(wd->items, l, item) + { + if (item) + { + elm_box_pack_end(wd->box, item->button); + evas_object_show(item->button); + item->visible = EINA_TRUE; + } + } + + wd->view_state = MULTIBUTTONENTRY_VIEW_NONE; + evas_object_smart_callback_call(obj, SIG_EXPAND_STATE_CHANGED, + (void *)(long)wd->shrink); + } + if (wd->view_state != MULTIBUTTONENTRY_VIEW_SHRINK) + { + _set_vis_guidetext(obj); + } +} + +static void +_view_update(Evas_Object *obj) +{ + Evas_Coord width = 1, height = 1; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd || !wd->box || !wd->entry || !(wd->w_box > 0)) return; + + // update label + if (wd->label) + { + elm_box_unpack(wd->box, wd->label); + elm_box_pack_start(wd->box, wd->label); + evas_object_size_hint_min_get(wd->label, &width, &height); + } + + if (wd->guidetext) + { + Evas_Coord guide_text_width = wd->w_box - width; + evas_object_size_hint_min_set(wd->guidetext, guide_text_width, height); + } + + // update buttons in shrink mode + if (wd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK) + _shrink_mode_set(obj, EINA_TRUE); + + // update guidetext + _set_vis_guidetext(obj); +} + +static void +_set_label(Evas_Object *obj, const char *str) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd || !str) return; + eina_stringshare_replace(&wd->labeltxt, str); + if (wd->label) + { + Evas_Coord width, height, sum_width = 0; + evas_object_size_hint_min_set(wd->label, 0, 0); + evas_object_resize(wd->label, 0, 0); + edje_object_part_text_escaped_set(wd->label, "mbe.label", str); + + if (!strcmp(str, "")) + { + /* FIXME: not work yet */ + edje_object_signal_emit(wd->label, "elm,mbe,clear_text", ""); + edje_object_part_geometry_get(wd->label, "mbe.label", NULL, NULL, &width, &height); + sum_width += width; + } + else + { + edje_object_signal_emit(wd->label, "elm,mbe,set_text", ""); + edje_object_part_geometry_get(wd->label, "mbe.label", NULL, NULL, &width, &height); + + sum_width += width; + + edje_object_part_geometry_get(wd->label, "mbe.label.left.padding", NULL, NULL, &width, NULL); + sum_width += width; + + edje_object_part_geometry_get(wd->label, "mbe.label.right.padding", NULL, NULL, &width, NULL); + sum_width += width; + } + evas_object_size_hint_min_set(wd->label, sum_width, height); + } + evas_object_show(wd->label); + _view_update(obj); +} + +static void +_set_guidetext(Evas_Object *obj, const char *str) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd || !str) return; + + eina_stringshare_replace(&wd->guidetexttxt, str); + if (wd->guidetext == NULL) + wd->guidetext = edje_object_add(evas_object_evas_get(obj)); + + if (wd->guidetext) + { + _elm_theme_object_set(obj, wd->guidetext, "multibuttonentry", + "guidetext", elm_widget_style_get(obj)); + evas_object_size_hint_weight_set(wd->guidetext, 0.0, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(wd->guidetext, EVAS_HINT_FILL, + EVAS_HINT_FILL); + edje_object_part_text_escaped_set(wd->guidetext, "elm.text", str); + _view_update(obj); + } +} + +static void +_change_current_button_state(Evas_Object *obj, Multibuttonentry_Button_State state) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Multibuttonentry_Item *item = NULL; + + if (!wd) return; + item = (Elm_Multibuttonentry_Item *)wd->selected_it; + + if (item && item->button) + { + switch (state) + { + case MULTIBUTTONENTRY_BUTTON_STATE_DEFAULT: + edje_object_signal_emit(item->button, "default", ""); + wd->selected_it = NULL; + break; + case MULTIBUTTONENTRY_BUTTON_STATE_SELECTED: + edje_object_signal_emit(item->button, "focused", ""); + evas_object_smart_callback_call(obj, SIG_ITEM_SELECTED, item); + break; + default: + edje_object_signal_emit(item->button, "default", ""); + wd->selected_it = NULL; + break; + } + } +} + +static void +_change_current_button(Evas_Object *obj, Evas_Object *btn) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Eina_List *l; + Elm_Multibuttonentry_Item *item; + + if (!wd) return; + + // change the state of previous button to "default" + _change_current_button_state(obj, MULTIBUTTONENTRY_BUTTON_STATE_DEFAULT); + + // change the current + EINA_LIST_FOREACH(wd->items, l, item) + { + if (item->button == btn) + { + wd->selected_it = (Elm_Object_Item *)item; + break; + } + } + // change the state of current button to "focused" + _change_current_button_state(obj, MULTIBUTTONENTRY_BUTTON_STATE_SELECTED); +} + +static void +_button_clicked(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + + Elm_Multibuttonentry_Item *item = NULL; + if (!wd || wd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK) return; + + _change_current_button(data, obj); + + if (wd->selected_it) + if ((item = (Elm_Multibuttonentry_Item *)wd->selected_it) != NULL) + { + evas_object_smart_callback_call(data, SIG_ITEM_CLICKED, item); + _select_button(data, item->button); + } +} + +static void +_del_button_obj(Evas_Object *obj, Evas_Object *btn) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd || !btn) return; + if (btn) + evas_object_del(btn); +} + +static void +_del_button_item(Elm_Multibuttonentry_Item *item) +{ + Eina_List *l; + Elm_Multibuttonentry_Item *_item; + if (!item) return; + Widget_Data *wd; + + Evas_Object *obj = WIDGET(item); + wd = elm_widget_data_get(obj); + if (!wd) return; + EINA_LIST_FOREACH(wd->items, l, _item) + { + if (_item == item) + { + wd->items = eina_list_remove(wd->items, _item); + elm_box_unpack(wd->box, _item->button); + + evas_object_smart_callback_call(obj, SIG_ITEM_DELETED, _item); + + _del_button_obj(obj, _item->button); + + if (wd->selected_it == (Elm_Object_Item *)_item) + wd->selected_it = NULL; + break; + } + } + if (wd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK) + _shrink_mode_set(obj, EINA_TRUE); + + if (!eina_list_count(wd->items)) + _set_vis_guidetext(obj); +} + +static void +_select_button(Evas_Object *obj, Evas_Object *btn) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + if (btn) + { + _change_current_button(obj, btn); + if (elm_widget_focus_get(obj)) + { + elm_object_focus_set(wd->entry, EINA_FALSE); + evas_object_focus_set(btn, EINA_TRUE); + } + } + else + { + _change_current_button_state(obj, MULTIBUTTONENTRY_BUTTON_STATE_DEFAULT); + if (elm_widget_focus_get(obj)) + elm_object_focus_set(wd->entry, EINA_TRUE); + } +} + +static void +_resize_button(Evas_Object *btn, Evas_Coord *realw, Evas_Coord *vieww) +{ + Evas_Coord rw, vw; + Evas_Coord w_text, h_btn, padding_outer = 0; + Evas_Coord w_btn = 0, button_max_width = 0; + const char *size_str; + + size_str = edje_object_data_get(btn, "button_max_size"); + if (size_str) button_max_width = (Evas_Coord)atoi(size_str); + + // decide the size of button + edje_object_part_geometry_get(btn, "elm.base", NULL, NULL, NULL, &h_btn); + edje_object_part_geometry_get(btn, "elm.btn.text", NULL, NULL, &w_text, NULL); + edje_object_part_geometry_get(btn, "right.padding", NULL, NULL, &padding_outer, NULL); + w_btn = w_text + (2 * padding_outer); + + rw = w_btn; + + if (button_max_width < w_btn) + vw = button_max_width; + else + vw = w_btn; + + //resize btn + evas_object_resize(btn, vw, h_btn); + evas_object_size_hint_min_set(btn, vw, h_btn); + + if (realw) *realw = rw; + if (vieww) *vieww = vw; +} + +static Eina_Bool +_item_del_pre_hook(Elm_Object_Item *it) +{ + _del_button_item((Elm_Multibuttonentry_Item *)it); + return EINA_TRUE; +} + +static Elm_Object_Item* +_add_button_item(Evas_Object *obj, const char *str, Multibuttonentry_Pos pos, const void *ref, Evas_Smart_Cb func, void *data) +{ + Elm_Multibuttonentry_Item *item; + Elm_Multibuttonentry_Item_Filter *item_filter; + Elm_Multibuttonentry_Item *reference = (Elm_Multibuttonentry_Item *)ref; + Eina_List *l; + Evas_Object *btn; + Evas_Coord width = -1, height = -1; + char *str_utf8 = NULL; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd || !wd->box || !wd->entry) return NULL; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + if (!str) return NULL; + + EINA_LIST_FOREACH(wd->filter_list, l, item_filter) + { + if (!(item_filter->callback_func(obj, str, data, item_filter->data))) + return NULL; + } + // add button + btn = edje_object_add(evas_object_evas_get(obj)); + str_utf8 = elm_entry_markup_to_utf8(str); + + //entry is cleared when text is made to button + elm_object_text_set(wd->entry, ""); + + _elm_theme_object_set(obj, btn, "multibuttonentry", "btn", elm_widget_style_get(obj)); + edje_object_part_text_escaped_set(btn, "elm.btn.text", str_utf8); + edje_object_part_geometry_get(btn, "elm.btn.text", NULL, NULL, &width, &height); + + evas_object_size_hint_min_set(btn, width, height); + + edje_object_signal_callback_add(btn, "mouse,clicked,1", "*", _button_clicked, obj); + evas_object_size_hint_weight_set(btn, 0.0, 0.0); + evas_object_show(btn); + + // append item list + item = elm_widget_item_new(obj, Elm_Multibuttonentry_Item); + if (item) + { + elm_widget_item_del_pre_hook_set(item, _item_del_pre_hook); + elm_widget_item_text_set_hook_set(item, _item_text_set_hook); + elm_widget_item_text_get_hook_set(item, _item_text_get_hook); + elm_widget_item_data_set(item, data); + Evas_Coord rw, vw; + _resize_button(btn, &rw, &vw); + item->button = btn; + item->rw = rw; + item->vw = vw; + item->visible = EINA_TRUE; + + if (func) + { + item->func = func; + } + + switch (pos) + { + case MULTIBUTTONENTRY_POS_START: + wd->items = eina_list_prepend(wd->items, item); + if (wd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK) + { + elm_widget_sub_object_add(obj, btn); + _shrink_mode_set(obj, EINA_TRUE); + } + else + { + if (wd->label) + elm_box_pack_after(wd->box, btn, wd->label); + else + elm_box_pack_start(wd->box, btn); + if (wd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT) + _set_vis_guidetext(obj); + } + break; + case MULTIBUTTONENTRY_POS_END: + wd->items = eina_list_append(wd->items, item); + if (wd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK) + { + elm_widget_sub_object_add(obj, btn); + evas_object_hide(btn); + } + else + { + if (wd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT) + _set_vis_guidetext(obj); + if (wd->entry) + elm_box_pack_before(wd->box, btn, wd->entry); + else + elm_box_pack_end(wd->box, btn); + } + break; + case MULTIBUTTONENTRY_POS_BEFORE: + if (reference) + wd->items = eina_list_prepend_relative(wd->items, item, reference); + else + wd->items = eina_list_append(wd->items, item); + if (wd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK) + { + elm_widget_sub_object_add(obj, btn); + evas_object_hide(btn); + _shrink_mode_set(obj, EINA_TRUE); + } + else + { + if (reference) + elm_box_pack_before(wd->box, btn, reference->button); + else + { + if (wd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT) + _set_vis_guidetext(obj); + if (wd->entry) + elm_box_pack_before(wd->box, btn, wd->entry); + else + elm_box_pack_end(wd->box, btn); + } + } + break; + case MULTIBUTTONENTRY_POS_AFTER: + if (reference) + wd->items = eina_list_append_relative(wd->items, item, reference); + else + wd->items = eina_list_append(wd->items, item); + if (wd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK) + { + elm_widget_sub_object_add(obj, btn); + _shrink_mode_set(obj, EINA_TRUE); + } + else + { + if (reference) + elm_box_pack_after(wd->box, btn, reference->button); + else + { + if (wd->view_state == MULTIBUTTONENTRY_VIEW_GUIDETEXT) + _set_vis_guidetext(obj); + if (wd->entry) + elm_box_pack_before(wd->box, btn, wd->entry); + else + elm_box_pack_end(wd->box, btn); + } + } + break; + default: + break; + } + } + evas_object_smart_callback_call(obj, SIG_ITEM_ADDED, item); + + free(str_utf8); + + return (Elm_Object_Item *)item; +} + +static Elm_Multibuttonentry_Item_Filter* +_filter_new(Elm_Multibuttonentry_Item_Filter_Cb func, void *data) +{ + Elm_Multibuttonentry_Item_Filter *item_filter = ELM_NEW(Elm_Multibuttonentry_Item_Filter); + if (!item_filter) return NULL; + + item_filter->callback_func= func; + item_filter->data = data; + + return item_filter; +} + +static void +_filter_free(Elm_Multibuttonentry_Item_Filter *item_filter) +{ + free(item_filter); +} + +static void +_evas_mbe_key_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(data); + Elm_Multibuttonentry_Item *item = NULL; + + if (!wd || !wd->base || !wd->box) return; + + Evas_Event_Key_Up *ev = (Evas_Event_Key_Up*)event_info; + + if (wd->last_btn_select) + { + if (wd->selected_it && + ((strcmp(ev->keyname, "BackSpace") == 0) || + (strcmp(ev->keyname, "Delete") == 0))) + { + item = (Elm_Multibuttonentry_Item *)wd->selected_it; + if (item) + { + _del_button_item(item); + elm_widget_item_free(item); + elm_object_focus_set(wd->entry, EINA_TRUE); + } + } + else if (((!wd->selected_it && (wd->n_str == 0) && + (strcmp(ev->keyname, "BackSpace") == 0)) || + (strcmp(ev->keyname, "Delete") == 0))) + { + item = eina_list_data_get(eina_list_last(wd->items)); + if (item) + _select_button(data, item->button); + } + } + else + wd->last_btn_select = EINA_TRUE; +} + +static void +_entry_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(data); + Evas_Event_Key_Down *ev = (Evas_Event_Key_Down *)event_info; + + if (!wd) return; + + if ((wd->n_str == 1) && (strcmp(ev->keyname, "BackSpace") == 0 || (strcmp(ev->keyname, "Delete") == 0 ))) + wd->last_btn_select = EINA_FALSE; +} + +static void +_entry_key_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(data); + Evas_Event_Key_Up *ev = (Evas_Event_Key_Up *) event_info; + const char *str; + + if (!wd || !wd->base || !wd->box) return; + + str = elm_object_text_get(wd->entry); + + if ((strcmp(str, "") != 0) && (strcmp(ev->keyname, "KP_Enter") == 0 || strcmp(ev->keyname, "Return") == 0 )) + { + _add_button_item(data, str, MULTIBUTTONENTRY_POS_END, NULL, NULL, NULL); + wd->n_str = 0; + } +} + +static void +_entry_clicked_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + + _change_current_button_state(data, MULTIBUTTONENTRY_BUTTON_STATE_DEFAULT); + elm_object_focus_set(wd->entry, EINA_TRUE); +} + +static void +_entry_focus_in_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + Elm_Multibuttonentry_Item *item = NULL; + + if (!wd) return; + + if (wd->selected_it) + { + item = (Elm_Multibuttonentry_Item *)wd->selected_it; + elm_object_focus_set(wd->entry, EINA_FALSE); + evas_object_focus_set(item->button, EINA_TRUE); + } +} + +static void +_entry_focus_out_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + const char *str; + + if (!wd) return; + + str = elm_object_text_get(wd->entry); + if (strlen(str)) + _add_button_item(data, str, MULTIBUTTONENTRY_POS_END, NULL, NULL, NULL); +} + +static void +_entry_changed_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + const char *str; + + if (!wd) return; + + str = elm_object_text_get(wd->entry); + wd->n_str = strlen(str); +} + +static void +_entry_resized_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Coord en_x, en_y, en_w, en_h; + Evas_Coord bx_x, bx_y; + + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + + evas_object_geometry_get(wd->entry, &en_x, &en_y, &en_w, &en_h); + evas_object_geometry_get(wd->box, &bx_x, &bx_y, NULL, NULL); + + if (wd->focused) + elm_widget_show_region_set(wd->box, en_x - bx_x, en_y - bx_y, en_w, + en_h, EINA_TRUE); +} + +static void +_view_init(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + + if (!wd->box) + { + wd->box = elm_box_add(obj); + if (!wd->box) return; + elm_widget_sub_object_add(obj, wd->box); + elm_box_layout_set(wd->box, _box_layout_cb, NULL, NULL); + elm_box_homogeneous_set(wd->box, EINA_FALSE); + edje_object_part_swallow(wd->base, "box.swallow", wd->box); + } + if (!wd->label) + { + wd->label = edje_object_add(evas_object_evas_get(obj)); + if (!wd->label) return; + _elm_theme_object_set(obj, wd->label, "multibuttonentry", "label", elm_widget_style_get(obj)); + _set_label(obj, ""); + elm_widget_sub_object_add(obj, wd->label); + } + + if (!wd->entry) + { + wd->entry = elm_entry_add(obj); + if (!wd->entry) return; + elm_entry_single_line_set(wd->entry, EINA_TRUE); + elm_object_text_set(wd->entry, ""); + elm_entry_input_panel_enabled_set(wd->entry, EINA_FALSE); + evas_object_size_hint_min_set(wd->entry, MIN_W_ENTRY, 0); + evas_object_size_hint_weight_set(wd->entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(wd->entry, EVAS_HINT_FILL, EVAS_HINT_FILL); + if (wd->box) elm_box_pack_end(wd->box, wd->entry); + evas_object_show(wd->entry); + wd->view_state = MULTIBUTTONENTRY_VIEW_ENTRY; + } + + if (!wd->end) + { + const char *end_type; + + end_type = edje_object_data_get(wd->base, "closed_button_type"); + if (!end_type || !strcmp(end_type, "label")) + { + wd->end = elm_label_add(obj); + if (!wd->end) return; + elm_object_style_set(wd->end, "extended/multibuttonentry_default"); + wd->end_type = MULTIBUTTONENTRY_CLOSED_LABEL; + } + else + { + const char *size_str; + wd->end = edje_object_add(evas_object_evas_get(obj)); + if (!wd->end) return; + _elm_theme_object_set(obj, wd->end, "multibuttonentry", "closedbutton", elm_widget_style_get(obj)); + Evas_Coord button_min_width = 0; + Evas_Coord button_min_height = 0; + + size_str = edje_object_data_get(wd->end, "closed_button_width"); + if (size_str) button_min_width = (Evas_Coord)atoi(size_str); + size_str = edje_object_data_get(wd->end, "closed_button_height"); + if (size_str) button_min_height = (Evas_Coord)atoi(size_str); + + wd->end_type = MULTIBUTTONENTRY_CLOSED_IMAGE; + evas_object_size_hint_min_set(wd->end, + button_min_width * _elm_config->scale, + button_min_height * _elm_config->scale); + elm_widget_sub_object_add(obj, wd->end); + } + } +} + +static void +_calculate_box_min_size(Evas_Object *box, Evas_Object_Box_Data *priv) +{ + Evas_Coord minw, minh, mnw, mnh, ww; + Evas_Coord w, cw = 0, cmaxh = 0; + const Eina_List *l; + Evas_Object_Box_Option *opt; + double wx; + + /* FIXME: need to calc max */ + minw = 0; + minh = 0; + + evas_object_geometry_get(box, NULL, NULL, &w, NULL); + evas_object_size_hint_min_get(box, &minw, NULL); + + EINA_LIST_FOREACH(priv->children, l, opt) + { + evas_object_size_hint_min_get(opt->obj, &mnw, &mnh); + evas_object_size_hint_weight_get(opt->obj, &wx, NULL); + + if (wx) + { + if (mnw != -1 && (w - cw) >= mnw) + ww = w - cw; + else + ww = w; + } + else + ww = mnw; + + if ((cw + mnw) > w) + { + minh += cmaxh; + cw = 0; + cmaxh = 0; + } + cw += ww; + if (cmaxh < mnh) cmaxh = mnh; + } + + minh += cmaxh; + + evas_object_size_hint_min_set(box, minw, minh); +} + +static Evas_Coord +_calculate_item_max_height(Evas_Object *box, Evas_Object_Box_Data *priv, int obj_index) +{ + Evas_Coord mnw, mnh, cw = 0, cmaxh = 0, w, ww; + const Eina_List *l; + Evas_Object_Box_Option *opt; + int local_index = 0; + double wx; + + evas_object_geometry_get(box, NULL, NULL, &w, NULL); + + EINA_LIST_FOREACH(priv->children, l, opt) + { + evas_object_size_hint_min_get(opt->obj, &mnw, &mnh); + evas_object_size_hint_weight_get(opt->obj, &wx, NULL); + + if (wx) + { + if (mnw != -1 && (w - cw) >= mnw) + ww = w - cw; + else + ww = w; + } + else + ww = mnw; + + if ((cw + ww) > w) + { + if (local_index > obj_index) return cmaxh; + cw = 0; + cmaxh = 0; + } + + cw += ww; + if (cmaxh < mnh) cmaxh = mnh; + + local_index++; + } + + return cmaxh; +} + +static void +_box_layout_cb(Evas_Object *o, Evas_Object_Box_Data *priv, void *data __UNUSED__) +{ + Evas_Coord x, y, w, h, xx, yy; + const Eina_List *l; + Evas_Object *obj; + Evas_Coord minw, minh; + double ax, ay; + Evas_Object_Box_Option *opt; + + _calculate_box_min_size(o, priv); + + evas_object_geometry_get(o, &x, &y, &w, &h); + + evas_object_size_hint_min_get(o, &minw, &minh); + evas_object_size_hint_align_get(o, &ax, &ay); + if (w < minw) + { + x = x + ((w - minw) * (1.0 - ax)); + w = minw; + } + if (h < minh) + { + y = y + ((h - minh) * (1.0 - ay)); + h = minh; + } + + xx = x; + yy = y; + + Evas_Coord cw = 0, ch = 0, cmaxh = 0, obj_index = 0; + + EINA_LIST_FOREACH(priv->children, l, opt) + { + Evas_Coord mnw, mnh, mxw, mxh; + double wx, wy; + int fw, fh; + + obj = opt->obj; + evas_object_size_hint_align_get(obj, &ax, &ay); + evas_object_size_hint_weight_get(obj, &wx, &wy); + evas_object_size_hint_min_get(obj, &mnw, &mnh); + evas_object_size_hint_max_get(obj, &mxw, &mxh); + fw = fh = 0; + if (ax == -1.0) {fw = 1; ax = 0.5;} + if (ay == -1.0) {fh = 1; ay = 0.5;} + Evas_Coord ww, hh, ow, oh; + + if (wx) + { + if (mnw != -1 && (w - cw) >= mnw) + ww = w - cw; + else + ww = w; + } + else + ww = mnw; + hh = _calculate_item_max_height(o, priv, obj_index); + + ow = mnw; + if (fw) ow = ww; + if ((mxw >= 0) && (mxw < ow)) ow = mxw; + oh = mnh; + if (fh) oh = hh; + if ((mxh >= 0) && (mxh < oh)) oh = mxh; + + if ((cw + ww) > w) + { + ch += cmaxh; + cw = 0; + cmaxh = 0; + } + + evas_object_move(obj, + xx + cw + (Evas_Coord)(((double)(ww - ow)) * ax), + yy + ch + (Evas_Coord)(((double)(hh - oh)) * ay)); + evas_object_resize(obj, ow, oh); + + cw += ww; + if (cmaxh < hh) cmaxh = hh; + + obj_index++; + } +} + +static void +_item_text_set_hook(Elm_Object_Item *it, const char *part, const char *label) +{ + Elm_Multibuttonentry_Item *item; + if (part && strcmp(part, "default")) return; + if (!label) return; + item = (Elm_Multibuttonentry_Item *)it; + edje_object_part_text_escaped_set(item->button, "elm.btn.text", label); + _resize_button(item->button, &item->rw, &item->vw); +} + +static const char * +_item_text_get_hook(const Elm_Object_Item *it, const char *part) +{ + Elm_Multibuttonentry_Item *item; + if (part && strcmp(part, "default")) return NULL; + item = (Elm_Multibuttonentry_Item *)it; + return edje_object_part_text_get(item->button, "elm.btn.text"); +} + +static void +_text_set_hook(Evas_Object *obj, const char *part, const char *label) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + if (!part || !strcmp(part, "default")) + { + if (label) _set_label(obj, label); + else _set_label(obj, ""); + } + else if (!strcmp(part, "guide")) + { + if (label) _set_guidetext(obj, label); + else _set_guidetext(obj, ""); + } +} + +static const char * +_text_get_hook(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + if (!part || !strcmp(part, "default")) + { + return wd->labeltxt; + } + else if (!strcmp(part, "guide")) + { + return wd->guidetexttxt; + } + return NULL; +} + +EAPI Evas_Object * +elm_multibuttonentry_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "multibuttonentry"); + elm_widget_type_set(obj, "multibuttonentry"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_event_hook_set(obj, _event_hook); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_signal_emit_hook_set(obj, _signal_emit_hook); + elm_widget_text_set_hook_set(obj, _text_set_hook); + elm_widget_text_get_hook_set(obj, _text_get_hook); + + wd->base = edje_object_add(e); + _elm_theme_object_set(obj, wd->base, "multibuttonentry", "base", "default"); + elm_widget_resize_object_set(obj, wd->base); + elm_widget_can_focus_set(obj, EINA_TRUE); + + wd->view_state = MULTIBUTTONENTRY_VIEW_NONE; + wd->focused = EINA_FALSE; + wd->last_btn_select = EINA_TRUE; + wd->n_str = 0; + wd->rect_for_end = NULL; + wd->add_callback = NULL; + wd->add_callback_data = NULL; + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + _view_init(obj); + _event_init(obj); + + return obj; +} + +EAPI Evas_Object * +elm_multibuttonentry_entry_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return NULL; + + return wd->entry; +} + +EAPI Eina_Bool +elm_multibuttonentry_expanded_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) -1; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return -1; + return (wd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK ? EINA_FALSE : EINA_TRUE); +} + +EAPI void +elm_multibuttonentry_expanded_set(Evas_Object *obj, Eina_Bool expanded) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd || !wd->box || + ((wd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK) ? EINA_FALSE : EINA_TRUE) == expanded) return; + + if (expanded) + _shrink_mode_set(obj, EINA_FALSE); + else + _shrink_mode_set(obj, EINA_TRUE); + +} + +EAPI Elm_Object_Item * +elm_multibuttonentry_item_prepend(Evas_Object *obj, const char *label, Evas_Smart_Cb func, void *data) +{ + return _add_button_item(obj, label, MULTIBUTTONENTRY_POS_START, NULL, func, data); +} + +EAPI Elm_Object_Item * +elm_multibuttonentry_item_append(Evas_Object *obj, const char *label, Evas_Smart_Cb func, void *data) +{ + return _add_button_item(obj, label, MULTIBUTTONENTRY_POS_END, NULL, func, data); +} + +EAPI Elm_Object_Item * +elm_multibuttonentry_item_insert_before(Evas_Object *obj, Elm_Object_Item *before, const char *label, Evas_Smart_Cb func, void *data) +{ + return _add_button_item(obj, label, MULTIBUTTONENTRY_POS_BEFORE, before, func, data); +} + +EAPI Elm_Object_Item * +elm_multibuttonentry_item_insert_after(Evas_Object *obj, Elm_Object_Item *after, const char *label, Evas_Smart_Cb func, void *data) +{ + return _add_button_item(obj, label, MULTIBUTTONENTRY_POS_AFTER, after, func, data); +} + +EAPI const Eina_List * +elm_multibuttonentry_items_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->items; +} + +EAPI Elm_Object_Item * +elm_multibuttonentry_first_item_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return eina_list_data_get(wd->items); +} + +EAPI Elm_Object_Item * +elm_multibuttonentry_last_item_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return eina_list_data_get(eina_list_last(wd->items)); +} + +EAPI Elm_Object_Item * +elm_multibuttonentry_selected_item_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->selected_it; +} + +EAPI void +elm_multibuttonentry_item_selected_set(Elm_Object_Item *it, Eina_Bool selected) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Multibuttonentry_Item *item = (Elm_Multibuttonentry_Item *)it; + if (selected) _select_button(WIDGET(item), item->button); + else _select_button(WIDGET(item), NULL); +} + +EAPI Eina_Bool +elm_multibuttonentry_item_selected_get(const Elm_Object_Item *it) +{ + //TODO : To be implemented. + if (!it) return EINA_FALSE; + return EINA_TRUE; +} + +EAPI void +elm_multibuttonentry_clear(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Elm_Multibuttonentry_Item *item; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (wd->items) + { + EINA_LIST_FREE(wd->items, item) + { + elm_box_unpack(wd->box, item->button); + _del_button_obj(obj, item->button); + free(item); + } + wd->items = NULL; + } + wd->selected_it = NULL; + _view_update(obj); +} + +EAPI Elm_Object_Item * +elm_multibuttonentry_item_prev_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + Widget_Data *wd; + Eina_List *l; + Elm_Multibuttonentry_Item *_item; + + wd = elm_widget_data_get(WIDGET(it)); + if (!wd) return NULL; + + EINA_LIST_FOREACH(wd->items, l, _item) + { + if (_item == (Elm_Multibuttonentry_Item *)it) + { + l = eina_list_prev(l); + if (!l) return NULL; + return eina_list_data_get(l); + } + } + return NULL; +} + +EAPI Elm_Object_Item * +elm_multibuttonentry_item_next_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + Widget_Data *wd; + Eina_List *l; + Elm_Multibuttonentry_Item *_item; + wd = elm_widget_data_get(WIDGET(it)); + if (!wd) return NULL; + + EINA_LIST_FOREACH(wd->items, l, _item) + { + if (_item == (Elm_Multibuttonentry_Item *)it) + { + l = eina_list_next(l); + if (!l) return NULL; + return eina_list_data_get(l); + } + } + return NULL; +} + +EINA_DEPRECATED EAPI void * +elm_multibuttonentry_item_data_get(const Elm_Object_Item *it) +{ + return elm_widget_item_data_get(it); +} + +EINA_DEPRECATED EAPI void +elm_multibuttonentry_item_data_set(Elm_Object_Item *it, void *data) +{ + return elm_widget_item_data_set(it, data); +} + +EAPI void +elm_multibuttonentry_item_filter_append(Evas_Object *obj, Elm_Multibuttonentry_Item_Filter_Cb func, void *data) +{ + Elm_Multibuttonentry_Item_Filter *new_item_filter = NULL; + Elm_Multibuttonentry_Item_Filter *_item_filter = NULL; + Eina_List *l; + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + ELM_CHECK_WIDTYPE(obj, widtype); + EINA_SAFETY_ON_NULL_RETURN(func); + + new_item_filter= _filter_new(func, data); + if (!new_item_filter) return; + + EINA_LIST_FOREACH(wd->filter_list, l, _item_filter) + { + if (_item_filter && ((_item_filter->callback_func == func) && (_item_filter->data == data))) + { + printf("Already Registered this item filter!!!!\n"); + return; + } + } + wd->filter_list = eina_list_append(wd->filter_list, new_item_filter); +} + +EAPI void +elm_multibuttonentry_item_filter_prepend(Evas_Object *obj, Elm_Multibuttonentry_Item_Filter_Cb func, void *data) +{ + Elm_Multibuttonentry_Item_Filter *new_item_filter = NULL; + Elm_Multibuttonentry_Item_Filter *_item_filter = NULL; + Eina_List *l; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + ELM_CHECK_WIDTYPE(obj, widtype); + EINA_SAFETY_ON_NULL_RETURN(func); + + new_item_filter = _filter_new(func, data); + if (!new_item_filter) return; + + EINA_LIST_FOREACH(wd->filter_list, l, _item_filter) + { + if (_item_filter && ((_item_filter->callback_func == func) && (_item_filter->data == data))) + { + printf("Already Registered this item filter!!!!\n"); + return; + } + } + wd->filter_list = eina_list_prepend(wd->filter_list, new_item_filter); +} + +EAPI void +elm_multibuttonentry_item_filter_remove(Evas_Object *obj, Elm_Multibuttonentry_Item_Filter_Cb func, void *data) +{ + Widget_Data *wd; + Eina_List *l; + Elm_Multibuttonentry_Item_Filter *item_filter; + + wd = elm_widget_data_get(obj); + + EINA_SAFETY_ON_NULL_RETURN(func); + + EINA_LIST_FOREACH(wd->filter_list, l, item_filter) + { + if ((item_filter->callback_func == func) && ((!data) || (item_filter->data == data))) + { + wd->filter_list = eina_list_remove_list(wd->filter_list, l); + _filter_free(item_filter); + return; + } + } +} diff --git a/libraries/elementary/src/lib/elc_multibuttonentry.h b/libraries/elementary/src/lib/elc_multibuttonentry.h new file mode 100644 index 0000000..af3ce87 --- /dev/null +++ b/libraries/elementary/src/lib/elc_multibuttonentry.h @@ -0,0 +1,318 @@ +/** + * @defgroup Multibuttonentry Multibuttonentry + * @ingroup Elementary + * + * A Multibuttonentry is a widget to allow a user enter text and manage it as a number + * of buttons. Each text button is inserted by pressing the "return" key. + * If there is no space in the current row, a new button is added to the next row. + * When a text button is pressed, it will become focused. + * Backspace removes the focus. + * When the Multibuttonentry loses focus items longer than one line are shrunk + * to one line. + * + * Typical use case of multibuttonentry is, composing emails/messages to a group + * of addresses, each of which is an item that can be clicked for further actions. + * + * Smart callbacks one can register: + * - @c "item,selected" - this is called when an item is selected by api, user + * interaction, and etc. this is also called when a user press back space + * while cursor is on the first field of entry. + * - @c "item,added" - when a new multibuttonentry item is added. + * - @c "item,deleted" - when a multibuttonentry item is deleted. + * - @c "item,clicked" - this is called when an item is clicked by user + * interaction. Both "item,selected" and "item,clicked" are needed. + * - @c "clicked" - when multibuttonentry is clicked. + * - @c "focused" - when multibuttonentry is focused. + * - @c "unfocused" - when multibuttonentry is unfocused. + * - @c "expanded" - when multibuttonentry is expanded. + * - @c "contracted" - when multibuttonentry is contracted. + * - @c "expand,state,changed" - when shrink mode state of multibuttonentry is changed. + * + * Default text parts of the multibuttonentry widget that you can use for are: + * @li "default" - A label of the multibuttonentry + * + * Default text parts of the multibuttonentry items that you can use for are: + * @li "default" - A label of the multibuttonentry item + * + * Supported elm_object common APIs. + * @li @ref elm_object_signal_emit + * @li @ref elm_object_part_text_set + * @li @ref elm_object_part_text_get + * + * Supported elm_object_item common APIs. + * @li @ref elm_object_item_part_text_set + * @li @ref elm_object_item_part_text_get + * + */ + +/** + * @addtogroup Multibuttonentry + * @{ + */ + +/** + * @brief Callback to be invoked when an item is added to the multibuttonentry. + * + * @param obj The parent object + * @param item_label The label corresponding to the added item. + * @param item_data data specific to this item. + * @param data data specific to the multibuttonentry. + * + * @return EINA_TRUE + * EINA_FALSE otherwise. + * + * @ingroup Multibuttonentry + */ +typedef Eina_Bool (*Elm_Multibuttonentry_Item_Filter_Cb)(Evas_Object *obj, const char *item_label, void *item_data, void *data); + +/** + * @brief Add a new multibuttonentry to the parent + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * + * @ingroup Multibuttonentry + */ +EAPI Evas_Object *elm_multibuttonentry_add(Evas_Object *parent); + + +/** + * Get the entry of the multibuttonentry object + * + * @param obj The multibuttonentry object + * @return The entry object, or NULL if none + * + * @ingroup Multibuttonentry + */ +EAPI Evas_Object *elm_multibuttonentry_entry_get(const Evas_Object *obj); + +/** + * Get the value of expanded state. + * In expanded state, the complete entry will be displayed. + * Otherwise, only single line of the entry will be displayed. + * + * @param obj The multibuttonentry object + * @return EINA_TRUE if the widget is in expanded state. EINA_FALSE if not. + * + * @ingroup Multibuttonentry + */ +EAPI Eina_Bool elm_multibuttonentry_expanded_get(const Evas_Object *obj); + +/** + * Set/Unset the multibuttonentry to expanded state. + * In expanded state, the complete entry will be displayed. + * Otherwise, only single line of the entry will be displayed. + * + * @param obj The multibuttonentry object + * @param expanded the value of expanded state. + * Set this to EINA_TRUE for expanded state. + * Set this to EINA_FALSE for single line state. + * + * @ingroup Multibuttonentry + */ +EAPI void elm_multibuttonentry_expanded_set(Evas_Object *obj, Eina_Bool expanded); + +/** + * Prepend a new item to the multibuttonentry + * + * @param obj The multibuttonentry object + * @param label The label of new item + * @param func The callback function to be invoked when this item is pressed. + * @param data The pointer to the data to be attached + * @return A handle to the item added or NULL if not possible + * + * @see Use elm_object_item_del() to delete the item. + * + * @ingroup Multibuttonentry + */ +EAPI Elm_Object_Item *elm_multibuttonentry_item_prepend(Evas_Object *obj, const char *label, Evas_Smart_Cb func, void *data); + +/** + * Append a new item to the multibuttonentry + * + * @param obj The multibuttonentry object + * @param label The label of new item + * @param func The callback function to be invoked when this item is pressed. + * @param data The pointer to the data to be attached + * @return A handle to the item added or NULL if not possible + * + * @see Use elm_object_item_del() to delete the item. + * + * @ingroup Multibuttonentry + */ +EAPI Elm_Object_Item *elm_multibuttonentry_item_append(Evas_Object *obj, const char *label, Evas_Smart_Cb func, void *data); + +/** + * Add a new item to the multibuttonentry before the indicated object + * + * reference. + * @param obj The multibuttonentry object + * @param before The item before which to add it + * @param label The label of new item + * @param func The callback function to be invoked when this item is pressed. + * @param data The pointer to the data to be attached + * @return A handle to the item added or NULL if not possible + * + * @see Use elm_object_item_del() to delete the item. + * + * @ingroup Multibuttonentry + */ +EAPI Elm_Object_Item *elm_multibuttonentry_item_insert_before(Evas_Object *obj, Elm_Object_Item *before, const char *label, Evas_Smart_Cb func, void *data); + +/** + * Add a new item to the multibuttonentry after the indicated object + * + * @param obj The multibuttonentry object + * @param after The item after which to add it + * @param label The label of new item + * @param func The callback function to be invoked when this item is pressed. + * @param data The pointer to the data to be attached + * @return A handle to the item added or NULL if not possible + * + * @see Use elm_object_item_del() to delete the item. + * + * @ingroup Multibuttonentry + */ +EAPI Elm_Object_Item *elm_multibuttonentry_item_insert_after(Evas_Object *obj, Elm_Object_Item *after, const char *label, Evas_Smart_Cb func, void *data); + +/** + * Get a list of items in the multibuttonentry + * + * @param obj The multibuttonentry object + * @return The list of items, or NULL if none + * + * @ingroup Multibuttonentry + */ +EAPI const Eina_List *elm_multibuttonentry_items_get(const Evas_Object *obj); + +/** + * Get the first item in the multibuttonentry + * + * @param obj The multibuttonentry object + * @return The first item, or NULL if none + * + * @ingroup Multibuttonentry + */ +EAPI Elm_Object_Item *elm_multibuttonentry_first_item_get(const Evas_Object *obj); + +/** + * Get the last item in the multibuttonentry + * + * @param obj The multibuttonentry object + * @return The last item, or NULL if none + * + * @ingroup Multibuttonentry + */ +EAPI Elm_Object_Item *elm_multibuttonentry_last_item_get(const Evas_Object *obj); + +/** + * Get the selected item in the multibuttonentry + * + * @param obj The multibuttonentry object + * @return The selected item, or NULL if none + * + * @ingroup Multibuttonentry + */ +EAPI Elm_Object_Item *elm_multibuttonentry_selected_item_get(const Evas_Object *obj); + +/** + * Set the selected state of an item + * + * @param it The item + * @param selected if it's EINA_TRUE, select the item otherwise, unselect the item + * + * @ingroup Multibuttonentry + */ +EAPI void elm_multibuttonentry_item_selected_set(Elm_Object_Item *it, Eina_Bool selected); + + +/** + * Get the selected state of an item + * + * @param it The item + * @return EINA_TRUE if the item is selected, EINA_FALSE otherwise. + * + * @ingroup Multibuttonentry + */ +EAPI Eina_Bool elm_multibuttonentry_item_selected_get(const Elm_Object_Item *it); + +/** + * Remove all items in the multibuttonentry. + * + * @param obj The multibuttonentry object + * + * @ingroup Multibuttonentry + */ +EAPI void elm_multibuttonentry_clear(Evas_Object *obj); + +/** + * Get the previous item in the multibuttonentry + * + * @param it The item + * @return The item before the item @p it + * + * @ingroup Multibuttonentry + */ +EAPI Elm_Object_Item *elm_multibuttonentry_item_prev_get(const Elm_Object_Item *it); + +/** + * Get the next item in the multibuttonentry + * + * @param it The item + * @return The item after the item @p it + * + * @ingroup Multibuttonentry + */ +EAPI Elm_Object_Item *elm_multibuttonentry_item_next_get(const Elm_Object_Item *it); + +/** + * Append an item filter function for text inserted in the Multibuttonentry + * + * Append the given callback to the list. This functions will be called + * whenever any text is inserted into the Multibuttonentry, with the text to be inserted + * as a parameter. The callback function is free to alter the text in any way + * it wants, but it must remember to free the given pointer and update it. + * If the new text is to be discarded, the function can free it and set it text + * parameter to NULL. This will also prevent any following filters from being + * called. + * + * @param obj The multibuttonentry object + * @param func The function to use as item filter + * @param data User data to pass to @p func + * + * @ingroup Multibuttonentry + */ +EAPI void elm_multibuttonentry_item_filter_append(Evas_Object *obj, Elm_Multibuttonentry_Item_Filter_Cb func, void *data); + +/** + * Prepend a filter function for text inserted in the Multibuttonentry + * + * Prepend the given callback to the list. See elm_multibuttonentry_item_filter_append() + * for more information + * + * @param obj The multibuttonentry object + * @param func The function to use as text filter + * @param data User data to pass to @p func + * + * @ingroup Multibuttonentry + */ +EAPI void elm_multibuttonentry_item_filter_prepend(Evas_Object *obj, Elm_Multibuttonentry_Item_Filter_Cb func, void *data); + +/** + * Remove a filter from the list + * + * Removes the given callback from the filter list. See elm_multibuttonentry_item_filter_append() + * for more information. + * + * @param obj The multibuttonentry object + * @param func The filter function to remove + * @param data The user data passed when adding the function + * + * @ingroup Multibuttonentry + */ +EAPI void elm_multibuttonentry_item_filter_remove(Evas_Object *obj, Elm_Multibuttonentry_Item_Filter_Cb func, void *data); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elc_naviframe.c b/libraries/elementary/src/lib/elc_naviframe.c new file mode 100644 index 0000000..49e838e --- /dev/null +++ b/libraries/elementary/src/lib/elc_naviframe.c @@ -0,0 +1,1530 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; +typedef struct _Elm_Naviframe_Item Elm_Naviframe_Item; +typedef struct _Elm_Naviframe_Content_Item_Pair Elm_Naviframe_Content_Item_Pair; +typedef struct _Elm_Naviframe_Text_Item_Pair Elm_Naviframe_Text_Item_Pair; + +struct _Widget_Data +{ + Eina_Inlist *stack; + Evas_Object *base; + Eina_Bool preserve: 1; + Eina_Bool auto_pushed: 1; + Eina_Bool freeze_events: 1; +}; + +struct _Elm_Naviframe_Content_Item_Pair +{ + EINA_INLIST; + const char *part; + Elm_Naviframe_Item *it; +}; + +struct _Elm_Naviframe_Text_Item_Pair +{ + EINA_INLIST; + const char *part; +}; + +struct _Elm_Naviframe_Item +{ + ELM_WIDGET_ITEM; + EINA_INLIST; + Eina_Inlist *content_list; + Eina_Inlist *text_list; + Evas_Object *content; + Evas_Object *title_prev_btn; + Evas_Object *title_next_btn; + Evas_Object *title_icon; + const char *style; + Evas_Coord minw; + Evas_Coord minh; + Eina_Bool back_btn: 1; + Eina_Bool title_visible: 1; + Eina_Bool content_unfocusable : 1; +}; + +static const char *widtype = NULL; + +//widget signals +static const char SIG_TRANSITION_FINISHED[] = "transition,finished"; +static const char SIG_TITLE_CLICKED[] = "title,clicked"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_TRANSITION_FINISHED, ""}, + {SIG_TITLE_CLICKED, ""}, + {NULL, NULL} +}; + +static void _text_set_hook(Evas_Object *obj, + const char *part, + const char *label); +static const char *_text_get_hook(const Evas_Object *obj, const char *part); +static void _content_set_hook(Evas_Object *obj, + const char *part, + Evas_Object *content); +static Evas_Object *_content_get_hook(const Evas_Object *obj, const char *part); +static Evas_Object *_content_unset_hook(Evas_Object *obj, const char *part); +static void _del_hook(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); +static void _emit_hook(Evas_Object *obj, + const char *emission, + const char *source); +static void _disable_hook(Evas_Object *obj); +static void _item_text_set_hook(Elm_Object_Item *it, + const char *part, + const char *label); +static const char *_item_text_get_hook(const Elm_Object_Item *it, + const char *part); +static void _item_content_set_hook(Elm_Object_Item *it, + const char *part, + Evas_Object *content); +static Evas_Object *_item_content_get_hook(const Elm_Object_Item *it, + const char *part); +static Evas_Object *_item_content_unset_hook(Elm_Object_Item *it, + const char *part); +static void _item_signal_emit_hook(Elm_Object_Item *it, + const char *emission, + const char *source); +static void _item_title_visible_update(Elm_Naviframe_Item *navi_it); +static void _sizing_eval(Evas_Object *obj); +static void _move(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _resize(void *data, + Evas *e, + Evas_Object *obj, + void *event_info); +static void _title_clicked(void *data, Evas_Object *obj, + const char *emission, + const char *source); +static void _back_btn_clicked(void *data, + Evas_Object *obj, + void *event_info); +static Evas_Object *_back_btn_new(Evas_Object *obj); +static void _item_content_del(void *data, + Evas *e, + Evas_Object *obj, + void *event_info); +static void _title_content_del(void *data, + Evas *e, + Evas_Object *obj, + void *event_info); +static void _title_prev_btn_del(void *data, + Evas *e, + Evas_Object *obj, + void *event_info); +static void _title_next_btn_del(void *data, + Evas *e, + Evas_Object *obj, + void *event_info); +static void _title_icon_del(void *data, + Evas *e, + Evas_Object *obj, + void *event_info); +static void _title_content_set(Elm_Naviframe_Item *it, + const char *part, + Evas_Object *content); +static void _title_prev_btn_set(Elm_Naviframe_Item *it, + Evas_Object *btn, + Eina_Bool back_btn); +static void _title_next_btn_set(Elm_Naviframe_Item *it, Evas_Object *btn); +static void _title_icon_set(Elm_Naviframe_Item *it, Evas_Object *icon); +static Evas_Object * _item_content_unset(Elm_Naviframe_Item *it); +static Evas_Object * _title_prev_btn_unset(Elm_Naviframe_Item *it); +static Evas_Object * _title_next_btn_unset(Elm_Naviframe_Item *it); +static Evas_Object * _title_icon_unset(Elm_Naviframe_Item *it); +static Evas_Object * _title_content_unset(Elm_Naviframe_Item *it, + const char *part); +static void _item_del(Elm_Naviframe_Item *it); +static Eina_Bool _item_del_pre_hook(Elm_Object_Item *it); +static void _pushed_finished(void *data, + Evas_Object *obj, + const char *emission, + const char *source); +static void _popped_finished(void *data, + Evas_Object *obj, + const char *emission, + const char *source); +static void _show_finished(void *data, + Evas_Object *obj, + const char *emission, + const char *source); +static void _changed_size_hints(void *data, + Evas *e, + Evas_Object *obj, + void *event_info); +static void _item_content_set(Elm_Naviframe_Item *navi_it, + Evas_Object *content); +static void _item_style_set(Elm_Naviframe_Item *navi_it, + const char *item_style); +static Elm_Naviframe_Item * _item_new(Evas_Object *obj, + const char *title_label, + Evas_Object *prev_btn, + Evas_Object *next_btn, + Evas_Object *content, + const char *item_style); +static Eina_Bool _focus_next_hook(const Evas_Object *obj, + Elm_Focus_Direction dir, + Evas_Object **next); + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd; + Elm_Naviframe_Item *it; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + if (wd->stack) + { + while (wd->stack->last) + { + it = EINA_INLIST_CONTAINER_GET(wd->stack->last, + Elm_Naviframe_Item); + wd->stack = eina_inlist_remove(wd->stack, wd->stack->last); + _item_del(it); + elm_widget_item_free(it); + if (!wd->stack) break; + } + } + free(wd); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd; + Elm_Naviframe_Item *it; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + _elm_theme_object_set(obj, + wd->base, + "naviframe", + "base", + elm_widget_style_get(obj)); + + EINA_INLIST_FOREACH(wd->stack, it) + { + _item_style_set(it, it->style); + _item_title_visible_update(it); + } +} + +static void _emit_hook(Evas_Object *obj, + const char *emission, + const char *source) +{ + Elm_Object_Item *it = elm_naviframe_top_item_get(obj); + if (!it) return; + return elm_object_item_signal_emit(it, emission, source); +} + +static void +_disable_hook(Evas_Object *obj __UNUSED__) +{ + //FIXME: +} + +static void +_item_text_set_hook(Elm_Object_Item *it, + const char *part, + const char *label) +{ + Elm_Naviframe_Text_Item_Pair *pair = NULL; + Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *)it; + char buf[1024]; + + if (!part || !strcmp(part, "default")) + snprintf(buf, sizeof(buf), "elm.text.title"); + else if (!strcmp("subtitle", part)) + snprintf(buf, sizeof(buf), "elm.text.subtitle"); + else + snprintf(buf, sizeof(buf), "%s", part); + + EINA_INLIST_FOREACH(navi_it->text_list, pair) + if (!strcmp(buf, pair->part)) break; + + if (!pair) + { + pair = ELM_NEW(Elm_Naviframe_Text_Item_Pair); + if (!pair) + { + ERR("Failed to allocate new text part of the item! : naviframe=%p", + WIDGET(navi_it)); + return; + } + eina_stringshare_replace(&pair->part, buf); + navi_it->text_list = eina_inlist_append(navi_it->text_list, + EINA_INLIST_GET(pair)); + } + elm_object_part_text_set(VIEW(navi_it), buf, label); + + if (label) + { + snprintf(buf, sizeof(buf), "elm,state,%s,show", buf); + elm_object_signal_emit(VIEW(navi_it), buf, "elm"); + } + else + { + snprintf(buf, sizeof(buf), "elm,state,%s,hide", buf); + elm_object_signal_emit(VIEW(navi_it), buf, "elm"); + } + + _sizing_eval(WIDGET(navi_it)); +} + +static const char * +_item_text_get_hook(const Elm_Object_Item *it, const char *part) +{ + char buf[1024]; + + if (!part || !strcmp(part, "default")) + snprintf(buf, sizeof(buf), "elm.text.title"); + else if (!strcmp("subtitle", part)) + snprintf(buf, sizeof(buf), "elm.text.subtitle"); + else + snprintf(buf, sizeof(buf), "%s", part); + + return elm_object_part_text_get(VIEW(it), buf); +} + +static void +_item_content_set_hook(Elm_Object_Item *it, + const char *part, + Evas_Object *content) +{ + Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *)it; + + //specified parts + if (!part || !strcmp("default", part)) + { + _item_content_set(navi_it, content); + return; + } + else if (!strcmp(part, "prev_btn")) + { + _title_prev_btn_set(navi_it, content, EINA_FALSE); + return; + } + else if (!strcmp(part, "next_btn")) + { + _title_next_btn_set(navi_it, content); + return; + } + else if (!strcmp(part, "icon")) + { + _title_icon_set(navi_it, content); + return; + } + + //common part + _title_content_set(navi_it, part, content); +} + +static Evas_Object * +_item_content_get_hook(const Elm_Object_Item *it, const char *part) +{ + Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *)it; + + //specified parts + if (!part || !strcmp("default", part)) + return navi_it->content; + else if (!strcmp(part, "prev_btn")) + return navi_it->title_prev_btn; + else if (!strcmp(part, "next_btn")) + return navi_it->title_next_btn; + else if (!strcmp(part, "icon")) + return navi_it->title_icon; + + //common parts + return elm_object_part_content_get(VIEW(navi_it), part); +} + +static Evas_Object * +_item_content_unset_hook(Elm_Object_Item *it, const char *part) +{ + Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *)it; + + //specified parts + if (!part || !strcmp("default", part)) + return _item_content_unset(navi_it); + else if (!strcmp(part, "prev_btn")) + return _title_prev_btn_unset(navi_it); + else if (!strcmp(part, "next_btn")) + return _title_next_btn_unset(navi_it); + else if (!strcmp(part, "icon")) + return _title_icon_unset(navi_it); + + return _title_content_unset(navi_it, part); +} + +static void +_item_signal_emit_hook(Elm_Object_Item *it, + const char *emission, + const char *source) +{ + elm_object_signal_emit(VIEW(it), emission, source); +} + +static void +_item_title_visible_update(Elm_Naviframe_Item *navi_it) +{ + if (navi_it->title_visible) + elm_object_signal_emit(VIEW(navi_it), "elm,state,title,show", "elm"); + else + elm_object_signal_emit(VIEW(navi_it), "elm,state,title,hide", "elm"); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd; + Elm_Naviframe_Item *it; + Evas_Coord x, y, w, h; + Evas_Coord minw = -1, minh = -1; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + evas_object_geometry_get(obj, &x, &y, &w, &h); + + EINA_INLIST_FOREACH(wd->stack, it) + { + evas_object_move(VIEW(it), x, y); + evas_object_resize(VIEW(it), w, h); + edje_object_size_min_calc(elm_layout_edje_get(VIEW(it)), + &it->minw, + &it->minh); + if (it->minw > minw) minw = it->minw; + if (it->minh > minh) minh = it->minh; + } + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, -1, -1); +} + +static void +_move(void *data __UNUSED__, + Evas *e __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + _sizing_eval(obj); +} + +static void +_resize(void *data __UNUSED__, + Evas *e __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + _sizing_eval(obj); +} + +static void +_title_clicked(void *data, + Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, + const char *source __UNUSED__) +{ + Elm_Naviframe_Item *it = data; + evas_object_smart_callback_call(WIDGET(it), SIG_TITLE_CLICKED, it); +} + +static void +_back_btn_clicked(void *data, + Evas_Object *obj, + void *event_info __UNUSED__) +{ +/* Since edje has the event queue, clicked event could be happend multiple times + on some heavy environment. This callback del will prevent those scenario and + guarantee only one clicked for it's own page. */ + evas_object_smart_callback_del(obj, "clicked", _back_btn_clicked); + elm_naviframe_item_pop(data); +} + +static Evas_Object * +_back_btn_new(Evas_Object *obj) +{ + Evas_Object *btn; + char buf[1024]; + btn = elm_button_add(obj); + if (!btn) return NULL; + evas_object_smart_callback_add(btn, "clicked", _back_btn_clicked, obj); + snprintf(buf, sizeof(buf), "naviframe/back_btn/%s", + elm_widget_style_get(obj)); + elm_object_style_set(btn, buf); + return btn; +} + +static void _text_set_hook(Evas_Object *obj, + const char *part, + const char *label) +{ + Elm_Object_Item *it = elm_naviframe_top_item_get(obj); + if (!it) return; + elm_object_item_part_text_set(it, part, label); +} + +static const char *_text_get_hook(const Evas_Object *obj, const char *part) +{ + Elm_Object_Item *it = elm_naviframe_top_item_get(obj); + if (!it) return NULL; + return elm_object_item_part_text_get(it, part); +} + +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + Elm_Object_Item *it = elm_naviframe_top_item_get(obj); + if (!it) return; + elm_object_item_part_content_set(it, part, content); +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + Elm_Object_Item *it = elm_naviframe_top_item_get(obj); + if (!it) return NULL; + return elm_object_item_part_content_unset(it, part); +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + Elm_Object_Item *it = elm_naviframe_top_item_get(obj); + if (!it) return NULL; + return elm_object_item_part_content_get(it, part); +} + +static void +_title_content_del(void *data, + Evas *e __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + char buf[1024]; + Elm_Naviframe_Content_Item_Pair *pair = data; + Elm_Naviframe_Item *it = pair->it; + snprintf(buf, sizeof(buf), "elm,state,%s,hide", pair->part); + elm_object_signal_emit(VIEW(it), buf, "elm"); + it->content_list = eina_inlist_remove(it->content_list, + EINA_INLIST_GET(pair)); + eina_stringshare_del(pair->part); + free(pair); +} + +static void +_title_prev_btn_del(void *data, + Evas *e __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Elm_Naviframe_Item *it = data; + it->back_btn = EINA_FALSE; + it->title_prev_btn = NULL; + elm_object_signal_emit(VIEW(it), "elm,state,prev_btn,hide", "elm"); +} + +static void +_title_next_btn_del(void *data, + Evas *e __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Elm_Naviframe_Item *it = data; + it->title_next_btn = NULL; + elm_object_signal_emit(VIEW(it), "elm,state,next_btn,hide", "elm"); +} + +static void +_title_icon_del(void *data, + Evas *e __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Elm_Naviframe_Item *it = data; + it->title_icon = NULL; + elm_object_signal_emit(VIEW(it), "elm,state,icon,hide", "elm"); +} + +static void +_item_content_del(void *data, + Evas *e __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Elm_Naviframe_Item *it = data; + it->content = NULL; + elm_object_signal_emit(VIEW(it), "elm,state,content,hide", "elm"); +} + +static void +_title_content_set(Elm_Naviframe_Item *it, + const char *part, + Evas_Object *content) +{ + char buf[1024]; + Elm_Naviframe_Content_Item_Pair *pair = NULL; + Evas_Object *prev_content = NULL; + + EINA_INLIST_FOREACH(it->content_list, pair) + if (!strcmp(part, pair->part)) break; + + if (pair) + { + prev_content = elm_object_part_content_get(VIEW(it), part); + if (prev_content != content) + { + if (content) + { + evas_object_event_callback_del(prev_content, + EVAS_CALLBACK_DEL, + _title_content_del); + snprintf(buf, sizeof(buf), "elm,state,%s,hide", part); + elm_object_signal_emit(VIEW(it), buf, "elm"); + } + evas_object_del(prev_content); + if (!content) return; + } + } + else + { + if (!content) return; + pair = ELM_NEW(Elm_Naviframe_Content_Item_Pair); + if (!pair) + { + ERR("Failed to allocate new content part of the item! : naviframe=%p", WIDGET(it)); + return; + } + pair->it = it; + eina_stringshare_replace(&pair->part, part); + it->content_list = eina_inlist_append(it->content_list, + EINA_INLIST_GET(pair)); + } + if (prev_content != content) + { + evas_object_event_callback_add(content, + EVAS_CALLBACK_DEL, + _title_content_del, + pair); + } + elm_object_part_content_set(VIEW(it), part, content); + snprintf(buf, sizeof(buf), "elm,state,%s,show", part); + elm_object_signal_emit(VIEW(it), buf, "elm"); + + _sizing_eval(WIDGET(it)); +} + +static void +_title_prev_btn_set(Elm_Naviframe_Item *it, + Evas_Object *btn, + Eina_Bool back_btn) +{ + if (it->title_prev_btn == btn) return; + if (it->title_prev_btn) evas_object_del(it->title_prev_btn); + it->title_prev_btn = btn; + if (!btn) return; + + evas_object_event_callback_add(btn, + EVAS_CALLBACK_DEL, + _title_prev_btn_del, + it); + elm_object_part_content_set(VIEW(it), "elm.swallow.prev_btn", btn); + elm_object_signal_emit(VIEW(it), "elm,state,prev_btn,show", "elm"); + it->back_btn = back_btn; + + _sizing_eval(WIDGET(it)); +} + +static void +_title_next_btn_set(Elm_Naviframe_Item *it, Evas_Object *btn) +{ + if (it->title_next_btn == btn) return; + if (it->title_next_btn) evas_object_del(it->title_next_btn); + it->title_next_btn = btn; + if (!btn) return; + + evas_object_event_callback_add(btn, + EVAS_CALLBACK_DEL, + _title_next_btn_del, + it); + elm_object_part_content_set(VIEW(it), "elm.swallow.next_btn", btn); + elm_object_signal_emit(VIEW(it), "elm,state,next_btn,show", "elm"); + + _sizing_eval(WIDGET(it)); +} + +static void +_title_icon_set(Elm_Naviframe_Item *it, Evas_Object *icon) +{ + if (it->title_icon == icon) return; + if (it->title_icon) evas_object_del(it->title_icon); + it->title_icon = icon; + if (!icon) return; + + evas_object_event_callback_add(icon, + EVAS_CALLBACK_DEL, + _title_icon_del, + it); + elm_object_part_content_set(VIEW(it), "elm.swallow.icon", icon); + elm_object_signal_emit(VIEW(it), "elm,state,icon,show", "elm"); + + _sizing_eval(WIDGET(it)); +} + +static Evas_Object * +_item_content_unset(Elm_Naviframe_Item *it) +{ + Evas_Object *content = it->content; + if (!content) return NULL; + + elm_object_part_content_unset(VIEW(it), "elm.swallow.content"); + elm_object_signal_emit(VIEW(it), "elm,state,content,hide", "elm"); + evas_object_event_callback_del(content, + EVAS_CALLBACK_DEL, + _item_content_del); + _sizing_eval(WIDGET(it)); + + it->content = NULL; + return content; +} + +static Evas_Object * +_title_prev_btn_unset(Elm_Naviframe_Item *it) +{ + Evas_Object *content = it->title_prev_btn; + if (!content) return NULL; + + elm_object_part_content_unset(VIEW(it), "elm.swallow.prev_btn"); + elm_object_signal_emit(VIEW(it), "elm,state,prev_btn,hide", "elm"); + evas_object_event_callback_del(content, + EVAS_CALLBACK_DEL, + _title_prev_btn_del); + _sizing_eval(WIDGET(it)); + + it->title_prev_btn = NULL; + return content; +} + +static Evas_Object * +_title_next_btn_unset(Elm_Naviframe_Item *it) +{ + Evas_Object *content = it->title_next_btn; + if (!content) return NULL; + + elm_object_part_content_unset(VIEW(it), "elm.swallow.next_btn"); + elm_object_signal_emit(VIEW(it), "elm,state,next_btn,hide", "elm"); + evas_object_event_callback_del(content, + EVAS_CALLBACK_DEL, + _title_next_btn_del); + _sizing_eval(WIDGET(it)); + + it->title_next_btn = NULL; + return content; +} + +static Evas_Object * +_title_icon_unset(Elm_Naviframe_Item *it) +{ + Evas_Object *content = it->title_icon; + if (!content) return NULL; + + elm_object_part_content_unset(VIEW(it), "elm.swallow.icon"); + elm_object_signal_emit(VIEW(it), "elm,state,icon,hide", "elm"); + evas_object_event_callback_del(content, + EVAS_CALLBACK_DEL, + _title_icon_del); + _sizing_eval(WIDGET(it)); + it->title_icon = NULL; + + return content; +} + +static Evas_Object * +_title_content_unset(Elm_Naviframe_Item *it, const char *part) +{ + Elm_Naviframe_Content_Item_Pair *pair = NULL; + char buf[1028]; + Evas_Object *content = NULL; + + EINA_INLIST_FOREACH(it->content_list, pair) + { + if (!strcmp(part, pair->part)) + { + content = elm_object_part_content_get(VIEW(it), part); + eina_stringshare_del(pair->part); + it->content_list = eina_inlist_remove(it->content_list, + EINA_INLIST_GET(pair)); + free(pair); + break; + } + } + + if (!content) return NULL; + + elm_object_part_content_unset(VIEW(it), part); + snprintf(buf, sizeof(buf), "elm,state,%s,hide", part); + elm_object_signal_emit(VIEW(it), buf, "elm"); + evas_object_event_callback_del(content, + EVAS_CALLBACK_DEL, + _title_content_del); + _sizing_eval(WIDGET(it)); + + return content; +} + +static void +_item_del(Elm_Naviframe_Item *it) +{ + Widget_Data *wd; + Elm_Naviframe_Content_Item_Pair *content_pair; + Elm_Naviframe_Text_Item_Pair *text_pair; + Evas_Object *content; + + if (!it) return; + + wd = elm_widget_data_get(WIDGET(it)); + if (!wd) return; + + while (it->content_list) + { + content_pair = + EINA_INLIST_CONTAINER_GET(it->content_list, + Elm_Naviframe_Content_Item_Pair); + content = elm_object_part_content_get(VIEW(it), content_pair->part); + evas_object_event_callback_del(content, + EVAS_CALLBACK_DEL, + _title_content_del); + eina_stringshare_del(content_pair->part); + it->content_list = eina_inlist_remove(it->content_list, + it->content_list); + free(content_pair); + } + + while (it->text_list) + { + text_pair = EINA_INLIST_CONTAINER_GET(it->text_list, + Elm_Naviframe_Text_Item_Pair); + eina_stringshare_del(text_pair->part); + it->text_list = eina_inlist_remove(it->text_list, + it->text_list); + free(text_pair); + } + + eina_stringshare_del(it->style); + + if (wd->preserve && it->content) + { + elm_object_part_content_unset(VIEW(it), "elm.swallow.content"); + evas_object_event_callback_del(it->content, + EVAS_CALLBACK_DEL, + _item_content_del); + } +} + +static Eina_Bool +_item_del_pre_hook(Elm_Object_Item *it) +{ + Elm_Naviframe_Item *navi_it; + Widget_Data *wd; + + navi_it =(Elm_Naviframe_Item *)it; + wd = elm_widget_data_get(WIDGET(navi_it)); + if (!wd) return EINA_FALSE; + + if (it == elm_naviframe_top_item_get(WIDGET(navi_it))) + { + wd->stack = eina_inlist_remove(wd->stack, EINA_INLIST_GET(navi_it)); + _item_del(navi_it); + //If the item is only one, the stack will be empty + if (!wd->stack) return EINA_TRUE; + navi_it = EINA_INLIST_CONTAINER_GET(wd->stack->last, + Elm_Naviframe_Item); + evas_object_show(VIEW(navi_it)); + evas_object_raise(VIEW(navi_it)); + elm_object_signal_emit(VIEW(navi_it), "elm,state,visible", "elm"); + } + else + { + wd->stack = eina_inlist_remove(wd->stack, EINA_INLIST_GET(navi_it)); + _item_del(navi_it); + } + + return EINA_TRUE; +} + +static void +_pushed_finished(void *data, + Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, + const char *source __UNUSED__) +{ + Widget_Data *wd; + Elm_Naviframe_Item *it = data; + if (!it) return; + + wd = elm_widget_data_get(WIDGET(it)); + if (!wd) return; + + evas_object_hide(VIEW(it)); + + if (it->content) + elm_widget_tree_unfocusable_set(it->content, it->content_unfocusable); + + if (wd->freeze_events) + evas_object_freeze_events_set(VIEW(it), EINA_FALSE); +} + +static void +_popped_finished(void *data, + Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, + const char *source __UNUSED__) +{ + Widget_Data *wd; + Elm_Naviframe_Item *it = data; + if (!it) return; + + wd = elm_widget_data_get(WIDGET(it)); + if (!wd) return; + + if (wd->preserve && it->content) + elm_widget_tree_unfocusable_set(it->content, it->content_unfocusable); + + _item_del(data); + + elm_widget_item_free(data); +} + +static void +_show_finished(void *data, + Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, + const char *source __UNUSED__) +{ + Elm_Naviframe_Item *it; + Widget_Data *wd; + + it = data; + if (!it) return; + wd = elm_widget_data_get(WIDGET(it)); + if (!wd) return; + + elm_widget_tree_unfocusable_set(it->content, it->content_unfocusable); + + evas_object_smart_callback_call(WIDGET(it), + SIG_TRANSITION_FINISHED, + data); + if (wd->freeze_events) + evas_object_freeze_events_set(VIEW(it), EINA_FALSE); +} + +static void +_changed_size_hints(void *data, + Evas *e __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + _sizing_eval(data); +} + +static void +_item_content_set(Elm_Naviframe_Item *navi_it, Evas_Object *content) +{ + if (navi_it->content == content) return; + if (navi_it->content) evas_object_del(navi_it->content); + elm_object_part_content_set(VIEW(navi_it), "elm.swallow.content", content); + + if (content) + elm_object_signal_emit(VIEW(navi_it), "elm,state,content,show", "elm"); + else + elm_object_signal_emit(VIEW(navi_it), "elm,state,content,hide", "elm"); + + evas_object_event_callback_add(content, + EVAS_CALLBACK_DEL, + _item_content_del, + navi_it); + navi_it->content = content; + _sizing_eval(WIDGET(navi_it)); +} + +//FIXME: need to handle if this function is called while transition +static void +_item_style_set(Elm_Naviframe_Item *navi_it, const char *item_style) +{ + Elm_Naviframe_Content_Item_Pair *content_pair; + Elm_Naviframe_Text_Item_Pair *text_pair; + Widget_Data *wd; + + char buf[256]; + + if (!item_style) + { + strcpy(buf, "item/basic"); + eina_stringshare_replace(&navi_it->style, "basic"); + } + else + { + snprintf(buf, sizeof(buf), "item/%s", item_style); + eina_stringshare_replace(&navi_it->style, item_style); + } + elm_layout_theme_set(VIEW(navi_it), + "naviframe", + buf, + elm_widget_style_get(WIDGET(navi_it))); + //recover item + EINA_INLIST_FOREACH(navi_it->text_list, text_pair) + _item_text_set_hook((Elm_Object_Item *) navi_it, + text_pair->part, + elm_object_part_text_get(VIEW(navi_it), + text_pair->part)); + + EINA_INLIST_FOREACH(navi_it->content_list, content_pair) + _item_content_set_hook((Elm_Object_Item *) navi_it, + content_pair->part, + elm_object_part_content_get(VIEW(navi_it), + content_pair->part)); + //content + if (navi_it->content) + elm_object_signal_emit(VIEW(navi_it), "elm,state,content,show", "elm"); + + //prev button + if (navi_it->title_prev_btn) + elm_object_signal_emit(VIEW(navi_it), "elm,state,prev_btn,show", "elm"); + + //next button + if (navi_it->title_next_btn) + elm_object_signal_emit(VIEW(navi_it), "elm,state,next_btn,show", "elm"); + + _sizing_eval(WIDGET(navi_it)); + + wd = elm_widget_data_get(WIDGET(navi_it)); + if (!wd) return; + + if (wd->freeze_events) + evas_object_freeze_events_set(VIEW(navi_it), EINA_FALSE); +} + +static Elm_Naviframe_Item * +_item_new(Evas_Object *obj, + const char *title_label, + Evas_Object *prev_btn, + Evas_Object *next_btn, + Evas_Object *content, + const char *item_style) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + //create item + Elm_Naviframe_Item *it = elm_widget_item_new(obj, Elm_Naviframe_Item); + if (!it) + { + ERR("Failed to allocate new item! : naviframe=%p", obj); + return NULL; + } + + elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook); + elm_widget_item_text_set_hook_set(it, _item_text_set_hook); + elm_widget_item_text_get_hook_set(it, _item_text_get_hook); + elm_widget_item_content_set_hook_set(it, _item_content_set_hook); + elm_widget_item_content_get_hook_set(it, _item_content_get_hook); + elm_widget_item_content_unset_hook_set(it, _item_content_unset_hook); + elm_widget_item_signal_emit_hook_set(it, _item_signal_emit_hook); + + //item base layout + VIEW(it) = elm_layout_add(obj); + evas_object_smart_member_add(VIEW(it), obj); + + evas_object_event_callback_add(VIEW(it), + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, + obj); + elm_object_signal_callback_add(VIEW(it), + "elm,action,show,finished", + "", + _show_finished, it); + elm_object_signal_callback_add(VIEW(it), + "elm,action,pushed,finished", + "", + _pushed_finished, it); + elm_object_signal_callback_add(VIEW(it), + "elm,action,popped,finished", + "", + _popped_finished, it); + elm_object_signal_callback_add(VIEW(it), + "elm,action,title,clicked", + "", + _title_clicked, it); + + _item_style_set(it, item_style); + _item_text_set_hook((Elm_Object_Item *)it, "elm.text.title", title_label); + + //title buttons + if ((!prev_btn) && wd->auto_pushed && eina_inlist_count(wd->stack)) + { + prev_btn = _back_btn_new(obj); + _title_prev_btn_set(it, prev_btn, EINA_TRUE); + } + else + _title_prev_btn_set(it, prev_btn, EINA_FALSE); + + _title_next_btn_set(it, next_btn); + _item_content_set(it, content); + it->title_visible = EINA_TRUE; + return it; +} + +static Eina_Bool +_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next) +{ + Eina_Bool ret; + Elm_Naviframe_Item *top_it; + Eina_List *l = NULL; + Widget_Data *wd = elm_widget_data_get(obj); + void *(*list_data_get)(const Eina_List *list); + if (!wd) return EINA_FALSE; + + top_it = (Elm_Naviframe_Item *)elm_naviframe_top_item_get(obj); + if (!top_it) return EINA_FALSE; + + list_data_get = eina_list_data_get; + + //Forcus order: prev button, next button, contents + if (top_it->title_prev_btn) + l = eina_list_append(l, top_it->title_prev_btn); + if (top_it->title_next_btn) + l = eina_list_append(l, top_it->title_next_btn); + l = eina_list_append(l, VIEW(top_it)); + + ret = elm_widget_focus_list_next_get(obj, l, list_data_get, dir, next); + eina_list_free(l); + return ret; +} + +EAPI Evas_Object * +elm_naviframe_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + ELM_SET_WIDTYPE(widtype, "naviframe"); + elm_widget_type_set(obj, "naviframe"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_disable_hook_set(obj, _disable_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_text_set_hook_set(obj, _text_set_hook); + elm_widget_text_get_hook_set(obj, _text_get_hook); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); + elm_widget_signal_emit_hook_set(obj, _emit_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); + elm_widget_focus_next_hook_set(obj, _focus_next_hook); + + //base + //FIXME: Is this base layout really needed? + wd->base = elm_layout_add(obj); + evas_object_event_callback_add(wd->base, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, + obj); + elm_widget_resize_object_set(obj, wd->base); + elm_layout_theme_set(wd->base, "naviframe", "base", "default"); + + evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _move, obj); + evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj); + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + wd->auto_pushed = EINA_TRUE; + wd->freeze_events = EINA_TRUE; + + return obj; +} + +EAPI Elm_Object_Item * +elm_naviframe_item_push(Evas_Object *obj, + const char *title_label, + Evas_Object *prev_btn, + Evas_Object *next_btn, + Evas_Object *content, + const char *item_style) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + Elm_Naviframe_Item *prev_it, *it; + + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + it = _item_new(obj, title_label, prev_btn, next_btn, content, item_style); + if (!it) return NULL; + + evas_object_show(VIEW(it)); + + prev_it = (Elm_Naviframe_Item *) elm_naviframe_top_item_get(obj); + if (prev_it) + { + if (wd->freeze_events) + { + evas_object_freeze_events_set(VIEW(it), EINA_TRUE); + evas_object_freeze_events_set(VIEW(prev_it), EINA_TRUE); + } + elm_object_signal_emit(VIEW(prev_it), "elm,state,cur,pushed", "elm"); + elm_object_signal_emit(VIEW(it), "elm,state,new,pushed", "elm"); + edje_object_message_signal_process(elm_layout_edje_get(VIEW(prev_it))); + if (prev_it->content) + { + prev_it->content_unfocusable = elm_widget_tree_unfocusable_get(prev_it->content); + elm_widget_tree_unfocusable_set(prev_it->content, EINA_TRUE); + } + edje_object_message_signal_process(elm_layout_edje_get(VIEW(it))); + } + wd->stack = eina_inlist_append(wd->stack, EINA_INLIST_GET(it)); + _sizing_eval(obj); + return (Elm_Object_Item *)it; +} + +EAPI Elm_Object_Item * +elm_naviframe_item_insert_before(Evas_Object *obj, + Elm_Object_Item *before, + const char *title_label, + Evas_Object *prev_btn, + Evas_Object *next_btn, + Evas_Object *content, + const char *item_style) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + ELM_OBJ_ITEM_CHECK_OR_RETURN(before, NULL); + Elm_Naviframe_Item *it; + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + it = _item_new(obj, title_label, prev_btn, next_btn, content, item_style); + if (!it) return NULL; + + wd->stack = + eina_inlist_prepend_relative(wd->stack, + EINA_INLIST_GET(it), + EINA_INLIST_GET(((Elm_Naviframe_Item *) before))); + _sizing_eval(obj); + return (Elm_Object_Item *)it; +} + +EAPI Elm_Object_Item * +elm_naviframe_item_insert_after(Evas_Object *obj, + Elm_Object_Item *after, + const char *title_label, + Evas_Object *prev_btn, + Evas_Object *next_btn, + Evas_Object *content, + const char *item_style) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + ELM_OBJ_ITEM_CHECK_OR_RETURN(after, NULL); + Elm_Naviframe_Item *it; + Widget_Data *wd; + Eina_Bool top_inserted; + + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + it = _item_new(obj, title_label, prev_btn, next_btn, content, item_style); + if (!it) return NULL; + + if (elm_naviframe_top_item_get(obj) == after) top_inserted = EINA_TRUE; + + wd->stack = + eina_inlist_append_relative(wd->stack, + EINA_INLIST_GET(it), + EINA_INLIST_GET(((Elm_Naviframe_Item *) after))); + if (top_inserted) + { + evas_object_show(VIEW(it)); + evas_object_hide(VIEW(after)); + } + + _sizing_eval(obj); + + return (Elm_Object_Item *)it; +} + +EAPI Evas_Object * +elm_naviframe_item_pop(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Elm_Naviframe_Item *it, *prev_it = NULL; + Widget_Data *wd; + Evas_Object *content = NULL; + + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + it = (Elm_Naviframe_Item *) elm_naviframe_top_item_get(obj); + if (!it) return NULL; + if (wd->preserve) + content = it->content; + + if (it->content) + { + it->content_unfocusable = elm_widget_tree_unfocusable_get(it->content); + elm_widget_tree_unfocusable_set(it->content, EINA_TRUE); + } + + if (wd->stack->last->prev) + prev_it = EINA_INLIST_CONTAINER_GET(wd->stack->last->prev, + Elm_Naviframe_Item); + wd->stack = eina_inlist_remove(wd->stack, EINA_INLIST_GET(it)); + if (prev_it) + { + if (wd->freeze_events) + { + evas_object_freeze_events_set(VIEW(it), EINA_TRUE); + evas_object_freeze_events_set(VIEW(prev_it), EINA_TRUE); + } + elm_object_signal_emit(VIEW(it), "elm,state,cur,popped", "elm"); + evas_object_show(VIEW(prev_it)); + elm_object_signal_emit(VIEW(prev_it), + "elm,state,prev,popped", + "elm"); + edje_object_message_signal_process(elm_layout_edje_get(VIEW(it))); + edje_object_message_signal_process(elm_layout_edje_get(VIEW(prev_it))); + } + else + { + _item_del(it); + elm_widget_item_free(it); + } + + return content; +} + +EAPI void +elm_naviframe_item_pop_to(Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Naviframe_Item *navi_it; + Widget_Data *wd; + Eina_Inlist *l, *prev_l; + + navi_it = (Elm_Naviframe_Item *)it; + wd = elm_widget_data_get(WIDGET(navi_it)); + if (!wd) return; + + if (it == elm_naviframe_top_item_get(WIDGET(navi_it))) return; + + l = wd->stack->last->prev; + + while (l) + { + if (EINA_INLIST_CONTAINER_GET(l, Elm_Naviframe_Item) == + ((Elm_Naviframe_Item *)it)) break; + prev_l = l->prev; + wd->stack = eina_inlist_remove(wd->stack, l); + _item_del(EINA_INLIST_CONTAINER_GET(l, Elm_Naviframe_Item)); + elm_widget_item_free(EINA_INLIST_CONTAINER_GET(l, + Elm_Naviframe_Item)); + l = prev_l; + } + elm_naviframe_item_pop(WIDGET(navi_it)); +} + +EAPI void +elm_naviframe_item_promote(Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Naviframe_Item *navi_it; + Elm_Naviframe_Item *prev_it; + Widget_Data *wd; + + navi_it = (Elm_Naviframe_Item *)it; + wd = elm_widget_data_get(navi_it->base.widget); + if (!wd) return; + + if (it == elm_naviframe_top_item_get(navi_it->base.widget)) return; + wd->stack = eina_inlist_demote(wd->stack, EINA_INLIST_GET(navi_it)); + prev_it = EINA_INLIST_CONTAINER_GET(wd->stack->last->prev, + Elm_Naviframe_Item); + if (prev_it->content) + { + prev_it->content_unfocusable = elm_widget_tree_unfocusable_get(prev_it->content); + elm_widget_tree_unfocusable_set(prev_it->content, EINA_TRUE); + } + + if (wd->freeze_events) + { + evas_object_freeze_events_set(VIEW(it), EINA_TRUE); + evas_object_freeze_events_set(VIEW(prev_it), EINA_TRUE); + } + elm_object_signal_emit(VIEW(prev_it), + "elm,state,cur,pushed", + "elm"); + evas_object_show(VIEW(navi_it)); + evas_object_raise(VIEW(navi_it)); + elm_object_signal_emit(VIEW(navi_it), + "elm,state,new,pushed", + "elm"); + edje_object_message_signal_process(elm_layout_edje_get(VIEW(prev_it))); + edje_object_message_signal_process(elm_layout_edje_get(VIEW(navi_it))); +} + +EAPI void +elm_naviframe_item_simple_promote(Evas_Object *obj, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + Elm_Naviframe_Item *itr; + EINA_INLIST_FOREACH(wd->stack, itr) + { + if (elm_object_item_content_get((Elm_Object_Item *)itr) == content) + { + elm_naviframe_item_promote((Elm_Object_Item *)itr); + break; + } + } +} + + +EAPI void +elm_naviframe_content_preserve_on_pop_set(Evas_Object *obj, Eina_Bool preserve) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->preserve = !!preserve; +} + +EAPI Eina_Bool +elm_naviframe_content_preserve_on_pop_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->preserve; +} + +EAPI Elm_Object_Item* +elm_naviframe_top_item_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (!wd->stack)) return NULL; + return (Elm_Object_Item *) (EINA_INLIST_CONTAINER_GET(wd->stack->last, + Elm_Naviframe_Item)); +} + +EAPI Elm_Object_Item* +elm_naviframe_bottom_item_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (!wd->stack)) return NULL; + return (Elm_Object_Item *) (EINA_INLIST_CONTAINER_GET(wd->stack, + Elm_Naviframe_Item)); +} + +EAPI void +elm_naviframe_item_style_set(Elm_Object_Item *it, const char *item_style) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *)it; + + if (item_style) + if (!strcmp(item_style, navi_it->style)) return; + + if (!item_style) + if (!strcmp("basic", navi_it->style)) return; + + _item_style_set(navi_it, item_style); + _item_title_visible_update(navi_it); +} + +EAPI const char * +elm_naviframe_item_style_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *)it; + return navi_it->style; +} + +EAPI void +elm_naviframe_item_title_visible_set(Elm_Object_Item *it, Eina_Bool visible) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *)it; + + visible = !!visible; + if (navi_it->title_visible == visible) return; + + navi_it->title_visible = visible; + _item_title_visible_update(navi_it); +} + +EAPI Eina_Bool +elm_naviframe_item_title_visible_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE); + Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *)it; + return navi_it->title_visible; +} + +EAPI void +elm_naviframe_prev_btn_auto_pushed_set(Evas_Object *obj, Eina_Bool auto_pushed) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->auto_pushed = !!auto_pushed; +} + +EAPI Eina_Bool +elm_naviframe_prev_btn_auto_pushed_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->auto_pushed; +} + +EAPI Eina_List * +elm_naviframe_items_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + Eina_List *ret = NULL; + Elm_Naviframe_Item *itr; + EINA_INLIST_FOREACH(wd->stack, itr) + ret = eina_list_append(ret, itr); + return ret; +} + +EAPI void +elm_naviframe_event_enabled_set(Evas_Object *obj, Eina_Bool enabled) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + enabled = !!enabled; + if (wd->freeze_events == !enabled) return; + wd->freeze_events = !enabled; +} + +EAPI Eina_Bool +elm_naviframe_event_enabled_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return !wd->freeze_events; +} diff --git a/libraries/elementary/src/lib/elc_naviframe.h b/libraries/elementary/src/lib/elc_naviframe.h new file mode 100644 index 0000000..c17147c --- /dev/null +++ b/libraries/elementary/src/lib/elc_naviframe.h @@ -0,0 +1,406 @@ +/** + * @defgroup Naviframe Naviframe + * @ingroup Elementary + * + * @brief Naviframe is a kind of view manager for the applications. + * + * Naviframe provides functions to switch different pages with stack + * mechanism. It means if one page(item) needs to be changed to the new one, + * then naviframe would push the new page to its internal stack. Of course, + * it can be back to the previous page by popping the top page. Naviframe + * provides some transition effect while the pages are switching (same as + * pager). + * + * Since each item could keep the different styles, users could keep the + * same look & feel for the pages or different styles for the items in it's + * application. + * + * Default content parts of the naviframe that you can use content hooks for + * are: + * @li "default" - The main content of the current page + * @li "icon" - An icon in the title area of the current page + * @li "prev_btn" - A button of the current page to go to the previous page + * @li "next_btn" - A button of the current page to go to the next page + * + * Default text parts of the naviframe that you can use for are: + * @li "default" - Title label in the title area of the current page + * @li "subtitle" - Sub-title label in the title area of the current page + * + * Signals that you can add callbacks for are: + * @li "transition,finished" - When the transition is finished in changing the + * item + * @li "title,clicked" - User clicked title area + * + * Default content parts of the naviframe items that you can use content hooks + * for are: + * @li "default" - The main content of the page + * @li "icon" - An icon in the title area + * @li "prev_btn" - A button to go to the previous page + * @li "next_btn" - A button to go to the next page + * + * Default text parts of the naviframe items that you can use for are: + * @li "default" - Title label in the title area + * @li "subtitle" - Sub-title label in the title area + * + * Supported elm_object common APIs. + * @li @ref elm_object_signal_emit + * @li @ref elm_object_part_text_set + * @li @ref elm_object_part_text_get + * @li @ref elm_object_part_content_set + * @li @ref elm_object_part_content_get + * @li @ref elm_object_part_content_unset + * + * Supported elm_object_item common APIs. + * @li @ref elm_object_item_part_text_set + * @li @ref elm_object_item_part_text_get + * @li @ref elm_object_item_part_content_set + * @li @ref elm_object_item_part_content_get + * @li @ref elm_object_item_part_content_unset + * @li @ref elm_object_item_signal_emit + */ + +/** + * @addtogroup Naviframe + * @{ + */ + +/** + * @brief Add a new Naviframe object to the parent. + * + * @param parent Parent object + * @return New object or @c NULL, if it cannot be created + * + * @ingroup Naviframe + */ +EAPI Evas_Object *elm_naviframe_add(Evas_Object *parent); + +/** + * @brief Push a new item to the top of the naviframe stack (and show it). + * + * @param obj The naviframe object + * @param title_label The label in the title area. The name of the title + * label part is "elm.text.title" + * @param prev_btn The button to go to the previous item. If it is NULL, + * then naviframe will create a back button automatically. The name of + * the prev_btn part is "elm.swallow.prev_btn" + * @param next_btn The button to go to the next item. Or It could be just an + * extra function button. The name of the next_btn part is + * "elm.swallow.next_btn" + * @param content The main content object. The name of content part is + * "elm.swallow.content" + * @param item_style The current item style name. @c NULL would be default. + * @return The created item or @c NULL upon failure. + * + * The item pushed becomes one page of the naviframe, this item will be + * deleted when it is popped. + * + * @see also elm_naviframe_item_style_set() + * @see also elm_naviframe_item_insert_before() + * @see also elm_naviframe_item_insert_after() + * + * The following styles are available for this item: + * @li @c "default" + * + * @ingroup Naviframe + */ +EAPI Elm_Object_Item *elm_naviframe_item_push(Evas_Object *obj, const char *title_label, Evas_Object *prev_btn, Evas_Object *next_btn, Evas_Object *content, const char *item_style); + +/** + * @brief Insert a new item into the naviframe before item @p before. + * + * @param obj The naviframe object + * @param before The naviframe item to insert before. + * @param title_label The label in the title area. The name of the title + * label part is "elm.text.title" + * @param prev_btn The button to go to the previous item. If it is NULL, + * then naviframe will create a back button automatically. The name of + * the prev_btn part is "elm.swallow.prev_btn" + * @param next_btn The button to go to the next item. Or It could be just an + * extra function button. The name of the next_btn part is + * "elm.swallow.next_btn" + * @param content The main content object. The name of content part is + * "elm.swallow.content" + * @param item_style The current item style name. @c NULL would be default. + * @return The created item or @c NULL upon failure. + * + * The item is inserted into the naviframe straight away without any + * transition operations. This item will be deleted when it is popped. + * + * @see also elm_naviframe_item_style_set() + * @see also elm_naviframe_item_push() + * @see also elm_naviframe_item_insert_after() + * + * The following styles are available for this item: + * @li @c "default" + * + * @ingroup Naviframe + */ +EAPI Elm_Object_Item *elm_naviframe_item_insert_before(Evas_Object *obj, Elm_Object_Item *before, const char *title_label, Evas_Object *prev_btn, Evas_Object *next_btn, Evas_Object *content, const char *item_style); + +/** + * @brief Insert a new item into the naviframe after item @p after. + * + * @param obj The naviframe object + * @param after The naviframe item to insert after. + * @param title_label The label in the title area. The name of the title + * label part is "elm.text.title" + * @param prev_btn The button to go to the previous item. If it is NULL, + * then naviframe will create a back button automatically. The name of + * the prev_btn part is "elm.swallow.prev_btn" + * @param next_btn The button to go to the next item. Or It could be just an + * extra function button. The name of the next_btn part is + * "elm.swallow.next_btn" + * @param content The main content object. The name of content part is + * "elm.swallow.content" + * @param item_style The current item style name. @c NULL would be default. + * @return The created item or @c NULL upon failure. + * + * The item is inserted into the naviframe straight away without any + * transition operations. This item will be deleted when it is popped. + * + * @see also elm_naviframe_item_style_set() + * @see also elm_naviframe_item_push() + * @see also elm_naviframe_item_insert_before() + * + * The following styles are available for this item: + * @li @c "default" + * + * @ingroup Naviframe + */ +EAPI Elm_Object_Item *elm_naviframe_item_insert_after(Evas_Object *obj, Elm_Object_Item *after, const char *title_label, Evas_Object *prev_btn, Evas_Object *next_btn, Evas_Object *content, const char *item_style); + +/** + * @brief Pop an item that is on top of the stack + * + * @param obj The naviframe object + * @return @c NULL or the content object(if the + * elm_naviframe_content_preserve_on_pop_get is true). + * + * This pops an item that is on the top(visible) of the naviframe, makes it + * disappear, then deletes the item. The item that was underneath it on the + * stack will become visible. + * + * @see also elm_naviframe_content_preserve_on_pop_get() + * + * @ingroup Naviframe + */ +EAPI Evas_Object *elm_naviframe_item_pop(Evas_Object *obj); + +/** + * @brief Pop the items between the top and the above one on the given item. + * + * @param it The naviframe item + * + * @ingroup Naviframe + */ +EAPI void elm_naviframe_item_pop_to(Elm_Object_Item *it); + +/** + * Promote an item already in the naviframe stack to the top of the stack + * + * @param it The naviframe item + * + * This will take the indicated item and promote it to the top of the stack + * as if it had been pushed there. The item must already be inside the + * naviframe stack to work. + * + */ +EAPI void elm_naviframe_item_promote(Elm_Object_Item *it); + +/** + * @brief preserve the content objects when items are popped. + * + * @param obj The naviframe object + * @param preserve Enable the preserve mode if EINA_TRUE, disable otherwise + * + * @see also elm_naviframe_content_preserve_on_pop_get() + * + * @ingroup Naviframe + */ +EAPI void elm_naviframe_content_preserve_on_pop_set(Evas_Object *obj, Eina_Bool preserve); + +/** + * @brief Get a value whether preserve mode is enabled or not. + * + * @param obj The naviframe object + * @return If @c EINA_TRUE, preserve mode is enabled + * + * @see also elm_naviframe_content_preserve_on_pop_set() + * + * @ingroup Naviframe + */ +EAPI Eina_Bool elm_naviframe_content_preserve_on_pop_get(const Evas_Object *obj); + +/** + * @brief Get a top item on the naviframe stack + * + * @param obj The naviframe object + * @return The top item on the naviframe stack or @c NULL, if the stack is + * empty + * + * @ingroup Naviframe + */ +EAPI Elm_Object_Item *elm_naviframe_top_item_get(const Evas_Object *obj); + +/** + * @brief Get a bottom item on the naviframe stack + * + * @param obj The naviframe object + * @return The bottom item on the naviframe stack or @c NULL, if the stack is + * empty + * + * @ingroup Naviframe + */ +EAPI Elm_Object_Item *elm_naviframe_bottom_item_get(const Evas_Object *obj); + +/** + * @brief Set an item style + * + * @param it The naviframe item + * @param item_style The current item style name. @c NULL would be default + * + * The following styles are available for this item: + * @li @c "default" + * + * @see also elm_naviframe_item_style_get() + * + * @ingroup Naviframe + */ +EAPI void elm_naviframe_item_style_set(Elm_Object_Item *it, const char *item_style); + +/** + * @brief Get an item style + * + * @param it The naviframe item + * @return The current item style name + * + * @see also elm_naviframe_item_style_set() + * + * @ingroup Naviframe + */ +EAPI const char *elm_naviframe_item_style_get(const Elm_Object_Item *it); + +/** + * @brief Show/Hide the title area + * + * @param it The naviframe item + * @param visible If @c EINA_TRUE, title area will be visible, hidden + * otherwise + * + * When the title area is invisible, then the controls would be hidden so as * to expand the content area to full-size. + * + * @see also elm_naviframe_item_title_visible_get() + * + * @ingroup Naviframe + */ +EAPI void elm_naviframe_item_title_visible_set(Elm_Object_Item *it, Eina_Bool visible); + +/** + * @brief Get a value whether title area is visible or not. + * + * @param it The naviframe item + * @return If @c EINA_TRUE, title area is visible + * + * @see also elm_naviframe_item_title_visible_set() + * + * @ingroup Naviframe + */ +EAPI Eina_Bool elm_naviframe_item_title_visible_get(const Elm_Object_Item *it); + +/** + * @brief Set creating prev button automatically or not + * + * @param obj The naviframe object + * @param auto_pushed If @c EINA_TRUE, the previous button(back button) will + * be created internally when you pass the @c NULL to the prev_btn + * parameter in elm_naviframe_item_push + * + * @see also elm_naviframe_item_push() + * + * @ingroup Naviframe + */ +EAPI void elm_naviframe_prev_btn_auto_pushed_set(Evas_Object *obj, Eina_Bool auto_pushed); + +/** + * @brief Get a value whether prev button(back button) will be auto pushed or + * not. + * + * @param obj The naviframe object + * @return If @c EINA_TRUE, prev button will be auto pushed. + * + * @see also elm_naviframe_item_push() + * elm_naviframe_prev_btn_auto_pushed_set() + * + * @ingroup Naviframe + */ +EAPI Eina_Bool elm_naviframe_prev_btn_auto_pushed_get(const Evas_Object *obj); + +/** + * @brief Get a list of all the naviframe items. + * + * @param obj The naviframe object + * @return An Eina_List of naviframe items, #Elm_Object_Item, + * or @c NULL on failure. + * @note The returned list MUST be freed. + * + * @ingroup Naviframe + */ +EAPI Eina_List *elm_naviframe_items_get(const Evas_Object *obj) EINA_MALLOC EINA_WARN_UNUSED_RESULT; + +/** + * @brief Set the event enabled when pushing/popping items + * + * If @c enabled is EINA_TRUE, the contents of the naviframe item will + * receives events from mouse and keyboard during view changing such as + * item push/pop. + * + * @param obj The naviframe object + * @param enabled Events are received when enabled is @c EINA_TRUE, and + * ignored otherwise. + * + * @warning Events will be blocked by calling evas_object_freeze_events_set() + * internally. So don't call the API whiling pushing/popping items. + * + * @see elm_naviframe_event_enabled_get() + * @see evas_object_freeze_events_set() + * + * @ingroup Naviframe + */ +EAPI void elm_naviframe_event_enabled_set(Evas_Object *obj, Eina_Bool enabled); + +/** + * @brief Get the value of event enabled status. + * + * @param obj The naviframe object + * @return EINA_TRUE, when event is enabled + * + * @see elm_naviframe_event_enabled_set() + * + * @ingroup Naviframe + */ +EAPI Eina_Bool elm_naviframe_event_enabled_get(const Evas_Object *obj); + +/** + * @brief Simple version of item_push. + * + * @see elm_naviframe_item_push + */ +static inline Elm_Object_Item * +elm_naviframe_item_simple_push(Evas_Object *obj, Evas_Object *content) +{ + Elm_Object_Item *it; + it = elm_naviframe_item_push(obj, NULL, NULL, NULL, content, NULL); + elm_naviframe_item_title_visible_set(it, EINA_FALSE); + return it; +} + +/** + * @brief Simple version of item_promote. + * + * @see elm_naviframe_item_promote + */ +EAPI void elm_naviframe_item_simple_promote(Evas_Object *obj, Evas_Object *content); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elc_player.c b/libraries/elementary/src/lib/elc_player.c new file mode 100644 index 0000000..a6327c3 --- /dev/null +++ b/libraries/elementary/src/lib/elc_player.c @@ -0,0 +1,590 @@ +#include +#include "elm_priv.h" + +#ifdef HAVE_EMOTION +# include +#endif + +typedef struct _Widget_Data Widget_Data; +struct _Widget_Data +{ + Evas_Object *layout; + Evas_Object *video; + Evas_Object *emotion; + + Evas_Object *forward; + Evas_Object *info; + Evas_Object *next; + Evas_Object *pause; + Evas_Object *play; + Evas_Object *prev; + Evas_Object *rewind; + Evas_Object *stop; + + Evas_Object *slider; +}; + +#ifdef HAVE_EMOTION +static const char *widtype = NULL; + +static const char SIG_FORWARD_CLICKED[] = "forward,clicked"; +static const char SIG_INFO_CLICKED[] = "info,clicked"; +static const char SIG_NEXT_CLICKED[] = "next,clicked"; +static const char SIG_PAUSE_CLICKED[] = "pause,clicked"; +static const char SIG_PLAY_CLICKED[] = "play,clicked"; +static const char SIG_PREV_CLICKED[] = "prev,clicked"; +static const char SIG_REWIND_CLICKED[] = "rewind,clicked"; +static const char SIG_STOP_CLICKED[] = "stop,clicked"; + +static const Evas_Smart_Cb_Description _signals[] = { + { SIG_FORWARD_CLICKED, "" }, + { SIG_INFO_CLICKED, "" }, + { SIG_NEXT_CLICKED, "" }, + { SIG_PAUSE_CLICKED, "" }, + { SIG_PLAY_CLICKED, "" }, + { SIG_PREV_CLICKED, "" }, + { SIG_REWIND_CLICKED, "" }, + { SIG_STOP_CLICKED, "" }, + { NULL, NULL } +}; + +static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); +static void _theme_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _on_focus_hook(void *data, Evas_Object *obj); +static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src, + Evas_Callback_Type type, void *event_info); + +static Eina_Bool +_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info) +{ + if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE; + Evas_Event_Key_Down *ev = event_info; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; + if (elm_widget_disabled_get(obj)) return EINA_FALSE; + if (!wd->video) return EINA_FALSE; + if ((!strcmp(ev->keyname, "Left")) || + ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string))) + { + double current, last; + + current = elm_video_play_position_get(wd->video); + last = elm_video_play_length_get(wd->video); + + if (current < last) + { + current += last / 100; + elm_video_play_position_set(wd->video, current); + } + + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + if ((!strcmp(ev->keyname, "Right")) || + ((!strcmp(ev->keyname, "KP_Right")) && (!ev->string))) + { + double current, last; + + current = elm_video_play_position_get(wd->video); + last = elm_video_play_length_get(wd->video); + + if (current > 0) + { + current -= last / 100; + if (current < 0) current = 0; + elm_video_play_position_set(wd->video, current); + } + + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + if (!strcmp(ev->keyname, "space")) + { + if (elm_video_is_playing_get(wd->video)) + elm_video_pause(wd->video); + else + elm_video_play(wd->video); + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + fprintf(stderr, "keyname: '%s' not handle\n", ev->keyname); + return EINA_FALSE; +} + +static void +_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (elm_widget_focus_get(obj)) + { + edje_object_signal_emit(wd->layout, "elm,action,focus", "elm"); + evas_object_focus_set(wd->layout, EINA_TRUE); + } + else + { + edje_object_signal_emit(wd->layout, "elm,action,unfocus", "elm"); + evas_object_focus_set(wd->layout, EINA_FALSE); + } +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->layout, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _elm_theme_object_set(obj, wd->layout, "video", "base", elm_widget_style_get(obj)); + edje_object_scale_set(wd->layout, elm_widget_scale_get(obj) * + _elm_config->scale); + +#define UPDATE_THEME(Obj, Target, Layout, Name) \ + if (Target) \ + { \ + elm_object_style_set(Target, elm_widget_style_get(Obj)); \ + if (!edje_object_part_swallow(Layout, Name, Target)) \ + evas_object_hide(Target); \ + elm_object_disabled_set(Target, elm_widget_disabled_get(Obj)); \ + } + + UPDATE_THEME(obj, wd->forward, wd->layout, "media_player/forward"); + UPDATE_THEME(obj, wd->info, wd->layout, "media_player/info"); + UPDATE_THEME(obj, wd->next, wd->layout, "media_player/next"); + UPDATE_THEME(obj, wd->pause, wd->layout, "media_player/pause"); + UPDATE_THEME(obj, wd->play, wd->layout, "media_player/play"); + UPDATE_THEME(obj, wd->prev, wd->layout, "media_player/prev"); + UPDATE_THEME(obj, wd->rewind, wd->layout, "media_player/rewind"); + UPDATE_THEME(obj, wd->next, wd->layout, "media_player/next"); + UPDATE_THEME(obj, wd->slider, wd->layout, "media_player/slider"); + + _sizing_eval(obj); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord w, h; + + if (!wd) return; + edje_object_size_min_get(wd->layout, &w, &h); + edje_object_size_min_restricted_calc(wd->layout, &w, &h, w, h); + evas_object_size_hint_min_set(obj, w, h); +} + +static void +_update_slider(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *player = data; + Widget_Data *wd = elm_widget_data_get(player); + double pos, length; + Eina_Bool seekable; + + if (!wd) return ; + seekable = elm_video_is_seekable_get(wd->video); + length = elm_video_play_length_get(wd->video); + pos = elm_video_play_position_get(wd->video); + + elm_object_disabled_set(wd->slider, !seekable); + elm_slider_min_max_set(wd->slider, 0, length); + elm_slider_value_set(wd->slider, pos); +} + +static void +_update_position(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *player = data; + Widget_Data *wd = elm_widget_data_get(player); + + if (!wd) return ; + elm_video_play_position_set(wd->video, elm_slider_value_get(wd->slider)); +} + +static void +_forward(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *player = data; + Widget_Data *wd = elm_widget_data_get(player); + double pos, length; + + if (!wd) return ; + + pos = elm_video_play_position_get(wd->video); + length = elm_video_play_length_get(wd->video); + + pos += length * 0.3; + elm_video_play_position_set(wd->video, pos); + + edje_object_signal_emit(wd->layout, "elm,button,forward", "elm"); + evas_object_smart_callback_call(player, SIG_FORWARD_CLICKED, NULL); +} + +static void +_info(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *player = data; + Widget_Data *wd = elm_widget_data_get(player); + + if (!wd) return ; + + edje_object_signal_emit(wd->layout, "elm,button,info", "elm"); + evas_object_smart_callback_call(player, SIG_INFO_CLICKED, NULL); +} + +static void +_next(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *player = data; + Widget_Data *wd = elm_widget_data_get(player); + double pos, length; + + if (!wd) return ; + + pos = elm_video_play_position_get(wd->video); + length = elm_video_play_length_get(wd->video); + + pos += length * 0.1; + elm_video_play_position_set(wd->video, pos); + + edje_object_signal_emit(wd->layout, "elm,button,next", "elm"); + evas_object_smart_callback_call(player, SIG_NEXT_CLICKED, NULL); +} + +static void +_pause(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *player = data; + Widget_Data *wd = elm_widget_data_get(player); + + if (!wd) return ; + + edje_object_signal_emit(wd->layout, "elm,player,pause", "elm"); + elm_video_pause(wd->video); + + edje_object_signal_emit(wd->layout, "elm,button,pause", "elm"); + evas_object_smart_callback_call(player, SIG_PAUSE_CLICKED, NULL); +} + +static void +_play(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *player = data; + Widget_Data *wd = elm_widget_data_get(player); + + if (!wd) return ; + elm_video_play(wd->video); + edje_object_signal_emit(wd->layout, "elm,button,play", "elm"); + evas_object_smart_callback_call(player, SIG_PLAY_CLICKED, NULL); +} + +static void +_prev(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *player = data; + Widget_Data *wd = elm_widget_data_get(player); + double pos, length; + + if (!wd) return ; + + pos = elm_video_play_position_get(wd->video); + length = elm_video_play_length_get(wd->video); + + pos -= length * 0.1; + elm_video_play_position_set(wd->video, pos); + evas_object_smart_callback_call(player, SIG_PREV_CLICKED, NULL); + edje_object_signal_emit(wd->layout, "elm,button,prev", "elm"); +} + +static void +_rewind(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *player = data; + Widget_Data *wd = elm_widget_data_get(player); + + if (!wd) return ; + elm_video_play_position_set(wd->video, 0); + edje_object_signal_emit(wd->layout, "elm,button,rewind", "elm"); + evas_object_smart_callback_call(player, SIG_REWIND_CLICKED, NULL); +} + +static void +_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *player = data; + Widget_Data *wd = elm_widget_data_get(player); + + if (!wd) return ; + + edje_object_signal_emit(wd->layout, "elm,button,stop", "elm"); + evas_object_smart_callback_call(player, SIG_STOP_CLICKED, NULL); +} + +static void +_play_started(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *player = data; + Widget_Data *wd = elm_widget_data_get(player); + + if (!wd) return ; + + edje_object_signal_emit(wd->layout, "elm,player,play", "elm"); +} + +static void +_play_finished(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *player = data; + Widget_Data *wd = elm_widget_data_get(player); + + if (!wd) return ; + + edje_object_signal_emit(wd->layout, "elm,player,pause", "elm"); +} + +static void +_cleanup_callback(Widget_Data *wd) +{ + if (!wd || !wd->emotion) return; + + evas_object_smart_callback_del(wd->emotion, "frame_decode", + _update_slider); + evas_object_smart_callback_del(wd->emotion, "frame_resize", + _update_slider); + evas_object_smart_callback_del(wd->emotion, "length_change", + _update_slider); + evas_object_smart_callback_del(wd->emotion, "position_update", + _update_slider); + evas_object_smart_callback_del(wd->emotion, "playback_started", + _play_started); + evas_object_smart_callback_del(wd->emotion, "playback_finished", + _play_finished); + elm_object_disabled_set(wd->slider, EINA_TRUE); + elm_object_disabled_set(wd->forward, EINA_TRUE); + elm_object_disabled_set(wd->info, EINA_TRUE); + elm_object_disabled_set(wd->next, EINA_TRUE); + elm_object_disabled_set(wd->pause, EINA_TRUE); + elm_object_disabled_set(wd->play, EINA_TRUE); + elm_object_disabled_set(wd->prev, EINA_TRUE); + elm_object_disabled_set(wd->rewind, EINA_TRUE); + elm_object_disabled_set(wd->next, EINA_TRUE); + wd->video = NULL; + wd->emotion = NULL; +} + +static void +_track_video(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _cleanup_callback(data); +} + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + evas_object_smart_callback_del(wd->forward, "clicked", _forward); + evas_object_smart_callback_del(wd->info, "clicked", _info); + evas_object_smart_callback_del(wd->next, "clicked", _next); + evas_object_smart_callback_del(wd->pause, "clicked", _pause); + evas_object_smart_callback_del(wd->play, "clicked", _play); + evas_object_smart_callback_del(wd->prev, "clicked", _prev); + evas_object_smart_callback_del(wd->rewind, "clicked", _rewind); + evas_object_smart_callback_del(wd->next, "clicked", _next); + _cleanup_callback(wd); + free(wd); +} + +static Evas_Object * +_player_button_add(Evas_Object *parent, Evas_Object *obj, Evas_Object *layout, const char *name, Evas_Smart_Cb func) +{ + Evas_Object *ic; + Evas_Object *bt; + + ic = elm_icon_add(parent); + elm_icon_standard_set(ic, name); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + bt = elm_button_add(parent); + elm_widget_mirrored_automatic_set(bt, EINA_FALSE); + elm_object_part_content_set(bt, "icon", ic); + evas_object_size_hint_align_set(bt, 0.0, 0.0); + elm_object_style_set(bt, "anchor"); + evas_object_smart_callback_add(bt, "clicked", func, obj); + elm_widget_sub_object_add(obj, bt); + + if (!edje_object_part_swallow(layout, name, bt)) + evas_object_hide(bt); + return bt; +} + +static char * +_double_to_time(double value) +{ + char buf[256]; + int ph, pm, ps, pf; + + ph = value / 3600; + pm = value / 60 - (ph * 60); + ps = value - (pm * 60); + pf = value * 100 - (ps * 100) - (pm * 60 * 100) - (ph * 60 * 60 * 100); + if (ph) + snprintf(buf, sizeof(buf), "%i:%02i:%02i.%02i", + ph, pm, ps, pf); + else if (pm) + snprintf(buf, sizeof(buf), "%02i:%02i.%02i", + pm, ps, pf); + else + snprintf(buf, sizeof(buf), "%02i.%02i", + ps, pf); + + return (char *)eina_stringshare_add(buf); +} + +static void +_value_free(char *data) +{ + eina_stringshare_del(data); +} +#endif + +#ifdef HAVE_EMOTION +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + if (part && strcmp(part, "video")) return; + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + double pos, length; + Eina_Bool seekable; + + if (!_elm_video_check(content)) return; + if (wd->video == content) return; + + if (wd->video) evas_object_del(wd->video); + _cleanup_callback(wd); + + wd->video = content; + + if (!wd->video) + { + wd->emotion = NULL; + return ; + } + + elm_object_disabled_set(wd->slider, EINA_FALSE); + elm_object_disabled_set(wd->forward, EINA_FALSE); + elm_object_disabled_set(wd->info, EINA_FALSE); + elm_object_disabled_set(wd->next, EINA_FALSE); + elm_object_disabled_set(wd->pause, EINA_FALSE); + elm_object_disabled_set(wd->play, EINA_FALSE); + elm_object_disabled_set(wd->prev, EINA_FALSE); + elm_object_disabled_set(wd->rewind, EINA_FALSE); + elm_object_disabled_set(wd->next, EINA_FALSE); + + wd->emotion = elm_video_emotion_get(wd->video); + emotion_object_priority_set(wd->emotion, EINA_TRUE); + evas_object_event_callback_add(wd->video, EVAS_CALLBACK_DEL, + _track_video, wd); + + seekable = elm_video_is_seekable_get(wd->video); + length = elm_video_play_length_get(wd->video); + pos = elm_video_play_position_get(wd->video); + + elm_object_disabled_set(wd->slider, !seekable); + elm_slider_min_max_set(wd->slider, 0, length); + elm_slider_value_set(wd->slider, pos); + + if (elm_video_is_playing_get(wd->video)) edje_object_signal_emit(wd->layout, "elm,player,play", "elm"); + else edje_object_signal_emit(wd->layout, "elm,player,pause", "elm"); + + evas_object_smart_callback_add(wd->emotion, "frame_decode", + _update_slider, obj); + evas_object_smart_callback_add(wd->emotion, "frame_resize", + _update_slider, obj); + evas_object_smart_callback_add(wd->emotion, "length_change", + _update_slider, obj); + evas_object_smart_callback_add(wd->emotion, "position_update", + _update_slider, obj); + evas_object_smart_callback_add(wd->emotion, "playback_started", + _play_started, obj); + evas_object_smart_callback_add(wd->emotion, "playback_finished", + _play_finished, obj); + + /* FIXME: track info from video */ +} +#endif + +EAPI Evas_Object * +elm_player_add(Evas_Object *parent) +{ +#ifdef HAVE_EMOTION + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + ELM_SET_WIDTYPE(widtype, "player"); + elm_widget_type_set(obj, "player"); + elm_widget_sub_object_add(parent, obj); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_can_focus_set(obj, EINA_TRUE); + elm_widget_event_hook_set(obj, _event_hook); + elm_widget_content_set_hook_set(obj, _content_set_hook); + /* TODO: add content_unset and content_get hook */ + + wd->layout = edje_object_add(e); + _elm_theme_object_set(obj, wd->layout, "player", "base", "default"); + elm_widget_resize_object_set(obj, wd->layout); + elm_widget_sub_object_add(obj, wd->layout); + evas_object_show(wd->layout); + evas_object_size_hint_weight_set(wd->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + wd->forward = _player_button_add(parent, obj, wd->layout, "media_player/forward", _forward); + wd->info = _player_button_add(parent, obj, wd->layout, "media_player/info", _info); + wd->next = _player_button_add(parent, obj, wd->layout, "media_player/next", _next); + wd->pause = _player_button_add(parent, obj, wd->layout, "media_player/pause", _pause); + wd->play = _player_button_add(parent, obj, wd->layout, "media_player/play", _play); + wd->prev = _player_button_add(parent, obj, wd->layout, "media_player/prev", _prev); + wd->rewind = _player_button_add(parent, obj, wd->layout, "media_player/rewind", _rewind); + wd->stop = _player_button_add(parent, obj, wd->layout, "media_player/stop", _stop); + + wd->slider = elm_slider_add(parent); + elm_widget_sub_object_add(obj, wd->slider); + elm_slider_indicator_format_function_set(wd->slider, _double_to_time, _value_free); + elm_slider_units_format_function_set(wd->slider, _double_to_time, _value_free); + elm_slider_min_max_set(wd->slider, 0, 0); + elm_slider_value_set(wd->slider, 0); + elm_object_disabled_set(wd->slider, EINA_TRUE); + evas_object_size_hint_align_set(wd->slider, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(wd->slider, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + edje_object_part_swallow(wd->layout, "media_player/slider", wd->slider); + evas_object_smart_callback_add(wd->slider, "changed", _update_position, obj); + + wd->emotion = NULL; + wd->video = NULL; + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _sizing_eval(obj); + + return obj; +#else + (void) parent; + return NULL; +#endif +} diff --git a/libraries/elementary/src/lib/elc_popup.c b/libraries/elementary/src/lib/elc_popup.c new file mode 100644 index 0000000..1013f49 --- /dev/null +++ b/libraries/elementary/src/lib/elc_popup.c @@ -0,0 +1,1454 @@ +#include +#include "elm_priv.h" + +#define ELM_POPUP_ACTION_BUTTON_MAX 3 +typedef struct _Widget_Data Widget_Data; +typedef struct _Elm_Popup_Content_Item Elm_Popup_Content_Item; +typedef struct _Action_Area_Data Action_Area_Data; + +struct _Widget_Data +{ + Evas_Object *base; + Evas_Object *notify; + Evas_Object *title_icon; + Evas_Object *content_area; + Evas_Object *content_text_obj; + Evas_Object *action_area; + Evas_Object *box; + Evas_Object *scr; + Evas_Object *content; + Eina_List *items; + const char *title_text; + Action_Area_Data *buttons[ELM_POPUP_ACTION_BUTTON_MAX]; + Elm_Wrap_Type content_text_wrap_type; + unsigned int button_count; + Evas_Coord max_sc_w; + Evas_Coord max_sc_h; + Eina_Bool scr_size_recalc:1; +}; + +struct _Elm_Popup_Content_Item +{ + Elm_Widget_Item base; + const char *label; + Evas_Object *icon; + Evas_Smart_Cb func; + Eina_Bool disabled:1; +}; + +struct _Action_Area_Data +{ + Evas_Object *obj; + Evas_Object *btn; + Eina_Bool delete_me; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); +static void _text_set_hook(Evas_Object *obj, const char *part, + const char *label); +static const char *_text_get_hook(const Evas_Object *obj, + const char *part); +static void _content_set_hook(Evas_Object *obj, const char *part, + Evas_Object *content); +static Evas_Object *_content_get_hook(Evas_Object *obj, + const char *part); +static Evas_Object *_content_unset_hook(Evas_Object *obj, + const char *part); +static void _item_text_set_hook(Elm_Object_Item *it, const char *part, + const char *label); +static const char *_item_text_get_hook(const Elm_Object_Item *it, + const char *part); +static void _item_content_set_hook(Elm_Object_Item *it, const char *part, + Evas_Object *content); +static Evas_Object *_item_content_unset_hook(const Elm_Object_Item *it, + const char *part); +static Evas_Object *_item_content_get_hook(const Elm_Object_Item *it, + const char *part); +static void _item_disable_hook(Elm_Object_Item *it); +static void _item_del_pre_hook(Elm_Object_Item *it); +static void _item_signal_emit_hook(Elm_Object_Item *it, const char *emission, + const char *source); +static void _sizing_eval(Evas_Object *obj); +static void _block_clicked_cb(void *data, Evas_Object *obj, void *event_info); +static void _notify_resize(void *data, Evas *e, Evas_Object *obj, + void *event_info); +static void _scroller_resize(void *data, Evas *e, Evas_Object *obj, + void *event_info); +static void _timeout(void *data, Evas_Object *obj , void *event_info); +static void _sub_del(void *data, Evas_Object *obj, void *event_info); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); +static void _restack(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _layout_change_cb(void *data, Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, + const char *source __UNUSED__); +static void _item_new(Elm_Popup_Content_Item *item); +static void _remove_items(Widget_Data *wd); +static void _list_new(Evas_Object *obj); +static void _list_del(Widget_Data *wd); +static void _item_sizing_eval(Elm_Popup_Content_Item *item); +static void _item_select_cb(void *data, Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, + const char *source __UNUSED__); +static void _scroller_size_calc(Evas_Object *obj); +static void _action_button_set(Evas_Object *obj, Evas_Object *btn, + unsigned int idx); +static Evas_Object *_action_button_get(Evas_Object *obj, unsigned int idx); +static Evas_Object *_action_button_unset(Evas_Object *obj, unsigned int idx); +static void _button_remove(Evas_Object *obj, Evas_Object *content, + Eina_Bool delete); +static void _popup_show(void *data, Evas *e, Evas_Object *obj, + void *event_info); +static void _popup_hide(void *data, Evas *e, Evas_Object *obj, + void *event_info); +static const char SIG_BLOCK_CLICKED[] = "block,clicked"; +static const char SIG_TIMEOUT[] = "timeout"; +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_BLOCK_CLICKED, ""}, + {SIG_TIMEOUT, ""}, + {NULL, NULL} +}; + +#define ELM_POPUP_CONTENT_ITEM_CHECK_RETURN(it, ...) \ + ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, __VA_ARGS__); \ + ELM_CHECK_WIDTYPE(WIDGET(item), widtype) __VA_ARGS__; + +static void +_layout_set(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + if ((!(wd->title_text)) && (!(wd->title_icon))) + elm_object_signal_emit(wd->base, "elm,state,title_area,hidden", "elm"); + else + elm_object_signal_emit(wd->base, "elm,state,title_area,visible", "elm"); + if (wd->button_count) + elm_object_signal_emit(wd->base, "elm,state,action_area,visible", "elm"); + else + elm_object_signal_emit(wd->base, "elm,state,action_area,hidden", "elm"); +} + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + free(wd); +} + +static void +_del_pre_hook(Evas_Object *obj) +{ + unsigned int i; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + evas_object_smart_callback_del(wd->notify, "block,clicked", + _block_clicked_cb); + evas_object_smart_callback_del(wd->notify, "timeout", _timeout); + evas_object_event_callback_del(wd->notify, EVAS_CALLBACK_RESIZE, + _notify_resize); + evas_object_event_callback_del(obj, EVAS_CALLBACK_SHOW, _popup_show); + wd->button_count = 0; + for (i = 0; i < ELM_POPUP_ACTION_BUTTON_MAX; i++) + if (wd->buttons[i]) + { + evas_object_del(wd->buttons[i]->btn); + free(wd->buttons[i]); + wd->buttons[i] = NULL; + } + if (wd->items) + { + _remove_items(wd); + _list_del(wd); + } +} + +static void +_theme_hook(Evas_Object *obj) +{ + Eina_List *elist; + Elm_Popup_Content_Item *item; + char buf[128]; + unsigned int i = 0; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + elm_layout_theme_set(wd->base, "popup", "base", elm_widget_style_get(obj)); + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + if (wd->button_count) + { + snprintf(buf, sizeof(buf), "buttons%u", wd->button_count); + elm_layout_theme_set(wd->action_area, "popup", buf, + elm_widget_style_get(obj)); + for (i = 0; i < ELM_POPUP_ACTION_BUTTON_MAX; i++) + { + if (!wd->buttons[i]) continue; + elm_object_style_set(wd->buttons[i]->btn, buf); + } + } + elm_layout_theme_set(wd->content_area, "popup", "content", + elm_widget_style_get(obj)); + if (wd->content_text_obj) + { + snprintf(buf, sizeof(buf), "popup/%s", elm_widget_style_get(obj)); + elm_object_style_set(wd->content_text_obj, buf); + } + else if (wd->items) + { + EINA_LIST_FOREACH(wd->items, elist, item) + { + _elm_theme_object_set(obj, VIEW(item), "popup", + "item", elm_widget_style_get(obj)); + if (item->label) + { + edje_object_part_text_escaped_set(VIEW(item), "elm.text", + item->label); + edje_object_signal_emit(VIEW(item), + "elm,state,item,text,visible", "elm"); + } + if (item->icon) + edje_object_signal_emit(VIEW(item), + "elm,state,item,icon,visible", "elm"); + if (item->disabled) + edje_object_signal_emit(VIEW(item), + "elm,state,item,disabled", "elm"); + evas_object_show(VIEW(item)); + edje_object_message_signal_process(VIEW(item)); + } + _scroller_size_calc(obj); + } + if (wd->title_text) + { + elm_object_part_text_set(wd->base, "elm.text.title", wd->title_text); + elm_object_signal_emit(wd->base, "elm,state,title,text,visible", "elm"); + } + if (wd->title_icon) + elm_object_signal_emit(wd->base, "elm,state,title,icon,visible", "elm"); + _layout_set(obj); + edje_object_message_signal_process(elm_layout_edje_get(wd->base)); + _sizing_eval(obj); +} + +static void +_item_sizing_eval(Elm_Popup_Content_Item *item) +{ + Evas_Coord min_w = -1, min_h = -1, max_w = -1, max_h = -1; + + edje_object_size_min_restricted_calc(VIEW(item), &min_w, &min_h, min_w, + min_h); + evas_object_size_hint_min_set(VIEW(item), min_w, min_h); + evas_object_size_hint_max_set(VIEW(item), max_w, max_h); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Eina_List *elist; + Elm_Popup_Content_Item *item; + Evas_Coord w_box = 0, h_box = 0; + Evas_Coord minw_box = 0, minh_box = 0; + Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + if (wd->items) + { + EINA_LIST_FOREACH(wd->items, elist, item) + { + _item_sizing_eval(item); + evas_object_size_hint_min_get(VIEW(item), &minw_box, + &minh_box); + if (minw_box > w_box) + w_box = minw_box; + if (minh_box != -1) + h_box += minh_box; + } + evas_object_size_hint_min_set(wd->box, w_box, h_box); + evas_object_size_hint_min_set(wd->scr, w_box, MIN(h_box, wd->max_sc_h)); + evas_object_size_hint_max_set(wd->scr, w_box, wd->max_sc_h); + evas_object_smart_calculate(wd->scr); + } + edje_object_size_min_calc(elm_layout_edje_get(wd->base), &minw, &minh); + evas_object_size_hint_min_set(wd->base, minw, minh); + evas_object_size_hint_max_set(wd->base, maxw, maxh); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, maxw, maxh); + elm_layout_sizing_eval(wd->base); +} + +static void +_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + _sizing_eval(data); +} + +static void +_sub_del(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Popup_Content_Item *item; + unsigned int i; + Evas_Object *sub = event_info; + Widget_Data *wd = elm_widget_data_get(data); + + if (!wd) return; + if (obj == data) + { + if ((item = evas_object_data_get(sub, "_popup_content_item")) != NULL) + { + if (sub == item->icon) + { + edje_object_part_unswallow(VIEW(item), sub); + edje_object_signal_emit(VIEW(item), + "elm,state,item,icon,hidden", "elm"); + item->icon = NULL; + } + } + } + else if (obj == wd->content_area) + { + if (sub == wd->content) + { + wd->content = NULL; + elm_object_part_content_unset(wd->base, "elm.swallow.content"); + _sizing_eval(data); + } + else if (sub == wd->content_text_obj) + { + wd->content_text_obj = NULL; + elm_object_part_content_unset(wd->base, "elm.swallow.content"); + _sizing_eval(data); + } + else if (sub == wd->scr) + { + wd->scr = NULL; + wd->box = NULL; + elm_object_part_content_unset(wd->base, "elm.swallow.content"); + _sizing_eval(data); + } + } + else if (obj == wd->action_area) + { + for (i = 0; i < ELM_POPUP_ACTION_BUTTON_MAX; i++) + { + if (wd->buttons[i] && sub == wd->buttons[i]->btn && + wd->buttons[i]->delete_me == EINA_TRUE) + { + _button_remove(data, sub, EINA_FALSE); + break; + } + } + } + else if (obj == wd->base) + { + if (sub == wd->title_icon) + { + elm_object_signal_emit(wd->base, "elm,state,title,icon,hidden", + "elm"); + edje_object_message_signal_process(wd->base); + wd->title_icon = NULL; + } + } +} + +static void +_block_clicked_cb(void *data, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + + if (!wd) return; + evas_object_smart_callback_call(data, SIG_BLOCK_CLICKED, NULL); +} + +static void +_timeout(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_hide(data); + evas_object_smart_callback_call(data, SIG_TIMEOUT, NULL); +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Eina_List *elist; + Elm_Popup_Content_Item *item; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + elm_object_mirrored_set(wd->notify, rtl); + if (wd->items) + EINA_LIST_FOREACH(wd->items, elist, item) + edje_object_mirrored_set(VIEW(item), rtl); +} + +static void +_layout_change_cb(void *data, Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, + const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get((Evas_Object*)data); + + if (!wd) return; + if (wd->base) + elm_layout_sizing_eval(wd->base); +} + +static void +_restack(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, + void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + evas_object_layer_set(wd->notify, evas_object_layer_get(obj)); +} + +static void +_scroller_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, + void *event_info __UNUSED__) +{ + Evas_Coord w, h; + Widget_Data *wd = elm_widget_data_get(data); + + if (!wd || wd->scr_size_recalc) return; + evas_object_geometry_get(obj, NULL, NULL, &w, &h); + if (w && h) + { + if ((w <= wd->max_sc_w) && (h <= wd->max_sc_h)) + { + _sizing_eval(data); + wd->scr_size_recalc = EINA_TRUE; + return; + } + } + if (wd->max_sc_w < w) + wd->max_sc_w = w; + if (wd->max_sc_h < h) + wd->max_sc_h = h; + _sizing_eval(data); +} + +static void +_list_new(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + //Scroller + wd->scr = elm_scroller_add(obj); + elm_scroller_bounce_set(wd->scr, EINA_FALSE, EINA_TRUE); + elm_object_content_set(wd->scr, wd->box); + evas_object_size_hint_weight_set(wd->scr, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(wd->scr, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_RESIZE, + _scroller_resize, obj); + evas_object_event_callback_add(wd->scr, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + elm_object_part_content_set(wd->base, "elm.swallow.content", wd->scr); + + //Box + wd->box = elm_box_add(obj); + evas_object_size_hint_weight_set(wd->box, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(wd->box, EVAS_HINT_FILL, EVAS_HINT_FILL); + + elm_object_content_set(wd->scr, wd->box); +} + +static void +_list_del(Widget_Data *wd) +{ + if (!wd->scr) return; + elm_object_part_content_unset(wd->base, "elm.swallow.content"); + evas_object_event_callback_del(wd->scr, EVAS_CALLBACK_RESIZE, + _scroller_resize); + evas_object_event_callback_del(wd->scr, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints); + evas_object_del(wd->scr); + wd->scr = NULL; + wd->box = NULL; +} + +static void +_scroller_size_calc(Evas_Object *obj) +{ + Evas_Coord h; + Evas_Coord h_title = 0; + Evas_Coord h_action_area = 0; + Evas_Coord h_content = 0; + const char *action_area_height; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd || !wd->items) return; + wd->scr_size_recalc = EINA_FALSE; + wd->max_sc_h = -1; + wd->max_sc_w = -1; + evas_object_geometry_get(wd->notify, NULL, NULL, NULL, &h); + if (wd->title_text || wd->title_icon) + edje_object_part_geometry_get(elm_layout_edje_get(wd->base), + "elm.bg.title", NULL, NULL, NULL, &h_title); + if (wd->button_count) + { + action_area_height = edje_object_data_get( + elm_layout_edje_get(wd->action_area), "action_area_height"); + if (action_area_height) h_action_area = (int)(atoi(action_area_height) + * _elm_config->scale * elm_object_scale_get(obj)); + } + h_content = h - (h_title + h_action_area); + wd->max_sc_h = h_content; +} + +static void +_item_select_cb(void *data, Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Elm_Popup_Content_Item *item = data; + + if (!item || item->disabled) return; + if (item->func) + item->func((void*)item->base.data, WIDGET(item), data); +} + +static void +_item_new(Elm_Popup_Content_Item *item) +{ + Widget_Data *wd = elm_widget_data_get(WIDGET(item)); + + if (!wd) return; + elm_widget_item_text_set_hook_set(item, _item_text_set_hook); + elm_widget_item_text_get_hook_set(item, _item_text_get_hook); + elm_widget_item_content_set_hook_set(item, _item_content_set_hook); + elm_widget_item_content_get_hook_set(item, _item_content_get_hook); + elm_widget_item_content_unset_hook_set(item, _item_content_unset_hook); + elm_widget_item_disable_hook_set(item, _item_disable_hook); + elm_widget_item_del_pre_hook_set(item, _item_del_pre_hook); + elm_widget_item_signal_emit_hook_set(item, _item_signal_emit_hook); + VIEW(item) = edje_object_add(evas_object_evas_get(wd->base)); + _elm_theme_object_set(WIDGET(item), VIEW(item), "popup", "item", + elm_widget_style_get(WIDGET(item))); + edje_object_mirrored_set(VIEW(item), elm_widget_mirrored_get(WIDGET(item))); + edje_object_signal_callback_add(VIEW(item), "elm,action,click", "", + _item_select_cb, item); + evas_object_size_hint_align_set(VIEW(item), EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_show(VIEW(item)); +} + +static void +_remove_items(Widget_Data *wd) +{ + Eina_List *elist; + Elm_Popup_Content_Item *item; + + if (!wd->items) return; + EINA_LIST_FOREACH(wd->items, elist, item) + { + if (item->label) + eina_stringshare_del(item->label); + if (item->icon) + { + evas_object_del(item->icon); + item->icon = NULL; + } + evas_object_del(VIEW(item)); + wd->items = eina_list_remove(wd->items, item); + free(item); + } + wd->items = NULL; +} + +static void +_notify_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + + if (wd->items) + _scroller_size_calc(data); + _sizing_eval(data); +} + +static void +_title_text_set(Evas_Object *obj, const char *text) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Eina_Bool title_visibility_old, title_visibility_current; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + if (wd->title_text == text) return; + title_visibility_old = (wd->title_text) || (wd->title_icon); + eina_stringshare_replace(&wd->title_text, text); + elm_object_part_text_set(wd->base, "elm.text.title", text); + if (wd->title_text) + elm_object_signal_emit(wd->base, "elm,state,title,text,visible", "elm"); + else + elm_object_signal_emit(wd->base, "elm,state,title,text,hidden", "elm"); + title_visibility_current = (wd->title_text) || (wd->title_icon); + if (title_visibility_old != title_visibility_current) + _layout_set(obj); + edje_object_message_signal_process(wd->base); + _sizing_eval(obj); +} + +static void +_content_text_set(Evas_Object *obj, const char *text) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Evas_Object *prev_content; + char buf[128]; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + if (wd->items) + { + _remove_items(wd); + _list_del(wd); + } + prev_content = elm_object_part_content_get(wd->content_area, + "elm.swallow.content"); + if (prev_content) + evas_object_del(prev_content); + if (text) + { + elm_object_part_content_set(wd->base, "elm.swallow.content", + wd->content_area); + wd->content_text_obj = elm_label_add(obj); + snprintf(buf, sizeof(buf), "popup/%s", + elm_widget_style_get(obj)); + elm_object_style_set(wd->content_text_obj, buf); + elm_label_line_wrap_set(wd->content_text_obj, + wd->content_text_wrap_type); + elm_object_text_set(wd->content_text_obj, text); + evas_object_size_hint_weight_set(wd->content_text_obj, EVAS_HINT_EXPAND, + 0.0); + evas_object_size_hint_align_set(wd->content_text_obj, EVAS_HINT_FILL, + EVAS_HINT_FILL); + elm_object_part_content_set(wd->content_area, "elm.swallow.content", + wd->content_text_obj); + } + _sizing_eval(obj); +} + +static void +_text_set_hook(Evas_Object *obj, const char *part, + const char *label) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + if (!part || !strcmp(part, "default")) + _content_text_set(obj, label); + else if (!strcmp(part, "title,text")) + _title_text_set(obj, label); + else + WRN("The part name is invalid! : popup=%p", obj); +} + +static const char* +_title_text_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return NULL; + return wd->title_text; +} + +static const char* +_content_text_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + const char *str = NULL; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return NULL; + if (wd->content_text_obj) + str = elm_object_text_get(wd->content_text_obj); + return str; +} + +static const char * +_text_get_hook(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + const char *str = NULL; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return NULL; + if (!part || !strcmp(part, "default")) + str = _content_text_get(obj); + else if (!strcmp(part, "title,text")) + str = _title_text_get(obj); + else + WRN("The part name is invalid! : popup=%p", obj); + return str; +} + +static void +_title_icon_set(Evas_Object *obj, Evas_Object *icon) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Eina_Bool title_visibility_old, title_visibility_current; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + if (wd->title_icon == icon) return; + title_visibility_old = (wd->title_text) || (wd->title_icon); + if (wd->title_icon) evas_object_del(wd->title_icon); + + wd->title_icon = icon; + title_visibility_current = (wd->title_text) || (wd->title_icon); + elm_object_part_content_set(wd->base, "elm.swallow.title.icon", + wd->title_icon); + if (wd->title_icon) + elm_object_signal_emit(wd->base, "elm,state,title,icon,visible", "elm"); + if (title_visibility_old != title_visibility_current) _layout_set(obj); + edje_object_message_signal_process(wd->base); + _sizing_eval(obj); +} + +static void +_content_set(Evas_Object *obj, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Evas_Object *prev_content; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + if (wd->content && wd->content == content) return; + if (wd->items) + { + _remove_items(wd); + _list_del(wd); + } + prev_content = elm_object_part_content_get(wd->content_area, + "elm.swallow.content"); + if (prev_content) + evas_object_del(prev_content); + wd->content = content; + if (content) + { + elm_object_part_content_set(wd->base, "elm.swallow.content", + wd->content_area); + elm_object_part_content_set(wd->content_area, "elm.swallow.content", + content); + evas_object_show(content); + } + _sizing_eval(obj); +} + +static void +_button_remove(Evas_Object *obj, Evas_Object *content, Eina_Bool delete) +{ + unsigned int i = 0, position = 0; + char buf[128]; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd->button_count) return; + for (i = 0; i < ELM_POPUP_ACTION_BUTTON_MAX; i++) + { + if (wd->buttons[i]) + { + position++; + wd->buttons[i]->delete_me = EINA_FALSE; + if (wd->buttons[i]->btn == content) + { + snprintf(buf, sizeof(buf), "actionbtn%u", position); + elm_object_part_content_unset(wd->action_area, buf); + evas_object_hide(content); + if (delete) evas_object_del(content); + free(wd->buttons[i]); + wd->buttons[i] = NULL; + wd->button_count -= 1; + } + } + } + position = 0; + for (i = 0; i < ELM_POPUP_ACTION_BUTTON_MAX; i++) + { + if (!wd->buttons[i]) continue; + position++; + snprintf(buf, sizeof(buf), "actionbtn%u", position); + elm_object_part_content_unset(wd->action_area, buf); + elm_object_part_content_set(wd->action_area, buf, + wd->buttons[i]->btn); + evas_object_show(wd->buttons[i]->btn); + wd->buttons[i]->delete_me = EINA_TRUE; + } + if (!wd->button_count) + { + _layout_set(obj); + elm_object_part_content_unset(wd->base, "elm.swallow.action_area"); + evas_object_hide(wd->action_area); + edje_object_message_signal_process(elm_layout_edje_get(wd->base)); + } + else + { + snprintf(buf, sizeof(buf), "buttons%u", wd->button_count); + elm_layout_theme_set(wd->action_area, "popup", buf, + elm_widget_style_get(obj)); + } +} + +static void +_action_button_set(Evas_Object *obj, Evas_Object *btn, unsigned int idx) +{ + Action_Area_Data *adata; + char buf[128]; + unsigned int num = idx - 1, i = 0, position = 0; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + if (num >= ELM_POPUP_ACTION_BUTTON_MAX) return; + if (wd->buttons[num]) + _button_remove(obj, wd->buttons[num]->btn, EINA_TRUE); + if (btn) + { + wd->button_count++; + snprintf(buf, sizeof(buf), "buttons%u", wd->button_count); + elm_layout_theme_set(wd->action_area, "popup", buf, + elm_widget_style_get(obj)); + adata = ELM_NEW(Action_Area_Data); + adata->obj = obj; + adata->btn = btn; + wd->buttons[num] = adata; + /* Adding delete_me state inside action data as unset calls _sub_del + too and before setting a new content, the previous one needs to + be unset in order to avoid unwanted deletion. This way rearrangement + of buttons can be achieved in action area. + */ + for (i = 0; i < ELM_POPUP_ACTION_BUTTON_MAX; i++) + if (wd->buttons[i]) + wd->buttons[i]->delete_me = EINA_FALSE; + for (i = 0; i < ELM_POPUP_ACTION_BUTTON_MAX; i++) + { + if (!wd->buttons[i]) continue; + position++; + snprintf(buf, sizeof(buf), "actionbtn%u", position); + elm_object_part_content_unset(wd->action_area, buf); + elm_object_part_content_set(wd->action_area, buf, + wd->buttons[i]->btn); + evas_object_show(wd->buttons[i]->btn); + /* Setting delete_me to TRUE in order to let _sub_del handle it + if deleted externally and update the buttons array after freeing + action data allocated earlier. + */ + wd->buttons[i]->delete_me = EINA_TRUE; + } + elm_object_part_content_set(wd->base, "elm.swallow.action_area", + wd->action_area); + evas_object_show(wd->action_area); + if (wd->button_count == 1) + _layout_set(obj); + edje_object_message_signal_process(wd->base); + if (wd->items) + _scroller_size_calc(obj); + _sizing_eval(obj); + } +} + +static void +_content_set_hook(Evas_Object *obj, const char *part, + Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + char buff[3]; + unsigned int i; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + if (!part || !strcmp(part, "default")) + _content_set(obj, content); + else if (!strcmp(part, "title,icon")) + _title_icon_set(obj, content); + else if (!strncmp(part, "button", 6)) + { + part += 6; + for (i = 0; i < ELM_POPUP_ACTION_BUTTON_MAX; i++) + { + snprintf(buff, sizeof(buff), "%u", i+1); + if (!strncmp(part, buff, sizeof(buff))) + { + _action_button_set(obj, content, i+1); + break; + } + } + } + else + WRN("The part name is invalid! : popup=%p", obj); +} + +static Evas_Object * +_title_icon_get(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return NULL; + return wd->title_icon; +} + +static Evas_Object * +_content_get(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return NULL; + return wd->content; +} + +static Evas_Object * +_action_button_get(Evas_Object *obj, unsigned int idx) +{ + unsigned int num = idx - 1; + Evas_Object *button = NULL; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd || !wd->button_count) return NULL; + if (wd->buttons[num]) + button = wd->buttons[num]->btn; + return button; +} + +static Evas_Object * +_content_get_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Evas_Object *content = NULL; + char buff[3]; + unsigned int i; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return NULL; + if (!part || !strcmp(part, "default")) + content = _content_get(obj); + else if (!strcmp(part, "title,text")) + content = _title_icon_get(obj); + else if (!strncmp(part, "button", 6)) + { + part += 6; + for (i = 0; i < ELM_POPUP_ACTION_BUTTON_MAX; i++) + { + snprintf(buff, sizeof(buff), "%u", i+1); + if (!strncmp(part, buff, sizeof(buff))) + { + content = _action_button_get(obj, i+1); + break; + } + } + } + else + WRN("The part name is invalid! : popup=%p", obj); + return content; +} + +static Evas_Object * +_content_unset(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Evas_Object *content; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd || !wd->content) return NULL; + content = elm_object_part_content_unset(wd->content_area, + "elm.swallow.content"); + wd->content = NULL; + _sizing_eval(obj); + return content; +} + +static Evas_Object * +_title_icon_unset(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Evas_Object *icon; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd || !wd->title_icon) return NULL; + icon = elm_object_part_content_unset(wd->base, "elm.swallow.title.icon"); + wd->title_icon = NULL; + return icon; +} + +static Evas_Object * +_action_button_unset(Evas_Object *obj, unsigned int idx) +{ + unsigned int num = idx -1; + Evas_Object *button = NULL; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return NULL; + if ((!wd->button_count) || (num >= ELM_POPUP_ACTION_BUTTON_MAX)) + return NULL; + + if (wd->buttons[num]) + { + button = wd->buttons[num]->btn; + _button_remove(obj, button, EINA_FALSE); + } + return button; +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Evas_Object *content = NULL; + char buff[3]; + unsigned int i; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return NULL; + if (!part || !strcmp(part, "default")) + content = _content_unset(obj); + else if (!strcmp(part, "title,icon")) + content = _title_icon_unset(obj); + else if (!strncmp(part, "button", 6)) + { + part += 6; + for (i = 0; i < ELM_POPUP_ACTION_BUTTON_MAX; i++) + { + snprintf(buff, sizeof(buff), "%u", i+1); + if (!strncmp(part, buff, sizeof(buff))) + { + content = _action_button_unset(obj, i+1); + break; + } + } + } + else + WRN("The part name is invalid! : popup=%p", obj); + return content; +} + +static Eina_Bool +_focus_next_hook(const Evas_Object *obj, + Elm_Focus_Direction dir, + Evas_Object **next) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) + return EINA_FALSE; + return elm_widget_focus_next_get(wd->notify, dir, next); +} + +static void +_item_text_set(Elm_Popup_Content_Item *item, const char *label) +{ + if (!eina_stringshare_replace(&item->label, label)) return; + edje_object_part_text_escaped_set(VIEW(item), "elm.text", label); + if (item->label) + edje_object_signal_emit(VIEW(item), + "elm,state,item,text,visible", "elm"); + else + edje_object_signal_emit(VIEW(item), + "elm,state,item,text,hidden", "elm"); + edje_object_message_signal_process(VIEW(item)); +} + +static void +_item_text_set_hook(Elm_Object_Item *it, const char *part, const char *label) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Popup_Content_Item *item = (Elm_Popup_Content_Item *)it; + + if ((!part) || (!strcmp(part, "default"))) + { + _item_text_set(item, label); + return; + } + WRN("The part name is invalid! : popup=%p", WIDGET(item)); +} + +static const char * +_item_text_get_hook(const Elm_Object_Item *it, const char *part) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + Elm_Popup_Content_Item *item = (Elm_Popup_Content_Item *)it; + + if ((!part) || (!strcmp(part, "default"))) + return item->label; + WRN("The part name is invalid! : popup=%p", WIDGET(item)); + return NULL; +} + +static void +_item_icon_set(Elm_Popup_Content_Item *item, Evas_Object *icon) +{ + if (item->icon == icon) return; + if (item->icon) + { + evas_object_data_del(item->icon, "_popup_content_item"); + evas_object_del(item->icon); + } + item->icon = icon; + if (item->icon) + { + elm_widget_sub_object_add(WIDGET(item), item->icon); + evas_object_data_set(item->icon, "_popup_content_item", item); + edje_object_part_swallow(VIEW(item), "elm.swallow.content", + item->icon); + edje_object_signal_emit(VIEW(item), + "elm,state,item,icon,visible", "elm"); + } + else + edje_object_signal_emit(VIEW(item), + "elm,state,item,icon,hidden", "elm"); + edje_object_message_signal_process(item->base.view); +} + +static void +_item_content_set_hook(Elm_Object_Item *it, const char *part, + Evas_Object *content) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Popup_Content_Item *item = (Elm_Popup_Content_Item *)it; + + if ((!(part)) || (!strcmp(part, "default"))) + _item_icon_set(item, content); + else + WRN("The part name is invalid! : popup=%p", WIDGET(item)); +} + +static Evas_Object * +_item_content_get_hook(const Elm_Object_Item *it, + const char *part) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + Elm_Popup_Content_Item *item = (Elm_Popup_Content_Item *)it; + + if ((!(part)) || (!strcmp(part, "default"))) + return item->icon; + WRN("The part name is invalid! : popup=%p", WIDGET(item)); + return NULL; +} + +static Evas_Object * +_item_icon_unset(Elm_Popup_Content_Item *item) +{ + Evas_Object *icon = item->icon; + + if (!item->icon) return NULL; + elm_widget_sub_object_del(WIDGET(item), icon); + evas_object_data_del(icon, "_popup_content_item"); + edje_object_part_unswallow(item->base.view, icon); + edje_object_signal_emit(VIEW(item), + "elm,state,item,icon,hidden", "elm"); + item->icon = NULL; + return icon; +} + +static Evas_Object * +_item_content_unset_hook(const Elm_Object_Item *it, + const char *part) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + Evas_Object *content = NULL; + Elm_Popup_Content_Item *item = (Elm_Popup_Content_Item *)it; + + if ((!(part)) || (!strcmp(part, "default"))) + content = _item_icon_unset(item); + else + WRN("The part name is invalid! : popup=%p", WIDGET(item)); + return content; +} + +static void +_item_disable_hook(Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Popup_Content_Item *item = (Elm_Popup_Content_Item *)it; + Widget_Data *wd = elm_widget_data_get(WIDGET(item)); + + if (!wd) return; + if (elm_widget_item_disabled_get(it)) + edje_object_signal_emit(VIEW(item), "elm,state,item,disabled", "elm"); + else + edje_object_signal_emit(VIEW(item), "elm,state,item,enabled", "elm"); +} + +static void +_item_del_pre_hook(Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Popup_Content_Item *item = (Elm_Popup_Content_Item *)it; + Widget_Data *wd = elm_widget_data_get(WIDGET(item)); + + if (!wd) return; + if (item->icon) + evas_object_del(item->icon); + eina_stringshare_del(item->label); + wd->items = eina_list_remove(wd->items, item); + if (!eina_list_count(wd->items)) + { + wd->items = NULL; + _list_del(wd); + } +} + +static void +_item_signal_emit_hook(Elm_Object_Item *it, const char *emission, + const char *source) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Popup_Content_Item *item = (Elm_Popup_Content_Item *)it; + + edje_object_signal_emit(VIEW(item), emission, source); +} + +static void +_popup_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, + void *event_info __UNUSED__) +{ + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + evas_object_show(wd->notify); +} + +static void +_popup_hide(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, + void *event_info __UNUSED__) +{ + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + evas_object_hide(wd->notify); +} + +EAPI Evas_Object * +elm_popup_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + int i = 0; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + ELM_SET_WIDTYPE(widtype, "popup"); + elm_widget_type_set(obj, widtype); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_text_set_hook_set(obj, _text_set_hook); + elm_widget_text_get_hook_set(obj, _text_get_hook); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj,_content_unset_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); + elm_widget_focus_next_hook_set(obj, _focus_next_hook); + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + wd->notify = elm_notify_add(obj); + elm_notify_parent_set(wd->notify, parent); + elm_notify_orient_set(wd->notify, ELM_NOTIFY_ORIENT_CENTER); + elm_notify_allow_events_set(wd->notify, EINA_FALSE); + evas_object_size_hint_weight_set(wd->notify, + EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(wd->notify, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_style_set(wd->notify, "popup"); + + evas_object_event_callback_add(wd->notify, EVAS_CALLBACK_RESIZE, + _notify_resize, obj); + evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _popup_show, + NULL); + evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _popup_hide, + NULL); + evas_object_event_callback_add(obj, EVAS_CALLBACK_RESTACK, _restack, NULL); + wd->base = elm_layout_add(obj); + evas_object_size_hint_weight_set(wd->base, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(wd->base, EVAS_HINT_FILL, EVAS_HINT_FILL); + + elm_layout_theme_set(wd->base, "popup", "base", elm_widget_style_get(obj)); + elm_object_content_set(wd->notify, wd->base); + + elm_object_signal_callback_add(wd->base, "elm,state,title_area,visible", + "elm", _layout_change_cb, obj); + elm_object_signal_callback_add(wd->base, "elm,state,title_area,hidden", + "elm", _layout_change_cb, obj); + elm_object_signal_callback_add(wd->base, "elm,state,action_area,visible", + "elm", _layout_change_cb, obj); + elm_object_signal_callback_add(wd->base, "elm,state,action_area,hidden", + "elm", _layout_change_cb, obj); + wd->content_area = elm_layout_add(obj); + elm_layout_theme_set(wd->content_area, "popup", "content", + elm_widget_style_get(obj)); + wd->action_area = elm_layout_add(obj); + evas_object_size_hint_weight_set(wd->action_area, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(wd->action_area, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_event_callback_add(wd->action_area, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + evas_object_event_callback_add(wd->content_area, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + evas_object_smart_callback_add(wd->base, "sub-object-del", + _sub_del, obj); + evas_object_smart_callback_add(wd->content_area, "sub-object-del", + _sub_del, obj); + evas_object_smart_callback_add(wd->action_area, "sub-object-del", + _sub_del, obj); + evas_object_smart_callback_add(obj, "sub-object-del", + _sub_del, obj); + + wd->content_text_wrap_type = ELM_WRAP_MIXED; + evas_object_smart_callback_add(wd->notify, "block,clicked", + _block_clicked_cb, obj); + evas_object_smart_callback_add(wd->notify, "timeout", _timeout, obj); + for (i = 0; i < ELM_POPUP_ACTION_BUTTON_MAX; i++) + wd->buttons[i] = NULL; + _layout_set(obj); + //TODO: To use scroller for description also + return obj; +} + +EAPI void +elm_popup_content_text_wrap_type_set(Evas_Object *obj, Elm_Wrap_Type wrap) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Evas_Object *content_text_obj; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + if (wd->content_text_wrap_type == ELM_WRAP_NONE) return; + //Need to wrap the content text, so not allowing ELM_WRAP_NONE + wd->content_text_wrap_type = wrap; + if (wd->content_text_obj) + { + content_text_obj = elm_object_part_content_get(wd->content_area, + "elm.swallow.content"); + elm_label_line_wrap_set(content_text_obj, wrap); + } +} + +EAPI Elm_Wrap_Type +elm_popup_content_text_wrap_type_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_WRAP_LAST; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return ELM_WRAP_LAST; + return wd->content_text_wrap_type; +} + +EAPI void +elm_popup_orient_set(Evas_Object *obj, Elm_Popup_Orient orient) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + if (orient >= ELM_POPUP_ORIENT_LAST) return; + elm_notify_orient_set(wd->notify, (Elm_Notify_Orient)orient); +} + +EAPI Elm_Popup_Orient +elm_popup_orient_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) -1; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return ELM_POPUP_ORIENT_LAST; + return (Elm_Popup_Orient)elm_notify_orient_get(wd->notify); +} + +EAPI void +elm_popup_timeout_set(Evas_Object *obj, double timeout) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + elm_notify_timeout_set(wd->notify, timeout); +} + +EAPI double +elm_popup_timeout_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0.0; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return 0.0; + return elm_notify_timeout_get(wd->notify); +} + +EAPI void +elm_popup_allow_events_set(Evas_Object *obj, Eina_Bool allow) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Eina_Bool allow_events = !!allow; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + elm_notify_allow_events_set(wd->notify, allow_events); +} + +EAPI Eina_Bool +elm_popup_allow_events_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return EINA_FALSE; + return elm_notify_allow_events_get(wd->notify); +} + +EAPI Elm_Object_Item * +elm_popup_item_append(Evas_Object *obj, const char *label, + Evas_Object *icon, Evas_Smart_Cb func, + const void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Evas_Object *prev_content; + Elm_Popup_Content_Item *item; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return NULL; + item = elm_widget_item_new(obj, Elm_Popup_Content_Item); + if (!item) return NULL; + if (wd->content || wd->content_text_obj) + { + prev_content = elm_object_part_content_get(wd->content_area, + "elm.swallow.content"); + if (prev_content) + evas_object_del(prev_content); + } + + //The first item is appended. + if (!wd->items) + _list_new(obj); + + item->func = func; + item->base.data = data; + + _item_new(item); + _item_icon_set(item, icon); + _item_text_set(item, label); + elm_box_pack_end(wd->box, VIEW(item)); + wd->items = eina_list_append(wd->items, item); + + _scroller_size_calc(obj); + _sizing_eval(obj); + return (Elm_Object_Item *)item; +} diff --git a/libraries/elementary/src/lib/elc_popup.h b/libraries/elementary/src/lib/elc_popup.h new file mode 100644 index 0000000..14687af --- /dev/null +++ b/libraries/elementary/src/lib/elc_popup.h @@ -0,0 +1,269 @@ +/** + * @defgroup Popup Popup + * @ingroup Elementary + * + * This widget is an enhancement of @ref Notify. + * In addition to Content area, there are two optional sections namely Title + * area and Action area. + * + * Popup Widget displays its content with a particular orientation in the parent + * area. This orientation can be one among top, center, bottom, left, top-left, + * top-right, bottom-left and bottom-right. + * Content part of Popup can be an Evas Object set by application or it can be + * Text set by application or set of items containing an icon and/or text. + * The content/item-list can be removed using elm_object_content_set with second + * parameter passed as NULL. + * + * Following figures shows the textual layouts of popup in which Title Area and + * Action area area are optional ones. + * Action area can have up to 3 buttons handled using elm_object common APIs + * mentioned below. If user wants to have more than 3 buttons then these buttons + * can be put inside the items of a list as content. + * User needs to handle the clicked signal of these action buttons if required. + * No event is processed by the widget automatically when clicked on these + * action buttons. + * + *
+ *
+ * |-------------------- |    |----------------- ---|    |----------------- ---|
+ * |     Title Area      |    |     Title Area      |    |     Title Area      |
+ * |Icon|    Text        |    |Icon|    Text        |    |Icon|    Text        |
+ * |------------------- -|    |---------------- ----|    |------------------ --|
+ * |       Item 1        |    |                     |    |                     |
+ * |------------------- -|    |                     |    |                     |
+ * |       Item 2        |    |                     |    |    Description      |
+ * |------------------ --|    |       Content       |    |                     |
+ * |       Item 3        |    |                     |    |                     |
+ * |------------------ --|    |                     |    |                     |
+ * |         .           |    |------------------ --|    |------------------- -|
+ * |         .           |    |     Action Area     |    |     Action Area     |
+ * |         .           |    | Btn1  |Btn2|. |Btn3 |    | Btn1  |Btn2|  |Btn3 |
+ * |------------------ --|    |------------------- -|    |------------------- -|
+ * |       Item N        |     Content Based Layout     Description based Layout
+ * |------------------ --|
+ * |     Action Area     |
+ * | Btn1  |Btn2|. |Btn3 |
+ * |------------------- -|
+ *    Item Based Layout
+ *
+ * 
+ * + * Timeout can be set on expiry of which popup instance hides and sends a smart + * signal "timeout" to the user. + * The visible region of popup is surrounded by a translucent region called + * Blocked Event area. + * By clicking on Blocked Event area, the signal "block,clicked" is sent to + * the application. This block event area can be avoided by using + * API elm_popup_allow_events_set. + * When gets hidden, popup does not get destroyed automatically, application + * should destroy the popup instance after use. + * To control the maximum height of the internal scroller for item, we use the + * height of the action area which is passed by theme based on the number of + * buttons currently set to popup. + * + * Signals that you can add callbacks for are: + * @li "timeout" - when ever popup is closed as a result of timeout. + * @li "block,clicked" - when ever user taps on Blocked Event area. + * + * Styles available for Popup + * @li "default" + * + * Default contents parts of the popup widget that you can use for are: + * @li "default" - The content of the popup + * @li "title,icon" - Title area's icon + * @li "button1" - 1st button of the action area + * @li "button2" - 2nd button of the action area + * @li "button3" - 3rd button of the action area + * + * Default text parts of the popup widget that you can use for are: + * @li "title,text" - This operates on Title area's label + * @li "default" - content-text set in the content area of the widget + * + * Default contents parts of the popup items that you can use for are: + * @li "default" -Item's icon + * + * Default text parts of the popup items that you can use for are: + * @li "default" - Item's label + * + * Supported elm_object common APIs. + * @li @ref elm_object_part_content_set + * @li @ref elm_object_part_content_get + * @li @ref elm_object_part_content_unset + * + * Supported elm_object_item common APIs. + * @li @ref elm_object_item_disabled_set + * @li @ref elm_object_item_disabled_get + * @li @ref elm_object_item_part_text_set + * @li @ref elm_object_item_part_text_get + * @li @ref elm_object_item_part_content_set + * @li @ref elm_object_item_part_content_get + * @li @ref elm_object_item_signal_emit + * @li @ref elm_object_item_del + * + * Here are some sample code to illustrate Popup usage: + * @li @ref popup_example_01_c + * @li @ref popup_example_02_c + * @li @ref popup_example_03_c + */ + +/** + * @brief Possible orient values for popup. + * + * These values should be used in conjunction to elm_popup_orient_set() to + * set the position in which the popup should appear(relative to its parent) + * and in conjunction with elm_popup_orient_get() to know where the popup + * is appearing. + * + * @ingroup Popup + */ +typedef enum +{ + ELM_POPUP_ORIENT_TOP = 0, /**< Popup should appear in the top of parent, default */ + ELM_POPUP_ORIENT_CENTER, /**< Popup should appear in the center of parent */ + ELM_POPUP_ORIENT_BOTTOM, /**< Popup should appear in the bottom of parent */ + ELM_POPUP_ORIENT_LEFT, /**< Popup should appear in the left of parent */ + ELM_POPUP_ORIENT_RIGHT, /**< Popup should appear in the right of parent */ + ELM_POPUP_ORIENT_TOP_LEFT, /**< Popup should appear in the top left of parent */ + ELM_POPUP_ORIENT_TOP_RIGHT, /**< Popup should appear in the top right of parent */ + ELM_POPUP_ORIENT_BOTTOM_LEFT, /**< Popup should appear in the bottom left of parent */ + ELM_POPUP_ORIENT_BOTTOM_RIGHT, /**< Notify should appear in the bottom right of parent */ + ELM_POPUP_ORIENT_LAST /**< Sentinel value, @b don't use */ + } Elm_Popup_Orient; + +/** + * @brief Adds a new Popup to the parent + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * @ingroup Popup + */ +EAPI Evas_Object *elm_popup_add(Evas_Object *parent) EINA_ARG_NONNULL(1); + +/** + * @brief Add a new item to a Popup object + * + * Both an item list and a content could not be set at the same time! + * once you add an item, the previous content will be removed. + * + * @param obj popup object + * @param icon Icon to be set on new item + * @param label The Label of the new item + * @param func Convenience function called when item selected + * @param data Data passed to @p func above + * @return A handle to the item added or @c NULL, on errors + * + * @ingroup Popup + * @warning When the first item is appended to popup object, any previous content + * of the content area is deleted. At a time, only one of content, content-text + * and item(s) can be there in a popup content area. + */ +EAPI Elm_Object_Item *elm_popup_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data) EINA_ARG_NONNULL(1); + +/** + * @brief Sets the wrapping type of content text packed in content + * area of popup object. + * + * @param obj The Popup object + * @param wrap wrapping type of type Elm_Wrap_Type + * + * @ingroup Popup + * @see elm_popup_content_text_wrap_type_get() + */ +EAPI void elm_popup_content_text_wrap_type_set(Evas_Object *obj, Elm_Wrap_Type wrap) EINA_ARG_NONNULL(1); + +/** + * @brief Returns the wrapping type of content text packed in content area of + * popup object. + * + * @param obj The Popup object + * @return wrap type of the content text + * + * @ingroup Popup + * @see elm_popup_content_text_wrap_type_set + */ +EAPI Elm_Wrap_Type elm_popup_content_text_wrap_type_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); + +/** + * @brief Sets the orientation of the popup in the parent region + * + * @param obj The popup object + * @param orient the orientation of the popup + * + * Sets the position in which popup will appear in its parent + * + * @ingroup Popup + * @see @ref Elm_Popup_Orient for possible values. + */ +EAPI void elm_popup_orient_set(Evas_Object *obj, Elm_Popup_Orient orient) EINA_ARG_NONNULL(1); + +/** + * @brief Returns the orientation of Popup + * + * @param obj The popup object + * @return the orientation of the popup + * + * @ingroup Popup + * @see elm_popup_orient_set() + * @see Elm_Popup_Orient + */ +EAPI Elm_Popup_Orient elm_popup_orient_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); + +/** + * @brief Sets a timeout to hide popup automatically + * + * @param obj The popup object + * @param timeout The timeout in seconds + * + * This function sets a timeout and starts the timer controlling when the + * popup is hidden. Since calling evas_object_show() on a popup restarts + * the timer controlling when it is hidden, setting this before the + * popup is shown will in effect mean starting the timer when the popup is + * shown. Smart signal "timeout" is called afterwards which can be handled + * if needed. + * + * @note Set a value <= 0.0 to disable a running timer. + * + * @note If the value > 0.0 and the popup is previously visible, the + * timer will be started with this value, canceling any running timer. + * @ingroup Popup + */ +EAPI void elm_popup_timeout_set(Evas_Object *obj, double timeout) EINA_ARG_NONNULL(1); + +/** + * @brief Returns the timeout value set to the popup (in seconds) + * + * @param obj The popup object + * @return the timeout value + * + * @ingroup Popup + * @see elm_popup_timeout_set() + */ +EAPI double elm_popup_timeout_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); + +/** + * @brief Sets whether events should be passed to by a click outside. + * + * @param obj The popup object + * @param allow EINA_TRUE Events are passed to lower objects, else not + * + * Enabling allow event will remove the Blocked event area and events will + * pass to the lower layer objects otherwise they are blocked. + * + * @ingroup Popup + * @see elm_popup_allow_events_get() + * @note The default value is EINA_FALSE. + */ +EAPI void elm_popup_allow_events_set(Evas_Object *obj, Eina_Bool allow); + +/** + * @brief Returns value indicating whether allow event is enabled or not + * + * @param obj The popup object + * @return EINA_FALSE if Blocked event area is present else EINA_TRUE + * + * @ingroup Popup + * @see elm_popup_allow_events_set() + * @note By default the Blocked event area is present + */ +EAPI Eina_Bool elm_popup_allow_events_get(const Evas_Object *obj); diff --git a/libraries/elementary/src/lib/elc_scrolled_entry.c b/libraries/elementary/src/lib/elc_scrolled_entry.c new file mode 100644 index 0000000..cbba45e --- /dev/null +++ b/libraries/elementary/src/lib/elc_scrolled_entry.c @@ -0,0 +1,193 @@ +#include +#include "elm_priv.h" +EINA_DEPRECATED EAPI Evas_Object * +elm_scrolled_entry_add(Evas_Object *parent) +{ + Evas_Object *obj; + obj = elm_entry_add(parent); + elm_entry_scrollable_set(obj, EINA_TRUE); + return obj; +} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_icon_set(Evas_Object *obj, Evas_Object *icon) +{elm_object_part_content_set(obj, "icon", icon);} +EINA_DEPRECATED EAPI Evas_Object * +elm_scrolled_entry_icon_get(const Evas_Object *obj) +{return elm_object_part_content_get(obj, "icon");} +EINA_DEPRECATED EAPI Evas_Object * +elm_scrolled_entry_icon_unset(Evas_Object *obj) +{return elm_object_part_content_unset(obj, "icon");} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_icon_visible_set(Evas_Object *obj, Eina_Bool setting) +{elm_entry_icon_visible_set(obj, setting);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_end_set(Evas_Object *obj, Evas_Object *end) +{elm_object_part_content_set(obj, "end", end);} +EINA_DEPRECATED EAPI Evas_Object * +elm_scrolled_entry_end_get(const Evas_Object *obj) +{return elm_object_part_content_get(obj, "end");} +EINA_DEPRECATED EAPI Evas_Object * +elm_scrolled_entry_end_unset(Evas_Object *obj) +{return elm_object_part_content_unset(obj, "end");} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_end_visible_set(Evas_Object *obj, Eina_Bool setting) +{elm_entry_end_visible_set(obj, setting);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_single_line_set(Evas_Object *obj, Eina_Bool single_line) +{elm_entry_single_line_set(obj, single_line);} +EINA_DEPRECATED EAPI Eina_Bool +elm_scrolled_entry_single_line_get(const Evas_Object *obj) +{return elm_entry_single_line_get(obj);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_password_set(Evas_Object *obj, Eina_Bool password) +{elm_entry_password_set(obj, password);} +EINA_DEPRECATED EAPI Eina_Bool +elm_scrolled_entry_password_get(const Evas_Object *obj) +{return elm_entry_password_get(obj);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_entry_set(Evas_Object *obj, const char *entry) +{elm_object_text_set(obj, entry);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_entry_append(Evas_Object *obj, const char *entry) +{elm_entry_entry_append(obj, entry);} +EINA_DEPRECATED EAPI const char * +elm_scrolled_entry_entry_get(const Evas_Object *obj) +{return elm_object_text_get(obj);} +EINA_DEPRECATED EAPI Eina_Bool +elm_scrolled_entry_is_empty(const Evas_Object *obj) +{return elm_entry_is_empty(obj);} +EINA_DEPRECATED EAPI const char * +elm_scrolled_entry_selection_get(const Evas_Object *obj) +{return elm_entry_selection_get(obj);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_entry_insert(Evas_Object *obj, const char *entry) +{elm_entry_entry_insert(obj, entry);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_line_wrap_set(Evas_Object *obj, Elm_Wrap_Type wrap) +{elm_entry_line_wrap_set(obj, wrap);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_editable_set(Evas_Object *obj, Eina_Bool editable) +{elm_entry_editable_set(obj, editable);} +EINA_DEPRECATED EAPI Eina_Bool +elm_scrolled_entry_editable_get(const Evas_Object *obj) +{return elm_entry_editable_get(obj);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_select_none(Evas_Object *obj) +{elm_entry_select_none(obj);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_select_all(Evas_Object *obj) +{return elm_entry_select_all(obj);} +EINA_DEPRECATED EAPI Eina_Bool +elm_scrolled_entry_cursor_next(Evas_Object *obj) +{return elm_entry_cursor_next(obj);} +EINA_DEPRECATED EAPI Eina_Bool +elm_scrolled_entry_cursor_prev(Evas_Object *obj) +{return elm_entry_cursor_prev(obj);} +EINA_DEPRECATED EAPI Eina_Bool +elm_scrolled_entry_cursor_up(Evas_Object *obj) +{return elm_entry_cursor_up(obj);} +EINA_DEPRECATED EAPI Eina_Bool +elm_scrolled_entry_cursor_down(Evas_Object *obj) +{return elm_entry_cursor_down(obj);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_cursor_begin_set(Evas_Object *obj) +{elm_entry_cursor_begin_set(obj);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_cursor_end_set(Evas_Object *obj) +{elm_entry_cursor_end_set(obj);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_cursor_line_begin_set(Evas_Object *obj) +{elm_entry_cursor_line_begin_set(obj);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_cursor_line_end_set(Evas_Object *obj) +{elm_entry_cursor_line_end_set(obj);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_cursor_selection_begin(Evas_Object *obj) +{elm_entry_cursor_selection_begin(obj);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_cursor_selection_end(Evas_Object *obj) +{return elm_entry_cursor_selection_end(obj);} +EINA_DEPRECATED EAPI Eina_Bool +elm_scrolled_entry_cursor_is_format_get(const Evas_Object *obj) +{return elm_entry_cursor_is_format_get(obj);} +EINA_DEPRECATED EAPI Eina_Bool +elm_scrolled_entry_cursor_is_visible_format_get(const Evas_Object *obj) +{return elm_entry_cursor_is_visible_format_get(obj);} +EINA_DEPRECATED EAPI const char * +elm_scrolled_entry_cursor_content_get(const Evas_Object *obj) +{return elm_entry_cursor_content_get(obj);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_cursor_pos_set(Evas_Object *obj, int pos) +{elm_entry_cursor_pos_set(obj, pos);} +EINA_DEPRECATED EAPI int +elm_scrolled_entry_cursor_pos_get(const Evas_Object *obj) +{return elm_entry_cursor_pos_get(obj);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_selection_cut(Evas_Object *obj) +{elm_entry_selection_cut(obj);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_selection_copy(Evas_Object *obj) +{elm_entry_selection_copy(obj);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_selection_paste(Evas_Object *obj) +{elm_entry_selection_paste(obj);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_context_menu_clear(Evas_Object *obj) +{elm_entry_context_menu_clear(obj);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_context_menu_item_add(Evas_Object *obj, const char *label, const char *icon_file, Elm_Icon_Type icon_type, Evas_Smart_Cb func, const void *data) +{elm_entry_context_menu_item_add(obj, label, icon_file, icon_type, func, data);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_context_menu_disabled_set(Evas_Object *obj, Eina_Bool disabled) +{elm_entry_context_menu_disabled_set(obj, disabled);} +EINA_DEPRECATED EAPI Eina_Bool +elm_scrolled_entry_context_menu_disabled_get(const Evas_Object *obj) +{return elm_entry_context_menu_disabled_get(obj);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_scrollbar_policy_set(Evas_Object *obj, Elm_Scroller_Policy h, Elm_Scroller_Policy v) +{elm_entry_scrollbar_policy_set(obj, h, v);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce) +{elm_entry_bounce_set(obj, h_bounce, v_bounce);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce) +{elm_entry_bounce_get(obj, h_bounce, v_bounce);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_item_provider_append(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item), void *data) +{elm_entry_item_provider_append(obj, func, data);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_item_provider_prepend(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item), void *data) +{elm_entry_item_provider_prepend(obj, func, data);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_item_provider_remove(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item), void *data) +{elm_entry_item_provider_remove(obj, func, data);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_text_filter_append(Evas_Object *obj, void (*func) (void *data, Evas_Object *entry, char **text), void *data) +{elm_entry_markup_filter_append(obj, func, data);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_text_filter_prepend(Evas_Object *obj, void (*func) (void *data, Evas_Object *entry, char **text), void *data) +{elm_entry_markup_filter_prepend(obj, func, data);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_text_filter_remove(Evas_Object *obj, void (*func) (void *data, Evas_Object *entry, char **text), void *data) +{elm_entry_markup_filter_remove(obj, func, data);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_file_set(Evas_Object *obj, const char *file, Elm_Text_Format format) +{elm_entry_file_set(obj, file, format);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_file_get(const Evas_Object *obj, const char **file, Elm_Text_Format *format) +{elm_entry_file_get(obj, file, format);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_file_save(Evas_Object *obj) +{elm_entry_file_save(obj);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_autosave_set(Evas_Object *obj, Eina_Bool autosave) +{elm_entry_autosave_set(obj, autosave);} +EINA_DEPRECATED EAPI Eina_Bool +elm_scrolled_entry_autosave_get(const Evas_Object *obj) +{return elm_entry_autosave_get(obj);} +EINA_DEPRECATED EAPI void +elm_scrolled_entry_cnp_textonly_set(Evas_Object *obj, Eina_Bool textonly) +{Elm_Cnp_Mode cnp_mode = ELM_CNP_MODE_MARKUP; if (textonly) cnp_mode = ELM_CNP_MODE_NO_IMAGE; elm_entry_cnp_mode_set(obj, cnp_mode);} +EINA_DEPRECATED EAPI Eina_Bool +elm_scrolled_entry_cnp_textonly_get(Evas_Object *obj) +{return elm_entry_cnp_mode_get(obj) != ELM_CNP_MODE_MARKUP;} diff --git a/libraries/elementary/src/lib/elm_access.c b/libraries/elementary/src/lib/elm_access.c new file mode 100644 index 0000000..4ea5582 --- /dev/null +++ b/libraries/elementary/src/lib/elm_access.c @@ -0,0 +1,536 @@ +#include +#include "elm_priv.h" + +typedef struct _Mod_Api Mod_Api; + +struct _Mod_Api +{ + void (*out_read) (const char *txt); + void (*out_read_done) (void); + void (*out_cancel) (void); + void (*out_done_callback_set) (void (*func) (void *data), const void *data); +}; + +static int initted = 0; +static Mod_Api *mapi = NULL; + +static void +_access_init(void) +{ + Elm_Module *m; + initted++; + if (initted > 1) return; + if (!(m = _elm_module_find_as("access/api"))) return; + m->api = malloc(sizeof(Mod_Api)); + if (!m->api) return; + m->init_func(m); + ((Mod_Api *)(m->api) )->out_read = // called to read out some text + _elm_module_symbol_get(m, "out_read"); + ((Mod_Api *)(m->api) )->out_read_done = // called to set a done marker so when it is reached the done callback is called + _elm_module_symbol_get(m, "out_read_done"); + ((Mod_Api *)(m->api) )->out_cancel = // called to read out some text + _elm_module_symbol_get(m, "out_cancel"); + ((Mod_Api *)(m->api) )->out_done_callback_set = // called when last read done + _elm_module_symbol_get(m, "out_done_callback_set"); + mapi = m->api; +} + +static Elm_Access_Item * +_access_add_set(Elm_Access_Info *ac, int type) +{ + Elm_Access_Item *ai; + Eina_List *l; + + if (!ac) return NULL; + EINA_LIST_FOREACH(ac->items, l, ai) + { + if (ai->type == type) + { + if (!ai->func) + { + if (ai->data) eina_stringshare_del(ai->data); + } + ai->func = NULL; + ai->data = NULL; + return ai; + } + } + ai = calloc(1, sizeof(Elm_Access_Item)); + ai->type = type; + ac->items = eina_list_prepend(ac->items, ai); + return ai; +} + +static Eina_Bool +_access_obj_over_timeout_cb(void *data) +{ + Elm_Access_Info *ac = evas_object_data_get(data, "_elm_access"); + if (!ac) return EINA_FALSE; + if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF) + { + _elm_access_object_hilight(data); + _elm_access_read(ac, ELM_ACCESS_CANCEL, data, NULL); + _elm_access_read(ac, ELM_ACCESS_TYPE, data, NULL); + _elm_access_read(ac, ELM_ACCESS_INFO, data, NULL); + _elm_access_read(ac, ELM_ACCESS_STATE, data, NULL); + _elm_access_read(ac, ELM_ACCESS_DONE, data, NULL); + } + ac->delay_timer = NULL; + return EINA_FALSE; +} + +static void +_access_obj_mouse_in_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Access_Info *ac = evas_object_data_get(data, "_elm_access"); + if (!ac) return; + + if (ac->delay_timer) + { + ecore_timer_del(ac->delay_timer); + ac->delay_timer = NULL; + } + if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF) + ac->delay_timer = ecore_timer_add(0.2, _access_obj_over_timeout_cb, data); +} + +static void +_access_obj_mouse_out_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Access_Info *ac = evas_object_data_get(data, "_elm_access"); + if (!ac) return; + _elm_access_object_unhilight(data); + if (ac->delay_timer) + { + ecore_timer_del(ac->delay_timer); + ac->delay_timer = NULL; + } +} + +static void +_access_obj_del_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Elm_Access_Info *ac; + + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOUSE_IN, + _access_obj_mouse_in_cb, data); + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOUSE_OUT, + _access_obj_mouse_out_cb, data); + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL, + _access_obj_del_cb, data); + ac = evas_object_data_get(data, "_elm_access"); + evas_object_data_del(data, "_elm_access"); + if (ac) + { + _elm_access_clear(ac); + free(ac); + } +} + +static void +_access_read_done(void *data __UNUSED__) +{ + printf("read done\n"); + // FIXME: produce event here +} + +static void +_access_2nd_click_del_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Ecore_Timer *t; + + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL, + _access_2nd_click_del_cb, NULL); + t = evas_object_data_get(obj, "_elm_2nd_timeout"); + if (t) + { + ecore_timer_del(t); + evas_object_data_del(obj, "_elm_2nd_timeout"); + } +} + +static Eina_Bool +_access_2nd_click_timeout_cb(void *data) +{ + evas_object_event_callback_del_full(data, EVAS_CALLBACK_DEL, + _access_2nd_click_del_cb, NULL); + evas_object_data_del(data, "_elm_2nd_timeout"); + return EINA_FALSE; +} + +static void +_access_obj_hilight_del_cb(void *data __UNUSED__, Evas *e, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _elm_access_object_hilight_disable(e); +} + +static void +_access_obj_hilight_hide_cb(void *data __UNUSED__, Evas *e, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _elm_access_object_hilight_disable(e); +} + +static void +_access_obj_hilight_move_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Coord x, y; + Evas_Object *o; + + o = evas_object_name_find(evas_object_evas_get(obj), "_elm_access_disp"); + if (!o) return; + evas_object_geometry_get(obj, &x, &y, NULL, NULL); + evas_object_move(o, x, y); +} + +static void +_access_obj_hilight_resize_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Coord w, h; + Evas_Object *o; + + o = evas_object_name_find(evas_object_evas_get(obj), "_elm_access_disp"); + if (!o) return; + evas_object_geometry_get(obj, NULL, NULL, &w, &h); + evas_object_resize(o, w, h); +} + + + +//-------------------------------------------------------------------------// + +EAPI void +_elm_access_clear(Elm_Access_Info *ac) +{ + Elm_Access_Item *ai; + + if (!ac) return; + if (ac->delay_timer) + { + ecore_timer_del(ac->delay_timer); + ac->delay_timer = NULL; + } + EINA_LIST_FREE(ac->items, ai) + { + if (!ai->func) + { + if (ai->data) eina_stringshare_del(ai->data); + } + free(ai); + } +} + +EAPI void +_elm_access_text_set(Elm_Access_Info *ac, int type, const char *text) +{ + Elm_Access_Item *ai = _access_add_set(ac, type); + if (!ai) return; + ai->data = eina_stringshare_add(text); +} + +EAPI void +_elm_access_callback_set(Elm_Access_Info *ac, int type, Elm_Access_Content_Cb func, const void *data) +{ + Elm_Access_Item *ai = _access_add_set(ac, type); + if (!ai) return; + ai->func = func; + ai->data = data; +} + +EAPI char * +_elm_access_text_get(const Elm_Access_Info *ac, int type, Evas_Object *obj, Elm_Widget_Item *item) +{ + Elm_Access_Item *ai; + Eina_List *l; + + if (!ac) return NULL; + EINA_LIST_FOREACH(ac->items, l, ai) + { + if (ai->type == type) + { + if (ai->func) return ai->func((void *)(ai->data), obj, item); + else if (ai->data) return strdup(ai->data); + return NULL; + } + } + return NULL; +} + +EAPI void +_elm_access_read(Elm_Access_Info *ac, int type, Evas_Object *obj, Elm_Widget_Item *item) +{ + char *txt = _elm_access_text_get(ac, type, obj, item); + + _access_init(); + if (mapi) + { + if (mapi->out_done_callback_set) + mapi->out_done_callback_set(_access_read_done, NULL); + if (type == ELM_ACCESS_DONE) + { + if (mapi->out_read_done) mapi->out_read_done(); + } + else if (type == ELM_ACCESS_CANCEL) + { + if (mapi->out_cancel) mapi->out_cancel(); + } + else + { + if (txt) + { + if (mapi->out_read) mapi->out_read(txt); + if (mapi->out_read) mapi->out_read(".\n"); + } + } + } + if (txt) free(txt); +} + +EAPI void +_elm_access_say(const char *txt) +{ + _access_init(); + if (mapi) + { + if (mapi->out_done_callback_set) + mapi->out_done_callback_set(_access_read_done, NULL); + if (mapi->out_cancel) mapi->out_cancel(); + if (txt) + { + if (mapi->out_read) mapi->out_read(txt); + if (mapi->out_read) mapi->out_read(".\n"); + } + if (mapi->out_read_done) mapi->out_read_done(); + } +} + +EAPI Elm_Access_Info * +_elm_access_object_get(const Evas_Object *obj) +{ + return evas_object_data_get(obj, "_elm_access"); +} + +EAPI Elm_Access_Info * +_elm_access_item_get(const Elm_Widget_Item *it) +{ + return it->access; +} + +EAPI void +_elm_access_object_hilight(Evas_Object *obj) +{ + Evas_Object *o; + Evas_Coord x, y, w, h; + + o = evas_object_name_find(evas_object_evas_get(obj), "_elm_access_disp"); + if (!o) + { + o = edje_object_add(evas_object_evas_get(obj)); + evas_object_name_set(o, "_elm_access_disp"); + evas_object_layer_set(o, ELM_OBJECT_LAYER_TOOLTIP); + } + else + { + Evas_Object *ptarget = evas_object_data_get(o, "_elm_access_target"); + if (ptarget) + { + evas_object_data_del(o, "_elm_access_target"); + evas_object_event_callback_del_full(ptarget, EVAS_CALLBACK_DEL, + _access_obj_hilight_del_cb, NULL); + evas_object_event_callback_del_full(ptarget, EVAS_CALLBACK_HIDE, + _access_obj_hilight_hide_cb, NULL); + evas_object_event_callback_del_full(ptarget, EVAS_CALLBACK_MOVE, + _access_obj_hilight_move_cb, NULL); + evas_object_event_callback_del_full(ptarget, EVAS_CALLBACK_RESIZE, + _access_obj_hilight_resize_cb, NULL); + } + } + evas_object_data_set(o, "_elm_access_target", obj); + _elm_theme_object_set(obj, o, "access", "base", "default"); + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, + _access_obj_hilight_del_cb, NULL); + evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, + _access_obj_hilight_hide_cb, NULL); + evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, + _access_obj_hilight_move_cb, NULL); + evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, + _access_obj_hilight_resize_cb, NULL); + evas_object_raise(o); + evas_object_geometry_get(obj, &x, &y, &w, &h); + evas_object_move(o, x, y); + evas_object_resize(o, w, h); + evas_object_show(o); +} + +EAPI void +_elm_access_object_unhilight(Evas_Object *obj) +{ + Evas_Object *o, *ptarget; + + o = evas_object_name_find(evas_object_evas_get(obj), "_elm_access_disp"); + if (!o) return; + ptarget = evas_object_data_get(o, "_elm_access_target"); + if (ptarget == obj) + { + evas_object_event_callback_del_full(ptarget, EVAS_CALLBACK_DEL, + _access_obj_hilight_del_cb, NULL); + evas_object_event_callback_del_full(ptarget, EVAS_CALLBACK_HIDE, + _access_obj_hilight_hide_cb, NULL); + evas_object_event_callback_del_full(ptarget, EVAS_CALLBACK_MOVE, + _access_obj_hilight_move_cb, NULL); + evas_object_event_callback_del_full(ptarget, EVAS_CALLBACK_RESIZE, + _access_obj_hilight_resize_cb, NULL); + evas_object_del(o); + } +} + +EAPI void +_elm_access_object_hilight_disable(Evas *e) +{ + Evas_Object *o, *ptarget; + + o = evas_object_name_find(e, "_elm_access_disp"); + if (!o) return; + ptarget = evas_object_data_get(o, "_elm_access_target"); + if (ptarget) + { + evas_object_event_callback_del_full(ptarget, EVAS_CALLBACK_DEL, + _access_obj_hilight_del_cb, NULL); + evas_object_event_callback_del_full(ptarget, EVAS_CALLBACK_HIDE, + _access_obj_hilight_hide_cb, NULL); + evas_object_event_callback_del_full(ptarget, EVAS_CALLBACK_MOVE, + _access_obj_hilight_move_cb, NULL); + evas_object_event_callback_del_full(ptarget, EVAS_CALLBACK_RESIZE, + _access_obj_hilight_resize_cb, NULL); + } + evas_object_del(o); +} + +EAPI void +_elm_access_object_register(Evas_Object *obj, Evas_Object *hoverobj) +{ + Elm_Access_Info *ac; + + evas_object_event_callback_add(hoverobj, EVAS_CALLBACK_MOUSE_IN, + _access_obj_mouse_in_cb, obj); + evas_object_event_callback_add(hoverobj, EVAS_CALLBACK_MOUSE_OUT, + _access_obj_mouse_out_cb, obj); + evas_object_event_callback_add(hoverobj, EVAS_CALLBACK_DEL, + _access_obj_del_cb, obj); + ac = calloc(1, sizeof(Elm_Access_Info)); + evas_object_data_set(obj, "_elm_access", ac); +} + +static Eina_Bool +_access_item_over_timeout_cb(void *data) +{ + Elm_Access_Info *ac = ((Elm_Widget_Item *)data)->access; + if (!ac) return EINA_FALSE; + if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF) + { + _elm_access_object_hilight(((Elm_Widget_Item *)data)->view); + _elm_access_read(ac, ELM_ACCESS_CANCEL, NULL, data); + _elm_access_read(ac, ELM_ACCESS_TYPE, NULL, data); + _elm_access_read(ac, ELM_ACCESS_INFO, NULL, data); + _elm_access_read(ac, ELM_ACCESS_STATE, NULL, data); + _elm_access_read(ac, ELM_ACCESS_DONE, NULL, data); + } + ac->delay_timer = NULL; + return EINA_FALSE; +} + +static void +_access_item_mouse_in_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Access_Info *ac = ((Elm_Widget_Item *)data)->access; + if (!ac) return; + + if (ac->delay_timer) + { + ecore_timer_del(ac->delay_timer); + ac->delay_timer = NULL; + } + if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF) + ac->delay_timer = ecore_timer_add(0.2, _access_item_over_timeout_cb, data); +} + +static void +_access_item_mouse_out_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Access_Info *ac = ((Elm_Widget_Item *)data)->access; + if (!ac) return; + + _elm_access_object_unhilight(((Elm_Widget_Item *)data)->view); + if (ac->delay_timer) + { + ecore_timer_del(ac->delay_timer); + ac->delay_timer = NULL; + } +} + +static void _access_item_del_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__); + +EAPI void +_elm_access_item_unregister(Elm_Widget_Item *item) +{ + Elm_Access_Info *ac; + + ac = item->access; + if (ac) + { + evas_object_event_callback_del_full(ac->hoverobj, + EVAS_CALLBACK_MOUSE_IN, + _access_item_mouse_in_cb, item); + evas_object_event_callback_del_full(ac->hoverobj, + EVAS_CALLBACK_MOUSE_OUT, + _access_item_mouse_out_cb, item); + evas_object_event_callback_del_full(ac->hoverobj, + EVAS_CALLBACK_DEL, + _access_item_del_cb, item); + item->access = NULL; + _elm_access_clear(ac); + free(ac); + } +} + +static void +_access_item_del_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _elm_access_item_unregister((Elm_Widget_Item *)data); +} + +EAPI void +_elm_access_item_register(Elm_Widget_Item *item, Evas_Object *hoverobj) +{ + Elm_Access_Info *ac; + + evas_object_event_callback_add(hoverobj, EVAS_CALLBACK_MOUSE_IN, + _access_item_mouse_in_cb, item); + evas_object_event_callback_add(hoverobj, EVAS_CALLBACK_MOUSE_OUT, + _access_item_mouse_out_cb, item); + evas_object_event_callback_add(hoverobj, EVAS_CALLBACK_DEL, + _access_item_del_cb, item); + ac = calloc(1, sizeof(Elm_Access_Info)); + ac->hoverobj = hoverobj; + item->access = ac; +} + +EAPI Eina_Bool +_elm_access_2nd_click_timeout(Evas_Object *obj) +{ + Ecore_Timer *t; + + t = evas_object_data_get(obj, "_elm_2nd_timeout"); + if (t) + { + ecore_timer_del(t); + evas_object_data_del(obj, "_elm_2nd_timeout"); + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL, + _access_2nd_click_del_cb, NULL); + return EINA_TRUE; + } + t = ecore_timer_add(0.3, _access_2nd_click_timeout_cb, obj); + evas_object_data_set(obj, "_elm_2nd_timeout", t); + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, + _access_2nd_click_del_cb, NULL); + return EINA_FALSE; +} diff --git a/libraries/elementary/src/lib/elm_actionslider.c b/libraries/elementary/src/lib/elm_actionslider.c new file mode 100644 index 0000000..ec3087b --- /dev/null +++ b/libraries/elementary/src/lib/elm_actionslider.c @@ -0,0 +1,505 @@ +#include +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *as; // actionslider + Evas_Object *drag_button_base; + Elm_Actionslider_Pos magnet_position, enabled_position; + const char *text_left, *text_right, *text_center; + const char *indicator_label; + Ecore_Animator *button_animator; + double final_position; + Eina_Bool mouse_down : 1; +}; + +static const char *widtype = NULL; + +static const char SIG_CHANGED[] = "pos_changed"; +static const char SIG_SELECTED[] = "selected"; + +static const Evas_Smart_Cb_Description _signals[] = +{ + {SIG_CHANGED, ""}, + {SIG_SELECTED, ""}, + {NULL, NULL} +}; + + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->drag_button_base) + { + evas_object_del(wd->drag_button_base); + wd->drag_button_base = NULL; + } + if (wd->text_left) eina_stringshare_del(wd->text_left); + if (wd->text_right) eina_stringshare_del(wd->text_right); + if (wd->text_center) eina_stringshare_del(wd->text_center); + if (wd->indicator_label) eina_stringshare_del(wd->indicator_label); + free(wd); +} + +static Elm_Actionslider_Pos +_get_pos_by_orientation(const Evas_Object *obj, Elm_Actionslider_Pos pos) +{ + if (elm_widget_mirrored_get(obj)) + { + switch (pos) + { + case ELM_ACTIONSLIDER_LEFT: + pos = ELM_ACTIONSLIDER_RIGHT; + break; + case ELM_ACTIONSLIDER_RIGHT: + pos = ELM_ACTIONSLIDER_LEFT; + break; + default: + break; + } + } + return pos; +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + double pos; + + if (!wd) return; + if (edje_object_mirrored_get(wd->as) == rtl) + return; + + edje_object_mirrored_set(wd->as, rtl); + if (!elm_widget_mirrored_get(obj)) + { + edje_object_part_text_escaped_set(wd->as, "elm.text.left", wd->text_left); + edje_object_part_text_escaped_set(wd->as, "elm.text.right", wd->text_right); + } + else + { + edje_object_part_text_escaped_set(wd->as, "elm.text.left", wd->text_right); + edje_object_part_text_escaped_set(wd->as, "elm.text.right", wd->text_left); + } + edje_object_part_drag_value_get(wd->as, "elm.drag_button_base", &pos, NULL); + edje_object_part_drag_value_set(wd->as, "elm.drag_button_base", 1.0 - pos, 0.5); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1; + + if (!wd) return; + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + evas_object_size_hint_min_set(wd->drag_button_base, minw, minh); + evas_object_size_hint_max_set(wd->drag_button_base, -1, -1); + + minw = -1; + minh = -1; + elm_coords_finger_size_adjust(3, &minw, 1, &minh); + edje_object_size_min_restricted_calc(wd->as, &minw, &minh, minw, minh); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, -1, -1); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_widget_mirrored_reload(obj); + if (!edje_object_part_swallow_get(wd->as, "elm.drag_button_base")) + edje_object_part_unswallow(wd->as, wd->drag_button_base); + + _elm_theme_object_set(obj, wd->as, "actionslider", + "base", elm_widget_style_get(obj)); + _elm_theme_object_set(obj, wd->drag_button_base, "actionslider", + "drag_button", elm_widget_style_get(obj)); + edje_object_part_swallow(wd->as, "elm.drag_button_base", wd->drag_button_base); + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + edje_object_part_text_escaped_set(wd->as, "elm.text.center", wd->text_center); + edje_object_part_text_escaped_set(wd->as, "elm.text.indicator", wd->indicator_label); + edje_object_message_signal_process(wd->as); + _sizing_eval(obj); +} + +static void +_drag_button_down_cb(void *data, Evas_Object *o __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get((Evas_Object *) data); + if (!wd) return; + wd->mouse_down = EINA_TRUE; +} + +static void +_drag_button_move_cb(void *data, Evas_Object *o __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Evas_Object *obj = (Evas_Object *) data; + Widget_Data *wd = elm_widget_data_get(obj); + double pos = 0.0; + if (!wd) return; + + if (!wd->mouse_down) return; + edje_object_part_drag_value_get(wd->as, "elm.drag_button_base", &pos, NULL); + if (pos == 0.0) + evas_object_smart_callback_call(obj, SIG_CHANGED, + (void *) ((!elm_widget_mirrored_get(obj)) ? + "left" : "right")); + else if (pos == 1.0) + evas_object_smart_callback_call(obj, SIG_CHANGED, + (void *) ((!elm_widget_mirrored_get(obj)) ? + "right" : "left")); + else if (pos >= 0.45 && pos <= 0.55) + evas_object_smart_callback_call(obj, SIG_CHANGED, (void *)"center"); +} + +static Eina_Bool +_button_animation(void *data) +{ + Evas_Object *obj = data; + Widget_Data *wd = elm_widget_data_get(obj); + double cur_position = 0.0, new_position = 0.0; + double move_amount = 0.05; + Eina_Bool flag_finish_animation = EINA_FALSE; + if (!wd) return ECORE_CALLBACK_CANCEL; + + edje_object_part_drag_value_get(wd->as, + "elm.drag_button_base", &cur_position, NULL); + { + double adjusted_final; + adjusted_final = (!elm_widget_mirrored_get(obj)) ? + wd->final_position : 1.0 - wd->final_position; + if ((adjusted_final == 0.0) || + (adjusted_final == 0.5 && cur_position >= adjusted_final)) + { + new_position = cur_position - move_amount; + if (new_position <= adjusted_final) + { + new_position = adjusted_final; + flag_finish_animation = EINA_TRUE; + } + } + else if ((adjusted_final == 1.0) || + (adjusted_final == 0.5 && cur_position < adjusted_final)) + { + new_position = cur_position + move_amount; + if (new_position >= adjusted_final) + { + new_position = adjusted_final; + flag_finish_animation = EINA_TRUE; + } + } + edje_object_part_drag_value_set(wd->as, + "elm.drag_button_base", new_position, 0.5); + } + + if (flag_finish_animation) + { + if ((!wd->final_position) && + (wd->enabled_position & ELM_ACTIONSLIDER_LEFT)) + evas_object_smart_callback_call(data, SIG_SELECTED, + (void *)wd->text_left); + else if ((wd->final_position == 0.5) && + (wd->enabled_position & ELM_ACTIONSLIDER_CENTER)) + evas_object_smart_callback_call(data, SIG_SELECTED, + (void *)wd->text_center); + else if ((wd->final_position == 1) && + (wd->enabled_position & ELM_ACTIONSLIDER_RIGHT)) + evas_object_smart_callback_call(data, SIG_SELECTED, + (void *)wd->text_right); + wd->button_animator = NULL; + return ECORE_CALLBACK_CANCEL; + } + return ECORE_CALLBACK_RENEW; +} + +static void +_drag_button_up_cb(void *data, Evas_Object *o __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Evas_Object *obj = (Evas_Object *) data; + Widget_Data *wd = elm_widget_data_get(obj); + double position = 0.0; + if (!wd) return; + + wd->mouse_down = EINA_FALSE; + + edje_object_part_drag_value_get(wd->as, "elm.drag_button_base", + &position, NULL); + + if ((wd->enabled_position & ELM_ACTIONSLIDER_LEFT) && + ((!elm_widget_mirrored_get(obj) && position == 0.0) || + (elm_widget_mirrored_get(obj) && position == 1.0))) + { + wd->final_position = 0; + evas_object_smart_callback_call(data, SIG_SELECTED, + (void *) wd->text_left); + return; + } + if (position >= 0.45 && position <= 0.55 && + (wd->enabled_position & ELM_ACTIONSLIDER_CENTER)) + { + wd->final_position = 0.5; + evas_object_smart_callback_call(data, SIG_SELECTED, + (void *)wd->text_center); + if (wd->button_animator) ecore_animator_del(wd->button_animator); + wd->button_animator = ecore_animator_add(_button_animation, data); + return; + } + if ((wd->enabled_position & ELM_ACTIONSLIDER_RIGHT) && + ((!elm_widget_mirrored_get(obj) && position == 1.0) || + (elm_widget_mirrored_get(obj) && position == 0.0))) + { + wd->final_position = 1; + evas_object_smart_callback_call(data, SIG_SELECTED, + (void *) wd->text_right); + return; + } + + if (wd->magnet_position == ELM_ACTIONSLIDER_NONE) return; + +#define _FINAL_POS_BY_ORIENTATION(x) (x) +#define _POS_BY_ORIENTATION(x) \ + ((!elm_widget_mirrored_get(obj)) ? \ + x : 1.0 - x) + + position = _POS_BY_ORIENTATION(position); + + if (position < 0.3) + { + if (wd->magnet_position & ELM_ACTIONSLIDER_LEFT) + wd->final_position = _FINAL_POS_BY_ORIENTATION(0); + else if (wd->magnet_position & ELM_ACTIONSLIDER_CENTER) + wd->final_position = 0.5; + else if (wd->magnet_position & ELM_ACTIONSLIDER_RIGHT) + wd->final_position = _FINAL_POS_BY_ORIENTATION(1); + } + else if ((position >= 0.3) && (position <= 0.7)) + { + if (wd->magnet_position & ELM_ACTIONSLIDER_CENTER) + wd->final_position = 0.5; + else if (position < 0.5) + { + if (wd->magnet_position & ELM_ACTIONSLIDER_LEFT) + wd->final_position = _FINAL_POS_BY_ORIENTATION(0); + else + wd->final_position = _FINAL_POS_BY_ORIENTATION(1); + } + else + { + if (wd->magnet_position & ELM_ACTIONSLIDER_RIGHT) + wd->final_position = _FINAL_POS_BY_ORIENTATION(1); + else + wd->final_position = _FINAL_POS_BY_ORIENTATION(0); + } + } + else + { + if (wd->magnet_position & ELM_ACTIONSLIDER_RIGHT) + wd->final_position = _FINAL_POS_BY_ORIENTATION(1); + else if (wd->magnet_position & ELM_ACTIONSLIDER_CENTER) + wd->final_position = 0.5; + else + wd->final_position = _FINAL_POS_BY_ORIENTATION(0); + } + if (wd->button_animator) ecore_animator_del(wd->button_animator); + wd->button_animator = ecore_animator_add(_button_animation, data); + +#undef _FINAL_POS_BY_ORIENTATION +} + +static void +_elm_actionslider_label_set(Evas_Object *obj, const char *item, const char *label) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (!item || !strcmp(item, "indicator")) + { + eina_stringshare_replace(&wd->indicator_label, label); + edje_object_part_text_escaped_set(wd->as, "elm.text.indicator", + wd->indicator_label); + } + else if (!strcmp(item, "left")) + { + eina_stringshare_replace(&wd->text_left, label); + if (!elm_widget_mirrored_get(obj)) + edje_object_part_text_escaped_set(wd->as, "elm.text.left", wd->text_left); + else + edje_object_part_text_escaped_set(wd->as, "elm.text.right", wd->text_left); + } + else if (!strcmp(item, "center")) + { + eina_stringshare_replace(&wd->text_center, label); + edje_object_part_text_escaped_set(wd->as, "elm.text.center", wd->text_center); + } + else if (!strcmp(item, "right")) + { + eina_stringshare_replace(&wd->text_right, label); + if (!elm_widget_mirrored_get(obj)) + edje_object_part_text_escaped_set(wd->as, "elm.text.right", wd->text_right); + else + edje_object_part_text_escaped_set(wd->as, "elm.text.left", wd->text_right); + } +} + +static const char * +_elm_actionslider_label_get(const Evas_Object *obj, const char *item) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + if (!item || !strcmp(item, "indicator")) + return wd->indicator_label; + else if (!strcmp(item, "left")) + return wd->text_left; + else if (!strcmp(item, "center")) + return wd->text_center; + else if (!strcmp(item, "right")) + return wd->text_right; + + return NULL; +} + +EAPI Evas_Object * +elm_actionslider_add(Evas_Object *parent) +{ + Evas_Object *obj; + Widget_Data *wd; + Evas *e; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "actionslider"); + elm_widget_type_set(obj, "actionslider"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_text_set_hook_set(obj, _elm_actionslider_label_set); + elm_widget_text_get_hook_set(obj, _elm_actionslider_label_get); + + wd->mouse_down = EINA_FALSE; + wd->enabled_position = ELM_ACTIONSLIDER_ALL; + + wd->as = edje_object_add(e); + _elm_theme_object_set(obj, wd->as, "actionslider", "base", "default"); + elm_widget_resize_object_set(obj, wd->as); + + wd->drag_button_base = evas_object_rectangle_add(e); + evas_object_color_set(wd->drag_button_base, 0, 0, 0, 0); + edje_object_part_swallow(wd->as, "elm.drag_button_base", wd->drag_button_base); + + edje_object_signal_callback_add(wd->as, + "elm.drag_button,mouse,up", "", + _drag_button_up_cb, obj); + edje_object_signal_callback_add(wd->as, + "elm.drag_button,mouse,down", "", + _drag_button_down_cb, obj); + edje_object_signal_callback_add(wd->as, + "elm.drag_button,mouse,move", "", + _drag_button_move_cb, obj); + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _sizing_eval(obj); + return obj; +} + +EAPI void +elm_actionslider_indicator_pos_set(Evas_Object *obj, Elm_Actionslider_Pos pos) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + double position = 0.0; + if (!wd) return; + pos = _get_pos_by_orientation(obj, pos); + if (pos == ELM_ACTIONSLIDER_CENTER) position = 0.5; + else if (pos == ELM_ACTIONSLIDER_RIGHT) position = 1.0; + edje_object_part_drag_value_set(wd->as, "elm.drag_button_base", position, 0.5); +} + +EAPI Elm_Actionslider_Pos +elm_actionslider_indicator_pos_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_ACTIONSLIDER_NONE; + Widget_Data *wd = elm_widget_data_get(obj); + double position; + if (!wd) return ELM_ACTIONSLIDER_NONE; + + edje_object_part_drag_value_get(wd->as, "elm.drag_button_base", &position, NULL); + if (position < 0.3) + return _get_pos_by_orientation(obj, ELM_ACTIONSLIDER_LEFT); + else if (position < 0.7) + return ELM_ACTIONSLIDER_CENTER; + else + return _get_pos_by_orientation(obj, ELM_ACTIONSLIDER_RIGHT); +} + +EAPI void +elm_actionslider_magnet_pos_set(Evas_Object *obj, Elm_Actionslider_Pos pos) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->magnet_position = pos; +} + +EAPI Elm_Actionslider_Pos +elm_actionslider_magnet_pos_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_ACTIONSLIDER_NONE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return ELM_ACTIONSLIDER_NONE; + return wd->magnet_position; +} + +EAPI void +elm_actionslider_enabled_pos_set(Evas_Object *obj, Elm_Actionslider_Pos pos) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->enabled_position = pos; +} + +EAPI Elm_Actionslider_Pos +elm_actionslider_enabled_pos_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_ACTIONSLIDER_NONE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return ELM_ACTIONSLIDER_NONE; + return wd->enabled_position; +} + +EAPI const char * +elm_actionslider_selected_label_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + if ((wd->final_position == 0.0) && + (wd->enabled_position & ELM_ACTIONSLIDER_LEFT)) + return wd->text_left; + + if ((wd->final_position == 0.5) && + (wd->enabled_position & ELM_ACTIONSLIDER_CENTER)) + return wd->text_center; + + if ((wd->final_position == 1.0) && + (wd->enabled_position & ELM_ACTIONSLIDER_RIGHT)) + return wd->text_right; + + return NULL; +} diff --git a/libraries/elementary/src/lib/elm_actionslider.h b/libraries/elementary/src/lib/elm_actionslider.h new file mode 100644 index 0000000..1be91fc --- /dev/null +++ b/libraries/elementary/src/lib/elm_actionslider.h @@ -0,0 +1,139 @@ +/** + * @addtogroup Actionslider Actionslider + * @ingroup Elementary + * + * @image html img/widget/actionslider/preview-00.png + * @image latex img/widget/actionslider/preview-00.eps + * + * An actionslider is a switcher for 2 or 3 labels with customizable magnet + * properties. The user drags and releases the indicator, to choose a label. + * + * Labels occupy the following positions. + * a. Left + * b. Right + * c. Center + * + * Positions can be enabled or disabled. + * + * Magnets can be set on the above positions. + * + * When the indicator is released, it will move to its nearest "enabled and magnetized" position. + * + * @note By default all positions are set as enabled. + * + * Signals that you can add callbacks for are: + * + * "selected" - when user selects an enabled position (the label is passed as + * event info)". + * "pos_changed" - when the indicator reaches any of the positions("left", + * "right" or "center"). + * + * Default text parts of the actionslider widget that you can use for are: + * @li "indicator" - An indicator label of the actionslider + * @li "left" - A left label of the actionslider + * @li "right" - A right label of the actionslider + * @li "center" - A center label of the actionslider + * + * Supported elm_object common APIs. + * @li @ref elm_object_part_text_set + * @li @ref elm_object_part_text_get + * + * See an example of actionslider usage @ref actionslider_example_page "here" + * @{ + */ +typedef enum +{ + ELM_ACTIONSLIDER_NONE = 0, + ELM_ACTIONSLIDER_LEFT = 1 << 0, + ELM_ACTIONSLIDER_CENTER = 1 << 1, + ELM_ACTIONSLIDER_RIGHT = 1 << 2, + ELM_ACTIONSLIDER_ALL = (1 << 3) - 1 +} Elm_Actionslider_Pos; + +/** + * Add a new actionslider to the parent. + * + * @param parent The parent object + * @return The new actionslider object or NULL if it cannot be created + * + * @ingroup Actionslider + */ +EAPI Evas_Object *elm_actionslider_add(Evas_Object *parent); + +/** + * Get actionslider selected label. + * + * @param obj The actionslider object + * @return The selected label + * + * @ingroup Actionslider + */ +EAPI const char *elm_actionslider_selected_label_get(const Evas_Object *obj); + +/** + * Set actionslider indicator position. + * + * @param obj The actionslider object. + * @param pos The position of the indicator. + * + * @ingroup Actionslider + */ +EAPI void elm_actionslider_indicator_pos_set(Evas_Object *obj, Elm_Actionslider_Pos pos); + +/** + * Get actionslider indicator position. + * + * @param obj The actionslider object. + * @return The position of the indicator. + * + * @ingroup Actionslider + */ +EAPI Elm_Actionslider_Pos elm_actionslider_indicator_pos_get(const Evas_Object *obj); + +/** + * Set actionslider magnet position. To make multiple positions magnets @c or + * them together(e.g.: ELM_ACTIONSLIDER_LEFT | ELM_ACTIONSLIDER_RIGHT) + * + * @param obj The actionslider object. + * @param pos Bit mask indicating the magnet positions. + * + * @ingroup Actionslider + */ +EAPI void elm_actionslider_magnet_pos_set(Evas_Object *obj, Elm_Actionslider_Pos pos); + +/** + * Get actionslider magnet position. + * + * @param obj The actionslider object. + * @return The positions with magnet property. + * + * @ingroup Actionslider + */ +EAPI Elm_Actionslider_Pos elm_actionslider_magnet_pos_get(const Evas_Object *obj); + +/** + * Set actionslider enabled position. To set multiple positions as enabled @c or + * them together(e.g.: ELM_ACTIONSLIDER_LEFT | ELM_ACTIONSLIDER_RIGHT). + * + * @note All the positions are enabled by default. + * + * @param obj The actionslider object. + * @param pos Bit mask indicating the enabled positions. + * + * @ingroup Actionslider + */ +EAPI void elm_actionslider_enabled_pos_set(Evas_Object *obj, Elm_Actionslider_Pos pos); + +/** + * Get actionslider enabled position. + * + * @param obj The actionslider object. + * @return The enabled positions. + * + * @ingroup Actionslider + */ +EAPI Elm_Actionslider_Pos elm_actionslider_enabled_pos_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_app.h b/libraries/elementary/src/lib/elm_app.h new file mode 100644 index 0000000..86dba27 --- /dev/null +++ b/libraries/elementary/src/lib/elm_app.h @@ -0,0 +1,193 @@ +/** + * Provide information in order to make Elementary determine the @b + * run time location of the software in question, so other data files + * such as images, sound files, executable utilities, libraries, + * modules and locale files can be found. + * + * @param mainfunc This is your application's main function name, + * whose binary's location is to be found. Providing @c NULL + * will make Elementary not to use it + * @param dom This will be used as the application's "domain", in the + * form of a prefix to any environment variables that may + * override prefix detection and the directory name, inside the + * standard share or data directories, where the software's + * data files will be looked for. + * @param checkfile This is an (optional) magic file's path to check + * for existence (and it must be located in the data directory, + * under the share directory provided above). Its presence will + * help determine the prefix found was correct. Pass @c NULL if + * the check is not to be done. + * + * This function allows one to re-locate the application somewhere + * else after compilation, if the developer wishes for easier + * distribution of pre-compiled binaries. + * + * The prefix system is designed to locate where the given software is + * installed (under a common path prefix) at run time and then report + * specific locations of this prefix and common directories inside + * this prefix like the binary, library, data and locale directories, + * through the @c elm_app_*_get() family of functions. + * + * Call elm_app_info_set() early on before you change working + * directory or anything about @c argv[0], so it gets accurate + * information. + * + * It will then try and trace back which file @p mainfunc comes from, + * if provided, to determine the application's prefix directory. + * + * The @p dom parameter provides a string prefix to prepend before + * environment variables, allowing a fallback to @b specific + * environment variables to locate the software. You would most + * probably provide a lowercase string there, because it will also + * serve as directory domain, explained next. For environment + * variables purposes, this string is made uppercase. For example if + * @c "myapp" is provided as the prefix, then the program would expect + * @c "MYAPP_PREFIX" as a master environment variable to specify the + * exact install prefix for the software, or more specific environment + * variables like @c "MYAPP_BIN_DIR", @c "MYAPP_LIB_DIR", @c + * "MYAPP_DATA_DIR" and @c "MYAPP_LOCALE_DIR", which could be set by + * the user or scripts before launching. If not provided (@c NULL), + * environment variables will not be used to override compiled-in + * defaults or auto detections. + * + * The @p dom string also provides a subdirectory inside the system + * shared data directory for data files. For example, if the system + * directory is @c /usr/local/share, then this directory name is + * appended, creating @c /usr/local/share/myapp, if it @p was @c + * "myapp". It is expected that the application installs data files in + * this directory. + * + * The @p checkfile is a file name or path of something inside the + * share or data directory to be used to test that the prefix + * detection worked. For example, your app will install a wallpaper + * image as @c /usr/local/share/myapp/images/wallpaper.jpg and so to + * check that this worked, provide @c "images/wallpaper.jpg" as the @p + * checkfile string. + * + * @see elm_app_compile_bin_dir_set() + * @see elm_app_compile_lib_dir_set() + * @see elm_app_compile_data_dir_set() + * @see elm_app_compile_locale_set() + * @see elm_app_prefix_dir_get() + * @see elm_app_bin_dir_get() + * @see elm_app_lib_dir_get() + * @see elm_app_data_dir_get() + * @see elm_app_locale_dir_get() + */ +EAPI void elm_app_info_set(void *mainfunc, const char *dom, const char *checkfile); + +/** + * Provide information on the @b fallback application's binaries + * directory, in scenarios where they get overridden by + * elm_app_info_set(). + * + * @param dir The path to the default binaries directory (compile time + * one) + * + * @note Elementary will as well use this path to determine actual + * names of binaries' directory paths, maybe changing it to be @c + * something/local/bin instead of @c something/bin, only, for + * example. + * + * @warning You should call this function @b before + * elm_app_info_set(). + */ +EAPI void elm_app_compile_bin_dir_set(const char *dir); + +/** + * Provide information on the @b fallback application's libraries + * directory, on scenarios where they get overridden by + * elm_app_info_set(). + * + * @param dir The path to the default libraries directory (compile + * time one) + * + * @note Elementary will as well use this path to determine actual + * names of libraries' directory paths, maybe changing it to be @c + * something/lib32 or @c something/lib64 instead of @c something/lib, + * only, for example. + * + * @warning You should call this function @b before + * elm_app_info_set(). + */ +EAPI void elm_app_compile_lib_dir_set(const char *dir); + +/** + * Provide information on the @b fallback application's data + * directory, on scenarios where they get overridden by + * elm_app_info_set(). + * + * @param dir The path to the default data directory (compile time + * one) + * + * @note Elementary will as well use this path to determine actual + * names of data directory paths, maybe changing it to be @c + * something/local/share instead of @c something/share, only, for + * example. + * + * @warning You should call this function @b before + * elm_app_info_set(). + */ +EAPI void elm_app_compile_data_dir_set(const char *dir); + +/** + * Provide information on the @b fallback application's locale + * directory, on scenarios where they get overridden by + * elm_app_info_set(). + * + * @param dir The path to the default locale directory (compile time + * one) + * + * @warning You should call this function @b before + * elm_app_info_set(). + */ +EAPI void elm_app_compile_locale_set(const char *dir); + +/** + * Retrieve the application's run time prefix directory, as set by + * elm_app_info_set() and the way (environment) the application was + * run from. + * + * @return The directory prefix the application is actually using. + */ +EAPI const char *elm_app_prefix_dir_get(void); + +/** + * Retrieve the application's run time binaries prefix directory, as + * set by elm_app_info_set() and the way (environment) the application + * was run from. + * + * @return The binaries directory prefix the application is actually + * using. + */ +EAPI const char *elm_app_bin_dir_get(void); + +/** + * Retrieve the application's run time libraries prefix directory, as + * set by elm_app_info_set() and the way (environment) the application + * was run from. + * + * @return The libraries directory prefix the application is actually + * using. + */ +EAPI const char *elm_app_lib_dir_get(void); + +/** + * Retrieve the application's run time data prefix directory, as + * set by elm_app_info_set() and the way (environment) the application + * was run from. + * + * @return The data directory prefix the application is actually + * using. + */ +EAPI const char *elm_app_data_dir_get(void); + +/** + * Retrieve the application's run time locale prefix directory, as + * set by elm_app_info_set() and the way (environment) the application + * was run from. + * + * @return The locale directory prefix the application is actually + * using. + */ +EAPI const char *elm_app_locale_dir_get(void); diff --git a/libraries/elementary/src/lib/elm_authors.h b/libraries/elementary/src/lib/elm_authors.h new file mode 100644 index 0000000..694c797 --- /dev/null +++ b/libraries/elementary/src/lib/elm_authors.h @@ -0,0 +1,61 @@ +/** + * @page authors Authors + * @author Carsten Haitzler + * @author Gustavo Sverzut Barbieri + * @author Cedric Bail + * @author Vincent Torri + * @author Daniel Kolesa + * @author Jaime Thomas + * @author Swisscom - http://www.swisscom.ch/ + * @author Christopher Michael + * @author Marco Trevisan (Treviño) + * @author Michael Bouchaud + * @author Jonathan Atton (Watchwolf) + * @author Brian Wang + * @author Mike Blumenkrantz (discomfitor/zmike) + * @author Samsung Electronics tbd + * @author Samsung SAIT tbd + * @author Brett Nash + * @author Bruno Dilly + * @author Rafael Fonseca + * @author Chuneon Park + * @author Woohyun Jung + * @author Jaehwan Kim + * @author Wonguk Jeong + * @author Leandro A. F. Pereira + * @author Helen Fornazier + * @author Gustavo Lima Chaves + * @author Fabiano Fidêncio + * @author Tiago Falcão + * @author Otavio Pontes + * @author Viktor Kojouharov + * @author Daniel Juyung Seo (SeoZ) + * @author Sangho Park + * @author Rajeev Ranjan (Rajeev) + * @author Seunggyun Kim + * @author Sohyun Kim + * @author Jihoon Kim + * @author Jeonghyun Yun (arosis) + * @author Tom Hacohen + * @author Aharon Hillel + * @author Jonathan Atton (Watchwolf) + * @author Shinwoo Kim + * @author Govindaraju SM + * @author Prince Kumar Dubey + * @author Sung W. Park + * @author Thierry el Borgi + * @author Shilpa Singh + * @author Chanwook Jung + * @author Hyoyoung Chang + * @author Guillaume "Kuri" Friloux + * @author Kim Yunhan + * @author Bluezery + * @author Nicolas Aguirre + * @author Sanjeev BA + * @author Hyunsil Park + * @author Goun Lee + * @author Mikael Sans + * + * Please contact to get in + * contact with the developers and maintainers. + */ diff --git a/libraries/elementary/src/lib/elm_bg.c b/libraries/elementary/src/lib/elm_bg.c new file mode 100644 index 0000000..df29d5b --- /dev/null +++ b/libraries/elementary/src/lib/elm_bg.c @@ -0,0 +1,324 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *base, *rect, *img, *overlay; + const char *file, *group; + Elm_Bg_Option option; + struct + { + Evas_Coord w, h; + } load_opts; +}; + +static const char *widtype = NULL; + +static void _del_hook(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); +static void _custom_resize(void *data, Evas *a, Evas_Object *obj, void *event_info); +static void _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content); +static Evas_Object *_content_get_hook(const Evas_Object *obj, const char *part); +static Evas_Object *_content_unset_hook(Evas_Object *obj, const char *part); + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + free(wd); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord w, h; + + _elm_theme_object_set(obj, wd->base, "bg", "base", + elm_widget_style_get(obj)); + + if (wd->rect) + edje_object_part_swallow(wd->base, "elm.swallow.rectangle", wd->rect); + if (wd->img) + edje_object_part_swallow(wd->base, "elm.swallow.background", wd->img); + if (wd->overlay) + edje_object_part_swallow(wd->base, "elm.swallow.content", wd->overlay); + + // FIXME: if i don't do this, bg doesnt calc correctly. why? + evas_object_geometry_get(wd->base, NULL, NULL, &w, &h); + evas_object_resize(wd->base, w, h); +} + +static void +_custom_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = data; + Evas_Coord bx = 0, by = 0, bw = 0, bh = 0; + Evas_Coord iw = 0, ih = 0, mw = -1, mh = -1; + Evas_Coord fx = 0, fy = 0, fw = 0, fh = 0; + Evas_Coord nx = 0, ny = 0, nw = 0, nh = 0; + const char *p; + + if ((!wd->img) || (!wd->file)) return; + if (((p = strrchr(wd->file, '.'))) && (!strcasecmp(p, ".edj"))) return; + + /* grab image size */ + evas_object_image_size_get(wd->img, &iw, &ih); + if ((iw < 1) || (ih < 1)) return; + + /* grab base object dimensions */ + evas_object_geometry_get(wd->base, &bx, &by, &bw, &bh); + + /* set some defaults */ + nx = bx; + ny = by; + nw = bw; + nh = bh; + + switch (wd->option) + { + case ELM_BG_OPTION_CENTER: + fw = nw = iw; + fh = nh = ih; + nx = ((bw - fw) / 2); + ny = ((bh - fh) / 2); + mw = iw; + mh = ih; + break; + case ELM_BG_OPTION_SCALE: + fw = bw; + fh = ((ih * fw) / iw); + if (fh < bh) + { + fh = bh; + fw = ((iw * fh) / ih); + } + fx = ((bw - fw) / 2); + fy = ((bh - fh) / 2); + break; + case ELM_BG_OPTION_TILE: + fw = iw; + fh = ih; + break; + case ELM_BG_OPTION_STRETCH: + default: + fw = bw; + fh = bh; + break; + } + + evas_object_move(wd->img, nx, ny); + evas_object_resize(wd->img, nw, nh); + evas_object_image_fill_set(wd->img, fx, fy, fw, fh); + + evas_object_size_hint_min_set(wd->img, mw, mh); + evas_object_size_hint_max_set(wd->img, mw, mh); +} + +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd; + if (part && strcmp(part, "overlay")) return; + wd = elm_widget_data_get(obj); + if (!wd) return; + + if (content == wd->overlay) return; + if (wd->overlay) evas_object_del(wd->overlay); + + wd->overlay = content; + if (content) + { + edje_object_part_swallow(wd->base, "elm.swallow.content", content); + elm_widget_sub_object_add(obj, content); + } + + _custom_resize(wd, NULL, NULL, NULL); +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + if (part && strcmp(part, "overlay")) return NULL; + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->overlay; +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + Evas_Object *overlay; + if (part && strcmp(part, "overlay")) return NULL; + wd = elm_widget_data_get(obj); + if (!wd || !wd->overlay) return NULL; + overlay = wd->overlay; + elm_widget_sub_object_del(obj, wd->overlay); + edje_object_part_unswallow(wd->base, wd->overlay); + wd->overlay = NULL; + _custom_resize(wd, NULL, NULL, NULL); + return overlay; +} + +EAPI Evas_Object * +elm_bg_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "bg"); + elm_widget_type_set(obj, "bg"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); + + elm_widget_can_focus_set(obj, EINA_FALSE); + + wd->base = edje_object_add(e); + _elm_theme_object_set(obj, wd->base, "bg", "base", "default"); + elm_widget_resize_object_set(obj, wd->base); + + evas_object_event_callback_add(wd->base, EVAS_CALLBACK_RESIZE, + _custom_resize, wd); + + wd->option = ELM_BG_OPTION_SCALE; + return obj; +} + +EAPI Eina_Bool +elm_bg_file_set(Evas_Object *obj, const char *file, const char *group) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + const char *p; + + if (wd->img) + { + evas_object_del(wd->img); + wd->img = NULL; + } + if (!file) + { + eina_stringshare_del(wd->file); + wd->file = NULL; + eina_stringshare_del(wd->group); + wd->group = NULL; + return EINA_TRUE; + } + eina_stringshare_replace(&wd->file, file); + eina_stringshare_replace(&wd->group, group); + if (((p = strrchr(file, '.'))) && (!strcasecmp(p, ".edj"))) + { + wd->img = edje_object_add(evas_object_evas_get(wd->base)); + edje_object_file_set(wd->img, file, group); + } + else + { + wd->img = evas_object_image_add(evas_object_evas_get(wd->base)); + if ((wd->load_opts.w > 0) && (wd->load_opts.h > 0)) + evas_object_image_load_size_set(wd->img, wd->load_opts.w, wd->load_opts.h); + evas_object_image_file_set(wd->img, file, group); + } + evas_object_repeat_events_set(wd->img, EINA_TRUE); + edje_object_part_swallow(wd->base, "elm.swallow.background", wd->img); + elm_widget_sub_object_add(obj, wd->img); + _custom_resize(wd, NULL, NULL, NULL); + + return EINA_TRUE; +} + +EAPI void +elm_bg_file_get(const Evas_Object *obj, const char **file, const char **group) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (file) *file = wd->file; + if (group) *group = wd->group; + + return; +} + +EAPI void +elm_bg_option_set(Evas_Object *obj, Elm_Bg_Option option) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + wd->option = option; + _custom_resize(wd, NULL, NULL, NULL); + + return; +} + +EAPI Elm_Bg_Option +elm_bg_option_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_BG_OPTION_LAST; + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + return wd->option; +} + +EAPI void +elm_bg_color_set(Evas_Object *obj, int r, int g, int b) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd->rect) + { + wd->rect = evas_object_rectangle_add(evas_object_evas_get(wd->base)); + edje_object_part_swallow(wd->base, "elm.swallow.rectangle", wd->rect); + elm_widget_sub_object_add(obj, wd->rect); + _custom_resize(wd, NULL, NULL, NULL); + } + evas_object_color_set(wd->rect, r, g, b, 255); + + return; +} + +EAPI void +elm_bg_color_get(const Evas_Object *obj, int *r, int *g, int *b) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + evas_object_color_get(wd->rect, r, g, b, NULL); + + return; +} + +EAPI void +elm_bg_load_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + const char *p; + if (!wd) return; + wd->load_opts.w = w; + wd->load_opts.h = h; + if (!wd->img) return; + if (!(((p = strrchr(wd->file, '.'))) && (!strcasecmp(p, ".edj")))) + evas_object_image_load_size_set(wd->img, w, h); + + return; +} + diff --git a/libraries/elementary/src/lib/elm_bg.h b/libraries/elementary/src/lib/elm_bg.h new file mode 100644 index 0000000..6ba62b1 --- /dev/null +++ b/libraries/elementary/src/lib/elm_bg.h @@ -0,0 +1,199 @@ +/** + * @defgroup Bg Bg + * @ingroup Elementary + * + * @image html img/widget/bg/preview-00.png + * @image latex img/widget/bg/preview-00.eps + * + * @brief Background object, used for setting a solid color, image or + * Edje group as a background to a window or any container object. + * + * The bg (background) widget is used for setting (solid) background + * decorations to a window (unless it has transparency enabled) or to + * any container object. It works just like an image, but has some + * properties useful to a background, like setting it to tiled, + * centered, scaled or stretched. + * + * Default content parts of the bg widget that you can use for are: + * @li "overlay" - overlay of the bg + * + * Supported elm_object common APIs. + * @li @ref elm_object_part_content_set + * @li @ref elm_object_part_content_get + * @li @ref elm_object_part_content_unset + * + * Here is some sample code using it: + * @li @ref bg_01_example_page + * @li @ref bg_02_example_page + * @li @ref bg_03_example_page + */ + +/** + * Identifiers on how a background widget is to display its image -- + * if it was set to use an image file. + * + * @see elm_bg_option_set() + * @see elm_bg_option_get() + * + * @ingroup Bg + */ +typedef enum +{ + ELM_BG_OPTION_CENTER, /**< center the background image */ + ELM_BG_OPTION_SCALE, /**< scale the background image, retaining aspect ratio */ + ELM_BG_OPTION_STRETCH, /**< stretch the background image to fill the widget's area */ + ELM_BG_OPTION_TILE, /**< tile background image at its original size */ + ELM_BG_OPTION_LAST /**< sentinel value, also used to indicate errors */ +} Elm_Bg_Option; + +/** + * Add a new background to the parent + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * @ingroup Bg + */ +EAPI Evas_Object *elm_bg_add(Evas_Object *parent); + +/** + * Set the file (image or edje collection) to give life for the + * background + * + * @param obj The background object handle + * @param file The file path + * @param group Optional key (group in Edje) within the file + * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise + * + * This sets the image file used in the background object. If the + * image comes from an Edje group, it will be stretched to completely + * fill the background object. If it comes from a traditional image file, it + * will by default be centered in this widget's are (thus retaining + * its aspect), what could lead to some parts being not visible. You + * may change the mode of exhibition for a real image file with + * elm_bg_option_set(). + * + * @note Once the image of @p obj is set, a previously set one will be + * deleted, even if @p file is NULL. + * + * @note This will only affect the contents of one of the background's + * swallow spots, namely @c "elm.swallow.background". If you want to + * achieve the @c Layout's file setting behavior, you'll have to call + * that method on this object. + * + * @ingroup Bg + */ +EAPI Eina_Bool elm_bg_file_set(Evas_Object *obj, const char *file, const char *group); + +/** + * Get the file (image or edje collection) set on a given background + * widget + * + * @param obj The background object handle + * @param file Where to store the requested file's path + * @param group Where to store the optional key within @a file, @b if + * it's an Edje file + * + * @note Use @c NULL pointers on the file components you're not + * interested in: they'll be ignored by the function. + * + * @ingroup Bg + */ +EAPI void elm_bg_file_get(const Evas_Object *obj, const char **file, const char **group); + +/** + * Set the mode of display for a given background widget's image + * + * @param obj The background object handle + * @param option The desired background option (see #Elm_Bg_Option) + * + * This sets how the background widget will display its image. This + * will only work if the elm_bg_file_set() was previously called with + * an image file on @a obj. The image can be display tiled, scaled, + * centered or stretched. + * + * @see elm_bg_option_get() + * + * @ingroup Bg + */ +EAPI void elm_bg_option_set(Evas_Object *obj, Elm_Bg_Option option); + +/** + * Get the mode of display for a given background widget's image + * + * @param obj The background object handle + * @return The image displaying mode in use for @a obj or + * #ELM_BG_OPTION_LAST, on errors. + * + * @see elm_bg_option_set() for more details + * + * @ingroup Bg + */ +EAPI Elm_Bg_Option elm_bg_option_get(const Evas_Object *obj); + +/** + * Set the color on a given background widget + * + * @param obj The background object handle + * @param r The red color component's value + * @param g The green color component's value + * @param b The blue color component's value + * + * This sets the color used for the background rectangle, in RGB + * format. Each color component's range is from 0 to 255. + * + * @note You probably only want to use this function if you haven't + * previously called elm_bg_file_set(), so that you just want a solid + * color background. + * + * @see elm_bg_color_get() + * + * @ingroup Bg + */ +EAPI void elm_bg_color_set(Evas_Object *obj, int r, int g, int b); + +/** + * Get the color set on a given background widget + * + * @param obj The background object handle + * @param r Where to store the red color component's value + * @param g Where to store the green color component's value + * @param b Where to store the blue color component's value + * + * @note Use @c NULL pointers on the file components you're not + * interested in: they'll be ignored by the function. + * + * @see elm_bg_color_get() for more details + * + * @ingroup Bg + */ +EAPI void elm_bg_color_get(const Evas_Object *obj, int *r, int *g, int *b); + +/** + * Set the size of the pixmap representation of the image set on a + * given background widget. + * + * @param obj The background object handle + * @param w The new width of the image pixmap representation. + * @param h The new height of the image pixmap representation. + * + * @warning This function just makes sense if an image file was set on + * @p obj, with elm_bg_file_set(). + * + * This function sets a new size for pixmap representation of the + * given bg image. It allows for the image to be loaded already in the + * specified size, reducing the memory usage and load time (for + * example, when loading a big image file with its load size set to a + * smaller size) + * + * @note This is just a hint for the underlying system. The real size + * of the pixmap may differ depending on the type of image being + * loaded, being bigger than requested. + * + * @ingroup Bg + */ +EAPI void elm_bg_load_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_box.c b/libraries/elementary/src/lib/elm_box.c new file mode 100644 index 0000000..bcf0b38 --- /dev/null +++ b/libraries/elementary/src/lib/elm_box.c @@ -0,0 +1,683 @@ +#include +#include "elm_priv.h" +#include "els_box.h" + +static const char SIG_CHILD_ADDED[] = "child,added"; +static const char SIG_CHILD_REMOVED[] = "child,removed"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CHILD_ADDED, ""}, + {SIG_CHILD_REMOVED, ""}, + {NULL, NULL} +}; + + +typedef struct _Widget_Data Widget_Data; +typedef struct _Transition_Animation_Data Transition_Animation_Data; + +struct _Widget_Data +{ + Evas_Object *box; + Eina_Bool horizontal:1; + Eina_Bool homogeneous:1; + Eina_Bool recalc:1; +}; + +struct _Elm_Box_Transition +{ + double initial_time; + double duration; + Eina_Bool animation_ended:1; + Eina_Bool recalculate:1; + Ecore_Animator *animator; + + struct + { + Evas_Object_Box_Layout layout; + void *data; + void(*free_data)(void *data); + } start, end; + + void(*transition_end_cb)(void *data); + void *transition_end_data; + void (*transition_end_free_data)(void *data); + Eina_List *objs; + Evas_Object *box; +}; + +struct _Transition_Animation_Data +{ + Evas_Object *obj; + struct + { + Evas_Coord x, y, w, h; + } start, end; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _sub_del(void *data, Evas_Object *obj, void *event_info); + +static void +_del_pre_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_event_callback_del_full + (wd->box, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj); + evas_object_box_remove_all(wd->box, EINA_FALSE); +} + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + free(wd); +} + +static void * +_elm_box_list_data_get(const Eina_List *list) +{ + Evas_Object_Box_Option *opt = eina_list_data_get(list); + return opt->obj; +} + +static void +_cb_proxy_child_added(void *data, Evas_Object *o __UNUSED__, void *event_info) +{ + Evas_Object *box = data; + Evas_Object_Box_Option *opt = event_info; + evas_object_smart_callback_call(box, SIG_CHILD_ADDED, opt->obj); +} + +static void +_cb_proxy_child_removed(void *data, Evas_Object *o __UNUSED__, void *event_info) +{ + Evas_Object *box = data; + Evas_Object *child = event_info; + evas_object_smart_callback_call(box, SIG_CHILD_REMOVED, child); +} + +static Eina_Bool +_elm_box_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next) +{ + Widget_Data *wd = elm_widget_data_get(obj); + const Eina_List *items; + void *(*list_data_get) (const Eina_List *list); + + if ((!wd) || (!wd->box)) + return EINA_FALSE; + + /* Focus chain */ + /* TODO: Change this to use other chain */ + if ((items = elm_widget_focus_custom_chain_get(obj))) + list_data_get = eina_list_data_get; + else + { + Evas_Object_Box_Data *bd = evas_object_smart_data_get(wd->box); + items = bd->children; + list_data_get = _elm_box_list_data_get; + + if (!items) return EINA_FALSE; + } + + return elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_widget_mirrored_reload(obj); + evas_object_smart_calculate(wd->box); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; + Evas_Coord w, h; + if (!wd) return; + evas_object_size_hint_min_get(wd->box, &minw, &minh); + evas_object_size_hint_max_get(wd->box, &maxw, &maxh); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, maxw, maxh); + evas_object_geometry_get(obj, NULL, NULL, &w, &h); + if (w < minw) w = minw; + if (h < minh) h = minh; + if ((maxw >= 0) && (w > maxw)) w = maxw; + if ((maxh >= 0) && (h > maxh)) h = maxh; + evas_object_resize(obj, w, h); +} + +static void +_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _sizing_eval(data); +} + +static void +_sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + _sizing_eval(obj); +} + +static void +_layout(Evas_Object *o, Evas_Object_Box_Data *priv, void *data) +{ + Evas_Object *obj = (Evas_Object *) data; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _els_box_layout(o, priv, wd->horizontal, wd->homogeneous, + elm_widget_mirrored_get(obj)); +} + +static Eina_Bool +_transition_animation(void *data) +{ + evas_object_smart_changed(data); + return ECORE_CALLBACK_RENEW; +} + +static void +_transition_layout_child_added(void *data, Evas_Object *obj __UNUSED__, void *event_info) +{ + Transition_Animation_Data *tad; + Evas_Object_Box_Option *opt = event_info; + Elm_Box_Transition *layout_data = data; + + tad = calloc(1, sizeof(Transition_Animation_Data)); + if (!tad) return; + tad->obj = opt->obj; + layout_data->objs = eina_list_append(layout_data->objs, tad); + layout_data->recalculate = EINA_TRUE; +} + +static void +_transition_layout_child_removed(void *data, Evas_Object *obj __UNUSED__, void *event_info) +{ + Eina_List *l; + Transition_Animation_Data *tad; + Elm_Box_Transition *layout_data = data; + + EINA_LIST_FOREACH(layout_data->objs, l, tad) + { + if (tad->obj == event_info) + { + free(eina_list_data_get(l)); + layout_data->objs = eina_list_remove_list(layout_data->objs, l); + layout_data->recalculate = EINA_TRUE; + break; + } + } +} + +static void +_transition_layout_obj_resize_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Box_Transition *layout_data = data; + layout_data->recalculate = EINA_TRUE; +} + +static void +_transition_layout_calculate_coords(Evas_Object *obj, Evas_Object_Box_Data *priv, + Elm_Box_Transition *layout_data) +{ + Eina_List *l; + Transition_Animation_Data *tad; + Evas_Coord x, y, w, h; + const double curtime = ecore_loop_time_get(); + + layout_data->duration = + layout_data->duration - (curtime - layout_data->initial_time); + layout_data->initial_time = curtime; + + evas_object_geometry_get(obj, &x, &y, &w, &h); + EINA_LIST_FOREACH(layout_data->objs, l, tad) + { + evas_object_geometry_get(tad->obj, &tad->start.x, &tad->start.y, + &tad->start.w, &tad->start.h); + tad->start.x = tad->start.x - x; + tad->start.y = tad->start.y - y; + } + layout_data->end.layout(obj, priv, layout_data->end.data); + EINA_LIST_FOREACH(layout_data->objs, l, tad) + { + evas_object_geometry_get(tad->obj, &tad->end.x, &tad->end.y, + &tad->end.w, &tad->end.h); + tad->end.x = tad->end.x - x; + tad->end.y = tad->end.y - y; + } +} + +static Eina_Bool +_transition_layout_load_children_list(Evas_Object_Box_Data *priv, + Elm_Box_Transition *layout_data) +{ + Eina_List *l; + Evas_Object_Box_Option *opt; + Transition_Animation_Data *tad; + + EINA_LIST_FREE(layout_data->objs, tad) + free(tad); + + EINA_LIST_FOREACH(priv->children, l, opt) + { + tad = calloc(1, sizeof(Transition_Animation_Data)); + if (!tad) + { + EINA_LIST_FREE(layout_data->objs, tad) + free(tad); + layout_data->objs = NULL; + return EINA_FALSE; + } + tad->obj = opt->obj; + layout_data->objs = eina_list_append(layout_data->objs, tad); + } + return EINA_TRUE; +} + +static Eina_Bool +_transition_layout_animation_start(Evas_Object *obj, Evas_Object_Box_Data *priv, + Elm_Box_Transition *layout_data, Eina_Bool(*transition_animation_cb)(void *data)) +{ + layout_data->start.layout(obj, priv, layout_data->start.data); + layout_data->box = obj; + layout_data->initial_time = ecore_loop_time_get(); + + if (!_transition_layout_load_children_list(priv, layout_data)) + return EINA_FALSE; + _transition_layout_calculate_coords(obj, priv, layout_data); + + evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, + _transition_layout_obj_resize_cb, layout_data); + evas_object_smart_callback_add(obj, SIG_CHILD_ADDED, + _transition_layout_child_added, layout_data); + evas_object_smart_callback_add(obj, SIG_CHILD_REMOVED, + _transition_layout_child_removed, layout_data); + if (!layout_data->animator) + layout_data->animator = ecore_animator_add(transition_animation_cb, obj); + layout_data->animation_ended = EINA_FALSE; + return EINA_TRUE; +} + +static void +_transition_layout_animation_stop(Elm_Box_Transition *layout_data) +{ + layout_data->animation_ended = EINA_TRUE; + if (layout_data->animator) + { + ecore_animator_del(layout_data->animator); + layout_data->animator = NULL; + } + + if (layout_data->transition_end_cb) + layout_data->transition_end_cb(layout_data->transition_end_data); +} + +static void +_transition_layout_animation_exec(Evas_Object *obj, Evas_Object_Box_Data *priv __UNUSED__, + Elm_Box_Transition *layout_data, const double curtime) +{ + Eina_List *l; + Transition_Animation_Data *tad; + Evas_Coord x, y, w, h; + Evas_Coord cur_x, cur_y, cur_w, cur_h; + double progress = 0.0; + + progress = (curtime - layout_data->initial_time) / layout_data->duration; + evas_object_geometry_get(obj, &x, &y, &w, &h); + + EINA_LIST_FOREACH(layout_data->objs, l, tad) + { + cur_x = x + tad->start.x + ((tad->end.x - tad->start.x) * progress); + cur_y = y + tad->start.y + ((tad->end.y - tad->start.y) * progress); + cur_w = tad->start.w + ((tad->end.w - tad->start.w) * progress); + cur_h = tad->start.h + ((tad->end.h - tad->start.h) * progress); + evas_object_move(tad->obj, cur_x, cur_y); + evas_object_resize(tad->obj, cur_w, cur_h); + } +} + +EAPI Evas_Object * +elm_box_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "box"); + elm_widget_type_set(obj, "box"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); + elm_widget_focus_next_hook_set(obj, _elm_box_focus_next_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); + elm_widget_highlight_ignore_set(obj, EINA_TRUE); + elm_widget_theme_hook_set(obj, _theme_hook); + + wd->box = evas_object_box_add(e); + /*evas_object_box_layout_set(wd->box, evas_object_box_layout_vertical, + NULL, NULL);*/ + evas_object_box_layout_set(wd->box, _layout, obj, NULL); + + evas_object_event_callback_add(wd->box, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + elm_widget_resize_object_set(obj, wd->box); + + evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + evas_object_smart_callback_add + (wd->box, SIG_CHILD_ADDED, _cb_proxy_child_added, obj); + evas_object_smart_callback_add + (wd->box, SIG_CHILD_REMOVED, _cb_proxy_child_removed, obj); + + return obj; +} + +EAPI void +elm_box_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->horizontal = !!horizontal; + evas_object_smart_calculate(wd->box); + /*if (wd->horizontal) + { + if (wd->homogeneous) + evas_object_box_layout_set(wd->box, + evas_object_box_layout_homogeneous_horizontal, NULL, NULL); + else + evas_object_box_layout_set(wd->box, evas_object_box_layout_horizontal, + NULL, NULL); + } + else + { + if (wd->homogeneous) + evas_object_box_layout_set(wd->box, + evas_object_box_layout_homogeneous_vertical, NULL, NULL); + else + evas_object_box_layout_set(wd->box, evas_object_box_layout_horizontal, + NULL, NULL); + } */ +} + +EAPI Eina_Bool +elm_box_horizontal_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->horizontal; +} + +EAPI void +elm_box_homogeneous_set(Evas_Object *obj, Eina_Bool homogeneous) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->homogeneous = !!homogeneous; + evas_object_smart_calculate(wd->box); + /*if (wd->horizontal) + { + if (wd->homogeneous) + evas_object_box_layout_set(wd->box, + evas_object_box_layout_homogeneous_horizontal, NULL, NULL); + else + evas_object_box_layout_set(wd->box, evas_object_box_layout_horizontal, + NULL, NULL); + } + else + { + if (wd->homogeneous) + evas_object_box_layout_set(wd->box, + evas_object_box_layout_homogeneous_vertical, NULL, NULL); + else + evas_object_box_layout_set(wd->box, evas_object_box_layout_horizontal, + NULL, NULL); + } */ +} + +EAPI Eina_Bool +elm_box_homogeneous_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->homogeneous; +} + +EAPI void +elm_box_pack_start(Evas_Object *obj, Evas_Object *subobj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_widget_sub_object_add(obj, subobj); + evas_object_box_prepend(wd->box, subobj); +} + +EAPI void +elm_box_pack_end(Evas_Object *obj, Evas_Object *subobj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_widget_sub_object_add(obj, subobj); + evas_object_box_append(wd->box, subobj); +} + +EAPI void +elm_box_pack_before(Evas_Object *obj, Evas_Object *subobj, Evas_Object *before) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_widget_sub_object_add(obj, subobj); + evas_object_box_insert_before(wd->box, subobj, before); +} + +EAPI void +elm_box_pack_after(Evas_Object *obj, Evas_Object *subobj, Evas_Object *after) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_widget_sub_object_add(obj, subobj); + evas_object_box_insert_after(wd->box, subobj, after); +} + +EAPI void +elm_box_clear(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_box_remove_all(wd->box, EINA_TRUE); +} + +EAPI void +elm_box_unpack(Evas_Object *obj, Evas_Object *subobj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_box_remove(wd->box, subobj); +} + +EAPI void +elm_box_unpack_all(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_box_remove_all(wd->box, EINA_FALSE); +} + +EAPI void +elm_box_layout_set(Evas_Object *obj, Evas_Object_Box_Layout cb, const void *data, Ecore_Cb free_data) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (cb) + evas_object_box_layout_set(wd->box, cb, data, free_data); + else + evas_object_box_layout_set(wd->box, _layout, obj, NULL); +} + +EAPI void +elm_box_layout_transition(Evas_Object *obj, Evas_Object_Box_Data *priv, void *data) +{ + Elm_Box_Transition *box_data = data; + const double curtime = ecore_loop_time_get(); + + if (box_data->animation_ended) + { + box_data->end.layout(obj, priv, box_data->end.data); + return; + } + + if (!box_data->animator) + { + if (!_transition_layout_animation_start(obj, priv, box_data, + _transition_animation)) + return; + } + else + { + if (box_data->recalculate) + { + _transition_layout_calculate_coords(obj, priv, box_data); + box_data->recalculate = EINA_FALSE; + } + } + + if ((curtime >= box_data->duration + box_data->initial_time)) + _transition_layout_animation_stop(box_data); + else + _transition_layout_animation_exec(obj, priv, box_data, curtime); +} + +EAPI Elm_Box_Transition * +elm_box_transition_new(const double duration, + Evas_Object_Box_Layout start_layout, void *start_layout_data, + Ecore_Cb start_layout_free_data, + Evas_Object_Box_Layout end_layout, void *end_layout_data, + Ecore_Cb end_layout_free_data, + Ecore_Cb transition_end_cb, + void *transition_end_data) +{ + Elm_Box_Transition *box_data; + + EINA_SAFETY_ON_NULL_RETURN_VAL(start_layout, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(end_layout, NULL); + + box_data = calloc(1, sizeof(Elm_Box_Transition)); + if (!box_data) + return NULL; + + box_data->start.layout = start_layout; + box_data->start.data = start_layout_data; + box_data->start.free_data = start_layout_free_data; + box_data->end.layout = end_layout; + box_data->end.data = end_layout_data; + box_data->end.free_data = end_layout_free_data; + box_data->duration = duration; + box_data->transition_end_cb = transition_end_cb; + box_data->transition_end_data = transition_end_data; + return box_data; +} + +EAPI void +elm_box_transition_free(void *data) +{ + EINA_SAFETY_ON_NULL_RETURN(data); + + Transition_Animation_Data *tad; + Elm_Box_Transition *box_data = data; + if ((box_data->start.free_data) && (box_data->start.data)) + box_data->start.free_data(box_data->start.data); + if ((box_data->end.free_data) && (box_data->end.data)) + box_data->end.free_data(box_data->end.data); + EINA_LIST_FREE(box_data->objs, tad) + free(tad); + evas_object_event_callback_del(box_data->box, EVAS_CALLBACK_RESIZE, _transition_layout_obj_resize_cb); + evas_object_smart_callback_del(box_data->box, SIG_CHILD_ADDED, _transition_layout_child_added); + evas_object_smart_callback_del(box_data->box, SIG_CHILD_REMOVED, _transition_layout_child_removed); + if (box_data->animator) + { + ecore_animator_del(box_data->animator); + box_data->animator = NULL; + } + free(data); +} + +EAPI Eina_List * +elm_box_children_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return evas_object_box_children_get(wd->box); +} + +EAPI void +elm_box_padding_set(Evas_Object *obj, Evas_Coord horizontal, Evas_Coord vertical) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_box_padding_set(wd->box, horizontal, vertical); +} + +EAPI void +elm_box_padding_get(const Evas_Object *obj, Evas_Coord *horizontal, Evas_Coord *vertical) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_box_padding_get(wd->box, horizontal, vertical); +} + +EAPI void +elm_box_align_set(Evas_Object *obj, double horizontal, double vertical) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_size_hint_align_set(wd->box, horizontal, vertical); +} + +EAPI void +elm_box_align_get(const Evas_Object *obj, double *horizontal, double *vertical) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_size_hint_align_get(wd->box, horizontal, vertical); +} + +EAPI void +elm_box_recalculate(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (wd->recalc)) return; + evas_object_smart_need_recalculate_set(wd->box, EINA_TRUE); + wd->recalc++; + evas_object_smart_calculate(wd->box); + wd->recalc--; +} diff --git a/libraries/elementary/src/lib/elm_box.h b/libraries/elementary/src/lib/elm_box.h new file mode 100644 index 0000000..43011ab --- /dev/null +++ b/libraries/elementary/src/lib/elm_box.h @@ -0,0 +1,498 @@ +/** + * @defgroup Box Box + * @ingroup Elementary + * + * @image html img/widget/box/preview-00.png + * @image latex img/widget/box/preview-00.eps width=\textwidth + * + * @image html img/box.png + * @image latex img/box.eps width=\textwidth + * + * A box arranges objects in a linear fashion, governed by a layout function + * that defines the details of this arrangement. + * + * By default, the box will use an internal function to set the layout to + * a single row, either vertical or horizontal. This layout is affected + * by a number of parameters, such as the homogeneous flag set by + * elm_box_homogeneous_set(), the values given by elm_box_padding_set() and + * elm_box_align_set() and the hints set to each object in the box. + * + * For this default layout, it's possible to change the orientation with + * elm_box_horizontal_set(). The box will start in the vertical orientation, + * placing its elements ordered from top to bottom. When horizontal is set, + * the order will go from left to right. If the box is set to be + * homogeneous, every object in it will be assigned the same space, that + * of the largest object. Padding can be used to set some spacing between + * the cell given to each object. The alignment of the box, set with + * elm_box_align_set(), determines how the bounding box of all the elements + * will be placed within the space given to the box widget itself. + * + * The size hints of each object also affect how they are placed and sized + * within the box. evas_object_size_hint_min_set() will give the minimum + * size the object can have, and the box will use it as the basis for all + * latter calculations. Elementary widgets set their own minimum size as + * needed, so there's rarely any need to use it manually. + * + * evas_object_size_hint_weight_set(), when not in homogeneous mode, is + * used to tell whether the object will be allocated the minimum size it + * needs or if the space given to it should be expanded. It's important + * to realize that expanding the size given to the object is not the same + * thing as resizing the object. It could very well end being a small + * widget floating in a much larger empty space. If not set, the weight + * for objects will normally be 0.0 for both axis, meaning the widget will + * not be expanded. To take as much space possible, set the weight to + * EVAS_HINT_EXPAND (defined to 1.0) for the desired axis to expand. + * + * Besides how much space each object is allocated, it's possible to control + * how the widget will be placed within that space using + * evas_object_size_hint_align_set(). By default, this value will be 0.5 + * for both axis, meaning the object will be centered, but any value from + * 0.0 (left or top, for the @c x and @c y axis, respectively) to 1.0 + * (right or bottom) can be used. The special value EVAS_HINT_FILL, which + * is -1.0, means the object will be resized to fill the entire space it + * was allocated. + * + * In addition, customized functions to define the layout can be set, which + * allow the application developer to organize the objects within the box + * in any number of ways. + * + * The special elm_box_layout_transition() function can be used + * to switch from one layout to another, animating the motion of the + * children of the box. + * + * @note Objects should not be added to box objects using _add() calls. + * + * Some examples on how to use boxes follow: + * @li @ref box_example_01 + * @li @ref box_example_02 + * + * @{ + */ +/** + * @typedef Elm_Box_Transition + * + * Opaque handler containing the parameters to perform an animated + * transition of the layout the box uses. + * + * @see elm_box_transition_new() + * @see elm_box_layout_set() + * @see elm_box_layout_transition() + */ +typedef struct _Elm_Box_Transition Elm_Box_Transition; + +/** + * Add a new box to the parent + * + * By default, the box will be in vertical mode and non-homogeneous. + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * @ingroup Box + */ +EAPI Evas_Object *elm_box_add(Evas_Object *parent); + +/** + * Set the horizontal orientation + * + * By default, box object arranges their contents vertically from top to + * bottom. + * By calling this function with @p horizontal as EINA_TRUE, the box will + * become horizontal, arranging contents from left to right. + * + * @note This flag is ignored if a custom layout function is set. + * + * @param obj The box object + * @param horizontal The horizontal flag (EINA_TRUE = horizontal, + * EINA_FALSE = vertical) + * + * @ingroup Box + */ +EAPI void elm_box_horizontal_set(Evas_Object *obj, Eina_Bool horizontal); + +/** + * Get the horizontal orientation + * + * @param obj The box object + * @return EINA_TRUE if the box is set to horizontal mode, EINA_FALSE otherwise + */ +EAPI Eina_Bool elm_box_horizontal_get(const Evas_Object *obj); + +/** + * Set the box to arrange its children homogeneously + * + * If enabled, homogeneous layout makes all items the same size, according + * to the size of the largest of its children. + * + * @note This flag is ignored if a custom layout function is set. + * + * @param obj The box object + * @param homogeneous The homogeneous flag + * + * @ingroup Box + */ +EAPI void elm_box_homogeneous_set(Evas_Object *obj, Eina_Bool homogeneous); + +/** + * Get whether the box is using homogeneous mode or not + * + * @param obj The box object + * @return EINA_TRUE if it's homogeneous, EINA_FALSE otherwise + * + * @ingroup Box + */ +EAPI Eina_Bool elm_box_homogeneous_get(const Evas_Object *obj); + +/** + * Add an object to the beginning of the pack list + * + * Pack @p subobj into the box @p obj, placing it first in the list of + * children objects. The actual position the object will get on screen + * depends on the layout used. If no custom layout is set, it will be at + * the top or left, depending if the box is vertical or horizontal, + * respectively. + * + * @param obj The box object + * @param subobj The object to add to the box + * + * @see elm_box_pack_end() + * @see elm_box_pack_before() + * @see elm_box_pack_after() + * @see elm_box_unpack() + * @see elm_box_unpack_all() + * @see elm_box_clear() + * + * @ingroup Box + */ +EAPI void elm_box_pack_start(Evas_Object *obj, Evas_Object *subobj); + +/** + * Add an object at the end of the pack list + * + * Pack @p subobj into the box @p obj, placing it last in the list of + * children objects. The actual position the object will get on screen + * depends on the layout used. If no custom layout is set, it will be at + * the bottom or right, depending if the box is vertical or horizontal, + * respectively. + * + * @param obj The box object + * @param subobj The object to add to the box + * + * @see elm_box_pack_start() + * @see elm_box_pack_before() + * @see elm_box_pack_after() + * @see elm_box_unpack() + * @see elm_box_unpack_all() + * @see elm_box_clear() + * + * @ingroup Box + */ +EAPI void elm_box_pack_end(Evas_Object *obj, Evas_Object *subobj); + +/** + * Adds an object to the box before the indicated object + * + * This will add the @p subobj to the box indicated before the object + * indicated with @p before. If @p before is not already in the box, results + * are undefined. Before means either to the left of the indicated object or + * above it depending on orientation. + * + * @param obj The box object + * @param subobj The object to add to the box + * @param before The object before which to add it + * + * @see elm_box_pack_start() + * @see elm_box_pack_end() + * @see elm_box_pack_after() + * @see elm_box_unpack() + * @see elm_box_unpack_all() + * @see elm_box_clear() + * + * @ingroup Box + */ +EAPI void elm_box_pack_before(Evas_Object *obj, Evas_Object *subobj, Evas_Object *before); + +/** + * Adds an object to the box after the indicated object + * + * This will add the @p subobj to the box indicated after the object + * indicated with @p after. If @p after is not already in the box, results + * are undefined. After means either to the right of the indicated object or + * below it depending on orientation. + * + * @param obj The box object + * @param subobj The object to add to the box + * @param after The object after which to add it + * + * @see elm_box_pack_start() + * @see elm_box_pack_end() + * @see elm_box_pack_before() + * @see elm_box_unpack() + * @see elm_box_unpack_all() + * @see elm_box_clear() + * + * @ingroup Box + */ +EAPI void elm_box_pack_after(Evas_Object *obj, Evas_Object *subobj, Evas_Object *after); + +/** + * Clear the box of all children + * + * Remove all the elements contained by the box, deleting the respective + * objects. + * + * @param obj The box object + * + * @see elm_box_unpack() + * @see elm_box_unpack_all() + * + * @ingroup Box + */ +EAPI void elm_box_clear(Evas_Object *obj); + +/** + * Unpack a box item + * + * Remove the object given by @p subobj from the box @p obj without + * deleting it. + * + * @param obj The box object + * @param subobj The object to unpack + * + * @see elm_box_unpack_all() + * @see elm_box_clear() + * + * @ingroup Box + */ +EAPI void elm_box_unpack(Evas_Object *obj, Evas_Object *subobj); + +/** + * Remove all items from the box, without deleting them + * + * Clear the box from all children, but don't delete the respective objects. + * If no other references of the box children exist, the objects will never + * be deleted, and thus the application will leak the memory. Make sure + * when using this function that you hold a reference to all the objects + * in the box @p obj. + * + * @param obj The box object + * + * @see elm_box_clear() + * @see elm_box_unpack() + * + * @ingroup Box + */ +EAPI void elm_box_unpack_all(Evas_Object *obj); + +/** + * Retrieve a list of the objects packed into the box + * + * Returns a new @c Eina_List with a pointer to @c Evas_Object in its nodes. + * The order of the list corresponds to the packing order the box uses. + * + * You must free this list with eina_list_free() once you are done with it. + * + * @param obj The box object + * + * @ingroup Box + */ +EAPI Eina_List *elm_box_children_get(const Evas_Object *obj); + +/** + * Set the space (padding) between the box's elements. + * + * Extra space in pixels that will be added between a box child and its + * neighbors after its containing cell has been calculated. This padding + * is set for all elements in the box, besides any possible padding that + * individual elements may have through their size hints. + * + * @param obj The box object + * @param horizontal The horizontal space between elements + * @param vertical The vertical space between elements + * + * @ingroup Box + */ +EAPI void elm_box_padding_set(Evas_Object *obj, Evas_Coord horizontal, Evas_Coord vertical); + +/** + * Get the space (padding) between the box's elements. + * + * @param obj The box object + * @param horizontal The horizontal space between elements + * @param vertical The vertical space between elements + * + * @see elm_box_padding_set() + * + * @ingroup Box + */ +EAPI void elm_box_padding_get(const Evas_Object *obj, Evas_Coord *horizontal, Evas_Coord *vertical); + +/** + * Set the alignment of the whole bounding box of contents. + * + * Sets how the bounding box containing all the elements of the box, after + * their sizes and position has been calculated, will be aligned within + * the space given for the whole box widget. + * + * @param obj The box object + * @param horizontal The horizontal alignment of elements + * @param vertical The vertical alignment of elements + * + * @ingroup Box + */ +EAPI void elm_box_align_set(Evas_Object *obj, double horizontal, double vertical); + +/** + * Get the alignment of the whole bounding box of contents. + * + * @param obj The box object + * @param horizontal The horizontal alignment of elements + * @param vertical The vertical alignment of elements + * + * @see elm_box_align_set() + * + * @ingroup Box + */ +EAPI void elm_box_align_get(const Evas_Object *obj, double *horizontal, double *vertical); + +/** + * Force the box to recalculate its children packing. + * + * If any children was added or removed, box will not calculate the + * values immediately rather leaving it to the next main loop + * iteration. While this is great as it would save lots of + * recalculation, whenever you need to get the position of a just + * added item you must force recalculate before doing so. + * + * @param obj The box object. + * + * @ingroup Box + */ +EAPI void elm_box_recalculate(Evas_Object *obj); + +/** + * Set the layout defining function to be used by the box + * + * Whenever anything changes that requires the box in @p obj to recalculate + * the size and position of its elements, the function @p cb will be called + * to determine what the layout of the children will be. + * + * Once a custom function is set, everything about the children layout + * is defined by it. The flags set by elm_box_horizontal_set() and + * elm_box_homogeneous_set() no longer have any meaning, and the values + * given by elm_box_padding_set() and elm_box_align_set() are up to this + * layout function to decide if they are used and how. These last two + * will be found in the @c priv parameter, of type @c Evas_Object_Box_Data, + * passed to @p cb. The @c Evas_Object the function receives is not the + * Elementary widget, but the internal Evas Box it uses, so none of the + * functions described here can be used on it. + * + * Any of the layout functions in @c Evas can be used here, as well as the + * special elm_box_layout_transition(). + * + * The final @p data argument received by @p cb is the same @p data passed + * here, and the @p free_data function will be called to free it + * whenever the box is destroyed or another layout function is set. + * + * Setting @p cb to NULL will revert back to the default layout function. + * + * @param obj The box object + * @param cb The callback function used for layout + * @param data Data that will be passed to layout function + * @param free_data Function called to free @p data + * + * @see elm_box_layout_transition() + * + * @ingroup Box + */ +EAPI void elm_box_layout_set(Evas_Object *obj, Evas_Object_Box_Layout cb, const void *data, Ecore_Cb free_data); + +/** + * Special layout function that animates the transition from one layout to another + * + * Normally, when switching the layout function for a box, this will be + * reflected immediately on screen on the next render, but it's also + * possible to do this through an animated transition. + * + * This is done by creating an ::Elm_Box_Transition and setting the box + * layout to this function. + * + * For example: + * @code + * Elm_Box_Transition *t = elm_box_transition_new(1.0, + * evas_object_box_layout_vertical, // start + * NULL, // data for initial layout + * NULL, // free function for initial data + * evas_object_box_layout_horizontal, // end + * NULL, // data for final layout + * NULL, // free function for final data + * anim_end, // will be called when animation ends + * NULL); // data for anim_end function\ + * elm_box_layout_set(box, elm_box_layout_transition, t, + * elm_box_transition_free); + * @endcode + * + * @note This function can only be used with elm_box_layout_set(). Calling + * it directly will not have the expected results. + * + * @see elm_box_transition_new + * @see elm_box_transition_free + * @see elm_box_layout_set + * + * @ingroup Box + */ +EAPI void elm_box_layout_transition(Evas_Object *obj, Evas_Object_Box_Data *priv, void *data); + +/** + * Create a new ::Elm_Box_Transition to animate the switch of layouts + * + * If you want to animate the change from one layout to another, you need + * to set the layout function of the box to elm_box_layout_transition(), + * passing as user data to it an instance of ::Elm_Box_Transition with the + * necessary information to perform this animation. The free function to + * set for the layout is elm_box_transition_free(). + * + * The parameters to create an ::Elm_Box_Transition sum up to how long + * will it be, in seconds, a layout function to describe the initial point, + * another for the final position of the children and one function to be + * called when the whole animation ends. This last function is useful to + * set the definitive layout for the box, usually the same as the end + * layout for the animation, but could be used to start another transition. + * + * @param duration The duration of the transition in seconds + * @param start_layout The layout function that will be used to start the animation + * @param start_layout_data The data to be passed the @p start_layout function + * @param start_layout_free_data Function to free @p start_layout_data + * @param end_layout The layout function that will be used to end the animation + * @param end_layout_data Data param passed to @p end_layout + * @param end_layout_free_data The data to be passed the @p end_layout function + * @param end_layout_free_data Function to free @p end_layout_data + * @param transition_end_cb Callback function called when animation ends + * @param transition_end_data Data to be passed to @p transition_end_cb + * @return An instance of ::Elm_Box_Transition + * + * @see elm_box_transition_new + * @see elm_box_layout_transition + * + * @ingroup Box + */ +EAPI Elm_Box_Transition *elm_box_transition_new(const double duration, Evas_Object_Box_Layout start_layout, void *start_layout_data, Ecore_Cb start_layout_free_data, Evas_Object_Box_Layout end_layout, void *end_layout_data, Ecore_Cb end_layout_free_data, Ecore_Cb transition_end_cb, void *transition_end_data); + +/** + * Free a Elm_Box_Transition instance created with elm_box_transition_new(). + * + * This function is mostly useful as the @c free_data parameter in + * elm_box_layout_set() when elm_box_layout_transition(). + * + * @param data The Elm_Box_Transition instance to be freed. + * + * @see elm_box_transition_new + * @see elm_box_layout_transition + * + * @ingroup Box + */ +EAPI void elm_box_transition_free(void *data); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_bubble.c b/libraries/elementary/src/lib/elm_bubble.c new file mode 100644 index 0000000..0f35578 --- /dev/null +++ b/libraries/elementary/src/lib/elm_bubble.c @@ -0,0 +1,368 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *bbl; + Evas_Object *content, *icon; + const char *label, *info, *corner; + Elm_Bubble_Pos pos; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); +static void _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content); +static Evas_Object *_content_get_hook(const Evas_Object *obj, const char *part); +static Evas_Object *_content_unset_hook(Evas_Object *obj, const char *part); +static void _theme_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _sub_del(void *data, Evas_Object *obj, void *event_info); + +static const char SIG_CLICKED[] = "clicked"; + +static const Evas_Smart_Cb_Description _signals[] = +{ + {SIG_CLICKED, ""}, + {NULL, NULL} +}; + +static const char *corner_string[] = +{ + "top_left", + "top_right", + "bottom_left", + "bottom_right" +}; + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->label) eina_stringshare_del(wd->label); + if (wd->info) eina_stringshare_del(wd->info); + if (wd->corner) eina_stringshare_del(wd->corner); + free(wd); +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->bbl, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _elm_theme_object_set(obj, wd->bbl, "bubble", corner_string[wd->pos], + elm_widget_style_get(obj)); + edje_object_part_text_escaped_set(wd->bbl, "elm.text", wd->label); + if (wd->label) edje_object_signal_emit(wd->bbl, "elm,state,text,visible", "elm"); + else edje_object_signal_emit(wd->bbl, "elm,state,text,hidden", "elm"); + edje_object_part_text_escaped_set(wd->bbl, "elm.info", wd->info); + if (wd->info) edje_object_signal_emit(wd->bbl, "elm,state,info,visible", "elm"); + else edje_object_signal_emit(wd->bbl, "elm,state,info,hidden", "elm"); + if (wd->content) + { + edje_object_part_swallow(wd->bbl, "elm.swallow.content", wd->content); + edje_object_message_signal_process(wd->bbl); + } + if (wd->icon) + edje_object_signal_emit(wd->bbl, "elm,state,icon,visible", "elm"); + else + edje_object_signal_emit(wd->bbl, "elm,state,icon,hidden", "elm"); + edje_object_scale_set(wd->bbl, + elm_widget_scale_get(obj) * _elm_config->scale); + _sizing_eval(obj); +} + +static void +_content_set(Evas_Object *obj, Evas_Object *content) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (wd->content == content) return; + if (wd->content) evas_object_del(wd->content); + wd->content = content; + if (content) + { + elm_widget_sub_object_add(obj, content); + evas_object_event_callback_add(content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + edje_object_part_swallow(wd->bbl, "elm.swallow.content", content); + } + _sizing_eval(obj); +} + +static Evas_Object * +_content_unset(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *content; + if (!wd) return NULL; + if (!wd->content) return NULL; + content = wd->content; + elm_widget_sub_object_del(obj, content); + evas_object_event_callback_del_full(content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + edje_object_part_unswallow(wd->bbl, content); + wd->content = NULL; + return content; +} + +static void +_icon_set(Evas_Object *obj, Evas_Object* icon) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->icon == icon) return; + if (wd->icon) evas_object_del(wd->icon); + wd->icon = icon; + if (icon) + { + elm_widget_sub_object_add(obj, icon); + edje_object_part_swallow(wd->bbl, "elm.swallow.icon", icon); + evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + edje_object_signal_emit(wd->bbl, "elm,state,icon,visible", "elm"); + edje_object_message_signal_process(wd->bbl); + } + _sizing_eval(obj); +} + +static Evas_Object * +_icon_unset(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *icon; + if (!wd) return NULL; + if (!wd->icon) return NULL; + icon = wd->icon; + elm_widget_sub_object_del(obj, icon); + evas_object_event_callback_del_full(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + edje_object_part_unswallow(wd->bbl, icon); + wd->icon = NULL; + return icon; +} + +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (!part || !strcmp(part, "default")) + _content_set(obj, content); + else if (!strcmp(part, "icon")) + _icon_set(obj, content); +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (!part || !strcmp(part, "default")) + return wd->content; + else if (!strcmp(part, "icon")) + return wd->icon; + return NULL; +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (!part || !strcmp(part, "default")) + return _content_unset(obj); + else if (!strcmp(part, "icon")) + return _icon_unset(obj); + return NULL; +} + +static Eina_Bool +_elm_bubble_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *cur; + + if ((!wd) || (!wd->content)) + return EINA_FALSE; + + cur = wd->content; + + /* Try Focus cycle in subitem */ + return elm_widget_focus_next_get(cur, dir, next); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; + if (!wd) return; + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + edje_object_size_min_restricted_calc(wd->bbl, &minw, &minh, minw, minh); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, maxw, maxh); +} + +static void +_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + _sizing_eval(data); +} + +static void +_sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *sub = event_info; + if (!wd) return; + evas_object_event_callback_del_full(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + if (sub == wd->content) wd->content = NULL; + else if (sub == wd->icon) + { + edje_object_signal_emit(wd->bbl, "elm,state,icon,hidden", "elm"); + wd->icon = NULL; + edje_object_message_signal_process(wd->bbl); + } + _sizing_eval(obj); +} + +static void +_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Evas_Event_Mouse_Up *ev = event_info; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) + return; + evas_object_smart_callback_call(data, SIG_CLICKED, NULL); +} + +static void +_elm_bubble_label_set(Evas_Object *obj, const char *item, const char *label) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (!item || !strcmp(item, "default")) + { + eina_stringshare_replace(&wd->label, label); + edje_object_part_text_escaped_set(wd->bbl, "elm.text", label); + if (label) edje_object_signal_emit(wd->bbl, "elm,state,text,visible", + "elm"); + else edje_object_signal_emit(wd->bbl, "elm,state,text,hidden", "elm"); + _sizing_eval(obj); + } + else if (!strcmp(item, "info")) + { + eina_stringshare_replace(&wd->info, label); + edje_object_part_text_escaped_set(wd->bbl, "elm.info", label); + if (label) edje_object_signal_emit(wd->bbl, "elm,state,info,visible", + "elm"); + else edje_object_signal_emit(wd->bbl, "elm,state,info,hidden", "elm"); + _sizing_eval(obj); + } +} + +static const char* +_elm_bubble_label_get(const Evas_Object *obj, const char *item) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + if (!item || !strcmp(item, "default")) + { + return wd->label; + } + else if (!strcmp(item, "info")) + { + return wd->info; + } + + return NULL; +} + +EAPI Evas_Object * +elm_bubble_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "bubble"); + elm_widget_type_set(obj, "bubble"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_focus_next_hook_set(obj, _elm_bubble_focus_next_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); + elm_widget_text_set_hook_set(obj, _elm_bubble_label_set); + elm_widget_text_get_hook_set(obj, _elm_bubble_label_get); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); + + wd->corner = eina_stringshare_add("base"); + wd->pos = ELM_BUBBLE_POS_TOP_LEFT; //default + + wd->bbl = edje_object_add(e); + elm_widget_resize_object_set(obj, wd->bbl); + + evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + evas_object_event_callback_add(wd->bbl, EVAS_CALLBACK_MOUSE_UP, + _mouse_up, obj); + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _elm_theme_object_set(obj, wd->bbl, "bubble", wd->corner, + elm_widget_style_get(obj)); + _sizing_eval(obj); + return obj; +} + +EAPI void +elm_bubble_pos_set(Evas_Object *obj, Elm_Bubble_Pos pos) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (posELM_BUBBLE_POS_BOTTOM_RIGHT) return; + wd->pos = pos; + _theme_hook(obj); +} + +EAPI Elm_Bubble_Pos +elm_bubble_pos_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_BUBBLE_POS_INVALID; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return ELM_BUBBLE_POS_INVALID; + return wd->pos; +} diff --git a/libraries/elementary/src/lib/elm_bubble.h b/libraries/elementary/src/lib/elm_bubble.h new file mode 100644 index 0000000..9f97ec1 --- /dev/null +++ b/libraries/elementary/src/lib/elm_bubble.h @@ -0,0 +1,111 @@ +/** + * @defgroup Bubble Bubble + * @ingroup Elementary + * + * @image html img/widget/bubble/preview-00.png + * @image latex img/widget/bubble/preview-00.eps + * @image html img/widget/bubble/preview-01.png + * @image latex img/widget/bubble/preview-01.eps + * @image html img/widget/bubble/preview-02.png + * @image latex img/widget/bubble/preview-02.eps + * + * @brief The Bubble is a widget to show text similar to how speech is + * represented in comics. + * + * The bubble widget contains 5 important visual elements: + * @li The frame is a rectangle with rounded edjes and an "arrow". + * @li The @p icon is an image to which the frame's arrow points to. + * @li The @p label is a text which appears to the right of the icon if the + * corner is "top_left" or "bottom_left" and is right aligned to the frame + * otherwise. + * @li The @p info is a text which appears to the right of the label. Info's + * font is of a lighter color than label. + * @li The @p content is an evas object that is shown inside the frame. + * + * The position of the arrow, icon, label and info depends on which corner is + * selected. The four available corners are: + * @li "top_left" - Default + * @li "top_right" + * @li "bottom_left" + * @li "bottom_right" + * + * Signals that you can add callbacks for are: + * @li "clicked" - This is called when a user has clicked the bubble. + * + * Default content parts of the bubble that you can use for are: + * @li "default" - A content of the bubble + * @li "icon" - An icon of the bubble + * + * Default text parts of the button widget that you can use for are: + * @li "default" - Label of the bubble + * @li "info" - info of the bubble + * + * Supported elm_object common APIs. + * @li @ref elm_object_part_text_set + * @li @ref elm_object_part_text_get + * @li @ref elm_object_part_content_set + * @li @ref elm_object_part_content_get + * @li @ref elm_object_part_content_unset + * + * For an example of using a bubble see @ref bubble_01_example_page "this". + * + * @{ + */ + +/** + * Defines the corner values for a bubble. + * + * The corner will be used to determine where the arrow of the + * bubble points to. + */ +typedef enum +{ + ELM_BUBBLE_POS_INVALID = -1, + ELM_BUBBLE_POS_TOP_LEFT, + ELM_BUBBLE_POS_TOP_RIGHT, + ELM_BUBBLE_POS_BOTTOM_LEFT, + ELM_BUBBLE_POS_BOTTOM_RIGHT, +} Elm_Bubble_Pos; + +/** + * Add a new bubble to the parent + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * This function adds a text bubble to the given parent evas object. + * + * @ingroup Bubble + */ +EAPI Evas_Object *elm_bubble_add(Evas_Object *parent); + +/** + * Set the corner of the bubble + * + * @param obj The bubble object. + * @param pos The given corner for the bubble. + * + * This function sets the corner of the bubble. The corner will be used to + * determine where the arrow in the frame points to and where label, icon and + * info are shown. + * + * + * @ingroup Bubble + */ +EAPI void elm_bubble_pos_set(Evas_Object *obj, Elm_Bubble_Pos pos); + +/** + * Get the corner of the bubble + * + * @param obj The bubble object. + * @return The given corner for the bubble. + * + * This function gets the selected corner of the bubble. + * + * @ingroup Bubble + */ +EAPI Elm_Bubble_Pos elm_bubble_pos_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_button.c b/libraries/elementary/src/lib/elm_button.c new file mode 100644 index 0000000..be2506b --- /dev/null +++ b/libraries/elementary/src/lib/elm_button.c @@ -0,0 +1,534 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *btn, *icon; + const char *label; + double ar_threshold; + double ar_interval; + Ecore_Timer *timer; + Eina_Bool autorepeat : 1; + Eina_Bool repeating : 1; + Eina_Bool delete_me : 1; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _del_pre_hook(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); +static void _disable_hook(Evas_Object *obj); +static void _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content); +static Evas_Object *_content_get_hook(const Evas_Object *obj, const char *part); +static Evas_Object *_content_unset_hook(Evas_Object *obj, const char *part); +static void _sizing_eval(Evas_Object *obj); +static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _sub_del(void *data, Evas_Object *obj, void *event_info); +static void _signal_clicked(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _signal_pressed(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _signal_unpressed(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _on_focus_hook(void *data, Evas_Object *obj); +static void _activate(Evas_Object *obj); +static void _activate_hook(Evas_Object *obj); +static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src, + Evas_Callback_Type type, void *event_info); + +static const char SIG_CLICKED[] = "clicked"; +static const char SIG_REPEATED[] = "repeated"; +static const char SIG_PRESSED[] = "pressed"; +static const char SIG_UNPRESSED[] = "unpressed"; +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CLICKED, ""}, + {SIG_REPEATED, ""}, + {SIG_PRESSED, ""}, + {SIG_UNPRESSED, ""}, + {NULL, NULL} +}; + +static Eina_Bool +_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info) +{ + if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE; + Evas_Event_Key_Down *ev = event_info; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; + if (elm_widget_disabled_get(obj)) return EINA_FALSE; + if ((strcmp(ev->keyname, "Return")) && + (strcmp(ev->keyname, "KP_Enter")) && + (strcmp(ev->keyname, "space"))) + return EINA_FALSE; + _activate(obj); + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + edje_object_signal_emit(wd->btn, "elm,anim,activate", "elm"); + return EINA_TRUE; +} + +static void +_del_pre_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->delete_me = EINA_TRUE; +} + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->label) eina_stringshare_del(wd->label); + free(wd); +} + +static void +_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (elm_widget_focus_get(obj)) + { + edje_object_signal_emit(wd->btn, "elm,action,focus", "elm"); + evas_object_focus_set(wd->btn, EINA_TRUE); + } + else + { + edje_object_signal_emit(wd->btn, "elm,action,unfocus", "elm"); + evas_object_focus_set(wd->btn, EINA_FALSE); + } +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->btn, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + const char *str; + if (!wd) return; + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _elm_theme_object_set(obj, wd->btn, "button", "base", elm_widget_style_get(obj)); + if (wd->icon) + edje_object_part_swallow(wd->btn, "elm.swallow.content", wd->icon); + if (wd->label) + edje_object_signal_emit(wd->btn, "elm,state,text,visible", "elm"); + else + edje_object_signal_emit(wd->btn, "elm,state,text,hidden", "elm"); + if (wd->icon) + edje_object_signal_emit(wd->btn, "elm,state,icon,visible", "elm"); + else + edje_object_signal_emit(wd->btn, "elm,state,icon,hidden", "elm"); + edje_object_part_text_escaped_set(wd->btn, "elm.text", wd->label); + if (elm_object_disabled_get(obj)) + edje_object_signal_emit(wd->btn, "elm,state,disabled", "elm"); + edje_object_message_signal_process(wd->btn); + edje_object_scale_set(wd->btn, elm_widget_scale_get(obj) * _elm_config->scale); + str = edje_object_data_get(wd->btn, "focus_highlight"); + if ((str) && (!strcmp(str, "on"))) + elm_widget_highlight_in_theme_set(obj, EINA_TRUE); + else + elm_widget_highlight_in_theme_set(obj, EINA_FALSE); + _sizing_eval(obj); +} + +static void +_disable_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (elm_widget_disabled_get(obj)) + edje_object_signal_emit(wd->btn, "elm,state,disabled", "elm"); + else + edje_object_signal_emit(wd->btn, "elm,state,enabled", "elm"); +} + +static void +_signal_emit_hook(Evas_Object *obj, const char *emission, const char *source) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_signal_emit(wd->btn, emission, source); +} + +static void +_signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_signal_callback_add(wd->btn, emission, source, func_cb, data); +} + +static void +_signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + edje_object_signal_callback_del_full(wd->btn, emission, source, func_cb, + data); +} + +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (part && strcmp(part, "icon")) return; + if (wd->icon == content) return; + if (wd->icon) evas_object_del(wd->icon); + wd->icon = content; + if (content) + { + elm_widget_sub_object_add(obj, content); + evas_object_event_callback_add(content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + edje_object_part_swallow(wd->btn, "elm.swallow.content", content); + edje_object_signal_emit(wd->btn, "elm,state,icon,visible", "elm"); + edje_object_message_signal_process(wd->btn); + } + _sizing_eval(obj); +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + + if (part && strcmp(part, "icon")) return NULL; + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->icon; +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + + if (part && strcmp(part, "icon")) return NULL; + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (!wd->icon) return NULL; + Evas_Object *icon = wd->icon; + elm_widget_sub_object_del(obj, wd->icon); + edje_object_part_unswallow(wd->btn, icon); + return icon; +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1; + + if (!wd) return; + if (wd->delete_me) return; + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + edje_object_size_min_restricted_calc(wd->btn, &minw, &minh, minw, minh); + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + evas_object_size_hint_min_set(obj, minw, minh); +} + +static void +_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + if (obj != wd->icon) return; + _sizing_eval(data); +} + +static void +_sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *sub = event_info; + if (!wd) return; + if (sub == wd->icon) + { + edje_object_signal_emit(wd->btn, "elm,state,icon,hidden", "elm"); + evas_object_event_callback_del_full(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + wd->icon = NULL; + edje_object_message_signal_process(wd->btn); + _sizing_eval(obj); + } +} + +static void +_activate(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->timer) + { + ecore_timer_del(wd->timer); + wd->timer = NULL; + } + wd->repeating = EINA_FALSE; + if ((_elm_config->access_mode == ELM_ACCESS_MODE_OFF) || + (_elm_access_2nd_click_timeout(obj))) + { + if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF) + _elm_access_say(E_("Clicked")); + if (!elm_widget_disabled_get(obj) && + !evas_object_freeze_events_get(obj)) + evas_object_smart_callback_call(obj, SIG_CLICKED, NULL); + } +} + +static void +_activate_hook(Evas_Object *obj) +{ + _activate(obj); +} + +static void +_signal_clicked(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + _activate(data); +} + +static Eina_Bool +_autorepeat_send(void *data) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return ECORE_CALLBACK_CANCEL; + + evas_object_smart_callback_call(data, SIG_REPEATED, NULL); + if (!wd->repeating) + { + wd->timer = NULL; + return ECORE_CALLBACK_CANCEL; + } + + return ECORE_CALLBACK_RENEW; +} + +static Eina_Bool +_autorepeat_initial_send(void *data) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return ECORE_CALLBACK_CANCEL; + + if (wd->timer) ecore_timer_del(wd->timer); + wd->repeating = EINA_TRUE; + _autorepeat_send(data); + wd->timer = ecore_timer_add(wd->ar_interval, _autorepeat_send, data); + + return ECORE_CALLBACK_CANCEL; +} + +static void +_signal_pressed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + + if ((wd->autorepeat) && (!wd->repeating)) + { + if (wd->ar_threshold <= 0.0) + _autorepeat_initial_send(data); /* call immediately */ + else + wd->timer = ecore_timer_add(wd->ar_threshold, _autorepeat_initial_send, data); + } + + evas_object_smart_callback_call(data, SIG_PRESSED, NULL); +} + +static void +_signal_unpressed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + + if (wd->timer) + { + ecore_timer_del(wd->timer); + wd->timer = NULL; + } + wd->repeating = EINA_FALSE; + evas_object_smart_callback_call(data, SIG_UNPRESSED, NULL); +} + +static void +_elm_button_label_set(Evas_Object *obj, const char *item, const char *label) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (item && strcmp(item, "default")) return; + if (!wd) return; + eina_stringshare_replace(&wd->label, label); + if (label) + edje_object_signal_emit(wd->btn, "elm,state,text,visible", "elm"); + else + edje_object_signal_emit(wd->btn, "elm,state,text,hidden", "elm"); + edje_object_message_signal_process(wd->btn); + edje_object_part_text_escaped_set(wd->btn, "elm.text", label); + _sizing_eval(obj); +} + +static const char * +_elm_button_label_get(const Evas_Object *obj, const char *item) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (item && strcmp(item, "default")) return NULL; + if (!wd) return NULL; + return wd->label; +} + +static char * +_access_info_cb(void *data __UNUSED__, Evas_Object *obj, Elm_Widget_Item *item __UNUSED__) +{ + const char *txt = elm_widget_access_info_get(obj); + if (!txt) txt = _elm_button_label_get(obj, NULL); + if (txt) return strdup(txt); + return NULL; +} + +static char * +_access_state_cb(void *data __UNUSED__, Evas_Object *obj, Elm_Widget_Item *item __UNUSED__) +{ + if (elm_widget_disabled_get(obj)) + return strdup(E_("State: Disabled")); + return NULL; +} + +EAPI Evas_Object * +elm_button_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "button"); + elm_widget_type_set(obj, "button"); + elm_widget_sub_object_add(parent, obj); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_disable_hook_set(obj, _disable_hook); + elm_widget_can_focus_set(obj, EINA_TRUE); + elm_widget_activate_hook_set(obj, _activate_hook); + elm_widget_event_hook_set(obj, _event_hook); + elm_widget_signal_emit_hook_set(obj, _signal_emit_hook); + elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook); + elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook); + elm_widget_text_set_hook_set(obj, _elm_button_label_set); + elm_widget_text_get_hook_set(obj, _elm_button_label_get); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); + + wd->btn = edje_object_add(e); + _elm_theme_object_set(obj, wd->btn, "button", "base", "default"); + edje_object_signal_callback_add(wd->btn, "elm,action,click", "", + _signal_clicked, obj); + edje_object_signal_callback_add(wd->btn, "elm,action,press", "", + _signal_pressed, obj); + edje_object_signal_callback_add(wd->btn, "elm,action,unpress", "", + _signal_unpressed, obj); + elm_widget_resize_object_set(obj, wd->btn); + + evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + + _theme_hook(obj); + + // TODO: convert Elementary to subclassing of Evas_Smart_Class + // TODO: and save some bytes, making descriptions per-class and not instance! + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + _elm_access_object_register(obj, wd->btn); + _elm_access_text_set(_elm_access_object_get(obj), + ELM_ACCESS_TYPE, E_("Button")); + _elm_access_callback_set(_elm_access_object_get(obj), + ELM_ACCESS_INFO, _access_info_cb, obj); + _elm_access_callback_set(_elm_access_object_get(obj), + ELM_ACCESS_STATE, _access_state_cb, obj); + return obj; +} + +EAPI void +elm_button_autorepeat_set(Evas_Object *obj, Eina_Bool on) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->timer) + { + ecore_timer_del(wd->timer); + wd->timer = NULL; + } + wd->autorepeat = on; + wd->repeating = EINA_FALSE; +} + +EAPI Eina_Bool +elm_button_autorepeat_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->autorepeat; +} + +EAPI void +elm_button_autorepeat_initial_timeout_set(Evas_Object *obj, double t) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->ar_threshold == t) return; + if (wd->timer) + { + ecore_timer_del(wd->timer); + wd->timer = NULL; + } + wd->ar_threshold = t; +} + +EAPI double +elm_button_autorepeat_initial_timeout_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0.0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0.0; + return wd->ar_threshold; +} + +EAPI void +elm_button_autorepeat_gap_timeout_set(Evas_Object *obj, double t) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->ar_interval == t) return; + + wd->ar_interval = t; + if ((wd->repeating) && (wd->timer)) ecore_timer_interval_set(wd->timer, t); +} + +EAPI double +elm_button_autorepeat_gap_timeout_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0.0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0.0; + return wd->ar_interval; +} diff --git a/libraries/elementary/src/lib/elm_button.h b/libraries/elementary/src/lib/elm_button.h new file mode 100644 index 0000000..5893898 --- /dev/null +++ b/libraries/elementary/src/lib/elm_button.h @@ -0,0 +1,159 @@ +/** + * @defgroup Button Button + * @ingroup Elementary + * + * @image html img/widget/button/preview-00.png + * @image latex img/widget/button/preview-00.eps + * @image html img/widget/button/preview-01.png + * @image latex img/widget/button/preview-01.eps + * @image html img/widget/button/preview-02.png + * @image latex img/widget/button/preview-02.eps + * + * This is a push-button. Press it and run some function. It can contain + * a simple label and icon object and it also has an autorepeat feature. + * + * This widget emits the following signals: + * @li "clicked": the user clicked the button (press/release). + * @li "repeated": the user pressed the button without releasing it. + * @li "pressed": button was pressed. + * @li "unpressed": button was released after being pressed. + * In all cases, the @c event parameter of the callback will be + * @c NULL. + * + * Also, defined in the default theme, the button has the following styles + * available: + * @li default: a normal button. + * @li anchor: Like default, but the button fades away when the mouse is not + * over it, leaving only the text or icon. + * @li hoversel_vertical: Internally used by @ref Hoversel to give a + * continuous look across its options. + * @li hoversel_vertical_entry: Another internal for @ref Hoversel. + * @li naviframe: Internally used by @ref Naviframe for its back button. + * @li colorselector: Internally used by @ref Colorselector + * for its left and right buttons. + * + * Default content parts of the button widget that you can use for are: + * @li "icon" - An icon of the button + * + * Default text parts of the button widget that you can use for are: + * @li "default" - Label of the button + * + * Supported elm_object common APIs. + * @li @ref elm_object_part_text_set + * @li @ref elm_object_part_text_get + * @li @ref elm_object_part_content_set + * @li @ref elm_object_part_content_get + * @li @ref elm_object_part_content_unset + * @li @ref elm_object_signal_emit + * @li @ref elm_object_signal_callback_add + * @li @ref elm_object_signal_callback_del + * + * Here is some sample code using it: + * @li @ref button_example_00 + * @li @ref button_example_01 + */ + +/** + * @addtogroup Button + * @{ + */ + +/** + * Add a new button to the parent's canvas + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * @ingroup Button + */ +EAPI Evas_Object *elm_button_add(Evas_Object *parent); + +/** + * Turn on/off the autorepeat event generated when the button is kept pressed + * + * When off, no autorepeat is performed and buttons emit a normal @c clicked + * signal when they are clicked. + * + * When on, keeping a button pressed will continuously emit a @c repeated + * signal until the button is released. The time it takes until it starts + * emitting the signal is given by + * elm_button_autorepeat_initial_timeout_set(), and the time between each + * new emission by elm_button_autorepeat_gap_timeout_set(). + * + * @param obj The button object + * @param on A bool to turn on/off the event + * + * @ingroup Button + */ +EAPI void elm_button_autorepeat_set(Evas_Object *obj, Eina_Bool on); + +/** + * Get whether the autorepeat feature is enabled + * + * @param obj The button object + * @return EINA_TRUE if autorepeat is on, EINA_FALSE otherwise + * + * @see elm_button_autorepeat_set() + * + * @ingroup Button + */ +EAPI Eina_Bool elm_button_autorepeat_get(const Evas_Object *obj); + +/** + * Set the initial timeout before the autorepeat event is generated + * + * Sets the timeout, in seconds, since the button is pressed until the + * first @c repeated signal is emitted. If @p t is 0.0 or less, there + * won't be any delay and the event will be fired the moment the button is + * pressed. + * + * @param obj The button object + * @param t Timeout in seconds + * + * @see elm_button_autorepeat_set() + * @see elm_button_autorepeat_gap_timeout_set() + * + * @ingroup Button + */ +EAPI void elm_button_autorepeat_initial_timeout_set(Evas_Object *obj, double t); + +/** + * Get the initial timeout before the autorepeat event is generated + * + * @param obj The button object + * @return Timeout in seconds + * + * @see elm_button_autorepeat_initial_timeout_set() + * + * @ingroup Button + */ +EAPI double elm_button_autorepeat_initial_timeout_get(const Evas_Object *obj); + +/** + * Set the interval between each generated autorepeat event + * + * After the first @c repeated event is fired, all subsequent ones will + * follow after a delay of @p t seconds for each. + * + * @param obj The button object + * @param t Interval in seconds + * + * @see elm_button_autorepeat_initial_timeout_set() + * + * @ingroup Button + */ +EAPI void elm_button_autorepeat_gap_timeout_set(Evas_Object *obj, double t); + +/** + * Get the interval between each generated autorepeat event + * + * @param obj The button object + * @return Interval in seconds + * + * @ingroup Button + */ +EAPI double elm_button_autorepeat_gap_timeout_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_cache.h b/libraries/elementary/src/lib/elm_cache.h new file mode 100644 index 0000000..7546f6b --- /dev/null +++ b/libraries/elementary/src/lib/elm_cache.h @@ -0,0 +1,31 @@ +/** + * @defgroup Caches Caches + * @ingroup Elementary + * + * These are functions which let one fine-tune some cache values for + * Elementary applications, thus allowing for performance adjustments. + * + * @{ + */ + +/** + * @brief Flush all caches. + * + * Frees all data that was in cache and is not currently being used to reduce + * memory usage. This frees Edje's, Evas' and Eet's cache. This is equivalent + * to calling all of the following functions: + * @li edje_file_cache_flush() + * @li edje_collection_cache_flush() + * @li eet_clearcache() + * @li evas_image_cache_flush() + * @li evas_font_cache_flush() + * @li evas_render_dump() + * @note Evas caches are flushed for every canvas associated with a window. + * + * @ingroup Caches + */ +EAPI void elm_cache_all_flush(void); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_calendar.c b/libraries/elementary/src/lib/elm_calendar.c new file mode 100644 index 0000000..2e41c5f --- /dev/null +++ b/libraries/elementary/src/lib/elm_calendar.c @@ -0,0 +1,1029 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +#ifdef HAVE_EVIL +# include +#endif + +#include +#include "elm_priv.h" + +typedef enum _Day_Color // EINA_DEPRECATED +{ + DAY_WEEKDAY = 0, + DAY_SATURDAY = 1, + DAY_SUNDAY = 2 +} Day_Color; + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *calendar; + Eina_List *marks; + double interval, first_interval; + int year_min, year_max, spin_speed; + int today_it, selected_it, first_day_it; + Elm_Calendar_Weekday first_week_day; + Ecore_Timer *spin, *update_timer; + Elm_Calendar_Format_Cb format_func; + const char *weekdays[ELM_DAY_LAST]; + struct tm current_time, selected_time; + Day_Color day_color[42]; // EINA_DEPRECATED + Elm_Calendar_Select_Mode select_mode; +}; + +struct _Elm_Calendar_Mark +{ + Evas_Object *obj; + Eina_List *node; + struct tm mark_time; + const char *mark_type; + Elm_Calendar_Mark_Repeat_Type repeat; +}; + +static const char *widtype = NULL; +static void _on_focus_hook(void *data, Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); + +static const char SIG_CHANGED[] = "changed"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CHANGED, ""}, + {NULL, NULL} +}; + + +/* Should not be translated, it's used if we failed + * getting from locale. */ +static const char *_days_abbrev[] = +{ + "Sun", "Mon", "Tue", "Wed", + "Thu", "Fri", "Sat" +}; + +static int _days_in_month[2][12] = +{ + {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, + {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} +}; + +static Elm_Calendar_Mark * +_mark_new(Evas_Object *obj, const char *mark_type, struct tm *mark_time, Elm_Calendar_Mark_Repeat_Type repeat) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Calendar_Mark *mark; + + if (!wd) return NULL; + mark = calloc(1, sizeof(Elm_Calendar_Mark)); + if (!mark) return NULL; + mark->obj = obj; + mark->mark_type = eina_stringshare_add(mark_type); + mark->mark_time = *mark_time; + mark->repeat = repeat; + return mark; +} + +static inline void +_mark_free(Elm_Calendar_Mark *mark) +{ + eina_stringshare_del(mark->mark_type); + free(mark); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1; + if (!wd) return; + elm_coords_finger_size_adjust(8, &minw, 7, &minh); + edje_object_size_min_restricted_calc(wd->calendar, &minw, &minh, minw, minh); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, -1, -1); +} + +static inline int +_maxdays_get(struct tm *selected_time) +{ + int month, year; + + month = selected_time->tm_mon; + year = selected_time->tm_year + 1900; + + return _days_in_month[((!(year % 4)) && + ((!(year % 400)) || + (year % 100)))] + [month]; +} + +static inline void +_unselect(Widget_Data *wd, int selected) +{ + char emission[32]; + snprintf(emission, sizeof(emission), "cit_%i,unselected", selected); + edje_object_signal_emit(wd->calendar, emission, "elm"); +} + +static inline void +_select(Widget_Data *wd, int selected) +{ + char emission[32]; + snprintf(emission, sizeof(emission), "cit_%i,selected", selected); + edje_object_signal_emit(wd->calendar, emission, "elm"); +} + +static inline void +_not_today(Widget_Data *wd) +{ + char emission[32]; + snprintf(emission, sizeof(emission), "cit_%i,not_today", wd->today_it); + edje_object_signal_emit(wd->calendar, emission, "elm"); + wd->today_it = -1; +} + +static inline void +_today(Widget_Data *wd, int it) +{ + char emission[32]; + snprintf(emission, sizeof(emission), "cit_%i,today", it); + edje_object_signal_emit(wd->calendar, emission, "elm"); + wd->today_it = it; +} + +static char * +_format_month_year(struct tm *selected_time) +{ + char buf[32]; + if (!strftime(buf, sizeof(buf), E_("%B %Y"), selected_time)) return NULL; + return strdup(buf); +} + +static inline void +_cit_mark(Evas_Object *cal, int cit, const char *mtype) +{ + char sign[64]; + snprintf(sign, sizeof(sign), "cit_%i,%s", cit, mtype); + edje_object_signal_emit(cal, sign, "elm"); +} + +static inline int +_weekday_get(int first_week_day, int day) +{ + return (day + first_week_day - 1) % ELM_DAY_LAST; +} + +// EINA_DEPRECATED +static void +_text_day_color_update(Widget_Data *wd, int pos) +{ + char emission[32]; + + switch (wd->day_color[pos]) + { + case DAY_WEEKDAY: + snprintf(emission, sizeof(emission), "cit_%i,weekday", pos); + break; + case DAY_SATURDAY: + snprintf(emission, sizeof(emission), "cit_%i,saturday", pos); + break; + case DAY_SUNDAY: + snprintf(emission, sizeof(emission), "cit_%i,sunday", pos); + break; + default: + return; + } + + edje_object_signal_emit(wd->calendar, emission, "elm"); +} + +static void +_set_month_year(Widget_Data *wd) +{ + char *buf; + + /* Set selected month */ + buf = wd->format_func(&wd->selected_time); + if (buf) + { + edje_object_part_text_escaped_set(wd->calendar, "month_text", buf); + free(buf); + } + else + edje_object_part_text_escaped_set(wd->calendar, "month_text", ""); +} + +static void +_populate(Evas_Object *obj) +{ + int maxdays, day, mon, yr, i; + Elm_Calendar_Mark *mark; + char part[12], day_s[3]; + struct tm first_day; + Eina_List *l; + Eina_Bool last_row = EINA_TRUE; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + + if (wd->today_it > 0) _not_today(wd); + + maxdays = _maxdays_get(&wd->selected_time); + mon = wd->selected_time.tm_mon; + yr = wd->selected_time.tm_year; + + _set_month_year(wd); + + /* Set days */ + day = 0; + first_day = wd->selected_time; + first_day.tm_mday = 1; + mktime(&first_day); + + // Layout of the calendar is changed for removing the unfilled last row. + if (first_day.tm_wday < (int)wd->first_week_day) + wd->first_day_it = first_day.tm_wday + ELM_DAY_LAST - wd->first_week_day; + else + wd->first_day_it = first_day.tm_wday - wd->first_week_day; + + if ((35 - wd->first_day_it) > (maxdays - 1)) last_row = EINA_FALSE; + + if (!last_row) + { + char emission[32]; + + for (i = 0; i < 5; i++) + { + snprintf(emission, sizeof(emission), "cseph_%i,row_hide", i); + edje_object_signal_emit(wd->calendar, emission, "elm"); + } + snprintf(emission, sizeof(emission), "cseph_%i,row_invisible", 5); + edje_object_signal_emit(wd->calendar, emission, "elm"); + for (i = 0; i < 35; i++) + { + snprintf(emission, sizeof(emission), "cit_%i,cell_expanded", i); + edje_object_signal_emit(wd->calendar, emission, "elm"); + } + for (i = 35; i < 42; i++) + { + snprintf(emission, sizeof(emission), "cit_%i,cell_invisible", i); + edje_object_signal_emit(wd->calendar, emission, "elm"); + } + } + else + { + char emission[32]; + + for (i = 0; i < 6; i++) + { + snprintf(emission, sizeof(emission), "cseph_%i,row_show", i); + edje_object_signal_emit(wd->calendar, emission, "elm"); + } + for (i = 0; i < 42; i++) + { + snprintf(emission, sizeof(emission), "cit_%i,cell_default", i); + edje_object_signal_emit(wd->calendar, emission, "elm"); + } + } + + for (i = 0; i < 42; i++) + { + _text_day_color_update(wd, i); // EINA_DEPRECATED + if ((!day) && (i == wd->first_day_it)) day = 1; + + if ((day == wd->current_time.tm_mday) + && (mon == wd->current_time.tm_mon) + && (yr == wd->current_time.tm_year)) + _today(wd, i); + + if (day == wd->selected_time.tm_mday) + { + if ((wd->selected_it > -1) && (wd->selected_it != i)) + _unselect(wd, wd->selected_it); + + if (wd->select_mode != ELM_CALENDAR_SELECT_MODE_NONE) + _select(wd, i); + + wd->selected_it = i; + } + + if ((day) && (day <= maxdays)) + snprintf(day_s, sizeof(day_s), "%i", day++); + else + day_s[0] = 0; + + snprintf(part, sizeof(part), "cit_%i.text", i); + edje_object_part_text_set(wd->calendar, part, day_s); + /* Clear previous marks */ + _cit_mark(wd->calendar, i, "clear"); + } + + /* Set marks */ + EINA_LIST_FOREACH(wd->marks, l, mark) + { + struct tm *mtime = &mark->mark_time; + int month = wd->selected_time.tm_mon; + int year = wd->selected_time.tm_year; + int mday_it = mtime->tm_mday + wd->first_day_it - 1; + + switch (mark->repeat) + { + case ELM_CALENDAR_UNIQUE: + if ((mtime->tm_mon == month) && (mtime->tm_year == year)) + _cit_mark(wd->calendar, mday_it, mark->mark_type); + break; + case ELM_CALENDAR_DAILY: + if (((mtime->tm_year == year) && (mtime->tm_mon < month)) || + (mtime->tm_year < year)) + day = 1; + else if ((mtime->tm_year == year) && (mtime->tm_mon == month)) + day = mtime->tm_mday; + else + break; + for (; day <= maxdays; day++) + _cit_mark(wd->calendar, day + wd->first_day_it - 1, + mark->mark_type); + break; + case ELM_CALENDAR_WEEKLY: + if (((mtime->tm_year == year) && (mtime->tm_mon < month)) || + (mtime->tm_year < year)) + day = 1; + else if ((mtime->tm_year == year) && (mtime->tm_mon == month)) + day = mtime->tm_mday; + else + break; + for (; day <= maxdays; day++) + if (mtime->tm_wday == _weekday_get(wd->first_day_it, day)) + _cit_mark(wd->calendar, day + wd->first_day_it - 1, + mark->mark_type); + break; + case ELM_CALENDAR_MONTHLY: + if (((mtime->tm_year < year) || + ((mtime->tm_year == year) && (mtime->tm_mon <= month))) && + (mtime->tm_mday <= maxdays)) + _cit_mark(wd->calendar, mday_it, mark->mark_type); + break; + case ELM_CALENDAR_ANNUALLY: + if ((mtime->tm_year <= year) && (mtime->tm_mon == month) && + (mtime->tm_mday <= maxdays)) + _cit_mark(wd->calendar, mday_it, mark->mark_type); + break; + } + } +} + +static void +_set_headers(Evas_Object *obj) +{ + static char part[] = "ch_0.text"; + int i; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + for (i = 0; i < ELM_DAY_LAST; i++) + { + part[3] = i + '0'; + edje_object_part_text_escaped_set + (wd->calendar, part, + wd->weekdays[(i + wd->first_week_day) % ELM_DAY_LAST]); + } +} + +static void +_del_hook(Evas_Object *obj) +{ + int i; + Elm_Calendar_Mark *mark; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + + if (wd->spin) ecore_timer_del(wd->spin); + if (wd->update_timer) ecore_timer_del(wd->update_timer); + + if (wd->marks) + { + EINA_LIST_FREE(wd->marks, mark) + { + _mark_free(mark); + } + } + + for (i = 0; i < ELM_DAY_LAST; i++) + eina_stringshare_del(wd->weekdays[i]); + + free(wd); +} + +static void +_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (elm_widget_focus_get(obj)) + { + edje_object_signal_emit(wd->calendar, "elm,action,focus", "elm"); + evas_object_focus_set(wd->calendar, EINA_TRUE); + } + else + { + edje_object_signal_emit(wd->calendar, "elm,action,unfocus", "elm"); + evas_object_focus_set(wd->calendar, EINA_FALSE); + } +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->calendar, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_widget_mirrored_reload(obj); + _elm_theme_object_set(obj, wd->calendar, "calendar", "base", + elm_widget_style_get(obj)); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _set_headers(obj); + _populate(obj); + edje_object_message_signal_process(wd->calendar); + edje_object_scale_set(wd->calendar, + elm_widget_scale_get(obj) * _elm_config->scale); + _sizing_eval(obj); +} + +static void +_signal_emit_hook(Evas_Object *obj, const char *emission, const char *source) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_signal_emit(wd->calendar, emission, source); +} + +static void +_signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_signal_callback_add(wd->calendar, emission, + source, func_cb, data); +} + +static void +_signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_signal_callback_del_full(wd->calendar, emission, source, func_cb, + data); +} + +/* Set correct tm_wday and tm_yday after other fields changes*/ +static inline void +_fix_selected_time(Widget_Data *wd) +{ + mktime(&wd->selected_time); +} + +static Eina_Bool +_update_month(Evas_Object *obj, int delta) +{ + struct tm time_check; + int maxdays; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + /* check if it's a valid time. for 32 bits, year greater than 2037 is not */ + time_check = wd->selected_time; + time_check.tm_mon += delta; + if (mktime(&time_check) == -1) + return EINA_FALSE; + + wd->selected_time.tm_mon += delta; + if (wd->selected_time.tm_mon < 0) + { + if (wd->selected_time.tm_year == wd->year_min) + { + wd->selected_time.tm_mon++; + return EINA_FALSE; + } + wd->selected_time.tm_mon = 11; + wd->selected_time.tm_year--; + } + else if (wd->selected_time.tm_mon > 11) + { + if (wd->selected_time.tm_year == wd->year_max) + { + wd->selected_time.tm_mon--; + return EINA_FALSE; + } + wd->selected_time.tm_mon = 0; + wd->selected_time.tm_year++; + } + + maxdays = _maxdays_get(&wd->selected_time); + if (wd->selected_time.tm_mday > maxdays) + wd->selected_time.tm_mday = maxdays; + + _fix_selected_time(wd); + evas_object_smart_callback_call(obj, SIG_CHANGED, NULL); + + return EINA_TRUE; +} + +static Eina_Bool +_spin_value(void *data) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return ECORE_CALLBACK_CANCEL; + if (_update_month(data, wd->spin_speed)) _populate(data); + wd->interval = wd->interval / 1.05; + ecore_timer_interval_set(wd->spin, wd->interval); + return ECORE_CALLBACK_RENEW; +} + +static void +_button_inc_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + wd->interval = wd->first_interval; + wd->spin_speed = 1; + if (wd->spin) ecore_timer_del(wd->spin); + wd->spin = ecore_timer_add(wd->interval, _spin_value, data); + _spin_value(data); +} + +static void +_button_dec_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + wd->interval = wd->first_interval; + wd->spin_speed = -1; + if (wd->spin) ecore_timer_del(wd->spin); + wd->spin = ecore_timer_add(wd->interval, _spin_value, data); + _spin_value(data); +} + +static void +_button_stop(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + wd->interval = wd->first_interval; + if (wd->spin) ecore_timer_del(wd->spin); + wd->spin = NULL; +} + +static int +_get_item_day(Evas_Object *obj, int selected_it) +{ + int day; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; + + day = selected_it - wd->first_day_it + 1; + if ((day < 0) || (day > _maxdays_get(&wd->selected_time))) + return 0; + + return day; +} + +static void +_update_sel_it(Evas_Object *obj, int sel_it) +{ + int day; + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (wd->select_mode == ELM_CALENDAR_SELECT_MODE_NONE)) + return; + + day = _get_item_day(obj, sel_it); + if (!day) + return; + + _unselect(wd, wd->selected_it); + + wd->selected_it = sel_it; + wd->selected_time.tm_mday = day; + _select(wd, wd->selected_it); + _fix_selected_time(wd); + evas_object_smart_callback_call(obj, SIG_CHANGED, NULL); +} + +static void +_day_selected(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source) +{ + int sel_it; + Widget_Data *wd = elm_widget_data_get(data); + if ((!wd) || (wd->select_mode == ELM_CALENDAR_SELECT_MODE_NONE)) + return; + sel_it = atoi(source); + + _update_sel_it(data, sel_it); +} + +static inline int +_time_to_next_day(struct tm *t) +{ + return ((((24 - t->tm_hour) * 60) - t->tm_min) * 60) - t->tm_sec; +} + +static Eina_Bool +_update_cur_date(void *data) +{ + time_t current_time; + int t, day; + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return ECORE_CALLBACK_RENEW; + + if (wd->today_it > 0) _not_today(wd); + + current_time = time(NULL); + localtime_r(¤t_time, &wd->current_time); + t = _time_to_next_day(&wd->current_time); + ecore_timer_interval_set(wd->update_timer, t); + + if ((wd->current_time.tm_mon != wd->selected_time.tm_mon) || + (wd->current_time.tm_year!= wd->selected_time.tm_year)) + return ECORE_CALLBACK_RENEW; + + day = wd->current_time.tm_mday + wd->first_day_it - 1; + _today(wd, day); + + return ECORE_CALLBACK_RENEW; +} + +static Eina_Bool +_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info) +{ + if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE; + Evas_Event_Key_Down *ev = event_info; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return EINA_FALSE; + if (elm_widget_disabled_get(obj)) return EINA_FALSE; + if (wd->select_mode == ELM_CALENDAR_SELECT_MODE_NONE) return EINA_FALSE; + + if ((!strcmp(ev->keyname, "Left")) || + ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string))) + { + _update_sel_it(obj, wd->selected_it-1); + } + else if ((!strcmp(ev->keyname, "Right")) || + ((!strcmp(ev->keyname, "KP_Right")) && (!ev->string))) + { + _update_sel_it(obj, wd->selected_it+1); + } + else if ((!strcmp(ev->keyname, "Up")) || + ((!strcmp(ev->keyname, "KP_Up")) && (!ev->string))) + { + _update_sel_it(obj, wd->selected_it-ELM_DAY_LAST); + } + else if ((!strcmp(ev->keyname, "Down")) || + ((!strcmp(ev->keyname, "KP_Down")) && (!ev->string))) + { + _update_sel_it(obj, wd->selected_it+ELM_DAY_LAST); + } + else if ((!strcmp(ev->keyname, "Prior")) || + ((!strcmp(ev->keyname, "KP_Prior")) && (!ev->string))) + { + if (_update_month(obj, -1)) _populate(obj); + } + else if ((!strcmp(ev->keyname, "Next")) || + ((!strcmp(ev->keyname, "KP_Next")) && (!ev->string))) + { + if (_update_month(obj, 1)) _populate(obj); + } + else return EINA_FALSE; + + return EINA_TRUE; +} + +EAPI Evas_Object * +elm_calendar_add(Evas_Object *parent) +{ + time_t current_time; + time_t weekday = 259200; /* Just the first sunday since epoch */ + Evas_Object *obj; + Widget_Data *wd; + int i, t; + Evas *e; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "calendar"); + elm_widget_type_set(obj, "calendar"); + elm_widget_sub_object_add(parent, obj); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_signal_emit_hook_set(obj, _signal_emit_hook); + elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook); + elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook); + elm_widget_can_focus_set(obj, EINA_TRUE); + elm_widget_event_hook_set(obj, _event_hook); + + wd->first_interval = 0.85; + wd->year_min = 2; + wd->year_max = -1; + wd->today_it = -1; + wd->selected_it = -1; + wd->first_day_it = -1; + wd->format_func = _format_month_year; + wd->marks = NULL; + + wd->calendar = edje_object_add(e); + _elm_theme_object_set(obj, wd->calendar, "calendar", "base", "default"); + elm_widget_resize_object_set(obj, wd->calendar); + + edje_object_signal_callback_add(wd->calendar, "elm,action,increment,start", + "*", _button_inc_start, obj); + edje_object_signal_callback_add(wd->calendar, "elm,action,decrement,start", + "*", _button_dec_start, obj); + edje_object_signal_callback_add(wd->calendar, "elm,action,stop", + "*", _button_stop, obj); + edje_object_signal_callback_add(wd->calendar, "elm,action,selected", + "*", _day_selected, obj); + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + for (i = 0; i < ELM_DAY_LAST; i++) + { + /* FIXME: I'm not aware of a known max, so if it fails, + * just make it larger. :| */ + char buf[20]; + /* I don't know of a better way of doing it */ + if (strftime(buf, sizeof(buf), "%a", gmtime(&weekday))) + { + wd->weekdays[i] = eina_stringshare_add(buf); + } + else + { + /* If we failed getting day, get a default value */ + wd->weekdays[i] = _days_abbrev[i]; + WRN("Failed getting weekday name for '%s' from locale.", + _days_abbrev[i]); + } + weekday += 86400; /* Advance by a day */ + } + + current_time = time(NULL); + localtime_r(¤t_time, &wd->selected_time); + wd->current_time = wd->selected_time; + t = _time_to_next_day(&wd->current_time); + wd->update_timer = ecore_timer_add(t, _update_cur_date, obj); + + _set_headers(obj); + _populate(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _sizing_eval(obj); + return obj; +} + +EAPI void +elm_calendar_weekdays_names_set(Evas_Object *obj, const char *weekdays[]) +{ + int i; + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + EINA_SAFETY_ON_NULL_RETURN(weekdays); + + for (i = 0; i < ELM_DAY_LAST; i++) + { + eina_stringshare_replace(&wd->weekdays[i], weekdays[i]); + } + _set_headers(obj); +} + +EAPI const char ** +elm_calendar_weekdays_names_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->weekdays; +} + +EAPI void +elm_calendar_interval_set(Evas_Object *obj, double interval) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->first_interval = interval; +} + +EAPI double +elm_calendar_interval_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0.0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0.0; + return wd->first_interval; +} + +EAPI void +elm_calendar_min_max_year_set(Evas_Object *obj, int min, int max) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + min -= 1900; + max -= 1900; + if ((wd->year_min == min) && (wd->year_max == max)) return; + wd->year_min = min > 2 ? min : 2; + if (max > wd->year_min) + wd->year_max = max; + else + wd->year_max = wd->year_min; + if (wd->selected_time.tm_year > wd->year_max) + wd->selected_time.tm_year = wd->year_max; + if (wd->selected_time.tm_year < wd->year_min) + wd->selected_time.tm_year = wd->year_min; + _fix_selected_time(wd); + _populate(obj); +} + +EAPI void +elm_calendar_min_max_year_get(const Evas_Object *obj, int *min, int *max) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (min) *min = wd->year_min + 1900; + if (max) *max = wd->year_max + 1900; +} + +EINA_DEPRECATED EAPI void +elm_calendar_day_selection_disabled_set(Evas_Object *obj, Eina_Bool disabled) +{ + if (disabled) + elm_calendar_select_mode_set(obj, ELM_CALENDAR_SELECT_MODE_NONE); + else + elm_calendar_select_mode_set(obj, ELM_CALENDAR_SELECT_MODE_DEFAULT); +} + +EINA_DEPRECATED EAPI Eina_Bool +elm_calendar_day_selection_disabled_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return !!(wd->select_mode == ELM_CALENDAR_SELECT_MODE_NONE); +} + +EAPI void +elm_calendar_selected_time_set(Evas_Object *obj, struct tm *selected_time) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + EINA_SAFETY_ON_NULL_RETURN(selected_time); + wd->selected_time = *selected_time; + _populate(obj); + return; +} + +EAPI Eina_Bool +elm_calendar_selected_time_get(const Evas_Object *obj, struct tm *selected_time) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + EINA_SAFETY_ON_NULL_RETURN_VAL(selected_time, EINA_FALSE); + *selected_time = wd->selected_time; + return EINA_TRUE; +} + +EAPI void +elm_calendar_format_function_set(Evas_Object *obj, Elm_Calendar_Format_Cb format_function) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->format_func = format_function; + _set_month_year(wd); +} + +EAPI Elm_Calendar_Mark * +elm_calendar_mark_add(Evas_Object *obj, const char *mark_type, struct tm *mark_time, Elm_Calendar_Mark_Repeat_Type repeat) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Calendar_Mark *mark; + if (!wd) return NULL; + + mark = _mark_new(obj, mark_type, mark_time, repeat); + wd->marks = eina_list_append(wd->marks, mark); + mark->node = eina_list_last(wd->marks); + return mark; +} + +EAPI void +elm_calendar_mark_del(Elm_Calendar_Mark *mark) +{ + Evas_Object *obj; + Widget_Data *wd; + + EINA_SAFETY_ON_NULL_RETURN(mark); + + obj = mark->obj; + wd = elm_widget_data_get(obj); + if (!wd) return; + + wd->marks = eina_list_remove_list(wd->marks, mark->node); + _mark_free(mark); +} + +EAPI void +elm_calendar_marks_clear(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Calendar_Mark *mark; + + if (!wd) return; + EINA_LIST_FREE(wd->marks, mark) + _mark_free(mark); +} + +EAPI const Eina_List * +elm_calendar_marks_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->marks; +} + +EAPI void +elm_calendar_marks_draw(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _populate(obj); +} + +EAPI void +elm_calendar_first_day_of_week_set(Evas_Object *obj, Elm_Calendar_Weekday day) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (day >= ELM_DAY_LAST) return; + if (wd->first_week_day != day) + { + wd->first_week_day = day; + _set_headers(obj); + _populate(obj); + } +} + +EAPI Elm_Calendar_Weekday +elm_calendar_first_day_of_week_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) -1; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return -1; + return wd->first_week_day; +} + +EAPI void +elm_calendar_select_mode_set(Evas_Object *obj, Elm_Calendar_Select_Mode mode) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if ((mode <= ELM_CALENDAR_SELECT_MODE_ONDEMAND) + && (wd->select_mode != mode)) + { + wd->select_mode = mode; + if (wd->select_mode == ELM_CALENDAR_SELECT_MODE_ALWAYS) + _select(wd, wd->selected_it); + else + _unselect(wd, wd->selected_it); + } +} + +EAPI Elm_Calendar_Select_Mode +elm_calendar_select_mode_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) -1; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return -1; + return wd->select_mode; +} + + diff --git a/libraries/elementary/src/lib/elm_calendar.h b/libraries/elementary/src/lib/elm_calendar.h new file mode 100644 index 0000000..6778018 --- /dev/null +++ b/libraries/elementary/src/lib/elm_calendar.h @@ -0,0 +1,510 @@ +/** + * @defgroup Calendar Calendar + * @ingroup Elementary + * + * This is a Calendar widget. Calender widget helps applications to flexibly + * display a calender with day of the week, day, year and month. Applications will be + * able to choose a specific date that will be reported in the smart_callbacks for + * the calendar widget. The APIs of calendar widget let the applications perform + * other functions like, + * placing marks on specific dates + * Setting the bounds for the calendar (minimum and maximum years) + * Setting the day names of the week. ( for ex. Thu. or Thursday) + * Setting the year and month format. + * + * Signals that you can add callbacks for are: + * - @c "changed" - emitted when the date in the calendar is changed. + * + * Supported elm_object common APIs. + * @li @ref elm_object_signal_emit + * @li @ref elm_object_signal_callback_add + * @li @ref elm_object_signal_callback_del + * + * Here is some sample code using it: + * @li @ref calendar_example_01 + * @li @ref calendar_example_02 + * @li @ref calendar_example_03 + * @li @ref calendar_example_04 + * @li @ref calendar_example_05 + * @li @ref calendar_example_06 + */ + +/** + * @addtogroup Calendar + * @{ + */ + +typedef enum +{ + ELM_CALENDAR_UNIQUE, /**< Default value. Marks will be displayed only on event day. */ + ELM_CALENDAR_DAILY, /**< Marks will be displayed every day after event day (inclusive). */ + ELM_CALENDAR_WEEKLY, /**< Marks will be displayed every week after event day (inclusive) - i.e. each seven days. */ + ELM_CALENDAR_MONTHLY, /**< Marks will be displayed every month day that coincides to event day. E.g.: if an event is set to 30th Jan, no marks will be displayed on Feb, but will be displayed on 30th Mar*/ + ELM_CALENDAR_ANNUALLY /**< Marks will be displayed every year that coincides to event day (and month). E.g. an event added to 30th Jan 2012 will be repeated on 30th Jan 2013. */ +} _Elm_Calendar_Mark_Repeat_Type; + +/** + * @enum _Elm_Calendar_Mark_Repeat_Type + * @typedef Elm_Calendar_Mark_Repeat_Type + * + * Event periodicity, used to define if a mark should be repeated + * @b beyond event's day. It's set when a mark is added. + * + * So, for a mark added to 13th May with periodicity set to WEEKLY, + * there will be marks every week after this date. Marks will be displayed + * at 13th, 20th, 27th, 3rd June ... + * + * Values don't work as bitmask, only one can be chosen. + * + * @see elm_calendar_mark_add() + * + * @ingroup Calendar + */ +typedef _Elm_Calendar_Mark_Repeat_Type Elm_Calendar_Mark_Repeat_Type; + +typedef enum +{ + ELM_DAY_SUNDAY, + ELM_DAY_MONDAY, + ELM_DAY_TUESDAY, + ELM_DAY_WEDNESDAY, + ELM_DAY_THURSDAY, + ELM_DAY_FRIDAY, + ELM_DAY_SATURDAY, + ELM_DAY_LAST +} _Elm_Calendar_Weekday; + +/** + * @enum _Elm_Calendar_Weekday + * @typedef Elm_Calendar_Weekday + * + * a weekday + * + * @see elm_calendar_first_day_of_week_set() + * + * @ingroup Calendar + */ +typedef _Elm_Calendar_Weekday Elm_Calendar_Weekday; + + +typedef enum +{ + ELM_CALENDAR_SELECT_MODE_DEFAULT = 0, /**< Default value. a day is always selected. */ + ELM_CALENDAR_SELECT_MODE_ALWAYS, /**< a day is always selected. */ + ELM_CALENDAR_SELECT_MODE_NONE, /**< None of the days can be selected. */ + ELM_CALENDAR_SELECT_MODE_ONDEMAND /**< User may have selected a day or not. (not supported yet)*/ +} _Elm_Calendar_Select_Mode; + +/** + * @enum _Elm_Calendar_Select_Mode + * @typedef Elm_Calendar_Select_Mode + * + * the mode, who determine how user could select a day + * + * @see elm_calendar_select_mode_set() + * + * @ingroup Calendar + */ +typedef _Elm_Calendar_Select_Mode Elm_Calendar_Select_Mode; + +typedef struct _Elm_Calendar_Mark Elm_Calendar_Mark; /**< Item handle for a calendar mark. Created with elm_calendar_mark_add() and deleted with elm_calendar_mark_del(). */ + +/** + * @typedef Elm_Calendar_Format_Cb + * + * This callback type is used to format the string that will be used + * to display month and year. + * + * @param stime Struct representing time. + * @return String representing time that will be set to calendar's text. + * + * @see elm_calendar_format_function_set() + * + * @ingroup Calendar + */ +typedef char * (*Elm_Calendar_Format_Cb)(struct tm *stime); + +/** + * Add a new calendar widget to the given parent Elementary + * (container) object. + * + * @param parent The parent object. + * @return a new calendar widget handle or @c NULL, on errors. + * + * This function inserts a new calendar widget on the canvas. + * + * @ref calendar_example_01 + * + * @ingroup Calendar + */ +EAPI Evas_Object *elm_calendar_add(Evas_Object *parent); + +/** + * Get weekdays names displayed by the calendar. + * + * @param obj The calendar object. + * @return Array of seven strings to be used as weekday names. + * + * By default, weekdays abbreviations get from system are displayed: + * E.g. for an en_US locale: "Sun, Mon, Tue, Wed, Thu, Fri, Sat" + * The first string is related to Sunday, the second to Monday... + * + * @see elm_calendar_weekdays_name_set() + * + * @ref calendar_example_05 + * + * @ingroup Calendar + */ +EAPI const char **elm_calendar_weekdays_names_get(const Evas_Object *obj); + +/** + * Set weekdays names to be displayed by the calendar. + * + * @param obj The calendar object. + * @param weekdays Array of seven strings to be used as weekday names. + * @warning It must have 7 elements, or it will access invalid memory. + * @warning The strings must be NULL terminated ('@\0'). + * + * By default, weekdays abbreviations get from system are displayed: + * E.g. for an en_US locale: "Sun, Mon, Tue, Wed, Thu, Fri, Sat" + * + * The first string should be related to Sunday, the second to Monday... + * + * The usage should be like this: + * @code + * const char *weekdays[] = + * { + * "Sunday", "Monday", "Tuesday", "Wednesday", + * "Thursday", "Friday", "Saturday" + * }; + * elm_calendar_weekdays_names_set(calendar, weekdays); + * @endcode + * + * @see elm_calendar_weekdays_name_get() + * + * @ref calendar_example_02 + * + * @ingroup Calendar + */ +EAPI void elm_calendar_weekdays_names_set(Evas_Object *obj, const char *weekdays[]); + +/** + * Set the minimum and maximum values for the year + * + * @param obj The calendar object + * @param min The minimum year, greater than 1901; + * @param max The maximum year; + * + * Maximum must be greater than minimum, except if you don't want to set + * maximum year. + * Default values are 1902 and -1. + * + * If the maximum year is a negative value, it will be limited depending + * on the platform architecture (year 2037 for 32 bits); + * + * @see elm_calendar_min_max_year_get() + * + * @ref calendar_example_03 + * + * @ingroup Calendar + */ +EAPI void elm_calendar_min_max_year_set(Evas_Object *obj, int min, int max); + +/** + * Get the minimum and maximum values for the year + * + * @param obj The calendar object. + * @param min The minimum year. + * @param max The maximum year. + * + * Default values are 1902 and -1. + * + * @see elm_calendar_min_max_year_get() for more details. + * + * @ref calendar_example_05 + * + * @ingroup Calendar + */ +EAPI void elm_calendar_min_max_year_get(const Evas_Object *obj, int *min, int *max); + +/** + * Set select day mode to use. + * + * @param obj The calendar object. + * @param select_mdoe The select mode to use. + * + * Set the day selection mode used. + * + * @ingroup Calendar + */ +EAPI void elm_calendar_select_mode_set(Evas_Object *obj, Elm_Calendar_Select_Mode mode); + +/** + * Get the select day mode used. + * + * @param obj The calendar object. + * + * @return the selected mode + * + * Get the day selection mode used. + * + * @see elm_calendar_select_mode_set() for more details + * + * @ingroup Calendar + */ +EAPI Elm_Calendar_Select_Mode elm_calendar_select_mode_get(const Evas_Object *obj); + +/** + * Set selected date to be highlighted on calendar. + * + * @param obj The calendar object. + * @param selected_time A @b tm struct to represent the selected date. + * + * Set the selected date, changing the displayed month if needed. + * Selected date changes when the user goes to next/previous month or + * select a day pressing over it on calendar. + * + * @see elm_calendar_selected_time_get() + * + * @ref calendar_example_04 + * + * @ingroup Calendar + */ +EAPI void elm_calendar_selected_time_set(Evas_Object *obj, struct tm *selected_time); + +/** + * Get selected date. + * + * @param obj The calendar object + * @param selected_time A @b tm struct to point to selected date + * @return EINA_FALSE means an error occurred and returned time shouldn't + * be considered. + * + * Get date selected by the user or set by function + * elm_calendar_selected_time_set(). + * Selected date changes when the user goes to next/previous month or + * select a day pressing over it on calendar. + * + * @see elm_calendar_selected_time_get() + * + * @ref calendar_example_05 + * + * @ingroup Calendar + */ +EAPI Eina_Bool elm_calendar_selected_time_get(const Evas_Object *obj, struct tm *selected_time); + +/** + * Set a function to format the string that will be used to display + * month and year; + * + * @param obj The calendar object + * @param format_func Function to set the month-year string given + * the selected date + * + * By default it uses strftime with "%B %Y" format string. + * It should allocate the memory that will be used by the string, + * that will be freed by the widget after usage. + * A pointer to the string and a pointer to the time struct will be provided. + * + * Example: + * @code + * static char * + * _format_month_year(struct tm *selected_time) + * { + * char buf[32]; + * if (!strftime(buf, sizeof(buf), "%B %Y", selected_time)) return NULL; + * return strdup(buf); + * } + * + * elm_calendar_format_function_set(calendar, _format_month_year); + * @endcode + * + * @ref calendar_example_02 + * + * @ingroup Calendar + */ +EAPI void elm_calendar_format_function_set(Evas_Object *obj, Elm_Calendar_Format_Cb format_func); + +/** + * Add a new mark to the calendar + * + * @param obj The calendar object + * @param mark_type A string used to define the type of mark. It will be + * emitted to the theme, that should display a related modification on these + * days representation. + * @param mark_time A time struct to represent the date of inclusion of the + * mark. For marks that repeats it will just be displayed after the inclusion + * date in the calendar. + * @param repeat Repeat the event following this periodicity. Can be a unique + * mark (that don't repeat), daily, weekly, monthly or annually. + * @return The created mark or @p NULL upon failure. + * + * Add a mark that will be drawn in the calendar respecting the insertion + * time and periodicity. It will emit the type as signal to the widget theme. + * Default theme supports "holiday" and "checked", but it can be extended. + * + * It won't immediately update the calendar, drawing the marks. + * For this, call elm_calendar_marks_draw(). However, when user selects + * next or previous month calendar forces marks drawn. + * + * Marks created with this method can be deleted with + * elm_calendar_mark_del(). + * + * Example + * @code + * struct tm selected_time; + * time_t current_time; + * + * current_time = time(NULL) + 5 * 84600; + * localtime_r(¤t_time, &selected_time); + * elm_calendar_mark_add(cal, "holiday", selected_time, + * ELM_CALENDAR_ANNUALLY); + * + * current_time = time(NULL) + 1 * 84600; + * localtime_r(¤t_time, &selected_time); + * elm_calendar_mark_add(cal, "checked", selected_time, ELM_CALENDAR_UNIQUE); + * + * elm_calendar_marks_draw(cal); + * @endcode + * + * @see elm_calendar_marks_draw() + * @see elm_calendar_mark_del() + * + * @ref calendar_example_06 + * + * @ingroup Calendar + */ +EAPI Elm_Calendar_Mark *elm_calendar_mark_add(Evas_Object *obj, const char *mark_type, struct tm *mark_time, Elm_Calendar_Mark_Repeat_Type repeat); + +/** + * Delete mark from the calendar. + * + * @param mark The mark to be deleted. + * + * If deleting all calendar marks is required, elm_calendar_marks_clear() + * should be used instead of getting marks list and deleting each one. + * + * @see elm_calendar_mark_add() + * + * @ref calendar_example_06 + * + * @ingroup Calendar + */ +EAPI void elm_calendar_mark_del(Elm_Calendar_Mark *mark); + +/** + * Remove all calendar's marks + * + * @param obj The calendar object. + * + * @see elm_calendar_mark_add() + * @see elm_calendar_mark_del() + * + * @ingroup Calendar + */ +EAPI void elm_calendar_marks_clear(Evas_Object *obj); + +/** + * Get a list of all the calendar marks. + * + * @param obj The calendar object. + * @return An @c Eina_List of calendar marks objects, or @c NULL on failure. + * + * @see elm_calendar_mark_add() + * @see elm_calendar_mark_del() + * @see elm_calendar_marks_clear() + * + * @ingroup Calendar + */ +EAPI const Eina_List *elm_calendar_marks_get(const Evas_Object *obj); + +/** + * Draw calendar marks. + * + * @param obj The calendar object. + * + * Should be used after adding, removing or clearing marks. + * It will go through the entire marks list updating the calendar. + * If lots of marks will be added, add all the marks and then call + * this function. + * + * When the month is changed, i.e. user selects next or previous month, + * marks will be drawn. + * + * @see elm_calendar_mark_add() + * @see elm_calendar_mark_del() + * @see elm_calendar_marks_clear() + * + * @ref calendar_example_06 + * + * @ingroup Calendar + */ +EAPI void elm_calendar_marks_draw(Evas_Object *obj); + +/** + * Set the interval on time updates for an user mouse button hold + * on calendar widgets' month selection. + * + * @param obj The calendar object + * @param interval The (first) interval value in seconds + * + * This interval value is @b decreased while the user holds the + * mouse pointer either selecting next or previous month. + * + * This helps the user to get to a given month distant from the + * current one easier/faster, as it will start to change quicker and + * quicker on mouse button holds. + * + * The calculation for the next change interval value, starting from + * the one set with this call, is the previous interval divided by + * 1.05, so it decreases a little bit. + * + * The default starting interval value for automatic changes is + * @b 0.85 seconds. + * + * @see elm_calendar_interval_get() + * + * @ingroup Calendar + */ +EAPI void elm_calendar_interval_set(Evas_Object *obj, double interval); + +/** + * Get the interval on time updates for an user mouse button hold + * on calendar widgets' month selection. + * + * @param obj The calendar object + * @return The (first) interval value, in seconds, set on it + * + * @see elm_calendar_interval_set() for more details + * + * @ingroup Calendar + */ +EAPI double elm_calendar_interval_get(const Evas_Object *obj); + +/** + * Set the first day of week to use on calendar widgets'. + * + * @param obj The calendar object + * @param day An int which correspond to the first day of the week (Sunday = 0, monday = 1, + * ..., saturday = 6) + * + * @ingroup Calendar + */ +EAPI void elm_calendar_first_day_of_week_set(Evas_Object *obj, Elm_Calendar_Weekday day); + +/** + * Get the first day of week, who are used on calendar widgets'. + * + * @param obj The calendar object + * @return An int which correspond to the first day of the week (Sunday = 0, monday = 1, + * ..., saturday = 6) + * + * @see elm_calendar_first_day_of_week_set() for more details + * + * @ingroup Calendar + */ +EAPI Elm_Calendar_Weekday elm_calendar_first_day_of_week_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_check.c b/libraries/elementary/src/lib/elm_check.c new file mode 100644 index 0000000..e3f40b4 --- /dev/null +++ b/libraries/elementary/src/lib/elm_check.c @@ -0,0 +1,518 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *chk, *icon; + Eina_Bool state; + Eina_Bool *statep; + const char *label; + const char *ontext, *offtext; +}; + +static const char *widtype = NULL; +static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src, + Evas_Callback_Type type, void *event_info); +static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); +static void _theme_hook(Evas_Object *obj); +static void _disable_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, + void *event_info); +static void _sub_del(void *data, Evas_Object *obj, void *event_info); +static void _signal_check_off(void *data, Evas_Object *obj, + const char *emission, const char *source); +static void _signal_check_on(void *data, Evas_Object *obj, + const char *emission, const char *source); +static void _signal_check_toggle(void *data, Evas_Object *obj, + const char *emission, const char *source); +static void _on_focus_hook(void *data, Evas_Object *obj); +static void _activate_hook(Evas_Object *obj); +static void _content_set_hook(Evas_Object *obj, const char *part, + Evas_Object *content); +static Evas_Object *_content_get_hook(const Evas_Object *obj, const char *part); +static Evas_Object *_content_unset_hook(Evas_Object *obj, const char *part); +static void _activate(Evas_Object *obj); +static const char SIG_CHANGED[] = "changed"; +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CHANGED, ""}, + {NULL, NULL} +}; + +static Eina_Bool +_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, + Evas_Callback_Type type, void *event_info) +{ + if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE; + Evas_Event_Key_Down *ev = event_info; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; + if (elm_widget_disabled_get(obj)) return EINA_FALSE; + if ((strcmp(ev->keyname, "Return")) && + (strcmp(ev->keyname, "KP_Enter")) && + (strcmp(ev->keyname, "space"))) + return EINA_FALSE; + _activate(obj); + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; +} + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->label) eina_stringshare_del(wd->label); + if (wd->ontext) eina_stringshare_del(wd->ontext); + if (wd->offtext) eina_stringshare_del(wd->offtext); + free(wd); +} + +static void +_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (elm_widget_focus_get(obj)) + { + edje_object_signal_emit(wd->chk, "elm,action,focus", "elm"); + evas_object_focus_set(wd->chk, EINA_TRUE); + } + else + { + edje_object_signal_emit(wd->chk, "elm,action,unfocus", "elm"); + evas_object_focus_set(wd->chk, EINA_FALSE); + } +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->chk, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _elm_theme_object_set(obj, wd->chk, "check", "base", elm_widget_style_get(obj)); + if (wd->icon) + edje_object_signal_emit(wd->chk, "elm,state,icon,visible", "elm"); + else + edje_object_signal_emit(wd->chk, "elm,state,icon,hidden", "elm"); + if (wd->state) + edje_object_signal_emit(wd->chk, "elm,state,check,on", "elm"); + else + edje_object_signal_emit(wd->chk, "elm,state,check,off", "elm"); + if (wd->label) + edje_object_signal_emit(wd->chk, "elm,state,text,visible", "elm"); + else + edje_object_signal_emit(wd->chk, "elm,state,text,hidden", "elm"); + edje_object_part_text_escaped_set(wd->chk, "elm.text", wd->label); + edje_object_part_text_escaped_set(wd->chk, "elm.ontext", wd->ontext); + edje_object_part_text_escaped_set(wd->chk, "elm.offtext", wd->offtext); + if (elm_widget_disabled_get(obj)) + edje_object_signal_emit(wd->chk, "elm,state,disabled", "elm"); + edje_object_message_signal_process(wd->chk); + edje_object_scale_set(wd->chk, elm_widget_scale_get(obj) * _elm_config->scale); + _sizing_eval(obj); +} + +static void +_disable_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (elm_widget_disabled_get(obj)) + edje_object_signal_emit(wd->chk, "elm,state,disabled", "elm"); + else + edje_object_signal_emit(wd->chk, "elm,state,enabled", "elm"); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; + if (!wd) return; + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + edje_object_size_min_restricted_calc(wd->chk, &minw, &minh, minw, minh); + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, maxw, maxh); +} + +static void +_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + if (obj != wd->icon) return; + _sizing_eval(data); +} + +static void +_sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *sub = event_info; + if (!wd) return; + if (sub == wd->icon) + { + edje_object_signal_emit(wd->chk, "elm,state,icon,hidden", "elm"); + evas_object_event_callback_del_full(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + wd->icon = NULL; + _sizing_eval(obj); + edje_object_message_signal_process(wd->chk); + } +} + +static void +_signal_check_off(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + wd->state = EINA_FALSE; + if (wd->statep) *wd->statep = wd->state; + edje_object_signal_emit(wd->chk, "elm,state,check,off", "elm"); + evas_object_smart_callback_call(data, SIG_CHANGED, NULL); +} + +static void +_signal_check_on(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + wd->state = EINA_TRUE; + if (wd->statep) *wd->statep = wd->state; + edje_object_signal_emit(wd->chk, "elm,state,check,on", "elm"); + evas_object_smart_callback_call(data, SIG_CHANGED, NULL); +} + +static void +_signal_check_toggle(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + _activate(data); +} + +static void +_activate_hook(Evas_Object *obj) +{ + _activate(obj); +} + +static void +_signal_emit_hook(Evas_Object *obj, const char *emission, const char *source) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + edje_object_signal_emit(wd->chk, emission, source); +} + +static void +_signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_signal_callback_add(wd->chk, emission, source, func_cb, data); +} + +static void +_signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + edje_object_signal_callback_del_full(wd->chk, emission, source, func_cb, + data); +} + +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd; + + if (part && strcmp(part, "icon")) return; + wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->icon == content) return; + if (wd->icon) evas_object_del(wd->icon); + wd->icon = content; + if (content) + { + elm_widget_sub_object_add(obj, content); + evas_object_event_callback_add(content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + edje_object_part_swallow(wd->chk, "elm.swallow.content", content); + edje_object_signal_emit(wd->chk, "elm,state,icon,visible", "elm"); + edje_object_message_signal_process(wd->chk); + } + _sizing_eval(obj); +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + + if (part && strcmp(part, "icon")) return NULL; + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->icon; +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + + if (part && strcmp(part, "icon")) return NULL; + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (!wd->icon) return NULL; + Evas_Object *icon = wd->icon; + elm_widget_sub_object_del(obj, wd->icon); + edje_object_part_unswallow(wd->chk, icon); + return icon; +} + +static void +_activate(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if ((_elm_config->access_mode == ELM_ACCESS_MODE_OFF) || + (_elm_access_2nd_click_timeout(obj))) + { + wd->state = !wd->state; + if (wd->statep) *wd->statep = wd->state; + if (wd->state) + { + edje_object_signal_emit(wd->chk, "elm,state,check,on", "elm"); + if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF) + { + if (!wd->ontext) + { + _elm_access_say(E_("State: On")); + } + else + _elm_access_say(E_("State: On")); + } + } + else + { + edje_object_signal_emit(wd->chk, "elm,state,check,off", "elm"); + if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF) + { + if (!wd->offtext) + { + _elm_access_say(E_("State: Off")); + } + else + _elm_access_say(E_("State: Off")); + } + } + evas_object_smart_callback_call(obj, SIG_CHANGED, NULL); + } +} + +static void +_elm_check_label_set(Evas_Object *obj, const char *item, const char *label) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if ((!item) || (!strcmp(item, "default"))) + { + eina_stringshare_replace(&wd->label, label); + if (label) + edje_object_signal_emit(wd->chk, "elm,state,text,visible", "elm"); + else + edje_object_signal_emit(wd->chk, "elm,state,text,hidden", "elm"); + edje_object_message_signal_process(wd->chk); + edje_object_part_text_escaped_set(wd->chk, "elm.text", label); + } + else if ((item) && (!strcmp(item, "on"))) + { + eina_stringshare_replace(&wd->ontext, label); + edje_object_part_text_escaped_set(wd->chk, "elm.ontext", wd->ontext); + } + else if ((item) && (!strcmp(item, "off"))) + { + eina_stringshare_replace(&wd->offtext, label); + edje_object_part_text_escaped_set(wd->chk, "elm.offtext", wd->offtext); + } + _sizing_eval(obj); +} + +static const char * +_elm_check_label_get(const Evas_Object *obj, const char *item) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if ((!item) || (!strcmp(item, "default"))) + return wd->label; + else if ((item) && (!strcmp(item, "on"))) + return wd->ontext; + else if ((item) && (!strcmp(item, "off"))) + return wd->offtext; + return NULL; +} + +static char * +_access_info_cb(void *data __UNUSED__, Evas_Object *obj, Elm_Widget_Item *item __UNUSED__) +{ + const char *txt = elm_widget_access_info_get(obj); + if (!txt) txt = _elm_check_label_get(obj, NULL); + if (txt) return strdup(txt); + return NULL; +} + +static char * +_access_state_cb(void *data, Evas_Object *obj, Elm_Widget_Item *item __UNUSED__) +{ + Evas_Object *o = data; + Widget_Data *wd = elm_widget_data_get(o); + if (!wd) return NULL; + if (elm_widget_disabled_get(obj)) + return strdup(E_("State: Disabled")); + if (wd->state) + { + if (wd->ontext) + { + char buf[1024]; + + snprintf(buf, sizeof(buf), "%s: %s", E_("State"), wd->ontext); + return strdup(buf); + } + else + return strdup(E_("State: On")); + } + if (wd->offtext) + { + char buf[1024]; + + snprintf(buf, sizeof(buf), "%s: %s", E_("State"), wd->offtext); + return strdup(buf); + } + return strdup(E_("State: Off")); +} + +EAPI Evas_Object * +elm_check_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "check"); + elm_widget_type_set(obj, "check"); + elm_widget_sub_object_add(parent, obj); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_disable_hook_set(obj, _disable_hook); + elm_widget_can_focus_set(obj, EINA_TRUE); + elm_widget_activate_hook_set(obj, _activate_hook); + elm_widget_event_hook_set(obj, _event_hook); + elm_widget_signal_emit_hook_set(obj, _signal_emit_hook); + elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook); + elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook); + elm_widget_text_set_hook_set(obj, _elm_check_label_set); + elm_widget_text_get_hook_set(obj, _elm_check_label_get); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); + + wd->chk = edje_object_add(e); + _elm_theme_object_set(obj, wd->chk, "check", "base", "default"); + edje_object_signal_callback_add(wd->chk, "elm,action,check,on", "", + _signal_check_on, obj); + edje_object_signal_callback_add(wd->chk, "elm,action,check,off", "", + _signal_check_off, obj); + edje_object_signal_callback_add(wd->chk, "elm,action,check,toggle", "", + _signal_check_toggle, obj); + elm_widget_resize_object_set(obj, wd->chk); + + evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _sizing_eval(obj); + + // TODO: convert Elementary to subclassing of Evas_Smart_Class + // TODO: and save some bytes, making descriptions per-class and not instance! + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + _elm_access_object_register(obj, wd->chk); + _elm_access_text_set(_elm_access_object_get(obj), + ELM_ACCESS_TYPE, E_("Check")); + _elm_access_callback_set(_elm_access_object_get(obj), + ELM_ACCESS_INFO, _access_info_cb, obj); + _elm_access_callback_set(_elm_access_object_get(obj), + ELM_ACCESS_STATE, _access_state_cb, obj); + return obj; +} + +EAPI void +elm_check_state_set(Evas_Object *obj, Eina_Bool state) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (state != wd->state) + { + wd->state = state; + if (wd->statep) *wd->statep = wd->state; + if (wd->state) + edje_object_signal_emit(wd->chk, "elm,state,check,on", "elm"); + else + edje_object_signal_emit(wd->chk, "elm,state,check,off", "elm"); + } + edje_object_message_signal_process(wd->chk); +} + +EAPI Eina_Bool +elm_check_state_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->state; +} + +EAPI void +elm_check_state_pointer_set(Evas_Object *obj, Eina_Bool *statep) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (statep) + { + wd->statep = statep; + if (*wd->statep != wd->state) + { + wd->state = *wd->statep; + if (wd->state) + edje_object_signal_emit(wd->chk, "elm,state,check,on", "elm"); + else + edje_object_signal_emit(wd->chk, "elm,state,check,off", "elm"); + } + } + else + wd->statep = NULL; +} diff --git a/libraries/elementary/src/lib/elm_check.h b/libraries/elementary/src/lib/elm_check.h new file mode 100644 index 0000000..7bdf13b --- /dev/null +++ b/libraries/elementary/src/lib/elm_check.h @@ -0,0 +1,105 @@ +/** + * @defgroup Check Check + * @ingroup Elementary + * + * @image html img/widget/check/preview-00.png + * @image latex img/widget/check/preview-00.eps + * @image html img/widget/check/preview-01.png + * @image latex img/widget/check/preview-01.eps + * @image html img/widget/check/preview-02.png + * @image latex img/widget/check/preview-02.eps + * + * @brief The check widget allows for toggling a value between true and + * false. + * + * Check objects are a lot like radio objects in layout and functionality + * except they do not work as a group, but independently and only toggle the + * value of a boolean from false to true (0 or 1). elm_check_state_set() sets + * the boolean state (1 for true, 0 for false), and elm_check_state_get() + * returns the current state. For convenience, like the radio objects, you + * can set a pointer to a boolean directly with elm_check_state_pointer_set() + * for it to modify. + * + * Signals that you can add callbacks for are: + * "changed" - This is called whenever the user changes the state of the check + * objects(event_info is NULL). + * + * Default content parts of the check widget that you can use for are: + * @li "icon" - An icon of the check + * + * Default text parts of the check widget that you can use for are: + * @li "default" - A label of the check + * @li "on" - On state label of the check + * @li "off" - Off state label of the check + * + * Supported elm_object common APIs. + * @li @ref elm_object_disabled_set + * @li @ref elm_object_disabled_get + * @li @ref elm_object_part_text_set + * @li @ref elm_object_part_text_get + * @li @ref elm_object_part_content_set + * @li @ref elm_object_part_content_get + * @li @ref elm_object_part_content_unset + * @li @ref elm_object_signal_emit + * @li @ref elm_object_signal_callback_add + * @li @ref elm_object_signal_callback_del + * + * @ref tutorial_check should give you a firm grasp of how to use this widget. + * + * @{ + */ + +/** + * @brief Add a new Check object + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * @ingroup Check + */ +EAPI Evas_Object * elm_check_add(Evas_Object *parent); + +/** + * @brief Set the on/off state of the check object + * + * @param obj The check object + * @param state The state to use (1 == on, 0 == off) + * + * This sets the state of the check. If set with elm_check_state_pointer_set() + * the state of that variable is also changed. Calling this @b doesn't cause + * the "changed" signal to be emitted. + * + * @ingroup Check + */ +EAPI void elm_check_state_set(Evas_Object *obj, Eina_Bool state); + +/** + * @brief Get the state of the check object + * + * @param obj The check object + * @return The boolean state + * + * @ingroup Check + */ +EAPI Eina_Bool elm_check_state_get(const Evas_Object *obj); + +/** + * @brief Set a convenience pointer to a boolean to change + * + * @param obj The check object + * @param statep Pointer to the boolean to modify + * + * This sets a pointer to a boolean, that, in addition to the check objects + * state will also be modified directly. To stop setting the object pointed + * to simply use NULL as the @p statep parameter. If @p statep is not NULL, + * then when this is called, the check objects state will also be modified to + * reflect the value of the boolean @p statep points to, just like calling + * elm_check_state_set(). + * + * @ingroup Check + */ +EAPI void elm_check_state_pointer_set(Evas_Object *obj, Eina_Bool *statep); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_clock.c b/libraries/elementary/src/lib/elm_clock.c new file mode 100644 index 0000000..3bd0b2d --- /dev/null +++ b/libraries/elementary/src/lib/elm_clock.c @@ -0,0 +1,681 @@ +#include +#include "elm_priv.h" + +#define DEFAULT_FIRST_INTERVAL 0.85 +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *clk; + double interval, first_interval; + Eina_Bool seconds : 1; + Eina_Bool am_pm : 1; + Eina_Bool edit : 1; + Elm_Clock_Edit_Mode digedit; + int hrs, min, sec, timediff; + Evas_Object *digit[6]; + Evas_Object *ampm; + Evas_Object *sel_obj; + Ecore_Timer *ticker, *spin; + struct + { + int hrs, min, sec; + char ampm; + Eina_Bool seconds : 1; + Eina_Bool am_pm : 1; + Eina_Bool edit : 1; + Elm_Clock_Edit_Mode digedit; + } cur; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); +static void _on_focus_hook(void *data, Evas_Object *obj); +static Eina_Bool _ticker(void *data); +static Eina_Bool _signal_clock_val_up(void *data); +static Eina_Bool _signal_clock_val_down(void *data); +static void _time_update(Evas_Object *obj); + +static const char SIG_CHANGED[] = "changed"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CHANGED, ""}, + {NULL, NULL} +}; + + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + int i; + for (i = 0; i < 6; i++) + { + if (wd->digit[i]) evas_object_del(wd->digit[i]); + } + if (wd->ampm) evas_object_del(wd->ampm); + if (wd->ticker) ecore_timer_del(wd->ticker); + if (wd->spin) ecore_timer_del(wd->spin); + free(wd); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (elm_widget_focus_get(obj)) + edje_object_signal_emit(wd->clk, "elm,action,focus", "elm"); + else + edje_object_signal_emit(wd->clk, "elm,action,unfocus", "elm"); + wd->cur.am_pm = !wd->cur.am_pm; /* hack - force update */ + _time_update(obj); +} + +static void +_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (elm_widget_focus_get(obj)) + { + edje_object_signal_emit(wd->clk, "elm,action,focus", "elm"); + evas_object_focus_set(wd->clk, EINA_TRUE); + } + else + { + edje_object_signal_emit(wd->clk, "elm,action,unfocus", "elm"); + evas_object_focus_set(wd->clk, EINA_FALSE); + } +} + +static void +_signal_emit_hook(Evas_Object *obj, const char *emission, const char *source) +{ + Widget_Data *wd = elm_widget_data_get(obj); + int i; + if (!wd) return; + edje_object_signal_emit(wd->clk, emission, source); + for (i = 0; i < 6; i++) + { + if (wd->digit[i]) + edje_object_signal_emit(wd->digit[i], emission, source); + } +} + +static void +_signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + int i; + if (!wd) return; + edje_object_signal_callback_add(wd->clk, emission, source, func_cb, data); + for (i = 0; i < 6; i++) + { + if (wd->digit[i]) + edje_object_signal_callback_add(wd->digit[i], emission, source, + func_cb, data); + } +} + +static void +_signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + int i; + for (i = 0; i < 6; i++) + { + edje_object_signal_callback_del_full(wd->digit[i], emission, source, + func_cb, data); + } + edje_object_signal_callback_del_full(wd->clk, emission, source, func_cb, + data); +} + +static void +_timediff_set(Widget_Data *wd) +{ + struct timeval timev; + struct tm *tm; + time_t tt; + gettimeofday(&timev, NULL); + tt = (time_t)(timev.tv_sec); + tzset(); + tm = localtime(&tt); + wd->timediff = (((wd->hrs - tm->tm_hour) * 60 + + wd->min - tm->tm_min) * 60) + wd->sec - tm->tm_sec; +} + +static Eina_Bool +_ticker(void *data) +{ + Widget_Data *wd = elm_widget_data_get(data); + double t; + struct timeval timev; + struct tm *tm; + time_t tt; + if (!wd) return ECORE_CALLBACK_CANCEL; + gettimeofday(&timev, NULL); + t = ((double)(1000000 - timev.tv_usec)) / 1000000.0; + wd->ticker = ecore_timer_add(t, _ticker, data); + if (!wd->edit) + { + tt = (time_t)(timev.tv_sec) + wd->timediff; + tzset(); + tm = localtime(&tt); + if (tm) + { + wd->hrs = tm->tm_hour; + wd->min = tm->tm_min; + wd->sec = tm->tm_sec; + _time_update(data); + } + } + return ECORE_CALLBACK_CANCEL; +} + +static Eina_Bool +_signal_clock_val_up(void *data) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) goto clock_val_up_exit_on_error; + if (!wd->edit) goto clock_val_up_cancel; + if (!wd->sel_obj) goto clock_val_up_cancel; + if (wd->sel_obj == wd->digit[0]) + { + wd->hrs = wd->hrs + 10; + if (wd->hrs >= 24) wd->hrs -= 24; + } + if (wd->sel_obj == wd->digit[1]) + { + wd->hrs = wd->hrs + 1; + if (wd->hrs >= 24) wd->hrs -= 24; + } + if (wd->sel_obj == wd->digit[2]) + { + wd->min = wd->min + 10; + if (wd->min >= 60) wd->min -= 60; + } + if (wd->sel_obj == wd->digit[3]) + { + wd->min = wd->min + 1; + if (wd->min >= 60) wd->min -= 60; + } + if (wd->sel_obj == wd->digit[4]) + { + wd->sec = wd->sec + 10; + if (wd->sec >= 60) wd->sec -= 60; + } + if (wd->sel_obj == wd->digit[5]) + { + wd->sec = wd->sec + 1; + if (wd->sec >= 60) wd->sec -= 60; + } + if (wd->sel_obj == wd->ampm) + { + wd->hrs = wd->hrs + 12; + if (wd->hrs > 23) wd->hrs -= 24; + } + wd->interval = wd->interval / 1.05; + ecore_timer_interval_set(wd->spin, wd->interval); + _time_update(data); + evas_object_smart_callback_call(data, SIG_CHANGED, NULL); + return ECORE_CALLBACK_RENEW; +clock_val_up_cancel: + wd->spin = NULL; +clock_val_up_exit_on_error: + return ECORE_CALLBACK_CANCEL; +} + +static Eina_Bool +_signal_clock_val_down(void *data) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) goto clock_val_down_exit_on_error; + if (!wd->edit) goto clock_val_down_cancel; + if (!wd->sel_obj) goto clock_val_down_cancel; + if (wd->sel_obj == wd->digit[0]) + { + wd->hrs = wd->hrs - 10; + if (wd->hrs < 0) wd->hrs += 24; + } + if (wd->sel_obj == wd->digit[1]) + { + wd->hrs = wd->hrs - 1; + if (wd->hrs < 0) wd->hrs += 24; + } + if (wd->sel_obj == wd->digit[2]) + { + wd->min = wd->min - 10; + if (wd->min < 0) wd->min += 60; + } + if (wd->sel_obj == wd->digit[3]) + { + wd->min = wd->min - 1; + if (wd->min < 0) wd->min += 60; + } + if (wd->sel_obj == wd->digit[4]) + { + wd->sec = wd->sec - 10; + if (wd->sec < 0) wd->sec += 60; + } + if (wd->sel_obj == wd->digit[5]) + { + wd->sec = wd->sec - 1; + if (wd->sec < 0) wd->sec += 60; + } + if (wd->sel_obj == wd->ampm) + { + wd->hrs = wd->hrs - 12; + if (wd->hrs < 0) wd->hrs += 24; + } + wd->interval = wd->interval / 1.05; + ecore_timer_interval_set(wd->spin, wd->interval); + _time_update(data); + evas_object_smart_callback_call(data, SIG_CHANGED, NULL); + return ECORE_CALLBACK_RENEW; +clock_val_down_cancel: + wd->spin = NULL; +clock_val_down_exit_on_error: + return ECORE_CALLBACK_CANCEL; +} + +static void +_signal_clock_val_up_start(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + wd->interval = wd->first_interval; + wd->sel_obj = obj; + if (wd->spin) ecore_timer_del(wd->spin); + wd->spin = ecore_timer_add(wd->interval, _signal_clock_val_up, data); + _signal_clock_val_up(data); +} + +static void +_signal_clock_val_down_start(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + wd->interval = wd->first_interval; + wd->sel_obj = obj; + if (wd->spin) ecore_timer_del(wd->spin); + wd->spin = ecore_timer_add(wd->interval, _signal_clock_val_down, data); + _signal_clock_val_down(data); +} + +static void +_signal_clock_val_change_stop(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + if (wd->spin) ecore_timer_del(wd->spin); + wd->spin = NULL; + wd->sel_obj = NULL; +} + +static void +_time_update(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Edje_Message_Int msg; + int ampm = 0; + const char *style = elm_widget_style_get(obj); + if (!wd) return; + if ((wd->cur.seconds != wd->seconds) || (wd->cur.am_pm != wd->am_pm) || + (wd->cur.edit != wd->edit) || (wd->cur.digedit != wd->digedit)) + { + int i; + Evas_Coord mw, mh; + + for (i = 0; i < 6; i++) + { + if (wd->digit[i]) + { + evas_object_del(wd->digit[i]); + wd->digit[i] = NULL; + } + } + if (wd->ampm) + { + evas_object_del(wd->ampm); + wd->ampm = NULL; + } + + if ((wd->seconds) && (wd->am_pm)) + _elm_theme_object_set(obj, wd->clk, "clock", "base-all", style); + else if (wd->seconds) + _elm_theme_object_set(obj, wd->clk, "clock", "base-seconds", style); + else if (wd->am_pm) + _elm_theme_object_set(obj, wd->clk, "clock", "base-am_pm", style); + else + _elm_theme_object_set(obj, wd->clk, "clock", "base", style); + edje_object_scale_set(wd->clk, elm_widget_scale_get(obj) * + _elm_config->scale); + + for (i = 0; i < 6; i++) + { + char buf[16]; + + if ((!wd->seconds) && (i >= 4)) break; + wd->digit[i] = edje_object_add(evas_object_evas_get(wd->clk)); + _elm_theme_object_set(obj, wd->digit[i], "clock", "flipdigit", style); + edje_object_scale_set(wd->digit[i], elm_widget_scale_get(obj) * + _elm_config->scale); + if ((wd->edit) && (wd->digedit & (1 << i))) + edje_object_signal_emit(wd->digit[i], "elm,state,edit,on", "elm"); + edje_object_signal_callback_add(wd->digit[i], "elm,action,up,start", + "", _signal_clock_val_up_start, obj); + edje_object_signal_callback_add(wd->digit[i], "elm,action,up,stop", + "", _signal_clock_val_change_stop, obj); + edje_object_signal_callback_add(wd->digit[i], "elm,action,down,start", + "", _signal_clock_val_down_start, obj); + edje_object_signal_callback_add(wd->digit[i], "elm,action,down,stop", + "", _signal_clock_val_change_stop, obj); + mw = mh = -1; + elm_coords_finger_size_adjust(1, &mw, 2, &mh); + edje_object_size_min_restricted_calc(wd->digit[i], &mw, &mh, mw, mh); + elm_coords_finger_size_adjust(1, &mw, 2, &mh); + edje_extern_object_min_size_set(wd->digit[i], mw, mh); + snprintf(buf, sizeof(buf), "d%i", i); + edje_object_part_swallow(wd->clk , buf, wd->digit[i]); + evas_object_show(wd->digit[i]); + } + if (wd->am_pm) + { + wd->ampm = edje_object_add(evas_object_evas_get(wd->clk)); + _elm_theme_object_set(obj, wd->ampm, "clock", "flipampm", style); + edje_object_scale_set(wd->ampm, elm_widget_scale_get(obj) * + _elm_config->scale); + if (wd->edit) + edje_object_signal_emit(wd->ampm, "elm,state,edit,on", "elm"); + edje_object_signal_callback_add(wd->ampm, "elm,action,up,start", + "", _signal_clock_val_up_start, obj); + edje_object_signal_callback_add(wd->ampm, "elm,action,up,stop", + "", _signal_clock_val_change_stop, obj); + edje_object_signal_callback_add(wd->ampm, "elm,action,down,start", + "", _signal_clock_val_down_start, obj); + edje_object_signal_callback_add(wd->ampm, "elm,action,down,stop", + "", _signal_clock_val_change_stop, obj); + mw = mh = -1; + elm_coords_finger_size_adjust(1, &mw, 2, &mh); + edje_object_size_min_restricted_calc(wd->ampm, &mw, &mh, mw, mh); + elm_coords_finger_size_adjust(1, &mw, 2, &mh); + edje_extern_object_min_size_set(wd->ampm, mw, mh); + edje_object_part_swallow(wd->clk , "ampm", wd->ampm); + evas_object_show(wd->ampm); + } + + edje_object_size_min_calc(wd->clk, &mw, &mh); + evas_object_size_hint_min_set(obj, mw, mh); + + wd->cur.hrs = 0; + wd->cur.min = 0; + wd->cur.sec = 0; + wd->cur.ampm = -1; + wd->cur.seconds = wd->seconds; + wd->cur.am_pm = wd->am_pm; + wd->cur.edit = wd->edit; + wd->cur.digedit = wd->digedit; + } + if (wd->hrs != wd->cur.hrs) + { + int hrs; + int d1, d2, dc1, dc2; + + hrs = wd->hrs; + if (wd->am_pm) + { + if (hrs >= 12) + { + if (hrs > 12) hrs -= 12; + ampm = 1; + } + else if (!hrs) hrs = 12; + } + d1 = hrs / 10; + d2 = hrs % 10; + dc1 = wd->cur.hrs / 10; + dc2 = wd->cur.hrs % 10; + if (d1 != dc1) + { + msg.val = d1; + edje_object_message_send(wd->digit[0], EDJE_MESSAGE_INT, 1, &msg); + } + if (d2 != dc2) + { + msg.val = d2; + edje_object_message_send(wd->digit[1], EDJE_MESSAGE_INT, 1, &msg); + } + wd->cur.hrs = hrs; + } + if (wd->min != wd->cur.min) + { + int d1, d2, dc1, dc2; + + d1 = wd->min / 10; + d2 = wd->min % 10; + dc1 = wd->cur.min / 10; + dc2 = wd->cur.min % 10; + if (d1 != dc1) + { + msg.val = d1; + edje_object_message_send(wd->digit[2], EDJE_MESSAGE_INT, 1, &msg); + } + if (d2 != dc2) + { + msg.val = d2; + edje_object_message_send(wd->digit[3], EDJE_MESSAGE_INT, 1, &msg); + } + wd->cur.min = wd->min; + } + if (wd->seconds) + { + if (wd->sec != wd->cur.sec) + { + int d1, d2, dc1, dc2; + + d1 = wd->sec / 10; + d2 = wd->sec % 10; + dc1 = wd->cur.sec / 10; + dc2 = wd->cur.sec % 10; + if (d1 != dc1) + { + msg.val = d1; + edje_object_message_send(wd->digit[4], EDJE_MESSAGE_INT, 1, &msg); + } + if (d2 != dc2) + { + msg.val = d2; + edje_object_message_send(wd->digit[5], EDJE_MESSAGE_INT, 1, &msg); + } + wd->cur.sec = wd->sec; + } + } + else + wd->cur.sec = -1; + + if (wd->am_pm) + { + if (wd->hrs >= 12) ampm = 1; + if (ampm != wd->cur.ampm) + { + if (wd->cur.ampm != ampm) + { + msg.val = ampm; + edje_object_message_send(wd->ampm, EDJE_MESSAGE_INT, 1, &msg); + } + wd->cur.ampm = ampm; + } + } + else + wd->cur.ampm = -1; +} + +EAPI Evas_Object * +elm_clock_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "clock"); + elm_widget_type_set(obj, "clock"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_signal_emit_hook_set(obj, _signal_emit_hook); + elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook); + elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook); + elm_widget_can_focus_set(obj, EINA_TRUE); + + wd->clk = edje_object_add(e); + elm_widget_resize_object_set(obj, wd->clk); + + wd->cur.ampm = -1; + wd->cur.seconds = EINA_TRUE; + wd->cur.am_pm = EINA_TRUE; + wd->cur.edit = EINA_TRUE; + wd->cur.digedit = ELM_CLOCK_EDIT_DEFAULT; + wd->first_interval = DEFAULT_FIRST_INTERVAL; + wd->timediff = 0; + + _time_update(obj); + _ticker(obj); + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + return obj; +} + +EAPI void +elm_clock_time_set(Evas_Object *obj, int hrs, int min, int sec) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->hrs = hrs; + wd->min = min; + wd->sec = sec; + _timediff_set(wd); + _time_update(obj); +} + +EAPI void +elm_clock_time_get(const Evas_Object *obj, int *hrs, int *min, int *sec) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (hrs) *hrs = wd->hrs; + if (min) *min = wd->min; + if (sec) *sec = wd->sec; +} + +EAPI void +elm_clock_edit_set(Evas_Object *obj, Eina_Bool edit) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->edit = edit; + if (!edit) + _timediff_set(wd); + if ((edit) && (wd->digedit == ELM_CLOCK_EDIT_DEFAULT)) + elm_clock_edit_mode_set(obj, ELM_CLOCK_EDIT_ALL); + else + _time_update(obj); +} + +EAPI Eina_Bool +elm_clock_edit_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->edit; +} + +EAPI void +elm_clock_edit_mode_set(Evas_Object *obj, Elm_Clock_Edit_Mode digedit) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->digedit = digedit; + if (digedit == ELM_CLOCK_EDIT_DEFAULT) + elm_clock_edit_set(obj, EINA_FALSE); + else + _time_update(obj); +} + +EAPI Elm_Clock_Edit_Mode +elm_clock_edit_mode_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; + return wd->digedit; +} + +EAPI void +elm_clock_show_am_pm_set(Evas_Object *obj, Eina_Bool am_pm) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->am_pm = !!am_pm; + _time_update(obj); +} + +EAPI Eina_Bool +elm_clock_show_am_pm_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->am_pm; +} + +EAPI void +elm_clock_show_seconds_set(Evas_Object *obj, Eina_Bool seconds) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->seconds = !!seconds; + _time_update(obj); +} + +EAPI Eina_Bool +elm_clock_show_seconds_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->seconds; +} + +EAPI void +elm_clock_first_interval_set(Evas_Object *obj, double interval) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->first_interval = !!interval; +} + +EAPI double +elm_clock_first_interval_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0.0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0.0; + return wd->first_interval; +} diff --git a/libraries/elementary/src/lib/elm_clock.h b/libraries/elementary/src/lib/elm_clock.h new file mode 100644 index 0000000..d8012ef --- /dev/null +++ b/libraries/elementary/src/lib/elm_clock.h @@ -0,0 +1,308 @@ +/** + * @defgroup Clock Clock + * @ingroup Elementary + * + * @image html img/widget/clock/preview-00.png + * @image latex img/widget/clock/preview-00.eps + * + * This is a @b digital clock widget. In its default theme, it has a + * vintage "flipping numbers clock" appearance, which will animate + * sheets of individual algarisms individually as time goes by. + * + * A newly created clock will fetch system's time (already + * considering local time adjustments) to start with, and will tick + * accordingly. It may or may not show seconds. + * + * Clocks have an @b edition mode. When in it, the sheets will + * display extra arrow indications on the top and bottom and the + * user may click on them to raise or lower the time values. After + * it's told to exit edition mode, it will keep ticking with that + * new time set (it keeps the difference from local time). + * + * Also, when under edition mode, user clicks on the cited arrows + * which are @b held for some time will make the clock to flip the + * sheet, thus editing the time, continuously and automatically for + * the user. The interval between sheet flips will keep growing in + * time, so that it helps the user to reach a time which is distant + * from the one set. + * + * The time display is, by default, in military mode (24h), but an + * am/pm indicator may be optionally shown, too, when it will + * switch to 12h. + * + * Smart callbacks one can register to: + * - "changed" - the clock's user changed the time + * + * Supported elm_object common APIs. + * @li @ref elm_object_signal_emit + * @li @ref elm_object_signal_callback_add + * @li @ref elm_object_signal_callback_del + * + * Here is an example on its usage: + * @li @ref clock_example + */ + +/** + * @addtogroup Clock + * @{ + */ + +/** + * Identifiers for which clock digits should be editable, when a + * clock widget is in edition mode. Values may be OR-ed together to + * make a mask, naturally. + * + * @see elm_clock_edit_set() + * @see elm_clock_edit_mode_set() + */ +typedef enum +{ + ELM_CLOCK_EDIT_DEFAULT = 0, /**< Default value. Means that all digits are editable, when in edition mode. */ + ELM_CLOCK_EDIT_HOUR_DECIMAL = 1 << 0, /**< Decimal algarism of hours value should be editable */ + ELM_CLOCK_EDIT_HOUR_UNIT = 1 << 1, /**< Unit algarism of hours value should be editable */ + ELM_CLOCK_EDIT_MIN_DECIMAL = 1 << 2, /**< Decimal algarism of minutes value should be editable */ + ELM_CLOCK_EDIT_MIN_UNIT = 1 << 3, /**< Unit algarism of minutes value should be editable */ + ELM_CLOCK_EDIT_SEC_DECIMAL = 1 << 4, /**< Decimal algarism of seconds value should be editable */ + ELM_CLOCK_EDIT_SEC_UNIT = 1 << 5, /**< Unit algarism of seconds value should be editable */ + ELM_CLOCK_EDIT_ALL = (1 << 6) - 1 /**< All digits should be editable */ +} Elm_Clock_Edit_Mode; + +/** + * Add a new clock widget to the given parent Elementary + * (container) object + * + * @param parent The parent object + * @return a new clock widget handle or @c NULL, on errors + * + * This function inserts a new clock widget on the canvas. + * + * @ingroup Clock + */ +EAPI Evas_Object *elm_clock_add(Evas_Object *parent); + +/** + * Set a clock widget's time, programmatically + * + * @param obj The clock widget object + * @param hrs The hours to set + * @param min The minutes to set + * @param sec The seconds to set + * + * This function updates the time that is showed by the clock + * widget. + * + * Values @b must be set within the following ranges: + * - 0 - 23, for hours + * - 0 - 59, for minutes + * - 0 - 59, for seconds, + * + * even if the clock is not in "military" mode. + * + * @warning The behavior for values set out of those ranges is @b + * undefined. + * + * @ingroup Clock + */ +EAPI void elm_clock_time_set(Evas_Object *obj, int hrs, int min, int sec); + +/** + * Get a clock widget's time values + * + * @param obj The clock object + * @param[out] hrs Pointer to the variable to get the hours value + * @param[out] min Pointer to the variable to get the minutes value + * @param[out] sec Pointer to the variable to get the seconds value + * + * This function gets the time set for @p obj, returning + * it on the variables passed as the arguments to function + * + * @note Use @c NULL pointers on the time values you're not + * interested in: they'll be ignored by the function. + * + * @ingroup Clock + */ +EAPI void elm_clock_time_get(const Evas_Object *obj, int *hrs, int *min, int *sec); + +/** + * Set whether a given clock widget is under edition mode or + * under (default) displaying-only mode. + * + * @param obj The clock object + * @param edit @c EINA_TRUE to put it in edition, @c EINA_FALSE to + * put it back to "displaying only" mode + * + * This function makes a clock's time to be editable or not by + * user interaction. When in edition mode, clocks @b stop + * ticking, until one brings them back to canonical mode. The + * elm_clock_edit_mode_set() function will influence which digits + * of the clock will be editable. By default, all of them will be + * (#ELM_CLOCK_NONE). + * + * @note am/pm sheets, if being shown, will @b always be editable + * under edition mode. + * + * @see elm_clock_edit_get() + * + * @ingroup Clock + */ +EAPI void elm_clock_edit_set(Evas_Object *obj, Eina_Bool edit); + +/** + * Retrieve whether a given clock widget is under editing mode + * or under (default) displaying-only mode. + * + * @param obj The clock object + * @return @c EINA_TRUE, if it's in edition mode, @c EINA_FALSE otherwise + * + * This function retrieves whether the clock's time can be edited + * or not by user interaction. + * + * @see elm_clock_edit_set() for more details + * + * @ingroup Clock + */ +EAPI Eina_Bool elm_clock_edit_get(const Evas_Object *obj); + +/** + * Set what digits of the given clock widget should be editable + * when in edition mode. + * + * @param obj The clock object + * @param digedit Bit mask indicating the digits to be editable + * (values in #Elm_Clock_Edit_Mode). + * + * If the @p digedit param is #ELM_CLOCK_NONE, editing will be + * disabled on @p obj (same effect as elm_clock_edit_set(), with @c + * EINA_FALSE). + * + * @see elm_clock_edit_mode_get() + * + * @ingroup Clock + */ +EAPI void elm_clock_edit_mode_set(Evas_Object *obj, Elm_Clock_Edit_Mode digedit); + +/** + * Retrieve what digits of the given clock widget should be + * editable when in edition mode. + * + * @param obj The clock object + * @return Bit mask indicating the digits to be editable + * (values in #Elm_Clock_Edit_Mode). + * + * @see elm_clock_edit_mode_set() for more details + * + * @ingroup Clock + */ +EAPI Elm_Clock_Edit_Mode elm_clock_edit_mode_get(const Evas_Object *obj); + +/** + * Set if the given clock widget must show hours in military or + * am/pm mode + * + * @param obj The clock object + * @param am_pm @c EINA_TRUE to put it in am/pm mode, @c EINA_FALSE + * to military mode + * + * This function sets if the clock must show hours in military or + * am/pm mode. In some countries like Brazil the military mode + * (00-24h-format) is used, in opposition to the USA, where the + * am/pm mode is more commonly used. + * + * @see elm_clock_show_am_pm_get() + * + * @ingroup Clock + */ +EAPI void elm_clock_show_am_pm_set(Evas_Object *obj, Eina_Bool am_pm); + +/** + * Get if the given clock widget shows hours in military or am/pm + * mode + * + * @param obj The clock object + * @return @c EINA_TRUE, if in am/pm mode, @c EINA_FALSE if in + * military + * + * This function gets if the clock shows hours in military or am/pm + * mode. + * + * @see elm_clock_show_am_pm_set() for more details + * + * @ingroup Clock + */ +EAPI Eina_Bool elm_clock_show_am_pm_get(const Evas_Object *obj); + +/** + * Set if the given clock widget must show time with seconds or not + * + * @param obj The clock object + * @param seconds @c EINA_TRUE to show seconds, @c EINA_FALSE otherwise + * + * This function sets if the given clock must show or not elapsed + * seconds. By default, they are @b not shown. + * + * @see elm_clock_show_seconds_get() + * + * @ingroup Clock + */ +EAPI void elm_clock_show_seconds_set(Evas_Object *obj, Eina_Bool seconds); + +/** + * Get whether the given clock widget is showing time with seconds + * or not + * + * @param obj The clock object + * @return @c EINA_TRUE if it's showing seconds, @c EINA_FALSE otherwise + * + * This function gets whether @p obj is showing or not the elapsed + * seconds. + * + * @see elm_clock_show_seconds_set() + * + * @ingroup Clock + */ +EAPI Eina_Bool elm_clock_show_seconds_get(const Evas_Object *obj); + +/** + * Set the first interval on time updates for a user mouse button hold + * on clock widgets' time edition. + * + * @param obj The clock object + * @param interval The first interval value in seconds + * + * This interval value is @b decreased while the user holds the + * mouse pointer either incrementing or decrementing a given the + * clock digit's value. + * + * This helps the user to get to a given time distant from the + * current one easier/faster, as it will start to flip quicker and + * quicker on mouse button holds. + * + * The calculation for the next flip interval value, starting from + * the one set with this call, is the previous interval divided by + * 1.05, so it decreases a little bit. + * + * The default starting interval value for automatic flips is + * @b 0.85 seconds. + * + * @see elm_clock_first_interval_get() + * + * @ingroup Clock + */ +EAPI void elm_clock_first_interval_set(Evas_Object *obj, double interval); + +/** + * Get the first interval on time updates for a user mouse button hold + * on clock widgets' time edition. + * + * @param obj The clock object + * @return The first interval value, in seconds, set on it + * + * @see elm_clock_first_interval_set() for more details + * + * @ingroup Clock + */ +EAPI double elm_clock_first_interval_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_cnp.c b/libraries/elementary/src/lib/elm_cnp.c new file mode 100644 index 0000000..cf08189 --- /dev/null +++ b/libraries/elementary/src/lib/elm_cnp.c @@ -0,0 +1,1635 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#include "elm_priv.h" + +#ifdef HAVE_MMAN_H +# include +#endif + +#ifdef HAVE_ELEMENTARY_X + +#define ARRAYINIT(foo) [foo] = + +//#define DEBUGON 1 + +#ifdef DEBUGON +# define cnp_debug(x...) fprintf(stderr, __FILE__": " x) +#else +# define cnp_debug(x...) +#endif + +typedef struct _Cnp_Selection Cnp_Selection; +typedef struct _Escape Escape; +typedef struct _Tmp_Info Tmp_Info; +typedef struct _Cnp_Atom Cnp_Atom; +typedef struct _Saved_Type Saved_Type; +typedef struct _Dropable Dropable; + +typedef Eina_Bool (*Converter_Fn_Cb) (char *target, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *ttype, int *typesize); +typedef int (*Response_Handler_Cb) (Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *); +typedef int (*Notify_Handler_Cb) (Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *); + +enum +{ + CNP_ATOM_TARGETS = 0, + CNP_ATOM_ATOM, + CNP_ATOM_LISTING_ATOMS = CNP_ATOM_ATOM, + CNP_ATOM_text_uri, + CNP_ATOM_text_urilist, + CNP_ATOM_text_x_vcard, + CNP_ATOM_image_png, + CNP_ATOM_image_jpeg, + CNP_ATOM_image_bmp, + CNP_ATOM_image_gif, + CNP_ATOM_image_tiff, + CNP_ATOM_image_svg, + CNP_ATOM_image_xpm, + CNP_ATOM_image_tga, + CNP_ATOM_image_ppm, + CNP_ATOM_XELM, + CNP_ATOM_text_html_utf8, + CNP_ATOM_text_html, + CNP_ATOM_UTF8STRING, + CNP_ATOM_STRING, + CNP_ATOM_TEXT, + CNP_ATOM_text_plain_utf8, + CNP_ATOM_text_plain, + + CNP_N_ATOMS, +}; + +struct _Cnp_Selection +{ + const char *debug; + Evas_Object *widget; + char *selbuf; + Evas_Object *requestwidget; + void *udata; + Elm_Sel_Format requestformat; + Elm_Drop_Cb datacb; + Eina_Bool (*set) (Ecore_X_Window, const void *data, int size); + Eina_Bool (*clear) (void); + void (*request) (Ecore_X_Window, const char *target); + + Elm_Sel_Format format; + Ecore_X_Selection ecore_sel; + + Eina_Bool active : 1; +}; + +struct _Escape +{ + const char *escape; + const char *value; +}; + +struct _Tmp_Info +{ + char *filename; + void *map; + int fd; + int len; +}; + +struct _Cnp_Atom +{ + const char *name; + Elm_Sel_Format formats; + /* Called by ecore to do conversion */ + Converter_Fn_Cb converter; + Response_Handler_Cb response; + Notify_Handler_Cb notify; + /* Atom */ + Ecore_X_Atom atom; +}; + +struct _Saved_Type +{ + const char **types; + char *imgfile; + int ntypes; + int x, y; + Eina_Bool textreq: 1; +}; + +struct _Dropable +{ + Evas_Object *obj; + /* FIXME: Cache window */ + Elm_Sel_Format types; + Elm_Drop_Cb dropcb; + void *cbdata; +}; + +static Tmp_Info *elm_cnp_tempfile_create(int size); +static int tmpinfo_free(Tmp_Info *tmp); + +static Eina_Bool _elm_cnp_init(void); +static Eina_Bool selection_clear(void *udata __UNUSED__, int type, void *event); +static Eina_Bool selection_notify(void *udata __UNUSED__, int type, void *event); + +static Eina_Bool targets_converter(char *target, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *ttype, int *typesize); +static Eina_Bool text_converter(char *target, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *ttype, int *typesize); +static Eina_Bool general_converter(char *target, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *ttype, int *typesize); +static Eina_Bool image_converter(char *target, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *ttype, int *typesize); +static Eina_Bool vcard_send(char *target, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *ttype, int *typesize); + +static int response_handler_targets(Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *); + +static int notify_handler_targets(Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify); +static int notify_handler_text(Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify); +static int notify_handler_image(Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify); +static int notify_handler_uri(Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify); +static int notify_handler_html(Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify); +static int vcard_receive(Cnp_Selection *sed, Ecore_X_Event_Selection_Notify *notify); + +static Eina_Bool pasteimage_append(char *file, Evas_Object *entry); + +static Cnp_Atom atoms[CNP_N_ATOMS] = { + [CNP_ATOM_TARGETS] = { + "TARGETS", + ELM_SEL_FORMAT_TARGETS, + targets_converter, + response_handler_targets, + notify_handler_targets, + 0 + }, + [CNP_ATOM_ATOM] = { + "ATOM", // for opera browser + ELM_SEL_FORMAT_TARGETS, + targets_converter, + response_handler_targets, + notify_handler_targets, + 0 + }, + [CNP_ATOM_XELM] = { + "application/x-elementary-markup", + ELM_SEL_FORMAT_MARKUP, + general_converter, + NULL, + NULL, + 0 + }, + [CNP_ATOM_text_uri] = { + "text/uri", + ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_IMAGE, /* Either images or entries */ + general_converter, + NULL, + notify_handler_uri, + 0 + }, + [CNP_ATOM_text_urilist] = { + "text/uri-list", + ELM_SEL_FORMAT_IMAGE, + general_converter, + NULL, + notify_handler_uri, + 0 + }, + [CNP_ATOM_text_x_vcard] = { + "text/x-vcard", + ELM_SEL_FORMAT_VCARD, + vcard_send, NULL, + vcard_receive, 0 + }, + [CNP_ATOM_image_png] = { + "image/png", + ELM_SEL_FORMAT_IMAGE, + image_converter, + NULL, + notify_handler_image, + 0 + }, + [CNP_ATOM_image_jpeg] = { + "image/jpeg", + ELM_SEL_FORMAT_IMAGE, + image_converter, + NULL, + notify_handler_image,/* Raw image data is the same */ + 0 + }, + [CNP_ATOM_image_bmp] = { + "image/x-ms-bmp", + ELM_SEL_FORMAT_IMAGE, + image_converter, + NULL, + notify_handler_image,/* Raw image data is the same */ + 0 + }, + [CNP_ATOM_image_gif] = { + "image/gif", + ELM_SEL_FORMAT_IMAGE, + image_converter, + NULL, + notify_handler_image,/* Raw image data is the same */ + 0 + }, + [CNP_ATOM_image_tiff] = { + "image/tiff", + ELM_SEL_FORMAT_IMAGE, + image_converter, + NULL, + notify_handler_image,/* Raw image data is the same */ + 0 + }, + [CNP_ATOM_image_svg] = { + "image/svg+xml", + ELM_SEL_FORMAT_IMAGE, + image_converter, + NULL, + notify_handler_image,/* Raw image data is the same */ + 0 + }, + [CNP_ATOM_image_xpm] = { + "image/x-xpixmap", + ELM_SEL_FORMAT_IMAGE, + image_converter, + NULL, + notify_handler_image,/* Raw image data is the same */ + 0 + }, + [CNP_ATOM_image_tga] = { + "image/x-tga", + ELM_SEL_FORMAT_IMAGE, + image_converter, + NULL, + notify_handler_image,/* Raw image data is the same */ + 0 + }, + [CNP_ATOM_image_ppm] = { + "image/x-portable-pixmap", + ELM_SEL_FORMAT_IMAGE, + image_converter, + NULL, + notify_handler_image,/* Raw image data is the same */ + 0 + }, + [CNP_ATOM_text_html_utf8] = { + "text/html;charset=utf-8", + ELM_SEL_FORMAT_HTML, + general_converter, + NULL, + notify_handler_html, + 0 + }, + [CNP_ATOM_text_html] = { + "text/html", + ELM_SEL_FORMAT_HTML, + general_converter, + NULL, + notify_handler_html, /* No encoding: Webkit only */ + 0 + }, + [CNP_ATOM_UTF8STRING] = { + "UTF8_STRING", + ELM_SEL_FORMAT_TEXT | ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_HTML, + text_converter, + NULL, + notify_handler_text, + 0 + }, + [CNP_ATOM_STRING] = { + "STRING", + ELM_SEL_FORMAT_TEXT | ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_HTML, + text_converter, + NULL, + notify_handler_text, + 0 + }, + [CNP_ATOM_TEXT] = { + "TEXT", + ELM_SEL_FORMAT_TEXT | ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_HTML, + text_converter, + NULL, + NULL, + 0 + }, + [CNP_ATOM_text_plain_utf8] = { + "text/plain;charset=utf-8", + ELM_SEL_FORMAT_TEXT | ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_HTML, + text_converter, + NULL, + NULL, + 0 + }, + [CNP_ATOM_text_plain] = { + "text/plain", + ELM_SEL_FORMAT_TEXT | ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_HTML, + text_converter, + NULL, + NULL, + 0 + }, +}; + +static Cnp_Selection selections[ELM_SEL_TYPE_CLIPBOARD + 1] = { + ARRAYINIT(ELM_SEL_TYPE_PRIMARY) { + .debug = "Primary", + .ecore_sel = ECORE_X_SELECTION_PRIMARY, + .set = ecore_x_selection_primary_set, + .clear = ecore_x_selection_primary_clear, + .request = ecore_x_selection_primary_request, + }, + ARRAYINIT(ELM_SEL_TYPE_SECONDARY) { + .debug = "Secondary", + .ecore_sel = ECORE_X_SELECTION_SECONDARY, + .set = ecore_x_selection_secondary_set, + .clear = ecore_x_selection_secondary_clear, + .request = ecore_x_selection_secondary_request, + }, + ARRAYINIT(ELM_SEL_TYPE_XDND) { + .debug = "XDnD", + .ecore_sel = ECORE_X_SELECTION_XDND, + .request = ecore_x_selection_xdnd_request, + }, + ARRAYINIT(ELM_SEL_TYPE_CLIPBOARD) { + .debug = "Clipboard", + .ecore_sel = ECORE_X_SELECTION_CLIPBOARD, + .set = ecore_x_selection_clipboard_set, + .clear = ecore_x_selection_clipboard_clear, + .request = ecore_x_selection_clipboard_request, + }, +}; + +/* Data for DND in progress */ +static Saved_Type savedtypes = { NULL, NULL, 0, 0, 0, EINA_FALSE }; + +static void (*dragdonecb) (void *data, Evas_Object *obj) = NULL; +static void *dragdonedata = NULL; + +static int _elm_cnp_init_count = 0; + +/** + * Drag & Drop functions + */ + +/* FIXME: Way too many globals */ +static Eina_List *drops = NULL; +static Evas_Object *dragwin = NULL; +static int _dragx = 0, _dragy = 0; +static Ecore_Event_Handler *handler_pos = NULL; +static Ecore_Event_Handler *handler_drop = NULL; +static Ecore_Event_Handler *handler_enter = NULL; +static Ecore_Event_Handler *handler_status = NULL; + +#endif + +/* Stringshared, so I can just compare pointers later */ +static const char *text_uri; + +Eina_Bool +elm_selection_selection_has_owner(void) +{ +#ifdef HAVE_ELEMENTARY_X + return !!ecore_x_selection_owner_get(ECORE_X_ATOM_SELECTION_CLIPBOARD); +#else + return EINA_FALSE; +#endif +} + +EAPI Eina_Bool +elm_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type selection, + Elm_Sel_Format format, const void *selbuf, size_t buflen) +{ +#ifdef HAVE_ELEMENTARY_X + Evas_Object *top = elm_widget_top_get(obj); + Ecore_X_Window xwin; + Cnp_Selection *sel; + + if (top) xwin = elm_win_xwindow_get(top); + else xwin = elm_win_xwindow_get(obj); + if ((!xwin) || (selection > ELM_SEL_TYPE_CLIPBOARD)) + return EINA_FALSE; + if (!_elm_cnp_init_count) _elm_cnp_init(); + if ((!selbuf) && (format != ELM_SEL_FORMAT_IMAGE)) + return elm_object_cnp_selection_clear(obj, selection); + + sel = selections + selection; + + sel->active = EINA_TRUE; + sel->widget = obj; + sel->set(xwin, &selection, sizeof(Elm_Sel_Type)); + sel->format = format; + + if (selbuf) + { + if (format == ELM_SEL_FORMAT_IMAGE) + { + // selbuf is actual image data, not text/string + sel->selbuf = malloc(buflen); + memcpy(sel->selbuf, selbuf, buflen); + } + else + sel->selbuf = strdup((char*)selbuf); + } + else + sel->selbuf = NULL; + + return EINA_TRUE; +#else + return EINA_FALSE; +#endif +} + +EAPI Eina_Bool +elm_object_cnp_selection_clear(Evas_Object *obj, Elm_Sel_Type selection) +{ +#ifdef HAVE_ELEMENTARY_X + Cnp_Selection *sel; + + if ((unsigned int)selection > (unsigned int)ELM_SEL_TYPE_CLIPBOARD) + return EINA_FALSE; + if (!_elm_cnp_init_count) _elm_cnp_init(); + + sel = selections + selection; + + /* No longer this selection: Consider it gone! */ + if ((!sel->active) || (sel->widget != obj)) return EINA_TRUE; + + sel->active = EINA_FALSE; + sel->widget = NULL; + if (sel->selbuf) + { + free(sel->selbuf); + sel->selbuf = NULL; + } + sel->clear(); + + return EINA_TRUE; +#else + return EINA_FALSE; +#endif +} + +EAPI Eina_Bool +elm_cnp_selection_get(Evas_Object *obj, Elm_Sel_Type selection, + Elm_Sel_Format format, Elm_Drop_Cb datacb, void *udata) +{ +#ifdef HAVE_ELEMENTARY_X + Evas_Object *top; + Cnp_Selection *sel; + + if (selection > ELM_SEL_TYPE_CLIPBOARD) + return EINA_FALSE; + if (!_elm_cnp_init_count) _elm_cnp_init(); + + sel = selections + selection; + top = elm_widget_top_get(obj); + if (!top) return EINA_FALSE; + + sel->requestformat = format; + sel->requestwidget = obj; + sel->request(elm_win_xwindow_get(top), ECORE_X_SELECTION_TARGET_TARGETS); + sel->datacb = datacb; + sel->udata = udata; + + return EINA_TRUE; +#else + return EINA_FALSE; +#endif +} + +#ifdef HAVE_ELEMENTARY_X + +static Eina_Bool +_elm_cnp_init(void) +{ + int i; + + if (_elm_cnp_init_count++) return EINA_TRUE; + for (i = 0; i < CNP_N_ATOMS; i++) + { + atoms[i].atom = ecore_x_atom_get(atoms[i].name); + ecore_x_selection_converter_atom_add(atoms[i].atom, + atoms[i].converter); + } + + ecore_event_handler_add(ECORE_X_EVENT_SELECTION_CLEAR, selection_clear, NULL); + ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY, selection_notify, NULL); + + text_uri = eina_stringshare_add("text/uri-list"); + return EINA_TRUE; +} + +static Eina_Bool +selection_clear(void *udata __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_X_Event_Selection_Clear *ev = event; + Cnp_Selection *sel; + int i; + + for (i = 0; i <= ELM_SEL_TYPE_CLIPBOARD; i++) + { + if (selections[i].ecore_sel == ev->selection) break; + } + cnp_debug("selection %d clear\n", i); + /* Not me... Don't care */ + if (i > ELM_SEL_TYPE_CLIPBOARD) return ECORE_CALLBACK_PASS_ON; + + sel = selections + i; + sel->active = EINA_FALSE; + sel->widget = NULL; + if (sel->selbuf) + { + free(sel->selbuf); + sel->selbuf = NULL; + } + + return ECORE_CALLBACK_PASS_ON; +} + + +/* + * Response to a selection notify: + * - So we have asked for the selection list. + * - If it's the targets list, parse it, and fire of what we want, + * else it's the data we want. + */ +static Eina_Bool +selection_notify(void *udata __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_X_Event_Selection_Notify *ev = event; + Cnp_Selection *sel; + int i; + + cnp_debug("selection notify callback: %d\n",ev->selection); + switch (ev->selection) + { + case ECORE_X_SELECTION_PRIMARY: + sel = selections + ELM_SEL_TYPE_PRIMARY; + break; + case ECORE_X_SELECTION_SECONDARY: + sel = selections + ELM_SEL_TYPE_SECONDARY; + break; + case ECORE_X_SELECTION_XDND: + sel = selections + ELM_SEL_TYPE_XDND; + break; + case ECORE_X_SELECTION_CLIPBOARD: + sel = selections + ELM_SEL_TYPE_CLIPBOARD; + break; + default: + return ECORE_CALLBACK_PASS_ON; + } + cnp_debug("Target is %s\n", ev->target); + + for (i = 0; i < CNP_N_ATOMS; i++) + { + if (!strcmp(ev->target, atoms[i].name)) + { + if (atoms[i].notify) + { + cnp_debug("Found something: %s\n", atoms[i].name); + atoms[i].notify(sel, ev); + } + else + { + cnp_debug("Ignored: No handler!\n"); + } + } + } + + return ECORE_CALLBACK_PASS_ON; +} + +static Elm_Sel_Format +_get_selection_type(void *data, int size) +{ + if (size == sizeof(Elm_Sel_Type)) + { + Cnp_Selection *sel = selections + *((int *)data); + if (sel->active && + (sel->format >= ELM_SEL_FORMAT_TARGETS) && + (sel->format <= ELM_SEL_FORMAT_HTML)) + return sel->format; + } + return ELM_SEL_FORMAT_NONE; +} + +static Eina_Bool +targets_converter(char *target __UNUSED__, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *ttype, int *typesize) +{ + int i,count; + Ecore_X_Atom *aret; + Cnp_Selection *sel; + Elm_Sel_Format seltype; + + if (!data_ret) return EINA_FALSE; + + if (_get_selection_type(data, size) == ELM_SEL_FORMAT_NONE) + { + /* TODO : fallback into precise type */ + seltype = ELM_SEL_FORMAT_TEXT; + } + else + { + sel = selections + *((int *)data); + seltype = sel->format; + } + + for (i = 0, count = 0; i < CNP_N_ATOMS ; i++) + { + if (seltype & atoms[i].formats) count++; + } + + aret = malloc(sizeof(Ecore_X_Atom) * count); + for (i = 0, count = 0; i < CNP_N_ATOMS; i++) + { + if (seltype & atoms[i].formats) aret[count ++] = atoms[i].atom; + } + + *data_ret = aret; + if (typesize) *typesize = 32 /* urk */; + if (ttype) *ttype = ECORE_X_ATOM_ATOM; + if (size_ret) *size_ret = count; + + return EINA_TRUE; +} + +static Eina_Bool +image_converter(char *target __UNUSED__, void *data __UNUSED__, int size __UNUSED__, void **data_ret __UNUSED__, int *size_ret __UNUSED__, Ecore_X_Atom *ttype __UNUSED__, int *typesize __UNUSED__) +{ + cnp_debug("Image converter called\n"); + return EINA_TRUE; +} + +static Eina_Bool +vcard_send(char *target __UNUSED__, void *data __UNUSED__, int size __UNUSED__, void **data_ret, int *size_ret, Ecore_X_Atom *ttype __UNUSED__, int *typesize __UNUSED__) +{ + Cnp_Selection *sel; + + cnp_debug("Vcard send called\n"); + + sel = selections + *((int *)data); + + if (data_ret) *data_ret = strdup(sel->selbuf); + if (size_ret) *size_ret = strlen(sel->selbuf); + + return EINA_TRUE; +} + +static Eina_Bool +is_uri_type_data(Cnp_Selection *sel __UNUSED__, Ecore_X_Event_Selection_Notify *notify) +{ + Ecore_X_Selection_Data *data; + char *p; + + data = notify->data; + cnp_debug("data->format is %d %p %p\n", data->format, notify, data); + if (data->content == ECORE_X_SELECTION_CONTENT_FILES) return EINA_TRUE; + p = (char *)data->data; + if (!p) return EINA_TRUE; + + cnp_debug("Got %s\n", p); + if (strncmp(p, "file://", 7)) + { + if (*p != '/') return EINA_FALSE; + } + + return EINA_TRUE; +} + +/* + * Callback to handle a targets response on a selection request: + * So pick the format we'd like; and then request it. + */ +static int +notify_handler_targets(Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify) +{ + Ecore_X_Selection_Data_Targets *targets; + Ecore_X_Atom *atomlist; + Evas_Object *top; + int i, j; + + targets = notify->data; + atomlist = (Ecore_X_Atom *)(targets->data.data); + + for (j = (CNP_ATOM_LISTING_ATOMS+1); j < CNP_N_ATOMS; j++) + { + cnp_debug("\t%s %d\n", atoms[j].name, atoms[j].atom); + if (!(atoms[j].formats & sel->requestformat)) continue; + for (i = 0; i < targets->data.length; i++) + { + if ((atoms[j].atom == atomlist[i]) && (atoms[j].notify)) + { + if ((j == CNP_ATOM_text_uri) || + (j == CNP_ATOM_text_urilist)) + { + if (!is_uri_type_data(sel, notify)) continue; + } + cnp_debug("Atom %s matches\n",atoms[j].name); + goto done; + } + } + } + + cnp_debug("Couldn't find anything that matches\n"); + return ECORE_CALLBACK_PASS_ON; + +done: + top = elm_widget_top_get(sel->requestwidget); + if (!top) top = sel->requestwidget; + cnp_debug("Sending request for %s\n", atoms[j].name); + sel->request(elm_win_xwindow_get(top), atoms[j].name); + + return ECORE_CALLBACK_PASS_ON; +} + +static int +response_handler_targets(Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify) +{ + Ecore_X_Selection_Data_Targets *targets; + Ecore_X_Atom *atomlist; + Evas_Object *top; + int i,j; + + targets = notify->data; + atomlist = (Ecore_X_Atom *)(targets->data.data); + + for (j = (CNP_ATOM_LISTING_ATOMS+1); j < CNP_N_ATOMS; j++) + { + if (!(atoms[j].formats & sel->requestformat)) continue; + for (i = 0 ; i < targets->data.length ; i ++) + { + if ((atoms[j].atom == atomlist[i]) && (atoms[j].response)) + { + /* Found a match: Use it */ + goto found; + } + } + } + cnp_debug("No matching type found\n"); + return 0; + +found: + top = elm_widget_top_get(sel->requestwidget); + if (!top) return 0; + + sel->request(elm_win_xwindow_get(top), atoms[j].name); + return 0; +} + + +static int +notify_handler_text(Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify) +{ + Ecore_X_Selection_Data *data; + char *str; + char *mkupstr; + + data = notify->data; + str = malloc(sizeof(char) * (data->length + 1)); + if (!str) return 0; + strncpy(str, (char *)data->data, data->length); + str[data->length] = '\0'; + + if (sel->datacb) + { + Elm_Selection_Data ddata; + + ddata.x = ddata.y = 0; + ddata.format = ELM_SEL_FORMAT_TEXT; + ddata.data = data->data; + ddata.len = data->length; + sel->datacb(sel->udata, sel->widget, &ddata); + free(str); + return 0; + } + + cnp_debug("Notify handler text %d %d %p\n", data->format, + data->length, data->data); + mkupstr = _elm_util_text_to_mkup((const char *)str); + cnp_debug("String is %s (from %s)\n", str, data->data); + _elm_entry_entry_paste(sel->requestwidget, mkupstr); + free(str); + free(mkupstr); + return 0; +} + + +/** + * So someone is pasting an image into my entry or widget... + */ +static int +notify_handler_uri(Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify) +{ + Ecore_X_Selection_Data *data; + Ecore_X_Selection_Data_Files *files; + char *p, *stripstr; + + data = notify->data; + cnp_debug("data->format is %d %p %p\n", data->format, notify, data); + if (data->content == ECORE_X_SELECTION_CONTENT_FILES) + { + cnp_debug("got a files list\n"); + files = notify->data; + if (files->num_files > 1) + { + /* Don't handle many items */ + cnp_debug("more then one file: Bailing\n"); + return 0; + } + stripstr = p = strdup(files->files[0]); + } + else + { + stripstr = p = malloc(data->length * sizeof(char) + 1); + memcpy(stripstr, data->data, data->length); + stripstr[data->length] = 0; + } + + if (!p) + { + cnp_debug("Couldn't find a file\n"); + return 0; + } + cnp_debug("Got %s\n",p); + if (strncmp(p, "file://", 7)) + { + /* Try and continue if it looks sane */ + if (*p != '/') + { + free(p); + return 0; + } + } + else + { + p += strlen("file://"); + } + + if (savedtypes.imgfile) free((void*)savedtypes.imgfile); + if (savedtypes.textreq) + { + savedtypes.textreq = 0; + savedtypes.imgfile = strdup(p); + } + else + { + pasteimage_append(p, sel->requestwidget); + } + free(stripstr); + return 0; +} + +/** + * Just receieved an vcard, either through cut and paste, or dnd. + */ +static int +vcard_receive(Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify) +{ + Dropable *dropable; + Eina_List *l; + Ecore_X_Selection_Data *data; + + data = notify->data; + cnp_debug("vcard receive\n"); + + if (sel == (selections + ELM_SEL_TYPE_XDND)) + { + Elm_Selection_Data ddata; + + cnp_debug("drag & drop\n"); + /* FIXME: this needs to be generic: Used for all receives */ + EINA_LIST_FOREACH(drops, l, dropable) + { + if (dropable->obj == sel->requestwidget) break; + } + if (!dropable) + { + cnp_debug("Unable to find drop object"); + ecore_x_dnd_send_finished(); + return 0; + } + dropable = eina_list_data_get(l); + ddata.x = savedtypes.x; + ddata.y = savedtypes.y; + ddata.format = ELM_SEL_FORMAT_VCARD; + ddata.data = data->data; + ddata.len = data->length; + dropable->dropcb(dropable->cbdata, dropable->obj, &ddata); + ecore_x_dnd_send_finished(); + } + else if (sel->datacb) + { + Elm_Selection_Data ddata; + ddata.x = ddata.y = 0; + ddata.format = ELM_SEL_FORMAT_IMAGE; + ddata.data = data->data; + ddata.len = data->length; + sel->datacb(sel->udata, sel->widget, &ddata); + } + else + { + cnp_debug("Paste request\n"); + } + + return 0; + +} + + +static int +notify_handler_image(Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify) +{ + Ecore_X_Selection_Data *data; + Tmp_Info *tmp; + + cnp_debug("got a image file!\n"); + data = notify->data; + + cnp_debug("Size if %d\n", data->length); + + if (sel->datacb) + { + Elm_Selection_Data ddata; + + ddata.x = ddata.y = 0; + ddata.format = ELM_SEL_FORMAT_IMAGE; + ddata.data = data->data; + ddata.len = data->length; + sel->datacb(sel->udata, sel->widget, &ddata); + return 0; + } + + /* generate tmp name */ + tmp = elm_cnp_tempfile_create(data->length); + memcpy(tmp->map, data->data, data->length); + munmap(tmp->map, data->length); + + /* FIXME: Add to paste image data to clean up */ + pasteimage_append(tmp->filename, sel->requestwidget); + + tmpinfo_free(tmp); + return 0; +} + + +/** + * Warning: Generic text/html can';t handle it sanely. + * Firefox sends ucs2 (i think). + * chrome sends utf8... blerg + */ +static int +notify_handler_html(Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify) +{ + Ecore_X_Selection_Data *data; + + cnp_debug("Got some HTML: Checking encoding is useful\n"); + data = notify->data; + + if (sel->datacb) + { + Elm_Selection_Data ddata; + ddata.x = ddata.y = 0; + ddata.format = ELM_SEL_FORMAT_HTML; + ddata.data = data->data; + ddata.len = data->length; + sel->datacb(sel->udata, sel->widget, &ddata); + return 0; + } + + char *stripstr = malloc(sizeof(char) * (data->length + 1)); + strncpy(stripstr, (char *)data->data, data->length); + stripstr[data->length] = '\0'; + cnp_debug("String is %s (%d bytes)\n", stripstr, data->length); + _elm_entry_entry_paste(sel->requestwidget, stripstr); + free(stripstr); + return 0; +} + + +static Eina_Bool +text_converter(char *target __UNUSED__, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *ttype __UNUSED__, int *typesize __UNUSED__) +{ + Cnp_Selection *sel; + + cnp_debug("text converter\n"); + if (_get_selection_type(data, size) == ELM_SEL_FORMAT_NONE) + { + if (data_ret) + { + *data_ret = malloc(size * sizeof(char) + 1); + memcpy(*data_ret, data, size); + ((char**)(data_ret))[0][size] = 0; + } + if (size_ret) *size_ret = size; + return EINA_TRUE; + } + sel = selections + *((int *)data); + if (!sel->active) return EINA_TRUE; + + if ((sel->format & ELM_SEL_FORMAT_MARKUP) || + (sel->format & ELM_SEL_FORMAT_HTML)) + { + *data_ret = _elm_util_mkup_to_text(sel->selbuf); + if (size_ret) *size_ret = strlen(*data_ret); + } + else if (sel->format & ELM_SEL_FORMAT_TEXT) + { + *data_ret = strdup(sel->selbuf); + *size_ret = strlen(sel->selbuf); + } + else if (sel->format & ELM_SEL_FORMAT_IMAGE) + { + cnp_debug("Image %s\n", evas_object_type_get(sel->widget)); + cnp_debug("Elm type: %s\n", elm_object_widget_type_get(sel->widget)); + evas_object_image_file_get(elm_photocam_internal_image_get(sel->widget), + (const char **)data_ret, NULL); + if (!*data_ret) *data_ret = strdup("No file"); + else *data_ret = strdup(*data_ret); + *size_ret = strlen(*data_ret); + } + return EINA_TRUE; +} + +static Eina_Bool +general_converter(char *target __UNUSED__, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *ttype __UNUSED__, int *typesize __UNUSED__) +{ + if (_get_selection_type(data, size) == ELM_SEL_FORMAT_NONE) + { + if (data_ret) + { + *data_ret = malloc(size * sizeof(char) + 1); + memcpy(*data_ret, data, size); + ((char**)(data_ret))[0][size] = 0; + } + if (size_ret) *size_ret = size; + } + else + { + Cnp_Selection *sel = selections + *((int *)data); + if (data_ret) *data_ret = strdup(sel->selbuf); + if (size_ret) *size_ret = strlen(sel->selbuf); + } + return EINA_TRUE; +} + +static Eina_Bool +pasteimage_append(char *file, Evas_Object *entry) +{ + char *entrytag; + int len; + static const char *tagstring = ""; + + if ((!file) || (!entry)) return EINA_FALSE; + + len = strlen(tagstring)+strlen(file); + + entrytag = alloca(len + 1); + snprintf(entrytag, len + 1, tagstring, file); + _elm_entry_entry_paste(entry, entrytag); + + return EINA_TRUE; +} + +static Eina_Bool +_dnd_enter(void *data __UNUSED__, int etype __UNUSED__, void *ev) +{ + Ecore_X_Event_Xdnd_Enter *enter = ev; + int i; + + /* Skip it */ + if ((!enter) || (!enter->num_types) || (!enter->types)) return EINA_TRUE; + + cnp_debug("Types\n"); + savedtypes.ntypes = enter->num_types; + if (savedtypes.types) free(savedtypes.types); + savedtypes.types = malloc(sizeof(char *) * enter->num_types); + if (!savedtypes.types) return EINA_FALSE; + + for (i = 0; i < enter->num_types; i++) + { + savedtypes.types[i] = eina_stringshare_add(enter->types[i]); + cnp_debug("Type is %s %p %p\n", enter->types[i], + savedtypes.types[i],text_uri); + if (savedtypes.types[i] == text_uri) + { + /* Request it, so we know what it is */ + cnp_debug("Sending uri request\n"); + savedtypes.textreq = 1; + if (savedtypes.imgfile) free((void*)savedtypes.imgfile); + savedtypes.imgfile = NULL; + ecore_x_selection_xdnd_request(enter->win, text_uri); + } + } + + /* FIXME: Find an object and make it current */ + return EINA_TRUE; +} + +static Eina_Bool +_dnd_drop(void *data __UNUSED__, int etype __UNUSED__, void *ev) +{ + struct _Ecore_X_Event_Xdnd_Drop *drop; + Dropable *dropable; + Eina_List *l; + Ecore_Evas *ee; + Ecore_X_Window xwin; + Elm_Selection_Data ddata; + int x, y, w, h; + int i, j; + + drop = ev; + + // check we still have something to drop + if (!drops) return EINA_TRUE; + + /* Find any widget in our window; then work out geometry rel to our window */ + for (l = drops; l; l = l->next) + { + dropable = l->data; + xwin = (Ecore_X_Window)ecore_evas_window_get + (ecore_evas_ecore_evas_get(evas_object_evas_get + (dropable->obj))); + if (xwin == drop->win) break; + } + /* didn't find a window */ + if (!l) return EINA_TRUE; + + /* Calculate real (widget relative) position */ + // - window position + // - widget position + ee = ecore_evas_ecore_evas_get(evas_object_evas_get(dropable->obj)); + ecore_evas_geometry_get(ee, &x, &y, NULL, NULL); + savedtypes.x = drop->position.x - x; + savedtypes.y = drop->position.y - y; + + cnp_debug("Drop position is %d,%d\n", savedtypes.x, savedtypes.y); + + for (; l; l = l->next) + { + dropable = l->data; + evas_object_geometry_get(dropable->obj, &x, &y, &w, &h); + if ((savedtypes.x >= x) && (savedtypes.y >= y) && + (savedtypes.x < x + w) && (savedtypes.y < y + h)) + break; /* found! */ + } + + if (!l) return EINA_TRUE; /* didn't find one */ + + evas_object_geometry_get(dropable->obj, &x, &y, NULL, NULL); + savedtypes.x -= x; + savedtypes.y -= y; + + /* Find our type from the previous list */ + for (i = 0; i < CNP_N_ATOMS; i++) + { + for (j = 0; j < savedtypes.ntypes; j++) + { + if (!strcmp(savedtypes.types[j], atoms[i].name)) goto found; + } + } + + cnp_debug("Didn't find a target\n"); + return EINA_TRUE; + +found: + cnp_debug("Found a target we'd like: %s\n", atoms[i].name); + cnp_debug("0x%x\n",xwin); + + if (i == CNP_ATOM_text_urilist) + { + cnp_debug("We found a URI... (%scached) %s\n", + savedtypes.imgfile ? "" : "not ", + savedtypes.imgfile); + if (savedtypes.imgfile) + { + char *entrytag; + static const char *tagstring = ""; + ddata.x = savedtypes.x; + ddata.y = savedtypes.y; + + /* If it's markup that also supports images */ + if ((dropable->types & ELM_SEL_FORMAT_MARKUP) && + (dropable->types & ELM_SEL_FORMAT_IMAGE)) + { + int len; + ddata.format = ELM_SEL_FORMAT_MARKUP; + + len = strlen(tagstring) + strlen(savedtypes.imgfile); + entrytag = alloca(len + 1); + snprintf(entrytag, len + 1, tagstring, savedtypes.imgfile); + ddata.data = entrytag; + cnp_debug("Insert %s\n", (char *)ddata.data); + dropable->dropcb(dropable->cbdata, dropable->obj, &ddata); + ecore_x_dnd_send_finished(); + if (savedtypes.imgfile) free((void*)savedtypes.imgfile); + savedtypes.imgfile = NULL; + + return EINA_TRUE; + } + else if (dropable->types & ELM_SEL_FORMAT_IMAGE) + { + cnp_debug("Doing image insert (%s)\n", savedtypes.imgfile); + ddata.format = ELM_SEL_FORMAT_IMAGE; + ddata.data = (char *)savedtypes.imgfile; + dropable->dropcb(dropable->cbdata, dropable->obj, &ddata); + ecore_x_dnd_send_finished(); + if (savedtypes.imgfile) free((void*)savedtypes.imgfile); + savedtypes.imgfile = NULL; + + return EINA_TRUE; + } + else + { + cnp_debug("Item doesn't support images... passing\n"); + return EINA_TRUE; + } + } + else if (savedtypes.textreq) + { + /* Already asked: Pretend we asked now, and paste immediately when + * it comes in */ + savedtypes.textreq = 0; + ecore_x_dnd_send_finished(); + return EINA_TRUE; + } + } + + cnp_debug("doing a request then\n"); + selections[ELM_SEL_TYPE_XDND].requestwidget = dropable->obj; + selections[ELM_SEL_TYPE_XDND].requestformat = ELM_SEL_FORMAT_MARKUP; + selections[ELM_SEL_TYPE_XDND].active = EINA_TRUE; + + ecore_x_selection_xdnd_request(xwin, atoms[i].name); + + return EINA_TRUE; +} +static Eina_Bool +_dnd_position(void *data __UNUSED__, int etype __UNUSED__, void *ev) +{ + struct _Ecore_X_Event_Xdnd_Position *pos; + Ecore_X_Rectangle rect; + + pos = ev; + + /* Need to send a status back */ + /* FIXME: Should check I can drop here */ + /* FIXME: Should highlight widget */ + rect.x = pos->position.x - 5; + rect.y = pos->position.y - 5; + rect.width = 10; + rect.height = 10; + ecore_x_dnd_send_status(EINA_TRUE, EINA_FALSE, rect, pos->action); + + return EINA_TRUE; +} + +/** + * When dragging this is callback response from the destination. + * The important thing we care about: Can we drop; thus update cursor + * appropriately. + */ +static Eina_Bool +_dnd_status(void *data __UNUSED__, int etype __UNUSED__, void *ev) +{ + struct _Ecore_X_Event_Xdnd_Status *status = ev; + + if (!status) return EINA_TRUE; + + /* Only thing we care about: will accept */ + if (status->will_accept) + { + cnp_debug("Will accept\n"); + } + else + { /* Won't accept */ + cnp_debug("Won't accept accept\n"); + } + return EINA_TRUE; +} + +/** + * Add a widget as drop target. + */ +Eina_Bool +elm_drop_target_add(Evas_Object *obj, Elm_Sel_Type format, Elm_Drop_Cb dropcb, void *cbdata) +{ + Dropable *drop; + Ecore_X_Window xwin; + Eina_List *item; + int first; + Evas_Object *top; + + if (!obj) return EINA_FALSE; + top = elm_widget_top_get(obj); + if (!top || !elm_win_xwindow_get(top)) return EINA_FALSE; + if (!_elm_cnp_init_count) _elm_cnp_init(); + + /* Is this the first? */ + first = (!drops) ? 1 : 0; + + EINA_LIST_FOREACH(drops, item, drop) + { + if (drop->obj == obj) + { + /* Update: Not a new one */ + drop->dropcb = dropcb; + drop->cbdata = cbdata; + drop->types = format; + return EINA_TRUE; + } + } + + /* Create new drop */ + drop = calloc(1, sizeof(Dropable)); + if (!drop) return EINA_FALSE; + /* FIXME: Check for eina's deranged error method */ + drops = eina_list_append(drops, drop); + + if (!drops/* || or other error */) + { + free(drop); + return EINA_FALSE; + } + drop->dropcb = dropcb; + drop->cbdata = cbdata; + drop->types = format; + drop->obj = obj; + + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, + /* I love C and varargs */ + (Evas_Object_Event_Cb)elm_drop_target_del, + obj); + /* FIXME: Handle resizes */ + + /* If not the first: We're done */ + if (!first) return EINA_TRUE; + + xwin = (Ecore_X_Window)ecore_evas_window_get + (ecore_evas_ecore_evas_get(evas_object_evas_get(obj))); + + ecore_x_dnd_aware_set(xwin, EINA_TRUE); + + cnp_debug("Adding drop target calls\n"); + handler_enter = ecore_event_handler_add(ECORE_X_EVENT_XDND_ENTER, + _dnd_enter, NULL); + handler_pos = ecore_event_handler_add(ECORE_X_EVENT_XDND_POSITION, + _dnd_position, NULL); + handler_drop = ecore_event_handler_add(ECORE_X_EVENT_XDND_DROP, + _dnd_drop, NULL); + + return EINA_TRUE; +} + +Eina_Bool +elm_drop_target_del(Evas_Object *obj) +{ + Dropable *drop,*del; + Eina_List *item; + Ecore_X_Window xwin; + + del = NULL; + EINA_LIST_FOREACH(drops, item, drop) + { + if (drop->obj == obj) + { + drops = eina_list_remove_list(drops, item); + del = drop; + break; + } + } + if (!del) return EINA_FALSE; + + evas_object_event_callback_del(obj, EVAS_CALLBACK_FREE, + (Evas_Object_Event_Cb)elm_drop_target_del); + free(drop); + /* If still drops there: All fine.. continue */ + if (drops) return EINA_TRUE; + + cnp_debug("Disabling DND\n"); + xwin = (Ecore_X_Window)ecore_evas_window_get + (ecore_evas_ecore_evas_get(evas_object_evas_get(obj))); + ecore_x_dnd_aware_set(xwin, EINA_FALSE); + + ecore_event_handler_del(handler_pos); + ecore_event_handler_del(handler_drop); + ecore_event_handler_del(handler_enter); + + if (savedtypes.imgfile) free((void*)savedtypes.imgfile); + savedtypes.imgfile = NULL; + + return EINA_TRUE; +} + + +static void +_drag_mouse_up(void *un __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *data) +{ + Ecore_X_Window xwin = *((Ecore_X_Window *)data); + evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_UP, _drag_mouse_up); + ecore_x_dnd_drop(); + ecore_x_dnd_aware_set(xwin, EINA_FALSE); + if (dragdonecb) + { + dragdonecb(dragdonedata, selections[ELM_SEL_TYPE_XDND].widget); + dragdonecb = NULL; + } + if (dragwin) + { + evas_object_del(dragwin); + dragwin = NULL; + } +} + +static void +_drag_move(void *data __UNUSED__, Ecore_X_Xdnd_Position *pos) +{ + evas_object_move(dragwin, + pos->position.x - _dragx, + pos->position.y - _dragy); +} + + +Eina_Bool +elm_drag_start(Evas_Object *obj, Elm_Sel_Format format, const char *data, void (*dragdone) (void *data, Evas_Object *), void *donecbdata) +{ + Ecore_X_Window xwin; + Cnp_Selection *sel; + Elm_Sel_Type xdnd = ELM_SEL_TYPE_XDND; + Ecore_Evas *ee; + int x, y, x2, y2, x3, y3; + Evas_Object *icon; + int w, h; + + if (!_elm_cnp_init_count) _elm_cnp_init(); + + xwin = elm_win_xwindow_get(obj); + + cnp_debug("starting drag...\n"); + + if (dragwin) + { + cnp_debug("another obj is dragging...\n"); + return EINA_FALSE; + } + + ecore_x_dnd_type_set(xwin, "text/uri-list", EINA_TRUE); + sel = selections + ELM_SEL_TYPE_XDND; + sel->active = EINA_TRUE; + sel->widget = obj; + sel->format = format; + sel->selbuf = data ? strdup(data) : NULL; + dragdonecb = dragdone; + dragdonedata = donecbdata; + + ecore_x_dnd_aware_set(xwin, EINA_TRUE); + ecore_x_dnd_callback_pos_update_set(_drag_move, NULL); + ecore_x_dnd_begin(xwin, (unsigned char *)&xdnd, sizeof(Elm_Sel_Type)); + evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_UP, + _drag_mouse_up, (void *)(long)xwin); + + handler_status = ecore_event_handler_add(ECORE_X_EVENT_XDND_STATUS, + _dnd_status, NULL); + + dragwin = elm_win_add(NULL, "Elm Drag Object", ELM_WIN_UTILITY); + elm_win_override_set(dragwin, EINA_TRUE); + + /* FIXME: Images only */ + icon = elm_icon_add(dragwin); + elm_icon_file_set(icon, data + 7, NULL); /* 7!? "file://" */ + elm_win_resize_object_add(dragwin, icon); + evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, EVAS_HINT_FILL); + + /* Position subwindow appropriately */ + ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); + ecore_evas_geometry_get(ee, &x, &y, NULL, NULL); + evas_object_geometry_get(obj, &x2, &y2, &w, &h); + x += x2; + y += y2; + evas_object_move(dragwin, x, y); + evas_object_resize(icon, w, h); + evas_object_resize(dragwin, w, h); + + evas_object_show(icon); + evas_object_show(dragwin); + + evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x3, &y3); + _dragx = x3 - x2; + _dragy = y3 - y2; + + return EINA_TRUE; +} + +static Tmp_Info * +elm_cnp_tempfile_create(int size) +{ +#ifdef HAVE_MMAN_H + Tmp_Info *info; + const char *tmppath; + int len; + + info = malloc(sizeof(Tmp_Info)); + if (!info) return NULL; + + tmppath = getenv("TMP"); + if (!tmppath) tmppath = P_tmpdir; + len = snprintf(NULL, 0, "%s/%sXXXXXX", tmppath, "elmcnpitem-"); + if (len < 0) + { + free(info); + return NULL; + } + len++; + info->filename = malloc(len); + if (!info->filename) + { + free(info); + return NULL; + } + snprintf(info->filename,len,"%s/%sXXXXXX", tmppath, "elmcnpitem-"); + + info->fd = mkstemp(info->filename); + +# ifdef __linux__ + { + char *tmp; + /* And before someone says anything see POSIX 1003.1-2008 page 400 */ + long pid; + + pid = (long)getpid(); + /* Use pid instead of /proc/self: That way if can be passed around */ + len = snprintf(NULL,0,"/proc/%li/fd/%i", pid, info->fd); + len++; + tmp = malloc(len); + if (tmp) + { + snprintf(tmp,len, "/proc/%li/fd/%i", pid, info->fd); + unlink(info->filename); + free(info->filename); + info->filename = tmp; + } + } +# endif + + cnp_debug("filename is %s\n", info->filename); + if (size < 1) + { + /* Set map to NULL and return */ + info->map = NULL; + info->len = 0; + return info; + } + + /* Map it in */ + if (ftruncate(info->fd, size)) + { + perror("ftruncate"); + info->map = NULL; + info->len = 0; + return info; + } + + eina_mmap_safety_enabled_set(EINA_TRUE); + + info->map = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, info->fd, 0); + if (info->map == MAP_FAILED) + { + perror("mmap"); + info->map = NULL; + info->len = 0; + } + + return info; +#else + (void) size; + return NULL; +#endif +} + + +static int +tmpinfo_free(Tmp_Info *info) +{ + if (!info) return 0; + free(info->filename); + free(info); + return 0; +} + +#else +/* Stubs for windows */ +Eina_Bool +elm_drag_start(Evas_Object *o, Elm_Sel_Format f, const char *d, void (*donecb)(void *, Evas_Object *),void *cbdata) +{ + return EINA_FALSE; +} + +Eina_Bool +elm_drop_target_add(Evas_Object *obj, Elm_Sel_Type format, Elm_Drop_Cb dropcb, void *cbdata) +{ + return EINA_FALSE; +} + +Eina_Bool +elm_drop_target_del(Evas_Object *o) +{ + return EINA_TRUE; +} +#endif + +/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-3f0^-2{2(0W1st0 :*/ diff --git a/libraries/elementary/src/lib/elm_cnp.h b/libraries/elementary/src/lib/elm_cnp.h new file mode 100644 index 0000000..2b45c91 --- /dev/null +++ b/libraries/elementary/src/lib/elm_cnp.h @@ -0,0 +1,163 @@ +/** + * @defgroup CopyPaste CopyPaste + * @ingroup Elementary + * + * Implements the following functionality + * a. select, copy/cut and paste + * b. clipboard + * c. drag and drop + * in order to share data across application windows. + * + * Contains functions to select text or a portion of data, + * send it to a buffer, and paste the data into a target. + * + * elm_cnp provides a generic copy and paste facility based on its windowing system. + * It is not necessary to know the details of each windowing system, + * but some terms and behavior are common. + * Currently the X11 window system is widely used, and only X11 functionality is implemented. + * + * In X11R6 window system, CopyPaste works like a peer-to-peer communication. + * Copying is an operation on an object in an X server. + * X11 calls those objects 'selections' which have names. + * Generally, two selection types are needed for copy and paste: + * The Primary selection and the Clipboard selection. + * Primary selection is for selecting text (that means highlighted text). + * Clipboard selection is for explicit copying behavior + * (such as ctrl+c, or 'copy' in a menu). + * Thus, in applications most cases only use the clipboard selection. + * As stated before, taking ownership of a selection doesn't move any actual data. + * Copying and Pasting is described as follows: + * 1. Copy text in Program A : Program A takes ownership of the selection + * 2. Paste text in Program B : Program B notes that Program A owns the selection + * 3. Program B asks A for the text + * 4. Program A responds and sends the text to program B + * 5. Program B pastes the response + * More information is on + * - http://www.jwz.org/doc/x-cut-and-paste.html + * - X11R6 Inter-Client Communication Conventions Manual, section 2 + * + * TODO: add for other window system. + * + * @{ + */ + +/** + * Defines the types of selection property names. + * @see http://www.x.org/docs/X11/xlib.pdf + * for more details. + */ +typedef enum +{ + ELM_SEL_TYPE_PRIMARY, /**< Primary text selection (highlighted or selected text) */ + ELM_SEL_TYPE_SECONDARY, /**< Used when primary selection is in use */ + ELM_SEL_TYPE_XDND, /**< Drag 'n' Drop */ + ELM_SEL_TYPE_CLIPBOARD, /**< Clipboard selection (ctrl+C) */ +} Elm_Sel_Type; + +/** + * Defines the types of content. + */ +typedef enum +{ + /** For matching every possible atom */ + ELM_SEL_FORMAT_TARGETS = -1, + /** Content is from outside of Elementary */ + ELM_SEL_FORMAT_NONE = 0x0, + /** Plain unformatted text: Used for things that don't want rich markup */ + ELM_SEL_FORMAT_TEXT = 0x01, + /** Edje textblock markup, including inline images */ + ELM_SEL_FORMAT_MARKUP = 0x02, + /** Images */ + ELM_SEL_FORMAT_IMAGE = 0x04, + /** Vcards */ + ELM_SEL_FORMAT_VCARD = 0x08, + /** Raw HTML-like data (eg. webkit) */ + ELM_SEL_FORMAT_HTML = 0x10, +} Elm_Sel_Format; + +/** + * Structure holding the info about selected data. + */ +struct _Elm_Selection_Data +{ + Evas_Coord x, y; + Elm_Sel_Format format; + void *data; + size_t len; +}; +typedef struct _Elm_Selection_Data Elm_Selection_Data; + +/** + * Callback invoked in when the selected data is 'dropped' at its destination. + * + * @param data Application specific data + * @param obj The evas object where selected data is 'dropped'. + * @param ev struct holding information about selected data + * FIXME: this should probably be a smart callback + */ +typedef Eina_Bool (*Elm_Drop_Cb)(void *data, Evas_Object *obj, Elm_Selection_Data *ev); + + +/** + * @brief Set copy data for a widget. + * + * Set copy data and take ownership of selection. Format is used for specifying the selection type, + * and this is used during pasting. + * + * @param selection Selection type for copying and pasting + * @param obj The source widget pointer + * @param format Selection format + * @param buf The data selected + * @param buflen The size of @p buf + * @return If EINA_TRUE, setting data was successful. + * + * @ingroup CopyPaste + * + */ +EAPI Eina_Bool elm_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type selection, + Elm_Sel_Format format, + const void *buf, size_t buflen); + +/** + * @brief Retrieve data from a widget that has a selection. + * + * Gets the current selection data from a widget. + * The widget input here will usually be elm_entry, + * in which case @p datacb and @p udata can be NULL. + * If a different widget is passed, @p datacb and @p udata are used for retrieving data. + * + * @see also elm_cnp_selection_set() + * + * @param selection Selection type for copying and pasting + * @param format Selection format + * @param obj The source widget + * @param datacb The user data callback if the target widget isn't elm_entry + * @param udata The user data pointer for @p datacb + * @return If EINA_TRUE, getting selection data was successful. + * + * @ingroup CopyPaste + */ +EAPI Eina_Bool elm_cnp_selection_get(Evas_Object *obj, Elm_Sel_Type selection, + Elm_Sel_Format format, + Elm_Drop_Cb datacb, void *udata); + +/** + * @brief Clear the selection data of a widget. + * + * Clear all data from the selection which is owned by a widget. + * + * @see also elm_cnp_selection_set() + * + * @param obj The source widget + * @param selection Selection type for copying and pasting + * @return If EINA_TRUE, clearing data was successful. + * + * @ingroup CopyPaste + * + */ +EAPI Eina_Bool elm_object_cnp_selection_clear(Evas_Object *obj, + Elm_Sel_Type selection); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_colorselector.c b/libraries/elementary/src/lib/elm_colorselector.c new file mode 100644 index 0000000..f650855 --- /dev/null +++ b/libraries/elementary/src/lib/elm_colorselector.c @@ -0,0 +1,1279 @@ +#include +#include "elm_priv.h" + +#define BASE_STEP 360.0 +#define HUE_STEP 360.0 +#define SAT_STEP 128.0 +#define LIG_STEP 256.0 +#define ALP_STEP 256.0 +#define DEFAULT_HOR_PAD 10 +#define DEFAULT_VER_PAD 10 + +typedef enum _Color_Type +{ + HUE, + SATURATION, + LIGHTNESS, + ALPHA +} Color_Type; + +typedef struct _Colorselector_Data Colorselector_Data; +struct _Colorselector_Data +{ + Evas_Object *parent; + Evas_Object *colorbar; + Evas_Object *bar; + Evas_Object *lbt; + Evas_Object *rbt; + Evas_Object *bg_rect; + Evas_Object *arrow; + Evas_Object *touch_area; + Color_Type color_type; +}; + +typedef struct _Widget_Data Widget_Data; +typedef struct _Elm_Color_Item Elm_Color_Item; +struct _Widget_Data +{ + Evas_Object *sel; + Evas_Object *base; + Evas_Object *box; + Eina_List *items; + Colorselector_Data *cp[4]; + Ecore_Timer *longpress_timer; + const char *palette_name; + Evas_Coord _x, _y, _w, _h; + int r, g, b, a; + int er, eg, eb; + int sr, sg, sb; + int lr, lg, lb; + double h, s, l; + Elm_Colorselector_Mode mode; + Eina_Bool longpressed : 1; + Eina_Bool config_load: 1; +}; + +struct _Elm_Color_Item +{ + ELM_WIDGET_ITEM; + Evas_Object *color_obj; + Elm_Color_RGBA *color; +}; + +static const char *widtype = NULL; + +static void _del_hook(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _resize_cb(void *data, Evas *a, Evas_Object *obj, void *event_info); +static void _rgb_to_hsl(void *data); +static void _hsl_to_rgb(void *data); +static void _color_with_saturation(void *data); +static void _color_with_lightness(void *data); +static void _draw_rects(void *data, double x); +static void _arrow_cb(void *data, Evas_Object *obj, const char *emission, + const char *source); +static void _colorbar_cb(void *data, Evas *e, Evas_Object *obj, + void *event_info); +static void _left_button_clicked_cb(void *data, Evas_Object * obj, + void *event_info); +static void _left_button_repeat_cb(void *data, Evas_Object * obj, + void *event_info); +static void _right_button_clicked_cb(void *data, Evas_Object * obj, + void *event_info); +static void _right_button_repeat_cb(void *data, Evas_Object * obj, + void *event_info); +static void _add_colorbar(Evas_Object *obj); +static void _set_color(Evas_Object *obj, int r, int g, int b, int a); +static Elm_Color_Item *_item_new(Evas_Object *obj); +static void _item_sizing_eval(Elm_Color_Item *item); +static void _item_highlight(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _item_unhighlight(void *data, Evas *e, Evas_Object *obj, void *event_info); +static Eina_Bool _long_press(void *data); +static void _remove_items(Widget_Data *wd); +static void _colors_remove(Evas_Object *obj); +static void _colors_save(Evas_Object *obj); +static void _colors_load_apply(Evas_Object *obj); + +static const char SIG_CHANGED[] = "changed"; +static const char SIG_COLOR_ITEM_SELECTED[] = "color,item,selected"; +static const char SIG_COLOR_ITEM_LONGPRESSED[] = "color,item,longpressed"; + +static const Evas_Smart_Cb_Description _signals[] = +{ + {SIG_COLOR_ITEM_SELECTED, ""}, + {SIG_COLOR_ITEM_LONGPRESSED, ""}, + {SIG_CHANGED, ""}, + {NULL, NULL} +}; + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + int i = 0; + + if (!wd) return; + if (wd->longpress_timer) ecore_timer_del(wd->longpress_timer); + if (wd->palette_name) eina_stringshare_del(wd->palette_name); + _remove_items(wd); + for (i = 0; i < 4; i++) free(wd->cp[i]); + free(wd); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Eina_List *elist; + Elm_Color_Item *item; + int i; + const char *hpadstr, *vpadstr; + unsigned int h_pad = DEFAULT_HOR_PAD; + unsigned int v_pad = DEFAULT_VER_PAD; + + if ((!wd) || (!wd->sel)) return; + + _elm_theme_object_set(obj, wd->base, "colorselector", "palette", + elm_widget_style_get(obj)); + _elm_theme_object_set(obj, wd->sel, "colorselector", "bg", + elm_widget_style_get(obj)); + hpadstr = edje_object_data_get(wd->base, "horizontal_pad"); + if (hpadstr) h_pad = atoi(hpadstr); + vpadstr = edje_object_data_get(wd->base, "vertical_pad"); + if (vpadstr) v_pad = atoi(vpadstr); + elm_box_padding_set(wd->box, (Evas_Coord)(h_pad * elm_widget_scale_get(obj) * _elm_config->scale), + (Evas_Coord)(v_pad * elm_widget_scale_get(obj) *_elm_config->scale)); + EINA_LIST_FOREACH(wd->items, elist, item) + { + elm_layout_theme_set(VIEW(item), "colorselector", "item", elm_widget_style_get(obj)); + _elm_theme_object_set(obj, item->color_obj, "colorselector", "item/color", elm_widget_style_get(obj)); + } + for (i = 0; i < 4; i++) + { + evas_object_del(wd->cp[i]->colorbar); + wd->cp[i]->colorbar = NULL; + evas_object_del(wd->cp[i]->bar); + wd->cp[i]->bar = NULL; + evas_object_del(wd->cp[i]->lbt); + wd->cp[i]->lbt = NULL; + evas_object_del(wd->cp[i]->rbt); + wd->cp[i]->rbt = NULL; + if (i != 0) + { + evas_object_del(wd->cp[i]->bg_rect); + wd->cp[i]->bg_rect = NULL; + } + evas_object_del(wd->cp[i]->arrow); + wd->cp[i]->arrow = NULL; + evas_object_del(wd->cp[i]->touch_area); + wd->cp[i]->touch_area = NULL; + } + + _add_colorbar(obj); + elm_colorselector_color_set(obj, wd->r, wd->g, wd->b, wd->a); + _sizing_eval(obj); +} + +static void +_colorselector_set_size_hints(Evas_Object *obj, int timesw, int timesh) +{ + Evas_Coord minw = -1, minh = -1; + + elm_coords_finger_size_adjust(timesw, &minw, timesh, &minh); + edje_object_size_min_restricted_calc(obj, &minw, &minh, + minw, minh); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, -1, -1); +} + +static void +_item_sizing_eval(Elm_Color_Item *item) +{ + Evas_Coord minw = -1, minh = -1; + + if (!item) return; + + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + edje_object_size_min_restricted_calc(VIEW(item), &minw, &minh, minw, + minh); + evas_object_size_hint_min_set(VIEW(item), minw, minh); +} + +static void _resize_cb(void *data, Evas *a __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _sizing_eval(data); +} + +static void +_sizing_eval_palette(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Eina_List *elist; + Elm_Color_Item *item; + Evas_Coord bw = 0, bh = 0; + Evas_Coord w = 0, h = 0; + if (!wd) return; + + EINA_LIST_FOREACH(wd->items, elist, item) + { + _item_sizing_eval(item); + } + evas_object_size_hint_min_get(wd->box, &bw, &bh); + evas_object_size_hint_min_set(obj, bw, bh); + evas_object_size_hint_max_set(obj, -1, -1); + evas_object_geometry_get(obj, NULL, NULL, &w, &h); + if (w < bw) w = bw; + if (h < bh) h = bh; + evas_object_resize(obj, w, h); +} + +static void +_sizing_eval_selector(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1; + Evas_Coord w = 0, h = 0; + int i; + + if (!wd) return; + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + for (i = 0; i < 4; i++) + { + if (wd->cp[i]->bg_rect) + _colorselector_set_size_hints(wd->cp[i]->bg_rect, 1, 1); + _colorselector_set_size_hints(wd->cp[i]->bar, 1, 1); + _colorselector_set_size_hints(wd->cp[i]->rbt, 1, 1); + _colorselector_set_size_hints(wd->cp[i]->lbt, 1, 1); + + _colorselector_set_size_hints(wd->cp[i]->colorbar, 4, 1); + } + + elm_coords_finger_size_adjust(4, &minw, 4, &minh); + edje_object_size_min_restricted_calc(wd->sel, &minw, &minh, minw, minh); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, -1, -1); + evas_object_geometry_get(obj, NULL, NULL, &w, &h); + if (w < minw) w = minw; + if (h < minh) h = minh; + evas_object_resize(obj, w, h); +} + +static void +_sizing_eval_palette_selector(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1; + Evas_Coord bw = 0, bh = 0; + Evas_Coord w = 0, h = 0; + int i; + if (!wd) return; + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + for (i = 0; i < 4; i++) + { + if (wd->cp[i]->bg_rect) + _colorselector_set_size_hints(wd->cp[i]->bg_rect, 1, 1); + _colorselector_set_size_hints(wd->cp[i]->bar, 1, 1); + _colorselector_set_size_hints(wd->cp[i]->rbt, 1, 1); + _colorselector_set_size_hints(wd->cp[i]->lbt, 1, 1); + + _colorselector_set_size_hints(wd->cp[i]->colorbar, 4, 1); + } + + elm_coords_finger_size_adjust(4, &minw, 4, &minh); + edje_object_size_min_restricted_calc(wd->sel, &minw, &minh, minw, minh); + evas_object_size_hint_min_get(wd->box, &bw, &bh); + evas_object_size_hint_min_set(obj, minw, minh+bh); + evas_object_size_hint_max_set(obj, -1, -1); + evas_object_geometry_get(obj, NULL, NULL, &w, &h); + if (w < minw) w = minw; + if (h < (minh+bh)) h = (minh+bh); + evas_object_resize(obj, w, h); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + switch (wd->mode) + { + case ELM_COLORSELECTOR_PALETTE: + _sizing_eval_palette(obj); + break; + case ELM_COLORSELECTOR_COMPONENTS: + _sizing_eval_selector(obj); + break; + case ELM_COLORSELECTOR_BOTH: + _sizing_eval_palette_selector(obj); + break; + default: + break; + } +} + +static Eina_Bool +_long_press(void *data) +{ + Elm_Color_Item *item = (Elm_Color_Item *) data; + Widget_Data *wd = elm_widget_data_get(WIDGET(item)); + if (!wd) return ECORE_CALLBACK_CANCEL; + wd->longpress_timer = NULL; + wd->longpressed = EINA_TRUE; + evas_object_smart_callback_call(WIDGET(item), SIG_COLOR_ITEM_LONGPRESSED, item); + return ECORE_CALLBACK_CANCEL; +} + +static void +_item_highlight(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Color_Item *item = (Elm_Color_Item *) data; + Evas_Event_Mouse_Down *ev = event_info; + if (!item) return; + Widget_Data *wd = elm_widget_data_get(WIDGET(item)); + if (!wd) return; + if (ev->button != 1) return; + elm_object_signal_emit(VIEW(item), "elm,state,selected", "elm"); + wd->longpressed = EINA_FALSE; + if (wd->longpress_timer) ecore_timer_del(wd->longpress_timer); + wd->longpress_timer = ecore_timer_add(_elm_config->longpress_timeout, _long_press, data); +} + +static void +_item_unhighlight(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Color_Item *item = (Elm_Color_Item *) data; + Evas_Event_Mouse_Down *ev = event_info; + if (!item) return; + Widget_Data *wd = elm_widget_data_get(WIDGET(item)); + if (!wd) return; + if (ev->button != 1) return; + if (wd->longpress_timer) + { + ecore_timer_del(wd->longpress_timer); + wd->longpress_timer = NULL; + } + elm_object_signal_emit(VIEW(item), "elm,state,unselected", "elm"); + if (!wd->longpressed) + { + evas_object_smart_callback_call(WIDGET(item), SIG_COLOR_ITEM_SELECTED, item); + elm_colorselector_color_set(WIDGET(item), item->color->r, item->color->g, item->color->b, item->color->a); + } +} + +static void +_remove_items(Widget_Data *wd) +{ + Elm_Color_Item *item; + + if (!wd->items) return; + + EINA_LIST_FREE(wd->items, item) + { + free(item->color); + elm_widget_item_free(item); + } + + wd->items = NULL; +} + +static Elm_Color_Item* +_item_new(Evas_Object *obj) +{ + Elm_Color_Item *item; + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + item = elm_widget_item_new(obj, Elm_Color_Item); + if (!item) return NULL; + + VIEW(item) = elm_layout_add(obj); + elm_layout_theme_set(VIEW(item), "colorselector", "item", elm_widget_style_get(obj)); + evas_object_size_hint_weight_set(VIEW(item), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(VIEW(item), EVAS_HINT_FILL, EVAS_HINT_FILL); + item->color_obj = edje_object_add(evas_object_evas_get(obj)); + _elm_theme_object_set(obj, item->color_obj, "colorselector", "item/color", elm_widget_style_get(obj)); + evas_object_size_hint_weight_set(item->color_obj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(item->color_obj, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_event_callback_add(item->color_obj, EVAS_CALLBACK_MOUSE_DOWN, _item_highlight, item); + evas_object_event_callback_add(item->color_obj, EVAS_CALLBACK_MOUSE_UP, _item_unhighlight, item); + elm_object_part_content_set(VIEW(item), "color_obj", item->color_obj); + _item_sizing_eval(item); + evas_object_show(VIEW(item)); + + return item; +} + +static void +_colors_remove(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + _remove_items(wd); + _elm_config_colors_free(wd->palette_name); +} + +static void _colors_save(Evas_Object *obj) +{ + Eina_List *elist; + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Color_Item *item; + _elm_config_colors_free(wd->palette_name); + EINA_LIST_FOREACH(wd->items, elist, item) + { + _elm_config_color_set(wd->palette_name, item->color->r, item->color->g, + item->color->b, item->color->a); + } +} + +static void +_colors_load_apply(Evas_Object *obj) +{ + Elm_Color_RGBA *color; + Eina_List *elist; + Eina_List *color_list; + Elm_Color_Item *item; + Widget_Data *wd = elm_widget_data_get(obj); + color_list = _elm_config_color_list_get(wd->palette_name); + if (!color_list) return; + EINA_LIST_FOREACH(color_list, elist, color) + { + item = _item_new(obj); + if (!item) return; + item->color = ELM_NEW(Elm_Color_RGBA); + if (!item->color) return; + item->color->r = color->r; + item->color->g = color->g; + item->color->b = color->b; + item->color->a = color->a; + elm_box_pack_end(wd->box, VIEW(item)); + evas_object_color_set(item->color_obj, item->color->r, item->color->g, + item->color->b, item->color->a); + wd->items = eina_list_append(wd->items, item); + _sizing_eval_palette(obj); + } + wd->config_load = EINA_TRUE; +} + +static void +_rgb_to_hsl(void *data) +{ + Widget_Data *wd = data; + double r, g, b; + double v, m, vm; + double r2, g2, b2; + + r = wd->r; + g = wd->g; + b = wd->b; + + r /= 255.0; + g /= 255.0; + b /= 255.0; + + v = (r > g) ? r : g; + v = (v > b) ? v : b; + + m = (r < g) ? r : g; + m = (m < b) ? m : b; + + wd->h = 0.0; + wd->s = 0.0; + wd->l = 0.0; + + wd->l = (m + v) / 2.0; + + if (wd->l <= 0.0) return; + + vm = v - m; + wd->s = vm; + + if (wd->s > 0.0) wd->s /= (wd->l <= 0.5) ? (v + m) : (2.0 - v - m); + else return; + + r2 = (v - r) / vm; + g2 = (v - g) / vm; + b2 = (v - b) / vm; + + if (r == v) wd->h = (g == m ? 5.0 + b2 : 1.0 - g2); + else if (g == v) wd->h = (b == m ? 1.0 + r2 : 3.0 - b2); + else wd->h = (r == m ? 3.0 + g2 : 5.0 - r2); + + wd->h *= 60.0; +} + +static void +_hsl_to_rgb(void *data) +{ + Widget_Data *wd = data; + double r = 0, g = 0, b = 0; + double _h, _s, _l; + int i = 0; + double sv, vsf, f, p, q, t, v; + + _h = wd->h; + _s = wd->s; + _l = wd->l; + + if (_s == 0.0) r = g = b = _l; + else + { + if (_h == 360.0) _h = 0.0; + _h /= 60.0; + + v = (_l <= 0.5) ? (_l * (1.0 + _s)) : (_l + _s - (_l * _s)); + p = _l + _l - v; + + if (v) sv = (v - p) / v; + else sv = 0; + + i = (int)_h; + f = _h - i; + + vsf = v * sv * f; + + t = p + vsf; + q = v - vsf; + + switch (i) + { + case 0: + r = v; + g = t; + b = p; + break; + case 1: + r = q; + g = v; + b = p; + break; + case 2: + r = p; + g = v; + b = t; + break; + case 3: + r = p; + g = q; + b = v; + break; + case 4: + r = t; + g = p; + b = v; + break; + case 5: + r = v; + g = p; + b = q; + break; + } + } + i = (int)(r * 255.0); + f = (r * 255.0) - i; + wd->r = (f <= 0.5) ? i : (i + 1); + + i = (int)(g * 255.0); + f = (g * 255.0) - i; + wd->g = (f <= 0.5) ? i : (i + 1); + + i = (int)(b * 255.0); + f = (b * 255.0) - i; + wd->b = (f <= 0.5) ? i : (i + 1); +} + +static void +_color_with_saturation(void *data) +{ + Widget_Data *wd = data; + + if (wd->er > 127) + wd->sr = 127 + (int)((double)(wd->er - 127) * wd->s); + else + wd->sr = 127 - (int)((double)(127 - wd->er) * wd->s); + + if (wd->eg > 127) + wd->sg = 127 + (int)((double)(wd->eg - 127) * wd->s); + else + wd->sg = 127 - (int)((double)(127 - wd->eg) * wd->s); + + if (wd->eb > 127) + wd->sb = 127 + (int)((double)(wd->eb - 127) * wd->s); + else + wd->sb = 127 - (int)((double)(127 - wd->eb) * wd->s); +} + +static void +_color_with_lightness(void *data) +{ + Widget_Data *wd = data; + + if (wd->l > 0.5) + { + wd->lr = wd->er + (int)((double)(255 - wd->er) * (wd->l - 0.5) * 2.0); + wd->lg = wd->eg + (int)((double)(255 - wd->eg) * (wd->l - 0.5) * 2.0); + wd->lb = wd->eb + (int)((double)(255 - wd->eb) * (wd->l - 0.5) * 2.0); + } + else if (wd->l < 0.5) + { + wd->lr = (double)wd->er * wd->l * 2.0; + wd->lg = (double)wd->eg * wd->l * 2.0; + wd->lb = (double)wd->eb * wd->l * 2.0; + } + else + { + wd->lr = wd->er; + wd->lg = wd->eg; + wd->lb = wd->eb; + } +} + +static void +_draw_rects(void *data, double x) +{ + Colorselector_Data *cp = data; + Widget_Data *wd = elm_widget_data_get(cp->parent); + double one_six = 1.0 / 6.0; + + switch (cp->color_type) + { + case HUE: + wd->h = 360.0 * x; + + if (x < one_six) + { + wd->er = 255; + wd->eg = (255.0 * x * 6.0); + wd->eb = 0; + } + else if (x < 2 * one_six) + { + wd->er = 255 - (int)(255.0 * (x - one_six) * 6.0); + wd->eg = 255; + wd->eb = 0; + } + else if (x < 3 * one_six) + { + wd->er = 0; + wd->eg = 255; + wd->eb = (int)(255.0 * (x - (2.0 * one_six)) * 6.0); + } + else if (x < 4 * one_six) + { + wd->er = 0; + wd->eg = 255 - (int)(255.0 * (x - (3.0 * one_six)) * 6.0); + wd->eb = 255; + } + else if (x < 5 * one_six) + { + wd->er = 255.0 * (x - (4.0 * one_six)) * 6.0; + wd->eg = 0; + wd->eb = 255; + } + else + { + wd->er = 255; + wd->eg = 0; + wd->eb = 255 - (int)(255.0 * (x - (5.0 * one_six)) * 6.0); + } + + evas_object_color_set(wd->cp[0]->arrow, wd->er, wd->eg, wd->eb, 255); + evas_object_color_set(wd->cp[1]->bg_rect, wd->er, wd->eg, wd->eb, 255); + evas_object_color_set(wd->cp[2]->bg_rect, wd->er, wd->eg, wd->eb, 255); + evas_object_color_set(wd->cp[3]->bar, wd->er, wd->eg, wd->eb, 255); + + _color_with_saturation(wd); + evas_object_color_set(wd->cp[1]->arrow, wd->sr, wd->sg, wd->sb, 255); + + _color_with_lightness(wd); + evas_object_color_set(wd->cp[2]->arrow, wd->lr, wd->lg, wd->lb, 255); + + evas_object_color_set(wd->cp[3]->arrow, + (wd->er * wd->a) / 255, + (wd->eg * wd->a) / 255, + (wd->eb * wd->a) / 255, + wd->a); + break; + case SATURATION: + wd->s = 1.0 - x; + _color_with_saturation(wd); + evas_object_color_set(wd->cp[1]->arrow, wd->sr, wd->sg, wd->sb, 255); + break; + case LIGHTNESS: + wd->l = x; + _color_with_lightness(wd); + evas_object_color_set(wd->cp[2]->arrow, wd->lr, wd->lg, wd->lb, 255); + break; + case ALPHA: + wd->a = 255.0 * x; + evas_object_color_set(wd->cp[3]->arrow, + (wd->er * wd->a) / 255, + (wd->eg * wd->a) / 255, + (wd->eb * wd->a) / 255, + wd->a); + break; + default: + break; + } + _hsl_to_rgb(wd); +} + +static void +_arrow_cb(void *data, Evas_Object *obj, const char *emission __UNUSED__, + const char *source __UNUSED__) +{ + Colorselector_Data *cp = data; + double x, y; + + edje_object_part_drag_value_get(obj, "elm.arrow", &x, &y); + _draw_rects(data, x); + evas_object_smart_callback_call(cp->parent, SIG_CHANGED, NULL); +} + +static void +_colorbar_cb(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) +{ + Colorselector_Data *cp = data; + Evas_Event_Mouse_Down *ev = event_info; + Evas_Coord x, y, w, h; + double arrow_x = 0, arrow_y; + + evas_object_geometry_get(cp->bar, &x, &y, &w, &h); + edje_object_part_drag_value_get(cp->colorbar, "elm.arrow", + &arrow_x, &arrow_y); + if (w > 0) arrow_x = (double)(ev->canvas.x - x) / (double)w; + if (arrow_x > 1) arrow_x = 1; + if (arrow_x < 0) arrow_x = 0; + edje_object_part_drag_value_set(cp->colorbar, "elm.arrow", arrow_x, arrow_y); + _draw_rects(data, arrow_x); + evas_object_smart_callback_call(cp->parent, SIG_CHANGED, NULL); + evas_event_feed_mouse_cancel(e, 0, NULL); + evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, 0, NULL); +} + +static void +_left_button_clicked_cb(void *data, Evas_Object * obj __UNUSED__, + void *event_info __UNUSED__) +{ + Colorselector_Data *cp = data; + double x, y; + + edje_object_signal_emit(cp->lbt, "elm,state,left,button,down", + "left_button"); + edje_object_part_drag_value_get(cp->colorbar, "elm.arrow", &x, &y); + + switch(cp->color_type) + { + case HUE : + x -= 1.0 / HUE_STEP; + break; + case SATURATION : + x -= 1.0 / SAT_STEP; + break; + case LIGHTNESS : + x -= 1.0 / LIG_STEP; + break; + case ALPHA : + x -= 1.0 / ALP_STEP; + break; + default : + break; + } + + if (x < 0.0) x = 0.0; + + edje_object_part_drag_value_set(cp->colorbar, "elm.arrow", x, y); + _draw_rects(data, x); + evas_object_smart_callback_call(cp->parent, SIG_CHANGED, NULL); +} + +static void +_left_button_repeat_cb(void *data, Evas_Object * obj __UNUSED__, + void *event_info __UNUSED__) +{ + Colorselector_Data *cp = data; + double x, y; + + edje_object_part_drag_value_get(cp->colorbar, "elm.arrow", &x, &y); + x -= 1.0 / BASE_STEP; + if (x < 0.0) x = 0.0; + edje_object_part_drag_value_set(cp->colorbar, "elm.arrow", x, y); + _draw_rects(data, x); + evas_object_smart_callback_call(cp->parent, SIG_CHANGED, NULL); + +} + +static void +_right_button_clicked_cb(void *data, Evas_Object * obj __UNUSED__, + void *event_info __UNUSED__) +{ + Colorselector_Data *cp = data; + double x, y; + + edje_object_signal_emit(cp->rbt, "elm,state,right,button,down", + "right_button"); + edje_object_part_drag_value_get(cp->colorbar, "elm.arrow", &x, &y); + + switch(cp->color_type) + { + case HUE : + x += 1.0 / HUE_STEP; + break; + case SATURATION : + x += 1.0 / SAT_STEP; + break; + case LIGHTNESS : + x += 1.0 / LIG_STEP; + break; + case ALPHA : + x += 1.0 / ALP_STEP; + break; + default : + break; + } + + if (x > 1.0) x = 1.0; + + edje_object_part_drag_value_set(cp->colorbar, "elm.arrow", x, y); + _draw_rects(data, x); + evas_object_smart_callback_call(cp->parent, SIG_CHANGED, NULL); +} + +static void +_right_button_repeat_cb(void *data, Evas_Object * obj __UNUSED__, + void *event_info __UNUSED__) +{ + Colorselector_Data *cp = data; + double x, y; + + edje_object_part_drag_value_get(cp->colorbar, "elm.arrow", &x, &y); + x += 1.0 / BASE_STEP; + if (x > 1.0) x = 1.0; + edje_object_part_drag_value_set(cp->colorbar, "elm.arrow", x, y); + _draw_rects(data, x); + evas_object_smart_callback_call(cp->parent, SIG_CHANGED, NULL); +} + +static void +_add_colorbar(Evas_Object *obj) +{ + char colorbar_name[128]; + char colorbar_s[128]; + Widget_Data *wd; + Evas *e; + int i = 0; + char buf[1024]; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + e = evas_object_evas_get(obj); + + for (i = 0; i < 4; i++) + { + wd->cp[i] = ELM_NEW(Colorselector_Data); + wd->cp[i]->parent = obj; + switch(i) + { + case 0 : + wd->cp[i]->color_type = HUE; + break; + case 1 : + wd->cp[i]->color_type = SATURATION; + break; + case 2 : + wd->cp[i]->color_type = LIGHTNESS; + break; + case 3 : + wd->cp[i]->color_type = ALPHA; + break; + default : + break; + } + /* load colorbar area */ + wd->cp[i]->colorbar = edje_object_add(e); + _elm_theme_object_set(obj, wd->cp[i]->colorbar, "colorselector", "base", + elm_widget_style_get(obj)); + snprintf(colorbar_name, sizeof(colorbar_name), "colorbar_%d", i); + snprintf(colorbar_s, sizeof(colorbar_s), "elm.colorbar_%d", i); + edje_object_signal_callback_add(wd->cp[i]->colorbar, "drag", "*", + _arrow_cb, wd->cp[i]); + edje_object_part_swallow(wd->sel, colorbar_s, wd->cp[i]->colorbar); + elm_widget_sub_object_add(obj, wd->cp[i]->colorbar); + + /* load colorbar image */ + wd->cp[i]->bar = edje_object_add(e); + snprintf(buf, sizeof(buf), "%s/%s", colorbar_name, + elm_widget_style_get(obj)); + _elm_theme_object_set(obj, wd->cp[i]->bar, "colorselector", "image", + buf); + edje_object_part_swallow(wd->cp[i]->colorbar, "elm.bar", + wd->cp[i]->bar); + elm_widget_sub_object_add(obj, wd->cp[i]->bar); + + /* provide expanded touch area */ + wd->cp[i]->touch_area = evas_object_rectangle_add(e); + evas_object_color_set(wd->cp[i]->touch_area, 0, 0, 0, 0); + edje_object_part_swallow(wd->cp[i]->colorbar, "elm.arrow_bg", + wd->cp[i]->touch_area); + evas_object_event_callback_add(wd->cp[i]->touch_area, + EVAS_CALLBACK_MOUSE_DOWN, _colorbar_cb, + wd->cp[i]); + elm_widget_sub_object_add(obj, wd->cp[i]->touch_area); + + /* load background rectangle of the colorbar. used for + changing color of the opacity bar */ + if ((i == 1) || (i == 2)) + { + wd->cp[i]->bg_rect = evas_object_rectangle_add(e); + evas_object_color_set(wd->cp[i]->bg_rect, wd->er, wd->eg, wd->eb, + 255); + edje_object_part_swallow(wd->cp[i]->colorbar, "elm.bar_bg", + wd->cp[i]->bg_rect); + + elm_widget_sub_object_add(obj, wd->cp[i]->bg_rect); + } + if (i == 3) + { + wd->cp[i]->bg_rect = edje_object_add(e); + snprintf(buf, sizeof(buf), "%s/%s", colorbar_name, + elm_widget_style_get(obj)); + _elm_theme_object_set(obj, wd->cp[i]->bg_rect, "colorselector", + "bg_image", buf); + edje_object_part_swallow(wd->cp[i]->colorbar, "elm.bar_bg", + wd->cp[i]->bg_rect); + elm_widget_sub_object_add(obj, wd->cp[i]->bg_rect); + evas_object_color_set(wd->cp[i]->bar, wd->er, wd->eg, wd->eb, 255); + } + /* load arrow image, pointing the colorbar */ + wd->cp[i]->arrow = edje_object_add(e); + _elm_theme_object_set(obj, wd->cp[i]->arrow, "colorselector", "arrow", + elm_widget_style_get(obj)); + edje_object_part_swallow(wd->cp[i]->colorbar, "elm.arrow_icon", + wd->cp[i]->arrow); + elm_widget_sub_object_add(obj, wd->cp[i]->arrow); + if (i == 2) + evas_object_color_set(wd->cp[i]->arrow, 0, 0, 0, 255); + else + evas_object_color_set(wd->cp[i]->arrow, wd->er, wd->eg, wd->eb, 255); + + /* load left button */ + wd->cp[i]->lbt = elm_button_add(obj); + snprintf(buf, sizeof(buf), "colorselector/left/%s", + elm_widget_style_get(obj)); + elm_object_style_set(wd->cp[i]->lbt, buf); + elm_widget_sub_object_add(obj, wd->cp[i]->lbt); + edje_object_part_swallow(wd->cp[i]->colorbar, "elm.l_button", + wd->cp[i]->lbt); + evas_object_smart_callback_add(wd->cp[i]->lbt, "clicked", + _left_button_clicked_cb, wd->cp[i]); + elm_button_autorepeat_set(wd->cp[i]->lbt, EINA_TRUE); + elm_button_autorepeat_initial_timeout_set(wd->cp[i]->lbt, + _elm_config->longpress_timeout); + elm_button_autorepeat_gap_timeout_set(wd->cp[i]->lbt, + (1.0 / _elm_config->fps)); + evas_object_smart_callback_add(wd->cp[i]->lbt, "repeated", + _left_button_repeat_cb, wd->cp[i]); + + /* load right button */ + wd->cp[i]->rbt = elm_button_add(obj); + snprintf(buf, sizeof(buf), "colorselector/right/%s", + elm_widget_style_get(obj)); + elm_object_style_set(wd->cp[i]->rbt, buf); + elm_widget_sub_object_add(obj, wd->cp[i]->rbt); + edje_object_part_swallow(wd->cp[i]->colorbar, "elm.r_button", + wd->cp[i]->rbt); + evas_object_smart_callback_add(wd->cp[i]->rbt, "clicked", + _right_button_clicked_cb, wd->cp[i]); + elm_button_autorepeat_set(wd->cp[i]->rbt, EINA_TRUE); + elm_button_autorepeat_initial_timeout_set(wd->cp[i]->rbt, + _elm_config->longpress_timeout); + elm_button_autorepeat_gap_timeout_set(wd->cp[i]->rbt, + (1.0 / _elm_config->fps)); + evas_object_smart_callback_add(wd->cp[i]->rbt, "repeated", + _right_button_repeat_cb, wd->cp[i]); + } +} + +static void +_set_color(Evas_Object *obj, int r, int g, int b, int a) +{ + Widget_Data *wd = elm_widget_data_get(obj); + double x, y; + + wd->r = r; + wd->g = g; + wd->b = b; + wd->a = a; + + _rgb_to_hsl(wd); + + edje_object_part_drag_value_get(wd->cp[0]->colorbar, "elm.arrow", &x, &y); + x = wd->h / 360.0; + edje_object_part_drag_value_set(wd->cp[0]->colorbar, "elm.arrow", x, y); + _draw_rects(wd->cp[0], x); + + edje_object_part_drag_value_get(wd->cp[1]->colorbar, "elm.arrow", &x, &y); + x = 1.0 - wd->s; + edje_object_part_drag_value_set(wd->cp[1]->colorbar, "elm.arrow", x, y); + _draw_rects(wd->cp[1], x); + + edje_object_part_drag_value_get(wd->cp[2]->colorbar, "elm.arrow", &x, &y); + x = wd->l; + edje_object_part_drag_value_set(wd->cp[2]->colorbar, "elm.arrow", x, y); + _draw_rects(wd->cp[2], x); + + edje_object_part_drag_value_get(wd->cp[3]->colorbar, "elm.arrow", &x, &y); + x = wd->a / 255.0; + edje_object_part_drag_value_set(wd->cp[3]->colorbar, "elm.arrow", x, y); + _draw_rects(wd->cp[3], x); +} + +EAPI Evas_Object * +elm_colorselector_add(Evas_Object *parent) +{ + Evas_Object *obj = NULL; + Widget_Data *wd = NULL; + Evas *e; + const char *hpadstr, *vpadstr; + unsigned int h_pad = DEFAULT_HOR_PAD; + unsigned int v_pad = DEFAULT_VER_PAD; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "colorselector"); + elm_widget_type_set(obj, "colorselector"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + /* load background edj */ + wd->base = edje_object_add(e); + _elm_theme_object_set(obj, wd->base, "colorselector", "palette", "default"); + elm_widget_resize_object_set(obj, wd->base); + evas_object_event_callback_add(wd->base, EVAS_CALLBACK_RESIZE, + _resize_cb, obj); + + wd->box = elm_box_add(obj); + elm_box_layout_set(wd->box, evas_object_box_layout_flow_horizontal, + NULL, NULL); + elm_box_horizontal_set(wd->box, EINA_TRUE); + evas_object_size_hint_weight_set(wd->box, EVAS_HINT_EXPAND, + 0); + evas_object_size_hint_align_set(wd->box, EVAS_HINT_FILL, 0); + elm_box_homogeneous_set(wd->box, EINA_TRUE); + hpadstr = edje_object_data_get(wd->base, "horizontal_pad"); + if (hpadstr) h_pad = atoi(hpadstr); + vpadstr = edje_object_data_get(wd->base, "vertical_pad"); + if (vpadstr) v_pad = atoi(vpadstr); + elm_box_padding_set(wd->box, (Evas_Coord)(h_pad * elm_widget_scale_get(obj) * _elm_config->scale), + (Evas_Coord)(v_pad * elm_widget_scale_get(obj) *_elm_config->scale)); + elm_box_align_set(wd->box, 0.5, 0.5); + elm_widget_sub_object_add(obj, wd->box); + evas_object_show(wd->box); + edje_object_part_swallow(wd->base, "palette", wd->box); + wd->palette_name = eina_stringshare_add("default"); + _colors_load_apply(obj); + + /* load background edj */ + wd->sel = edje_object_add(e); + _elm_theme_object_set(obj, wd->sel, "colorselector", "bg", "default"); + edje_object_part_swallow(wd->base, "selector", wd->sel); + elm_widget_sub_object_add(obj, wd->sel); + + wd->mode = ELM_COLORSELECTOR_BOTH; + wd->er = 255; + wd->eg = 0; + wd->eb = 0; + wd->h = 0.0; + wd->s = 1.0; + wd->l = 0.0; + wd->a = 255; + + _hsl_to_rgb(wd); + _add_colorbar(obj); + _sizing_eval(obj); + + return obj; +} + +EAPI void +elm_colorselector_color_set(Evas_Object *obj, int r, int g, int b, int a) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + _set_color(obj, r, g, b, a); +} + +EAPI void +elm_colorselector_color_get(const Evas_Object *obj, int *r, int *g, int *b, int *a) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (r) *r = wd->r; + if (g) *g = wd->g; + if (b) *b = wd->b; + if (a) *a = wd->a; +} + +EAPI void +elm_colorselector_mode_set(Evas_Object *obj, Elm_Colorselector_Mode mode) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->mode == mode) return; + wd->mode = mode; + switch (wd->mode) + { + case ELM_COLORSELECTOR_PALETTE: + if (edje_object_part_swallow_get(wd->base, "selector")) + { + edje_object_part_unswallow(wd->base, wd->sel); + evas_object_hide(wd->sel); + } + if (!edje_object_part_swallow_get(wd->base, "palette")) + { + edje_object_part_swallow(wd->base, "palette", wd->box); + evas_object_show(wd->box); + } + edje_object_signal_emit(wd->base, "elm,state,palette", "elm"); + break; + case ELM_COLORSELECTOR_COMPONENTS: + if (edje_object_part_swallow_get(wd->base, "palette")) + { + edje_object_part_unswallow(wd->base, wd->box); + evas_object_hide(wd->box); + } + if (!edje_object_part_swallow_get(wd->base, "selector")) + { + edje_object_part_swallow(wd->base, "selector", wd->sel); + evas_object_show(wd->sel); + } + edje_object_signal_emit(wd->base, "elm,state,components", "elm"); + break; + case ELM_COLORSELECTOR_BOTH: + if (!edje_object_part_swallow_get(wd->base, "palette")) + { + edje_object_part_swallow(wd->base, "palette", wd->box); + evas_object_show(wd->box); + } + if (!edje_object_part_swallow_get(wd->base, "selector")) + { + edje_object_part_swallow(wd->base, "selector", wd->sel); + evas_object_show(wd->sel); + } + edje_object_signal_emit(wd->base, "elm,state,both", "elm"); + break; + default: + return; + } + edje_object_message_signal_process(wd->base); + + _sizing_eval(obj); +} + +EAPI Elm_Colorselector_Mode +elm_colorselector_mode_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_COLORSELECTOR_BOTH; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return ELM_COLORSELECTOR_BOTH; + return wd->mode; +} + +EAPI void +elm_colorselector_palette_item_color_get(const Elm_Object_Item *it, int *r __UNUSED__, int *g __UNUSED__, int *b __UNUSED__, int*a __UNUSED__) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Color_Item *item; + item = (Elm_Color_Item *) it; + if (item) + { + if (r) *r = item->color->r; + if (g) *g = item->color->g; + if (b) *b = item->color->b; + if (a) *a = item->color->a; + } +} + +EAPI void +elm_colorselector_palette_item_color_set(Elm_Object_Item *it, int r __UNUSED__, int g __UNUSED__, int b __UNUSED__, int a __UNUSED__) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Color_Item *item; + item = (Elm_Color_Item *) it; + item->color->r = r; + item->color->g = g; + item->color->b = b; + item->color->a = a; + evas_object_color_set(item->color_obj, item->color->r, item->color->g, item->color->b, item->color->a); + _colors_save(WIDGET(it)); +} + +EAPI Elm_Object_Item * +elm_colorselector_palette_color_add(Evas_Object *obj, int r, int g, int b, int a) +{ + Elm_Color_Item *item; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (wd->config_load) + { + _colors_remove(obj); + wd->config_load = EINA_FALSE; + } + item = _item_new(obj); + if (!item) return NULL; + item->color = ELM_NEW(Elm_Color_RGBA); + if (!item->color) return NULL; + item->color->r = r; + item->color->g = g; + item->color->b = b; + item->color->a = a; + _elm_config_color_set(wd->palette_name, item->color->r, item->color->g, + item->color->b, item->color->a); + elm_box_pack_end(wd->box, VIEW(item)); + evas_object_color_set(item->color_obj, item->color->r, item->color->g, + item->color->b, item->color->a); + wd->items = eina_list_append(wd->items, item); + _sizing_eval(obj); + return (Elm_Object_Item *) item; +} + +EAPI void +elm_colorselector_palette_clear(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _colors_remove(obj); +} + +EAPI void +elm_colorselector_palette_name_set(Evas_Object *obj, const char *palette_name) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (!strcmp(wd->palette_name, palette_name)) return; + if (palette_name) + { + _colors_remove(obj); + eina_stringshare_replace(&wd->palette_name, palette_name); + _colors_load_apply(obj); + } +} + +EAPI const char* +elm_colorselector_palette_name_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->palette_name; +} diff --git a/libraries/elementary/src/lib/elm_colorselector.h b/libraries/elementary/src/lib/elm_colorselector.h new file mode 100644 index 0000000..76c6c97 --- /dev/null +++ b/libraries/elementary/src/lib/elm_colorselector.h @@ -0,0 +1,192 @@ +/** + * @defgroup Colorselector Colorselector + * @ingroup Elementary + * + * @image html img/widget/colorselector/preview-00.png + * @image latex img/widget/colorselector/preview-00.eps + * + * A ColorSelector is a color selection widget. It allows application to set a + * series of colors.It also allows to load/save colors from/to config with a + * unique identifier, by default, the colors are loaded/saved from/to config + * using "default" identifier. + * The colors can be picked by user from the color set by clicking on individual color + * item on the palette or by selecting it from selector. + * + * Signals that you can add callbacks for are: + * - "changed" - When the color value changes on selector(event_info is NULL). + * - "color,item,selected" - When user clicks on color item. The event_info parameter + * of the callback will be the selected color item. + * - "color,item,longpressed" - When user long presses on color item. The event info + * parameter of the callback contains selected color item. + * + * See @ref tutorial_colorselector. + * @{ + */ + +typedef struct _Elm_Color_RGBA +{ + unsigned int r; + unsigned int g; + unsigned int b; + unsigned int a; +} Elm_Color_RGBA; + +typedef struct _Elm_Custom_Palette +{ + const char *palette_name; + Eina_List *color_list; +} Elm_Custom_Palette; + +/** + * @enum _Elm_Colorselector_Mode + * @typedef Elm_Colorselector_Mode + * + * Different modes supported by Colorselector + * + * @see elm_colorselector_mode_set() + * @see elm_colorselector_mode_get() + */ +typedef enum +{ + ELM_COLORSELECTOR_PALETTE = 0, /**< only color palette is displayed */ + ELM_COLORSELECTOR_COMPONENTS, /**< only color selector is displayed */ + ELM_COLORSELECTOR_BOTH /**< Both Palette and selector is displayed, default */ +} Elm_Colorselector_Mode; + +/** + * @brief Add a new colorselector to the parent + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * @ingroup Colorselector + */ +EAPI Evas_Object *elm_colorselector_add(Evas_Object *parent); + +/** + * Set color to colorselector + * + * @param obj Colorselector object + * @param r r-value of color + * @param g g-value of color + * @param b b-value of color + * @param a a-value of color + * + * @ingroup Colorselector + */ +EAPI void elm_colorselector_color_set(Evas_Object *obj, int r, int g, int b, int a); + +/** + * Get current color from colorselector + * + * @param obj Colorselector object + * @param r integer pointer for r-value of color + * @param g integer pointer for g-value of color + * @param b integer pointer for b-value of color + * @param a integer pointer for a-value of color + * + * @ingroup Colorselector + */ +EAPI void elm_colorselector_color_get(const Evas_Object *obj, int *r, int *g, int *b, int *a); + +/** + * Set Colorselector's mode. + * + * @param obj Colorselector object + * @param mode Elm_Colorselector_Mode + * + * Colorselector supports three modes palette only, selector only and both. + * + * @ingroup Colorselector + */ +EAPI void elm_colorselector_mode_set(Evas_Object *obj, Elm_Colorselector_Mode mode); + +/** + * Get Colorselector's mode. + * + * @param obj Colorselector object + * @return mode The current mode of colorselector + * + * @ingroup Colorselector + */ +EAPI Elm_Colorselector_Mode elm_colorselector_mode_get(const Evas_Object *obj); + +/** + * Get Palette item's color. + * + * @param it The color palette item. + * @param r integer pointer for r-value of color + * @param g integer pointer for g-value of color + * @param b integer pointer for b-value of color + * @param a integer pointer for a-value of color + * + * @ingroup Colorselector + */ +EAPI void elm_colorselector_palette_item_color_get(const Elm_Object_Item *it, int *r, int *g, int *b, int *a); + +/** + * Set palette item's color. + * + * @param it The color palette item. + * @param r r-value of color + * @param g g-value of color + * @param b b-value of color + * @param a a-value of color + * + * @ingroup Colorselector + */ +EAPI void elm_colorselector_palette_item_color_set(Elm_Object_Item *it, int r, int g, int b, int a); + +/** + * Add a new color item to palette. + * + * @param obj The Colorselector object + * @param r r-value of color + * @param g g-value of color + * @param b b-value of color + * @param a a-value of color + * @return A new color palette Item. + * + * @ingroup Colorselector + */ +EAPI Elm_Object_Item *elm_colorselector_palette_color_add(Evas_Object *obj, int r, int g, int b, int a); + +/** + * Clear the palette items. + * + * @param obj The Colorselector object + * + * @ingroup Colorselector + */ +EAPI void elm_colorselector_palette_clear(Evas_Object *obj); + +/** + * Set current palette's name + * + * @param obj The Colorselector object + * @param palette_name Name of palette + * + * When colorpalette name is set, colors will be loaded from and saved to config + * using the set name. If no name is set then colors will be loaded from or + * saved to "default" config. + * + * @ingroup Colorselector + */ +EAPI void elm_colorselector_palette_name_set(Evas_Object *obj, const char *palette_name); + +/** + * Get current palette's name + * + * @param obj The Colorselector object + * @return Name of palette + * + * Returns the currently set palette name using which colors will be + * saved/loaded in to config. + * + * @ingroup Colorselector + */ +EAPI const char *elm_colorselector_palette_name_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_config.c b/libraries/elementary/src/lib/elm_config.c new file mode 100644 index 0000000..f4744a5 --- /dev/null +++ b/libraries/elementary/src/lib/elm_config.c @@ -0,0 +1,2215 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +#ifdef HAVE_EVIL +# include +#endif + +#include +#include "elm_priv.h" + +EAPI int ELM_EVENT_CONFIG_ALL_CHANGED = 0; + +Elm_Config *_elm_config = NULL; +char *_elm_profile = NULL; +static Eet_Data_Descriptor *_config_edd = NULL; +static Eet_Data_Descriptor *_config_font_overlay_edd = NULL; +static Eet_Data_Descriptor *_config_color_edd = NULL; +static Eet_Data_Descriptor *_config_color_palette_edd = NULL; +const char *_elm_preferred_engine = NULL; + +static Ecore_Poller *_elm_cache_flush_poller = NULL; + +const char *_elm_engines[] = { + "software_x11", + "fb", + "directfb", + "software_16_x11", + "software_8_x11", + "xrender_x11", + "opengl_x11", + "software_gdi", + "software_16_wince_gdi", + "sdl", + "software_16_sdl", + "opengl_sdl", + "buffer", + "ews", + "opengl_cocoa", + "psl1ght", + "wayland_shm", + "wayland_egl", + NULL +}; + +/* whenever you want to add a new text class support into Elementary, + declare it both here and in the (default) theme */ +static const Elm_Text_Class _elm_text_classes[] = { + {"button", "Button Labels"}, + {"label", "Text Labels"}, + {"entry", "Text Entries"}, + {"title_bar", "Title Bar"}, + {"list_item", "List Items"}, + {"grid_item", "Grid Items"}, + {"toolbar_item", "Toolbar Items"}, + {"menu_item", "Menu Items"}, + {NULL, NULL} +}; + +static void _desc_init(void); +static void _desc_shutdown(void); +static void _profile_fetch_from_conf(void); +static void _config_free(void); +static void _config_apply(void); +static Elm_Config *_config_user_load(void); +static Elm_Config *_config_system_load(void); +static void _config_load(void); +static void _config_update(void); +static void _env_get(void); +static size_t _elm_data_dir_snprintf(char *dst, + size_t size, + const char *fmt, ...) + EINA_PRINTF(3, 4); +static size_t _elm_user_dir_snprintf(char *dst, + size_t size, + const char *fmt, ...) + EINA_PRINTF(3, 4); + +#define ELM_CONFIG_VAL(edd, type, member, dtype) \ + EET_DATA_DESCRIPTOR_ADD_BASIC(edd, type, #member, member, dtype) +#define ELM_CONFIG_LIST(edd, type, member, eddtype) \ + EET_DATA_DESCRIPTOR_ADD_LIST(edd, type, #member, member, eddtype) + +#ifdef HAVE_ELEMENTARY_X +static Ecore_Event_Handler *_prop_change_handler = NULL; +static Ecore_Timer *_prop_all_update_timer = NULL; +static Ecore_Timer *_prop_change_delay_timer = NULL; +static Ecore_X_Window _root_1st = 0; +#define ATOM_COUNT 2 +static Ecore_X_Atom _atom[ATOM_COUNT]; +static Ecore_X_Atom _atom_config = 0; +static const char *_atom_names[ATOM_COUNT] = +{ + "ELM_PROFILE", + "ELM_CONFIG" +}; +#define ATOM_E_PROFILE 0 +#define ATOM_E_CONFIG 1 + +static Eina_Bool _prop_all_update_cb(void *data __UNUSED__); +static Eina_Bool _prop_config_get(void); +static void _prop_config_set(void); +static Eina_Bool _prop_change(void *data __UNUSED__, + int ev_type __UNUSED__, + void *ev); + +static Eina_Bool +_prop_all_update_cb(void *data __UNUSED__) +{ + _prop_config_set(); + ecore_x_window_prop_string_set(_root_1st, _atom[ATOM_E_PROFILE], + _elm_profile); + _prop_all_update_timer = NULL; + return EINA_FALSE; +} + +static Eina_Bool +_prop_config_get(void) +{ + int size = 0; + Ecore_X_Atom atom; + char buf[512]; + unsigned char *data = NULL; + Elm_Config *config_data; + + snprintf(buf, sizeof(buf), "ELM_CONFIG_%s", _elm_profile); + atom = ecore_x_atom_get(buf); + _atom_config = atom; + if (!ecore_x_window_prop_property_get(_root_1st, + atom, _atom[ATOM_E_CONFIG], + 8, &data, &size)) + { + if (!ecore_x_window_prop_property_get(_root_1st, + _atom[ATOM_E_CONFIG], + _atom[ATOM_E_CONFIG], + 8, &data, &size)) + return EINA_FALSE; + else + _atom_config = _atom[ATOM_E_CONFIG]; + } + else + _atom_config = atom; + if (size < 1) + { + free(data); + return EINA_FALSE; + } + config_data = eet_data_descriptor_decode(_config_edd, data, size); + free(data); + if (!config_data) return EINA_FALSE; + + /* What do we do on version mismatch when someone changes the + * config in the rootwindow? */ + /* Most obvious case, new version and we are still linked to + * whatever was there before, we just ignore until user restarts us */ + if (config_data->config_version > ELM_CONFIG_VERSION) + return EINA_TRUE; + /* What in the case the version is older? Do we even support those + * cases or we only check for equality above? */ + + _config_free(); + _elm_config = config_data; + _config_apply(); + _elm_config_font_overlay_apply(); + _elm_rescale(); + _elm_recache(); + ecore_event_add(ELM_EVENT_CONFIG_ALL_CHANGED, NULL, NULL, NULL); + return EINA_TRUE; +} + +static void +_prop_config_set(void) +{ + unsigned char *config_data = NULL; + int size = 0; + + config_data = eet_data_descriptor_encode(_config_edd, _elm_config, &size); + if (config_data) + { + Ecore_X_Atom atom; + char buf[512]; + + snprintf(buf, sizeof(buf), "ELM_CONFIG_%s", _elm_profile); + atom = ecore_x_atom_get(buf); + _atom_config = atom; + + ecore_x_window_prop_property_set(_root_1st, _atom_config, + _atom[ATOM_E_CONFIG], 8, + config_data, size); + free(config_data); + } +} + +static Eina_Bool +_prop_change_delay_cb(void *data __UNUSED__) +{ + char *s; + + s = ecore_x_window_prop_string_get(_root_1st, _atom[ATOM_E_PROFILE]); + if (s) + { + if (_elm_profile) free(_elm_profile); + _elm_profile = s; + } + _prop_config_get(); + _prop_change_delay_timer = NULL; + return EINA_FALSE; +} + +static Eina_Bool +_prop_change(void *data __UNUSED__, + int ev_type __UNUSED__, + void *ev) +{ + Ecore_X_Event_Window_Property *event = ev; + + if (event->win == _root_1st) + { + if (event->atom == _atom[ATOM_E_PROFILE]) + { + if (_prop_change_delay_timer) ecore_timer_del(_prop_change_delay_timer); + _prop_change_delay_timer = ecore_timer_add(0.1, _prop_change_delay_cb, NULL); + } + else if (((_atom_config > 0) && (event->atom == _atom_config)) || + (event->atom == _atom[ATOM_E_CONFIG])) + { + if (_prop_change_delay_timer) ecore_timer_del(_prop_change_delay_timer); + _prop_change_delay_timer = ecore_timer_add(0.1, _prop_change_delay_cb, NULL); + } + } + return ECORE_CALLBACK_PASS_ON; +} + +#endif + +static void +_desc_init(void) +{ + Eet_Data_Descriptor_Class eddc; + + EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Elm_Config); + eddc.func.str_direct_alloc = NULL; + eddc.func.str_direct_free = NULL; + + _config_edd = eet_data_descriptor_file_new(&eddc); + if (!_config_edd) + { + printf("EEEK! eet_data_descriptor_file_new() failed\n"); + return; + } + + memset(&eddc, 0, sizeof(eddc)); /* just in case... */ + EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Elm_Font_Overlay); + eddc.func.str_direct_alloc = NULL; + eddc.func.str_direct_free = NULL; + + _config_font_overlay_edd = eet_data_descriptor_stream_new(&eddc); + if (!_config_font_overlay_edd) + { + printf("EEEK! eet_data_descriptor_stream_new() failed\n"); + eet_data_descriptor_free(_config_edd); + return; + } + + memset(&eddc, 0, sizeof(eddc)); /* just in case... */ + EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Elm_Color_RGBA); + eddc.func.str_direct_alloc = NULL; + eddc.func.str_direct_free = NULL; + + _config_color_edd = eet_data_descriptor_stream_new(&eddc); + if (!_config_color_edd) + { + printf("EEEK! eet_data_descriptor_stream_new() failed\n"); + eet_data_descriptor_free(_config_edd); + return; + } + + memset(&eddc, 0, sizeof(eddc)); /* just in case... */ + EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Elm_Custom_Palette); + eddc.func.str_direct_alloc = NULL; + eddc.func.str_direct_free = NULL; + + _config_color_palette_edd = eet_data_descriptor_stream_new(&eddc); + if (!_config_color_palette_edd) + { + printf("EEEK! eet_data_descriptor_stream_new() failed\n"); + eet_data_descriptor_free(_config_edd); + return; + } + +#define T_INT EET_T_INT +#define T_DOUBLE EET_T_DOUBLE +#define T_STRING EET_T_STRING +#define T_UCHAR EET_T_UCHAR + +#define T Elm_Font_Overlay +#define D _config_font_overlay_edd + ELM_CONFIG_VAL(D, T, text_class, EET_T_STRING); + ELM_CONFIG_VAL(D, T, font, EET_T_STRING); + ELM_CONFIG_VAL(D, T, size, EET_T_INT); +#undef T +#undef D + +#define T Elm_Color_RGBA +#define D _config_color_edd + ELM_CONFIG_VAL(D, T, r, EET_T_UINT); + ELM_CONFIG_VAL(D, T, g, EET_T_UINT); + ELM_CONFIG_VAL(D, T, b, EET_T_UINT); + ELM_CONFIG_VAL(D, T, a, EET_T_UINT); +#undef T +#undef D + +#define T Elm_Custom_Palette +#define D _config_color_palette_edd + ELM_CONFIG_VAL(D, T, palette_name, EET_T_STRING); + ELM_CONFIG_LIST(D, T, color_list, _config_color_edd); +#undef T +#undef D + +#define T Elm_Config +#define D _config_edd + ELM_CONFIG_VAL(D, T, config_version, T_INT); + ELM_CONFIG_VAL(D, T, engine, T_STRING); + ELM_CONFIG_VAL(D, T, vsync, T_UCHAR); + ELM_CONFIG_VAL(D, T, thumbscroll_enable, T_UCHAR); + ELM_CONFIG_VAL(D, T, thumbscroll_threshold, T_INT); + ELM_CONFIG_VAL(D, T, thumbscroll_momentum_threshold, T_DOUBLE); + ELM_CONFIG_VAL(D, T, thumbscroll_friction, T_DOUBLE); + ELM_CONFIG_VAL(D, T, thumbscroll_bounce_friction, T_DOUBLE); + ELM_CONFIG_VAL(D, T, thumbscroll_border_friction, T_DOUBLE); + ELM_CONFIG_VAL(D, T, thumbscroll_sensitivity_friction, T_DOUBLE); + ELM_CONFIG_VAL(D, T, page_scroll_friction, T_DOUBLE); + ELM_CONFIG_VAL(D, T, bring_in_scroll_friction, T_DOUBLE); + ELM_CONFIG_VAL(D, T, zoom_friction, T_DOUBLE); + ELM_CONFIG_VAL(D, T, thumbscroll_bounce_enable, T_UCHAR); + ELM_CONFIG_VAL(D, T, scroll_smooth_amount, T_DOUBLE); + ELM_CONFIG_VAL(D, T, scroll_smooth_history_weight, T_DOUBLE); + ELM_CONFIG_VAL(D, T, scroll_smooth_future_time, T_DOUBLE); + ELM_CONFIG_VAL(D, T, scroll_smooth_time_window, T_DOUBLE); + ELM_CONFIG_VAL(D, T, scale, T_DOUBLE); + ELM_CONFIG_VAL(D, T, bgpixmap, T_INT); + ELM_CONFIG_VAL(D, T, compositing, T_INT); + /* EET_DATA_DESCRIPTOR_ADD_LIST(D, T, "font_dirs", font_dirs, sub_edd); */ + ELM_CONFIG_LIST(D, T, font_overlays, _config_font_overlay_edd); + ELM_CONFIG_VAL(D, T, font_hinting, T_INT); + ELM_CONFIG_VAL(D, T, cache_flush_poll_interval, T_INT); + ELM_CONFIG_VAL(D, T, cache_flush_enable, T_UCHAR); + ELM_CONFIG_VAL(D, T, image_cache, T_INT); + ELM_CONFIG_VAL(D, T, font_cache, T_INT); + ELM_CONFIG_VAL(D, T, edje_cache, T_INT); + ELM_CONFIG_VAL(D, T, edje_collection_cache, T_INT); + ELM_CONFIG_VAL(D, T, finger_size, T_INT); + ELM_CONFIG_VAL(D, T, fps, T_DOUBLE); + ELM_CONFIG_VAL(D, T, theme, T_STRING); + ELM_CONFIG_VAL(D, T, modules, T_STRING); + ELM_CONFIG_VAL(D, T, tooltip_delay, T_DOUBLE); + ELM_CONFIG_VAL(D, T, cursor_engine_only, T_UCHAR); + ELM_CONFIG_VAL(D, T, focus_highlight_enable, T_UCHAR); + ELM_CONFIG_VAL(D, T, focus_highlight_animate, T_UCHAR); + ELM_CONFIG_VAL(D, T, toolbar_shrink_mode, T_INT); + ELM_CONFIG_VAL(D, T, fileselector_expand_enable, T_UCHAR); + ELM_CONFIG_VAL(D, T, inwin_dialogs_enable, T_UCHAR); + ELM_CONFIG_VAL(D, T, icon_size, T_INT); + ELM_CONFIG_VAL(D, T, longpress_timeout, T_DOUBLE); + ELM_CONFIG_VAL(D, T, effect_enable, T_UCHAR); + ELM_CONFIG_VAL(D, T, desktop_entry, T_UCHAR); + ELM_CONFIG_VAL(D, T, password_show_last, T_UCHAR); + ELM_CONFIG_VAL(D, T, password_show_last_timeout, T_DOUBLE); + ELM_CONFIG_VAL(D, T, glayer_zoom_finger_enable, T_UCHAR); + ELM_CONFIG_VAL(D, T, glayer_zoom_finger_factor, T_DOUBLE); + ELM_CONFIG_VAL(D, T, glayer_zoom_wheel_factor, T_DOUBLE); + ELM_CONFIG_VAL(D, T, glayer_zoom_distance_tolerance, T_DOUBLE); + ELM_CONFIG_VAL(D, T, glayer_rotate_finger_enable, T_UCHAR); + ELM_CONFIG_VAL(D, T, glayer_rotate_angular_tolerance, T_DOUBLE); + ELM_CONFIG_VAL(D, T, glayer_line_min_length, T_DOUBLE); + ELM_CONFIG_VAL(D, T, glayer_line_distance_tolerance, T_DOUBLE); + ELM_CONFIG_VAL(D, T, glayer_line_angular_tolerance, T_DOUBLE); + ELM_CONFIG_VAL(D, T, glayer_flick_time_limit_ms, T_INT); + ELM_CONFIG_VAL(D, T, glayer_long_tap_start_timeout, T_DOUBLE); + ELM_CONFIG_VAL(D, T, access_mode, T_INT); + ELM_CONFIG_VAL(D, T, glayer_continues_enable, T_UCHAR); + ELM_CONFIG_VAL(D, T, week_start, T_INT); + ELM_CONFIG_VAL(D, T, weekend_start, T_INT); + ELM_CONFIG_VAL(D, T, weekend_len, T_INT); + ELM_CONFIG_VAL(D, T, year_min, T_INT); + ELM_CONFIG_VAL(D, T, year_max, T_INT); + ELM_CONFIG_LIST(D, T, color_palette, _config_color_palette_edd); +#undef T +#undef D +#undef T_INT +#undef T_DOUBLE +#undef T_STRING +#undef T_UCHAR +} + +static void +_desc_shutdown(void) +{ + if (_config_edd) + { + eet_data_descriptor_free(_config_edd); + _config_edd = NULL; + } + + if (_config_font_overlay_edd) + { + eet_data_descriptor_free(_config_font_overlay_edd); + _config_font_overlay_edd = NULL; + } + + if (_config_color_edd) + { + eet_data_descriptor_free(_config_color_edd); + _config_color_edd = NULL; + } + + if (_config_color_palette_edd) + { + eet_data_descriptor_free(_config_color_palette_edd); + _config_color_palette_edd = NULL; + } +} + +static int +_sort_files_cb(const void *f1, + const void *f2) +{ + return strcmp(f1, f2); +} + +const char * +_elm_config_current_profile_get(void) +{ + return _elm_profile; +} + +static size_t +_elm_data_dir_snprintf(char *dst, + size_t size, + const char *fmt, + ...) +{ + size_t data_dir_len, off; + va_list ap; + + data_dir_len = eina_strlcpy(dst, _elm_data_dir, size); + + off = data_dir_len + 1; + if (off >= size) + goto end; + + va_start(ap, fmt); + dst[data_dir_len] = '/'; + + off = off + vsnprintf(dst + off, size - off, fmt, ap); + va_end(ap); + +end: + return off; +} + +static size_t +_elm_user_dir_snprintf(char *dst, + size_t size, + const char *fmt, + ...) +{ + const char *home; + size_t user_dir_len, off; + va_list ap; + +#ifdef _WIN32 + home = evil_homedir_get(); +#else + home = getenv("HOME"); +#endif + if (!home) + home = "/"; + + user_dir_len = eina_str_join_len(dst, size, '/', home, strlen(home), + ELEMENTARY_BASE_DIR, sizeof(ELEMENTARY_BASE_DIR) - 1); + + off = user_dir_len + 1; + if (off >= size) + goto end; + + va_start(ap, fmt); + dst[user_dir_len] = '/'; + + off = off + vsnprintf(dst + off, size - off, fmt, ap); + va_end(ap); + +end: + return off; +} + +const char * +_elm_config_profile_dir_get(const char *prof, + Eina_Bool is_user) +{ + char buf[PATH_MAX]; + + if (!is_user) + goto not_user; + + _elm_user_dir_snprintf(buf, sizeof(buf), "config/%s", prof); + + if (ecore_file_is_dir(buf)) + return strdup(buf); + + return NULL; + +not_user: + snprintf(buf, sizeof(buf), "%s/config/%s", _elm_data_dir, prof); + + if (ecore_file_is_dir(buf)) + return strdup(buf); + + return NULL; +} + +Eina_List * +_elm_config_font_overlays_list(void) +{ + return _elm_config->font_overlays; +} + +void +_elm_config_font_overlay_set(const char *text_class, + const char *font, + Evas_Font_Size size) +{ + Elm_Font_Overlay *efd; + Eina_List *l; + + EINA_LIST_FOREACH(_elm_config->font_overlays, l, efd) + { + if (strcmp(efd->text_class, text_class)) + continue; + + if (efd->font) eina_stringshare_del(efd->font); + efd->font = eina_stringshare_add(font); + efd->size = size; + _elm_config->font_overlays = + eina_list_promote_list(_elm_config->font_overlays, l); + return; + } + + /* the text class doesn't exist */ + efd = calloc(1, sizeof(Elm_Font_Overlay)); + efd->text_class = eina_stringshare_add(text_class); + efd->font = eina_stringshare_add(font); + efd->size = size; + + _elm_config->font_overlays = eina_list_prepend(_elm_config->font_overlays, + efd); +} + +void +_elm_config_font_overlay_remove(const char *text_class) +{ + Elm_Font_Overlay *efd; + Eina_List *l; + + EINA_LIST_FOREACH(_elm_config->font_overlays, l, efd) + { + if (strcmp(efd->text_class, text_class)) + continue; + + _elm_config->font_overlays = + eina_list_remove_list(_elm_config->font_overlays, l); + if (efd->text_class) eina_stringshare_del(efd->text_class); + if (efd->font) eina_stringshare_del(efd->font); + free(efd); + + return; + } +} + +void +_elm_config_font_overlay_apply(void) +{ + Elm_Font_Overlay *efd; + Eina_List *l; + int i; + + for (i = 0; _elm_text_classes[i].desc; i++) + edje_text_class_del(_elm_text_classes[i].name); + + EINA_LIST_FOREACH(_elm_config->font_overlays, l, efd) + edje_text_class_set(efd->text_class, efd->font, efd->size); +} + +Eina_List * +_elm_config_text_classes_get(void) +{ + Eina_List *ret = NULL; + int i; + + for (i = 0; _elm_text_classes[i].desc; i++) + { + Elm_Text_Class *tc; + tc = malloc(sizeof(*tc)); + if (!tc) continue; + + *tc = _elm_text_classes[i]; + + ret = eina_list_append(ret, tc); + } + + return ret; +} + +void +_elm_config_text_classes_free(Eina_List *l) +{ + Elm_Text_Class *tc; + + EINA_LIST_FREE(l, tc) + free(tc); +} + +Eina_List * +_elm_config_color_list_get(const char *palette_name) +{ + Eina_List *plist; + Elm_Custom_Palette *cpalette; + EINA_LIST_FOREACH(_elm_config->color_palette, plist, cpalette) + { + if (strcmp(cpalette->palette_name, palette_name)) + continue; + return cpalette->color_list; + } + return NULL; +} + +void +_elm_config_color_set(const char *palette_name, + int r, + int g, + int b, + int a) +{ + Eina_List *plist; + Elm_Custom_Palette *cpalette; + Elm_Color_RGBA *color; + EINA_LIST_FOREACH(_elm_config->color_palette, plist, cpalette) + { + if (strcmp(cpalette->palette_name, palette_name)) + continue; + + color = calloc(1, sizeof(Elm_Color_RGBA)); + color->r = r; + color->g = g; + color->b = b; + color->a = a; + cpalette->color_list = eina_list_prepend(cpalette->color_list, + color); + } +} + +void +_elm_config_colors_free(const char *palette_name) +{ + Eina_List *plist; + Elm_Custom_Palette *cpalette; + Elm_Color_RGBA *color; + EINA_LIST_FOREACH(_elm_config->color_palette, plist, cpalette) + { + if (strcmp(cpalette->palette_name, palette_name)) + continue; + + EINA_LIST_FREE(cpalette->color_list, color) + { + free(color); + } + } +} + +Eina_List * +_elm_config_profiles_list(void) +{ + Eina_File_Direct_Info *info; + Eina_List *flist = NULL; + Eina_Iterator *file_it; + char buf[PATH_MAX]; + const char *dir; + size_t len; + + len = _elm_user_dir_snprintf(buf, sizeof(buf), "config"); + + file_it = eina_file_stat_ls(buf); + if (!file_it) + goto sys; + + buf[len] = '/'; + len++; + + len = sizeof(buf) - len; + + EINA_ITERATOR_FOREACH(file_it, info) + { + if (info->name_length >= len) + continue; + + if (info->type == EINA_FILE_DIR) + { + flist = + eina_list_sorted_insert(flist, _sort_files_cb, + eina_stringshare_add(info->path + + info->name_start)); + } + } + + eina_iterator_free(file_it); + +sys: + len = eina_str_join_len(buf, sizeof(buf), '/', _elm_data_dir, + strlen(_elm_data_dir), "config", + sizeof("config") - 1); + + file_it = eina_file_direct_ls(buf); + if (!file_it) + goto list_free; + + buf[len] = '/'; + len++; + + len = sizeof(buf) - len; + EINA_ITERATOR_FOREACH(file_it, info) + { + if (info->name_length >= len) + continue; + + switch (info->type) + { + case EINA_FILE_DIR: + { + const Eina_List *l; + const char *tmp; + + EINA_LIST_FOREACH(flist, l, tmp) + if (!strcmp(info->path + info->name_start, tmp)) + break; + + if (!l) + flist = + eina_list_sorted_insert(flist, _sort_files_cb, + eina_stringshare_add(info->path + + info->name_start)); + } + break; + + default: + continue; + } + } + eina_iterator_free(file_it); + return flist; + +list_free: + EINA_LIST_FREE(flist, dir) + eina_stringshare_del(dir); + + return NULL; +} + +static void +_profile_fetch_from_conf(void) +{ + char buf[PATH_MAX], *p, *s; + Eet_File *ef = NULL; + int len = 0; + + _elm_profile = strdup("default"); + + // if env var - use profile without question + s = getenv("ELM_PROFILE"); + if (s) + { + free(_elm_profile); + _elm_profile = strdup(s); + return; + } + + // user profile + _elm_user_dir_snprintf(buf, sizeof(buf), "config/profile.cfg"); + ef = eet_open(buf, EET_FILE_MODE_READ); + if (ef) + { + p = eet_read(ef, "config", &len); + if (p) + { + free(_elm_profile); + _elm_profile = malloc(len + 1); + memcpy(_elm_profile, p, len); + _elm_profile[len] = 0; + free(p); + } + eet_close(ef); + if (!p) ef = NULL; + } + if (ef) return; + + // system profile + _elm_data_dir_snprintf(buf, sizeof(buf), "config/profile.cfg"); + ef = eet_open(buf, EET_FILE_MODE_READ); + if (ef) + { + p = eet_read(ef, "config", &len); + if (p) + { + free(_elm_profile); + _elm_profile = malloc(len + 1); + memcpy(_elm_profile, p, len); + _elm_profile[len] = 0; + free(p); + } + eet_close(ef); + } +} + +static void +_config_free(void) +{ + Elm_Font_Overlay *fo; + const char *fontdir; + Elm_Custom_Palette *palette; + Elm_Color_RGBA *color; + + if (!_elm_config) return; + EINA_LIST_FREE(_elm_config->font_dirs, fontdir) + { + eina_stringshare_del(fontdir); + } + if (_elm_config->engine) eina_stringshare_del(_elm_config->engine); + EINA_LIST_FREE(_elm_config->font_overlays, fo) + { + if (fo->text_class) eina_stringshare_del(fo->text_class); + if (fo->font) eina_stringshare_del(fo->font); + free(fo); + } + EINA_LIST_FREE(_elm_config->color_palette, palette) + { + if (palette->palette_name) eina_stringshare_del(palette->palette_name); + EINA_LIST_FREE(palette->color_list, color) free(color); + free(palette); + } + if (_elm_config->theme) eina_stringshare_del(_elm_config->theme); + if (_elm_config->modules) eina_stringshare_del(_elm_config->modules); + free(_elm_config); + _elm_config = NULL; +} + +static void +_config_apply(void) +{ + _elm_theme_parse(NULL, _elm_config->theme); + ecore_animator_frametime_set(1.0 / _elm_config->fps); +} + +static void +_config_sub_apply(void) +{ + edje_frametime_set(1.0 / _elm_config->fps); + edje_scale_set(_elm_config->scale); + edje_password_show_last_set(_elm_config->password_show_last); + edje_password_show_last_timeout_set(_elm_config->password_show_last_timeout); + if (_elm_config->modules) _elm_module_parse(_elm_config->modules); +} + +static Eina_Bool +_elm_cache_flush_cb(void *data __UNUSED__) +{ + elm_cache_all_flush(); + return ECORE_CALLBACK_RENEW; +} + +/* kind of abusing this call right now -- shared between all of those + * properties -- but they are not meant to be called that periodically + * anyway */ +void +_elm_recache(void) +{ + Eina_List *l; + Evas_Object *win; + + elm_cache_all_flush(); + + EINA_LIST_FOREACH(_elm_win_list, l, win) + { + Evas *e = evas_object_evas_get(win); + evas_image_cache_set(e, _elm_config->image_cache * 1024); + evas_font_cache_set(e, _elm_config->font_cache * 1024); + } + edje_file_cache_set(_elm_config->edje_cache); + edje_collection_cache_set(_elm_config->edje_collection_cache); + + if (_elm_cache_flush_poller) + { + ecore_poller_del(_elm_cache_flush_poller); + _elm_cache_flush_poller = NULL; + } + if (_elm_config->cache_flush_enable) + { + if (_elm_config->cache_flush_poll_interval > 0) + { + _elm_cache_flush_poller = + ecore_poller_add(ECORE_POLLER_CORE, + _elm_config->cache_flush_poll_interval, + _elm_cache_flush_cb, NULL); + } + } +} + +static Elm_Config * +_config_user_load(void) +{ + Elm_Config *cfg = NULL; + Eet_File *ef; + char buf[PATH_MAX]; + + _elm_user_dir_snprintf(buf, sizeof(buf), "config/%s/base.cfg", + _elm_profile); + + ef = eet_open(buf, EET_FILE_MODE_READ); + if (ef) + { + cfg = eet_data_read(ef, _config_edd, "config"); + eet_close(ef); + } + return cfg; +} + +static Elm_Config * +_config_system_load(void) +{ + Elm_Config *cfg = NULL; + Eet_File *ef; + char buf[PATH_MAX]; + + _elm_data_dir_snprintf(buf, sizeof(buf), "config/%s/base.cfg", + _elm_profile); + + ef = eet_open(buf, EET_FILE_MODE_READ); + if (ef) + { + cfg = eet_data_read(ef, _config_edd, "config"); + eet_close(ef); + } + return cfg; +} + +static void +_config_load(void) +{ + _elm_config = _config_user_load(); + if (_elm_config) + { + if (_elm_config->config_version < ELM_CONFIG_VERSION) + _config_update(); + return; + } + + /* no user config, fallback for system. No need to check version for + * this one, if it's not the right one, someone screwed up at the time + * of installing it */ + _elm_config = _config_system_load(); + if (_elm_config) return; + /* FIXME: config load could have failed because of a non-existent + * profile. Fallback to default before moving on */ + + // config load fail - defaults + // why are these here? well if they are, it means you can make a gui + // config recovery app i guess... + _elm_config = ELM_NEW(Elm_Config); + _elm_config->config_version = ELM_CONFIG_VERSION; + _elm_config->engine = eina_stringshare_add("software_x11"); + _elm_config->vsync = 0; + _elm_config->thumbscroll_enable = EINA_TRUE; + _elm_config->thumbscroll_threshold = 24; + _elm_config->thumbscroll_momentum_threshold = 100.0; + _elm_config->thumbscroll_friction = 1.0; + _elm_config->thumbscroll_bounce_friction = 0.5; + _elm_config->thumbscroll_bounce_enable = EINA_TRUE; + _elm_config->page_scroll_friction = 0.5; + _elm_config->bring_in_scroll_friction = 0.5; + _elm_config->zoom_friction = 0.5; + _elm_config->thumbscroll_border_friction = 0.5; + _elm_config->thumbscroll_sensitivity_friction = 0.25; // magic number! just trial and error shows this makes it behave "nicer" and not run off at high speed all the time + _elm_config->scroll_smooth_amount = 1.0; + _elm_config->scroll_smooth_history_weight = 0.3; + _elm_config->scroll_smooth_future_time = 0.0; + _elm_config->scroll_smooth_time_window = 0.2; + _elm_config->scale = 1.0; + _elm_config->bgpixmap = 0; + _elm_config->compositing = 1; + _elm_config->font_hinting = 2; + _elm_config->cache_flush_poll_interval = 512; + _elm_config->cache_flush_enable = EINA_TRUE; + _elm_config->font_dirs = NULL; + _elm_config->image_cache = 4096; + _elm_config->font_cache = 512; + _elm_config->edje_cache = 32; + _elm_config->edje_collection_cache = 64; + _elm_config->finger_size = 40; + _elm_config->fps = 60.0; + _elm_config->theme = eina_stringshare_add("default"); + _elm_config->modules = NULL; + _elm_config->tooltip_delay = 1.0; + _elm_config->cursor_engine_only = EINA_TRUE; + _elm_config->focus_highlight_enable = EINA_FALSE; + _elm_config->focus_highlight_animate = EINA_TRUE; + _elm_config->toolbar_shrink_mode = 2; + _elm_config->fileselector_expand_enable = EINA_FALSE; + _elm_config->inwin_dialogs_enable = EINA_FALSE; + _elm_config->icon_size = 32; + _elm_config->longpress_timeout = 1.0; + _elm_config->effect_enable = EINA_TRUE; + _elm_config->desktop_entry = EINA_FALSE; + _elm_config->is_mirrored = EINA_FALSE; /* Read sys value in env_get() */ + _elm_config->password_show_last = EINA_FALSE; + _elm_config->password_show_last_timeout = 2.0; + _elm_config->glayer_zoom_finger_enable = EINA_TRUE; + _elm_config->glayer_zoom_finger_factor = 1.0; + _elm_config->glayer_zoom_wheel_factor = 0.05; + _elm_config->glayer_zoom_distance_tolerance = 1.0; /* 1 times elm_finger_size_get() */ + _elm_config->glayer_rotate_finger_enable = EINA_TRUE; + _elm_config->glayer_rotate_angular_tolerance = 2.0; /* 2 DEG */ + _elm_config->glayer_line_min_length = 1.0; /* 1 times elm_finger_size_get() */ + _elm_config->glayer_line_distance_tolerance = 3.0; /* 3 times elm_finger_size_get() */ + _elm_config->glayer_line_angular_tolerance = 20.0; /* 20 DEG */ + _elm_config->glayer_flick_time_limit_ms = 120; /* ms to finish flick */ + _elm_config->glayer_long_tap_start_timeout = 1.2; /* 1.2 second to start long-tap */ + _elm_config->glayer_continues_enable = EINA_TRUE; /* Continue gestures default */ + _elm_config->week_start = 1; /* monday */ + _elm_config->weekend_start = 6; /* saturday */ + _elm_config->weekend_len = 2; + _elm_config->year_min = 2; + _elm_config->year_max = 137; + _elm_config->color_palette = NULL; +} + +static const char * +_elm_config_eet_close_error_get(Eet_File *ef, + char *file) +{ + Eet_Error err; + const char *erstr = NULL; + + err = eet_close(ef); + switch (err) + { + case EET_ERROR_WRITE_ERROR: + erstr = "An error occurred while saving Elementary's " + "settings to disk. The error could not be " + "deterimined. The file where the error occurred was: " + "%s. This file has been deleted to avoid corrupt data."; + break; + + case EET_ERROR_WRITE_ERROR_FILE_TOO_BIG: + erstr = "Elementary's settings files are too big " + "for the file system they are being saved to. " + "This error is very strange as the files should " + "be extremely small. Please check the settings " + "for your home directory. " + "The file where the error occurred was: %s ." + "This file has been deleted to avoid corrupt data."; + break; + + case EET_ERROR_WRITE_ERROR_IO_ERROR: + erstr = "An output error occurred when writing the settings " + "files for Elementary. Your disk is having troubles " + "and possibly needs replacement. " + "The file where the error occurred was: %s ." + "This file has been deleted to avoid corrupt data."; + break; + + case EET_ERROR_WRITE_ERROR_OUT_OF_SPACE: + erstr = "Elementary cannot write its settings file " + "because it ran out of space to write the file. " + "You have either run out of disk space or have " + "gone over your quota limit. " + "The file where the error occurred was: %s ." + "This file has been deleted to avoid corrupt data."; + break; + + case EET_ERROR_WRITE_ERROR_FILE_CLOSED: + erstr = "Elementary unexpectedly had the settings file " + "it was writing closed on it. This is very unusual. " + "The file where the error occurred was: %s " + "This file has been deleted to avoid corrupt data."; + break; + + default: + break; + } + if (erstr) + { + /* delete any partially-written file */ + ecore_file_unlink(file); + return strdup(erstr); + } + + return NULL; +} + +static Eina_Bool +_elm_config_profile_save(void) +{ + char buf[4096], buf2[4096]; + int ok = 0, ret; + const char *err; + Eet_File *ef; + size_t len; + + len = _elm_user_dir_snprintf(buf, sizeof(buf), "config/profile.cfg"); + if (len + 1 >= sizeof(buf)) + return EINA_FALSE; + + len = _elm_user_dir_snprintf(buf2, sizeof(buf2), "config/profile.cfg.tmp"); + if (len + 1 >= sizeof(buf2)) + return EINA_FALSE; + + ef = eet_open(buf2, EET_FILE_MODE_WRITE); + if (!ef) + return EINA_FALSE; + + ok = eet_write(ef, "config", _elm_profile, strlen(_elm_profile), 0); + if (!ok) + goto err; + + err = _elm_config_eet_close_error_get(ef, buf2); + if (err) + { + ERR("%s", err); + free((void *)err); + goto err; + } + + ret = ecore_file_mv(buf2, buf); + if (!ret) + { + ERR("Error saving Elementary's configuration file"); + goto err; + } + + ecore_file_unlink(buf2); + return EINA_TRUE; + +err: + ecore_file_unlink(buf2); + return EINA_FALSE; +} + +Eina_Bool +_elm_config_save(void) +{ + char buf[4096], buf2[4096]; + int ok = 0, ret; + const char *err; + Eet_File *ef; + size_t len; + + len = _elm_user_dir_snprintf(buf, sizeof(buf), "config/%s", _elm_profile); + if (len + 1 >= sizeof(buf)) + return EINA_FALSE; + + ok = ecore_file_mkpath(buf); + if (!ok) + { + ERR("Problem accessing Elementary's user configuration directory: %s", + buf); + return EINA_FALSE; + } + + if (!_elm_config_profile_save()) + return EINA_FALSE; + + buf[len] = '/'; + len++; + + if (len + sizeof("base.cfg") >= sizeof(buf) - len) + return EINA_FALSE; + + memcpy(buf + len, "base.cfg", sizeof("base.cfg")); + len += sizeof("base.cfg") - 1; + + if (len + sizeof(".tmp") >= sizeof(buf)) + return EINA_FALSE; + + memcpy(buf2, buf, len); + memcpy(buf2 + len, ".tmp", sizeof(".tmp")); + + ef = eet_open(buf2, EET_FILE_MODE_WRITE); + if (!ef) + return EINA_FALSE; + + ok = eet_data_write(ef, _config_edd, "config", _elm_config, 1); + if (!ok) + goto err; + + err = _elm_config_eet_close_error_get(ef, buf2); + if (err) + { + ERR("%s", err); + free((void *)err); + goto err; + } + + ret = ecore_file_mv(buf2, buf); + if (!ret) + { + ERR("Error saving Elementary's configuration file"); + goto err; + } + + ecore_file_unlink(buf2); + return EINA_TRUE; + +err: + ecore_file_unlink(buf2); + return EINA_FALSE; +} + +static void +_config_update(void) +{ + Elm_Config *tcfg; + + tcfg = _config_system_load(); + if (!tcfg) + { + /* weird profile or something? We should probably fill + * with hardcoded defaults, or get from default previx */ + return; + } +#define IFCFG(v) if ((_elm_config->config_version & 0xffff) < (v)) { +#define IFCFGELSE } else { +#define IFCFGEND } +#define COPYVAL(x) do {_elm_config->x = tcfg->x; } while (0) +#define COPYPTR(x) do {_elm_config->x = tcfg->x; tcfg->x = NULL; } while (0) +#define COPYSTR(x) COPYPTR(x) + + /* we also need to update for property changes in the root window + * if needed, but that will be dependent on new properties added + * with each version */ + + IFCFG(0x0003); + COPYVAL(longpress_timeout); + IFCFGEND; + +#undef COPYSTR +#undef COPYPTR +#undef COPYVAL +#undef IFCFGEND +#undef IFCFGELSE +#undef IFCFG + + /* after updating user config, we must save */ +} + +static void +_env_get(void) +{ + char *s; + double friction; + + s = getenv("ELM_ENGINE"); + if (s) + { + if ((!strcasecmp(s, "x11")) || + (!strcasecmp(s, "x")) || + (!strcasecmp(s, "software-x11")) || + (!strcasecmp(s, "software_x11"))) + eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_X11); + else if ((!strcasecmp(s, "opengl")) || + (!strcasecmp(s, "gl")) || + (!strcasecmp(s, "opengl-x11")) || + (!strcasecmp(s, "opengl_x11"))) + eina_stringshare_replace(&_elm_config->engine, ELM_OPENGL_X11); + else if ((!strcasecmp(s, "x11-8")) || + (!strcasecmp(s, "x8")) || + (!strcasecmp(s, "software-8-x11")) || + (!strcasecmp(s, "software_8_x11"))) + eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_8_X11); + else if ((!strcasecmp(s, "x11-16")) || + (!strcasecmp(s, "x16")) || + (!strcasecmp(s, "software-16-x11")) || + (!strcasecmp(s, "software_16_x11"))) + eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_16_X11); +/* + else if ((!strcasecmp(s, "xrender")) || + (!strcasecmp(s, "xr")) || + (!strcasecmp(s, "xrender-x11")) || + (!strcasecmp(s, "xrender_x11"))) + eina_stringshare_replace(&_elm_config->engine, ELM_XRENDER_X11); + */ + else if ((!strcasecmp(s, "fb")) || + (!strcasecmp(s, "software-fb")) || + (!strcasecmp(s, "software_fb"))) + eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_FB); + else if ((!strcasecmp(s, "directfb")) || + (!strcasecmp(s, "dfb"))) + eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_DIRECTFB); + else if ((!strcasecmp(s, "psl1ght"))) + eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_PSL1GHT); + else if ((!strcasecmp(s, "sdl")) || + (!strcasecmp(s, "software-sdl")) || + (!strcasecmp(s, "software_sdl"))) + eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_SDL); + else if ((!strcasecmp(s, "sdl-16")) || + (!strcasecmp(s, "software-16-sdl")) || + (!strcasecmp(s, "software_16_sdl"))) + eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_16_SDL); + else if ((!strcasecmp(s, "opengl-sdl")) || + (!strcasecmp(s, "opengl_sdl")) || + (!strcasecmp(s, "gl-sdl")) || + (!strcasecmp(s, "gl_sdl"))) + eina_stringshare_replace(&_elm_config->engine, ELM_OPENGL_SDL); + else if ((!strcasecmp(s, "opengl-cocoa")) || + (!strcasecmp(s, "opengl_cocoa")) || + (!strcasecmp(s, "gl-cocoa")) || + (!strcasecmp(s, "gl_cocoa"))) + eina_stringshare_replace(&_elm_config->engine, ELM_OPENGL_COCOA); + else if ((!strcasecmp(s, "gdi")) || + (!strcasecmp(s, "software-gdi")) || + (!strcasecmp(s, "software_gdi"))) + eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_WIN32); + else if ((!strcasecmp(s, "wince-gdi")) || + (!strcasecmp(s, "software-16-wince-gdi")) || + (!strcasecmp(s, "software_16_wince_gdi"))) + eina_stringshare_replace(&_elm_config->engine, ELM_SOFTWARE_16_WINCE); + else if (!strcasecmp(s, "buffer")) + eina_stringshare_replace(&_elm_config->engine, ELM_BUFFER); + else if ((!strncmp(s, "shot:", 5))) + eina_stringshare_replace(&_elm_config->engine, s); + else if ((!strcasecmp(s, "ews"))) + eina_stringshare_replace(&_elm_config->engine, ELM_EWS); + else if ((!strcasecmp(s, "wayland_shm"))) + eina_stringshare_replace(&_elm_config->engine, ELM_WAYLAND_SHM); + else if ((!strcasecmp(s, "wayland_egl"))) + eina_stringshare_replace(&_elm_config->engine, ELM_WAYLAND_EGL); + else + ERR("Unknown engine '%s'.", s); + } + + s = getenv("ELM_VSYNC"); + if (s) _elm_config->vsync = !!atoi(s); + + s = getenv("ELM_THUMBSCROLL_ENABLE"); + if (s) _elm_config->thumbscroll_enable = !!atoi(s); + s = getenv("ELM_THUMBSCROLL_THRESHOLD"); + if (s) _elm_config->thumbscroll_threshold = atoi(s); + // FIXME: floatformat locale issues here 1.0 vs 1,0 - should just be 1.0 + s = getenv("ELM_THUMBSCROLL_MOMENTUM_THRESHOLD"); + if (s) _elm_config->thumbscroll_momentum_threshold = atof(s); + s = getenv("ELM_THUMBSCROLL_FRICTION"); + if (s) _elm_config->thumbscroll_friction = atof(s); + s = getenv("ELM_THUMBSCROLL_BOUNCE_ENABLE"); + if (s) _elm_config->thumbscroll_bounce_enable = !!atoi(s); + s = getenv("ELM_THUMBSCROLL_BOUNCE_FRICTION"); + if (s) _elm_config->thumbscroll_bounce_friction = atof(s); + s = getenv("ELM_PAGE_SCROLL_FRICTION"); + if (s) _elm_config->page_scroll_friction = atof(s); + s = getenv("ELM_BRING_IN_SCROLL_FRICTION"); + if (s) _elm_config->bring_in_scroll_friction = atof(s); + s = getenv("ELM_ZOOM_FRICTION"); + if (s) _elm_config->zoom_friction = atof(s); + s = getenv("ELM_THUMBSCROLL_BORDER_FRICTION"); + if (s) + { + friction = atof(s); + if (friction < 0.0) + friction = 0.0; + + if (friction > 1.0) + friction = 1.0; + + _elm_config->thumbscroll_border_friction = friction; + } + s = getenv("ELM_THUMBSCROLL_SENSITIVITY_FRICTION"); + if (s) + { + friction = atof(s); + if (friction < 0.1) + friction = 0.1; + + if (friction > 1.0) + friction = 1.0; + + _elm_config->thumbscroll_sensitivity_friction = friction; + } + s = getenv("ELM_SCROLL_SMOOTH_AMOUNT"); + if (s) _elm_config->scroll_smooth_amount = atof(s); + s = getenv("ELM_SCROLL_SMOOTH_HISTORY_WEIGHT"); + if (s) _elm_config->scroll_smooth_history_weight = atof(s); + s = getenv("ELM_SCROLL_SMOOTH_FUTURE_TIME"); + if (s) _elm_config->scroll_smooth_future_time = atof(s); + s = getenv("ELM_SCROLL_SMOOTH_TIME_WINDOW"); + if (s) _elm_config->scroll_smooth_time_window = atof(s); + s = getenv("ELM_THEME"); + if (s) eina_stringshare_replace(&_elm_config->theme, s); + + s = getenv("ELM_FONT_HINTING"); + if (s) + { + if (!strcasecmp(s, "none")) _elm_config->font_hinting = 0; + else if (!strcasecmp(s, "auto")) + _elm_config->font_hinting = 1; + else if (!strcasecmp(s, "bytecode")) + _elm_config->font_hinting = 2; + } + + s = getenv("ELM_FONT_PATH"); + if (s) + { + const char *p, *pp; + char *buf2; + + EINA_LIST_FREE(_elm_config->font_dirs, p) + { + eina_stringshare_del(p); + } + + buf2 = alloca(strlen(s) + 1); + p = s; + pp = p; + for (;; ) + { + if ((*p == ':') || (*p == 0)) + { + int len; + + len = p - pp; + strncpy(buf2, pp, len); + buf2[len] = 0; + _elm_config->font_dirs = + eina_list_append(_elm_config->font_dirs, + eina_stringshare_add(buf2)); + if (*p == 0) break; + p++; + pp = p; + } + else + { + if (*p == 0) break; + p++; + } + } + } + + s = getenv("ELM_IMAGE_CACHE"); + if (s) _elm_config->image_cache = atoi(s); + + s = getenv("ELM_FONT_CACHE"); + if (s) _elm_config->font_cache = atoi(s); + + s = getenv("ELM_SCALE"); + if (s) _elm_config->scale = atof(s); + + s = getenv("ELM_FINGER_SIZE"); + if (s) _elm_config->finger_size = atoi(s); + + s = getenv("ELM_PASSWORD_SHOW_LAST"); + if (s) _elm_config->password_show_last = !!atoi(s); + + s = getenv("ELM_PASSWORD_SHOW_LAST_TIMEOUT"); + if (s) + { + double pw_show_last_timeout = atof(s); + if (pw_show_last_timeout >= 0.0) + _elm_config->password_show_last_timeout = pw_show_last_timeout; + } + + s = getenv("ELM_FPS"); + if (s) _elm_config->fps = atof(s); + if (_elm_config->fps < 1.0) _elm_config->fps = 1.0; + + s = getenv("ELM_MODULES"); + if (s) eina_stringshare_replace(&_elm_config->modules, s); + + /* Get RTL orientation from system */ + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALE_DIR); + _elm_config->is_mirrored = !strcmp(E_("default:LTR"), "default:RTL"); + + s = getenv("ELM_TOOLTIP_DELAY"); + if (s) + { + double delay = atof(s); + if (delay >= 0.0) + _elm_config->tooltip_delay = delay; + } + + s = getenv("ELM_CURSOR_ENGINE_ONLY"); + if (s) _elm_config->cursor_engine_only = !!atoi(s); + + s = getenv("ELM_FOCUS_HIGHLIGHT_ENABLE"); + if (s) _elm_config->focus_highlight_enable = !!atoi(s); + + s = getenv("ELM_FOCUS_HIGHLIGHT_ANIMATE"); + if (s) _elm_config->focus_highlight_animate = !!atoi(s); + + s = getenv("ELM_TOOLBAR_SHRINK_MODE"); + if (s) _elm_config->toolbar_shrink_mode = atoi(s); + + s = getenv("ELM_FILESELECTOR_EXPAND_ENABLE"); + if (s) _elm_config->fileselector_expand_enable = !!atoi(s); + + s = getenv("ELM_INWIN_DIALOGS_ENABLE"); + if (s) _elm_config->inwin_dialogs_enable = !!atoi(s); + + s = getenv("ELM_ICON_SIZE"); + if (s) _elm_config->icon_size = atoi(s); + + s = getenv("ELM_LONGPRESS_TIMEOUT"); + if (s) _elm_config->longpress_timeout = atof(s); + if (_elm_config->longpress_timeout < 0.0) + _elm_config->longpress_timeout = 0.0; + + s = getenv("ELM_EFFECT_ENABLE"); + if (s) _elm_config->effect_enable = !!atoi(s); + + s = getenv("ELM_DESKTOP_ENTRY"); + if (s) _elm_config->desktop_entry = !!atoi(s); + s = getenv("ELM_ACCESS_MODE"); + if (s) _elm_config->access_mode = ELM_ACCESS_MODE_ON; +} + +EAPI Eina_Bool +elm_config_mirrored_get(void) +{ + return _elm_config->is_mirrored; +} + +EAPI void +elm_config_mirrored_set(Eina_Bool mirrored) +{ + _elm_config->is_mirrored = mirrored; + _elm_rescale(); +} + +EAPI Eina_Bool +elm_config_cursor_engine_only_get(void) +{ + return _elm_config->cursor_engine_only; +} + +EAPI void +elm_config_cursor_engine_only_set(Eina_Bool engine_only) +{ + engine_only = !!engine_only; + _elm_config->cursor_engine_only = engine_only; +} + +EAPI double +elm_config_tooltip_delay_get(void) +{ + return _elm_config->tooltip_delay; +} + +EAPI void +elm_config_tooltip_delay_set(double delay) +{ + if (delay < 0.0) return; + _elm_config->tooltip_delay = delay; +} + +EAPI double +elm_config_scale_get(void) +{ + return _elm_config->scale; +} + +EAPI void +elm_config_scale_set(double scale) +{ + if (_elm_config->scale == scale) return; + _elm_config->scale = scale; + _elm_rescale(); +} + +EAPI Eina_Bool +elm_config_password_show_last_get(void) +{ + return _elm_config->password_show_last; +} + +EAPI void +elm_config_password_show_last_set(Eina_Bool password_show_last) +{ + if (_elm_config->password_show_last == password_show_last) return; + _elm_config->password_show_last = password_show_last; + edje_password_show_last_set(_elm_config->password_show_last); +} + +EAPI double +elm_config_password_show_last_timeout_get(void) +{ + return _elm_config->password_show_last_timeout; +} + +EAPI void +elm_config_password_show_last_timeout_set(double password_show_last_timeout) +{ + if (_elm_config->password_show_last_timeout == password_show_last_timeout) return; + _elm_config->password_show_last_timeout = password_show_last_timeout; + edje_password_show_last_timeout_set(_elm_config->password_show_last_timeout); +} + +EAPI Eina_Bool +elm_config_save(void) +{ + return _elm_config_save(); +} + +EAPI void +elm_config_reload(void) +{ + _elm_config_reload(); +} + +EAPI const char * +elm_config_profile_get(void) +{ + return _elm_config_current_profile_get(); +} + +EAPI const char * +elm_config_profile_dir_get(const char *profile, + Eina_Bool is_user) +{ + return _elm_config_profile_dir_get(profile, is_user); +} + +EAPI void +elm_config_profile_dir_free(const char *p_dir) +{ + free((void *)p_dir); +} + +EAPI Eina_List * +elm_config_profile_list_get(void) +{ + return _elm_config_profiles_list(); +} + +EAPI void +elm_config_profile_list_free(Eina_List *l) +{ + const char *dir; + + EINA_LIST_FREE(l, dir) + eina_stringshare_del(dir); +} + +EAPI void +elm_config_profile_set(const char *profile) +{ + EINA_SAFETY_ON_NULL_RETURN(profile); + _elm_config_profile_set(profile); +} + +EAPI const char * +elm_config_engine_get(void) +{ + return _elm_config->engine; +} + +EAPI void +elm_config_engine_set(const char *engine) +{ + EINA_SAFETY_ON_NULL_RETURN(engine); + + _elm_config_engine_set(engine); +} + +EAPI Eina_List * +elm_config_text_classes_list_get(void) +{ + return _elm_config_text_classes_get(); +} + +EAPI void +elm_config_text_classes_list_free(Eina_List *list) +{ + _elm_config_text_classes_free(list); +} + +EAPI const Eina_List * +elm_config_font_overlay_list_get(void) +{ + return _elm_config_font_overlays_list(); +} + +EAPI void +elm_config_font_overlay_set(const char *text_class, + const char *font, + Evas_Font_Size size) +{ + EINA_SAFETY_ON_NULL_RETURN(text_class); + _elm_config_font_overlay_set(text_class, font, size); +} + +EAPI void +elm_config_font_overlay_unset(const char *text_class) +{ + EINA_SAFETY_ON_NULL_RETURN(text_class); + _elm_config_font_overlay_remove(text_class); +} + +EAPI void +elm_config_font_overlay_apply(void) +{ + _elm_config_font_overlay_apply(); +} + +EAPI Evas_Coord +elm_config_finger_size_get(void) +{ + return _elm_config->finger_size; +} + +EAPI void +elm_config_finger_size_set(Evas_Coord size) +{ + if (_elm_config->finger_size == size) return; + _elm_config->finger_size = size; + _elm_rescale(); +} + +EAPI int +elm_config_cache_flush_interval_get(void) +{ + return _elm_config->cache_flush_poll_interval; +} + +EAPI void +elm_config_cache_flush_interval_set(int size) +{ + if (_elm_config->cache_flush_poll_interval == size) return; + _elm_config->cache_flush_poll_interval = size; + + _elm_recache(); +} + +EAPI Eina_Bool +elm_config_cache_flush_enabled_get(void) +{ + return _elm_config->cache_flush_enable; +} + +EAPI void +elm_config_cache_flush_enabled_set(Eina_Bool enabled) +{ + enabled = !!enabled; + if (_elm_config->cache_flush_enable == enabled) return; + _elm_config->cache_flush_enable = enabled; + + _elm_recache(); +} + +EAPI int +elm_config_cache_font_cache_size_get(void) +{ + return _elm_config->font_cache; +} + +EAPI void +elm_config_cache_font_cache_size_set(int size) +{ + if (_elm_config->font_cache == size) return; + _elm_config->font_cache = size; + + _elm_recache(); +} + +EAPI int +elm_config_cache_image_cache_size_get(void) +{ + return _elm_config->image_cache; +} + +EAPI void +elm_config_cache_image_cache_size_set(int size) +{ + if (_elm_config->image_cache == size) return; + _elm_config->image_cache = size; + + _elm_recache(); +} + +EAPI int +elm_config_cache_edje_file_cache_size_get() +{ + return _elm_config->edje_cache; +} + +EAPI void +elm_config_cache_edje_file_cache_size_set(int size) +{ + if (_elm_config->edje_cache == size) return; + _elm_config->edje_cache = size; + + _elm_recache(); +} + +EAPI int +elm_config_cache_edje_collection_cache_size_get(void) +{ + return _elm_config->edje_collection_cache; +} + +EAPI void +elm_config_cache_edje_collection_cache_size_set(int size) +{ + if (_elm_config->edje_collection_cache == size) return; + _elm_config->edje_collection_cache = size; + + _elm_recache(); +} + +EAPI Eina_Bool +elm_config_focus_highlight_enabled_get(void) +{ + return _elm_config->focus_highlight_enable; +} + +EAPI void +elm_config_focus_highlight_enabled_set(Eina_Bool enable) +{ + _elm_config->focus_highlight_enable = !!enable; +} + +EAPI Eina_Bool +elm_config_focus_highlight_animate_get(void) +{ + return _elm_config->focus_highlight_animate; +} + +EAPI void +elm_config_focus_highlight_animate_set(Eina_Bool animate) +{ + _elm_config->focus_highlight_animate = !!animate; +} + +EAPI Eina_Bool +elm_config_scroll_bounce_enabled_get(void) +{ + return _elm_config->thumbscroll_bounce_enable; +} + +EAPI void +elm_config_scroll_bounce_enabled_set(Eina_Bool enabled) +{ + _elm_config->thumbscroll_bounce_enable = enabled; +} + +EAPI double +elm_config_scroll_bounce_friction_get(void) +{ + return _elm_config->thumbscroll_bounce_friction; +} + +EAPI void +elm_config_scroll_bounce_friction_set(double friction) +{ + _elm_config->thumbscroll_bounce_friction = friction; +} + +EAPI double +elm_config_scroll_page_scroll_friction_get(void) +{ + return _elm_config->page_scroll_friction; +} + +EAPI void +elm_config_scroll_page_scroll_friction_set(double friction) +{ + _elm_config->page_scroll_friction = friction; +} + +EAPI double +elm_config_scroll_bring_in_scroll_friction_get(void) +{ + return _elm_config->bring_in_scroll_friction; +} + +EAPI void +elm_config_scroll_bring_in_scroll_friction_set(double friction) +{ + _elm_config->bring_in_scroll_friction = friction; +} + +EAPI double +elm_config_scroll_zoom_friction_get(void) +{ + return _elm_config->zoom_friction; +} + +EAPI void +elm_config_scroll_zoom_friction_set(double friction) +{ + _elm_config->zoom_friction = friction; +} + +EAPI Eina_Bool +elm_config_scroll_thumbscroll_enabled_get(void) +{ + return _elm_config->thumbscroll_enable; +} + +EAPI void +elm_config_scroll_thumbscroll_enabled_set(Eina_Bool enabled) +{ + _elm_config->thumbscroll_enable = enabled; +} + +EAPI unsigned int +elm_config_scroll_thumbscroll_threshold_get(void) +{ + return _elm_config->thumbscroll_threshold; +} + +EAPI void +elm_config_scroll_thumbscroll_threshold_set(unsigned int threshold) +{ + _elm_config->thumbscroll_threshold = threshold; +} + +EAPI double +elm_config_scroll_thumbscroll_momentum_threshold_get(void) +{ + return _elm_config->thumbscroll_momentum_threshold; +} + +EAPI void +elm_config_scroll_thumbscroll_momentum_threshold_set(double threshold) +{ + _elm_config->thumbscroll_momentum_threshold = threshold; +} + +EAPI double +elm_config_scroll_thumbscroll_friction_get(void) +{ + return _elm_config->thumbscroll_friction; +} + +EAPI void +elm_config_scroll_thumbscroll_friction_set(double friction) +{ + _elm_config->thumbscroll_friction = friction; +} + +EAPI double +elm_config_scroll_thumbscroll_border_friction_get(void) +{ + return _elm_config->thumbscroll_border_friction; +} + +EAPI void +elm_config_scroll_thumbscroll_border_friction_set(double friction) +{ + if (friction < 0.0) friction = 0.0; + if (friction > 1.0) friction = 1.0; + _elm_config->thumbscroll_border_friction = friction; +} + +EAPI double +elm_config_scroll_thumbscroll_sensitivity_friction_get(void) +{ + return _elm_config->thumbscroll_sensitivity_friction; +} + +EAPI void +elm_config_scroll_thumbscroll_sensitivity_friction_set(double friction) +{ + if (friction < 0.1) friction = 0.1; + if (friction > 1.0) friction = 1.0; + _elm_config->thumbscroll_sensitivity_friction = friction; +} + +EAPI void +elm_config_longpress_timeout_set(double longpress_timeout) +{ + _elm_config->longpress_timeout = longpress_timeout; +} + +EAPI double +elm_config_longpress_timeout_get(void) +{ + return _elm_config->longpress_timeout; +} + +EAPI void +elm_config_all_flush(void) +{ +#ifdef HAVE_ELEMENTARY_X + if (_prop_all_update_timer) ecore_timer_del(_prop_all_update_timer); + _prop_all_update_timer = ecore_timer_add(0.1, _prop_all_update_cb, NULL); +#endif +} + +static void +_translation_init() +{ +#ifdef ENABLE_NLS + const char *cur_dom = textdomain(NULL); + const char *trans_comment = gettext(""); + const char *msg_locale = setlocale(LC_MESSAGES, NULL); + + /* Same concept as what glib does: + * We shouldn't translate if there are no translations for the + * application in the current locale + domain. (Unless locale is + * en_/C where translating only parts of the interface make some + * sense). + */ + _elm_config->translate = !(strcmp (cur_dom, "messages") && + !*trans_comment && strncmp (msg_locale, "en_", 3) && + strcmp (msg_locale, "C")); +#endif +} + +void +_elm_config_init(void) +{ + if (!ELM_EVENT_CONFIG_ALL_CHANGED) + ELM_EVENT_CONFIG_ALL_CHANGED = ecore_event_type_new(); + _desc_init(); + _profile_fetch_from_conf(); + _config_load(); + _env_get(); + if (_elm_preferred_engine) eina_stringshare_del(_elm_preferred_engine); + if (_elm_config->engine) + _elm_preferred_engine = eina_stringshare_add(_elm_config->engine); + else + _elm_preferred_engine = NULL; + _translation_init(); + _config_apply(); + _elm_config_font_overlay_apply(); + _elm_recache(); +} + +void +_elm_config_sub_shutdown(void) +{ +#define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name)) + if (ENGINE_COMPARE(ELM_SOFTWARE_X11) || + ENGINE_COMPARE(ELM_SOFTWARE_16_X11) || + ENGINE_COMPARE(ELM_XRENDER_X11) || + ENGINE_COMPARE(ELM_OPENGL_X11) || + ENGINE_COMPARE(ELM_OPENGL_COCOA)) +#undef ENGINE_COMPARE + { +#ifdef HAVE_ELEMENTARY_X + ecore_x_disconnect(); +#endif + } +} + +void +_elm_config_sub_init(void) +{ +#define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name)) + if (ENGINE_COMPARE(ELM_SOFTWARE_X11) || + ENGINE_COMPARE(ELM_SOFTWARE_16_X11) || + ENGINE_COMPARE(ELM_XRENDER_X11) || + ENGINE_COMPARE(ELM_OPENGL_X11) || + ENGINE_COMPARE(ELM_OPENGL_COCOA)) +#undef ENGINE_COMPARE + { +#ifdef HAVE_ELEMENTARY_X + if (!ecore_x_init(NULL)) + { + ERR("Cannot connect to X11 display. check $DISPLAY variable"); + exit(1); + } + _root_1st = ecore_x_window_root_first_get(); + + if (!ecore_x_screen_is_composited(0)) + _elm_config->compositing = 0; + + ecore_x_atoms_get(_atom_names, ATOM_COUNT, _atom); + ecore_x_event_mask_set(_root_1st, + ECORE_X_EVENT_MASK_WINDOW_PROPERTY); + _prop_change_handler = ecore_event_handler_add + (ECORE_X_EVENT_WINDOW_PROPERTY, _prop_change, NULL); + if (!getenv("ELM_PROFILE")) + { + char *s; + + s = ecore_x_window_prop_string_get(_root_1st, + _atom[ATOM_E_PROFILE]); + if (s) + { + int changed = 0; + + if (_elm_profile) + { + if (strcmp(_elm_profile, s)) changed = 1; + free(_elm_profile); + } + _elm_profile = s; + if (changed) _prop_config_get(); + } + } +#endif + } + _config_sub_apply(); +} + +void +_elm_config_reload(void) +{ + _config_free(); + _config_load(); + _config_apply(); + _elm_config_font_overlay_apply(); + _elm_rescale(); + _elm_recache(); +} + +void +_elm_config_engine_set(const char *engine) +{ + if (_elm_config->engine && strcmp(_elm_config->engine, engine)) + eina_stringshare_del(_elm_config->engine); + + _elm_config->engine = eina_stringshare_add(engine); +} + +EAPI const char * +elm_config_preferred_engine_get(void) +{ + return _elm_preferred_engine; +} + +EAPI void +elm_config_preferred_engine_set(const char *engine) +{ + if (engine) + eina_stringshare_replace(&(_elm_preferred_engine), engine); + else + { + if (_elm_preferred_engine) eina_stringshare_del(_elm_preferred_engine); + _elm_preferred_engine = eina_stringshare_add(_elm_config->engine); + } +} + +void +_elm_config_profile_set(const char *profile) +{ + Eina_Bool changed = EINA_FALSE; + + if (_elm_profile) + { + if (strcmp(_elm_profile, profile)) + changed = 1; + free(_elm_profile); + } + + _elm_profile = strdup(profile); + + if (changed) + { + _config_free(); + _config_load(); + _config_apply(); + _elm_config_font_overlay_apply(); + _elm_rescale(); + _elm_recache(); + } +} + +void +_elm_config_shutdown(void) +{ +#ifdef HAVE_ELEMENTARY_X + if (_prop_all_update_timer) + { + ecore_timer_del(_prop_all_update_timer); + _prop_all_update_timer = NULL; + _prop_all_update_cb(NULL); + } + if (_prop_change_delay_timer) ecore_timer_del(_prop_change_delay_timer); + _prop_change_delay_timer = NULL; +#endif + +#define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name)) + if (ENGINE_COMPARE(ELM_SOFTWARE_X11) || + ENGINE_COMPARE(ELM_SOFTWARE_16_X11) || + ENGINE_COMPARE(ELM_XRENDER_X11) || + ENGINE_COMPARE(ELM_OPENGL_X11)) +#undef ENGINE_COMPARE + { +#ifdef HAVE_ELEMENTARY_X + ecore_event_handler_del(_prop_change_handler); + _prop_change_handler = NULL; +#endif + } + _config_free(); + if (_elm_preferred_engine) + { + eina_stringshare_del(_elm_preferred_engine); + _elm_preferred_engine = NULL; + } + if (_elm_profile) + { + free(_elm_profile); + _elm_profile = NULL; + } + _desc_shutdown(); +} + diff --git a/libraries/elementary/src/lib/elm_config.h b/libraries/elementary/src/lib/elm_config.h new file mode 100644 index 0000000..413eab8 --- /dev/null +++ b/libraries/elementary/src/lib/elm_config.h @@ -0,0 +1,948 @@ +/** + * @defgroup Config Elementary Config + * @ingroup Elementary + * + * Elementary configuration is formed by a set options bounded to a + * given @ref Profile profile, like @ref Theme theme, @ref Fingers + * "finger size", etc. These are functions with which one synchronizes + * changes made to those values to the configuration storing files, de + * facto. You most probably don't want to use the functions in this + * group unless you're writing an elementary configuration manager. + * + * @{ + */ + +/** + * Save back Elementary's configuration, so that it will persist on + * future sessions. + * + * @return @c EINA_TRUE, when successful. @c EINA_FALSE, otherwise. + * @ingroup Config + * + * This function will take effect -- thus, do I/O -- immediately. Use + * it when you want to save all configuration changes at once. The + * current configuration set will get saved onto the current profile + * configuration file. + * + */ +EAPI Eina_Bool elm_config_save(void); + +/** + * Reload Elementary's configuration, bounded to current selected + * profile. + * + * @return @c EINA_TRUE, when successful. @c EINA_FALSE, otherwise. + * @ingroup Config + * + * Useful when you want to force reloading of configuration values for + * a profile. If one removes user custom configuration directories, + * for example, it will force a reload with system values instead. + * + */ +EAPI void elm_config_reload(void); + +/** + * Flush all config settings then apply those settings to all applications + * using elementary on the current display. + * + * @ingroup Config + */ +EAPI void elm_config_all_flush(void); + +/** + * @} + */ + +/** + * @defgroup Profile Elementary Profile + * @ingroup Elementary + * + * Profiles are pre-set options that affect the whole look-and-feel of + * Elementary-based applications. There are, for example, profiles + * aimed at desktop computer applications and others aimed at mobile, + * touchscreen-based ones. You most probably don't want to use the + * functions in this group unless you're writing an elementary + * configuration manager. + * + * @{ + */ + +/** + * Get Elementary's profile in use. + * + * This gets the global profile that is applied to all Elementary + * applications. + * + * @return The profile's name + * @ingroup Profile + */ +EAPI const char *elm_config_profile_get(void); + +/** + * Get an Elementary's profile directory path in the filesystem. One + * may want to fetch a system profile's dir or a user one (fetched + * inside $HOME). + * + * @param profile The profile's name + * @param is_user Whether to lookup for a user profile (@c EINA_TRUE) + * or a system one (@c EINA_FALSE) + * @return The profile's directory path. + * @ingroup Profile + * + * @note You must free it with elm_config_profile_dir_free(). + */ +EAPI const char *elm_config_profile_dir_get(const char *profile, Eina_Bool is_user); + +/** + * Free an Elementary's profile directory path, as returned by + * elm_config_profile_dir_get(). + * + * @param p_dir The profile's path + * @ingroup Profile + * + */ +EAPI void elm_config_profile_dir_free(const char *p_dir); + +/** + * Get Elementary's list of available profiles. + * + * @return The profiles list. List node data are the profile name + * strings. + * @ingroup Profile + * + * @note One must free this list, after usage, with the function + * elm_config_profile_list_free(). + */ +EAPI Eina_List *elm_config_profile_list_get(void); + +/** + * Free Elementary's list of available profiles. + * + * @param l The profiles list, as returned by elm_config_profile_list_get(). + * @ingroup Profile + * + */ +EAPI void elm_config_profile_list_free(Eina_List *l); + +/** + * Set Elementary's profile. + * + * This sets the global profile that is applied to Elementary + * applications. Just the process the call comes from will be + * affected. + * + * @param profile The profile's name + * @ingroup Profile + * + */ +EAPI void elm_config_profile_set(const char *profile); + +/** + * @} + */ + +/** + * @defgroup Scrolling Elementary Scrolling + * @ingroup Elementary + * + * These are functions setting how scrollable views in Elementary + * widgets should behave on user interaction. + * + * @{ + */ + +/** + * Get whether scrollers should bounce when they reach their + * viewport's edge during a scroll. + * + * @return the thumb scroll bouncing state + * + * This is the default behavior for touch screens, in general. + * @ingroup Scrolling + */ +EAPI Eina_Bool elm_config_scroll_bounce_enabled_get(void); + +/** + * Set whether scrollers should bounce when they reach their + * viewport's edge during a scroll. + * + * @param enabled the thumb scroll bouncing state + * + * @see elm_config_scroll_bounce_enabled_get() + * @ingroup Scrolling + */ +EAPI void elm_config_scroll_bounce_enabled_set(Eina_Bool enabled); + +/** + * Get the amount of inertia a scroller will impose at bounce + * animations. + * + * @return the thumb scroll bounce friction + * + * @ingroup Scrolling + */ +EAPI double elm_config_scroll_bounce_friction_get(void); + +/** + * Set the amount of inertia a scroller will impose at bounce + * animations. + * + * @param friction the thumb scroll bounce friction + * + * @see elm_config_scroll_bounce_friction_get() + * @ingroup Scrolling + */ +EAPI void elm_config_scroll_bounce_friction_set(double friction); + +/** + * Get the amount of inertia a paged scroller will impose at + * page fitting animations. + * + * @return the page scroll friction + * + * @ingroup Scrolling + */ +EAPI double elm_config_scroll_page_scroll_friction_get(void); + +/** + * Set the amount of inertia a paged scroller will impose at + * page fitting animations. + * + * @param friction the page scroll friction + * + * @see elm_config_scroll_page_scroll_friction_get() + * @ingroup Scrolling + */ +EAPI void elm_config_scroll_page_scroll_friction_set(double friction); + +/** + * Get the amount of inertia a scroller will impose at region bring + * animations. + * + * @return the bring in scroll friction + * + * @ingroup Scrolling + */ +EAPI double elm_config_scroll_bring_in_scroll_friction_get(void); + +/** + * Set the amount of inertia a scroller will impose at region bring + * animations. + * + * @param friction the bring in scroll friction + * + * @see elm_config_scroll_bring_in_scroll_friction_get() + * @ingroup Scrolling + */ +EAPI void elm_config_scroll_bring_in_scroll_friction_set(double friction); + +/** + * Get the amount of inertia scrollers will impose at animations + * triggered by Elementary widgets' zooming API. + * + * @return the zoom friction + * + * @ingroup Scrolling + */ +EAPI double elm_config_scroll_zoom_friction_get(void); + +/** + * Set the amount of inertia scrollers will impose at animations + * triggered by Elementary widgets' zooming API. + * + * @param friction the zoom friction + * + * @see elm_config_scroll_zoom_friction_get() + * @ingroup Scrolling + */ +EAPI void elm_config_scroll_zoom_friction_set(double friction); + +/** + * Get whether scrollers should be draggable from any point in their + * views. + * + * @return the thumb scroll state + * + * @note This is the default behavior for touch screens, in general. + * @note All other functions namespaced with "thumbscroll" will only + * have effect if this mode is enabled. + * + * @ingroup Scrolling + */ +EAPI Eina_Bool elm_config_scroll_thumbscroll_enabled_get(void); + +/** + * Set whether scrollers should be draggable from any point in their + * views. + * + * @param enabled the thumb scroll state + * + * @see elm_config_scroll_thumbscroll_enabled_get() + * @ingroup Scrolling + */ +EAPI void elm_config_scroll_thumbscroll_enabled_set(Eina_Bool enabled); + +/** + * Get the number of pixels one should travel while dragging a + * scroller's view to actually trigger scrolling. + * + * @return the thumb scroll threshold + * + * One would use higher values for touch screens, in general, because + * of their inherent imprecision. + * @ingroup Scrolling + */ +EAPI unsigned int elm_config_scroll_thumbscroll_threshold_get(void); + +/** + * Set the number of pixels one should travel while dragging a + * scroller's view to actually trigger scrolling. + * + * @param threshold the thumb scroll threshold + * + * @see elm_config_thumbscroll_threshold_get() + * @ingroup Scrolling + */ +EAPI void elm_config_scroll_thumbscroll_threshold_set(unsigned int threshold); + +/** + * Get the minimum speed of mouse cursor movement which will trigger + * list self scrolling animation after a mouse up event + * (pixels/second). + * + * @return the thumb scroll momentum threshold + * + * @ingroup Scrolling + */ +EAPI double elm_config_scroll_thumbscroll_momentum_threshold_get(void); + +/** + * Set the minimum speed of mouse cursor movement which will trigger + * list self scrolling animation after a mouse up event + * (pixels/second). + * + * @param threshold the thumb scroll momentum threshold + * + * @see elm_config_thumbscroll_momentum_threshold_get() + * @ingroup Scrolling + */ +EAPI void elm_config_scroll_thumbscroll_momentum_threshold_set(double threshold); + +/** + * Get the amount of inertia a scroller will impose at self scrolling + * animations. + * + * @return the thumb scroll friction + * + * @ingroup Scrolling + */ +EAPI double elm_config_scroll_thumbscroll_friction_get(void); + +/** + * Set the amount of inertia a scroller will impose at self scrolling + * animations. + * + * @param friction the thumb scroll friction + * + * @see elm_config_thumbscroll_friction_get() + * @ingroup Scrolling + */ +EAPI void elm_config_scroll_thumbscroll_friction_set(double friction); + +/** + * Get the amount of lag between your actual mouse cursor dragging + * movement and a scroller's view movement itself, while pushing it + * into bounce state manually. + * + * @return the thumb scroll border friction + * + * @ingroup Scrolling + */ +EAPI double elm_config_scroll_thumbscroll_border_friction_get(void); + +/** + * Set the amount of lag between your actual mouse cursor dragging + * movement and a scroller's view movement itself, while pushing it + * into bounce state manually. + * + * @param friction the thumb scroll border friction. @c 0.0 for + * perfect synchrony between two movements, @c 1.0 for maximum + * lag. + * + * @see elm_config_thumbscroll_border_friction_get() + * @note parameter value will get bound to 0.0 - 1.0 interval, always + * + * @ingroup Scrolling + */ +EAPI void elm_config_scroll_thumbscroll_border_friction_set(double friction); + +/** + * Get the sensitivity amount which is be multiplied by the length of + * mouse dragging. + * + * @return the thumb scroll sensitivity friction + * + * @ingroup Scrolling + */ +EAPI double elm_config_scroll_thumbscroll_sensitivity_friction_get(void); + +/** + * Set the sensitivity amount which is be multiplied by the length of + * mouse dragging. + * + * @param friction the thumb scroll sensitivity friction. @c 0.1 for + * minimum sensitivity, @c 1.0 for maximum sensitivity. 0.25 + * is proper. + * + * @see elm_config_thumbscroll_sensitivity_friction_get() + * @note parameter value will get bound to 0.1 - 1.0 interval, always + * + * @ingroup Scrolling + */ +EAPI void elm_config_scroll_thumbscroll_sensitivity_friction_set(double friction); + +/** + * @} + */ + +/** + * Get the duration for occurring long press event. + * + * @return Timeout for long press event + * @ingroup Longpress + */ +EAPI double elm_config_longpress_timeout_get(void); + +/** + * Set the duration for occurring long press event. + * + * @param lonpress_timeout Timeout for long press event + * @ingroup Longpress + */ +EAPI void elm_config_longpress_timeout_set(double longpress_timeout); + +/** + * Get the duration after which tooltip will be shown. + * + * @return Duration after which tooltip will be shown. + */ +EAPI double elm_config_tooltip_delay_get(void); + +/** + * Set the duration after which tooltip will be shown. + * + * @return EINA_TRUE if value is set. + */ +EAPI void elm_config_tooltip_delay_set(double delay); + +/** + * Get the configured cursor engine only usage + * + * This gets the globally configured exclusive usage of engine cursors. + * + * @return 1 if only engine cursors should be used + * @ingroup Cursors + */ +EAPI Eina_Bool elm_config_cursor_engine_only_get(void); + +/** + * Set the configured cursor engine only usage + * + * This sets the globally configured exclusive usage of engine cursors. + * It won't affect cursors set before changing this value. + * + * @param engine_only If 1 only engine cursors will be enabled, if 0 will + * look for them on theme before. + * @ingroup Cursors + */ +EAPI void elm_config_cursor_engine_only_set(Eina_Bool engine_only); + +/** + * Get the global scaling factor + * + * This gets the globally configured scaling factor that is applied to all + * objects. + * + * @return The scaling factor + * @ingroup Scaling + */ +EAPI double elm_config_scale_get(void); + +/** + * Set the global scaling factor + * + * This sets the globally configured scaling factor that is applied to all + * objects. + * + * @param scale The scaling factor to set + * @ingroup Scaling + */ +EAPI void elm_config_scale_set(double scale); + +/** + * @defgroup Password_last_show Password show last + * @ingroup Elementary + * + * Show last feature of password mode enables user to view + * the last input entered for few seconds before masking it. + * These functions allow to set this feature in password mode + * of entry widget and also allow to manipulate the duration + * for which the input has to be visible. + * + * @{ + */ + +/** + * Get the "show last" setting of password mode. + * + * This gets the "show last" setting of password mode which might be + * enabled or disabled. + * + * @return @c EINA_TRUE, if the "show last" setting is enabled, + * @c EINA_FALSE if it's disabled. + * + * @ingroup Password_last_show + */ +EAPI Eina_Bool elm_config_password_show_last_get(void); + +/** + * Set show last setting in password mode. + * + * This enables or disables show last setting of password mode. + * + * @param password_show_last If EINA_TRUE enables "show last" in password mode. + * @see elm_config_password_show_last_timeout_set() + * @ingroup Password_last_show + */ +EAPI void elm_config_password_show_last_set(Eina_Bool password_show_last); + +/** + * Gets the timeout value in "show last" password mode. + * + * This gets the time out value for which the last input entered in password + * mode will be visible. + * + * @return The timeout value of "show last" password mode. + * @ingroup Password_last_show + */ +EAPI double elm_config_password_show_last_timeout_get(void); + +/** + * Set's the timeout value in "show last" password mode. + * + * This sets the time out value for which the last input entered in password + * mode will be visible. + * + * @param password_show_last_timeout The timeout value. + * @see elm_config_password_show_last_set() + * @ingroup Password_last_show + */ +EAPI void elm_config_password_show_last_timeout_set(double password_show_last_timeout); + +/** + * @} + */ + +/** + * @defgroup Engine Elementary Engine + * @ingroup Elementary + * + * These are functions setting and querying which rendering engine + * Elementary will use for drawing its windows' pixels. + * + * The following are the available engines: + * @li "software_x11" + * @li "fb" + * @li "directfb" + * @li "software_16_x11" + * @li "software_8_x11" + * @li "xrender_x11" + * @li "opengl_x11" + * @li "software_gdi" + * @li "software_16_wince_gdi" + * @li "sdl" + * @li "software_16_sdl" + * @li "opengl_sdl" + * @li "buffer" + * @li "ews" + * @li "opengl_cocoa" + * @li "psl1ght" + * + * @{ + */ + +/** + * @brief Get Elementary's rendering engine in use. + * + * @return The rendering engine's name + * @note there's no need to free the returned string, here. + * + * This gets the global rendering engine that is applied to all Elementary + * applications. + * + * @see elm_config_engine_set() + */ +EAPI const char *elm_config_engine_get(void); + +/** + * @brief Set Elementary's rendering engine for use. + * + * @param engine The rendering engine's name + * + * Note that it will take effect only to Elementary windows created after + * this is called. + * + * @see elm_win_add() + */ +EAPI void elm_config_engine_set(const char *engine); + +/** + * @brief Get Elementary's preferred engine to use. + * + * @return The rendering engine's name + * @note there's no need to free the returned string, here. + * + * This gets the global rendering engine that is applied to all Elementary + * applications and is PREFERRED by the application. This can (and will) + * override the engine configured for all applications which. + * + * @see elm_config_preferred_engine_set() + */ +EAPI const char *elm_config_preferred_engine_get(void); + +/** + * @brief Set Elementary's preferred rendering engine for use. + * + * @param engine The rendering engine's name + * + * Note that it will take effect only to Elementary windows created after + * this is called. This overrides the engine set by configuration at + * application startup. Note that it is a hint and may not be honored. + * + * @see elm_win_add() + */ +EAPI void elm_config_preferred_engine_set(const char *engine); + +typedef struct _Elm_Text_Class +{ + const char *name; + const char *desc; +} Elm_Text_Class; + +typedef struct _Elm_Font_Overlay +{ + const char *text_class; + const char *font; + Evas_Font_Size size; +} Elm_Font_Overlay; + +/** + * Get Elementary's list of supported text classes. + * + * @return The text classes list, with @c Elm_Text_Class blobs as data. + * @ingroup Fonts + * + * Release the list with elm_text_classes_list_free(). + */ +EAPI Eina_List *elm_config_text_classes_list_get(void); + +/** + * Free Elementary's list of supported text classes. + * + * @ingroup Fonts + * + * @see elm_config_text_classes_list_get(). + */ +EAPI void elm_config_text_classes_list_free(Eina_List *list); + +/** + * Get Elementary's list of font overlays, set with + * elm_config_font_overlay_set(). + * + * @return The font overlays list, with @c Elm_Font_Overlay blobs as + * data. + * + * @ingroup Fonts + * + * For each text class, one can set a font overlay for it, + * overriding the default font properties for that class coming from + * the theme in use. There is no need to free this list. + * + * @see elm_config_font_overlay_set() and elm_config_font_overlay_unset(). + */ +EAPI const Eina_List *elm_config_font_overlay_list_get(void); + +/** + * Set a font overlay for a given Elementary text class. + * + * @param text_class Text class name + * @param font Font name and style string + * @param size Font size + * + * @ingroup Fonts + * + * @p font has to be in the format returned by + * elm_font_fontconfig_name_get(). @see elm_config_font_overlay_list_get() + * and elm_config_font_overlay_unset(). + */ +EAPI void elm_config_font_overlay_set(const char *text_class, const char *font, Evas_Font_Size size); + +/** + * Unset a font overlay for a given Elementary text class. + * + * @param text_class Text class name + * + * @ingroup Fonts + * + * This will bring back text elements belonging to text class + * @p text_class back to their default font settings. + */ +EAPI void elm_config_font_overlay_unset(const char *text_class); + +/** + * Apply the changes made with elm_config_font_overlay_set() and + * elm_config_font_overlay_unset() on the current Elementary window. + * + * @ingroup Fonts + * + * This applies all font overlays set to all objects in the UI. + */ +EAPI void elm_config_font_overlay_apply(void); + +/** + * Get the configured "finger size" + * + * @return The finger size + * + * This gets the globally configured finger size, in pixels + * + * @ingroup Fingers + */ +EAPI Evas_Coord elm_config_finger_size_get(void); + +/** + * Set the configured finger size + * + * This sets the globally configured finger size in pixels + * + * @param size The finger size + * @ingroup Fingers + */ +EAPI void elm_config_finger_size_set(Evas_Coord size); + + +/** + * Get the configured cache flush interval time + * + * This gets the globally configured cache flush interval time, in + * ticks + * + * @return The cache flush interval time + * @ingroup Caches + * + * @see elm_cache_all_flush() + */ +EAPI int elm_config_cache_flush_interval_get(void); + +/** + * Set the configured cache flush interval time + * + * This sets the globally configured cache flush interval time, in ticks + * + * @param size The cache flush interval time + * @ingroup Caches + * + * @see elm_cache_all_flush() + */ +EAPI void elm_config_cache_flush_interval_set(int size); + +/** + * Get the configured cache flush enabled state + * + * This gets the globally configured cache flush state - if it is enabled + * or not. When cache flushing is enabled, elementary will regularly + * (see elm_config_cache_flush_interval_get() ) flush caches and dump data out of + * memory and allow usage to re-seed caches and data in memory where it + * can do so. An idle application will thus minimize its memory usage as + * data will be freed from memory and not be re-loaded as it is idle and + * not rendering or doing anything graphically right now. + * + * @return The cache flush state + * @ingroup Caches + * + * @see elm_cache_all_flush() + */ +EAPI Eina_Bool elm_config_cache_flush_enabled_get(void); + +/** + * Set the configured cache flush enabled state + * + * This sets the globally configured cache flush enabled state. + * + * @param enabled The cache flush enabled state + * @ingroup Caches + * + * @see elm_cache_all_flush() + */ +EAPI void elm_config_cache_flush_enabled_set(Eina_Bool enabled); + +/** + * Get the configured font cache size + * + * This gets the globally configured font cache size, in bytes. + * + * @return The font cache size + * @ingroup Caches + */ +EAPI int elm_config_cache_font_cache_size_get(void); + +/** + * Set the configured font cache size + * + * This sets the globally configured font cache size, in bytes + * + * @param size The font cache size + * @ingroup Caches + */ +EAPI void elm_config_cache_font_cache_size_set(int size); + +/** + * Get the configured image cache size + * + * This gets the globally configured image cache size, in bytes + * + * @return The image cache size + * @ingroup Caches + */ +EAPI int elm_config_cache_image_cache_size_get(void); + +/** + * Set the configured image cache size + * + * This sets the globally configured image cache size, in bytes + * + * @param size The image cache size + * @ingroup Caches + */ +EAPI void elm_config_cache_image_cache_size_set(int size); + + +/** + * Get the configured edje file cache size. + * + * This gets the globally configured edje file cache size, in number + * of files. + * + * @return The edje file cache size + * @ingroup Caches + */ +EAPI int elm_config_cache_edje_file_cache_size_get(void); + +/** + * Set the configured edje file cache size + * + * This sets the globally configured edje file cache size, in number + * of files. + * + * @param size The edje file cache size + * @ingroup Caches + */ +EAPI void elm_config_cache_edje_file_cache_size_set(int size); + +/** + * Get the configured edje collections (groups) cache size. + * + * This gets the globally configured edje collections cache size, in + * number of collections. + * + * @return The edje collections cache size + * @ingroup Caches + */ +EAPI int elm_config_cache_edje_collection_cache_size_get(void); + +/** + * Set the configured edje collections (groups) cache size + * + * This sets the globally configured edje collections cache size, in + * number of collections. + * + * @param size The edje collections cache size + * @ingroup Caches + */ +EAPI void elm_config_cache_edje_collection_cache_size_set(int size); + +/** + * Get the enable status of the focus highlight + * + * This gets whether the highlight on focused objects is enabled or not + * + * @see elm_config_focus_highlight_enabled_set() + * @ingroup Focus + */ +EAPI Eina_Bool elm_config_focus_highlight_enabled_get(void); + +/** + * Set the enable status of the focus highlight + * + * @param enable Enable highlight if EINA_TRUE, disable otherwise + * + * Set whether to show or not the highlight on focused objects + * + * Note that it will take effect only to Elementary windows created after + * this is called. + * + * @see elm_win_add() + * + * @ingroup Focus + */ +EAPI void elm_config_focus_highlight_enabled_set(Eina_Bool enable); + +/** + * Get the enable status of the highlight animation + * + * @return The focus highlight mode set + * + * Get whether the focus highlight, if enabled, will animate its switch from + * one object to the next + * + * @ingroup Focus + */ +EAPI Eina_Bool elm_config_focus_highlight_animate_get(void); + +/** + * Set the enable status of the highlight animation + * + * @param animate Enable animation if EINA_TRUE, disable otherwise + * + * Set whether the focus highlight, if enabled, will animate its switch from + * one object to the next + * + * Note that it will take effect only to Elementary windows created after + * this is called. + * + * @see elm_win_add() + * + * @ingroup Focus + */ +EAPI void elm_config_focus_highlight_animate_set(Eina_Bool animate); + +/** + * Get the system mirrored mode. This determines the default mirrored mode + * of widgets. + * + * @return EINA_TRUE if mirrored is set, EINA_FALSE otherwise + */ +EAPI Eina_Bool elm_config_mirrored_get(void); + +/** + * Set the system mirrored mode. This determines the default mirrored mode + * of widgets. + * + * @param mirrored EINA_TRUE to set mirrored mode, EINA_FALSE to unset it. + */ +EAPI void elm_config_mirrored_set(Eina_Bool mirrored); + +/** + * @} + */ + diff --git a/libraries/elementary/src/lib/elm_conform.c b/libraries/elementary/src/lib/elm_conform.c new file mode 100644 index 0000000..355341e --- /dev/null +++ b/libraries/elementary/src/lib/elm_conform.c @@ -0,0 +1,692 @@ +#include +#include "elm_priv.h" + +#ifndef MIN +# define MIN(a,b) ((a) < (b)) ? (a) : (b) +#endif + +#ifndef MAX +# define MAX(a,b) ((a) < (b)) ? (b) : (a) +#endif + +typedef struct _Widget_Data Widget_Data; +struct _Widget_Data +{ + Evas_Object *base; + Evas_Object *indicator; + Evas_Object *softkey; + Evas_Object *virtualkeypad; + Evas_Object *clipboard; + Evas_Object *content; + Evas_Object *scroller; +#ifdef HAVE_ELEMENTARY_X + Ecore_Event_Handler *prop_hdl; + Ecore_X_Virtual_Keyboard_State vkb_state; +#endif + struct + { + Ecore_Animator *animator; // animaton timer + double start; // time started + Evas_Coord auto_x, auto_y; // desired delta + Evas_Coord x, y; // current delta + } delta; + Ecore_Job *show_region_job; +}; + +/* Enum to identify conformant swallow parts */ +typedef enum _Conformant_Part_Type Conformant_Part_Type; +enum _Conformant_Part_Type +{ + ELM_CONFORM_INDICATOR_PART = 1, + ELM_CONFORM_SOFTKEY_PART = 2, + ELM_CONFORM_VIRTUAL_KEYPAD_PART = 4, + ELM_CONFORM_CLIPBOARD_PART = 8 +}; + +#ifdef HAVE_ELEMENTARY_X +#define SUB_TYPE_COUNT 2 +static char *sub_type[SUB_TYPE_COUNT] = { "scroller", "genlist" }; +#endif + +/* local function prototypes */ +static const char *widtype = NULL; +static void _del_pre_hook(Evas_Object *obj); +static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); +static void _theme_hook(Evas_Object *obj); +static void _content_set_hook(Evas_Object *obj, + const char *part, + Evas_Object *content); +static Evas_Object *_content_get_hook(const Evas_Object *obj, + const char *part); +static Evas_Object *_content_unset_hook(Evas_Object *obj, const char *part); +static void _swallow_conformant_parts(Evas_Object *obj); +static void _conformant_part_size_set(Evas_Object *obj, + Evas_Object *sobj, + Evas_Coord sx, + Evas_Coord sy, + Evas_Coord sw, + Evas_Coord sh); +static void _conformant_part_sizing_eval(Evas_Object *obj, + Conformant_Part_Type part_type); +static void _conformant_move_resize_event_cb(void *data, + Evas *e, + Evas_Object *obj, + void *event_info); +static void _sizing_eval(Evas_Object *obj); +static void _show_region_job(void *data); +static void _changed_size_hints(void *data, Evas *e, + Evas_Object *obj, + void *event_info); + +/* local functions */ +static void +_del_pre_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + +#ifdef HAVE_ELEMENTARY_X + if (wd->prop_hdl) ecore_event_handler_del(wd->prop_hdl); +#endif +} + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (wd->show_region_job) ecore_job_del(wd->show_region_job); + free(wd); +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + edje_object_mirrored_set(wd->base, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _elm_theme_object_set(obj, wd->base, "conformant", "base", + elm_widget_style_get(obj)); + _swallow_conformant_parts(obj); + + if (wd->content) + edje_object_part_swallow(wd->base, "elm.swallow.content", wd->content); + _sizing_eval(obj); +} + +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd; + + if (part && strcmp(part, "default")) return; + wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->content == content) return; + if (wd->content) evas_object_del(wd->content); + wd->content = content; + if (content) + { + elm_widget_sub_object_add(obj, content); + evas_object_event_callback_add(content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + edje_object_part_swallow(wd->base, "elm.swallow.content", content); + } + _sizing_eval(obj); +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + + if (part && strcmp(part, "default")) return NULL; + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->content; +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + Evas_Object *content; + if (part && strcmp(part, "default")) return NULL; + wd = elm_widget_data_get(obj); + if ((!wd) || (!wd->content)) return NULL; + + content = wd->content; + elm_widget_sub_object_del(obj, wd->content); + evas_object_event_callback_del_full(content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + edje_object_part_unswallow(wd->base, content); + wd->content = NULL; + return content; +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord mw = -1, mh = -1; + if (!wd) return; + + edje_object_size_min_calc(wd->base, &mw, &mh); + evas_object_size_hint_min_set(obj, mw, mh); + evas_object_size_hint_max_set(obj, -1, -1); +} + +/* Example of env vars: + * ILLUME_KBD="0, 0, 800, 301" + * ILLUME_IND=0,0,800,32 + * ILLUME_STK="0,568,800,32 + */ +static Eina_Bool +_conformant_part_geometry_env_get(const char *part, int *sx, int *sy, int *sw, int *sh) +{ + const char delimiters[] = " ,;"; + char *env_val, *token; + char buf[PATH_MAX]; + int tsx, tsy, tsw; + + if (!(env_val = getenv(part))) return EINA_FALSE; + + /* strtok would modify env var if not copied to a buffer */ + strncpy(buf, env_val, sizeof(buf)); + + token = strtok(buf, delimiters); + if (!token) return EINA_FALSE; + tsx = atoi(token); + + token = strtok(NULL, delimiters); + if (!token) return EINA_FALSE; + tsy = atoi(token); + + token = strtok(NULL, delimiters); + if (!token) return EINA_FALSE; + tsw = atoi(token); + + token = strtok(NULL, delimiters); + if (!token) return EINA_FALSE; + *sh = atoi(token); + + *sx = tsx; + *sy = tsy; + *sw = tsw; + + return EINA_TRUE; +} + +static void +_conformant_part_size_set(Evas_Object *obj, Evas_Object *sobj, Evas_Coord sx, + Evas_Coord sy, Evas_Coord sw, Evas_Coord sh) +{ + Evas_Coord cx, cy, cw, ch; + Evas_Coord part_height = 0, part_width = 0; + + evas_object_geometry_get(obj, &cx, &cy, &cw, &ch); + + /* Part overlapping with conformant */ + if ((cx < (sx + sw)) && ((cx + cw) > sx) + && (cy < (sy + sh)) && ((cy + ch) > sy)) + { + part_height = MIN((cy + ch), (sy + sh)) - MAX(cy, sy); + part_width = MIN((cx + cw), (sx + sw)) - MAX(cx, sx); + } + + evas_object_size_hint_min_set(sobj, part_width, part_height); + evas_object_size_hint_max_set(sobj, part_width, part_height); +} + +static void +_conformant_part_sizing_eval(Evas_Object *obj, Conformant_Part_Type part_type) +{ +#ifdef HAVE_ELEMENTARY_X + Ecore_X_Window zone = 0; + Evas_Object *top; +#endif + Ecore_X_Window xwin; + int sx = -1, sy = -1, sw = -1, sh = -1; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + +#ifdef HAVE_ELEMENTARY_X + top = elm_widget_top_get(obj); + xwin = elm_win_xwindow_get(top); + if (xwin) + zone = ecore_x_e_illume_zone_get(xwin); +#endif + + if (part_type & ELM_CONFORM_INDICATOR_PART) + { + if ((!_conformant_part_geometry_env_get("ILLUME_IND", + &sx, &sy, &sw, &sh)) && (xwin)) + { +#ifdef HAVE_ELEMENTARY_X + //No information of the indicator geometry, reset the geometry. + if (!ecore_x_e_illume_indicator_geometry_get(zone, &sx, &sy, &sw, &sh)) + sx = sy = sw = sh = 0; +#else + ; +#endif + } + _conformant_part_size_set(obj, wd->indicator, sx, sy, sw, sh); + } + if (part_type & ELM_CONFORM_VIRTUAL_KEYPAD_PART) + { + if ((!_conformant_part_geometry_env_get("ILLUME_KBD", + &sx, &sy, &sw, &sh)) && (xwin)) + { +#ifdef HAVE_ELEMENTARY_X + //No information of the keyboard geometry, reset the geometry. + if (!ecore_x_e_illume_keyboard_geometry_get(zone, &sx, &sy, &sw, &sh)) + sx = sy = sw = sh = 0; +#else + ; +#endif + } + _conformant_part_size_set(obj, wd->virtualkeypad, sx, sy, sw, sh); + } + if (part_type & ELM_CONFORM_SOFTKEY_PART) + { + if ((!_conformant_part_geometry_env_get("ILLUME_STK", + &sx, &sy, &sw, &sh)) && (xwin)) + { +#ifdef HAVE_ELEMENTARY_X + //No information of the softkey geometry, reset the geometry. + if (!ecore_x_e_illume_softkey_geometry_get(zone, &sx, &sy, &sw, &sh)) + sx = sy = sw = sh = 0; +#else + ; +#endif + } + _conformant_part_size_set(obj, wd->softkey, sx, sy, sw, sh); + } + if (part_type & ELM_CONFORM_CLIPBOARD_PART) + { + if ((!_conformant_part_geometry_env_get("ILLUME_CB", + &sx, &sy, &sw, &sh)) && (xwin)) + { +#ifdef HAVE_ELEMENTARY_X + //No information of the clipboard geometry, reset the geometry. + if (!ecore_x_e_illume_clipboard_geometry_get(zone, &sx, &sy, &sw, &sh)) + sx = sy = sw = sh = 0; +#else + ; +#endif + } + _conformant_part_size_set(obj, wd->clipboard, sx, sy, sw, sh); + } +} + +static void +_swallow_conformant_parts(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas *e = evas_object_evas_get(obj); + if (!wd || !e) return; + + wd->scroller = NULL; + + //Indicator + if (!wd->indicator) + { + wd->indicator = evas_object_rectangle_add(e); + elm_widget_sub_object_add(obj, wd->indicator); + evas_object_size_hint_min_set(wd->indicator, -1, 0); + evas_object_size_hint_max_set(wd->indicator, -1, 0); + } + else + _conformant_part_sizing_eval(obj, ELM_CONFORM_INDICATOR_PART); + evas_object_color_set(wd->indicator, 0, 0, 0, 0); + edje_object_part_swallow(wd->base, "elm.swallow.indicator", wd->indicator); + + //Virtual Keyboard + if (!wd->virtualkeypad) + { + wd->virtualkeypad = evas_object_rectangle_add(e); + elm_widget_sub_object_add(obj, wd->virtualkeypad); + evas_object_size_hint_min_set(wd->virtualkeypad, -1, 0); + evas_object_size_hint_max_set(wd->virtualkeypad, -1, 0); + } + else + _conformant_part_sizing_eval(obj, ELM_CONFORM_VIRTUAL_KEYPAD_PART); + evas_object_color_set(wd->virtualkeypad, 0, 0, 0, 0); + edje_object_part_swallow(wd->base, "elm.swallow.virtualkeypad", + wd->virtualkeypad); + //Clipboard + if (!wd->clipboard) + { + wd->clipboard = evas_object_rectangle_add(e); + elm_widget_sub_object_add(obj, wd->clipboard); + evas_object_size_hint_min_set(wd->clipboard, -1, 0); + evas_object_size_hint_max_set(wd->clipboard, -1, 0); + } + else + _conformant_part_sizing_eval(obj, ELM_CONFORM_CLIPBOARD_PART); + evas_object_color_set(wd->clipboard, 0, 0, 0, 0); + edje_object_part_swallow(wd->base, "elm.swallow.clipboard", + wd->clipboard); + + //Softkey + if (!wd->softkey) + { + wd->softkey = evas_object_rectangle_add(e); + elm_widget_sub_object_add(obj, wd->softkey); + evas_object_size_hint_min_set(wd->softkey, -1, 0); + evas_object_size_hint_max_set(wd->softkey, -1, 0); + } + else + _conformant_part_sizing_eval(obj, ELM_CONFORM_SOFTKEY_PART); + evas_object_color_set(wd->softkey, 0, 0, 0, 0); + edje_object_part_swallow(wd->base, "elm.swallow.softkey", wd->softkey); +} + +static void +_changed_size_hints(void *data, Evas *e __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + + _sizing_eval(data); +} + +static void +_sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *sub = event_info; + if (!wd) return; + + if (sub == wd->content) + { + evas_object_event_callback_del_full(sub, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + wd->content = NULL; + _sizing_eval(obj); + } +} + +/* unused now - but meant to be for making sure the focused widget is always + * visible when the vkbd comes and goes by moving the conformant obj (and thus + * its children) to show the focused widget (and if focus changes follow) + +static Evas_Object * +_focus_object_get(const Evas_Object *obj) +{ + Evas_Object *win, *foc; + + win = elm_widget_top_get(obj); + if (!win) return NULL; + foc = elm_widget_top_get(win); +} + +static void +_focus_object_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) +{ + evas_object_geometry_get(obj, x, y, w, h); +} + +static void +_focus_change_del(void *data, Evas_Object *obj, void *event_info) +{ + // called from toplevel when the focused window shanges +} + +static void +_autoscroll_move(Evas_Object *obj) +{ + // move conformant edje by delta to show focused widget +} + +static void +_autoscroll_mode_enable(Evas_Object *obj) +{ +// called when autoscroll mode should be on - content area smaller than +// its min size +// 1. get focused object +// 2. if not in visible conformant area calculate delta needed to +// get it in +// 3. store delta and call _autoscroll_move() which either asanimates +// or jumps right there +} + +static void +_autoscroll_mode_disable(Evas_Object *obj) +{ +// called when autoscroll mode should be off - set delta to 0 and +// call _autoscroll_move() +} + */ + +static void +_conformant_move_resize_event_cb(void *data __UNUSED__, Evas *e __UNUSED__, + Evas_Object *obj, void *event_info __UNUSED__) +{ + Conformant_Part_Type part_type; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + part_type = (ELM_CONFORM_INDICATOR_PART | + ELM_CONFORM_SOFTKEY_PART | + ELM_CONFORM_VIRTUAL_KEYPAD_PART | + ELM_CONFORM_CLIPBOARD_PART); + _conformant_part_sizing_eval(obj, part_type); +} + +// showing the focused/important region. +#ifdef HAVE_ELEMENTARY_X +static void +_content_resize_event_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj + __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *conformant = (Evas_Object *)data; + Widget_Data *wd = elm_widget_data_get(conformant); + if (!wd) return; + + if (wd->vkb_state == ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF) return; + + if (wd->show_region_job) ecore_job_del(wd->show_region_job); + wd->show_region_job = ecore_job_add(_show_region_job, conformant); +} +#endif + +static void +_show_region_job(void *data) +{ + Evas_Object *focus_obj; + Evas_Object *conformant = (Evas_Object *)data; + Widget_Data *wd = elm_widget_data_get(conformant); + if (!wd) return; + + focus_obj = elm_widget_focused_object_get(conformant); + if (focus_obj) + { + Evas_Coord x, y, w, h; + + elm_widget_show_region_get(focus_obj, &x, &y, &w, &h); + + if (h < _elm_config->finger_size) + h = _elm_config->finger_size; + + elm_widget_show_region_set(focus_obj, x, y, w, h, EINA_TRUE); + } + + wd->show_region_job = NULL; +} + +#ifdef HAVE_ELEMENTARY_X +static void +_update_autoscroll_objs(void *data) +{ + const char *type; + int i; + Evas_Object *sub, *top_scroller = NULL; + Evas_Object *conformant = (Evas_Object *)data; + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + + sub = elm_widget_focused_object_get(conformant); + //Look up for Top most scroller in the Focus Object hierarchy inside Conformant. + + while (sub) + { + type = elm_widget_type_get(sub); + if (!strcmp(type, "conformant")) break; + for (i = 0; i < SUB_TYPE_COUNT; i++) + if (!strcmp(type, sub_type[i])) + { + top_scroller = sub; + break; + } + sub = elm_object_parent_widget_get(sub); + } + + //If the scroller got changed by app, replace it. + if (top_scroller != wd->scroller) + { + if (wd->scroller) evas_object_event_callback_del(wd->scroller, + EVAS_CALLBACK_RESIZE, + _content_resize_event_cb); + wd->scroller = top_scroller; + if (wd->scroller) evas_object_event_callback_add(wd->scroller, + EVAS_CALLBACK_RESIZE, + _content_resize_event_cb, + data); + } +} + +static Eina_Bool +_prop_change(void *data, int type __UNUSED__, void *event) +{ + Ecore_X_Event_Window_Property *ev; + Widget_Data *wd = elm_widget_data_get(data); + + if (!wd) return ECORE_CALLBACK_PASS_ON; + ev = event; + if (ev->atom == ECORE_X_ATOM_E_ILLUME_ZONE) + { + Conformant_Part_Type part_type; + + part_type = (ELM_CONFORM_INDICATOR_PART | + ELM_CONFORM_SOFTKEY_PART | + ELM_CONFORM_VIRTUAL_KEYPAD_PART | + ELM_CONFORM_CLIPBOARD_PART); + _conformant_part_sizing_eval(data, part_type); + } + else if (ev->atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY) + _conformant_part_sizing_eval(data, ELM_CONFORM_INDICATOR_PART); + else if (ev->atom == ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY) + _conformant_part_sizing_eval(data, ELM_CONFORM_SOFTKEY_PART); + else if (ev->atom == ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY) + _conformant_part_sizing_eval(data, ELM_CONFORM_VIRTUAL_KEYPAD_PART); + else if (ev->atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY) + _conformant_part_sizing_eval(data, ELM_CONFORM_CLIPBOARD_PART); + else if (ev->atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE) + { + Ecore_X_Window zone; + + printf("Keyboard Geometry Changed\n"); + zone = ecore_x_e_illume_zone_get(ev->win); + wd->vkb_state = ecore_x_e_virtual_keyboard_state_get(zone); + if (wd->vkb_state == ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF) + { + evas_object_size_hint_min_set(wd->virtualkeypad, -1, 0); + evas_object_size_hint_max_set(wd->virtualkeypad, -1, 0); + } + else + _update_autoscroll_objs(data); + } + else if (ev->atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE) + { + Ecore_X_Window zone; + Ecore_X_Illume_Clipboard_State state; + + zone = ecore_x_e_illume_zone_get(ev->win); + state = ecore_x_e_illume_clipboard_state_get(zone); + + if (state != ECORE_X_ILLUME_CLIPBOARD_STATE_ON) + { + evas_object_size_hint_min_set(wd->clipboard, -1, 0); + evas_object_size_hint_max_set(wd->clipboard, -1, 0); + } + else + _update_autoscroll_objs(data); + } + + return ECORE_CALLBACK_PASS_ON; +} +#endif + +EAPI Evas_Object * +elm_conformant_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "conformant"); + elm_widget_type_set(obj, "conformant"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); + + wd->base = edje_object_add(e); + _elm_theme_object_set(obj, wd->base, "conformant", "base", "default"); + elm_widget_resize_object_set(obj, wd->base); + + _swallow_conformant_parts(obj); + +#ifdef HAVE_ELEMENTARY_X + Evas_Object *top = elm_widget_top_get(obj); + Ecore_X_Window xwin = elm_win_xwindow_get(top); + + if ((xwin) && (!elm_win_inlined_image_object_get(top))) + { + wd->prop_hdl = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, + _prop_change, obj); + wd->vkb_state = ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF; + } + // FIXME: get kbd region prop +#endif + + evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, + _conformant_move_resize_event_cb, obj); + evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, + _conformant_move_resize_event_cb, obj); + + evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _sizing_eval(obj); + return obj; +} diff --git a/libraries/elementary/src/lib/elm_conform.h b/libraries/elementary/src/lib/elm_conform.h new file mode 100644 index 0000000..3daf72a --- /dev/null +++ b/libraries/elementary/src/lib/elm_conform.h @@ -0,0 +1,49 @@ +/** + * @defgroup Conformant Conformant + * @ingroup Elementary + * + * @image html img/widget/conformant/preview-00.png + * @image latex img/widget/conformant/preview-00.eps width=\textwidth + * + * @image html img/conformant.png + * @image latex img/conformant.eps width=\textwidth + * + * The aim is to provide a widget that can be used in elementary apps to + * account for space taken up by the indicator, virtual keypad & softkey + * windows when running the illume2 module of E17. + * + * So conformant content will be sized and positioned considering the + * space required for such stuff, and when they popup, as a keyboard + * shows when an entry is selected, conformant content won't change. + * + * Available styles for it: + * - @c "default" + * + * Default content parts of the conformant widget that you can use for are: + * @li "default" - A content of the conformant + * + * See how to use this widget in this example: + * @ref conformant_example + */ + +/** + * @addtogroup Conformant + * @{ + */ + +/** + * Add a new conformant widget to the given parent Elementary + * (container) object. + * + * @param parent The parent object. + * @return A new conformant widget handle or @c NULL, on errors. + * + * This function inserts a new conformant widget on the canvas. + * + * @ingroup Conformant + */ +EAPI Evas_Object *elm_conformant_add(Evas_Object *parent); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_cursor.h b/libraries/elementary/src/lib/elm_cursor.h new file mode 100644 index 0000000..84a404a --- /dev/null +++ b/libraries/elementary/src/lib/elm_cursor.h @@ -0,0 +1,122 @@ +/** + * @defgroup Cursors Cursors + * @ingroup Elementary + * + * The Elementary cursor is an internal smart object used to + * customize the mouse cursor displayed over objects (or + * widgets). In the most common scenario, the cursor decoration + * comes from the graphical @b engine Elementary is running + * on. Those engines may provide different decorations for cursors, + * and Elementary provides functions to choose them (think of X11 + * cursors, as an example). + * + * By default, Elementary searches cursors only from engine. + * There's also the possibility of, besides using engine provided + * cursors, also use the ones coming from Edje theme files. Both + * globally and per widget, Elementary makes it possible for one to + * make the cursors lookup to be held on engines only or on + * Elementary's theme file, too. To set cursor's hot spot, + * two data items should be added to cursor's theme: "hot_x" and + * "hot_y", that are the offset from upper-left corner of the cursor + * (coordinates 0,0). + * + * @{ + */ + +/** + * Set the cursor to be shown when mouse is over the object + * + * Set the cursor that will be displayed when mouse is over the + * object. The object can have only one cursor set to it, so if + * this function is called twice for an object, the previous set + * will be unset. + * If using X cursors, a definition of all the valid cursor names + * is listed on Elementary_Cursors.h. If an invalid name is set + * the default cursor will be used. + * + * @param obj the object being set a cursor. + * @param cursor the cursor name to be used. + * + * @ingroup Cursors + */ +EAPI void elm_object_cursor_set(Evas_Object *obj, const char *cursor); + +/** + * Get the cursor to be shown when mouse is over the object + * + * @param obj an object with cursor already set. + * @return the cursor name. + * + * @ingroup Cursors + */ +EAPI const char *elm_object_cursor_get(const Evas_Object *obj); + +/** + * Unset cursor for object + * + * Unset cursor for object, and set the cursor to default if the mouse + * was over this object. + * + * @param obj Target object + * @see elm_object_cursor_set() + * + * @ingroup Cursors + */ +EAPI void elm_object_cursor_unset(Evas_Object *obj); + +/** + * Sets a different style for this object cursor. + * + * @note before you set a style you should define a cursor with + * elm_object_cursor_set() + * + * @param obj an object with cursor already set. + * @param style the theme style to use (default, transparent, ...) + * + * @ingroup Cursors + */ +EAPI void elm_object_cursor_style_set(Evas_Object *obj, const char *style); + +/** + * Get the style for this object cursor. + * + * @param obj an object with cursor already set. + * @return style the theme style in use, defaults to "default". If the + * object does not have a cursor set, then NULL is returned. + * + * @ingroup Cursors + */ +EAPI const char *elm_object_cursor_style_get(const Evas_Object *obj); + +/** + * Set if the cursor set should be searched on the theme or should use + * the provided by the engine, only. + * + * @note before you set engine_only you should define a cursor with + * elm_object_cursor_set(). By default it will only look for cursors + * provided by the engine. + * + * @param obj an object with cursor already set. + * @param theme_search boolean to define if cursors should be looked only + * between the provided by the engine or searched on widget's theme as well. + * + * @ingroup Cursors + */ +EAPI void elm_object_cursor_theme_search_enabled_set(Evas_Object *obj, Eina_Bool theme_search); + +/** + * Get the cursor engine only usage for this object cursor. + * + * @param obj an object with cursor already set. + * @return engine_only boolean to define it cursors should be + * looked only between the provided by the engine or searched on + * widget's theme as well. If the object does not have a cursor + * set, then EINA_FALSE is returned. + * + * @ingroup Cursors + */ +EAPI Eina_Bool elm_object_cursor_theme_search_enabled_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_datetime.c b/libraries/elementary/src/lib/elm_datetime.c new file mode 100644 index 0000000..8736e8d --- /dev/null +++ b/libraries/elementary/src/lib/elm_datetime.c @@ -0,0 +1,1075 @@ +#include +#include "elm_priv.h" + +#ifdef HAVE_LOCALE_H +# include +#endif + +#ifdef HAVE_LANGINFO_H +# include +#endif + +typedef struct _Widget_Data Widget_Data; +typedef struct _Datetime_Field Datetime_Field; +typedef struct _Datetime_Mod_Api Datetime_Mod_Api; +typedef struct _Format_Map Format_Map; + +#define DATETIME_TYPE_COUNT 6 +#define MAX_FORMAT_LEN 64 +#define MAX_SEPARATOR_LEN 6 +#define MAX_FIELD_FORMAT_LEN 3 +#define MIN_DAYS_IN_MONTH 28 +#define BUFFER_SIZE 1024 + +// interface between EDC & C code. Field names & signal names. +// values 0 to DATETIME_TYPE_COUNT are valid range, can be substituted for %d. +#define EDC_DATETIME_ENABLE_SIG_STR "elm,state,enabled" +#define EDC_DATETIME_DISABLE_SIG_STR "elm,state,disabled" +#define EDC_DATETIME_FOCUSIN_SIG_STR "elm,action,focus" +#define EDC_DATETIME_FOCUSOUT_SIG_STR "elm,action,unfocus" +#define EDC_PART_FIELD_STR "field%d" +#define EDC_PART_SEPARATOR_STR "separator%d" +#define EDC_PART_FIELD_ENABLE_SIG_STR "field%d,enable" +#define EDC_PART_FIELD_DISABLE_SIG_STR "field%d,disable" + +// struct tm does not define the fields in the order from year, month, date, hour, minute. +// values are reassigned to an array for easy handling. +#define DATETIME_TM_ARRAY(intptr, tmptr) int *intptr[] = {&(tmptr)->tm_year, \ + &(tmptr)->tm_mon, &(tmptr)->tm_mday, &(tmptr)->tm_hour, &(tmptr)->tm_min} + +struct _Datetime_Field +{ + Evas_Object *item_obj; + char fmt[MAX_FIELD_FORMAT_LEN]; + Elm_Datetime_Field_Type type; + const char *separator; + int location; // location of the field as per the current format + int min, max; + Eina_Bool fmt_exist:1; // whether field format is present or not + Eina_Bool visible:1; // whether field can be visible or not +}; + +struct _Datetime_Mod_Api +{ + Elm_Datetime_Module_Data *(*obj_hook) (Evas_Object *obj); + void (*obj_unhook) (Elm_Datetime_Module_Data *module_data); + Evas_Object *(*field_create) (Elm_Datetime_Module_Data *module_data, + Elm_Datetime_Field_Type field_type); + void (*field_value_display) (Elm_Datetime_Module_Data *module_data, + Evas_Object *obj); +}; + +struct _Widget_Data +{ + Evas_Object *base; + Datetime_Field field_list[DATETIME_TYPE_COUNT]; // fixed set of fields. + struct tm curr_time, min_limit, max_limit; + Elm_Datetime_Module_Data *mod_data; + char format[MAX_FORMAT_LEN]; + Eina_Bool user_format:1; // whether user set format or default format. +}; + +struct _Format_Map +{ + char *fmt_char; + int def_min; + int def_max; + char *ignore_sep; +}; + +// default limits for individual fields +static Format_Map mapping[DATETIME_TYPE_COUNT] = { + [ELM_DATETIME_YEAR] = { "Yy", -1, -1, "" }, + [ELM_DATETIME_MONTH] = { "mbBh", 0, 11, "" }, + [ELM_DATETIME_DATE] = { "de", 1, 31, "" }, + [ELM_DATETIME_HOUR] = { "IHkl", 0, 23, "" }, + [ELM_DATETIME_MINUTE] = { "M", 0, 59, ":" }, + [ELM_DATETIME_AMPM] = { "pP", 0, 1, "" } +}; + +static const char *multifield_formats = "cxXrRTDF"; +static const char *ignore_separators = "()"; + +static Datetime_Mod_Api *dt_mod = NULL; +static const char *widtype = NULL; + +static void _del_hook(Evas_Object *obj); +static void _disable_hook(Evas_Object *obj); +static void _translate_hook(Evas_Object *obj); +static void _on_focus_hook(void *data __UNUSED__, Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); +static void _sizing_eval(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); +static void _validate_datetime_limits(struct tm *time1, struct tm *time2, Eina_Bool swap); +static void _apply_field_limits(Evas_Object *obj); +static void _apply_range_restrictions(Evas_Object *obj, struct tm *time); +static const char *_field_format_get(Evas_Object * obj, Elm_Datetime_Field_Type field_type); +static void _field_limit_get(Evas_Object * obj, Elm_Datetime_Field_Type field_type, + int *range_min, int *range_max); +static void _reload_format(Evas_Object *obj); +static void _field_list_display(Evas_Object *obj); +static void _field_list_arrange(Evas_Object *obj); +static void _field_list_init(Evas_Object *obj); + +static const char SIG_CHANGED[] = "changed"; +static const char SIG_LANGUAGE_CHANGED[] = "language,changed"; +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CHANGED, ""}, + {SIG_LANGUAGE_CHANGED, ""}, + {NULL, NULL} +}; + +static Datetime_Mod_Api * +_dt_mod_init() +{ + Elm_Module *mod = NULL; + if (!(mod = _elm_module_find_as("datetime/api"))) return NULL; + + mod->api = malloc(sizeof(Datetime_Mod_Api)); + if (!mod->api) return NULL; + + ((Datetime_Mod_Api *)(mod->api))->obj_hook = _elm_module_symbol_get(mod, "obj_hook"); + ((Datetime_Mod_Api *)(mod->api))->obj_unhook = _elm_module_symbol_get(mod, "obj_unhook"); + ((Datetime_Mod_Api *)(mod->api))->field_create = _elm_module_symbol_get(mod, "field_create"); + ((Datetime_Mod_Api *)(mod->api))->field_value_display = _elm_module_symbol_get(mod, "field_value_display"); + + return mod->api; +} + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd; + Datetime_Field *tmp; + unsigned int idx; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + for (idx = 0; idx < DATETIME_TYPE_COUNT; idx++) + { + tmp = wd->field_list + idx; + evas_object_del(tmp->item_obj); + eina_stringshare_del(tmp->separator); + } + + if ((dt_mod) && (dt_mod->obj_unhook)) + dt_mod->obj_unhook(wd->mod_data); // module - unhook + + free(wd); +} + +static void +_disable_hook(Evas_Object *obj) +{ + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd || !wd->base) return; + if (elm_widget_disabled_get(obj)) + edje_object_signal_emit(wd->base, EDC_DATETIME_DISABLE_SIG_STR, "elm"); + else + edje_object_signal_emit(wd->base, EDC_DATETIME_ENABLE_SIG_STR, "elm"); +} + +static void +_translate_hook(Evas_Object *obj) +{ + Widget_Data *wd; + wd = elm_widget_data_get(obj); + if (!wd) return; + + if (!wd->user_format) _reload_format(obj); + else _field_list_display(obj); + evas_object_smart_callback_call(obj, SIG_LANGUAGE_CHANGED, NULL); +} + +static void +_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + if (elm_widget_focus_get(obj)) + edje_object_signal_emit(wd->base, EDC_DATETIME_FOCUSIN_SIG_STR, "elm"); + else + edje_object_signal_emit(wd->base, EDC_DATETIME_FOCUSOUT_SIG_STR, "elm"); +} + +static Eina_List * +_datetime_items_get(const Evas_Object *obj) +{ + Widget_Data *wd; + Eina_List *items = NULL; + Datetime_Field *field; + int loc, count = 0; + unsigned int idx; + + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + for (idx = 0; idx < DATETIME_TYPE_COUNT; idx++) + { + field = wd->field_list + idx; + if (field->fmt_exist && field->visible) count++; + } + for (loc = 0; loc < count; loc++) + { + for (idx = 0; idx < DATETIME_TYPE_COUNT; idx++) + { + field = wd->field_list + idx; + if (field->location == loc) + items = eina_list_append(items, field->item_obj); + } + } + + return items; +} + +static Eina_Bool +_elm_datetime_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next) +{ + Widget_Data *wd; + const Eina_List *items; + void *(*list_data_get) (const Eina_List *list); + Eina_List *(*list_free) (Eina_List *list); + Eina_Bool ret; + + wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + if ((items = elm_widget_focus_custom_chain_get(obj))) + { + list_data_get = eina_list_data_get; + list_free = NULL; + } + else + { + items = _datetime_items_get(obj); + list_data_get = eina_list_data_get; + list_free = eina_list_free; + if (!items) return EINA_FALSE; + } + + ret = elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next); + if (list_free) list_free((Eina_List *)items); + + return ret; +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + edje_object_mirrored_set(wd->base, rtl); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd; + Datetime_Field *field; + Evas_Coord minw = -1, minh = -1; + unsigned int idx, field_count = 0; + + wd = elm_widget_data_get(obj); + if (!wd || !wd->base) return; + for (idx = 0; idx < DATETIME_TYPE_COUNT; idx++) + { + field = wd->field_list + idx; + if ((field->visible) && (field->fmt_exist)) field_count ++; + } + if (field_count) + elm_coords_finger_size_adjust(field_count, &minw, 1, &minh); + edje_object_size_min_restricted_calc(wd->base, &minw, &minh, minw, minh); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, -1, -1); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd; + Datetime_Field *field; + char buf[BUFFER_SIZE]; + unsigned int idx; + + wd = elm_widget_data_get(obj); + if (!wd || !wd->base) return; + + _elm_theme_object_set(obj, wd->base, "datetime", "base", + elm_widget_style_get(obj)); + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + + edje_object_scale_set(wd->base, elm_widget_scale_get(obj) * _elm_config->scale); + + if (elm_widget_disabled_get(obj)) + edje_object_signal_emit(wd->base, EDC_DATETIME_DISABLE_SIG_STR,"elm"); + else + edje_object_signal_emit(wd->base, EDC_DATETIME_ENABLE_SIG_STR, "elm"); + + if ((!dt_mod) || (!dt_mod->field_value_display)) return; + + for (idx = 0; idx < DATETIME_TYPE_COUNT; idx++) + { + field = wd->field_list + idx; + if (field->fmt_exist && field->visible) + { + snprintf(buf, sizeof(buf), EDC_PART_FIELD_ENABLE_SIG_STR, field->location); + edje_object_signal_emit(wd->base, buf, "elm"); + snprintf(buf, sizeof(buf), EDC_PART_SEPARATOR_STR, field->location); + edje_object_part_text_escaped_set(wd->base, buf, field->separator); + dt_mod->field_value_display(wd->mod_data, field->item_obj); + } + else + { + snprintf(buf, sizeof(buf),EDC_PART_FIELD_DISABLE_SIG_STR, field->location); + edje_object_signal_emit(wd->base, buf, "elm"); + } + } + edje_object_message_signal_process(wd->base); + _sizing_eval(obj); +} + +static int +_max_days_get(int year, int month) +{ + struct tm time1; + time_t t; + int day; + + t = time(NULL); + localtime_r(&t, &time1); + time1.tm_year = year; + time1.tm_mon = month; + for (day = MIN_DAYS_IN_MONTH; day <= mapping[ELM_DATETIME_DATE].def_max; day++) + { + time1.tm_mday = day; + mktime(&time1); + if (time1.tm_mday == 1) break; + } + day --; + return day; +} + +static Eina_Bool +_date_cmp(struct tm *time1, struct tm *time2) +{ + unsigned int idx; + DATETIME_TM_ARRAY(timearr1, time1); + DATETIME_TM_ARRAY(timearr2, time2); + + for (idx = 0; idx < DATETIME_TYPE_COUNT - 1; idx++) + { + if (*timearr1[idx] != *timearr2[idx]) + return EINA_FALSE; + } + return EINA_TRUE; +} + +// validates curr_time/min_limt/max_limit according to the newly set value +static void +_validate_datetime_limits(struct tm *time1, struct tm *time2, Eina_Bool swap) +{ + struct tm *t1, *t2; + unsigned int idx; + if (!time1 || !time2) return; + + t1 = (swap) ? time2 : time1; + t2 = (swap) ? time1 : time2; + + DATETIME_TM_ARRAY(timearr1, time1); + DATETIME_TM_ARRAY(timearr2, time2); + for (idx = 0; idx < DATETIME_TYPE_COUNT - 1; idx++) + { + if (*timearr1[idx] < *timearr2[idx]) + { + memcpy(t1, t2, sizeof(struct tm)); + break; + } + else if (*timearr1[idx] > *timearr2[idx]) + break; + } +} + +static void +_apply_field_limits(Evas_Object *obj) +{ + Widget_Data *wd; + Datetime_Field *field; + int val; + unsigned int idx = 0; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + DATETIME_TM_ARRAY(timearr, &wd->curr_time); + for (idx = 0; idx < DATETIME_TYPE_COUNT - 1; idx++) + { + field = wd->field_list + idx; + val = *timearr[idx]; + if (val < field->min) + *timearr[idx] = field->min; + else if (val > field->max) + *timearr[idx] = field->max; + } + _field_list_display(obj); +} + +static void +_apply_range_restrictions(Evas_Object *obj, struct tm *tim) +{ + Widget_Data *wd; + unsigned int idx; + int val, min, max; + + wd = elm_widget_data_get(obj); + if (!wd || !tim) return; + + DATETIME_TM_ARRAY(timearr, tim); + for (idx = ELM_DATETIME_MONTH; idx < DATETIME_TYPE_COUNT - 1; idx++) + { + val = *timearr[idx]; + min = mapping[idx].def_min; + max = mapping[idx].def_max; + if (idx == ELM_DATETIME_DATE) + max = _max_days_get(tim->tm_year, tim->tm_mon); + if (val < min) + *timearr[idx] = min; + else if (val > max) + *timearr[idx] = max; + } +} + +static const char * +_field_format_get(Evas_Object * obj, Elm_Datetime_Field_Type field_type) +{ + Widget_Data *wd; + Datetime_Field *field; + + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + field = wd->field_list + field_type; + if (!field) return NULL; + + return field->fmt; +} + +static void +_field_limit_get(Evas_Object * obj, Elm_Datetime_Field_Type field_type, int *range_min, int *range_max) +{ + Widget_Data *wd; + Datetime_Field *field; + int min, max, max_days; + unsigned int idx; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + field = wd->field_list + field_type; + if (!field) return; + + min = field->min; + max = field->max; + + DATETIME_TM_ARRAY(curr_timearr, &wd->curr_time); + DATETIME_TM_ARRAY(min_timearr, &wd->min_limit); + DATETIME_TM_ARRAY(max_timearr, &wd->max_limit); + + for (idx = 0; idx < field->type; idx++) + if (*curr_timearr[idx] > *min_timearr[idx]) break; + if ((idx == field_type) && (min < *min_timearr[field_type])) + min = *min_timearr[field_type]; + if (field_type == ELM_DATETIME_DATE) + { + max_days = _max_days_get(wd->curr_time.tm_year, wd->curr_time.tm_mon); + if (max > max_days) max = max_days; + } + for (idx = 0; idx < field->type; idx++) + if (*curr_timearr[idx] < *max_timearr[idx]) break; + if ((idx == field_type) && (max > *max_timearr[field_type])) + max = *max_timearr[field_type]; + + *range_min = min; + *range_max = max; +} + +static void +_field_list_display(Evas_Object *obj) +{ + Widget_Data *wd; + Datetime_Field *field; + unsigned int idx= 0; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + for (idx = 0; idx < DATETIME_TYPE_COUNT; idx++) + { + field = wd->field_list + idx; + if (field->fmt_exist && field->visible) + { + if ((dt_mod) && (dt_mod->field_value_display)) + dt_mod->field_value_display(wd->mod_data, field->item_obj); + } + } +} + +static void +_field_list_arrange(Evas_Object *obj) +{ + Widget_Data *wd; + Datetime_Field *field; + char buf[BUFFER_SIZE]; + int idx; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + for (idx = 0; idx < DATETIME_TYPE_COUNT; idx++) + { + field = wd->field_list + idx; + edje_object_part_unswallow(wd->base, field->item_obj); + } + for (idx = 0; idx < DATETIME_TYPE_COUNT; idx++) + { + field = wd->field_list + idx; + if (field->visible && field->fmt_exist) + { + snprintf(buf, sizeof(buf), EDC_PART_FIELD_STR, field->location); + edje_object_part_swallow(wd->base, buf, field->item_obj); + } + else evas_object_hide(field->item_obj); + } + _sizing_eval(obj); + _field_list_display(obj); +} + +// FIXME: provide nl_langinfo on Windows if possible +// returns expanded format string for corresponding multi-field format character +static char * +_expanded_fmt_str_get(char ch) +{ + char *exp_fmt = ""; + switch (ch) + { + case 'c': +#ifdef HAVE_LANGINFO_H + exp_fmt = nl_langinfo(D_T_FMT); +#else + exp_fmt = ""; +#endif + break; + case 'x': +#ifdef HAVE_LANGINFO_H + exp_fmt = nl_langinfo(D_FMT); +#else + exp_fmt = ""; +#endif + break; + case 'X': +#ifdef HAVE_LANGINFO_H + exp_fmt = nl_langinfo(T_FMT); +#else + exp_fmt = ""; +#endif + break; + case 'r': +#ifdef HAVE_LANGINFO_H + exp_fmt = nl_langinfo(T_FMT_AMPM); +#else + exp_fmt = ""; +#endif + break; + case 'R': + exp_fmt = "%H:%M"; + break; + case 'T': + exp_fmt = "%H:%M:%S"; + break; + case 'D': + exp_fmt = "%m/%d/%y"; + break; + case 'F': + exp_fmt = "%Y-%m-%d"; + break; + default: + exp_fmt = ""; + break; + } + return exp_fmt; +} + +static void +_expand_format(char * dt_fmt) +{ + char *ptr, *expanded_fmt, ch; + char buf[MAX_FORMAT_LEN] = {0,}; + unsigned int idx = 0, len = 0; + Eina_Bool fmt_char = EINA_FALSE; + + ptr = dt_fmt; + while ((ch = *ptr)) + { + if ((fmt_char) && (strchr(multifield_formats, ch))) + { + // replace the multi-field format characters with corresponding expanded format + expanded_fmt = _expanded_fmt_str_get(ch); + len = strlen(expanded_fmt); + buf[--idx] = 0; + strncat(buf, expanded_fmt, len); + idx += len; + } + else buf[idx++] = ch; + if (ch == '%') fmt_char = EINA_TRUE; + else fmt_char = EINA_FALSE; + ptr++; + } + buf[idx] = 0; + strncpy(dt_fmt, buf, MAX_FORMAT_LEN); +} + +static unsigned int +_parse_format(Evas_Object *obj, char *fmt_ptr) +{ + Widget_Data *wd; + Datetime_Field *field = NULL; + unsigned int len = 0, idx = 0, location = 0; + char separator[MAX_SEPARATOR_LEN]; + char cur; + Eina_Bool fmt_parsing = EINA_FALSE, sep_parsing = EINA_FALSE, + sep_lookup = EINA_FALSE; + + wd = elm_widget_data_get(obj); + + while ((cur = *fmt_ptr)) + { + if (fmt_parsing) + { + fmt_parsing = EINA_FALSE; + for (idx = 0; idx < DATETIME_TYPE_COUNT; idx++) + { + if (strchr(mapping[idx].fmt_char, cur)) + { + field = wd->field_list + idx; + // ignore the fields already have or disabled + // valid formats, means already parsed & repeated, ignore. + if (!field->visible || field->location != -1) break; + field->fmt[1] = cur; + field->fmt_exist = EINA_TRUE; + field->location = location++; + sep_lookup = EINA_TRUE; + len = 0; + break; + } + } + } + if (cur == '%') + { + fmt_parsing = EINA_TRUE; + sep_parsing = EINA_FALSE; + // set the separator to previous field + separator[len] = 0; + if (field) eina_stringshare_replace(&field->separator, separator); + } + + // ignore the set of chars (global, field specific) as field separators. + if (sep_parsing && (len < MAX_SEPARATOR_LEN - 1) && + (field->type != ELM_DATETIME_AMPM) && (!strchr(ignore_separators, cur)) && + (!strchr(mapping[idx].ignore_sep, cur))) + separator[len++] = cur; + if (sep_lookup) sep_parsing = EINA_TRUE; + sep_lookup = EINA_FALSE; + fmt_ptr++; + } + // return the number of valid fields parsed. + return location; +} + +static void +_reload_format(Evas_Object *obj) +{ + Widget_Data *wd; + Datetime_Field *field; + char buf[BUFFER_SIZE]; + unsigned int idx, field_count; + char *dt_fmt; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + // FIXME: provide nl_langinfo on Windows if possible + // fetch the default format from Libc. + if (!wd->user_format) +#ifdef HAVE_LANGINFO_H + strncpy(wd->format, nl_langinfo(D_T_FMT), MAX_FORMAT_LEN); +#else + strncpy(wd->format, "", MAX_FORMAT_LEN); +#endif + + dt_fmt = (char *)malloc(MAX_FORMAT_LEN); + if (!dt_fmt) return; + strncpy(dt_fmt, wd->format, MAX_FORMAT_LEN); + + _expand_format(dt_fmt); + + // reset all the fields to disable state + for (idx = 0; idx < DATETIME_TYPE_COUNT; idx++) + { + field = wd->field_list + idx; + field->fmt_exist = EINA_FALSE; + field->location = -1; + } + + field_count = _parse_format(obj, dt_fmt); + free(dt_fmt); + + // assign locations to disabled fields for uniform usage + for (idx = 0; idx < DATETIME_TYPE_COUNT; idx++) + { + field = wd->field_list + idx; + if (field->location == -1) field->location = field_count++; + + if (field->fmt_exist && field->visible) + { + snprintf(buf, sizeof(buf), EDC_PART_FIELD_ENABLE_SIG_STR, + field->location); + edje_object_signal_emit(wd->base, buf, "elm"); + } + else + { + snprintf(buf, sizeof(buf),EDC_PART_FIELD_DISABLE_SIG_STR, + field->location); + edje_object_signal_emit(wd->base, buf, "elm"); + } + snprintf(buf, sizeof(buf), EDC_PART_SEPARATOR_STR, (field->location + 1)); + edje_object_part_text_escaped_set(wd->base, buf, field->separator); + } + edje_object_message_signal_process(wd->base); + _field_list_arrange(obj); +} + +static void +_field_list_init(Evas_Object *obj) +{ + Widget_Data *wd; + Datetime_Field *field; + unsigned int idx; + time_t t; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + t = time(NULL); + localtime_r(&t, &wd->curr_time); + + mapping[ELM_DATETIME_YEAR].def_min = _elm_config->year_min; + mapping[ELM_DATETIME_YEAR].def_max = _elm_config->year_max; + for (idx = 0; idx < DATETIME_TYPE_COUNT; idx++) + { + field = wd->field_list + idx; + field->type = ELM_DATETIME_YEAR + idx; + field->fmt[0] = '%'; + field->fmt_exist = EINA_FALSE; + field->visible = EINA_TRUE; + field->min = mapping[idx].def_min; + field->max = mapping[idx].def_max; + } + DATETIME_TM_ARRAY(min_timearr, &wd->min_limit); + DATETIME_TM_ARRAY(max_timearr, &wd->max_limit); + for (idx = 0; idx < DATETIME_TYPE_COUNT-1; idx++) + { + *min_timearr[idx] = mapping[idx].def_min; + *max_timearr[idx] = mapping[idx].def_max; + } +} + +EAPI Evas_Object * +elm_datetime_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + Datetime_Field *field; + int idx; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "datetime"); + elm_widget_type_set(obj, widtype); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_translate_hook_set(obj, _translate_hook); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_disable_hook_set(obj, _disable_hook); + elm_widget_can_focus_set(obj, EINA_TRUE); + elm_widget_focus_next_hook_set(obj, _elm_datetime_focus_next_hook); + + wd->base = edje_object_add(e); + elm_widget_resize_object_set(obj, wd->base); + _elm_theme_object_set(obj, wd->base, "datetime", "base", "default"); + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + // module - initialise module for datetime + if (!dt_mod) dt_mod = _dt_mod_init(); + if ((dt_mod) && (dt_mod->obj_hook)) + wd->mod_data = dt_mod->obj_hook(obj); + // update module data + if (wd->mod_data) + { + wd->mod_data->base = obj; + wd->mod_data->field_limit_get = _field_limit_get; + wd->mod_data->field_format_get = _field_format_get; + } + + _field_list_init(obj); + _reload_format(obj); + + if ((dt_mod)&&(dt_mod->field_create)) + { + for (idx = 0; idx < DATETIME_TYPE_COUNT; idx++) + { + field = wd->field_list + idx; + field->item_obj = dt_mod->field_create(wd->mod_data, idx); + } + } + _field_list_arrange(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + + return obj; +} + +EAPI const char * +elm_datetime_format_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + return wd->format; +} + +EAPI void +elm_datetime_format_set(Evas_Object *obj, const char *fmt) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + if (fmt) + { + strncpy(wd->format, fmt, MAX_FORMAT_LEN); + wd->user_format = EINA_TRUE; + } + else + wd->user_format = EINA_FALSE; + + _reload_format(obj); +} + +EAPI Eina_Bool +elm_datetime_field_visible_get(const Evas_Object *obj, Elm_Datetime_Field_Type + fieldtype) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd; + Datetime_Field *field; + + wd = elm_widget_data_get(obj); + if (!wd || (fieldtype > ELM_DATETIME_AMPM)) return EINA_FALSE; + + field = wd->field_list + fieldtype; + return field->visible; +} + +EAPI void +elm_datetime_field_visible_set(Evas_Object *obj, Elm_Datetime_Field_Type fieldtype, + Eina_Bool visible) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd; + Datetime_Field *field; + + wd = elm_widget_data_get(obj); + if (!wd || (fieldtype > ELM_DATETIME_AMPM)) return; + + field = wd->field_list + fieldtype; + if (field->visible == visible) return; + + field->visible = visible; + _reload_format(obj); +} + +EAPI void +elm_datetime_field_limit_get(const Evas_Object *obj, Elm_Datetime_Field_Type fieldtype, + int *min, int *max) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd; + Datetime_Field *field; + + wd = elm_widget_data_get(obj); + if (!wd || (fieldtype >= ELM_DATETIME_AMPM)) return; + + field = wd->field_list + fieldtype; + if (min) *min = field->min; + if (max) *max = field->max; +} + +EAPI void +elm_datetime_field_limit_set(Evas_Object *obj, Elm_Datetime_Field_Type fieldtype, + int min, int max) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd; + Datetime_Field *field; + + wd = elm_widget_data_get(obj); + if (!wd || (fieldtype >= ELM_DATETIME_AMPM)) return; + + if (min > max) return; + + field = wd->field_list + fieldtype; + if ((min > mapping[fieldtype].def_min && min < mapping[fieldtype].def_max) + || (field->type == ELM_DATETIME_YEAR)) + field->min = min; + if ((max > mapping[fieldtype].def_min && max < mapping[fieldtype].def_max) + || (field->type == ELM_DATETIME_YEAR)) + field->max = max; + + _apply_field_limits(obj); +} + +EAPI Eina_Bool +elm_datetime_value_get(const Evas_Object *obj, struct tm *currtime) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + EINA_SAFETY_ON_NULL_RETURN_VAL(currtime, EINA_FALSE); + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + *currtime = wd->curr_time; + return EINA_TRUE; +} + +EAPI Eina_Bool +elm_datetime_value_set(Evas_Object *obj, const struct tm *newtime) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + EINA_SAFETY_ON_NULL_RETURN_VAL(newtime, EINA_FALSE); + Widget_Data *wd; + struct tm old_time; + + wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + old_time = wd->curr_time; + wd->curr_time = *newtime; + // apply default field restrictions for curr_time + _apply_range_restrictions(obj, &wd->curr_time); + // validate the curr_time according to the min_limt and max_limt + _validate_datetime_limits(&wd->curr_time, &wd->min_limit, EINA_FALSE); + _validate_datetime_limits(&wd->max_limit, &wd->curr_time, EINA_TRUE); + _apply_field_limits(obj); + + if (!_date_cmp(&old_time, &wd->curr_time)) + evas_object_smart_callback_call(obj, SIG_CHANGED, NULL); + + return EINA_TRUE; +} + +EAPI Eina_Bool +elm_datetime_value_min_get(const Evas_Object *obj, struct tm *mintime) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + EINA_SAFETY_ON_NULL_RETURN_VAL(mintime, EINA_FALSE); + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + *mintime = wd->min_limit; + return EINA_TRUE; +} + +EAPI Eina_Bool +elm_datetime_value_min_set(Evas_Object *obj, const struct tm *mintime) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + EINA_SAFETY_ON_NULL_RETURN_VAL(mintime, EINA_FALSE); + Widget_Data *wd; + struct tm old_time; + + wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + wd->min_limit = *mintime; + old_time = wd->curr_time; + // apply default field restrictions for min_limit + _apply_range_restrictions(obj, &wd->min_limit); + // validate curr_time and max_limt according to the min_limit + _validate_datetime_limits(&wd->max_limit, &wd->min_limit, EINA_FALSE); + _validate_datetime_limits(&wd->curr_time, &wd->min_limit, EINA_FALSE); + _apply_field_limits(obj); + + if (!_date_cmp(&old_time, &wd->curr_time)) + evas_object_smart_callback_call(obj, SIG_CHANGED, NULL); + + return EINA_TRUE; +} + +EAPI Eina_Bool +elm_datetime_value_max_get(const Evas_Object *obj, struct tm *maxtime) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + EINA_SAFETY_ON_NULL_RETURN_VAL(maxtime, EINA_FALSE); + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + *maxtime = wd->max_limit; + return EINA_TRUE; +} + +EAPI Eina_Bool +elm_datetime_value_max_set(Evas_Object *obj, const struct tm *maxtime) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + EINA_SAFETY_ON_NULL_RETURN_VAL(maxtime, EINA_FALSE); + Widget_Data *wd; + struct tm old_time; + + wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + wd->max_limit = *maxtime; + old_time = wd->curr_time; + // apply default field restrictions for max_limit + _apply_range_restrictions(obj, &wd->max_limit); + // validate curr_time and min_limt according to the max_limit + _validate_datetime_limits(&wd->max_limit, &wd->min_limit, EINA_TRUE); + _validate_datetime_limits(&wd->max_limit, &wd->curr_time, EINA_TRUE); + _apply_field_limits(obj); + + if (!_date_cmp(&old_time, &wd->curr_time)) + evas_object_smart_callback_call(obj, SIG_CHANGED, NULL); + + return EINA_TRUE; +} diff --git a/libraries/elementary/src/lib/elm_datetime.h b/libraries/elementary/src/lib/elm_datetime.h new file mode 100644 index 0000000..36785cb --- /dev/null +++ b/libraries/elementary/src/lib/elm_datetime.h @@ -0,0 +1,592 @@ +/** + * @defgroup Datetime Datetime + * @ingroup Elementary + * + * + * @image html img/widget/datetime/preview-00.png + * @image latex img/widget/datetime/preview-00.eps + * + * @image html img/widget/datetime/preview-01.png + * @image latex img/widget/datetime/preview-01.eps + * + * @image html img/widget/datetime/preview-02.png + * @image latex img/widget/datetime/preview-02.eps + * + * Datetime widget is used to display and input date & time values. + * This widget displays date and time as per the system's locale settings (Date + * includes Day, Month & Year along with the defined separators and + * Time includes Hour, Minute & AM/PM fields. Separator for AM/PM field is ignored. + * + * The corresponding Month, AM/PM strings are displayed according to the + * system’s language settings. + * + * Datetime format is a combination of LIBC standard characters like + * “%%d %%b %%Y %%I : %%M %%p” which, as a whole represents both Date as well as Time + * format. + * + * Elm_datetime supports only the following sub set of libc date format specifiers: + * + * @b %%Y : The year as a decimal number including the century (example: 2011). + * + * @b %%y : The year as a decimal number without a century (range 00 to 99) + * + * @b %%m : The month as a decimal number (range 01 to 12). + * + * @b %%b : The abbreviated month name according to the current locale. + * + * @b %%B : The full month name according to the current locale. + * + * @b %%h : The abbreviated month name according to the current locale(same as %%b). + * + * @b %%d : The day of the month as a decimal number (range 01 to 31). + * + * @b %%e : The day of the month as a decimal number (range 1 to 31). single + * digits are preceded by a blank. + * + * @b %%I : The hour as a decimal number using a 12-hour clock (range 01 to 12). + * + * @b %%H : The hour as a decimal number using a 24-hour clock (range 00 to 23). + * + * @b %%k : The hour (24-hour clock) as a decimal number (range 0 to 23). single + * digits are preceded by a blank. + * + * @b %%l : The hour (12-hour clock) as a decimal number (range 1 to 12); single + * digits are preceded by a blank. + * + * @b %%M : The minute as a decimal number (range 00 to 59). + * + * @b %%p : Either 'AM' or 'PM' according to the given time value, or the + * corresponding strings for the current locale. Noon is treated as 'PM' + * and midnight as 'AM' + * + * @b %%P : Like %p but in lower case: 'am' or 'pm' or a corresponding string for + * the current locale. + * + * @b %%c : The preferred date and time representation for the current locale. + * + * @b %%x : The preferred date representation for the current locale without the time. + * + * @b %%X : The preferred time representation for the current locale without the date. + * + * @b %%r : The complete calendar time using the AM/PM format of the current locale. + * + * @b %%R : The hour and minute in decimal numbers using the format %H:%M. + * + * @b %%T : The time of day in decimal numbers using the format %H:%M:%S. + * + * @b %%D : The date using the format %%m/%%d/%%y. + * + * @b %%F : The date using the format %%Y-%%m-%%d. + * + * (For more reference on the available LIBC date format specifiers, please + * visit the link: + * http://www.gnu.org/s/hello/manual/libc.html#Formatting-Calendar-Time ) + * + * Datetime widget can provide Unicode @b separators in between its fields + * except for AM/PM field. + * A separator can be any Unicode character other than the LIBC standard + * date format specifiers.( Example: In the format %%b %%d @b , %%y %%H @b : %%M + * comma(,) is separator for date field %%d and colon(:) is separator for + * hour field %%H ). + * + * The default format is a predefined one, based on the system Locale. + * + * Hour format 12hr(1-12) or 24hr(0-23) display can be selected by setting + * the corresponding user format. + * + * Datetime supports six fields: Year, Month, Date, Hour, Minute, AM/PM. + * Depending on the Datetime module that is loaded, the user can see + * different UI to select the individual field values. + * + * The individual fields of Datetime can be arranged in any order according to the format + * set by application. + * + * There is a provision to set the visibility of a particular field as TRUE/ FALSE + * so that only time/ only date / only required fields will be displayed. + * + * Each field is having a default minimum and maximum values just like the daily + * calendar information. These min/max values can be modified as per the application usage. + * + * User can enter the values only in between the range of maximum and minimum. + * Apart from these APIs, there is a provision to display only a limited set of + * values out of the possible values. APIs to select the individual field limits + * are intended for this purpose. + * + * The whole widget is left aligned and its size grows horizontally depending + * on the current format and each field's visible/disabled state. + * + * Datetime individual field selection is implemented in a modular style. + * Module can be implemented as a Ctxpopup based selection or an ISE based + * selection or even a spinner like selection etc. + * + * Datetime Module design: + * + * The following functions are expected to be implemented in a Datetime module: + * + * Field creation: + *
+ *
+ *  __________                                            __________
+ * |          |----- obj_hook() ---------------------->>>|          |
+ * |          |<<<----------------returns Mod_data ------|          |
+ * | Datetime |_______                                   |          |
+ * |  widget  |       |Assign module call backs          |  Module  |
+ * |   base   |<<<____|                                  |          |
+ * |          |                                          |          |
+ * |          |----- field_create() ------------------>>>|          |
+ * |__________|<<<----------------returns field_obj -----|__________|
+ *
+ * 
+ * + * Field value setting: + *
+ *
+ *  __________                                          __________
+ * |          |                                        |          |
+ * | Datetime |<<<----------elm_datetime_value_set()---|          |
+ * |  widget  |                                        |  Module  |
+ * |   base   |----display_field_value()------------>>>|          |
+ * |__________|                                        |__________|
+ *
+ * 
+ * + * del_hook: + *
+ *  __________                                          __________
+ * |          |                                        |          |
+ * | Datetime |----obj_unhook()-------------------->>>>|          |
+ * |  widget  |                                        |  Module  |
+ * |   base   |         <<<-----frees mod_data---------|          |
+ * |__________|                                        |__________|
+ *
+ * 
+ * + * + * Any module can use the following shared functions that are implemented in elm_datetime.c : + * + * field_format_get() - gives the field format. + * + * field_limit_get() - gives the field minimum, maximum limits. + * + * To enable a module, set the ELM_MODULES environment variable as shown: + * + * export ELM_MODULES="datetime_input_ctxpopup>datetime/api" + * + * + * Datetime widgets emits the following signals: + * + * @li @b "changed" - whenever Datetime field value is changed, this signal is sent. + * + * @li @b "language,changed" - whenever system locale changes, this signal is sent. + * + * Here is an example on its usage: + * @li @ref datetime_example + * + */ + +/** + * @addtogroup Datetime + * @{ + */ + +/** + * Identifies a Datetime field, The widget supports 6 fields : Year, month, + * Date, Hour, Minute, AM/PM + * + */ +typedef enum _Elm_Datetime_Field_Type +{ + ELM_DATETIME_YEAR = 0, /**< Indicates Year field */ + ELM_DATETIME_MONTH = 1, /**< Indicates Month field */ + ELM_DATETIME_DATE = 2, /**< Indicates Date field */ + ELM_DATETIME_HOUR = 3, /**< Indicates Hour field */ + ELM_DATETIME_MINUTE = 4, /**< Indicates Minute field */ + ELM_DATETIME_AMPM = 5, /**< Indicates AM/PM field */ +} Elm_Datetime_Field_Type; + +/** + * @brief Adds a new datetime Widget + * + * The default datetime format and corresponding strings are based on current locale. + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * This function inserts a new datetime widget on the canvas. + * + * @ingroup Datetime + */ +EAPI Evas_Object *elm_datetime_add(Evas_Object *parent); + +/** + * Get the datetime format. Format is a combination of allowed Libc date format + * specifiers like: "%b %d, %Y %I : %M %p". + * + * Maximum allowed format length is 64 chars. + * + * Format can include separators for each individual datetime field except + * for AM/PM field. + * + * Each separator can be a maximum of 6 UTF-8 bytes. + * Space is also taken as a separator. + * + * Following are the allowed set of format specifiers for each datetime field. + * + * @b %%Y : The year as a decimal number including the century. + * + * @b %%y : The year as a decimal number without a century (range 00 to 99). + * + * @b %%m : The month as a decimal number (range 01 to 12). + * + * @b %%b : The abbreviated month name according to the current locale. + * + * @b %%B : The full month name according to the current locale. + * + * @b %%h : The abbreviated month name according to the current locale(same as %%b). + * + * @b %%d : The day of the month as a decimal number (range 01 to 31). + * + * @b %%e : The day of the month as a decimal number (range 1 to 31). single + * digits are preceded by a blank. + * + * @b %%I : The hour as a decimal number using a 12-hour clock (range 01 to 12). + * + * @b %%H : The hour as a decimal number using a 24-hour clock (range 00 to 23). + * + * @b %%k : The hour (24-hour clock) as a decimal number (range 0 to 23). single + * digits are preceded by a blank. + * + * @b %%l : The hour (12-hour clock) as a decimal number (range 1 to 12); single + * digits are preceded by a blank. + * + * @b %%M : The minute as a decimal number (range 00 to 59). + * + * @b %%p : Either 'AM' or 'PM' according to the given time value, or the + * corresponding strings for the current locale. Noon is treated as 'PM' + * and midnight as 'AM'. + * + * @b %%P : Like %p but in lower case: 'am' or 'pm' or a corresponding string for + * the current locale. + * + * @b %%c : The preferred date and time representation for the current locale. + * + * @b %%x : The preferred date representation for the current locale without the time. + * + * @b %%X : The preferred time representation for the current locale without the date. + * + * @b %%r : The complete calendar time using the AM/PM format of the current locale. + * + * @b %%R : The hour and minute in decimal numbers using the format %H:%M. + * + * @b %%T : The time of day in decimal numbers using the format %H:%M:%S. + * + * @b %%D : The date using the format %%m/%%d/%%y. + * + * @b %%F : The date using the format %%Y-%%m-%%d. + * + * These specifiers can be arranged in any order and the widget will display the + * fields accordingly. + * + * Default format is taken as per the system locale settings. + * + * @param obj The datetime object + * @return The datetime format string. Example: "%b %d, %Y %I : %M %p" + * + * @see elm_datetime_format_set() + * @ingroup Datetime + */ + EAPI const char *elm_datetime_format_get(const Evas_Object *obj); + +/** + * Set the datetime format. Format is a combination of allowed Libc date format + * specifiers like: "%b %d, %Y %I : %M %p". + * + * Maximum allowed format length is 64 chars. + * + * Format can include separators for each individual datetime field except + * for AM/PM field. + * + * Each separator can be a maximum of 6 UTF-8 bytes. + * Space is also taken as a separator. + * + * Following are the allowed set of format specifiers for each datetime field. + * + * @b %%Y : The year as a decimal number including the century. + * + * @b %%y : The year as a decimal number without a century (range 00 to 99). + * + * @b %%m : The month as a decimal number (range 01 to 12). + * + * @b %%b : The abbreviated month name according to the current locale. + * + * @b %%B : The full month name according to the current locale. + * + * @b %%h : The abbreviated month name according to the current locale(same as %%b). + * + * @b %%d : The day of the month as a decimal number (range 01 to 31). + * + * @b %%e : The day of the month as a decimal number (range 1 to 31). single + * digits are preceded by a blank. + * + * @b %%I : The hour as a decimal number using a 12-hour clock (range 01 to 12). + * + * @b %%H : The hour as a decimal number using a 24-hour clock (range 00 to 23). + * + * @b %%k : The hour (24-hour clock) as a decimal number (range 0 to 23). single + * digits are preceded by a blank. + * + * @b %%l : The hour (12-hour clock) as a decimal number (range 1 to 12); single + * digits are preceded by a blank. + * + * @b %%M : The minute as a decimal number (range 00 to 59). + * + * @b %%p : Either 'AM' or 'PM' according to the given time value, or the + * corresponding strings for the current locale. Noon is treated as 'PM' + * and midnight as 'AM'. + * + * @b %%P : Like %p but in lower case: 'am' or 'pm' or a corresponding string for + * the current locale. + * + * @b %%c : The preferred date and time representation for the current locale. + * + * @b %%x : The preferred date representation for the current locale without the time. + * + * @b %%X : The preferred time representation for the current locale without the date. + * + * @b %%r : The complete calendar time using the AM/PM format of the current locale. + * + * @b %%R : The hour and minute in decimal numbers using the format %H:%M. + * + * @b %%T : The time of day in decimal numbers using the format %H:%M:%S. + * + * @b %%D : The date using the format %%m/%%d/%%y. + * + * @b %%F : The date using the format %%Y-%%m-%%d. + * + * These specifiers can be arranged in any order and the widget will display the + * fields accordingly. + * + * Default format is taken as per the system locale settings. + * + * @param obj The datetime object + * @param fmt The datetime format + * + * @see elm_datetime_format_get() + * @ingroup Datetime + */ +EAPI void elm_datetime_format_set(Evas_Object *obj, const char *fmt); + +/** + * @brief Get the upper boundary of a field. + * + * Year: years since 1900. Negative value represents year below 1900 (year + * value -30 represents 1870). Year default range is from 70 to 137. + * + * Month: default value range is from 0 to 11. + * + * Date: default value range is from 1 to 31 according to the month value. + * + * Hour: default value will be in terms of 24 hr format (0~23) + * + * Minute: default value range is from 0 to 59. + * + * @param obj The datetime object + * @param maxtime Time structure containing the maximum time value. + * @return int The maximum value of the field. + * + * @see elm_datetime_value_max_set() + * @ingroup Datetime + */ +EAPI Eina_Bool elm_datetime_value_max_get(const Evas_Object *obj, struct tm *maxtime); + +/** + * @brief Set the upper boundary of a field. + * + * Year: years since 1900. Negative value represents year below 1900 (year + * value -30 represents 1870). Year default range is from 70 to 137. + * + * Month: default value range is from 0 to 11. + * + * Date: default value range is from 1 to 31 according to the month value. + * + * Hour: default value will be in terms of 24 hr format (0~23) + * + * Minute: default value range is from 0 to 59. + * + * @param obj The datetime object + * @param maxtime Time structure containing the maximum time value. + * @return EINA_TRUE if maximum value is accepted. + * + * @see elm_datetime_value_max_get() + * @ingroup Datetime + */ +EAPI Eina_Bool elm_datetime_value_max_set(Evas_Object *obj, const struct tm *maxtime); + +/** + * @brief Get the lower boundary of a field. + * + * Year: years since 1900. Negative value represents year below 1900 (year + * value -30 represents 1870). Year default range is from 70 to 137. + * + * Month: default value range is from 0 to 11. + * + * Date: default value range is from 1 to 31 according to the month value. + * + * Hour: default value will be in terms of 24 hr format (0~23) + * + * Minute: default value range is from 0 to 59. + * + * @param obj The datetime object + * @param mintime Time structure. + * @return EINA_TRUE if minimum value is successfully returned. + * + * @see elm_datetime_value_min_set() + * @ingroup Datepicker + */ +EAPI Eina_Bool elm_datetime_value_min_get(const Evas_Object *obj, struct tm *mintime); + +/** + * @brief Set the lower boundary of a field. + * + * Year: years since 1900. Negative value represents year below 1900 (year + * value -30 represents 1870). Year default range is from 70 to 137. + * + * Month: default value range is from 0 to 11. + * + * Date: default value range is from 1 to 31 according to the month value. + * + * Hour: default value will be in terms of 24 hr format (0~23) + * + * Minute: default value range is from 0 to 59. + * + * @param obj The datetime object. + * @param mintime Time structure containing the minimum time value. + * @return EINA_TRUE if minimum value is accepted. + * + * @see elm_datetime_value_min_get() + * @ingroup Datetime + */ +EAPI Eina_Bool elm_datetime_value_min_set(Evas_Object *obj, const struct tm *mintime); + +/** + * @brief Get the field limits of a field. + * + * Limits can be set to individual fields, independently, except for AM/PM field. + * Any field can display the values only in between these Minimum and Maximum limits unless + * the corresponding time value is restricted from MinTime to MaxTime. + * That is, Min/ Max field limits always works under the limitations of MinTime/ MaxTime. + * + * There is no provision to set the limits of AM/PM field. + * + * @param obj The datetime object + * @param fieldtype Type of the field. ELM_DATETIME_YEAR etc. + * @param min Reference to field's minimum value + * @param max Reference to field's maximum value + * + * @see elm_datetime_field_limit_set() + * @ingroup Datetime + */ +EAPI void elm_datetime_field_limit_get(const Evas_Object *obj, Elm_Datetime_Field_Type fieldtype, int *min, int *max); + +/** + * @brief Set the field limits of a field. + * + * Limits can be set to individual fields, independently, except for AM/PM field. + * Any field can display the values only in between these Minimum and Maximum limits unless + * the corresponding time value is restricted from MinTime to MaxTime. + * That is, Min/ Max field limits always works under the limitations of MinTime/ MaxTime. + * + * There is no provision to set the limits of AM/PM field. + * + * @param obj The datetime object + * @param fieldtype Type of the field. ELM_DATETIME_YEAR etc. + * @param min Reference to field's minimum value + * @param max Reference to field's maximum value + * + * @see elm_datetime_field_limit_set() + * @ingroup Datetime + */ +EAPI void elm_datetime_field_limit_set(Evas_Object *obj, Elm_Datetime_Field_Type fieldtype, int min, int max); + +/** + * @brief Get the current value of a field. + * + * Year: years since 1900. Negative value represents year below 1900 (year + * value -30 represents 1870). Year default range is from 70 to 137. + * + * Month: default value range is from 0 to 11. + * + * Date: default value range is from 1 to 31 according to the month value. + * + * Hour: default value will be in terms of 24 hr format (0~23) + * + * Minute: default value range is from 0 to 59. + * + * @param obj The datetime object. + * @param currtime Time structure. + * @return EINA_TRUE if current time is returned successfully. + * + * @see elm_datetime_field_value_set() + * @ingroup Datetime + */ +EAPI Eina_Bool elm_datetime_value_get(const Evas_Object *obj, struct tm *currtime); + +/** + * @brief Set the current value of a Datetime object. + * + * Year: years since 1900. Negative value represents year below 1900 (year + * value -30 represents 1870). Year default range is from 70 to 137. + * + * Month: default value range is from 0 to 11. + * + * Date: default value range is from 1 to 31 according to the month value. + * + * Hour: default value will be in terms of 24 hr format (0~23) + * + * Minute: default value range is from 0 to 59. + * + * + * @param obj The datetime object. + * @param newtime Time structure filled with values to be set. + * @return EINA_TRUE if current time is set successfully. + * + * @see elm_datetime_value_set() + * @ingroup Datetime + */ +EAPI Eina_Bool elm_datetime_value_set(Evas_Object *obj, const struct tm *newtime); + +/** + * @brief Get whether a field can be visible/not + * + * @param obj The datetime object + * @param fieldtype Type of the field. ELM_DATETIME_YEAR etc + * @return bool @c EINA_TRUE, if field can be visible. @c EINA_FALSE otherwise. + * + * @see elm_datetime_field_visible_set() + * @ingroup Datetime + */ +EAPI Eina_Bool elm_datetime_field_visible_get(const Evas_Object *obj, Elm_Datetime_Field_Type fieldtype); + +/** + * @brief Set a field to be visible or not. + * Setting this API True does not ensure that the field is visible, apart from + * this, the field's format must be present in Datetime overall format. + * If a field's visibility is set to False then it won't appear even though + * its format is present in overall format. + * So if and only if this API is set true and the corresponding field's format + * is present in Datetime format, the field is visible. + * + * By default the field visibility is set to True. + * + * @param obj The datetime object + * @param fieldtype Type of the field. ELM_DATETIME_YEAR etc. + * @param visible @c EINA_TRUE field can be visible, @c EINA_FALSE otherwise. + * + * @see elm_datetime_field_visible_get() + * @ingroup Datetime + */ +EAPI void elm_datetime_field_visible_set(Evas_Object *obj, Elm_Datetime_Field_Type fieldtype, Eina_Bool visible); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_debug.h b/libraries/elementary/src/lib/elm_debug.h new file mode 100644 index 0000000..f5de943 --- /dev/null +++ b/libraries/elementary/src/lib/elm_debug.h @@ -0,0 +1,28 @@ +/** + * @defgroup Debug Debug + * @ingroup Elementary + * Don't use it unless you are sure. + * + * @{ + */ + +/** + * Print Tree object hierarchy in stdout + * + * @param top The root object + * @ingroup Debug + */ +EAPI void elm_object_tree_dump(const Evas_Object *top); + +/** + * Print Elm Objects tree hierarchy in file as dot(graphviz) syntax. + * + * @param top The root object + * @param file The path of output file + * @ingroup Debug + */ +EAPI void elm_object_tree_dot_dump(const Evas_Object *top, const char *file); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_deprecated.h b/libraries/elementary/src/lib/elm_deprecated.h new file mode 100644 index 0000000..49f88c2 --- /dev/null +++ b/libraries/elementary/src/lib/elm_deprecated.h @@ -0,0 +1,423 @@ + +EINA_DEPRECATED EAPI Evas_Object *elm_scrolled_entry_add(Evas_Object *parent); +EINA_DEPRECATED EAPI void elm_scrolled_entry_single_line_set(Evas_Object *obj, Eina_Bool single_line); +EINA_DEPRECATED EAPI Eina_Bool elm_scrolled_entry_single_line_get(const Evas_Object *obj); +EINA_DEPRECATED EAPI void elm_scrolled_entry_password_set(Evas_Object *obj, Eina_Bool password); +EINA_DEPRECATED EAPI Eina_Bool elm_scrolled_entry_password_get(const Evas_Object *obj); +EINA_DEPRECATED EAPI void elm_scrolled_entry_entry_set(Evas_Object *obj, const char *entry); +EINA_DEPRECATED EAPI const char *elm_scrolled_entry_entry_get(const Evas_Object *obj); +EINA_DEPRECATED EAPI void elm_scrolled_entry_entry_append(Evas_Object *obj, const char *entry); +EINA_DEPRECATED EAPI Eina_Bool elm_scrolled_entry_is_empty(const Evas_Object *obj); +EINA_DEPRECATED EAPI const char *elm_scrolled_entry_selection_get(const Evas_Object *obj); +EINA_DEPRECATED EAPI void elm_scrolled_entry_entry_insert(Evas_Object *obj, const char *entry); +EINA_DEPRECATED EAPI void elm_scrolled_entry_line_wrap_set(Evas_Object *obj, Elm_Wrap_Type wrap); +EINA_DEPRECATED EAPI void elm_scrolled_entry_editable_set(Evas_Object *obj, Eina_Bool editable); +EINA_DEPRECATED EAPI Eina_Bool elm_scrolled_entry_editable_get(const Evas_Object *obj); +EINA_DEPRECATED EAPI void elm_scrolled_entry_select_none(Evas_Object *obj); +EINA_DEPRECATED EAPI void elm_scrolled_entry_select_all(Evas_Object *obj); +EINA_DEPRECATED EAPI Eina_Bool elm_scrolled_entry_cursor_next(Evas_Object *obj); +EINA_DEPRECATED EAPI Eina_Bool elm_scrolled_entry_cursor_prev(Evas_Object *obj); +EINA_DEPRECATED EAPI Eina_Bool elm_scrolled_entry_cursor_up(Evas_Object *obj); +EINA_DEPRECATED EAPI Eina_Bool elm_scrolled_entry_cursor_down(Evas_Object *obj); +EINA_DEPRECATED EAPI void elm_scrolled_entry_cursor_begin_set(Evas_Object *obj); +EINA_DEPRECATED EAPI void elm_scrolled_entry_cursor_end_set(Evas_Object *obj); +EINA_DEPRECATED EAPI void elm_scrolled_entry_cursor_line_begin_set(Evas_Object *obj); +EINA_DEPRECATED EAPI void elm_scrolled_entry_cursor_line_end_set(Evas_Object *obj); +EINA_DEPRECATED EAPI void elm_scrolled_entry_cursor_selection_begin(Evas_Object *obj); +EINA_DEPRECATED EAPI void elm_scrolled_entry_cursor_selection_end(Evas_Object *obj); +EINA_DEPRECATED EAPI Eina_Bool elm_scrolled_entry_cursor_is_format_get(const Evas_Object *obj); +EINA_DEPRECATED EAPI Eina_Bool elm_scrolled_entry_cursor_is_visible_format_get(const Evas_Object *obj); +EINA_DEPRECATED EAPI const char *elm_scrolled_entry_cursor_content_get(const Evas_Object *obj); +EINA_DEPRECATED EAPI void elm_scrolled_entry_cursor_pos_set(Evas_Object *obj, int pos); +EINA_DEPRECATED EAPI int elm_scrolled_entry_cursor_pos_get(const Evas_Object *obj); +EINA_DEPRECATED EAPI void elm_scrolled_entry_selection_cut(Evas_Object *obj); +EINA_DEPRECATED EAPI void elm_scrolled_entry_selection_copy(Evas_Object *obj); +EINA_DEPRECATED EAPI void elm_scrolled_entry_selection_paste(Evas_Object *obj); +EINA_DEPRECATED EAPI void elm_scrolled_entry_context_menu_clear(Evas_Object *obj); +EINA_DEPRECATED EAPI void elm_scrolled_entry_context_menu_item_add(Evas_Object *obj, const char *label, const char *icon_file, Elm_Icon_Type icon_type, Evas_Smart_Cb func, const void *data); +EINA_DEPRECATED EAPI void elm_scrolled_entry_context_menu_disabled_set(Evas_Object *obj, Eina_Bool disabled); +EINA_DEPRECATED EAPI Eina_Bool elm_scrolled_entry_context_menu_disabled_get(const Evas_Object *obj); +EINA_DEPRECATED EAPI void elm_scrolled_entry_scrollbar_policy_set(Evas_Object *obj, Elm_Scroller_Policy h, Elm_Scroller_Policy v); +EINA_DEPRECATED EAPI void elm_scrolled_entry_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce); +EINA_DEPRECATED EAPI void elm_scrolled_entry_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce); +EINA_DEPRECATED EAPI void elm_scrolled_entry_icon_set(Evas_Object *obj, Evas_Object *icon); +EINA_DEPRECATED EAPI Evas_Object *elm_scrolled_entry_icon_get(const Evas_Object *obj); +EINA_DEPRECATED EAPI Evas_Object *elm_scrolled_entry_icon_unset(Evas_Object *obj); +EINA_DEPRECATED EAPI void elm_scrolled_entry_icon_visible_set(Evas_Object *obj, Eina_Bool setting); +EINA_DEPRECATED EAPI void elm_scrolled_entry_end_set(Evas_Object *obj, Evas_Object *end); +EINA_DEPRECATED EAPI Evas_Object *elm_scrolled_entry_end_get(const Evas_Object *obj); +EINA_DEPRECATED EAPI Evas_Object *elm_scrolled_entry_end_unset(Evas_Object *obj); +EINA_DEPRECATED EAPI void elm_scrolled_entry_end_visible_set(Evas_Object *obj, Eina_Bool setting); +EINA_DEPRECATED EAPI void elm_scrolled_entry_item_provider_append(Evas_Object *obj, Evas_Object * (*func)(void *data, Evas_Object * entry, const char *item), void *data); +EINA_DEPRECATED EAPI void elm_scrolled_entry_item_provider_prepend(Evas_Object *obj, Evas_Object * (*func)(void *data, Evas_Object * entry, const char *item), void *data); +EINA_DEPRECATED EAPI void elm_scrolled_entry_item_provider_remove(Evas_Object *obj, Evas_Object * (*func)(void *data, Evas_Object * entry, const char *item), void *data); +EINA_DEPRECATED EAPI void elm_scrolled_entry_text_filter_append(Evas_Object *obj, void (*func)(void *data, Evas_Object *entry, char **text), void *data); +EINA_DEPRECATED EAPI void elm_scrolled_entry_text_filter_prepend(Evas_Object *obj, void (*func)(void *data, Evas_Object *entry, char **text), void *data); +EINA_DEPRECATED EAPI void elm_scrolled_entry_text_filter_remove(Evas_Object *obj, void (*func)(void *data, Evas_Object *entry, char **text), void *data); +EINA_DEPRECATED EAPI void elm_scrolled_entry_file_set(Evas_Object *obj, const char *file, Elm_Text_Format format); +EINA_DEPRECATED EAPI void elm_scrolled_entry_file_get(const Evas_Object *obj, const char **file, Elm_Text_Format *format); +EINA_DEPRECATED EAPI void elm_scrolled_entry_file_save(Evas_Object *obj); +EINA_DEPRECATED EAPI void elm_scrolled_entry_autosave_set(Evas_Object *obj, Eina_Bool autosave); +EINA_DEPRECATED EAPI Eina_Bool elm_scrolled_entry_autosave_get(const Evas_Object *obj); +EINA_DEPRECATED EAPI void elm_scrolled_entry_cnp_textonly_set(Evas_Object *obj, Eina_Bool textonly); +EINA_DEPRECATED EAPI Eina_Bool elm_scrolled_entry_cnp_textonly_get(Evas_Object *obj); + +/** + * Convert a pixel coordinate (x,y) into a geographic coordinate + * (longitude, latitude). + * + * @param obj The map object. + * @param x the coordinate. + * @param y the coordinate. + * @param size the size in pixels of the map. + * The map is a square and generally his size is : pow(2.0, zoom)*256. + * @param lon Pointer to store the longitude that correspond to x. + * @param lat Pointer to store the latitude that correspond to y. + * + * @note Origin pixel point is the top left corner of the viewport. + * Map zoom and size are taken on account. + * + * @see elm_map_utils_convert_geo_into_coord() if you need the inverse. + * + * @deprecated Use elm_map_canvas_to_geo_convert() instead + */ +EINA_DEPRECATED EAPI void elm_map_utils_convert_coord_into_geo(const Evas_Object *obj, int x, int y, int size, double *lon, double *lat); + +/** + * Convert a geographic coordinate (longitude, latitude) into a pixel + * coordinate (x, y). + * + * @param obj The map object. + * @param lon the longitude. + * @param lat the latitude. + * @param size the size in pixels of the map. The map is a square + * and generally his size is : pow(2.0, zoom)*256. + * @param x Pointer to store the horizontal pixel coordinate that + * correspond to the longitude. + * @param y Pointer to store the vertical pixel coordinate that + * correspond to the latitude. + * + * @note Origin pixel point is the top left corner of the viewport. + * Map zoom and size are taken on account. + * + * @see elm_map_utils_convert_coord_into_geo() if you need the inverse. + * + * @deprecatedUse Use elm_map_canvas_to_geo_convert() instead + */ +EINA_DEPRECATED EAPI void elm_map_utils_convert_geo_into_coord(const Evas_Object *obj, double lon, double lat, int size, int *x, int *y); + +/** + * Get the information of downloading status. + * + * @param obj The map object. + * @param try_num Pointer to store number of tiles being downloaded. + * @param finish_num Pointer to store number of tiles successfully + * downloaded. + * + * This gets the current downloading status for the map object, the number + * of tiles being downloaded and the number of tiles already downloaded. + * + * @deprecatedUse Use elm_map_tile_load_status_get() instead + */ +EINA_DEPRECATED EAPI void elm_map_utils_downloading_status_get(const Evas_Object *obj, int *try_num, int *finish_num); + +/** + * Convert a geographic coordinate (longitude, latitude) into a name + * (address). + * + * @param obj The map object. + * @param lon the longitude. + * @param lat the latitude. + * @return name A #Elm_Map_Name handle for this coordinate. + * + * To get the string for this address, elm_map_name_address_get() + * should be used. + * + * @see elm_map_utils_convert_name_into_coord() if you need the inverse. + * @deprecatedUse Use elm_map_name_add() instead + * + */ +EINA_DEPRECATED EAPI Elm_Map_Name *elm_map_utils_convert_coord_into_name(const Evas_Object *obj, double lon, double lat); + +/** + * Convert a name (address) into a geographic coordinate + * (longitude, latitude). + * + * @param obj The map object. + * @param address The address. + * @return name A #Elm_Map_Name handle for this address. + * + * To get the longitude and latitude, elm_map_name_region_get() + * should be used. + * + * @see elm_map_utils_convert_coord_into_name() if you need the inverse. + * @deprecatedUse Use elm_map_name_geo_request() instead + * + */ +EINA_DEPRECATED EAPI Elm_Map_Name *elm_map_utils_convert_name_into_coord(const Evas_Object *obj, char *address); + +/** + * Add a new marker to the map object. + * + * @param obj The map object. + * @param lon The longitude of the marker. + * @param lat The latitude of the marker. + * @param clas The class, to use when marker @b isn't grouped to others. + * @param clas_group The class group, to use when marker is grouped to others + * @param data The data passed to the callbacks. + * + * @return The created marker or @c NULL upon failure. + * + * A marker will be created and shown in a specific point of the map, defined + * by @p lon and @p lat. + * + * It will be displayed using style defined by @p class when this marker + * is displayed alone (not grouped). A new class can be created with + * elm_map_marker_class_new(). + * + * If the marker is grouped to other markers, it will be displayed with + * style defined by @p class_group. Markers with the same group are grouped + * if they are close. A new group class can be created with + * elm_map_marker_group_class_new(). + * + * Markers created with this method can be deleted with + * elm_map_marker_remove(). + * + * A marker can have associated content to be displayed by a bubble, + * when a user click over it, as well as an icon. These objects will + * be fetch using class' callback functions. + * + * @see elm_map_marker_class_new() + * @see elm_map_marker_group_class_new() + * @see elm_map_marker_remove() + * + * @deprecated Use Elm_Map_Overlay instead + */ +EINA_DEPRECATED EAPI Elm_Map_Marker *elm_map_marker_add(Evas_Object *obj, double lon, double lat, Elm_Map_Marker_Class *clas, Elm_Map_Group_Class *clas_group, void *data); + +/** + * Remove a marker from the map. + * + * @param marker The marker to remove. + * + * @see elm_map_marker_add() + * + * @deprecated Use Elm_Map_Overlay instead + */ +EINA_DEPRECATED EAPI void elm_map_marker_remove(Elm_Map_Marker *marker); + +/** + * Get the current coordinates of the marker. + * + * @param marker marker. + * @param lat Pointer to store the marker's latitude. + * @param lon Pointer to store the marker's longitude. + * + * These values are set when adding markers, with function + * elm_map_marker_add(). + * + * @see elm_map_marker_add() + * + * @deprecated Use Elm_Map_Overlay instead + */ +EINA_DEPRECATED EAPI void elm_map_marker_region_get(const Elm_Map_Marker *marker, double *lon, double *lat); + +/** + * Animatedly bring in given marker to the center of the map. + * + * @param marker The marker to center at. + * + * This causes map to jump to the given @p marker's coordinates + * and show it (by scrolling) in the center of the viewport, if it is not + * already centered. This will use animation to do so and take a period + * of time to complete. + * + * @see elm_map_marker_show() for a function to avoid animation. + * @see elm_map_marker_region_get() + * + * @deprecated Use Elm_Map_Overlay instead + */ +EINA_DEPRECATED EAPI void elm_map_marker_bring_in(Elm_Map_Marker *marker); + +/** + * Show the given marker at the center of the map, @b immediately. + * + * @param marker The marker to center at. + * + * This causes map to @b redraw its viewport's contents to the + * region containing the given @p marker's coordinates, that will be + * moved to the center of the map. + * + * @see elm_map_marker_bring_in() for a function to move with animation. + * @see elm_map_markers_list_show() if more than one marker need to be + * displayed. + * @see elm_map_marker_region_get() + * + * @deprecated Use Elm_Map_Overlay instead + */ +EINA_DEPRECATED EAPI void elm_map_marker_show(Elm_Map_Marker *marker); + +/** + * Move and zoom the map to display a list of markers. + * + * @param markers A list of #Elm_Map_Marker handles. + * + * The map will be centered on the center point of the markers in the list. + * Then the map will be zoomed in order to fit the markers using the maximum + * zoom which allows display of all the markers. + * + * @warning All the markers should belong to the same map object. + * + * @see elm_map_marker_show() to show a single marker. + * @see elm_map_marker_bring_in() + * + * @deprecated Use Elm_Map_Overlay instead + */ +EINA_DEPRECATED EAPI void elm_map_markers_list_show(Eina_List *markers); + +/** + * Get the Evas object returned by the Elm_Map_Marker_Get_Func callback + * + * @param marker The marker which content should be returned. + * @return Return the evas object if it exists, else @c NULL. + * + * To set callback function #Elm_Map_Marker_Get_Func for the marker class, + * elm_map_marker_class_get_cb_set() should be used. + * + * This content is what will be inside the bubble that will be displayed + * when an user clicks over the marker. + * + * This returns the actual Evas object used to be placed inside + * the bubble. This may be @c NULL, as it may + * not have been created or may have been deleted, at any time, by + * the map. Do not modify this object (move, resize, + * show, hide, etc.), as the map is controlling it. This + * function is for querying, emitting custom signals or hooking + * lower level callbacks for events on that object. Do not delete + * this object under any circumstances. + * + * @deprecated Use Elm_Map_Overlay instead + */ +EINA_DEPRECATED EAPI Evas_Object *elm_map_marker_object_get(const Elm_Map_Marker *marker); + +/** + * Update the marker + * + * @param marker The marker to be updated. + * + * If a content is set to this marker, it will call function to delete it, + * #Elm_Map_Marker_Del_Func, and then will fetch the content again with + * #Elm_Map_Marker_Get_Func. + * + * These functions are set for the marker class with + * elm_map_marker_class_get_cb_set() and elm_map_marker_class_del_cb_set(). + * + * @deprecated Use Elm_Map_Overlay instead + */ +EINA_DEPRECATED EAPI void elm_map_marker_update(Elm_Map_Marker *marker); + +/** + * Create a new group class. + * + * @param obj The map object. + * @return Returns the new group class. + * + * Each marker must be associated to a group class. Markers in the same + * group are grouped if they are close. + * + * The group class defines the style of the marker when a marker is grouped + * to others markers. When it is alone, another class will be used. + * + * A group class will need to be provided when creating a marker with + * elm_map_marker_add(). + * + * Some properties and functions can be set by class, as: + * - style, with elm_map_group_class_style_set() + * - data - to be associated to the group class. It can be set using + * elm_map_group_class_data_set(). + * - min zoom to display markers, set with + * elm_map_group_class_zoom_displayed_set(). + * - max zoom to group markers, set using + * elm_map_group_class_zoom_grouped_set(). + * - visibility - set if markers will be visible or not, set with + * elm_map_group_class_hide_set(). + * - #Elm_Map_Group_Icon_Get_Func - used to fetch icon for markers group classes. + * It can be set using elm_map_group_class_icon_cb_set(). + * + * @see elm_map_marker_add() + * @see elm_map_group_class_style_set() + * @see elm_map_group_class_data_set() + * @see elm_map_group_class_zoom_displayed_set() + * @see elm_map_group_class_zoom_grouped_set() + * @see elm_map_group_class_hide_set() + * @see elm_map_group_class_icon_cb_set() + * + * @deprecated Use Elm_Map_Overlay instead + */ +EINA_DEPRECATED EAPI Elm_Map_Group_Class *elm_map_group_class_new(Evas_Object *obj); + +/** + * Create a new marker class. + * + * @param obj The map object. + * @return Returns the new group class. + * + * Each marker must be associated to a class. + * + * The marker class defines the style of the marker when a marker is + * displayed alone, i.e., not grouped to to others markers. When grouped + * it will use group class style. + * + * A marker class will need to be provided when creating a marker with + * elm_map_marker_add(). + * + * Some properties and functions can be set by class, as: + * - style, with elm_map_marker_class_style_set() + * - #Elm_Map_Marker_Icon_Get_Func - used to fetch icon for markers classes. + * It can be set using elm_map_marker_class_icon_cb_set(). + * - #Elm_Map_Marker_Get_Func - used to fetch bubble content for marker classes. + * Set using elm_map_marker_class_get_cb_set(). + * - #Elm_Map_Marker_Del_Func - used to delete bubble content for marker classes. + * Set using elm_map_marker_class_del_cb_set(). + * + * @see elm_map_marker_add() + * @see elm_map_marker_class_style_set() + * @see elm_map_marker_class_icon_cb_set() + * @see elm_map_marker_class_get_cb_set() + * @see elm_map_marker_class_del_cb_set() + * + * @deprecated Use Elm_Map_Overlay instead + */ +EINA_DEPRECATED EAPI Elm_Map_Marker_Class *elm_map_marker_class_new(Evas_Object *obj); + +/** + * Remove a route from the map. + * + * @param route The route to remove. + * + * @see elm_map_route_add() + * @deprecated Use elm_map_route_del() instead + * + */ +EINA_DEPRECATED EAPI void elm_map_route_remove(Elm_Map_Route *route); + +/** + * @deprecated Use elm_object_item_data_get instead. + */ +EINA_DEPRECATED EAPI void * elm_multibuttonentry_item_data_get(const Elm_Object_Item *it); + +/** + * @deprecated Use elm_object_item_data_set instead. + */ +EINA_DEPRECATED EAPI void elm_multibuttonentry_item_data_set(Elm_Object_Item *it, void *data); + +/** + * @deprecated Use elm_calendar_select_mode_set instead. + */ +EINA_DEPRECATED EAPI void elm_calendar_day_selection_disabled_set(Evas_Object *obj, Eina_Bool disabled); + +/** + * @deprecated Use elm_calendar_select_mode_get instead. + */ +EINA_DEPRECATED EAPI Eina_Bool elm_calendar_day_selection_disabled_get(const Evas_Object *obj); + diff --git a/libraries/elementary/src/lib/elm_diskselector.c b/libraries/elementary/src/lib/elm_diskselector.c new file mode 100644 index 0000000..8334d37 --- /dev/null +++ b/libraries/elementary/src/lib/elm_diskselector.c @@ -0,0 +1,1401 @@ +#include +#include "elm_priv.h" +#include "els_scroller.h" + +#ifndef MAX +# define MAX(a, b) (((a) > (b)) ? (a) : (b)) +#endif + +#ifndef CEIL +#define CEIL(a) (((a) % 2 != 0) ? ((a) / 2 + 1) : ((a) / 2)) +#endif + +#define DISPLAY_ITEM_NUM_MIN 3 + +typedef struct _Widget_Data Widget_Data; +typedef struct _Elm_Diskselector_Item Elm_Diskselector_Item; + +struct _Widget_Data +{ + Evas_Object *self; + Evas_Object *scroller; + Evas_Object *main_box; + Evas_Object *left_blank; + Evas_Object *right_blank; + Elm_Diskselector_Item *selected_item; + Elm_Diskselector_Item *first; + Elm_Diskselector_Item *second; + Elm_Diskselector_Item *s_last; + Elm_Diskselector_Item *last; + Eina_List *items; + Eina_List *r_items; + Eina_List *over_items; + Eina_List *under_items; + int item_count, len_threshold, len_side, display_item_num; + Ecore_Idle_Enterer *idler; + Ecore_Idle_Enterer *check_idler; + Evas_Coord minw, minh; + Eina_Bool init:1; + Eina_Bool round:1; + Eina_Bool display_item_num_by_api:1; +}; + +struct _Elm_Diskselector_Item +{ + ELM_WIDGET_ITEM; + Eina_List *node; + Evas_Object *icon; + const char *label; + Evas_Smart_Cb func; +}; + +static const char *widtype = NULL; + +static Eina_Bool _move_scroller(void *data); +static void _del_hook(Evas_Object * obj); +static void _del_pre_hook(Evas_Object * obj); +static void _sizing_eval(Evas_Object * obj); +static void _theme_hook(Evas_Object * obj); +static void _on_focus_hook(void *data, Evas_Object *obj); +static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src, Evas_Callback_Type type, void *event_info); +static void _sub_del(void *data, Evas_Object * obj, void *event_info); +static void _round_items_del(Widget_Data *wd); +static void _scroller_move_cb(void *data, Evas_Object *obj, void *event_info); +static void _item_click_cb(void *data, Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, + const char *source __UNUSED__); +static void _selected_item_indicate(Elm_Diskselector_Item *it); +static void _item_text_set_hook(Elm_Object_Item *it, + const char *part, + const char *label); +static const char * _item_text_get_hook(const Elm_Object_Item *it, + const char *part); +static void _item_content_set_hook(Elm_Object_Item *it, + const char *part, + Evas_Object *content); +static Evas_Object * _item_content_get_hook(const Elm_Object_Item *it, + const char *part); + +static const char SIG_SELECTED[] = "selected"; +static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start"; +static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop"; +static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start"; +static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_SELECTED, ""}, + {SIG_SCROLL_ANIM_START, ""}, + {SIG_SCROLL_ANIM_STOP, ""}, + {SIG_SCROLL_DRAG_START, ""}, + {SIG_SCROLL_DRAG_STOP, ""}, + {NULL, NULL} +}; + +static void +_diskselector_object_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd; + Evas_Coord w, h; + + wd = elm_widget_data_get(data); + if (!wd) return; + + if ((wd->minw == -1) && (wd->minh == -1)) + elm_coords_finger_size_adjust(6, &wd->minw, 1, &wd->minh); + edje_object_size_min_restricted_calc + (elm_smart_scroller_edje_object_get + (wd->scroller), &wd->minw, &wd->minh, wd->minw, wd->minh); + evas_object_size_hint_min_set(obj, wd->minw, wd->minh); + evas_object_size_hint_max_set(obj, -1, -1); + + evas_object_geometry_get(wd->scroller, NULL, NULL, &w, &h); + if (wd->round) + evas_object_resize(wd->main_box, (w / wd->display_item_num) * (wd->item_count + (CEIL(wd->display_item_num) * 2)), h); + else + evas_object_resize(wd->main_box, (w / wd->display_item_num) * (wd->item_count + CEIL(wd->display_item_num)), h); + + elm_smart_scroller_paging_set(wd->scroller, 0, 0, + (int)(w / wd->display_item_num), 0); + + if (!wd->idler) + wd->idler = ecore_idle_enterer_before_add(_move_scroller, data); +} + +static void +_item_del(Elm_Diskselector_Item *item) +{ + if (!item) return; + eina_stringshare_del(item->label); + if (item->icon) + evas_object_del(item->icon); +} + +static int +_count_letter(const char *str) +{ + int pos = 0; + int code = 0, chnum; + + for (chnum = 0; ; chnum++) + { + pos = evas_string_char_next_get(str, pos, &code); + if (code == 0) break; + } + return chnum; +} + +static int +_check_letter(const char *str, int length) +{ + int pos = 0; + int code = 0, chnum; + + for (chnum = 0; ; chnum++) + { + if (chnum == length) break; + pos = evas_string_char_next_get(str, pos, &code); + if (code == 0) break; + } + return pos; +} + +static Eina_Bool +_check_string(void *data) +{ + int mid, steps, length, diff; + Elm_Diskselector_Item *it; + Eina_List *list, *l; + Evas_Coord ox, ow; + char buf[1024]; + Widget_Data *wd = data; + + evas_object_geometry_get(wd->scroller, &ox, NULL, &ow, NULL); + if (ow <= 0) + return EINA_FALSE; + if (!wd->init) + return EINA_FALSE; + if (!wd->round) + list = wd->items; + else + list = wd->r_items; + + EINA_LIST_FOREACH(list, l, it) + { + Evas_Coord x, w; + int len; + evas_object_geometry_get(VIEW(it), &x, NULL, &w, NULL); + /* item not visible */ + if ((x + w <= ox) || (x >= ox + ow)) + continue; + + len = _count_letter(it->label); +// // FIXME: len should be # of ut8f letters. ie count using utf8 string walk, not stringshare len +// len = eina_stringshare_strlen(it->label); + + if (x <= ox + 5) + edje_object_signal_emit(VIEW(it), "elm,state,left_side", + "elm"); + else if (x + w >= ox + ow - 5) + edje_object_signal_emit(VIEW(it), "elm,state,right_side", + "elm"); + else + { + if ((wd->len_threshold) && (len > wd->len_threshold)) + edje_object_signal_emit(VIEW(it), "elm,state,center_small", + "elm"); + else + edje_object_signal_emit(VIEW(it), "elm,state,center", + "elm"); + } + + // if len is les that the limit len, skip anyway + if (len <= wd->len_side) + continue; + + steps = len - wd->len_side + 1; + mid = x + w / 2; + if (mid <= ox + ow / 2) + diff = (ox + ow / 2) - mid; + else + diff = mid - (ox + ow / 2); + + length = len - (int)(diff * steps / (ow / 3)); + length = MAX(length, wd->len_side); + // limit string len to "length" ut8f chars + length = _check_letter(it->label, length); + // cut it off at byte mark returned form _check_letter + strncpy(buf, it->label, length); + buf[length] = '\0'; + edje_object_part_text_escaped_set(VIEW(it), "elm.text", buf); + } + + if (wd->check_idler) + ecore_idle_enterer_del(wd->check_idler); + wd->check_idler = NULL; + return EINA_FALSE; +} + +static Eina_Bool +_item_del_pre_hook(Elm_Object_Item *it) +{ + Elm_Diskselector_Item *item, *item2, *dit; + Eina_List *l; + int i = 0; + Widget_Data *wd; + item = (Elm_Diskselector_Item *)it; + wd = elm_widget_data_get(WIDGET(item)); + if (!wd) return EINA_FALSE; + + elm_box_unpack(wd->main_box, VIEW(item)); + + if (wd->round) + wd->r_items = eina_list_remove(wd->r_items, item); + + wd->items = eina_list_remove(wd->items, item); + + if (wd->selected_item == item) + { + dit = (Elm_Diskselector_Item *) eina_list_nth(wd->items, 0); + if (dit != item) + wd->selected_item = dit; + else + wd->selected_item = eina_list_nth(wd->items, 1); + + _selected_item_indicate(wd->selected_item); + } + + _item_del(item); + wd->item_count -= 1; + + if (wd->round) + { + if (!wd->item_count) + { + evas_object_hide(wd->VIEW(first)); + evas_object_hide(wd->VIEW(second)); + evas_object_hide(wd->VIEW(last)); + evas_object_hide(wd->VIEW(s_last)); + + EINA_LIST_FOREACH(wd->under_items, l, item2) + evas_object_hide(VIEW(item2)); + + EINA_LIST_FOREACH(wd->over_items, l, item2) + evas_object_hide(VIEW(item2)); + } + else + { + dit = eina_list_nth(wd->items, 0); + if (dit) + { + eina_stringshare_replace(&wd->first->label, dit->label); + edje_object_part_text_escaped_set(wd->VIEW(first), "elm.text", + wd->first->label); + } + dit = eina_list_nth(wd->items, 1); + if (dit) + { + eina_stringshare_replace(&wd->second->label, dit->label); + edje_object_part_text_escaped_set(wd->VIEW(second), "elm.text", + wd->second->label); + } + // if more than 3 itmes should be displayed + for (i = 2; i < CEIL(wd->display_item_num); i++) + { + dit = eina_list_nth(wd->items, i); + item2 = eina_list_nth(wd->over_items, i - 2); + eina_stringshare_replace(&item2->label, dit->label); + edje_object_part_text_escaped_set(VIEW(item2), "elm.text", item2->label); + } + + dit = eina_list_nth(wd->items, eina_list_count(wd->items) - 1); + if (dit) + { + eina_stringshare_replace(&wd->last->label, dit->label); + edje_object_part_text_escaped_set(wd->VIEW(last), "elm.text", + wd->last->label); + } + dit = eina_list_nth(wd->items, eina_list_count(wd->items) - 2); + if (dit) + { + eina_stringshare_replace(&wd->s_last->label, dit->label); + edje_object_part_text_escaped_set(wd->VIEW(s_last), "elm.text", + wd->s_last->label); + } + // if more than 3 itmes should be displayed + for (i = 3; i <= CEIL(wd->display_item_num); i++) + { + dit = eina_list_nth(wd->items, wd->item_count - i); + item2 = eina_list_nth(wd->under_items, i - 3); + eina_stringshare_replace(&item2->label, dit->label); + edje_object_part_text_escaped_set(VIEW(item2), "elm.text", + item2->label); + } + } + } + wd->check_idler = ecore_idle_enterer_before_add(_check_string, wd); + _sizing_eval(wd->self); + + return EINA_TRUE; +} + +static Elm_Diskselector_Item * +_item_new(Evas_Object *obj, Evas_Object *icon, const char *label, Evas_Smart_Cb func, const void *data) +{ + Elm_Diskselector_Item *it; + const char *style = elm_widget_style_get(obj); + + it = elm_widget_item_new(obj, Elm_Diskselector_Item); + if (!it) return NULL; + + elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook); + elm_widget_item_text_set_hook_set(it, _item_text_set_hook); + elm_widget_item_text_get_hook_set(it, _item_text_get_hook); + elm_widget_item_content_set_hook_set(it, _item_content_set_hook); + elm_widget_item_content_get_hook_set(it, _item_content_get_hook); + + it->label = eina_stringshare_add(label); + it->icon = icon; + it->func = func; + it->base.data = data; + VIEW(it) = edje_object_add(evas_object_evas_get(obj)); + _elm_theme_object_set(obj, VIEW(it), "diskselector", "item", style); + evas_object_size_hint_weight_set(VIEW(it), EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(VIEW(it), EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_show(VIEW(it)); + + if (it->label) + { + edje_object_part_text_escaped_set(VIEW(it), "elm.text", it->label); + edje_object_signal_callback_add(VIEW(it), "elm,action,click", "", _item_click_cb, it); + } + if (it->icon) + { + evas_object_size_hint_min_set(it->icon, 24, 24); + evas_object_size_hint_max_set(it->icon, 40, 40); + edje_object_part_swallow(VIEW(it), "elm.swallow.icon", it->icon); + evas_object_show(it->icon); + elm_widget_sub_object_add(obj, it->icon); + } + return it; +} + +static void +_theme_data_get(Widget_Data *wd) +{ + const char* str; + str = edje_object_data_get(wd->right_blank, "len_threshold"); + if (str) wd->len_threshold = MAX(0, atoi(str)); + else wd->len_threshold = 0; + + if (!wd->display_item_num_by_api) + { + str = edje_object_data_get(wd->right_blank, "display_item_num"); + if (str) wd->display_item_num = MAX(DISPLAY_ITEM_NUM_MIN, atoi(str)); + else wd->display_item_num = DISPLAY_ITEM_NUM_MIN; + } + + str = edje_object_data_get(wd->right_blank, "min_width"); + if (str) wd->minw = MAX(-1, atoi(str)); + else wd->minw = -1; + + str = edje_object_data_get(wd->right_blank, "min_height"); + if (str) wd->minh = MAX(-1, atoi(str)); + else wd->minh = -1; +} + +static void +_del_hook(Evas_Object * obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + free(wd); +} + +static void +_del_pre_hook(Evas_Object * obj) +{ + Elm_Diskselector_Item *it; + Eina_List *l; + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (wd->left_blank) + evas_object_del(wd->left_blank); + if (wd->right_blank) + evas_object_del(wd->right_blank); + if (wd->last) + { + eina_stringshare_del(wd->last->label); + evas_object_del(wd->VIEW(last)); + free(wd->last); + } + if (wd->s_last) + { + eina_stringshare_del(wd->s_last->label); + evas_object_del(wd->VIEW(s_last)); + free(wd->s_last); + } + if (wd->second) + { + eina_stringshare_del(wd->second->label); + evas_object_del(wd->VIEW(second)); + free(wd->second); + } + if (wd->first) + { + eina_stringshare_del(wd->first->label); + evas_object_del(wd->VIEW(first)); + free(wd->first); + } + + EINA_LIST_FOREACH(wd->under_items, l, it) + { + if (it) + { + eina_stringshare_del(it->label); + evas_object_del(VIEW(it)); + free(it); + } + } + + EINA_LIST_FOREACH(wd->over_items, l, it) + { + if (it) + { + eina_stringshare_del(it->label); + evas_object_del(VIEW(it)); + free(it); + } + } + + EINA_LIST_FREE(wd->items, it) + { + _item_del(it); + elm_widget_item_free(it); + } + eina_list_free(wd->r_items); +} + +static void +_sizing_eval(Evas_Object * obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _diskselector_object_resize(obj, NULL, obj, NULL); +} + +static void +_theme_hook(Evas_Object * obj) +{ + Eina_List *l; + Elm_Diskselector_Item *it; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (wd->scroller) + elm_smart_scroller_object_theme_set(obj, wd->scroller, "diskselector", + "base", elm_widget_style_get(obj)); + if (wd->round) + { + EINA_LIST_FOREACH(wd->r_items, l, it) + { + _elm_theme_object_set(obj, VIEW(it), "diskselector", "item", + elm_widget_style_get(obj)); + edje_object_part_text_escaped_set(VIEW(it), "elm.text", it->label); + } + } + else + { + EINA_LIST_FOREACH(wd->items, l, it) + { + _elm_theme_object_set(obj, VIEW(it), "diskselector", "item", + elm_widget_style_get(obj)); + edje_object_part_text_escaped_set(VIEW(it), "elm.text", it->label); + } + } + _elm_theme_object_set(obj, wd->right_blank, "diskselector", "item", + elm_widget_style_get(obj)); + _theme_data_get(wd); + _sizing_eval(obj); +} + +static void +_sub_del(void *data __UNUSED__, Evas_Object * obj, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *sub = event_info; + Elm_Diskselector_Item *it; + const Eina_List *l; + + if (!wd) return; + if (!sub) abort(); + if (sub == wd->scroller) + wd->scroller = NULL; + else + { + EINA_LIST_FOREACH(wd->items, l, it) + { + if (sub == it->icon) + { + it->icon = NULL; + _sizing_eval(obj); + break; + } + } + } +} + +static void +_select_item(Elm_Diskselector_Item *it) +{ + if (!it) return; + Widget_Data *wd = elm_widget_data_get(WIDGET(it)); + wd->selected_item = it; + _selected_item_indicate(wd->selected_item); + if (it->func) it->func((void *)it->base.data, WIDGET(it), it); + evas_object_smart_callback_call(WIDGET(it), SIG_SELECTED, it); +} + +static void +_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) + return; + + if (elm_widget_focus_get(obj)) + { + edje_object_signal_emit(wd->self, "elm,action,focus", "elm"); + evas_object_focus_set(wd->self, EINA_TRUE); + } + else + { + edje_object_signal_emit(wd->self, "elm,action,unfocus", "elm"); + evas_object_focus_set(wd->self, EINA_FALSE); + } +} + +static Eina_Bool +_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info) +{ + if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE; + Evas_Event_Key_Down *ev = event_info; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; + if (elm_widget_disabled_get(obj)) return EINA_FALSE; + + Elm_Diskselector_Item *it = NULL; + Eina_List *l; + + if (!wd->selected_item) { + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + + if ((!strcmp(ev->keyname, "Left")) || + ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string)) || + (!strcmp(ev->keyname, "Up")) || + ((!strcmp(ev->keyname, "KP_Up")) && (!ev->string))) + { + l = wd->selected_item->node->prev; + if ((!l) && (wd->round)) + l = eina_list_last(wd->items); + } + else if ((!strcmp(ev->keyname, "Right")) || + ((!strcmp(ev->keyname, "KP_Right")) && (!ev->string)) || + (!strcmp(ev->keyname, "Down")) || + ((!strcmp(ev->keyname, "KP_Down")) && (!ev->string))) + { + l = wd->selected_item->node->next; + if ((!l) && (wd->round)) + l = wd->items; + } + else if ((!strcmp(ev->keyname, "Home")) || + ((!strcmp(ev->keyname, "KP_Home")) && (!ev->string))) + l = wd->items; + else if ((!strcmp(ev->keyname, "End")) || + ((!strcmp(ev->keyname, "KP_End")) && (!ev->string))) + l = eina_list_last(wd->items); + else return EINA_FALSE; + + if (l) + it = eina_list_data_get(l); + + if (it) + { + wd->selected_item = it; + if (!wd->idler) + wd->idler = ecore_idle_enterer_before_add(_move_scroller, obj); + } + + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; +} + +static void +_selected_item_indicate(Elm_Diskselector_Item *it) +{ + Elm_Diskselector_Item *item; + Eina_List *l; + Widget_Data *wd; + wd = elm_widget_data_get(WIDGET(it)); + + if (!wd) return; + if (!it->label) return; + + EINA_LIST_FOREACH(wd->r_items, l, item) + { + if (item->label && !strcmp(item->label, it->label)) + edje_object_signal_emit(VIEW(item), "elm,state,selected", "elm"); + else + edje_object_signal_emit(VIEW(item), "elm,state,default", "elm"); + } +} + +static void +_item_click_cb(void *data, Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Elm_Diskselector_Item *it = data; + + if (!it) return; + + Widget_Data *wd; + wd = elm_widget_data_get(WIDGET(it)); + + if (!wd) return; + + if (wd->selected_item != it) + { + wd->selected_item = it; + _selected_item_indicate(wd->selected_item); + } + + if (it->func) it->func((void *)it->base.data, WIDGET(it), it); +} + +static void +_scroller_move_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Coord x, y, w, h, bw; + Widget_Data *wd = data; + + _check_string(wd); + elm_smart_scroller_child_pos_get(obj, &x, &y); + elm_smart_scroller_child_viewport_size_get(obj, &w, &h); + if (wd->round) + { + evas_object_geometry_get(wd->main_box, NULL, NULL, &bw, NULL); + if (x > ((w / wd->display_item_num) * (wd->item_count + (wd->display_item_num % 2)))) + elm_smart_scroller_child_region_show(wd->scroller, + x - ((w / wd->display_item_num) * wd->item_count), + y, w, h); + else if (x < 0) + elm_smart_scroller_child_region_show(wd->scroller, + x + ((w / wd->display_item_num) * wd->item_count), + y, w, h); + } +} + +static void +_scroller_stop_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Diskselector_Item *it; + Widget_Data *wd = elm_widget_data_get(data); + Evas_Coord x, w, ow; + Eina_List *l, *list; + + if (wd->idler) return; + + if (!wd->round) + list = wd->items; + else + list = wd->r_items; + + evas_object_geometry_get(wd->scroller, NULL, NULL, &ow, NULL); + EINA_LIST_FOREACH(list, l, it) + { + evas_object_geometry_get(VIEW(it), &x, NULL, &w, NULL); + if (abs((int)(ow / 2 - (int)(x + w / 2))) < 10) break; + } + + if (!it) return; + _select_item(it); + evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_STOP, it); +} + +static void +_scroller_start_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_START, + elm_diskselector_selected_item_get(data)); +} + +static void +_drag_start_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START, + elm_diskselector_selected_item_get(data)); +} + +static void +_drag_stop_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP, + elm_diskselector_selected_item_get(data)); +} + +static Eina_Bool +_move_scroller(void *data) +{ + Evas_Object *obj = data; + Widget_Data *wd; + Eina_List *list, *l; + Elm_Diskselector_Item *dit; + Evas_Coord y, w, h; + int i; + + wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + if (!wd->round) + { + i = 0; + list = wd->items; + } + else + { + i = 1; + list = wd->r_items; + } + + EINA_LIST_FOREACH(list, l, dit) + { + if (wd->selected_item == dit) + break; + i++; + } + + if (wd->round) i -= CEIL(wd->display_item_num); + + if (!dit) + { + wd->selected_item = + (Elm_Diskselector_Item *) eina_list_nth(wd->items, 0); + return EINA_FALSE; + } + + evas_object_geometry_get(wd->scroller, NULL, &y, &w, &h); + elm_smart_scroller_child_region_show(wd->scroller, w / wd->display_item_num * i, y, w, h); + _select_item(dit); + if (wd->idler) + { + ecore_idle_enterer_del(wd->idler); + wd->idler = NULL; + } + wd->init = EINA_TRUE; + _check_string(wd); + + return EINA_TRUE; +} + +static void +_round_item_del(Widget_Data *wd, Elm_Diskselector_Item *it) +{ + if (!it) return; + elm_box_unpack(wd->main_box, VIEW(it)); + wd->r_items = eina_list_remove(wd->r_items, it); + eina_stringshare_del(it->label); + elm_widget_item_free(it); +} + +static void +_round_items_del(Widget_Data *wd) +{ + Eina_List *l; + Elm_Diskselector_Item * it; + + _round_item_del(wd, wd->last); + wd->last = NULL; + _round_item_del(wd, wd->s_last); + wd->s_last = NULL; + _round_item_del(wd, wd->second); + wd->second = NULL; + _round_item_del(wd, wd->first); + wd->first = NULL; + + EINA_LIST_FOREACH(wd->under_items, l, it) + { + _round_item_del(wd, it); + } + wd->under_items = eina_list_free(wd->under_items); + + EINA_LIST_FOREACH(wd->over_items, l, it) + { + _round_item_del(wd, it); + } + wd->over_items = eina_list_free(wd->over_items); +} + +static void +_round_items_add(Widget_Data *wd) +{ + Elm_Diskselector_Item *dit; + Elm_Diskselector_Item *it; + Elm_Diskselector_Item *temp_it; + int i = 0; + dit = it = eina_list_nth(wd->items, 0); + if (!dit) return; + + if (!wd->first) + { + wd->first = _item_new(WIDGET(it), it->icon, it->label, it->func, + it->base.data); + wd->first->node = it->node; + wd->r_items = eina_list_append(wd->r_items, wd->first); + } + + it = eina_list_nth(wd->items, 1); + if (!it) + it = dit; + if (!wd->second) + { + wd->second = _item_new(WIDGET(it), it->icon, it->label, it->func, + it->base.data); + wd->second->node = it->node; + wd->r_items = eina_list_append(wd->r_items, wd->second); + } + + // if more than 3 itmes should be displayed + for (i = 2; i < CEIL(wd->display_item_num); i++) + { + it = eina_list_nth(wd->items, i); + if (!it) it = dit; + temp_it = _item_new(WIDGET(it), it->icon, it->label, it->func, it->base.data); + wd->over_items = eina_list_append(wd->over_items, temp_it); + wd->r_items = eina_list_append(wd->r_items, temp_it); + } + + it = eina_list_nth(wd->items, wd->item_count - 1); + if (!it) + it = dit; + if (!wd->last) + { + wd->last = _item_new(WIDGET(it), it->icon, it->label, it->func, + it->base.data); + wd->last->node = it->node; + wd->r_items = eina_list_prepend(wd->r_items, wd->last); + } + + it = eina_list_nth(wd->items, wd->item_count - 2); + if (!it) + it = dit; + if (!wd->s_last) + { + wd->s_last = _item_new(WIDGET(it), it->icon, it->label, it->func, + it->base.data); + wd->s_last->node = it->node; + wd->r_items = eina_list_prepend(wd->r_items, wd->s_last); + } + + // if more than 3 itmes should be displayed + for (i = 3; i <= CEIL(wd->display_item_num); i++) + { + it = eina_list_nth(wd->items, wd->item_count - i); + if (!it) it = dit; + temp_it = _item_new(WIDGET(it), it->icon, it->label, it->func, it->base.data); + wd->under_items = eina_list_append(wd->under_items, temp_it); + wd->r_items = eina_list_prepend(wd->r_items, temp_it); + } +} + +static void +_item_icon_set(Elm_Diskselector_Item *it, Evas_Object *icon) +{ + if (it->icon == icon) return; + if (it->icon) evas_object_del(it->icon); + it->icon = icon; + if (VIEW(it)) + { + evas_object_size_hint_min_set(it->icon, 24, 24); + evas_object_size_hint_max_set(it->icon, 40, 40); + edje_object_part_swallow(VIEW(it), "elm.swallow.icon", it->icon); + evas_object_show(it->icon); + elm_widget_sub_object_add(WIDGET(it), it->icon); + } +} + +static void +_check_identical_item(Elm_Diskselector_Item *it, Evas_Object *icon) +{ + Widget_Data *wd; + Elm_Diskselector_Item *dit; + Eina_List *l; + int idx = 0; + int ic = 0; + int ac = 0; + + wd = elm_widget_data_get(WIDGET(it)); + if (!wd) return; + + if (wd->round) + { + // Get index from indentical item from round items + EINA_LIST_FOREACH(wd->r_items, l, dit) + { + if (it == dit) break; + idx++; + } + + // No item to match + ic = eina_list_count(wd->r_items); + if (idx >= ic) return; + dit = NULL; + + // Number of added items: CEIL(wd->display_item_num) + ac = CEIL(wd->display_item_num); + + if (((idx >= 0) && (idx < ac)) || + ((idx >= ac) && (idx < (2 * ac)))) + { + // Selected item: under, low region + dit = eina_list_nth(wd->r_items, + idx + ic - (2 * ac)); + } + else if (((idx >= (ic - ac)) && (idx < ic)) || + ((idx >= (ic - (2 * ac))) && (idx < ic - ac))) + { + // Selected item: over, high region + dit = eina_list_nth(wd->r_items, + idx - ic + (2 * ac)); + } + + if (dit) _item_icon_set(dit, icon); + _sizing_eval(wd->self); + } +} + +static void +_item_text_set_hook(Elm_Object_Item *it, const char *part, const char *label) +{ + Elm_Diskselector_Item *item; + if (part && strcmp(part, "default")) return; + item = (Elm_Diskselector_Item *)it; + eina_stringshare_replace(&item->label, label); + edje_object_part_text_escaped_set(VIEW(item), "elm.text", item->label); +} + +static const char * +_item_text_get_hook(const Elm_Object_Item *it, const char *part) +{ + if (part && strcmp(part, "default")) return NULL; + return ((Elm_Diskselector_Item *)it)->label; +} + +static void +_item_content_set_hook(Elm_Object_Item *it, + const char *part, + Evas_Object *content) +{ + if (part && strcmp(part, "icon")) return; + _item_icon_set((Elm_Diskselector_Item *)it, content); + _check_identical_item((Elm_Diskselector_Item *)it, content); +} + +static Evas_Object * +_item_content_get_hook(const Elm_Object_Item *it, const char *part) +{ + if (part && strcmp(part, "icon")) return NULL; + return ((Elm_Diskselector_Item *)it)->icon; +} + + +EAPI Evas_Object * +elm_diskselector_add(Evas_Object *parent) +{ + Evas *e; + Evas_Object *obj; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "diskselector"); + elm_widget_type_set(obj, "diskselector"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_can_focus_set(obj, EINA_TRUE); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_event_hook_set(obj, _event_hook); + + wd->self = obj; + wd->item_count = 0; + wd->round = EINA_FALSE; + wd->init = EINA_FALSE; + wd->len_side = 3; + wd->display_item_num_by_api = EINA_FALSE; + + wd->scroller = elm_smart_scroller_add(e); + elm_smart_scroller_widget_set(wd->scroller, obj); + _theme_hook(obj); + elm_widget_resize_object_set(obj, wd->scroller); + elm_smart_scroller_policy_set(wd->scroller, ELM_SMART_SCROLLER_POLICY_OFF, + ELM_SMART_SCROLLER_POLICY_OFF); + elm_smart_scroller_bounce_allow_set(wd->scroller, EINA_TRUE, EINA_FALSE); + evas_object_smart_callback_add(wd->scroller, "scroll", _scroller_move_cb, + wd); + evas_object_smart_callback_add(wd->scroller, "animate,stop", + _scroller_stop_cb, obj); + evas_object_smart_callback_add(wd->scroller, "animate,start", + _scroller_start_cb, obj); + evas_object_smart_callback_add(wd->scroller, "drag,stop", + _drag_stop_cb, obj); + evas_object_smart_callback_add(wd->scroller, "drag,start", + _drag_start_cb, obj); + + _elm_theme_object_set(obj, wd->scroller, "diskselector", "base", + "default"); + evas_object_event_callback_add(wd->scroller, EVAS_CALLBACK_RESIZE, + _diskselector_object_resize, obj); + + wd->main_box = elm_box_add(parent); + elm_box_horizontal_set(wd->main_box, EINA_TRUE); + elm_box_homogeneous_set(wd->main_box, EINA_TRUE); + evas_object_size_hint_weight_set(wd->main_box, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(wd->main_box, EVAS_HINT_FILL, + EVAS_HINT_FILL); + _elm_theme_object_set(obj, wd->main_box, "diskselector", "base", + "default"); + elm_widget_sub_object_add(obj, wd->main_box); + + elm_smart_scroller_child_set(wd->scroller, wd->main_box); + + wd->left_blank = edje_object_add(evas_object_evas_get(obj)); + _elm_theme_object_set(obj, wd->left_blank, "diskselector", "item", + "default"); + evas_object_size_hint_weight_set(wd->left_blank, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(wd->left_blank, EVAS_HINT_FILL, + EVAS_HINT_FILL); + elm_box_pack_end(wd->main_box, wd->left_blank); + evas_object_show(wd->left_blank); + + wd->right_blank = edje_object_add(evas_object_evas_get(obj)); + _elm_theme_object_set(obj, wd->right_blank, "diskselector", "item", + "default"); + evas_object_size_hint_weight_set(wd->right_blank, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(wd->right_blank, EVAS_HINT_FILL, + EVAS_HINT_FILL); + elm_box_pack_end(wd->main_box, wd->right_blank); + evas_object_show(wd->right_blank); + + _theme_data_get(wd); + + evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + evas_object_smart_callbacks_descriptions_set(obj, _signals); + _sizing_eval(obj); + return obj; +} + +EAPI Eina_Bool +elm_diskselector_round_enabled_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->round; +} + +EAPI void +elm_diskselector_round_enabled_set(Evas_Object * obj, Eina_Bool enabled) +{ + Eina_List *elist; + Elm_Diskselector_Item *it; + + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (wd->round == enabled) + return; + + wd->round = !!enabled; + if (enabled) + { + wd->r_items = eina_list_clone(wd->items); + elm_box_unpack(wd->main_box, wd->left_blank); + evas_object_hide(wd->left_blank); + elm_box_unpack(wd->main_box, wd->right_blank); + evas_object_hide(wd->right_blank); + if (!wd->items) + return; + + _round_items_add(wd); + + if (wd->last) + elm_box_pack_start(wd->main_box, wd->VIEW(last)); + if (wd->s_last) + elm_box_pack_start(wd->main_box, wd->VIEW(s_last)); + + // if more than 3 items should be displayed + EINA_LIST_FOREACH(wd->under_items, elist, it) + elm_box_pack_start(wd->main_box, VIEW(it)); + + if (wd->first) + elm_box_pack_end(wd->main_box, wd->VIEW(first)); + if (wd->second) + elm_box_pack_end(wd->main_box, wd->VIEW(second)); + + // if more than 3 items should be displayed + EINA_LIST_FOREACH(wd->over_items, elist, it) + elm_box_pack_end(wd->main_box, VIEW(it)); + } + else + { + _round_items_del(wd); + elm_box_pack_start(wd->main_box, wd->left_blank); + elm_box_pack_end(wd->main_box, wd->right_blank); + eina_list_free(wd->r_items); + wd->r_items = NULL; + } + + _selected_item_indicate(wd->selected_item); + _sizing_eval(obj); +} + +EAPI int +elm_diskselector_side_text_max_length_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; + return wd->len_side; +} + +EAPI void +elm_diskselector_side_text_max_length_set(Evas_Object *obj, int len) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->len_side = len; +} + +EAPI void +elm_diskselector_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->scroller) + elm_smart_scroller_bounce_allow_set(wd->scroller, h_bounce, v_bounce); +} + +EAPI void +elm_diskselector_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_smart_scroller_bounce_allow_get(wd->scroller, h_bounce, v_bounce); +} + +EAPI void +elm_diskselector_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Elm_Smart_Scroller_Policy s_policy_h, s_policy_v; + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (!wd->scroller)) return; + elm_smart_scroller_policy_get(wd->scroller, &s_policy_h, &s_policy_v); + *policy_h = (Elm_Scroller_Policy) s_policy_h; + *policy_v = (Elm_Scroller_Policy) s_policy_v; +} + +EAPI void +elm_diskselector_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (!wd->scroller)) return; + if ((policy_h >= ELM_SCROLLER_POLICY_LAST) || + (policy_v >= ELM_SCROLLER_POLICY_LAST)) + return; + elm_smart_scroller_policy_set(wd->scroller, policy_h, policy_v); +} + +EAPI void +elm_diskselector_clear(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Diskselector_Item *it; + + if (!wd) return; + if (!wd->items) return; + + wd->selected_item = NULL; + EINA_LIST_FREE(wd->items, it) + { + _item_del(it); + elm_widget_item_free(it); + } + _round_items_del(wd); + _sizing_eval(obj); +} + +EAPI const Eina_List * +elm_diskselector_items_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->items; +} + +EAPI Elm_Object_Item * +elm_diskselector_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data) +{ + Elm_Diskselector_Item *it; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + it = _item_new(obj, icon, label, func, data); + wd->items = eina_list_append(wd->items, it); + it->node = eina_list_last(wd->items); + wd->item_count++; + if (wd->round) + { + _round_items_del(wd); + wd->r_items = eina_list_append(wd->r_items, it); + _round_items_add(wd); + if (wd->last) + elm_box_pack_start(wd->main_box, wd->VIEW(last)); + if (wd->s_last) + elm_box_pack_start(wd->main_box, wd->VIEW(s_last)); + elm_box_pack_end(wd->main_box, VIEW(it)); + if (wd->first) + elm_box_pack_end(wd->main_box, wd->VIEW(first)); + if (wd->second) + elm_box_pack_end(wd->main_box, wd->VIEW(second)); + } + else + { + elm_box_unpack(wd->main_box, wd->right_blank); + elm_box_pack_end(wd->main_box, VIEW(it)); + elm_box_pack_end(wd->main_box, wd->right_blank); + } + if (!wd->selected_item) + wd->selected_item = it; + if (!wd->idler) + wd->idler = ecore_idle_enterer_before_add(_move_scroller, obj); + _sizing_eval(obj); + return (Elm_Object_Item *)it; +} + +EAPI Elm_Object_Item * +elm_diskselector_selected_item_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return (Elm_Object_Item *) wd->selected_item; +} + +EAPI void +elm_diskselector_item_selected_set(Elm_Object_Item *it, Eina_Bool selected) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Widget_Data *wd; + Elm_Diskselector_Item *item = (Elm_Diskselector_Item *)it; + wd = elm_widget_data_get(WIDGET(item)); + if (!wd) return; + + if ((wd->selected_item == item) && (selected)) + return; + + if ((wd->selected_item == item) && (!selected)) + wd->selected_item = eina_list_data_get(wd->items); + else + { + wd->selected_item = item; + _selected_item_indicate(wd->selected_item); + } + + if (!wd->idler) + wd->idler = ecore_idle_enterer_before_add(_move_scroller, WIDGET(item)); +} + +EAPI Eina_Bool +elm_diskselector_item_selected_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE); + Widget_Data *wd = elm_widget_data_get(WIDGET(it)); + if (!wd) return EINA_FALSE; + return (wd->selected_item == ((Elm_Diskselector_Item *)it)); +} + +EAPI Elm_Object_Item * +elm_diskselector_item_prev_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + Elm_Diskselector_Item *item = (Elm_Diskselector_Item *)it; + if (item->node->prev) return item->node->prev->data; + else return NULL; +} + +EAPI Elm_Object_Item * +elm_diskselector_item_next_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + Elm_Diskselector_Item *item = (Elm_Diskselector_Item *)it; + if (item->node->next) return item->node->next->data; + else return NULL; +} + +EAPI Elm_Object_Item * +elm_diskselector_first_item_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd || !wd->items) return NULL; + return eina_list_data_get(wd->items); +} + +EAPI Elm_Object_Item * +elm_diskselector_last_item_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd || !wd->items) return NULL; + return eina_list_data_get(eina_list_last(wd->items)); +} + +EAPI void +elm_diskselector_display_item_num_set(Evas_Object *obj, int num) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (num < DISPLAY_ITEM_NUM_MIN) num = DISPLAY_ITEM_NUM_MIN; + wd->display_item_num = num; + wd->display_item_num_by_api = EINA_TRUE; +} + +EAPI int +elm_diskselector_display_item_num_get(const Evas_Object *item) +{ + ELM_CHECK_WIDTYPE(item, widtype) (-1); + Widget_Data *wd = elm_widget_data_get(item); + if (!wd) return -1; + return wd->display_item_num; +} diff --git a/libraries/elementary/src/lib/elm_diskselector.h b/libraries/elementary/src/lib/elm_diskselector.h new file mode 100644 index 0000000..76eed8d --- /dev/null +++ b/libraries/elementary/src/lib/elm_diskselector.h @@ -0,0 +1,440 @@ +/** + * @defgroup Diskselector Diskselector + * @ingroup Elementary + * + * @image html img/widget/diskselector/preview-00.png + * @image latex img/widget/diskselector/preview-00.eps + * + * A diskselector is a kind of list widget. It scrolls horizontally, + * and can contain label and icon objects. Three items are displayed + * with the selected one in the middle. + * + * It can act like a circular list with round mode and labels can be + * reduced for a defined length for side items. + * + * Smart callbacks one can listen to: + * @li "selected" - when item is selected, i.e. scroller stops. + * @li "scroll,anim,start" - scrolling animation has started + * @li "scroll,anim,stop" - scrolling animation has stopped + * @li "scroll,drag,start" - dragging the diskselector has started + * @li "scroll,drag,stop" - dragging the diskselector has stopped + * @note The "scroll,anim,*" and "scroll,drag,*" signals are only emitted by + * user intervention. + * + * Available styles for it: + * - @c "default" + * + * Default content parts of the diskselector items that you can use for are: + * @li "icon" - An icon in the diskselector item + * + * Default text parts of the diskselector items that you can use for are: + * @li "default" - Label of the diskselector item + * + * Supported elm_object_item common APIs. + * @li @ref elm_object_item_part_text_set + * @li @ref elm_object_item_part_text_get + * @li @ref elm_object_item_part_content_set + * @li @ref elm_object_item_part_content_get + * + * List of examples: + * @li @ref diskselector_example_01 + * @li @ref diskselector_example_02 + */ + +/** + * @addtogroup Diskselector + * @{ + */ + +/** + * Add a new diskselector widget to the given parent Elementary + * (container) object. + * + * @param parent The parent object. + * @return a new diskselector widget handle or @c NULL, on errors. + * + * This function inserts a new diskselector widget on the canvas. + * + * @ingroup Diskselector + */ +EAPI Evas_Object *elm_diskselector_add(Evas_Object *parent); + +/** + * Enable or disable round mode. + * + * @param obj The diskselector object. + * @param enabled @c EINA_TRUE to enable round mode or @c EINA_FALSE to + * disable it. + * + * Disabled by default. If round mode is enabled the items list will + * work like a circular list, so when the user reaches the last item, + * the first one will popup. + * + * @see elm_diskselector_round_enabled_get() + * + * @ingroup Diskselector + */ +EAPI void elm_diskselector_round_enabled_set(Evas_Object *obj, Eina_Bool enabled); + +/** + * Get a value whether round mode is enabled or not. + * + * @see elm_diskselector_round_enabled_set() for details. + * + * @param obj The diskselector object. + * @return @c EINA_TRUE means round mode is enabled. @c EINA_FALSE indicates + * it's disabled. If @p obj is @c NULL, @c EINA_FALSE is returned. + * + * @ingroup Diskselector + */ +EAPI Eina_Bool elm_diskselector_round_enabled_get(const Evas_Object *obj); + +/** + * Get the side labels max length. + * + * @see elm_diskselector_side_text_max_length_set() for details. + * + * @param obj The diskselector object. + * @return The max length defined for side labels, or 0 if not a valid + * diskselector. + * + * @ingroup Diskselector + */ +EAPI int elm_diskselector_side_text_max_length_get(const Evas_Object *obj); + +/** + * Set the side labels max length. + * + * @param obj The diskselector object. + * @param len The max length defined for side labels. + * + * Length is the number of characters of items' label that will be + * visible when it's set on side positions. It will just crop + * the string after defined size. E.g.: + * + * An item with label "January" would be displayed on side position as + * "Jan" if max length is set to 3, or "Janu", if this property + * is set to 4. + * + * When it's selected, the entire label will be displayed, except for + * width restrictions. In this case label will be cropped and "..." + * will be concatenated. + * + * Default side label max length is 3. + * + * This property will be applied over all items, included before or + * later this function call. + * + * @ingroup Diskselector + */ +EAPI void elm_diskselector_side_text_max_length_set(Evas_Object *obj, int len); + +/** + * Set the number of items to be displayed. + * + * @param obj The diskselector object. + * @param num The number of items the diskselector will display. + * + * Default value is 3, and also it's the minimum. If @p num is less + * than 3, it will be set to 3. + * + * Also, it can be set on theme, using data item @c display_item_num + * on group "elm/diskselector/item/X", where X is style set. + * E.g.: + * + * group { name: "elm/diskselector/item/X"; + * data { + * item: "display_item_num" "5"; + * } + * + * @ingroup Diskselector + */ +EAPI void elm_diskselector_display_item_num_set(Evas_Object *obj, int num); + +/** + * Get the number of items in the diskselector object. + * + * @param obj The diskselector object. + * + * @ingroup Diskselector + */ +EAPI int elm_diskselector_display_item_num_get(const Evas_Object *obj); + +/** + * Set bouncing behaviour when the scrolled content reaches an edge. + * + * Tell the internal scroller object whether it should bounce or not + * when it reaches the respective edges for each axis. + * + * @param obj The diskselector object. + * @param h_bounce Whether to bounce or not in the horizontal axis. + * @param v_bounce Whether to bounce or not in the vertical axis. + * + * @see elm_scroller_bounce_set() + * + * @ingroup Diskselector + */ +EAPI void elm_diskselector_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce); + +/** + * Get the bouncing behaviour of the internal scroller. + * + * Get whether the internal scroller should bounce when the edge of each + * axis is reached scrolling. + * + * @param obj The diskselector object. + * @param h_bounce Pointer to store the bounce state of the horizontal + * axis. + * @param v_bounce Pointer to store the bounce state of the vertical + * axis. + * + * @see elm_scroller_bounce_get() + * @see elm_diskselector_bounce_set() + * + * @ingroup Diskselector + */ +EAPI void elm_diskselector_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce); + +/** + * Get the scrollbar policy. + * + * @see elm_diskselector_scroller_policy_get() for details. + * + * @param obj The diskselector object. + * @param policy_h Pointer to store horizontal scrollbar policy. + * @param policy_v Pointer to store vertical scrollbar policy. + * + * @ingroup Diskselector + */ +EAPI void elm_diskselector_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v); + +/** + * Set the scrollbar policy. + * + * @param obj The diskselector object. + * @param policy_h Horizontal scrollbar policy. + * @param policy_v Vertical scrollbar policy. + * + * This sets the scrollbar visibility policy for the given scroller. + * #ELM_SCROLLER_POLICY_AUTO means the scrollbar is made visible if it + * is needed, and otherwise kept hidden. #ELM_SCROLLER_POLICY_ON turns + * it on all the time, and #ELM_SCROLLER_POLICY_OFF always keeps it off. + * This applies respectively for the horizontal and vertical scrollbars. + * + * The both are disabled by default, i.e., are set to + * #ELM_SCROLLER_POLICY_OFF. + * + * @ingroup Diskselector + */ +EAPI void elm_diskselector_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v); + +/** + * Remove all diskselector's items. + * + * @param obj The diskselector object. + * + * @see elm_object_item_del() + * @see elm_diskselector_item_append() + * + * @ingroup Diskselector + */ +EAPI void elm_diskselector_clear(Evas_Object *obj); + +/** + * Get a list of all the diskselector items. + * + * @param obj The diskselector object. + * @return An @c Eina_List of diskselector items, #Elm_Object_Item, + * or @c NULL on failure. + * + * @see elm_diskselector_item_append() + * @see elm_object_item_del() + * @see elm_diskselector_clear() + * + * @ingroup Diskselector + */ +EAPI const Eina_List *elm_diskselector_items_get(const Evas_Object *obj); + +/** + * Appends a new item to the diskselector object. + * + * @param obj The diskselector object. + * @param label The label of the diskselector item. + * @param icon The icon object to use at left side of the item. An + * icon can be any Evas object, but usually it is an icon created + * with elm_icon_add(). + * @param func The function to call when the item is selected. + * @param data The data to associate with the item for related callbacks. + * + * @return The created item or @c NULL upon failure. + * + * A new item will be created and appended to the diskselector, i.e., will + * be set as last item. Also, if there is no selected item, it will + * be selected. This will always happens for the first appended item. + * + * If no icon is set, label will be centered on item position, otherwise + * the icon will be placed at left of the label, that will be shifted + * to the right. + * + * Items created with this method can be deleted with + * elm_object_item_del(). + * + * Associated @p data can be properly freed when item is deleted if a + * callback function is set with elm_object_item_del_cb_set(). + * + * If a function is passed as argument, it will be called every time this item + * is selected, i.e., the user stops the diskselector with this + * item on center position. If such function isn't needed, just passing + * @c NULL as @p func is enough. The same should be done for @p data. + * + * Simple example (with no function callback or data associated): + * @code + * disk = elm_diskselector_add(win); + * ic = elm_icon_add(win); + * elm_icon_file_set(ic, "path/to/image", NULL); + * elm_icon_resizable_set(ic, EINA_TRUE, EINA_TRUE); + * elm_diskselector_item_append(disk, "label", ic, NULL, NULL); + * @endcode + * + * @see elm_object_item_del() + * @see elm_diskselector_clear() + * @see elm_icon_add() + * + * @ingroup Diskselector + */ +EAPI Elm_Object_Item *elm_diskselector_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data); + +/** + * Get the selected item. + * + * @param obj The diskselector object. + * @return The selected diskselector item. + * + * The selected item can be unselected with function + * elm_diskselector_item_selected_set(), and the first item of + * diskselector will be selected. + * + * The selected item always will be centered on diskselector, with + * full label displayed, i.e., max length set to side labels won't + * apply on the selected item. More details on + * elm_diskselector_side_text_max_length_set(). + * + * @ingroup Diskselector + */ +EAPI Elm_Object_Item *elm_diskselector_selected_item_get(const Evas_Object *obj); + +/** + * Set the selected state of an item. + * + * @param it The diskselector item + * @param selected The selected state + * + * This sets the selected state of the given item @p it. + * @c EINA_TRUE for selected, @c EINA_FALSE for not selected. + * + * If a new item is selected the previously selected will be unselected. + * Previously selected item can be get with function + * elm_diskselector_selected_item_get(). + * + * If the item @p it is unselected, the first item of diskselector will + * be selected. + * + * Selected items will be visible on center position of diskselector. + * So if it was on another position before selected, or was invisible, + * diskselector will animate items until the selected item reaches center + * position. + * + * @see elm_diskselector_item_selected_get() + * @see elm_diskselector_selected_item_get() + * + * @ingroup Diskselector + */ +EAPI void elm_diskselector_item_selected_set(Elm_Object_Item *it, Eina_Bool selected); + +/* + * Get whether the @p item is selected or not. + * + * @param it The diskselector item. + * @return @c EINA_TRUE means item is selected. @c EINA_FALSE indicates + * it's not. If @p obj is @c NULL, @c EINA_FALSE is returned. + * + * @see elm_diskselector_selected_item_set() for details. + * @see elm_diskselector_item_selected_get() + * + * @ingroup Diskselector + */ +EAPI Eina_Bool elm_diskselector_item_selected_get(const Elm_Object_Item *it); + +/** + * Get the first item of the diskselector. + * + * @param obj The diskselector object. + * @return The first item, or @c NULL if none. + * + * The list of items follows append order. So it will return the first + * item appended to the widget that wasn't deleted. + * + * @see elm_diskselector_item_append() + * @see elm_diskselector_items_get() + * + * @ingroup Diskselector + */ +EAPI Elm_Object_Item *elm_diskselector_first_item_get(const Evas_Object *obj); + +/** + * Get the last item of the diskselector. + * + * @param obj The diskselector object. + * @return The last item, or @c NULL if none. + * + * The list of items follows append order. So it will return last first + * item appended to the widget that wasn't deleted. + * + * @see elm_diskselector_item_append() + * @see elm_diskselector_items_get() + * + * @ingroup Diskselector + */ +EAPI Elm_Object_Item *elm_diskselector_last_item_get(const Evas_Object *obj); + +/** + * Get the item before @p item in diskselector. + * + * @param it The diskselector item. + * @return The item before @p item, or @c NULL if none or on failure. + * + * The list of items follows append order. So it will return item appended + * just before @p item and that wasn't deleted. + * + * If it is the first item, @c NULL will be returned. + * First item can be get by elm_diskselector_first_item_get(). + * + * @see elm_diskselector_item_append() + * @see elm_diskselector_items_get() + * + * @ingroup Diskselector + */ +EAPI Elm_Object_Item *elm_diskselector_item_prev_get(const Elm_Object_Item *it); + +/** + * Get the item after @p item in diskselector. + * + * @param it The diskselector item. + * @return The item after @p item, or @c NULL if none or on failure. + * + * The list of items follows append order. So it will return item appended + * just after @p item and that wasn't deleted. + * + * If it is the last item, @c NULL will be returned. + * Last item can be get by elm_diskselector_last_item_get(). + * + * @see elm_diskselector_item_append() + * @see elm_diskselector_items_get() + * + * @ingroup Diskselector + */ +EAPI Elm_Object_Item *elm_diskselector_item_next_get(const Elm_Object_Item *it); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_entry.c b/libraries/elementary/src/lib/elm_entry.c new file mode 100644 index 0000000..cdf5f31 --- /dev/null +++ b/libraries/elementary/src/lib/elm_entry.c @@ -0,0 +1,3934 @@ +#include +#include +#include "elm_priv.h" +#include "els_scroller.h" + + +/* Maximum chunk size to be inserted to the entry at once + * FIXME: This size is arbitrary, should probably choose a better size. + * Possibly also find a way to set it to a low value for weak computers, + * and to a big value for better computers. */ +#define _CHUNK_SIZE 10000 + +typedef struct _Mod_Api Mod_Api; + +typedef struct _Widget_Data Widget_Data; +typedef struct _Elm_Entry_Context_Menu_Item Elm_Entry_Context_Menu_Item; +typedef struct _Elm_Entry_Item_Provider Elm_Entry_Item_Provider; +typedef struct _Elm_Entry_Markup_Filter Elm_Entry_Markup_Filter; + +struct _Widget_Data +{ + Evas_Object *ent, *scroller; + Evas_Object *hoversel; + Ecore_Job *deferred_recalc_job; + Ecore_Event_Handler *sel_notify_handler; + Ecore_Event_Handler *sel_clear_handler; + Ecore_Timer *longpress_timer; + Ecore_Timer *delay_write; + /* for deferred appending */ + Ecore_Idler *append_text_idler; + char *append_text_left; + int append_text_position; + int append_text_len; + /* Only for clipboard */ + const char *cut_sel; + const char *text; + const char *file; + Elm_Text_Format format; + Evas_Coord lastw, entmw, entmh; + Evas_Coord downx, downy; + Eina_List *items; + Eina_List *item_providers; + Eina_List *text_filters; + Eina_List *markup_filters; + Ecore_Job *hovdeljob; + Mod_Api *api; // module api if supplied + int cursor_pos; + Elm_Scroller_Policy policy_h, policy_v; + Elm_Wrap_Type linewrap; + Elm_Input_Panel_Layout input_panel_layout; + Elm_Autocapital_Type autocapital_type; + Elm_Input_Panel_Lang input_panel_lang; + Elm_Input_Panel_Return_Key_Type input_panel_return_key_type; + void *input_panel_imdata; + int input_panel_imdata_len; + struct + { + Evas_Object *hover_parent; + Evas_Object *pop, *hover; + const char *hover_style; + } anchor_hover; + Eina_Bool changed : 1; + Eina_Bool single_line : 1; + Eina_Bool password : 1; + Eina_Bool editable : 1; + Eina_Bool selection_asked : 1; + Eina_Bool have_selection : 1; + Eina_Bool selmode : 1; + Eina_Bool deferred_cur : 1; + Eina_Bool cur_changed : 1; + Eina_Bool disabled : 1; + Eina_Bool context_menu : 1; + Eina_Bool drag_selection_asked : 1; + Eina_Bool can_write : 1; + Eina_Bool autosave : 1; + Eina_Bool usedown : 1; + Eina_Bool scroll : 1; + Eina_Bool h_bounce : 1; + Eina_Bool v_bounce : 1; + Eina_Bool input_panel_enable : 1; + Eina_Bool prediction_allow : 1; + Eina_Bool input_panel_return_key_disabled : 1; + Eina_Bool autoreturnkey : 1; + Eina_Bool havetext : 1; + Elm_Cnp_Mode cnp_mode : 2; +}; + +struct _Elm_Entry_Context_Menu_Item +{ + Evas_Object *obj; + const char *label; + const char *icon_file; + const char *icon_group; + Elm_Icon_Type icon_type; + Evas_Smart_Cb func; + void *data; +}; + +struct _Elm_Entry_Item_Provider +{ + Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item); + void *data; +}; + +struct _Elm_Entry_Markup_Filter +{ + Elm_Entry_Filter_Cb func; + void *data; +}; + +typedef enum _Length_Unit +{ + LENGTH_UNIT_CHAR, + LENGTH_UNIT_BYTE, + LENGTH_UNIT_LAST +} Length_Unit; + +static const char *widtype = NULL; + +#ifdef HAVE_ELEMENTARY_X +static Eina_Bool _drag_drop_cb(void *data, Evas_Object *obj, Elm_Selection_Data *); +#endif +static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); +static void _theme_hook(Evas_Object *obj); +static void _disable_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _on_focus_hook(void *data, Evas_Object *obj); +static void _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content); +static Evas_Object *_content_unset_hook(Evas_Object *obj, const char *part); +static Evas_Object *_content_get_hook(const Evas_Object *obj, const char *part); +static void _resize(void *data, Evas *e, Evas_Object *obj, void *event_info); +static const char *_getbase(Evas_Object *obj); +static void _signal_entry_changed(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _signal_selection_start(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _signal_selection_changed(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _signal_selection_cleared(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _signal_entry_paste_request(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _signal_entry_copy_notify(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _signal_entry_cut_notify(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _signal_cursor_changed(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _add_chars_till_limit(Evas_Object *obj, char **text, int can_add, Length_Unit unit); +static void _entry_hover_anchor_clicked(void *data, Evas_Object *obj, void *event_info); + +static const char SIG_CHANGED[] = "changed"; +static const char SIG_CHANGED_USER[] = "changed,user"; +static const char SIG_ACTIVATED[] = "activated"; +static const char SIG_PRESS[] = "press"; +static const char SIG_LONGPRESSED[] = "longpressed"; +static const char SIG_CLICKED[] = "clicked"; +static const char SIG_CLICKED_DOUBLE[] = "clicked,double"; +static const char SIG_CLICKED_TRIPLE[] = "clicked,triple"; +static const char SIG_FOCUSED[] = "focused"; +static const char SIG_UNFOCUSED[] = "unfocused"; +static const char SIG_SELECTION_PASTE[] = "selection,paste"; +static const char SIG_SELECTION_COPY[] = "selection,copy"; +static const char SIG_SELECTION_CUT[] = "selection,cut"; +static const char SIG_SELECTION_START[] = "selection,start"; +static const char SIG_SELECTION_CHANGED[] = "selection,changed"; +static const char SIG_SELECTION_CLEARED[] = "selection,cleared"; +static const char SIG_CURSOR_CHANGED[] = "cursor,changed"; +static const char SIG_CURSOR_CHANGED_MANUAL[] = "cursor,changed,manual"; +static const char SIG_ANCHOR_CLICKED[] = "anchor,clicked"; +static const char SIG_ANCHOR_HOVER_OPENED[] = "anchor,hover,opened"; +static const char SIG_ANCHOR_DOWN[] = "anchor,down"; +static const char SIG_ANCHOR_UP[] = "anchor,up"; +static const char SIG_ANCHOR_IN[] = "anchor,in"; +static const char SIG_ANCHOR_OUT[] = "anchor,out"; +static const char SIG_PREEDIT_CHANGED[] = "preedit,changed"; +static const char SIG_UNDO_REQUEST[] = "undo,request"; +static const char SIG_REDO_REQUEST[] = "redo,request"; +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CHANGED, ""}, + {SIG_ACTIVATED, ""}, + {SIG_PRESS, ""}, + {SIG_LONGPRESSED, ""}, + {SIG_CLICKED, ""}, + {SIG_CLICKED_DOUBLE, ""}, + {SIG_CLICKED_TRIPLE, ""}, + {SIG_FOCUSED, ""}, + {SIG_UNFOCUSED, ""}, + {SIG_SELECTION_PASTE, ""}, + {SIG_SELECTION_COPY, ""}, + {SIG_SELECTION_CUT, ""}, + {SIG_SELECTION_START, ""}, + {SIG_SELECTION_CHANGED, ""}, + {SIG_SELECTION_CLEARED, ""}, + {SIG_CURSOR_CHANGED, ""}, + {SIG_CURSOR_CHANGED_MANUAL, ""}, + {SIG_ANCHOR_CLICKED, ""}, + {SIG_ANCHOR_HOVER_OPENED, ""}, + {SIG_ANCHOR_DOWN, ""}, + {SIG_ANCHOR_UP, ""}, + {SIG_ANCHOR_IN, ""}, + {SIG_ANCHOR_OUT, ""}, + {SIG_PREEDIT_CHANGED, ""}, + {SIG_CHANGED_USER, ""}, + {SIG_UNDO_REQUEST, ""}, + {SIG_REDO_REQUEST, ""}, + {NULL, NULL} +}; + +static Eina_List *entries = NULL; + +struct _Mod_Api +{ + void (*obj_hook) (Evas_Object *obj); + void (*obj_unhook) (Evas_Object *obj); + void (*obj_longpress) (Evas_Object *obj); +}; + +static Mod_Api * +_module(Evas_Object *obj __UNUSED__) +{ + static Elm_Module *m = NULL; + if (m) goto ok; // already found - just use + if (!(m = _elm_module_find_as("entry/api"))) return NULL; + // get module api + m->api = malloc(sizeof(Mod_Api)); + if (!m->api) return NULL; + ((Mod_Api *)(m->api) )->obj_hook = // called on creation + _elm_module_symbol_get(m, "obj_hook"); + ((Mod_Api *)(m->api) )->obj_unhook = // called on deletion + _elm_module_symbol_get(m, "obj_unhook"); + ((Mod_Api *)(m->api) )->obj_longpress = // called on long press menu + _elm_module_symbol_get(m, "obj_longpress"); +ok: // ok - return api + return m->api; +} + +static char * +_buf_append(char *buf, const char *str, int *len, int *alloc) +{ + int len2 = strlen(str); + if ((*len + len2) >= *alloc) + { + char *buf2 = realloc(buf, *alloc + len2 + 512); + if (!buf2) return NULL; + buf = buf2; + *alloc += (512 + len2); + } + strcpy(buf + *len, str); + *len += len2; + return buf; +} + +static char * +_load_file(const char *file) +{ + FILE *f; + size_t size; + int alloc = 0, len = 0; + char *text = NULL, buf[16384 + 1]; + + f = fopen(file, "rb"); + if (!f) return NULL; + while ((size = fread(buf, 1, sizeof(buf) - 1, f))) + { + char *tmp_text; + buf[size] = 0; + tmp_text = _buf_append(text, buf, &len, &alloc); + if (!tmp_text) break; + text = tmp_text; + } + fclose(f); + return text; +} + +static char * +_load_plain(const char *file) +{ + char *text; + + text = _load_file(file); + if (text) + { + char *text2; + + text2 = elm_entry_utf8_to_markup(text); + free(text); + return text2; + } + return NULL; +} + +static Eina_Bool +_load(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + char *text; + if (!wd) return EINA_FALSE; + if (!wd->file) + { + elm_object_text_set(obj, ""); + return EINA_TRUE; + } + switch (wd->format) + { + case ELM_TEXT_FORMAT_PLAIN_UTF8: + text = _load_plain(wd->file); + break; + case ELM_TEXT_FORMAT_MARKUP_UTF8: + text = _load_file(wd->file); + break; + default: + text = NULL; + break; + } + if (text) + { + elm_object_text_set(obj, text); + free(text); + return EINA_TRUE; + } + else + { + elm_object_text_set(obj, ""); + return EINA_FALSE; + } +} + +static void +_save_markup_utf8(const char *file, const char *text) +{ + FILE *f; + + if ((!text) || (!text[0])) + { + ecore_file_unlink(file); + return; + } + f = fopen(file, "wb"); + if (!f) + { + // FIXME: report a write error + return; + } + fputs(text, f); // FIXME: catch error + fclose(f); +} + +static void +_save_plain_utf8(const char *file, const char *text) +{ + char *text2; + + text2 = elm_entry_markup_to_utf8(text); + if (!text2) + return; + _save_markup_utf8(file, text2); + free(text2); +} + +static void +_save(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (!wd->file) return; + switch (wd->format) + { + case ELM_TEXT_FORMAT_PLAIN_UTF8: + _save_plain_utf8(wd->file, elm_object_text_get(obj)); + break; + case ELM_TEXT_FORMAT_MARKUP_UTF8: + _save_markup_utf8(wd->file, elm_object_text_get(obj)); + break; + default: + break; + } +} + +static Eina_Bool +_delay_write(void *data) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return ECORE_CALLBACK_CANCEL; + _save(data); + wd->delay_write = NULL; + return ECORE_CALLBACK_CANCEL; +} + +static void +_elm_entry_update_guide(Evas_Object *obj, Eina_Bool havetext) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if ((havetext) && (!wd->havetext)) + edje_object_signal_emit(wd->ent, "elm,guide,disabled", "elm"); + else if ((!havetext) && (wd->havetext)) + edje_object_signal_emit(wd->ent, "elm,guide,enabled", "elm"); + wd->havetext = havetext; +} + +static Elm_Entry_Markup_Filter * +_filter_new(Elm_Entry_Filter_Cb func, void *data) +{ + Elm_Entry_Markup_Filter *tf = ELM_NEW(Elm_Entry_Markup_Filter); + if (!tf) return NULL; + + tf->func = func; + if (func == elm_entry_filter_limit_size) + { + Elm_Entry_Filter_Limit_Size *lim = data, *lim2; + + if (!data) + { + free(tf); + return NULL; + } + lim2 = malloc(sizeof(Elm_Entry_Filter_Limit_Size)); + if (!lim2) + { + free(tf); + return NULL; + } + memcpy(lim2, lim, sizeof(Elm_Entry_Filter_Limit_Size)); + tf->data = lim2; + } + else if (func == elm_entry_filter_accept_set) + { + Elm_Entry_Filter_Accept_Set *as = data, *as2; + + if (!data) + { + free(tf); + return NULL; + } + as2 = malloc(sizeof(Elm_Entry_Filter_Accept_Set)); + if (!as2) + { + free(tf); + return NULL; + } + if (as->accepted) + as2->accepted = eina_stringshare_add(as->accepted); + else + as2->accepted = NULL; + if (as->rejected) + as2->rejected = eina_stringshare_add(as->rejected); + else + as2->rejected = NULL; + tf->data = as2; + } + else + tf->data = data; + return tf; +} + +static void +_filter_free(Elm_Entry_Markup_Filter *tf) +{ + if (tf->func == elm_entry_filter_limit_size) + { + Elm_Entry_Filter_Limit_Size *lim = tf->data; + if (lim) free(lim); + } + else if (tf->func == elm_entry_filter_accept_set) + { + Elm_Entry_Filter_Accept_Set *as = tf->data; + if (as) + { + if (as->accepted) eina_stringshare_del(as->accepted); + if (as->rejected) eina_stringshare_del(as->rejected); + free(as); + } + } + free(tf); +} + +static void +_del_pre_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->delay_write) + { + ecore_timer_del(wd->delay_write); + wd->delay_write = NULL; + if (wd->autosave) _save(obj); + } + elm_entry_anchor_hover_end(obj); + elm_entry_anchor_hover_parent_set(obj, NULL); +} + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Entry_Context_Menu_Item *it; + Elm_Entry_Item_Provider *ip; + Elm_Entry_Markup_Filter *tf; + + evas_event_freeze(evas_object_evas_get(obj)); + + if (wd->file) eina_stringshare_del(wd->file); + + if (wd->hovdeljob) ecore_job_del(wd->hovdeljob); + if ((wd->api) && (wd->api->obj_unhook)) wd->api->obj_unhook(obj); // module - unhook + + entries = eina_list_remove(entries, obj); +#ifdef HAVE_ELEMENTARY_X + if (wd->sel_notify_handler) + ecore_event_handler_del(wd->sel_notify_handler); + if (wd->sel_clear_handler) + ecore_event_handler_del(wd->sel_clear_handler); +#endif + if (wd->cut_sel) eina_stringshare_del(wd->cut_sel); + if (wd->text) eina_stringshare_del(wd->text); + if (wd->deferred_recalc_job) ecore_job_del(wd->deferred_recalc_job); + if (wd->append_text_idler) + { + ecore_idler_del(wd->append_text_idler); + free(wd->append_text_left); + wd->append_text_left = NULL; + wd->append_text_idler = NULL; + } + if (wd->longpress_timer) ecore_timer_del(wd->longpress_timer); + EINA_LIST_FREE(wd->items, it) + { + eina_stringshare_del(it->label); + eina_stringshare_del(it->icon_file); + eina_stringshare_del(it->icon_group); + free(it); + } + EINA_LIST_FREE(wd->item_providers, ip) + { + free(ip); + } + EINA_LIST_FREE(wd->text_filters, tf) + { + _filter_free(tf); + } + EINA_LIST_FREE(wd->markup_filters, tf) + { + _filter_free(tf); + } + if (wd->delay_write) ecore_timer_del(wd->delay_write); + if (wd->input_panel_imdata) free(wd->input_panel_imdata); + + if (wd->anchor_hover.hover_style) eina_stringshare_del(wd->anchor_hover.hover_style); + evas_event_thaw(evas_object_evas_get(obj)); + evas_event_thaw_eval(evas_object_evas_get(obj)); + free(wd); +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + edje_object_mirrored_set(wd->ent, rtl); + if (wd->anchor_hover.hover) + elm_widget_mirrored_set(wd->anchor_hover.hover, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + const char *t; + + evas_event_freeze(evas_object_evas_get(obj)); + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + + t = eina_stringshare_add(elm_object_text_get(obj)); + _elm_theme_object_set(obj, wd->ent, "entry", _getbase(obj), elm_widget_style_get(obj)); + if (_elm_config->desktop_entry) + edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_TRUE); + elm_object_text_set(obj, t); + eina_stringshare_del(t); + if (elm_widget_disabled_get(obj)) + edje_object_signal_emit(wd->ent, "elm,state,disabled", "elm"); + edje_object_part_text_input_panel_layout_set(wd->ent, "elm.text", wd->input_panel_layout); + edje_object_part_text_autocapital_type_set(wd->ent, "elm.text", wd->autocapital_type); + edje_object_part_text_prediction_allow_set(wd->ent, "elm.text", wd->prediction_allow); + edje_object_part_text_input_panel_enabled_set(wd->ent, "elm.text", wd->input_panel_enable); + edje_object_part_text_input_panel_imdata_set(wd->ent, "elm.text", wd->input_panel_imdata, wd->input_panel_imdata_len); + edje_object_part_text_input_panel_return_key_type_set(wd->ent, "elm.text", wd->input_panel_return_key_type); + edje_object_part_text_input_panel_return_key_disabled_set(wd->ent, "elm.text", wd->input_panel_return_key_disabled); + + if (wd->cursor_pos != 0) + elm_entry_cursor_pos_set(obj, wd->cursor_pos); + if (elm_widget_focus_get(obj)) + edje_object_signal_emit(wd->ent, "elm,action,focus", "elm"); + edje_object_message_signal_process(wd->ent); + edje_object_scale_set(wd->ent, elm_widget_scale_get(obj) * _elm_config->scale); + if (wd->scroll) + { + const char *str; + Evas_Object *edj; + + elm_smart_scroller_mirrored_set(wd->scroller, elm_widget_mirrored_get(obj)); + elm_smart_scroller_object_theme_set(obj, wd->scroller, "scroller", "entry", + elm_widget_style_get(obj)); + edj = elm_smart_scroller_edje_object_get(wd->scroller); + str = edje_object_data_get(edj, "focus_highlight"); + if ((str) && (!strcmp(str, "on"))) + elm_widget_highlight_in_theme_set(obj, EINA_TRUE); + else + elm_widget_highlight_in_theme_set(obj, EINA_FALSE); + } + _sizing_eval(obj); + wd->havetext = !wd->havetext; + _elm_entry_update_guide(obj, !wd->havetext); + evas_event_thaw(evas_object_evas_get(obj)); + evas_event_thaw_eval(evas_object_evas_get(obj)); +} + +static void +_disable_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (elm_widget_disabled_get(obj)) + { + edje_object_signal_emit(wd->ent, "elm,state,disabled", "elm"); + wd->disabled = EINA_TRUE; + } + else + { + edje_object_signal_emit(wd->ent, "elm,state,enabled", "elm"); + wd->disabled = EINA_FALSE; + } +} + +static void +_recalc_cursor_geometry(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_smart_callback_call(obj, SIG_CURSOR_CHANGED, NULL); + if (!wd->deferred_recalc_job) + { + Evas_Coord cx, cy, cw, ch; + edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text", + &cx, &cy, &cw, &ch); + if (wd->cur_changed) + { + elm_widget_show_region_set(obj, cx, cy, cw, ch, EINA_FALSE); + wd->cur_changed = EINA_FALSE; + } + } + else + wd->deferred_cur = EINA_TRUE; +} + +static void +_elm_deferred_recalc_job(void *data) +{ + Widget_Data *wd = elm_widget_data_get(data); + Evas_Coord minh = -1, resw = -1, minw = -1, fw = 0, fh = 0; + if (!wd) return; + wd->deferred_recalc_job = NULL; + + evas_object_geometry_get(wd->ent, NULL, NULL, &resw, NULL); + edje_object_size_min_restricted_calc(wd->ent, &minw, &minh, resw, 0); + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + /* This is a hack to workaround the way min size hints are treated. + * If the minimum width is smaller than the restricted width, it means + * the mininmum doesn't matter. */ + if (minw <= resw) + { + Evas_Coord ominw = -1; + evas_object_size_hint_min_get(data, &ominw, NULL); + minw = ominw; + } + + wd->entmw = minw; + wd->entmh = minh; + + elm_coords_finger_size_adjust(1, &fw, 1, &fh); + if (wd->scroll) + { + Evas_Coord vmw = 0, vmh = 0; + + edje_object_size_min_calc + (elm_smart_scroller_edje_object_get(wd->scroller), + &vmw, &vmh); + if (wd->single_line) + { + evas_object_size_hint_min_set(data, vmw, minh + vmh); + evas_object_size_hint_max_set(data, -1, minh + vmh); + } + else + { + evas_object_size_hint_min_set(data, vmw, vmh); + evas_object_size_hint_max_set(data, -1, -1); + } + } + else + { + if (wd->single_line) + { + evas_object_size_hint_min_set(data, minw, minh); + evas_object_size_hint_max_set(data, -1, minh); + } + else + { + evas_object_size_hint_min_set(data, fw, minh); + evas_object_size_hint_max_set(data, -1, -1); + } + } + + if (wd->deferred_cur) + { + Evas_Coord cx, cy, cw, ch; + edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text", + &cx, &cy, &cw, &ch); + if (wd->cur_changed) + { + elm_widget_show_region_set(data, cx, cy, cw, ch, EINA_FALSE); + wd->cur_changed = EINA_FALSE; + } + } +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1; + Evas_Coord resw, resh; + if (!wd) return; + + evas_object_geometry_get(obj, NULL, NULL, &resw, &resh); + if (wd->linewrap) + { + if ((resw == wd->lastw) && (!wd->changed)) return; + evas_event_freeze(evas_object_evas_get(obj)); + wd->changed = EINA_FALSE; + wd->lastw = resw; + if (wd->scroll) + { + Evas_Coord vw = 0, vh = 0, vmw = 0, vmh = 0, w = -1, h = -1; + + evas_object_resize(wd->scroller, resw, resh); + edje_object_size_min_calc + (elm_smart_scroller_edje_object_get(wd->scroller), + &vmw, &vmh); + elm_smart_scroller_child_viewport_size_get(wd->scroller, &vw, &vh); + edje_object_size_min_restricted_calc(wd->ent, &minw, &minh, vw, 0); + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + /* This is a hack to workaround the way min size hints are treated. + * If the minimum width is smaller than the restricted width, it means + * the mininmum doesn't matter. */ + if (minw <= vw) + { + Evas_Coord ominw = -1; + evas_object_size_hint_min_get(wd->ent, &ominw, NULL); + minw = ominw; + } + wd->entmw = minw; + wd->entmh = minh; + + if ((minw > 0) && (vw < minw)) vw = minw; + if (minh > vh) vh = minh; + + if (wd->single_line) h = vmh + minh; + else h = vmh; + evas_object_resize(wd->ent, vw, vh); + evas_object_size_hint_min_set(obj, w, h); + if (wd->single_line) + evas_object_size_hint_max_set(obj, -1, h); + else + evas_object_size_hint_max_set(obj, -1, -1); + } + else + { + if (wd->deferred_recalc_job) ecore_job_del(wd->deferred_recalc_job); + wd->deferred_recalc_job = ecore_job_add(_elm_deferred_recalc_job, obj); + } + evas_event_thaw(evas_object_evas_get(obj)); + evas_event_thaw_eval(evas_object_evas_get(obj)); + } + else + { + if (!wd->changed) return; + evas_event_freeze(evas_object_evas_get(obj)); + wd->changed = EINA_FALSE; + wd->lastw = resw; + if (wd->scroll) + { + Evas_Coord vw = 0, vh = 0, vmw = 0, vmh = 0, w = -1, h = -1; + + edje_object_size_min_calc(wd->ent, &minw, &minh); + wd->entmw = minw; + wd->entmh = minh; + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + + elm_smart_scroller_child_viewport_size_get(wd->scroller, &vw, &vh); + + if (minw > vw) vw = minw; + if (minh > vh) vh = minh; + + evas_object_resize(wd->ent, vw, vh); + edje_object_size_min_calc + (elm_smart_scroller_edje_object_get(wd->scroller), + &vmw, &vmh); + if (wd->single_line) h = vmh + minh; + else h = vmh; + evas_object_size_hint_min_set(obj, w, h); + if (wd->single_line) + evas_object_size_hint_max_set(obj, -1, h); + else + evas_object_size_hint_max_set(obj, -1, -1); + } + else + { + edje_object_size_min_calc(wd->ent, &minw, &minh); + wd->entmw = minw; + wd->entmh = minh; + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + evas_object_size_hint_min_set(obj, minw, minh); + if (wd->single_line) + evas_object_size_hint_max_set(obj, -1, minh); + else + evas_object_size_hint_max_set(obj, -1, -1); + } + evas_event_thaw(evas_object_evas_get(obj)); + evas_event_thaw_eval(evas_object_evas_get(obj)); + } + + _recalc_cursor_geometry(obj); +} + +static void +_check_enable_return_key(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Eina_Bool return_key_disabled = EINA_FALSE; + if (!wd) return; + + if (!wd->autoreturnkey) return; + + if (elm_entry_is_empty(obj) == EINA_TRUE) + return_key_disabled = EINA_TRUE; + + elm_entry_input_panel_return_key_disabled_set(obj, return_key_disabled); +} + +static void +_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *top = elm_widget_top_get(obj); + if (!wd) return; + if (!wd->editable) return; + if (elm_widget_focus_get(obj)) + { + evas_object_focus_set(wd->ent, EINA_TRUE); + edje_object_signal_emit(wd->ent, "elm,action,focus", "elm"); + if (top && wd->input_panel_enable) + elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON); + evas_object_smart_callback_call(obj, SIG_FOCUSED, NULL); + _check_enable_return_key(obj); + } + else + { + edje_object_signal_emit(wd->ent, "elm,action,unfocus", "elm"); + evas_object_focus_set(wd->ent, EINA_FALSE); + if (top && wd->input_panel_enable) + elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_OFF); + evas_object_smart_callback_call(obj, SIG_UNFOCUSED, NULL); + } +} + +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *edje; + Evas_Object *prev_content; + if ((!wd) || (!content)) return; + + if (wd->scroll) + edje = elm_smart_scroller_edje_object_get(wd->scroller); + else + edje = wd->ent; + + if (!part || !strcmp(part, "icon")) + { + prev_content = edje_object_part_swallow_get(edje, "elm.swallow.icon"); + edje_object_signal_emit(edje, "elm,action,show,icon", "elm"); + } + else if (!strcmp(part, "end")) + { + prev_content = edje_object_part_swallow_get(edje, "elm.swallow.end"); + edje_object_signal_emit(edje, "elm,action,show,end", "elm"); + } + else + prev_content = edje_object_part_swallow_get(edje, part); + + if (prev_content) evas_object_del(prev_content); + + evas_event_freeze(evas_object_evas_get(obj)); + elm_widget_sub_object_add(obj, content); + + if (!part || !strcmp(part, "icon")) + edje_object_part_swallow(edje, "elm.swallow.icon", content); + else if (!strcmp(part, "end")) + edje_object_part_swallow(edje, "elm.swallow.end", content); + else + edje_object_part_swallow(edje, part, content); + + _sizing_eval(obj); + evas_event_thaw(evas_object_evas_get(obj)); + evas_event_thaw_eval(evas_object_evas_get(obj)); +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *content, *edje; + if (!wd) return NULL; + + if (wd->scroll) + edje = elm_smart_scroller_edje_object_get(wd->scroller); + else + edje = wd->ent; + + if (!part || !strcmp(part, "icon")) + { + edje_object_signal_emit(edje, "elm,action,hide,icon", "elm"); + content = edje_object_part_swallow_get(edje, "elm.swallow.icon"); + } + else if (!strcmp(part, "end")) + { + edje_object_signal_emit(edje, "elm,action,hide,end", "elm"); + content = edje_object_part_swallow_get(edje, "elm.swallow.end"); + } + else + content = edje_object_part_swallow_get(edje, part); + + edje_object_part_swallow(edje, part, NULL); + if (!content) return NULL; + evas_event_freeze(evas_object_evas_get(obj)); + elm_widget_sub_object_del(obj, content); + edje_object_part_unswallow(wd->ent, content); + _sizing_eval(obj); + evas_event_thaw(evas_object_evas_get(obj)); + evas_event_thaw_eval(evas_object_evas_get(obj)); + + return content; +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *content = NULL, *edje; + if (!wd) return NULL; + + if (wd->scroll) + edje = elm_smart_scroller_edje_object_get(wd->scroller); + else + edje = wd->ent; + + if (!edje) return NULL; + + if (!part || !strcmp(part, "icon")) + content = edje_object_part_swallow_get(edje, "elm.swallow.icon"); + else if (!strcmp(part, "end")) + content = edje_object_part_swallow_get(edje, "elm.swallow.end"); + else + content = edje_object_part_swallow_get(edje, part); + + return content; +} + +static void +_translate_hook(Evas_Object *obj) +{ + evas_object_smart_callback_call(obj, "language,changed", NULL); +} + +static void +_signal_emit_hook(Evas_Object *obj, const char *emission, const char *source) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_signal_emit(wd->ent, emission, source); + if (wd->scroller) + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scroller), + emission, source); +} + +static void +_signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_signal_callback_add(wd->ent, emission, source, func_cb, data); + if (wd->scroller) + edje_object_signal_callback_add(elm_smart_scroller_edje_object_get(wd->scroller), + emission, source, func_cb, data); +} + +static void +_signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + edje_object_signal_callback_del_full(wd->ent, emission, source, func_cb, + data); + if (wd->scroller) + edje_object_signal_callback_del_full(elm_smart_scroller_edje_object_get(wd->scroller), + emission, source, func_cb, data); +} + +static void +_on_focus_region_hook(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) +{ + Widget_Data *wd = elm_widget_data_get(obj); + edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text", x, y, w, h); +} + +static void +_focus_region_hook(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (wd->scroll) + elm_smart_scroller_child_region_show(wd->scroller, x, y, w, h); +} + +static void +_show_region_hook(void *data, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(data); + Evas_Coord x, y, w, h; + if (!wd) return; + elm_widget_show_region_get(obj, &x, &y, &w, &h); + if (wd->scroll) + elm_smart_scroller_child_region_show(wd->scroller, x, y, w, h); +} + +static void +_sub_del(void *data, Evas_Object *obj, void *event_info) +{ + Widget_Data *wd = data; + Evas_Object *sub = event_info; + Evas_Object *edje; + + if (wd->scroll) + edje = elm_smart_scroller_edje_object_get(wd->scroller); + else + edje = wd->ent; + + if (sub == edje_object_part_swallow_get(edje, "elm.swallow.icon")) + { + edje_object_part_unswallow(edje, sub); + if (edje) + edje_object_signal_emit(edje, "elm,action,hide,icon", "elm"); + } + else if (sub == edje_object_part_swallow_get(edje, "elm.swallow.end")) + { + edje_object_part_unswallow(edje, sub); + if (edje) + edje_object_signal_emit(edje, "elm,action,hide,end", "elm"); + } + _sizing_eval(obj); +} + +static void +_hoversel_position(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord cx, cy, cw, ch, x, y, mw, mh; + if (!wd) return; + + cx = cy = 0; + cw = ch = 1; + evas_object_geometry_get(wd->ent, &x, &y, NULL, NULL); + if (wd->usedown) + { + cx = wd->downx - x; + cy = wd->downy - y; + cw = 1; + ch = 1; + } + else + edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text", + &cx, &cy, &cw, &ch); + evas_object_size_hint_min_get(wd->hoversel, &mw, &mh); + if (cw < mw) + { + cx += (cw - mw) / 2; + cw = mw; + } + if (ch < mh) + { + cy += (ch - mh) / 2; + ch = mh; + } + evas_object_move(wd->hoversel, x + cx, y + cy); + evas_object_resize(wd->hoversel, cw, ch); +} + +static void +_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + + if (wd->hoversel) _hoversel_position(data); +} + +static void +_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + + if (wd->linewrap) + { + _sizing_eval(data); + } + else if (wd->scroll) + { + Evas_Coord vw = 0, vh = 0; + + elm_smart_scroller_child_viewport_size_get(wd->scroller, &vw, &vh); + if (vw < wd->entmw) vw = wd->entmw; + if (vh < wd->entmh) vh = wd->entmh; + evas_object_resize(wd->ent, vw, vh); + } + if (wd->hoversel) _hoversel_position(data); +} + +static void +_hover_del(void *data) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + + if (wd->hoversel) + { + evas_object_del(wd->hoversel); + wd->hoversel = NULL; + } + wd->hovdeljob = NULL; +} + +static void +_dismissed(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + wd->usedown = 0; + if (wd->hoversel) evas_object_hide(wd->hoversel); + if (wd->selmode) + { + if (!_elm_config->desktop_entry) + { + if (!wd->password) + edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_TRUE); + } + } + elm_widget_scroll_freeze_pop(data); + if (wd->hovdeljob) ecore_job_del(wd->hovdeljob); + wd->hovdeljob = ecore_job_add(_hover_del, data); +} + +static void +_select(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + wd->selmode = EINA_TRUE; + edje_object_part_text_select_none(wd->ent, "elm.text"); + if (!_elm_config->desktop_entry) + { + if (!wd->password) + edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_TRUE); + } + edje_object_signal_emit(wd->ent, "elm,state,select,on", "elm"); + if (!_elm_config->desktop_entry) + elm_widget_scroll_hold_push(data); +} + +static char * +_remove_item_tags(const char *str) +{ + char *ret; + if (!str) + return NULL; + + Eina_Strbuf *buf = eina_strbuf_new(); + if (!buf) + return NULL; + + if (!eina_strbuf_append(buf, str)) + return NULL; + + while (EINA_TRUE) + { + const char *temp = eina_strbuf_string_get(buf); + + char *startTag = NULL; + char *endTag = NULL; + + startTag = strstr(temp, ""); + else + break; + if (!endTag || startTag > endTag) + break; + + size_t sindex = startTag - temp; + size_t eindex = endTag - temp + 1; + if (!eina_strbuf_remove(buf, sindex, eindex)) + break; + } + ret = eina_strbuf_string_steal(buf); + eina_strbuf_free(buf); + return ret; +} + +void +_elm_entry_entry_paste(Evas_Object *obj, const char *entry) +{ + Widget_Data *wd = elm_widget_data_get(obj); + char *str = NULL; + + if (wd->cnp_mode == ELM_CNP_MODE_NO_IMAGE) + { + str = _remove_item_tags(entry); + if (!str) str = strdup(entry); + } + else + str = strdup(entry); + if (!str) str = (char *)entry; + + edje_object_part_text_user_insert(wd->ent, "elm.text", str); + if (str != entry) free(str); +} + +static void +_paste(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + evas_object_smart_callback_call(data, SIG_SELECTION_PASTE, NULL); + if (wd->sel_notify_handler) + { +#ifdef HAVE_ELEMENTARY_X + Elm_Sel_Format formats = ELM_SEL_FORMAT_MARKUP; + wd->selection_asked = EINA_TRUE; + if (wd->cnp_mode == ELM_CNP_MODE_PLAINTEXT) + formats = ELM_SEL_FORMAT_TEXT; + else if (wd->cnp_mode != ELM_CNP_MODE_NO_IMAGE) + formats |= ELM_SEL_FORMAT_IMAGE; + elm_cnp_selection_get(data, ELM_SEL_TYPE_CLIPBOARD, formats, NULL, NULL); +#endif + } +} + +static void +_store_selection(Elm_Sel_Type seltype, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + const char *sel; + + if (!wd) return; + sel = edje_object_part_text_selection_get(wd->ent, "elm.text"); + if ((!sel) || (!sel[0])) return; /* avoid deleting our own selection */ + elm_cnp_selection_set(obj, seltype, ELM_SEL_FORMAT_MARKUP, sel, strlen(sel)); + if (seltype == ELM_SEL_TYPE_CLIPBOARD) + eina_stringshare_replace(&wd->cut_sel, sel); +} + +static void +_cut(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + + /* Store it */ + wd->selmode = EINA_FALSE; + if (!_elm_config->desktop_entry) + edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE); + edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm"); + if (!_elm_config->desktop_entry) + elm_widget_scroll_hold_pop(data); + _store_selection(ELM_SEL_TYPE_CLIPBOARD, data); + edje_object_part_text_user_insert(wd->ent, "elm.text", ""); + _sizing_eval(data); +} + +static void +_copy(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + wd->selmode = EINA_FALSE; + if (!_elm_config->desktop_entry) + { + edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE); + edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm"); + elm_widget_scroll_hold_pop(data); + } + _store_selection(ELM_SEL_TYPE_CLIPBOARD, data); + // edje_object_part_text_select_none(wd->ent, "elm.text"); +} + +static void +_cancel(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + wd->selmode = EINA_FALSE; + if (!_elm_config->desktop_entry) + edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE); + edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm"); + if (!_elm_config->desktop_entry) + elm_widget_scroll_hold_pop(data); + edje_object_part_text_select_none(wd->ent, "elm.text"); +} + +static void +_item_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Entry_Context_Menu_Item *it = data; + Evas_Object *obj2 = it->obj; + if (it->func) it->func(it->data, obj2, NULL); +} + +static void +_menu_press(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *top; + const Eina_List *l; + const Elm_Entry_Context_Menu_Item *it; + if (!wd) return; + if ((wd->api) && (wd->api->obj_longpress)) + { + wd->api->obj_longpress(obj); + } + else if (wd->context_menu) + { + const char *context_menu_orientation; + + if (wd->hoversel) evas_object_del(wd->hoversel); + else elm_widget_scroll_freeze_push(obj); + wd->hoversel = elm_hoversel_add(obj); + context_menu_orientation = edje_object_data_get + (wd->ent, "context_menu_orientation"); + if ((context_menu_orientation) && + (!strcmp(context_menu_orientation, "horizontal"))) + elm_hoversel_horizontal_set(wd->hoversel, EINA_TRUE); + elm_object_style_set(wd->hoversel, "entry"); + elm_widget_sub_object_add(obj, wd->hoversel); + elm_object_text_set(wd->hoversel, "Text"); + top = elm_widget_top_get(obj); + if (top) elm_hoversel_hover_parent_set(wd->hoversel, top); + evas_object_smart_callback_add(wd->hoversel, "dismissed", _dismissed, obj); + if (wd->have_selection) + { + if (!wd->password) + { + if (wd->have_selection) + { + elm_hoversel_item_add(wd->hoversel, E_("Copy"), NULL, ELM_ICON_NONE, + _copy, obj); + if (wd->editable) + elm_hoversel_item_add(wd->hoversel, E_("Cut"), NULL, ELM_ICON_NONE, + _cut, obj); + } + elm_hoversel_item_add(wd->hoversel, E_("Cancel"), NULL, ELM_ICON_NONE, + _cancel, obj); + } + } + else + { + if (!wd->selmode) + { + if (!_elm_config->desktop_entry) + { + if (!wd->password) + elm_hoversel_item_add(wd->hoversel, E_("Select"), NULL, ELM_ICON_NONE, + _select, obj); + } + if (elm_selection_selection_has_owner()) + { + if (wd->editable) + elm_hoversel_item_add(wd->hoversel, E_("Paste"), NULL, ELM_ICON_NONE, + _paste, obj); + } + } + } + EINA_LIST_FOREACH(wd->items, l, it) + { + elm_hoversel_item_add(wd->hoversel, it->label, it->icon_file, + it->icon_type, _item_clicked, it); + } + if (wd->hoversel) + { + _hoversel_position(obj); + evas_object_show(wd->hoversel); + elm_hoversel_hover_begin(wd->hoversel); + } + if (!_elm_config->desktop_entry) + { + edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE); + edje_object_part_text_select_abort(wd->ent, "elm.text"); + } + } +} + +static Eina_Bool +_long_press(void *data) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return ECORE_CALLBACK_CANCEL; + if (!_elm_config->desktop_entry) + _menu_press(data); + wd->longpress_timer = NULL; + evas_object_smart_callback_call(data, SIG_LONGPRESSED, NULL); + return ECORE_CALLBACK_CANCEL; +} + +static void +_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(data); + Evas_Event_Mouse_Down *ev = event_info; + if (!wd) return; + if (wd->disabled) return; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; + wd->downx = ev->canvas.x; + wd->downy = ev->canvas.y; + if (ev->button == 1) + { + if (wd->longpress_timer) ecore_timer_del(wd->longpress_timer); + wd->longpress_timer = ecore_timer_add(_elm_config->longpress_timeout, _long_press, data); + } +} + +static void +_mouse_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(data); + Evas_Event_Mouse_Up *ev = event_info; + if (!wd) return; + if (wd->disabled) return; + if (ev->button == 1) + { + if (wd->longpress_timer) + { + ecore_timer_del(wd->longpress_timer); + wd->longpress_timer = NULL; + } + } + else if ((ev->button == 3) && (!_elm_config->desktop_entry)) + { + wd->usedown = 1; + _menu_press(data); + } +} + +static void +_mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(data); + Evas_Event_Mouse_Move *ev = event_info; + if (!wd) return; + if (wd->disabled) return; + if (!wd->selmode) + { + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) + { + if (wd->longpress_timer) + { + ecore_timer_del(wd->longpress_timer); + wd->longpress_timer = NULL; + } + } + else if (wd->longpress_timer) + { + Evas_Coord dx, dy; + + dx = wd->downx - ev->cur.canvas.x; + dx *= dx; + dy = wd->downy - ev->cur.canvas.y; + dy *= dy; + if ((dx + dy) > + ((_elm_config->finger_size / 2) * + (_elm_config->finger_size / 2))) + { + ecore_timer_del(wd->longpress_timer); + wd->longpress_timer = NULL; + } + } + } + else if (wd->longpress_timer) + { + Evas_Coord dx, dy; + + dx = wd->downx - ev->cur.canvas.x; + dx *= dx; + dy = wd->downy - ev->cur.canvas.y; + dy *= dy; + if ((dx + dy) > + ((_elm_config->finger_size / 2) * + (_elm_config->finger_size / 2))) + { + ecore_timer_del(wd->longpress_timer); + wd->longpress_timer = NULL; + } + } +} + +static const char * +_getbase(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return "base"; + if (wd->editable) + { + if (wd->password) return "base-password"; + else + { + if (wd->single_line) return "base-single"; + else + { + switch (wd->linewrap) + { + case ELM_WRAP_CHAR: + return "base-charwrap"; + case ELM_WRAP_WORD: + return "base"; + case ELM_WRAP_MIXED: + return "base-mixedwrap"; + case ELM_WRAP_NONE: + default: + return "base-nowrap"; + } + } + } + } + else + { + if (wd->password) return "base-password"; + else + { + if (wd->single_line) return "base-single-noedit"; + else + { + switch (wd->linewrap) + { + case ELM_WRAP_CHAR: + return "base-noedit-charwrap"; + case ELM_WRAP_WORD: + return "base-noedit"; + case ELM_WRAP_MIXED: + return "base-noedit-mixedwrap"; + case ELM_WRAP_NONE: + default: + return "base-nowrap-noedit"; + } + } + } + } +} + +static void +_entry_changed_common_handling(void *data, const char *event) +{ + Widget_Data *wd = elm_widget_data_get(data); + Evas_Coord minh; + const char *text; + if (!wd) return; + evas_event_freeze(evas_object_evas_get(data)); + wd->changed = EINA_TRUE; + /* Reset the size hints which are no more relevant. + * Keep the height, this is a hack, but doesn't really matter + * cause we'll re-eval in a moment. */ + evas_object_size_hint_min_get(data, NULL, &minh); + evas_object_size_hint_min_set(data, -1, minh); + _sizing_eval(data); + if (wd->text) eina_stringshare_del(wd->text); + wd->text = NULL; + if (wd->delay_write) + { + ecore_timer_del(wd->delay_write); + wd->delay_write = NULL; + } + evas_event_thaw(evas_object_evas_get(data)); + evas_event_thaw_eval(evas_object_evas_get(data)); + if ((wd->autosave) && (wd->file)) + wd->delay_write = ecore_timer_add(2.0, _delay_write, data); + /* callback - this could call callbacks that delete the entry... thus... + * any access to wd after this could be invalid */ + evas_object_smart_callback_call(data, event, NULL); + _check_enable_return_key(data); + text = edje_object_part_text_get(wd->ent, "elm.text"); + if (text) + { + if (text[0]) + _elm_entry_update_guide(data, EINA_TRUE); + else + _elm_entry_update_guide(data, EINA_FALSE); + } +} + +static void +_signal_entry_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + _entry_changed_common_handling(data, SIG_CHANGED); +} + +static void +_signal_entry_changed_user(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Elm_Entry_Change_Info info; + Edje_Entry_Change_Info *edje_info = (Edje_Entry_Change_Info *) + edje_object_signal_callback_extra_data_get(); + if (edje_info) + { + memcpy(&info, edje_info, sizeof(info)); + evas_object_smart_callback_call(data, SIG_CHANGED_USER, &info); + } + else + { + evas_object_smart_callback_call(data, SIG_CHANGED_USER, NULL); + } +} + +static void +_signal_preedit_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + _entry_changed_common_handling(data, SIG_PREEDIT_CHANGED); +} + +static void +_signal_undo_request(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_UNDO_REQUEST, NULL); +} + +static void +_signal_redo_request(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_REDO_REQUEST, NULL); +} + +static void +_signal_selection_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + const Eina_List *l; + Evas_Object *entry; + if (!wd) return; + EINA_LIST_FOREACH(entries, l, entry) + { + if (entry != data) elm_entry_select_none(entry); + } + wd->have_selection = EINA_TRUE; + evas_object_smart_callback_call(data, SIG_SELECTION_START, NULL); +#ifdef HAVE_ELEMENTARY_X + if (wd->sel_notify_handler) + { + const char *txt = elm_entry_selection_get(data); + Evas_Object *top; + + top = elm_widget_top_get(data); + if (txt && top && (elm_win_xwindow_get(top))) + elm_cnp_selection_set(data, ELM_SEL_TYPE_PRIMARY, + ELM_SEL_FORMAT_MARKUP, txt, strlen(txt)); + } +#endif +} + +static void +_signal_selection_all(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + elm_entry_select_all(data); +} + +static void +_signal_selection_none(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + elm_entry_select_none(data); +} + +static void +_signal_selection_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + wd->have_selection = EINA_TRUE; + evas_object_smart_callback_call(data, SIG_SELECTION_CHANGED, NULL); + _store_selection(ELM_SEL_TYPE_PRIMARY, data); +} + +static void +_signal_selection_cleared(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + if (!wd->have_selection) return; + wd->have_selection = EINA_FALSE; + evas_object_smart_callback_call(data, SIG_SELECTION_CLEARED, NULL); + if (wd->sel_notify_handler) + { + if (wd->cut_sel) + { +#ifdef HAVE_ELEMENTARY_X + Evas_Object *top; + + top = elm_widget_top_get(data); + if ((top) && (elm_win_xwindow_get(top))) + elm_cnp_selection_set(data, ELM_SEL_TYPE_PRIMARY, + ELM_SEL_FORMAT_MARKUP, wd->cut_sel, + strlen(wd->cut_sel)); +#endif + eina_stringshare_del(wd->cut_sel); + wd->cut_sel = NULL; + } + else + { +#ifdef HAVE_ELEMENTARY_X + Evas_Object *top; + + top = elm_widget_top_get(data); + if ((top) && (elm_win_xwindow_get(top))) + elm_object_cnp_selection_clear(data, ELM_SEL_TYPE_PRIMARY); +#endif + } + } +} + +static void +_signal_entry_paste_request(void *data, Evas_Object *obj __UNUSED__, const char *emission, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); +#ifdef HAVE_ELEMENTARY_X + Elm_Sel_Type type = (emission[sizeof("ntry,paste,request,")] == '1') ? + ELM_SEL_TYPE_PRIMARY : ELM_SEL_TYPE_CLIPBOARD; +#endif + + if (!wd) return; + if (!wd->editable) return; + evas_object_smart_callback_call(data, SIG_SELECTION_PASTE, NULL); + if (wd->sel_notify_handler) + { +#ifdef HAVE_ELEMENTARY_X + Evas_Object *top; + + top = elm_widget_top_get(data); + if ((top) && (elm_win_xwindow_get(top))) + { + wd->selection_asked = EINA_TRUE; + Elm_Sel_Format formats = ELM_SEL_FORMAT_MARKUP; + if (wd->cnp_mode == ELM_CNP_MODE_PLAINTEXT) + formats = ELM_SEL_FORMAT_TEXT; + else if (wd->cnp_mode != ELM_CNP_MODE_NO_IMAGE) + formats |= ELM_SEL_FORMAT_IMAGE; + elm_cnp_selection_get(data, type, formats, + NULL, NULL); + } +#endif + } +} + +static void +_signal_entry_copy_notify(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_SELECTION_COPY, NULL); + _copy(data, NULL, NULL); +} + +static void +_signal_entry_cut_notify(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_SELECTION_CUT, NULL); + _cut(data, NULL, NULL); +} + +static void +_signal_cursor_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + wd->cursor_pos = edje_object_part_text_cursor_pos_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN); + wd->cur_changed = EINA_TRUE; + _recalc_cursor_geometry(data); +} + +static void +_signal_cursor_changed_manual(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_CURSOR_CHANGED_MANUAL, NULL); +} + + +static void +_signal_anchor_geoms_do_things_with(Widget_Data *wd, Elm_Entry_Anchor_Info *ei) +{ + const Eina_List *geoms, *l; + Evas_Textblock_Rectangle *r; + Evas_Coord px, py, x, y; + + geoms = edje_object_part_text_anchor_geometry_get(wd->ent, "elm.text", ei->name); + if (!geoms) return; + + + evas_object_geometry_get(wd->ent, &x, &y, NULL, NULL); + evas_pointer_canvas_xy_get(evas_object_evas_get(wd->ent), &px, &py); + EINA_LIST_FOREACH(geoms, l, r) + { + if (((r->x + x) <= px) && ((r->y + y) <= py) && + ((r->x + x + r->w) > px) && ((r->y + y + r->h) > py)) + { + ei->x = r->x + x; + ei->y = r->y + y; + ei->w = r->w; + ei->h = r->h; + break; + } + } +} + +static void +_signal_anchor_down(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + Elm_Entry_Anchor_Info ei; + const char *p; + char *p2; + if (!wd) return; + p = emission + sizeof("nchor,mouse,down,"); + ei.button = strtol(p, &p2, 10); + ei.name = p2 + 1; + ei.x = ei.y = ei.w = ei.h = 0; + + _signal_anchor_geoms_do_things_with(wd, &ei); + + if (!wd->disabled) + evas_object_smart_callback_call(data, SIG_ANCHOR_DOWN, &ei); +} + +static void +_signal_anchor_up(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + Elm_Entry_Anchor_Info ei; + const char *p; + char *p2; + if (!wd) return; + p = emission + sizeof("nchor,mouse,up,"); + ei.button = strtol(p, &p2, 10); + ei.name = p2 + 1; + ei.x = ei.y = ei.w = ei.h = 0; + + _signal_anchor_geoms_do_things_with(wd, &ei); + + if (!wd->disabled) + evas_object_smart_callback_call(data, SIG_ANCHOR_UP, &ei); +} + +static void +_signal_anchor_clicked(void *data, Evas_Object *obj __UNUSED__, const char *emission, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + Elm_Entry_Anchor_Info ei; + const char *p; + char *p2; + if (!wd) return; + p = emission + sizeof("nchor,mouse,clicked,"); + ei.button = strtol(p, &p2, 10); + ei.name = p2 + 1; + ei.x = ei.y = ei.w = ei.h = 0; + + _signal_anchor_geoms_do_things_with(wd, &ei); + + if (!wd->disabled) + { + evas_object_smart_callback_call(data, SIG_ANCHOR_CLICKED, &ei); + + if (!_elm_config->desktop_entry) + _entry_hover_anchor_clicked(data, data, &ei); + } +} + +static void +_signal_anchor_move(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; +} + +static void +_signal_anchor_in(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + Elm_Entry_Anchor_Info ei; + if (!wd) return; + ei.name = emission + sizeof("nchor,mouse,in,"); + ei.button = 0; + ei.x = ei.y = ei.w = ei.h = 0; + + _signal_anchor_geoms_do_things_with(wd, &ei); + + if (!wd->disabled) + evas_object_smart_callback_call(data, SIG_ANCHOR_IN, &ei); +} + +static void +_signal_anchor_out(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + Elm_Entry_Anchor_Info ei; + if (!wd) return; + ei.name = emission + sizeof("nchor,mouse,out,"); + ei.button = 0; + ei.x = ei.y = ei.w = ei.h = 0; + + _signal_anchor_geoms_do_things_with(wd, &ei); + + if (!wd->disabled) + evas_object_smart_callback_call(data, SIG_ANCHOR_OUT, &ei); +} + +static void +_signal_key_enter(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + evas_object_smart_callback_call(data, SIG_ACTIVATED, NULL); +} + +static void +_signal_mouse_down(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + evas_object_smart_callback_call(data, SIG_PRESS, NULL); +} + +static void +_signal_mouse_clicked(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + evas_object_smart_callback_call(data, SIG_CLICKED, NULL); +} + +static void +_signal_mouse_double(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + evas_object_smart_callback_call(data, SIG_CLICKED_DOUBLE, NULL); +} + +static void +_signal_mouse_triple(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + evas_object_smart_callback_call(data, SIG_CLICKED_TRIPLE, NULL); +} + +#ifdef HAVE_ELEMENTARY_X +static Eina_Bool +_event_selection_notify(void *data, int type __UNUSED__, void *event) +{ + Widget_Data *wd = elm_widget_data_get(data); + Ecore_X_Event_Selection_Notify *ev = event; + if (!wd) return ECORE_CALLBACK_PASS_ON; + if ((!wd->selection_asked) && (!wd->drag_selection_asked)) + return ECORE_CALLBACK_PASS_ON; + + if ((ev->selection == ECORE_X_SELECTION_CLIPBOARD) || + (ev->selection == ECORE_X_SELECTION_PRIMARY)) + { + Ecore_X_Selection_Data_Text *text_data; + + text_data = ev->data; + if (text_data->data.content == ECORE_X_SELECTION_CONTENT_TEXT) + { + if (text_data->text) + { + char *txt = _elm_util_text_to_mkup(text_data->text); + + if (txt) + { + elm_entry_entry_insert(data, txt); + free(txt); + } + } + } + wd->selection_asked = EINA_FALSE; + } + else if (ev->selection == ECORE_X_SELECTION_XDND) + { + Ecore_X_Selection_Data_Text *text_data; + + text_data = ev->data; + if (text_data->data.content == ECORE_X_SELECTION_CONTENT_TEXT) + { + if (text_data->text) + { + char *txt = _elm_util_text_to_mkup(text_data->text); + + if (txt) + { + /* Massive FIXME: this should be at the drag point */ + elm_entry_entry_insert(data, txt); + free(txt); + } + } + } + wd->drag_selection_asked = EINA_FALSE; + + ecore_x_dnd_send_finished(); + + } + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_event_selection_clear(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + Ecore_X_Event_Selection_Clear *ev = event; + if (!wd) return ECORE_CALLBACK_PASS_ON; + if (!wd->have_selection) return ECORE_CALLBACK_PASS_ON; + if ((ev->selection == ECORE_X_SELECTION_CLIPBOARD) || + (ev->selection == ECORE_X_SELECTION_PRIMARY)) + { + elm_entry_select_none(data); + } + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_drag_drop_cb(void *data __UNUSED__, Evas_Object *obj, Elm_Selection_Data *drop) +{ + Widget_Data *wd; + Eina_Bool rv; + + wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + printf("Inserting at (%d,%d) %s\n",drop->x,drop->y,(char*)drop->data); + + edje_object_part_text_cursor_copy(wd->ent, "elm.text", + EDJE_CURSOR_MAIN,/*->*/EDJE_CURSOR_USER); + rv = edje_object_part_text_cursor_coord_set(wd->ent,"elm.text", + EDJE_CURSOR_MAIN,drop->x,drop->y); + if (!rv) printf("Warning: Failed to position cursor: paste anyway\n"); + elm_entry_entry_insert(obj, drop->data); + edje_object_part_text_cursor_copy(wd->ent, "elm.text", + EDJE_CURSOR_USER,/*->*/EDJE_CURSOR_MAIN); + + return EINA_TRUE; +} +#endif + +static Evas_Object * +_get_item(void *data, Evas_Object *edje __UNUSED__, const char *part __UNUSED__, const char *item) +{ + Widget_Data *wd = elm_widget_data_get(data); + Evas_Object *o; + Eina_List *l; + Elm_Entry_Item_Provider *ip; + + EINA_LIST_FOREACH(wd->item_providers, l, ip) + { + o = ip->func(ip->data, data, item); + if (o) return o; + } + if (!strncmp(item, "file://", 7)) + { + const char *fname = item + 7; + + o = evas_object_image_filled_add(evas_object_evas_get(data)); + evas_object_image_file_set(o, fname, NULL); + if (evas_object_image_load_error_get(o) == EVAS_LOAD_ERROR_NONE) + { + evas_object_show(o); + } + else + { + evas_object_del(o); + o = edje_object_add(evas_object_evas_get(data)); + _elm_theme_object_set(data, o, "entry/emoticon", "wtf", elm_widget_style_get(data)); + } + return o; + } + o = edje_object_add(evas_object_evas_get(data)); + if (!_elm_theme_object_set(data, o, "entry", item, elm_widget_style_get(data))) + _elm_theme_object_set(data, o, "entry/emoticon", "wtf", elm_widget_style_get(data)); + return o; +} + +static void +_text_filter(void *data, Evas_Object *edje __UNUSED__, const char *part __UNUSED__, Edje_Text_Filter_Type type, char **text) +{ + Widget_Data *wd = elm_widget_data_get(data); + Eina_List *l; + Elm_Entry_Markup_Filter *tf; + + if (type == EDJE_TEXT_FILTER_FORMAT) + return; + + EINA_LIST_FOREACH(wd->text_filters, l, tf) + { + tf->func(tf->data, data, text); + if (!*text) + break; + } +} + +static void +_markup_filter(void *data, Evas_Object *edje __UNUSED__, const char *part __UNUSED__, char **text) +{ + Widget_Data *wd = elm_widget_data_get(data); + Eina_List *l; + Elm_Entry_Markup_Filter *tf; + + EINA_LIST_FOREACH(wd->markup_filters, l, tf) + { + tf->func(tf->data, data, text); + if (!*text) + break; + } +} + +/* This function is used to insert text by chunks in jobs */ +static Eina_Bool +_text_append_idler(void *data) +{ + int start; + char backup; + Evas_Object *obj = (Evas_Object *) data; + Widget_Data *wd = elm_widget_data_get(obj); + evas_event_freeze(evas_object_evas_get(obj)); + if (wd->text) eina_stringshare_del(wd->text); + wd->text = NULL; + wd->changed = EINA_TRUE; + + start = wd->append_text_position; + if ((start + _CHUNK_SIZE) < wd->append_text_len) + { + int pos = start; + int tag_start, esc_start; + + tag_start = esc_start = -1; + /* Find proper markup cut place */ + while (pos - start < _CHUNK_SIZE) + { + int prev_pos = pos; + Eina_Unicode tmp = + eina_unicode_utf8_get_next(wd->append_text_left, &pos); + if (esc_start == -1) + { + if (tmp == '<') + tag_start = prev_pos; + else if (tmp == '>') + tag_start = -1; + } + if (tag_start == -1) + { + if (tmp == '&') + esc_start = prev_pos; + else if (tmp == ';') + esc_start = -1; + } + } + + if (tag_start >= 0) + { + wd->append_text_position = tag_start; + } + else if (esc_start >= 0) + { + wd->append_text_position = esc_start; + } + else + { + wd->append_text_position = pos; + } + } + else + { + wd->append_text_position = wd->append_text_len; + } + + backup = wd->append_text_left[wd->append_text_position]; + wd->append_text_left[wd->append_text_position] = '\0'; + + edje_object_part_text_append(wd->ent, "elm.text", + wd->append_text_left + start); + + wd->append_text_left[wd->append_text_position] = backup; + + evas_event_thaw(evas_object_evas_get(obj)); + evas_event_thaw_eval(evas_object_evas_get(obj)); + + _elm_entry_update_guide(obj, EINA_TRUE); + + /* If there's still more to go, renew the idler, else, cleanup */ + if (wd->append_text_position < wd->append_text_len) + { + return ECORE_CALLBACK_RENEW; + } + else + { + free(wd->append_text_left); + wd->append_text_left = NULL; + wd->append_text_idler = NULL; + return ECORE_CALLBACK_CANCEL; + } +} + +static void +_add_chars_till_limit(Evas_Object *obj, char **text, int can_add, Length_Unit unit) +{ + int i = 0, current_len = 0; + char *new_text; + + if (!*text) return; + if (unit >= LENGTH_UNIT_LAST) return; + new_text = *text; + current_len = strlen(*text); + while (*new_text) + { + int idx = 0, unit_size = 0; + char *markup, *utfstr; + if (*new_text == '<') + { + while (*(new_text + idx) != '>') + { + idx++; + if (!*(new_text + idx)) break; + } + } + else if (*new_text == '&') + { + while (*(new_text + idx) != ';') + { + idx++; + if (!*(new_text + idx)) break; + } + } + idx = evas_string_char_next_get(new_text, idx, NULL); + markup = malloc(idx + 1); + if (markup) + { + strncpy(markup, new_text, idx); + markup[idx] = 0; + utfstr = elm_entry_markup_to_utf8(markup); + if (utfstr) + { + if (unit == LENGTH_UNIT_BYTE) + unit_size = strlen(utfstr); + else if (unit == LENGTH_UNIT_CHAR) + unit_size = evas_string_char_len_get(utfstr); + free(utfstr); + utfstr = NULL; + } + free(markup); + markup = NULL; + } + if (can_add < unit_size) + { + if (!i) + { + evas_object_smart_callback_call(obj, "maxlength,reached", NULL); + free(*text); + *text = NULL; + return; + } + can_add = 0; + strncpy(new_text, new_text + idx, current_len - ((new_text + idx) - *text)); + current_len -= idx; + (*text)[current_len] = 0; + } + else + { + new_text += idx; + can_add -= unit_size; + } + i++; + } + evas_object_smart_callback_call(obj, "maxlength,reached", NULL); +} + +static void +_elm_entry_text_set(Evas_Object *obj, const char *item, const char *entry) +{ + int len = 0; + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_event_freeze(evas_object_evas_get(obj)); + if (!entry) entry = ""; + if (item) + { + if (!strcmp(item, "guide")) + edje_object_part_text_set(wd->ent, "elm.guide", entry); + else + edje_object_part_text_set(wd->ent, item, entry); + evas_event_thaw(evas_object_evas_get(obj)); + evas_event_thaw_eval(evas_object_evas_get(obj)); + return; + } + + if (wd->text) eina_stringshare_del(wd->text); + wd->text = NULL; + wd->changed = EINA_TRUE; + + /* Clear currently pending job if there is one */ + if (wd->append_text_idler) + { + ecore_idler_del(wd->append_text_idler); + free(wd->append_text_left); + wd->append_text_left = NULL; + wd->append_text_idler = NULL; + } + + len = strlen(entry); + /* Split to ~_CHUNK_SIZE chunks */ + if (len > _CHUNK_SIZE) + { + wd->append_text_left = (char *) malloc(len + 1); + } + + /* If we decided to use the idler */ + if (wd->append_text_left) + { + /* Need to clear the entry first */ + edje_object_part_text_set(wd->ent, "elm.text", ""); + memcpy(wd->append_text_left, entry, len + 1); + wd->append_text_position = 0; + wd->append_text_len = len; + wd->append_text_idler = ecore_idler_add(_text_append_idler, obj); + } + else + { + edje_object_part_text_set(wd->ent, "elm.text", entry); + } + if ((entry) && (entry[0])) + _elm_entry_update_guide(obj, EINA_TRUE); + else + _elm_entry_update_guide(obj, EINA_FALSE); + evas_event_thaw(evas_object_evas_get(obj)); + evas_event_thaw_eval(evas_object_evas_get(obj)); +} + +static const char * +_elm_entry_text_get(const Evas_Object *obj, const char *item) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (item && strcmp(item, "default")) return NULL; + const char *text; + if (!wd) return NULL; + text = edje_object_part_text_get(wd->ent, "elm.text"); + if (!text) + { + ERR("text=NULL for edje %p, part 'elm.text'", wd->ent); + return NULL; + } + + if (wd->append_text_len > 0) + { + char *tmpbuf; + size_t tlen; + tlen = wd->append_text_position; + tmpbuf = malloc(wd->append_text_len + 1); + if (!tmpbuf) + { + ERR("Failed to allocate memory for entry's text %p", obj); + return NULL; + } + memcpy(tmpbuf, text, tlen); + if (wd->append_text_left) + memcpy(tmpbuf + tlen, wd->append_text_left + wd->append_text_position, wd->append_text_len - tlen); + tmpbuf[wd->append_text_len + 1] = '\0'; + eina_stringshare_replace(&wd->text, tmpbuf); + free(tmpbuf); + } + else + { + eina_stringshare_replace(&wd->text, text); + } + return wd->text; +} + +EAPI Evas_Object * +elm_entry_add(Evas_Object *parent) +{ +#ifdef HAVE_ELEMENTARY_X + Evas_Object *top; +#endif + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "entry"); + elm_widget_type_set(obj, "entry"); + elm_widget_sub_object_add(parent, obj); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_disable_hook_set(obj, _disable_hook); + elm_widget_signal_emit_hook_set(obj, _signal_emit_hook); + elm_widget_focus_region_hook_set(obj, _focus_region_hook); + elm_widget_on_focus_region_hook_set(obj, _on_focus_region_hook); + elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook); + elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook); + elm_object_cursor_set(obj, ELM_CURSOR_XTERM); + elm_widget_can_focus_set(obj, EINA_TRUE); + elm_widget_text_set_hook_set(obj, _elm_entry_text_set); + elm_widget_text_get_hook_set(obj, _elm_entry_text_get); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_translate_hook_set(obj, _translate_hook); + + evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, wd); + + wd->linewrap = ELM_WRAP_WORD; + wd->editable = EINA_TRUE; + wd->disabled = EINA_FALSE; + wd->context_menu = EINA_TRUE; + wd->autosave = EINA_TRUE; + wd->cnp_mode = ELM_CNP_MODE_MARKUP; + wd->scroll = EINA_FALSE; + wd->input_panel_imdata = NULL; + + wd->ent = edje_object_add(e); + edje_object_item_provider_set(wd->ent, _get_item, obj); + edje_object_text_insert_filter_callback_add(wd->ent,"elm.text", _text_filter, obj); + edje_object_text_markup_filter_callback_add(wd->ent,"elm.text", _markup_filter, obj); + evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_MOVE, _move, obj); + evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_MOUSE_DOWN, + _mouse_down, obj); + evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_MOUSE_UP, + _mouse_up, obj); + evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_MOUSE_MOVE, + _mouse_move, obj); + evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj); + + _elm_theme_object_set(obj, wd->ent, "entry", "base", "default"); + edje_object_signal_callback_add(wd->ent, "entry,changed", "elm.text", + _signal_entry_changed, obj); + edje_object_signal_callback_add(wd->ent, "entry,changed,user", "elm.text", + _signal_entry_changed_user, obj); + edje_object_signal_callback_add(wd->ent, "preedit,changed", "elm.text", + _signal_preedit_changed, obj); + edje_object_signal_callback_add(wd->ent, "selection,start", "elm.text", + _signal_selection_start, obj); + edje_object_signal_callback_add(wd->ent, "selection,changed", "elm.text", + _signal_selection_changed, obj); + edje_object_signal_callback_add(wd->ent, "entry,selection,all,request", "elm.text", + _signal_selection_all, obj); + edje_object_signal_callback_add(wd->ent, "entry,selection,none,request", "elm.text", + _signal_selection_none, obj); + edje_object_signal_callback_add(wd->ent, "selection,cleared", "elm.text", + _signal_selection_cleared, obj); + edje_object_signal_callback_add(wd->ent, "entry,paste,request,*", "elm.text", + _signal_entry_paste_request, obj); + edje_object_signal_callback_add(wd->ent, "entry,copy,notify", "elm.text", + _signal_entry_copy_notify, obj); + edje_object_signal_callback_add(wd->ent, "entry,cut,notify", "elm.text", + _signal_entry_cut_notify, obj); + edje_object_signal_callback_add(wd->ent, "cursor,changed", "elm.text", + _signal_cursor_changed, obj); + edje_object_signal_callback_add(wd->ent, "cursor,changed,manual", "elm.text", + _signal_cursor_changed_manual, obj); + edje_object_signal_callback_add(wd->ent, "anchor,mouse,down,*", "elm.text", + _signal_anchor_down, obj); + edje_object_signal_callback_add(wd->ent, "anchor,mouse,up,*", "elm.text", + _signal_anchor_up, obj); + edje_object_signal_callback_add(wd->ent, "anchor,mouse,clicked,*", "elm.text", + _signal_anchor_clicked, obj); + edje_object_signal_callback_add(wd->ent, "anchor,mouse,move,*", "elm.text", + _signal_anchor_move, obj); + edje_object_signal_callback_add(wd->ent, "anchor,mouse,in,*", "elm.text", + _signal_anchor_in, obj); + edje_object_signal_callback_add(wd->ent, "anchor,mouse,out,*", "elm.text", + _signal_anchor_out, obj); + edje_object_signal_callback_add(wd->ent, "entry,key,enter", "elm.text", + _signal_key_enter, obj); + edje_object_signal_callback_add(wd->ent, "mouse,down,1", "elm.text", + _signal_mouse_down, obj); + edje_object_signal_callback_add(wd->ent, "mouse,clicked,1", "elm.text", + _signal_mouse_clicked, obj); + edje_object_signal_callback_add(wd->ent, "mouse,down,1,double", "elm.text", + _signal_mouse_double, obj); + edje_object_signal_callback_add(wd->ent, "mouse,down,1,triple", "elm.text", + _signal_mouse_triple, obj); + edje_object_signal_callback_add(wd->ent, "entry,undo,request", "elm.text", + _signal_undo_request, obj); + edje_object_signal_callback_add(wd->ent, "entry,redo,request", "elm.text", + _signal_redo_request, obj); + edje_object_part_text_set(wd->ent, "elm.text", ""); + if (_elm_config->desktop_entry) + edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_TRUE); + elm_widget_resize_object_set(obj, wd->ent); + _sizing_eval(obj); + + elm_entry_input_panel_layout_set(obj, ELM_INPUT_PANEL_LAYOUT_NORMAL); + elm_entry_input_panel_enabled_set(obj, EINA_TRUE); + elm_entry_prediction_allow_set(obj, EINA_TRUE); + + wd->autocapital_type = edje_object_part_text_autocapital_type_get(wd->ent, "elm.text"); + +#ifdef HAVE_ELEMENTARY_X + top = elm_widget_top_get(obj); + if ((top) && (elm_win_xwindow_get(top))) + { + wd->sel_notify_handler = + ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY, + _event_selection_notify, obj); + wd->sel_clear_handler = + ecore_event_handler_add(ECORE_X_EVENT_SELECTION_CLEAR, + _event_selection_clear, obj); + } + + elm_drop_target_add(obj, ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_IMAGE, + _drag_drop_cb, NULL); +#endif + + entries = eina_list_prepend(entries, obj); + + // module - find module for entry + wd->api = _module(obj); + // if found - hook in + if ((wd->api) && (wd->api->obj_hook)) wd->api->obj_hook(obj); + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + // TODO: convert Elementary to subclassing of Evas_Smart_Class + // TODO: and save some bytes, making descriptions per-class and not instance! + evas_object_smart_callbacks_descriptions_set(obj, _signals); + return obj; +} + +EAPI void +elm_entry_single_line_set(Evas_Object *obj, Eina_Bool single_line) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->single_line == single_line) return; + wd->single_line = single_line; + wd->linewrap = ELM_WRAP_NONE; + elm_entry_cnp_mode_set(obj, ELM_CNP_MODE_NO_IMAGE); + _theme_hook(obj); + if (wd->scroller) + { + if (wd->single_line) + elm_smart_scroller_policy_set(wd->scroller, + ELM_SMART_SCROLLER_POLICY_OFF, + ELM_SMART_SCROLLER_POLICY_OFF); + else + { + const Elm_Scroller_Policy map[3] = + { + ELM_SMART_SCROLLER_POLICY_AUTO, + ELM_SMART_SCROLLER_POLICY_ON, + ELM_SMART_SCROLLER_POLICY_OFF + }; + elm_smart_scroller_policy_set(wd->scroller, + map[wd->policy_h], + map[wd->policy_v]); + } + _sizing_eval(obj); + } +} + +EAPI Eina_Bool +elm_entry_single_line_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->single_line; +} + +EAPI void +elm_entry_password_set(Evas_Object *obj, Eina_Bool password) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->password == password) return; + wd->password = password; + if (password) + { + wd->single_line = EINA_TRUE; + wd->linewrap = ELM_WRAP_NONE; +#ifdef HAVE_ELEMENTARY_X + elm_drop_target_del(obj); +#endif + edje_object_signal_callback_del_full(wd->ent, "selection,start", "elm.text", + _signal_selection_start, obj); + edje_object_signal_callback_del_full(wd->ent, "selection,changed", "elm.text", + _signal_selection_changed, obj); + edje_object_signal_callback_del_full(wd->ent, "entry,selection,all,request", "elm.text", + _signal_selection_all, obj); + edje_object_signal_callback_del_full(wd->ent, "entry,selection,none,request", "elm.text", + _signal_selection_none, obj); + edje_object_signal_callback_del_full(wd->ent, "selection,cleared", "elm.text", + _signal_selection_cleared, obj); + edje_object_signal_callback_del_full(wd->ent, "entry,paste,request,*", "elm.text", + _signal_entry_paste_request, obj); + edje_object_signal_callback_del_full(wd->ent, "entry,copy,notify", "elm.text", + _signal_entry_copy_notify, obj); + edje_object_signal_callback_del_full(wd->ent, "entry,cut,notify", "elm.text", + _signal_entry_cut_notify, obj); + } + else + { +#ifdef HAVE_ELEMENTARY_X + elm_drop_target_add(obj, ELM_SEL_FORMAT_MARKUP, _drag_drop_cb, NULL); +#endif + edje_object_signal_callback_add(wd->ent, "selection,start", "elm.text", + _signal_selection_start, obj); + edje_object_signal_callback_add(wd->ent, "selection,changed", "elm.text", + _signal_selection_changed, obj); + edje_object_signal_callback_add(wd->ent, "entry,selection,all,request", "elm.text", + _signal_selection_all, obj); + edje_object_signal_callback_add(wd->ent, "entry,selection,none,request", "elm.text", + _signal_selection_none, obj); + edje_object_signal_callback_add(wd->ent, "selection,cleared", "elm.text", + _signal_selection_cleared, obj); + edje_object_signal_callback_add(wd->ent, "entry,paste,request,*", "elm.text", + _signal_entry_paste_request, obj); + edje_object_signal_callback_add(wd->ent, "entry,copy,notify", "elm.text", + _signal_entry_copy_notify, obj); + edje_object_signal_callback_add(wd->ent, "entry,cut,notify", "elm.text", + _signal_entry_cut_notify, obj); + } + _theme_hook(obj); +} + +EAPI Eina_Bool +elm_entry_password_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->password; +} + +EAPI void +elm_entry_entry_set(Evas_Object *obj, const char *entry) +{ + _elm_entry_text_set(obj, NULL, entry); +} + +EAPI const char * +elm_entry_entry_get(const Evas_Object *obj) +{ + return _elm_entry_text_get(obj, NULL); +} + +EAPI void +elm_entry_entry_append(Evas_Object *obj, const char *entry) +{ + int len = 0; + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (!entry) entry = ""; + wd->changed = EINA_TRUE; + + len = strlen(entry); + if (wd->append_text_left) + { + char *tmpbuf; + tmpbuf = realloc(wd->append_text_left, wd->append_text_len + len + 1); + if (!tmpbuf) + { + /* Do something */ + return; + } + wd->append_text_left = tmpbuf; + memcpy(wd->append_text_left + wd->append_text_len, entry, len + 1); + wd->append_text_len += len; + } + else + { + /* FIXME: Add chunked appending here (like in entry_set) */ + edje_object_part_text_append(wd->ent, "elm.text", entry); + } +} + +EAPI Eina_Bool +elm_entry_is_empty(const Evas_Object *obj) +{ + /* FIXME: until there's support for that in textblock, we just check + * to see if the there is text or not. */ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_TRUE; + Widget_Data *wd = elm_widget_data_get(obj); + const Evas_Object *tb; + Evas_Textblock_Cursor *cur; + Eina_Bool ret; + if (!wd) return EINA_TRUE; + /* It's a hack until we get the support suggested above. + * We just create a cursor, point it to the begining, and then + * try to advance it, if it can advance, the tb is not empty, + * otherwise it is. */ + tb = edje_object_part_object_get(wd->ent, "elm.text"); + cur = evas_object_textblock_cursor_new((Evas_Object *) tb); /* This is + actually, ok for the time being, thsese hackish stuff will be removed + once evas 1.0 is out*/ + evas_textblock_cursor_pos_set(cur, 0); + ret = evas_textblock_cursor_char_next(cur); + evas_textblock_cursor_free(cur); + + return !ret; +} + +EAPI Evas_Object * +elm_entry_textblock_get(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + return (Evas_Object *) edje_object_part_object_get(wd->ent, "elm.text"); +} + +EAPI void +elm_entry_calc_force(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + edje_object_calc_force(wd->ent); + wd->changed = EINA_TRUE; + _sizing_eval(obj); +} + + +EAPI const char * +elm_entry_selection_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (wd->password)) return NULL; + return edje_object_part_text_selection_get(wd->ent, "elm.text"); +} + +EAPI void +elm_entry_entry_insert(Evas_Object *obj, const char *entry) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_part_text_insert(wd->ent, "elm.text", entry); + wd->changed = EINA_TRUE; + _sizing_eval(obj); +} + +EAPI void +elm_entry_line_wrap_set(Evas_Object *obj, Elm_Wrap_Type wrap) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->linewrap == wrap) return; + wd->lastw = -1; + wd->linewrap = wrap; + _theme_hook(obj); +} + +EAPI Elm_Wrap_Type +elm_entry_line_wrap_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->linewrap; +} + +EAPI void +elm_entry_editable_set(Evas_Object *obj, Eina_Bool editable) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->editable == editable) return; + wd->editable = editable; + _theme_hook(obj); + +#ifdef HAVE_ELEMENTARY_X + if (editable) + elm_drop_target_add(obj, ELM_SEL_FORMAT_MARKUP, _drag_drop_cb, NULL); + else + elm_drop_target_del(obj); +#endif +} + +EAPI Eina_Bool +elm_entry_editable_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->editable; +} + +EAPI void +elm_entry_select_none(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (wd->password)) return; + if (wd->selmode) + { + wd->selmode = EINA_FALSE; + if (!_elm_config->desktop_entry) + edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE); + edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm"); + } + wd->have_selection = EINA_FALSE; + edje_object_part_text_select_none(wd->ent, "elm.text"); +} + +EAPI void +elm_entry_select_all(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (wd->password)) return; + if (wd->selmode) + { + wd->selmode = EINA_FALSE; + if (!_elm_config->desktop_entry) + edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE); + edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm"); + } + wd->have_selection = EINA_TRUE; + edje_object_part_text_select_all(wd->ent, "elm.text"); +} + +EAPI Eina_Bool +elm_entry_cursor_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text", x, y, w, h); + return EINA_TRUE; +} + +EAPI Eina_Bool +elm_entry_cursor_next(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return edje_object_part_text_cursor_next(wd->ent, "elm.text", EDJE_CURSOR_MAIN); +} + +EAPI Eina_Bool +elm_entry_cursor_prev(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return edje_object_part_text_cursor_prev(wd->ent, "elm.text", EDJE_CURSOR_MAIN); +} + +EAPI Eina_Bool +elm_entry_cursor_up(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return edje_object_part_text_cursor_up(wd->ent, "elm.text", EDJE_CURSOR_MAIN); +} + +EAPI Eina_Bool +elm_entry_cursor_down(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return edje_object_part_text_cursor_down(wd->ent, "elm.text", EDJE_CURSOR_MAIN); +} + +EAPI void +elm_entry_cursor_begin_set(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_part_text_cursor_begin_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN); +} + +EAPI void +elm_entry_cursor_end_set(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_part_text_cursor_end_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN); +} + +EAPI void +elm_entry_cursor_line_begin_set(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_part_text_cursor_line_begin_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN); +} + +EAPI void +elm_entry_cursor_line_end_set(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_part_text_cursor_line_end_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN); +} + +EAPI void +elm_entry_cursor_selection_begin(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_part_text_select_begin(wd->ent, "elm.text"); +} + +EAPI void +elm_entry_cursor_selection_end(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_part_text_select_extend(wd->ent, "elm.text"); +} + +EAPI Eina_Bool +elm_entry_cursor_is_format_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return edje_object_part_text_cursor_is_format_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN); +} + +EAPI Eina_Bool +elm_entry_cursor_is_visible_format_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return edje_object_part_text_cursor_is_visible_format_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN); +} + +EAPI char * +elm_entry_cursor_content_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return edje_object_part_text_cursor_content_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN); +} + +EAPI void +elm_entry_cursor_pos_set(Evas_Object *obj, int pos) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_part_text_cursor_pos_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN, pos); + edje_object_message_signal_process(wd->ent); +} + +EAPI int +elm_entry_cursor_pos_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; + return edje_object_part_text_cursor_pos_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN); +} + +EAPI void +elm_entry_selection_cut(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (wd->password)) return; + _cut(obj, NULL, NULL); +} + +EAPI void +elm_entry_selection_copy(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (wd->password)) return; + _copy(obj, NULL, NULL); +} + +EAPI void +elm_entry_selection_paste(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (wd->password)) return; + _paste(obj, NULL, NULL); +} + +EAPI void +elm_entry_context_menu_clear(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Entry_Context_Menu_Item *it; + if (!wd) return; + EINA_LIST_FREE(wd->items, it) + { + eina_stringshare_del(it->label); + eina_stringshare_del(it->icon_file); + eina_stringshare_del(it->icon_group); + free(it); + } +} + +EAPI void +elm_entry_context_menu_item_add(Evas_Object *obj, const char *label, const char *icon_file, Elm_Icon_Type icon_type, Evas_Smart_Cb func, const void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Entry_Context_Menu_Item *it; + if (!wd) return; + it = calloc(1, sizeof(Elm_Entry_Context_Menu_Item)); + if (!it) return; + wd->items = eina_list_append(wd->items, it); + it->obj = obj; + it->label = eina_stringshare_add(label); + it->icon_file = eina_stringshare_add(icon_file); + it->icon_type = icon_type; + it->func = func; + it->data = (void *)data; +} + +EAPI void +elm_entry_context_menu_disabled_set(Evas_Object *obj, Eina_Bool disabled) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->context_menu == !disabled) return; + wd->context_menu = !disabled; +} + +EAPI Eina_Bool +elm_entry_context_menu_disabled_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return !wd->context_menu; +} + +EAPI void +elm_entry_item_provider_append(Evas_Object *obj, Elm_Entry_Item_Provider_Cb func, void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + EINA_SAFETY_ON_NULL_RETURN(func); + Elm_Entry_Item_Provider *ip = calloc(1, sizeof(Elm_Entry_Item_Provider)); + if (!ip) return; + ip->func = func; + ip->data = data; + wd->item_providers = eina_list_append(wd->item_providers, ip); +} + +EAPI void +elm_entry_item_provider_prepend(Evas_Object *obj, Elm_Entry_Item_Provider_Cb func, void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + EINA_SAFETY_ON_NULL_RETURN(func); + Elm_Entry_Item_Provider *ip = calloc(1, sizeof(Elm_Entry_Item_Provider)); + if (!ip) return; + ip->func = func; + ip->data = data; + wd->item_providers = eina_list_prepend(wd->item_providers, ip); +} + +EAPI void +elm_entry_item_provider_remove(Evas_Object *obj, Elm_Entry_Item_Provider_Cb func, void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + Eina_List *l; + Elm_Entry_Item_Provider *ip; + if (!wd) return; + EINA_SAFETY_ON_NULL_RETURN(func); + EINA_LIST_FOREACH(wd->item_providers, l, ip) + { + if ((ip->func == func) && ((!data) || (ip->data == data))) + { + wd->item_providers = eina_list_remove_list(wd->item_providers, l); + free(ip); + return; + } + } +} + +EAPI void +elm_entry_markup_filter_append(Evas_Object *obj, Elm_Entry_Filter_Cb func, void *data) +{ + Widget_Data *wd; + Elm_Entry_Markup_Filter *tf; + ELM_CHECK_WIDTYPE(obj, widtype); + + wd = elm_widget_data_get(obj); + + EINA_SAFETY_ON_NULL_RETURN(func); + + tf = _filter_new(func, data); + if (!tf) return; + + wd->markup_filters = eina_list_append(wd->markup_filters, tf); +} + +EAPI void +elm_entry_markup_filter_prepend(Evas_Object *obj, Elm_Entry_Filter_Cb func, void *data) +{ + Widget_Data *wd; + Elm_Entry_Markup_Filter *tf; + ELM_CHECK_WIDTYPE(obj, widtype); + + wd = elm_widget_data_get(obj); + + EINA_SAFETY_ON_NULL_RETURN(func); + + tf = _filter_new(func, data); + if (!tf) return; + + wd->markup_filters = eina_list_prepend(wd->markup_filters, tf); +} + +EAPI void +elm_entry_markup_filter_remove(Evas_Object *obj, Elm_Entry_Filter_Cb func, void *data) +{ + Widget_Data *wd; + Eina_List *l; + Elm_Entry_Markup_Filter *tf; + ELM_CHECK_WIDTYPE(obj, widtype); + + wd = elm_widget_data_get(obj); + + EINA_SAFETY_ON_NULL_RETURN(func); + + EINA_LIST_FOREACH(wd->markup_filters, l, tf) + { + if ((tf->func == func) && ((!data) || (tf->data == data))) + { + wd->markup_filters = eina_list_remove_list(wd->markup_filters, l); + _filter_free(tf); + return; + } + } +} + +EAPI char * +elm_entry_markup_to_utf8(const char *s) +{ + char *ss = _elm_util_mkup_to_text(s); + if (!ss) ss = strdup(""); + return ss; +} + +EAPI char * +elm_entry_utf8_to_markup(const char *s) +{ + char *ss = _elm_util_text_to_mkup(s); + if (!ss) ss = strdup(""); + return ss; +} + +static const char * +_text_get(const Evas_Object *obj) +{ + return elm_object_text_get(obj); +} + +EAPI void +elm_entry_filter_limit_size(void *data, Evas_Object *entry, char **text) +{ + Elm_Entry_Filter_Limit_Size *lim = data; + char *current, *utfstr; + int len, newlen; + const char *(*text_get)(const Evas_Object *); + + EINA_SAFETY_ON_NULL_RETURN(data); + EINA_SAFETY_ON_NULL_RETURN(entry); + EINA_SAFETY_ON_NULL_RETURN(text); + + /* hack. I don't want to copy the entire function to work with + * scrolled_entry */ + text_get = _text_get; + + current = elm_entry_markup_to_utf8(text_get(entry)); + utfstr = elm_entry_markup_to_utf8(*text); + + if (lim->max_char_count > 0) + { + len = evas_string_char_len_get(current); + newlen = evas_string_char_len_get(utfstr); + if ((len >= lim->max_char_count) && (newlen > 0)) + { + evas_object_smart_callback_call(entry, "maxlength,reached", NULL); + free(*text); + *text = NULL; + free(current); + free(utfstr); + return; + } + if ((len + newlen) > lim->max_char_count) + _add_chars_till_limit(entry, text, (lim->max_char_count - len), LENGTH_UNIT_CHAR); + } + else if (lim->max_byte_count > 0) + { + len = strlen(current); + newlen = strlen(utfstr); + if ((len >= lim->max_byte_count) && (newlen > 0)) + { + evas_object_smart_callback_call(entry, "maxlength,reached", NULL); + free(*text); + *text = NULL; + free(current); + free(utfstr); + return; + } + if ((len + newlen) > lim->max_byte_count) + _add_chars_till_limit(entry, text, (lim->max_byte_count - len), LENGTH_UNIT_BYTE); + } + free(current); + free(utfstr); +} + +EAPI void +elm_entry_filter_accept_set(void *data, Evas_Object *entry __UNUSED__, char **text) +{ + Elm_Entry_Filter_Accept_Set *as = data; + const char *set; + char *insert; + Eina_Bool goes_in; + int read_idx, last_read_idx = 0, read_char; + + EINA_SAFETY_ON_NULL_RETURN(data); + EINA_SAFETY_ON_NULL_RETURN(text); + + if ((!as->accepted) && (!as->rejected)) + return; + + if (as->accepted) + { + set = as->accepted; + goes_in = EINA_TRUE; + } + else + { + set = as->rejected; + goes_in = EINA_FALSE; + } + + insert = *text; + read_idx = evas_string_char_next_get(*text, 0, &read_char); + while (read_char) + { + int cmp_idx, cmp_char; + Eina_Bool in_set = EINA_FALSE; + + cmp_idx = evas_string_char_next_get(set, 0, &cmp_char); + while (cmp_char) + { + if (read_char == cmp_char) + { + in_set = EINA_TRUE; + break; + } + cmp_idx = evas_string_char_next_get(set, cmp_idx, &cmp_char); + } + if (in_set == goes_in) + { + int size = read_idx - last_read_idx; + const char *src = (*text) + last_read_idx; + if (src != insert) + memcpy(insert, *text + last_read_idx, size); + insert += size; + } + last_read_idx = read_idx; + read_idx = evas_string_char_next_get(*text, read_idx, &read_char); + } + *insert = 0; +} + +EAPI Eina_Bool +elm_entry_file_set(Evas_Object *obj, const char *file, Elm_Text_Format format) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + if (wd->delay_write) + { + ecore_timer_del(wd->delay_write); + wd->delay_write = NULL; + } + if (wd->autosave) _save(obj); + eina_stringshare_replace(&wd->file, file); + wd->format = format; + return _load(obj); +} + +EAPI void +elm_entry_file_get(const Evas_Object *obj, const char **file, Elm_Text_Format *format) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (file) *file = wd->file; + if (format) *format = wd->format; +} + +EAPI void +elm_entry_file_save(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->delay_write) + { + ecore_timer_del(wd->delay_write); + wd->delay_write = NULL; + } + _save(obj); + wd->delay_write = ecore_timer_add(2.0, _delay_write, obj); +} + +EAPI void +elm_entry_autosave_set(Evas_Object *obj, Eina_Bool autosave) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->autosave = !!autosave; +} + +EAPI Eina_Bool +elm_entry_autosave_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->autosave; +} + +EINA_DEPRECATED EAPI void +elm_entry_cnp_textonly_set(Evas_Object *obj, Eina_Bool textonly) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Elm_Cnp_Mode cnp_mode = ELM_CNP_MODE_MARKUP; + if (textonly) + cnp_mode = ELM_CNP_MODE_NO_IMAGE; + elm_entry_cnp_mode_set(obj, cnp_mode); +} + +EINA_DEPRECATED EAPI Eina_Bool +elm_entry_cnp_textonly_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + return elm_entry_cnp_mode_get(obj) != ELM_CNP_MODE_MARKUP; +} + +EAPI void +elm_entry_cnp_mode_set(Evas_Object *obj, Elm_Cnp_Mode cnp_mode) +{ + Elm_Sel_Format format = ELM_SEL_FORMAT_MARKUP; + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->cnp_mode == cnp_mode) return; + wd->cnp_mode = cnp_mode; + if (wd->cnp_mode == ELM_CNP_MODE_PLAINTEXT) + format = ELM_SEL_FORMAT_TEXT; + else if (cnp_mode == ELM_CNP_MODE_MARKUP) format |= ELM_SEL_FORMAT_IMAGE; +#ifdef HAVE_ELEMENTARY_X + elm_drop_target_add(obj, format, _drag_drop_cb, NULL); +#endif +} + +EAPI Elm_Cnp_Mode +elm_entry_cnp_mode_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_CNP_MODE_MARKUP; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return ELM_CNP_MODE_MARKUP; + return wd->cnp_mode; +} + +EAPI void +elm_entry_scrollable_set(Evas_Object *obj, Eina_Bool scroll) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + const Elm_Scroller_Policy map[3] = + { + ELM_SMART_SCROLLER_POLICY_AUTO, + ELM_SMART_SCROLLER_POLICY_ON, + ELM_SMART_SCROLLER_POLICY_OFF + }; + if (!wd) return; + scroll = !!scroll; + if (wd->scroll == scroll) return; + wd->scroll = scroll; + if (wd->scroll) + { + if (!wd->scroller) + { + wd->scroller = elm_smart_scroller_add(evas_object_evas_get(obj)); + elm_widget_resize_object_set(obj, wd->scroller); + elm_smart_scroller_widget_set(wd->scroller, obj); + elm_smart_scroller_object_theme_set(obj, wd->scroller, "scroller", "entry", + elm_widget_style_get(obj)); + evas_object_size_hint_weight_set(wd->scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(wd->scroller, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_propagate_events_set(wd->scroller, EINA_TRUE); + evas_object_propagate_events_set(elm_smart_scroller_edje_object_get(wd->scroller), + EINA_TRUE); + } + elm_smart_scroller_bounce_allow_set(wd->scroller, wd->h_bounce, wd->v_bounce); + if (wd->single_line) + elm_smart_scroller_policy_set(wd->scroller, ELM_SMART_SCROLLER_POLICY_OFF, + ELM_SMART_SCROLLER_POLICY_OFF); + else + elm_smart_scroller_policy_set(wd->scroller, map[wd->policy_h], map[wd->policy_v]); + elm_widget_sub_object_add(obj, wd->ent); + elm_smart_scroller_child_set(wd->scroller, wd->ent); + evas_object_show(wd->scroller); + elm_widget_on_show_region_hook_set(obj, _show_region_hook, obj); + } + else + { + if (wd->scroller) + { + elm_smart_scroller_child_set(wd->scroller, NULL); + evas_object_smart_member_add(wd->scroller, obj); + elm_widget_sub_object_add(obj, wd->scroller); + evas_object_hide(wd->scroller); + } + elm_widget_sub_object_del(obj, wd->ent); + elm_widget_resize_object_set(obj, wd->ent); + elm_widget_on_show_region_hook_set(obj, NULL, NULL); + } + wd->lastw = -1; + _theme_hook(obj); +} + +EAPI Eina_Bool +elm_entry_scrollable_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->scroll; +} + +EAPI void +elm_entry_icon_visible_set(Evas_Object *obj, Eina_Bool setting) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *edje; + if (!wd) return; + if (wd->scroll) + edje = elm_smart_scroller_edje_object_get(wd->scroller); + else + edje = wd->ent; + + if ((!edje) || (!edje_object_part_swallow_get(edje, "elm.swallow.icon"))) return; + if (setting) + edje_object_signal_emit(edje, "elm,action,show,icon", "elm"); + else + edje_object_signal_emit(edje, "elm,action,hide,icon", "elm"); + _sizing_eval(obj); +} + +EAPI void +elm_entry_end_visible_set(Evas_Object *obj, Eina_Bool setting) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *edje; + if (!wd) return; + if (wd->scroll) + edje = elm_smart_scroller_edje_object_get(wd->scroller); + else + edje = wd->ent; + + if ((!edje) || (!edje_object_part_swallow_get(edje, "elm.swallow.icon"))) return; + if (setting) + edje_object_signal_emit(edje, "elm,action,show,end", "elm"); + else + edje_object_signal_emit(edje, "elm,action,hide,end", "elm"); + _sizing_eval(obj); +} + +EAPI void +elm_entry_scrollbar_policy_set(Evas_Object *obj, Elm_Scroller_Policy h, Elm_Scroller_Policy v) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + const Elm_Scroller_Policy map[3] = + { + ELM_SMART_SCROLLER_POLICY_AUTO, + ELM_SMART_SCROLLER_POLICY_ON, + ELM_SMART_SCROLLER_POLICY_OFF + }; + if (!wd) return; + wd->policy_h = h; + wd->policy_v = v; + elm_smart_scroller_policy_set(wd->scroller, + map[wd->policy_h], + map[wd->policy_v]); +} + +EAPI void +elm_entry_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->h_bounce = h_bounce; + wd->v_bounce = v_bounce; + elm_smart_scroller_bounce_allow_set(wd->scroller, h_bounce, v_bounce); +} + +EAPI void +elm_entry_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_smart_scroller_bounce_allow_get(wd->scroller, h_bounce, v_bounce); +} + +EAPI void +elm_entry_input_panel_layout_set(Evas_Object *obj, Elm_Input_Panel_Layout layout) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + wd->input_panel_layout = layout; + + edje_object_part_text_input_panel_layout_set(wd->ent, "elm.text", layout); +} + +EAPI Elm_Input_Panel_Layout +elm_entry_input_panel_layout_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_INPUT_PANEL_LAYOUT_INVALID; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return ELM_INPUT_PANEL_LAYOUT_INVALID; + + return wd->input_panel_layout; +} + +EAPI void +elm_entry_autocapital_type_set(Evas_Object *obj, Elm_Autocapital_Type autocapital_type) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + wd->autocapital_type = autocapital_type; + edje_object_part_text_autocapital_type_set(wd->ent, "elm.text", autocapital_type); +} + +EAPI Elm_Autocapital_Type +elm_entry_autocapital_type_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_AUTOCAPITAL_TYPE_NONE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return ELM_AUTOCAPITAL_TYPE_NONE; + + return wd->autocapital_type; +} + +EAPI void +elm_entry_prediction_allow_set(Evas_Object *obj, Eina_Bool prediction) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + wd->prediction_allow = prediction; + edje_object_part_text_prediction_allow_set(wd->ent, "elm.text", prediction); +} + +EAPI Eina_Bool +elm_entry_prediction_allow_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_TRUE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_TRUE; + + return wd->prediction_allow; +} + +EAPI void +elm_entry_imf_context_reset(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + edje_object_part_text_imf_context_reset(wd->ent, "elm.text"); +} + +EAPI void +elm_entry_input_panel_enabled_set(Evas_Object *obj, Eina_Bool enabled) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + wd->input_panel_enable = enabled; + edje_object_part_text_input_panel_enabled_set(wd->ent, "elm.text", enabled); +} + +EAPI Eina_Bool +elm_entry_input_panel_enabled_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_TRUE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_TRUE; + + return wd->input_panel_enable; +} + +EAPI void +elm_entry_input_panel_show(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + edje_object_part_text_input_panel_show(wd->ent, "elm.text"); +} + +EAPI void +elm_entry_input_panel_hide(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + edje_object_part_text_input_panel_hide(wd->ent, "elm.text"); +} + +EAPI void +elm_entry_input_panel_language_set(Evas_Object *obj, Elm_Input_Panel_Lang lang) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + wd->input_panel_lang = lang; + edje_object_part_text_input_panel_language_set(wd->ent, "elm.text", lang); +} + +EAPI Elm_Input_Panel_Lang +elm_entry_input_panel_language_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_INPUT_PANEL_LANG_AUTOMATIC; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return ELM_INPUT_PANEL_LANG_AUTOMATIC; + + return wd->input_panel_lang; +} + +EAPI void +elm_entry_input_panel_imdata_set(Evas_Object *obj, const void *data, int len) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (wd->input_panel_imdata) + free(wd->input_panel_imdata); + + wd->input_panel_imdata = calloc(1, len); + wd->input_panel_imdata_len = len; + memcpy(wd->input_panel_imdata, data, len); + + edje_object_part_text_input_panel_imdata_set(wd->ent, "elm.text", wd->input_panel_imdata, wd->input_panel_imdata_len); +} + +EAPI void +elm_entry_input_panel_imdata_get(const Evas_Object *obj, void *data, int *len) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + edje_object_part_text_input_panel_imdata_get(wd->ent, "elm.text", data, len); +} + +EAPI void +elm_entry_input_panel_return_key_type_set(Evas_Object *obj, Elm_Input_Panel_Return_Key_Type return_key_type) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + wd->input_panel_return_key_type = return_key_type; + + edje_object_part_text_input_panel_return_key_type_set(wd->ent, "elm.text", return_key_type); +} + +EAPI Elm_Input_Panel_Return_Key_Type +elm_entry_input_panel_return_key_type_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return ELM_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT; + + return wd->input_panel_return_key_type; +} + +EAPI void +elm_entry_input_panel_return_key_disabled_set(Evas_Object *obj, Eina_Bool disabled) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + wd->input_panel_return_key_disabled = disabled; + + edje_object_part_text_input_panel_return_key_disabled_set(wd->ent, "elm.text", disabled); +} + +EAPI Eina_Bool +elm_entry_input_panel_return_key_disabled_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + return wd->input_panel_return_key_disabled; +} + +EAPI void +elm_entry_input_panel_return_key_autoenabled_set(Evas_Object *obj, Eina_Bool enabled) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + wd->autoreturnkey = enabled; + _check_enable_return_key(obj); +} + +EAPI void* +elm_entry_imf_context_get(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + return edje_object_part_text_imf_context_get(wd->ent, "elm.text"); +} + +/* START - ANCHOR HOVER */ +static void +_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + wd->anchor_hover.hover_parent = NULL; +} + +EAPI void +elm_entry_anchor_hover_parent_set(Evas_Object *obj, Evas_Object *parent) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->anchor_hover.hover_parent) + evas_object_event_callback_del_full(wd->anchor_hover.hover_parent, EVAS_CALLBACK_DEL, _parent_del, obj); + wd->anchor_hover.hover_parent = parent; + if (wd->anchor_hover.hover_parent) + evas_object_event_callback_add(wd->anchor_hover.hover_parent, EVAS_CALLBACK_DEL, _parent_del, obj); +} + +EAPI Evas_Object * +elm_entry_anchor_hover_parent_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->anchor_hover.hover_parent; +} + +EAPI void +elm_entry_anchor_hover_style_set(Evas_Object *obj, const char *style) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + eina_stringshare_replace(&wd->anchor_hover.hover_style, style); +} + +EAPI const char * +elm_entry_anchor_hover_style_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->anchor_hover.hover_style; +} + +EAPI void +elm_entry_anchor_hover_end(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->anchor_hover.hover) evas_object_del(wd->anchor_hover.hover); + if (wd->anchor_hover.pop) evas_object_del(wd->anchor_hover.pop); + wd->anchor_hover.hover = NULL; + wd->anchor_hover.pop = NULL; +} + + +static void +_anchor_hover_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_entry_anchor_hover_end(data); +} + +static void +_entry_hover_anchor_clicked(void *data, Evas_Object *obj, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Entry_Anchor_Info *info = event_info; + Evas_Object *hover_parent; + Elm_Entry_Anchor_Hover_Info ei; + Evas_Coord x, w, y, h, px, py; + if (!wd) return; + + ei.anchor_info = event_info; + + wd->anchor_hover.pop = elm_icon_add(obj); + evas_object_move(wd->anchor_hover.pop, info->x, info->y); + evas_object_resize(wd->anchor_hover.pop, info->w, info->h); + + wd->anchor_hover.hover = elm_hover_add(obj); + elm_widget_mirrored_set(wd->anchor_hover.hover, elm_widget_mirrored_get(obj)); + if (wd->anchor_hover.hover_style) + elm_object_style_set(wd->anchor_hover.hover, wd->anchor_hover.hover_style); + + hover_parent = wd->anchor_hover.hover_parent; + if (!hover_parent) hover_parent = obj; + elm_hover_parent_set(wd->anchor_hover.hover, hover_parent); + elm_hover_target_set(wd->anchor_hover.hover, wd->anchor_hover.pop); + ei.hover = wd->anchor_hover.hover; + + evas_object_geometry_get(hover_parent, &x, &y, &w, &h); + ei.hover_parent.x = x; + ei.hover_parent.y = y; + ei.hover_parent.w = w; + ei.hover_parent.h = h; + px = info->x + (info->w / 2); + py = info->y + (info->h / 2); + ei.hover_left = 1; + if (px < (x + (w / 3))) ei.hover_left = 0; + ei.hover_right = 1; + if (px > (x + ((w * 2) / 3))) ei.hover_right = 0; + ei.hover_top = 1; + if (py < (y + (h / 3))) ei.hover_top = 0; + ei.hover_bottom = 1; + if (py > (y + ((h * 2) / 3))) ei.hover_bottom = 0; + + if (elm_widget_mirrored_get(wd->anchor_hover.hover)) + { /* Swap right and left because they switch sides in RTL */ + Eina_Bool tmp = ei.hover_left; + ei.hover_left = ei.hover_right; + ei.hover_right = tmp; + } + + evas_object_smart_callback_call(data, SIG_ANCHOR_HOVER_OPENED, &ei); + evas_object_smart_callback_add(wd->anchor_hover.hover, "clicked", _anchor_hover_clicked, data); + + /* FIXME: Should just check if there's any callback registered to the smart + * events instead. + * This is used to determine if anyone cares about the hover or not. */ + if (!elm_object_part_content_get(wd->anchor_hover.hover, "middle") && + !elm_object_part_content_get(wd->anchor_hover.hover, "left") && + !elm_object_part_content_get(wd->anchor_hover.hover, "right") && + !elm_object_part_content_get(wd->anchor_hover.hover, "top") && + !elm_object_part_content_get(wd->anchor_hover.hover, "bottom")) + { + evas_object_del(wd->anchor_hover.hover); + } + else + { + evas_object_show(wd->anchor_hover.hover); + } +} +/* END - ANCHOR HOVER */ diff --git a/libraries/elementary/src/lib/elm_entry.h b/libraries/elementary/src/lib/elm_entry.h new file mode 100644 index 0000000..0621caa --- /dev/null +++ b/libraries/elementary/src/lib/elm_entry.h @@ -0,0 +1,1730 @@ +/** + * @defgroup Entry Entry + * @ingroup Elementary + * + * @image html img/widget/entry/preview-00.png + * @image latex img/widget/entry/preview-00.eps width=\textwidth + * @image html img/widget/entry/preview-01.png + * @image latex img/widget/entry/preview-01.eps width=\textwidth + * @image html img/widget/entry/preview-02.png + * @image latex img/widget/entry/preview-02.eps width=\textwidth + * @image html img/widget/entry/preview-03.png + * @image latex img/widget/entry/preview-03.eps width=\textwidth + * + * An entry is a convenience widget which shows a box that the user can + * enter text into. Entries by default don't scroll, so they grow to + * accommodate the entire text, resizing the parent window as needed. This + * can be changed with the elm_entry_scrollable_set() function. + * + * They can also be single line or multi line (the default) and when set + * to multi line mode they support text wrapping in any of the modes + * indicated by #Elm_Wrap_Type. + * + * Other features include password mode, filtering of inserted text with + * elm_entry_markup_filter_append() and related functions, inline "items" and + * formatted markup text. + * + * @section entry-markup Formatted text + * + * The markup tags supported by the Entry are defined by the theme, but + * even when writing new themes or extensions it's a good idea to stick to + * a sane default, to maintain coherency and avoid application breakages. + * Currently defined by the default theme are the following tags: + * @li \: Inserts a line break. + * @li \: Inserts a paragraph separator. This is preferred over line + * breaks. + * @li \: Inserts a tab. + * @li \...\: Emphasis. Sets the @em oblique style for the + * enclosed text. + * @li \...\: Sets the @b bold style for the enclosed text. + * @li \...\: Underlines the enclosed text. + * @li \...\: Highlights the enclosed text. + * + * @section entry-special Special markups + * + * Besides those used to format text, entries support two special markup + * tags used to insert click-able portions of text or items inlined within + * the text. + * + * @subsection entry-anchors Anchors + * + * Anchors are similar to HTML anchors. Text can be surrounded by \ and + * \ tags and an event will be generated when this text is clicked, + * like this: + * + * @code + * This text is outside but this one is an anchor + * @endcode + * + * The @c href attribute in the opening tag gives the name that will be + * used to identify the anchor and it can be any valid utf8 string. + * + * When an anchor is clicked, an @c "anchor,clicked" signal is emitted with + * an #Elm_Entry_Anchor_Info in the @c event_info parameter for the + * callback function. The same applies for "anchor,in" (mouse in), "anchor,out" + * (mouse out), "anchor,down" (mouse down), and "anchor,up" (mouse up) events on + * an anchor. + * + * @subsection entry-items Items + * + * Inlined in the text, any other @c Evas_Object can be inserted by using + * \ tags this way: + * + * @code + * + * @endcode + * + * Just like with anchors, the @c href identifies each item, but these need, + * in addition, to indicate their size, which is done using any one of + * @c size, @c absize or @c relsize attributes. These attributes take their + * value in the WxH format, where W is the width and H the height of the + * item. + * + * @li absize: Absolute pixel size for the item. Whatever value is set will + * be the item's size regardless of any scale value the object may have + * been set to. The final line height will be adjusted to fit larger items. + * @li size: Similar to @c absize, but it's adjusted to the scale value set + * for the object. + * @li relsize: Size is adjusted for the item to fit within the current + * line height. + * + * Besides their size, items are specified a @c vsize value that affects + * how their final size and position are calculated. The possible values + * are: + * @li ascent: Item will be placed within the line's baseline and its + * ascent. That is, the height between the line where all characters are + * positioned and the highest point in the line. For @c size and @c absize + * items, the descent value will be added to the total line height to make + * them fit. @c relsize items will be adjusted to fit within this space. + * @li full: Items will be placed between the descent and ascent, or the + * lowest point in the line and its highest. + * + * The next image shows different configurations of items and how + * the previously mentioned options affect their sizes. In all cases, + * the green line indicates the ascent, blue for the baseline and red for + * the descent. + * + * @image html entry_item.png + * @image latex entry_item.eps width=\textwidth + * + * And another one to show how size differs from absize. In the first one, + * the scale value is set to 1.0, while the second one is using one of 2.0. + * + * @image html entry_item_scale.png + * @image latex entry_item_scale.eps width=\textwidth + * + * After the size for an item is calculated, the entry will request an + * object to place in its space. For this, the functions set with + * elm_entry_item_provider_append() and related functions will be called + * in order until one of them returns a @c non-NULL value. If no providers + * are available, or all of them return @c NULL, then the entry falls back + * to one of the internal defaults, provided the name matches with one of + * them. + * + * All of the following are currently supported: + * + * - emoticon/angry + * - emoticon/angry-shout + * - emoticon/crazy-laugh + * - emoticon/evil-laugh + * - emoticon/evil + * - emoticon/goggle-smile + * - emoticon/grumpy + * - emoticon/grumpy-smile + * - emoticon/guilty + * - emoticon/guilty-smile + * - emoticon/haha + * - emoticon/half-smile + * - emoticon/happy-panting + * - emoticon/happy + * - emoticon/indifferent + * - emoticon/kiss + * - emoticon/knowing-grin + * - emoticon/laugh + * - emoticon/little-bit-sorry + * - emoticon/love-lots + * - emoticon/love + * - emoticon/minimal-smile + * - emoticon/not-happy + * - emoticon/not-impressed + * - emoticon/omg + * - emoticon/opensmile + * - emoticon/smile + * - emoticon/sorry + * - emoticon/squint-laugh + * - emoticon/surprised + * - emoticon/suspicious + * - emoticon/tongue-dangling + * - emoticon/tongue-poke + * - emoticon/uh + * - emoticon/unhappy + * - emoticon/very-sorry + * - emoticon/what + * - emoticon/wink + * - emoticon/worried + * - emoticon/wtf + * + * Alternatively, an item may reference an image by its path, using + * the URI form @c file:///path/to/an/image.png and the entry will then + * use that image for the item. + * + * @section entry-files Loading and saving files + * + * Entries have convenience functions to load text from a file and save + * changes back to it after a short delay. The automatic saving is enabled + * by default, but can be disabled with elm_entry_autosave_set() and files + * can be loaded directly as plain text or have any markup in them + * recognized. See elm_entry_file_set() for more details. + * + * @section entry-signals Emitted signals + * + * This widget emits the following signals: + * + * @li "changed": The text within the entry was changed. + * @li "changed,user": The text within the entry was changed because of user interaction. + * @li "activated": The enter key was pressed on a single line entry. + * @li "press": A mouse button has been pressed on the entry. + * @li "longpressed": A mouse button has been pressed and held for a couple + * seconds. + * @li "clicked": The entry has been clicked (mouse press and release). + * @li "clicked,double": The entry has been double clicked. + * @li "clicked,triple": The entry has been triple clicked. + * @li "focused": The entry has received focus. + * @li "unfocused": The entry has lost focus. + * @li "selection,paste": A paste of the clipboard contents was requested. + * @li "selection,copy": A copy of the selected text into the clipboard was + * requested. + * @li "selection,cut": A cut of the selected text into the clipboard was + * requested. + * @li "selection,start": A selection has begun and no previous selection + * existed. + * @li "selection,changed": The current selection has changed. + * @li "selection,cleared": The current selection has been cleared. + * @li "cursor,changed": The cursor has changed position. + * @li "anchor,clicked": An anchor has been clicked. The event_info + * parameter for the callback will be an #Elm_Entry_Anchor_Info. + * @li "anchor,in": Mouse cursor has moved into an anchor. The event_info + * parameter for the callback will be an #Elm_Entry_Anchor_Info. + * @li "anchor,out": Mouse cursor has moved out of an anchor. The event_info + * parameter for the callback will be an #Elm_Entry_Anchor_Info. + * @li "anchor,up": Mouse button has been unpressed on an anchor. The event_info + * parameter for the callback will be an #Elm_Entry_Anchor_Info. + * @li "anchor,down": Mouse button has been pressed on an anchor. The event_info + * parameter for the callback will be an #Elm_Entry_Anchor_Info. + * @li "preedit,changed": The preedit string has changed. + * @li "language,changed": Program language changed. + * + * Default content parts of the entry items that you can use for are: + * @li "icon" - An icon in the entry + * @li "end" - A content in the end of the entry + * + * Default text parts of the entry that you can use for are: + * @li "default" - text of the entry + * + * Supported elm_object common APIs. + * @li @ref elm_object_signal_emit + * @li @ref elm_object_part_text_set + * @li @ref elm_object_part_text_get + * @li @ref elm_object_part_content_set + * @li @ref elm_object_part_content_get + * @li @ref elm_object_part_content_unset + * @li @ref elm_object_signal_callback_add + * @li @ref elm_object_signal_callback_del + * @li @ref elm_object_disabled_set + * @li @ref elm_object_disabled_get + * + * @section entry-examples + * + * An overview of the Entry API can be seen in @ref entry_example + * + * @{ + */ + +/** + * @typedef Elm_Text_Format + * + * Text Format types. + * + * @see elm_entry_file_set() + */ +typedef enum +{ + ELM_TEXT_FORMAT_PLAIN_UTF8, /**< Plain UTF8 type */ + ELM_TEXT_FORMAT_MARKUP_UTF8 /**< Markup UTF8 type */ +} Elm_Text_Format; + +/** + * @typedef Elm_Wrap_Type + * + * Line wrapping types. + * + * @see elm_entry_line_wrap_set() + */ +typedef enum +{ + ELM_WRAP_NONE = 0, /**< No wrap - value is zero */ + ELM_WRAP_CHAR, /**< Char wrap - wrap between characters */ + ELM_WRAP_WORD, /**< Word wrap - wrap in allowed wrapping points (as defined in the unicode standard) */ + ELM_WRAP_MIXED, /**< Mixed wrap - Word wrap, and if that fails, char wrap. */ + ELM_WRAP_LAST +} Elm_Wrap_Type; /**< Type of word or character wrapping to use */ + +/** + * @typedef Elm_Input_Panel_Layout + * + * Input panel (virtual keyboard) layout types. + * + * @see elm_entry_input_panel_layout_set() + */ +typedef enum +{ + ELM_INPUT_PANEL_LAYOUT_NORMAL, /**< Default layout */ + ELM_INPUT_PANEL_LAYOUT_NUMBER, /**< Number layout */ + ELM_INPUT_PANEL_LAYOUT_EMAIL, /**< Email layout */ + ELM_INPUT_PANEL_LAYOUT_URL, /**< URL layout */ + ELM_INPUT_PANEL_LAYOUT_PHONENUMBER, /**< Phone Number layout */ + ELM_INPUT_PANEL_LAYOUT_IP, /**< IP layout */ + ELM_INPUT_PANEL_LAYOUT_MONTH, /**< Month layout */ + ELM_INPUT_PANEL_LAYOUT_NUMBERONLY, /**< Number Only layout */ + ELM_INPUT_PANEL_LAYOUT_INVALID, /**< Never use this */ + ELM_INPUT_PANEL_LAYOUT_HEX, /**< Hexadecimal layout */ + ELM_INPUT_PANEL_LAYOUT_TERMINAL, /**< Command-line terminal layout */ + ELM_INPUT_PANEL_LAYOUT_PASSWORD /**< Like normal, but no auto-correct, no auto-capitalization etc. */ +} Elm_Input_Panel_Layout; /**< Type of input panel (virtual keyboard) to use - this is a hint and may not provide exactly what is desired. */ + +/** + * @typedef Elm_Input_Panel_Lang + * + * Input panel (virtual keyboard) language modes. + * + * @see elm_entry_input_panel_language_set() + */ +typedef enum +{ + ELM_INPUT_PANEL_LANG_AUTOMATIC, /**< Automatic */ + ELM_INPUT_PANEL_LANG_ALPHABET /**< Alphabet */ +} Elm_Input_Panel_Lang; + +/** + * @typedef Elm_Autocapital_Type + * + * Autocapitalization Types. + * + * @see elm_entry_autocapital_type_set() + */ +typedef enum +{ + ELM_AUTOCAPITAL_TYPE_NONE, /**< No auto-capitalization when typing */ + ELM_AUTOCAPITAL_TYPE_WORD, /**< Autocapitalize each word typed */ + ELM_AUTOCAPITAL_TYPE_SENTENCE, /**< Autocapitalize the start of each sentence */ + ELM_AUTOCAPITAL_TYPE_ALLCHARACTER, /**< Autocapitalize all letters */ +} Elm_Autocapital_Type; /**< Choose method of auto-capitalization */ + +/** + * @typedef Elm_Input_Panel_Return_Key_Type + * + * "Return" Key types on the input panel (virtual keyboard). + * + * @see elm_entry_input_panel_return_key_type_set() + */ +typedef enum +{ + ELM_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT, /**< Default */ + ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE, /**< Done */ + ELM_INPUT_PANEL_RETURN_KEY_TYPE_GO, /**< Go */ + ELM_INPUT_PANEL_RETURN_KEY_TYPE_JOIN, /**< Join */ + ELM_INPUT_PANEL_RETURN_KEY_TYPE_LOGIN, /**< Login */ + ELM_INPUT_PANEL_RETURN_KEY_TYPE_NEXT, /**< Next */ + ELM_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH, /**< Search string or magnifier icon */ + ELM_INPUT_PANEL_RETURN_KEY_TYPE_SEND /**< Send */ +} Elm_Input_Panel_Return_Key_Type; + +/** + * @typedef Elm_Entry_Anchor_Info + * + * The info sent in the callback for the "anchor,clicked" signals emitted + * by entries. + */ +typedef struct _Elm_Entry_Anchor_Info Elm_Entry_Anchor_Info; + +/** + * @struct _Elm_Entry_Anchor_Info + * + * The info sent in the callback for the "anchor,clicked" signals emitted + * by entries. + */ +struct _Elm_Entry_Anchor_Info +{ + const char *name; /**< The name of the anchor, as stated in its href */ + int button; /**< The mouse button used to click on it */ + Evas_Coord x, /**< Anchor geometry, relative to canvas */ + y, /**< Anchor geometry, relative to canvas */ + w, /**< Anchor geometry, relative to canvas */ + h; /**< Anchor geometry, relative to canvas */ +}; + +/** + * @typedef Elm_Entry_Anchor_Hover_Info + * + * The info sent in the callback for "anchor,clicked" signals emitted by + * the Anchor_Hover widget. + */ +typedef struct _Elm_Entry_Anchor_Hover_Info Elm_Entry_Anchor_Hover_Info; + +/** + * @struct _Elm_Entry_Anchor_Hover_Info + * + * The info sent in the callback for "anchor,clicked" signals emitted by + * the Anchor_Hover widget. + */ +struct _Elm_Entry_Anchor_Hover_Info +{ + const Elm_Entry_Anchor_Info *anchor_info; /**< The actual anchor info. */ + Evas_Object *hover; /**< The hover object to use for the popup */ + struct + { + Evas_Coord x, y, w, h; + } hover_parent; /**< Geometry of the object used as parent by the + hover */ + Eina_Bool hover_left : 1; /**< Hint indicating if there's space + for content on the left side of + the hover. Before calling the + callback, the widget will make the + necessary calculations to check + which sides are fit to be set with + content, based on the position the + hover is activated and its distance + to the edges of its parent object + */ + Eina_Bool hover_right : 1; /**< Hint indicating content fits on + the right side of the hover. + See @ref hover_left */ + Eina_Bool hover_top : 1; /**< Hint indicating content fits on top + of the hover. See @ref hover_left */ + Eina_Bool hover_bottom : 1; /**< Hint indicating content fits + below the hover. See @ref + hover_left */ +}; + +/** + * @typedef Elm_Entry_Item_Provider_Cb + * This callback type is used to provide items. + * If it returns an object handle other than NULL (it should create an + * object to do this), then this object is used to replace the current item. + * If not the next provider is called until one provides an item object, or the + * default provider in entry does. + * @param data The data specified as the last param when adding the provider + * @param entry The entry object + * @param text A pointer to the item href string in the text + * @return The object to be placed in the entry like an icon, or other element + * @see elm_entry_item_provider_append + * @see elm_entry_item_provider_prepend + * @see elm_entry_item_provider_remove + */ +typedef Evas_Object * (*Elm_Entry_Item_Provider_Cb)(void *data, Evas_Object * entry, const char *item); + +/** + * @typedef Elm_Entry_Filter_Cb + * This callback type is used by entry filters to modify text. + * @param data The data specified as the last param when adding the filter + * @param entry The entry object + * @param text A pointer to the location of the text being filtered. The type of text is always markup. This data can be modified, but any additional allocations must be managed by the user. + * @see elm_entry_markup_filter_append + * @see elm_entry_markup_filter_prepend + * @see elm_entry_markup_filter_remove + */ +typedef void (*Elm_Entry_Filter_Cb)(void *data, Evas_Object *entry, char **text); + +/** + * @typedef Elm_Entry_Change_Info + * This corresponds to Edje_Entry_Change_Info. Includes information about + * a change in the entry. + */ +typedef Edje_Entry_Change_Info Elm_Entry_Change_Info; + +/** + * This adds an entry to @p parent object. + * + * By default, entries are: + * @li not scrolled + * @li multi-line + * @li word wrapped + * @li autosave is enabled + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * @ingroup Entry + */ +EAPI Evas_Object *elm_entry_add(Evas_Object *parent); + +/** + * Sets the entry to single line mode. + * + * In single line mode, entries don't ever wrap when the text reaches the + * edge, and instead they keep growing horizontally. Pressing the @c Enter + * key will generate an @c "activate" event instead of adding a new line. + * + * When @p single_line is @c EINA_FALSE, line wrapping takes effect again + * and pressing enter will break the text into a different line + * without generating any events. + * + * @param obj The entry object + * @param single_line If true, the text in the entry + * will be on a single line. + * + * @ingroup Entry + */ +EAPI void elm_entry_single_line_set(Evas_Object *obj, Eina_Bool single_line); + +/** + * Gets whether the entry is set to be single line. + * + * @param obj The entry object + * @return single_line If true, the text in the entry is set to display + * on a single line. + * + * @see elm_entry_single_line_set() + * + * @ingroup Entry + */ +EAPI Eina_Bool elm_entry_single_line_get(const Evas_Object *obj); + +/** + * Sets the entry to password mode. + * + * In password mode, entries are implicitly single line and the display of + * any text in them is replaced with asterisks (*). + * + * @param obj The entry object + * @param password If true, password mode is enabled. + * + * @ingroup Entry + */ +EAPI void elm_entry_password_set(Evas_Object *obj, Eina_Bool password); + +/** + * Gets whether the entry is set to password mode. + * + * @param obj The entry object + * @return If true, the entry is set to display all characters + * as asterisks (*). + * + * @see elm_entry_password_set() + * + * @ingroup Entry + */ +EAPI Eina_Bool elm_entry_password_get(const Evas_Object *obj); + +/** + * This sets the text displayed within the entry to @p entry. + * + * @param obj The entry object + * @param entry The text to be displayed + * + * @note Using this function bypasses text filters + * + * @ingroup Entry + */ +EAPI void elm_entry_entry_set(Evas_Object *obj, const char *entry); + +/** + * This returns the text currently shown in object @p entry. + * See also elm_entry_entry_set(). + * + * @param obj The entry object + * @return The currently displayed text or NULL on failure + * + * @ingroup Entry + */ +EAPI const char *elm_entry_entry_get(const Evas_Object *obj); + +/** + * Appends @p entry to the text of the entry. + * + * Adds the text in @p entry to the end of any text already present in the + * widget. + * + * The appended text is subject to any filters set for the widget. + * + * @param obj The entry object + * @param entry The text to be displayed + * + * @see elm_entry_markup_filter_append() + * + * @ingroup Entry + */ +EAPI void elm_entry_entry_append(Evas_Object *obj, const char *entry); + +/** + * Gets whether the entry is empty. + * + * Empty means no text at all. If there are any markup tags, like an item + * tag for which no provider finds anything, and no text is displayed, this + * function still returns EINA_FALSE. + * + * @param obj The entry object + * @return EINA_TRUE if the entry is empty, EINA_FALSE otherwise. + * + * @ingroup Entry + */ +EAPI Eina_Bool elm_entry_is_empty(const Evas_Object *obj); + +/** + * Gets any selected text within the entry. + * + * If there's any selected text in the entry, this function returns it as + * a string in markup format. NULL is returned if no selection exists or + * if an error occurred. + * + * The returned value points to an internal string and should not be freed + * or modified in any way. If the @p entry object is deleted or its + * contents are changed, the returned pointer should be considered invalid. + * + * @param obj The entry object + * @return The selected text within the entry or NULL on failure + * + * @ingroup Entry + */ +EAPI const char *elm_entry_selection_get(const Evas_Object *obj); + +/** + * Returns the actual textblock object of the entry. + * + * This function exposes the internal textblock object that actually + * contains and draws the text. This should be used for low-level + * manipulations that are otherwise not possible. + * + * Changing the textblock directly from here will not notify edje/elm to + * recalculate the textblock size automatically, so any modifications + * done to the textblock returned by this function should be followed by + * a call to elm_entry_calc_force(). + * + * The return value is marked as const as an additional warning. + * One should not use the returned object with any of the generic evas + * functions (geometry_get/resize/move and etc), but only with the textblock + * functions; The former will either not work at all, or break the correct + * functionality. + * + * IMPORTANT: Many functions may change (i.e delete and create a new one) + * the internal textblock object. Do NOT cache the returned object, and try + * not to mix calls on this object with regular elm_entry calls (which may + * change the internal textblock object). This applies to all cursors + * returned from textblock calls, and all the other derivative values. + * + * @param obj The entry object + * @return The textblock object. + * + * @ingroup Entry + */ +EAPI Evas_Object * elm_entry_textblock_get(Evas_Object *obj); + +/** + * Forces calculation of the entry size and text layouting. + * + * This should be used after modifying the textblock object directly. See + * elm_entry_textblock_get() for more information. + * + * @param obj The entry object + * + * @see elm_entry_textblock_get() + * + * @ingroup Entry + */ +EAPI void elm_entry_calc_force(Evas_Object *obj); + +/** + * Inserts the given text into the entry at the current cursor position. + * + * This inserts text at the cursor position as if it was typed + * by the user (note that this also allows markup which a user + * can't just "type" as it would be converted to escaped text, so this + * call can be used to insert things like emoticon items or bold push/pop + * tags, other font and color change tags etc.) + * + * If any selection exists, it will be replaced by the inserted text. + * + * The inserted text is subject to any filters set for the widget. + * + * @param obj The entry object + * @param entry The text to insert + * + * @see elm_entry_markup_filter_append() + * + * @ingroup Entry + */ +EAPI void elm_entry_entry_insert(Evas_Object *obj, const char *entry); + +/** + * Set the line wrap type to use on multi-line entries. + * + * Sets the wrap type used by the entry to any of the specified in + * Elm_Wrap_Type. This tells how the text will be implicitly cut into a new + * line (without inserting a line break or paragraph separator) when it + * reaches the far edge of the widget. + * + * Note that this only makes sense for multi-line entries. A widget set + * to be single line will never wrap. + * + * @param obj The entry object + * @param wrap The wrap mode to use. See Elm_Wrap_Type for details on them + */ +EAPI void elm_entry_line_wrap_set(Evas_Object *obj, Elm_Wrap_Type wrap); + +/** + * Gets the wrap mode the entry was set to use. + * + * @param obj The entry object + * @return Wrap type + * + * @see also elm_entry_line_wrap_set() + * + * @ingroup Entry + */ +EAPI Elm_Wrap_Type elm_entry_line_wrap_get(const Evas_Object *obj); + +/** + * Sets if the entry is to be editable or not. + * + * By default, entries are editable and when focused, any text input by the + * user will be inserted at the current cursor position. But calling this + * function with @p editable as EINA_FALSE will prevent the user from + * inputting text into the entry. + * + * The only way to change the text of a non-editable entry is to use + * elm_object_text_set(), elm_entry_entry_insert() and other related + * functions. + * + * @param obj The entry object + * @param editable If EINA_TRUE, user input will be inserted in the entry, + * if not, the entry is read-only and no user input is allowed. + * + * @ingroup Entry + */ +EAPI void elm_entry_editable_set(Evas_Object *obj, Eina_Bool editable); + +/** + * Gets whether the entry is editable or not. + * + * @param obj The entry object + * @return If true, the entry is editable by the user. + * If false, it is not editable by the user + * + * @see elm_entry_editable_set() + * + * @ingroup Entry + */ +EAPI Eina_Bool elm_entry_editable_get(const Evas_Object *obj); + +/** + * This drops any existing text selection within the entry. + * + * @param obj The entry object + * + * @ingroup Entry + */ +EAPI void elm_entry_select_none(Evas_Object *obj); + +/** + * This selects all text within the entry. + * + * @param obj The entry object + * + * @ingroup Entry + */ +EAPI void elm_entry_select_all(Evas_Object *obj); + +/** + * This moves the cursor one place to the right within the entry. + * + * @param obj The entry object + * @return EINA_TRUE upon success, EINA_FALSE upon failure + * + * @ingroup Entry + */ +EAPI Eina_Bool elm_entry_cursor_next(Evas_Object *obj); + +/** + * This moves the cursor one place to the left within the entry. + * + * @param obj The entry object + * @return EINA_TRUE upon success, EINA_FALSE upon failure + * + * @ingroup Entry + */ +EAPI Eina_Bool elm_entry_cursor_prev(Evas_Object *obj); + +/** + * This moves the cursor one line up within the entry. + * + * @param obj The entry object + * @return EINA_TRUE upon success, EINA_FALSE upon failure + * + * @ingroup Entry + */ +EAPI Eina_Bool elm_entry_cursor_up(Evas_Object *obj); + +/** + * This moves the cursor one line down within the entry. + * + * @param obj The entry object + * @return EINA_TRUE upon success, EINA_FALSE upon failure + * + * @ingroup Entry + */ +EAPI Eina_Bool elm_entry_cursor_down(Evas_Object *obj); + +/** + * This moves the cursor to the beginning of the entry. + * + * @param obj The entry object + * + * @ingroup Entry + */ +EAPI void elm_entry_cursor_begin_set(Evas_Object *obj); + +/** + * This moves the cursor to the end of the entry. + * + * @param obj The entry object + * + * @ingroup Entry + */ +EAPI void elm_entry_cursor_end_set(Evas_Object *obj); + +/** + * This moves the cursor to the beginning of the current line. + * + * @param obj The entry object + * + * @ingroup Entry + */ +EAPI void elm_entry_cursor_line_begin_set(Evas_Object *obj); + +/** + * This moves the cursor to the end of the current line. + * + * @param obj The entry object + * + * @ingroup Entry + */ +EAPI void elm_entry_cursor_line_end_set(Evas_Object *obj); + +/** + * This begins a selection within the entry as though + * the user were holding down the mouse button to make a selection. + * + * @param obj The entry object + * + * @ingroup Entry + */ +EAPI void elm_entry_cursor_selection_begin(Evas_Object *obj); + +/** + * This ends a selection within the entry as though + * the user had just released the mouse button while making a selection. + * + * @param obj The entry object + * + * @ingroup Entry + */ +EAPI void elm_entry_cursor_selection_end(Evas_Object *obj); + +/** + * Gets whether a format node exists at the current cursor position. + * + * A format node is anything that defines how the text is rendered. It can + * be a visible format node, such as a line break or a paragraph separator, + * or an invisible one, such as bold begin or end tag. + * This function returns whether any format node exists at the current + * cursor position. + * + * @param obj The entry object + * @return EINA_TRUE if the current cursor position contains a format node, + * EINA_FALSE otherwise. + * + * @see elm_entry_cursor_is_visible_format_get() + * + * @ingroup Entry + */ +EAPI Eina_Bool elm_entry_cursor_is_format_get(const Evas_Object *obj); + +/** + * Gets if the current cursor position holds a visible format node. + * + * @param obj The entry object + * @return EINA_TRUE if the current cursor is a visible format, EINA_FALSE + * if it's an invisible one or no format exists. + * + * @see elm_entry_cursor_is_format_get() + * + * @ingroup Entry + */ +EAPI Eina_Bool elm_entry_cursor_is_visible_format_get(const Evas_Object *obj); + +/** + * Gets the character pointed by the cursor at its current position. + * + * This function returns a string with the utf8 character stored at the + * current cursor position. + * Only the text is returned, any format that may exist will not be part + * of the return value. You must free the string when done with free(). + * + * @param obj The entry object + * @return The text pointed by the cursors. + * + * @ingroup Entry + */ +EAPI char *elm_entry_cursor_content_get(const Evas_Object *obj); + +/** + * This function returns the geometry of the cursor. + * + * It's useful if you want to draw something on the cursor (or where it is), + * or for example in the case of scrolled entry where you want to show the + * cursor. + * + * @param obj The entry object + * @param x returned geometry + * @param y returned geometry + * @param w returned geometry + * @param h returned geometry + * @return EINA_TRUE upon success, EINA_FALSE upon failure + * + * @ingroup Entry + */ +EAPI Eina_Bool elm_entry_cursor_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); + +/** + * Sets the cursor position in the entry to the given value + * + * The value in @p pos is the index of the character position within the + * contents of the string as returned by elm_entry_cursor_pos_get(). + * + * @param obj The entry object + * @param pos The position of the cursor + * + * @ingroup Entry + */ +EAPI void elm_entry_cursor_pos_set(Evas_Object *obj, int pos); + +/** + * Retrieves the current position of the cursor in the entry + * + * @param obj The entry object + * @return The cursor position + * + * @ingroup Entry + */ +EAPI int elm_entry_cursor_pos_get(const Evas_Object *obj); + +/** + * This executes a "cut" action on the selected text in the entry. + * + * @param obj The entry object + * + * @ingroup Entry + */ +EAPI void elm_entry_selection_cut(Evas_Object *obj); + +/** + * This executes a "copy" action on the selected text in the entry. + * + * @param obj The entry object + * + * @ingroup Entry + */ +EAPI void elm_entry_selection_copy(Evas_Object *obj); + +/** + * This executes a "paste" action in the entry. + * + * @param obj The entry object + * + * @ingroup Entry + */ +EAPI void elm_entry_selection_paste(Evas_Object *obj); + +/** + * This clears and frees the items in a entry's contextual (longpress) + * menu. + * + * @param obj The entry object + * + * @see elm_entry_context_menu_item_add() + * + * @ingroup Entry + */ +EAPI void elm_entry_context_menu_clear(Evas_Object *obj); + +/** + * This adds an item to the entry's contextual menu. + * + * A longpress on an entry will make the contextual menu show up, if this + * hasn't been disabled with elm_entry_context_menu_disabled_set(). + * By default, this menu provides a few options like enabling selection mode, + * which is useful on embedded devices that need to be explicit about it, + * and when a selection exists it also shows the copy and cut actions. + * + * With this function, developers can add other options to this menu to + * perform any action they deem necessary. + * + * @param obj The entry object + * @param label The item's text label + * @param icon_file The item's icon file + * @param icon_type The item's icon type + * @param func The callback to execute when the item is clicked + * @param data The data to associate with the item for related functions + * + * @ingroup Entry + */ +EAPI void elm_entry_context_menu_item_add(Evas_Object *obj, const char *label, const char *icon_file, Elm_Icon_Type icon_type, Evas_Smart_Cb func, const void *data); + +/** + * This disables the entry's contextual (longpress) menu. + * + * @param obj The entry object + * @param disabled If true, the menu is disabled + * + * @ingroup Entry + */ +EAPI void elm_entry_context_menu_disabled_set(Evas_Object *obj, Eina_Bool disabled); + +/** + * This returns whether the entry's contextual (longpress) menu is + * disabled. + * + * @param obj The entry object + * @return If true, the menu is disabled + * + * @ingroup Entry + */ +EAPI Eina_Bool elm_entry_context_menu_disabled_get(const Evas_Object *obj); + +/** + * This appends a custom item provider to the list for that entry + * + * This appends the given callback. The list is walked from beginning to end + * with each function called given the item href string in the text. If the + * function returns an object handle other than NULL (it should create an + * object to do this), then this object is used to replace that item. If + * not the next provider is called until one provides an item object, or the + * default provider in entry does. + * + * @param obj The entry object + * @param func The function called to provide the item object + * @param data The data passed to @p func + * + * @see @ref entry-items + * + * @ingroup Entry + */ +EAPI void elm_entry_item_provider_append(Evas_Object *obj, Elm_Entry_Item_Provider_Cb func, void *data); + +/** + * This prepends a custom item provider to the list for that entry + * + * This prepends the given callback. See elm_entry_item_provider_append() for + * more information + * + * @param obj The entry object + * @param func The function called to provide the item object + * @param data The data passed to @p func + * + * @ingroup Entry + */ +EAPI void elm_entry_item_provider_prepend(Evas_Object *obj, Elm_Entry_Item_Provider_Cb func, void *data); + +/** + * This removes a custom item provider to the list for that entry + * + * This removes the given callback. See elm_entry_item_provider_append() for + * more information + * + * @param obj The entry object + * @param func The function called to provide the item object + * @param data The data passed to @p func + * + * @ingroup Entry + */ +EAPI void elm_entry_item_provider_remove(Evas_Object *obj, Elm_Entry_Item_Provider_Cb func, void *data); + +/** + * Append a markup filter function for text inserted in the entry + * + * Append the given callback to the list. This functions will be called + * whenever any text is inserted into the entry, with the text to be inserted + * as a parameter. The type of given text is always markup. + * The callback function is free to alter the text in any way it wants, but + * it must remember to free the given pointer and update it. + * If the new text is to be discarded, the function can free it and set its + * text parameter to NULL. This will also prevent any following filters from + * being called. + * + * @param obj The entry object + * @param func The function to use as text filter + * @param data User data to pass to @p func + * + * @ingroup Entry + */ +EAPI void elm_entry_markup_filter_append(Evas_Object *obj, Elm_Entry_Filter_Cb func, void *data); + +/** + * Prepend a markup filter function for text inserted in the entry + * + * Prepend the given callback to the list. See elm_entry_markup_filter_append() + * for more information + * + * @param obj The entry object + * @param func The function to use as text filter + * @param data User data to pass to @p func + * + * @ingroup Entry + */ +EAPI void elm_entry_markup_filter_prepend(Evas_Object *obj, Elm_Entry_Filter_Cb func, void *data); + +/** + * Remove a markup filter from the list + * + * Removes the given callback from the filter list. See + * elm_entry_markup_filter_append() for more information. + * + * @param obj The entry object + * @param func The filter function to remove + * @param data The user data passed when adding the function + * + * @ingroup Entry + */ +EAPI void elm_entry_markup_filter_remove(Evas_Object *obj, Elm_Entry_Filter_Cb func, void *data); + +/** + * This converts a markup (HTML-like) string into UTF-8. + * + * The returned string is a malloc'ed buffer and it should be freed when + * not needed anymore. + * + * @param s The string (in markup) to be converted + * @return The converted string (in UTF-8). It should be freed. + * + * @ingroup Entry + */ +EAPI char *elm_entry_markup_to_utf8(const char *s); + +/** + * This converts a UTF-8 string into markup (HTML-like). + * + * The returned string is a malloc'ed buffer and it should be freed when + * not needed anymore. + * + * @param s The string (in UTF-8) to be converted + * @return The converted string (in markup). It should be freed. + * + * @ingroup Entry + */ +EAPI char *elm_entry_utf8_to_markup(const char *s); + +/** + * This sets the file (and implicitly loads it) for the text to display and + * then edit. All changes are written back to the file after a short delay if + * the entry object is set to autosave (which is the default). + * + * If the entry had any other file set previously, any changes made to it + * will be saved if the autosave feature is enabled, otherwise, the file + * will be silently discarded and any non-saved changes will be lost. + * + * @param obj The entry object + * @param file The path to the file to load and save + * @param format The file format + * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise + * + * @ingroup Entry + */ +EAPI Eina_Bool elm_entry_file_set(Evas_Object *obj, const char *file, Elm_Text_Format format); + +/** + * Gets the file being edited by the entry. + * + * This function can be used to retrieve any file set on the entry for + * edition, along with the format used to load and save it. + * + * @param obj The entry object + * @param file The path to the file to load and save + * @param format The file format + * + * @ingroup Entry + */ +EAPI void elm_entry_file_get(const Evas_Object *obj, const char **file, Elm_Text_Format *format); + +/** + * This function writes any changes made to the file set with + * elm_entry_file_set() + * + * @param obj The entry object + * + * @ingroup Entry + */ +EAPI void elm_entry_file_save(Evas_Object *obj); + +/** + * This sets the entry object to 'autosave' the loaded text file or not. + * + * @param obj The entry object + * @param autosave Autosave the loaded file or not + * + * @see elm_entry_file_set() + * + * @ingroup Entry + */ +EAPI void elm_entry_autosave_set(Evas_Object *obj, Eina_Bool autosave); + +/** + * This gets the entry object's 'autosave' status. + * + * @param obj The entry object + * @return Autosave the loaded file or not + * + * @see elm_entry_file_set() + * + * @ingroup Entry + */ +EAPI Eina_Bool elm_entry_autosave_get(const Evas_Object *obj); + +/** + * Enable or disable scrolling in entry + * + * Normally the entry is not scrollable unless you enable it with this call. + * + * @param obj The entry object + * @param scroll EINA_TRUE if it is to be scrollable, EINA_FALSE otherwise + * + * @ingroup Entry + */ +EAPI void elm_entry_scrollable_set(Evas_Object *obj, Eina_Bool scroll); + +/** + * Get the scrollable state of the entry + * + * Normally the entry is not scrollable. This gets the scrollable state + * of the entry. See elm_entry_scrollable_set() for more information. + * + * @param obj The entry object + * @return The scrollable state + * + * @ingroup Entry + */ +EAPI Eina_Bool elm_entry_scrollable_get(const Evas_Object *obj); + +/** + * Sets the visibility of the left-side widget of the entry, + * set by elm_object_part_content_set(). + * + * @param obj The entry object + * @param setting EINA_TRUE if the object should be displayed, + * EINA_FALSE if not. + * + * @ingroup Entry + */ +EAPI void elm_entry_icon_visible_set(Evas_Object *obj, Eina_Bool setting); + +/** + * Sets the visibility of the end widget of the entry, set by + * elm_object_part_content_set(ent, "end", content). + * + * @param obj The entry object + * @param setting EINA_TRUE if the object should be displayed, + * EINA_FALSE if not. + * + * @ingroup Entry + */ +EAPI void elm_entry_end_visible_set(Evas_Object *obj, Eina_Bool setting); + +/** + * This sets the entry's scrollbar policy (i.e. enabling/disabling + * them). + * + * Setting an entry to single-line mode with elm_entry_single_line_set() + * will automatically disable the display of scrollbars when the entry + * moves inside its scroller. + * + * @param obj The entry object + * @param h The horizontal scrollbar policy to apply + * @param v The vertical scrollbar policy to apply + * + * @ingroup Entry + */ +EAPI void elm_entry_scrollbar_policy_set(Evas_Object *obj, Elm_Scroller_Policy h, Elm_Scroller_Policy v); + +/** + * This enables/disables bouncing within the entry. + * + * This function sets whether the entry will bounce when scrolling reaches + * the end of the contained entry. + * + * @param obj The entry object + * @param h_bounce The horizontal bounce state + * @param v_bounce The vertical bounce state + * + * @ingroup Entry + */ +EAPI void elm_entry_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce); + +/** + * Get the bounce mode + * + * @param obj The Entry object + * @param h_bounce Allow bounce horizontally + * @param v_bounce Allow bounce vertically + * + * @ingroup Entry + */ +EAPI void elm_entry_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce); + +/** + * Set the input panel layout of the entry + * + * @param obj The entry object + * @param layout layout type + * + * @ingroup Entry + */ +EAPI void elm_entry_input_panel_layout_set(Evas_Object *obj, Elm_Input_Panel_Layout layout); + +/** + * Get the input panel layout of the entry + * + * @param obj The entry object + * @return layout type + * + * @see elm_entry_input_panel_layout_set + * + * @ingroup Entry + */ +EAPI Elm_Input_Panel_Layout elm_entry_input_panel_layout_get(const Evas_Object *obj); + +/** + * Set the autocapitalization type on the immodule. + * + * @param obj The entry object + * @param autocapital_type The type of autocapitalization + * + * @ingroup Entry + */ +EAPI void elm_entry_autocapital_type_set(Evas_Object *obj, Elm_Autocapital_Type autocapital_type); + +/** + * Retrieve the autocapitalization type on the immodule. + * + * @param obj The entry object + * @return autocapitalization type + * + * @ingroup Entry + */ +EAPI Elm_Autocapital_Type elm_entry_autocapital_type_get(const Evas_Object *obj); + +/** + * Sets the attribute to show the input panel automatically. + * + * @param obj The entry object + * @param enabled If true, the input panel is appeared when entry is clicked or has a focus + * + * @ingroup Entry + */ +EAPI void elm_entry_input_panel_enabled_set(Evas_Object *obj, Eina_Bool enabled); + +/** + * Retrieve the attribute to show the input panel automatically. + * + * @param obj The entry object + * @return EINA_TRUE if input panel will be appeared when the entry is clicked or has a focus, EINA_FALSE otherwise + * + * @ingroup Entry + */ +EAPI Eina_Bool elm_entry_input_panel_enabled_get(const Evas_Object *obj); + +/** + * Show the input panel (virtual keyboard) based on the input panel property of entry such as layout, autocapital types, and so on. + * + * Note that input panel is shown or hidden automatically according to the focus state of entry widget. + * This API can be used in the case of manually controlling by using elm_entry_input_panel_enabled_set(en, EINA_FALSE). + * + * @param obj The entry object + * + * @ingroup Entry + */ +EAPI void elm_entry_input_panel_show(Evas_Object *obj); + +/** + * Hide the input panel (virtual keyboard). + * + * Note that input panel is shown or hidden automatically according to the focus state of entry widget. + * This API can be used in the case of manually controlling by using elm_entry_input_panel_enabled_set(en, EINA_FALSE) + * + * @param obj The entry object + * + * @ingroup Entry + */ +EAPI void elm_entry_input_panel_hide(Evas_Object *obj); + +/** + * Set the language mode of the input panel. + * + * This API can be used if you want to show the alphabet keyboard mode. + * + * @param obj The entry object + * @param lang language to be set to the input panel. + * + * @ingroup Entry + */ +EAPI void elm_entry_input_panel_language_set(Evas_Object *obj, Elm_Input_Panel_Lang lang); + +/** + * Get the language mode of the input panel. + * + * See @ref elm_entry_input_panel_language_set for more details. + * + * @param obj The entry object + * @return input panel language type + * + * @ingroup Entry + */ +EAPI Elm_Input_Panel_Lang elm_entry_input_panel_language_get(const Evas_Object *obj); + +/** + * Set the input panel-specific data to deliver to the input panel. + * + * This API is used by applications to deliver specific data to the input panel. + * The data format MUST be negotiated by both application and the input panel. + * The size and format of data are defined by the input panel. + * + * @param obj The entry object + * @param data The specific data to be set to the input panel. + * @param len the length of data, in bytes, to send to the input panel + * + * @ingroup Entry + */ +EAPI void elm_entry_input_panel_imdata_set(Evas_Object *obj, const void *data, int len); + +/** + * Get the specific data of the current input panel. + * + * See @ref elm_entry_input_panel_imdata_set for more details. + * + * @param obj The entry object + * @param data The specific data to be got from the input panel + * @param len The length of data + * + * @ingroup Entry + */ +EAPI void elm_entry_input_panel_imdata_get(const Evas_Object *obj, void *data, int *len); + +/** + * Set the "return" key type. This type is used to set string or icon on the "return" key of the input panel. + * + * An input panel displays the string or icon associated with this type + * + * @param obj The entry object + * @param return_key_type The type of "return" key on the input panel + * + * @ingroup Entry + */ +EAPI void elm_entry_input_panel_return_key_type_set(Evas_Object *obj, Elm_Input_Panel_Return_Key_Type return_key_type); + +/** + * Get the "return" key type. + * + * @see elm_entry_input_panel_return_key_type_set() for more details + * + * @param obj The entry object + * @return The type of "return" key on the input panel + * + * @ingroup Entry + */ +EAPI Elm_Input_Panel_Return_Key_Type elm_entry_input_panel_return_key_type_get(const Evas_Object *obj); + +/** + * Set the return key on the input panel to be disabled. + * + * @param obj The entry object + * @param disabled The state to put in in: @c EINA_TRUE for + * disabled, @c EINA_FALSE for enabled + * + * @ingroup Entry + */ +EAPI void elm_entry_input_panel_return_key_disabled_set(Evas_Object *obj, Eina_Bool disabled); + +/** + * Get whether the return key on the input panel should be disabled or not. + * + * @param obj The entry object + * @return EINA_TRUE if it should be disabled + * + * @ingroup Entry + */ +EAPI Eina_Bool elm_entry_input_panel_return_key_disabled_get(const Evas_Object *obj); + +/** + * Set whether the return key on the input panel is disabled automatically when entry has no text. + * + * If @p enabled is EINA_TRUE, The return key on input panel is disabled when the entry has no text. + * The return key on the input panel is automatically enabled when the entry has text. + * The default value is EINA_FALSE. + * + * @param obj The entry object + * @param enabled If @p enabled is EINA_TRUE, the return key is automatically disabled when the entry has no text. + * + * @ingroup Entry + */ +EAPI void elm_entry_input_panel_return_key_autoenabled_set(Evas_Object *obj, Eina_Bool enabled); + +/** + * Reset the input method context of the entry if needed. + * + * This can be necessary in the case where modifying the buffer would confuse on-going input method behavior + * @param obj The entry object + * + * @ingroup Entry + */ +EAPI void elm_entry_imf_context_reset(Evas_Object *obj); + +/** + * Set whether the entry should allow to use the text prediction. + * + * @param obj The entry object + * @param prediction Whether the entry should allow to use the text prediction. + * + * @ingroup Entry + */ +EAPI void elm_entry_prediction_allow_set(Evas_Object *obj, Eina_Bool prediction); + +/** + * Get whether the entry should allow to use the text prediction. + * + * @param obj The entry object + * @return EINA_TRUE if it allows to use the text prediction, otherwise EINA_FALSE. + * + * @ingroup Entry + */ +EAPI Eina_Bool elm_entry_prediction_allow_get(const Evas_Object *obj); + +/* pre-made filters for entries */ + +/** + * @typedef Elm_Entry_Filter_Limit_Size + * + * Data for the elm_entry_filter_limit_size() entry filter. + */ +typedef struct _Elm_Entry_Filter_Limit_Size Elm_Entry_Filter_Limit_Size; + +/** + * @struct _Elm_Entry_Filter_Limit_Size + * + * Data for the elm_entry_filter_limit_size() entry filter. + */ +struct _Elm_Entry_Filter_Limit_Size +{ + int max_char_count; /**< The maximum number of characters allowed. */ + int max_byte_count; /**< The maximum number of bytes allowed*/ +}; + +/** + * Filter inserted text based on user defined character and byte limits + * + * Add this filter to an entry to limit the characters that it will accept + * based the contents of the provided #Elm_Entry_Filter_Limit_Size. + * The function works on the UTF-8 representation of the string, converting + * it from the set markup, thus not accounting for any format in it. + * + * The user must create an #Elm_Entry_Filter_Limit_Size structure and pass + * it as data when setting the filter. In it, it's possible to set limits + * by character count or bytes (any of them is disabled if 0), and both can + * be set at the same time. In that case, it first checks for characters, + * then bytes. The #Elm_Entry_Filter_Limit_Size structure must be alive and + * valid for as long as the entry is alive AND the elm_entry_filter_limit_size + * filter is set. + * + * The function will cut the inserted text in order to allow only the first + * number of characters that are still allowed. The cut is made in + * characters, even when limiting by bytes, in order to always contain + * valid ones and avoid half unicode characters making it in. + * + * This filter, like any others, does not apply when setting the entry text + * directly with elm_object_text_set(). + * + * @ingroup Entry + */ +EAPI void elm_entry_filter_limit_size(void *data, Evas_Object *entry, char **text); + +/** + * @typedef Elm_Entry_Filter_Accept_Set + * + * Data for the elm_entry_filter_accept_set() entry filter. + */ +typedef struct _Elm_Entry_Filter_Accept_Set Elm_Entry_Filter_Accept_Set; + +/** + * @struct _Elm_Entry_Filter_Accept_Set + * + * Data for the elm_entry_filter_accept_set() entry filter. + */ +struct _Elm_Entry_Filter_Accept_Set +{ + const char *accepted; /**< Set of characters accepted in the entry. */ + const char *rejected; /**< Set of characters rejected from the entry. */ +}; + +/** + * Filter inserted text based on accepted or rejected sets of characters + * + * Add this filter to an entry to restrict the set of accepted characters + * based on the sets in the provided #Elm_Entry_Filter_Accept_Set. + * This structure contains both accepted and rejected sets, but they are + * mutually exclusive. This structure must be available for as long as + * the entry is alive AND the elm_entry_filter_accept_set is being used. + * + * The @c accepted set takes preference, so if it is set, the filter will + * only work based on the accepted characters, ignoring anything in the + * @c rejected value. If @c accepted is @c NULL, then @c rejected is used. + * + * In both cases, the function filters by matching utf8 characters to the + * raw markup text, so it can be used to remove formatting tags. + * + * This filter, like any others, does not apply when setting the entry text + * directly with elm_object_text_set() + * + * @ingroup Entry + */ +EAPI void elm_entry_filter_accept_set(void *data, Evas_Object *entry, char **text); + +/** + * Returns the input method context of the entry. + * + * This function exposes the internal input method context. + * + * IMPORTANT: Many functions may change (i.e delete and create a new one) + * the internal input method context. Do NOT cache the returned object. + * + * @param obj The entry object + * @return The input method context (Ecore_IMF_Context *) in entry. + * + * @ingroup Entry + */ +EAPI void *elm_entry_imf_context_get(Evas_Object *obj); + +/** + * @typedef Elm_Cnp_Mode + * Enum of entry's copy & paste policy. + * + * @see elm_entry_cnp_mode_set() + * @see elm_entry_cnp_mode_get() + */ +typedef enum { + ELM_CNP_MODE_MARKUP, /**< copy & paste text with markup tag */ + ELM_CNP_MODE_NO_IMAGE, /**< copy & paste text without item(image) tag */ + ELM_CNP_MODE_PLAINTEXT /**< copy & paste text without markup tag */ +} Elm_Cnp_Mode; + +/** + * Control pasting of text and images for the widget. + * + * Normally the entry allows both text and images to be pasted. + * By setting cnp_mode to be ELM_CNP_MODE_NO_IMAGE, this prevents images from being copy or past. + * By setting cnp_mode to be ELM_CNP_MODE_PLAINTEXT, this remove all tags in text . + * + * @note this only changes the behaviour of text. + * + * @param obj The entry object + * @param cnp_mode One of #Elm_Cnp_Mode: #ELM_CNP_MODE_MARKUP, + * #ELM_CNP_MODE_NO_IMAGE, #ELM_CNP_MODE_PLAINTEXT. + * + * @ingroup Entry + */ +EAPI void elm_entry_cnp_mode_set(Evas_Object *obj, Elm_Cnp_Mode cnp_mode); + +/** + * Getting elm_entry text paste/drop mode. + * + * Normally the entry allows both text and images to be pasted. + * This gets the copy & paste mode of the entry. + * + * @param obj The entry object + * @return mode One of #Elm_Cnp_Mode: #ELM_CNP_MODE_MARKUP, + * #ELM_CNP_MODE_NO_IMAGE, #ELM_CNP_MODE_PLAINTEXT. + * + * @ingroup Entry + */ +EAPI Elm_Cnp_Mode elm_entry_cnp_mode_get(const Evas_Object *obj); + +/** + * Set the parent of the hover popup + * + * Sets the parent object to use by the hover created by the entry + * when an anchor is clicked. See @ref Hover for more details on this. + * + * @param obj The entry object + * @param parent The object to use as parent for the hover + * + * @ingroup Entry + */ +EAPI void elm_entry_anchor_hover_parent_set(Evas_Object *obj, Evas_Object *parent); + +/** + * Get the parent of the hover popup + * + * Get the object used as parent for the hover created by the entry + * widget. See @ref Hover for more details on this. + * If no parent is set, the same entry object will be used. + * + * @param obj The entry object + * @return The object used as parent for the hover, NULL if none is set. + * + * @ingroup Entry + */ +EAPI Evas_Object *elm_entry_anchor_hover_parent_get(const Evas_Object *obj); + +/** + * Set the style that the hover should use + * + * When creating the popup hover, entry will request that it's + * themed according to @p style. + * + * Setting style no NULL means disabling automatic hover. + * + * @param obj The entry object + * @param style The style to use for the underlying hover + * + * @see elm_object_style_set() + * + * @ingroup Entry + */ +EAPI void elm_entry_anchor_hover_style_set(Evas_Object *obj, const char *style); + +/** + * Get the style that the hover should use + * + * Get the style, the hover created by entry will use. + * + * @param obj The entry object + * @return The style to use by the hover. NULL means the default is used. + * + * @see elm_object_style_set() + * + * @ingroup Entry + */ +EAPI const char *elm_entry_anchor_hover_style_get(const Evas_Object *obj); + +/** + * Ends the hover popup in the entry + * + * When an anchor is clicked, the entry widget will create a hover + * object to use as a popup with user provided content. This function + * terminates this popup, returning the entry to its normal state. + * + * @param obj The entry object + * + * @ingroup Entry + */ +EAPI void elm_entry_anchor_hover_end(Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_factory.c b/libraries/elementary/src/lib/elm_factory.c new file mode 100644 index 0000000..25a3d37 --- /dev/null +++ b/libraries/elementary/src/lib/elm_factory.c @@ -0,0 +1,338 @@ +#include +#include "elm_priv.h" + +// FIXME: handle if canvas resizes + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *obj; + Evas_Object *content; + int last_calc_count; + Evas_Coord maxminw, maxminh; + Eina_Bool eval : 1; + Eina_Bool szeval : 1; + Eina_Bool maxmin : 1; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static Eina_Bool _focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next); +static void _sizing_eval(Evas_Object *obj); +static void _eval(Evas_Object *obj); +static void _changed(Evas_Object *obj); +static void _move(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__); +static void _resize(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__); +static void _child_change(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__); +static void _child_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__); +static void _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content); +static Evas_Object *_content_get_hook(const Evas_Object *obj, const char *part); +static Evas_Object *_content_unset_hook(Evas_Object *obj, const char *part); + +static const char SIG_REALIZE[] = "realize"; +static const char SIG_UNREALIZE[] = "unrealize"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_REALIZE, ""}, + {SIG_UNREALIZE, ""}, + {NULL, NULL} +}; + +static int fac = 0; + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->content) + { + Evas_Object *o = wd->content; + + evas_object_event_callback_del_full(o, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _child_change, obj); + evas_object_event_callback_del_full(o, + EVAS_CALLBACK_DEL, + _child_del, obj); + wd->content = NULL; + evas_object_del(o); + fac--; +// printf("FAC-- = %i\n", fac); + } + free(wd); +} + +static Eina_Bool +_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *cur; + + if ((!wd) || (!wd->content)) return EINA_FALSE; + cur = wd->content; + return elm_widget_focus_next_get(cur, dir, next); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; + + if (!wd) return; + if (!wd->content) return; + evas_object_size_hint_min_get(wd->content, &minw, &minh); + evas_object_size_hint_max_get(wd->content, &maxw, &maxh); + if (wd->maxmin) + { + if (minw > wd->maxminw) wd->maxminw = minw; + if (minh > wd->maxminh) wd->maxminh = minh; + evas_object_size_hint_min_set(obj, wd->maxminw, wd->maxminh); + } + else + { + evas_object_size_hint_min_set(obj, minw, minh); + } + evas_object_size_hint_max_set(obj, maxw, maxh); +// printf("FAC SZ: %i %i | %i %i\n", minw, minh, maxw, maxh); +} + +static void +_eval(Evas_Object *obj) +{ + Evas_Coord x, y, w, h, cvx, cvy, cvw, cvh; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + evas_event_freeze(evas_object_evas_get(obj)); + evas_object_geometry_get(obj, &x, &y, &w, &h); + if (w < 1) w = 1; + if (h < 1) h = 1; + evas_output_viewport_get(evas_object_evas_get(obj), + &cvx, &cvy, &cvw, &cvh); + if ((cvw < 1) || (cvh < 1)) return; + // need some fuzz value thats beyond the current viewport + // for now just make it the viewport * 3 in size (so 1 vp in each direction) + /* + cvx -= cvw; + cvy -= cvh; + cvw *= 3; + cvh *= 3; + */ + if (ELM_RECTS_INTERSECT(x, y, w, h, cvx, cvy, cvw, cvh)) + { + if (!wd->content) + { +// printf(" + %i %i %ix%i <> %i %i %ix%i\n", x, y, w, h, cvx, cvy, cvw, cvh); + evas_object_smart_callback_call(obj, SIG_REALIZE, NULL); + if (wd->content) + { + if (evas_object_smart_data_get(wd->content)) + evas_object_smart_calculate(wd->content); + } + wd->last_calc_count = + evas_smart_objects_calculate_count_get(evas_object_evas_get(obj)); + } + } + else + { + if (wd->content) + { + if (wd->last_calc_count != + evas_smart_objects_calculate_count_get(evas_object_evas_get(obj))) + evas_object_smart_callback_call(obj, SIG_UNREALIZE, NULL); + } + } + evas_event_thaw(evas_object_evas_get(obj)); + evas_event_thaw_eval(evas_object_evas_get(obj)); +} + +static void +_changed(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->eval) + { + _eval(obj); + wd->eval = EINA_FALSE; + } + if (wd->szeval) + { + _sizing_eval(obj); + wd->szeval = EINA_FALSE; + } +} + +static void +_move(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->eval = EINA_TRUE; + evas_object_smart_changed(obj); +} + +static void +_resize(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->eval = EINA_TRUE; + evas_object_smart_changed(obj); +} + +static void +_child_change(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + wd->eval = EINA_TRUE; + wd->szeval = EINA_TRUE; + evas_object_smart_changed(data); +} + +static void +_child_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *fobj = data; + Widget_Data *wd = elm_widget_data_get(fobj); + if (!wd) return; + if (wd->content != obj) return; + evas_object_event_callback_del_full(wd->content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _child_change, obj); + evas_object_event_callback_del_full(wd->content, + EVAS_CALLBACK_DEL, + _child_del, obj); + wd->content = NULL; + fac--; +// printf("FAC-- = %i\n", fac); +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + Evas_Object *content; + + if (part && strcmp(part, "default")) return NULL; + wd = elm_widget_data_get(obj); + if (!wd || !wd->content) return NULL; + + content = wd->content; + evas_object_event_callback_del_full(content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _child_change, obj); + evas_object_event_callback_del_full(content, + EVAS_CALLBACK_DEL, + _child_del, obj); + wd->content = NULL; + fac--; +// printf("FAC-- = %i\n", fac); + return content; +} + +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd; + Evas_Object *prev_content; + + if (part && strcmp(part, "default")) return; + wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->content == content) return; + + prev_content = _content_unset_hook(obj, part); + if (prev_content) evas_object_del(prev_content); + + wd->content = content; + if (!content) return; + + elm_widget_resize_object_set(obj, content); + evas_object_event_callback_add(content, EVAS_CALLBACK_DEL, _child_del, obj); + evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _child_change, obj); + wd->eval = EINA_TRUE; + wd->szeval = EINA_TRUE; + evas_object_smart_changed(obj); + fac++; +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + if (part && strcmp(part, "default")) return NULL; + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->content; +} + +EAPI Evas_Object * +elm_factory_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "factory"); + elm_widget_type_set(obj, "factory"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_focus_next_hook_set(obj, _focus_next_hook); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); + elm_widget_changed_hook_set(obj, _changed); + + evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _move, NULL); + evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, NULL); + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + wd->obj = obj; + wd->last_calc_count = -1; + return obj; +} + +EAPI void +elm_factory_maxmin_mode_set(Evas_Object *obj, Eina_Bool enabled) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->maxmin = !!enabled; +} + +EAPI Eina_Bool +elm_factory_maxmin_mode_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->maxmin; +} + +EAPI void +elm_factory_maxmin_reset_set(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->maxminw = 0; + wd->maxminh = 0; + wd->eval = EINA_TRUE; + wd->szeval = EINA_TRUE; + evas_object_smart_changed(obj); +} diff --git a/libraries/elementary/src/lib/elm_factory.h b/libraries/elementary/src/lib/elm_factory.h new file mode 100644 index 0000000..a81ba5e --- /dev/null +++ b/libraries/elementary/src/lib/elm_factory.h @@ -0,0 +1,6 @@ +/* this api is currently disabled due to being incomplete. you cannot + * use it as it is not compiled in */ +EAPI Evas_Object *elm_factory_add(Evas_Object *parent); +EAPI void elm_factory_maxmin_mode_set(Evas_Object *obj, Eina_Bool enabled); +EAPI Eina_Bool elm_factory_maxmin_mode_get(const Evas_Object *obj); +EAPI void elm_factory_maxmin_reset_set(Evas_Object *obj); diff --git a/libraries/elementary/src/lib/elm_finger.h b/libraries/elementary/src/lib/elm_finger.h new file mode 100644 index 0000000..cfe5d2e --- /dev/null +++ b/libraries/elementary/src/lib/elm_finger.h @@ -0,0 +1,45 @@ +/** + * @defgroup Fingers Fingers + * @ingroup Elementary + * + * Elementary is designed to be finger-friendly for touchscreens, + * and so in addition to scaling for display resolution, it can + * also scale based on finger "resolution" (or size). You can then + * customize the granularity of the areas meant to receive clicks + * on touchscreens. + * + * Different profiles may have pre-set values for finger sizes. + * + * @ref general_functions_example_page "This" example contemplates + * some of these functions. + * + * @{ + */ + +/** + * Adjust size of an element for finger usage. + * + * @param times_w How many fingers should fit horizontally + * @param w Pointer to the width size to adjust + * @param times_h How many fingers should fit vertically + * @param h Pointer to the height size to adjust + * + * This takes width and height sizes (in pixels) as input and a + * size multiple (which is how many fingers you want to place + * within the area, being "finger" the size set by + * elm_finger_size_set()), and adjusts the size to be large enough + * to accommodate the resulting size -- if it doesn't already + * accommodate it. On return the @p w and @p h sizes pointed to by + * these parameters will be modified, on those conditions. + * + * @note This is kind of low level Elementary call, most useful + * on size evaluation times for widgets. An external user wouldn't + * be calling, most of the time. + * + * @ingroup Fingers + */ +EAPI void elm_coords_finger_size_adjust(int times_w, Evas_Coord *w, int times_h, Evas_Coord *h); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_flip.c b/libraries/elementary/src/lib/elm_flip.c new file mode 100644 index 0000000..d02acdd --- /dev/null +++ b/libraries/elementary/src/lib/elm_flip.c @@ -0,0 +1,1941 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; +typedef struct _Slice Slice; +typedef struct _Vertex2 Vertex2; +typedef struct _Vertex3 Vertex3; + +struct _Slice +{ + Evas_Object *obj; + double u[4], v[4], x[4], y[4], z[4]; +}; + +struct _Vertex2 +{ + double x, y; +}; + +struct _Vertex3 +{ + double x, y, z; +}; + +struct _Widget_Data +{ + Evas_Object *obj; + Ecore_Animator *animator; + double start, len; + Elm_Flip_Mode mode; + Evas_Object *clip; + Evas_Object *event[4]; + struct + { + Evas_Object *content, *clip; + } front, back; + Ecore_Job *job; + Evas_Coord down_x, down_y, x, y, ox, oy, w, h; + Elm_Flip_Interaction intmode; + int dir; + double dir_hitsize[4]; + Eina_Bool dir_enabled[4]; + int slices_w, slices_h; + Slice **slices, **slices2; + + Eina_Bool state : 1; + Eina_Bool down : 1; + Eina_Bool finish : 1; + Eina_Bool started : 1; + Eina_Bool backflip : 1; + Eina_Bool pageflip : 1; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _sub_del(void *data, Evas_Object *obj, void *event_info); + +static void _state_slices_clear(Widget_Data *wd); +static void _configure(Evas_Object *obj); + +static const char SIG_ANIMATE_BEGIN[] = "animate,begin"; +static const char SIG_ANIMATE_DONE[] = "animate,done"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_ANIMATE_BEGIN, ""}, + {SIG_ANIMATE_DONE, ""}, + {NULL, NULL} +}; + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->animator) ecore_animator_del(wd->animator); + _state_slices_clear(wd); + free(wd); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _sizing_eval(obj); +} + +static Eina_Bool +_elm_flip_focus_next_hook(const Evas_Object *obj, + Elm_Focus_Direction dir, Evas_Object **next) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + /* Try Focus cycle in subitem */ + if (wd->state) + return elm_widget_focus_next_get(wd->front.content, dir, next); + else + return elm_widget_focus_next_get(wd->back.content, dir, next); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1, minw2 = -1, minh2 = -1; + Evas_Coord maxw = -1, maxh = -1, maxw2 = -1, maxh2 = -1; + int fingx = 0, fingy = 0; + if (!wd) return; + if (wd->front.content) + evas_object_size_hint_min_get(wd->front.content, &minw, &minh); + if (wd->back.content) + evas_object_size_hint_min_get(wd->back.content, &minw2, &minh2); + if (wd->front.content) + evas_object_size_hint_max_get(wd->front.content, &maxw, &maxh); + if (wd->back.content) + evas_object_size_hint_max_get(wd->back.content, &maxw2, &maxh2); + + if (minw2 > minw) minw = minw2; + if (minh2 > minh) minh = minh2; + if ((maxw2 >= 0) && (maxw2 < maxw)) maxw = maxw2; + if ((maxh2 >= 0) && (maxh2 < maxh)) maxh = maxh2; + + if (wd->dir_enabled[0]) fingy++; + if (wd->dir_enabled[1]) fingy++; + if (wd->dir_enabled[2]) fingx++; + if (wd->dir_enabled[3]) fingx++; + + elm_coords_finger_size_adjust(fingx, &minw, fingy, &minh); + + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, maxw, maxh); +} + +static void +_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + _sizing_eval(data); +} + +static void +_sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *sub = event_info; + if (!wd) return; + if (sub == wd->front.content) + { + evas_object_event_callback_del_full(sub, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + wd->front.content = NULL; + evas_object_hide(wd->front.clip); + _sizing_eval(obj); + } + else if (sub == wd->back.content) + { + evas_object_event_callback_del_full(sub, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + wd->back.content = NULL; + evas_object_hide(wd->back.clip); + _sizing_eval(obj); + } +} + +static Slice * +_slice_new(Widget_Data *wd, Evas_Object *obj) +{ + Slice *sl; + + sl = calloc(1, sizeof(Slice)); + if (!sl) return NULL; + sl->obj = evas_object_image_add(evas_object_evas_get(obj)); + elm_widget_sub_object_add(wd->obj, sl->obj); + evas_object_smart_member_add(sl->obj, wd->obj); + evas_object_image_smooth_scale_set(sl->obj, EINA_FALSE); + evas_object_pass_events_set(sl->obj, EINA_TRUE); + evas_object_image_source_set(sl->obj, obj); + return sl; +} + +static void +_slice_free(Slice *sl) +{ + evas_object_del(sl->obj); + free(sl); +} + +static void +_slice_apply(Widget_Data *wd, Slice *sl, Evas_Coord x __UNUSED__, + Evas_Coord y __UNUSED__, Evas_Coord w, Evas_Coord h __UNUSED__, + Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh) +{ + Evas_Map *m; + int i; + + m = evas_map_new(4); + if (!m) return; + evas_map_smooth_set(m, EINA_FALSE); + for (i = 0; i < 4; i++) + { + evas_map_point_color_set(m, i, 255, 255, 255, 255); + if (wd->dir == 0) + { + int p[4] = { 0, 1, 2, 3 }; + evas_map_point_coord_set(m, i, ox + sl->x[p[i]], oy + sl->y[p[i]], + sl->z[p[i]]); + evas_map_point_image_uv_set(m, i, sl->u[p[i]] , sl->v[p[i]]); + } + else if (wd->dir == 1) + { + int p[4] = { 1, 0, 3, 2 }; + evas_map_point_coord_set(m, i, ox + (w - sl->x[p[i]]), + oy + sl->y[p[i]], sl->z[p[i]]); + evas_map_point_image_uv_set(m, i, ow - sl->u[p[i]], sl->v[p[i]]); + } + else if (wd->dir == 2) + { + int p[4] = { 1, 0, 3, 2 }; + evas_map_point_coord_set(m, i, ox + sl->y[p[i]], oy + sl->x[p[i]], + sl->z[p[i]]); + evas_map_point_image_uv_set(m, i, sl->v[p[i]] , sl->u[p[i]]); + } + else/* if (wd->dir == 3) will be this anyway */ + { + int p[4] = { 0, 1, 2, 3 }; + evas_map_point_coord_set(m, i, ox + sl->y[p[i]], + oy + (w - sl->x[p[i]]), sl->z[p[i]]); + evas_map_point_image_uv_set(m, i, sl->v[p[i]] , oh - sl->u[p[i]]); + } + } + evas_object_map_enable_set(sl->obj, EINA_TRUE); + evas_object_image_fill_set(sl->obj, 0, 0, ow, oh); + evas_object_map_set(sl->obj, m); + evas_map_free(m); +} + +static void +_slice_3d(Widget_Data *wd __UNUSED__, Slice *sl, Evas_Coord x, Evas_Coord y, + Evas_Coord w, Evas_Coord h) +{ + Evas_Map *m = (Evas_Map *)evas_object_map_get(sl->obj); + int i; + + if (!m) return; + // vanishing point is center of page, and focal dist is 1024 + evas_map_util_3d_perspective(m, x + (w / 2), y + (h / 2), 0, 1024); + for (i = 0; i < 4; i++) + { + Evas_Coord xx, yy, zz; + evas_map_point_coord_get(m, i, &xx, &yy, &zz); + evas_map_point_coord_set(m, i, xx, yy, 0); + } + if (evas_map_util_clockwise_get(m)) evas_object_show(sl->obj); + else evas_object_hide(sl->obj); + evas_object_map_set(sl->obj, m); +} + +static void +_slice_light(Widget_Data *wd __UNUSED__, Slice *sl, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) +{ + Evas_Map *m = (Evas_Map *)evas_object_map_get(sl->obj); + int i; + + if (!m) return; + evas_map_util_3d_lighting(m, + // light position + // (centered over page 10 * h toward camera) + x + (w / 2) , y + (h / 2) , -10000, + 255, 255, 255, // light color + 0 , 0 , 0); // ambient minimum + // multiply brightness by 1.2 to make lightish bits all white so we dont + // add shading where we could otherwise be pure white + for (i = 0; i < 4; i++) + { + int r, g, b, a; + + evas_map_point_color_get(m, i, &r, &g, &b, &a); + r = (double)r * 1.2; if (r > 255) r = 255; + g = (double)g * 1.2; if (g > 255) g = 255; + b = (double)b * 1.2; if (b > 255) b = 255; + evas_map_point_color_set(m, i, r, g, b, a); + } + evas_object_map_set(sl->obj, m); +} + +static void +_slice_xyz(Widget_Data *wd __UNUSED__, Slice *sl, + double xx1, double yy1, double zz1, + double xx2, double yy2, double zz2, + double xx3, double yy3, double zz3, + double xx4, double yy4, double zz4) +{ + sl->x[0] = xx1; sl->y[0] = yy1; sl->z[0] = zz1; + sl->x[1] = xx2; sl->y[1] = yy2; sl->z[1] = zz2; + sl->x[2] = xx3; sl->y[2] = yy3; sl->z[2] = zz3; + sl->x[3] = xx4; sl->y[3] = yy4; sl->z[3] = zz4; +} + +static void +_slice_uv(Widget_Data *wd __UNUSED__, Slice *sl, + double u1, double v1, + double u2, double v2, + double u3, double v3, + double u4, double v4) +{ + sl->u[0] = u1; sl->v[0] = v1; + sl->u[1] = u2; sl->v[1] = v2; + sl->u[2] = u3; sl->v[2] = v3; + sl->u[3] = u4; sl->v[3] = v4; +} + +static void +_deform_point(Vertex2 *vi, Vertex3 *vo, double rho, double theta, double A) +{ + // ^Y + // | + // | X + // +----> + // theta == cone angle (0 -> PI/2) + // A == distance of cone apex from origin + // rho == angle of cone from vertical axis (...-PI/2 to PI/2...) + Vertex3 v1; + double d, r, b; + + d = sqrt((vi->x * vi->x) + pow(vi->y - A, 2)); + r = d * sin(theta); + b = asin(vi->x / d) / sin(theta); + + v1.x = r * sin(b); + v1.y = d + A - (r * (1 - cos(b)) * sin(theta)); + v1.z = r * (1 - cos(b)) * cos(theta); + + vo->x = (v1.x * cos(rho)) - (v1.z * sin(rho)); + vo->y = v1.y; + vo->z = (v1.x * sin(rho)) + (v1.z * cos(rho)); +} + +static void +_interp_point(Vertex3 *vi1, Vertex3 *vi2, Vertex3 *vo, double v) +{ + vo->x = (v * vi2->x) + ((1.0 - v) * vi1->x); + vo->y = (v * vi2->y) + ((1.0 - v) * vi1->y); + vo->z = (v * vi2->z) + ((1.0 - v) * vi1->z); +} + +static void +_state_slices_clear(Widget_Data *wd) +{ + int i, j, num; + + if (wd->slices) + { + num = 0; + for (j = 0; j < wd->slices_h; j++) + { + for (i = 0; i < wd->slices_w; i++) + { + if (wd->slices[num]) _slice_free(wd->slices[num]); + if (wd->slices2[num]) _slice_free(wd->slices2[num]); + num++; + } + } + free(wd->slices); + free(wd->slices2); + wd->slices = NULL; + wd->slices2 = NULL; + } + wd->slices_w = 0; + wd->slices_h = 0; +} + +static int +_slice_obj_color_sum(Slice *s, int p, int *r, int *g, int *b, int *a) +{ + Evas_Map *m; + int rr = 0, gg = 0, bb = 0, aa = 0; + + if (!s) return 0; + m = (Evas_Map *)evas_object_map_get(s->obj); + if (!m) return 0; + evas_map_point_color_get(m, p, &rr, &gg, &bb, &aa); + *r += rr; *g += gg; *b += bb; *a += aa; + return 1; +} + +static void +_slice_obj_color_set(Slice *s, int p, int r, int g, int b, int a) +{ + Evas_Map *m; + + if (!s) return; + m = (Evas_Map *) evas_object_map_get(s->obj); + if (!m) return; + evas_map_point_color_set(m, p, r, g, b, a); + evas_object_map_set(s->obj, m); +} + +static void +_slice_obj_vert_color_merge(Slice *s1, int p1, Slice *s2, int p2, + Slice *s3, int p3, Slice *s4, int p4) +{ + int r = 0, g = 0, b = 0, a = 0, n = 0; + + n += _slice_obj_color_sum(s1, p1, &r, &g, &b, &a); + n += _slice_obj_color_sum(s2, p2, &r, &g, &b, &a); + n += _slice_obj_color_sum(s3, p3, &r, &g, &b, &a); + n += _slice_obj_color_sum(s4, p4, &r, &g, &b, &a); + + if (n < 1) return; + r /= n; g /= n; b /= n; a /= n; + + _slice_obj_color_set(s1, p1, r, g, b, a); + _slice_obj_color_set(s2, p2, r, g, b, a); + _slice_obj_color_set(s3, p3, r, g, b, a); + _slice_obj_color_set(s4, p4, r, g, b, a); +} + +static int +_state_update(Widget_Data *wd) +{ + Evas_Coord xx1, yy1, xx2, yy2, mx, my; + Evas_Coord x, y, w, h, ox, oy, ow, oh; + int i, j, num, nn, jump, num2; + Slice *sl; + double b, minv = 0.0, minva, mgrad; + int gx, gy, gszw, gszh, gw, gh, col, row, nw, nh; + double rho, A, theta, perc, percm, n, rhol, Al, thetal; + Vertex3 *tvo, *tvol; + Evas_Object *front, *back; + + wd->backflip = EINA_TRUE; + if (wd->state) + { + front = wd->front.content; + back = wd->front.content; + } + else + { + front = wd->back.content; + back = wd->back.content; + } + + evas_object_geometry_get(wd->obj, &x, &y, &w, &h); + ox = x; oy = y; ow = w; oh = h; + xx1 = wd->down_x; + yy1 = wd->down_y; + xx2 = wd->x; + yy2 = wd->y; + + if (wd->dir == 0) + { + // no nothing. left drag is standard + } + else if (wd->dir == 1) + { + xx1 = (w - 1) - xx1; + xx2 = (w - 1) - xx2; + } + else if (wd->dir == 2) + { + Evas_Coord tmp; + + tmp = xx1; xx1 = yy1; yy1 = tmp; + tmp = xx2; xx2 = yy2; yy2 = tmp; + tmp = w; w = h; h = tmp; + } + else/* if (wd->dir == 3) will be this anyway */ + { + Evas_Coord tmp; + + tmp = xx1; xx1 = yy1; yy1 = tmp; + tmp = xx2; xx2 = yy2; yy2 = tmp; + tmp = w; w = h; h = tmp; + xx1 = (w - 1) - xx1; + xx2 = (w - 1) - xx2; + } + + if (xx2 >= xx1) xx2 = xx1 - 1; + mx = (xx1 + xx2) / 2; + my = (yy1 + yy2) / 2; + + if (mx < 0) mx = 0; + else if (mx >= w) mx = w - 1; + if (my < 0) my = 0; + else if (my >= h) my = h - 1; + + mgrad = (double)(yy1 - yy2) / (double)(xx1 - xx2); + + if (mx < 1) mx = 1; // quick hack to keep curl line visible + + if (mgrad == 0.0) // special horizontal case + mgrad = 0.001; // quick dirty hack for now + // else + { + minv = 1.0 / mgrad; + // y = (m * x) + b + b = my + (minv * mx); + } + if ((b >= -5) && (b <= (h + 5))) + { + if (minv > 0.0) // clamp to h + { + minv = (double)(h + 5 - my) / (double)(mx); + b = my + (minv * mx); + } + else // clamp to 0 + { + minv = (double)(-5 - my) / (double)(mx); + b = my + (minv * mx); + } + } + + perc = (double)xx2 / (double)xx1; + percm = (double)mx / (double)xx1; + if (perc < 0.0) perc = 0.0; + else if (perc > 1.0) perc = 1.0; + if (percm < 0.0) percm = 0.0; + else if (percm > 1.0) percm = 1.0; + + minva = atan(minv) / (M_PI / 2); + if (minva < 0.0) minva = -minva; + + // A = apex of cone + if (b <= 0) A = b; + else A = h - b; + if (A < -(h * 20)) A = -h * 20; + //--// + Al = -5; + + // rho = is how much the page is turned + n = 1.0 - perc; + n = 1.0 - cos(n * M_PI / 2.0); + n = n * n; + rho = -(n * M_PI); + //--// + rhol = -(n * M_PI); + + // theta == curliness (how much page culrs in on itself + n = sin((1.0 - perc) * M_PI); + n = n * 1.2; + theta = 7.86 + n; + //--// + n = sin((1.0 - perc) * M_PI); + n = 1.0 - n; + n = n * n; + n = 1.0 - n; + thetal = 7.86 + n; + + nw = 16; + nh = 16; + gszw = w / nw; + gszh = h / nh; + if (gszw < 4) gszw = 4; + if (gszh < 4) gszh = 4; + + nw = (w + gszw - 1) / gszw; + nh = (h + gszh - 1) / gszh; + if ((wd->slices_w != nw) || (wd->slices_h != nh)) _state_slices_clear(wd); + wd->slices_w = nw; + wd->slices_h = nh; + if (!wd->slices) + { + wd->slices = calloc(wd->slices_w * wd->slices_h, sizeof(Slice *)); + if (!wd->slices) return 0; + wd->slices2 = calloc(wd->slices_w * wd->slices_h, sizeof(Slice *)); + if (!wd->slices2) + { + free(wd->slices); + wd->slices = NULL; + return 0; + } + } + + num = (wd->slices_w + 1) * (wd->slices_h + 1); + + tvo = alloca(sizeof(Vertex3) * num); + tvol = alloca(sizeof(Vertex3) * (wd->slices_w + 1)); + + for (col = 0, gx = 0; gx <= (w + gszw - 1); gx += gszw, col++) + { + Vertex2 vil; + + vil.x = gx; + vil.y = h - ((gx * h) / (w + gszw - 1)); + _deform_point(&vil, &(tvol[col]), rhol, thetal, Al); + } + + n = minva * sin(perc * M_PI); + n = n * n; + + num = 0; + for (col = 0, gx = 0; gx <= (w + gszw - 1); gx += gszw, col++) + { + for (gy = 0; gy <= (h + gszh - 1); gy += gszh) + { + Vertex2 vi; + Vertex3 vo, tvo1; + + if (gx > w) vi.x = w; + else vi.x = gx; + if (gy > h) vi.y = h; + else vi.y = gy; + _deform_point(&vi, &vo, rho, theta, A); + tvo1 = tvol[col]; + if (gy > h) tvo1.y = h; + else tvo1.y = gy; + _interp_point(&vo, &tvo1, &(tvo[num]), n); + num++; + } + } + + jump = wd->slices_h + 1; + for (col = 0, gx = 0; gx < w; gx += gszw, col++) + { + num = wd->slices_h * col; + num2 = jump * col; + + gw = gszw; + if ((gx + gw) > w) gw = w - gx; + + for (row = 0, gy = 0; gy < h; gy += gszh, row++) + { + Vertex3 vo[4]; + + if (b > 0) nn = num + wd->slices_h - row - 1; + else nn = num + row; + + gh = gszh; + if ((gy + gh) > h) gh = h - gy; + + vo[0] = tvo[num2 + row]; + vo[1] = tvo[num2 + row + jump]; + vo[2] = tvo[num2 + row + jump + 1]; + vo[3] = tvo[num2 + row + 1]; +#define SWP(a, b) do {typeof(a) vt; vt = (a); (a) = (b); (b) = vt;} while (0) + if (b > 0) + { + SWP(vo[0], vo[3]); + SWP(vo[1], vo[2]); + vo[0].y = h - vo[0].y; + vo[1].y = h - vo[1].y; + vo[2].y = h - vo[2].y; + vo[3].y = h - vo[3].y; + } + + // FRONT + sl = wd->slices[nn]; + if (!sl) + { + sl = _slice_new(wd, front); + wd->slices[nn] = sl; + } + _slice_xyz(wd, sl, + vo[0].x, vo[0].y, vo[0].z, + vo[1].x, vo[1].y, vo[1].z, + vo[2].x, vo[2].y, vo[2].z, + vo[3].x, vo[3].y, vo[3].z); + if (b <= 0) + _slice_uv(wd, sl, + gx, gy, gx + gw, gy, gx + gw, gy + gh, gx, gy + gh); + else + _slice_uv(wd, sl, + gx, h - (gy + gh), gx + gw, h - (gy + gh), gx + gw, + h - gy, gx, h - gy); + + // BACK + sl = wd->slices2[nn]; + if (!sl) + { + sl = _slice_new(wd, back); + wd->slices2[nn] = sl; + } + + _slice_xyz(wd, sl, + vo[1].x, vo[1].y, vo[1].z, + vo[0].x, vo[0].y, vo[0].z, + vo[3].x, vo[3].y, vo[3].z, + vo[2].x, vo[2].y, vo[2].z); + if (wd->backflip) + { + if (b <= 0) + _slice_uv(wd, sl, gx + gw, gy, gx, gy, gx, gy + gh, gx + gw, + gy + gh); + else + _slice_uv(wd, sl, gx + gw, h - (gy + gh), gx, h - (gy + gh), + gx, h - gy, gx + gw, h - gy); + } + else + { + if (b <= 0) + _slice_uv(wd, sl, w - (gx + gw), gy, w - (gx), gy, w - (gx), + gy + gh, w - (gx + gw), gy + gh); + else + _slice_uv(wd, sl, w - (gx + gw), h - (gy + gh), w - (gx), + h - (gy + gh), w - (gx), h - gy, w - (gx + gw), + h - gy); + } + } + } + + for (num = 0; num < wd->slices_h * wd->slices_w; num++) + { + _slice_apply(wd, wd->slices[num], x, y, w, h, ox, oy, ow, oh); + _slice_apply(wd, wd->slices2[num], x, y, w, h, ox, oy, ow, oh); + _slice_light(wd, wd->slices[num], ox, oy, ow, oh); + _slice_light(wd, wd->slices2[num], ox, oy, ow, oh); + } + + for (i = 0; i <= wd->slices_w; i++) + { + num = i * wd->slices_h; + for (j = 0; j <= wd->slices_h; j++) + { + Slice *s[4] = { NULL }, *s2[4] = { NULL }; + + if ((i > 0) && (j > 0)) + s[0] = wd->slices[num - 1 - wd->slices_h], + s2[0] = wd->slices2[num - 1 - wd->slices_h]; + if ((i < wd->slices_w) && (j > 0)) + s[1] = wd->slices[num - 1], + s2[1] = wd->slices2[num - 1]; + if ((i > 0) && (j < wd->slices_h)) + s[2] = wd->slices[num - wd->slices_h], + s2[2] = wd->slices2[num - wd->slices_h]; + if ((i < wd->slices_w) && (j < wd->slices_h)) + s[3] = wd->slices[num], + s2[3] = wd->slices2[num]; + switch (wd->dir) + { + case 0: + _slice_obj_vert_color_merge(s[0], 2, s[1], 3, s[2], 1, s[3], 0); + _slice_obj_vert_color_merge(s2[0], 3, s2[1], 2, s2[2], 0, s2[3], 1); + break; + case 1: + _slice_obj_vert_color_merge(s[0], 3, s[1], 2, s[2], 0, s[3], 1); + _slice_obj_vert_color_merge(s2[0], 2, s2[1], 3, s2[2], 1, s2[3], 0); + break; + case 2: + _slice_obj_vert_color_merge(s[0], 3, s[1], 2, s[2], 0, s[3], 1); + _slice_obj_vert_color_merge(s2[0], 2, s2[1], 3, s2[2], 1, s2[3], 0); + break; + default: + _slice_obj_vert_color_merge(s[0], 2, s[1], 3, s[2], 1, s[3], 0); + _slice_obj_vert_color_merge(s2[0], 3, s2[1], 2, s2[2], 0, s2[3], 1); + } + num++; + } + } + + for (num = 0; num < wd->slices_h * wd->slices_w; num++) + { + _slice_3d(wd, wd->slices[num], ox, oy, ow, oh); + _slice_3d(wd, wd->slices2[num], ox, oy, ow, oh); + } + + return 1; +} + +static void +_state_end(Widget_Data *wd) +{ + _state_slices_clear(wd); +} + + +static void +flip_show_hide(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (elm_flip_front_visible_get(obj)) + { + if (wd->pageflip) + { + if (wd->front.content) + { + evas_object_move(wd->front.content, 4999, 4999); + evas_object_show(wd->front.clip); + } + else + evas_object_hide(wd->front.clip); + if (wd->back.content) + evas_object_show(wd->back.clip); + else + evas_object_hide(wd->back.clip); + } + else + { + if (wd->front.content) + evas_object_show(wd->front.clip); + else + evas_object_hide(wd->front.clip); + evas_object_hide(wd->back.clip); + } + } + else + { + if (wd->pageflip) + { + if (wd->front.content) + evas_object_show(wd->front.clip); + else + evas_object_hide(wd->front.clip); + if (wd->back.content) + { + evas_object_move(wd->back.content, 4999, 4999); + evas_object_show(wd->back.clip); + } + else + evas_object_hide(wd->back.clip); + } + else + { + if (wd->front.content) + evas_object_hide(wd->front.clip); + else + evas_object_hide(wd->front.clip); + if (wd->back.content) + evas_object_show(wd->back.clip); + else + evas_object_hide(wd->back.clip); + } + } +} + +static void +_flip_do(Evas_Object *obj, double t, Elm_Flip_Mode mode, int lin, int rev) +{ + Evas_Coord x, y, w, h; + double p, deg, pp; + Evas_Map *mf, *mb; + Evas_Coord cx, cy, px, py, foc; + int lx, ly, lz, lr, lg, lb, lar, lag, lab; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + + mf = evas_map_new(4); + evas_map_smooth_set(mf, EINA_FALSE); + mb = evas_map_new(4); + evas_map_smooth_set(mb, EINA_FALSE); + + if (wd->front.content) + { + const char *type = evas_object_type_get(wd->front.content); + + // FIXME: only handles filled obj + if ((type) && (!strcmp(type, "image"))) + { + int iw, ih; + evas_object_image_size_get(wd->front.content, &iw, &ih); + evas_object_geometry_get(wd->front.content, &x, &y, &w, &h); + evas_map_util_points_populate_from_geometry(mf, x, y, w, h, 0); + evas_map_point_image_uv_set(mf, 0, 0, 0); + evas_map_point_image_uv_set(mf, 1, iw, 0); + evas_map_point_image_uv_set(mf, 2, iw, ih); + evas_map_point_image_uv_set(mf, 3, 0, ih); + } + else + { + evas_object_geometry_get(wd->front.content, &x, &y, &w, &h); + evas_map_util_points_populate_from_geometry(mf, x, y, w, h, 0); + } + } + if (wd->back.content) + { + const char *type = evas_object_type_get(wd->back.content); + + if ((type) && (!strcmp(type, "image"))) + { + int iw, ih; + evas_object_image_size_get(wd->back.content, &iw, &ih); + evas_object_geometry_get(wd->back.content, &x, &y, &w, &h); + evas_map_util_points_populate_from_geometry(mb, x, y, w, h, 0); + evas_map_point_image_uv_set(mb, 0, 0, 0); + evas_map_point_image_uv_set(mb, 1, iw, 0); + evas_map_point_image_uv_set(mb, 2, iw, ih); + evas_map_point_image_uv_set(mb, 3, 0, ih); + } + else + { + evas_object_geometry_get(wd->back.content, &x, &y, &w, &h); + evas_map_util_points_populate_from_geometry(mb, x, y, w, h, 0); + } + } + + evas_object_geometry_get(obj, &x, &y, &w, &h); + + cx = x + (w / 2); + cy = y + (h / 2); + + px = x + (w / 2); + py = y + (h / 2); + foc = 2048; + + lx = cx; + ly = cy; + lz = -10000; + lr = 255; + lg = 255; + lb = 255; + lar = 0; + lag = 0; + lab = 0; + + switch (mode) + { + case ELM_FLIP_ROTATE_Y_CENTER_AXIS: + p = 1.0 - t; + pp = p; + if (!lin) pp = (p * p); + p = 1.0 - pp; + if (wd->state) deg = 180.0 * p; + else deg = 180 + (180.0 * p); + if (rev) deg = -deg; + evas_map_util_3d_rotate(mf, 0.0, deg, 0.0, cx, cy, 0); + evas_map_util_3d_rotate(mb, 0.0, 180 + deg, 0.0, cx, cy, 0); + break; + case ELM_FLIP_ROTATE_X_CENTER_AXIS: + p = 1.0 - t; + pp = p; + if (!lin) pp = (p * p); + p = 1.0 - pp; + if (wd->state) deg = 180.0 * p; + else deg = 180 + (180.0 * p); + if (rev) deg = -deg; + evas_map_util_3d_rotate(mf, deg, 0.0, 0.0, cx, cy, 0); + evas_map_util_3d_rotate(mb, 180.0 + deg, 0.0, 0.0, cx, cy, 0); + break; + case ELM_FLIP_ROTATE_XZ_CENTER_AXIS: + p = 1.0 - t; + pp = p; + if (!lin) pp = (p * p); + p = 1.0 - pp; + if (wd->state) deg = 180.0 * p; + else deg = 180 + (180.0 * p); + if (rev) deg = -deg; + evas_map_util_3d_rotate(mf, deg, 0.0, deg, cx, cy, 0); + evas_map_util_3d_rotate(mb, 180 + deg, 0.0, 180 + deg, cx, cy, 0); + break; + case ELM_FLIP_ROTATE_YZ_CENTER_AXIS: + p = 1.0 - t; + pp = p; + if (!lin) pp = (p * p); + p = 1.0 - pp; + if (wd->state) deg = 180.0 * p; + else deg = 180 + (180.0 * p); + if (rev) deg = -deg; + evas_map_util_3d_rotate(mf, 0.0, deg, deg, cx, cy, 0); + evas_map_util_3d_rotate(mb, 0.0, 180.0 + deg, 180.0 + deg, cx, cy, 0); + break; + case ELM_FLIP_CUBE_LEFT: + p = 1.0 - t; + pp = p; + if (!lin) pp = (p * p); + p = 1.0 - pp; + deg = -90.0 * p; + if (wd->state) + { + evas_map_util_3d_rotate(mf, 0.0, deg, 0.0, cx, cy, w / 2); + evas_map_util_3d_rotate(mb, 0.0, deg + 90, 0.0, cx, cy, w / 2); + } + else + { + evas_map_util_3d_rotate(mf, 0.0, deg + 90, 0.0, cx, cy, w / 2); + evas_map_util_3d_rotate(mb, 0.0, deg, 0.0, cx, cy, w / 2); + } + break; + case ELM_FLIP_CUBE_RIGHT: + p = 1.0 - t; + pp = p; + if (!lin) pp = (p * p); + p = 1.0 - pp; + deg = 90.0 * p; + if (wd->state) + { + evas_map_util_3d_rotate(mf, 0.0, deg, 0.0, cx, cy, w / 2); + evas_map_util_3d_rotate(mb, 0.0, deg - 90, 0.0, cx, cy, w / 2); + } + else + { + evas_map_util_3d_rotate(mf, 0.0, deg - 90, 0.0, cx, cy, w / 2); + evas_map_util_3d_rotate(mb, 0.0, deg, 0.0, cx, cy, w / 2); + } + break; + case ELM_FLIP_CUBE_UP: + p = 1.0 - t; + pp = p; + if (!lin) pp = (p * p); + p = 1.0 - pp; + deg = -90.0 * p; + if (wd->state) + { + evas_map_util_3d_rotate(mf, deg, 0.0, 0.0, cx, cy, h / 2); + evas_map_util_3d_rotate(mb, deg + 90, 0.0, 0.0, cx, cy, h / 2); + } + else + { + evas_map_util_3d_rotate(mf, deg + 90, 0.0, 0.0, cx, cy, h / 2); + evas_map_util_3d_rotate(mb, deg, 0.0, 0.0, cx, cy, h / 2); + } + break; + case ELM_FLIP_CUBE_DOWN: + p = 1.0 - t; + pp = p; + if (!lin) pp = (p * p); + p = 1.0 - pp; + deg = 90.0 * p; + if (wd->state) + { + evas_map_util_3d_rotate(mf, deg, 0.0, 0.0, cx, cy, h / 2); + evas_map_util_3d_rotate(mb, deg - 90, 0.0, 0.0, cx, cy, h / 2); + } + else + { + evas_map_util_3d_rotate(mf, deg - 90, 0.0, 0.0, cx, cy, h / 2); + evas_map_util_3d_rotate(mb, deg, 0.0, 0.0, cx, cy, h / 2); + } + break; + case ELM_FLIP_PAGE_LEFT: + break; + case ELM_FLIP_PAGE_RIGHT: + break; + case ELM_FLIP_PAGE_UP: + break; + case ELM_FLIP_PAGE_DOWN: + break; + default: + break; + } + + + if (wd->front.content) + { + evas_map_util_3d_lighting(mf, lx, ly, lz, lr, lg, lb, lar, lag, lab); + evas_map_util_3d_perspective(mf, px, py, 0, foc); + evas_object_map_set(wd->front.content, mf); + evas_object_map_enable_set(wd->front.content, 1); + if (evas_map_util_clockwise_get(mf)) evas_object_show(wd->front.clip); + else evas_object_hide(wd->front.clip); + } + + if (wd->back.content) + { + evas_map_util_3d_lighting(mb, lx, ly, lz, lr, lg, lb, lar, lag, lab); + evas_map_util_3d_perspective(mb, px, py, 0, foc); + evas_object_map_set(wd->back.content, mb); + evas_object_map_enable_set(wd->back.content, 1); + if (evas_map_util_clockwise_get(mb)) evas_object_show(wd->back.clip); + else evas_object_hide(wd->back.clip); + } + + evas_map_free(mf); + evas_map_free(mb); +} + +static void +_showhide(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord x, y, w, h; + if (!wd) return; + + evas_object_geometry_get(obj, &x, &y, &w, &h); + if (wd->front.content) + { + if ((wd->pageflip) && (wd->state)) + { + evas_object_move(wd->front.content, 4999, 4999); + } + else + { + if (!wd->animator) + evas_object_move(wd->front.content, x, y); + } + evas_object_resize(wd->front.content, w, h); + } + if (wd->back.content) + { + if ((wd->pageflip) && (!wd->state)) + { + evas_object_move(wd->back.content, 4999, 4999); + } + else + { + if (!wd->animator) + evas_object_move(wd->back.content, x, y); + } + evas_object_resize(wd->back.content, w, h); + } + +} + +static Eina_Bool +_flip(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + double t = ecore_loop_time_get() - wd->start; + Evas_Coord w, h; + + if (!wd) return ECORE_CALLBACK_CANCEL; + if (!wd->animator) return ECORE_CALLBACK_CANCEL; + + t = t / wd->len; + if (t > 1.0) t = 1.0; + + evas_object_geometry_get(obj, NULL, NULL, &w, &h); + if (wd->mode == ELM_FLIP_PAGE_LEFT) + { + wd->dir = 0; + wd->started = EINA_TRUE; + wd->pageflip = EINA_TRUE; + wd->down_x = w - 1; + wd->down_y = h / 2; + wd->x = (1.0 - t) * wd->down_x; + wd->y = wd->down_y; + flip_show_hide(obj); + _state_update(wd); + } + else if (wd->mode == ELM_FLIP_PAGE_RIGHT) + { + wd->dir = 1; + wd->started = EINA_TRUE; + wd->pageflip = EINA_TRUE; + wd->down_x = 0; + wd->down_y = h / 2; + wd->x = (t) * w; + wd->y = wd->down_y; + flip_show_hide(obj); + _state_update(wd); + } + else if (wd->mode == ELM_FLIP_PAGE_UP) + { + wd->dir = 2; + wd->started = EINA_TRUE; + wd->pageflip = EINA_TRUE; + wd->down_x = w / 2; + wd->down_y = h - 1; + wd->x = wd->down_x; + wd->y = (1.0 - t) * wd->down_y; + flip_show_hide(obj); + _state_update(wd); + } + else if (wd->mode == ELM_FLIP_PAGE_DOWN) + { + wd->dir = 3; + wd->started = EINA_TRUE; + wd->pageflip = EINA_TRUE; + wd->down_x = w / 2; + wd->down_y = 0; + wd->x = wd->down_x; + wd->y = (t) * h; + flip_show_hide(obj); + _state_update(wd); + } + else + _flip_do(obj, t, wd->mode, 0, 0); + + if (t >= 1.0) + { + wd->pageflip = EINA_FALSE; + _state_end(wd); + evas_object_map_enable_set(wd->front.content, 0); + evas_object_map_enable_set(wd->back.content, 0); + // FIXME: hack around evas rendering bug (only fix makes evas bitch-slow + evas_object_resize(wd->front.content, 0, 0); + evas_object_resize(wd->back.content, 0, 0); + evas_smart_objects_calculate(evas_object_evas_get(obj)); + // FIXME: end hack + wd->animator = NULL; + wd->state = !wd->state; + _configure(obj); + flip_show_hide(obj); + evas_object_smart_callback_call(obj, SIG_ANIMATE_DONE, NULL); + return ECORE_CALLBACK_CANCEL; + } + return ECORE_CALLBACK_RENEW; +} + +static void +_configure(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord x, y, w, h; + Evas_Coord fsize; + if (!wd) return; + + _showhide(obj); + evas_object_geometry_get(obj, &x, &y, &w, &h); + // FIXME: manual flip wont get fixed + if (wd->animator) _flip(obj); + + if (wd->event[0]) + { + fsize = (double)w * wd->dir_hitsize[0]; + elm_coords_finger_size_adjust(0, NULL, 1, &fsize); + evas_object_move(wd->event[0], x, y); + evas_object_resize(wd->event[0], w, fsize); + } + if (wd->event[1]) + { + fsize = (double)w * wd->dir_hitsize[1]; + elm_coords_finger_size_adjust(0, NULL, 1, &fsize); + evas_object_move(wd->event[1], x, y + h - fsize); + evas_object_resize(wd->event[1], w, fsize); + } + if (wd->event[2]) + { + fsize = (double)h * wd->dir_hitsize[2]; + elm_coords_finger_size_adjust(1, &fsize, 0, NULL); + evas_object_move(wd->event[2], x, y); + evas_object_resize(wd->event[2], fsize, h); + } + if (wd->event[3]) + { + fsize = (double)h * wd->dir_hitsize[3]; + elm_coords_finger_size_adjust(1, &fsize, 0, NULL); + evas_object_move(wd->event[3], x + w - fsize, y); + evas_object_resize(wd->event[3], fsize, h); + } +} + +static void +_move(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + _configure(obj); +} + +static void +_resize(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + _configure(obj); +} + +static Eina_Bool +_animate(void *data) +{ + return _flip(data); +} + +static double +_pos_get(Widget_Data *wd, int *rev, Elm_Flip_Mode *m) +{ + Evas_Coord x, y, w, h; + double t = 1.0; + + evas_object_geometry_get(wd->obj, &x, &y, &w, &h); + switch (wd->intmode) + { + case ELM_FLIP_INTERACTION_ROTATE: + case ELM_FLIP_INTERACTION_CUBE: + { + if (wd->dir == 0) + { + if (wd->down_x > 0) + t = 1.0 - ((double)wd->x / (double)wd->down_x); + *rev = 1; + } + else if (wd->dir == 1) + { + if (wd->down_x < w) + t = 1.0 - ((double)(w - wd->x) / (double)(w - wd->down_x)); + } + else if (wd->dir == 2) + { + if (wd->down_y > 0) + t = 1.0 - ((double)wd->y / (double)wd->down_y); + } + else if (wd->dir == 3) + { + if (wd->down_y < h) + t = 1.0 - ((double)(h - wd->y) / (double)(h - wd->down_y)); + *rev = 1; + } + + if (t < 0.0) t = 0.0; + else if (t > 1.0) t = 1.0; + + if ((wd->dir == 0) || (wd->dir == 1)) + { + if (wd->intmode == ELM_FLIP_INTERACTION_ROTATE) + *m = ELM_FLIP_ROTATE_Y_CENTER_AXIS; + else if (wd->intmode == ELM_FLIP_INTERACTION_CUBE) + { + if (*rev) + *m = ELM_FLIP_CUBE_LEFT; + else + *m = ELM_FLIP_CUBE_RIGHT; + } + } + else + { + if (wd->intmode == ELM_FLIP_INTERACTION_ROTATE) + *m = ELM_FLIP_ROTATE_X_CENTER_AXIS; + else if (wd->intmode == ELM_FLIP_INTERACTION_CUBE) + { + if (*rev) + *m = ELM_FLIP_CUBE_UP; + else + *m = ELM_FLIP_CUBE_DOWN; + } + } + } + default: + break; + } + return t; +} + +static Eina_Bool +_event_anim(void *data, double pos) +{ + Widget_Data *wd = data; + double p; + + p = ecore_animator_pos_map(pos, ECORE_POS_MAP_ACCELERATE, 0.0, 0.0); + if (wd->finish) + { + if (wd->dir == 0) + wd->x = wd->ox * (1.0 - p); + else if (wd->dir == 1) + wd->x = wd->ox + ((wd->w - wd->ox) * p); + else if (wd->dir == 2) + wd->y = wd->oy * (1.0 - p); + else if (wd->dir == 3) + wd->y = wd->oy + ((wd->h - wd->oy) * p); + } + else + { + if (wd->dir == 0) + wd->x = wd->ox + ((wd->w - wd->ox) * p); + else if (wd->dir == 1) + wd->x = wd->ox * (1.0 - p); + else if (wd->dir == 2) + wd->y = wd->oy + ((wd->h - wd->oy) * p); + else if (wd->dir == 3) + wd->y = wd->oy * (1.0 - p); + } + switch (wd->intmode) + { + case ELM_FLIP_INTERACTION_NONE: + break; + case ELM_FLIP_INTERACTION_ROTATE: + case ELM_FLIP_INTERACTION_CUBE: + { + Elm_Flip_Mode m = ELM_FLIP_ROTATE_X_CENTER_AXIS; + int rev = 0; + p = _pos_get(wd, &rev, &m); + _flip_do(wd->obj, p, m, 1, rev); + } + break; + case ELM_FLIP_INTERACTION_PAGE: + wd->pageflip = EINA_TRUE; + _configure(data); + _state_update(wd); + break; + default: + break; + } + if (pos < 1.0) return ECORE_CALLBACK_RENEW; + + wd->pageflip = EINA_FALSE; + _state_end(wd); + evas_object_map_enable_set(wd->front.content, 0); + evas_object_map_enable_set(wd->back.content, 0); + // FIXME: hack around evas rendering bug (only fix makes evas bitch-slow + evas_object_resize(wd->front.content, 0, 0); + evas_object_resize(wd->back.content, 0, 0); + evas_smart_objects_calculate(evas_object_evas_get(wd->obj)); + // FIXME: end hack + wd->animator = NULL; + if (wd->finish) wd->state = !wd->state; + flip_show_hide(wd->obj); + _configure(wd->obj); + wd->animator = NULL; + evas_object_smart_callback_call(wd->obj, SIG_ANIMATE_DONE, NULL); + + return ECORE_CALLBACK_CANCEL; +} + +static void +_update_job(void *data) +{ + Widget_Data *wd = data; + double p; + Elm_Flip_Mode m = ELM_FLIP_ROTATE_X_CENTER_AXIS; + int rev = 0; + + wd->job = NULL; + switch (wd->intmode) + { + case ELM_FLIP_INTERACTION_ROTATE: + case ELM_FLIP_INTERACTION_CUBE: + p = _pos_get(wd, &rev, &m); + _flip_do(wd->obj, p, m, 1, rev); + break; + case ELM_FLIP_INTERACTION_PAGE: + wd->pageflip = EINA_TRUE; + _configure(data); + _state_update(wd); + break; + default: + break; + } +} + +static void +_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Evas_Object *fl = data; + Widget_Data *wd = elm_widget_data_get(fl); + Evas_Event_Mouse_Down *ev = event_info; + Evas_Coord x, y, w, h; + + if (!wd) return; + if (ev->button != 1) return; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return ; + if (wd->animator) + { + ecore_animator_del(wd->animator); + wd->animator = NULL; + } + wd->down = EINA_TRUE; + wd->started = EINA_FALSE; + evas_object_geometry_get(data, &x, &y, &w, &h); + wd->x = ev->canvas.x - x; + wd->y = ev->canvas.y - y; + wd->w = w; + wd->h = h; + wd->down_x = wd->x; + wd->down_y = wd->y; +} + +static void +_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Evas_Object *fl = data; + Widget_Data *wd = elm_widget_data_get(fl); + Evas_Event_Mouse_Up *ev = event_info; + Evas_Coord x, y, w, h; + double tm = 0.5; + + if (!wd) return; + if (ev->button != 1) return; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return ; + wd->down = 0; + evas_object_geometry_get(data, &x, &y, &w, &h); + wd->x = ev->canvas.x - x; + wd->y = ev->canvas.y - y; + wd->w = w; + wd->h = h; + wd->ox = wd->x; + wd->oy = wd->y; + if (wd->job) + { + ecore_job_del(wd->job); + wd->job = NULL; + } + wd->finish = EINA_FALSE; + if (wd->dir == 0) + { + tm = (double)wd->x / (double)wd->w; + if (wd->x < (wd->w / 2)) wd->finish = EINA_TRUE; + } + else if (wd->dir == 1) + { + if (wd->x > (wd->w / 2)) wd->finish = EINA_TRUE; + tm = 1.0 - ((double)wd->x / (double)wd->w); + } + else if (wd->dir == 2) + { + if (wd->y < (wd->h / 2)) wd->finish = EINA_TRUE; + tm = (double)wd->y / (double)wd->h; + } + else if (wd->dir == 3) + { + if (wd->y > (wd->h / 2)) wd->finish = EINA_TRUE; + tm = 1.0 - ((double)wd->y / (double)wd->h); + } + if (tm < 0.01) tm = 0.01; + else if (tm > 0.99) tm = 0.99; + if (!wd->finish) tm = 1.0 - tm; + tm *= 1.0; // FIXME: config for anim time + if (wd->animator) ecore_animator_del(wd->animator); + wd->animator = ecore_animator_timeline_add(tm, _event_anim, wd); + _event_anim(wd, 0.0); +} + +static void +_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Evas_Object *fl = data; + Widget_Data *wd = elm_widget_data_get(fl); + Evas_Event_Mouse_Move *ev = event_info; + Evas_Coord x, y, w, h; + + if (!wd) return; + if (!wd->down) return; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return ; + evas_object_geometry_get(data, &x, &y, &w, &h); + wd->x = ev->cur.canvas.x - x; + wd->y = ev->cur.canvas.y - y; + wd->w = w; + wd->h = h; + if (!wd->started) + { + Evas_Coord dx, dy; + + dx = wd->x - wd->down_x; + dy = wd->y - wd->down_y; + if (((dx * dx) + (dy * dy)) > + (_elm_config->finger_size * _elm_config->finger_size / 4)) + { + wd->dir = 0; + if ((wd->x > (w / 2)) && + (dx < 0) && (abs(dx) > abs(dy))) + wd->dir = 0; // left + else if ((wd->x < (w / 2)) && (dx >= 0) && + (abs(dx) > abs(dy))) + wd->dir = 1; // right + else if ((wd->y > (h / 2)) && (dy < 0) && (abs(dy) >= abs(dx))) + wd->dir = 2; // up + else if ((wd->y < (h / 2)) && (dy >= 0) && (abs(dy) >= abs(dx))) + wd->dir = 3; // down + wd->started = EINA_TRUE; + if (wd->intmode == ELM_FLIP_INTERACTION_PAGE) + wd->pageflip = EINA_TRUE; + flip_show_hide(data); + evas_smart_objects_calculate(evas_object_evas_get(data)); + _flip(data); + // FIXME: hack around evas rendering bug (only fix makes evas bitch-slow) + evas_object_map_enable_set(wd->front.content, EINA_FALSE); + evas_object_map_enable_set(wd->back.content, EINA_FALSE); +// FIXME: XXX why does this bork interactive flip?? +// evas_object_resize(wd->front.content, 0, 0); +// evas_object_resize(wd->back.content, 0, 0); + evas_smart_objects_calculate(evas_object_evas_get(data)); + _configure(obj); + // FIXME: end hack + evas_object_smart_callback_call(obj, SIG_ANIMATE_BEGIN, NULL); + } + else return; + } + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + if (wd->job) ecore_job_del(wd->job); + wd->job = ecore_job_add(_update_job, wd); +} + +static void +_flip_content_front_set(Evas_Object *obj, Evas_Object *content) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + int i; + + if (wd->front.content == content) return; + if (wd->front.content) evas_object_del(wd->front.content); + wd->front.content = content; + if (content) + { + elm_widget_sub_object_add(obj, content); + evas_object_smart_member_add(content, obj); + //FIXME: smart member clip could be reset by the obj. + evas_object_clip_set(content, wd->front.clip); + evas_object_event_callback_add(content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + _sizing_eval(obj); + } + + // force calc to contents are the right size before transition + evas_smart_objects_calculate(evas_object_evas_get(obj)); + flip_show_hide(obj); + _configure(obj); + if (wd->intmode != ELM_FLIP_INTERACTION_NONE) + { + for (i = 0; i < 4; i++) evas_object_raise(wd->event[i]); + } +} + +static void +_flip_content_back_set(Evas_Object *obj, Evas_Object *content) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + int i; + if (wd->back.content == content) return; + if (wd->back.content) evas_object_del(wd->back.content); + wd->back.content = content; + if (content) + { + elm_widget_sub_object_add(obj, content); + evas_object_smart_member_add(content, obj); + //FIXME: smart member clip could be reset by the obj. + evas_object_clip_set(content, wd->back.clip); + evas_object_event_callback_add(content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + _sizing_eval(obj); + } + + // force calc to contents are the right size before transition + evas_smart_objects_calculate(evas_object_evas_get(obj)); + flip_show_hide(obj); + _configure(obj); + if (wd->intmode != ELM_FLIP_INTERACTION_NONE) + { + for (i = 0; i < 4; i++) evas_object_raise(wd->event[i]); + } +} + +static Evas_Object * +_content_front_unset(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (!wd->front.content)) return NULL; + + Evas_Object *content = wd->front.content; + elm_widget_sub_object_del(obj, content); + evas_object_smart_member_del(content); + return content; +} + +static Evas_Object * +_content_back_unset(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (!wd->back.content)) return NULL; + + Evas_Object *content = wd->back.content; + elm_widget_sub_object_del(obj, content); + evas_object_smart_member_del(content); + return content; +} + +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + + if (!part || !strcmp(part, "front")) + _flip_content_front_set(obj, content); + else if (!strcmp(part, "back")) + _flip_content_back_set(obj, content); +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + if (!part || !strcmp(part, "front")) + return wd->front.content; + else if (!strcmp(part, "back")) + return wd->back.content; + + return NULL; +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + + if (!part || !strcmp(part, "front")) + return _content_front_unset(obj); + else if (!strcmp(part, "back")) + return _content_back_unset(obj); + + return NULL; +} + +EAPI Evas_Object * +elm_flip_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "flip"); + elm_widget_type_set(obj, "flip"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_focus_next_hook_set(obj, _elm_flip_focus_next_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); + + wd->obj = obj; + + wd->clip = evas_object_rectangle_add(e); + evas_object_static_clip_set(wd->clip, EINA_TRUE); + evas_object_move(wd->clip, -49999, -49999); + evas_object_resize(wd->clip, 99999, 99999); + elm_widget_sub_object_add(obj, wd->clip); + evas_object_smart_member_add(wd->clip, obj); + + wd->front.clip = evas_object_rectangle_add(e); + evas_object_static_clip_set(wd->front.clip, EINA_TRUE); + evas_object_data_set(wd->front.clip, "_elm_leaveme", obj); + evas_object_move(wd->front.clip, -49999, -49999); + evas_object_resize(wd->front.clip, 99999, 99999); + elm_widget_sub_object_add(obj, wd->front.clip); + evas_object_smart_member_add(wd->front.clip, obj); + evas_object_clip_set(wd->front.clip, wd->clip); + + wd->back.clip = evas_object_rectangle_add(e); + evas_object_static_clip_set(wd->back.clip, EINA_TRUE); + evas_object_data_set(wd->back.clip, "_elm_leaveme", obj); + evas_object_move(wd->back.clip, -49999, -49999); + evas_object_resize(wd->back.clip, 99999, 99999); + elm_widget_sub_object_add(obj, wd->back.clip); + evas_object_smart_member_add(wd->back.clip, obj); + evas_object_clip_set(wd->back.clip, wd->clip); + + evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _move, NULL); + evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, NULL); + evas_object_event_callback_add(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj);; + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + wd->state = EINA_TRUE; + wd->intmode = ELM_FLIP_INTERACTION_NONE; + + _sizing_eval(obj); + + return obj; +} + +EAPI Eina_Bool +elm_flip_front_visible_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->state; +} + +EAPI void +elm_flip_perspective_set(Evas_Object *obj, Evas_Coord foc __UNUSED__, Evas_Coord x __UNUSED__, Evas_Coord y __UNUSED__) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; +} + +// FIXME: add ambient and lighting control + +EAPI void +elm_flip_go(Evas_Object *obj, Elm_Flip_Mode mode) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (!wd->animator) wd->animator = ecore_animator_add(_animate, obj); + flip_show_hide(obj); + wd->mode = mode; + wd->start = ecore_loop_time_get(); + wd->len = 0.5; // FIXME: make config val + if ((wd->mode == ELM_FLIP_PAGE_LEFT) || + (wd->mode == ELM_FLIP_PAGE_RIGHT) || + (wd->mode == ELM_FLIP_PAGE_UP) || + (wd->mode == ELM_FLIP_PAGE_DOWN)) + wd->pageflip = EINA_TRUE; + // force calc to contents are the right size before transition + evas_smart_objects_calculate(evas_object_evas_get(obj)); + _flip(obj); + // FIXME: hack around evas rendering bug (only fix makes evas bitch-slow) + evas_object_map_enable_set(wd->front.content, 0); + evas_object_map_enable_set(wd->back.content, 0); + evas_object_resize(wd->front.content, 0, 0); + evas_object_resize(wd->back.content, 0, 0); + evas_smart_objects_calculate(evas_object_evas_get(obj)); + _configure(obj); + // FIXME: end hack + evas_object_smart_callback_call(obj, SIG_ANIMATE_BEGIN, NULL); +} + +EAPI void +elm_flip_interaction_set(Evas_Object *obj, Elm_Flip_Interaction mode) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + int i; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->intmode == mode) return; + wd->intmode = mode; + for (i = 0; i < 4; i++) + { + if (wd->intmode == ELM_FLIP_INTERACTION_NONE) + { + if (wd->event[i]) + { + evas_object_del(wd->event[i]); + wd->event[i] = NULL; + } + } + else + { + if ((wd->dir_enabled[i]) && (!wd->event[i])) + { + Evas *e = evas_object_evas_get(obj); + wd->event[i] = evas_object_rectangle_add(e); + elm_widget_sub_object_add(obj, wd->event[i]); + evas_object_data_set(wd->event[i], "_elm_leaveme", obj); + evas_object_clip_set(wd->event[i], evas_object_clip_get(obj)); + evas_object_color_set(wd->event[i], 0, 0, 0, 0); + evas_object_show(wd->event[i]); + evas_object_smart_member_add(wd->event[i], obj); + evas_object_event_callback_add(wd->event[i], + EVAS_CALLBACK_MOUSE_DOWN, + _down_cb, obj); + evas_object_event_callback_add(wd->event[i], + EVAS_CALLBACK_MOUSE_UP, + _up_cb, obj); + evas_object_event_callback_add(wd->event[i], + EVAS_CALLBACK_MOUSE_MOVE, + _move_cb, obj); + } + } + } + _sizing_eval(obj); + _configure(obj); +} + +EAPI Elm_Flip_Interaction +elm_flip_interaction_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_FLIP_INTERACTION_NONE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return ELM_FLIP_INTERACTION_NONE; + return wd->intmode; +} + +EAPI void +elm_flip_interaction_direction_enabled_set(Evas_Object *obj, Elm_Flip_Direction dir, Eina_Bool enabled) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + int i = -1; + if (!wd) return; + enabled = !!enabled; + if (dir == ELM_FLIP_DIRECTION_UP) i = 0; + else if (dir == ELM_FLIP_DIRECTION_DOWN) i = 1; + else if (dir == ELM_FLIP_DIRECTION_LEFT) i = 2; + else if (dir == ELM_FLIP_DIRECTION_RIGHT) i = 3; + if (i < 0) return; + if (wd->dir_enabled[i] == enabled) return; + wd->dir_enabled[i] = enabled; + if (wd->intmode == ELM_FLIP_INTERACTION_NONE) return; + if ((wd->dir_enabled[i]) && (!wd->event[i])) + { + wd->event[i] = evas_object_rectangle_add(evas_object_evas_get(obj)); + elm_widget_sub_object_add(obj, wd->event[i]); + evas_object_data_set(wd->event[i], "_elm_leaveme", obj); + evas_object_clip_set(wd->event[i], evas_object_clip_get(obj)); + evas_object_color_set(wd->event[i], 0, 0, 0, 0); + evas_object_show(wd->event[i]); + evas_object_smart_member_add(wd->event[i], obj); + evas_object_event_callback_add(wd->event[i], EVAS_CALLBACK_MOUSE_DOWN, + _down_cb, obj); + evas_object_event_callback_add(wd->event[i], EVAS_CALLBACK_MOUSE_UP, + _up_cb, obj); + evas_object_event_callback_add(wd->event[i], EVAS_CALLBACK_MOUSE_MOVE, + _move_cb, obj); + } + else if (!(wd->dir_enabled[i]) && (wd->event[i])) + { + evas_object_del(wd->event[i]); + wd->event[i] = NULL; + } + _sizing_eval(obj); + _configure(obj); +} + +EAPI Eina_Bool +elm_flip_interaction_direction_enabled_get(Evas_Object *obj, Elm_Flip_Direction dir) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + int i = -1; + if (!wd) return EINA_FALSE; + if (dir == ELM_FLIP_DIRECTION_UP) i = 0; + else if (dir == ELM_FLIP_DIRECTION_DOWN) i = 1; + else if (dir == ELM_FLIP_DIRECTION_LEFT) i = 2; + else if (dir == ELM_FLIP_DIRECTION_RIGHT) i = 3; + if (i < 0) return EINA_FALSE; + return wd->dir_enabled[i]; +} + +EAPI void +elm_flip_interaction_direction_hitsize_set(Evas_Object *obj, Elm_Flip_Direction dir, double hitsize) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + int i = -1; + if (!wd) return; + if (dir == ELM_FLIP_DIRECTION_UP) i = 0; + else if (dir == ELM_FLIP_DIRECTION_DOWN) i = 1; + else if (dir == ELM_FLIP_DIRECTION_LEFT) i = 2; + else if (dir == ELM_FLIP_DIRECTION_RIGHT) i = 3; + if (i < 0) return; + if (hitsize < 0.0) hitsize = 0.0; + else if (hitsize > 1.0) hitsize = 1.0; + if (wd->dir_hitsize[i] == hitsize) return; + wd->dir_hitsize[i] = hitsize; + _sizing_eval(obj); + _configure(obj); +} + +EAPI double +elm_flip_interaction_direction_hitsize_get(Evas_Object *obj, Elm_Flip_Direction dir) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + int i = -1; + if (!wd) return 0.0; + if (dir == ELM_FLIP_DIRECTION_UP) i = 0; + else if (dir == ELM_FLIP_DIRECTION_DOWN) i = 1; + else if (dir == ELM_FLIP_DIRECTION_LEFT) i = 2; + else if (dir == ELM_FLIP_DIRECTION_RIGHT) i = 3; + if (i < 0) return 0.0; + return wd->dir_hitsize[i]; +} diff --git a/libraries/elementary/src/lib/elm_flip.h b/libraries/elementary/src/lib/elm_flip.h new file mode 100644 index 0000000..124809b --- /dev/null +++ b/libraries/elementary/src/lib/elm_flip.h @@ -0,0 +1,257 @@ +/** + * @defgroup Flip Flip + * @ingroup Elementary + * + * @image html img/widget/flip/preview-00.png + * @image latex img/widget/flip/preview-00.eps + * + * This widget holds 2 content objects(Evas_Object): one on the front and one + * on the back. It allows you to flip from front to back and vice-versa using + * various animations. + * + * If either the front or back contents are not set the flip will treat that + * as transparent. So if you wore to set the front content but not the back, + * and then call elm_flip_go() you would see whatever is below the flip. + * + * For a list of supported animations see elm_flip_go(). + * + * Signals that you can add callbacks for are: + * "animate,begin" - when a flip animation was started + * "animate,done" - when a flip animation is finished + * + * Default content parts of the flip widget that you can use for are: + * @li "front" - A front content of the flip + * @li "back" - A back content of the flip + * + * Supported elm_object common APIs. + * @li @ref elm_object_part_content_set + * @li @ref elm_object_part_content_get + * @li @ref elm_object_part_content_unset + * + * @ref tutorial_flip show how to use most of the API. + * + * @{ + */ +typedef enum +{ + ELM_FLIP_ROTATE_Y_CENTER_AXIS, + ELM_FLIP_ROTATE_X_CENTER_AXIS, + ELM_FLIP_ROTATE_XZ_CENTER_AXIS, + ELM_FLIP_ROTATE_YZ_CENTER_AXIS, + ELM_FLIP_CUBE_LEFT, + ELM_FLIP_CUBE_RIGHT, + ELM_FLIP_CUBE_UP, + ELM_FLIP_CUBE_DOWN, + ELM_FLIP_PAGE_LEFT, + ELM_FLIP_PAGE_RIGHT, + ELM_FLIP_PAGE_UP, + ELM_FLIP_PAGE_DOWN +} Elm_Flip_Mode; + +typedef enum +{ + ELM_FLIP_INTERACTION_NONE, + ELM_FLIP_INTERACTION_ROTATE, + ELM_FLIP_INTERACTION_CUBE, + ELM_FLIP_INTERACTION_PAGE +} Elm_Flip_Interaction; + +typedef enum +{ + ELM_FLIP_DIRECTION_UP, /**< Allows interaction with the top of the widget */ + ELM_FLIP_DIRECTION_DOWN, /**< Allows interaction with the bottom of the widget */ + ELM_FLIP_DIRECTION_LEFT, /**< Allows interaction with the left portion of the widget */ + ELM_FLIP_DIRECTION_RIGHT /**< Allows interaction with the right portion of the widget */ +} Elm_Flip_Direction; + +/** + * @brief Add a new flip to the parent + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * @ingroup Flip + */ +EAPI Evas_Object *elm_flip_add(Evas_Object *parent); + +/** + * @brief Get flip front visibility state + * + * @param obj The flip object + * @return EINA_TRUE if front front is showing, EINA_FALSE if the back is + * showing. + * + * @ingroup Flip + */ +Eina_Bool elm_flip_front_visible_get(const Evas_Object *obj); + +/** + * @brief Set flip perspective + * + * @param obj The flip object + * @param foc The coordinate to set the focus on + * @param x The X coordinate + * @param y The Y coordinate + * + * @warning This function currently does nothing. + * + * @ingroup Flip + */ +EAPI void elm_flip_perspective_set(Evas_Object *obj, Evas_Coord foc, Evas_Coord x, Evas_Coord y); + +/** + * @brief Runs the flip animation + * + * @param obj The flip object + * @param mode The mode type + * + * Flips the front and back contents using the @p mode animation. This + * effectively hides the currently visible content and shows the hidden one. + * + * There a number of possible animations to use for the flipping: + * @li ELM_FLIP_ROTATE_X_CENTER_AXIS - Rotate the currently visible content + * around a horizontal axis in the middle of its height, the other content + * is shown as the other side of the flip. + * @li ELM_FLIP_ROTATE_Y_CENTER_AXIS - Rotate the currently visible content + * around a vertical axis in the middle of its width, the other content is + * shown as the other side of the flip. + * @li ELM_FLIP_ROTATE_XZ_CENTER_AXIS - Rotate the currently visible content + * around a diagonal axis in the middle of its width, the other content is + * shown as the other side of the flip. + * @li ELM_FLIP_ROTATE_YZ_CENTER_AXIS - Rotate the currently visible content + * around a diagonal axis in the middle of its height, the other content is + * shown as the other side of the flip. + * @li ELM_FLIP_CUBE_LEFT - Rotate the currently visible content to the left + * as if the flip was a cube, the other content is show as the right face of + * the cube. + * @li ELM_FLIP_CUBE_RIGHT - Rotate the currently visible content to the + * right as if the flip was a cube, the other content is show as the left + * face of the cube. + * @li ELM_FLIP_CUBE_UP - Rotate the currently visible content up as if the + * flip was a cube, the other content is show as the bottom face of the cube. + * @li ELM_FLIP_CUBE_DOWN - Rotate the currently visible content down as if + * the flip was a cube, the other content is show as the upper face of the + * cube. + * @li ELM_FLIP_PAGE_LEFT - Move the currently visible content to the left as + * if the flip was a book, the other content is shown as the page below that. + * @li ELM_FLIP_PAGE_RIGHT - Move the currently visible content to the right + * as if the flip was a book, the other content is shown as the page below + * that. + * @li ELM_FLIP_PAGE_UP - Move the currently visible content up as if the + * flip was a book, the other content is shown as the page below that. + * @li ELM_FLIP_PAGE_DOWN - Move the currently visible content down as if the + * flip was a book, the other content is shown as the page below that. + * + * @image html elm_flip.png + * @image latex elm_flip.eps width=\textwidth + * + * @ingroup Flip + */ +EAPI void elm_flip_go(Evas_Object *obj, Elm_Flip_Mode mode); + +/** + * @brief Set the interactive flip mode + * + * @param obj The flip object + * @param mode The interactive flip mode to use + * + * This sets if the flip should be interactive (allow user to click and + * drag a side of the flip to reveal the back page and cause it to flip). + * By default a flip is not interactive. You may also need to set which + * sides of the flip are "active" for flipping and how much space they use + * (a minimum of a finger size) with elm_flip_interaction_direction_enabled_set() + * and elm_flip_interaction_direction_hitsize_set() + * + * The four available mode of interaction are: + * @li ELM_FLIP_INTERACTION_NONE - No interaction is allowed + * @li ELM_FLIP_INTERACTION_ROTATE - Interaction will cause rotate animation + * @li ELM_FLIP_INTERACTION_CUBE - Interaction will cause cube animation + * @li ELM_FLIP_INTERACTION_PAGE - Interaction will cause page animation + * + * @note ELM_FLIP_INTERACTION_ROTATE won't cause + * ELM_FLIP_ROTATE_XZ_CENTER_AXIS or ELM_FLIP_ROTATE_YZ_CENTER_AXIS to + * happen, those can only be achieved with elm_flip_go(); + * + * @ingroup Flip + */ +EAPI void elm_flip_interaction_set(Evas_Object *obj, Elm_Flip_Interaction mode); + +/** + * @brief Get the interactive flip mode + * + * @param obj The flip object + * @return The interactive flip mode + * + * Returns the interactive flip mode set by elm_flip_interaction_set() + * + * @ingroup Flip + */ +EAPI Elm_Flip_Interaction elm_flip_interaction_get(const Evas_Object *obj); + +/** + * @brief Set which directions of the flip respond to interactive flip + * + * @param obj The flip object + * @param dir The direction to change + * @param enabled If that direction is enabled or not + * + * By default all directions are disabled, so you may want to enable the + * desired directions for flipping if you need interactive flipping. You must + * call this function once for each direction that should be enabled. + * + * @see elm_flip_interaction_set() + * + * @ingroup Flip + */ +EAPI void elm_flip_interaction_direction_enabled_set(Evas_Object *obj, Elm_Flip_Direction dir, Eina_Bool enabled); + +/** + * @brief Get the enabled state of that flip direction + * + * @param obj The flip object + * @param dir The direction to check + * @return If that direction is enabled or not + * + * Gets the enabled state set by elm_flip_interaction_direction_enabled_set() + * + * @see elm_flip_interaction_set() + * + * @ingroup Flip + */ +EAPI Eina_Bool elm_flip_interaction_direction_enabled_get(Evas_Object *obj, Elm_Flip_Direction dir); + +/** + * @brief Set the amount of the flip that is sensitive to interactive flip + * + * @param obj The flip object + * @param dir The direction to modify + * @param hitsize The amount of that dimension (0.0 to 1.0) to use + * + * Set the amount of the flip that is sensitive to interactive flip, with 0 + * representing no area in the flip and 1 representing the entire flip. There + * is however a consideration to be made in that the area will never be + * smaller than the finger size set(as set in your Elementary configuration). + * + * @see elm_flip_interaction_set() + * + * @ingroup Flip + */ +EAPI void elm_flip_interaction_direction_hitsize_set(Evas_Object *obj, Elm_Flip_Direction dir, double hitsize); + +/** + * @brief Get the amount of the flip that is sensitive to interactive flip + * + * @param obj The flip object + * @param dir The direction to check + * @return The size set for that direction + * + * Returns the amount of sensitive area set by + * elm_flip_interaction_direction_hitsize_set(). + * + * @ingroup Flip + */ +EAPI double elm_flip_interaction_direction_hitsize_get(Evas_Object *obj, Elm_Flip_Direction dir); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_flipselector.c b/libraries/elementary/src/lib/elm_flipselector.c new file mode 100644 index 0000000..7939aba --- /dev/null +++ b/libraries/elementary/src/lib/elm_flipselector.c @@ -0,0 +1,936 @@ +#include +#include "elm_priv.h" + +/* TODO: ideally, the default theme would use map{} blocks on the TEXT + parts to implement their fading in/out propertly (as in the clock + widget) */ +/* TODO: if one ever wants to extend it to receiving generic widgets + as items, be my guest. in this case, remember to implement the + items tooltip infra. */ +/* TODO: fix default theme image borders for looong strings as item + labels. */ +/* TODO: set text elipsis on labels if one enforces mininum size on + * the overall widget less the required for displaying it. */ +/* TODO: find a way to, in the default theme, to detect we are + * bootstrapping (receiving the 1st message) and populate the downmost + * TEXT parts with the same text as the upmost, where appropriate. */ + +#define FLIP_FIRST_INTERVAL (0.85) +#define FLIP_MIN_INTERVAL (0.1) +#define MSG_FLIP_DOWN (1) +#define MSG_FLIP_UP (2) +#define MAX_LEN_DEFAULT (50) + +#define DATA_GET eina_list_data_get + +struct _Elm_Flipselector_Item +{ + ELM_WIDGET_ITEM; + const char *label; + Evas_Smart_Cb func; + void *data; + int deleted : 1; +}; + +typedef struct _Widget_Data Widget_Data; +typedef struct _Elm_Flipselector_Item Elm_Flipselector_Item; + +struct _Widget_Data +{ + Evas_Object *self; + Evas_Object *base; + Eina_List *items; + Eina_List *current; + Eina_List *sentinel; /* item containing the largest label string */ + int walking; + unsigned int max_len; + Ecore_Timer *spin; + double interval, first_interval; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _update_view(Evas_Object *obj); +static void _callbacks_set(Evas_Object *obj); +static void _flip_up(Widget_Data *wd); +static void _flip_down(Widget_Data *wd); +static Eina_Bool _item_del_pre_hook(Elm_Object_Item *it); + +static const char SIG_SELECTED[] = "selected"; +static const char SIG_UNDERFLOWED[] = "underflowed"; +static const char SIG_OVERFLOWED[] = "overflowed"; +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_SELECTED, ""}, + {SIG_UNDERFLOWED, ""}, + {SIG_OVERFLOWED, ""}, + {NULL, NULL} +}; + +static void +_item_text_set_hook(Elm_Object_Item *it, + const char *part, + const char *label) +{ + Widget_Data *wd; + Eina_List *l; + Elm_Flipselector_Item *item; + + if (!label) return; + + if (part && strcmp(part ,"default")) return; + + item = (Elm_Flipselector_Item *)it; + wd = elm_widget_data_get(WIDGET(item)); + if ((!wd) || (!wd->items)) return; + + l = eina_list_data_find_list(wd->items, item); + if (!l) return; + + eina_stringshare_del(item->label); + item->label = eina_stringshare_add_length(label, wd->max_len); + + if (strlen(label) > strlen(elm_object_item_text_get(DATA_GET(wd->sentinel)))) + wd->sentinel = l; + + if (wd->current == l) + { + _update_view(WIDGET(item)); + _sizing_eval(wd->self); + } +} + +static const char * +_item_text_get_hook(const Elm_Object_Item *it, const char *part) +{ + if (part && strcmp(part ,"default")) return NULL; + + return ((Elm_Flipselector_Item *)it)->label; +} + +static void +_item_signal_emit_hook(Elm_Object_Item *it, + const char *emission, + const char *source) +{ + Elm_Flipselector_Item *item = (Elm_Flipselector_Item *)it; + edje_object_signal_emit(VIEW(item), emission, source); +} + +static Elm_Flipselector_Item * +_item_new(Evas_Object *obj, const char *label, Evas_Smart_Cb func, const void *data) +{ + unsigned int len; + Elm_Flipselector_Item *it; + Widget_Data *wd = elm_widget_data_get(obj); + + it = elm_widget_item_new(obj, Elm_Flipselector_Item); + if (!it) return NULL; + + elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook); + elm_widget_item_text_set_hook_set(it, _item_text_set_hook); + elm_widget_item_text_get_hook_set(it, _item_text_get_hook); + elm_widget_item_signal_emit_hook_set(it, _item_signal_emit_hook); + + len = strlen(label); + if (len > wd->max_len) + len = wd->max_len; + + it->label = eina_stringshare_add_length(label, len); + it->func = func; + it->base.data = data; + + /* TODO: no view here, but if one desires general contents in the + * future... */ + return it; +} + +static inline void +_item_free(Elm_Flipselector_Item *it) +{ + eina_stringshare_del(it->label); + elm_widget_item_free(it); +} + +static void +_del_hook(Evas_Object *obj) +{ + Elm_Flipselector_Item *item; + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (wd->walking) ERR("flipselector deleted while walking.\n"); + + EINA_LIST_FREE(wd->items, item) + _item_free(item); + + if (wd->spin) ecore_timer_del(wd->spin); + free(wd); +} + +static void +_disable_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (elm_widget_disabled_get(obj)) + edje_object_signal_emit(wd->base, "elm,state,disabled", "elm"); + else + edje_object_signal_emit(wd->base, "elm,state,enabled", "elm"); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd; + const char *max_len; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + _elm_theme_object_set(obj, wd->base, "flipselector", "base", + elm_widget_style_get(obj)); + edje_object_scale_set(wd->base, + elm_widget_scale_get(obj) * _elm_config->scale); + + max_len = edje_object_data_get(wd->base, "max_len"); + if (!max_len) + wd->max_len = MAX_LEN_DEFAULT; + else + { + wd->max_len = atoi(max_len); + if (!wd->max_len) + wd->max_len = MAX_LEN_DEFAULT; + } + + _update_view(obj); + _sizing_eval(obj); +} + +static void +_sentinel_eval(Widget_Data *wd) +{ + Elm_Flipselector_Item *it; + Eina_List *l; + + if (!wd->items) + { + wd->sentinel = NULL; + return; + } + + wd->sentinel = wd->items; + + EINA_LIST_FOREACH(wd->items, l, it) + { + if (strlen(elm_object_item_text_get((Elm_Object_Item *)it)) > + strlen(elm_object_item_text_get(DATA_GET(wd->sentinel)))) + wd->sentinel = l; + } +} + +/* TODO: create a flag to avoid looping here all times */ +static void +_flipselector_process_deletions(Widget_Data *wd) +{ + Elm_Flipselector_Item *it; + Eina_List *l; + Eina_Bool skip = EINA_TRUE; + Eina_Bool sentinel_eval = EINA_FALSE; + + wd->walking++; /* avoid nested deletions */ + + EINA_LIST_FOREACH(wd->items, l, it) + { + if (!it->deleted) continue; + + if (wd->current == l) + { + if (wd->current == wd->sentinel) + sentinel_eval = EINA_TRUE; + wd->current = eina_list_prev(wd->current); + } + wd->items = eina_list_remove(wd->items, it); + + if (!wd->current) + wd->current = wd->items; + + _item_free(it); + skip = EINA_FALSE; + + if (eina_list_count(wd->items) <= 1) + edje_object_signal_emit(wd->base, "elm,state,button,hidden", "elm"); + else + edje_object_signal_emit(wd->base, "elm,state,button,visible", "elm"); + } + + if (!skip) + _update_view(wd->self); + + if (sentinel_eval) + _sentinel_eval(wd); + + wd->walking--; +} + +static inline void +_flipselector_walk(Widget_Data *wd) +{ + if (wd->walking < 0) + { + ERR("walking was negative. fixed!\n"); + wd->walking = 0; + } + wd->walking++; +} + +static inline void +_flipselector_unwalk(Widget_Data *wd) +{ + wd->walking--; + if (wd->walking < 0) + { + ERR("walking became negative. fixed!\n"); + wd->walking = 0; + } + if (wd->walking) return; + + _flipselector_process_deletions(wd); +} + +static Eina_Bool +_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info) +{ + Evas_Event_Key_Down *ev; + Widget_Data *wd; + Eina_Bool is_up = EINA_TRUE; + + if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE; + + wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + ev = event_info; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; + + if (elm_widget_disabled_get(obj)) return EINA_FALSE; + + if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down"))) + is_up = EINA_FALSE; + else if ((strcmp(ev->keyname, "Up")) && (strcmp(ev->keyname, "KP_Up"))) + return EINA_FALSE; + + if (wd->spin) ecore_timer_del(wd->spin); + wd->spin = NULL; + + /* TODO: if direction setting via API is not coming in, replace + these calls by flip_{next,prev} */ + _flipselector_walk(wd); + if (is_up) _flip_up(wd); + else _flip_down(wd); + _flipselector_unwalk(wd); + + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; +} + +static void +_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + /* FIXME: no treatment of this signal so far */ + if (elm_widget_focus_get(obj)) + { + edje_object_signal_emit(wd->base, "elm,action,focus", "elm"); + evas_object_focus_set(wd->base, EINA_TRUE); + } + else + { + edje_object_signal_emit(wd->base, "elm,action,unfocus", "elm"); + evas_object_focus_set(wd->base, EINA_FALSE); + } +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd; + const char *tmp = NULL; + Evas_Coord minw = -1, minh = -1, w, h; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + elm_coords_finger_size_adjust(1, &minw, 2, &minh); + + if (wd->sentinel) + { + const char *label = elm_object_item_text_get(DATA_GET(wd->sentinel)); + tmp = edje_object_part_text_get(wd->base, "elm.top"); + edje_object_part_text_escaped_set(wd->base, "elm.top", label); + } + + edje_object_size_min_restricted_calc(wd->base, &minw, &minh, minw, minh); + elm_coords_finger_size_adjust(1, &minw, 2, &minh); + evas_object_size_hint_min_get(obj, &w, &h); + + if (wd->sentinel) edje_object_part_text_escaped_set(wd->base, "elm.top", tmp); + + if (w > minw) minw = w; + if (h > minh) minh = h; + + evas_object_size_hint_min_set(obj, minw, minh); +} + +static void +_update_view(Evas_Object *obj) +{ + Widget_Data *wd; + const char *label; + Elm_Flipselector_Item *item; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + label = NULL; + item = DATA_GET(wd->current); + if (item) label = item->label; + + edje_object_part_text_escaped_set(wd->base, "elm.top", label ? label : ""); + edje_object_part_text_escaped_set(wd->base, "elm.bottom", label ? label : ""); + edje_object_message_signal_process(wd->base); +} + +static void +_changed(Widget_Data *wd) +{ + Elm_Flipselector_Item *item; + + item = DATA_GET(wd->current); + if (!item) return; + + if (item->func) + item->func((void *)item->base.data, WIDGET(item), item); + if (!item->deleted) + evas_object_smart_callback_call(wd->self, SIG_SELECTED, item); +} + +static void +_send_msg(Widget_Data *wd, int flipside, char *label) +{ + Edje_Message_String msg; + + msg.str = label; + edje_object_message_send(wd->base, EDJE_MESSAGE_STRING, flipside, &msg); + edje_object_message_signal_process(wd->base); + + _changed(wd); +} + +static void +_flip_up(Widget_Data *wd) +{ + Elm_Flipselector_Item *item; + + if (!wd->current) return; + + if (wd->current == wd->items) + { + wd->current = eina_list_last(wd->items); + evas_object_smart_callback_call(wd->self, SIG_UNDERFLOWED, NULL); + } + else + wd->current = eina_list_prev(wd->current); + + item = DATA_GET(wd->current); + if (!item) return; + + _send_msg(wd, MSG_FLIP_UP, (char *)item->label); +} + +static Eina_Bool +_signal_val_up(void *data) +{ + Widget_Data *wd = elm_widget_data_get(data); + + if (!wd) goto val_up_exit_on_error; + + _flipselector_walk(wd); + + if (wd->interval > FLIP_MIN_INTERVAL) + wd->interval = wd->interval / 1.05; + + ecore_timer_interval_set(wd->spin, wd->interval); + + _flip_up(wd); + + _flipselector_unwalk(wd); + + return ECORE_CALLBACK_RENEW; + +val_up_exit_on_error: + return ECORE_CALLBACK_CANCEL; +} + +static void +_signal_val_up_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + + wd->interval = wd->first_interval; + + if (wd->spin) ecore_timer_del(wd->spin); + wd->spin = ecore_timer_add(wd->interval, _signal_val_up, data); + + _signal_val_up(data); +} + +static void +_flip_down(Widget_Data *wd) +{ + Elm_Flipselector_Item *item; + + if (!wd->current) return; + + wd->current = eina_list_next(wd->current); + if (!wd->current) + { + wd->current = wd->items; + evas_object_smart_callback_call(wd->self, SIG_OVERFLOWED, NULL); + } + + item = DATA_GET(wd->current); + if (!item) return; + + _send_msg(wd, MSG_FLIP_DOWN, (char *)item->label); +} + +static Eina_Bool +_signal_val_down(void *data) +{ + Widget_Data *wd = elm_widget_data_get(data); + + if (!wd) goto val_down_exit_on_error; + + _flipselector_walk(wd); + + if (wd->interval > FLIP_MIN_INTERVAL) + wd->interval = wd->interval / 1.05; + ecore_timer_interval_set(wd->spin, wd->interval); + + _flip_down(wd); + + _flipselector_unwalk(wd); + + return ECORE_CALLBACK_RENEW; + +val_down_exit_on_error: + return ECORE_CALLBACK_CANCEL; +} + +static void +_signal_val_down_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + + wd->interval = wd->first_interval; + + if (wd->spin) ecore_timer_del(wd->spin); + wd->spin = ecore_timer_add(wd->interval, _signal_val_down, data); + + _signal_val_down(data); +} + +static void +_signal_val_change_stop(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + + if (wd->spin) ecore_timer_del(wd->spin); + wd->spin = NULL; +} + +static void +_callbacks_set(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + edje_object_signal_callback_add(wd->base, "elm,action,up,start", + "", _signal_val_up_start, obj); + edje_object_signal_callback_add(wd->base, "elm,action,up,stop", + "", _signal_val_change_stop, obj); + edje_object_signal_callback_add(wd->base, "elm,action,down,start", + "", _signal_val_down_start, obj); + edje_object_signal_callback_add(wd->base, "elm,action,down,stop", + "", _signal_val_change_stop, obj); +} + +static Eina_Bool +_item_del_pre_hook(Elm_Object_Item *it) +{ + Widget_Data *wd; + Elm_Flipselector_Item *item, *item2; + Eina_List *l; + + item = (Elm_Flipselector_Item *)it; + wd = elm_widget_data_get(WIDGET(item)); + if (!wd) return EINA_FALSE; + + if (wd->walking > 0) + { + item->deleted = EINA_TRUE; + return EINA_FALSE; + } + + _flipselector_walk(wd); + + EINA_LIST_FOREACH(wd->items, l, item2) + { + if (item2 == item) + { + wd->items = eina_list_remove_list(wd->items, l); + if (wd->current == l) + { + wd->current = l->prev; + if (!wd->current) wd->current = l->next; + if (wd->current) + { + item2 = wd->current->data; + _send_msg(wd, MSG_FLIP_DOWN, (char *)item2->label); + } + else + _send_msg(wd, MSG_FLIP_DOWN, ""); + } + break; + } + } + eina_stringshare_del(item->label); + _sentinel_eval(wd); + _flipselector_unwalk(wd); + + return EINA_TRUE; +} + +EAPI Evas_Object * +elm_flipselector_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "flipselector"); + elm_widget_type_set(obj, "flipselector"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + + wd->self = obj; + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_disable_hook_set(obj, _disable_hook); + + elm_widget_can_focus_set(obj, EINA_TRUE); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_event_hook_set(obj, _event_hook); + + wd->base = edje_object_add(e); + elm_widget_resize_object_set(obj, wd->base); + + _callbacks_set(obj); + + wd->first_interval = FLIP_FIRST_INTERVAL; + + _theme_hook(obj); + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + return obj; +} + +EAPI void +elm_flipselector_flip_next(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (wd->spin) ecore_timer_del(wd->spin); + wd->spin = NULL; + + _flipselector_walk(wd); + _flip_down(wd); + _flipselector_unwalk(wd); +} + +EAPI void +elm_flipselector_flip_prev(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (wd->spin) ecore_timer_del(wd->spin); + wd->spin = NULL; + + _flipselector_walk(wd); + _flip_up(wd); + _flipselector_unwalk(wd); +} + +EAPI Elm_Object_Item * +elm_flipselector_item_append(Evas_Object *obj, const char *label, void (*func)(void *data, Evas_Object *obj, void *event_info), void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + + Elm_Flipselector_Item *item; + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + item = _item_new(obj, label, func, data); + if (!item) return NULL; + + wd->items = eina_list_append(wd->items, item); + if (!wd->current) + { + wd->current = wd->items; + _update_view(obj); + } + + if (!wd->sentinel || + (strlen(elm_object_item_text_get((Elm_Object_Item *)item)) > + strlen(elm_object_item_text_get(DATA_GET(wd->sentinel))))) + { + wd->sentinel = eina_list_last(wd->items); + _sizing_eval(obj); + } + + if (eina_list_count(wd->items) >= 2) + edje_object_signal_emit(wd->base, "elm,state,button,visible", "elm"); + + return (Elm_Object_Item *)item; +} + +EAPI Elm_Object_Item * +elm_flipselector_item_prepend(Evas_Object *obj, const char *label, void (*func)(void *data, Evas_Object *obj, void *event_info), void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + + Elm_Flipselector_Item *item; + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + item = _item_new(obj, label, func, data); + if (!item) return NULL; + + wd->items = eina_list_prepend(wd->items, item); + if (!wd->current) + { + wd->current = wd->items; + _update_view(obj); + } + + if (!wd->sentinel || + (strlen(elm_object_item_text_get((Elm_Object_Item *)item)) > + strlen(elm_object_item_text_get(DATA_GET(wd->sentinel))))) + { + wd->sentinel = wd->items; + _sizing_eval(obj); + } + + if (eina_list_count(wd->items) >= 2) + edje_object_signal_emit(wd->base, "elm,state,button,visible", "elm"); + + return (Elm_Object_Item *)item; +} + +EAPI const Eina_List * +elm_flipselector_items_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->items; +} + +EAPI Elm_Object_Item * +elm_flipselector_first_item_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + + Elm_Flipselector_Item *it; + Widget_Data *wd; + Eina_List *l; + + wd = elm_widget_data_get(obj); + if (!wd || !wd->items) return NULL; + + EINA_LIST_FOREACH(wd->items, l, it) + { + if (it->deleted) continue; + return (Elm_Object_Item *)it; + } + return NULL; +} + +EAPI Elm_Object_Item * +elm_flipselector_last_item_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + + Elm_Flipselector_Item *it; + Widget_Data *wd; + Eina_List *l; + + wd = elm_widget_data_get(obj); + if (!wd || !wd->items) return NULL; + + EINA_LIST_REVERSE_FOREACH(wd->items, l, it) + { + if (it->deleted) continue; + return (Elm_Object_Item *)it; + } + return NULL; +} + +EAPI Elm_Object_Item * +elm_flipselector_selected_item_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return DATA_GET(wd->current); +} + +EAPI void +elm_flipselector_item_selected_set(Elm_Object_Item *it, Eina_Bool selected) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + + Elm_Flipselector_Item *item, *_item, *cur; + int flipside = MSG_FLIP_UP; + Widget_Data *wd; + Eina_List *l; + + item = (Elm_Flipselector_Item *)it; + wd = elm_widget_data_get(WIDGET(item)); + if (!wd) return; + + cur = DATA_GET(wd->current); + if ((selected) && (cur == item)) return; + + _flipselector_walk(wd); + + if ((!selected) && (cur == item)) + { + EINA_LIST_FOREACH(wd->items, l, _item) + { + if (!_item->deleted) + { + wd->current = l; + _send_msg(wd, MSG_FLIP_UP, (char *)_item->label); + break; + } + } + _flipselector_unwalk(wd); + return; + } + + EINA_LIST_FOREACH(wd->items, l, _item) + { + if (_item == cur) flipside = MSG_FLIP_DOWN; + + if (_item == item) + { + wd->current = l; + _send_msg(wd, flipside, (char *)item->label); + break; + } + } + + _flipselector_unwalk(wd); +} + +EAPI Eina_Bool +elm_flipselector_item_selected_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE); + Widget_Data *wd; + Elm_Flipselector_Item *item; + + item = (Elm_Flipselector_Item *)it; + wd = elm_widget_data_get(WIDGET(item)); + if (!wd) return EINA_FALSE; + return (eina_list_data_get(wd->current) == item); +} + +EAPI Elm_Object_Item * +elm_flipselector_item_prev_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + + Widget_Data *wd; + Eina_List *l; + Elm_Flipselector_Item *item = (Elm_Flipselector_Item *)it; + + wd = elm_widget_data_get(WIDGET(item)); + if ((!wd) || (!wd->items)) return NULL; + + l = eina_list_data_find_list(wd->items, it); + if (l && l->prev) return DATA_GET(l->prev); + + return NULL; +} + +EAPI Elm_Object_Item * +elm_flipselector_item_next_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + + Widget_Data *wd; + Eina_List *l; + Elm_Flipselector_Item *item = (Elm_Flipselector_Item *)it; + + wd = elm_widget_data_get(WIDGET(item)); + if ((!wd) || (!wd->items)) return NULL; + + l = eina_list_data_find_list(wd->items, it); + if (l && l->next) return DATA_GET(l->next); + + return NULL; +} + +EAPI void +elm_flipselector_first_interval_set(Evas_Object *obj, double interval) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->first_interval = interval; +} + +EAPI double +elm_flipselector_first_interval_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; + return wd->first_interval; +} diff --git a/libraries/elementary/src/lib/elm_flipselector.h b/libraries/elementary/src/lib/elm_flipselector.h new file mode 100644 index 0000000..bdc52df --- /dev/null +++ b/libraries/elementary/src/lib/elm_flipselector.h @@ -0,0 +1,310 @@ +/** + * @defgroup Flipselector Flip Selector + * @ingroup Elementary + * + * @image html img/widget/flipselector/preview-00.png + * @image latex img/widget/flipselector/preview-00.eps + * + * A flip selector is a widget to show a set of @b text items, one + * at a time, with the same sheet switching style as the @ref Clock + * "clock" widget, when one changes the current displaying sheet + * (thus, the "flip" in the name). + * + * User clicks to flip sheets which are @b held for some time will + * make the flip selector to flip continuously and automatically for + * the user. The interval between flips will keep growing in time, + * so that it helps the user to reach an item which is distant from + * the current selection. + * + * Smart callbacks one can register to: + * - @c "selected" - when the widget's selected text item is changed + * - @c "overflowed" - when the widget's current selection is changed + * from the first item in its list to the last + * - @c "underflowed" - when the widget's current selection is changed + * from the last item in its list to the first + * + * Available styles for it: + * - @c "default" + * + * Default text parts of the flipselector items that you can use for are: + * @li "default" - label of the flipselector item + * + * Supported elm_object common APIs. + * @li @ref elm_object_disabled_set + * @li @ref elm_object_disabled_get + * + * Supported elm_object_item common APIs. + * @li @ref elm_object_item_text_set + * @li @ref elm_object_item_part_text_set + * @li @ref elm_object_item_signal_emit + * + * Here is an example on its usage: + * @li @ref flipselector_example + */ + +/** + * @addtogroup Flipselector + * @{ + */ + +/** + * Add a new flip selector widget to the given parent Elementary + * (container) widget + * + * @param parent The parent object + * @return a new flip selector widget handle or @c NULL, on errors + * + * This function inserts a new flip selector widget on the canvas. + * + * @ingroup Flipselector + */ +EAPI Evas_Object *elm_flipselector_add(Evas_Object *parent); + +/** + * Programmatically select the next item of a flip selector widget + * + * @param obj The flipselector object + * + * @note The selection will be animated. Also, if it reaches the + * end of its list of member items, it will continue with the first + * one onwards. + * + * @ingroup Flipselector + */ +EAPI void elm_flipselector_flip_next(Evas_Object *obj); + +/** + * Programmatically select the previous item of a flip selector + * widget + * + * @param obj The flipselector object + * + * @note The selection will be animated. Also, if it reaches the + * beginning of its list of member items, it will continue with the + * last one backwards. + * + * @ingroup Flipselector + */ +EAPI void elm_flipselector_flip_prev(Evas_Object *obj); + +/** + * Append a (text) item to a flip selector widget + * + * @param obj The flipselector object + * @param label The (text) label of the new item + * @param func Convenience callback function to take place when + * item is selected + * @param data Data passed to @p func, above + * @return A handle to the item added or @c NULL, on errors + * + * The widget's list of labels to show will be appended with the + * given value. If the user wishes so, a callback function pointer + * can be passed, which will get called when this same item is + * selected. + * + * @note The current selection @b won't be modified by appending an + * element to the list. + * + * @note The maximum length of the text label is going to be + * determined by the widget's theme. Strings larger than + * that value are going to be @b truncated. + * + * @ingroup Flipselector + */ +EAPI Elm_Object_Item *elm_flipselector_item_append(Evas_Object *obj, const char *label, Evas_Smart_Cb func, void *data); + +/** + * Prepend a (text) item to a flip selector widget + * + * @param obj The flipselector object + * @param label The (text) label of the new item + * @param func Convenience callback function to take place when + * item is selected + * @param data Data passed to @p func, above + * @return A handle to the item added or @c NULL, on errors + * + * The widget's list of labels to show will be prepended with the + * given value. If the user wishes so, a callback function pointer + * can be passed, which will get called when this same item is + * selected. + * + * @note The current selection @b won't be modified by prepending + * an element to the list. + * + * @note The maximum length of the text label is going to be + * determined by the widget's theme. Strings larger than + * that value are going to be @b truncated. + * + * @ingroup Flipselector + */ +EAPI Elm_Object_Item *elm_flipselector_item_prepend(Evas_Object *obj, const char *label, Evas_Smart_Cb func, void *data); + +/** + * Get the internal list of items in a given flip selector widget. + * + * @param obj The flipselector object + * @return The list of items (#Elm_Object_Item as data) or + * @c NULL on errors. + * + * This list is @b not to be modified in any way and must not be + * freed. Use the list members with functions like + * elm_object_item_text_set(), + * elm_object_item_text_get(), + * elm_object_item_del(), + * elm_flipselector_item_selected_get(), + * elm_flipselector_item_selected_set(). + * + * @warning This list is only valid until @p obj object's internal + * items list is changed. It should be fetched again with another + * call to this function when changes happen. + * + * @ingroup Flipselector + */ +EAPI const Eina_List *elm_flipselector_items_get(const Evas_Object *obj); + +/** + * Get the first item in the given flip selector widget's list of + * items. + * + * @param obj The flipselector object + * @return The first item or @c NULL, if it has no items (and on + * errors) + * + * @see elm_flipselector_item_append() + * @see elm_flipselector_last_item_get() + * + * @ingroup Flipselector + */ +EAPI Elm_Object_Item *elm_flipselector_first_item_get(const Evas_Object *obj); + +/** + * Get the last item in the given flip selector widget's list of + * items. + * + * @param obj The flipselector object + * @return The last item or @c NULL, if it has no items (and on + * errors) + * + * @see elm_flipselector_item_prepend() + * @see elm_flipselector_first_item_get() + * + * @ingroup Flipselector + */ +EAPI Elm_Object_Item *elm_flipselector_last_item_get(const Evas_Object *obj); + +/** + * Get the currently selected item in a flip selector widget. + * + * @param obj The flipselector object + * @return The selected item or @c NULL, if the widget has no items + * (and on errors) + * + * @ingroup Flipselector + */ +EAPI Elm_Object_Item *elm_flipselector_selected_item_get(const Evas_Object *obj); + +/** + * Set whether a given flip selector widget's item should be the + * currently selected one. + * + * @param it The flip selector item + * @param selected @c EINA_TRUE to select it, @c EINA_FALSE to unselect. + * + * This sets whether @p item is or not the selected (thus, under + * display) one. If @p item is different than the one under display, + * the latter will be unselected. If the @p item is set to be + * unselected, on the other hand, the @b first item in the widget's + * internal members list will be the new selected one. + * + * @see elm_flipselector_item_selected_get() + * + * @ingroup Flipselector + */ +EAPI void elm_flipselector_item_selected_set(Elm_Object_Item *it, Eina_Bool selected); + +/** + * Get whether a given flip selector widget's item is the currently + * selected one. + * + * @param it The flip selector item + * @return @c EINA_TRUE, if it's selected, @c EINA_FALSE otherwise + * (or on errors). + * + * @see elm_flipselector_item_selected_set() + * + * @ingroup Flipselector + */ +EAPI Eina_Bool elm_flipselector_item_selected_get(const Elm_Object_Item *it); + +/** + * Gets the item before @p item in a flip selector widget's internal list of + * items. + * + * @param it The item to fetch previous from + * @return The item before the @p item, in its parent's list. If there is no + * previous item for @p item or there's an error, @c NULL is returned. + * + * @see elm_flipselector_item_next_get() + * + * @ingroup Flipselector + */ +EAPI Elm_Object_Item *elm_flipselector_item_prev_get(const Elm_Object_Item *it); + +/** + * Gets the item after @p item in a flip selector widget's + * internal list of items. + * + * @param it The item to fetch next from + * @return The item after the @p item, in its parent's list. If there is no next + * item for @p item or there's an error, @c NULL is returned. + * + * @see elm_flipselector_item_prev_get() + * + * @ingroup Flipselector + */ +EAPI Elm_Object_Item *elm_flipselector_item_next_get(const Elm_Object_Item *it); + +/** + * Set the interval on time updates for a user mouse button hold + * on a flip selector widget. + * + * @param obj The flip selector object + * @param interval The (first) interval value in seconds + * + * This interval value is @b decreased while the user holds the + * mouse pointer either flipping up or flipping down a given flip + * selector. + * + * This helps the user to get to a given item distant from the + * current one easier/faster, as it will start to flip quicker and + * quicker on mouse button holds. + * + * The calculation for the next flip interval value, starting from + * the one set with this call, is the previous interval divided by + * 1.05, so it decreases a little bit. + * + * The default starting interval value for automatic flips is + * @b 0.85 seconds. + * + * @see elm_flipselector_first_interval_get() + * + * @ingroup Flipselector + */ +EAPI void elm_flipselector_first_interval_set(Evas_Object *obj, double interval); + +/** + * Get the interval on time updates for an user mouse button hold + * on a flip selector widget. + * + * @param obj The flip selector object + * @return The (first) interval value, in seconds, set on it + * + * @see elm_flipselector_first_interval_set() for more details + * + * @ingroup Flipselector + */ +EAPI double elm_flipselector_first_interval_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_focus.h b/libraries/elementary/src/lib/elm_focus.h new file mode 100644 index 0000000..59fc97c --- /dev/null +++ b/libraries/elementary/src/lib/elm_focus.h @@ -0,0 +1,214 @@ +/** + * @defgroup Focus Focus + * @ingroup Elementary + * + * An Elementary application has, at all times, one (and only one) + * @b focused object. This is what determines where the input + * events go to within the application's window. Also, focused + * objects can be decorated differently, in order to signal to the + * user where the input is, at a given moment. + * + * Elementary applications also have the concept of focus + * chain: one can cycle through all the windows' focusable + * objects by input (tab key) or programmatically. The default + * focus chain for an application is the one define by the order in + * which the widgets where added in code. One will cycle through + * top level widgets, and, for each one containing sub-objects, cycle + * through them all, before returning to the level + * above. Elementary also allows one to set @b custom focus chains + * for their applications. + * + * Besides the focused decoration a widget may exhibit, when it + * gets focus, Elementary has a @b global focus highlight object + * that can be enabled for a window. If one chooses to do so, this + * extra highlight effect will surround the current focused object, + * too. + * + * @note Some Elementary widgets are @b unfocusable, after + * creation, by their very nature: they are not meant to be + * interacted with input events, but are there just for visual + * purposes. + * + * @ref general_functions_example_page "This" example contemplates + * some of these functions. + */ + +/** + * Get the whether an Elementary object has the focus or not. + * + * @param obj The Elementary object to get the information from + * @return @c EINA_TRUE, if the object is focused, @c EINA_FALSE if + * not (and on errors). + * + * @see elm_object_focus_set() + * + * @ingroup Focus + */ +EAPI Eina_Bool elm_object_focus_get(const Evas_Object *obj); + +/** + * Set/unset focus to a given Elementary object. + * + * @param obj The Elementary object to operate on. + * @param focus @c EINA_TRUE Set focus to a given object, + * @c EINA_FALSE Unset focus to a given object. + * + * @note When you set focus to this object, if it can handle focus, will + * take the focus away from the one who had it previously and will, for + * now on, be the one receiving input events. Unsetting focus will remove + * the focus from @p obj, passing it back to the previous element in the + * focus chain list. + * + * @see elm_object_focus_get(), elm_object_focus_custom_chain_get() + * + * @ingroup Focus + */ +EAPI void elm_object_focus_set(Evas_Object *obj, Eina_Bool focus); + +/** + * Set the ability for an Elementary object to be focused + * + * @param obj The Elementary object to operate on + * @param enable @c EINA_TRUE if the object can be focused, @c + * EINA_FALSE if not (and on errors) + * + * This sets whether the object @p obj is able to take focus or + * not. Unfocusable objects do nothing when programmatically + * focused, being the nearest focusable parent object the one + * really getting focus. Also, when they receive mouse input, they + * will get the event, but not take away the focus from where it + * was previously. + * + * @ingroup Focus + */ +EAPI void elm_object_focus_allow_set(Evas_Object *obj, Eina_Bool enable); + +/** + * Get whether an Elementary object is focusable or not + * + * @param obj The Elementary object to operate on + * @return @c EINA_TRUE if the object is allowed to be focused, @c + * EINA_FALSE if not (and on errors) + * + * @note Objects which are meant to be interacted with by input + * events are created able to be focused, by default. All the + * others are not. + * + * @ingroup Focus + */ +EAPI Eina_Bool elm_object_focus_allow_get(const Evas_Object *obj); + +/** + * Set custom focus chain. + * + * This function overwrites any previous custom focus chain within + * the list of objects. The previous list will be deleted and this list + * will be managed by elementary. After it is set, don't modify it. + * + * @note On focus cycle, only will be evaluated children of this container. + * + * @param obj The container object + * @param objs Chain of objects to pass focus + * @ingroup Focus + */ +EAPI void elm_object_focus_custom_chain_set(Evas_Object *obj, Eina_List *objs); + +/** + * Unset a custom focus chain on a given Elementary widget + * + * @param obj The container object to remove focus chain from + * + * Any focus chain previously set on @p obj (for its child objects) + * is removed entirely after this call. + * + * @ingroup Focus + */ +EAPI void elm_object_focus_custom_chain_unset(Evas_Object *obj); + +/** + * Get custom focus chain + * + * @param obj The container object + * @ingroup Focus + */ +EAPI const Eina_List *elm_object_focus_custom_chain_get(const Evas_Object *obj); + +/** + * Append object to custom focus chain. + * + * @note If relative_child equal to NULL or not in custom chain, the object + * will be added in end. + * + * @note On focus cycle, only will be evaluated children of this container. + * + * @param obj The container object + * @param child The child to be added in custom chain + * @param relative_child The relative object to position the child + * @ingroup Focus + */ +EAPI void elm_object_focus_custom_chain_append(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child); + +/** + * Prepend object to custom focus chain. + * + * @note If relative_child equal to NULL or not in custom chain, the object + * will be added in begin. + * + * @note On focus cycle, only will be evaluated children of this container. + * + * @param obj The container object + * @param child The child to be added in custom chain + * @param relative_child The relative object to position the child + * @ingroup Focus + */ +EAPI void elm_object_focus_custom_chain_prepend(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child); + +/** + * Give focus to next object in object tree. + * + * Give focus to next object in focus chain of one object sub-tree. + * If the last object of chain already have focus, the focus will go to the + * first object of chain. + * + * @param obj The object root of sub-tree + * @param dir Direction to move the focus + * + * @ingroup Focus + */ +EAPI void elm_object_focus_next(Evas_Object *obj, Elm_Focus_Direction dir); + +/** + * Make the elementary object and its children to be focusable + * (or unfocusable). + * + * @param obj The Elementary object to operate on + * @param focusable @c EINA_TRUE for focusable, + * @c EINA_FALSE for unfocusable. + * + * This sets whether the object @p obj and its children objects + * are able to take focus or not. If the tree is set as unfocusable, + * newest focused object which is not in this tree will get focus. + * This API can be helpful for an object to be deleted. + * When an object will be deleted soon, it and its children may not + * want to get focus (by focus reverting or by other focus controls). + * Then, just use this API before deleting. + * + * @see elm_object_tree_focus_allow_get() + * + * @ingroup Focus + * + */ +EAPI void elm_object_tree_focus_allow_set(Evas_Object *obj, Eina_Bool focusable); + +/** + * Get whether an Elementary object and its children are focusable or not. + * + * @param obj The Elementary object to get the information from + * @return @c EINA_TRUE, if the tree is focusable, + * @c EINA_FALSE if not (and on errors). + * + * @see elm_object_tree_focus_allow_set() + * + * @ingroup Focus + */ +EAPI Eina_Bool elm_object_tree_focus_allow_get(const Evas_Object *obj); diff --git a/libraries/elementary/src/lib/elm_font.c b/libraries/elementary/src/lib/elm_font.c new file mode 100644 index 0000000..43e9ebc --- /dev/null +++ b/libraries/elementary/src/lib/elm_font.c @@ -0,0 +1,221 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +#ifdef HAVE_EVIL +# include +#endif + +#include +#include "elm_priv.h" + +Elm_Font_Properties * +_elm_font_properties_get(Eina_Hash **font_hash, + const char *font) +{ + Elm_Font_Properties *efp = NULL; + char *s1; + + s1 = strchr(font, ':'); + if (s1) + { + char *s2, *name, *style; + int len; + + len = s1 - font; + name = calloc(sizeof(char), len + 1); + if (!name) return NULL; + strncpy(name, font, len); + + /* get subname (should be english) */ + s2 = strchr(name, ','); + if (s2) + { + len = s2 - name; + name = realloc(name, sizeof(char) * len + 1); + if (name) + { + memset(name, 0, sizeof(char) * len + 1); + strncpy(name, font, len); + } + } + + if (!strncmp(s1, ELM_FONT_TOKEN_STYLE, strlen(ELM_FONT_TOKEN_STYLE))) + { + style = s1 + strlen(ELM_FONT_TOKEN_STYLE); + + if (font_hash) efp = eina_hash_find(*font_hash, name); + if (!efp) + { + efp = calloc(1, sizeof(Elm_Font_Properties)); + if (efp) + { + efp->name = eina_stringshare_add(name); + if ((font_hash && !*font_hash)) + { + *font_hash = eina_hash_string_superfast_new(NULL); + eina_hash_add(*font_hash, name, efp); + } + } + } + s2 = strchr(style, ','); + if (s2) + { + char *style_old; + + len = s2 - style; + style_old = style; + style = calloc(sizeof(char), len + 1); + if (style) + { + strncpy(style, style_old, len); + efp->styles = eina_list_append(efp->styles, + eina_stringshare_add(style)); + free(style); + } + } + else + efp->styles = eina_list_append(efp->styles, + eina_stringshare_add(style)); + } + free(name); + } + else + { + if (font_hash) efp = eina_hash_find(*font_hash, font); + if (!efp) + { + efp = calloc(1, sizeof(Elm_Font_Properties)); + if (efp) + { + efp->name = eina_stringshare_add(font); + if (font_hash && !*font_hash) + { + *font_hash = eina_hash_string_superfast_new(NULL); + eina_hash_add(*font_hash, font, efp); + } + } + } + } + return efp; +} + +Eina_Hash * +_elm_font_available_hash_add(Eina_Hash *font_hash, + const char *full_name) +{ + _elm_font_properties_get(&font_hash, full_name); + return font_hash; +} + +static void +_elm_font_properties_free(Elm_Font_Properties *efp) +{ + const char *str; + + EINA_LIST_FREE(efp->styles, str) + if (str) eina_stringshare_del(str); + + if (efp->name) eina_stringshare_del(efp->name); + free(efp); +} + +static Eina_Bool +_font_hash_free_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__) +{ + Elm_Font_Properties *efp; + + efp = data; + _elm_font_properties_free(efp); + return EINA_TRUE; +} + +void +_elm_font_available_hash_del(Eina_Hash *hash) +{ + if (!hash) return; + + eina_hash_foreach(hash, _font_hash_free_cb, NULL); + eina_hash_free(hash); +} + +EAPI Elm_Font_Properties * +elm_font_properties_get(const char *font) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(font, NULL); + return _elm_font_properties_get(NULL, font); +} + +EAPI void +elm_font_properties_free(Elm_Font_Properties *efp) +{ + const char *str; + + EINA_SAFETY_ON_NULL_RETURN(efp); + EINA_LIST_FREE(efp->styles, str) + if (str) eina_stringshare_del(str); + if (efp->name) eina_stringshare_del(efp->name); + free(efp); +} + +EAPI char * +elm_font_fontconfig_name_get(const char *name, + const char *style) +{ + char buf[256]; + + EINA_SAFETY_ON_NULL_RETURN_VAL(name, NULL); + if (!style || style[0] == 0) return (char *) eina_stringshare_add(name); + snprintf(buf, 256, "%s" ELM_FONT_TOKEN_STYLE "%s", name, style); + return (char *) eina_stringshare_add(buf); +} + +EAPI void +elm_font_fontconfig_name_free(char *name) +{ + eina_stringshare_del(name); +} + +EAPI Eina_Hash * +elm_font_available_hash_add(Eina_List *list) +{ + Eina_Hash *font_hash; + Eina_List *l; + void *key; + + font_hash = NULL; + + /* populate with default font families */ + //FIXME: Need to check whether fonts are being added multiple times. + font_hash = _elm_font_available_hash_add(font_hash, "Sans:style=Regular"); + font_hash = _elm_font_available_hash_add(font_hash, "Sans:style=Bold"); + font_hash = _elm_font_available_hash_add(font_hash, "Sans:style=Oblique"); + font_hash = _elm_font_available_hash_add(font_hash, + "Sans:style=Bold Oblique"); + + font_hash = _elm_font_available_hash_add(font_hash, "Serif:style=Regular"); + font_hash = _elm_font_available_hash_add(font_hash, "Serif:style=Bold"); + font_hash = _elm_font_available_hash_add(font_hash, "Serif:style=Oblique"); + font_hash = _elm_font_available_hash_add(font_hash, + "Serif:style=Bold Oblique"); + + font_hash = _elm_font_available_hash_add(font_hash, + "Monospace:style=Regular"); + font_hash = _elm_font_available_hash_add(font_hash, + "Monospace:style=Bold"); + font_hash = _elm_font_available_hash_add(font_hash, + "Monospace:style=Oblique"); + font_hash = _elm_font_available_hash_add(font_hash, + "Monospace:style=Bold Oblique"); + + EINA_LIST_FOREACH(list, l, key) + if (key) _elm_font_available_hash_add(font_hash, key); + + return font_hash; +} + +EAPI void +elm_font_available_hash_del(Eina_Hash *hash) +{ + _elm_font_available_hash_del(hash); +} diff --git a/libraries/elementary/src/lib/elm_font.h b/libraries/elementary/src/lib/elm_font.h new file mode 100644 index 0000000..cf21df7 --- /dev/null +++ b/libraries/elementary/src/lib/elm_font.h @@ -0,0 +1,99 @@ +/** + * @defgroup Fonts Elementary Fonts + * @ingroup Elementary + * + * These are functions dealing with font rendering, selection and the + * like for Elementary applications. One might fetch which system + * fonts are there to use and set custom fonts for individual classes + * of UI items containing text (text classes). + * + * @{ + */ + +typedef struct _Elm_Font_Properties +{ + const char *name; + Eina_List *styles; +} Elm_Font_Properties; + +/** + * Translate a font (family) name string in fontconfig's font names + * syntax into an @c Elm_Font_Properties struct. + * + * @param font The font name and styles string + * @return the font properties struct + * + * @ingroup Fonts + * + * @note The reverse translation can be achieved with + * elm_font_fontconfig_name_get(), for one style only (single font + * instance, not family). + */ +EAPI Elm_Font_Properties *elm_font_properties_get(const char *font); + +/** + * Free font properties return by elm_font_properties_get(). + * + * @param efp the font properties struct + * + * @ingroup Fonts + */ +EAPI void elm_font_properties_free(Elm_Font_Properties *efp); + +/** + * Translate a font name, bound to a style, into fontconfig's font names + * syntax. + * + * @param name The font (family) name + * @param style The given style (may be @c NULL) + * + * @return the font name and style string + * + * @ingroup Fonts + * + * @note The reverse translation can be achieved with + * elm_font_properties_get(), for one style only (single font + * instance, not family). + */ +EAPI char *elm_font_fontconfig_name_get(const char *name, const char *style); + +/** + * Free the font string return by elm_font_fontconfig_name_get(). + * + * @param name the font properties struct + * + * @ingroup Fonts + */ +EAPI void elm_font_fontconfig_name_free(char *name); + +/** + * Create a font hash table of available system fonts. + * + * One must call it with @p list being the return value of + * evas_font_available_list(). The hash will be indexed by font + * (family) names, being its values @c Elm_Font_Properties blobs. + * + * @param list The list of available system fonts, as returned by + * evas_font_available_list(). + * @return the font hash. + * + * @ingroup Fonts + * + * @note The user is supposed to get it populated at least with 3 + * default font families (Sans, Serif, Monospace), which should be + * present on most systems. + */ +EAPI Eina_Hash *elm_font_available_hash_add(Eina_List *list); + +/** + * Free the hash returned by elm_font_available_hash_add(). + * + * @param hash the hash to be freed. + * + * @ingroup Fonts + */ +EAPI void elm_font_available_hash_del(Eina_Hash *hash); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_frame.c b/libraries/elementary/src/lib/elm_frame.c new file mode 100644 index 0000000..0d32c16 --- /dev/null +++ b/libraries/elementary/src/lib/elm_frame.c @@ -0,0 +1,325 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *frm; + Evas_Object *content; + const char *label; + unsigned int recalc_count; + Eina_Bool collapsed : 1; + Eina_Bool collapsible : 1; + Eina_Bool anim : 1; +}; + +static const char SIG_CLICKED[] = "clicked"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CLICKED, ""}, + {NULL, NULL} +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); +static void _theme_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _changed_size_hints(void *data, + Evas *e, Evas_Object *obj, + void *event_info); +static void _sub_del(void *data, Evas_Object *obj, void *event_info); + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->label) eina_stringshare_del(wd->label); + free(wd); +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->frm, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _elm_theme_object_set(obj, wd->frm, "frame", "base", + elm_widget_style_get(obj)); + edje_object_part_text_escaped_set(wd->frm, "elm.text", wd->label); + if (wd->content) + edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content); + edje_object_scale_set(wd->frm, + elm_widget_scale_get(obj) * _elm_config->scale); + _sizing_eval(obj); +} + +static Eina_Bool +_elm_frame_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if ((!wd) || (!wd->content)) + return EINA_FALSE; + + /* Try Focus cycle in subitem */ + return elm_widget_focus_next_get(wd->content, dir, next); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1; + Evas_Coord cminw = -1, cminh = -1; + if (!wd) return; + edje_object_size_min_calc(wd->frm, &minw, &minh); + evas_object_size_hint_min_get(obj, &cminw, &cminh); + if ((minw == cminw) && (minh == cminh)) return; + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, -1, -1); +} + +static void +_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + if (wd->anim) return; + // FIXME: why is this needed? how does edje get this unswallowed or + // lose its callbacks to edje + edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content); + _sizing_eval(data); +} + +static void +_sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *sub = event_info; + if (!wd) return; + if (sub == wd->content) + { + evas_object_event_callback_del_full(sub, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + wd->content = NULL; + _sizing_eval(obj); + } +} + +static void +_elm_frame_label_set(Evas_Object *obj, const char *item, const char *label) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (item && strcmp(item, "default")) return; + if (!wd) return; + eina_stringshare_replace(&(wd->label), label); + edje_object_part_text_escaped_set(wd->frm, "elm.text", wd->label); + _sizing_eval(obj); +} + +static const char * +_elm_frame_label_get(const Evas_Object *obj, const char *item) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (item && strcmp(item, "default")) return NULL; + return wd->label; +} + +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd; + + if (part && strcmp(part, "default")) return; + wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->content == content) return; + if (wd->content) evas_object_del(wd->content); + wd->content = content; + if (content) + { + elm_widget_sub_object_add(obj, content); + evas_object_event_callback_add(content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + edje_object_part_swallow(wd->frm, "elm.swallow.content", content); + } + _sizing_eval(obj); +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + + if (part && strcmp(part, "default")) return NULL; + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + return wd->content; +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + Evas_Object *content; + if (part && strcmp(part, "default")) return NULL; + wd = elm_widget_data_get(obj); + if (!wd || !wd->content) return NULL; + content = wd->content; + elm_widget_sub_object_del(obj, wd->content); + edje_object_part_unswallow(wd->frm, content); + return content; +} + +static void +_recalc(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _sizing_eval(data); +} + +static void +_recalc_done(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *src __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + evas_object_smart_callback_del(wd->frm, "recalc", _recalc); + wd->anim = EINA_FALSE; + _sizing_eval(data); +} + +static void +_signal_click(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *src __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + if (wd->anim) return; + if (wd->collapsible) + { + evas_object_smart_callback_add(wd->frm, "recalc", _recalc, data); + edje_object_signal_emit(wd->frm, "elm,action,toggle", "elm"); + wd->collapsed++; + wd->anim = EINA_TRUE; + } + evas_object_smart_callback_call(data, SIG_CLICKED, NULL); +} + +EAPI Evas_Object * +elm_frame_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "frame"); + elm_widget_type_set(obj, "frame"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_focus_next_hook_set(obj, _elm_frame_focus_next_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); + elm_widget_text_set_hook_set(obj, _elm_frame_label_set); + elm_widget_text_get_hook_set(obj, _elm_frame_label_get); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); + + wd->frm = edje_object_add(e); + _elm_theme_object_set(obj, wd->frm, "frame", "base", "default"); + elm_widget_resize_object_set(obj, wd->frm); + + evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + edje_object_signal_callback_add(wd->frm, "elm,anim,done", "elm", + _recalc_done, obj); + edje_object_signal_callback_add(wd->frm, "elm,action,click", "elm", + _signal_click, obj); + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _sizing_eval(obj); + return obj; +} + +EAPI void +elm_frame_autocollapse_set(Evas_Object *obj, Eina_Bool autocollapse) +{ + Widget_Data *wd; + ELM_CHECK_WIDTYPE(obj, widtype); + wd = elm_widget_data_get(obj); + if (!wd) return; + wd->collapsible = !!autocollapse; +} + +EAPI Eina_Bool +elm_frame_autocollapse_get(const Evas_Object *obj) +{ + Widget_Data *wd; + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->collapsible; +} + +EAPI void +elm_frame_collapse_set(Evas_Object *obj, Eina_Bool collapse) +{ + Widget_Data *wd; + ELM_CHECK_WIDTYPE(obj, widtype); + wd = elm_widget_data_get(obj); + if (!wd) return; + collapse = !!collapse; + if (wd->collapsed == collapse) return; + edje_object_signal_emit(wd->frm, "elm,action,switch", "elm"); + edje_object_message_signal_process(wd->frm); + wd->collapsed = !!collapse; + wd->anim = EINA_FALSE; + _sizing_eval(obj); +} + +EAPI void +elm_frame_collapse_go(Evas_Object *obj, Eina_Bool collapse) +{ + Widget_Data *wd; + ELM_CHECK_WIDTYPE(obj, widtype); + wd = elm_widget_data_get(obj); + if (!wd) return; + collapse = !!collapse; + if (wd->collapsed == collapse) return; + edje_object_signal_emit(wd->frm, "elm,action,toggle", "elm"); + evas_object_smart_callback_add(wd->frm, "recalc", _recalc, obj); + wd->collapsed = collapse; + wd->anim = EINA_TRUE; +} + +EAPI Eina_Bool +elm_frame_collapse_get(const Evas_Object *obj) +{ + Widget_Data *wd; + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->collapsed; +} diff --git a/libraries/elementary/src/lib/elm_frame.h b/libraries/elementary/src/lib/elm_frame.h new file mode 100644 index 0000000..58c3d93 --- /dev/null +++ b/libraries/elementary/src/lib/elm_frame.h @@ -0,0 +1,114 @@ +/** + * @defgroup Frame Frame + * @ingroup Elementary + * + * @image html img/widget/frame/preview-00.png + * @image latex img/widget/frame/preview-00.eps + * + * @brief Frame is a widget that holds some content and has a title. + * + * The default look is a frame with a title, but Frame supports multiple + * styles: + * @li default + * @li pad_small + * @li pad_medium + * @li pad_large + * @li pad_huge + * @li outdent_top + * @li outdent_bottom + * + * Of all this styles only default shows the title. + * + * Smart callbacks one can listen to: + * - @c "clicked" - The user has clicked the frame's label + * + * Default content parts of the frame widget that you can use for are: + * @li "default" - A content of the frame + * + * Default text parts of the frame widget that you can use for are: + * @li "default" - Label of the frame + * + * Supported elm_object common APIs. + * @li @ref elm_object_part_text_set + * @li @ref elm_object_part_text_get + * @li @ref elm_object_part_content_set + * @li @ref elm_object_part_content_get + * @li @ref elm_object_part_content_unset + * + * For a detailed example see the @ref tutorial_frame. + * + * @{ + */ + +/** + * @brief Add a new frame to the parent + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * @ingroup Frame + */ +EAPI Evas_Object *elm_frame_add(Evas_Object *parent); + +/** + * @brief Toggle autocollapsing of a frame + * @param obj The frame + * @param autocollapse Whether to enable autocollapse + * + * When @p enable is EINA_TRUE, clicking a frame's label will collapse the frame + * vertically, shrinking it to the height of the label. + * By default, this is DISABLED. + * + * @ingroup Frame + */ +EAPI void elm_frame_autocollapse_set(Evas_Object *obj, Eina_Bool autocollapse); + +/** + * @brief Determine autocollapsing of a frame + * @param obj The frame + * @return Whether autocollapse is enabled + * + * When this returns EINA_TRUE, clicking a frame's label will collapse the frame + * vertically, shrinking it to the height of the label. + * By default, this is DISABLED. + * + * @ingroup Frame + */ +EAPI Eina_Bool elm_frame_autocollapse_get(const Evas_Object *obj); + +/** + * @brief Manually collapse a frame without animations + * @param obj The frame + * @param collapse true to collapse, false to expand + * + * Use this to toggle the collapsed state of a frame, bypassing animations. + * + * @ingroup Frame + */ +EAPI void elm_frame_collapse_set(Evas_Object *obj, Eina_Bool collapse); + +/** + * @brief Determine the collapse state of a frame + * @param obj The frame + * @return true if collapsed, false otherwise + * + * Use this to determine the collapse state of a frame. + * + * @ingroup Frame + */ +EAPI Eina_Bool elm_frame_collapse_get(const Evas_Object *obj); + +/** + * @brief Manually collapse a frame with animations + * @param obj The frame + * @param collapse true to collapse, false to expand + * + * Use this to toggle the collapsed state of a frame, triggering animations. + * + * @ingroup Frame + */ +EAPI void elm_frame_collapse_go(Evas_Object *obj, Eina_Bool collapse); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_gen.h b/libraries/elementary/src/lib/elm_gen.h new file mode 100644 index 0000000..431f7b1 --- /dev/null +++ b/libraries/elementary/src/lib/elm_gen.h @@ -0,0 +1,63 @@ +typedef struct Elm_Gen_Item Elm_Gen_Item; + +/** + * @struct Elm_Gen_Item_Class + * + * Gengrid or Genlist item class definition. + * field details. + */ +typedef struct _Elm_Gen_Item_Class Elm_Gen_Item_Class; + +/** + * Text fetching class function for Elm_Gen_Item_Class. + * @param data The data passed in the item creation function + * @param obj The base widget object + * @param part The part name of the swallow + * @return The allocated (NOT stringshared) string to set as the text + */ +typedef char *(*Elm_Gen_Item_Text_Get_Cb)(void *data, Evas_Object *obj, const char *part); /**< Label fetching class function for gen item classes. */ + +/** + * Content (swallowed object) fetching class function for Elm_Gen_Item_Class. + * @param data The data passed in the item creation function + * @param obj The base widget object + * @param part The part name of the swallow + * @return The content object to swallow + */ +typedef Evas_Object *(*Elm_Gen_Item_Content_Get_Cb)(void *data, Evas_Object *obj, const char *part); /**< Content(swallowed object) fetching class function for gen item classes. */ + +/** + * State fetching class function for Elm_Gen_Item_Class. + * @param data The data passed in the item creation function + * @param obj The base widget object + * @param part The part name of the swallow + * @return The hell if I know + */ +typedef Eina_Bool (*Elm_Gen_Item_State_Get_Cb)(void *data, Evas_Object *obj, const char *part); /**< State fetching class function for gen item classes. */ + +/** + * Deletion class function for Elm_Gen_Item_Class. + * @param data The data passed in the item creation function + * @param obj The base widget object + */ +typedef void (*Elm_Gen_Item_Del_Cb)(void *data, Evas_Object *obj); /**< Deletion class function for gen item classes. */ + +struct _Elm_Gen_Item_Class +{ + int version; /**< Set by elementary if you alloc an item class using elm_genlist/gengrid_item_class_new(), or if you set your own class (must be const) then set it to ELM_GENLIST/GENGRID_ITEM_CLASS_VERSION */ + unsigned int refcount; /**< Set it to 0 if you use your own const class, or its managed for you by class ref/unref calls */ + Eina_Bool delete_me : 1; /**< Leave this alone - set it to 0 if you have a const class of your own */ + const char *item_style; /**< Name of the visual style to use for this item. If you don't know use "default" */ + const char *decorate_item_style; /**< Style used if item is set to a decorate mode. @see elm_genlist_item_decorate_mode_set() or NULL if you don't care. currently it's used only in genlist. */ + const char *decorate_all_item_style; /**< Style to use when in edit mode, or NULL if you don't care. currently it's used only in genlist. */ + struct + { + Elm_Gen_Item_Text_Get_Cb text_get; /**< Text fetching class function for genlist/gengrid item classes.*/ + Elm_Gen_Item_Content_Get_Cb content_get; /**< Content fetching class function for genlist/gengrid item classes. */ + Elm_Gen_Item_State_Get_Cb state_get; /**< State fetching class function for genlist/gengrid item classes. */ + Elm_Gen_Item_Del_Cb del; /**< Deletion class function for genlist/gengrid item classes. */ + } func; +}; /**< #Elm_Gen_Item_Class member definitions */ + +#define ELM_GEN_ITEM_CLASS_VERSION 2 +#define ELM_GEN_ITEM_CLASS_HEADER ELM_GEN_ITEM_CLASS_VERSION, 0, 0 diff --git a/libraries/elementary/src/lib/elm_gen_common.h b/libraries/elementary/src/lib/elm_gen_common.h new file mode 100644 index 0000000..ec6d03f --- /dev/null +++ b/libraries/elementary/src/lib/elm_gen_common.h @@ -0,0 +1,204 @@ +#ifndef ELM_GEN_H_ +#define ELM_GEN_H_ + +#include +#include +#include "elm_priv.h" + +#define ELM_GEN_ITEM_FROM_INLIST(it) \ + ((it) ? EINA_INLIST_CONTAINER_GET(it, Elm_Gen_Item) : NULL) + +#define SWIPE_MOVES 12 + +typedef struct Elm_Gen_Item_Type Elm_Gen_Item_Type; +typedef struct Elm_Gen_Item_Tooltip Elm_Gen_Item_Tooltip; +typedef struct _Widget_Data Widget_Data; + +struct Elm_Gen_Item_Tooltip +{ + const void *data; + Elm_Tooltip_Item_Content_Cb content_cb; + Evas_Smart_Cb del_cb; + const char *style; + Eina_Bool free_size : 1; +}; + +struct Elm_Gen_Item +{ + ELM_WIDGET_ITEM; + EINA_INLIST; + Widget_Data *wd; + Elm_Gen_Item_Type *item; + const Elm_Gen_Item_Class *itc; + Evas_Coord x, y, dx, dy; + Evas_Object *spacer, *deco_all_view; + Elm_Gen_Item *parent; + Eina_List *texts, *contents, *states, *content_objs; + Ecore_Timer *long_timer; + int relcount; + int walking; + int generation; /**< a generation of an item. when the item is created, this value is set to the value of genlist generation. this value will be decreased when the item is going to be deleted */ + const char *mouse_cursor; + + struct + { + Evas_Smart_Cb func; + const void *data; + } func; + + Elm_Gen_Item_Tooltip tooltip; + Ecore_Cb del_cb, sel_cb, highlight_cb; + Ecore_Cb unsel_cb, unhighlight_cb, unrealize_cb; + + int position; + Elm_Object_Select_Mode select_mode; + + Eina_Bool position_update : 1; + Eina_Bool want_unrealize : 1; + Eina_Bool realized : 1; + Eina_Bool selected : 1; + Eina_Bool highlighted : 1; + Eina_Bool dragging : 1; /**< this is set true when an item is being dragged. this is set false on multidown/mouseup/mousedown. when this is true, the item should not be unrealized. or evas mouse down/up event will be corrupted. */ + Eina_Bool down : 1; + Eina_Bool group : 1; + Eina_Bool reorder : 1; + Eina_Bool decorate_it_set : 1; /**< item uses style mode for highlight/select */ + Eina_Bool flipped : 1; /**< a flag that shows the flip status of the item. */ +}; + +typedef struct _Pan Pan; +struct _Pan +{ + Evas_Object_Smart_Clipped_Data __clipped_data; + Widget_Data *wd; + Ecore_Job *resize_job; +}; + +typedef enum +{ + ELM_GENLIST_TREE_EFFECT_NONE = 0, + ELM_GENLIST_TREE_EFFECT_EXPAND = 1, + ELM_GENLIST_TREE_EFFECT_CONTRACT = 2 +} Elm_Genlist_Item_Move_Effect_Mode; + +struct _Widget_Data +{ + Eina_Inlist_Sorted_State *state; + Evas_Object *obj; /**< the genlist object */ + Evas_Object *scr; /**< a smart scroller object which is used internally in genlist */ + Evas_Object *pan_smart; /**< "elm_genlist_pan" evas smart object. this is an extern pan of smart scroller(scr). */ + Eina_List *selected; /**< a list of selected items */ + Eina_List *group_items; /**< a list of groups index items */ + Eina_Inlist *items; /**< an inlist of all items */ + Elm_Gen_Item *reorder_it; /**< item currently being repositioned */ + Elm_Object_Item *last_selected_item; + Pan *pan; /**< pan_smart object's smart data */ + Ecore_Job *calc_job; + int walking; + int item_width, item_height; + int group_item_width, group_item_height; + int minw, minh; + unsigned int item_count; + Evas_Coord pan_x, pan_y; + Elm_Object_Select_Mode select_mode; + Eina_Bool reorder_mode : 1; /**< a flag for reorder mode enable/disable */ + Eina_Bool on_hold : 1; + Eina_Bool multi : 1; /**< a flag for item multi selection */ + Eina_Bool wasselected : 1; + Eina_Bool highlight : 1; /**< a flag for items can be highlighted or not. by default this flag is true. */ + Eina_Bool clear_me : 1; /**< a flag whether genlist is marked as to be cleared or not. if this flag is true, genlist clear was already deferred. */ + Eina_Bool h_bounce : 1; + Eina_Bool v_bounce : 1; + Ecore_Cb del_cb, calc_cb, sizing_cb; + Ecore_Cb clear_cb; + //////////////////////////////////// + Eina_Inlist *blocks; /**< an inlist of all blocks. a block consists of a certain number of items. maximum number of items in a block is 'max_items_per_block'. */ + Evas_Coord reorder_old_pan_y, w, h, realminw, prev_viewport_w; + Ecore_Job *update_job; + Ecore_Idle_Enterer *queue_idle_enterer; + Ecore_Idler *must_recalc_idler; + Eina_List *queue; + Elm_Gen_Item *show_item, *anchor_item, *mode_item, *reorder_rel, *expanded_item; + Eina_Inlist *item_cache; /**< an inlist of edje object it cache. */ + Evas_Coord anchor_y; + Evas_Coord reorder_start_y; /**< reorder it's initial y coordinate in the pan. */ + Elm_List_Mode mode; + Ecore_Timer *multi_timer, *scr_hold_timer; + Ecore_Animator *reorder_move_animator; + const char *decorate_it_type; + double start_time; + Evas_Coord prev_x, prev_y, prev_mx, prev_my; + Evas_Coord cur_x, cur_y, cur_mx, cur_my; + Eina_Bool mouse_down : 1; + Eina_Bool multi_down : 1; + Eina_Bool multi_timeout : 1; + Eina_Bool multitouched : 1; + Eina_Bool longpressed : 1; + Eina_Bool bring_in : 1; /**< a flag to describe the scroll animation. (show, bring in) */ + Eina_Bool height_for_width : 1; + Eina_Bool homogeneous : 1; + Eina_Bool swipe : 1; + Eina_Bool decorate_all_mode : 1; + Eina_Bool reorder_pan_move : 1; + Eina_Bool auto_scroll_enabled : 1; + Eina_Bool pan_changed : 1; + Eina_Bool requeued : 1; /**< this is set to EINA_TRUE when the item is re-queued. this happens when the item is un-queued but the rel item is still in the queue. this item will be processed later. */ + Eina_Bool check_scroll : 1; /**< this flag means genlist is supposed to be scrolled. if this flag is set to EINA_TRUE, genlist checks whether it's ok to scroll genlist now or not. */ + Eina_Bool tree_effect_enabled : 1; /**< tree effect */ + struct + { + Evas_Coord x, y; + } history[SWIPE_MOVES]; + int multi_device; + int item_cache_count; + int item_cache_max; /**< maximum number of cached items */ + int movements; + int max_items_per_block; /**< maximum number of items per block */ + double longpress_timeout; /**< longpress timeout. this value comes from _elm_config by default. this can be changed by elm_genlist_longpress_timeout_set() */ + int generation; /**< a generation of genlist. when genlist is cleared, this value will be increased and a new generation will start */ + Eina_Compare_Cb item_compare_cb; + Eina_Compare_Cb item_compare_data_cb; + Elm_Genlist_Item_Scrollto_Type scrollto_type; /**< a scrollto type which remembers where to scroll ex) in, top, middle */ + Evas_Object *alpha_bg; /**< not to receive event when tree effect is not finished */ + Eina_List *move_items; /**< items move for tree effect */ + Elm_Gen_Item *expanded_next_item; + Ecore_Animator *tree_effect_animator; /**< tree effect animator */ + Elm_Genlist_Item_Move_Effect_Mode move_effect_mode; + + /* The stuff below directly come from gengrid without any thinking */ + unsigned int nmax; + Evas_Coord reorder_item_x, reorder_item_y; + Evas_Coord old_pan_x, old_pan_y; + long items_lost; + double align_x, align_y; + + Eina_Bool horizontal : 1; + Eina_Bool move_effect_enabled : 1; + Eina_Bool reorder_item_changed : 1; + Eina_Bool filled : 1; +}; + +Elm_Gen_Item *_elm_genlist_item_new(Widget_Data *wd, const Elm_Gen_Item_Class *itc, const void *data, Elm_Gen_Item *parent, Evas_Smart_Cb func, const void *func_data); + +Evas_Object *_elm_genlist_item_widget_get(const Elm_Gen_Item *it); + +void _elm_genlist_page_relative_set(Evas_Object *obj, double h_pagerel, double v_pagerel); + +void _elm_genlist_page_relative_get(const Evas_Object *obj, double *h_pagerel, double *v_pagerel); + +void _elm_genlist_page_size_set(Evas_Object *obj, Evas_Coord h_pagesize, Evas_Coord v_pagesize); + +void _elm_genlist_current_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber); + +void _elm_genlist_last_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber); + +void _elm_genlist_page_show(const Evas_Object *obj, int h_pagenumber, int v_pagenumber); + +void _elm_genlist_page_bring_in(const Evas_Object *obj, int h_pagenumber, int v_pagenumber); + +void _elm_genlist_item_unrealize(Elm_Gen_Item *it, Eina_Bool calc); +void _elm_genlist_item_del_serious(Elm_Gen_Item *it); + +void _elm_genlist_item_del_notserious(Elm_Gen_Item *it); + +#endif diff --git a/libraries/elementary/src/lib/elm_general.h b/libraries/elementary/src/lib/elm_general.h new file mode 100644 index 0000000..08cd205 --- /dev/null +++ b/libraries/elementary/src/lib/elm_general.h @@ -0,0 +1,365 @@ +/** + * @defgroup General General + * @ingroup Elementary + * + * @brief General Elementary API. Functions that don't relate to + * Elementary objects specifically. + * + * Here are documented functions which init/shutdown the library, + * that apply to generic Elementary objects, that deal with + * configuration, et cetera. + * + * @ref general_functions_example_page "This" example contemplates + * some of these functions. + */ + +/** + * @addtogroup General + * @{ + */ + +/** + * Defines couple of standard Evas_Object layers to be used + * with evas_object_layer_set(). + * + * @note whenever extending with new values, try to keep some padding + * to siblings so there is room for further extensions. + */ +typedef enum +{ + ELM_OBJECT_LAYER_BACKGROUND = EVAS_LAYER_MIN + 64, /**< where to place backgrounds */ + ELM_OBJECT_LAYER_DEFAULT = 0, /**< Evas_Object default layer (and thus for Elementary) */ + ELM_OBJECT_LAYER_FOCUS = EVAS_LAYER_MAX - 128, /**< where focus object visualization is */ + ELM_OBJECT_LAYER_TOOLTIP = EVAS_LAYER_MAX - 64, /**< where to show tooltips */ + ELM_OBJECT_LAYER_CURSOR = EVAS_LAYER_MAX - 32, /**< where to show cursors */ + ELM_OBJECT_LAYER_LAST /**< last layer known by Elementary */ +} Elm_Object_Layer; + +/**************************************************************************/ +EAPI extern int ELM_ECORE_EVENT_ETHUMB_CONNECT; + +/** + * Emitted when the application has reconfigured elementary settings due + * to an external configuration tool asking it to. + */ +EAPI extern int ELM_EVENT_CONFIG_ALL_CHANGED; + +/** + * Emitted when any Elementary's policy value is changed. + */ +EAPI extern int ELM_EVENT_POLICY_CHANGED; + +/** + * @typedef Elm_Event_Policy_Changed + * + * Data on the event when an Elementary policy has changed + */ +typedef struct _Elm_Event_Policy_Changed Elm_Event_Policy_Changed; + +/** + * @struct _Elm_Event_Policy_Changed + * + * Data on the event when an Elementary policy has changed + */ +struct _Elm_Event_Policy_Changed +{ + unsigned int policy; /**< the policy identifier */ + int new_value; /**< value the policy had before the change */ + int old_value; /**< new value the policy got */ +}; + +/** + * Policy identifiers. + */ +typedef enum +{ + ELM_POLICY_QUIT, /**< under which circumstances the application + * should quit automatically. @see + * Elm_Policy_Quit. + */ + ELM_POLICY_LAST +} Elm_Policy; /**< Elementary policy identifiers/groups enumeration. @see elm_policy_set() */ + +typedef enum +{ + ELM_POLICY_QUIT_NONE = 0, /**< never quit the application + * automatically */ + ELM_POLICY_QUIT_LAST_WINDOW_CLOSED /**< quit when the + * application's last + * window is closed */ +} Elm_Policy_Quit; /**< Possible values for the #ELM_POLICY_QUIT policy */ + +typedef enum +{ + ELM_FOCUS_PREVIOUS, + ELM_FOCUS_NEXT +} Elm_Focus_Direction; + +typedef enum +{ + ELM_OBJECT_SELECT_MODE_DEFAULT = 0, /**< default select mode */ + ELM_OBJECT_SELECT_MODE_ALWAYS, /**< always select mode */ + ELM_OBJECT_SELECT_MODE_NONE, /**< no select mode */ + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY, /**< no select mode with no finger size rule*/ + ELM_OBJECT_SELECT_MODE_MAX +} Elm_Object_Select_Mode; + +/** + * @typedef Elm_Object_Item + * An Elementary Object item handle. + * @ingroup General + */ +typedef struct _Elm_Object_Item Elm_Object_Item; + +typedef Eina_Bool (*Elm_Event_Cb)(void *data, Evas_Object *obj, Evas_Object *src, Evas_Callback_Type type, void *event_info); /**< Function prototype definition for callbacks on input events happening on Elementary widgets. @a data will receive the user data pointer passed to elm_object_event_callback_add(). @a src will be a pointer to the widget on which the input event took place. @a type will get the type of this event and @a event_info, the struct with details on this event. */ + +#ifndef ELM_LIB_QUICKLAUNCH +#define ELM_MAIN() int main(int argc, char **argv) {elm_init(argc, argv); return elm_main(argc, argv); } /**< macro to be used after the elm_main() function */ +#else +#define ELM_MAIN() int main(int argc, char **argv) {return elm_quicklaunch_fallback(argc, argv); } /**< macro to be used after the elm_main() function */ +#endif + +/**************************************************************************/ +/* General calls */ + +/** + * Initialize Elementary + * + * @param[in] argc System's argument count value + * @param[in] argv System's pointer to array of argument strings + * @return The init counter value. + * + * This function initializes Elementary and increments a counter of + * the number of calls to it. It returns the new counter's value. + * + * @warning This call is exported only for use by the @c ELM_MAIN() + * macro. There is no need to use this if you use this macro (which + * is highly advisable). An elm_main() should contain the entry + * point code for your application, having the same prototype as + * elm_init(), and @b not being static (putting the @c EAPI_MAIN symbol + * in front of its type declaration is advisable). The @c + * ELM_MAIN() call should be placed just after it. + * + * Example: + * @dontinclude bg_example_01.c + * @skip static void + * @until ELM_MAIN + * + * See the full @ref bg_example_01_c "example". + * + * @see elm_shutdown(). + * @ingroup General + */ +EAPI int elm_init(int argc, char **argv); + +/** + * Shut down Elementary + * + * @return The init counter value. + * + * This should be called at the end of your application, just + * before it ceases to do any more processing. This will clean up + * any permanent resources your application may have allocated via + * Elementary that would otherwise persist. + * + * @see elm_init() for an example + * + * @ingroup General + */ +EAPI int elm_shutdown(void); + +/** + * Run Elementary's main loop + * + * This call should be issued just after all initialization is + * completed. This function will not return until elm_exit() is + * called. It will keep looping, running the main + * (event/processing) loop for Elementary. + * + * @see elm_init() for an example + * + * @ingroup General + */ +EAPI void elm_run(void); + +/** + * Exit Elementary's main loop + * + * If this call is issued, it will flag the main loop to cease + * processing and return back to its parent function (usually your + * elm_main() function). + * + * @see elm_init() for an example. There, just after a request to + * close the window comes, the main loop will be left. + * + * @note By using the appropriate #ELM_POLICY_QUIT on your Elementary + * applications, you'll be able to get this function called automatically for you. + * + * @ingroup General + */ +EAPI void elm_exit(void); + +/** + * Exposed symbol used only by macros and should not be used by apps + */ +EAPI void elm_quicklaunch_mode_set(Eina_Bool ql_on); + +/** + * Exposed symbol used only by macros and should not be used by apps + */ +EAPI Eina_Bool elm_quicklaunch_mode_get(void); + +/** + * Exposed symbol used only by macros and should not be used by apps + */ +EAPI int elm_quicklaunch_init(int argc, char **argv); + +/** + * Exposed symbol used only by macros and should not be used by apps + */ +EAPI int elm_quicklaunch_sub_init(int argc, char **argv); + +/** + * Exposed symbol used only by macros and should not be used by apps + */ +EAPI int elm_quicklaunch_sub_shutdown(void); + +/** + * Exposed symbol used only by macros and should not be used by apps + */ +EAPI int elm_quicklaunch_shutdown(void); + +/** + * Exposed symbol used only by macros and should not be used by apps + */ +EAPI void elm_quicklaunch_seed(void); + +/** + * Exposed symbol used only by macros and should not be used by apps + */ +EAPI Eina_Bool elm_quicklaunch_prepare(int argc, char **argv); + +/** + * Exposed symbol used only by macros and should not be used by apps + */ +EAPI Eina_Bool elm_quicklaunch_fork(int argc, char **argv, char *cwd, void (postfork_func) (void *data), void *postfork_data); + +/** + * Exposed symbol used only by macros and should not be used by apps + */ +EAPI void elm_quicklaunch_cleanup(void); + +/** + * Exposed symbol used only by macros and should not be used by apps + */ +EAPI int elm_quicklaunch_fallback(int argc, char **argv); + +/** + * Exposed symbol used only by macros and should not be used by apps + */ +EAPI char *elm_quicklaunch_exe_path_get(const char *exe); + +/** + * Set a new policy's value (for a given policy group/identifier). + * + * @param policy policy identifier, as in @ref Elm_Policy. + * @param value policy value, which depends on the identifier + * + * @return @c EINA_TRUE on success or @c EINA_FALSE, on error. + * + * Elementary policies define applications' behavior, + * somehow. These behaviors are divided in policy groups (see + * #Elm_Policy enumeration). This call will emit the Ecore event + * #ELM_EVENT_POLICY_CHANGED, which can be hooked at with + * handlers. An #Elm_Event_Policy_Changed struct will be passed, + * then. + * + * @note Currently, we have only one policy identifier/group + * (#ELM_POLICY_QUIT), which has two possible values. + * + * @ingroup General + */ +EAPI Eina_Bool elm_policy_set(unsigned int policy, int value); + +/** + * Gets the policy value for given policy identifier. + * + * @param policy policy identifier, as in #Elm_Policy. + * @return The currently set policy value, for that + * identifier. Will be @c 0 if @p policy passed is invalid. + * + * @ingroup General + */ +EAPI int elm_policy_get(unsigned int policy); + +/** + * Change the language of the current application + * + * The @p lang passed must be the full name of the locale to use, for + * example "en_US.utf8" or "es_ES@euro". + * + * Changing language with this function will make Elementary run through + * all its widgets, translating strings set with + * elm_object_domain_translatable_text_part_set(). This way, an entire + * UI can have its language changed without having to restart the program. + * + * For more complex cases, like having formatted strings that need + * translation, widgets will also emit a "language,changed" signal that + * the user can listen to to manually translate the text. + * + * @param lang Language to set, must be the full name of the locale + * + * @ingroup General + */ +EAPI void elm_language_set(const char *lang); + +/** + * Set the text for an objects' part, marking it as translatable. + * + * The string to set as @p text must be the original one. Do not pass the + * return of @c gettext() here. Elementary will translate the string + * internally and set it on the object using elm_object_part_text_set(), + * also storing the original string so that it can be automatically + * translated when the language is changed with elm_language_set(). + * + * The @p domain will be stored along to find the translation in the + * correct catalog. It can be NULL, in which case it will use whatever + * domain was set by the application with @c textdomain(). This is useful + * in case you are building a library on top of Elementary that will have + * its own translatable strings, that should not be mixed with those of + * programs using the library. + * + * @param obj The object containing the text part + * @param part The name of the part to set + * @param domain The translation domain to use + * @param text The original, non-translated text to set + * + * @ingroup General + */ +EAPI void elm_object_domain_translatable_text_part_set(Evas_Object *obj, const char *part, const char *domain, const char *text); + +#define elm_object_domain_translatable_text_set(obj, domain, text) elm_object_domain_translatable_text_part_set((obj), NULL, (domain), (text)) + +#define elm_object_translatable_text_set(obj, text) elm_object_domain_translatable_text_part_set((obj), NULL, NULL, (text)) + +/** + * Gets the original string set as translatable for an object + * + * When setting translated strings, the function elm_object_part_text_get() + * will return the translation returned by @c gettext(). To get the + * original string use this function. + * + * @param obj The object + * @param part The name of the part that was set + * + * @return The original, untranslated string + * + * @ingroup General + */ +EAPI const char *elm_object_translatable_text_part_get(const Evas_Object *obj, const char *part); + +#define elm_object_translatable_text_get(obj) elm_object_translatable_text_part_get((obj), NULL) + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_gengrid.c b/libraries/elementary/src/lib/elm_gengrid.c new file mode 100644 index 0000000..8ee50c4 --- /dev/null +++ b/libraries/elementary/src/lib/elm_gengrid.c @@ -0,0 +1,2869 @@ +#include +#include +#include "elm_priv.h" +#include "els_scroller.h" +#include "elm_gen_common.h" + +// internally allocated +#define CLASS_ALLOCATED 0x3a70f00f + +/* -- + * TODO: + * Handle non-homogeneous objects too. + */ + +#define PRELOAD 1 +#define REORDER_EFFECT_TIME 0.5 + +#define ELM_GEN_SETUP(wd) \ + (wd)->calc_cb = (Ecore_Cb)_calc_job + +#define ELM_GEN_ITEM_SETUP(it) \ + (it)->del_cb = (Ecore_Cb)_item_del; \ + (it)->highlight_cb = (Ecore_Cb)_item_highlight; \ + (it)->unsel_cb = (Ecore_Cb)_item_unselect; \ + (it)->unrealize_cb = (Ecore_Cb)_item_unrealize_cb + +struct Elm_Gen_Item_Type +{ + Elm_Gen_Item *it; + Ecore_Animator *item_reorder_move_animator; + Evas_Coord gx, gy, ox, oy, tx, ty, rx, ry; + unsigned int moving_effect_start_time; + int prev_group; + + Eina_Bool group_realized : 1; + Eina_Bool moving : 1; +}; + +static const char *widtype = NULL; +static void _item_highlight(Elm_Gen_Item *it); +static void _item_unrealize_cb(Elm_Gen_Item *it); +static void _item_unselect(Elm_Gen_Item *it); +static void _calc_job(void *data); +static void _on_focus_hook(void *data, + Evas_Object *obj); +static Eina_Bool _item_multi_select_up(Widget_Data *wd); +static Eina_Bool _item_multi_select_down(Widget_Data *wd); +static Eina_Bool _item_multi_select_left(Widget_Data *wd); +static Eina_Bool _item_multi_select_right(Widget_Data *wd); +static Eina_Bool _item_single_select_up(Widget_Data *wd); +static Eina_Bool _item_single_select_down(Widget_Data *wd); +static Eina_Bool _item_single_select_left(Widget_Data *wd); +static Eina_Bool _item_single_select_right(Widget_Data *wd); +static Eina_Bool _event_hook(Evas_Object *obj, + Evas_Object *src, + Evas_Callback_Type type, + void *event_info); +static Eina_Bool _deselect_all_items(Widget_Data *wd); + +static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION; +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); + +static const char SIG_ACTIVATED[] = "activated"; +static const char SIG_CLICKED_DOUBLE[] = "clicked,double"; +static const char SIG_LONGPRESSED[] = "longpressed"; +static const char SIG_SELECTED[] = "selected"; +static const char SIG_UNSELECTED[] = "unselected"; +static const char SIG_REALIZED[] = "realized"; +static const char SIG_UNREALIZED[] = "unrealized"; +static const char SIG_CHANGED[] = "changed"; +static const char SIG_DRAG_START_UP[] = "drag,start,up"; +static const char SIG_DRAG_START_DOWN[] = "drag,start,down"; +static const char SIG_DRAG_START_LEFT[] = "drag,start,left"; +static const char SIG_DRAG_START_RIGHT[] = "drag,start,right"; +static const char SIG_DRAG_STOP[] = "drag,stop"; +static const char SIG_DRAG[] = "drag"; +static const char SIG_SCROLL[] = "scroll"; +static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start"; +static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop"; +static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start"; +static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop"; +static const char SIG_EDGE_TOP[] = "edge,top"; +static const char SIG_EDGE_BOTTOM[] = "edge,bottom"; +static const char SIG_EDGE_LEFT[] = "edge,left"; +static const char SIG_EDGE_RIGHT[] = "edge,right"; +static const char SIG_MOVED[] = "moved"; +static const char SIG_INDEX_UPDATE[] = "index,update"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_ACTIVATED, ""}, + {SIG_CLICKED_DOUBLE, ""}, + {SIG_LONGPRESSED, ""}, + {SIG_SELECTED, ""}, + {SIG_UNSELECTED, ""}, + {SIG_REALIZED, ""}, + {SIG_UNREALIZED, ""}, + {SIG_CHANGED, ""}, + {SIG_DRAG_START_UP, ""}, + {SIG_DRAG_START_DOWN, ""}, + {SIG_DRAG_START_LEFT, ""}, + {SIG_DRAG_START_RIGHT, ""}, + {SIG_DRAG_STOP, ""}, + {SIG_DRAG, ""}, + {SIG_SCROLL, ""}, + {SIG_SCROLL_ANIM_START, ""}, + {SIG_SCROLL_ANIM_STOP, ""}, + {SIG_SCROLL_DRAG_START, ""}, + {SIG_SCROLL_DRAG_STOP, ""}, + {SIG_EDGE_TOP, ""}, + {SIG_EDGE_BOTTOM, ""}, + {SIG_EDGE_LEFT, ""}, + {SIG_EDGE_RIGHT, ""}, + {SIG_MOVED, ""}, + {NULL, NULL} +}; + +static Eina_Bool +_event_hook(Evas_Object *obj, + Evas_Object *src __UNUSED__, + Evas_Callback_Type type, + void *event_info) +{ + if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE; + Evas_Event_Key_Down *ev = event_info; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + if (!wd->items) return EINA_FALSE; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; + if (elm_widget_disabled_get(obj)) return EINA_FALSE; + + Elm_Object_Item *it = NULL; + Evas_Coord x = 0; + Evas_Coord y = 0; + Evas_Coord step_x = 0; + Evas_Coord step_y = 0; + Evas_Coord v_w = 0; + Evas_Coord v_h = 0; + Evas_Coord page_x = 0; + Evas_Coord page_y = 0; + + elm_smart_scroller_child_pos_get(wd->scr, &x, &y); + elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y); + elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y); + elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h); + + if ((!strcmp(ev->keyname, "Left")) || + ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string))) + { + if ((wd->horizontal) && + (((evas_key_modifier_is_set(ev->modifiers, "Shift")) && + (_item_multi_select_up(wd))) + || (_item_single_select_up(wd)))) + { + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else if ((!wd->horizontal) && + (((evas_key_modifier_is_set(ev->modifiers, "Shift")) && + (_item_multi_select_left(wd))) + || (_item_single_select_left(wd)))) + { + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else + x -= step_x; + } + else if ((!strcmp(ev->keyname, "Right")) || + ((!strcmp(ev->keyname, "KP_Right")) && (!ev->string))) + { + if ((wd->horizontal) && + (((evas_key_modifier_is_set(ev->modifiers, "Shift")) && + (_item_multi_select_down(wd))) + || (_item_single_select_down(wd)))) + { + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else if ((!wd->horizontal) && + (((evas_key_modifier_is_set(ev->modifiers, "Shift")) && + (_item_multi_select_right(wd))) + || (_item_single_select_right(wd)))) + { + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else + x += step_x; + } + else if ((!strcmp(ev->keyname, "Up")) || + ((!strcmp(ev->keyname, "KP_Up")) && (!ev->string))) + { + if ((wd->horizontal) && + (((evas_key_modifier_is_set(ev->modifiers, "Shift")) && + (_item_multi_select_left(wd))) + || (_item_single_select_left(wd)))) + { + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else if ((!wd->horizontal) && + (((evas_key_modifier_is_set(ev->modifiers, "Shift")) && + (_item_multi_select_up(wd))) + || (_item_single_select_up(wd)))) + { + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else + y -= step_y; + } + else if ((!strcmp(ev->keyname, "Down")) || + ((!strcmp(ev->keyname, "KP_Down")) && (!ev->string))) + { + if ((wd->horizontal) && + (((evas_key_modifier_is_set(ev->modifiers, "Shift")) && + (_item_multi_select_right(wd))) + || (_item_single_select_right(wd)))) + { + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else if ((!wd->horizontal) && + (((evas_key_modifier_is_set(ev->modifiers, "Shift")) && + (_item_multi_select_down(wd))) + || (_item_single_select_down(wd)))) + { + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else + y += step_y; + } + else if ((!strcmp(ev->keyname, "Home")) || + ((!strcmp(ev->keyname, "KP_Home")) && (!ev->string))) + { + it = elm_gengrid_first_item_get(obj); + elm_gengrid_item_bring_in(it, ELM_GENGRID_ITEM_SCROLLTO_IN); + elm_gengrid_item_selected_set(it, EINA_TRUE); + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else if ((!strcmp(ev->keyname, "End")) || + ((!strcmp(ev->keyname, "KP_End")) && (!ev->string))) + { + it = elm_gengrid_last_item_get(obj); + elm_gengrid_item_bring_in(it, ELM_GENGRID_ITEM_SCROLLTO_IN); + elm_gengrid_item_selected_set(it, EINA_TRUE); + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else if ((!strcmp(ev->keyname, "Prior")) || + ((!strcmp(ev->keyname, "KP_Prior")) && (!ev->string))) + { + if (wd->horizontal) + { + if (page_x < 0) + x -= -(page_x * v_w) / 100; + else + x -= page_x; + } + else + { + if (page_y < 0) + y -= -(page_y * v_h) / 100; + else + y -= page_y; + } + } + else if ((!strcmp(ev->keyname, "Next")) || + ((!strcmp(ev->keyname, "KP_Next")) && (!ev->string))) + { + if (wd->horizontal) + { + if (page_x < 0) + x += -(page_x * v_w) / 100; + else + x += page_x; + } + else + { + if (page_y < 0) + y += -(page_y * v_h) / 100; + else + y += page_y; + } + } + else if (!strcmp(ev->keyname, "Escape")) + { + if (!_deselect_all_items(wd)) return EINA_FALSE; + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else if (((!strcmp(ev->keyname, "Return")) || + (!strcmp(ev->keyname, "KP_Enter")) || + (!strcmp(ev->keyname, "space"))) + && (!wd->multi) && (wd->selected)) + { + it = elm_gengrid_selected_item_get(obj); + evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it); + } + else return EINA_FALSE; + + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + elm_smart_scroller_child_pos_set(wd->scr, x, y); + return EINA_TRUE; +} + +static Eina_Bool +_deselect_all_items(Widget_Data *wd) +{ + if (!wd->selected) return EINA_FALSE; + while (wd->selected) + elm_gengrid_item_selected_set((Elm_Object_Item *) wd->selected->data, + EINA_FALSE); + + return EINA_TRUE; +} + +static Eina_Bool +_item_multi_select_left(Widget_Data *wd) +{ + if (!wd->selected) return EINA_FALSE; + + Elm_Object_Item *prev = + elm_gengrid_item_prev_get(wd->last_selected_item); + if (!prev) return EINA_TRUE; + if (elm_gengrid_item_selected_get(prev)) + { + elm_gengrid_item_selected_set(wd->last_selected_item, EINA_FALSE); + wd->last_selected_item = prev; + elm_gengrid_item_show(wd->last_selected_item, ELM_GENGRID_ITEM_SCROLLTO_IN); + } + else + { + elm_gengrid_item_selected_set(prev, EINA_TRUE); + elm_gengrid_item_show(prev, ELM_GENGRID_ITEM_SCROLLTO_IN); + } + + return EINA_TRUE; +} + +static Eina_Bool +_item_multi_select_right(Widget_Data *wd) +{ + if (!wd->selected) return EINA_FALSE; + + Elm_Object_Item *next = + elm_gengrid_item_next_get(wd->last_selected_item); + if (!next) return EINA_TRUE; + if (elm_gengrid_item_selected_get(next)) + { + elm_gengrid_item_selected_set(wd->last_selected_item, EINA_FALSE); + wd->last_selected_item = next; + elm_gengrid_item_show(wd->last_selected_item, ELM_GENGRID_ITEM_SCROLLTO_IN); + } + else + { + elm_gengrid_item_selected_set(next, EINA_TRUE); + elm_gengrid_item_show(next, ELM_GENGRID_ITEM_SCROLLTO_IN); + } + + return EINA_TRUE; +} + +static Eina_Bool +_item_multi_select_up(Widget_Data *wd) +{ + unsigned int i; + Eina_Bool r = EINA_TRUE; + + if (!wd->selected) return EINA_FALSE; + + for (i = 0; (r) && (i < wd->nmax); i++) + r &= _item_multi_select_left(wd); + + return r; +} + +static Eina_Bool +_item_multi_select_down(Widget_Data *wd) +{ + unsigned int i; + Eina_Bool r = EINA_TRUE; + + if (!wd->selected) return EINA_FALSE; + + for (i = 0; (r) && (i < wd->nmax); i++) + r &= _item_multi_select_right(wd); + + return r; +} + +static Eina_Bool +_item_single_select_up(Widget_Data *wd) +{ + unsigned int i; + + Elm_Gen_Item *prev; + + if (!wd->selected) + { + prev = ELM_GEN_ITEM_FROM_INLIST(wd->items->last); + while ((prev) && (prev->generation < wd->generation)) + prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev); + elm_gengrid_item_selected_set((Elm_Object_Item *) prev, EINA_TRUE); + elm_gengrid_item_show((Elm_Object_Item *) prev, ELM_GENGRID_ITEM_SCROLLTO_IN); + return EINA_TRUE; + } + else + prev = (Elm_Gen_Item *) elm_gengrid_item_prev_get(wd->last_selected_item); + + if (!prev) return EINA_FALSE; + + for (i = 1; i < wd->nmax; i++) + { + Elm_Object_Item *tmp = + elm_gengrid_item_prev_get((Elm_Object_Item *) prev); + if (!tmp) return EINA_FALSE; + prev = (Elm_Gen_Item *) tmp; + } + + _deselect_all_items(wd); + + elm_gengrid_item_selected_set((Elm_Object_Item *) prev, EINA_TRUE); + elm_gengrid_item_show((Elm_Object_Item *) prev, ELM_GENGRID_ITEM_SCROLLTO_IN); + return EINA_TRUE; +} + +static Eina_Bool +_item_single_select_down(Widget_Data *wd) +{ + unsigned int i; + + Elm_Gen_Item *next; + + if (!wd->selected) + { + next = ELM_GEN_ITEM_FROM_INLIST(wd->items); + while ((next) && (next->generation < wd->generation)) + next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next); + elm_gengrid_item_selected_set((Elm_Object_Item *) next, EINA_TRUE); + elm_gengrid_item_show((Elm_Object_Item *) next, ELM_GENGRID_ITEM_SCROLLTO_IN); + return EINA_TRUE; + } + else + next = (Elm_Gen_Item *) elm_gengrid_item_next_get(wd->last_selected_item); + + if (!next) return EINA_FALSE; + + for (i = 1; i < wd->nmax; i++) + { + Elm_Object_Item *tmp = + elm_gengrid_item_next_get((Elm_Object_Item *) next); + if (!tmp) return EINA_FALSE; + next = (Elm_Gen_Item *) tmp; + } + + _deselect_all_items(wd); + + elm_gengrid_item_selected_set((Elm_Object_Item *) next, EINA_TRUE); + elm_gengrid_item_show((Elm_Object_Item *) next, ELM_GENGRID_ITEM_SCROLLTO_IN); + return EINA_TRUE; +} + +static Eina_Bool +_item_single_select_left(Widget_Data *wd) +{ + Elm_Gen_Item *prev; + if (!wd->selected) + { + prev = ELM_GEN_ITEM_FROM_INLIST(wd->items->last); + while ((prev) && (prev->generation < wd->generation)) + prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev); + } + else + prev = (Elm_Gen_Item *) elm_gengrid_item_prev_get(wd->last_selected_item); + + if (!prev) return EINA_FALSE; + + _deselect_all_items(wd); + + elm_gengrid_item_selected_set((Elm_Object_Item *) prev, EINA_TRUE); + elm_gengrid_item_show((Elm_Object_Item *) prev, ELM_GENGRID_ITEM_SCROLLTO_IN); + return EINA_TRUE; +} + +static Eina_Bool +_item_single_select_right(Widget_Data *wd) +{ + Elm_Gen_Item *next; + if (!wd->selected) + { + next = ELM_GEN_ITEM_FROM_INLIST(wd->items); + while ((next) && (next->generation < wd->generation)) + next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next); + } + else + next = (Elm_Gen_Item *) elm_gengrid_item_next_get(wd->last_selected_item); + + if (!next) return EINA_FALSE; + + _deselect_all_items(wd); + + elm_gengrid_item_selected_set((Elm_Object_Item *) next, EINA_TRUE); + elm_gengrid_item_show((Elm_Object_Item *) next, ELM_GENGRID_ITEM_SCROLLTO_IN); + return EINA_TRUE; +} + +static void +_on_focus_hook(void *data __UNUSED__, + Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (elm_widget_focus_get(obj)) + { + edje_object_signal_emit(wd->obj, "elm,action,focus", "elm"); + evas_object_focus_set(wd->obj, EINA_TRUE); + if ((wd->selected) && (!wd->last_selected_item)) + wd->last_selected_item = eina_list_data_get(wd->selected); + } + else + { + edje_object_signal_emit(wd->obj, "elm,action,unfocus", "elm"); + evas_object_focus_set(wd->obj, EINA_FALSE); + } +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Gen_Item *it; + if (!wd) return; + elm_smart_scroller_mirrored_set(wd->scr, rtl); + if (!wd->items) return; + it = ELM_GEN_ITEM_FROM_INLIST(wd->items); + + while (it) + { + edje_object_mirrored_set(VIEW(it), rtl); + elm_gengrid_item_update((Elm_Object_Item *)it); + it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next); + } +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + elm_smart_scroller_object_theme_set(obj, wd->scr, "gengrid", "base", + elm_widget_style_get(obj)); +} + +static void +_del_pre_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_gengrid_clear(obj); + evas_object_del(wd->pan_smart); + wd->pan_smart = NULL; +} + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (wd->calc_job) ecore_job_del(wd->calc_job); + free(wd); +} + +static void +_signal_emit_hook(Evas_Object *obj, + const char *emission, + const char *source) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), + emission, source); +} + +static void +_signal_callback_add_hook(Evas_Object *obj, + const char *emission, + const char *source, + Edje_Signal_Cb func_cb, + void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_signal_callback_add(elm_smart_scroller_edje_object_get(wd->scr), + emission, source, func_cb, data); +} + +static void +_signal_callback_del_hook(Evas_Object *obj, + const char *emission, + const char *source, + Edje_Signal_Cb func_cb, + void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_signal_callback_del_full(elm_smart_scroller_edje_object_get(wd->scr), + emission, source, func_cb, data); +} + +static void +_mouse_move(void *data, + Evas *evas __UNUSED__, + Evas_Object *obj, + void *event_info) +{ + Elm_Gen_Item *it = data; + Evas_Event_Mouse_Move *ev = event_info; + Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady; + Evas_Coord ox, oy, ow, oh, it_scrl_x, it_scrl_y; + + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) + { + if (!it->wd->on_hold) + { + it->wd->on_hold = EINA_TRUE; + if (!it->wd->wasselected) + _item_unselect(it); + } + } + if ((it->dragging) && (it->down)) + { + if (it->long_timer) + { + ecore_timer_del(it->long_timer); + it->long_timer = NULL; + } + evas_object_smart_callback_call(WIDGET(it), SIG_DRAG, it); + return; + } + if ((!it->down) || (it->wd->longpressed)) + { + if (it->long_timer) + { + ecore_timer_del(it->long_timer); + it->long_timer = NULL; + } + if ((it->wd->reorder_mode) && (it->wd->reorder_it)) + { + evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh); + + it_scrl_x = ev->cur.canvas.x - it->wd->reorder_it->dx; + it_scrl_y = ev->cur.canvas.y - it->wd->reorder_it->dy; + + if (it_scrl_x < ox) it->wd->reorder_item_x = ox; + else if (it_scrl_x + it->wd->item_width > ox + ow) + it->wd->reorder_item_x = ox + ow - it->wd->item_width; + else it->wd->reorder_item_x = it_scrl_x; + + if (it_scrl_y < oy) it->wd->reorder_item_y = oy; + else if (it_scrl_y + it->wd->item_height > oy + oh) + it->wd->reorder_item_y = oy + oh - it->wd->item_height; + else it->wd->reorder_item_y = it_scrl_y; + + if (it->wd->calc_job) ecore_job_del(it->wd->calc_job); + it->wd->calc_job = ecore_job_add(_calc_job, it->wd); + } + return; + } + if (it->select_mode != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + evas_object_geometry_get(obj, &x, &y, NULL, NULL); + x = ev->cur.canvas.x - x; + y = ev->cur.canvas.y - y; + dx = x - it->dx; + adx = dx; + if (adx < 0) adx = -dx; + dy = y - it->dy; + ady = dy; + if (ady < 0) ady = -dy; + minw /= 2; + minh /= 2; + if ((adx > minw) || (ady > minh)) + { + const char *left_drag, *right_drag; + if (!elm_widget_mirrored_get(WIDGET(it))) + { + left_drag = SIG_DRAG_START_LEFT; + right_drag = SIG_DRAG_START_RIGHT; + } + else + { + left_drag = SIG_DRAG_START_RIGHT; + right_drag = SIG_DRAG_START_LEFT; + } + + it->dragging = 1; + if (it->long_timer) + { + ecore_timer_del(it->long_timer); + it->long_timer = NULL; + } + if (!it->wd->wasselected) + _item_unselect(it); + if (dy < 0) + { + if (ady > adx) + evas_object_smart_callback_call(WIDGET(it), SIG_DRAG_START_UP, + it); + else + { + if (dx < 0) + evas_object_smart_callback_call(WIDGET(it), + left_drag, it); + } + } + else + { + if (ady > adx) + evas_object_smart_callback_call(WIDGET(it), + SIG_DRAG_START_DOWN, it); + else + { + if (dx < 0) + evas_object_smart_callback_call(WIDGET(it), + left_drag, it); + else + evas_object_smart_callback_call(WIDGET(it), + right_drag, it); + } + } + } +} + +static Eina_Bool +_long_press(void *data) +{ + Elm_Gen_Item *it = data; + + it->long_timer = NULL; + if (elm_widget_item_disabled_get(it)|| (it->dragging)) + return ECORE_CALLBACK_CANCEL; + it->wd->longpressed = EINA_TRUE; + evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, it); + if (it->wd->reorder_mode) + { + it->wd->reorder_it = it; + evas_object_raise(VIEW(it)); + elm_smart_scroller_hold_set(it->wd->scr, EINA_TRUE); + elm_smart_scroller_bounce_allow_set(it->wd->scr, EINA_FALSE, EINA_FALSE); + edje_object_signal_emit(VIEW(it), "elm,state,reorder,enabled", "elm"); + } + return ECORE_CALLBACK_CANCEL; +} + +static void +_mouse_down(void *data, + Evas *evas __UNUSED__, + Evas_Object *obj, + void *event_info) +{ + Elm_Gen_Item *it = data; + Evas_Event_Mouse_Down *ev = event_info; + Evas_Coord x, y; + + if (ev->button != 1) return; + it->down = 1; + it->dragging = 0; + evas_object_geometry_get(obj, &x, &y, NULL, NULL); + it->dx = ev->canvas.x - x; + it->dy = ev->canvas.y - y; + it->wd->longpressed = EINA_FALSE; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE; + else it->wd->on_hold = EINA_FALSE; + if (it->wd->on_hold) return; + it->wd->wasselected = it->selected; + _item_highlight(it); + if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) + { + evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it); + evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it); + } + if (it->long_timer) ecore_timer_del(it->long_timer); + if (it->realized) + it->long_timer = ecore_timer_add(_elm_config->longpress_timeout, + _long_press, it); + else + it->long_timer = NULL; +} + +static void +_mouse_up(void *data, + Evas *evas __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + Elm_Gen_Item *it = data; + Evas_Event_Mouse_Up *ev = event_info; + Eina_Bool dragged = EINA_FALSE; + + if (ev->button != 1) return; + it->down = EINA_FALSE; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE; + else it->wd->on_hold = EINA_FALSE; + if (it->long_timer) + { + ecore_timer_del(it->long_timer); + it->long_timer = NULL; + } + if (it->dragging) + { + it->dragging = EINA_FALSE; + evas_object_smart_callback_call(WIDGET(it), SIG_DRAG_STOP, it); + dragged = EINA_TRUE; + } + if (it->wd->on_hold) + { + it->wd->longpressed = EINA_FALSE; + it->wd->on_hold = EINA_FALSE; + return; + } + if ((it->wd->reorder_mode) && (it->wd->reorder_it)) + { + evas_object_smart_callback_call(WIDGET(it), SIG_MOVED, it->wd->reorder_it); + it->wd->reorder_it = NULL; + it->wd->move_effect_enabled = EINA_FALSE; + if (it->wd->calc_job) ecore_job_del(it->wd->calc_job); + it->wd->calc_job = ecore_job_add(_calc_job, it->wd); + + elm_smart_scroller_hold_set(it->wd->scr, EINA_FALSE); + elm_smart_scroller_bounce_allow_set(it->wd->scr, it->wd->h_bounce, it->wd->v_bounce); + edje_object_signal_emit(VIEW(it), "elm,state,reorder,disabled", "elm"); + } + if (it->wd->longpressed) + { + it->wd->longpressed = EINA_FALSE; + if (!it->wd->wasselected) _item_unselect(it); + it->wd->wasselected = EINA_FALSE; + return; + } + if (dragged) + { + if (it->want_unrealize) + _elm_genlist_item_unrealize(it, EINA_FALSE); + } + if (elm_widget_item_disabled_get(it) || (dragged)) return; + if (it->wd->multi) + { + if (!it->selected) + { + _item_highlight(it); + it->sel_cb(it); + } + else _item_unselect(it); + } + else + { + if (!it->selected) + { + while (it->wd->selected) + _item_unselect(it->wd->selected->data); + } + else + { + const Eina_List *l, *l_next; + Elm_Gen_Item *item2; + + EINA_LIST_FOREACH_SAFE(it->wd->selected, l, l_next, item2) + if (item2 != it) _item_unselect(item2); + } + _item_highlight(it); + it->sel_cb(it); + } +} + +static void +_item_highlight(Elm_Gen_Item *it) +{ + if ((it->wd->select_mode == ELM_OBJECT_SELECT_MODE_NONE) || + (!it->wd->highlight) || (it->highlighted) || + (it->generation < it->wd->generation)) return; + edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm"); + it->highlighted = EINA_TRUE; +} + +static void +_elm_gengrid_item_index_update(Elm_Gen_Item *it) +{ + if (it->position_update) + { + evas_object_smart_callback_call(WIDGET(it), SIG_INDEX_UPDATE, it); + it->position_update = EINA_FALSE; + } +} + +static void +_item_realize(Elm_Gen_Item *it) +{ + char buf[1024]; + char style[1024]; + + if ((it->realized) || (it->generation < it->wd->generation)) return; + VIEW(it) = edje_object_add(evas_object_evas_get(WIDGET(it))); + edje_object_scale_set(VIEW(it), elm_widget_scale_get(WIDGET(it)) * + _elm_config->scale); + edje_object_mirrored_set(VIEW(it), elm_widget_mirrored_get(WIDGET(it))); + evas_object_smart_member_add(VIEW(it), it->wd->pan_smart); + elm_widget_sub_object_add(WIDGET(it), VIEW(it)); + snprintf(style, sizeof(style), "item/%s", + it->itc->item_style ? it->itc->item_style : "default"); + _elm_theme_object_set(WIDGET(it), VIEW(it), "gengrid", style, + elm_widget_style_get(WIDGET(it))); + it->spacer = + evas_object_rectangle_add(evas_object_evas_get(WIDGET(it))); + evas_object_color_set(it->spacer, 0, 0, 0, 0); + elm_widget_sub_object_add(WIDGET(it), it->spacer); + evas_object_size_hint_min_set(it->spacer, 2 * _elm_config->scale, 1); + edje_object_part_swallow(VIEW(it), "elm.swallow.pad", it->spacer); + + if (it->itc->func.text_get) + { + const Eina_List *l; + const char *key; + + it->texts = + elm_widget_stringlist_get(edje_object_data_get(VIEW(it), + "texts")); + EINA_LIST_FOREACH(it->texts, l, key) + { + char *s = it->itc->func.text_get + ((void *)it->base.data, WIDGET(it), key); + if (s) + { + edje_object_part_text_escaped_set(VIEW(it), key, s); + free(s); + } + } + } + + if (it->itc->func.content_get) + { + const Eina_List *l; + const char *key; + Evas_Object *ic = NULL; + + it->contents = + elm_widget_stringlist_get(edje_object_data_get(VIEW(it), + "contents")); + EINA_LIST_FOREACH(it->contents, l, key) + { + if (it->itc->func.content_get) + ic = it->itc->func.content_get + ((void *)it->base.data, WIDGET(it), key); + if (ic) + { + it->content_objs = eina_list_append(it->content_objs, ic); + edje_object_part_swallow(VIEW(it), key, ic); + evas_object_show(ic); + elm_widget_sub_object_add(WIDGET(it), ic); + } + } + } + + if (it->itc->func.state_get) + { + const Eina_List *l; + const char *key; + + it->states = + elm_widget_stringlist_get(edje_object_data_get(VIEW(it), + "states")); + EINA_LIST_FOREACH(it->states, l, key) + { + Eina_Bool on = it->itc->func.state_get + ((void *)it->base.data, WIDGET(it), l->data); + if (on) + { + snprintf(buf, sizeof(buf), "elm,state,%s,active", key); + edje_object_signal_emit(VIEW(it), buf, "elm"); + } + } + } + + if (it->group) + { + if ((!it->wd->group_item_width) && (!it->wd->group_item_height)) + { + edje_object_size_min_restricted_calc(VIEW(it), + &it->wd->group_item_width, + &it->wd->group_item_height, + it->wd->group_item_width, + it->wd->group_item_height); + } + } + else + { + if ((!it->wd->item_width) && (!it->wd->item_height)) + { + edje_object_size_min_restricted_calc(VIEW(it), + &it->wd->item_width, + &it->wd->item_height, + it->wd->item_width, + it->wd->item_height); + elm_coords_finger_size_adjust(1, &it->wd->item_width, + 1, &it->wd->item_height); + } + + evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_DOWN, + _mouse_down, it); + evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_UP, + _mouse_up, it); + evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_MOVE, + _mouse_move, it); + + _elm_gengrid_item_index_update(it); + + if (it->selected) + edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm"); + if (elm_widget_item_disabled_get(it)) + edje_object_signal_emit(VIEW(it), "elm,state,disabled", "elm"); + } + evas_object_show(VIEW(it)); + + if (it->tooltip.content_cb) + { + elm_widget_item_tooltip_content_cb_set(it, + it->tooltip.content_cb, + it->tooltip.data, NULL); + elm_widget_item_tooltip_style_set(it, it->tooltip.style); + elm_widget_item_tooltip_window_mode_set(it, it->tooltip.free_size); + } + + if (it->mouse_cursor) + elm_widget_item_cursor_set(it, it->mouse_cursor); + + it->realized = EINA_TRUE; + it->want_unrealize = EINA_FALSE; +} + +static void +_item_unrealize_cb(Elm_Gen_Item *it) +{ + evas_object_del(VIEW(it)); + VIEW(it) = NULL; + evas_object_del(it->spacer); + it->spacer = NULL; +} + +static Eina_Bool +_reorder_item_move_animator_cb(void *data) +{ + Elm_Gen_Item *it = data; + double tt, t; + Evas_Coord dx, dy; + + tt = REORDER_EFFECT_TIME; + t = ((0.0 > (t = ecore_loop_time_get()-it->item->moving_effect_start_time)) ? 0.0 : t); + dx = ((it->item->tx - it->item->ox) / 10) * _elm_config->scale; + dy = ((it->item->ty - it->item->oy) / 10) * _elm_config->scale; + + if (t <= tt) + { + it->item->rx += (1 * sin((t / tt) * (M_PI / 2)) * dx); + it->item->ry += (1 * sin((t / tt) * (M_PI / 2)) * dy); + } + else + { + it->item->rx += dx; + it->item->ry += dy; + } + + if ((((dx > 0) && (it->item->rx >= it->item->tx)) || ((dx <= 0) && (it->item->rx <= it->item->tx))) && + (((dy > 0) && (it->item->ry >= it->item->ty)) || ((dy <= 0) && (it->item->ry <= it->item->ty)))) + { + evas_object_move(VIEW(it), it->item->tx, it->item->ty); + if (it->group) + { + Evas_Coord vw, vh; + evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &vw, &vh); + if (it->wd->horizontal) + evas_object_resize(VIEW(it), it->wd->group_item_width, vh); + else + evas_object_resize(VIEW(it), vw, it->wd->group_item_height); + } + else + evas_object_resize(VIEW(it), it->wd->item_width, it->wd->item_height); + it->item->moving = EINA_FALSE; + it->item->item_reorder_move_animator = NULL; + return ECORE_CALLBACK_CANCEL; + } + + evas_object_move(VIEW(it), it->item->rx, it->item->ry); + if (it->group) + { + Evas_Coord vw, vh; + evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &vw, &vh); + if (it->wd->horizontal) + evas_object_resize(VIEW(it), it->wd->group_item_width, vh); + else + evas_object_resize(VIEW(it), vw, it->wd->group_item_height); + } + else + evas_object_resize(VIEW(it), it->wd->item_width, it->wd->item_height); + + return ECORE_CALLBACK_RENEW; +} + +static void +_group_item_place(Pan *sd) +{ + Evas_Coord iw, ih, vw, vh; + Eina_List *l; + Eina_Bool was_realized; + Elm_Gen_Item *it; + evas_object_geometry_get(sd->wd->pan_smart, NULL, NULL, &vw, &vh); + if (sd->wd->horizontal) + { + iw = sd->wd->group_item_width; + ih = vh; + } + else + { + iw = vw; + ih = sd->wd->group_item_height; + } + EINA_LIST_FOREACH(sd->wd->group_items, l, it) + { + was_realized = it->realized; + if (it->item->group_realized) + { + _item_realize(it); + if (!was_realized) + evas_object_smart_callback_call(WIDGET(it), SIG_REALIZED, it); + evas_object_move(VIEW(it), it->item->gx, it->item->gy); + evas_object_resize(VIEW(it), iw, ih); + evas_object_raise(VIEW(it)); + } + else + _elm_genlist_item_unrealize(it, EINA_FALSE); + } +} + + +static void +_item_place(Elm_Gen_Item *it, + Evas_Coord cx, + Evas_Coord cy) +{ + Evas_Coord x, y, ox, oy, cvx, cvy, cvw, cvh, iw, ih, ww; + Evas_Coord tch, tcw, alignw = 0, alignh = 0, vw, vh; + Eina_Bool reorder_item_move_forward = EINA_FALSE; + long items_count; + it->x = cx; + it->y = cy; + evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &vw, &vh); + + /* Preload rows/columns at each side of the Gengrid */ + cvx = ox - PRELOAD * it->wd->item_width; + cvy = oy - PRELOAD * it->wd->item_height; + cvw = vw + 2 * PRELOAD * it->wd->item_width; + cvh = vh + 2 * PRELOAD * it->wd->item_height; + + alignh = 0; + alignw = 0; + + items_count = it->wd->item_count - eina_list_count(it->wd->group_items) + it->wd->items_lost; + if (it->wd->horizontal) + { + int columns, items_visible = 0, items_row; + + if (it->wd->item_height > 0) + items_visible = vh / it->wd->item_height; + if (items_visible < 1) + items_visible = 1; + + columns = items_count / items_visible; + if (items_count % items_visible) + columns++; + + tcw = (it->wd->item_width * columns) + (it->wd->group_item_width * eina_list_count(it->wd->group_items)); + alignw = (vw - tcw) * it->wd->align_x; + + items_row = items_visible; + if ((unsigned int)items_row > it->wd->item_count) + items_row = it->wd->item_count; + if (it->wd->filled + && (unsigned int)it->wd->nmax > (unsigned int)it->wd->item_count) + tch = it->wd->nmax * it->wd->item_height; + else + tch = items_row * it->wd->item_height; + alignh = (vh - tch) * it->wd->align_y; + } + else + { + unsigned int rows, items_visible = 0, items_col; + + if (it->wd->item_width > 0) + items_visible = vw / it->wd->item_width; + if (items_visible < 1) + items_visible = 1; + + rows = items_count / items_visible; + if (items_count % items_visible) + rows++; + + tch = (it->wd->item_height * rows) + (it->wd->group_item_height * eina_list_count(it->wd->group_items)); + alignh = (vh - tch) * it->wd->align_y; + + items_col = items_visible; + if (items_col > it->wd->item_count) + items_col = it->wd->item_count; + if (it->wd->filled + && (unsigned int)it->wd->nmax > (unsigned int)it->wd->item_count) + tcw = it->wd->nmax * it->wd->item_width; + else + tcw = items_col * it->wd->item_width; + alignw = (vw - tcw) * it->wd->align_x; + } + + if (it->group) + { + if (it->wd->horizontal) + { + x = (((cx - it->item->prev_group) * it->wd->item_width) + (it->item->prev_group * it->wd->group_item_width)) - it->wd->pan_x + ox + alignw; + y = oy; + iw = it->wd->group_item_width; + ih = vh; + } + else + { + x = ox; + y = (((cy - it->item->prev_group) * it->wd->item_height) + (it->item->prev_group * it->wd->group_item_height)) - it->wd->pan_y + oy + alignh; + iw = vw; + ih = it->wd->group_item_height; + } + it->item->gx = x; + it->item->gy = y; + } + else + { + if (it->wd->horizontal) + { + x = (((cx - it->item->prev_group) * it->wd->item_width) + (it->item->prev_group * it->wd->group_item_width)) - it->wd->pan_x + ox + alignw; + y = (cy * it->wd->item_height) - it->wd->pan_y + oy + alignh; + } + else + { + x = (cx * it->wd->item_width) - it->wd->pan_x + ox + alignw; + y = (((cy - it->item->prev_group) * it->wd->item_height) + (it->item->prev_group * it->wd->group_item_height)) - it->wd->pan_y + oy + alignh; + } + if (elm_widget_mirrored_get(WIDGET(it))) + { /* Switch items side and componsate for pan_x when in RTL mode */ + evas_object_geometry_get(WIDGET(it), NULL, NULL, &ww, NULL); + x = ww - x - it->wd->item_width - it->wd->pan_x - it->wd->pan_x; + } + iw = it->wd->item_width; + ih = it->wd->item_height; + } + + Eina_Bool was_realized = it->realized; + if (ELM_RECTS_INTERSECT(x, y, iw, ih, cvx, cvy, cvw, cvh)) + { + _item_realize(it); + if (!was_realized) + evas_object_smart_callback_call(WIDGET(it), SIG_REALIZED, it); + if (it->parent) + { + if (it->wd->horizontal) + { + if (it->parent->item->gx < ox) + { + it->parent->item->gx = x + it->wd->item_width - it->wd->group_item_width; + if (it->parent->item->gx > ox) + it->parent->item->gx = ox; + } + it->parent->item->group_realized = EINA_TRUE; + } + else + { + if (it->parent->item->gy < oy) + { + it->parent->item->gy = y + it->wd->item_height - it->wd->group_item_height; + if (it->parent->item->gy > oy) + it->parent->item->gy = oy; + } + it->parent->item->group_realized = EINA_TRUE; + } + } + if (it->wd->reorder_mode) + { + if (it->wd->reorder_it) + { + if (it->item->moving) return; + + if (!it->wd->move_effect_enabled) + { + it->item->ox = x; + it->item->oy = y; + } + if (it->wd->reorder_it == it) + { + evas_object_move(VIEW(it), + it->wd->reorder_item_x, it->wd->reorder_item_y); + evas_object_resize(VIEW(it), iw, ih); + return; + } + else + { + if (it->wd->move_effect_enabled) + { + if ((it->item->ox != x) || (it->item->oy != y)) + { + if (((it->wd->old_pan_x == it->wd->pan_x) && (it->wd->old_pan_y == it->wd->pan_y)) || + ((it->wd->old_pan_x != it->wd->pan_x) && !(it->item->ox - it->wd->pan_x + it->wd->old_pan_x == x)) || + ((it->wd->old_pan_y != it->wd->pan_y) && !(it->item->oy - it->wd->pan_y + it->wd->old_pan_y == y))) + { + it->item->tx = x; + it->item->ty = y; + it->item->rx = it->item->ox; + it->item->ry = it->item->oy; + it->item->moving = EINA_TRUE; + it->item->moving_effect_start_time = ecore_loop_time_get(); + it->item->item_reorder_move_animator = ecore_animator_add(_reorder_item_move_animator_cb, it); + return; + } + } + } + + /* need fix here */ + Evas_Coord nx, ny, nw, nh; + if (it->group) + { + if (it->wd->horizontal) + { + nx = x + (it->wd->group_item_width / 2); + ny = y; + nw = 1; + nh = vh; + } + else + { + nx = x; + ny = y + (it->wd->group_item_height / 2); + nw = vw; + nh = 1; + } + } + else + { + nx = x + (it->wd->item_width / 2); + ny = y + (it->wd->item_height / 2); + nw = 1; + nh = 1; + } + + if ( ELM_RECTS_INTERSECT(it->wd->reorder_item_x, it->wd->reorder_item_y, + it->wd->item_width, it->wd->item_height, + nx, ny, nw, nh)) + { + if (it->wd->horizontal) + { + if ((it->wd->nmax * it->wd->reorder_it->x + it->wd->reorder_it->y) > + (it->wd->nmax * it->x + it->y)) + reorder_item_move_forward = EINA_TRUE; + } + else + { + if ((it->wd->nmax * it->wd->reorder_it->y + it->wd->reorder_it->x) > + (it->wd->nmax * it->y + it->x)) + reorder_item_move_forward = EINA_TRUE; + } + + it->wd->items = eina_inlist_remove(it->wd->items, + EINA_INLIST_GET(it->wd->reorder_it)); + if (reorder_item_move_forward) + it->wd->items = eina_inlist_prepend_relative(it->wd->items, + EINA_INLIST_GET(it->wd->reorder_it), + EINA_INLIST_GET(it)); + else + it->wd->items = eina_inlist_append_relative(it->wd->items, + EINA_INLIST_GET(it->wd->reorder_it), + EINA_INLIST_GET(it)); + + it->wd->reorder_item_changed = EINA_TRUE; + it->wd->move_effect_enabled = EINA_TRUE; + if (it->wd->calc_job) ecore_job_del(it->wd->calc_job); + it->wd->calc_job = ecore_job_add(_calc_job, it->wd); + + return; + } + } + } + else if (it->item->item_reorder_move_animator) + { + ecore_animator_del(it->item->item_reorder_move_animator); + it->item->item_reorder_move_animator = NULL; + it->item->moving = EINA_FALSE; + } + } + if (!it->group) + { + evas_object_move(VIEW(it), x, y); + evas_object_resize(VIEW(it), iw, ih); + } + else + it->item->group_realized = EINA_TRUE; + } + else + { + if (!it->group) + _elm_genlist_item_unrealize(it, EINA_FALSE); + else + it->item->group_realized = EINA_FALSE; + } +} + +static void +_item_position_update(Eina_Inlist *list, int idx) +{ + Elm_Gen_Item *it; + + EINA_INLIST_FOREACH(list, it) + { + it->position = idx++; + it->position_update = EINA_TRUE; + } +} + +static void +_item_del(Elm_Gen_Item *it) +{ + Evas_Object *obj = WIDGET(it); + + evas_event_freeze(evas_object_evas_get(obj)); + it->wd->selected = eina_list_remove(it->wd->selected, it); + if (it->realized) _elm_genlist_item_unrealize(it, EINA_FALSE); + _elm_genlist_item_del_serious(it); + elm_gengrid_item_class_unref((Elm_Gengrid_Item_Class *)it->itc); + evas_event_thaw(evas_object_evas_get(obj)); + evas_event_thaw_eval(evas_object_evas_get(obj)); +} + +static void +_item_unselect(Elm_Gen_Item *it) +{ + if ((it->generation < it->wd->generation) || (!it->highlighted)) return; + edje_object_signal_emit(VIEW(it), "elm,state,unselected", "elm"); + it->highlighted = EINA_FALSE; + if (it->selected) + { + it->selected = EINA_FALSE; + it->wd->selected = eina_list_remove(it->wd->selected, it); + evas_object_smart_callback_call(WIDGET(it), SIG_UNSELECTED, it); + } +} + +static void +_calc_job(void *data) +{ + Widget_Data *wd = data; + Evas_Coord minw = 0, minh = 0, nmax = 0, cvw, cvh; + Elm_Gen_Item *it, *group_item = NULL; + int count_group = 0; + long count = 0; + wd->items_lost = 0; + + evas_object_geometry_get(wd->pan_smart, NULL, NULL, &cvw, &cvh); + if ((cvw != 0) || (cvh != 0)) + { + if ((wd->horizontal) && (wd->item_height > 0)) + nmax = cvh / wd->item_height; + else if (wd->item_width > 0) + nmax = cvw / wd->item_width; + + if (nmax < 1) + nmax = 1; + + EINA_INLIST_FOREACH(wd->items, it) + { + if (it->item->prev_group != count_group) + it->item->prev_group = count_group; + if (it->group) + { + count = count % nmax; + if (count) + wd->items_lost += nmax - count; + //printf("%d items and I lost %d\n", count, wd->items_lost); + count_group++; + if (count) count = 0; + group_item = it; + } + else + { + if (it->parent != group_item) + it->parent = group_item; + count++; + } + } + count = wd->item_count + wd->items_lost - count_group; + if (wd->horizontal) + { + minw = (ceil(count / (float)nmax) * wd->item_width) + (count_group * wd->group_item_width); + minh = nmax * wd->item_height; + } + else + { + minw = nmax * wd->item_width; + minh = (ceil(count / (float)nmax) * wd->item_height) + (count_group * wd->group_item_height); + } + + if ((minw != wd->minw) || (minh != wd->minh)) + { + wd->minh = minh; + wd->minw = minw; + evas_object_smart_callback_call(wd->pan_smart, "changed", NULL); + } + + wd->nmax = nmax; + evas_object_smart_changed(wd->pan_smart); + } + wd->calc_job = NULL; +} + +static void +_pan_add(Evas_Object *obj) +{ + Pan *sd; + Evas_Object_Smart_Clipped_Data *cd; + + _pan_sc.add(obj); + cd = evas_object_smart_data_get(obj); + sd = ELM_NEW(Pan); + if (!sd) return; + sd->__clipped_data = *cd; + free(cd); + evas_object_smart_data_set(obj, sd); +} + +static void +_pan_del(Evas_Object *obj) +{ + Pan *sd = evas_object_smart_data_get(obj); + + if (!sd) return; + _pan_sc.del(obj); +} + +static void +_pan_set(Evas_Object *obj, + Evas_Coord x, + Evas_Coord y) +{ + Pan *sd = evas_object_smart_data_get(obj); + if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return; + sd->wd->pan_x = x; + sd->wd->pan_y = y; + evas_object_smart_changed(obj); +} + +static void +_pan_get(Evas_Object *obj, + Evas_Coord *x, + Evas_Coord *y) +{ + Pan *sd = evas_object_smart_data_get(obj); + if (x) *x = sd->wd->pan_x; + if (y) *y = sd->wd->pan_y; +} + +static void +_pan_child_size_get(Evas_Object *obj, + Evas_Coord *w, + Evas_Coord *h) +{ + Pan *sd = evas_object_smart_data_get(obj); + if (w) *w = sd->wd->minw; + if (h) *h = sd->wd->minh; +} + +static void +_pan_max_get(Evas_Object *obj, + Evas_Coord *x, + Evas_Coord *y) +{ + Pan *sd = evas_object_smart_data_get(obj); + Evas_Coord ow, oh; + + if (!sd) return; + evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); + if (x) + *x = (ow < sd->wd->minw) ? sd->wd->minw - ow : 0; + if (y) + *y = (oh < sd->wd->minh) ? sd->wd->minh - oh : 0; +} + +static void +_pan_min_get(Evas_Object *obj, + Evas_Coord *x, + Evas_Coord *y) +{ + Pan *sd = evas_object_smart_data_get(obj); + Evas_Coord mx = 0, my = 0; + + if (!sd) return; + _pan_max_get(obj, &mx, &my); + if (x) + *x = -mx * sd->wd->align_x; + if (y) + *y = -my * sd->wd->align_y; +} + +static void +_pan_resize(Evas_Object *obj, + Evas_Coord w, + Evas_Coord h) +{ + Pan *sd = evas_object_smart_data_get(obj); + Evas_Coord ow, oh; + + evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); + if ((ow == w) && (oh == h)) return; + if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job); + sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd); +} + +static void +_pan_calculate(Evas_Object *obj) +{ + Pan *sd = evas_object_smart_data_get(obj); + Evas_Coord cx = 0, cy = 0; + Elm_Gen_Item *it; + + if (!sd) return; + if (!sd->wd->nmax) return; + + sd->wd->reorder_item_changed = EINA_FALSE; + + EINA_INLIST_FOREACH(sd->wd->items, it) + { + if (it->group) + { + if (sd->wd->horizontal) + { + if (cy) + { + cx++; + cy = 0; + } + } + else + { + if (cx) + { + cx = 0; + cy++; + } + } + } + _item_place(it, cx, cy); + if (sd->wd->reorder_item_changed) return; + if (it->group) + { + if (sd->wd->horizontal) + { + cx++; + cy = 0; + } + else + { + cx = 0; + cy++; + } + } + else + { + if (sd->wd->horizontal) + { + cy = (cy + 1) % sd->wd->nmax; + if (!cy) cx++; + } + else + { + cx = (cx + 1) % sd->wd->nmax; + if (!cx) cy++; + } + } + } + _group_item_place(sd); + + + if ((sd->wd->reorder_mode) && (sd->wd->reorder_it)) + { + if (!sd->wd->reorder_item_changed) + { + sd->wd->old_pan_x = sd->wd->pan_x; + sd->wd->old_pan_y = sd->wd->pan_y; + } + sd->wd->move_effect_enabled = EINA_FALSE; + } + evas_object_smart_callback_call(sd->wd->obj, SIG_CHANGED, NULL); +} + +static void +_pan_move(Evas_Object *obj, + Evas_Coord x __UNUSED__, + Evas_Coord y __UNUSED__) +{ + Pan *sd = evas_object_smart_data_get(obj); + if (!sd) return; + if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job); + sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd); +} + +static void +_hold_on(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_smart_scroller_hold_set(wd->scr, 1); +} + +static void +_hold_off(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_smart_scroller_hold_set(wd->scr, 0); +} + +static void +_freeze_on(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_smart_scroller_freeze_set(wd->scr, 1); +} + +static void +_freeze_off(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_smart_scroller_freeze_set(wd->scr, 0); +} + +static void +_scr_anim_start(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_START, NULL); +} + +static void +_scr_anim_stop(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_STOP, NULL); +} + +static void +_scr_drag_start(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START, NULL); +} + +static void +_scr_drag_stop(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP, NULL); +} + +static void +_edge_left(void *data, + Evas_Object *scr __UNUSED__, + void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_EDGE_LEFT, NULL); +} + +static void +_edge_right(void *data, + Evas_Object *scr __UNUSED__, + void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_EDGE_RIGHT, NULL); +} + +static void +_edge_top(void *data, + Evas_Object *scr __UNUSED__, + void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_EDGE_TOP, NULL); +} + +static void +_edge_bottom(void *data, + Evas_Object *scr __UNUSED__, + void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_EDGE_BOTTOM, NULL); +} + +static void +_scr_scroll(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_SCROLL, NULL); +} + +static int +_elm_gengrid_item_compare(const void *data, const void *data1) +{ + Elm_Gen_Item *it, *item1; + it = ELM_GEN_ITEM_FROM_INLIST(data); + item1 = ELM_GEN_ITEM_FROM_INLIST(data1); + return it->wd->item_compare_cb(it, item1); +} + +static void +_item_disable_hook(Elm_Object_Item *it) +{ + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + + if (_it->generation < _it->wd->generation) return; + + if (_it->realized) + { + if (elm_widget_item_disabled_get(_it)) + edje_object_signal_emit(VIEW(_it), "elm,state,disabled", "elm"); + else + edje_object_signal_emit(VIEW(_it), "elm,state,enabled", "elm"); + } +} + +static void +_item_del_pre_hook(Elm_Object_Item *it) +{ + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + if ((_it->relcount > 0) || (_it->walking > 0)) + { + _elm_genlist_item_del_notserious(_it); + return; + } + + _item_del(_it); +} + +static Elm_Gen_Item * +_item_new(Widget_Data *wd, + const Elm_Gengrid_Item_Class *itc, + const void *data, + Evas_Smart_Cb func, + const void *func_data) +{ + Elm_Gen_Item *it; + + it = _elm_genlist_item_new(wd, itc, data, NULL, func, func_data); + if (!it) return NULL; + elm_widget_item_disable_hook_set(it, _item_disable_hook); + elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook); + elm_gengrid_item_class_ref((Elm_Gengrid_Item_Class *)itc); + it->item = ELM_NEW(Elm_Gen_Item_Type); + wd->item_count++; + it->group = it->itc->item_style && (!strcmp(it->itc->item_style, "group_index")); + ELM_GEN_ITEM_SETUP(it); + + return it; +} + +EAPI Evas_Object * +elm_gengrid_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + static Evas_Smart *smart = NULL; + Eina_Bool bounce = _elm_config->thumbscroll_bounce_enable; + + if (!smart) + { + static Evas_Smart_Class sc; + + evas_object_smart_clipped_smart_set(&_pan_sc); + sc = _pan_sc; + sc.name = "elm_gengrid_pan"; + sc.version = EVAS_SMART_CLASS_VERSION; + sc.add = _pan_add; + sc.del = _pan_del; + sc.resize = _pan_resize; + sc.move = _pan_move; + sc.calculate = _pan_calculate; + if (!(smart = evas_smart_class_new(&sc))) return NULL; + } + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "gengrid"); + ELM_GEN_SETUP(wd); + elm_widget_type_set(obj, "gengrid"); + elm_widget_sub_object_add(parent, obj); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_signal_emit_hook_set(obj, _signal_emit_hook); + elm_widget_can_focus_set(obj, EINA_TRUE); + elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook); + elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook); + elm_widget_event_hook_set(obj, _event_hook); + + wd->generation = 1; + wd->scr = elm_smart_scroller_add(e); + elm_smart_scroller_widget_set(wd->scr, obj); + elm_smart_scroller_object_theme_set(obj, wd->scr, "gengrid", "base", + "default"); + elm_smart_scroller_bounce_allow_set(wd->scr, bounce, + _elm_config->thumbscroll_bounce_enable); + elm_widget_resize_object_set(obj, wd->scr); + + evas_object_smart_callback_add(wd->scr, "animate,start", _scr_anim_start, obj); + evas_object_smart_callback_add(wd->scr, "animate,stop", _scr_anim_stop, obj); + evas_object_smart_callback_add(wd->scr, "drag,start", _scr_drag_start, obj); + evas_object_smart_callback_add(wd->scr, "drag,stop", _scr_drag_stop, obj); + evas_object_smart_callback_add(wd->scr, "edge,left", _edge_left, obj); + evas_object_smart_callback_add(wd->scr, "edge,right", _edge_right, obj); + evas_object_smart_callback_add(wd->scr, "edge,top", _edge_top, obj); + evas_object_smart_callback_add(wd->scr, "edge,bottom", _edge_bottom, + obj); + evas_object_smart_callback_add(wd->scr, "scroll", _scr_scroll, obj); + + wd->obj = obj; + wd->align_x = 0.5; + wd->align_y = 0.5; + wd->h_bounce = bounce; + wd->v_bounce = bounce; + wd->highlight = EINA_TRUE; + + evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj); + evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj); + evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj); + evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj); + + wd->pan_smart = evas_object_smart_add(e, smart); + wd->pan = evas_object_smart_data_get(wd->pan_smart); + wd->pan->wd = wd; + + elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart, + _pan_set, _pan_get, _pan_max_get, + _pan_min_get, _pan_child_size_get); + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + return obj; +} + +EAPI void +elm_gengrid_item_size_set(Evas_Object *obj, + Evas_Coord w, + Evas_Coord h) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if ((wd->item_width == w) && (wd->item_height == h)) return; + wd->item_width = w; + wd->item_height = h; + if (wd->calc_job) ecore_job_del(wd->calc_job); + wd->calc_job = ecore_job_add(_calc_job, wd); +} + +EAPI void +elm_gengrid_item_size_get(const Evas_Object *obj, + Evas_Coord *w, + Evas_Coord *h) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (w) *w = wd->item_width; + if (h) *h = wd->item_height; +} + +EAPI void +elm_gengrid_group_item_size_set(Evas_Object *obj, + Evas_Coord w, + Evas_Coord h) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if ((wd->group_item_width == w) && (wd->group_item_height == h)) return; + wd->group_item_width = w; + wd->group_item_height = h; + if (wd->calc_job) ecore_job_del(wd->calc_job); + wd->calc_job = ecore_job_add(_calc_job, wd); +} + +EAPI void +elm_gengrid_group_item_size_get(const Evas_Object *obj, + Evas_Coord *w, + Evas_Coord *h) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (w) *w = wd->group_item_width; + if (h) *h = wd->group_item_height; +} + +EAPI void +elm_gengrid_align_set(Evas_Object *obj, + double align_x, + double align_y) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + + Widget_Data *wd = elm_widget_data_get(obj); + double old_h = wd->align_x, old_y = wd->align_y; + + if (align_x > 1.0) + align_x = 1.0; + else if (align_x < 0.0) + align_x = 0.0; + wd->align_x = align_x; + + if (align_y > 1.0) + align_y = 1.0; + else if (align_y < 0.0) + align_y = 0.0; + wd->align_y = align_y; + + if ((old_h != wd->align_x) || (old_y != wd->align_y)) + evas_object_smart_calculate(wd->pan_smart); +} + +EAPI void +elm_gengrid_align_get(const Evas_Object *obj, + double *align_x, + double *align_y) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (align_x) *align_x = wd->align_x; + if (align_y) *align_y = wd->align_y; +} + +EAPI Elm_Object_Item * +elm_gengrid_item_append(Evas_Object *obj, + const Elm_Gengrid_Item_Class *itc, + const void *data, + Evas_Smart_Cb func, + const void *func_data) +{ + Elm_Gen_Item *it; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + it = _item_new(wd, itc, data, func, func_data); + if (!it) return NULL; + wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it)); + it->position = eina_inlist_count(wd->items); + it->position_update = EINA_TRUE; + + if (it->group) + wd->group_items = eina_list_prepend(wd->group_items, it); + + if (wd->calc_job) ecore_job_del(wd->calc_job); + wd->calc_job = ecore_job_add(_calc_job, wd); + + return (Elm_Object_Item *)it; +} + +EAPI Elm_Object_Item * +elm_gengrid_item_prepend(Evas_Object *obj, + const Elm_Gengrid_Item_Class *itc, + const void *data, + Evas_Smart_Cb func, + const void *func_data) +{ + Elm_Gen_Item *it; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + it = _item_new(wd, itc, data, func, func_data); + if (!it) return NULL; + wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it)); + _item_position_update(wd->items, 0); + + if (it->group) + wd->group_items = eina_list_append(wd->group_items, it); + + if (wd->calc_job) ecore_job_del(wd->calc_job); + wd->calc_job = ecore_job_add(_calc_job, wd); + + return (Elm_Object_Item *)it; +} + +EAPI Elm_Object_Item * +elm_gengrid_item_insert_before(Evas_Object *obj, + const Elm_Gengrid_Item_Class *itc, + const void *data, + Elm_Object_Item *relative, + Evas_Smart_Cb func, + const void *func_data) +{ + Elm_Gen_Item *it; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + ELM_OBJ_ITEM_CHECK_OR_RETURN(relative, NULL); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + it = _item_new(wd, itc, data, func, func_data); + if (!it) return NULL; + wd->items = eina_inlist_prepend_relative + (wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET((Elm_Gen_Item *) relative)); + Eina_Inlist *tmp = eina_inlist_find(wd->items, EINA_INLIST_GET(it)); + _item_position_update(tmp, ((Elm_Gen_Item *)relative)->position); + + if (it->group) + wd->group_items = eina_list_append_relative(wd->group_items, it, ((Elm_Gen_Item *) relative)->parent); + + if (wd->calc_job) ecore_job_del(wd->calc_job); + wd->calc_job = ecore_job_add(_calc_job, wd); + + return (Elm_Object_Item *)it; +} + +EAPI Elm_Object_Item * +elm_gengrid_item_insert_after(Evas_Object *obj, + const Elm_Gengrid_Item_Class *itc, + const void *data, + Elm_Object_Item *relative, + Evas_Smart_Cb func, + const void *func_data) +{ + Elm_Gen_Item *it; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + ELM_OBJ_ITEM_CHECK_OR_RETURN(relative, NULL); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + it = _item_new(wd, itc, data, func, func_data); + if (!it) return NULL; + wd->items = eina_inlist_append_relative + (wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET((Elm_Gen_Item *) relative)); + Eina_Inlist *tmp = eina_inlist_find(wd->items, EINA_INLIST_GET(it)); + _item_position_update(tmp, ((Elm_Gen_Item *)relative)->position+1); + + if (it->group) + wd->group_items = eina_list_prepend_relative(wd->group_items, it, ((Elm_Gen_Item *) relative)->parent); + + if (wd->calc_job) ecore_job_del(wd->calc_job); + wd->calc_job = ecore_job_add(_calc_job, wd); + + return (Elm_Object_Item *)it; +} + +EAPI Elm_Object_Item * +elm_gengrid_item_sorted_insert(Evas_Object *obj, + const Elm_Gengrid_Item_Class *itc, + const void *data, + Eina_Compare_Cb comp, + Evas_Smart_Cb func, + const void *func_data) +{ + Elm_Gen_Item *it; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + it = _item_new(wd, itc, data, func, func_data); + if (!it) return NULL; + + if (!wd->state) + wd->state = eina_inlist_sorted_state_new(); + + wd->item_compare_cb = comp; + wd->items = eina_inlist_sorted_state_insert(wd->items, EINA_INLIST_GET(it), + _elm_gengrid_item_compare, wd->state); + _item_position_update(wd->items, 0); + + if (wd->calc_job) ecore_job_del(wd->calc_job); + wd->calc_job = ecore_job_add(_calc_job, wd); + + return (Elm_Object_Item *)it; +} + +EAPI void +elm_gengrid_horizontal_set(Evas_Object *obj, + Eina_Bool horizontal) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + horizontal = !!horizontal; + if (horizontal == wd->horizontal) return; + wd->horizontal = horizontal; + + /* Update the items to conform to the new layout */ + if (wd->calc_job) ecore_job_del(wd->calc_job); + wd->calc_job = ecore_job_add(_calc_job, wd); +} + +EAPI Eina_Bool +elm_gengrid_horizontal_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->horizontal; +} + +EAPI void +elm_gengrid_clear(Evas_Object *obj) +{ + elm_genlist_clear(obj); +} + +EINA_DEPRECATED EAPI const Evas_Object * +elm_gengrid_item_object_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + return VIEW(it); +} + +EAPI void +elm_gengrid_item_update(Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + if (!_it->realized) return; + if (_it->want_unrealize) return; + _elm_genlist_item_unrealize(_it, EINA_FALSE); + _item_realize(_it); + _item_place(_it, _it->x, _it->y); +} + +EAPI const Elm_Gengrid_Item_Class * +elm_gengrid_item_item_class_get(const Elm_Object_Item *it) +{ + return (Elm_Gengrid_Item_Class *)elm_genlist_item_item_class_get(it); +} + +EAPI void +elm_gengrid_item_item_class_update(Elm_Object_Item *it, + const Elm_Gengrid_Item_Class *itc) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + EINA_SAFETY_ON_NULL_RETURN(itc); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + if (_it->generation < _it->wd->generation) return; + _it->itc = itc; + elm_gengrid_item_update(it); +} + +EAPI void +elm_gengrid_item_pos_get(const Elm_Object_Item *it, + unsigned int *x, + unsigned int *y) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + if (x) *x = ((Elm_Gen_Item *)it)->x; + if (y) *y = ((Elm_Gen_Item *)it)->y; +} + +EAPI void +elm_gengrid_multi_select_set(Evas_Object *obj, + Eina_Bool multi) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->multi = !!multi; +} + +EAPI Eina_Bool +elm_gengrid_multi_select_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->multi; +} + +EAPI Elm_Object_Item * +elm_gengrid_selected_item_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (wd->selected) return wd->selected->data; + return NULL; +} + +EAPI const Eina_List * +elm_gengrid_selected_items_get(const Evas_Object *obj) +{ + return elm_genlist_selected_items_get(obj); +} + +EAPI void +elm_gengrid_item_selected_set(Elm_Object_Item *it, + Eina_Bool selected) +{ + elm_genlist_item_selected_set(it, selected); +} + +EAPI Eina_Bool +elm_gengrid_item_selected_get(const Elm_Object_Item *it) +{ + return elm_genlist_item_selected_get(it); +} + +EAPI Eina_List * +elm_gengrid_realized_items_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + Eina_List *list = NULL; + Elm_Gen_Item *it; + + EINA_INLIST_FOREACH(wd->items, it) + { + if (it->realized) list = eina_list_append(list, (Elm_Object_Item *)it); + } + return list; +} + +EAPI void +elm_gengrid_realized_items_update(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + + Eina_List *list, *l; + Elm_Object_Item *it; + + list = elm_gengrid_realized_items_get(obj); + EINA_LIST_FOREACH(list, l, it) + elm_gengrid_item_update(it); +} + +static Evas_Object * +_elm_gengrid_item_label_create(void *data, + Evas_Object *obj __UNUSED__, + Evas_Object *tooltip, + void *it __UNUSED__) +{ + Evas_Object *label = elm_label_add(tooltip); + if (!label) + return NULL; + elm_object_style_set(label, "tooltip"); + elm_object_text_set(label, data); + return label; +} + +static void +_elm_gengrid_item_label_del_cb(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + eina_stringshare_del(data); +} + +EAPI void +elm_gengrid_item_tooltip_text_set(Elm_Object_Item *it, + const char *text) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + text = eina_stringshare_add(text); + elm_gengrid_item_tooltip_content_cb_set(it, _elm_gengrid_item_label_create, + text, + _elm_gengrid_item_label_del_cb); +} + +EAPI void +elm_gengrid_item_tooltip_content_cb_set(Elm_Object_Item *it, + Elm_Tooltip_Item_Content_Cb func, + const void *data, + Evas_Smart_Cb del_cb) +{ + ELM_OBJ_ITEM_CHECK_OR_GOTO(it, error); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + + if ((_it->tooltip.content_cb == func) && (_it->tooltip.data == data)) + return; + + if (_it->tooltip.del_cb) + _it->tooltip.del_cb((void *)_it->tooltip.data, WIDGET(_it), _it); + _it->tooltip.content_cb = func; + _it->tooltip.data = data; + _it->tooltip.del_cb = del_cb; + if (VIEW(_it)) + { + elm_widget_item_tooltip_content_cb_set(_it, + _it->tooltip.content_cb, + _it->tooltip.data, NULL); + elm_widget_item_tooltip_style_set(_it, _it->tooltip.style); + elm_widget_item_tooltip_window_mode_set(_it, _it->tooltip.free_size); + } + + return; + +error: + if (del_cb) del_cb((void *)data, NULL, NULL); +} + +EAPI void +elm_gengrid_item_tooltip_unset(Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + + if ((VIEW(_it)) && (_it->tooltip.content_cb)) + elm_widget_item_tooltip_unset(_it); + + if (_it->tooltip.del_cb) + _it->tooltip.del_cb((void *) _it->tooltip.data, WIDGET(_it), _it); + _it->tooltip.del_cb = NULL; + _it->tooltip.content_cb = NULL; + _it->tooltip.data = NULL; + _it->tooltip.free_size = EINA_FALSE; + if (_it->tooltip.style) + elm_gengrid_item_tooltip_style_set(it, NULL); +} + +EAPI void +elm_gengrid_item_tooltip_style_set(Elm_Object_Item *it, + const char *style) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + eina_stringshare_replace(&((Elm_Gen_Item *)it)->tooltip.style, style); + if (VIEW(it)) elm_widget_item_tooltip_style_set(it, style); +} + +EAPI const char * +elm_gengrid_item_tooltip_style_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + return ((Elm_Gen_Item *)it)->tooltip.style; +} + +EAPI Eina_Bool +elm_gengrid_item_tooltip_window_mode_set(Elm_Object_Item *it, Eina_Bool disable) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE); + ((Elm_Gen_Item *)it)->tooltip.free_size = disable; + if (VIEW(it)) return elm_widget_item_tooltip_window_mode_set(it, disable); + return EINA_TRUE; +} + +EAPI Eina_Bool +elm_gengrid_item_tooltip_window_mode_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE); + return ((Elm_Gen_Item *)it)->tooltip.free_size; +} + +EAPI void +elm_gengrid_item_cursor_set(Elm_Object_Item *it, + const char *cursor) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + eina_stringshare_replace(&((Elm_Gen_Item *)it)->mouse_cursor, cursor); + if (VIEW(it)) elm_widget_item_cursor_set(it, cursor); +} + +EAPI const char * +elm_gengrid_item_cursor_get(const Elm_Object_Item *it) +{ + return elm_widget_item_cursor_get(it); +} + +EAPI void +elm_gengrid_item_cursor_unset(Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + if (!_it->mouse_cursor) + return; + + if (VIEW(_it)) + elm_widget_item_cursor_unset(_it); + + eina_stringshare_del(_it->mouse_cursor); + _it->mouse_cursor = NULL; +} + +EAPI void +elm_gengrid_item_cursor_style_set(Elm_Object_Item *it, + const char *style) +{ + elm_widget_item_cursor_style_set(it, style); +} + +EAPI const char * +elm_gengrid_item_cursor_style_get(const Elm_Object_Item *it) +{ + return elm_widget_item_cursor_style_get(it); +} + +EAPI void +elm_gengrid_item_cursor_engine_only_set(Elm_Object_Item *it, + Eina_Bool engine_only) +{ + elm_widget_item_cursor_engine_only_set(it, engine_only); +} + +EAPI Eina_Bool +elm_gengrid_item_cursor_engine_only_get(const Elm_Object_Item *it) +{ + return elm_widget_item_cursor_engine_only_get(it); +} + +EAPI void +elm_gengrid_reorder_mode_set(Evas_Object *obj, + Eina_Bool reorder_mode) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->reorder_mode = !!reorder_mode; +} + +EAPI Eina_Bool +elm_gengrid_reorder_mode_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->reorder_mode; +} + +EAPI void +elm_gengrid_bounce_set(Evas_Object *obj, + Eina_Bool h_bounce, + Eina_Bool v_bounce) +{ + elm_genlist_bounce_set(obj, h_bounce, v_bounce); +} + +EAPI void +elm_gengrid_bounce_get(const Evas_Object *obj, + Eina_Bool *h_bounce, + Eina_Bool *v_bounce) +{ + elm_genlist_bounce_get(obj, h_bounce, v_bounce); +} + +EAPI void +elm_gengrid_page_relative_set(Evas_Object *obj, + double h_pagerel, + double v_pagerel) +{ + _elm_genlist_page_relative_set(obj, h_pagerel, v_pagerel); +} + +EAPI void +elm_gengrid_page_relative_get(const Evas_Object *obj, double *h_pagerel, double *v_pagerel) +{ + _elm_genlist_page_relative_get(obj, h_pagerel, v_pagerel); +} + +EAPI void +elm_gengrid_page_size_set(Evas_Object *obj, + Evas_Coord h_pagesize, + Evas_Coord v_pagesize) +{ + _elm_genlist_page_size_set(obj, h_pagesize, v_pagesize); +} + +EAPI void +elm_gengrid_current_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber) +{ + _elm_genlist_current_page_get(obj, h_pagenumber, v_pagenumber); +} + +EAPI void +elm_gengrid_last_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber) +{ + _elm_genlist_last_page_get(obj, h_pagenumber, v_pagenumber); +} + +EAPI void +elm_gengrid_page_show(const Evas_Object *obj, int h_pagenumber, int v_pagenumber) +{ + _elm_genlist_page_show(obj, h_pagenumber, v_pagenumber); +} + +EAPI void +elm_gengrid_page_bring_in(const Evas_Object *obj, int h_pagenumber, int v_pagenumber) +{ + _elm_genlist_page_bring_in(obj, h_pagenumber, v_pagenumber); +} + +EAPI void +elm_gengrid_scroller_policy_set(Evas_Object *obj, + Elm_Scroller_Policy policy_h, + Elm_Scroller_Policy policy_v) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (!wd->scr)) return; + if ((policy_h >= ELM_SCROLLER_POLICY_LAST) || + (policy_v >= ELM_SCROLLER_POLICY_LAST)) + return; + elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v); +} + +EAPI void +elm_gengrid_scroller_policy_get(const Evas_Object *obj, + Elm_Scroller_Policy *policy_h, + Elm_Scroller_Policy *policy_v) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Smart_Scroller_Policy s_policy_h, s_policy_v; + if ((!wd) || (!wd->scr)) return; + elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v); + if (policy_h) *policy_h = (Elm_Scroller_Policy)s_policy_h; + if (policy_v) *policy_v = (Elm_Scroller_Policy)s_policy_v; +} + +EAPI Elm_Object_Item * +elm_gengrid_first_item_get(const Evas_Object *obj) +{ + return elm_genlist_first_item_get(obj); +} + +EAPI Elm_Object_Item * +elm_gengrid_last_item_get(const Evas_Object *obj) +{ + return elm_genlist_last_item_get(obj); +} + +EAPI Elm_Object_Item * +elm_gengrid_item_next_get(const Elm_Object_Item *it) +{ + return elm_genlist_item_next_get(it); +} + +EAPI Elm_Object_Item * +elm_gengrid_item_prev_get(const Elm_Object_Item *it) +{ + return elm_genlist_item_prev_get(it); +} + +EAPI void +elm_gengrid_item_show(Elm_Object_Item *it, Elm_Gengrid_Item_Scrollto_Type type) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + Widget_Data *wd = _it->wd; + Evas_Coord minx = 0, miny = 0; + + if ((_it->generation < _it->wd->generation)) return; + _pan_min_get(wd->pan_smart, &minx, &miny); + + if (type==ELM_GENGRID_ITEM_SCROLLTO_IN) + { + //TODO : type based handling like genlist + } + + if (wd->horizontal) + elm_smart_scroller_region_bring_in(_it->wd->scr, + ((_it->x - _it->item->prev_group) * wd->item_width) + (_it->item->prev_group * _it->wd->group_item_width) + minx, + _it->y * wd->item_height + miny, + _it->wd->item_width, + _it->wd->item_height); + else + elm_smart_scroller_region_bring_in(_it->wd->scr, + _it->x * wd->item_width + minx, + ((_it->y - _it->item->prev_group) * wd->item_height) + (_it->item->prev_group * _it->wd->group_item_height) + miny, + _it->wd->item_width, + _it->wd->item_height); +} + +EAPI void +elm_gengrid_item_bring_in(Elm_Object_Item *it, Elm_Gengrid_Item_Scrollto_Type type) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + + if (_it->generation < _it->wd->generation) return; + + Evas_Coord minx = 0, miny = 0; + Widget_Data *wd = _it->wd; + _pan_min_get(wd->pan_smart, &minx, &miny); + + if (type==ELM_GENGRID_ITEM_SCROLLTO_IN) + { + //TODO : type based handling like genlist + } + + if (wd->horizontal) + elm_smart_scroller_region_bring_in(_it->wd->scr, + ((_it->x - _it->item->prev_group) * wd->item_width) + (_it->item->prev_group * _it->wd->group_item_width) + minx, + _it->y * wd->item_height + miny, + _it->wd->item_width, + _it->wd->item_height); + else + elm_smart_scroller_region_bring_in(_it->wd->scr, + _it->x * wd->item_width + minx, + ((_it->y - _it->item->prev_group)* wd->item_height) + (_it->item->prev_group * _it->wd->group_item_height) + miny, + _it->wd->item_width, + _it->wd->item_height); +} + +EAPI void +elm_gengrid_filled_set(Evas_Object *obj, Eina_Bool fill) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + fill = !!fill; + if (wd->filled != fill) + wd->filled = fill; +} + +EAPI Eina_Bool +elm_gengrid_filled_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->filled; +} + +EAPI unsigned int +elm_gengrid_items_count(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; + return wd->item_count; +} + +EAPI Elm_Gengrid_Item_Class * +elm_gengrid_item_class_new(void) +{ + Elm_Gengrid_Item_Class *itc; + + itc = calloc(1, sizeof(Elm_Gengrid_Item_Class)); + if (!itc) + return NULL; + itc->version = CLASS_ALLOCATED; + itc->refcount = 1; + itc->delete_me = EINA_FALSE; + + return itc; +} + +EAPI void +elm_gengrid_item_class_free(Elm_Gengrid_Item_Class *itc) +{ + if (itc && (itc->version == CLASS_ALLOCATED)) + { + if (!itc->delete_me) itc->delete_me = EINA_TRUE; + if (itc->refcount > 0) elm_gengrid_item_class_unref(itc); + else + { + itc->version = 0; + free(itc); + } + } +} + +EAPI void +elm_gengrid_item_class_ref(Elm_Gengrid_Item_Class *itc) +{ + if (itc && (itc->version == CLASS_ALLOCATED)) + { + itc->refcount++; + if (itc->refcount == 0) itc->refcount--; + } +} + +EAPI void +elm_gengrid_item_class_unref(Elm_Gengrid_Item_Class *itc) +{ + if (itc && (itc->version == CLASS_ALLOCATED)) + { + if (itc->refcount > 0) itc->refcount--; + if (itc->delete_me && (!itc->refcount)) + elm_gengrid_item_class_free(itc); + } +} + +EAPI void +elm_gengrid_select_mode_set(Evas_Object *obj, Elm_Object_Select_Mode mode) +{ + elm_genlist_select_mode_set(obj, mode); +} + +EAPI Elm_Object_Select_Mode +elm_gengrid_select_mode_get(const Evas_Object *obj) +{ + return elm_genlist_select_mode_get(obj); +} + +EAPI void +elm_gengrid_highlight_mode_set(Evas_Object *obj, + Eina_Bool highlight) +{ + elm_genlist_highlight_mode_set(obj, highlight); +} + +EAPI Eina_Bool +elm_gengrid_highlight_mode_get(const Evas_Object *obj) +{ + return elm_genlist_highlight_mode_get(obj); +} + +EAPI int +elm_gengrid_item_index_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, -1); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + + return _it->position; +} + +EAPI void +elm_gengrid_item_select_mode_set(Elm_Object_Item *it, + Elm_Object_Select_Mode mode) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + if (!_it) return; + if (_it->generation < _it->wd->generation) return; + if (mode >= ELM_OBJECT_SELECT_MODE_MAX) + return; + if (_it->select_mode != mode) + _it->select_mode = mode; + + if (_it->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) + elm_gengrid_item_update(it); +} + +EAPI Elm_Object_Select_Mode +elm_gengrid_item_select_mode_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, ELM_OBJECT_SELECT_MODE_MAX); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + if (!_it) return ELM_OBJECT_SELECT_MODE_MAX; + return _it->select_mode; +} diff --git a/libraries/elementary/src/lib/elm_gengrid.h b/libraries/elementary/src/lib/elm_gengrid.h new file mode 100644 index 0000000..c88232a --- /dev/null +++ b/libraries/elementary/src/lib/elm_gengrid.h @@ -0,0 +1,1615 @@ +/** + * @defgroup Gengrid Gengrid (Generic grid) + * @ingroup Elementary + * + * This widget aims to position objects in a grid layout while + * actually creating and rendering only the visible ones, using the + * same idea as the @ref Genlist "genlist": the user defines a @b + * class for each item, specifying functions that will be called at + * object creation, deletion, etc. When those items are selected by + * the user, a callback function is issued. Users may interact with + * a gengrid via the mouse (by clicking on items to select them and + * clicking on the grid's viewport and swiping to pan the whole + * view) or via the keyboard, navigating through item with the + * arrow keys. + * + * @section Gengrid_Layouts Gengrid layouts + * + * Gengrid may layout its items in one of two possible layouts: + * - horizontal or + * - vertical. + * + * When in "horizontal mode", items will be placed in @b columns, + * from top to bottom and, when the space for a column is filled, + * another one is started on the right, thus expanding the grid + * horizontally, making for horizontal scrolling. When in "vertical + * mode" , though, items will be placed in @b rows, from left to + * right and, when the space for a row is filled, another one is + * started below, thus expanding the grid vertically (and making + * for vertical scrolling). + * + * @section Gengrid_Items Gengrid items + * + * An item in a gengrid can have 0 or more texts (they can be + * regular text or textblock Evas objects - that's up to the style + * to determine), 0 or more contents (which are simply objects + * swallowed into the gengrid item's theming Edje object) and 0 or + * more boolean states, which have the behavior left to the + * user to define. The Edje part names for each of these properties + * will be looked up, in the theme file for the gengrid, under the + * Edje (string) data items named @c "texts", @c "contents" and @c + * "states", respectively. For each of those properties, if more + * than one part is provided, they must have names listed separated + * by spaces in the data fields. For the default gengrid item + * theme, we have @b one text part (@c "elm.text"), @b two content + * parts (@c "elm.swalllow.icon" and @c "elm.swallow.end") and @b + * no state parts. + * + * A gengrid item may be at one of several styles. Elementary + * provides one by default - "default", but this can be extended by + * system or application custom themes/overlays/extensions (see + * @ref Theme "themes" for more details). + * + * @section Gengrid_Item_Class Gengrid item classes + * + * In order to have the ability to add and delete items on the fly, + * gengrid implements a class (callback) system where the + * application provides a structure with information about that + * type of item (gengrid may contain multiple different items with + * different classes, states and styles). Gengrid will call the + * functions in this struct (methods) when an item is "realized" + * (i.e., created dynamically, while the user is scrolling the + * grid). All objects will simply be deleted when no longer needed + * with evas_object_del(). The #Elm_GenGrid_Item_Class structure + * contains the following members: + * - @c item_style - This is a constant string and simply defines + * the name of the item style. It @b must be specified and the + * default should be @c "default". + * - @c func.text_get - This function is called when an item + * object is actually created. The @c data parameter will point to + * the same data passed to elm_gengrid_item_append() and related + * item creation functions. The @c obj parameter is the gengrid + * object itself, while the @c part one is the name string of one + * of the existing text parts in the Edje group implementing the + * item's theme. This function @b must return a strdup'()ed string, + * as the caller will free() it when done. See + * #Elm_Gengrid_Item_Text_Get_Cb. + * - @c func.content_get - This function is called when an item object + * is actually created. The @c data parameter will point to the + * same data passed to elm_gengrid_item_append() and related item + * creation functions. The @c obj parameter is the gengrid object + * itself, while the @c part one is the name string of one of the + * existing (content) swallow parts in the Edje group implementing the + * item's theme. It must return @c NULL, when no content is desired, + * or a valid object handle, otherwise. The object will be deleted + * by the gengrid on its deletion or when the item is "unrealized". + * See #Elm_Gengrid_Item_Content_Get_Cb. + * - @c func.state_get - This function is called when an item + * object is actually created. The @c data parameter will point to + * the same data passed to elm_gengrid_item_append() and related + * item creation functions. The @c obj parameter is the gengrid + * object itself, while the @c part one is the name string of one + * of the state parts in the Edje group implementing the item's + * theme. Return @c EINA_FALSE for false/off or @c EINA_TRUE for + * true/on. Gengrids will emit a signal to its theming Edje object + * with @c "elm,state,xxx,active" and @c "elm" as "emission" and + * "source" arguments, respectively, when the state is true (the + * default is false), where @c xxx is the name of the (state) part. + * See #Elm_Gengrid_Item_State_Get_Cb. + * - @c func.del - This is called when elm_object_item_del() is + * called on an item or elm_gengrid_clear() is called on the + * gengrid. This is intended for use when gengrid items are + * deleted, so any data attached to the item (e.g. its data + * parameter on creation) can be deleted. See #Elm_Gengrid_Item_Del_Cb. + * + * @section Gengrid_Usage_Hints Usage hints + * + * If the user wants to have multiple items selected at the same + * time, elm_gengrid_multi_select_set() will permit it. If the + * gengrid is single-selection only (the default), then + * elm_gengrid_select_item_get() will return the selected item or + * @c NULL, if none is selected. If the gengrid is under + * multi-selection, then elm_gengrid_selected_items_get() will + * return a list (that is only valid as long as no items are + * modified (added, deleted, selected or unselected) of child items + * on a gengrid. + * + * If an item changes (internal (boolean) state, text or content + * changes), then use elm_gengrid_item_update() to have gengrid + * update the item with the new state. A gengrid will re-"realize" + * the item, thus calling the functions in the + * #Elm_Gengrid_Item_Class set for that item. + * + * To programmatically (un)select an item, use + * elm_gengrid_item_selected_set(). To get its selected state use + * elm_gengrid_item_selected_get(). To make an item disabled + * (unable to be selected and appear differently) use + * elm_object_item_disabled_set() to set this and + * elm_object_item_disabled_get() to get the disabled state. + * + * Grid cells will only have their selection smart callbacks called + * when firstly getting selected. Any further clicks will do + * nothing, unless you enable the "always select mode", with + * elm_gengrid_select_mode_set() as ELM_OBJECT_SELECT_MODE_ALWAYS, + * thus making every click to issue selection callbacks. + * elm_gengrid_select_mode_set() as ELM_OBJECT_SELECT_MODE_NONE will + * turn off the ability to select items entirely in the widget and + * they will neither appear selected nor call the selection smart + * callbacks. + * + * Remember that you can create new styles and add your own theme + * augmentation per application with elm_theme_extension_add(). If + * you absolutely must have a specific style that overrides any + * theme the user or system sets up you can use + * elm_theme_overlay_add() to add such a file. + * + * @section Gengrid_Smart_Events Gengrid smart events + * + * Smart events that you can add callbacks for are: + * - @c "activated" - The user has double-clicked or pressed + * (enter|return|spacebar) on an item. The @c event_info parameter + * is the gengrid item that was activated. + * - @c "clicked,double" - The user has double-clicked an item. + * The @c event_info parameter is the gengrid item that was double-clicked. + * - @c "longpressed" - This is called when the item is pressed for a certain + * amount of time. By default it's 1 second. + * - @c "selected" - The user has made an item selected. The + * @c event_info parameter is the gengrid item that was selected. + * - @c "unselected" - The user has made an item unselected. The + * @c event_info parameter is the gengrid item that was unselected. + * - @c "realized" - This is called when the item in the gengrid + * has its implementing Evas object instantiated, de facto. @c + * event_info is the gengrid item that was created. The object + * may be deleted at any time, so it is highly advised to the + * caller @b not to use the object pointer returned from + * elm_gengrid_item_object_get(), because it may point to freed + * objects. + * - @c "unrealized" - This is called when the implementing Evas + * object for this item is deleted. @c event_info is the gengrid + * item that was deleted. + * - @c "changed" - Called when an item is added, removed, resized + * or moved and when the gengrid is resized or gets "horizontal" + * property changes. + * - @c "scroll,anim,start" - This is called when scrolling animation has + * started. + * - @c "scroll,anim,stop" - This is called when scrolling animation has + * stopped. + * - @c "drag,start,up" - Called when the item in the gengrid has + * been dragged (not scrolled) up. + * - @c "drag,start,down" - Called when the item in the gengrid has + * been dragged (not scrolled) down. + * - @c "drag,start,left" - Called when the item in the gengrid has + * been dragged (not scrolled) left. + * - @c "drag,start,right" - Called when the item in the gengrid has + * been dragged (not scrolled) right. + * - @c "drag,stop" - Called when the item in the gengrid has + * stopped being dragged. + * - @c "drag" - Called when the item in the gengrid is being + * dragged. + * - @c "scroll" - called when the content has been scrolled + * (moved). + * - @c "scroll,drag,start" - called when dragging the content has + * started. + * - @c "scroll,drag,stop" - called when dragging the content has + * stopped. + * - @c "edge,top" - This is called when the gengrid is scrolled until + * the top edge. + * - @c "edge,bottom" - This is called when the gengrid is scrolled + * until the bottom edge. + * - @c "edge,left" - This is called when the gengrid is scrolled + * until the left edge. + * - @c "edge,right" - This is called when the gengrid is scrolled + * until the right edge. + * + * Supported elm_object common APIs + * @li elm_object_signal_emit() + * + * Supported elm_object_item common APIs + * @li elm_object_item_part_content_get() + * @li elm_object_item_part_content_set() + * @li elm_object_item_part_content_unset() + * @li elm_object_item_part_text_set() + * @li elm_object_item_part_text_get() + * @li elm_object_item_disabled_set() + * @li elm_object_item_disabled_get() + * + * List of gengrid examples: + * @li @ref gengrid_example + */ + +/** + * @addtogroup Gengrid + * @{ + */ + +#define ELM_GENGRID_ITEM_CLASS_VERSION ELM_GEN_ITEM_CLASS_VERSION +#define ELM_GENGRID_ITEM_CLASS_HEADER ELM_GEN_ITEM_CLASS_HEADER + +/** + * Defines where to position the item in the genlist. + * + * @ingroup Genlist + */ +typedef enum +{ + ELM_GENGRID_ITEM_SCROLLTO_NONE = 0, /**< no scrollto */ + ELM_GENGRID_ITEM_SCROLLTO_IN = (1 << 0), /**< to the nearest viewport */ + ELM_GENGRID_ITEM_SCROLLTO_TOP = (1 << 1), /**< to the top of viewport */ + ELM_GENGRID_ITEM_SCROLLTO_MIDDLE = (1 << 2) /**< to the middle of viewport */ +} Elm_Gengrid_Item_Scrollto_Type; + + +/** + * @see Elm_Gen_Item_Class + */ +typedef Elm_Gen_Item_Class Elm_Gengrid_Item_Class; + +/** + * @see Elm_Gen_Item_Text_Get_Cb + */ +typedef Elm_Gen_Item_Text_Get_Cb Elm_Gengrid_Item_Text_Get_Cb; + +/** + * @see Elm_Gen_Item_Content_Get_Cb + */ +typedef Elm_Gen_Item_Content_Get_Cb Elm_Gengrid_Item_Content_Get_Cb; + +/** + * @see Elm_Gen_Item_State_Get_Cb + */ +typedef Elm_Gen_Item_State_Get_Cb Elm_Gengrid_Item_State_Get_Cb; + +/** + * @see Elm_Gen_Item_Del_Cb + */ +typedef Elm_Gen_Item_Del_Cb Elm_Gengrid_Item_Del_Cb; + +/** + * Add a new gengrid widget to the given parent Elementary + * (container) object + * + * @param parent The parent object + * @return a new gengrid widget handle or @c NULL, on errors + * + * This function inserts a new gengrid widget on the canvas. + * + * @see elm_gengrid_item_size_set() + * @see elm_gengrid_group_item_size_set() + * @see elm_gengrid_horizontal_set() + * @see elm_gengrid_item_append() + * @see elm_object_item_del() + * @see elm_gengrid_clear() + * + * @ingroup Gengrid + */ +EAPI Evas_Object *elm_gengrid_add(Evas_Object *parent); + +/** + * Remove all items from a given gengrid widget + * + * @param obj The gengrid object. + * + * This removes (and deletes) all items in @p obj, leaving it + * empty. + * + * @see elm_object_item_del(), to remove just one item. + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_clear(Evas_Object *obj); + +/** + * Enable or disable multi-selection in a given gengrid widget + * + * @param obj The gengrid object. + * @param multi @c EINA_TRUE, to enable multi-selection, + * @c EINA_FALSE to disable it. + * + * Multi-selection is the ability to have @b more than one + * item selected, on a given gengrid, simultaneously. When it is + * enabled, a sequence of clicks on different items will make them + * all selected, progressively. A click on an already selected item + * will unselect it. If interacting via the keyboard, + * multi-selection is enabled while holding the "Shift" key. + * + * @note By default, multi-selection is @b disabled on gengrids + * + * @see elm_gengrid_multi_select_get() + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_multi_select_set(Evas_Object *obj, Eina_Bool multi); + +/** + * Get whether multi-selection is enabled or disabled for a given + * gengrid widget + * + * @param obj The gengrid object. + * @return @c EINA_TRUE, if multi-selection is enabled, @c + * EINA_FALSE otherwise + * + * @see elm_gengrid_multi_select_set() for more details + * + * @ingroup Gengrid + */ +EAPI Eina_Bool elm_gengrid_multi_select_get(const Evas_Object *obj); + +/** + * Set the direction in which a given gengrid widget will expand while + * placing its items. + * + * @param obj The gengrid object. + * @param horizontal @c EINA_TRUE to make the gengrid expand + * horizontally, @c EINA_FALSE to expand vertically. + * + * When in "horizontal mode" (@c EINA_TRUE), items will be placed + * in @b columns, from top to bottom and, when the space for a + * column is filled, another one is started on the right, thus + * expanding the grid horizontally. When in "vertical mode" + * (@c EINA_FALSE), though, items will be placed in @b rows, from left + * to right and, when the space for a row is filled, another one is + * started below, thus expanding the grid vertically. + * + * @see elm_gengrid_horizontal_get() + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_horizontal_set(Evas_Object *obj, Eina_Bool horizontal); + +/** + * Get for what direction a given gengrid widget will expand while + * placing its items. + * + * @param obj The gengrid object. + * @return @c EINA_TRUE, if @p obj is set to expand horizontally, + * @c EINA_FALSE if it's set to expand vertically. + * + * @see elm_gengrid_horizontal_set() for more details + * + * @ingroup Gengrid + */ +EAPI Eina_Bool elm_gengrid_horizontal_get(const Evas_Object *obj); + +/** + * Enable or disable bouncing effect for a given gengrid widget + * + * @param obj The gengrid object + * @param h_bounce @c EINA_TRUE, to enable @b horizontal bouncing, + * @c EINA_FALSE to disable it + * @param v_bounce @c EINA_TRUE, to enable @b vertical bouncing, + * @c EINA_FALSE to disable it + * + * The bouncing effect occurs whenever one reaches the gengrid's + * edge's while panning it -- it will scroll past its limits a + * little bit and return to the edge again, in a animated for, + * automatically. + * + * @note By default, gengrids have bouncing enabled on both axis + * + * @see elm_gengrid_bounce_get() + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce); + +/** + * Get whether bouncing effects are enabled or disabled, for a + * given gengrid widget, on each axis + * + * @param obj The gengrid object + * @param h_bounce Pointer to a variable where to store the + * horizontal bouncing flag. + * @param v_bounce Pointer to a variable where to store the + * vertical bouncing flag. + * + * @see elm_gengrid_bounce_set() for more details + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce); + +/** + * Append a new item in a given gengrid widget. + * + * @param obj The gengrid object. + * @param gic The item class for the item. + * @param data The item data. + * @param func Convenience function called when the item is + * selected. + * @param func_data Data to be passed to @p func. + * @return A handle to the item added or @c NULL, on errors. + * + * This adds an item to the beginning of the gengrid. + * + * @see elm_gengrid_item_prepend() + * @see elm_gengrid_item_insert_before() + * @see elm_gengrid_item_insert_after() + * @see elm_object_item_del() + * + * @ingroup Gengrid + */ +EAPI Elm_Object_Item *elm_gengrid_item_append(Evas_Object *obj, const Elm_Gengrid_Item_Class *gic, const void *data, Evas_Smart_Cb func, const void *func_data); + +/** + * Prepend a new item in a given gengrid widget. + * + * @param obj The gengrid object. + * @param gic The item class for the item. + * @param data The item data. + * @param func Convenience function called when the item is + * selected. + * @param func_data Data to be passed to @p func. + * @return A handle to the item added or @c NULL, on errors. + * + * This adds an item to the end of the gengrid. + * + * @see elm_gengrid_item_append() + * @see elm_gengrid_item_insert_before() + * @see elm_gengrid_item_insert_after() + * @see elm_object_item_del() + * + * @ingroup Gengrid + */ +EAPI Elm_Object_Item *elm_gengrid_item_prepend(Evas_Object *obj, const Elm_Gengrid_Item_Class *gic, const void *data, Evas_Smart_Cb func, const void *func_data); + +/** + * Insert an item before another in a gengrid widget + * + * @param obj The gengrid object. + * @param gic The item class for the item. + * @param data The item data. + * @param relative The item to place this new one before. + * @param func Convenience function called when the item is + * selected. + * @param func_data Data to be passed to @p func. + * @return A handle to the item added or @c NULL, on errors. + * + * This inserts an item before another in the gengrid. + * + * @see elm_gengrid_item_append() + * @see elm_gengrid_item_prepend() + * @see elm_gengrid_item_insert_after() + * @see elm_object_item_del() + * + * @ingroup Gengrid + */ +EAPI Elm_Object_Item *elm_gengrid_item_insert_before(Evas_Object *obj, const Elm_Gengrid_Item_Class *gic, const void *data, Elm_Object_Item *relative, Evas_Smart_Cb func, const void *func_data); + +/** + * Insert an item after another in a gengrid widget + * + * @param obj The gengrid object. + * @param gic The item class for the item. + * @param data The item data. + * @param relative The item to place this new one after. + * @param func Convenience function called when the item is + * selected. + * @param func_data Data to be passed to @p func. + * @return A handle to the item added or @c NULL, on errors. + * + * This inserts an item after another in the gengrid. + * + * @see elm_gengrid_item_append() + * @see elm_gengrid_item_prepend() + * @see elm_gengrid_item_insert_after() + * @see elm_object_item_del() + * + * @ingroup Gengrid + */ +EAPI Elm_Object_Item *elm_gengrid_item_insert_after(Evas_Object *obj, const Elm_Gengrid_Item_Class *gic, const void *data, Elm_Object_Item *relative, Evas_Smart_Cb func, const void *func_data); + +/** + * Insert an item in a gengrid widget using a user-defined sort function. + * + * @param obj The gengrid object. + * @param gic The item class for the item. + * @param data The item data. + * @param comp User defined comparison function that defines the sort order + * based on Elm_Gen_Item and its data param. + * @param func Convenience function called when the item is selected. + * @param func_data Data to be passed to @p func. + * @return A handle to the item added or @c NULL, on errors. + * + * This inserts an item in the gengrid based on user defined comparison + * function. The two arguments passed to the function @p func are gengrid + * item handles to compare. + * + * @see elm_gengrid_item_append() + * @see elm_gengrid_item_prepend() + * @see elm_gengrid_item_insert_after() + * @see elm_object_item_del() + * + * @ingroup Gengrid + */ +EAPI Elm_Object_Item *elm_gengrid_item_sorted_insert(Evas_Object *obj, const Elm_Gengrid_Item_Class *gic, const void *data, Eina_Compare_Cb comp, Evas_Smart_Cb func, const void *func_data); + +/** + * Get the selected item in a given gengrid widget + * + * @param obj The gengrid object. + * @return The selected item's handle or @c NULL, if none is + * selected at the moment (and on errors) + * + * This returns the selected item in @p obj. If multi selection is + * enabled on @p obj (@see elm_gengrid_multi_select_set()), only + * the first item in the list is selected, which might not be very + * useful. For that case, see elm_gengrid_selected_items_get(). + * + * @ingroup Gengrid + */ +EAPI Elm_Object_Item *elm_gengrid_selected_item_get(const Evas_Object *obj); + +/** + * Get a list of selected items in a given gengrid + * + * @param obj The gengrid object. + * @return The list of selected items or @c NULL, if none is + * selected at the moment (and on errors) + * + * This returns a list of the selected items, in the order that + * they appear in the grid. This list is only valid as long as no + * more items are selected or unselected (or unselected implicitly + * by deletion). The list contains #Gengrid item pointers as + * data, naturally. + * + * @see elm_gengrid_selected_item_get() + * + * @ingroup Gengrid + */ +EAPI const Eina_List *elm_gengrid_selected_items_get(const Evas_Object *obj); + +/** + * Get a list of realized items in gengrid + * + * @param obj The gengrid object + * @return The list of realized items, nor NULL if none are realized. + * + * This returns a list of the realized items in the gengrid. The list + * contains gengrid item pointers. The list must be freed by the + * caller when done with eina_list_free(). The item pointers in the + * list are only valid so long as those items are not deleted or the + * gengrid is not deleted. + * + * @see elm_gengrid_realized_items_update() + * + * @ingroup Gengrid + */ +EAPI Eina_List *elm_gengrid_realized_items_get(const Evas_Object *obj); + +/** + * Update the contents of all realized items. + * + * @param obj The gengrid object. + * + * This updates all realized items by calling all the item class functions again + * to get the contents, texts and states. Use this when the original + * item data has changed and the changes are desired to be reflected. + * + * To update just one item, use elm_gengrid_item_update(). + * + * @see elm_gengrid_realized_items_get() + * @see elm_gengrid_item_update() + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_realized_items_update(Evas_Object *obj); + +/** + * Get the first item in a given gengrid widget + * + * @param obj The gengrid object + * @return The first item's handle or @c NULL, if there are no + * items in @p obj (and on errors) + * + * This returns the first item in the @p obj's internal list of + * items. + * + * @see elm_gengrid_last_item_get() + * + * @ingroup Gengrid + */ +EAPI Elm_Object_Item *elm_gengrid_first_item_get(const Evas_Object *obj); + +/** + * Get the last item in a given gengrid widget + * + * @param obj The gengrid object + * @return The last item's handle or @c NULL, if there are no + * items in @p obj (and on errors) + * + * This returns the last item in the @p obj's internal list of + * items. + * + * @see elm_gengrid_first_item_get() + * + * @ingroup Gengrid + */ +EAPI Elm_Object_Item *elm_gengrid_last_item_get(const Evas_Object *obj); + +/** + * Set the scrollbar policy + * + * @param obj The gengrid object + * @param policy_h Horizontal scrollbar policy. + * @param policy_v Vertical scrollbar policy. + * + * This sets the scrollbar visibility policy for the given gengrid + * scroller. #ELM_SCROLLER_POLICY_AUTO means the scrollbar is + * made visible if it is needed, and otherwise kept hidden. + * #ELM_SCROLLER_POLICY_ON turns it on all the time, and + * #ELM_SCROLLER_POLICY_OFF always keeps it off. This applies + * respectively for the horizontal and vertical scrollbars. Default is + * #ELM_SCROLLER_POLICY_AUTO + * + * @see elm_gengrid_scroller_policy_get() + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v); + +/** + * Get the scrollbar policy + * + * @param obj The gengrid object + * @param policy_h Pointer to store the horizontal scrollbar policy. + * @param policy_v Pointer to store the vertical scrollbar policy. + * + * @see elm_gengrid_scroller_policy_set() + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v); + +/** + * Get the @b next item in a gengrid widget's internal list of items, + * given a handle to one of those items. + * + * @param it The gengrid item to fetch next from + * @return The item after @p item, or @c NULL if there's none (and + * on errors) + * + * This returns the item placed after the @p item, on the container + * gengrid. + * + * @see elm_gengrid_item_prev_get() + * + * @ingroup Gengrid + */ +EAPI Elm_Object_Item *elm_gengrid_item_next_get(const Elm_Object_Item *it); + +/** + * Get the @b previous item in a gengrid widget's internal list of items, + * given a handle to one of those items. + * + * @param it The gengrid item to fetch previous from + * @return The item before @p item, or @c NULL if there's none (and + * on errors) + * + * This returns the item placed before the @p item, on the container + * gengrid. + * + * @see elm_gengrid_item_next_get() + * + * @ingroup Gengrid + */ +EAPI Elm_Object_Item *elm_gengrid_item_prev_get(const Elm_Object_Item *it); + +/** + * Set whether a given gengrid item is selected or not + * + * @param it The gengrid item + * @param selected Use @c EINA_TRUE, to make it selected, @c + * EINA_FALSE to make it unselected + * + * This sets the selected state of an item. If multi-selection is + * not enabled on the containing gengrid and @p selected is @c + * EINA_TRUE, any other previously selected items will get + * unselected in favor of this new one. + * + * @see elm_gengrid_item_selected_get() + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_item_selected_set(Elm_Object_Item *it, Eina_Bool selected); + +/** + * Get whether a given gengrid item is selected or not + * + * @param it The gengrid item + * @return @c EINA_TRUE, if it's selected, @c EINA_FALSE otherwise + * + * This API returns EINA_TRUE for all the items selected in multi-select mode as well. + * + * @see elm_gengrid_item_selected_set() for more details + * + * @ingroup Gengrid + */ +EAPI Eina_Bool elm_gengrid_item_selected_get(const Elm_Object_Item *it); + +/** + * Show the portion of a gengrid's internal grid containing a given + * item, @b immediately. + * + * @param it The item to display + * @param type Where to position the item in the viewport. + * + * This causes gengrid to @b redraw its viewport's contents to the + * region containing the given @p item item, if it is not fully + * visible. + * + * @see elm_gengrid_item_bring_in() + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_item_show(Elm_Object_Item *it, Elm_Gengrid_Item_Scrollto_Type type); + +/** + * Animatedly bring in, to the visible area of a gengrid, a given + * item on it. + * + * @param it The gengrid item to display + * @param type Where to position the item in the viewport. + * + * This causes gengrid to jump to the given @p item and show + * it (by scrolling), if it is not fully visible. This will use + * animation to do so and take a period of time to complete. + * + * @see elm_gengrid_item_show() + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_item_bring_in(Elm_Object_Item *it, Elm_Gengrid_Item_Scrollto_Type type); + +/** + * Update the contents of a given gengrid item + * + * @param it The gengrid item + * + * This updates an item by calling all the item class functions + * again to get the contents, texts and states. Use this when the + * original item data has changed and you want the changes to be + * reflected. + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_item_update(Elm_Object_Item *it); + +/** + * Update the item class of a gengrid item. + * + * This sets another class of the item, changing the way that it is + * displayed. After changing the item class, elm_gengrid_item_update() is + * called on the item @p it. + * + * @param it The gengrid item + * @param gic The gengrid item class describing the function pointers and the item style. + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_item_item_class_update(Elm_Object_Item *it, const Elm_Gengrid_Item_Class *gic); + +/** + * Get the Gengrid Item class for the given Gengrid Item. + * + * @param it The gengrid item + * + * This returns the Gengrid_Item_Class for the given item. It can be used to examine + * the function pointers and item_style. + * + * @ingroup Gengrid + */ +EAPI const Elm_Gengrid_Item_Class *elm_gengrid_item_item_class_get(const Elm_Object_Item *it); + +/** + * Get the index of the item. It is only valid once displayed. + * + * @param it a gengrid item + * @return the position inside the list of item. + * + * @ingroup Gengrid + */ +EAPI int elm_gengrid_item_index_get(const Elm_Object_Item *it); + +/** + * Return how many items are currently in a list + * + * @param obj The list + * @return The total number of list items in the list + * + * This behavior is O(1) and includes items which may or may not be realized. + * + * @ingroup Gengrid + */ +EAPI unsigned int elm_gengrid_items_count(const Evas_Object *obj); + +/** + * Add a new gengrid item class in a given gengrid widget. + * + * @return New allocated a gengrid item class. + * + * This adds gengrid item class for the gengrid widget. When adding an item, + * gengrid_item_{append, prepend, insert} function needs item class of the item. + * Given callback parameters are used at retrieving {text, content} of + * added item. Set as NULL if it's not used. + * If there's no available memory, return can be NULL. + * + * @see elm_gengrid_item_class_free() + * @see elm_gengrid_item_append() + * + * @ingroup Gengrid + */ +EAPI Elm_Gengrid_Item_Class *elm_gengrid_item_class_new(void); + +/** + * Remove an item class in a given gengrid widget. + * + * @param itc The itc to be removed. + * + * This removes item class from the gengrid widget. + * Whenever it has no more references to it, item class is going to be freed. + * Otherwise it just decreases its reference count. + * + * @see elm_gengrid_item_class_new() + * @see elm_gengrid_item_class_ref() + * @see elm_gengrid_item_class_unref() + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_item_class_free(Elm_Gengrid_Item_Class *itc); + +/** + * Increments object reference count for the item class. + * + * @param itc The given item class object to reference + * + * This API just increases its reference count for item class management. + * + * @see elm_gengrid_item_class_unref() + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_item_class_ref(Elm_Gengrid_Item_Class *itc); + +/** + * Decrements object reference count for the item class. + * + * @param itc The given item class object to reference + * + * This API just decreases its reference count for item class management. + * Reference count can't be less than 0. + * + * @see elm_gengrid_item_class_ref() + * @see elm_gengrid_item_class_free() + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_item_class_unref(Elm_Gengrid_Item_Class *itc); + +/** + * Set the text to be shown in a given gengrid item's tooltips. + * + * @param it The gengrid item + * @param text The text to set in the content + * + * This call will setup the text to be used as tooltip to that item + * (analogous to elm_object_tooltip_text_set(), but being item + * tooltips with higher precedence than object tooltips). It can + * have only one tooltip at a time, so any previous tooltip data + * will get removed. + * + * In order to set a content or something else as a tooltip, look at + * elm_gengrid_item_tooltip_content_cb_set(). + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_item_tooltip_text_set(Elm_Object_Item *it, const char *text); + +/** + * Set the content to be shown in a given gengrid item's tooltip + * + * @param it The gengrid item. + * @param func The function returning the tooltip contents. + * @param data What to provide to @a func as callback data/context. + * @param del_cb Called when data is not needed anymore, either when + * another callback replaces @p func, the tooltip is unset with + * elm_gengrid_item_tooltip_unset() or the owner @p item + * dies. This callback receives as its first parameter the + * given @p data, being @c event_info the item handle. + * + * This call will setup the tooltip's contents to @p item + * (analogous to elm_object_tooltip_content_cb_set(), but being + * item tooltips with higher precedence than object tooltips). It + * can have only one tooltip at a time, so any previous tooltip + * content will get removed. @p func (with @p data) will be called + * every time Elementary needs to show the tooltip and it should + * return a valid Evas object, which will be fully managed by the + * tooltip system, getting deleted when the tooltip is gone. + * + * In order to set just a text as a tooltip, look at + * elm_gengrid_item_tooltip_text_set(). + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_item_tooltip_content_cb_set(Elm_Object_Item *it, Elm_Tooltip_Item_Content_Cb func, const void *data, Evas_Smart_Cb del_cb); + +/** + * Unset a tooltip from a given gengrid item + * + * @param it gengrid item to remove a previously set tooltip from. + * + * This call removes any tooltip set on @p item. The callback + * provided as @c del_cb to + * elm_gengrid_item_tooltip_content_cb_set() will be called to + * notify it is not used anymore (and have resources cleaned, if + * need be). + * + * @see elm_gengrid_item_tooltip_content_cb_set() + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_item_tooltip_unset(Elm_Object_Item *it); + +/** + * Set a different @b style for a given gengrid item's tooltip. + * + * @param it gengrid item with tooltip set + * @param style the theme style to use on tooltips (e.g. @c + * "default", @c "transparent", etc) + * + * Tooltips can have alternate styles to be displayed on, + * which are defined by the theme set on Elementary. This function + * works analogously as elm_object_tooltip_style_set(), but here + * applied only to gengrid item objects. The default style for + * tooltips is @c "default". + * + * @note before you set a style you should define a tooltip with + * elm_gengrid_item_tooltip_content_cb_set() or + * elm_gengrid_item_tooltip_text_set() + * + * @see elm_gengrid_item_tooltip_style_get() + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_item_tooltip_style_set(Elm_Object_Item *it, const char *style); + +/** + * Get the style set a given gengrid item's tooltip. + * + * @param it gengrid item with tooltip already set on. + * @return style the theme style in use, which defaults to + * "default". If the object does not have a tooltip set, + * then @c NULL is returned. + * + * @see elm_gengrid_item_tooltip_style_set() for more details + * + * @ingroup Gengrid + */ +EAPI const char *elm_gengrid_item_tooltip_style_get(const Elm_Object_Item *it); + +/** + * @brief Disable size restrictions on an object's tooltip + * @param it The tooltip's anchor object + * @param disable If EINA_TRUE, size restrictions are disabled + * @return EINA_FALSE on failure, EINA_TRUE on success + * + * This function allows a tooltip to expand beyond its parent window's canvas. + * It will instead be limited only by the size of the display. + */ +EAPI Eina_Bool elm_gengrid_item_tooltip_window_mode_set(Elm_Object_Item *it, Eina_Bool disable); + +/** + * @brief Retrieve size restriction state of an object's tooltip + * @param it The tooltip's anchor object + * @return If EINA_TRUE, size restrictions are disabled + * + * This function returns whether a tooltip is allowed to expand beyond + * its parent window's canvas. + * It will instead be limited only by the size of the display. + */ +EAPI Eina_Bool elm_gengrid_item_tooltip_window_mode_get(const Elm_Object_Item *it); + +/** + * Set the type of mouse pointer/cursor decoration to be shown, + * when the mouse pointer is over the given gengrid widget item + * + * @param it gengrid item to customize cursor on + * @param cursor the cursor type's name + * + * This function works analogously as elm_object_cursor_set(), but + * here the cursor's changing area is restricted to the item's + * area, and not the whole widget's. Note that that item cursors + * have precedence over widget cursors, so that a mouse over @p + * item will always show cursor @p type. + * + * If this function is called twice for an object, a previously set + * cursor will be unset on the second call. + * + * @see elm_object_cursor_set() + * @see elm_gengrid_item_cursor_get() + * @see elm_gengrid_item_cursor_unset() + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_item_cursor_set(Elm_Object_Item *it, const char *cursor); + +/** + * Get the type of mouse pointer/cursor decoration set to be shown, + * when the mouse pointer is over the given gengrid widget item + * + * @param it gengrid item with custom cursor set + * @return the cursor type's name or @c NULL, if no custom cursors + * were set to @p item (and on errors) + * + * @see elm_object_cursor_get() + * @see elm_gengrid_item_cursor_set() for more details + * @see elm_gengrid_item_cursor_unset() + * + * @ingroup Gengrid + */ +EAPI const char *elm_gengrid_item_cursor_get(const Elm_Object_Item *it); + +/** + * Unset any custom mouse pointer/cursor decoration set to be + * shown, when the mouse pointer is over the given gengrid widget + * item, thus making it show the @b default cursor again. + * + * @param it a gengrid item + * + * Use this call to undo any custom settings on this item's cursor + * decoration, bringing it back to defaults (no custom style set). + * + * @see elm_object_cursor_unset() + * @see elm_gengrid_item_cursor_set() for more details + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_item_cursor_unset(Elm_Object_Item *it); + +/** + * Set a different @b style for a given custom cursor set for a + * gengrid item. + * + * @param it gengrid item with custom cursor set + * @param style the theme style to use (e.g. @c "default", + * @c "transparent", etc) + * + * This function only makes sense when one is using custom mouse + * cursor decorations defined in a theme file , which can + * have, given a cursor name/type, alternate styles on + * it. It works analogously as elm_object_cursor_style_set(), but + * here applied only to gengrid item objects. + * + * @warning Before you set a cursor style you should have defined a + * custom cursor previously on the item, with + * elm_gengrid_item_cursor_set() + * + * @see elm_gengrid_item_cursor_engine_only_set() + * @see elm_gengrid_item_cursor_style_get() + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_item_cursor_style_set(Elm_Object_Item *it, const char *style); + +/** + * Get the current @b style set for a given gengrid item's custom + * cursor + * + * @param it gengrid item with custom cursor set. + * @return style the cursor style in use. If the object does not + * have a cursor set, then @c NULL is returned. + * + * @see elm_gengrid_item_cursor_style_set() for more details + * + * @ingroup Gengrid + */ +EAPI const char *elm_gengrid_item_cursor_style_get(const Elm_Object_Item *it); + +/** + * Set if the (custom) cursor for a given gengrid item should be + * searched in its theme, also, or should only rely on the + * rendering engine. + * + * @param it item with custom (custom) cursor already set on + * @param engine_only Use @c EINA_TRUE to have cursors looked for + * only on those provided by the rendering engine, @c EINA_FALSE to + * have them searched on the widget's theme, as well. + * + * @note This call is of use only if you've set a custom cursor + * for gengrid items, with elm_gengrid_item_cursor_set(). + * + * @note By default, cursors will only be looked for between those + * provided by the rendering engine. + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_item_cursor_engine_only_set(Elm_Object_Item *it, Eina_Bool engine_only); + +/** + * Get if the (custom) cursor for a given gengrid item is being + * searched in its theme, also, or is only relying on the rendering + * engine. + * + * @param it a gengrid item + * @return @c EINA_TRUE, if cursors are being looked for only on + * those provided by the rendering engine, @c EINA_FALSE if they + * are being searched on the widget's theme, as well. + * + * @see elm_gengrid_item_cursor_engine_only_set(), for more details + * + * @ingroup Gengrid + */ +EAPI Eina_Bool elm_gengrid_item_cursor_engine_only_get(const Elm_Object_Item *it); + +/** + * Set the size for the items of a given gengrid widget + * + * @param obj The gengrid object. + * @param w The items' width. + * @param h The items' height; + * + * A gengrid, after creation, has still no information on the size + * to give to each of its cells. So, you most probably will end up + * with squares one @ref Fingers "finger" wide, the default + * size. Use this function to force a custom size for you items, + * making them as big as you wish. + * + * @see elm_gengrid_item_size_get() + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_item_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h); + +/** + * Get the size set for the items of a given gengrid widget + * + * @param obj The gengrid object. + * @param w Pointer to a variable where to store the items' width. + * @param h Pointer to a variable where to store the items' height. + * + * @note Use @c NULL pointers on the size values you're not + * interested in: they'll be ignored by the function. + * + * @see elm_gengrid_item_size_get() for more details + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_item_size_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h); + +/** + * Set the size for the group items of a given gengrid widget + * + * @param obj The gengrid object. + * @param w The group items' width. + * @param h The group items' height; + * + * A gengrid, after creation, has still no information on the size + * to give to each of its cells. So, you most probably will end up + * with squares one @ref Fingers "finger" wide, the default + * size. Use this function to force a custom size for you group items, + * making them as big as you wish. + * + * @see elm_gengrid_group_item_size_get() + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_group_item_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h); + +/** + * Get the size set for the group items of a given gengrid widget + * + * @param obj The gengrid object. + * @param w Pointer to a variable where to store the group items' width. + * @param h Pointer to a variable where to store the group items' height. + * + * @note Use @c NULL pointers on the size values you're not + * interested in: they'll be ignored by the function. + * + * @see elm_gengrid_group_item_size_get() for more details + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_group_item_size_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h); + +/** + * Set the items grid's alignment within a given gengrid widget + * + * @param obj The gengrid object. + * @param align_x Alignment in the horizontal axis (0 <= align_x <= 1). + * @param align_y Alignment in the vertical axis (0 <= align_y <= 1). + * + * This sets the alignment of the whole grid of items of a gengrid + * within its given viewport. By default, those values are both + * 0.5, meaning that the gengrid will have its items grid placed + * exactly in the middle of its viewport. + * + * @note If given alignment values are out of the cited ranges, + * they'll be changed to the nearest boundary values on the valid + * ranges. + * + * @see elm_gengrid_align_get() + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_align_set(Evas_Object *obj, double align_x, double align_y); + +/** + * Get the items grid's alignment values within a given gengrid + * widget + * + * @param obj The gengrid object. + * @param align_x Pointer to a variable where to store the + * horizontal alignment. + * @param align_y Pointer to a variable where to store the vertical + * alignment. + * + * @note Use @c NULL pointers on the alignment values you're not + * interested in: they'll be ignored by the function. + * + * @see elm_gengrid_align_set() for more details + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_align_get(const Evas_Object *obj, double *align_x, double *align_y); + +/** + * Set whether a given gengrid widget is or not able have items + * @b reordered + * + * @param obj The gengrid object + * @param reorder_mode Use @c EINA_TRUE to turn reordering on, + * @c EINA_FALSE to turn it off + * + * If a gengrid is set to allow reordering, a click held for more + * than 0.5 over a given item will highlight it specially, + * signaling the gengrid has entered the reordering state. From + * that time on, the user will be able to, while still holding the + * mouse button down, move the item freely in the gengrid's + * viewport, replacing to said item to the locations it goes to. + * The replacements will be animated and, whenever the user + * releases the mouse button, the item being replaced gets a new + * definitive place in the grid. + * + * @see elm_gengrid_reorder_mode_get() + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_reorder_mode_set(Evas_Object *obj, Eina_Bool reorder_mode); + +/** + * Get whether a given gengrid widget is or not able have items + * @b reordered + * + * @param obj The gengrid object + * @return @c EINA_TRUE, if reordering is on, @c EINA_FALSE if it's + * off + * + * @see elm_gengrid_reorder_mode_set() for more details + * + * @ingroup Gengrid + */ +EAPI Eina_Bool elm_gengrid_reorder_mode_get(const Evas_Object *obj); + + +/** + * Set a given gengrid widget's scrolling page size, relative to + * its viewport size. + * + * @param obj The gengrid object + * @param h_pagerel The horizontal page (relative) size + * @param v_pagerel The vertical page (relative) size + * + * The gengrid's scroller is capable of binding scrolling by the + * user to "pages". It means that, while scrolling and, specially + * after releasing the mouse button, the grid will @b snap to the + * nearest displaying page's area. When page sizes are set, the + * grid's continuous content area is split into (equal) page sized + * pieces. + * + * This function sets the size of a page relatively to the + * viewport dimensions of the gengrid, for each axis. A value + * @c 1.0 means "the exact viewport's size", in that axis, while @c + * 0.0 turns paging off in that axis. Likewise, @c 0.5 means "half + * a viewport". Sane usable values are, than, between @c 0.0 and @c + * 1.0. Values beyond those will make it behave behave + * inconsistently. If you only want one axis to snap to pages, use + * the value @c 0.0 for the other one. + * + * There is a function setting page size values in @b absolute + * values, too -- elm_gengrid_page_size_set(). Naturally, its use + * is mutually exclusive to this one. + * + * @see elm_gengrid_page_relative_get() + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_page_relative_set(Evas_Object *obj, double h_pagerel, double v_pagerel); + +/** + * Get a given gengrid widget's scrolling page size, relative to + * its viewport size. + * + * @param obj The gengrid object + * @param h_pagerel Pointer to a variable where to store the + * horizontal page (relative) size + * @param v_pagerel Pointer to a variable where to store the + * vertical page (relative) size + * + * @see elm_gengrid_page_relative_set() for more details + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_page_relative_get(const Evas_Object *obj, double *h_pagerel, double *v_pagerel); + +/** + * Set a given gengrid widget's scrolling page size + * + * @param obj The gengrid object + * @param h_pagesize The horizontal page size, in pixels + * @param v_pagesize The vertical page size, in pixels + * + * The gengrid's scroller is capable of binding scrolling by the + * user to "pages". It means that, while scrolling and, specially + * after releasing the mouse button, the grid will @b snap to the + * nearest displaying page's area. When page sizes are set, the + * grid's continuous content area is split into (equal) page sized + * pieces. + * + * This function sets the size of a page of the gengrid, in pixels, + * for each axis. Sane usable values are, between @c 0 and the + * dimensions of @p obj, for each axis. Values beyond those will + * make it behave behave inconsistently. If you only want one axis + * to snap to pages, use the value @c 0 for the other one. + * + * There is a function setting page size values in @b relative + * values, too -- elm_gengrid_page_relative_set(). Naturally, its + * use is mutually exclusive to this one. + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_page_size_set(Evas_Object *obj, Evas_Coord h_pagesize, Evas_Coord v_pagesize); + +/** + * @brief Get gengrid current page number. + * + * @param obj The gengrid object + * @param h_pagenumber The horizontal page number + * @param v_pagenumber The vertical page number + * + * The page number starts from 0. 0 is the first page. + * Current page means the page which meet the top-left of the viewport. + * If there are two or more pages in the viewport, it returns the number of page + * which meet the top-left of the viewport. + * + * @see elm_gengrid_last_page_get() + * @see elm_gengrid_page_show() + * @see elm_gengrid_page_bring_in() + */ +EAPI void elm_gengrid_current_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber); + +/** + * @brief Get gengrid last page number. + * + * @param obj The gengrid object + * @param h_pagenumber The horizontal page number + * @param v_pagenumber The vertical page number + * + * The page number starts from 0. 0 is the first page. + * This returns the last page number among the pages. + * + * @see elm_gengrid_current_page_get() + * @see elm_gengrid_page_show() + * @see elm_gengrid_page_bring_in() + */ +EAPI void elm_gengrid_last_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber); + +/** + * Show a specific virtual region within the gengrid content object by page number. + * + * @param obj The gengrid object + * @param h_pagenumber The horizontal page number + * @param v_pagenumber The vertical page number + * + * 0, 0 of the indicated page is located at the top-left of the viewport. + * This will jump to the page directly without animation. + * + * Example of usage: + * + * @code + * sc = elm_gengrid_add(win); + * elm_gengrid_content_set(sc, content); + * elm_gengrid_page_relative_set(sc, 1, 0); + * elm_gengrid_current_page_get(sc, &h_page, &v_page); + * elm_gengrid_page_show(sc, h_page + 1, v_page); + * @endcode + * + * @see elm_gengrid_page_bring_in() + */ +EAPI void elm_gengrid_page_show(const Evas_Object *obj, int h_pagenumber, int v_pagenumber); + +/** + * Show a specific virtual region within the gengrid content object by page number. + * + * @param obj The gengrid object + * @param h_pagenumber The horizontal page number + * @param v_pagenumber The vertical page number + * + * 0, 0 of the indicated page is located at the top-left of the viewport. + * This will slide to the page with animation. + * + * Example of usage: + * + * @code + * sc = elm_gengrid_add(win); + * elm_gengrid_content_set(sc, content); + * elm_gengrid_page_relative_set(sc, 1, 0); + * elm_gengrid_last_page_get(sc, &h_page, &v_page); + * elm_gengrid_page_bring_in(sc, h_page, v_page); + * @endcode + * + * @see elm_gengrid_page_show() + */ +EAPI void elm_gengrid_page_bring_in(const Evas_Object *obj, int h_pagenumber, int v_pagenumber); + +/** + * Get a given gengrid item's position, relative to the whole + * gengrid's grid area. + * + * @param it The Gengrid item. + * @param x Pointer to variable to store the item's row number. + * @param y Pointer to variable to store the item's column number. + * + * This returns the "logical" position of the item within the + * gengrid. For example, @c (0, 1) would stand for first row, + * second column. + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_item_pos_get(const Elm_Object_Item *it, unsigned int *x, unsigned int *y); + +/** + * Set how the items grid's filled within a given gengrid widget + * + * @param obj The gengrid object. + * @param fill Filled if True + * + * This sets the fill state of the whole grid of items of a gengrid + * within its given viewport. By default, this value is false, meaning + * that if the first line of items grid's isn't filled, the items are + * centered with the alignment + * + * @see elm_gengrid_filled_get() + * + * @ingroup Gengrid + * + */ +EAPI void elm_gengrid_filled_set(Evas_Object *obj, Eina_Bool fill); + +/** + * Get how the items grid's filled within a given gengrid widget + * + * @param obj The gengrid object. + * @return @c EINA_TRUE, if filled is on, @c EINA_FALSE if it's + * off + * + * @note Use @c NULL pointers on the alignment values you're not + * interested in: they'll be ignored by the function. + * + * @see elm_gengrid_align_set() for more details + * + * @ingroup Gengrid + */ +EAPI Eina_Bool elm_gengrid_filled_get(const Evas_Object *obj); + +/** + * Set the gengrid select mode. + * + * @param obj The gengrid object + * @param mode The select mode + * + * elm_gengrid_select_mode_set() changes item select mode in the gengrid widget. + * - ELM_OBJECT_SELECT_MODE_DEFAULT : Items will only call their selection func and + * callback when first becoming selected. Any further clicks will + * do nothing, unless you set always select mode. + * - ELM_OBJECT_SELECT_MODE_ALWAYS : This means that, even if selected, + * every click will make the selected callbacks be called. + * - ELM_OBJECT_SELECT_MODE_NONE : This will turn off the ability to select items + * entirely and they will neither appear selected nor call selected + * callback functions. + * + * @see elm_gengrid_select_mode_get() + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_select_mode_set(Evas_Object *obj, Elm_Object_Select_Mode mode); + +/** + * Get the gengrid select mode. + * + * @param obj The gengrid object + * @return The select mode + * (If getting mode is failed, it returns ELM_OBJECT_SELECT_MODE_MAX) + * + * @see elm_gengrid_select_mode_set() + * + * @ingroup Gengrid + */ +EAPI Elm_Object_Select_Mode elm_gengrid_select_mode_get(const Evas_Object *obj); + +/** + * Set whether the gengrid items' should be highlighted when item selected. + * + * @param obj The gengrid object. + * @param highlight @c EINA_TRUE to enable highlight or @c EINA_FALSE to + * disable it. + * + * This will turn on/off the highlight effect when items are selected and + * they will or will not be highlighted. The selected and clicked + * callback functions will still be called. + * + * highlight is enabled by default. + * + * @see elm_gengrid_highlight_mode_get(). + * + * @ingroup Gengrid + */ + +EAPI void elm_gengrid_highlight_mode_set(Evas_Object *obj, Eina_Bool highlight); + +/** + * Get whether the gengrid items' should be highlighted when item selected. + * + * @param obj The gengrid object. + * @return @c EINA_TRUE means items can be highlighted. @c EINA_FALSE indicates + * they can't. If @p obj is @c NULL, @c EINA_FALSE is returned. + * + * @see elm_gengrid_highlight_mode_set() for details. + * + * @ingroup Gengrid + */ + +EAPI Eina_Bool elm_gengrid_highlight_mode_get(const Evas_Object *obj); + +/** + * Set the gengrid item's select mode. + * + * @param it The gengrid item object + * @param mode The select mode + * + * elm_gengrid_select_mode_set() changes item's select mode. + * - ELM_OBJECT_SELECT_MODE_DEFAULT : The item will only call their selection func and + * callback when first becoming selected. Any further clicks will + * do nothing, unless you set always select mode. + * - ELM_OBJECT_SELECT_MODE_ALWAYS : This means that, even if selected, + * every click will make the selected callbacks be called. + * - ELM_OBJECT_SELECT_MODE_NONE : This will turn off the ability to select the item + * entirely and they will neither appear selected nor call selected + * callback functions. + * - ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY : This will apply no-finger-size rule + * with ELM_OBJECT_SELECT_MODE_NONE. No-finger-size rule makes an item can be + * smaller than lower limit. Clickable objects should be bigger than + * human touch point device (your finger) for some touch or + * small screen devices. So it is enabled, the item can be shrink than + * predefined finger-size value. And the item will be updated. + * + * @see elm_gengrid_item_select_mode_get() + * + * @ingroup Gengrid + */ +EAPI void elm_gengrid_item_select_mode_set(Elm_Object_Item *it, Elm_Object_Select_Mode mode); + +/** + * Get the gengrid item's select mode. + * + * @param it The gengrid item object + * @return The select mode + * (If getting mode is failed, it returns ELM_OBJECT_SELECT_MODE_MAX) + * + * @see elm_gengrid_item_select_mode_set() + * + * @ingroup Gengrid + */ +EAPI Elm_Object_Select_Mode elm_gengrid_item_select_mode_get(const Elm_Object_Item *it); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_genlist.c b/libraries/elementary/src/lib/elm_genlist.c new file mode 100644 index 0000000..c8e5c69 --- /dev/null +++ b/libraries/elementary/src/lib/elm_genlist.c @@ -0,0 +1,6231 @@ +#include +#include +#include +#include +#include "elm_priv.h" +#include "els_scroller.h" +#include "elm_gen_common.h" + +// internally allocated +#define CLASS_ALLOCATED 0x3a70f11f + +#define MAX_ITEMS_PER_BLOCK 32 +#define REORDER_EFFECT_TIME 0.5 + +#define ELM_GEN_SETUP(wd) \ + (wd)->calc_cb = (Ecore_Cb)_calc_job; \ + (wd)->clear_cb = (Ecore_Cb)_clear_cb; \ + (wd)->sizing_cb = (Ecore_Cb)_sizing_eval + +#define ELM_GEN_ITEM_SETUP(it) \ + (it)->del_cb = (Ecore_Cb)_item_del; \ + (it)->highlight_cb = (Ecore_Cb)_item_highlight; \ + (it)->unsel_cb = (Ecore_Cb)_item_unselect; \ + (it)->unhighlight_cb = (Ecore_Cb)_item_unhighlight; \ + (it)->unrealize_cb = (Ecore_Cb)_item_unrealize_cb + +#define ELM_GENLIST_CHECK_ITC_VER(itc) \ + do \ + { \ + if (!itc) \ + { \ + ERR("Genlist_Item_Class(itc) is NULL"); \ + return; \ + } \ + if ((itc->version != ELM_GENLIST_ITEM_CLASS_VERSION) && \ + (itc->version != CLASS_ALLOCATED)) \ + { \ + ERR("Genlist_Item_Class version mismatched! current = (%d), required = (%d) or (%d)", itc->version, ELM_GENLIST_ITEM_CLASS_VERSION, CLASS_ALLOCATED); \ + return; \ + } \ + } \ + while (0) + +typedef struct _Item_Block Item_Block; +typedef struct _Item_Cache Item_Cache; + +struct Elm_Gen_Item_Type +{ + Elm_Gen_Item *it; + Item_Block *block; + Eina_List *items; + Evas_Coord w, h, minw, minh; + Elm_Gen_Item *group_item; + Elm_Genlist_Item_Type type; + Eina_List *deco_it_texts, *deco_it_contents, *deco_it_states, *deco_it_content_objs; + Eina_List *deco_all_texts, *deco_all_contents, *deco_all_states, *deco_all_content_objs; + Eina_List *flip_contents, *flip_content_objs; + Ecore_Timer *swipe_timer; + Evas_Coord scrl_x, scrl_y, old_scrl_y; + + Elm_Gen_Item *rel; + Evas_Object *deco_it_view; + int expanded_depth; + int order_num_in; + + Eina_Bool before : 1; + + Eina_Bool want_realize : 1; + Eina_Bool expanded : 1; + Eina_Bool mincalcd : 1; + Eina_Bool queued : 1; + Eina_Bool showme : 1; + Eina_Bool updateme : 1; + Eina_Bool nocache : 1; /* do not use cache for this item */ + Eina_Bool nocache_once : 1; /* do not use cache for this item only once */ + Eina_Bool stacking_even : 1; + Eina_Bool nostacking : 1; + Eina_Bool move_effect_enabled : 1; + Eina_Bool decorate_all_item_realized : 1; + Eina_Bool tree_effect_finished : 1; /* tree effect */ + Eina_Bool tree_effect_hideme : 1; /* item hide for tree effect */ +}; + +struct _Item_Block +{ + EINA_INLIST; + int count; + int num; + int reorder_offset; + Widget_Data *wd; + Eina_List *items; + Evas_Coord x, y, w, h, minw, minh; + int position; + int item_position_stamp; + + Eina_Bool position_update : 1; + Eina_Bool want_unrealize : 1; + Eina_Bool realized : 1; + Eina_Bool changed : 1; + Eina_Bool updateme : 1; + Eina_Bool showme : 1; + Eina_Bool must_recalc : 1; +}; + +struct _Item_Cache +{ + EINA_INLIST; + + Evas_Object *base_view, *spacer; + + const char *item_style; // it->itc->item_style + Eina_Bool tree : 1; // it->group + + Eina_Bool selected : 1; // it->selected + Eina_Bool disabled : 1; // it->disabled + Eina_Bool expanded : 1; // it->item->expanded +}; + +static const char *widtype = NULL; +static void _item_cache_zero(Widget_Data *wd); +static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, + Eina_Bool rtl); +static void _theme_hook(Evas_Object *obj); +static void _show_region_hook(void *data, + Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _item_realize(Elm_Gen_Item *it, + int in, + Eina_Bool calc); +static void _item_unrealize_cb(Elm_Gen_Item *it); +static void _item_block_unrealize(Item_Block *itb); +static void _calc_job(void *data); +static void _on_focus_hook(void *data, + Evas_Object *obj); +static Eina_Bool _item_multi_select_up(Widget_Data *wd); +static Eina_Bool _item_multi_select_down(Widget_Data *wd); +static Eina_Bool _item_single_select_up(Widget_Data *wd); +static Eina_Bool _item_single_select_down(Widget_Data *wd); +static Eina_Bool _event_hook(Evas_Object *obj, + Evas_Object *src, + Evas_Callback_Type type, + void *event_info); +static void _signal_emit_hook(Evas_Object *obj, + const char *emission, + const char *source); +static Eina_Bool _deselect_all_items(Widget_Data *wd); +static void _pan_calculate(Evas_Object *obj); +static void _pan_max_get(Evas_Object *obj, + Evas_Coord *x, + Evas_Coord *y); +static void _item_position(Elm_Gen_Item *it, + Evas_Object *obj, + Evas_Coord it_x, + Evas_Coord it_y); +static void _decorate_item_realize(Elm_Gen_Item *it); +static void _decorate_item_unrealize(Elm_Gen_Item *it); +static void _decorate_item_set(Elm_Gen_Item *it); +static void _decorate_item_unset(Widget_Data *wd); +static void _decorate_all_item_position(Elm_Gen_Item *it, int itx, int ity); +static void _decorate_all_item_realize(Elm_Gen_Item *it, Eina_Bool effect_on); +static void _decorate_all_item_unrealize(Elm_Gen_Item *it); +static void _group_items_recalc(void *data); +static void _item_move_after(Elm_Gen_Item *it, + Elm_Gen_Item *after); +static void _item_move_before(Elm_Gen_Item *it, + Elm_Gen_Item *before); +static void _item_auto_scroll(Widget_Data *wd); +static void _elm_genlist_clear(Evas_Object *obj, + Eina_Bool standby); +static void _pan_child_size_get(Evas_Object *obj, + Evas_Coord *w, + Evas_Coord *h); +static Evas_Object* _create_tray_alpha_bg(const Evas_Object *obj); +static void _item_contract_emit(Elm_Gen_Item *it); +static int _item_tree_effect_before(Elm_Gen_Item *it); +static void _item_tree_effect(Widget_Data *wd, int y); +static void _item_tree_effect_finish(Widget_Data *wd); +static Eina_Bool _tree_effect_animator_cb(void *data); + +static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION; + +static const char SIG_ACTIVATED[] = "activated"; +static const char SIG_CLICKED_DOUBLE[] = "clicked,double"; +static const char SIG_SELECTED[] = "selected"; +static const char SIG_UNSELECTED[] = "unselected"; +static const char SIG_EXPANDED[] = "expanded"; +static const char SIG_CONTRACTED[] = "contracted"; +static const char SIG_EXPAND_REQUEST[] = "expand,request"; +static const char SIG_CONTRACT_REQUEST[] = "contract,request"; +static const char SIG_REALIZED[] = "realized"; +static const char SIG_UNREALIZED[] = "unrealized"; +static const char SIG_DRAG_START_UP[] = "drag,start,up"; +static const char SIG_DRAG_START_DOWN[] = "drag,start,down"; +static const char SIG_DRAG_START_LEFT[] = "drag,start,left"; +static const char SIG_DRAG_START_RIGHT[] = "drag,start,right"; +static const char SIG_DRAG_STOP[] = "drag,stop"; +static const char SIG_DRAG[] = "drag"; +static const char SIG_LONGPRESSED[] = "longpressed"; +static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start"; +static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop"; +static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start"; +static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop"; +static const char SIG_EDGE_TOP[] = "edge,top"; +static const char SIG_EDGE_BOTTOM[] = "edge,bottom"; +static const char SIG_EDGE_LEFT[] = "edge,left"; +static const char SIG_EDGE_RIGHT[] = "edge,right"; +static const char SIG_MULTI_SWIPE_LEFT[] = "multi,swipe,left"; +static const char SIG_MULTI_SWIPE_RIGHT[] = "multi,swipe,right"; +static const char SIG_MULTI_SWIPE_UP[] = "multi,swipe,up"; +static const char SIG_MULTI_SWIPE_DOWN[] = "multi,swipe,down"; +static const char SIG_MULTI_PINCH_OUT[] = "multi,pinch,out"; +static const char SIG_MULTI_PINCH_IN[] = "multi,pinch,in"; +static const char SIG_SWIPE[] = "swipe"; +static const char SIG_MOVED[] = "moved"; +static const char SIG_MOVED_AFTER[] = "moved,after"; +static const char SIG_MOVED_BEFORE[] = "moved,before"; +static const char SIG_INDEX_UPDATE[] = "index,update"; +static const char SIG_TREE_EFFECT_FINISHED [] = "tree,effect,finished"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CLICKED_DOUBLE, ""}, + {SIG_ACTIVATED, ""}, + {SIG_SELECTED, ""}, + {SIG_UNSELECTED, ""}, + {SIG_EXPANDED, ""}, + {SIG_CONTRACTED, ""}, + {SIG_EXPAND_REQUEST, ""}, + {SIG_CONTRACT_REQUEST, ""}, + {SIG_REALIZED, ""}, + {SIG_UNREALIZED, ""}, + {SIG_DRAG_START_UP, ""}, + {SIG_DRAG_START_DOWN, ""}, + {SIG_DRAG_START_LEFT, ""}, + {SIG_DRAG_START_RIGHT, ""}, + {SIG_DRAG_STOP, ""}, + {SIG_DRAG, ""}, + {SIG_LONGPRESSED, ""}, + {SIG_SCROLL_ANIM_START, ""}, + {SIG_SCROLL_ANIM_STOP, ""}, + {SIG_SCROLL_DRAG_START, ""}, + {SIG_SCROLL_DRAG_STOP, ""}, + {SIG_EDGE_TOP, ""}, + {SIG_EDGE_BOTTOM, ""}, + {SIG_EDGE_LEFT, ""}, + {SIG_EDGE_RIGHT, ""}, + {SIG_MULTI_SWIPE_LEFT, ""}, + {SIG_MULTI_SWIPE_RIGHT, ""}, + {SIG_MULTI_SWIPE_UP, ""}, + {SIG_MULTI_SWIPE_DOWN, ""}, + {SIG_MULTI_PINCH_OUT, ""}, + {SIG_MULTI_PINCH_IN, ""}, + {SIG_SWIPE, ""}, + {SIG_MOVED, ""}, + {SIG_MOVED_AFTER, ""}, + {SIG_MOVED_BEFORE, ""}, + {SIG_TREE_EFFECT_FINISHED, ""}, + {NULL, NULL} +}; + +/* TEMPORARY */ +#undef ELM_CHECK_WIDTYPE +#define ELM_CHECK_WIDTYPE(obj, widtype) \ + if ((!obj) || (!elm_genlist_type_check((obj), __func__))) return +#undef ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN +#define ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, ...) \ + ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, __VA_ARGS__); \ + ELM_CHECK_WIDTYPE(WIDGET((it)), widtype) __VA_ARGS__; + +static const char *_gengrid = NULL; +static const char *_genlist = NULL; + +/* THIS FUNCTION IS HACKY AND TEMPORARY!!! */ +Eina_Bool +elm_genlist_type_check(const Evas_Object *obj, + const char *func) +{ + const char *provided, *expected = "(unknown)"; + static int abort_on_warn = -1; + provided = elm_widget_type_get(obj); + if (!_genlist) _genlist = eina_stringshare_add("genlist"); + if (!_gengrid) _gengrid = eina_stringshare_add("gengrid"); + if (EINA_LIKELY(provided == _genlist) || EINA_LIKELY(provided == _gengrid)) + return EINA_TRUE; + if ((!provided) || (!provided[0])) + { + provided = evas_object_type_get(obj); + if ((!provided) || (!provided[0])) + provided = "(unknown)"; + } + ERR("Passing Object: %p in function: %s, of type: '%s' when expecting type: '%s'", obj, func, provided, expected); + if (abort_on_warn == -1) + { + if (getenv("ELM_ERROR_ABORT")) abort_on_warn = 1; + else abort_on_warn = 0; + } + if (abort_on_warn == 1) abort(); + return EINA_FALSE; +} + +static Eina_Bool +_event_hook(Evas_Object *obj, + Evas_Object *src __UNUSED__, + Evas_Callback_Type type, + void *event_info) +{ + if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE; + Evas_Event_Key_Down *ev = event_info; + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord pan_max_x = 0, pan_max_y = 0; + if (!wd) return EINA_FALSE; + if (!wd->items) return EINA_FALSE; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; + if (elm_widget_disabled_get(obj)) return EINA_FALSE; + + Elm_Object_Item *it = NULL; + Evas_Coord x = 0; + Evas_Coord y = 0; + Evas_Coord step_x = 0; + Evas_Coord step_y = 0; + Evas_Coord v_w = 0; + Evas_Coord v_h = 0; + Evas_Coord page_x = 0; + Evas_Coord page_y = 0; + + elm_smart_scroller_child_pos_get(wd->scr, &x, &y); + elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y); + elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y); + elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h); + + if ((!strcmp(ev->keyname, "Left")) || + ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string))) + { + x -= step_x; + } + else if ((!strcmp(ev->keyname, "Right")) || + ((!strcmp(ev->keyname, "KP_Right")) && (!ev->string))) + { + x += step_x; + } + else if ((!strcmp(ev->keyname, "Up")) || + ((!strcmp(ev->keyname, "KP_Up")) && (!ev->string))) + { + if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) && + (_item_multi_select_up(wd))) + || (_item_single_select_up(wd))) + { + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else + y -= step_y; + } + else if ((!strcmp(ev->keyname, "Down")) || + ((!strcmp(ev->keyname, "KP_Down")) && (!ev->string))) + { + if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) && + (_item_multi_select_down(wd))) + || (_item_single_select_down(wd))) + { + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else + y += step_y; + } + else if ((!strcmp(ev->keyname, "Home")) || + ((!strcmp(ev->keyname, "KP_Home")) && (!ev->string))) + { + it = elm_genlist_first_item_get(obj); + elm_genlist_item_bring_in(it, ELM_GENLIST_ITEM_SCROLLTO_IN); + elm_genlist_item_selected_set(it, EINA_TRUE); + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else if ((!strcmp(ev->keyname, "End")) || + ((!strcmp(ev->keyname, "KP_End")) && (!ev->string))) + { + it = elm_genlist_last_item_get(obj); + elm_genlist_item_bring_in(it, ELM_GENLIST_ITEM_SCROLLTO_IN); + elm_genlist_item_selected_set(it, EINA_TRUE); + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else if ((!strcmp(ev->keyname, "Prior")) || + ((!strcmp(ev->keyname, "KP_Prior")) && (!ev->string))) + { + if (page_y < 0) + y -= -(page_y * v_h) / 100; + else + y -= page_y; + } + else if ((!strcmp(ev->keyname, "Next")) || + ((!strcmp(ev->keyname, "KP_Next")) && (!ev->string))) + { + if (page_y < 0) + y += -(page_y * v_h) / 100; + else + y += page_y; + } + else if (!strcmp(ev->keyname, "Escape")) + { + if (!_deselect_all_items(wd)) return EINA_FALSE; + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else if (((!strcmp(ev->keyname, "Return")) || + (!strcmp(ev->keyname, "KP_Enter")) || + (!strcmp(ev->keyname, "space"))) + && (!wd->multi) && (wd->selected)) + { + it = elm_genlist_selected_item_get(obj); + elm_genlist_item_expanded_set(it, + !elm_genlist_item_expanded_get(it)); + evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it); + } + else return EINA_FALSE; + + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + _pan_max_get(wd->pan_smart, &pan_max_x, &pan_max_y); + if (x < 0) x = 0; + if (x > pan_max_x) x = pan_max_x; + if (y < 0) y = 0; + if (y > pan_max_y) y = pan_max_y; + elm_smart_scroller_child_pos_set(wd->scr, x, y); + return EINA_TRUE; +} + +static Eina_Bool +_deselect_all_items(Widget_Data *wd) +{ + if (!wd->selected) return EINA_FALSE; + while (wd->selected) + elm_genlist_item_selected_set(wd->selected->data, EINA_FALSE); + + return EINA_TRUE; +} + +static Eina_Bool +_item_multi_select_up(Widget_Data *wd) +{ + if (!wd->selected) return EINA_FALSE; + if (!wd->multi) return EINA_FALSE; + + Elm_Object_Item *prev = elm_genlist_item_prev_get(wd->last_selected_item); + if (!prev) return EINA_TRUE; + + if (elm_genlist_item_selected_get(prev)) + { + elm_genlist_item_selected_set(wd->last_selected_item, EINA_FALSE); + wd->last_selected_item = prev; + elm_genlist_item_show(wd->last_selected_item, ELM_GENLIST_ITEM_SCROLLTO_IN); + } + else + { + elm_genlist_item_selected_set(prev, EINA_TRUE); + elm_genlist_item_show(prev, ELM_GENLIST_ITEM_SCROLLTO_IN); + } + return EINA_TRUE; +} + +static Eina_Bool +_item_multi_select_down(Widget_Data *wd) +{ + if (!wd->selected) return EINA_FALSE; + if (!wd->multi) return EINA_FALSE; + + Elm_Object_Item *next; + next = elm_genlist_item_next_get(wd->last_selected_item); + if (!next) return EINA_TRUE; + + if (elm_genlist_item_selected_get(next)) + { + elm_genlist_item_selected_set(wd->last_selected_item, EINA_FALSE); + wd->last_selected_item = next; + elm_genlist_item_show(wd->last_selected_item, ELM_GENLIST_ITEM_SCROLLTO_IN); + } + else + { + elm_genlist_item_selected_set(next, EINA_TRUE); + elm_genlist_item_show(next, ELM_GENLIST_ITEM_SCROLLTO_IN); + } + return EINA_TRUE; +} + +static Eina_Bool +_item_single_select_up(Widget_Data *wd) +{ + Elm_Gen_Item *prev; + if (!wd->selected) + { + prev = ELM_GEN_ITEM_FROM_INLIST(wd->items->last); + while ((prev) && (prev->generation < wd->generation)) + prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev); + } + else prev = (Elm_Gen_Item *) elm_genlist_item_prev_get(wd->last_selected_item); + + if (!prev) return EINA_FALSE; + + _deselect_all_items(wd); + + elm_genlist_item_selected_set((Elm_Object_Item *) prev, EINA_TRUE); + elm_genlist_item_show((Elm_Object_Item *) prev, ELM_GENLIST_ITEM_SCROLLTO_IN); + return EINA_TRUE; +} + +static Eina_Bool +_item_single_select_down(Widget_Data *wd) +{ + Elm_Gen_Item *next; + if (!wd->selected) + { + next = ELM_GEN_ITEM_FROM_INLIST(wd->items); + while ((next) && (next->generation < wd->generation)) + next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next); + } + else next = (Elm_Gen_Item *) elm_genlist_item_next_get(wd->last_selected_item); + + if (!next) return EINA_FALSE; + + _deselect_all_items(wd); + + elm_genlist_item_selected_set((Elm_Object_Item *) next, EINA_TRUE); + elm_genlist_item_show((Elm_Object_Item *) next, ELM_GENLIST_ITEM_SCROLLTO_IN); + return EINA_TRUE; +} + +static void +_on_focus_hook(void *data __UNUSED__, + Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (elm_widget_focus_get(obj)) + { + elm_object_signal_emit(wd->obj, "elm,action,focus", "elm"); + evas_object_focus_set(wd->obj, EINA_TRUE); + if ((wd->selected) && (!wd->last_selected_item)) + wd->last_selected_item = eina_list_data_get(wd->selected); + } + else + { + elm_object_signal_emit(wd->obj, "elm,action,unfocus", "elm"); + evas_object_focus_set(wd->obj, EINA_FALSE); + } +} + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _item_cache_zero(wd); + if (wd->calc_job) ecore_job_del(wd->calc_job); + if (wd->update_job) ecore_job_del(wd->update_job); + if (wd->queue_idle_enterer) ecore_idle_enterer_del(wd->queue_idle_enterer); + if (wd->must_recalc_idler) ecore_idler_del(wd->must_recalc_idler); + if (wd->multi_timer) ecore_timer_del(wd->multi_timer); + if (wd->decorate_it_type) eina_stringshare_del(wd->decorate_it_type); + if (wd->scr_hold_timer) ecore_timer_del(wd->scr_hold_timer); + if (wd->tree_effect_animator) ecore_animator_del(wd->tree_effect_animator); + free(wd); +} + +static void +_del_pre_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->decorate_all_mode) elm_genlist_decorate_mode_set(wd->obj, EINA_FALSE); + elm_genlist_clear(obj); + evas_object_del(wd->pan_smart); + wd->pan_smart = NULL; +} + +static void +_mirrored_set(Evas_Object *obj, + Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _item_cache_zero(wd); + elm_smart_scroller_mirrored_set(wd->scr, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Item_Block *itb; + if (!wd) return; + evas_event_freeze(evas_object_evas_get(wd->obj)); + _item_cache_zero(wd); + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base", + elm_widget_style_get(obj)); + edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale); + wd->item_width = wd->item_height = 0; + wd->group_item_width = wd->group_item_height = 0; + wd->minw = wd->minh = wd->realminw = 0; + EINA_INLIST_FOREACH(wd->blocks, itb) + { + Eina_List *l; + Elm_Gen_Item *it; + + if (itb->realized) _item_block_unrealize(itb); + EINA_LIST_FOREACH(itb->items, l, it) + it->item->mincalcd = EINA_FALSE; + + itb->changed = EINA_TRUE; + } + if (wd->calc_job) ecore_job_del(wd->calc_job); + wd->calc_job = ecore_job_add(_calc_job, wd); + _sizing_eval(obj); + evas_event_thaw(evas_object_evas_get(wd->obj)); + evas_event_thaw_eval(evas_object_evas_get(wd->obj)); +} + +static void +_show_region_hook(void *data, + Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(data); + Evas_Coord x, y, w, h; + if (!wd) return; + elm_widget_show_region_get(obj, &x, &y, &w, &h); + //x & y are screen coordinates, Add with pan coordinates + x += wd->pan_x; + y += wd->pan_y; + elm_smart_scroller_child_region_show(wd->scr, x, y, w, h); +} + +static void +_translate_hook(Evas_Object *obj) +{ + evas_object_smart_callback_call(obj, "language,changed", NULL); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; + Evas_Coord vmw = 0, vmh = 0; + if (!wd) return; + + evas_object_size_hint_min_get(wd->scr, &minw, NULL); + evas_object_size_hint_max_get(wd->scr, &maxw, &maxh); + + edje_object_size_min_calc + (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh); + + if (wd->mode == ELM_LIST_COMPRESS) + { + Evas_Coord vw, vh; + + elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh); + if ((vw != 0) && (vw != wd->prev_viewport_w)) + { + Item_Block *itb; + + wd->prev_viewport_w = vw; + EINA_INLIST_FOREACH(wd->blocks, itb) + { + itb->must_recalc = EINA_TRUE; + } + if (wd->calc_job) ecore_job_del(wd->calc_job); + wd->calc_job = ecore_job_add(_calc_job, wd); + } + minw = vmw; + minh = vmh; + } + else if (wd->mode == ELM_LIST_LIMIT) + { + maxw = -1; + minw = vmw + minw; + } + else + { + minw = vmw; + minh = vmh; + } + + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, maxw, maxh); +} + +static void +_signal_emit_hook(Evas_Object *obj, + const char *emission, + const char *source) +{ + Widget_Data *wd = elm_widget_data_get(obj); + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), + emission, source); +} + +static void +_item_highlight(Elm_Gen_Item *it) +{ + const char *selectraise; + if ((it->wd->select_mode == ELM_OBJECT_SELECT_MODE_NONE) || + (!it->wd->highlight) || + (it->generation < it->wd->generation) || + (it->highlighted) || elm_widget_item_disabled_get(it) || + (it->select_mode == ELM_OBJECT_SELECT_MODE_NONE) || (it->item->deco_it_view) || + (it->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)) + return; + edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm"); + if (it->deco_all_view) edje_object_signal_emit(it->deco_all_view, "elm,state,selected", "elm"); + selectraise = edje_object_data_get(VIEW(it), "selectraise"); + if ((selectraise) && (!strcmp(selectraise, "on"))) + { + if (it->deco_all_view) evas_object_raise(it->deco_all_view); + else evas_object_raise(VIEW(it)); + if ((it->item->group_item) && (it->item->group_item->realized)) + evas_object_raise(it->item->VIEW(group_item)); + } + it->highlighted = EINA_TRUE; +} + +static void +_item_unhighlight(Elm_Gen_Item *it) +{ + if ((it->generation < it->wd->generation) || (!it->highlighted)) return; + edje_object_signal_emit(VIEW(it), "elm,state,unselected", "elm"); + if (it->deco_all_view) edje_object_signal_emit(it->deco_all_view, "elm,state,unselected", "elm"); + if (!it->item->nostacking) + { + if ((it->item->order_num_in & 0x1) ^ it->item->stacking_even) + { + if (it->deco_all_view) evas_object_lower(it->deco_all_view); + else evas_object_lower(VIEW(it)); + } + else + { + if (it->deco_all_view) evas_object_raise(it->deco_all_view); + else evas_object_raise(VIEW(it)); + } + } + it->highlighted = EINA_FALSE; +} + +static void +_item_block_position_update(Eina_Inlist *list, int idx) +{ + Item_Block *tmp; + + EINA_INLIST_FOREACH(list, tmp) + { + tmp->position = idx++; + tmp->position_update = EINA_TRUE; + } +} + +static void +_item_position_update(Eina_List *list, int idx) +{ + Elm_Gen_Item *it; + Eina_List *l; + + EINA_LIST_FOREACH(list, l, it) + { + it->position = idx++; + it->position_update = EINA_TRUE; + } +} + +static void +_item_block_del(Elm_Gen_Item *it) +{ + Eina_Inlist *il; + Item_Block *itb = it->item->block; + + itb->items = eina_list_remove(itb->items, it); + itb->count--; + itb->changed = EINA_TRUE; + if (it->wd->calc_job) ecore_job_del(it->wd->calc_job); + it->wd->calc_job = ecore_job_add(_calc_job, it->wd); + if (itb->count < 1) + { + il = EINA_INLIST_GET(itb); + Item_Block *itbn = (Item_Block *)(il->next); + if (it->parent) + it->parent->item->items = eina_list_remove(it->parent->item->items, it); + else + { + _item_block_position_update(il->next, itb->position); + it->wd->blocks = eina_inlist_remove(it->wd->blocks, il); + } + free(itb); + if (itbn) itbn->changed = EINA_TRUE; + } + else + { + if (itb->count < itb->wd->max_items_per_block/2) + { + il = EINA_INLIST_GET(itb); + Item_Block *itbp = (Item_Block *)(il->prev); + Item_Block *itbn = (Item_Block *)(il->next); + if ((itbp) && ((itbp->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2)) + { + Elm_Gen_Item *it2; + + EINA_LIST_FREE(itb->items, it2) + { + it2->item->block = itbp; + itbp->items = eina_list_append(itbp->items, it2); + itbp->count++; + itbp->changed = EINA_TRUE; + } + _item_block_position_update(EINA_INLIST_GET(itb)->next, + itb->position); + it->wd->blocks = eina_inlist_remove(it->wd->blocks, + EINA_INLIST_GET(itb)); + free(itb); + } + else if ((itbn) && ((itbn->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2)) + { + while (itb->items) + { + Eina_List *last = eina_list_last(itb->items); + Elm_Gen_Item *it2 = last->data; + + it2->item->block = itbn; + itb->items = eina_list_remove_list(itb->items, last); + itbn->items = eina_list_prepend(itbn->items, it2); + itbn->count++; + itbn->changed = EINA_TRUE; + } + _item_block_position_update(EINA_INLIST_GET(itb)->next, + itb->position); + it->wd->blocks = + eina_inlist_remove(it->wd->blocks, EINA_INLIST_GET(itb)); + free(itb); + } + } + } +} + +static void +_item_subitems_clear(Elm_Gen_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Eina_List *tl = NULL, *l; + Elm_Object_Item *it2; + + EINA_LIST_FOREACH(it->item->items, l, it2) + tl = eina_list_append(tl, it2); + EINA_LIST_FREE(tl, it2) + elm_object_item_del(it2); +} + +static void +_item_del(Elm_Gen_Item *it) +{ + Evas_Object *obj = WIDGET(it); + Widget_Data *wd = it->wd; + + evas_event_freeze(evas_object_evas_get(obj)); + elm_genlist_item_subitems_clear((Elm_Object_Item *)it); + if (wd->show_item == it) wd->show_item = NULL; + if (it->realized) _elm_genlist_item_unrealize(it, EINA_FALSE); + if (it->item->decorate_all_item_realized) _decorate_all_item_unrealize(it); + if (it->item->block) _item_block_del(it); + if (it->item->queued) + wd->queue = eina_list_remove(wd->queue, it); + if (wd->anchor_item == it) + { + wd->anchor_item = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next); + if (!wd->anchor_item) + wd->anchor_item = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev); + } + if (wd->expanded_item == it) + { + wd->expanded_item = NULL; + if (wd->tree_effect_animator) + { + ecore_animator_del(wd->tree_effect_animator); + wd->tree_effect_animator = NULL; + } + wd->move_effect_mode = ELM_GENLIST_TREE_EFFECT_NONE; + } + if (wd->expanded_next_item == it) wd->expanded_next_item = NULL; + if (wd->move_items) wd->move_items = eina_list_remove(wd->move_items, it); + if (it->parent) + it->parent->item->items = eina_list_remove(it->parent->item->items, it); + if (it->item->swipe_timer) + { + ecore_timer_del(it->item->swipe_timer); + it->item->swipe_timer = NULL; + } + _elm_genlist_item_del_serious(it); + elm_genlist_item_class_unref((Elm_Genlist_Item_Class *)it->itc); + evas_event_thaw(evas_object_evas_get(obj)); + evas_event_thaw_eval(evas_object_evas_get(obj)); +} + +static void +_clear_cb(Widget_Data *wd) +{ + wd->anchor_item = NULL; + if (wd->queue_idle_enterer) + { + ecore_idle_enterer_del(wd->queue_idle_enterer); + wd->queue_idle_enterer = NULL; + } + if (wd->must_recalc_idler) + { + ecore_idler_del(wd->must_recalc_idler); + wd->must_recalc_idler = NULL; + } + if (wd->queue) wd->queue = eina_list_free(wd->queue); + if (wd->reorder_move_animator) + { + ecore_animator_del(wd->reorder_move_animator); + wd->reorder_move_animator = NULL; + } + wd->show_item = NULL; + wd->reorder_old_pan_y = 0; +} + +static void +_item_unselect(Elm_Gen_Item *it) +{ + if ((it->generation < it->wd->generation) || (!it->selected)) return; + it->selected = EINA_FALSE; + it->wd->selected = eina_list_remove(it->wd->selected, it); + evas_object_smart_callback_call(WIDGET(it), SIG_UNSELECTED, it); +} + +static void +_mouse_move(void *data, + Evas *evas __UNUSED__, + Evas_Object *obj, + void *event_info) +{ + Elm_Gen_Item *it = data; + Evas_Event_Mouse_Move *ev = event_info; + Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady; + Evas_Coord ox, oy, ow, oh, it_scrl_y, y_pos; + + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) + { + if (!it->wd->on_hold) + { + it->wd->on_hold = EINA_TRUE; + if ((!it->wd->wasselected) && (!it->flipped)) + { + _item_unhighlight(it); + _item_unselect(it); + } + } + } + if (it->wd->multitouched) + { + it->wd->cur_x = ev->cur.canvas.x; + it->wd->cur_y = ev->cur.canvas.y; + return; + } + if ((it->dragging) && (it->down)) + { + if (it->wd->movements == SWIPE_MOVES) it->wd->swipe = EINA_TRUE; + else + { + it->wd->history[it->wd->movements].x = ev->cur.canvas.x; + it->wd->history[it->wd->movements].y = ev->cur.canvas.y; + if (abs((it->wd->history[it->wd->movements].x - + it->wd->history[0].x)) > 40) + it->wd->swipe = EINA_TRUE; + else + it->wd->movements++; + } + if (it->long_timer) + { + ecore_timer_del(it->long_timer); + it->long_timer = NULL; + } + evas_object_smart_callback_call(WIDGET(it), SIG_DRAG, it); + return; + } + if ((!it->down) /* || (it->wd->on_hold)*/ || (it->wd->longpressed)) + { + if (it->long_timer) + { + ecore_timer_del(it->long_timer); + it->long_timer = NULL; + } + if ((it->wd->reorder_mode) && (it->wd->reorder_it)) + { + evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh); + it_scrl_y = ev->cur.canvas.y - it->wd->reorder_it->dy; + + if (!it->wd->reorder_start_y) + it->wd->reorder_start_y = it->item->block->y + it->y; + + if (it_scrl_y < oy) + y_pos = oy; + else if (it_scrl_y + it->wd->reorder_it->item->h > oy + oh) + y_pos = oy + oh - it->wd->reorder_it->item->h; + else + y_pos = it_scrl_y; + + if (it->deco_all_view) + _item_position(it, it->deco_all_view, it->item->scrl_x, y_pos); + else + _item_position(it, VIEW(it), it->item->scrl_x, y_pos); + + if (it->wd->calc_job) ecore_job_del(it->wd->calc_job); + it->wd->calc_job = ecore_job_add(_calc_job, it->wd); + } + return; + } + if (it->select_mode != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + evas_object_geometry_get(obj, &x, &y, NULL, NULL); + x = ev->cur.canvas.x - x; + y = ev->cur.canvas.y - y; + dx = x - it->dx; + adx = dx; + if (adx < 0) adx = -dx; + dy = y - it->dy; + ady = dy; + if (ady < 0) ady = -dy; + minw /= 2; + minh /= 2; + if ((adx > minw) || (ady > minh)) + { + it->dragging = EINA_TRUE; + if (it->long_timer) + { + ecore_timer_del(it->long_timer); + it->long_timer = NULL; + } + if (!it->wd->wasselected) + { + _item_unhighlight(it); + _item_unselect(it); + } + if (dy < 0) + { + if (ady > adx) + evas_object_smart_callback_call(WIDGET(it), + SIG_DRAG_START_UP, it); + else + { + if (dx < 0) + evas_object_smart_callback_call(WIDGET(it), + SIG_DRAG_START_LEFT, it); + else + evas_object_smart_callback_call(WIDGET(it), + SIG_DRAG_START_RIGHT, it); + } + } + else + { + if (ady > adx) + evas_object_smart_callback_call(WIDGET(it), + SIG_DRAG_START_DOWN, it); + else + { + if (dx < 0) + evas_object_smart_callback_call(WIDGET(it), + SIG_DRAG_START_LEFT, it); + else + evas_object_smart_callback_call(WIDGET(it), + SIG_DRAG_START_RIGHT, it); + } + } + } +} + +static Eina_Bool +_long_press(void *data) +{ + Elm_Gen_Item *it = data, *it_tmp; + Eina_List *list, *l; + + it->long_timer = NULL; + if (elm_widget_item_disabled_get(it) || (it->dragging) || + (it->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)) + return ECORE_CALLBACK_CANCEL; + it->wd->longpressed = EINA_TRUE; + evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, it); + if ((it->wd->reorder_mode) && (!it->group)) + { + it->wd->reorder_it = it; + it->wd->reorder_start_y = 0; + if (it->deco_all_view) + evas_object_raise(it->deco_all_view); + else + evas_object_raise(VIEW(it)); + + elm_smart_scroller_hold_set(it->wd->scr, EINA_TRUE); + elm_smart_scroller_bounce_allow_set(it->wd->scr, EINA_FALSE, EINA_FALSE); + + list = elm_genlist_realized_items_get(it->wd->obj); + EINA_LIST_FOREACH(list, l, it_tmp) + { + if (it != it_tmp) _item_unselect(it_tmp); + } + if (elm_genlist_item_expanded_get((Elm_Object_Item *)it)) + { + elm_genlist_item_expanded_set((Elm_Object_Item *)it, EINA_FALSE); + return ECORE_CALLBACK_RENEW; + } + + if (!it->wd->decorate_all_mode) + edje_object_signal_emit(VIEW(it), "elm,state,reorder,enabled", "elm"); + } + return ECORE_CALLBACK_CANCEL; +} + +static void +_swipe(Elm_Gen_Item *it) +{ + int i, sum = 0; + + if (!it) return; + if ((it->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) || + elm_widget_item_disabled_get(it)) return; + it->wd->swipe = EINA_FALSE; + for (i = 0; i < it->wd->movements; i++) + { + sum += it->wd->history[i].x; + if (abs(it->wd->history[0].y - it->wd->history[i].y) > 10) return; + } + + sum /= it->wd->movements; + if (abs(sum - it->wd->history[0].x) <= 10) return; + evas_object_smart_callback_call(WIDGET(it), SIG_SWIPE, it); +} + +static Eina_Bool +_swipe_cancel(void *data) +{ + Elm_Gen_Item *it = data; + + if (!it) return ECORE_CALLBACK_CANCEL; + it->wd->swipe = EINA_FALSE; + it->wd->movements = 0; + return ECORE_CALLBACK_RENEW; +} + +static Eina_Bool +_multi_cancel(void *data) +{ + Widget_Data *wd = data; + + if (!wd) return ECORE_CALLBACK_CANCEL; + wd->multi_timeout = EINA_TRUE; + return ECORE_CALLBACK_RENEW; +} + +static void +_multi_touch_gesture_eval(void *data) +{ + Elm_Gen_Item *it = data; + + it->wd->multitouched = EINA_FALSE; + if (it->wd->multi_timer) + { + ecore_timer_del(it->wd->multi_timer); + it->wd->multi_timer = NULL; + } + if (it->wd->multi_timeout) + { + it->wd->multi_timeout = EINA_FALSE; + return; + } + + Evas_Coord minw = 0, minh = 0; + Evas_Coord off_x, off_y, off_mx, off_my; + + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + off_x = abs(it->wd->cur_x - it->wd->prev_x); + off_y = abs(it->wd->cur_y - it->wd->prev_y); + off_mx = abs(it->wd->cur_mx - it->wd->prev_mx); + off_my = abs(it->wd->cur_my - it->wd->prev_my); + + if (((off_x > minw) || (off_y > minh)) && ((off_mx > minw) || (off_my > minh))) + { + if ((off_x + off_mx) > (off_y + off_my)) + { + if ((it->wd->cur_x > it->wd->prev_x) && (it->wd->cur_mx > it->wd->prev_mx)) + evas_object_smart_callback_call(WIDGET(it), + SIG_MULTI_SWIPE_RIGHT, it); + else if ((it->wd->cur_x < it->wd->prev_x) && (it->wd->cur_mx < it->wd->prev_mx)) + evas_object_smart_callback_call(WIDGET(it), + SIG_MULTI_SWIPE_LEFT, it); + else if (abs(it->wd->cur_x - it->wd->cur_mx) > abs(it->wd->prev_x - it->wd->prev_mx)) + evas_object_smart_callback_call(WIDGET(it), + SIG_MULTI_PINCH_OUT, it); + else + evas_object_smart_callback_call(WIDGET(it), + SIG_MULTI_PINCH_IN, it); + } + else + { + if ((it->wd->cur_y > it->wd->prev_y) && (it->wd->cur_my > it->wd->prev_my)) + evas_object_smart_callback_call(WIDGET(it), + SIG_MULTI_SWIPE_DOWN, it); + else if ((it->wd->cur_y < it->wd->prev_y) && (it->wd->cur_my < it->wd->prev_my)) + evas_object_smart_callback_call(WIDGET(it), + SIG_MULTI_SWIPE_UP, it); + else if (abs(it->wd->cur_y - it->wd->cur_my) > abs(it->wd->prev_y - it->wd->prev_my)) + evas_object_smart_callback_call(WIDGET(it), + SIG_MULTI_PINCH_OUT, it); + else + evas_object_smart_callback_call(WIDGET(it), + SIG_MULTI_PINCH_IN, it); + } + } + it->wd->multi_timeout = EINA_FALSE; +} + +static void +_multi_down(void *data, + Evas *evas __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + Elm_Gen_Item *it = data; + Evas_Event_Multi_Down *ev = event_info; + + if ((it->wd->multi_device != 0) || (it->wd->multitouched) || (it->wd->multi_timeout)) return; + it->wd->multi_device = ev->device; + it->wd->multi_down = EINA_TRUE; + it->wd->multitouched = EINA_TRUE; + it->wd->prev_mx = ev->canvas.x; + it->wd->prev_my = ev->canvas.y; + if (!it->wd->wasselected) + { + _item_unhighlight(it); + _item_unselect(it); + } + it->wd->wasselected = EINA_FALSE; + it->wd->longpressed = EINA_FALSE; + if (it->long_timer) + { + ecore_timer_del(it->long_timer); + it->long_timer = NULL; + } + if (it->dragging) + { + it->dragging = EINA_FALSE; + evas_object_smart_callback_call(WIDGET(it), SIG_DRAG_STOP, it); + } + if (it->item->swipe_timer) + { + ecore_timer_del(it->item->swipe_timer); + it->item->swipe_timer = NULL; + } + if (it->wd->on_hold) + { + it->wd->swipe = EINA_FALSE; + it->wd->movements = 0; + it->wd->on_hold = EINA_FALSE; + } +} + +static void +_multi_up(void *data, + Evas *evas __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + Elm_Gen_Item *it = data; + Evas_Event_Multi_Up *ev = event_info; + + if (it->wd->multi_device != ev->device) return; + it->wd->multi_device = 0; + it->wd->multi_down = EINA_FALSE; + if (it->wd->mouse_down) return; + _multi_touch_gesture_eval(data); +} + +static void +_multi_move(void *data, + Evas *evas __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + Elm_Gen_Item *it = data; + Evas_Event_Multi_Move *ev = event_info; + + if (it->wd->multi_device != ev->device) return; + it->wd->cur_mx = ev->cur.canvas.x; + it->wd->cur_my = ev->cur.canvas.y; +} + +static void +_mouse_down(void *data, + Evas *evas __UNUSED__, + Evas_Object *obj, + void *event_info) +{ + Elm_Gen_Item *it = data; + Evas_Event_Mouse_Down *ev = event_info; + Evas_Coord x, y; + + if (ev->button != 1) return; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) + { + it->wd->on_hold = EINA_TRUE; + } + + it->down = EINA_TRUE; + it->dragging = EINA_FALSE; + evas_object_geometry_get(obj, &x, &y, NULL, NULL); + it->dx = ev->canvas.x - x; + it->dy = ev->canvas.y - y; + it->wd->mouse_down = EINA_TRUE; + if (!it->wd->multitouched) + { + it->wd->prev_x = ev->canvas.x; + it->wd->prev_y = ev->canvas.y; + it->wd->multi_timeout = EINA_FALSE; + if (it->wd->multi_timer) ecore_timer_del(it->wd->multi_timer); + it->wd->multi_timer = ecore_timer_add(1, _multi_cancel, it->wd); + } + it->wd->longpressed = EINA_FALSE; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE; + else it->wd->on_hold = EINA_FALSE; + if (it->wd->on_hold) return; + it->wd->wasselected = it->selected; + _item_highlight(it); + if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) + if ((!elm_widget_item_disabled_get(it)) && + (it->select_mode != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)) + { + evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it); + evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it); + } + if (it->item->swipe_timer) ecore_timer_del(it->item->swipe_timer); + it->item->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it); + if (it->long_timer) ecore_timer_del(it->long_timer); + if (it->realized) + it->long_timer = ecore_timer_add(it->wd->longpress_timeout, _long_press, + it); + else + it->long_timer = NULL; + it->wd->swipe = EINA_FALSE; + it->wd->movements = 0; +} + +static void +_mouse_up(void *data, + Evas *evas __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + Elm_Gen_Item *it = data; + Evas_Event_Mouse_Up *ev = event_info; + Eina_Bool dragged = EINA_FALSE; + + if (ev->button != 1) return; + it->down = EINA_FALSE; + it->wd->mouse_down = EINA_FALSE; + if (it->wd->multitouched) + { + if ((!it->wd->multi) && (!it->selected) && (it->highlighted)) _item_unhighlight(it); + if (it->wd->multi_down) return; + _multi_touch_gesture_eval(data); + return; + } + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE; + else it->wd->on_hold = EINA_FALSE; + if (it->long_timer) + { + ecore_timer_del(it->long_timer); + it->long_timer = NULL; + } + if (it->dragging) + { + it->dragging = EINA_FALSE; + evas_object_smart_callback_call(WIDGET(it), SIG_DRAG_STOP, it); + dragged = 1; + } + if (it->item->swipe_timer) + { + ecore_timer_del(it->item->swipe_timer); + it->item->swipe_timer = NULL; + } + if (it->wd->multi_timer) + { + ecore_timer_del(it->wd->multi_timer); + it->wd->multi_timer = NULL; + it->wd->multi_timeout = EINA_FALSE; + } + if (it->wd->on_hold) + { + if (it->wd->swipe) _swipe(data); + it->wd->longpressed = EINA_FALSE; + it->wd->on_hold = EINA_FALSE; + return; + } + if ((it->wd->reorder_mode) && (it->wd->reorder_it)) + { + Evas_Coord it_scrl_y = ev->canvas.y - it->wd->reorder_it->dy; + + if (it->wd->reorder_rel && (it->wd->reorder_it->parent == it->wd->reorder_rel->parent)) + { + if (it_scrl_y <= it->wd->reorder_rel->item->scrl_y) + _item_move_before(it->wd->reorder_it, it->wd->reorder_rel); + else + _item_move_after(it->wd->reorder_it, it->wd->reorder_rel); + evas_object_smart_callback_call(WIDGET(it), SIG_MOVED, it); + } + else + { + if (it->wd->calc_job) ecore_job_del(it->wd->calc_job); + it->wd->calc_job = ecore_job_add(_calc_job, it->wd); + } + edje_object_signal_emit(VIEW(it), "elm,state,reorder,disabled", "elm"); + it->wd->reorder_it = it->wd->reorder_rel = NULL; + elm_smart_scroller_hold_set(it->wd->scr, EINA_FALSE); + elm_smart_scroller_bounce_allow_set(it->wd->scr, it->wd->h_bounce, it->wd->v_bounce); + } + if (it->wd->longpressed) + { + it->wd->longpressed = EINA_FALSE; + if ((!it->wd->wasselected) && (!it->flipped)) + { + _item_unhighlight(it); + _item_unselect(it); + } + it->wd->wasselected = EINA_FALSE; + return; + } + if (dragged) + { + if (it->want_unrealize) + { + _elm_genlist_item_unrealize(it, EINA_FALSE); + if (it->item->block->want_unrealize) + _item_block_unrealize(it->item->block); + } + } + if (elm_widget_item_disabled_get(it) || (dragged) || + (it->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)) + return; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; + if (it->wd->multi) + { + if (!it->selected) + { + _item_highlight(it); + it->sel_cb(it); + } + else + { + _item_unhighlight(it); + _item_unselect(it); + } + } + else + { + if (!it->selected) + { + Widget_Data *wd = it->wd; + if (wd) + { + while (wd->selected) + { + _item_unhighlight(wd->selected->data); + _item_unselect(wd->selected->data); + } + } + } + else + { + const Eina_List *l, *l_next; + Elm_Gen_Item *it2; + + EINA_LIST_FOREACH_SAFE(it->wd->selected, l, l_next, it2) + if (it2 != it) + { + _item_unhighlight(it2); + _item_unselect(it2); + } + //_item_highlight(it); + //_item_select(it); + } + _item_highlight(it); + it->sel_cb(it); + } +} + +static void +_item_mouse_callbacks_add(Elm_Gen_Item *it, Evas_Object *view) +{ + evas_object_event_callback_add(view, EVAS_CALLBACK_MOUSE_DOWN, + _mouse_down, it); + evas_object_event_callback_add(view, EVAS_CALLBACK_MOUSE_UP, + _mouse_up, it); + evas_object_event_callback_add(view, EVAS_CALLBACK_MOUSE_MOVE, + _mouse_move, it); + evas_object_event_callback_add(view, EVAS_CALLBACK_MULTI_DOWN, + _multi_down, it); + evas_object_event_callback_add(view, EVAS_CALLBACK_MULTI_UP, + _multi_up, it); + evas_object_event_callback_add(view, EVAS_CALLBACK_MULTI_MOVE, + _multi_move, it); +} + +static void +_item_mouse_callbacks_del(Elm_Gen_Item *it, Evas_Object *view) +{ + evas_object_event_callback_del_full(view, EVAS_CALLBACK_MOUSE_DOWN, + _mouse_down, it); + evas_object_event_callback_del_full(view, EVAS_CALLBACK_MOUSE_UP, + _mouse_up, it); + evas_object_event_callback_del_full(view, EVAS_CALLBACK_MOUSE_MOVE, + _mouse_move, it); + evas_object_event_callback_del_full(view, EVAS_CALLBACK_MULTI_DOWN, + _multi_down, it); + evas_object_event_callback_del_full(view, EVAS_CALLBACK_MULTI_UP, + _multi_up, it); + evas_object_event_callback_del_full(view, EVAS_CALLBACK_MULTI_MOVE, + _multi_move, it); +} + +static void +_signal_expand_toggle(void *data, + Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, + const char *source __UNUSED__) +{ + Elm_Gen_Item *it = data; + + if (it->item->expanded) + evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACT_REQUEST, it); + else + evas_object_smart_callback_call(WIDGET(it), SIG_EXPAND_REQUEST, it); +} + +static void +_signal_expand(void *data, + Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, + const char *source __UNUSED__) +{ + Elm_Gen_Item *it = data; + + if (!it->item->expanded) + evas_object_smart_callback_call(WIDGET(it), SIG_EXPAND_REQUEST, it); +} + +static void +_signal_contract(void *data, + Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, + const char *source __UNUSED__) +{ + Elm_Gen_Item *it = data; + + if (it->item->expanded) + evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACT_REQUEST, it); +} + +static Eina_Bool +_scr_hold_timer_cb(void *data) +{ + if (!data) return ECORE_CALLBACK_CANCEL; + Widget_Data *wd = data; + elm_smart_scroller_hold_set(wd->scr, EINA_FALSE); + wd->scr_hold_timer = NULL; + return ECORE_CALLBACK_CANCEL; +} + +static void +_decorate_item_finished_signal_cb(void *data, + Evas_Object *obj, + const char *emission __UNUSED__, + const char *source __UNUSED__) +{ + if (!data) return; + if (!obj) return; + Elm_Gen_Item *it = data; + if ((it->generation < it->wd->generation) || (!it->realized) || (!it->item->deco_it_view)) return; + char buf[1024]; + Evas *te = evas_object_evas_get(obj); + + evas_event_freeze(te); + it->item->nocache_once = EINA_FALSE; + _decorate_item_unrealize(it); + if (it->item->group_item) + evas_object_raise(it->item->VIEW(group_item)); + snprintf(buf, sizeof(buf), "elm,state,%s,passive,finished", it->wd->decorate_it_type); + edje_object_signal_callback_del_full(obj, buf, "elm", _decorate_item_finished_signal_cb, it); + evas_event_thaw(te); + evas_event_thaw_eval(te); +} + +static void +_item_cache_clean(Widget_Data *wd) +{ + evas_event_freeze(evas_object_evas_get(wd->obj)); + while ((wd->item_cache) && (wd->item_cache_count > wd->item_cache_max)) + { + Item_Cache *itc; + + itc = EINA_INLIST_CONTAINER_GET(wd->item_cache->last, Item_Cache); + wd->item_cache = eina_inlist_remove(wd->item_cache, + wd->item_cache->last); + wd->item_cache_count--; + if (itc->spacer) evas_object_del(itc->spacer); + if (itc->base_view) evas_object_del(itc->base_view); + eina_stringshare_del(itc->item_style); + free(itc); + } + evas_event_thaw(evas_object_evas_get(wd->obj)); + evas_event_thaw_eval(evas_object_evas_get(wd->obj)); +} + +static void +_item_cache_zero(Widget_Data *wd) +{ + int pmax = wd->item_cache_max; + wd->item_cache_max = 0; + _item_cache_clean(wd); + wd->item_cache_max = pmax; +} + +static void +_item_cache_add(Elm_Gen_Item *it) +{ + Item_Cache *itc; + + evas_event_freeze(evas_object_evas_get(it->wd->obj)); + if (it->wd->item_cache_max <= 0) + { + evas_object_del(VIEW(it)); + VIEW(it) = NULL; + if (it->spacer) + { + evas_object_del(it->spacer); + it->spacer = NULL; + } + evas_event_thaw(evas_object_evas_get(it->wd->obj)); + evas_event_thaw_eval(evas_object_evas_get(it->wd->obj)); + return; + } + + it->wd->item_cache_count++; + itc = calloc(1, sizeof(Item_Cache)); + if (!itc) + { + evas_event_thaw(evas_object_evas_get(it->wd->obj)); + evas_event_thaw_eval(evas_object_evas_get(it->wd->obj)); + return; + } + it->wd->item_cache = eina_inlist_prepend(it->wd->item_cache, + EINA_INLIST_GET(itc)); + itc->spacer = it->spacer; + it->spacer = NULL; + itc->base_view = VIEW(it); + VIEW(it) = NULL; + edje_object_signal_emit(itc->base_view, "elm,state,unselected", "elm"); + evas_object_hide(itc->base_view); + evas_object_move(itc->base_view, -9999, -9999); + itc->item_style = eina_stringshare_add(it->itc->item_style); + if (it->item->type & ELM_GENLIST_ITEM_TREE) itc->tree = 1; + itc->selected = it->selected; + itc->disabled = elm_widget_item_disabled_get(it); + itc->expanded = it->item->expanded; + if (it->long_timer) + { + ecore_timer_del(it->long_timer); + it->long_timer = NULL; + } + if (it->item->swipe_timer) + { + ecore_timer_del(it->item->swipe_timer); + it->item->swipe_timer = NULL; + } + // FIXME: other callbacks? + edje_object_signal_callback_del_full(itc->base_view, + "elm,action,expand,toggle", + "elm", _signal_expand_toggle, it); + edje_object_signal_callback_del_full(itc->base_view, "elm,action,expand", + "elm", + _signal_expand, it); + edje_object_signal_callback_del_full(itc->base_view, "elm,action,contract", + "elm", _signal_contract, it); + _item_mouse_callbacks_del(it, itc->base_view); + _item_cache_clean(it->wd); + evas_event_thaw(evas_object_evas_get(it->wd->obj)); + evas_event_thaw_eval(evas_object_evas_get(it->wd->obj)); +} + +static Item_Cache * +_item_cache_find(Elm_Gen_Item *it) +{ + Item_Cache *itc; + Eina_Bool tree = 0; + + if (it->item->type & ELM_GENLIST_ITEM_TREE) tree = 1; + EINA_INLIST_FOREACH(it->wd->item_cache, itc) + { + if ((itc->selected) || (itc->disabled) || (itc->expanded)) + continue; + if ((itc->tree == tree) && + (((!it->itc->item_style) && (!itc->item_style)) || + (it->itc->item_style && itc->item_style && + (!strcmp(it->itc->item_style, itc->item_style))))) + { + it->wd->item_cache = eina_inlist_remove(it->wd->item_cache, + EINA_INLIST_GET(itc)); + it->wd->item_cache_count--; + return itc; + } + } + return NULL; +} + +static void +_elm_genlist_item_index_update(Elm_Gen_Item *it) +{ + if (it->position_update || it->item->block->position_update) + { + evas_object_smart_callback_call(WIDGET(it), SIG_INDEX_UPDATE, it); + it->position_update = EINA_FALSE; + } +} + +static void +_elm_genlist_item_odd_even_update(Elm_Gen_Item *it) +{ + if (!it->item->nostacking) + { + if ((it->item->order_num_in & 0x1) ^ it->item->stacking_even) + { + if (it->deco_all_view) evas_object_lower(it->deco_all_view); + else evas_object_lower(VIEW(it)); + } + else + { + if (it->deco_all_view) evas_object_raise(it->deco_all_view); + else evas_object_raise(VIEW(it)); + } + } + + if (it->item->order_num_in & 0x1) + { + edje_object_signal_emit(VIEW(it), "elm,state,odd", "elm"); + if (it->deco_all_view) edje_object_signal_emit(it->deco_all_view, "elm,state,odd", "elm"); + } + else + { + edje_object_signal_emit(VIEW(it), "elm,state,even", "elm"); + if (it->deco_all_view) edje_object_signal_emit(it->deco_all_view, "elm,state,even", "elm"); + } +} + +static void +_elm_genlist_item_state_update(Elm_Gen_Item *it, Item_Cache *itc) +{ + if (itc) + { + if (it->selected != itc->selected) + { + if (it->selected) + { + edje_object_signal_emit(VIEW(it), + "elm,state,selected", "elm"); + + if (it->deco_all_view) + edje_object_signal_emit(it->deco_all_view, + "elm,state,selected", "elm"); + } + } + if (elm_widget_item_disabled_get(it) != itc->disabled) + { + if (elm_widget_item_disabled_get(it)) + edje_object_signal_emit(VIEW(it), + "elm,state,disabled", "elm"); + if (it->deco_all_view) + edje_object_signal_emit(it->deco_all_view, + "elm,state,disabled", "elm"); + } + if (it->item->expanded != itc->expanded) + { + if (it->item->expanded) + edje_object_signal_emit(VIEW(it), + "elm,state,expanded", "elm"); + if (it->deco_all_view) + edje_object_signal_emit(it->deco_all_view, + "elm,state,expanded", "elm"); + } + } + else + { + if (it->selected) + { + edje_object_signal_emit(VIEW(it), + "elm,state,selected", "elm"); + if (it->deco_all_view) + edje_object_signal_emit(it->deco_all_view, + "elm,state,selected", "elm"); + } + + if (elm_widget_item_disabled_get(it)) + { + edje_object_signal_emit(VIEW(it), + "elm,state,disabled", "elm"); + if (it->deco_all_view) + edje_object_signal_emit(it->deco_all_view, + "elm,state,disabled", "elm"); + } + if (it->item->expanded) + { + edje_object_signal_emit(VIEW(it), + "elm,state,expanded", "elm"); + if (it->deco_all_view) + edje_object_signal_emit(it->deco_all_view, + "elm,state,expanded", "elm"); + } + } +} + +static Eina_List* +_item_mode_content_realize(Elm_Gen_Item *it, + Evas_Object *target, + Eina_List **source, + const char *parts, + Eina_List **contents_list) +{ + Eina_List *res = *contents_list; + + if (it->itc->func.content_get) + { + const Eina_List *l; + const char *key; + + EINA_LIST_FOREACH(*source, l, key) + { + if (parts && fnmatch(parts, key, FNM_PERIOD)) + continue; + + Evas_Object *ic = it->itc->func.content_get + ((void *)it->base.data, WIDGET(it), l->data); + + if (ic) + { + res = eina_list_append(res, ic); + edje_object_part_swallow(target, key, ic); + evas_object_show(ic); + elm_widget_sub_object_add(WIDGET(it), ic); + if (it->item->deco_it_view || it->wd->decorate_all_mode) + { + if (elm_widget_item_disabled_get(it)) + elm_widget_disabled_set(ic, EINA_TRUE); + } + } + } + } + + return res; +} + +static Eina_List* +_item_mode_content_unrealize(Elm_Gen_Item *it, + Evas_Object *target, + Eina_List **source, + const char *parts, + Eina_List **contents_list) +{ + Eina_List *res = *contents_list; + + if (it->itc->func.content_get) + { + const Eina_List *l; + const char *key; + Evas_Object *ic = NULL; + + EINA_LIST_FOREACH(*source, l, key) + { + if (parts && fnmatch(parts, key, FNM_PERIOD)) + continue; + + ic = edje_object_part_swallow_get(target, key); + if (ic) + { + res = eina_list_remove(res, ic); + edje_object_part_unswallow(target, ic); + evas_object_del(ic); + } + } + } + + return res; +} + +static void +_item_cache_free(Item_Cache *itc) +{ + if (itc->spacer) evas_object_del(itc->spacer); + if (itc->base_view) evas_object_del(itc->base_view); + eina_stringshare_del(itc->item_style); + free(itc); +} + +static void +_item_text_realize(Elm_Gen_Item *it, + Evas_Object *target, + Eina_List **source, + const char *parts) +{ + if (it->itc->func.text_get) + { + const Eina_List *l; + const char *key; + + if (!(*source)) + *source = elm_widget_stringlist_get(edje_object_data_get(target, "texts")); + EINA_LIST_FOREACH(*source, l, key) + { + if (parts && fnmatch(parts, key, FNM_PERIOD)) + continue; + + char *s = it->itc->func.text_get + ((void *)it->base.data, WIDGET(it), key); + + if (s) + { + edje_object_part_text_escaped_set(target, key, s); + free(s); + } + else + { + edje_object_part_text_set(target, key, ""); + } + } + } +} + +static Eina_List * +_item_content_unrealize(Elm_Gen_Item *it, + Evas_Object *target, + Eina_List **source, + const char *parts) +{ + Eina_List *res = it->content_objs; + + if (it->itc->func.content_get) + { + const Eina_List *l; + const char *key; + Evas_Object *ic = NULL; + + EINA_LIST_FOREACH(*source, l, key) + { + if (parts && fnmatch(parts, key, FNM_PERIOD)) + continue; + + ic = edje_object_part_swallow_get(target, key); + if (ic) + { + res = eina_list_remove(res, ic); + edje_object_part_unswallow(target, ic); + evas_object_del(ic); + } + } + } + + return res; +} + +static Eina_List * +_item_content_realize(Elm_Gen_Item *it, + Evas_Object *target, + Eina_List **source, + const char *parts) +{ + Eina_List *res = it->content_objs; + + if (it->itc->func.content_get) + { + const Eina_List *l; + const char *key; + Evas_Object *ic = NULL; + + if (!(*source)) + *source = elm_widget_stringlist_get(edje_object_data_get(target, "contents")); + + EINA_LIST_FOREACH(*source, l, key) + { + if (parts && fnmatch(parts, key, FNM_PERIOD)) + continue; + + if (it->itc->func.content_get) + ic = it->itc->func.content_get + ((void *)it->base.data, WIDGET(it), key); + if (ic) + { + res = eina_list_append(res, ic); + edje_object_part_swallow(target, key, ic); + evas_object_show(ic); + elm_widget_sub_object_add(WIDGET(it), ic); + if (elm_widget_item_disabled_get(it)) + elm_widget_disabled_set(ic, EINA_TRUE); + } + } + } + + return res; +} + +static void +_item_state_realize(Elm_Gen_Item *it, + Evas_Object *target, + Eina_List **source, + const char *parts) +{ + if (it->itc->func.state_get) + { + const Eina_List *l; + const char *key; + char buf[4096]; + + if (!(*source)) + *source = elm_widget_stringlist_get(edje_object_data_get(target, "states")); + EINA_LIST_FOREACH(*source, l, key) + { + if (parts && fnmatch(parts, key, FNM_PERIOD)) + continue; + + Eina_Bool on = it->itc->func.state_get + ((void *)it->base.data, WIDGET(it), key); + + if (on) + { + snprintf(buf, sizeof(buf), "elm,state,%s,active", key); + edje_object_signal_emit(target, buf, "elm"); + } + else + { + snprintf(buf, sizeof(buf), "elm,state,%s,passive", key); + edje_object_signal_emit(target, buf, "elm"); + } + } + } +} + +static void +_item_realize(Elm_Gen_Item *it, + int in, + Eina_Bool calc) +{ + const char *treesize; + char buf[1024]; + int tsize = 20; + Item_Cache *itc = NULL; + + if (it->generation < it->wd->generation) return; + //evas_event_freeze(evas_object_evas_get(it->wd->obj)); + if (it->realized) + { + if (it->item->order_num_in != in) + { + it->item->order_num_in = in; + _elm_genlist_item_odd_even_update(it); + _elm_genlist_item_state_update(it, NULL); + _elm_genlist_item_index_update(it); + } + //evas_event_thaw(evas_object_evas_get(it->wd->obj)); + //evas_event_thaw_eval(evas_object_evas_get(it->wd->obj)); + return; + } + it->item->order_num_in = in; + + if (it->item->nocache_once) + it->item->nocache_once = EINA_FALSE; + else if (!it->item->nocache) + itc = _item_cache_find(it); + if (itc && (!it->wd->tree_effect_enabled)) + { + VIEW(it) = itc->base_view; + itc->base_view = NULL; + it->spacer = itc->spacer; + itc->spacer = NULL; + } + else + { + const char *stacking_even; + const char *stacking; + + VIEW(it) = edje_object_add(evas_object_evas_get(WIDGET(it))); + edje_object_scale_set(VIEW(it), + elm_widget_scale_get(WIDGET(it)) * + _elm_config->scale); + evas_object_smart_member_add(VIEW(it), it->wd->pan_smart); + elm_widget_sub_object_add(WIDGET(it), VIEW(it)); + + if (it->item->type & ELM_GENLIST_ITEM_TREE) + snprintf(buf, sizeof(buf), "tree%s/%s", it->wd->mode == ELM_LIST_COMPRESS ? "_compress" : "", it->itc->item_style ?: "default"); + else + snprintf(buf, sizeof(buf), "item%s/%s", it->wd->mode == ELM_LIST_COMPRESS ? "_compress" : "", it->itc->item_style ?: "default"); + + _elm_theme_object_set(WIDGET(it), VIEW(it), "genlist", buf, + elm_widget_style_get(WIDGET(it))); + + stacking_even = edje_object_data_get(VIEW(it), "stacking_even"); + if (!stacking_even) stacking_even = "above"; + it->item->stacking_even = !!strcmp("above", stacking_even); + + stacking = edje_object_data_get(VIEW(it), "stacking"); + if (!stacking) stacking = "yes"; + it->item->nostacking = !!strcmp("yes", stacking); + + edje_object_mirrored_set(VIEW(it), + elm_widget_mirrored_get(WIDGET(it))); + } + + _elm_genlist_item_odd_even_update(it); + + treesize = edje_object_data_get(VIEW(it), "treesize"); + if (treesize) tsize = atoi(treesize); + if (!it->spacer && treesize) + { + it->spacer = + evas_object_rectangle_add(evas_object_evas_get(WIDGET(it))); + evas_object_color_set(it->spacer, 0, 0, 0, 0); + elm_widget_sub_object_add(WIDGET(it), it->spacer); + } + if (it->spacer) + { + evas_object_size_hint_min_set(it->spacer, + (it->item->expanded_depth * tsize) * _elm_config->scale, 1); + edje_object_part_swallow(VIEW(it), "elm.swallow.pad", it->spacer); + } + if (!calc) + { + edje_object_signal_callback_add(VIEW(it), + "elm,action,expand,toggle", + "elm", _signal_expand_toggle, it); + edje_object_signal_callback_add(VIEW(it), "elm,action,expand", + "elm", _signal_expand, it); + edje_object_signal_callback_add(VIEW(it), "elm,action,contract", + "elm", _signal_contract, it); + _item_mouse_callbacks_add(it, VIEW(it)); + + if ((it->wd->decorate_all_mode) && (!it->deco_all_view) && + (it->item->type != ELM_GENLIST_ITEM_GROUP) && (it->itc->decorate_all_item_style)) + _decorate_all_item_realize(it, EINA_FALSE); + + _elm_genlist_item_state_update(it, itc); + _elm_genlist_item_index_update(it); + } + + if ((calc) && (it->wd->homogeneous) && + ((it->wd->item_width) || + ((it->wd->item_width) && (it->wd->group_item_width)))) + { + /* homogenous genlist shortcut */ + if (!it->item->mincalcd) + { + if (it->group) + { + it->item->w = it->item->minw = it->wd->group_item_width; + it->item->h = it->item->minh = it->wd->group_item_height; + } + else + { + it->item->w = it->item->minw = it->wd->item_width; + it->item->h = it->item->minh = it->wd->item_height; + } + it->item->mincalcd = EINA_TRUE; + } + } + else + { + /* FIXME: If you see that assert, please notify us and we + will clean our mess */ + assert(eina_list_count(it->content_objs) == 0); + + _item_text_realize(it, VIEW(it), &it->texts, NULL); + it->content_objs = _item_content_realize(it, VIEW(it), &it->contents, NULL); + _item_state_realize(it, VIEW(it), &it->states, NULL); + if (it->flipped) + { + edje_object_signal_emit(VIEW(it), "elm,state,flip,enabled", "elm"); + if (!(it->item->flip_contents)) + it->item->flip_contents = + elm_widget_stringlist_get(edje_object_data_get(VIEW(it), "flips")); + it->item->flip_content_objs = + _item_mode_content_realize(it, VIEW(it), + &it->item->flip_contents, NULL, + &it->item->flip_content_objs); + } + + if (!it->item->mincalcd) + { + Evas_Coord mw = -1, mh = -1; + + if (it->select_mode != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) + elm_coords_finger_size_adjust(1, &mw, 1, &mh); + if (it->wd->mode == ELM_LIST_COMPRESS) mw = it->wd->prev_viewport_w; + edje_object_size_min_restricted_calc(VIEW(it), &mw, &mh, mw, + mh); + if (it->select_mode != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) + elm_coords_finger_size_adjust(1, &mw, 1, &mh); + it->item->w = it->item->minw = mw; + it->item->h = it->item->minh = mh; + it->item->mincalcd = EINA_TRUE; + + if ((!it->wd->group_item_width) && (it->group)) + { + it->wd->group_item_width = mw; + it->wd->group_item_height = mh; + } + else if ((!it->wd->item_width) && (it->item->type == ELM_GENLIST_ITEM_NONE)) + { + it->wd->item_width = mw; + it->wd->item_height = mh; + } + } + if (!calc) evas_object_show(VIEW(it)); + } + + if (it->tooltip.content_cb) + { + elm_widget_item_tooltip_content_cb_set(it, + it->tooltip.content_cb, + it->tooltip.data, NULL); + elm_widget_item_tooltip_style_set(it, it->tooltip.style); + elm_widget_item_tooltip_window_mode_set(it, it->tooltip.free_size); + } + + if (it->mouse_cursor) + elm_widget_item_cursor_set(it, it->mouse_cursor); + + it->realized = EINA_TRUE; + it->want_unrealize = EINA_FALSE; + + if (itc) _item_cache_free(itc); + //evas_event_thaw(evas_object_evas_get(it->wd->obj)); + //evas_event_thaw_eval(evas_object_evas_get(it->wd->obj)); + if (!calc) + { + if (it->item->tree_effect_hideme) + { + if (it->wd->move_effect_mode != ELM_GENLIST_TREE_EFFECT_NONE) + edje_object_signal_emit(VIEW(it), "elm,state,hide", ""); + it->item->tree_effect_hideme = EINA_FALSE; + } + evas_object_smart_callback_call(WIDGET(it), SIG_REALIZED, it); + } + + if ((!calc) && (it->wd->decorate_all_mode) && (it->item->type != ELM_GENLIST_ITEM_GROUP)) + { + if (it->itc->decorate_all_item_style) + { + if (!it->deco_all_view) _decorate_all_item_realize(it, EINA_FALSE); + edje_object_message_signal_process(it->deco_all_view); + } + } + edje_object_message_signal_process(VIEW(it)); +} + +static void +_item_unrealize_cb(Elm_Gen_Item *it) +{ + Evas_Object *content; + elm_widget_stringlist_free(it->item->flip_contents); + it->item->flip_contents = NULL; + EINA_LIST_FREE(it->item->flip_content_objs, content) + evas_object_del(content); + + if (it->item->nocache_once || it->item->nocache) + { + evas_object_del(VIEW(it)); + VIEW(it) = NULL; + if (it->spacer) + { + evas_object_del(it->spacer); + it->spacer = NULL; + } + } + else + { + edje_object_mirrored_set(VIEW(it), + elm_widget_mirrored_get(WIDGET(it))); + edje_object_scale_set(VIEW(it), + elm_widget_scale_get(WIDGET(it)) + * _elm_config->scale); + _item_cache_add(it); + } + + _decorate_item_unrealize(it); + it->states = NULL; + it->realized = EINA_FALSE; + it->want_unrealize = EINA_FALSE; + if (it->wd->decorate_all_mode) _decorate_all_item_unrealize(it); +} + +static Eina_Bool +_item_block_recalc(Item_Block *itb, + int in, + Eina_Bool qadd) +{ + const Eina_List *l; + Elm_Gen_Item *it; + Evas_Coord minw = 0, minh = 0; + Eina_Bool showme = EINA_FALSE, changed = EINA_FALSE; + Evas_Coord y = 0; + + //evas_event_freeze(evas_object_evas_get(itb->wd->obj)); + itb->num = in; + EINA_LIST_FOREACH(itb->items, l, it) + { + if (it->generation < it->wd->generation) continue; + showme |= it->item->showme; + if (!itb->realized) + { + if (qadd) + { + if (!it->item->mincalcd) changed = EINA_TRUE; + if (changed) + { + _item_realize(it, in, EINA_TRUE); + _elm_genlist_item_unrealize(it, EINA_TRUE); + } + } + else + { + _item_realize(it, in, EINA_TRUE); + _elm_genlist_item_unrealize(it, EINA_TRUE); + } + } + else + { + if (!it->item->mincalcd) changed = EINA_TRUE; + _item_realize(it, in, EINA_FALSE); + } + minh += it->item->minh; + if (minw < it->item->minw) minw = it->item->minw; + in++; + it->x = 0; + it->y = y; + y += it->item->h; + } + if (changed) itb->wd->pan_changed = changed; + itb->minw = minw; + itb->minh = minh; + itb->changed = EINA_FALSE; + itb->position_update = EINA_FALSE; + //evas_event_thaw(evas_object_evas_get(itb->wd->obj)); + //evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj)); + return showme; +} + +static void +_item_block_realize(Item_Block *itb) +{ + if (itb->realized) return; + itb->realized = EINA_TRUE; + itb->want_unrealize = EINA_FALSE; +} + +static void +_item_block_unrealize(Item_Block *itb) +{ + const Eina_List *l; + Elm_Gen_Item *it; + Eina_Bool dragging = EINA_FALSE; + + if (!itb->realized) return; + evas_event_freeze(evas_object_evas_get(itb->wd->obj)); + EINA_LIST_FOREACH(itb->items, l, it) + { + if (itb->must_recalc || !it->group) + { + if (it->dragging) + { + dragging = EINA_TRUE; + it->want_unrealize = EINA_TRUE; + } + else + _elm_genlist_item_unrealize(it, EINA_FALSE); + } + } + if (!dragging) + { + itb->realized = EINA_FALSE; + itb->want_unrealize = EINA_TRUE; + } + else + itb->want_unrealize = EINA_FALSE; + evas_event_thaw(evas_object_evas_get(itb->wd->obj)); + evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj)); +} + +static int +_get_space_for_reorder_item(Elm_Gen_Item *it) +{ + Evas_Coord rox, roy, row, roh, oy, oh; + Eina_Bool top = EINA_FALSE; + Elm_Gen_Item *reorder_it = it->wd->reorder_it; + if (!reorder_it) return 0; + + evas_object_geometry_get(it->wd->pan_smart, NULL, &oy, NULL, &oh); + evas_object_geometry_get(it->wd->VIEW(reorder_it), &rox, &roy, &row, &roh); + + if ((it->wd->reorder_start_y < it->item->block->y) && + (roy - oy + (roh / 2) >= it->item->block->y - it->wd->pan_y)) + { + it->item->block->reorder_offset = it->wd->reorder_it->item->h * -1; + if (it->item->block->count == 1) + it->wd->reorder_rel = it; + } + else if ((it->wd->reorder_start_y >= it->item->block->y) && + (roy - oy + (roh / 2) <= it->item->block->y - it->wd->pan_y)) + { + it->item->block->reorder_offset = it->wd->reorder_it->item->h; + } + else + it->item->block->reorder_offset = 0; + + it->item->scrl_y += it->item->block->reorder_offset; + + top = (ELM_RECTS_INTERSECT(it->item->scrl_x, it->item->scrl_y, it->item->w, it->item->h, + rox, roy + (roh / 2), row, 1)); + if (top) + { + it->wd->reorder_rel = it; + it->item->scrl_y += it->wd->reorder_it->item->h; + return it->wd->reorder_it->item->h; + } + else + return 0; +} + +static Eina_Bool +_reorder_move_animator_cb(void *data) +{ + Elm_Gen_Item *it = data; + Eina_Bool down = EINA_FALSE; + double t; + int y, dy = it->item->h / 10 * _elm_config->scale, diff; + + t = ((0.0 > (t = ecore_loop_time_get()-it->wd->start_time)) ? 0.0 : t); + + if (t <= REORDER_EFFECT_TIME) y = (1 * sin((t / REORDER_EFFECT_TIME) * (M_PI / 2)) * dy); + else y = dy; + + diff = abs(it->item->old_scrl_y - it->item->scrl_y); + if (diff > it->item->h) y = diff / 2; + + if (it->item->old_scrl_y < it->item->scrl_y) + { + it->item->old_scrl_y += y; + down = EINA_TRUE; + } + else if (it->item->old_scrl_y > it->item->scrl_y) + { + it->item->old_scrl_y -= y; + down = EINA_FALSE; + } + + if (it->deco_all_view) + _item_position(it, it->deco_all_view, it->item->scrl_x, it->item->old_scrl_y); + else + _item_position(it, VIEW(it), it->item->scrl_x, it->item->old_scrl_y); + _group_items_recalc(it->wd); + + if ((it->wd->reorder_pan_move) || + (down && it->item->old_scrl_y >= it->item->scrl_y) || + (!down && it->item->old_scrl_y <= it->item->scrl_y)) + { + it->item->old_scrl_y = it->item->scrl_y; + it->item->move_effect_enabled = EINA_FALSE; + it->wd->reorder_move_animator = NULL; + return ECORE_CALLBACK_CANCEL; + } + return ECORE_CALLBACK_RENEW; +} + +static void +_item_position(Elm_Gen_Item *it, + Evas_Object *view, + Evas_Coord it_x, + Evas_Coord it_y) +{ + if (!it) return; + if (!view) return; + + evas_event_freeze(evas_object_evas_get(it->wd->obj)); + evas_object_resize(view, it->item->w, it->item->h); + evas_object_move(view, it_x, it_y); + evas_object_show(view); + evas_event_thaw(evas_object_evas_get(it->wd->obj)); + evas_event_thaw_eval(evas_object_evas_get(it->wd->obj)); +} + +static void +_item_block_position(Item_Block *itb, + int in) +{ + const Eina_List *l; + Elm_Gen_Item *it; + Elm_Gen_Item *git; + Evas_Coord y = 0, ox, oy, ow, oh, cvx, cvy, cvw, cvh; + Eina_Bool vis = EINA_FALSE; + + evas_event_freeze(evas_object_evas_get(itb->wd->obj)); + evas_object_geometry_get(itb->wd->pan_smart, &ox, &oy, &ow, &oh); + evas_output_viewport_get(evas_object_evas_get(itb->wd->obj), &cvx, &cvy, + &cvw, &cvh); + EINA_LIST_FOREACH(itb->items, l, it) + { + if (it->generation < it->wd->generation) continue; + else if (it->wd->reorder_it == it) continue; + it->x = 0; + it->y = y; + it->item->w = itb->w; + it->item->scrl_x = itb->x + it->x - it->wd->pan_x + ox; + it->item->scrl_y = itb->y + it->y - it->wd->pan_y + oy; + + vis = (ELM_RECTS_INTERSECT(it->item->scrl_x, it->item->scrl_y, it->item->w, it->item->h, + cvx, cvy, cvw, cvh)); + if (!it->group) + { + if ((itb->realized) && (!it->realized)) + { + if (vis) _item_realize(it, in, EINA_FALSE); + } + if (it->realized) + { + if (vis || it->dragging) + { + if (it->wd->reorder_mode) + y += _get_space_for_reorder_item(it); + git = it->item->group_item; + if (git) + { + if (git->item->scrl_y < oy) + git->item->scrl_y = oy; + if ((git->item->scrl_y + git->item->h) > (it->item->scrl_y + it->item->h)) + git->item->scrl_y = (it->item->scrl_y + it->item->h) - git->item->h; + git->item->want_realize = EINA_TRUE; + } + if ((it->wd->reorder_it) && (it->item->old_scrl_y != it->item->scrl_y)) + { + if (!it->item->move_effect_enabled) + { + it->item->move_effect_enabled = EINA_TRUE; + it->wd->reorder_move_animator = + ecore_animator_add( + _reorder_move_animator_cb, it); + } + } + if (!it->item->move_effect_enabled) + { + if ((it->wd->decorate_all_mode) && (it->itc->decorate_all_item_style)) + _decorate_all_item_position(it, it->item->scrl_x, + it->item->scrl_y); + else + { + if (!it->wd->tree_effect_enabled || + (it->wd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_NONE) || + ((it->wd->move_effect_mode != ELM_GENLIST_TREE_EFFECT_NONE) && + (it->item->old_scrl_y == it->item->scrl_y))) + { + if (it->item->deco_it_view) + _item_position(it, it->item->deco_it_view, + it->item->scrl_x, + it->item->scrl_y); + else + _item_position(it, VIEW(it), it->item->scrl_x, + it->item->scrl_y); + } + } + it->item->old_scrl_y = it->item->scrl_y; + } + } + else + { + if (!it->wd->tree_effect_animator) + _elm_genlist_item_unrealize(it, EINA_FALSE); + } + } + in++; + } + else + { + if (vis) it->item->want_realize = EINA_TRUE; + } + y += it->item->h; + } + evas_event_thaw(evas_object_evas_get(itb->wd->obj)); + evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj)); +} + +static void +_group_items_recalc(void *data) +{ + Widget_Data *wd = data; + Eina_List *l; + Elm_Gen_Item *git; + + evas_event_freeze(evas_object_evas_get(wd->obj)); + EINA_LIST_FOREACH(wd->group_items, l, git) + { + if (git->item->want_realize) + { + if (!git->realized) + _item_realize(git, 0, EINA_FALSE); + evas_object_resize(VIEW(git), wd->minw, git->item->h); + evas_object_move(VIEW(git), git->item->scrl_x, git->item->scrl_y); + evas_object_show(VIEW(git)); + evas_object_raise(VIEW(git)); + } + else if (!git->item->want_realize && git->realized) + { + if (!git->dragging) + _elm_genlist_item_unrealize(git, EINA_FALSE); + } + } + evas_event_thaw(evas_object_evas_get(wd->obj)); + evas_event_thaw_eval(evas_object_evas_get(wd->obj)); +} + +static Eina_Bool +_must_recalc_idler(void *data) +{ + Widget_Data *wd = data; + if (wd->calc_job) ecore_job_del(wd->calc_job); + wd->calc_job = ecore_job_add(_calc_job, wd); + wd->must_recalc_idler = NULL; + return ECORE_CALLBACK_CANCEL; +} + +static void +_scroll_item(Widget_Data *wd) +{ + Elm_Gen_Item *it = NULL; + Evas_Coord gith = 0; + Evas_Coord ow, oh, dx = 0, dy = 0, dw = 0, dh = 0; + if (!wd->show_item) return; + + evas_object_geometry_get(wd->pan_smart, NULL, NULL, &ow, &oh); + it = wd->show_item; + dx = it->x + it->item->block->x; + dy = it->y + it->item->block->y; + dw = it->item->block->w; + dh = oh; + switch (wd->scrollto_type) + { + case ELM_GENLIST_ITEM_SCROLLTO_TOP: + if (it->item->group_item) gith = it->item->group_item->item->h; + dy -= gith; + break; + case ELM_GENLIST_ITEM_SCROLLTO_MIDDLE: + dy += ((it->item->h / 2) - (oh / 2)); + break; + case ELM_GENLIST_ITEM_SCROLLTO_IN: + default: + if ((wd->expanded_item) && + ((wd->show_item->y + wd->show_item->item->block->y + wd->show_item->item->h) + - (wd->expanded_item->y + wd->expanded_item->item->block->y) > oh)) + { + it = wd->expanded_item; + if (it->item->group_item) gith = it->item->group_item->item->h; + dx = it->x + it->item->block->x; + dy = it->y + it->item->block->y - gith; + dw = it->item->block->w; + } + else + { + if ((it->item->group_item) && (wd->pan_y > (it->y + it->item->block->y))) + gith = it->item->group_item->item->h; + dy -= gith; + dh = it->item->h; + } + break; + } + if (wd->bring_in) + elm_smart_scroller_region_bring_in(wd->scr, dx, dy, dw, dh); + else + elm_smart_scroller_child_region_show(wd->scr, dx, dy, dw, dh); + + it->item->showme = EINA_FALSE; + wd->show_item = NULL; + wd->auto_scroll_enabled = EINA_FALSE; + wd->check_scroll = EINA_FALSE; +} + +static void +_calc_job(void *data) +{ + Widget_Data *wd = data; + Item_Block *itb, *chb = NULL; + Evas_Coord minw = -1, minh = 0, y = 0, ow, dy = 0, vw; + Evas_Coord pan_w = 0, pan_h = 0; + int in = 0; + Eina_Bool minw_change = EINA_FALSE; + Eina_Bool did_must_recalc = EINA_FALSE; + if (!wd) return; + + evas_object_geometry_get(wd->pan_smart, NULL, NULL, &ow, &wd->h); + elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, NULL); + + if (wd->w != ow) + wd->w = ow; + + evas_event_freeze(evas_object_evas_get(wd->obj)); + EINA_INLIST_FOREACH(wd->blocks, itb) + { + Eina_Bool showme = EINA_FALSE; + + itb->num = in; + showme = itb->showme; + itb->showme = EINA_FALSE; + if (chb) + { + if (itb->realized) _item_block_unrealize(itb); + } + if ((itb->changed) || ((itb->must_recalc) && (!did_must_recalc))) + { + if (itb->must_recalc) + { + Eina_List *l; + Elm_Gen_Item *it; + EINA_LIST_FOREACH(itb->items, l, it) + if (it->item->mincalcd) it->item->mincalcd = EINA_FALSE; + itb->changed = EINA_TRUE; + if (itb->must_recalc) did_must_recalc = EINA_TRUE; + if (itb->realized) _item_block_unrealize(itb); + itb->must_recalc = EINA_FALSE; + } + showme = _item_block_recalc(itb, in, EINA_FALSE); + chb = itb; + } + itb->y = y; + itb->x = 0; + minh += itb->minh; + if (minw == -1) minw = itb->minw; + else if ((!itb->must_recalc) && (minw < itb->minw)) + { + minw = itb->minw; + minw_change = EINA_TRUE; + } + if (minw > vw) + { + minw = vw; + minw_change = EINA_TRUE; + } + itb->w = minw; + itb->h = itb->minh; + y += itb->h; + in += itb->count; + if ((showme) && (wd->show_item) && (!wd->show_item->item->queued)) + wd->check_scroll = EINA_TRUE; + } + if (minw_change) + { + EINA_INLIST_FOREACH(wd->blocks, itb) + { + itb->minw = minw; + itb->w = itb->minw; + } + } + if ((chb) && (EINA_INLIST_GET(chb)->next)) + { + EINA_INLIST_FOREACH(EINA_INLIST_GET(chb)->next, itb) + { + if (itb->realized) _item_block_unrealize(itb); + } + } + wd->realminw = minw; + if (minw < wd->w) minw = wd->w; + if ((minw != wd->minw) || (minh != wd->minh)) + { + wd->minw = minw; + wd->minh = minh; + evas_object_smart_callback_call(wd->pan_smart, "changed", NULL); + _sizing_eval(wd->obj); + if ((wd->anchor_item) && (wd->anchor_item->item->block) && (!wd->auto_scroll_enabled)) + { + Elm_Gen_Item *it; + Evas_Coord it_y; + + it = wd->anchor_item; + it_y = wd->anchor_y; + elm_smart_scroller_child_pos_set(wd->scr, wd->pan_x, + it->item->block->y + it->y + it_y); + wd->anchor_item = it; + wd->anchor_y = it_y; + } + } + if (did_must_recalc) + { + if (!wd->must_recalc_idler) + wd->must_recalc_idler = ecore_idler_add(_must_recalc_idler, wd); + } + if (wd->check_scroll) + { + _pan_child_size_get(wd->pan_smart, &pan_w, &pan_h); + if (EINA_INLIST_GET(wd->show_item) == wd->items->last) + wd->scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_IN; + switch (wd->scrollto_type) + { + case ELM_GENLIST_ITEM_SCROLLTO_TOP: + dy = wd->h; + break; + case ELM_GENLIST_ITEM_SCROLLTO_MIDDLE: + dy = wd->h / 2; + break; + case ELM_GENLIST_ITEM_SCROLLTO_IN: + default: + dy = 0; + break; + } + if (wd->show_item) + { + if ((pan_w > (wd->show_item->x + wd->show_item->item->block->x)) && + (pan_h > (wd->show_item->y + wd->show_item->item->block->y + dy))) + { + _scroll_item(wd); + } + } + } + wd->calc_job = NULL; + evas_object_smart_changed(wd->pan_smart); + evas_event_thaw(evas_object_evas_get(wd->obj)); + evas_event_thaw_eval(evas_object_evas_get(wd->obj)); +} + +static void +_update_job(void *data) +{ + Widget_Data *wd = data; + Eina_List *l2; + Item_Block *itb; + int num, num0; + Eina_Bool position = EINA_FALSE, recalc = EINA_FALSE; + if (!wd) return; + wd->update_job = NULL; + num = 0; + + evas_event_freeze(evas_object_evas_get(wd->obj)); + EINA_INLIST_FOREACH(wd->blocks, itb) + { + Evas_Coord itminw, itminh; + Elm_Gen_Item *it; + + if (!itb->updateme) + { + num += itb->count; + if (position) + _item_block_position(itb, num); + continue; + } + num0 = num; + recalc = EINA_FALSE; + EINA_LIST_FOREACH(itb->items, l2, it) + { + if (it->item->updateme) + { + itminw = it->item->minw; + itminh = it->item->minh; + + it->item->updateme = EINA_FALSE; + if (it->realized) + { + _elm_genlist_item_unrealize(it, EINA_FALSE); + _item_realize(it, num, EINA_FALSE); + position = EINA_TRUE; + } + else + { + _item_realize(it, num, EINA_TRUE); + _elm_genlist_item_unrealize(it, EINA_TRUE); + } + if ((it->item->minw != itminw) || (it->item->minh != itminh)) + recalc = EINA_TRUE; + } + num++; + } + itb->updateme = EINA_FALSE; + if (recalc) + { + position = EINA_TRUE; + itb->changed = EINA_TRUE; + _item_block_recalc(itb, num0, EINA_FALSE); + _item_block_position(itb, num0); + } + } + if (position) + { + if (wd->calc_job) ecore_job_del(wd->calc_job); + wd->calc_job = ecore_job_add(_calc_job, wd); + } + evas_event_thaw(evas_object_evas_get(wd->obj)); + evas_event_thaw_eval(evas_object_evas_get(wd->obj)); +} + +static void +_pan_set(Evas_Object *obj, + Evas_Coord x, + Evas_Coord y) +{ + Pan *sd = evas_object_smart_data_get(obj); + Item_Block *itb; + + if (!sd) return; + if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return; + sd->wd->pan_x = x; + sd->wd->pan_y = y; + + EINA_INLIST_FOREACH(sd->wd->blocks, itb) + { + if ((itb->y + itb->h) > y) + { + Elm_Gen_Item *it; + Eina_List *l2; + + EINA_LIST_FOREACH(itb->items, l2, it) + { + if ((itb->y + it->y) >= y) + { + sd->wd->anchor_item = it; + sd->wd->anchor_y = -(itb->y + it->y - y); + goto done; + } + } + } + } +done: + if (!sd->wd->reorder_move_animator) evas_object_smart_changed(obj); +} + +static void +_pan_get(Evas_Object *obj, + Evas_Coord *x, + Evas_Coord *y) +{ + Pan *sd = evas_object_smart_data_get(obj); + + if (!sd) return; + if (x) *x = sd->wd->pan_x; + if (y) *y = sd->wd->pan_y; +} + +static void +_pan_max_get(Evas_Object *obj, + Evas_Coord *x, + Evas_Coord *y) +{ + Pan *sd = evas_object_smart_data_get(obj); + Evas_Coord ow, oh; + + if (!sd) return; + evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); + ow = sd->wd->minw - ow; + if (ow < 0) ow = 0; + oh = sd->wd->minh - oh; + if (oh < 0) oh = 0; + if (x) *x = ow; + if (y) *y = oh; +} + +static void +_pan_min_get(Evas_Object *obj __UNUSED__, + Evas_Coord *x, + Evas_Coord *y) +{ + if (x) *x = 0; + if (y) *y = 0; +} + +static void +_pan_child_size_get(Evas_Object *obj, + Evas_Coord *w, + Evas_Coord *h) +{ + Pan *sd = evas_object_smart_data_get(obj); + + if (!sd) return; + if (w) *w = sd->wd->minw; + if (h) *h = sd->wd->minh; +} + +static void +_pan_add(Evas_Object *obj) +{ + Pan *sd; + Evas_Object_Smart_Clipped_Data *cd; + + _pan_sc.add(obj); + cd = evas_object_smart_data_get(obj); + sd = ELM_NEW(Pan); + if (!sd) return; + sd->__clipped_data = *cd; + free(cd); + evas_object_smart_data_set(obj, sd); +} + +static void +_pan_del(Evas_Object *obj) +{ + Pan *sd = evas_object_smart_data_get(obj); + + if (!sd) return; + if (sd->resize_job) + { + ecore_job_del(sd->resize_job); + sd->resize_job = NULL; + } + _pan_sc.del(obj); +} + +static void +_pan_resize_job(void *data) +{ + Pan *sd = data; + if (!sd) return; + _sizing_eval(sd->wd->obj); + sd->resize_job = NULL; +} + +static void +_pan_resize(Evas_Object *obj, + Evas_Coord w, + Evas_Coord h) +{ + Pan *sd = evas_object_smart_data_get(obj); + Evas_Coord ow, oh; + + if (!sd) return; + evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); + if ((ow == w) && (oh == h)) return; + if ((sd->wd->mode == ELM_LIST_COMPRESS) && (ow != w)) + { + /* fix me later */ + if (sd->resize_job) ecore_job_del(sd->resize_job); + sd->resize_job = ecore_job_add(_pan_resize_job, sd); + } + sd->wd->pan_changed = EINA_TRUE; + evas_object_smart_changed(obj); + if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job); + sd->wd->calc_job = NULL; +} + +static void +_pan_calculate(Evas_Object *obj) +{ + Pan *sd = evas_object_smart_data_get(obj); + Item_Block *itb; + Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh; + int in = 0; + Elm_Gen_Item *git; + Eina_List *l; + + if (!sd) return; + evas_event_freeze(evas_object_evas_get(obj)); + + if (sd->wd->pan_changed) + { + _calc_job(sd->wd); + sd->wd->pan_changed = EINA_FALSE; + } + + evas_object_geometry_get(obj, &ox, &oy, &ow, &oh); + evas_output_viewport_get(evas_object_evas_get(obj), &cvx, &cvy, &cvw, &cvh); + EINA_LIST_FOREACH(sd->wd->group_items, l, git) + { + git->item->want_realize = EINA_FALSE; + } + + if (sd->wd->tree_effect_enabled && (sd->wd->move_effect_mode != ELM_GENLIST_TREE_EFFECT_NONE)) + { + if (!sd->wd->tree_effect_animator) + { + _item_tree_effect_before(sd->wd->expanded_item); + evas_object_raise(sd->wd->alpha_bg); + evas_object_show(sd->wd->alpha_bg); + sd->wd->start_time = ecore_time_get(); + sd->wd->tree_effect_animator = ecore_animator_add(_tree_effect_animator_cb, sd->wd); + } + } + + EINA_INLIST_FOREACH(sd->wd->blocks, itb) + { + itb->w = sd->wd->minw; + if (ELM_RECTS_INTERSECT(itb->x - sd->wd->pan_x + ox, + itb->y - sd->wd->pan_y + oy, + itb->w, itb->h, + cvx, cvy, cvw, cvh)) + { + if ((!itb->realized) || (itb->changed)) + _item_block_realize(itb); + _item_block_position(itb, in); + } + else + { + if (itb->realized) _item_block_unrealize(itb); + } + in += itb->count; + } + if ((!sd->wd->reorder_it) || (sd->wd->reorder_pan_move)) + _group_items_recalc(sd->wd); + if ((sd->wd->reorder_mode) && (sd->wd->reorder_it)) + { + if (sd->wd->pan_y != sd->wd->reorder_old_pan_y) + sd->wd->reorder_pan_move = EINA_TRUE; + else sd->wd->reorder_pan_move = EINA_FALSE; + evas_object_raise(sd->wd->VIEW(reorder_it)); + sd->wd->reorder_old_pan_y = sd->wd->pan_y; + sd->wd->start_time = ecore_loop_time_get(); + } + + if (!sd->wd->tree_effect_enabled || (sd->wd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_NONE)) + _item_auto_scroll(sd->wd); + + evas_event_thaw(evas_object_evas_get(obj)); + evas_event_thaw_eval(evas_object_evas_get(obj)); +} + +static void +_pan_move(Evas_Object *obj, + Evas_Coord x __UNUSED__, + Evas_Coord y __UNUSED__) +{ + Pan *sd = evas_object_smart_data_get(obj); + + if (!sd) return; + + sd->wd->pan_changed = EINA_TRUE; + evas_object_smart_changed(obj); + if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job); + sd->wd->calc_job = NULL; +} + +static void +_hold_on(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_smart_scroller_hold_set(wd->scr, 1); +} + +static void +_hold_off(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_smart_scroller_hold_set(wd->scr, 0); +} + +static void +_freeze_on(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_smart_scroller_freeze_set(wd->scr, 1); +} + +static void +_freeze_off(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_smart_scroller_freeze_set(wd->scr, 0); +} + +static void +_scr_anim_start(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_START, NULL); +} + +static void +_scr_anim_stop(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_STOP, NULL); +} + +static void +_scr_drag_start(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START, NULL); +} + +static void +_scr_drag_stop(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP, NULL); +} + +static void +_edge_left(void *data, + Evas_Object *scr __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *obj = data; + evas_object_smart_callback_call(obj, SIG_EDGE_LEFT, NULL); +} + +static void +_edge_right(void *data, + Evas_Object *scr __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *obj = data; + evas_object_smart_callback_call(obj, SIG_EDGE_RIGHT, NULL); +} + +static void +_edge_top(void *data, + Evas_Object *scr __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *obj = data; + evas_object_smart_callback_call(obj, SIG_EDGE_TOP, NULL); +} + +static void +_edge_bottom(void *data, + Evas_Object *scr __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *obj = data; + evas_object_smart_callback_call(obj, SIG_EDGE_BOTTOM, NULL); +} + +static void +_decorate_item_realize(Elm_Gen_Item *it) +{ + char buf[1024]; + + if ((it->item->deco_it_view) || (it->generation < it->wd->generation)) return; + + evas_event_freeze(evas_object_evas_get(it->wd->obj)); + it->item->deco_it_view = edje_object_add(evas_object_evas_get(WIDGET(it))); + edje_object_scale_set(it->item->deco_it_view, + elm_widget_scale_get(WIDGET(it)) * + _elm_config->scale); + evas_object_smart_member_add(it->item->deco_it_view, it->wd->pan_smart); + elm_widget_sub_object_add(WIDGET(it), it->item->deco_it_view); + + strncpy(buf, "item", sizeof(buf)); + if (it->wd->mode == ELM_LIST_COMPRESS) + strncat(buf, "_compress", sizeof(buf) - strlen(buf)); + + if (it->item->order_num_in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf)); + strncat(buf, "/", sizeof(buf) - strlen(buf)); + strncat(buf, it->itc->decorate_item_style, sizeof(buf) - strlen(buf)); + + _elm_theme_object_set(WIDGET(it), it->item->deco_it_view, "genlist", buf, + elm_widget_style_get(WIDGET(it))); + edje_object_mirrored_set(it->item->deco_it_view, + elm_widget_mirrored_get(WIDGET(it))); + + /* signal callback add */ + evas_object_event_callback_add(it->item->deco_it_view, EVAS_CALLBACK_MOUSE_DOWN, + _mouse_down, it); + evas_object_event_callback_add(it->item->deco_it_view, EVAS_CALLBACK_MOUSE_UP, + _mouse_up, it); + evas_object_event_callback_add(it->item->deco_it_view, EVAS_CALLBACK_MOUSE_MOVE, + _mouse_move, it); + + /* text_get, content_get, state_get */ + /* FIXME: If you see that assert, please notify us and we + will clean our mess */ + assert(eina_list_count(it->item->deco_it_content_objs) == 0); + + _item_text_realize(it, it->item->deco_it_view, &it->item->deco_it_texts, NULL); + if (!it->item->deco_it_contents) + it->item->deco_it_contents = + elm_widget_stringlist_get(edje_object_data_get(it->item->deco_it_view, "contents")); + it->item->deco_it_content_objs = + _item_mode_content_realize(it, it->item->deco_it_view, + &it->item->deco_it_contents, NULL, + &it->item->deco_it_content_objs); + _item_state_realize(it, it->item->deco_it_view, &it->item->deco_it_states, NULL); + edje_object_part_swallow(it->item->deco_it_view, + edje_object_data_get(it->item->deco_it_view, "mode_part"), + VIEW(it)); + + it->want_unrealize = EINA_FALSE; + evas_event_thaw(evas_object_evas_get(it->wd->obj)); + evas_event_thaw_eval(evas_object_evas_get(it->wd->obj)); +} + +static void +_decorate_item_unrealize(Elm_Gen_Item *it) +{ + Widget_Data *wd = it->wd; + Evas_Object *content; + if (!it->item->deco_it_view) return; + + evas_event_freeze(evas_object_evas_get(it->wd->obj)); + elm_widget_stringlist_free(it->item->deco_it_texts); + it->item->deco_it_texts = NULL; + elm_widget_stringlist_free(it->item->deco_it_contents); + it->item->deco_it_contents = NULL; + elm_widget_stringlist_free(it->item->deco_it_states); + + EINA_LIST_FREE(it->item->deco_it_content_objs, content) + evas_object_del(content); + + edje_object_part_unswallow(it->item->deco_it_view, VIEW(it)); + evas_object_smart_member_add(VIEW(it), wd->pan_smart); + evas_object_del(it->item->deco_it_view); + it->item->deco_it_view = NULL; + + if (wd->mode_item == it) + wd->mode_item = NULL; + evas_event_thaw(evas_object_evas_get(it->wd->obj)); + evas_event_thaw_eval(evas_object_evas_get(it->wd->obj)); +} + +static void +_decorate_item_set(Elm_Gen_Item *it) +{ + if (!it) return; + Widget_Data *wd = it->wd; + if (!wd) return; + char buf[1024]; + + wd->mode_item = it; + it->item->nocache_once = EINA_TRUE; + + if (wd->scr_hold_timer) + { + ecore_timer_del(wd->scr_hold_timer); + wd->scr_hold_timer = NULL; + } + elm_smart_scroller_hold_set(wd->scr, EINA_TRUE); + wd->scr_hold_timer = ecore_timer_add(0.1, _scr_hold_timer_cb, wd); + + evas_event_freeze(evas_object_evas_get(it->wd->obj)); + _decorate_item_realize(it); + if (it->item->group_item) + evas_object_raise(it->item->VIEW(group_item)); + _item_position(it, it->item->deco_it_view, it->item->scrl_x, it->item->scrl_y); + evas_event_thaw(evas_object_evas_get(it->wd->obj)); + evas_event_thaw_eval(evas_object_evas_get(it->wd->obj)); + + snprintf(buf, sizeof(buf), "elm,state,%s,active", wd->decorate_it_type); + edje_object_signal_emit(it->item->deco_it_view, buf, "elm"); +} + +static void +_decorate_item_unset(Widget_Data *wd) +{ + if (!wd) return; + if (!wd->mode_item) return; + char buf[1024], buf2[1024]; + Elm_Gen_Item *it; + + it = wd->mode_item; + it->item->nocache_once = EINA_TRUE; + + snprintf(buf, sizeof(buf), "elm,state,%s,passive", wd->decorate_it_type); + snprintf(buf2, sizeof(buf2), "elm,state,%s,passive,finished", wd->decorate_it_type); + + edje_object_signal_emit(it->item->deco_it_view, buf, "elm"); + edje_object_signal_callback_add(it->item->deco_it_view, buf2, "elm", _decorate_item_finished_signal_cb, it); + + wd->mode_item = NULL; +} + +static void +_decorate_all_item_position(Elm_Gen_Item *it, int itx, int ity) +{ + if ((!it) || (!it->wd->decorate_all_mode)) return; + evas_object_resize(it->deco_all_view, it->item->w, it->item->h); + evas_object_move(it->deco_all_view, itx, ity); +} + +static void +_decorate_all_item_realize(Elm_Gen_Item *it, Eina_Bool effect_on) +{ + char buf[1024]; + const char *stacking_even; + const char *stacking; + + if ((!it) || (it->item->decorate_all_item_realized) || + (it->generation < it->wd->generation)) + return; + + it->deco_all_view = edje_object_add(evas_object_evas_get(WIDGET(it))); + edje_object_scale_set(it->deco_all_view, elm_widget_scale_get(WIDGET(it)) * + _elm_config->scale); + evas_object_smart_member_add(it->deco_all_view, it->wd->pan_smart); + elm_widget_sub_object_add(WIDGET(it), it->deco_all_view); + + if (it->item->type & ELM_GENLIST_ITEM_TREE) + strncpy(buf, "tree", sizeof(buf)); + else strncpy(buf, "item", sizeof(buf)); + if (it->wd->mode == ELM_LIST_COMPRESS) + strncat(buf, "_compress", sizeof(buf) - strlen(buf)); + + strncat(buf, "/", sizeof(buf) - strlen(buf)); + strncat(buf, it->itc->decorate_all_item_style, sizeof(buf) - strlen(buf)); + + _elm_theme_object_set(WIDGET(it), it->deco_all_view, "genlist", buf, + elm_widget_style_get(WIDGET(it))); + + stacking_even = edje_object_data_get(VIEW(it), "stacking_even"); + if (!stacking_even) stacking_even = "above"; + it->item->stacking_even = !!strcmp("above", stacking_even); + + stacking = edje_object_data_get(VIEW(it), "stacking"); + if (!stacking) stacking = "yes"; + it->item->nostacking = !!strcmp("yes", stacking); + + edje_object_mirrored_set(it->deco_all_view, + elm_widget_mirrored_get(WIDGET(it))); + + _elm_genlist_item_odd_even_update(it); + _elm_genlist_item_state_update(it, NULL); + + if (effect_on) edje_object_signal_emit(it->deco_all_view, "elm,state,decorate,enabled,effect", "elm"); + else edje_object_signal_emit(it->deco_all_view, "elm,state,decorate,enabled", "elm"); + + _item_mouse_callbacks_del(it, VIEW(it)); + _item_mouse_callbacks_add(it, it->deco_all_view); + + _item_text_realize(it, it->deco_all_view, &it->item->deco_all_texts, NULL); + if (it->flipped) edje_object_signal_emit(it->deco_all_view, "elm,state,flip,enabled", "elm"); + if (!it->item->deco_all_contents) + it->item->deco_all_contents = + elm_widget_stringlist_get(edje_object_data_get(it->deco_all_view, "contents")); + it->item->deco_all_content_objs = + _item_mode_content_realize(it, it->deco_all_view, + &it->item->deco_all_contents, NULL, + &it->item->deco_all_content_objs); + _item_state_realize(it, it->deco_all_view, &it->item->deco_all_states, NULL); + edje_object_part_swallow(it->deco_all_view, "elm.swallow.decorate.content", VIEW(it)); + + _decorate_all_item_position(it, it->item->scrl_x, it->item->scrl_y); + evas_object_show(it->deco_all_view); + + if (it->selected) edje_object_signal_emit(it->deco_all_view, "elm,state,selected", "elm"); + + it->item->decorate_all_item_realized = EINA_TRUE; + it->want_unrealize = EINA_FALSE; +} + +static void +_decorate_all_item_unrealize(Elm_Gen_Item *it) +{ + Evas_Object *icon; + if ((!it) || (!it->item->decorate_all_item_realized)) return; + + edje_object_part_unswallow(it->deco_all_view, VIEW(it)); + evas_object_smart_member_add(VIEW(it), it->wd->pan_smart); + elm_widget_sub_object_add(WIDGET(it), VIEW(it)); + _elm_genlist_item_odd_even_update(it); + _elm_genlist_item_state_update(it, NULL); + + evas_object_del(it->deco_all_view); + it->deco_all_view = NULL; + elm_widget_stringlist_free(it->item->deco_all_texts); + it->item->deco_all_texts = NULL; + elm_widget_stringlist_free(it->item->deco_all_contents); + it->item->deco_all_contents = NULL; + elm_widget_stringlist_free(it->item->deco_all_states); + it->item->deco_all_states = NULL; + EINA_LIST_FREE(it->item->deco_all_content_objs, icon) + evas_object_del(icon); + edje_object_message_signal_process(it->deco_all_view); + _item_mouse_callbacks_del(it, it->deco_all_view); + _item_mouse_callbacks_add(it, VIEW(it)); + + it->item->decorate_all_item_realized = EINA_FALSE; +} + +static void +_item_auto_scroll(Widget_Data *wd) +{ + if (!wd) return; + Elm_Gen_Item *tmp_item = NULL; + + if ((wd->expanded_item) && (wd->auto_scroll_enabled)) + { + tmp_item = eina_list_data_get(eina_list_last(wd->expanded_item->item->items)); + if (!tmp_item) return; + wd->show_item = tmp_item; + wd->bring_in = EINA_TRUE; + wd->scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_IN; + if ((wd->show_item->item->queued) || (!wd->show_item->item->mincalcd)) + { + wd->show_item->item->showme = EINA_TRUE; + wd->auto_scroll_enabled = EINA_FALSE; + } + else + _scroll_item(wd); + } +} + +EAPI Evas_Object * +elm_genlist_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + Evas_Coord minw, minh; + static Evas_Smart *smart = NULL; + + if (!smart) + { + static Evas_Smart_Class sc; + + evas_object_smart_clipped_smart_set(&_pan_sc); + sc = _pan_sc; + sc.name = "elm_genlist_pan"; + sc.version = EVAS_SMART_CLASS_VERSION; + sc.add = _pan_add; + sc.del = _pan_del; + sc.resize = _pan_resize; + sc.move = _pan_move; + sc.calculate = _pan_calculate; + if (!(smart = evas_smart_class_new(&sc))) return NULL; + } + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "genlist"); + ELM_GEN_SETUP(wd); + elm_widget_type_set(obj, "genlist"); + elm_widget_sub_object_add(parent, obj); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_signal_emit_hook_set(obj, _signal_emit_hook); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_can_focus_set(obj, EINA_TRUE); + elm_widget_event_hook_set(obj, _event_hook); + elm_widget_on_show_region_hook_set(obj, _show_region_hook, obj); + elm_widget_translate_hook_set(obj, _translate_hook); + + wd->generation = 1; + wd->scr = elm_smart_scroller_add(e); + elm_smart_scroller_widget_set(wd->scr, obj); + elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base", + elm_widget_style_get(obj)); + elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE, + _elm_config->thumbscroll_bounce_enable); + elm_widget_resize_object_set(obj, wd->scr); + + evas_object_smart_callback_add(wd->scr, "animate,start", _scr_anim_start, obj); + evas_object_smart_callback_add(wd->scr, "animate,stop", _scr_anim_stop, obj); + evas_object_smart_callback_add(wd->scr, "drag,start", _scr_drag_start, obj); + evas_object_smart_callback_add(wd->scr, "drag,stop", _scr_drag_stop, obj); + evas_object_smart_callback_add(wd->scr, "edge,left", _edge_left, obj); + evas_object_smart_callback_add(wd->scr, "edge,right", _edge_right, obj); + evas_object_smart_callback_add(wd->scr, "edge,top", _edge_top, obj); + evas_object_smart_callback_add(wd->scr, "edge,bottom", _edge_bottom, obj); + + wd->obj = obj; + wd->mode = ELM_LIST_SCROLL; + wd->max_items_per_block = MAX_ITEMS_PER_BLOCK; + wd->item_cache_max = wd->max_items_per_block * 2; + wd->longpress_timeout = _elm_config->longpress_timeout; + wd->highlight = EINA_TRUE; + + evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj); + evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj); + evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj); + evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj); + + wd->pan_smart = evas_object_smart_add(e, smart); + wd->pan = evas_object_smart_data_get(wd->pan_smart); + wd->pan->wd = wd; + + elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart, + _pan_set, _pan_get, _pan_max_get, + _pan_min_get, _pan_child_size_get); + + edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), + &minw, &minh); + evas_object_size_hint_min_set(obj, minw, minh); + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _sizing_eval(obj); + return obj; +} + +void +_item_select(Elm_Gen_Item *it) +{ + Evas_Object *obj = WIDGET(it); + + if ((it->generation < it->wd->generation) || (it->decorate_it_set) || + (it->select_mode == ELM_OBJECT_SELECT_MODE_NONE) || + (it->wd->select_mode == ELM_OBJECT_SELECT_MODE_NONE)) + return; + if (!it->selected) + { + it->selected = EINA_TRUE; + it->wd->selected = eina_list_append(it->wd->selected, it); + } + else if (it->wd->select_mode != ELM_OBJECT_SELECT_MODE_ALWAYS) return; + + evas_object_ref(obj); + it->walking++; + it->wd->walking++; + if (it->func.func) it->func.func((void *)it->func.data, WIDGET(it), it); + if (it->generation == it->wd->generation) + evas_object_smart_callback_call(WIDGET(it), SIG_SELECTED, it); + it->walking--; + it->wd->walking--; + if ((it->wd->clear_me) && (!it->wd->walking)) + _elm_genlist_clear(WIDGET(it), EINA_TRUE); + else + { + if ((!it->walking) && (it->generation < it->wd->generation)) + { + if (!it->relcount) + { + it->del_cb(it); + elm_widget_item_free(it); + } + } + else + it->wd->last_selected_item = (Elm_Object_Item *)it; + } + evas_object_unref(obj); +} + +static Evas_Object * +_item_content_get_hook(Elm_Gen_Item *it, const char *part) +{ + return edje_object_part_swallow_get(VIEW(it), part); +} + +static const char * +_item_text_get_hook(Elm_Gen_Item *it, const char *part) +{ + if (!it->itc->func.text_get) return NULL; + return edje_object_part_text_get(VIEW(it), part); +} + +static void +_item_disable_hook(Elm_Object_Item *it) +{ + Eina_List *l; + Evas_Object *obj; + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + + if (_it->generation < _it->wd->generation) return; + + if (_it->selected) + elm_genlist_item_selected_set(it, EINA_FALSE); + + if (_it->realized) + { + if (elm_widget_item_disabled_get(it)) + { + edje_object_signal_emit(VIEW(_it), "elm,state,disabled", "elm"); + if (_it->deco_all_view) + edje_object_signal_emit(_it->deco_all_view, "elm,state,disabled", "elm"); + } + else + { + edje_object_signal_emit(VIEW(_it), "elm,state,enabled", "elm"); + if (_it->deco_all_view) + edje_object_signal_emit(_it->deco_all_view, "elm,state,enabled", "elm"); + } + EINA_LIST_FOREACH(_it->content_objs, l, obj) + elm_widget_disabled_set(obj, elm_widget_item_disabled_get(_it)); + } +} + +static Eina_Bool +_item_del_pre_hook(Elm_Object_Item *it) +{ + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + + if ((_it->relcount > 0) || (_it->walking > 0)) + { + elm_genlist_item_subitems_clear(it); + if (_it->wd->show_item == _it) _it->wd->show_item = NULL; + _elm_genlist_item_del_notserious(_it); + if (_it->item->block) + { + if (_it->realized) _elm_genlist_item_unrealize(_it, EINA_FALSE); + _it->item->block->changed = EINA_TRUE; + if (_it->wd->calc_job) ecore_job_del(_it->wd->calc_job); + _it->wd->calc_job = ecore_job_add(_calc_job, _it->wd); + } + if (_it->parent) + { + _it->parent->item->items = + eina_list_remove(_it->parent->item->items, it); + _it->parent = NULL; + } + return EINA_FALSE; + } + _item_del(_it); + return EINA_TRUE; +} + +static void +_item_signal_emit_hook(Elm_Object_Item *it, + const char *emission, + const char *source) +{ + edje_object_signal_emit(VIEW(it), emission, source); +} + +Elm_Gen_Item * +_elm_genlist_item_new(Widget_Data *wd, + const Elm_Gen_Item_Class *itc, + const void *data, + Elm_Gen_Item *parent, + Evas_Smart_Cb func, + const void *func_data) +{ + Elm_Gen_Item *it; + + it = elm_widget_item_new(wd->obj, Elm_Gen_Item); + if (!it) return NULL; + it->wd = wd; + it->generation = wd->generation; + it->itc = itc; + elm_genlist_item_class_ref((Elm_Genlist_Item_Class *)itc); + it->base.data = data; + it->parent = parent; + it->func.func = func; + it->func.data = func_data; + elm_widget_item_content_get_hook_set(it, _item_content_get_hook); + elm_widget_item_text_get_hook_set(it, _item_text_get_hook); + elm_widget_item_disable_hook_set(it, _item_disable_hook); + elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook); + elm_widget_item_signal_emit_hook_set(it, _item_signal_emit_hook); + + /* TEMPORARY */ + it->sel_cb = (Ecore_Cb)_item_select; + + return it; +} + +static Elm_Gen_Item * +_item_new(Widget_Data *wd, + const Elm_Genlist_Item_Class *itc, + const void *data, + Elm_Gen_Item *parent, + Elm_Genlist_Item_Type type, + Evas_Smart_Cb func, + const void *func_data) +{ + Elm_Gen_Item *it, *it2; + int depth = 0; + + it = _elm_genlist_item_new(wd, itc, data, parent, func, func_data); + if (!it) return NULL; + it->item = ELM_NEW(Elm_Gen_Item_Type); + it->item->type = type; + if (type & ELM_GENLIST_ITEM_GROUP) it->group++; + it->item->expanded_depth = 0; + ELM_GEN_ITEM_SETUP(it); + if (it->parent) + { + if (it->parent->group) + it->item->group_item = parent; + else if (it->parent->item->group_item) + it->item->group_item = it->parent->item->group_item; + } + for (it2 = it, depth = 0; it2->parent; it2 = it2->parent) + { + if (!it2->parent->group) depth += 1; + } + it->item->expanded_depth = depth; + wd->item_count++; + return it; +} + +static Item_Block * +_item_block_new(Widget_Data *wd, Eina_Bool prepend) +{ + Item_Block *itb; + + itb = calloc(1, sizeof(Item_Block)); + if (!itb) return NULL; + itb->wd = wd; + if (prepend) + { + wd->blocks = eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb)); + _item_block_position_update(wd->blocks, 0); + } + else + { + wd->blocks = eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb)); + itb->position_update = EINA_TRUE; + if (wd->blocks != EINA_INLIST_GET(itb)) + { + itb->position = ((Item_Block *) (EINA_INLIST_GET(itb)->prev))->position + 1; + } + else + { + itb->position = 0; + } + } + return itb; +} + +static Eina_Bool +_item_block_add(Widget_Data *wd, + Elm_Gen_Item *it) +{ + Item_Block *itb = NULL; + + if (!it->item->rel) + { +newblock: + if (it->item->rel) + { + itb = calloc(1, sizeof(Item_Block)); + if (!itb) return EINA_FALSE; + itb->wd = wd; + if (!it->item->rel->item->block) + { + wd->blocks = + eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb)); + itb->items = eina_list_append(itb->items, it); + itb->position_update = EINA_TRUE; + it->position = eina_list_count(itb->items); + it->position_update = EINA_TRUE; + + if (wd->blocks != EINA_INLIST_GET(itb)) + { + itb->position = ((Item_Block *) (EINA_INLIST_GET(itb)->prev))->position + 1; + } + else + { + itb->position = 0; + } + } + else + { + Eina_List *tmp; + + tmp = eina_list_data_find_list(itb->items, it->item->rel); + if (it->item->before) + { + wd->blocks = eina_inlist_prepend_relative + (wd->blocks, EINA_INLIST_GET(itb), + EINA_INLIST_GET(it->item->rel->item->block)); + itb->items = + eina_list_prepend_relative_list(itb->items, it, tmp); + + /* Update index from where we prepended */ + _item_position_update(eina_list_prev(tmp), it->item->rel->position); + _item_block_position_update(EINA_INLIST_GET(itb), + it->item->rel->item->block->position); + } + else + { + wd->blocks = eina_inlist_append_relative + (wd->blocks, EINA_INLIST_GET(itb), + EINA_INLIST_GET(it->item->rel->item->block)); + itb->items = + eina_list_append_relative_list(itb->items, it, tmp); + + /* Update block index from where we appended */ + _item_position_update(eina_list_next(tmp), it->item->rel->position + 1); + _item_block_position_update(EINA_INLIST_GET(itb), + it->item->rel->item->block->position + 1); + } + } + } + else + { + if (it->item->before) + { + if (wd->blocks) + { + itb = (Item_Block *)(wd->blocks); + if (itb->count >= wd->max_items_per_block) + { + itb = _item_block_new(wd, EINA_TRUE); + if (!itb) return EINA_FALSE; + } + } + else + { + itb = _item_block_new(wd, EINA_TRUE); + if (!itb) return EINA_FALSE; + } + itb->items = eina_list_prepend(itb->items, it); + + _item_position_update(itb->items, 0); + } + else + { + if (wd->blocks) + { + itb = (Item_Block *)(wd->blocks->last); + if (itb->count >= wd->max_items_per_block) + { + itb = _item_block_new(wd, EINA_FALSE); + if (!itb) return EINA_FALSE; + } + } + else + { + itb = _item_block_new(wd, EINA_FALSE); + if (!itb) return EINA_FALSE; + } + itb->items = eina_list_append(itb->items, it); + it->position = eina_list_count(itb->items); + } + } + } + else + { + Eina_List *tmp; + + if (it->item->rel->item->queued) + { + /* NOTE: for a strange reason eina_list and eina_inlist don't have the same property + on sorted insertion order, so the queue is not always ordered like the item list. + This lead to issue where we depend on an item that is not yet created. As a quick + work around, we reschedule the calc of the item and stop reordering the list to + prevent any nasty issue to show up here. + */ + wd->queue = eina_list_append(wd->queue, it); + wd->requeued = EINA_TRUE; + it->item->queued = EINA_TRUE; + return EINA_FALSE; + } + itb = it->item->rel->item->block; + if (!itb) goto newblock; + tmp = eina_list_data_find_list(itb->items, it->item->rel); + if (it->item->before) + { + itb->items = eina_list_prepend_relative_list(itb->items, it, tmp); + _item_position_update(eina_list_prev(tmp), it->item->rel->position); + } + else + { + itb->items = eina_list_append_relative_list(itb->items, it, tmp); + _item_position_update(eina_list_next(tmp), it->item->rel->position + 1); + } + } + itb->count++; + itb->changed = EINA_TRUE; + it->item->block = itb; + if (itb->wd->calc_job) ecore_job_del(itb->wd->calc_job); + itb->wd->calc_job = ecore_job_add(_calc_job, itb->wd); + if (it->item->rel) + { + it->item->rel->relcount--; + if ((it->item->rel->generation < it->wd->generation) && (!it->item->rel->relcount)) + { + _item_del(it->item->rel); + elm_widget_item_free(it->item->rel); + } + it->item->rel = NULL; + } + if (itb->count > itb->wd->max_items_per_block) + { + Item_Block *itb2; + Elm_Gen_Item *it2; + int newc; + Eina_Bool done = EINA_FALSE; + + newc = itb->count / 2; + + if (EINA_INLIST_GET(itb)->prev) + { + Item_Block *itbp = (Item_Block *)(EINA_INLIST_GET(itb)->prev); + + if (itbp->count + newc < wd->max_items_per_block / 2) + { + /* moving items to previous block */ + while ((itb->count > newc) && (itb->items)) + { + it2 = eina_list_data_get(itb->items); + itb->items = eina_list_remove_list(itb->items, itb->items); + itb->count--; + + itbp->items = eina_list_append(itbp->items, it2); + it2->item->block = itbp; + itbp->count++; + } + + done = EINA_TRUE; + } + } + + if (!done && EINA_INLIST_GET(itb)->next) + { + Item_Block *itbn = (Item_Block *)(EINA_INLIST_GET(itb)->next); + + if (itbn->count + newc < wd->max_items_per_block / 2) + { + /* moving items to next block */ + while ((itb->count > newc) && (itb->items)) + { + Eina_List *l; + + l = eina_list_last(itb->items); + it2 = eina_list_data_get(l); + itb->items = eina_list_remove_list(itb->items, l); + itb->count--; + + itbn->items = eina_list_prepend(itbn->items, it2); + it2->item->block = itbn; + itbn->count++; + } + + done = EINA_TRUE; + } + } + + if (!done) + { + /* moving items to new block */ + itb2 = calloc(1, sizeof(Item_Block)); + if (!itb2) return EINA_FALSE; + itb2->wd = wd; + wd->blocks = + eina_inlist_append_relative(wd->blocks, EINA_INLIST_GET(itb2), + EINA_INLIST_GET(itb)); + itb2->changed = EINA_TRUE; + while ((itb->count > newc) && (itb->items)) + { + Eina_List *l; + + l = eina_list_last(itb->items); + it2 = l->data; + itb->items = eina_list_remove_list(itb->items, l); + itb->count--; + + itb2->items = eina_list_prepend(itb2->items, it2); + it2->item->block = itb2; + itb2->count++; + } + } + } + + return EINA_TRUE; +} + +static int +_queue_process(Widget_Data *wd) +{ + int n; + Eina_Bool showme = EINA_FALSE; + double t0, t; + + t0 = ecore_loop_time_get(); + //evas_event_freeze(evas_object_evas_get(wd->obj)); + for (n = 0; (wd->queue) && (n < 128); n++) + { + Elm_Gen_Item *it; + + it = eina_list_data_get(wd->queue); + wd->queue = eina_list_remove_list(wd->queue, wd->queue); + it->item->queued = EINA_FALSE; + if (!_item_block_add(wd, it)) continue; + if (!wd->blocks) + _item_block_realize(it->item->block); + t = ecore_time_get(); + if (it->item->block->changed) + { + showme = _item_block_recalc(it->item->block, it->item->block->num, EINA_TRUE); + it->item->block->changed = 0; + if (wd->pan_changed) + { + if (wd->calc_job) ecore_job_del(wd->calc_job); + wd->calc_job = NULL; + _calc_job(wd); + wd->pan_changed = EINA_FALSE; + } + } + if (showme) it->item->block->showme = EINA_TRUE; + /* same as eina_inlist_count > 1 */ + if (wd->blocks && wd->blocks->next) + { + if ((t - t0) > (ecore_animator_frametime_get())) break; + } + } + //evas_event_thaw(evas_object_evas_get(wd->obj)); + //evas_event_thaw_eval(evas_object_evas_get(wd->obj)); + return n; +} + +static Eina_Bool +_idle_process(void *data, Eina_Bool *wakeup) +{ + Widget_Data *wd = data; + + //xxx + //static double q_start = 0.0; + //if (q_start == 0.0) q_start = ecore_time_get(); + //xxx + if (_queue_process(wd) > 0) *wakeup = EINA_TRUE; + if (!wd->queue) + { + //xxx + //printf("PROCESS TIME: %3.3f\n", ecore_time_get() - q_start); + //xxx + return ECORE_CALLBACK_CANCEL; + } + return ECORE_CALLBACK_RENEW; +} + +static Eina_Bool +_item_idle_enterer(void *data) +{ + Widget_Data *wd = data; + Eina_Bool wakeup = EINA_FALSE; + Eina_Bool ok = _idle_process(data, &wakeup); + + if (wakeup) + { + // wake up mainloop + if (wd->calc_job) ecore_job_del(wd->calc_job); + wd->calc_job = ecore_job_add(_calc_job, wd); + } + if (ok == ECORE_CALLBACK_CANCEL) wd->queue_idle_enterer = NULL; + return ok; +} + +static void +_item_queue(Widget_Data *wd, + Elm_Gen_Item *it, + Eina_Compare_Cb cb) +{ + if (it->item->queued) return; + it->item->queued = EINA_TRUE; + if (cb && !wd->requeued) + wd->queue = eina_list_sorted_insert(wd->queue, cb, it); + else + wd->queue = eina_list_append(wd->queue, it); +// FIXME: why does a freeze then thaw here cause some genlist +// elm_genlist_item_append() to be much much slower? +// evas_event_freeze(evas_object_evas_get(wd->obj)); + while ((wd->queue) && ((!wd->blocks) || (!wd->blocks->next))) + { + if (wd->queue_idle_enterer) + { + ecore_idle_enterer_del(wd->queue_idle_enterer); + wd->queue_idle_enterer = NULL; + } + _queue_process(wd); + } +// evas_event_thaw(evas_object_evas_get(wd->obj)); +// evas_event_thaw_eval(evas_object_evas_get(wd->obj)); + if (!wd->queue_idle_enterer) + wd->queue_idle_enterer = ecore_idle_enterer_add(_item_idle_enterer, wd); +} + +static int +_elm_genlist_item_compare(const void *data, const void *data1) +{ + const Elm_Gen_Item *it, *item1; + it = ELM_GEN_ITEM_FROM_INLIST(data); + item1 = ELM_GEN_ITEM_FROM_INLIST(data1); + return it->wd->item_compare_cb(it, item1); +} + +static int +_elm_genlist_item_list_compare(const void *data, const void *data1) +{ + const Elm_Gen_Item *it = data; + const Elm_Gen_Item *item1 = data1; + return it->wd->item_compare_cb(it, item1); +} + +/*If application want to know the relative item, use elm_genlist_item_prev_get(it)*/ +static void +_item_move_after(Elm_Gen_Item *it, Elm_Gen_Item *after) +{ + if (!it) return; + if (!after) return; + + it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it)); + _item_block_del(it); + + it->wd->items = eina_inlist_append_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after)); + it->item->rel = after; + it->item->rel->relcount++; + it->item->before = EINA_FALSE; + if (after->item->group_item) it->item->group_item = after->item->group_item; + _item_queue(it->wd, it, NULL); + + evas_object_smart_callback_call(WIDGET(it), SIG_MOVED_AFTER, it); +} + +/*If application want to know the relative item, use elm_genlist_item_next_get(it)*/ +static void +_item_move_before(Elm_Gen_Item *it, Elm_Gen_Item *before) +{ + if (!it) return; + if (!before) return; + + it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it)); + _item_block_del(it); + it->wd->items = eina_inlist_prepend_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(before)); + it->item->rel = before; + it->item->rel->relcount++; + it->item->before = EINA_TRUE; + if (before->item->group_item) it->item->group_item = before->item->group_item; + _item_queue(it->wd, it, NULL); + + evas_object_smart_callback_call(WIDGET(it), SIG_MOVED_BEFORE, it); +} + +EAPI unsigned int +elm_genlist_items_count(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; + return wd->item_count; +} + +EAPI Elm_Object_Item * +elm_genlist_item_append(Evas_Object *obj, + const Elm_Genlist_Item_Class *itc, + const void *data, + Elm_Object_Item *parent, + Elm_Genlist_Item_Type type, + Evas_Smart_Cb func, + const void *func_data) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + Elm_Gen_Item *it = _item_new(wd, itc, data, (Elm_Gen_Item *) parent, type, + func, func_data); + if (!it) return NULL; + if (!it->parent) + { + if (it->group) + wd->group_items = eina_list_append(wd->group_items, it); + wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it)); + it->item->rel = NULL; + } + else + { + Elm_Gen_Item *it2 = NULL; + Eina_List *ll = eina_list_last(it->parent->item->items); + if (ll) it2 = ll->data; + it->parent->item->items = eina_list_append(it->parent->item->items, it); + if (!it2) it2 = it->parent; + wd->items = + eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it), + EINA_INLIST_GET(it2)); + it->item->rel = it2; + it->item->rel->relcount++; + } + it->item->before = EINA_FALSE; + _item_queue(wd, it, NULL); + return (Elm_Object_Item *)it; +} + +EAPI Elm_Object_Item * +elm_genlist_item_prepend(Evas_Object *obj, + const Elm_Genlist_Item_Class *itc, + const void *data, + Elm_Object_Item *parent, + Elm_Genlist_Item_Type type, + Evas_Smart_Cb func, + const void *func_data) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + Elm_Gen_Item *it = _item_new(wd, itc, data, (Elm_Gen_Item *) parent, type, + func, func_data); + if (!it) return NULL; + if (!it->parent) + { + if (it->group) + wd->group_items = eina_list_prepend(wd->group_items, it); + wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it)); + it->item->rel = NULL; + } + else + { + Elm_Gen_Item *it2 = NULL; + Eina_List *ll = it->parent->item->items; + if (ll) it2 = ll->data; + it->parent->item->items = eina_list_prepend(it->parent->item->items, it); + if (!it2) it2 = it->parent; + wd->items = + eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it), + EINA_INLIST_GET(it2)); + it->item->rel = it2; + it->item->rel->relcount++; + } + it->item->before = EINA_TRUE; + _item_queue(wd, it, NULL); + return (Elm_Object_Item *)it; +} + +EAPI Elm_Object_Item * +elm_genlist_item_insert_after(Evas_Object *obj, + const Elm_Genlist_Item_Class *itc, + const void *data, + Elm_Object_Item *parent, + Elm_Object_Item *after, + Elm_Genlist_Item_Type type, + Evas_Smart_Cb func, + const void *func_data) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + ELM_OBJ_ITEM_CHECK_OR_RETURN(after, NULL); + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Gen_Item *_after = (Elm_Gen_Item *) after; + if (!wd) return NULL; + /* It makes no sense to insert after in an empty list with after != NULL, something really bad is happening in your app. */ + EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL); + + Elm_Gen_Item *it = _item_new(wd, itc, data, (Elm_Gen_Item *) parent, type, + func, func_data); + if (!it) return NULL; + if (!it->parent) + { + if ((it->group) && (_after->group)) + wd->group_items = eina_list_append_relative(wd->group_items, it, + _after); + } + else + { + it->parent->item->items = + eina_list_append_relative(it->parent->item->items, it, _after); + } + wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it), + EINA_INLIST_GET(_after)); + it->item->rel = _after; + it->item->rel->relcount++; + it->item->before = EINA_FALSE; + _item_queue(wd, it, NULL); + return (Elm_Object_Item *)it; +} + +EAPI Elm_Object_Item * +elm_genlist_item_insert_before(Evas_Object *obj, + const Elm_Genlist_Item_Class *itc, + const void *data, + Elm_Object_Item *parent, + Elm_Object_Item *before, + Elm_Genlist_Item_Type type, + Evas_Smart_Cb func, + const void *func_data) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + ELM_OBJ_ITEM_CHECK_OR_RETURN(before, NULL); + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Gen_Item *_before = (Elm_Gen_Item *) before; + if (!wd) return NULL; + /* It makes no sense to insert before in an empty list with before != NULL, something really bad is happening in your app. */ + EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL); + + Elm_Gen_Item *it = _item_new(wd, itc, data, (Elm_Gen_Item *) parent, type, + func, func_data); + if (!it) return NULL; + if (!it->parent) + { + if (it->group && _before->group) + wd->group_items = eina_list_prepend_relative(wd->group_items, it, + _before); + } + else + { + it->parent->item->items = + eina_list_prepend_relative(it->parent->item->items, it, _before); + } + wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it), + EINA_INLIST_GET(_before)); + it->item->rel = _before; + it->item->rel->relcount++; + it->item->before = EINA_TRUE; + _item_queue(wd, it, NULL); + return (Elm_Object_Item *)it; +} + +EAPI Elm_Object_Item * +elm_genlist_item_sorted_insert(Evas_Object *obj, + const Elm_Genlist_Item_Class *itc, + const void *data, + Elm_Object_Item *parent, + Elm_Genlist_Item_Type type, + Eina_Compare_Cb comp, + Evas_Smart_Cb func, + const void *func_data) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + Elm_Gen_Item *rel = NULL; + Elm_Gen_Item *it = _item_new(wd, itc, data, (Elm_Gen_Item *) parent, type, + func, func_data); + if (!it) return NULL; + + wd->item_compare_cb = comp; + + if (it->parent) + { + Eina_List *l; + int cmp_result; + + l = eina_list_search_sorted_near_list(it->parent->item->items, + _elm_genlist_item_list_compare, + it, + &cmp_result); + if (l) + rel = eina_list_data_get(l); + else + rel = it->parent; + + if (cmp_result >= 0) + { + it->parent->item->items = eina_list_prepend_relative_list(it->parent->item->items, it, l); + wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel)); + it->item->before = EINA_FALSE; + } + else if (cmp_result < 0) + { + it->parent->item->items = eina_list_append_relative_list(it->parent->item->items, it, l); + wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel)); + it->item->before = EINA_TRUE; + } + } + else + { + if (!wd->state) + { + wd->state = eina_inlist_sorted_state_new(); + eina_inlist_sorted_state_init(wd->state, wd->items); + wd->requeued = EINA_FALSE; + } + + if (it->group) + wd->group_items = eina_list_append(wd->group_items, it); + + wd->items = eina_inlist_sorted_state_insert(wd->items, EINA_INLIST_GET(it), + _elm_genlist_item_compare, wd->state); + + if (EINA_INLIST_GET(it)->next) + { + rel = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next); + it->item->before = EINA_TRUE; + } + else if (EINA_INLIST_GET(it)->prev) + { + rel = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev); + it->item->before = EINA_FALSE; + } + } + + if (rel) + { + it->item->rel = rel; + it->item->rel->relcount++; + } + + _item_queue(wd, it, _elm_genlist_item_list_compare); + + return (Elm_Object_Item *)it; +} + +static void +_elm_genlist_clear(Evas_Object *obj, Eina_Bool standby) +{ + Eina_Inlist *next, *l; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (!standby) wd->generation++; + + if (wd->state) + { + eina_inlist_sorted_state_free(wd->state); + wd->state = NULL; + } + + if (wd->walking > 0) + { + wd->clear_me = EINA_TRUE; + return; + } + evas_event_freeze(evas_object_evas_get(wd->obj)); + for (l = wd->items, next = l ? l->next : NULL; + l; + l = next, next = next ? next->next : NULL) + { + Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(l); + + if (it->generation < wd->generation) + { + Elm_Gen_Item *itn = NULL; + + if (next) itn = ELM_GEN_ITEM_FROM_INLIST(next); + if (itn) itn->walking++; /* prevent early death of subitem */ + it->del_cb(it); + elm_widget_item_free(it); + if (itn) itn->walking--; + } + } + wd->clear_me = EINA_FALSE; + wd->pan_changed = EINA_TRUE; + if (wd->calc_job) + { + ecore_job_del(wd->calc_job); + wd->calc_job = NULL; + } + if (wd->selected) wd->selected = eina_list_free(wd->selected); + if (wd->clear_cb) wd->clear_cb(wd); + wd->pan_x = 0; + wd->pan_y = 0; + wd->minw = 0; + wd->minh = 0; + + if (wd->alpha_bg) evas_object_del(wd->alpha_bg); + wd->alpha_bg = NULL; + + if (wd->pan_smart) + { + evas_object_size_hint_min_set(wd->pan_smart, wd->minw, wd->minh); + evas_object_smart_callback_call(wd->pan_smart, "changed", NULL); + } + if (wd->sizing_cb) wd->sizing_cb(wd->obj); + elm_smart_scroller_child_region_show(wd->scr, 0, 0, 0, 0); + evas_event_thaw(evas_object_evas_get(wd->obj)); + evas_event_thaw_eval(evas_object_evas_get(wd->obj)); +} + +EAPI void +elm_genlist_clear(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + _elm_genlist_clear(obj, EINA_FALSE); +} + +EAPI void +elm_genlist_multi_select_set(Evas_Object *obj, + Eina_Bool multi) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->multi = !!multi; +} + +EAPI Eina_Bool +elm_genlist_multi_select_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->multi; +} + +EAPI Elm_Object_Item * +elm_genlist_selected_item_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (wd->selected) return wd->selected->data; + return NULL; +} + +EAPI const Eina_List * +elm_genlist_selected_items_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->selected; +} + +EAPI Eina_List * +elm_genlist_realized_items_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + Eina_List *list = NULL; + Item_Block *itb; + Eina_Bool done = EINA_FALSE; + if (!wd) return NULL; + EINA_INLIST_FOREACH(wd->blocks, itb) + { + if (itb->realized) + { + Eina_List *l; + Elm_Gen_Item *it; + + done = EINA_TRUE; + EINA_LIST_FOREACH(itb->items, l, it) + { + if (it->realized) list = eina_list_append(list, it); + } + } + else + { + if (done) break; + } + } + return list; +} + +EAPI Elm_Object_Item * +elm_genlist_at_xy_item_get(const Evas_Object *obj, + Evas_Coord x, + Evas_Coord y, + int *posret) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord ox, oy, ow, oh; + Item_Block *itb; + Evas_Coord lasty; + if (!wd) return NULL; + evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh); + lasty = oy; + EINA_INLIST_FOREACH(wd->blocks, itb) + { + Eina_List *l; + Elm_Gen_Item *it; + + if (!ELM_RECTS_INTERSECT(ox + itb->x - itb->wd->pan_x, + oy + itb->y - itb->wd->pan_y, + itb->w, itb->h, x, y, 1, 1)) + continue; + EINA_LIST_FOREACH(itb->items, l, it) + { + Evas_Coord itx, ity; + + itx = ox + itb->x + it->x - itb->wd->pan_x; + ity = oy + itb->y + it->y - itb->wd->pan_y; + if (ELM_RECTS_INTERSECT(itx, ity, it->item->w, it->item->h, x, y, 1, 1)) + { + if (posret) + { + if (y <= (ity + (it->item->h / 4))) *posret = -1; + else if (y >= (ity + it->item->h - (it->item->h / 4))) + *posret = 1; + else *posret = 0; + } + return (Elm_Object_Item *)it; + } + lasty = ity + it->item->h; + } + } + if (posret) + { + if (y > lasty) *posret = 1; + else *posret = -1; + } + return NULL; +} + +EAPI Elm_Object_Item * +elm_genlist_first_item_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (!wd->items) return NULL; + Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(wd->items); + while ((it) && (it->generation < wd->generation)) + it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next); + return (Elm_Object_Item *)it; +} + +EAPI Elm_Object_Item * +elm_genlist_last_item_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (!wd->items) return NULL; + Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(wd->items->last); + while ((it) && (it->generation < wd->generation)) + it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev); + return (Elm_Object_Item *)it; +} + +EAPI Elm_Object_Item * +elm_genlist_item_next_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + while (_it) + { + _it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(_it)->next); + if ((_it) && (_it->generation == _it->wd->generation)) break; + } + return (Elm_Object_Item *) _it; +} + +EAPI Elm_Object_Item * +elm_genlist_item_prev_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + while (_it) + { + _it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(_it)->prev); + if ((_it) && (_it->generation == _it->wd->generation)) break; + } + return (Elm_Object_Item *) _it; +} + +EAPI Elm_Object_Item * +elm_genlist_item_parent_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + return (Elm_Object_Item *) ((Elm_Gen_Item *)it)->parent; +} + +EAPI void +elm_genlist_item_subitems_clear(Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Widget_Data *wd = elm_widget_data_get(WIDGET(it)); + if (!wd) return; + Elm_Gen_Item *_it = (Elm_Gen_Item *) it; + + if (!wd->tree_effect_enabled || !wd->move_effect_mode) + _item_subitems_clear(_it); + else + { + if (!wd->tree_effect_animator) + { + wd->expanded_item = _it; + _item_tree_effect_before(_it); + evas_object_raise(wd->alpha_bg); + evas_object_show(wd->alpha_bg); + wd->start_time = ecore_time_get(); + wd->tree_effect_animator = ecore_animator_add(_tree_effect_animator_cb, wd); + } + else + _item_subitems_clear(_it); + } +} + +EAPI void +elm_genlist_item_selected_set(Elm_Object_Item *it, + Eina_Bool selected) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + Widget_Data *wd = _it->wd; + if (!wd) return; + if ((_it->generation < wd->generation) || elm_widget_item_disabled_get(_it)) + return; + selected = !!selected; + if (_it->selected == selected) return; + + if (selected) + { + if (!wd->multi) + { + while (wd->selected) + { + if (_it->unhighlight_cb) _it->unhighlight_cb(wd->selected->data); + _it->unsel_cb(wd->selected->data); + } + } + _it->highlight_cb(_it); + _item_select(_it); + return; + } + if (_it->unhighlight_cb) _it->unhighlight_cb(_it); + _it->unsel_cb(_it); +} + +EAPI Eina_Bool +elm_genlist_item_selected_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE); + return ((Elm_Gen_Item *)it)->selected; +} + +Elm_Gen_Item * +_elm_genlist_expanded_next_item_get(Elm_Gen_Item *it) +{ + Elm_Gen_Item *it2; + if (it->item->expanded) + { + it2 = (Elm_Gen_Item *) elm_genlist_item_next_get((Elm_Object_Item *) it); + } + else + { + it2 = (Elm_Gen_Item *) elm_genlist_item_next_get((Elm_Object_Item *) it); + while (it2) + { + if (it->item->expanded_depth >= it2->item->expanded_depth) break; + it2 = (Elm_Gen_Item *) elm_genlist_item_next_get((Elm_Object_Item *) it2); + } + } + return it2; +} + +static void +_elm_genlist_move_items_set(Elm_Gen_Item *it) +{ + Eina_List *l, *ll; + Elm_Gen_Item *it2 = NULL; + Evas_Coord ox, oy, ow, oh, dh = 0; + + it->wd->expanded_next_item = _elm_genlist_expanded_next_item_get(it); + + if (it->item->expanded) + { + it->wd->move_items = elm_genlist_realized_items_get(it->wd->obj); + EINA_LIST_FOREACH_SAFE(it->wd->move_items, l, ll, it2) + { + if (it2 == it->wd->expanded_next_item) break; + it->wd->move_items = eina_list_remove(it->wd->move_items, it2); + } + } + else + { + evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh); + it2 = it->wd->expanded_next_item; + while (it2 && (dh < oy + oh)) + { + dh += it2->item->h; + it->wd->move_items = eina_list_append(it->wd->move_items, it2); + it2 = (Elm_Gen_Item *) elm_genlist_item_next_get((Elm_Object_Item *) it2); + } + } +} + +EAPI void +elm_genlist_item_expanded_set(Elm_Object_Item *it, + Eina_Bool expanded) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + expanded = !!expanded; + if (_it->item->expanded == expanded) return; + _it->item->expanded = expanded; + _it->wd->expanded_item = _it; + _elm_genlist_move_items_set(_it); + + if (_it->wd->tree_effect_enabled && !_it->wd->alpha_bg) + _it->wd->alpha_bg = _create_tray_alpha_bg(WIDGET(_it)); + + if (_it->item->expanded) + { + _it->wd->move_effect_mode = ELM_GENLIST_TREE_EFFECT_EXPAND; + if (_it->realized) + edje_object_signal_emit(VIEW(_it), "elm,state,expanded", "elm"); + evas_object_smart_callback_call(WIDGET(_it), SIG_EXPANDED, _it); + _it->wd->auto_scroll_enabled = EINA_TRUE; + } + else + { + _it->wd->move_effect_mode = ELM_GENLIST_TREE_EFFECT_CONTRACT; + if (_it->realized) + edje_object_signal_emit(VIEW(_it), "elm,state,contracted", "elm"); + evas_object_smart_callback_call(WIDGET(_it), SIG_CONTRACTED, _it); + _it->wd->auto_scroll_enabled = EINA_FALSE; + } +} + +EAPI Eina_Bool +elm_genlist_item_expanded_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE); + return ((Elm_Gen_Item *)it)->item->expanded; +} + +EAPI int +elm_genlist_item_expanded_depth_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, 0); + return ((Elm_Gen_Item *)it)->item->expanded_depth; +} + +static Eina_Bool +_elm_genlist_item_compute_coordinates(Elm_Object_Item *it, + Elm_Genlist_Item_Scrollto_Type type, + Eina_Bool bring_in, + Evas_Coord *x, + Evas_Coord *y, + Evas_Coord *w, + Evas_Coord *h) +{ + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + Evas_Coord gith = 0; + if (_it->generation < _it->wd->generation) return EINA_FALSE; + if ((_it->item->queued) || (!_it->item->mincalcd)) + { + _it->wd->show_item = _it; + _it->wd->bring_in = bring_in; + _it->wd->scrollto_type = type; + _it->item->showme = EINA_TRUE; + return EINA_FALSE; + } + if (_it->wd->show_item) + { + _it->wd->show_item->item->showme = EINA_FALSE; + _it->wd->show_item = NULL; + } + + evas_object_geometry_get(_it->wd->pan_smart, NULL, NULL, w, h); + switch (type) + { + case ELM_GENLIST_ITEM_SCROLLTO_IN: + if ((_it->item->group_item) && + (_it->wd->pan_y > (_it->y + _it->item->block->y))) + gith = _it->item->group_item->item->h; + *h = _it->item->h; + *y = _it->y + _it->item->block->y - gith; + break; + case ELM_GENLIST_ITEM_SCROLLTO_TOP: + if (_it->item->group_item) gith = _it->item->group_item->item->h; + *y = _it->y + _it->item->block->y - gith; + break; + case ELM_GENLIST_ITEM_SCROLLTO_MIDDLE: + *y = _it->y + _it->item->block->y - (*h / 2) + (_it->item->h / 2); + break; + default: + return EINA_FALSE; + } + + *x = _it->x + _it->item->block->x; + *w = _it->item->block->w; + return EINA_TRUE; +} + +EAPI void +elm_genlist_item_promote(Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + if (_it->generation < _it->wd->generation) return; + _item_move_before(_it, + (Elm_Gen_Item *) elm_genlist_first_item_get(WIDGET(_it))); +} + +EAPI void +elm_genlist_item_demote(Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + if (_it->generation < _it->wd->generation) return; + _item_move_after(_it, + (Elm_Gen_Item *) elm_genlist_last_item_get(WIDGET(_it))); +} + +EAPI void +elm_genlist_item_show(Elm_Object_Item *it, Elm_Genlist_Item_Scrollto_Type type) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Evas_Coord x, y, w, h; + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + + if (_elm_genlist_item_compute_coordinates(it, type, EINA_FALSE, &x, &y, &w, &h)) + elm_smart_scroller_child_region_show(_it->wd->scr, x, y, w, h); +} + +EAPI void +elm_genlist_item_bring_in(Elm_Object_Item *it, Elm_Genlist_Item_Scrollto_Type type) +{ + + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Evas_Coord x, y, w, h; + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + + if (_elm_genlist_item_compute_coordinates(it, type, EINA_TRUE, &x, &y, &w, &h)) + elm_smart_scroller_region_bring_in(_it->wd->scr, x, y, w, h); +} + +EAPI void +elm_genlist_item_all_contents_unset(Elm_Object_Item *it, Eina_List **l) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + + Evas_Object *content; + EINA_LIST_FREE(((Elm_Gen_Item *)it)->content_objs, content) + { + elm_widget_sub_object_del(WIDGET(it), content); + evas_object_smart_member_del(content); + evas_object_hide(content); + if (l) *l = eina_list_append(*l, content); + } +} + +EAPI void +elm_genlist_item_update(Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + + if (!_it->item->block) return; + if (_it->generation < _it->wd->generation) return; + _it->item->mincalcd = EINA_FALSE; + _it->item->updateme = EINA_TRUE; + _it->item->block->updateme = EINA_TRUE; + if (_it->wd->update_job) ecore_job_del(_it->wd->update_job); + _it->wd->update_job = ecore_job_add(_update_job, _it->wd); +} + +EAPI void +elm_genlist_item_fields_update(Elm_Object_Item *it, + const char *parts, + Elm_Genlist_Item_Field_Type itf) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + + if (!_it->item->block) return; + if (_it->generation < _it->wd->generation) return; + + if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_TEXT)) + _item_text_realize(_it, VIEW(_it), &_it->texts, parts); + if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_CONTENT)) + { + _it->content_objs = _item_content_unrealize(_it, VIEW(_it), + &_it->contents, parts); + _it->content_objs = _item_content_realize(_it, VIEW(_it), + &_it->contents, parts); + + if (_it->flipped) + { + _it->item->flip_content_objs = + _item_mode_content_unrealize(_it, VIEW(_it), + &_it->item->flip_contents, parts, + &_it->item->flip_content_objs); + _it->item->flip_content_objs = + _item_mode_content_realize(_it, VIEW(_it), + &_it->item->flip_contents, parts, + &_it->item->flip_content_objs); + } + if (_it->item->deco_it_view) + { + _it->item->deco_it_content_objs = + _item_mode_content_unrealize(_it, _it->item->deco_it_view, + &_it->item->deco_it_contents, parts, + &_it->item->deco_it_content_objs); + _it->item->deco_it_content_objs = + _item_mode_content_realize(_it, _it->item->deco_it_view, + &_it->item->deco_it_contents, parts, + &_it->item->deco_it_content_objs); + } + if (_it->wd->decorate_all_mode) + { + _it->item->deco_all_content_objs = + _item_mode_content_unrealize(_it, _it->deco_all_view, + &_it->item->deco_all_contents, parts, + &_it->item->deco_all_content_objs); + _it->item->deco_all_content_objs = + _item_mode_content_realize(_it, _it->deco_all_view, + &_it->item->deco_all_contents, parts, + &_it->item->deco_all_content_objs); + } + } + if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_STATE)) + _item_state_realize(_it, VIEW(_it), &_it->states, parts); +} + +EAPI void +elm_genlist_item_item_class_update(Elm_Object_Item *it, + const Elm_Genlist_Item_Class *itc) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + + if (!_it->item->block) return; + EINA_SAFETY_ON_NULL_RETURN(itc); + if (_it->generation < _it->wd->generation) return; + _it->itc = itc; + _it->item->nocache_once = EINA_TRUE; + + elm_widget_stringlist_free(_it->texts); + _it->texts = NULL; + elm_widget_stringlist_free(_it->contents); + _it->contents = NULL; + elm_widget_stringlist_free(_it->states); + _it->states = NULL; + + if (_it->flipped) + { + elm_widget_stringlist_free(_it->item->flip_contents); + _it->item->flip_contents = NULL; + } + if (_it->item->deco_it_view) + { + elm_widget_stringlist_free(_it->item->deco_it_texts); + _it->item->deco_it_texts = NULL; + elm_widget_stringlist_free(_it->item->deco_it_contents); + _it->item->deco_it_contents = NULL; + } + if (_it->wd->decorate_all_mode) + { + elm_widget_stringlist_free(_it->item->deco_all_texts); + _it->item->deco_all_texts = NULL; + elm_widget_stringlist_free(_it->item->deco_all_contents); + _it->item->deco_all_contents = NULL; + } + + elm_genlist_item_update(it); +} + +EAPI const Elm_Genlist_Item_Class * +elm_genlist_item_item_class_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + if (_it->generation < _it->wd->generation) return NULL; + return _it->itc; +} + +static Evas_Object * +_elm_genlist_item_label_create(void *data, + Evas_Object *obj __UNUSED__, + Evas_Object *tooltip, + void *it __UNUSED__) +{ + Evas_Object *label = elm_label_add(tooltip); + if (!label) + return NULL; + elm_object_style_set(label, "tooltip"); + elm_object_text_set(label, data); + return label; +} + +static void +_elm_genlist_item_label_del_cb(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + eina_stringshare_del(data); +} + +EAPI void +elm_genlist_item_tooltip_text_set(Elm_Object_Item *it, + const char *text) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + text = eina_stringshare_add(text); + elm_genlist_item_tooltip_content_cb_set(it, _elm_genlist_item_label_create, + text, + _elm_genlist_item_label_del_cb); +} + +EAPI void +elm_genlist_item_tooltip_content_cb_set(Elm_Object_Item *it, + Elm_Tooltip_Item_Content_Cb func, + const void *data, + Evas_Smart_Cb del_cb) +{ + ELM_OBJ_ITEM_CHECK_OR_GOTO(it, error); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + + if ((_it->tooltip.content_cb == func) && (_it->tooltip.data == data)) + return; + + if (_it->tooltip.del_cb) + _it->tooltip.del_cb((void *) _it->tooltip.data, WIDGET(it), it); + + _it->tooltip.content_cb = func; + _it->tooltip.data = data; + _it->tooltip.del_cb = del_cb; + + if (VIEW(_it)) + { + elm_widget_item_tooltip_content_cb_set(_it, + _it->tooltip.content_cb, + _it->tooltip.data, NULL); + elm_widget_item_tooltip_style_set(_it, _it->tooltip.style); + elm_widget_item_tooltip_window_mode_set(_it, _it->tooltip.free_size); + } + + return; + +error: + if (del_cb) del_cb((void *)data, NULL, NULL); +} + +EAPI void +elm_genlist_item_tooltip_unset(Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + + if ((VIEW(_it)) && (_it->tooltip.content_cb)) + elm_widget_item_tooltip_unset(_it); + + if (_it->tooltip.del_cb) + _it->tooltip.del_cb((void *) _it->tooltip.data, WIDGET(_it), _it); + _it->tooltip.del_cb = NULL; + _it->tooltip.content_cb = NULL; + _it->tooltip.data = NULL; + _it->tooltip.free_size = EINA_FALSE; + if (_it->tooltip.style) + elm_genlist_item_tooltip_style_set(it, NULL); +} + +EAPI void +elm_genlist_item_tooltip_style_set(Elm_Object_Item *it, + const char *style) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + + eina_stringshare_replace(&_it->tooltip.style, style); + if (VIEW(_it)) elm_widget_item_tooltip_style_set(_it, style); +} + +EAPI const char * +elm_genlist_item_tooltip_style_get(const Elm_Object_Item *it) +{ + return elm_object_item_tooltip_style_get(it); +} + +EAPI Eina_Bool +elm_genlist_item_tooltip_window_mode_set(Elm_Object_Item *it, + Eina_Bool disable) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + + _it->tooltip.free_size = disable; + if (VIEW(_it)) return elm_widget_item_tooltip_window_mode_set(_it, disable); + return EINA_TRUE; +} + +EAPI Eina_Bool +elm_genlist_item_tooltip_window_mode_get(const Elm_Object_Item *it) +{ + return elm_object_tooltip_window_mode_get(VIEW(it)); +} + +EAPI void +elm_genlist_item_cursor_set(Elm_Object_Item *it, + const char *cursor) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + eina_stringshare_replace(&_it->mouse_cursor, cursor); + if (VIEW(_it)) elm_widget_item_cursor_set(_it, cursor); +} + +EAPI const char * +elm_genlist_item_cursor_get(const Elm_Object_Item *it) +{ + return elm_widget_item_cursor_get(it); +} + +EAPI void +elm_genlist_item_cursor_unset(Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + + if (!_it->mouse_cursor) return; + + if (VIEW(_it)) elm_widget_item_cursor_unset(_it); + + eina_stringshare_del(_it->mouse_cursor); + _it->mouse_cursor = NULL; +} + +EAPI void +elm_genlist_item_cursor_style_set(Elm_Object_Item *it, + const char *style) +{ + elm_widget_item_cursor_style_set(it, style); +} + +EAPI const char * +elm_genlist_item_cursor_style_get(const Elm_Object_Item *it) +{ + return elm_widget_item_cursor_style_get(it); +} + +EAPI void +elm_genlist_item_cursor_engine_only_set(Elm_Object_Item *it, + Eina_Bool engine_only) +{ + elm_widget_item_cursor_engine_only_set(it, engine_only); +} + +EAPI Eina_Bool +elm_genlist_item_cursor_engine_only_get(const Elm_Object_Item *it) +{ + return elm_widget_item_cursor_engine_only_get(it); +} + +EAPI int +elm_genlist_item_index_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, -1); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + + if (_it->item->block) + return _it->position + (_it->item->block->position * _it->wd->max_items_per_block); + return -1; +} + +EAPI void +elm_genlist_mode_set(Evas_Object *obj, + Elm_List_Mode mode) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->mode == mode) return; + wd->mode = mode; + if (wd->mode == ELM_LIST_COMPRESS) + elm_genlist_homogeneous_set(obj, EINA_FALSE); + _sizing_eval(obj); +} + + +EAPI Elm_List_Mode +elm_genlist_mode_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_LAST; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return ELM_LIST_LAST; + return wd->mode; +} + +EAPI void +elm_genlist_bounce_set(Evas_Object *obj, + Eina_Bool h_bounce, + Eina_Bool v_bounce) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->h_bounce = !!h_bounce; + wd->v_bounce = !!v_bounce; + elm_smart_scroller_bounce_allow_set(wd->scr, wd->h_bounce, wd->v_bounce); +} + +EAPI void +elm_genlist_bounce_get(const Evas_Object *obj, + Eina_Bool *h_bounce, + Eina_Bool *v_bounce) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (h_bounce) *h_bounce = wd->h_bounce; + if (v_bounce) *v_bounce = wd->v_bounce; +} + +EAPI void +elm_genlist_homogeneous_set(Evas_Object *obj, + Eina_Bool homogeneous) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->homogeneous = !!homogeneous; +} + +EAPI Eina_Bool +elm_genlist_homogeneous_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->homogeneous; +} + +EAPI void +elm_genlist_block_count_set(Evas_Object *obj, + int count) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->max_items_per_block = count; + wd->item_cache_max = wd->max_items_per_block * 2; + _item_cache_clean(wd); +} + +EAPI int +elm_genlist_block_count_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; + return wd->max_items_per_block; +} + +EAPI void +elm_genlist_longpress_timeout_set(Evas_Object *obj, + double timeout) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->longpress_timeout = timeout; +} + +EAPI double +elm_genlist_longpress_timeout_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; + return wd->longpress_timeout; +} + +EAPI void +elm_genlist_scroller_policy_set(Evas_Object *obj, + Elm_Scroller_Policy policy_h, + Elm_Scroller_Policy policy_v) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (!wd->scr)) return; + if ((policy_h >= ELM_SCROLLER_POLICY_LAST) || + (policy_v >= ELM_SCROLLER_POLICY_LAST)) + return; + elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v); +} + +EAPI void +elm_genlist_scroller_policy_get(const Evas_Object *obj, + Elm_Scroller_Policy *policy_h, + Elm_Scroller_Policy *policy_v) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Smart_Scroller_Policy s_policy_h, s_policy_v; + if ((!wd) || (!wd->scr)) return; + elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v); + if (policy_h) *policy_h = (Elm_Scroller_Policy)s_policy_h; + if (policy_v) *policy_v = (Elm_Scroller_Policy)s_policy_v; +} + +EAPI void +elm_genlist_realized_items_update(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + + Eina_List *list, *l; + Elm_Object_Item *it; + + list = elm_genlist_realized_items_get(obj); + EINA_LIST_FOREACH(list, l, it) + elm_genlist_item_update(it); +} + +EAPI void +elm_genlist_item_decorate_mode_set(Elm_Object_Item *it, + const char *decorate_it_type, + Eina_Bool decorate_it_set) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + + Widget_Data *wd = _it->wd; + Eina_List *l; + Elm_Object_Item *it2; + + if (!wd) return; + if (!decorate_it_type) return; + if ((_it->generation < _it->wd->generation) || + elm_widget_item_disabled_get(_it)) return; + if (wd->decorate_all_mode) return; + + if ((wd->mode_item == _it) && + (!strcmp(decorate_it_type, wd->decorate_it_type)) && + (decorate_it_set)) + return; + if (!_it->itc->decorate_item_style) return; + _it->decorate_it_set = decorate_it_set; + + if (wd->multi) + { + EINA_LIST_FOREACH(wd->selected, l, it2) + if (((Elm_Gen_Item *)it2)->realized) + elm_genlist_item_selected_set(it2, EINA_FALSE); + } + else + { + it2 = elm_genlist_selected_item_get(wd->obj); + if ((it2) && (((Elm_Gen_Item *)it2)->realized)) + elm_genlist_item_selected_set(it2, EINA_FALSE); + } + + if (((wd->decorate_it_type) && (strcmp(decorate_it_type, wd->decorate_it_type))) || + (decorate_it_set) || ((_it == wd->mode_item) && (!decorate_it_set))) + _decorate_item_unset(wd); + + eina_stringshare_replace(&wd->decorate_it_type, decorate_it_type); + if (decorate_it_set) _decorate_item_set(_it); +} + +EAPI const char * +elm_genlist_item_decorate_mode_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + return _it->wd->decorate_it_type; +} + +EAPI const Elm_Object_Item * +elm_genlist_decorated_item_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return (Elm_Object_Item *) wd->mode_item; +} + +EAPI Eina_Bool +elm_genlist_decorate_mode_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + return wd->decorate_all_mode; +} + +EAPI void +elm_genlist_decorate_mode_set(Evas_Object *obj, Eina_Bool decorated) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Eina_List *list, *l; + Elm_Gen_Item *it; + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + decorated = !!decorated; + if (wd->decorate_all_mode == decorated) return; + wd->decorate_all_mode = decorated; + + list = elm_genlist_realized_items_get(obj); + if (!wd->decorate_all_mode) + { + EINA_LIST_FOREACH(list, l, it) + { + if (it->item->type != ELM_GENLIST_ITEM_GROUP) + _decorate_all_item_unrealize(it); + } + _item_cache_zero(wd); + } + else + { + EINA_LIST_FOREACH(list, l, it) + { + if (it->item->type != ELM_GENLIST_ITEM_GROUP) + { + if (it->itc->decorate_all_item_style) + _decorate_all_item_realize(it, EINA_TRUE); + } + } + } + if (wd->calc_job) ecore_job_del(wd->calc_job); + wd->calc_job = ecore_job_add(_calc_job, wd); +} + +EAPI void +elm_genlist_reorder_mode_set(Evas_Object *obj, + Eina_Bool reorder_mode) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->reorder_mode = !!reorder_mode; +} + +EAPI Eina_Bool +elm_genlist_reorder_mode_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->reorder_mode; +} + +EAPI Elm_Genlist_Item_Type +elm_genlist_item_type_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, ELM_GENLIST_ITEM_MAX); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + return _it->item->type; +} + +EAPI Elm_Genlist_Item_Class * +elm_genlist_item_class_new(void) +{ + Elm_Genlist_Item_Class *itc; + + itc = calloc(1, sizeof(Elm_Genlist_Item_Class)); + if (!itc) + return NULL; + itc->version = CLASS_ALLOCATED; + itc->refcount = 1; + itc->delete_me = EINA_FALSE; + + return itc; +} + +EAPI void +elm_genlist_item_class_free(Elm_Genlist_Item_Class *itc) +{ + if (itc && (itc->version == CLASS_ALLOCATED)) + { + if (!itc->delete_me) itc->delete_me = EINA_TRUE; + if (itc->refcount > 0) elm_genlist_item_class_unref(itc); + else + { + itc->version = 0; + free(itc); + } + } +} + +EAPI void +elm_genlist_item_class_ref(Elm_Genlist_Item_Class *itc) +{ + if (itc && (itc->version == CLASS_ALLOCATED)) + { + itc->refcount++; + if (itc->refcount == 0) itc->refcount--; + } +} + +EAPI void +elm_genlist_item_class_unref(Elm_Genlist_Item_Class *itc) +{ + if (itc && (itc->version == CLASS_ALLOCATED)) + { + if (itc->refcount > 0) itc->refcount--; + if (itc->delete_me && (!itc->refcount)) + elm_genlist_item_class_free(itc); + } +} + +void _flip_job(void *data) +{ + Elm_Gen_Item *it = (Elm_Gen_Item *) data; + _item_unhighlight(it); + _item_unselect(it); + _elm_genlist_item_unrealize(it, EINA_FALSE); + it->flipped = EINA_TRUE; + it->item->nocache = EINA_TRUE; + if (it->wd->calc_job) ecore_job_del(it->wd->calc_job); + it->wd->calc_job = ecore_job_add(_calc_job, it->wd); +} + +EAPI void +elm_genlist_item_flip_set(Elm_Object_Item *it, + Eina_Bool flip) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + + flip = !!flip; + if (_it->flipped == flip) return; + + if (flip) + { + ecore_job_add(_flip_job, _it); + } + else + { + _it->flipped = flip; + _item_cache_zero(_it->wd); + elm_genlist_item_update(it); + _it->item->nocache = EINA_FALSE; + } +} + +EAPI Eina_Bool +elm_genlist_item_flip_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + return _it->flipped; +} + +EAPI void +elm_genlist_select_mode_set(Evas_Object *obj, Elm_Object_Select_Mode mode) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (mode >= ELM_OBJECT_SELECT_MODE_MAX) + return; + if (wd->select_mode != mode) + wd->select_mode = mode; +} + +EAPI Elm_Object_Select_Mode +elm_genlist_select_mode_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_OBJECT_SELECT_MODE_MAX; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return ELM_OBJECT_SELECT_MODE_MAX; + return wd->select_mode; +} + +EAPI void +elm_genlist_highlight_mode_set(Evas_Object *obj, + Eina_Bool highlight) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->highlight = !!highlight; +} + +EAPI Eina_Bool +elm_genlist_highlight_mode_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->highlight; +} + +EAPI void +elm_genlist_item_select_mode_set(Elm_Object_Item *it, + Elm_Object_Select_Mode mode) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + if (!_it) return; + if (_it->generation < _it->wd->generation) return; + if (mode >= ELM_OBJECT_SELECT_MODE_MAX) + return; + if (_it->select_mode != mode) + _it->select_mode = mode; + + if (_it->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) + { + _it->item->mincalcd = EINA_FALSE; + _it->item->updateme = EINA_TRUE; + if (_it->item->block) _it->item->block->updateme = EINA_TRUE; + if (_it->wd->update_job) ecore_job_del(_it->wd->update_job); + _it->wd->update_job = ecore_job_add(_update_job, _it->wd); + } +} + +EAPI Elm_Object_Select_Mode +elm_genlist_item_select_mode_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, ELM_OBJECT_SELECT_MODE_MAX); + Elm_Gen_Item *_it = (Elm_Gen_Item *)it; + if (!_it) return ELM_OBJECT_SELECT_MODE_MAX; + return _it->select_mode; +} + +/* for gengrid as of now */ +void +_elm_genlist_page_relative_set(Evas_Object *obj, + double h_pagerel, + double v_pagerel) +{ + Evas_Coord pagesize_h; + Evas_Coord pagesize_v; + + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + elm_smart_scroller_paging_get(wd->scr, NULL, NULL, &pagesize_h, &pagesize_v); + elm_smart_scroller_paging_set(wd->scr, h_pagerel, v_pagerel, pagesize_h, + pagesize_v); +} + +/* for gengrid as of now */ +void +_elm_genlist_page_relative_get(const Evas_Object *obj, + double *h_pagerel, + double *v_pagerel) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + elm_smart_scroller_paging_get(wd->scr, h_pagerel, v_pagerel, NULL, NULL); +} + +/* for gengrid as of now */ +void +_elm_genlist_page_size_set(Evas_Object *obj, + Evas_Coord h_pagesize, + Evas_Coord v_pagesize) +{ + double pagerel_h; + double pagerel_v; + + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_smart_scroller_paging_get(wd->scr, &pagerel_h, &pagerel_v, NULL, NULL); + elm_smart_scroller_paging_set(wd->scr, pagerel_h, pagerel_v, h_pagesize, + v_pagesize); +} + +/* for gengrid as of now */ +void +_elm_genlist_current_page_get(const Evas_Object *obj, + int *h_pagenumber, + int *v_pagenumber) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_smart_scroller_current_page_get(wd->scr, h_pagenumber, v_pagenumber); +} + +/* for gengrid as of now */ +void +_elm_genlist_last_page_get(const Evas_Object *obj, + int *h_pagenumber, + int *v_pagenumber) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_smart_scroller_last_page_get(wd->scr, h_pagenumber, v_pagenumber); +} + +/* for gengrid as of now */ +void +_elm_genlist_page_show(const Evas_Object *obj, + int h_pagenumber, + int v_pagenumber) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_smart_scroller_page_show(wd->scr, h_pagenumber, v_pagenumber); +} + +/* for gengrid as of now */ +void +_elm_genlist_page_bring_in(const Evas_Object *obj, + int h_pagenumber, + int v_pagenumber) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_smart_scroller_page_bring_in(wd->scr, h_pagenumber, v_pagenumber); +} + +void +_elm_genlist_item_unrealize(Elm_Gen_Item *it, + Eina_Bool calc) +{ + Evas_Object *content; + + if (!it->realized) return; + if (it->wd->reorder_it == it) return; + + evas_event_freeze(evas_object_evas_get(WIDGET(it))); + if (!calc) + evas_object_smart_callback_call(WIDGET(it), SIG_UNREALIZED, it); + if (it->long_timer) + { + ecore_timer_del(it->long_timer); + it->long_timer = NULL; + } + + elm_widget_stringlist_free(it->texts); + it->texts = NULL; + elm_widget_stringlist_free(it->contents); + it->contents = NULL; + elm_widget_stringlist_free(it->states); + it->states = NULL; + EINA_LIST_FREE(it->content_objs, content) + evas_object_del(content); + + it->unrealize_cb(it); + + it->realized = EINA_FALSE; + it->want_unrealize = EINA_FALSE; + evas_event_thaw(evas_object_evas_get(WIDGET(it))); + evas_event_thaw_eval(evas_object_evas_get(WIDGET(it))); +} + +void +_elm_genlist_item_del_notserious(Elm_Gen_Item *it) +{ + elm_widget_item_pre_notify_del(it); + it->generation = it->wd->generation - 1; /* This means that the item is deleted */ + + if ((it->relcount > 0) || (it->walking > 0)) return; + + if (it->selected) it->wd->selected = eina_list_remove(it->wd->selected, it); + + if (it->itc->func.del) + it->itc->func.del((void *)it->base.data, WIDGET(it)); +} + +void +_elm_genlist_item_del_serious(Elm_Gen_Item *it) +{ + _elm_genlist_item_del_notserious(it); + it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it)); + if (it->tooltip.del_cb) + it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it); + it->wd->walking -= it->walking; + if (it->long_timer) + { + ecore_timer_del(it->long_timer); + it->long_timer = NULL; + } + if (it->group) + it->wd->group_items = eina_list_remove(it->wd->group_items, it); + + if (it->wd->state) + { + eina_inlist_sorted_state_free(it->wd->state); + it->wd->state = NULL; + } + if (it->wd->calc_job) ecore_job_del(it->wd->calc_job); + it->wd->calc_job = ecore_job_add(it->wd->calc_cb, it->wd); + free(it->item); + + it->item = NULL; + if (it->wd->last_selected_item == (Elm_Object_Item *)it) + it->wd->last_selected_item = NULL; + it->wd->item_count--; +} + +EAPI void +elm_genlist_tree_effect_enabled_set(Evas_Object *obj, Eina_Bool enabled) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->tree_effect_enabled = !!enabled; +} + +EAPI Eina_Bool +elm_genlist_tree_effect_enabled_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->tree_effect_enabled; +} + +static Evas_Object* +_create_tray_alpha_bg(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + Evas_Object *bg = NULL; + Evas_Coord ox, oy, ow, oh; + + evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh); + bg = evas_object_rectangle_add(evas_object_evas_get(wd->obj)); + evas_object_color_set(bg,0,0,0,0); + evas_object_resize(bg , ow, oh); + evas_object_move(bg , ox, oy); + return bg ; +} + +static void +_item_contract_emit(Elm_Gen_Item *it) +{ + Elm_Gen_Item *it2; + Eina_List *l; + + edje_object_signal_emit(VIEW(it), "elm,state,contract_flip", ""); + it->item->tree_effect_finished = EINA_FALSE; + + EINA_LIST_FOREACH(it->item->items, l, it2) + if (it2) _item_contract_emit(it2); +} + +static int +_item_tree_effect_before(Elm_Gen_Item *it) +{ + Elm_Gen_Item *it2; + Eina_List *l; + + EINA_LIST_FOREACH(it->item->items, l, it2) + { + if (it2->parent && (it == it2->parent)) + { + if (!it2->realized) + it2->item->tree_effect_hideme = EINA_TRUE; + if (it->wd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_EXPAND) + edje_object_signal_emit(VIEW(it2), "elm,state,hide", ""); + else if (it->wd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_CONTRACT) + _item_contract_emit(it2); + } + } + return ECORE_CALLBACK_CANCEL; +} + +static void +_item_tree_effect(Widget_Data *wd, int y) +{ + Elm_Gen_Item *it = NULL, *expanded_next_it; + + expanded_next_it = wd->expanded_next_item; + + if (wd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_EXPAND) + { + it = (Elm_Gen_Item *) elm_genlist_item_prev_get((Elm_Object_Item *) expanded_next_it); + while (it) + { + if (it->item->expanded_depth <= expanded_next_it->item->expanded_depth) break; + if (it->item->scrl_y && (it->item->scrl_y <= expanded_next_it->item->old_scrl_y + y) && + (it->item->expanded_depth > expanded_next_it->item->expanded_depth)) + { + if (!it->item->tree_effect_finished) + { + edje_object_signal_emit(VIEW(it), "flip_item", ""); + _item_position(it, VIEW(it), it->item->scrl_x, it->item->scrl_y); + it->item->tree_effect_finished = EINA_TRUE; + } + } + it = (Elm_Gen_Item *) elm_genlist_item_prev_get((Elm_Object_Item *) it); + } + } + else if (wd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_CONTRACT) + { + it = (Elm_Gen_Item *) elm_genlist_item_prev_get((Elm_Object_Item *) expanded_next_it); + while (it) + { + if ((it->item->scrl_y > expanded_next_it->item->old_scrl_y + y) && + (it->item->expanded_depth > expanded_next_it->item->expanded_depth)) + { + if (!it->item->tree_effect_finished) + { + edje_object_signal_emit(VIEW(it), "elm,state,hide", ""); + it->item->tree_effect_finished = EINA_TRUE; + } + } + else + break; + it = (Elm_Gen_Item *) elm_genlist_item_prev_get((Elm_Object_Item *) it); + } + } +} + +static void +_item_tree_effect_finish(Widget_Data *wd) +{ + Elm_Gen_Item *it = NULL; + const Eina_List *l; + + if (wd->tree_effect_animator) + { + if (wd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_CONTRACT) + _item_subitems_clear(wd->expanded_item); + EINA_LIST_FOREACH(wd->expanded_item->item->items, l, it) + { + it->item->tree_effect_finished = EINA_TRUE; + it->item->old_scrl_y = it->item->scrl_y; + if (it->wd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_EXPAND) + edje_object_signal_emit(VIEW(it), "elm,state,show", ""); + } + } + _item_auto_scroll(wd); + evas_object_lower(wd->alpha_bg); + evas_object_hide(wd->alpha_bg); + wd->move_effect_mode = ELM_GENLIST_TREE_EFFECT_NONE; + if (wd->move_items) wd->move_items = eina_list_free(wd->move_items); + + evas_object_smart_callback_call(wd->pan_smart, "changed", NULL); + evas_object_smart_callback_call(wd->obj, SIG_TREE_EFFECT_FINISHED, NULL); + evas_object_smart_changed(wd->pan_smart); + + wd->tree_effect_animator = NULL; +} + +static Eina_Bool +_tree_effect_animator_cb(void *data) +{ + Widget_Data *wd = data; + if (!wd) return ECORE_CALLBACK_CANCEL; + Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh; + Elm_Gen_Item *it = NULL, *it2, *expanded_next_it; + const Eina_List *l; + double effect_duration = 0.3, t; + int y = 0, dy = 0, dh = 0; + Eina_Bool end = EINA_FALSE, vis = EINA_TRUE; + int in = 0; + + t = ((0.0 > (t = ecore_time_get() - wd->start_time)) ? 0.0 : t); + evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh); + evas_output_viewport_get(evas_object_evas_get(wd->pan_smart), &cvx, &cvy, &cvw, &cvh); + if (t > effect_duration) end = EINA_TRUE; + + // Below while statement is needed, when the genlist is resized. + it2 = wd->expanded_item; + while (it2 && vis) + { + evas_object_move(VIEW(it2), it2->item->scrl_x, it2->item->scrl_y); + vis = (ELM_RECTS_INTERSECT(it2->item->scrl_x, it2->item->scrl_y, it2->item->w, it2->item->h, + cvx, cvy, cvw, cvh)); + it2 = (Elm_Gen_Item *) elm_genlist_item_prev_get((Elm_Object_Item *) it2); + } + + if (wd->expanded_next_item) + { + expanded_next_it = wd->expanded_next_item; + + /* move items */ + EINA_LIST_FOREACH(wd->move_items, l, it) + { + if (wd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_EXPAND) + { + expanded_next_it->item->old_scrl_y = wd->expanded_item->item->old_scrl_y + wd->expanded_item->item->h; + if (expanded_next_it->item->scrl_y <= expanded_next_it->item->old_scrl_y) //did not calculate next item position + expanded_next_it->item->scrl_y = cvy + cvh; + + dy = ((expanded_next_it->item->scrl_y >= (cvy + cvh)) ? + cvy + cvh : expanded_next_it->item->scrl_y) - + expanded_next_it->item->old_scrl_y; + } + else if (wd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_CONTRACT) + { + if (expanded_next_it->item->scrl_y >= expanded_next_it->item->old_scrl_y) //did not calculate next item position + expanded_next_it->item->old_scrl_y = cvy + cvh; + + if (expanded_next_it->item->old_scrl_y > (cvy + cvh)) + { + dy = (wd->expanded_item->item->scrl_y + wd->expanded_item->item->h) - + cvy + cvh; + expanded_next_it->item->old_scrl_y = cvy + cvh; + } + else + { + dy = (wd->expanded_item->item->scrl_y + wd->expanded_item->item->h) - + expanded_next_it->item->old_scrl_y; + } + } + + if (t <= effect_duration) + { + y = ((1 - (1 - (t / effect_duration)) * (1 - (t /effect_duration))) * dy); + } + else + { + end = EINA_TRUE; + y = dy; + } + + if (!it->realized) + { + _item_realize(it, in, 0); + } + in++; + + if (it != expanded_next_it) + { + it->item->old_scrl_y = expanded_next_it->item->old_scrl_y + expanded_next_it->item->h + dh; + dh += it->item->h; + } + + if ((it->item->old_scrl_y + y) < (cvy + cvh)) + _item_position(it, VIEW(it),it->item->scrl_x, it->item->old_scrl_y + y); + } + /* tree effect */ + _item_tree_effect(wd, y); + } + else + { + int expanded_item_num = 0; + int num = 0; + + if (wd->expanded_item) + it = (Elm_Gen_Item *) elm_genlist_item_next_get((Elm_Object_Item *) wd->expanded_item); + + it2 = it; + while (it2) + { + expanded_item_num++; + it2 = (Elm_Gen_Item *) elm_genlist_item_next_get((Elm_Object_Item *) it2); + } + + while (it) + { + num++; + if (wd->expanded_item->item->expanded_depth >= it->item->expanded_depth) break; + if (wd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_EXPAND) + { + if (!it->item->tree_effect_finished) + { + if (t >= (((num - 1) * effect_duration) / expanded_item_num)) + { + edje_object_signal_emit(VIEW(it), "flip_item", ""); + _item_position(it, VIEW(it), it->item->scrl_x, it->item->scrl_y); + it->item->tree_effect_finished = EINA_TRUE; + } + } + } + it = (Elm_Gen_Item *) elm_genlist_item_next_get((Elm_Object_Item *) it); + } + } + + if (end) + { + _item_tree_effect_finish(wd); + return ECORE_CALLBACK_CANCEL; + } + return ECORE_CALLBACK_RENEW; +} diff --git a/libraries/elementary/src/lib/elm_genlist.h b/libraries/elementary/src/lib/elm_genlist.h new file mode 100644 index 0000000..7b94b5d --- /dev/null +++ b/libraries/elementary/src/lib/elm_genlist.h @@ -0,0 +1,1874 @@ +/** + * @defgroup Genlist Genlist + * @ingroup Elementary + * + * @image html img/widget/genlist/preview-00.png + * @image latex img/widget/genlist/preview-00.eps + * @image html img/genlist.png + * @image latex img/genlist.eps + * + * This widget aims to have more expansive list than the simple list in + * Elementary that could have more flexible items and allow many more entries + * while still being fast and low on memory usage. At the same time it was + * also made to be able to do tree structures. But the price to pay is more + * complexity when it comes to usage. If all you want is a simple list with + * icons and a single text, use the normal @ref List object. + * + * Genlist has a fairly large API, mostly because it's relatively complex, + * trying to be both expansive, powerful and efficient. First we will begin + * an overview on the theory behind genlist. + * + * @section Genlist_Item_Class Genlist item classes - creating items + * + * In order to have the ability to add and delete items on the fly, genlist + * implements a class (callback) system where the application provides a + * structure with information about that type of item (genlist may contain + * multiple different items with different classes, states and styles). + * Genlist will call the functions in this struct (methods) when an item is + * "realized" (i.e., created dynamically, while the user is scrolling the + * grid). All objects will simply be deleted when no longer needed with + * evas_object_del(). The #Elm_Genlist_Item_Class structure contains the + * following members: + * - @c item_style - This is a constant string and simply defines the name + * of the item style. It @b must be specified and the default should be @c + * "default". + * - @c decorate_item_style - This is a constant string and simply defines the name + * of the decorate mode item style. It is used to specify decorate mode item style. It can be + * used when you call elm_genlist_item_decorate_mode_set(). + * - @c decorate_all_item_style - This is a constant string and simply defines the name + * of the decorate all item style. It is used to specify decorate all item style. It can be + * used to set selection, checking and deletion mode. This is used when you + * call elm_genlist_decorate_mode_set(). + * - @c func - A struct with pointers to functions that will be called when + * an item is going to be actually created. All of them receive a @c data + * parameter that will point to the same data passed to + * elm_genlist_item_append() and related item creation functions, and an @c + * obj parameter that points to the genlist object itself. + * + * The function pointers inside @c func are @c text_get, @c content_get, @c + * state_get and @c del. The 3 first functions also receive a @c part + * parameter described below. A brief description of these functions follows: + * + * - @c text_get - The @c part parameter is the name string of one of the + * existing text parts in the Edje group implementing the item's theme. + * This function @b must return a strdup'()ed string, as the caller will + * free() it when done. See #Elm_Genlist_Item_Text_Get_Cb. + * - @c content_get - The @c part parameter is the name string of one of the + * existing (content) swallow parts in the Edje group implementing the item's + * theme. It must return @c NULL, when no content is desired, or a valid + * object handle, otherwise. The object will be deleted by the genlist on + * its deletion or when the item is "unrealized". See + * #Elm_Genlist_Item_Content_Get_Cb. + * - @c func.state_get - The @c part parameter is the name string of one of + * the state parts in the Edje group implementing the item's theme. Return + * @c EINA_FALSE for false/off or @c EINA_TRUE for true/on. Genlists will + * emit a signal to its theming Edje object with @c "elm,state,xxx,active" + * and @c "elm" as "emission" and "source" arguments, respectively, when + * the state is true (the default is false), where @c xxx is the name of + * the (state) part. See #Elm_Genlist_Item_State_Get_Cb. + * - @c func.del - This is intended for use when genlist items are deleted, + * so any data attached to the item (e.g. its data parameter on creation) + * can be deleted. See #Elm_Genlist_Item_Del_Cb. + * + * available item styles: + * - default + * - default_style - The text part is a textblock + * + * @image html img/widget/genlist/preview-04.png + * @image latex img/widget/genlist/preview-04.eps + * + * - double_label + * + * @image html img/widget/genlist/preview-01.png + * @image latex img/widget/genlist/preview-01.eps + * + * - icon_top_text_bottom + * + * @image html img/widget/genlist/preview-02.png + * @image latex img/widget/genlist/preview-02.eps + * + * - group_index + * + * @image html img/widget/genlist/preview-03.png + * @image latex img/widget/genlist/preview-03.eps + * + * @section Genlist_Items Structure of items + * + * An item in a genlist can have 0 or more texts (they can be regular + * text or textblock Evas objects - that's up to the style to determine), 0 + * or more contents (which are simply objects swallowed into the genlist item's + * theming Edje object) and 0 or more boolean states, which have the + * behavior left to the user to define. The Edje part names for each of + * these properties will be looked up, in the theme file for the genlist, + * under the Edje (string) data items named @c "labels", @c "contents" and @c + * "states", respectively. For each of those properties, if more than one + * part is provided, they must have names listed separated by spaces in the + * data fields. For the default genlist item theme, we have @b one text + * part (@c "elm.text"), @b two content parts (@c "elm.swalllow.icon" and @c + * "elm.swallow.end") and @b no state parts. + * + * A genlist item may be at one of several styles. Elementary provides one + * by default - "default", but this can be extended by system or application + * custom themes/overlays/extensions (see @ref Theme "themes" for more + * details). + * + * @section Genlist_Manipulation Editing and Navigating + * + * Items can be added by several calls. All of them return a @ref + * Elm_Object_Item handle that is an internal member inside the genlist. + * They all take a data parameter that is meant to be used for a handle to + * the applications internal data (eg. the struct with the original item + * data). The parent parameter is the parent genlist item this belongs to if + * it is a tree or an indexed group, and NULL if there is no parent. The + * flags can be a bitmask of #ELM_GENLIST_ITEM_NONE, + * #ELM_GENLIST_ITEM_TREE and #ELM_GENLIST_ITEM_GROUP. If + * #ELM_GENLIST_ITEM_TREE is set then this item is displayed as an item + * that is able to expand and have child items. If ELM_GENLIST_ITEM_GROUP + * is set then this item is group index item that is displayed at the top + * until the next group comes. The func parameter is a convenience callback + * that is called when the item is selected and the data parameter will be + * the func_data parameter, obj be the genlist object and event_info will be + * the genlist item. + * + * elm_genlist_item_append() adds an item to the end of the list, or if + * there is a parent, to the end of all the child items of the parent. + * elm_genlist_item_prepend() is the same but adds to the beginning of + * the list or children list. elm_genlist_item_insert_before() inserts at + * item before another item and elm_genlist_item_insert_after() inserts after + * the indicated item. + * + * The application can clear the list with elm_genlist_clear() which deletes + * all the items in the list and elm_object_item_del() will delete a specific + * item. elm_genlist_item_subitems_clear() will clear all items that are + * children of the indicated parent item. + * + * To help inspect list items you can jump to the item at the top of the list + * with elm_genlist_first_item_get() which will return the item pointer, and + * similarly elm_genlist_last_item_get() gets the item at the end of the list. + * elm_genlist_item_next_get() and elm_genlist_item_prev_get() get the next + * and previous items respectively relative to the indicated item. Using + * these calls you can walk the entire item list/tree. Note that as a tree + * the items are flattened in the list, so elm_genlist_item_parent_get() will + * let you know which item is the parent (and thus know how to skip them if + * wanted). + * + * @section Genlist_Multi_Selection Multi-selection + * + * If the application wants multiple items to be able to be selected, + * elm_genlist_multi_select_set() can enable this. If the list is + * single-selection only (the default), then elm_genlist_selected_item_get() + * will return the selected item, if any, or NULL if none is selected. If the + * list is multi-select then elm_genlist_selected_items_get() will return a + * list (that is only valid as long as no items are modified (added, deleted, + * selected or unselected)). + * + * @section Genlist_Usage_Hints Usage hints + * + * There are also convenience functions. elm_object_item_widget_get() will + * return the genlist object the item belongs to. elm_genlist_item_show() + * will make the scroller scroll to show that specific item so its visible. + * elm_object_item_data_get() returns the data pointer set by the item + * creation functions. + * + * If an item changes (state of boolean changes, text or contents change), + * then use elm_genlist_item_update() to have genlist update the item with + * the new state. Genlist will re-realize the item and thus call the functions + * in the _Elm_Genlist_Item_Class for that item. + * + * To programmatically (un)select an item use elm_genlist_item_selected_set(). + * To get its selected state use elm_genlist_item_selected_get(). Similarly + * to expand/contract an item and get its expanded state, use + * elm_genlist_item_expanded_set() and elm_genlist_item_expanded_get(). And + * again to make an item disabled (unable to be selected and appear + * differently) use elm_object_item_disabled_set() to set this and + * elm_object_item_disabled_get() to get the disabled state. + * + * In general to indicate how the genlist should expand items horizontally to + * fill the list area, use elm_genlist_mode_set(). Valid modes are + * ELM_LIST_LIMIT and ELM_LIST_SCROLL. The default is ELM_LIST_SCROLL. This + * mode means that if items are too wide to fit, the scroller will scroll + * horizontally. Otherwise items are expanded to fill the width of the + * viewport of the scroller. If it is ELM_LIST_LIMIT, items will be expanded + * to the viewport width and limited to that size. This can be combined with + * a different style that uses edjes' ellipsis feature (cutting text off like + * this: "tex..."). + * + * Items will only call their selection func and callback when first becoming + * selected. Any further clicks will do nothing, unless you enable always + * select with elm_genlist_select_mode_set() as ELM_OBJECT_SELECT_MODE_ALWAYS. + * This means even if selected, every click will make the selected callbacks + * be called. elm_genlist_select_mode_set() as ELM_OBJECT_SELECT_MODE_NONE will + * turn off the ability to select items entirely and they will neither + * appear selected nor call selected callback functions. + * + * Remember that you can create new styles and add your own theme augmentation + * per application with elm_theme_extension_add(). If you absolutely must + * have a specific style that overrides any theme the user or system sets up + * you can use elm_theme_overlay_add() to add such a file. + * + * @section Genlist_Implementation Implementation + * + * Evas tracks every object you create. Every time it processes an event + * (mouse move, down, up etc.) it needs to walk through objects and find out + * what event that affects. Even worse every time it renders display updates, + * in order to just calculate what to re-draw, it needs to walk through many + * many many objects. Thus, the more objects you keep active, the more + * overhead Evas has in just doing its work. It is advisable to keep your + * active objects to the minimum working set you need. Also remember that + * object creation and deletion carries an overhead, so there is a + * middle-ground, which is not easily determined. But don't keep massive lists + * of objects you can't see or use. Genlist does this with list objects. It + * creates and destroys them dynamically as you scroll around. It groups them + * into blocks so it can determine the visibility etc. of a whole block at + * once as opposed to having to walk the whole list. This 2-level list allows + * for very large numbers of items to be in the list (tests have used up to + * 2,000,000 items). Also genlist employs a queue for adding items. As items + * may be different sizes, every item added needs to be calculated as to its + * size and thus this presents a lot of overhead on populating the list, this + * genlist employs a queue. Any item added is queued and spooled off over + * time, actually appearing some time later, so if your list has many members + * you may find it takes a while for them to all appear, with your process + * consuming a lot of CPU while it is busy spooling. + * + * Genlist also implements a tree structure, but it does so with callbacks to + * the application, with the application filling in tree structures when + * requested (allowing for efficient building of a very deep tree that could + * even be used for file-management). See the above smart signal callbacks for + * details. + * + * @section Genlist_Smart_Events Genlist smart events + * + * Signals that you can add callbacks for are: + * - @c "activated" - The user has double-clicked or pressed + * (enter|return|spacebar) on an item. The @c event_info parameter is the + * item that was activated. + * - @c "clicked,double" - The user has double-clicked an item. The @c + * event_info parameter is the item that was double-clicked. + * - @c "selected" - This is called when a user has made an item selected. + * The event_info parameter is the genlist item that was selected. + * - @c "unselected" - This is called when a user has made an item + * unselected. The event_info parameter is the genlist item that was + * unselected. + * - @c "expanded" - This is called when elm_genlist_item_expanded_set() is + * called and the item is now meant to be expanded. The event_info + * parameter is the genlist item that was indicated to expand. It is the + * job of this callback to then fill in the child items. + * - @c "contracted" - This is called when elm_genlist_item_expanded_set() is + * called and the item is now meant to be contracted. The event_info + * parameter is the genlist item that was indicated to contract. It is the + * job of this callback to then delete the child items. + * - @c "expand,request" - This is called when a user has indicated they want + * to expand a tree branch item. The callback should decide if the item can + * expand (has any children) and then call elm_genlist_item_expanded_set() + * appropriately to set the state. The event_info parameter is the genlist + * item that was indicated to expand. + * - @c "contract,request" - This is called when a user has indicated they + * want to contract a tree branch item. The callback should decide if the + * item can contract (has any children) and then call + * elm_genlist_item_expanded_set() appropriately to set the state. The + * event_info parameter is the genlist item that was indicated to contract. + * - @c "realized" - This is called when the item in the list is created as a + * real evas object. event_info parameter is the genlist item that was + * created. + * - @c "unrealized" - This is called just before an item is unrealized. + * After this call content objects provided will be deleted and the item + * object itself delete or be put into a floating cache. + * - @c "drag,start,up" - This is called when the item in the list has been + * dragged (not scrolled) up. + * - @c "drag,start,down" - This is called when the item in the list has been + * dragged (not scrolled) down. + * - @c "drag,start,left" - This is called when the item in the list has been + * dragged (not scrolled) left. + * - @c "drag,start,right" - This is called when the item in the list has + * been dragged (not scrolled) right. + * - @c "drag,stop" - This is called when the item in the list has stopped + * being dragged. + * - @c "drag" - This is called when the item in the list is being dragged. + * - @c "longpressed" - This is called when the item is pressed for a certain + * amount of time. By default it's 1 second. The event_info parameter is the + * longpressed genlist item. + * - @c "scroll,anim,start" - This is called when scrolling animation has + * started. + * - @c "scroll,anim,stop" - This is called when scrolling animation has + * stopped. + * - @c "scroll,drag,start" - This is called when dragging the content has + * started. + * - @c "scroll,drag,stop" - This is called when dragging the content has + * stopped. + * - @c "edge,top" - This is called when the genlist is scrolled until + * the top edge. + * - @c "edge,bottom" - This is called when the genlist is scrolled + * until the bottom edge. + * - @c "edge,left" - This is called when the genlist is scrolled + * until the left edge. + * - @c "edge,right" - This is called when the genlist is scrolled + * until the right edge. + * - @c "multi,swipe,left" - This is called when the genlist is multi-touch + * swiped left. + * - @c "multi,swipe,right" - This is called when the genlist is multi-touch + * swiped right. + * - @c "multi,swipe,up" - This is called when the genlist is multi-touch + * swiped up. + * - @c "multi,swipe,down" - This is called when the genlist is multi-touch + * swiped down. + * - @c "multi,pinch,out" - This is called when the genlist is multi-touch + * pinched out. + * - @c multi,pinch,in" - This is called when the genlist is multi-touch + * pinched in. + * - @c "swipe" - This is called when the genlist is swiped. + * - @c "moved" - This is called when a genlist item is moved in reorder mode. + * - @c "moved,after" - This is called when a genlist item is moved after + * another item in reorder mode. The event_info parameter is the reordered + * item. To get the relative previous item, use elm_genlist_item_prev_get(). + * This signal is called along with "moved" signal. + * - @c "moved,before" - This is called when a genlist item is moved before + * another item in reorder mode. The event_info parameter is the reordered + * item. To get the relative previous item, use elm_genlist_item_next_get(). + * This signal is called along with "moved" signal. + * - @c "language,changed" - This is called when the program's language is + * changed. + * - @c "tree,effect,finished" - This is called when a genlist tree effect is finished. + * + * Supported elm_object common APIs + * @li @ref elm_object_signal_emit() + * + * Supported elm_object_item common APIs + * @li @ref elm_object_item_part_content_get() + * @li @ref elm_object_item_part_text_get() + * @li @ref elm_object_item_disabled_set() + * @li @ref elm_object_item_disabled_get() + * @li @ref elm_object_item_signal_emit() + * + * Unsupported elm_object_item common APIs due to the genlist concept. + * Genlist fills content/text according to the appropriate callback functions. + * Please use elm_genlist_item_update() or elm_genlist_item_fields_update() + * instead. + * @li @ref elm_object_item_part_content_set() + * @li @ref elm_object_item_part_content_unset() + * @li @ref elm_object_item_part_text_set() + * + * @section Genlist_Examples Examples + * + * Here is a list of examples that use the genlist, trying to show some of + * its capabilities: + * - @ref genlist_example_01 + * - @ref genlist_example_02 + * - @ref genlist_example_03 + * - @ref genlist_example_04 + * - @ref genlist_example_05 + */ + +/** + * @addtogroup Genlist + * @{ + */ + +#define ELM_GENLIST_ITEM_CLASS_VERSION ELM_GEN_ITEM_CLASS_VERSION +#define ELM_GENLIST_ITEM_CLASS_HEADER ELM_GEN_ITEM_CLASS_HEADER + +/** + * Defines if the item is of any special type (has subitems or it's the + * index of a group), or is just a simple item. + * + * @ingroup Genlist + */ +typedef enum +{ + ELM_GENLIST_ITEM_NONE = 0, /**< simple item */ + ELM_GENLIST_ITEM_TREE = (1 << 0), /**< this may be expanded and have child items. */ + ELM_GENLIST_ITEM_GROUP = (1 << 1), /**< an index item of a group of items. this item can have child items. */ + + ELM_GENLIST_ITEM_MAX = (1 << 2) +} Elm_Genlist_Item_Type; + +/** + * Defines the type of the item part + * Used while updating item's parts + * It can be used at updating multi fields. + * + * @ingroup Genlist + */ +typedef enum +{ + ELM_GENLIST_ITEM_FIELD_ALL = 0, + ELM_GENLIST_ITEM_FIELD_TEXT = (1 << 0), + ELM_GENLIST_ITEM_FIELD_CONTENT = (1 << 1), + ELM_GENLIST_ITEM_FIELD_STATE = (1 << 2) +} Elm_Genlist_Item_Field_Type; + +/** + * Defines where to position the item in the genlist. + * + * @ingroup Genlist + */ +typedef enum +{ + ELM_GENLIST_ITEM_SCROLLTO_NONE = 0, /**< no scrollto */ + ELM_GENLIST_ITEM_SCROLLTO_IN = (1 << 0), /**< to the nearest viewport */ + ELM_GENLIST_ITEM_SCROLLTO_TOP = (1 << 1), /**< to the top of viewport */ + ELM_GENLIST_ITEM_SCROLLTO_MIDDLE = (1 << 2) /**< to the middle of viewport */ +} Elm_Genlist_Item_Scrollto_Type; + +/** + * @see Elm_Gen_Item_Class + */ +typedef Elm_Gen_Item_Class Elm_Genlist_Item_Class; + +/** + * @see Elm_Gen_Item_Text_Get_Cb + */ +typedef Elm_Gen_Item_Text_Get_Cb Elm_Genlist_Item_Text_Get_Cb; + +/** + * @see Elm_Gen_Item_Content_Get_Cb + */ +typedef Elm_Gen_Item_Content_Get_Cb Elm_Genlist_Item_Content_Get_Cb; + +/** + * @see Elm_Gen_Item_State_Get_Cb + */ +typedef Elm_Gen_Item_State_Get_Cb Elm_Genlist_Item_State_Get_Cb; + +/** + * @see Elm_Gen_Item_Del_Cb + */ +typedef Elm_Gen_Item_Del_Cb Elm_Genlist_Item_Del_Cb; + +/** + * Add a new genlist widget to the given parent Elementary + * (container) object + * + * @param parent The parent object + * @return a new genlist widget handle or @c NULL, on errors + * + * This function inserts a new genlist widget on the canvas. + * + * @see elm_genlist_item_append() + * @see elm_object_item_del() + * @see elm_genlist_clear() + * + * @ingroup Genlist + */ +EAPI Evas_Object *elm_genlist_add(Evas_Object *parent); + +/** + * Remove all items from a given genlist widget. + * + * @param obj The genlist object + * + * This removes (and deletes) all items in @p obj, leaving it empty. + * + * @see elm_object_item_del(), to remove just one item. + * + * @ingroup Genlist + */ +EAPI void elm_genlist_clear(Evas_Object *obj); + +/** + * Enable or disable multi-selection in the genlist + * + * @param obj The genlist object + * @param multi Multi-select enable/disable. Default is disabled. + * + * This enables (@c EINA_TRUE) or disables (@c EINA_FALSE) multi-selection in + * the list. This allows more than 1 item to be selected. To retrieve the list + * of selected items, use elm_genlist_selected_items_get(). + * + * @see elm_genlist_selected_items_get() + * @see elm_genlist_multi_select_get() + * + * @ingroup Genlist + */ +EAPI void elm_genlist_multi_select_set(Evas_Object *obj, Eina_Bool multi); + +/** + * Gets if multi-selection in genlist is enabled or disabled. + * + * @param obj The genlist object + * @return Multi-select enabled/disabled + * (@c EINA_TRUE = enabled/@c EINA_FALSE = disabled). Default is @c EINA_FALSE. + * + * @see elm_genlist_multi_select_set() + * + * @ingroup Genlist + */ +EAPI Eina_Bool elm_genlist_multi_select_get(const Evas_Object *obj); + +/** + * This sets the horizontal stretching mode. + * + * @param obj The genlist object + * @param mode The mode to use (one of #ELM_LIST_SCROLL or #ELM_LIST_LIMIT). + * + * This sets the mode used for sizing items horizontally. Valid modes + * are #ELM_LIST_LIMIT, #ELM_LIST_SCROLL, and #ELM_LIST_COMPRESS. The default is + * ELM_LIST_SCROLL. This mode means that if items are too wide to fit, + * the scroller will scroll horizontally. Otherwise items are expanded + * to fill the width of the viewport of the scroller. If it is + * ELM_LIST_LIMIT, items will be expanded to the viewport width and + * limited to that size. If it is ELM_LIST_COMPRESS, the item width will be + * fixed (restricted to a minimum of) to the list width when calculating its + * size in order to allow the height to be calculated based on it. This allows, + * for instance, text block to wrap lines if the Edje part is configured with + * "text.min: 0 1". + * @note ELM_LIST_COMPRESS will make list resize slower as it will have to + * recalculate every item height again whenever the list width + * changes! + * @note When ELM_LIST_COMPRESS mode is enabled, it also enables + * compress mode (see elm_genlist_mode_set()) and + * disables homogeneous (see elm_genlist_homogeneous_set()). + * + * @see elm_genlist_mode_get() + * + * @ingroup Genlist + */ +EAPI void elm_genlist_mode_set(Evas_Object *obj, Elm_List_Mode mode); + +/** + * Gets the horizontal stretching mode. + * + * @param obj The genlist object + * @return The mode to use + * (#ELM_LIST_LIMIT, #ELM_LIST_SCROLL) + * + * @see elm_genlist_mode_set() + * + * @ingroup Genlist + */ +EAPI Elm_List_Mode elm_genlist_mode_get(const Evas_Object *obj); + +/** + * Enable/disable horizontal and vertical bouncing effect. + * + * @param obj The genlist object + * @param h_bounce Allow bounce horizontally (@c EINA_TRUE = on, @c + * EINA_FALSE = off). Default is @c EINA_FALSE. + * @param v_bounce Allow bounce vertically (@c EINA_TRUE = on, @c + * EINA_FALSE = off). Default is @c EINA_TRUE. + * + * This will enable or disable the scroller bouncing effect for the + * genlist. See elm_scroller_bounce_set() for details. + * + * @see elm_scroller_bounce_set() + * @see elm_genlist_bounce_get() + * + * @ingroup Genlist + */ +EAPI void elm_genlist_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce); + +/** + * Get whether the horizontal and vertical bouncing effect is enabled. + * + * @param obj The genlist object + * @param h_bounce Pointer to a bool to receive if the bounce horizontally + * option is set. + * @param v_bounce Pointer to a bool to receive if the bounce vertically + * option is set. + * + * @see elm_genlist_bounce_set() + * + * @ingroup Genlist + */ +EAPI void elm_genlist_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce); + +/** + * Append a new item in a given genlist widget. + * + * @param obj The genlist object + * @param itc The item class for the item + * @param data The item data + * @param parent The parent item, or NULL if none + * @param type Item type + * @param func Convenience function called when the item is selected + * @param func_data Data passed to @p func above. + * @return A handle to the item added or @c NULL if not possible + * + * This adds the given item to the end of the list or the end of + * the children list if the @p parent is given. + * + * @see elm_genlist_item_prepend() + * @see elm_genlist_item_insert_before() + * @see elm_genlist_item_insert_after() + * @see elm_object_item_del() + * + * @ingroup Genlist + */ +EAPI Elm_Object_Item *elm_genlist_item_append(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Object_Item *parent, Elm_Genlist_Item_Type type, Evas_Smart_Cb func, const void *func_data); + +/** + * Prepend a new item in a given genlist widget. + * + * @param obj The genlist object + * @param itc The item class for the item + * @param data The item data + * @param parent The parent item, or NULL if none + * @param type Item type + * @param func Convenience function called when the item is selected + * @param func_data Data passed to @p func above. + * @return A handle to the item added or NULL if not possible + * + * This adds an item to the beginning of the list or beginning of the + * children of the parent if given. + * + * @see elm_genlist_item_append() + * @see elm_genlist_item_insert_before() + * @see elm_genlist_item_insert_after() + * @see elm_object_item_del() + * + * @ingroup Genlist + */ +EAPI Elm_Object_Item *elm_genlist_item_prepend(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Object_Item *parent, Elm_Genlist_Item_Type type, Evas_Smart_Cb func, const void *func_data); + +/** + * Insert an item before another in a genlist widget + * + * @param obj The genlist object + * @param itc The item class for the item + * @param data The item data + * @param parent The parent item, or NULL if none + * @param before The item to place this new one before. + * @param type Item type + * @param func Convenience function called when the item is selected + * @param func_data Data passed to @p func above. + * @return A handle to the item added or @c NULL if not possible + * + * This inserts an item before another in the list. It will be in the + * same tree level or group as the item it is inserted before. + * + * @see elm_genlist_item_append() + * @see elm_genlist_item_prepend() + * @see elm_genlist_item_insert_after() + * @see elm_object_item_del() + * + * @ingroup Genlist + */ +EAPI Elm_Object_Item *elm_genlist_item_insert_before(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Object_Item *parent, Elm_Object_Item *before, Elm_Genlist_Item_Type type, Evas_Smart_Cb func, const void *func_data); + +/** + * Insert an item after another in a genlist widget + * + * @param obj The genlist object + * @param itc The item class for the item + * @param data The item data + * @param parent The parent item, or NULL if none + * @param after The item to place this new one after. + * @param type Item type + * @param func Convenience function called when the item is selected + * @param func_data Data passed to @p func above. + * @return A handle to the item added or @c NULL if not possible + * + * This inserts an item after another in the list. It will be in the + * same tree level or group as the item it is inserted after. + * + * @see elm_genlist_item_append() + * @see elm_genlist_item_prepend() + * @see elm_genlist_item_insert_before() + * @see elm_object_item_del() + * + * @ingroup Genlist + */ +EAPI Elm_Object_Item *elm_genlist_item_insert_after(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Object_Item *parent, Elm_Object_Item *after, Elm_Genlist_Item_Type type, Evas_Smart_Cb func, const void *func_data); + +/** + * Insert a new item into the sorted genlist object + * + * @param obj The genlist object + * @param itc The item class for the item + * @param data The item data + * @param parent The parent item, or NULL if none + * @param type Item type + * @param comp The function called for the sort + * @param func Convenience function called when item selected + * @param func_data Data passed to @p func above. + * @return A handle to the item added or NULL if not possible + * + * This inserts an item in the genlist based on user defined comparison + * function. The two arguments passed to the function @p func are genlist item + * handles to compare. + * + * @see elm_genlist_item_append() + * @see elm_genlist_item_prepend() + * @see elm_genlist_item_insert_after() + * @see elm_object_item_del() + + * @ingroup Genlist + */ +EAPI Elm_Object_Item *elm_genlist_item_sorted_insert(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Object_Item *parent, Elm_Genlist_Item_Type type, Eina_Compare_Cb comp, Evas_Smart_Cb func, const void *func_data); + +/* operations to retrieve existing items */ +/** + * Get the selected item in the genlist. + * + * @param obj The genlist object + * @return The selected item, or NULL if none is selected. + * + * This gets the selected item in the list (if multi-selection is enabled, only + * the item that was first selected in the list is returned - which is not very + * useful, so see elm_genlist_selected_items_get() for when multi-selection is + * used). + * + * If no item is selected, NULL is returned. + * + * @see elm_genlist_selected_items_get() + * + * @ingroup Genlist + */ +EAPI Elm_Object_Item *elm_genlist_selected_item_get(const Evas_Object *obj); + +/** + * Get a list of selected items in the genlist. + * + * @param obj The genlist object + * @return The list of selected items, or NULL if none are selected. + * + * It returns a list of the selected items. This list pointer is only valid so + * long as the selection doesn't change (no items are selected or unselected, or + * unselected implicitly by deletion). The list contains genlist items + * pointers. The order of the items in this list is the order which they were + * selected, i.e. the first item in this list is the first item that was + * selected, and so on. + * + * @note If not in multi-select mode, consider using function + * elm_genlist_selected_item_get() instead. + * + * @see elm_genlist_multi_select_set() + * @see elm_genlist_selected_item_get() + * + * @ingroup Genlist + */ +EAPI const Eina_List *elm_genlist_selected_items_get(const Evas_Object *obj); + +/** + * Get a list of realized items in genlist + * + * @param obj The genlist object + * @return The list of realized items, nor NULL if none are realized. + * + * This returns a list of the realized items in the genlist. The list + * contains genlist item pointers. The list must be freed by the + * caller when done with eina_list_free(). The item pointers in the + * list are only valid so long as those items are not deleted or the + * genlist is not deleted. + * + * @see elm_genlist_realized_items_update() + * + * @ingroup Genlist + */ +EAPI Eina_List *elm_genlist_realized_items_get(const Evas_Object *obj); + +/** + * Get the first item in the genlist + * + * This returns the first item in the list. + * + * @param obj The genlist object + * @return The first item, or NULL if none + * + * @ingroup Genlist + */ +EAPI Elm_Object_Item *elm_genlist_first_item_get(const Evas_Object *obj); + +/** + * Get the last item in the genlist + * + * This returns the last item in the list. + * + * @return The last item, or NULL if none + * + * @ingroup Genlist + */ +EAPI Elm_Object_Item *elm_genlist_last_item_get(const Evas_Object *obj); + +/** + * Set the scrollbar policy + * + * @param obj The genlist object + * @param policy_h Horizontal scrollbar policy. + * @param policy_v Vertical scrollbar policy. + * + * This sets the scrollbar visibility policy for the given genlist + * scroller. #ELM_SCROLLER_POLICY_AUTO means the scrollbar is + * made visible if it is needed, and otherwise kept hidden. + * #ELM_SCROLLER_POLICY_ON turns it on all the time, and + * #ELM_SCROLLER_POLICY_OFF always keeps it off. This applies + * respectively for the horizontal and vertical scrollbars. Default is + * #ELM_SCROLLER_POLICY_AUTO + * + * @see elm_genlist_scroller_policy_get() + * + * @ingroup Genlist + */ +EAPI void elm_genlist_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v); + +/** + * Get the scrollbar policy + * + * @param obj The genlist object + * @param policy_h Pointer to store the horizontal scrollbar policy. + * @param policy_v Pointer to store the vertical scrollbar policy. + * + * @see elm_genlist_scroller_policy_set() + * + * @ingroup Genlist + */ +EAPI void elm_genlist_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v); + +/** + * Get the @b next item in a genlist widget's internal list of items, + * given a handle to one of those items. + * + * @param it The genlist item to fetch next from + * @return The item after @p item, or @c NULL if there's none (and + * on errors) + * + * This returns the item placed after the @p item, on the container + * genlist. + * + * @see elm_genlist_item_prev_get() + * + * @ingroup Genlist + */ +EAPI Elm_Object_Item *elm_genlist_item_next_get(const Elm_Object_Item *it); + +/** + * Get the @b previous item in a genlist widget's internal list of items, + * given a handle to one of those items. + * + * @param it The genlist item to fetch previous from + * @return The item before @p item, or @c NULL if there's none (and + * on errors) + * + * This returns the item placed before the @p item, on the container + * genlist. + * + * @see elm_genlist_item_next_get() + * + * @ingroup Genlist + */ +EAPI Elm_Object_Item *elm_genlist_item_prev_get(const Elm_Object_Item *it); + +/** + * Set whether a given genlist item is selected or not + * + * @param it The item + * @param selected Use @c EINA_TRUE, to make it selected, @c + * EINA_FALSE to make it unselected + * + * This sets the selected state of an item. If multi selection is + * not enabled on the containing genlist and @p selected is @c + * EINA_TRUE, any other previously selected items will get + * unselected in favor of this new one. + * + * @see elm_genlist_item_selected_get() + * + * @ingroup Genlist + */ +EAPI void elm_genlist_item_selected_set(Elm_Object_Item *it, Eina_Bool selected); + +/** + * Get whether a given genlist item is selected or not + * + * @param it The item + * @return @c EINA_TRUE, if it's selected, @c EINA_FALSE otherwise + * + * @see elm_genlist_item_selected_set() for more details + * + * @ingroup Genlist + */ +EAPI Eina_Bool elm_genlist_item_selected_get(const Elm_Object_Item *it); + +/** + * Show the portion of a genlist's internal list containing a given + * item, immediately. + * + * @param it The item to display + * @param type The position to bring in, the given item to. + * @ref Elm_Genlist_Item_Scrollto_Type + * + * This causes genlist to jump to the given item @p it and show it (by + * jumping to that position), if it is not fully visible. + * + * @see elm_genlist_item_bring_in() + * + * @ingroup Genlist + */ +EAPI void elm_genlist_item_show(Elm_Object_Item *it, Elm_Genlist_Item_Scrollto_Type type); + +/** + * Animatedly bring in, to the visible are of a genlist, a given + * item on it. + * + * @param it The item to display + * @param type The position to bring in, the given item to. + * @ref Elm_Genlist_Item_Scrollto_Type + * + * This causes genlist to jump to the given item @p it and show it (by + * animatedly scrolling), if it is not fully visible. + * This may use animation and take a some time to do so. + * + * @see elm_genlist_item_show() + * + * @ingroup Genlist + */ +EAPI void elm_genlist_item_bring_in(Elm_Object_Item *it, Elm_Genlist_Item_Scrollto_Type type); + +/** + * Update the contents of an item + * + * @param it The item + * + * This updates an item by calling all the item class functions again + * to get the contents, texts and states. Use this when the original + * item data has changed and the changes are desired to be reflected. + * + * Use elm_genlist_realized_items_update() to update all already realized + * items. + * + * @see elm_genlist_realized_items_update() + * + * @ingroup Genlist + */ +EAPI void elm_genlist_item_update(Elm_Object_Item *it); + +/** + * Update the item class of an item + * + * @param it The item + * @param itc The item class for the item + * + * This sets another class of the item, changing the way that it is + * displayed. After changing the item class, elm_genlist_item_update() is + * called on the item @p it. + * + * @ingroup Genlist + */ +EAPI void elm_genlist_item_item_class_update(Elm_Object_Item *it, const Elm_Genlist_Item_Class *itc); + +/** + * Get the Genlist Item class for the given Genlist Item. + * + * @param it The genlist item + * + * This returns the Genlist_Item_Class for the given item. It can be used to + * examine the function pointers and item_style. + * + * @ingroup Genlist + */ +EAPI const Elm_Genlist_Item_Class *elm_genlist_item_item_class_get(const Elm_Object_Item *it); + +/** + * Get the index of the item. It is only valid once displayed. + * + * @param it a genlist item + * @return the position inside the list of item. + * + * @ingroup Genlist + */ +EAPI int elm_genlist_item_index_get(const Elm_Object_Item *it); + +/** + * Update the contents of all realized items. + * + * @param obj The genlist object. + * + * This updates all realized items by calling all the item class functions again + * to get the contents, texts and states. Use this when the original + * item data has changed and the changes are desired to be reflected. + * + * To update just one item, use elm_genlist_item_update(). + * + * @see elm_genlist_realized_items_get() + * @see elm_genlist_item_update() + * + * @ingroup Genlist + */ +EAPI void elm_genlist_realized_items_update(Evas_Object *obj); + +/** + * Return how many items are currently in a list + * + * @param obj The list + * @return The total number of list items in the list + * + * This behavior is O(1) and includes items which may or may not be realized. + * + * @ingroup Genlist + */ +EAPI unsigned int elm_genlist_items_count(const Evas_Object *obj); + +/** + * Create a new genlist item class in a given genlist widget. + * + * @return New allocated a genlist item class. + * + * This adds genlist item class for the genlist widget. When adding an item, + * genlist_item_{append, prepend, insert} function needs item class of the item. + * Given callback parameters are used at retrieving {text, content} of + * added item. Set as NULL if it's not used. + * If there's no available memory, return can be NULL. + * + * @see elm_genlist_item_class_free() + * @see elm_genlist_item_append() + * + * @ingroup Genlist + */ +EAPI Elm_Genlist_Item_Class *elm_genlist_item_class_new(void); + +/** + * Remove an item class in a given genlist widget. + * + * @param itc The itc to be removed. + * + * This removes item class from the genlist widget. + * Whenever it has no more references to it, item class is going to be freed. + * Otherwise it just decreases its reference count. + * + * @see elm_genlist_item_class_new() + * @see elm_genlist_item_class_ref() + * @see elm_genlist_item_class_unref() + * + * @ingroup Genlist + */ +EAPI void elm_genlist_item_class_free(Elm_Genlist_Item_Class *itc); + +/** + * Increments object reference count for the item class. + * + * @param itc The given item class object to reference + * + * This API just increases its reference count for item class management. + * + * @see elm_genlist_item_class_unref() + * + * @ingroup Genlist + */ +EAPI void elm_genlist_item_class_ref(Elm_Genlist_Item_Class *itc); + +/** + * Decrements object reference count for the item class. + * + * @param itc The given item class object to reference + * + * This API just decreases its reference count for item class management. + * Reference count can't be less than 0. + * + * @see elm_genlist_item_class_ref() + * @see elm_genlist_item_class_free() + * + * @ingroup Genlist + */ +EAPI void elm_genlist_item_class_unref(Elm_Genlist_Item_Class *itc); + +/** + * Set the text to be shown in a given genlist item's tooltips. + * + * @param it The genlist item + * @param text The text to set in the content + * + * This call will setup the text to be used as tooltip to that item + * (analogous to elm_object_tooltip_text_set(), but being item + * tooltips with higher precedence than object tooltips). It can + * have only one tooltip at a time, so any previous tooltip data + * will get removed. + * + * In order to set a content or something else as a tooltip, look at + * elm_genlist_item_tooltip_content_cb_set(). + * + * @ingroup Genlist + */ +EAPI void elm_genlist_item_tooltip_text_set(Elm_Object_Item *it, const char *text); + +/** + * Set the content to be shown in a given genlist item's tooltips + * + * @param it The genlist item. + * @param func The function returning the tooltip contents. + * @param data What to provide to @a func as callback data/context. + * @param del_cb Called when data is not needed anymore, either when + * another callback replaces @p func, the tooltip is unset with + * elm_genlist_item_tooltip_unset() or the owner @p item + * dies. This callback receives as its first parameter the + * given @p data, being @c event_info the item handle. + * + * This call will setup the tooltip's contents to @p item + * (analogous to elm_object_tooltip_content_cb_set(), but being + * item tooltips with higher precedence than object tooltips). It + * can have only one tooltip at a time, so any previous tooltip + * content will get removed. @p func (with @p data) will be called + * every time Elementary needs to show the tooltip and it should + * return a valid Evas object, which will be fully managed by the + * tooltip system, getting deleted when the tooltip is gone. + * + * In order to set just a text as a tooltip, look at + * elm_genlist_item_tooltip_text_set(). + * + * @ingroup Genlist + */ +EAPI void elm_genlist_item_tooltip_content_cb_set(Elm_Object_Item *it, Elm_Tooltip_Item_Content_Cb func, const void *data, Evas_Smart_Cb del_cb); + +/** + * Unset a tooltip from a given genlist item + * + * @param it genlist item to remove a previously set tooltip from. + * + * This call removes any tooltip set on @p item. The callback + * provided as @c del_cb to + * elm_genlist_item_tooltip_content_cb_set() will be called to + * notify it is not used anymore (and have resources cleaned, if + * need be). + * + * @see elm_genlist_item_tooltip_content_cb_set() + * + * @ingroup Genlist + */ +EAPI void elm_genlist_item_tooltip_unset(Elm_Object_Item *it); + +/** + * Set a different @b style for a given genlist item's tooltip. + * + * @param it genlist item with tooltip set + * @param style the theme style to use on tooltips (e.g. @c + * "default", @c "transparent", etc) + * + * Tooltips can have alternate styles to be displayed on, + * which are defined by the theme set on Elementary. This function + * works analogously as elm_object_tooltip_style_set(), but here + * applied only to genlist item objects. The default style for + * tooltips is @c "default". + * + * @note before you set a style you should define a tooltip with + * elm_genlist_item_tooltip_content_cb_set() or + * elm_genlist_item_tooltip_text_set() + * + * @see elm_genlist_item_tooltip_style_get() + * + * @ingroup Genlist + */ +EAPI void elm_genlist_item_tooltip_style_set(Elm_Object_Item *it, const char *style); + +/** + * Get the style set a given genlist item's tooltip. + * + * @param it genlist item with tooltip already set on. + * @return style the theme style in use, which defaults to + * "default". If the object does not have a tooltip set, + * then @c NULL is returned. + * + * @see elm_genlist_item_tooltip_style_set() for more details + * + * @ingroup Genlist + */ +EAPI const char *elm_genlist_item_tooltip_style_get(const Elm_Object_Item *it); + +/** + * @brief Disable size restrictions on an object's tooltip + * @param it The tooltip's anchor object + * @param disable If EINA_TRUE, size restrictions are disabled + * @return EINA_FALSE on failure, EINA_TRUE on success + * + * This function allows a tooltip to expand beyond its parent window's canvas. + * It will instead be limited only by the size of the display. + */ +EAPI Eina_Bool elm_genlist_item_tooltip_window_mode_set(Elm_Object_Item *it, Eina_Bool disable); + +/** + * @brief Retrieve size restriction state of an object's tooltip + * @param it The tooltip's anchor object + * @return If EINA_TRUE, size restrictions are disabled + * + * This function returns whether a tooltip is allowed to expand beyond + * its parent window's canvas. + * It will instead be limited only by the size of the display. + */ +EAPI Eina_Bool elm_genlist_item_tooltip_window_mode_get(const Elm_Object_Item *it); + +/** + * Set the type of mouse pointer/cursor decoration to be shown, + * when the mouse pointer is over the given genlist widget item + * + * @param it genlist item to customize cursor on + * @param cursor the cursor type's name + * + * This function works analogously as elm_object_cursor_set(), but + * here the cursor's changing area is restricted to the item's + * area, and not the whole widget's. Note that that item cursors + * have precedence over widget cursors, so that a mouse over @p + * item will always show cursor @p type. + * + * If this function is called twice for an object, a previously set + * cursor will be unset on the second call. + * + * @see elm_object_cursor_set() + * @see elm_genlist_item_cursor_get() + * @see elm_genlist_item_cursor_unset() + * + * @ingroup Genlist + */ +EAPI void elm_genlist_item_cursor_set(Elm_Object_Item *it, const char *cursor); + +/** + * Get the type of mouse pointer/cursor decoration set to be shown, + * when the mouse pointer is over the given genlist widget item + * + * @param it genlist item with custom cursor set + * @return the cursor type's name or @c NULL, if no custom cursors + * were set to @p item (and on errors) + * + * @see elm_object_cursor_get() + * @see elm_genlist_item_cursor_set() for more details + * @see elm_genlist_item_cursor_unset() + * + * @ingroup Genlist + */ +EAPI const char *elm_genlist_item_cursor_get(const Elm_Object_Item *it); + +/** + * Unset any custom mouse pointer/cursor decoration set to be + * shown, when the mouse pointer is over the given genlist widget + * item, thus making it show the @b default cursor again. + * + * @param it a genlist item + * + * Use this call to undo any custom settings on this item's cursor + * decoration, bringing it back to defaults (no custom style set). + * + * @see elm_object_cursor_unset() + * @see elm_genlist_item_cursor_set() for more details + * + * @ingroup Genlist + */ +EAPI void elm_genlist_item_cursor_unset(Elm_Object_Item *it); + +/** + * Set a different @b style for a given custom cursor set for a + * genlist item. + * + * @param it genlist item with custom cursor set + * @param style the theme style to use (e.g. @c "default", + * @c "transparent", etc) + * + * This function only makes sense when one is using custom mouse + * cursor decorations defined in a theme file , which can + * have, given a cursor name/type, alternate styles on + * it. It works analogously as elm_object_cursor_style_set(), but + * here applied only to genlist item objects. + * + * @warning Before you set a cursor style you should have defined a + * custom cursor previously on the item, with + * elm_genlist_item_cursor_set() + * + * @see elm_genlist_item_cursor_engine_only_set() + * @see elm_genlist_item_cursor_style_get() + * + * @ingroup Genlist + */ +EAPI void elm_genlist_item_cursor_style_set(Elm_Object_Item *it, const char *style); + +/** + * Get the current @b style set for a given genlist item's custom + * cursor + * + * @param it genlist item with custom cursor set. + * @return style the cursor style in use. If the object does not + * have a cursor set, then @c NULL is returned. + * + * @see elm_genlist_item_cursor_style_set() for more details + * + * @ingroup Genlist + */ +EAPI const char *elm_genlist_item_cursor_style_get(const Elm_Object_Item *it); + +/** + * Set if the (custom) cursor for a given genlist item should be + * searched in its theme, also, or should only rely on the + * rendering engine. + * + * @param it item with custom (custom) cursor already set on + * @param engine_only Use @c EINA_TRUE to have cursors looked for + * only on those provided by the rendering engine, @c EINA_FALSE to + * have them searched on the widget's theme, as well. + * + * @note This call is of use only if you've set a custom cursor + * for genlist items, with elm_genlist_item_cursor_set(). + * + * @note By default, cursors will only be looked for between those + * provided by the rendering engine. + * + * @ingroup Genlist + */ +EAPI void elm_genlist_item_cursor_engine_only_set(Elm_Object_Item *it, Eina_Bool engine_only); + +/** + * Get if the (custom) cursor for a given genlist item is being + * searched in its theme, also, or is only relying on the rendering + * engine. + * + * @param it a genlist item + * @return @c EINA_TRUE, if cursors are being looked for only on + * those provided by the rendering engine, @c EINA_FALSE if they + * are being searched on the widget's theme, as well. + * + * @see elm_genlist_item_cursor_engine_only_set(), for more details + * + * @ingroup Genlist + */ +EAPI Eina_Bool elm_genlist_item_cursor_engine_only_get(const Elm_Object_Item *it); + +/** + * Enable/disable homogeneous mode. + * + * @param obj The genlist object + * @param homogeneous Assume the items within the genlist are of the + * same height and width (EINA_TRUE = on, EINA_FALSE = off). Default is @c + * EINA_FALSE. + * + * This will enable the homogeneous mode where items are of the same + * height and width so that genlist may do the lazy-loading at its + * maximum (which increases the performance for scrolling the list). This + * implies 'compressed' mode. + * + * @see elm_genlist_mode_set() + * @see elm_genlist_homogeneous_get() + * + * @ingroup Genlist + */ +EAPI void elm_genlist_homogeneous_set(Evas_Object *obj, Eina_Bool homogeneous); + +/** + * Get whether the homogeneous mode is enabled. + * + * @param obj The genlist object + * @return Assume the items within the genlist are of the same height + * and width (EINA_TRUE = on, EINA_FALSE = off) + * + * @see elm_genlist_homogeneous_set() + * + * @ingroup Genlist + */ +EAPI Eina_Bool elm_genlist_homogeneous_get(const Evas_Object *obj); + +/** + * Set the maximum number of items within an item block + * + * @param obj The genlist object + * @param count Maximum number of items within an item block. Default is 32. + * + * This will configure the block count to tune to the target with particular + * performance matrix. + * + * A block of objects will be used to reduce the number of operations due to + * many objects in the screen. It can determine the visibility, or if the + * object has changed, it theme needs to be updated, etc. doing this kind of + * calculation to the entire block, instead of per object. + * + * The default value for the block count is enough for most lists, so unless + * you know you will have a lot of objects visible in the screen at the same + * time, don't try to change this. + * + * @see elm_genlist_block_count_get() + * @see @ref Genlist_Implementation + * + * @ingroup Genlist + */ +EAPI void elm_genlist_block_count_set(Evas_Object *obj, int count); + +/** + * Get the maximum number of items within an item block + * + * @param obj The genlist object + * @return Maximum number of items within an item block + * + * @see elm_genlist_block_count_set() + * + * @ingroup Genlist + */ +EAPI int elm_genlist_block_count_get(const Evas_Object *obj); + +/** + * Set the timeout in seconds for the longpress event. + * + * @param obj The genlist object + * @param timeout timeout in seconds. Default is elm config value(1.0) + * + * This option will change how long it takes to send an event "longpressed" + * after the mouse down signal is sent to the list. If this event occurs, no + * "clicked" event will be sent. + * + * @warning If you set the longpress timeout value with this API, your genlist + * will not be affected by the longpress value of elementary config value + * later. + * + * @see elm_genlist_longpress_timeout_set() + * + * @ingroup Genlist + */ +EAPI void elm_genlist_longpress_timeout_set(Evas_Object *obj, double timeout); + +/** + * Get the timeout in seconds for the longpress event. + * + * @param obj The genlist object + * @return timeout in seconds + * + * @see elm_genlist_longpress_timeout_get() + * + * @ingroup Genlist + */ +EAPI double elm_genlist_longpress_timeout_get(const Evas_Object *obj); + +/** + * Get the item that is at the x, y canvas coords. + * + * @param obj The genlist object. + * @param x The input x coordinate + * @param y The input y coordinate + * @param posret The position relative to the item returned here + * @return The item at the coordinates or NULL if none + * + * This returns the item at the given coordinates (which are canvas + * relative, not object-relative). If an item is at that coordinate, + * that item handle is returned, and if @p posret is not NULL, the + * integer pointed to is set to a value of -1, 0 or 1, depending if + * the coordinate is on the upper portion of that item (-1), on the + * middle section (0) or on the lower part (1). If NULL is returned as + * an item (no item found there), then posret may indicate -1 or 1 + * based if the coordinate is above or below all items respectively in + * the genlist. + * + * @ingroup Genlist + */ +EAPI Elm_Object_Item *elm_genlist_at_xy_item_get(const Evas_Object *obj, Evas_Coord x, Evas_Coord y, int *posret); + +/** + * Get the parent item of the given item + * + * @param it The item + * @return The parent of the item or @c NULL if it has no parent. + * + * This returns the item that was specified as parent of the item @p it on + * elm_genlist_item_append() and insertion related functions. + * + * @ingroup Genlist + */ +EAPI Elm_Object_Item *elm_genlist_item_parent_get(const Elm_Object_Item *it); + +/** + * Remove all sub-items (children) of the given item + * + * @param it The item + * + * This removes all items that are children (and their descendants) of the + * given item @p it. + * + * @see elm_genlist_clear() + * @see elm_object_item_del() + * + * @ingroup Genlist + */ +EAPI void elm_genlist_item_subitems_clear(Elm_Object_Item *it); + +/** + * Sets the expanded state of an item. + * + * @param it The item + * @param expanded The expanded state (@c EINA_TRUE expanded, @c EINA_FALSE not expanded). + * + * This function flags the item of type #ELM_GENLIST_ITEM_TREE as + * expanded or not. + * + * The theme will respond to this change visually, and a signal "expanded" or + * "contracted" will be sent from the genlist with a pointer to the item that + * has been expanded/contracted. + * + * Calling this function won't show or hide any child of this item (if it is + * a parent). You must manually delete and create them on the callbacks of + * the "expanded" or "contracted" signals. + * + * @see elm_genlist_item_expanded_get() + * + * @ingroup Genlist + */ +EAPI void elm_genlist_item_expanded_set(Elm_Object_Item *it, Eina_Bool expanded); + +/** + * Get the expanded state of an item + * + * @param it The item + * @return The expanded state + * + * This gets the expanded state of an item. + * + * @see elm_genlist_item_expanded_set() + * + * @ingroup Genlist + */ +EAPI Eina_Bool elm_genlist_item_expanded_get(const Elm_Object_Item *it); + +/** + * Get the depth of expanded item + * + * @param it The genlist item object + * @return The depth of expanded item + * + * @ingroup Genlist + */ +EAPI int elm_genlist_item_expanded_depth_get(const Elm_Object_Item *it); + +/** + * Unset all contents fetched by the item class + * + * @param it The item + * @param l The contents list to return + * + * This instructs genlist to release references to contents in the item, + * meaning that they will no longer be managed by genlist and are + * floating "orphans" that can be re-used elsewhere if the user wants + * to. + * + * @ingroup Genlist + */ +EAPI void elm_genlist_item_all_contents_unset(Elm_Object_Item *it, Eina_List **l); + +/** + * Promote an item to the top of the list + * + * @param it The item + * + * @ingroup Genlist + */ +EAPI void elm_genlist_item_promote(Elm_Object_Item *it); + +/** + * Demote an item to the end of the list + * + * @param it The item + * + * @ingroup Genlist + */ +EAPI void elm_genlist_item_demote(Elm_Object_Item *it); + +/** + * Update the part of an item + * + * @param it The item + * @param parts The name of item's part + * @param itf The type of item's part type + * + * This updates an item's part by calling item's fetching functions again + * to get the contents, texts and states. Use this when the original + * item data has changed and the changes are desired to be reflected. + * Second parts argument is used for globbing to match '*', '?', and '.' + * It can be used at updating multi fields. + * + * Use elm_genlist_realized_items_update() to update an item's all + * property. + * + * @see elm_genlist_item_update() + * + * @ingroup Genlist + */ +EAPI void elm_genlist_item_fields_update(Elm_Object_Item *it, const char *parts, Elm_Genlist_Item_Field_Type itf); + +/** + * Activate a genlist mode on an item + * + * @param it The genlist item + * @param decorate_it_type Mode name + * @param decorate_it_set Boolean to define set or unset mode. + + * + * A genlist mode is a different way of selecting an item. Once a mode is + * activated on an item, any other selected item is immediately unselected. + * This feature provides an easy way of implementing a new kind of animation + * for selecting an item, without having to entirely rewrite the item style + * theme. However, the elm_genlist_selected_* API can't be used to get what + * item is activate for a mode. + * + * The current item style will still be used, but applying a genlist mode to + * an item will select it using a different kind of animation. + * + * The current active item for a mode can be found by + * elm_genlist_decorated_item_get(). + * + * The characteristics of genlist mode are: + * - Only one mode can be active at any time, and for only one item. + * - Genlist handles deactivating other items when one item is activated. + * - A mode is defined in the genlist theme (edc), and more modes can easily + * be added. + * - A mode style and the genlist item style are different things. They + * can be combined to provide a default style to the item, with some kind + * of animation for that item when the mode is activated. + * + * When a mode is activated on an item, a new view for that item is created. + * The theme of this mode defines the animation that will be used to transit + * the item from the old view to the new view. This second (new) view will be + * active for that item while the mode is active on the item, and will be + * destroyed after the mode is totally deactivated from that item. + * + * @see elm_genlist_mode_get() + * @see elm_genlist_decorated_item_get() + * + * @ingroup Genlist + */ +EAPI void elm_genlist_item_decorate_mode_set(Elm_Object_Item *it, const char *decorate_it_type, Eina_Bool decorate_it_set); + +/** + * Get the item's decorate mode. + * + * @param it The genlist item + * + * This function just returns the name of the item's decorate mode. + * + * @see elm_genlist_item_decorate_mode_set() + * @see elm_genlist_decorated_item_get() + * + * @ingroup Genlist + */ +EAPI const char *elm_genlist_item_decorate_mode_get(const Elm_Object_Item *it); + +/** + * Get active genlist mode item + * + * @param obj The genlist object + * @return The active item for that current mode. Or @c NULL if no item is + * activated with any mode. + * + * This function returns the item that was activated with a mode, by the + * function elm_genlist_item_decorate_mode_set(). + * + * @see elm_genlist_item_decorate_mode_set() + * @see elm_genlist_mode_get() + * + * @ingroup Genlist + */ +EAPI const Elm_Object_Item *elm_genlist_decorated_item_get(const Evas_Object *obj); + +/** + * Set reorder mode + * + * @param obj The genlist object + * @param reorder_mode The reorder mode + * (EINA_TRUE = on, EINA_FALSE = off) + * + * @ingroup Genlist + */ +EAPI void elm_genlist_reorder_mode_set(Evas_Object *obj, Eina_Bool reorder_mode); + +/** + * Get the reorder mode + * + * @param obj The genlist object + * @return The reorder mode + * (EINA_TRUE = on, EINA_FALSE = off) + * + * @ingroup Genlist + */ +EAPI Eina_Bool elm_genlist_reorder_mode_get(const Evas_Object *obj); + +/** + * Get the Item's Type + * + * @param it The genlist item + * @return The item type. + * + * This function returns the item's type. Normally the item's type. + * If it failed, return value is ELM_GENLIST_ITEM_MAX + * + * @ingroup Genlist + */ +EAPI Elm_Genlist_Item_Type elm_genlist_item_type_get(const Elm_Object_Item *it); + +/** + * Set Genlist decorate mode + * + * This sets Genlist decorate mode to all items. + * + * @param obj The Genlist object + * @param decorated The decorate mode status + * (EINA_TRUE = decorate mode, EINA_FALSE = normal mode + * + * @ingroup Genlist + */ +EAPI void elm_genlist_decorate_mode_set(Evas_Object *obj, Eina_Bool decorated); + +/** + * Get Genlist decorate mode + * + * @param obj The genlist object + * @return The decorate mode status + * (EINA_TRUE = decorate mode, EINA_FALSE = normal mode + * + * @ingroup Genlist + */ +EAPI Eina_Bool elm_genlist_decorate_mode_get(const Evas_Object *obj); + +/** + * Set the flip state of a given genlist item. + * + * @param it The genlist item object + * @param flip The flip mode + * (EINA_TRUE = on, EINA_FALSE = off) + * + * This function sets the flip state of a given genlist item. + * Flip mode overrides current item object. + * It can be used for on-the-fly item replace. + * Flip mode can be used with/without edit mode. + * + * @see elm_genlist_item_flip_get() + * + * @ingroup Genlist + */ + +EAPI void elm_genlist_item_flip_set(Elm_Object_Item *it, Eina_Bool flip); + +/** + * Get the flip state of a given genlist item. + * + * @param it The genlist item object + * + * This function returns the flip state of a given genlist item. + * If the parameter is invalid, it returns EINA_FALSE. + * + * @see elm_genlist_item_flip_set() + * + * @ingroup Genlist + */ + +EAPI Eina_Bool elm_genlist_item_flip_get(const Elm_Object_Item *it); + +/** + * Set Genlist tree effect + * + * @param obj The genlist object + * @param enabled The tree effect status + * (EINA_TRUE = enabled, EINA_FALSE = disabled + * + * @ingroup Genlist + */ +EAPI void elm_genlist_tree_effect_enabled_set(Evas_Object *obj, Eina_Bool enabled); + +/** + * Get Genlist tree effect + * + * @param obj The genlist object + * @return The tree effect status + * (EINA_TRUE = enabled, EINA_FALSE = disabled + * + * @ingroup Genlist + */ +EAPI Eina_Bool elm_genlist_tree_effect_enabled_get(const Evas_Object *obj); + +/** + * Set the genlist select mode. + * + * @param obj The genlist object + * @param mode The select mode + * + * elm_genlist_select_mode_set() changes item select mode in the genlist widget. + * - ELM_OBJECT_SELECT_MODE_DEFAULT : Items will only call their selection func and + * callback when first becoming selected. Any further clicks will + * do nothing, unless you set always select mode. + * - ELM_OBJECT_SELECT_MODE_ALWAYS : This means that, even if selected, + * every click will make the selected callbacks be called. + * - ELM_OBJECT_SELECT_MODE_NONE : This will turn off the ability to select items + * entirely and they will neither appear selected nor call selected + * callback functions. + * + * @see elm_genlist_select_mode_get() + * + * @ingroup Genlist + */ +EAPI void elm_genlist_select_mode_set(Evas_Object *obj, Elm_Object_Select_Mode mode); + +/** + * Get the genlist select mode. + * + * @param obj The genlist object + * @return The select mode + * (If getting mode is failed, it returns ELM_OBJECT_SELECT_MODE_MAX) + * + * @see elm_genlist_select_mode_set() + * + * @ingroup Genlist + */ +EAPI Elm_Object_Select_Mode elm_genlist_select_mode_get(const Evas_Object *obj); + +/** + * Set whether the genlist items' should be highlighted when item selected. + * + * @param obj The genlist object. + * @param highlight @c EINA_TRUE to enable highlighting or @c EINA_FALSE to + * disable it. + * + * This will turn on/off the highlight effect when item selection and + * they will, or will not highlighted. The selected and clicked + * callback functions will still be called. + * + * Highlight is enabled by default. + * + * @see elm_genlist_highlight_mode_get(). + * + * @ingroup Genlist + */ +EAPI void elm_genlist_highlight_mode_set(Evas_Object *obj, Eina_Bool highlight); + +/** + * Get whether the genlist items' should be highlighted when item selected. + * + * @param obj The genlist object. + * @return @c EINA_TRUE means items can be highlighted. @c EINA_FALSE indicates + * they can't. If @p obj is @c NULL, @c EINA_FALSE is returned. + * + * @see elm_genlist_highlight_mode_set() for details. + * + * @ingroup Genlist + */ +EAPI Eina_Bool elm_genlist_highlight_mode_get(const Evas_Object *obj); + +/** + * Set the genlist item's select mode. + * + * @param it The genlist item object + * @param mode The select mode + * + * elm_genlist_select_mode_set() changes item's select mode. + * - ELM_OBJECT_SELECT_MODE_DEFAULT : The item will only call their selection func and + * callback when first becoming selected. Any further clicks will + * do nothing, unless you set always select mode. + * - ELM_OBJECT_SELECT_MODE_ALWAYS : This means that, even if selected, + * every click will make the selected callbacks be called. + * - ELM_OBJECT_SELECT_MODE_NONE : This will turn off the ability to select the item + * entirely and they will neither appear selected nor call selected + * callback functions. + * - ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY : This will apply no-finger-size rule + * with ELM_OBJECT_SELECT_MODE_NONE. No-finger-size rule makes an item can be + * smaller than lower limit. Clickable objects should be bigger than + * human touch point device (your finger) for some touch or + * small screen devices. So it is enabled, the item can be shrink than + * predefined finger-size value. And the item will be updated. + * + * @see elm_genlist_item_select_mode_get() + * + * @ingroup Genlist + */ +EAPI void +elm_genlist_item_select_mode_set(Elm_Object_Item *it, + Elm_Object_Select_Mode mode); + +/** + * Get the genlist item's select mode. + * + * @param it The genlist item object + * @return The select mode + * (If getting mode is failed, it returns ELM_OBJECT_SELECT_MODE_MAX) + * + * @see elm_genlist_item_select_mode_set() + * + * @ingroup Genlist + */ +EAPI Elm_Object_Select_Mode +elm_genlist_item_select_mode_get(const Elm_Object_Item *it); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_gesture_layer.c b/libraries/elementary/src/lib/elm_gesture_layer.c new file mode 100644 index 0000000..2d6dcc7 --- /dev/null +++ b/libraries/elementary/src/lib/elm_gesture_layer.c @@ -0,0 +1,3520 @@ +#include +#include "elm_priv.h" +/** @defgroup Elm_Gesture_Layer Gesture Layer */ + +/* Some defaults */ +#define ELM_MOUSE_DEVICE 0 +/* ELM_GESTURE_NEGATIVE_ANGLE - magic number says we didn't compute this yet */ +#define ELM_GESTURE_NEGATIVE_ANGLE (-1.0) /* Magic number */ +#define ELM_GESTURE_MOMENTUM_DELAY 25 +#define ELM_GESTURE_MOMENTUM_TIMEOUT 50 +#define ELM_GESTURE_MULTI_TIMEOUT 50 +#define ELM_GESTURE_MINIMUM_MOMENTUM 0.001 + +/* Some Trigo values */ +#define RAD_90DEG M_PI_2 +#define RAD_180DEG M_PI +#define RAD_270DEG (M_PI_2 * 3) +#define RAD_360DEG (M_PI * 2) +/* #define DEBUG_GESTURE_LAYER 1 */ + +#define RAD2DEG(x) ((x) * 57.295779513) +#define DEG2RAD(x) ((x) / 57.295779513) + +static void * +_glayer_bufdup(void *buf, size_t size) +{ + void *p; + p = malloc(size); + memcpy(p, buf, size); + return p; +} +#define COPY_EVENT_INFO(EV) _glayer_bufdup(EV, sizeof(*EV)) + + +#define SET_TEST_BIT(P) do { \ + P->test = P->fn[ELM_GESTURE_STATE_START].cb || P->fn[ELM_GESTURE_STATE_MOVE].cb || P->fn[ELM_GESTURE_STATE_END].cb || P->fn[ELM_GESTURE_STATE_ABORT].cb; \ +} while (0) + +#define IS_TESTED(T) ((wd->gesture[T]) ? wd->gesture[T]->test : EINA_FALSE) + +/** + * @internal + * + * @struct _Func_Data + * Struct holds callback information. + * + * @ingroup Elm_Gesture_Layer + */ +struct _Func_Data +{ + void *user_data; /**< Holds user data to CB (like sd) */ + Elm_Gesture_Event_Cb cb; +}; + +/** + * @internal + * + * @typedef Func_Data + * type for callback information + * + * @ingroup Elm_Gesture_Layer + */ +typedef struct _Func_Data Func_Data; + +/** + * @internal + * + * @struct _Gesture_Info + * Struct holds gesture info + * + * @ingroup Elm_Gesture_Layer + */ +struct _Gesture_Info +{ + Evas_Object *obj; + void *data; /**< Holds gesture intemidiate processing data */ + Func_Data fn[ELM_GESTURE_STATE_ABORT + 1]; /**< Callback info for states */ + Elm_Gesture_Type g_type; /**< gesture type */ + Elm_Gesture_State state; /**< gesture state */ + void *info; /**< Data for the state callback */ + Eina_Bool test; /**< if true this gesture should be tested on input */ +}; + +/** + * @internal + * + * @typedef Gesture_Info + * Type for _Gesture_Info + * + * @ingroup Elm_Gesture_Layer + */ +typedef struct _Gesture_Info Gesture_Info; + +/** + * @internal + * + * @struct _Event_History + * Struct holds event history. + * These events are repeated if no gesture found. + * + * @ingroup Elm_Gesture_Layer + */ +struct _Event_History +{ + EINA_INLIST; + void *event; + Evas_Callback_Type event_type; +}; + +/** + * @internal + * + * @typedef Event_History + * Type for _Event_History + * + * @ingroup Elm_Gesture_Layer + */ +typedef struct _Event_History Event_History; + +/** + * @internal + * + * @struct _Pointer_Event + * Struct holds pointer-event info + * This is a generic pointer event structure + * + * @ingroup Elm_Gesture_Layer + */ +struct _Pointer_Event +{ + Evas_Coord x, y; + unsigned int timestamp; + int device; + Evas_Callback_Type event_type; +}; + +/** + * @internal + * + * @typedef Pointer_Event + * Type for generic pointer event structure + * + * @ingroup Elm_Gesture_Layer + */ +typedef struct _Pointer_Event Pointer_Event; + +/* All *Type structs hold result for the user in 'info' field + * The rest is gesture processing intermediate data. + * NOTE: info field must be FIRST in the struct. + * This is used when reporting ABORT in event_history_clear() */ +struct _Taps_Type +{ + Elm_Gesture_Taps_Info info; + unsigned int sum_x; + unsigned int sum_y; + unsigned int n_taps_needed; + unsigned int n_taps; + Eina_List *l; +}; +typedef struct _Taps_Type Taps_Type; + +struct _Long_Tap_Type +{ + Elm_Gesture_Taps_Info info; + Evas_Coord center_x; + Evas_Coord center_y; + unsigned int max_touched; + Ecore_Timer *timeout; /* When this expires, long tap STARTed */ + Eina_List *touched; +}; +typedef struct _Long_Tap_Type Long_Tap_Type; + +struct _Momentum_Type +{ /* Fields used by _line_test() */ + Elm_Gesture_Momentum_Info info; + Evas_Coord_Point line_st; + Evas_Coord_Point line_end; + unsigned int t_st_x; /* Time start on X */ + unsigned int t_st_y; /* Time start on Y */ + unsigned int t_end; /* Time end */ + unsigned int t_up; /* Recent up event time */ + int xdir, ydir; +}; +typedef struct _Momentum_Type Momentum_Type; + +struct _Line_Data +{ + Evas_Coord_Point line_st; + Evas_Coord_Point line_end; + Evas_Coord line_length; + unsigned int t_st; /* Time start */ + unsigned int t_end; /* Time end */ + int device; + double line_angle; /* Current angle of line */ +}; +typedef struct _Line_Data Line_Data; + +struct _Line_Type +{ /* Fields used by _line_test() */ + Elm_Gesture_Line_Info info; + Eina_List *list; /* List of Line_Data */ +}; +typedef struct _Line_Type Line_Type; + +struct _Zoom_Type +{ /* Fields used by _zoom_test() */ + Elm_Gesture_Zoom_Info info; + Pointer_Event zoom_st; + Pointer_Event zoom_mv; + Pointer_Event zoom_st1; + Pointer_Event zoom_mv1; + Evas_Event_Mouse_Wheel *zoom_wheel; + Evas_Coord zoom_base; /* Holds gap between fingers on zoom-start */ + Evas_Coord zoom_distance_tolerance; + unsigned int m_st_tm; /* momentum start time */ + unsigned int m_prev_tm; /* momentum prev time */ + int dir; /* Direction: 1=zoom-in, (-1)=zoom-out */ + double m_base; /* zoom value when momentum starts */ + double next_step; +}; +typedef struct _Zoom_Type Zoom_Type; + +struct _Rotate_Type +{ /* Fields used by _rotation_test() */ + Elm_Gesture_Rotate_Info info; + Pointer_Event rotate_st; + Pointer_Event rotate_mv; + Pointer_Event rotate_st1; + Pointer_Event rotate_mv1; + unsigned int prev_momentum_tm; /* timestamp of prev_momentum */ + double prev_momentum; /* Snapshot of momentum 0.01 sec ago */ + double accum_momentum; + double rotate_angular_tolerance; + double next_step; +}; +typedef struct _Rotate_Type Rotate_Type; + +struct _Widget_Data +{ + Evas_Object *target; /* Target Widget */ + Event_History *event_history_list; + + int line_min_length; + Evas_Coord zoom_distance_tolerance; + Evas_Coord line_distance_tolerance; + double line_angular_tolerance; + double zoom_wheel_factor; /* mouse wheel zoom steps */ + double zoom_finger_factor; /* used for zoom factor */ + double rotate_angular_tolerance; + unsigned int flick_time_limit_ms; + double long_tap_start_timeout; + Eina_Bool glayer_continues_enable; + + double zoom_step; + double rotate_step; + + Gesture_Info *gesture[ELM_GESTURE_LAST]; + Ecore_Timer *dbl_timeout; /* When this expires, dbl click/taps ABORTed */ + Eina_List *pending; /* List of devices need to refeed *UP event */ + Eina_List *touched; /* Information of touched devices */ + + Eina_Bool repeat_events : 1; +}; +typedef struct _Widget_Data Widget_Data; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); + +static Eina_Bool _event_history_clear(Evas_Object *obj); +static void _reset_states(Widget_Data *wd); +static void _key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info); +static void _key_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info); +static void _zoom_with_wheel_test(Evas_Object *obj, void *event_info, Evas_Callback_Type event_type, Elm_Gesture_Type g_type); +static void _mouse_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info); +static void _mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); + +static void _multi_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info); +static void _multi_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info); +static void _multi_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info); + +/* START - Functions to manage touched-device list */ +/** + * @internal + * This function is used to find if device is touched + * + * @ingroup Elm_Gesture_Layer + */ +static int +compare_device(const void *data1, const void *data2) +{ /* Compare the two device numbers */ + return (((Pointer_Event *) data1)->device -((Pointer_Event *) data2)->device); +} + +/** + * @internal + * + * Remove Pointer Event from touched device list + * @param list Pointer to touched device list. + * @param Pointer_Event Pointer to PE. + * + * @ingroup Elm_Gesture_Layer + */ +static Eina_List * +_remove_touched_device(Eina_List *list, Pointer_Event *pe) +{ + Eina_List *lst = NULL; + Pointer_Event *p = eina_list_search_unsorted(list, compare_device, pe); + if (p) + { + lst = eina_list_remove(list, p); + free(p); + return lst; + } + + return list; +} + +/** + * @internal + * + * Recoed Pointer Event in touched device list + * Note: This fuction allocates memory for PE event + * This memory is released in _remove_touched_device() + * @param list Pointer to touched device list. + * @param Pointer_Event Pointer to PE. + * + * @ingroup Elm_Gesture_Layer + */ +static Eina_List * +_add_touched_device(Eina_List *list, Pointer_Event *pe) +{ + Pointer_Event *p = eina_list_search_unsorted(list, compare_device, pe); + if (p) + { /* We like to track device touch-position, overwrite info */ + memcpy(p, pe, sizeof(Pointer_Event)); + return list; + } + + if ((pe->event_type == EVAS_CALLBACK_MOUSE_DOWN) || + (pe->event_type == EVAS_CALLBACK_MULTI_DOWN)) + { /* Add touched device on DOWN event only */ + p = malloc(sizeof(Pointer_Event)); + /* Freed in _remove_touched_device() */ + memcpy(p, pe, sizeof(Pointer_Event)); + return eina_list_append(list, p); + } + + return list; +} +/* END - Functions to manage touched-device list */ + +/** + * @internal + * + * Get event flag + * @param event_info pointer to event. + * + * @ingroup Elm_Gesture_Layer + */ +static Evas_Event_Flags +_get_event_flag(void *event_info, Evas_Callback_Type event_type) +{ + switch(event_type) + { + case EVAS_CALLBACK_MOUSE_IN: + return ((Evas_Event_Mouse_In *) event_info)->event_flags; + case EVAS_CALLBACK_MOUSE_OUT: + return ((Evas_Event_Mouse_Out *) event_info)->event_flags; + case EVAS_CALLBACK_MOUSE_DOWN: + return ((Evas_Event_Mouse_Down *) event_info)->event_flags; + case EVAS_CALLBACK_MOUSE_MOVE: + return ((Evas_Event_Mouse_Move *) event_info)->event_flags; + case EVAS_CALLBACK_MOUSE_UP: + return ((Evas_Event_Mouse_Up *) event_info)->event_flags; + case EVAS_CALLBACK_MOUSE_WHEEL: + return ((Evas_Event_Mouse_Wheel *) event_info)->event_flags; + case EVAS_CALLBACK_MULTI_DOWN: + return ((Evas_Event_Multi_Down *) event_info)->event_flags; + case EVAS_CALLBACK_MULTI_MOVE: + return ((Evas_Event_Multi_Move *) event_info)->event_flags; + case EVAS_CALLBACK_MULTI_UP: + return ((Evas_Event_Multi_Up *) event_info)->event_flags; + case EVAS_CALLBACK_KEY_DOWN: + return ((Evas_Event_Key_Down *) event_info)->event_flags; + case EVAS_CALLBACK_KEY_UP: + return ((Evas_Event_Key_Up *) event_info)->event_flags; + default: + return EVAS_EVENT_FLAG_NONE; + } +} + +/** + * @internal + * + * Sets event flag to value returned from user callback + * @param wd Widget Data + * @param event_info pointer to event. + * @param event_type what type was ev (mouse down, etc...) + * @param ev_flags event flags + * + * @ingroup Elm_Gesture_Layer + */ +static void +consume_event(Widget_Data *wd, void *event_info, + Evas_Callback_Type event_type, Evas_Event_Flags ev_flags) +{ /* Mark EVAS_EVENT_FLAG_ON_HOLD on events that are used by gesture layer */ + /* ev_flags != EVAS_EVENT_FLAG_NONE means target used event and g-layer */ + /* should not refeed this event. */ + if (!event_info) + return; /* This happens when restarting gestures */ + + if ((ev_flags) || (!wd->repeat_events)) + { + switch(event_type) + { + case EVAS_CALLBACK_MOUSE_DOWN: + ((Evas_Event_Mouse_Down *) event_info)->event_flags |= ev_flags; + break; + case EVAS_CALLBACK_MOUSE_MOVE: + ((Evas_Event_Mouse_Move *) event_info)->event_flags |= ev_flags; + break; + case EVAS_CALLBACK_MOUSE_UP: + ((Evas_Event_Mouse_Up *) event_info)->event_flags |= ev_flags; + break; + case EVAS_CALLBACK_MOUSE_WHEEL: + ((Evas_Event_Mouse_Wheel *) event_info)->event_flags |= ev_flags; + break; + case EVAS_CALLBACK_MULTI_DOWN: + ((Evas_Event_Multi_Down *) event_info)->event_flags |= ev_flags; + break; + case EVAS_CALLBACK_MULTI_MOVE: + ((Evas_Event_Multi_Move *) event_info)->event_flags |= ev_flags; + break; + case EVAS_CALLBACK_MULTI_UP: + ((Evas_Event_Multi_Up *) event_info)->event_flags |= ev_flags; + break; + case EVAS_CALLBACK_KEY_DOWN: + ((Evas_Event_Key_Down *) event_info)->event_flags |= ev_flags; + break; + case EVAS_CALLBACK_KEY_UP: + ((Evas_Event_Key_Up *) event_info)->event_flags |= ev_flags; + break; + default: + return; + } + } +} + +/** + * @internal + * + * Report current state of a gesture by calling user callback. + * @param gesture what gesture state we report. + * @param info inforamtion for user callback + * + * @ingroup Elm_Gesture_Layer + */ +static Evas_Event_Flags +_report_state(Gesture_Info *gesture, void *info) +{ /* We report current state (START, MOVE, END, ABORT), once */ +#if defined(DEBUG_GESTURE_LAYER) + printf("%s reporting gesture=<%d> state=<%d>\n" , __func__, gesture->g_type, + gesture->state); +#endif + if ((gesture->state != ELM_GESTURE_STATE_UNDEFINED) && + (gesture->fn[gesture->state].cb)) + { /* Fill state-info struct and send ptr to user callback */ + return gesture->fn[gesture->state].cb( + gesture->fn[gesture->state].user_data, info); + } + + return EVAS_EVENT_FLAG_NONE; +} + +/** + * @internal + * + * Update state for a given gesture. + * We may update gesture state to: + * UNDEFINED - current input did not start gesure yet. + * START - gesture started according to input. + * MOVE - gusture in progress. + * END - gesture completed according to input. + * ABORT - input does not matches gesure. + * note that we may move from UNDEFINED to ABORT + * because we may detect that gesture will not START + * with a given input. + * + * @param g given gesture to change state. + * @param s gesure new state. + * @param info buffer to be sent to user callback on report_state. + * @param force makes report_state to report the new-state even + * if its same as current state. Works for MOVE - gesture in progress. + * + * @ingroup Elm_Gesture_Layer + */ +static Evas_Event_Flags +_set_state(Gesture_Info *g, Elm_Gesture_State s, + void *info, Eina_Bool force) +{ + Elm_Gesture_State old_state; + if ((g->state == s) && (!force)) + return EVAS_EVENT_FLAG_NONE; + + old_state = g->state; + + g->state = s; + g->info = info; /* Information for user callback */ + if ((g->state == ELM_GESTURE_STATE_ABORT) || + (g->state == ELM_GESTURE_STATE_END)) + g->test = EINA_FALSE; + + if ((g->state != ELM_GESTURE_STATE_UNDEFINED) && + (!((old_state == ELM_GESTURE_STATE_UNDEFINED) && + (s == ELM_GESTURE_STATE_ABORT)))) + return _report_state(g, g->info); + + return EVAS_EVENT_FLAG_NONE; +} + +/** + * @internal + * + * This resets all gesture states and sets test-bit. + * this is used for restarting gestures to listen to input. + * happens after we complete a gesture or no gesture was detected. + * @param wd Widget data of the gesture-layer object. + * + * @ingroup Elm_Gesture_Layer + */ +static void +_reset_states(Widget_Data *wd) +{ + int i; + Gesture_Info *p; + for (i = ELM_GESTURE_FIRST; i < ELM_GESTURE_LAST; i++) + { + p = wd->gesture[i]; + if (p) + { + _set_state(p, ELM_GESTURE_STATE_UNDEFINED, NULL, EINA_FALSE); + SET_TEST_BIT(p); + } + } +} + +/** + * @internal + * + * if gesture was NOT detected AND we only have gestures in ABORT state + * we clear history immediately to be ready for input. + * + * @param obj The gesture-layer object. + * @return TRUE on event history_clear + * + * @ingroup Elm_Gesture_Layer + */ +static Eina_Bool +_clear_if_finished(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + int i; + + /* Clear history if all we have aborted gestures */ + Eina_Bool reset_s = EINA_TRUE, all_undefined = EINA_TRUE; + for (i = ELM_GESTURE_FIRST; i < ELM_GESTURE_LAST; i++) + { /* If no gesture started and all we have aborted gestures, reset all */ + Gesture_Info *p = wd->gesture[i]; + if ((p) && (p->state != ELM_GESTURE_STATE_UNDEFINED)) + { + if ((p->state == ELM_GESTURE_STATE_START) || + (p->state == ELM_GESTURE_STATE_MOVE)) + reset_s = EINA_FALSE; + + all_undefined = EINA_FALSE; + } + } + + if (reset_s && (!all_undefined)) + return _event_history_clear(obj); + + return EINA_FALSE; +} + +static Eina_Bool +_inside(Evas_Coord xx1, Evas_Coord yy1, Evas_Coord xx2, Evas_Coord yy2) +{ + int w = _elm_config->finger_size >> 1; /* Finger size devided by 2 */ + if (xx1 < (xx2 - w)) + return EINA_FALSE; + + if (xx1 > (xx2 + w)) + return EINA_FALSE; + + if (yy1 < (yy2 - w)) + return EINA_FALSE; + + if (yy1 > (yy2 + w)) + return EINA_FALSE; + + return EINA_TRUE; +} + +/* All *test_reset() funcs are called to clear + * gesture intermediate data. + * This happens when we need to reset our tests. + * for example when gesture is detected or all ABORTed. */ +static void +_tap_gestures_test_reset(Gesture_Info *gesture) +{ + if (!gesture) + return; + + Widget_Data *wd = elm_widget_data_get(gesture->obj); + wd->dbl_timeout = NULL; + Eina_List *data; + Pointer_Event *pe; + + if (!gesture->data) + return; + + EINA_LIST_FREE(((Taps_Type *) gesture->data)->l, data) + EINA_LIST_FREE(data, pe) + free(pe); + + memset(gesture->data, 0, sizeof(Taps_Type)); +} + +/* All *test_reset() funcs are called to clear + * gesture intermediate data. + * This happens when we need to reset our tests. + * for example when gesture is detected or all ABORTed. */ +static void +_n_long_tap_test_reset(Gesture_Info *gesture) +{ + if (!gesture) + return; + + if (!gesture->data) + return; + + Long_Tap_Type *st = gesture->data; + Eina_List *l; + Pointer_Event *p; + EINA_LIST_FOREACH(st->touched, l, p) + free(p); + + eina_list_free(st->touched); + if (st->timeout) + { + ecore_timer_del(st->timeout); + st->timeout = NULL; + } + memset(gesture->data, 0, sizeof(Long_Tap_Type)); +} + +static void +_momentum_test_reset(Gesture_Info *gesture) +{ + if (!gesture) + return; + + if (!gesture->data) + return; + + memset(gesture->data, 0, sizeof(Momentum_Type)); +} + +static void +_line_data_reset(Line_Data *st) +{ + if (!st) + return; + + memset(st, 0, sizeof(Line_Data)); + st->line_angle = ELM_GESTURE_NEGATIVE_ANGLE; +} + +static void +_line_test_reset(Gesture_Info *gesture) +{ + if (!gesture) + return; + + if (!gesture->data) + return; + + Line_Type *st = gesture->data; + Eina_List *list = st->list; + Eina_List *l; + Line_Data *t_line; + EINA_LIST_FOREACH(list, l, t_line) + free(t_line); + + eina_list_free(list); + st->list = NULL; +} + +static void +_zoom_test_reset(Gesture_Info *gesture) +{ + if (!gesture) + return; + + if (!gesture->data) + return; + + Widget_Data *wd = elm_widget_data_get(gesture->obj); + Zoom_Type *st = gesture->data; + Evas_Modifier_Mask mask = evas_key_modifier_mask_get( + evas_object_evas_get(wd->target), "Control"); + evas_object_key_ungrab(wd->target, "Control_L", mask, 0); + evas_object_key_ungrab(wd->target, "Control_R", mask, 0); + + memset(st, 0, sizeof(Zoom_Type)); + st->zoom_distance_tolerance = wd->zoom_distance_tolerance; + st->info.zoom = 1.0; +} + +static void +_rotate_test_reset(Gesture_Info *gesture) +{ + if (!gesture) + return; + + if (!gesture->data) + return; + + Widget_Data *wd = elm_widget_data_get(gesture->obj); + Rotate_Type *st = gesture->data; + + memset(st, 0, sizeof(Rotate_Type)); + st->info.base_angle = ELM_GESTURE_NEGATIVE_ANGLE; + st->rotate_angular_tolerance = wd->rotate_angular_tolerance; +} + + +/** + * @internal + * + * We register callbacks when gesture layer is attached to an object + * or when its enabled after disable. + * + * @param obj The gesture-layer object. + * + * @ingroup Elm_Gesture_Layer + */ +static void +_register_callbacks(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (wd->target) + { + evas_object_event_callback_add(wd->target, EVAS_CALLBACK_MOUSE_DOWN, + _mouse_down, obj); + evas_object_event_callback_add(wd->target, EVAS_CALLBACK_MOUSE_MOVE, + _mouse_move, obj); + evas_object_event_callback_add(wd->target, EVAS_CALLBACK_MOUSE_UP, + _mouse_up, obj); + + evas_object_event_callback_add(wd->target, EVAS_CALLBACK_MOUSE_WHEEL, + _mouse_wheel, obj); + + evas_object_event_callback_add(wd->target, EVAS_CALLBACK_MULTI_DOWN, + _multi_down, obj); + evas_object_event_callback_add(wd->target, EVAS_CALLBACK_MULTI_MOVE, + _multi_move, obj); + evas_object_event_callback_add(wd->target, EVAS_CALLBACK_MULTI_UP, + _multi_up, obj); + + evas_object_event_callback_add(wd->target, EVAS_CALLBACK_KEY_DOWN, + _key_down_cb, obj); + evas_object_event_callback_add(wd->target, EVAS_CALLBACK_KEY_UP, + _key_up_cb, obj); + } +} + +/** + * @internal + * + * We unregister callbacks when gesture layer is disabled. + * + * @param obj The gesture-layer object. + * + * @ingroup Elm_Gesture_Layer + */ +static void +_unregister_callbacks(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (wd->target) + { + evas_object_event_callback_del(wd->target, EVAS_CALLBACK_MOUSE_DOWN, + _mouse_down); + evas_object_event_callback_del(wd->target, EVAS_CALLBACK_MOUSE_MOVE, + _mouse_move); + evas_object_event_callback_del(wd->target, EVAS_CALLBACK_MOUSE_UP, + _mouse_up); + + evas_object_event_callback_del(wd->target, EVAS_CALLBACK_MOUSE_WHEEL, + _mouse_wheel); + + evas_object_event_callback_del(wd->target, EVAS_CALLBACK_MULTI_DOWN, + _multi_down); + + evas_object_event_callback_del(wd->target, EVAS_CALLBACK_MULTI_MOVE, + _multi_move); + + evas_object_event_callback_del(wd->target, EVAS_CALLBACK_MULTI_UP, + _multi_up); + + evas_object_event_callback_del(wd->target, EVAS_CALLBACK_KEY_DOWN, + _key_down_cb); + evas_object_event_callback_del(wd->target, EVAS_CALLBACK_KEY_UP, + _key_up_cb); + } +} + +/* START - Event history list handling functions */ +/** + * @internal + * This function is used to find if device number + * is found in a list of devices. + * The list contains devices for refeeding *UP event + * + * @ingroup Elm_Gesture_Layer + */ +static int +device_in_pending_list(const void *data1, const void *data2) +{ /* Compare the two device numbers */ + return (((intptr_t) data1) - ((intptr_t) data2)); +} + +/** + * @internal + * + * This functions adds device to refeed-pending device list + * @ingroup Elm_Gesture_Layer + */ +static Eina_List * +_add_device_pending(Eina_List *list, void *event, Evas_Callback_Type event_type) +{ + int device = ELM_MOUSE_DEVICE; + switch(event_type) + { + case EVAS_CALLBACK_MOUSE_DOWN: + break; + case EVAS_CALLBACK_MULTI_DOWN: + device = ((Evas_Event_Multi_Down *) event)->device; + break; + default: + return list; + } + + if (!eina_list_search_unsorted_list(list, device_in_pending_list, + (void *)(intptr_t)device)) + { + return eina_list_append(list, (void *)(intptr_t)device); + } + + return list; +} + +/** + * @internal + * + * This functions returns pending-device node + * @ingroup Elm_Gesture_Layer + */ +static Eina_List * +_device_is_pending(Eina_List *list, void *event, Evas_Callback_Type event_type) +{ + int device = ELM_MOUSE_DEVICE; + switch(event_type) + { + case EVAS_CALLBACK_MOUSE_UP: + break; + case EVAS_CALLBACK_MULTI_UP: + device = ((Evas_Event_Multi_Up *) event)->device; + break; + default: + return NULL; + } + + return eina_list_search_unsorted_list(list, device_in_pending_list, + (void *)(intptr_t)device); +} + +/** + * @internal + * + * This function reports ABORT to all none-detected gestures + * Then resets test bits for all desired gesures + * and clears input-events history. + * note: if no gesture was detected, events from history list + * are streamed to the widget because it's unused by layer. + * user may cancel refeed of events by setting repeat events. + * + * @param obj The gesture-layer object. + * + * @ingroup Elm_Gesture_Layer + */ +static Eina_Bool +_event_history_clear(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + int i; + Gesture_Info *p; + Evas *e = evas_object_evas_get(obj); + Eina_Bool gesture_found = EINA_FALSE; + for (i = ELM_GESTURE_FIRST; i < ELM_GESTURE_LAST; i++) + { + p = wd->gesture[i]; + if (p) + { + if (p->state == ELM_GESTURE_STATE_END) + gesture_found = EINA_TRUE; + else + { /* Report ABORT to all gestures that still not finished */ + _set_state(p, ELM_GESTURE_STATE_ABORT, wd->gesture[i]->info, + EINA_FALSE); + } + } + } + + _reset_states(wd); /* we are ready to start testing for gestures again */ + + /* Clear all gestures intermediate data */ + if (IS_TESTED(ELM_GESTURE_N_LONG_TAPS)) + { /* We do not clear a long-tap gesture if fingers still on surface */ + /* and gesture timer still pending to test gesture state */ + Long_Tap_Type *st = wd->gesture[ELM_GESTURE_N_LONG_TAPS]->data; + if ((st) && /* st not allocated if clear occurs before 1st input */ + ((!eina_list_count(st->touched)) || (!st->timeout))) + _n_long_tap_test_reset(wd->gesture[ELM_GESTURE_N_LONG_TAPS]); + } + + if (wd->dbl_timeout) + { + ecore_timer_del(wd->dbl_timeout); + wd->dbl_timeout = NULL; + } + + _tap_gestures_test_reset(wd->gesture[ELM_GESTURE_N_TAPS]); + _tap_gestures_test_reset(wd->gesture[ELM_GESTURE_N_DOUBLE_TAPS]); + _tap_gestures_test_reset(wd->gesture[ELM_GESTURE_N_TRIPLE_TAPS]); + _momentum_test_reset(wd->gesture[ELM_GESTURE_MOMENTUM]); + _line_test_reset(wd->gesture[ELM_GESTURE_N_LINES]); + _line_test_reset(wd->gesture[ELM_GESTURE_N_FLICKS]); + _zoom_test_reset(wd->gesture[ELM_GESTURE_ZOOM]); + _rotate_test_reset(wd->gesture[ELM_GESTURE_ROTATE]); + + /* Disable gesture layer so refeeded events won't be consumed by it */ + _unregister_callbacks(obj); + while (wd->event_history_list) + { + Event_History *t; + t = wd->event_history_list; + Eina_List *pending = _device_is_pending(wd->pending, + wd->event_history_list->event, + wd->event_history_list->event_type); + + /* Refeed events if no gesture matched input */ + if (pending || ((!gesture_found) && (!wd->repeat_events))) + { + evas_event_refeed_event(e, wd->event_history_list->event, + wd->event_history_list->event_type); + + if (pending) + { + wd->pending = eina_list_remove_list(wd->pending, pending); + } + else + { + wd->pending = _add_device_pending(wd->pending, + wd->event_history_list->event, + wd->event_history_list->event_type); + } + } + + free(wd->event_history_list->event); + wd->event_history_list = (Event_History *) eina_inlist_remove( + EINA_INLIST_GET(wd->event_history_list), + EINA_INLIST_GET(wd->event_history_list)); + free(t); + } + _register_callbacks(obj); + return EINA_TRUE; +} + +/** + * @internal + * + * This function copies input events. + * We copy event info before adding it to history. + * The memory is freed when we clear history. + * + * @param event the event to copy + * @param event_type event type to copy + * + * @ingroup Elm_Gesture_Layer + */ +static void * +_copy_event_info(void *event, Evas_Callback_Type event_type) +{ + switch(event_type) + { + case EVAS_CALLBACK_MOUSE_DOWN: + return COPY_EVENT_INFO((Evas_Event_Mouse_Down *) event); + break; + case EVAS_CALLBACK_MOUSE_MOVE: + return COPY_EVENT_INFO((Evas_Event_Mouse_Move *) event); + break; + case EVAS_CALLBACK_MOUSE_UP: + return COPY_EVENT_INFO((Evas_Event_Mouse_Up *) event); + break; + case EVAS_CALLBACK_MOUSE_WHEEL: + return COPY_EVENT_INFO((Evas_Event_Mouse_Wheel *) event); + break; + case EVAS_CALLBACK_MULTI_DOWN: + return COPY_EVENT_INFO((Evas_Event_Multi_Down *) event); + break; + case EVAS_CALLBACK_MULTI_MOVE: + return COPY_EVENT_INFO((Evas_Event_Multi_Move *) event); + break; + case EVAS_CALLBACK_MULTI_UP: + return COPY_EVENT_INFO((Evas_Event_Multi_Up *) event); + break; + case EVAS_CALLBACK_KEY_DOWN: + return COPY_EVENT_INFO((Evas_Event_Key_Down *) event); + break; + case EVAS_CALLBACK_KEY_UP: + return COPY_EVENT_INFO((Evas_Event_Key_Up *) event); + break; + default: + return NULL; + } +} + +static Eina_Bool +_event_history_add(Evas_Object *obj, void *event, Evas_Callback_Type event_type) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Event_History *ev; + if (!wd) return EINA_FALSE; + + ev = malloc(sizeof(Event_History)); + ev->event = _copy_event_info(event, event_type); /* Freed on event_history_clear */ + ev->event_type = event_type; + wd->event_history_list = (Event_History *) eina_inlist_append( + EINA_INLIST_GET(wd->event_history_list), EINA_INLIST_GET(ev)); + + return EINA_TRUE; +} +/* END - Event history list handling functions */ + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + _event_history_clear(obj); + eina_list_free(wd->pending); + + Pointer_Event *data; + EINA_LIST_FREE(wd->touched, data) + free(data); + + if (!elm_widget_disabled_get(obj)) + _unregister_callbacks(obj); + + /* Free all gestures internal data structures */ + int i; + for (i = 0; i < ELM_GESTURE_LAST; i++) + if (wd->gesture[i]) + { + if (wd->gesture[i]->data) + free(wd->gesture[i]->data); + + free(wd->gesture[i]); + } + + free(wd); +} + +static int +compare_match_fingers(const void *data1, const void *data2) +{ /* Compare coords of first item in list to cur coords */ + const Pointer_Event *pe1 = eina_list_data_get(data1); + const Pointer_Event *pe2 = data2; + + if (_inside(pe1->x, pe1->y, pe2->x, pe2->y)) + return 0; + else if (pe1->x < pe2->x) + return -1; + else + { + if (pe1->x == pe2->x) + return pe1->y - pe2->y; + else + return 1; + } +} + +static int +compare_pe_device(const void *data1, const void *data2) +{ /* Compare device of first item in list to our pe device */ + const Pointer_Event *pe1 = eina_list_data_get(data1); + const Pointer_Event *pe2 = data2; + + /* Only match if last was a down event */ + if ((pe1->event_type != EVAS_CALLBACK_MULTI_DOWN) && + (pe1->event_type != EVAS_CALLBACK_MOUSE_DOWN)) + return 1; + + if (pe1->device == pe2->device) + return 0; + else if (pe1->device < pe2->device) + return -1; + else + return 1; +} + +static Eina_List* +_record_pointer_event(Taps_Type *st, Eina_List *pe_list, Pointer_Event *pe, + Widget_Data *wd, void *event_info, Evas_Callback_Type event_type) +{ /* Keep copy of pe and record it in list */ + Pointer_Event *p = malloc(sizeof(Pointer_Event)); + memcpy(p, pe, sizeof(Pointer_Event)); + consume_event(wd, event_info, event_type, EVAS_EVENT_FLAG_NONE); + + st->sum_x += pe->x; + st->sum_y += pe->y; + st->n_taps++; + + /* This will also update middle-point to report to user later */ + st->info.x = st->sum_x / st->n_taps; + st->info.y = st->sum_y / st->n_taps; + st->info.timestamp = pe->timestamp; + + if (!pe_list) + { + pe_list = eina_list_append(pe_list, p); + st->l = eina_list_append(st->l, pe_list); + } + else + pe_list = eina_list_append(pe_list, p); + + return pe_list; +} + +/** + * @internal + * + * This function sets state a tap-gesture to END or ABORT + * + * @param data gesture info pointer + * + * @ingroup Elm_Gesture_Layer + */ +static void +_tap_gesture_finish(void *data) +{ /* This function will test each tap gesture when timer expires */ + Gesture_Info *gesture = data; + Elm_Gesture_State s = ELM_GESTURE_STATE_END; + /* Here we check if taps-gesture was completed successfuly */ + /* Count how many taps were recieved on each device then */ + /* determine if it matches n_taps_needed defined on START */ + Taps_Type *st = gesture->data; + Eina_List *l; + Eina_List *pe_list; + EINA_LIST_FOREACH(st->l, l, pe_list) + { + if (eina_list_count(pe_list) != st->n_taps_needed) + { /* No match taps number on device, ABORT */ + s = ELM_GESTURE_STATE_ABORT; + break; + } + } + + st->info.n = eina_list_count(st->l); + _set_state(gesture, s, gesture->info, EINA_FALSE); + _tap_gestures_test_reset(gesture); +} + +/** + * @internal + * + * when this timer expires we finish tap gestures. + * + * @param data The gesture-layer object. + * @return cancles callback for this timer. + * + * @ingroup Elm_Gesture_Layer + */ +static Eina_Bool +_multi_tap_timeout(void *data) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return EINA_FALSE; + + if (IS_TESTED(ELM_GESTURE_N_TAPS)) + _tap_gesture_finish(wd->gesture[ELM_GESTURE_N_TAPS]); + + if (IS_TESTED(ELM_GESTURE_N_DOUBLE_TAPS)) + _tap_gesture_finish(wd->gesture[ELM_GESTURE_N_DOUBLE_TAPS]); + + if (IS_TESTED(ELM_GESTURE_N_TRIPLE_TAPS)) + _tap_gesture_finish(wd->gesture[ELM_GESTURE_N_TRIPLE_TAPS]); + + _clear_if_finished(data); + wd->dbl_timeout = NULL; + return ECORE_CALLBACK_CANCEL; +} + +/** + * @internal + * + * when this timer expires we START long tap gesture + * + * @param data The gesture-layer object. + * @return cancles callback for this timer. + * + * @ingroup Elm_Gesture_Layer + */ +static Eina_Bool +_long_tap_timeout(void *data) +{ + Gesture_Info *gesture = data; + Long_Tap_Type *st = gesture->data; + st->timeout = NULL; + + _set_state(gesture, ELM_GESTURE_STATE_START, + gesture->data, EINA_FALSE); + + return ECORE_CALLBACK_CANCEL; +} + + +/** + * @internal + * + * This function checks if a tap gesture should start + * + * @param wd Gesture Layer Widget Data. + * @param pe The recent input event as stored in pe struct. + * @param event_info Original input event pointer. + * @param event_type Type of original input event. + * @param gesture what gesture is tested + * @param how many taps for this gesture (1, 2 or 3) + * + * @return Flag to determine if we need to set a timer for finish + * + * @ingroup Elm_Gesture_Layer + */ +static Eina_Bool +_tap_gesture_start(Widget_Data *wd, Pointer_Event *pe, + void *event_info, Evas_Callback_Type event_type, + Gesture_Info *gesture, int taps) +{ /* Here we fill Tap struct */ + Taps_Type *st = gesture->data; + if (!st) + { /* Allocated once on first time */ + st = calloc(1, sizeof(Taps_Type)); + gesture->data = st; + _tap_gestures_test_reset(gesture); + } + + Eina_List *pe_list = NULL; + Pointer_Event *pe_down = NULL; + Evas_Event_Flags ev_flag = EVAS_EVENT_FLAG_NONE; + switch (pe->event_type) + { + case EVAS_CALLBACK_MULTI_DOWN: + case EVAS_CALLBACK_MOUSE_DOWN: + /* Check if got tap on same cord was tapped before */ + pe_list = eina_list_search_unsorted(st->l, compare_match_fingers, pe); + + if ((!pe_list) && + eina_list_search_unsorted(st->l, compare_pe_device, pe)) + { /* This device was touched in other cord before completion */ + ev_flag = _set_state(gesture, ELM_GESTURE_STATE_ABORT, + &st->info, EINA_FALSE); + consume_event(wd, event_info, event_type, ev_flag); + + return EINA_FALSE; + } + + pe_list = _record_pointer_event(st, pe_list, pe, wd, event_info, event_type); + if ((pe->device == 0) && (eina_list_count(pe_list) == 1)) + { /* This is the first mouse down we got */ + ev_flag = _set_state(gesture, ELM_GESTURE_STATE_START, + &st->info, EINA_FALSE); + consume_event(wd, event_info, event_type, ev_flag); + + st->n_taps_needed = taps * 2; /* count DOWN and UP */ + + return EINA_TRUE; + } + + break; + + case EVAS_CALLBACK_MULTI_UP: + case EVAS_CALLBACK_MOUSE_UP: + pe_list = eina_list_search_unsorted(st->l, compare_pe_device, pe); + if (!pe_list) + return EINA_FALSE; + + pe_list = _record_pointer_event(st, pe_list, pe, wd, event_info, event_type); + break; + + case EVAS_CALLBACK_MULTI_MOVE: + case EVAS_CALLBACK_MOUSE_MOVE: + /* Get first event in first list, this has to be a Mouse Down event */ + /* and verify that user didn't move out of this area before next tap */ + pe_list = eina_list_search_unsorted(st->l, compare_pe_device, pe); + if (pe_list) + { + pe_down = eina_list_data_get(pe_list); + if (!_inside(pe_down->x, pe_down->y, pe->x, pe->y)) + { + ev_flag = _set_state(gesture, ELM_GESTURE_STATE_ABORT, + &st->info, EINA_FALSE); + consume_event(wd, event_info, event_type, ev_flag); + } + } + break; + + default: + return EINA_FALSE; + } + + return EINA_FALSE; +} + + +/** + * @internal + * + * This function checks all click/tap and double/triple taps + * + * @param obj The gesture-layer object. + * @param pe The recent input event as stored in pe struct. + * @param event_info Original input event pointer. + * @param event_type Type of original input event. + * + * @ingroup Elm_Gesture_Layer + */ +static void +_tap_gestures_test(Evas_Object *obj, Pointer_Event *pe, + void *event_info, Evas_Callback_Type event_type) +{ /* Here we fill Recent_Taps struct and fire-up click/tap timers */ + Eina_Bool need_timer = EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (!pe) /* this happens when unhandled event arrived */ + return; /* see _make_pointer_event function */ + + if (IS_TESTED(ELM_GESTURE_N_TAPS)) + need_timer |= _tap_gesture_start(wd, pe, event_info, event_type, + wd->gesture[ELM_GESTURE_N_TAPS], 1); + + if (IS_TESTED(ELM_GESTURE_N_DOUBLE_TAPS)) + need_timer |= _tap_gesture_start(wd, pe, event_info, event_type, + wd->gesture[ELM_GESTURE_N_DOUBLE_TAPS], 2); + + if (IS_TESTED(ELM_GESTURE_N_TRIPLE_TAPS)) + need_timer |= _tap_gesture_start(wd, pe, event_info, event_type, + wd->gesture[ELM_GESTURE_N_TRIPLE_TAPS], 3); + + if ((need_timer) && (!wd->dbl_timeout)) + { /* Set a timer to finish these gestures */ + wd->dbl_timeout = ecore_timer_add(0.4, _multi_tap_timeout, + obj); + } +} + +/** + * @internal + * + * This function computes center-point for long-tap gesture + * + * @param st Long Tap gesture info pointer + * @param pe The recent input event as stored in pe struct. + * + * @ingroup Elm_Gesture_Layer + */ +static void +_compute_taps_center(Long_Tap_Type *st, + Evas_Coord *x_out, Evas_Coord *y_out, Pointer_Event *pe) +{ + if (!eina_list_count(st->touched)) + return; + + Eina_List *l; + Pointer_Event *p; + Evas_Coord x = 0, y = 0; + EINA_LIST_FOREACH(st->touched, l, p) + { /* Accumulate all then take avarage */ + if (p->device == pe->device) + { /* This will take care of values coming from MOVE event */ + x += pe->x; + y += pe->y; + } + else + { + x += p->x; + y += p->y; + } + } + + *x_out = x / eina_list_count(st->touched); + *y_out = y / eina_list_count(st->touched); +} + +/** + * @internal + * + * This function checks N long-tap gesture. + * + * @param obj The gesture-layer object. + * @param pe The recent input event as stored in pe struct. + * @param event_info Original input event pointer. + * @param event_type Type of original input event. + * @param g_type what Gesture we are testing. + * @param taps How many click/taps we test for. + * + * @ingroup Elm_Gesture_Layer + */ +static void +_n_long_tap_test(Evas_Object *obj, Pointer_Event *pe, + void *event_info, Evas_Callback_Type event_type, + Elm_Gesture_Type g_type) +{ /* Here we fill Recent_Taps struct and fire-up click/tap timers */ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (!pe) /* this happens when unhandled event arrived */ + return; /* see _make_pointer_event function */ + Gesture_Info *gesture = wd->gesture[g_type]; + if (!gesture) return; + + Long_Tap_Type *st = gesture->data; + if (!st) + { /* Allocated once on first time */ + st = calloc(1, sizeof(Long_Tap_Type)); + gesture->data = st; + _n_long_tap_test_reset(gesture); + } + + Evas_Event_Flags ev_flag = EVAS_EVENT_FLAG_NONE; + switch (pe->event_type) + { + case EVAS_CALLBACK_MULTI_DOWN: + case EVAS_CALLBACK_MOUSE_DOWN: + st->touched = _add_touched_device(st->touched, pe); + st->info.n = eina_list_count(st->touched); + if (st->info.n > st->max_touched) + st->max_touched = st->info.n; + else + { /* User removed finger from touch, then put back - ABORT */ + if ((gesture->state == ELM_GESTURE_STATE_START) || + (gesture->state == ELM_GESTURE_STATE_MOVE)) + { + ev_flag =_set_state(gesture, ELM_GESTURE_STATE_ABORT, + &st->info, EINA_FALSE); + consume_event(wd, event_info, event_type, ev_flag); + } + } + + if ((pe->device == 0) && (eina_list_count(st->touched) == 1)) + { /* This is the first mouse down we got */ + st->info.timestamp = pe->timestamp; + + /* To test long tap */ + /* When this timer expires, gesture STARTED */ + if (!st->timeout) + st->timeout = ecore_timer_add(wd->long_tap_start_timeout, + _long_tap_timeout, gesture); + } + + consume_event(wd, event_info, event_type, ev_flag); + _compute_taps_center(st, &st->info.x, &st->info.y, pe); + st->center_x = st->info.x; + st->center_y = st->info.y; + break; + + case EVAS_CALLBACK_MULTI_UP: + case EVAS_CALLBACK_MOUSE_UP: + st->touched = _remove_touched_device(st->touched, pe); + _compute_taps_center(st, &st->center_x, &st->center_y, pe); + if (st->info.n && + ((gesture->state == ELM_GESTURE_STATE_START) || + (gesture->state == ELM_GESTURE_STATE_MOVE))) + { /* Report END only for gesture that STARTed */ + if (eina_list_count(st->touched) == 0) + { /* Report END only at last release event */ + ev_flag =_set_state(gesture, ELM_GESTURE_STATE_END, + &st->info, EINA_FALSE); + consume_event(wd, event_info, event_type, ev_flag); + } + } + else + { /* Stop test, user lifts finger before long-start */ + if (st->timeout) ecore_timer_del(st->timeout); + st->timeout = NULL; + ev_flag =_set_state(gesture, ELM_GESTURE_STATE_ABORT, + &st->info, EINA_FALSE); + consume_event(wd, event_info, event_type, ev_flag); + } + + break; + + case EVAS_CALLBACK_MULTI_MOVE: + case EVAS_CALLBACK_MOUSE_MOVE: + if (st->info.n && + ((gesture->state == ELM_GESTURE_STATE_START) || + (gesture->state == ELM_GESTURE_STATE_MOVE))) + { /* Report MOVE only if STARTED */ + Evas_Coord x = 0; + Evas_Coord y = 0; + Elm_Gesture_State state_to_report = ELM_GESTURE_STATE_MOVE; + + _compute_taps_center(st, &x, &y, pe); + /* ABORT if user moved fingers out of tap area */ +#if defined(DEBUG_GESTURE_LAYER) + printf("%s x,y=(%d,%d) st->info.x,st->info.y=(%d,%d)\n",__func__,x,y,st->info.x,st->info.y); +#endif + if (!_inside(x, y, st->center_x, st->center_y)) + state_to_report = ELM_GESTURE_STATE_ABORT; + + /* Report MOVE if gesture started */ + ev_flag = _set_state(gesture, state_to_report, + &st->info, EINA_TRUE); + consume_event(wd, event_info, event_type, ev_flag); + } + break; + + default: + return; + } +} + +/** + * @internal + * + * This function computes momentum for MOMENTUM, LINE and FLICK gestures + * This momentum value will be sent to widget when gesture is completed. + * + * @param momentum pointer to buffer where we record momentum value. + * @param x1 x coord where user started gesture. + * @param y1 y coord where user started gesture. + * @param x2 x coord where user completed gesture. + * @param y2 y coord where user completed gesture. + * @param t1x timestamp for X, when user started gesture. + * @param t1y timestamp for Y, when user started gesture. + * @param t2 timestamp when user completed gesture. + * + * @ingroup Elm_Gesture_Layer + */ +static void +_set_momentum(Elm_Gesture_Momentum_Info *momentum, + Evas_Coord xx1, Evas_Coord yy1, + Evas_Coord xx2, Evas_Coord yy2, + unsigned int t1x, unsigned int t1y, unsigned int t2) +{ + Evas_Coord velx = 0, vely = 0, vel; + Evas_Coord dx = xx2 - xx1; + Evas_Coord dy = yy2 - yy1; + int dtx = t2 - t1x; + int dty = t2 - t1y; + if (dtx > 0) + velx = (dx * 1000) / dtx; + + if (dty > 0) + vely = (dy * 1000) / dty; + + vel = sqrt((velx * velx) + (vely * vely)); + + if ((_elm_config->thumbscroll_friction > 0.0) && + (vel > _elm_config->thumbscroll_momentum_threshold)) + { /* report momentum */ + momentum->mx = velx; + momentum->my = vely; + } + else + { + momentum->mx = 0; + momentum->my = 0; + } +} + +/** + * @internal + * + * This function is used for computing rotation angle (DEG). + * + * @param x1 first finger x location. + * @param y1 first finger y location. + * @param x2 second finger x location. + * @param y2 second finger y location. + * + * @return angle of the line between (x1,y1), (x2,y2) in Deg. + * Angles now are given in DEG, not RAD. + * ZERO angle at 12-oclock, growing clockwise. + * + * @ingroup Elm_Gesture_Layer + */ +static double +get_angle(Evas_Coord xx1, Evas_Coord yy1, Evas_Coord xx2, Evas_Coord yy2) +{ + double a, xx, yy, rt = (-1); + xx = fabs(xx2 - xx1); + yy = fabs(yy2 - yy1); + + if (((int)xx) && ((int)yy)) + { + rt = a = RAD2DEG(atan(yy / xx)); + if (xx1 < xx2) + { + if (yy1 < yy2) rt = 360 - a; + else rt = a; + } + else + { + if (yy1 < yy2) rt = 180 + a; + else rt = 180 - a; + } + } + + if (rt < 0) + { /* Do this only if rt is not set */ + if (((int)xx)) + { /* Horizontal line */ + if (xx2 < xx1) rt = 180; + else rt = 0.0; + } + else + { /* Vertical line */ + if (yy2 < yy1) rt = 90; + else rt = 270; + } + } + + /* Now we want to change from: + * 90 0 + * original circle 180 0 We want: 270 90 + * 270 180 + */ + rt = 450 - rt; + if (rt >= 360) rt -= 360; + + return rt; +} + +/** + * @internal + * + * This function is used for computing the magnitude and direction + * of vector between two points. + * + * @param x1 first finger x location. + * @param y1 first finger y location. + * @param x2 second finger x location. + * @param y2 second finger y location. + * @param l length computed (output) + * @param a angle computed (output) + * + * @ingroup Elm_Gesture_Layer + */ +static void +get_vector(Evas_Coord xx1, Evas_Coord yy1, Evas_Coord xx2, Evas_Coord yy2, + Evas_Coord *l, double *a) +{ + Evas_Coord xx, yy; + xx = xx2 - xx1; + yy = yy2 - yy1; + *l = (Evas_Coord) sqrt((xx * xx) + (yy * yy)); + *a = get_angle(xx1, yy1, xx2, yy2); +} + +static int +_get_direction(Evas_Coord xx1, Evas_Coord xx2) +{ + if (xx2 < xx1) return -1; + if (xx2 > xx1) return 1; + return 0; +} +/** + * @internal + * + * This function tests momentum gesture. + * @param obj The gesture-layer object. + * @param pe The recent input event as stored in pe struct. + * @param event_info recent input event. + * @param event_type recent event type. + * @param g_type what Gesture we are testing. + * + * @ingroup Elm_Gesture_Layer + */ +static void +_momentum_test(Evas_Object *obj, Pointer_Event *pe, + void *event_info, Evas_Callback_Type event_type, + Elm_Gesture_Type g_type) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + Gesture_Info *gesture = wd->gesture[g_type]; + if (!gesture ) return; + + /* When continues enable = TRUE a gesture may START on MOVE event */ + /* We don't allow this to happen with the if-statement below. */ + /* When continues enable = FALSE a gesture may START on DOWN only */ + /* Therefor it would NOT start on MOVE event. */ + /* NOTE that touched list is updated AFTER this function returns */ + /* so (count == 0) when we get here on first touch on surface. */ + if ((wd->glayer_continues_enable) && (!eina_list_count(wd->touched))) + return; /* Got move on mouse-over move */ + + Momentum_Type *st = gesture->data; + Elm_Gesture_State state_to_report = ELM_GESTURE_STATE_MOVE; + if (!st) + { /* Allocated once on first time */ + st = calloc(1, sizeof(Momentum_Type)); + gesture->data = st; + _momentum_test_reset(gesture); + } + + if (!pe) + return; + + /* First make avarage of all touched devices to determine center point */ + Eina_List *l; + Pointer_Event *p; + Pointer_Event pe_local = *pe; /* Copy pe event info to local */ + unsigned int cnt = 1; /* We start counter counting current pe event */ + EINA_LIST_FOREACH(wd->touched, l, p) + if (p->device != pe_local.device) + { + pe_local.x += p->x; + pe_local.y += p->y; + cnt++; + } + + + /* Compute avarage to get center point */ + pe_local.x /= cnt; + pe_local.y /= cnt; + + /* If user added finger - reset gesture */ + if ((st->info.n) && (st->info.n < cnt)) + state_to_report = ELM_GESTURE_STATE_ABORT; + + + if (st->info.n < cnt) + st->info.n = cnt; + + Evas_Event_Flags ev_flag = EVAS_EVENT_FLAG_NONE; + switch (event_type) + { + case EVAS_CALLBACK_MOUSE_DOWN: + case EVAS_CALLBACK_MULTI_DOWN: + case EVAS_CALLBACK_MOUSE_MOVE: + case EVAS_CALLBACK_MULTI_MOVE: + if (!st->t_st_x) + { + if ((event_type == EVAS_CALLBACK_MOUSE_DOWN) || + (event_type == EVAS_CALLBACK_MULTI_DOWN) || + (wd->glayer_continues_enable)) /* start also on MOVE */ + { /* We start on MOVE when cont-enabled only */ + st->line_st.x = st->line_end.x = pe_local.x; + st->line_st.y = st->line_end.y = pe_local.y; + st->t_st_x = st->t_st_y = st->t_end = pe_local.timestamp; + st->xdir = st->ydir = 0; + st->info.x2 = st->info.x1 = pe_local.x; + st->info.y2 = st->info.y1 = pe_local.y; + st->info.tx = st->info.ty = pe_local.timestamp; + ev_flag = _set_state(gesture, ELM_GESTURE_STATE_START, + &st->info, EINA_FALSE); + consume_event(wd, event_info, event_type, ev_flag); + } + + return; + } + + + if (st->t_up) + { + Eina_Bool force = EINA_TRUE; /* for move state */ + if ((st->t_up + ELM_GESTURE_MULTI_TIMEOUT) < pe_local.timestamp) + { /* ABORT if got DOWN or MOVE event after UP+timeout */ + state_to_report = ELM_GESTURE_STATE_ABORT; + force = EINA_FALSE; + } + + /* We report state but don't compute momentum now */ + ev_flag = _set_state(gesture, state_to_report, &st->info, + force); + consume_event(wd, event_info, event_type, ev_flag); + return; /* Stop computing when user remove finger */ + } + + if ((pe_local.timestamp - ELM_GESTURE_MOMENTUM_TIMEOUT) > st->t_end) + { /* Too long of a wait, reset all values */ + st->line_st.x = pe_local.x; + st->line_st.y = pe_local.y; + st->t_st_y = st->t_st_x = pe_local.timestamp; + st->info.tx = st->t_st_x; + st->info.ty = st->t_st_y; + st->xdir = st->ydir = 0; + } + else + { + int xdir, ydir; + xdir = _get_direction(st->line_end.x, pe_local.x); + ydir = _get_direction(st->line_end.y, pe_local.y); + if (xdir && (xdir != st->xdir)) + { + st->line_st.x = st->line_end.x; + st->info.tx = st->t_st_x = st->t_end; + st->xdir = xdir; + } + + if (ydir && (ydir != st->ydir)) + { + st->line_st.y = st->line_end.y; + st->info.ty = st->t_st_y = st->t_end; + st->ydir = ydir; + } + } + + st->info.x2 = st->line_end.x = pe_local.x; + st->info.y2 = st->line_end.y = pe_local.y; + st->t_end = pe_local.timestamp; + _set_momentum(&st->info, st->line_st.x, st->line_st.y, + pe_local.x, pe_local.y, st->t_st_x, st->t_st_y, + pe_local.timestamp); + + ev_flag = _set_state(gesture, state_to_report, &st->info, + EINA_TRUE); + consume_event(wd, event_info, event_type, ev_flag); + break; + + + case EVAS_CALLBACK_MOUSE_UP: + case EVAS_CALLBACK_MULTI_UP: + st->t_up = pe_local.timestamp; /* Record recent up event time */ + if ((cnt > 1) || /* Ignore if more fingers touch surface */ + (!st->t_st_x)) /* IGNORE if info was cleared, long press,move */ + return; + + if ((pe_local.timestamp - ELM_GESTURE_MOMENTUM_TIMEOUT) > st->t_end) + { /* Too long of a wait, reset all values */ + st->line_st.x = pe_local.x; + st->line_st.y = pe_local.y; + st->t_st_y = st->t_st_x = pe_local.timestamp; + st->xdir = st->ydir = 0; + } + + st->info.x2 = pe_local.x; + st->info.y2 = pe_local.y; + st->line_end.x = pe_local.x; + st->line_end.y = pe_local.y; + st->t_end = pe_local.timestamp; + + if ((fabs(st->info.mx) > ELM_GESTURE_MINIMUM_MOMENTUM) || + (fabs(st->info.my) > ELM_GESTURE_MINIMUM_MOMENTUM)) + state_to_report = ELM_GESTURE_STATE_END; + else + state_to_report = ELM_GESTURE_STATE_ABORT; + + ev_flag = _set_state(gesture, state_to_report, &st->info, + EINA_FALSE); + consume_event(wd, event_info, event_type, ev_flag); + return; + + default: + return; + } +} + +static int +compare_line_device(const void *data1, const void *data2) +{ /* Compare device component of line struct */ + const Line_Data *ln1 = data1; + const int *device = data2; + + if (ln1->t_st) /* Compare only with lines that started */ + return (ln1->device - (*device)); + + return (-1); +} + +/** + * @internal + * + * This function construct line struct from input. + * @param info pointer to store line momentum. + * @param st line info to store input data. + * @param pe The recent input event as stored in pe struct. + * + * @ingroup Elm_Gesture_Layer + */ +static Eina_Bool +_single_line_process(Elm_Gesture_Line_Info *info, Line_Data *st, + Pointer_Event *pe, Evas_Callback_Type event_type) +{ /* Record events and set momentum for line pointed by st */ + if (!pe) + return EINA_FALSE; + + switch (event_type) + { + case EVAS_CALLBACK_MOUSE_DOWN: + case EVAS_CALLBACK_MOUSE_MOVE: + case EVAS_CALLBACK_MULTI_DOWN: + case EVAS_CALLBACK_MULTI_MOVE: + if (!st->t_st) + { /* This happens only when line starts */ + st->line_st.x = pe->x; + st->line_st.y = pe->y; + st->t_st = pe->timestamp; + st->device = pe->device; + info->momentum.x1 = pe->x; + info->momentum.y1 = pe->y; + info->momentum.tx = pe->timestamp; + info->momentum.ty = pe->timestamp; + + return EINA_TRUE; + } + + break; + + case EVAS_CALLBACK_MOUSE_UP: + case EVAS_CALLBACK_MULTI_UP: + /* IGNORE if line info was cleared, like long press, move */ + if (!st->t_st) + return EINA_FALSE; + + st->line_end.x = pe->x; + st->line_end.y = pe->y; + st->t_end = pe->timestamp; + break; + + default: + return EINA_FALSE; + } + + if (!st->t_st) + { + _line_data_reset(st); + return EINA_FALSE; + } + + info->momentum.x2 = pe->x; + info->momentum.y2 = pe->y; + _set_momentum(&info->momentum, st->line_st.x, st->line_st.y, pe->x, pe->y, + st->t_st, st->t_st, pe->timestamp); + + return EINA_TRUE; +} + +/** + * @internal + * + * This function test for (n) line gesture. + * @param obj The gesture-layer object. + * @param pe The recent input event as stored in pe struct. + * @param event_info Original input event pointer. + * @param event_type Type of original input event. + * @param g_type what Gesture we are testing. + * + * @ingroup Elm_Gesture_Layer + */ +static void +_n_line_test(Evas_Object *obj, Pointer_Event *pe, void *event_info, + Evas_Callback_Type event_type, Elm_Gesture_Type g_type) +{ + if (!pe) + return; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + Gesture_Info *gesture = wd->gesture[g_type]; + if (!gesture ) return; + + /* When continues enable = TRUE a gesture may START on MOVE event */ + /* We don't allow this to happen with the if-statement below. */ + /* When continues enable = FALSE a gesture may START on DOWN only */ + /* Therefor it would NOT start on MOVE event. */ + /* NOTE that touched list is updated AFTER this function returns */ + /* so (count == 0) when we get here on first touch on surface. */ + if ((wd->glayer_continues_enable) && (!eina_list_count(wd->touched))) + return; /* Got move on mouse-over move */ + + Line_Type *st = gesture->data; + if (!st) + { + st = calloc(1, sizeof(Line_Type)); + gesture->data = st; + } + + Line_Data *line = NULL; + Eina_List *list = st->list; + unsigned cnt = eina_list_count(list); + + if (cnt) + { /* list is not empty, locate this device on list */ + line = (Line_Data *) eina_list_search_unsorted(st->list, + compare_line_device, &pe->device); + } + + if (!line) + { /* List is empty or device not found, new line-struct on START only */ + if ((event_type == EVAS_CALLBACK_MOUSE_DOWN) || + (event_type == EVAS_CALLBACK_MULTI_DOWN) || + ((wd->glayer_continues_enable) && /* START on MOVE also */ + ((event_type == EVAS_CALLBACK_MOUSE_MOVE) || + (event_type == EVAS_CALLBACK_MULTI_MOVE)))) + { /* Allocate new item on START only */ + line = calloc(1, sizeof(Line_Data)); + _line_data_reset(line); + list = eina_list_append(list, line); + st->list = list; + } + } + + if (!line) /* This may happen on MOVE that comes before DOWN */ + return; /* No line-struct to work with, can't continue testing */ + + if (_single_line_process(&st->info, line, pe, event_type)) /* update st with input */ + consume_event(wd, event_info, event_type, EVAS_EVENT_FLAG_NONE); + + /* Get direction and magnitude of the line */ + double angle; + get_vector(line->line_st.x, line->line_st.y, pe->x, pe->y, + &line->line_length, &angle); + + /* These are used later to compare lines length */ + Evas_Coord shortest_line_len = line->line_length; + Evas_Coord longest_line_len = line->line_length; + Evas_Event_Flags ev_flag = EVAS_EVENT_FLAG_NONE; + + /* Now update line-state */ + if (line->t_st) + { /* Analyze line only if line started */ + if (line->line_angle >= 0.0) + { /* if line direction was set, we test if broke tolerance */ + double a = fabs(angle - line->line_angle); + + double d = (tan(DEG2RAD(a))) * line->line_length; /* Distance from line */ +#if defined(DEBUG_GESTURE_LAYER) + printf("%s a=<%f> d=<%f>\n", __func__, a, d); +#endif + if ((d > wd->line_distance_tolerance) || (a > wd->line_angular_tolerance)) + { /* Broke tolerance: abort line and start a new one */ + ev_flag = _set_state(gesture, ELM_GESTURE_STATE_ABORT, + &st->info, EINA_FALSE); + consume_event(wd, event_info, event_type, ev_flag); + return; + } + + if (wd->glayer_continues_enable) + { /* We may finish line if momentum is zero */ + /* This is for continues-gesture */ + if ((!st->info.momentum.mx) && (!st->info.momentum.my)) + { /* Finish line on zero momentum for continues gesture */ + line->line_end.x = pe->x; + line->line_end.y = pe->y; + line->t_end = pe->timestamp; + } + } + } + else + { /* Record the line angle as it broke minimum length for line */ + if (line->line_length >= wd->line_min_length) + st->info.angle = line->line_angle = angle; + } + + + if (line->t_end) + { + if (line->line_angle < 0.0) + { /* it's not a line, too short more close to a tap */ + ev_flag = _set_state(gesture, ELM_GESTURE_STATE_ABORT, + &st->info, EINA_FALSE); + consume_event(wd, event_info, event_type, ev_flag); + return; + } + } + } + + /* Count how many lines already started / ended */ + int started = 0; + int ended = 0; + unsigned int tm_start = pe->timestamp; + unsigned int tm_end = pe->timestamp; + Eina_List *l; + Line_Data *t_line; + double base_angle = ELM_GESTURE_NEGATIVE_ANGLE; + Eina_Bool lines_parallel = EINA_TRUE; + EINA_LIST_FOREACH(list, l, t_line) + { + if (base_angle < 0) + base_angle = t_line->line_angle; + else + { + if (t_line->line_angle >= 0) + { /* Compare angle only with lines with direction defined */ + if (fabs(base_angle - t_line->line_angle) > + wd->line_angular_tolerance) + lines_parallel = EINA_FALSE; + } + } + + if (t_line->line_length) + { /* update only if this line is used */ + if (shortest_line_len > t_line->line_length) + shortest_line_len = t_line->line_length; + + if (longest_line_len < t_line->line_length) + longest_line_len = t_line->line_length; + } + + if (t_line->t_st) + { + started++; + if (t_line->t_st < tm_start) + tm_start = t_line->t_st; + } + + if (t_line->t_end) + { + ended++; + if (t_line->t_end < tm_end) + tm_end = t_line->t_end; + } + } + + st->info.momentum.n = started; + + + if (ended && + ((event_type == EVAS_CALLBACK_MOUSE_DOWN) || + (event_type == EVAS_CALLBACK_MULTI_DOWN))) + { /* user lift one finger then starts again without line-end - ABORT */ + ev_flag = _set_state(gesture, ELM_GESTURE_STATE_ABORT, &st->info, + EINA_FALSE); + consume_event(wd, event_info, event_type, ev_flag); + return; + } + + if (!lines_parallel) + { /* Lines are NOT at same direction, abort this gesture */ + ev_flag = _set_state(gesture, ELM_GESTURE_STATE_ABORT, &st->info, + EINA_FALSE); + consume_event(wd, event_info, event_type, ev_flag); + return; + } + + + /* We report ABORT if lines length are NOT matching when fingers are up */ + if ((longest_line_len - shortest_line_len) > (_elm_config->finger_size * 2)) + { + ev_flag = _set_state(gesture, ELM_GESTURE_STATE_ABORT, &st->info, + EINA_FALSE); + consume_event(wd, event_info, event_type, ev_flag); + return; + } + + if ((g_type == ELM_GESTURE_N_FLICKS) && ((tm_end - tm_start) > wd->flick_time_limit_ms)) + { /* We consider FLICK as a fast line.ABORT if take too long to finish */ + ev_flag = _set_state(gesture, ELM_GESTURE_STATE_ABORT, &st->info, + EINA_FALSE); + consume_event(wd, event_info, event_type, ev_flag); + return; + } + + switch (event_type) + { + case EVAS_CALLBACK_MOUSE_UP: + case EVAS_CALLBACK_MULTI_UP: + if ((started) && (started == ended)) + { + ev_flag = _set_state(gesture, ELM_GESTURE_STATE_END, + &st->info, EINA_FALSE); + consume_event(wd, event_info, event_type, ev_flag); + } + + return; + + case EVAS_CALLBACK_MOUSE_DOWN: + case EVAS_CALLBACK_MULTI_DOWN: + case EVAS_CALLBACK_MOUSE_MOVE: + case EVAS_CALLBACK_MULTI_MOVE: + if (started) + { + if (wd->glayer_continues_enable && (started == ended)) + { /* For continues gesture */ + ev_flag = _set_state(gesture, ELM_GESTURE_STATE_END, + &st->info, EINA_FALSE); + consume_event(wd, event_info, event_type, ev_flag); + } + else + { /* When continues, may START on MOVE event too */ + Elm_Gesture_State s = ELM_GESTURE_STATE_MOVE; + + /* This happens when: on n > 1 lines then one finger up */ + /* caused abort, then put finger down. */ + /* This will stop line from starting again. */ + /* Number of lines, MUST match touched-device in list */ + if ((!wd->glayer_continues_enable) && + (eina_list_count(st->list) < eina_list_count(wd->touched))) + s = ELM_GESTURE_STATE_ABORT; + + if (gesture->state == ELM_GESTURE_STATE_UNDEFINED) + s = ELM_GESTURE_STATE_START; + + ev_flag = _set_state(gesture, s, &st->info, EINA_TRUE); + consume_event(wd, event_info, event_type, ev_flag); + } + } + break; + + default: + return; /* Unhandeld event type */ + } +} + +/** + * @internal + * + * This function is used to check if rotation gesture started. + * @param st Contains current rotation values from user input. + * @return TRUE/FALSE if we need to set rotation START. + * + * @ingroup Elm_Gesture_Layer + */ +static Eina_Bool +rotation_broke_tolerance(Rotate_Type *st) +{ + if (st->info.base_angle < 0) + return EINA_FALSE; /* Angle has to be computed first */ + + if (st->rotate_angular_tolerance < 0) + return EINA_TRUE; + + double low = st->info.base_angle - st->rotate_angular_tolerance; + double high = st->info.base_angle + st->rotate_angular_tolerance; + double t = st->info.angle; + + if (low < 0) + { + low += 180; + high += 180; + + if (t < 180) + t += 180; + else + t -= 180; + } + + if (high > 360) + { + low -= 180; + high -= 180; + + if (t < 180) + t += 180; + else + t -= 180; + } + +#if defined(DEBUG_GESTURE_LAYER) + printf("%s angle=<%f> low=<%f> high=<%f>\n", __func__, t, low, high); +#endif + if ((t < low) || (t > high)) + { /* This marks that roation action has started */ + st->rotate_angular_tolerance = ELM_GESTURE_NEGATIVE_ANGLE; + st->info.base_angle = st->info.angle; /* Avoid jump in angle value */ + return EINA_TRUE; + } + + return EINA_FALSE; +} + +/** + * @internal + * + * This function is used for computing the gap between fingers. + * It returns the length and center point between fingers. + * + * @param x1 first finger x location. + * @param y1 first finger y location. + * @param x2 second finger x location. + * @param y2 second finger y location. + * @param x Gets center point x cord (output) + * @param y Gets center point y cord (output) + * + * @return length of the line between (x1,y1), (x2,y2) in pixels. + * + * @ingroup Elm_Gesture_Layer + */ +static Evas_Coord +get_finger_gap_length(Evas_Coord xx1, Evas_Coord yy1, + Evas_Coord xx2, Evas_Coord yy2, + Evas_Coord *x, Evas_Coord *y) +{ + double a, b, xx, yy, gap; + xx = fabs(xx2 - xx1); + yy = fabs(yy2 - yy1); + gap = sqrt((xx * xx) + (yy * yy)); + + /* START - Compute zoom center point */ + /* The triangle defined as follows: + * B + * / | + * / | + * gap / | a + * / | + * A-----C + * b + * http://en.wikipedia.org/wiki/Trigonometric_functions + *************************************/ + if (((int)xx) && ((int)yy)) + { + double A = atan((yy / xx)); +#if defined(DEBUG_GESTURE_LAYER) + printf("xx=<%f> yy=<%f> A=<%f>\n", xx, yy, A); +#endif + a = (Evas_Coord) ((gap / 2) * sin(A)); + b = (Evas_Coord) ((gap / 2) * cos(A)); + *x = (Evas_Coord) ((xx2 > xx1) ? (xx1 + b) : (xx2 + b)); + *y = (Evas_Coord) ((yy2 > yy1) ? (yy1 + a) : (yy2 + a)); + } + else + { + if ((int)xx) + { /* horiz line, take half width */ +#if defined(DEBUG_GESTURE_LAYER) + printf("==== HORIZ ====\n"); +#endif + *x = (Evas_Coord) ((xx1 + xx2) / 2); + *y = (Evas_Coord) (yy1); + } + + if ((int)yy) + { /* vert line, take half width */ +#if defined(DEBUG_GESTURE_LAYER) + printf("==== VERT ====\n"); +#endif + *x = (Evas_Coord) (xx1); + *y = (Evas_Coord) ((yy1 + yy2) / 2); + } + } + /* END - Compute zoom center point */ + + return (Evas_Coord) gap; +} + +/** + * @internal + * + * This function is used for computing zoom value. + * + * @param st Pointer to zoom data based on user input. + * @param tm_end Recent input event timestamp. + * @param zoom_val Current computed zoom value. + * + * @return zoom momentum + * + * @ingroup Elm_Gesture_Layer + */ +static double +_zoom_momentum_get(Zoom_Type *st, unsigned int tm_end, double zoom_val) +{ + unsigned int tm_total; + if (!st->m_st_tm) + { /* Init, and we don't start computing momentum yet */ + st->m_st_tm = st->m_prev_tm = tm_end; + st->m_base = zoom_val; + return 0.0; + } + + if ((tm_end - ELM_GESTURE_MOMENTUM_DELAY) < st->m_st_tm) + return 0.0; /* we don't start to compute momentum yet */ + + if (st->dir) + { /* if direction was already defined, check if changed */ + if (((st->dir < 0) && (zoom_val > st->info.zoom)) || + ((st->dir > 0) && (zoom_val < st->info.zoom))) + { /* Direction changed, reset momentum */ + st->m_st_tm = 0; + st->dir = (-st->dir); + return 0.0; + } + } + else + st->dir = (zoom_val > st->info.zoom) ? 1 : -1; /* init */ + + if ((tm_end - ELM_GESTURE_MOMENTUM_TIMEOUT) > st->m_prev_tm) + { + st->m_st_tm = 0; /* Rest momentum when waiting too long */ + return 0.0; + } + + st->m_prev_tm = tm_end; + tm_total = tm_end - st->m_st_tm; + + if (tm_total) + return ((zoom_val - st->m_base) * 1000) / tm_total; + else + return 0.0; +} + +/** + * @internal + * + * This function is used for computing zoom value. + * + * @param st Pointer to zoom data based on user input. + * @param x1 first finger x location. + * @param y1 first finger y location. + * @param x2 second finger x location. + * @param y2 second finger y location. + * @param factor zoom-factor, used to determine how fast zoom works. + * + * @return zoom value, when 1.0 means no zoom, 0.5 half size... + * + * @ingroup Elm_Gesture_Layer + */ +static double +compute_zoom(Zoom_Type *st, + Evas_Coord xx1, Evas_Coord yy1, + Evas_Coord xx2, Evas_Coord yy2, + double zoom_finger_factor) +{ + double rt = 1.0; + unsigned int tm_end = (st->zoom_mv.timestamp > st->zoom_mv1.timestamp) ? + st->zoom_mv.timestamp : st->zoom_mv1.timestamp; + + Evas_Coord diam = get_finger_gap_length(xx1, yy1, xx2, yy2, + &st->info.x, &st->info.y); + + st->info.radius = diam / 2; + + if (!st->zoom_base) + { + st->zoom_base = diam; + return st->info.zoom; + } + + if (st->zoom_distance_tolerance) + { /* zoom tolerance <> ZERO, means zoom action NOT started yet */ + if (diam < (st->zoom_base - st->zoom_distance_tolerance)) + { /* avoid jump with zoom value when break tolerance */ + st->zoom_base -= st->zoom_distance_tolerance; + st->zoom_distance_tolerance = 0; + } + + if (diam > (st->zoom_base + st->zoom_distance_tolerance)) + { /* avoid jump with zoom value when break tolerance */ + st->zoom_base += st->zoom_distance_tolerance; + st->zoom_distance_tolerance = 0; + } + + return rt; + } + + /* We use factor only on the difference between gap-base */ + /* if gap=120, base=100, we get ((120-100)/100)=0.2*factor */ + rt = ((1.0) + ((((float) diam - (float) st->zoom_base) / + (float) st->zoom_base) * zoom_finger_factor)); + + /* Momentum: zoom per second: */ + st->info.momentum = _zoom_momentum_get(st, tm_end, rt); + + return rt; +} + +/** + * @internal + * + * This function handles zoom with mouse wheel. + * thats a combination of wheel + CTRL key. + * @param obj The gesture-layer object. + * @param event_info Original input event pointer. + * @param event_type Type of original input event. + * @param g_type what Gesture we are testing. + * + * @ingroup Elm_Gesture_Layer + */ +static void +_zoom_with_wheel_test(Evas_Object *obj, void *event_info, + Evas_Callback_Type event_type, Elm_Gesture_Type g_type) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (!wd->gesture[g_type]) return; + + Gesture_Info *gesture_zoom = wd->gesture[g_type]; + Zoom_Type *st = gesture_zoom->data; + Evas_Event_Flags ev_flag = EVAS_EVENT_FLAG_NONE; + if (!st) + { /* Allocated once on first time, used for zoom intermediate data */ + st = calloc(1, sizeof(Zoom_Type)); + gesture_zoom->data = st; + _zoom_test_reset(gesture_zoom); + } + + switch (event_type) + { + case EVAS_CALLBACK_KEY_UP: + { + Evas_Event_Key_Up *p = event_info; + if ((!strcmp(p->keyname, "Control_L")) || + (!strcmp(p->keyname, "Control_R"))) + { /* Test if we ended a zoom gesture when releasing CTRL */ + if ((st->zoom_wheel) && + ((gesture_zoom->state == ELM_GESTURE_STATE_START) || + (gesture_zoom->state == ELM_GESTURE_STATE_MOVE))) + { /* User released CTRL after zooming */ + st->info.momentum = _zoom_momentum_get(st, + p->timestamp, st->info.zoom); + + ev_flag = _set_state(gesture_zoom, + ELM_GESTURE_STATE_END, &st->info, EINA_FALSE); + consume_event(wd, event_info, event_type, ev_flag); + + return; + } + } + break; + } + + case EVAS_CALLBACK_MOUSE_WHEEL: + { + Eina_Bool force; + Elm_Gesture_State s; + if (!evas_key_modifier_is_set( + ((Evas_Event_Mouse_Wheel *) event_info)->modifiers, + "Control")) + { /* if using wheel witout CTRL after starting zoom */ + if ((st->zoom_wheel) && + ((gesture_zoom->state == ELM_GESTURE_STATE_START) || + (gesture_zoom->state == ELM_GESTURE_STATE_MOVE))) + { + ev_flag = _set_state(gesture_zoom, + ELM_GESTURE_STATE_END, &st->info, EINA_FALSE); + consume_event(wd, event_info, event_type, ev_flag); + + return; + } + else + return; /* Ignore mouse-wheel without control */ + } + + /* Using mouse wheel with CTRL for zoom */ + if (st->zoom_wheel || (st->zoom_distance_tolerance == 0)) + { /* (zoom_wheel == NULL) and (zoom_distance_tolerance == 0) + we continue a zoom gesture */ + force = EINA_TRUE; + s = ELM_GESTURE_STATE_MOVE; + } + else + { /* On first wheel event, report START */ + Evas_Modifier_Mask mask = evas_key_modifier_mask_get( + evas_object_evas_get(wd->target), "Control"); + force = EINA_FALSE; + s = ELM_GESTURE_STATE_START; + if (!evas_object_key_grab(wd->target, "Control_L", mask, 0, EINA_FALSE)) + ERR("Failed to Grabbed CTRL_L"); + if (!evas_object_key_grab(wd->target, "Control_R", mask, 0, EINA_FALSE)) + ERR("Failed to Grabbed CTRL_R"); + } + + st->zoom_distance_tolerance = 0; /* Cancel tolerance */ + st->zoom_wheel = (Evas_Event_Mouse_Wheel *) event_info; + st->info.x = st->zoom_wheel->canvas.x; + st->info.y = st->zoom_wheel->canvas.y; + + if (st->zoom_wheel->z < 0) /* zoom in */ + st->info.zoom += (wd->zoom_finger_factor * wd->zoom_wheel_factor); + + if (st->zoom_wheel->z > 0) /* zoom out */ + st->info.zoom -= (wd->zoom_finger_factor * wd->zoom_wheel_factor); + + if (st->info.zoom < 0.0) + st->info.zoom = 0.0; + + st->info.momentum = _zoom_momentum_get(st, + st->zoom_wheel->timestamp, st->info.zoom); + + ev_flag = _set_state(gesture_zoom, s, &st->info, force); + consume_event(wd, event_info, event_type, ev_flag); + break; + } + + default: + return; + } +} + +/** + * @internal + * + * This function is used to test zoom gesture. + * user may combine zoom, rotation together. + * so its possible that both will be detected from input. + * (both are two-finger movement-oriented gestures) + * + * @param obj The gesture-layer object. + * @param event_info Pointer to recent input event. + * @param event_type Recent input event type. + * @param g_type what Gesture we are testing. + * + * @ingroup Elm_Gesture_Layer + */ +static void +_zoom_test(Evas_Object *obj, Pointer_Event *pe, void *event_info, + Evas_Callback_Type event_type, Elm_Gesture_Type g_type) +{ + if (!pe) + return; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (!wd->gesture[g_type]) return; + + Gesture_Info *gesture_zoom = wd->gesture[g_type]; + Zoom_Type *st = gesture_zoom->data; + + if (!st) + { /* Allocated once on first time, used for zoom data */ + st = calloc(1, sizeof(Zoom_Type)); + gesture_zoom->data = st; + _zoom_test_reset(gesture_zoom); + } + + + /* Start - new zoom testing, letting all fingers start */ + Evas_Event_Flags ev_flag = EVAS_EVENT_FLAG_NONE; + switch (event_type) + { + case EVAS_CALLBACK_MOUSE_MOVE: + case EVAS_CALLBACK_MULTI_MOVE: + /* if non-continues mode and gesture NOT started, ignore MOVE */ + if ((!wd->glayer_continues_enable) && + (!st->zoom_st.timestamp)) + return; + + case EVAS_CALLBACK_MOUSE_DOWN: + case EVAS_CALLBACK_MULTI_DOWN: + { /* Here we take care of zoom-start and zoom move */ + Eina_List *l; + Pointer_Event *p; + + if (eina_list_count(wd->touched) > 2) + { /* Process zoom only when 2 fingers on surface */ + ev_flag = _set_state(gesture_zoom, + ELM_GESTURE_STATE_ABORT, &st->info, EINA_FALSE); + consume_event(wd, event_info, event_type, ev_flag); + + return; + } + + if (!st->zoom_st.timestamp) + { /* Now scan touched-devices list and find other finger */ + EINA_LIST_FOREACH(wd->touched, l, p) + { /* Device of other finger <> pe device */ + if (p->device != pe->device) + break; + } + + if (!p) /* Single finger on touch */ + return; + + /* Record down fingers */ + consume_event(wd, event_info, event_type, ev_flag); + memcpy(&st->zoom_st, pe, sizeof(Pointer_Event)); + memcpy(&st->zoom_st1, p, sizeof(Pointer_Event)); + + /* Set mv field as well to be ready for MOVE events */ + memcpy(&st->zoom_mv, pe, sizeof(Pointer_Event)); + memcpy(&st->zoom_mv1, p, sizeof(Pointer_Event)); + + /* Here we have zoom_st, zoom_st1 set, report START */ + /* Set zoom-base after BOTH down events recorded */ + /* Compute length of line between fingers zoom start */ + st->info.zoom = 1.0; + st->zoom_base = get_finger_gap_length(st->zoom_st1.x, + st->zoom_st1.y, st->zoom_st.x, st->zoom_st.y, + &st->info.x, &st->info.y); + + st->info.radius = st->zoom_base / 2; + + if ((gesture_zoom->state != ELM_GESTURE_STATE_START) && + (gesture_zoom->state != ELM_GESTURE_STATE_MOVE)) + { /* zoom started with mouse-wheel, don't report twice */ + ev_flag = _set_state(gesture_zoom, + ELM_GESTURE_STATE_START, &st->info, EINA_FALSE); + consume_event(wd, event_info, event_type, ev_flag); + } + + return; /* Zoom started */ + } /* End of ZOOM_START handling */ + + + /* if we got here, we have (exacally) two fingers on surfce */ + /* we also after START, report MOVE */ + /* First detect which finger moved */ + if (pe->device == st->zoom_mv.device) + memcpy(&st->zoom_mv, pe, sizeof(Pointer_Event)); + else if (pe->device == st->zoom_mv1.device) + memcpy(&st->zoom_mv1, pe, sizeof(Pointer_Event)); + + /* Compute change in zoom as fingers move */ + st->info.zoom = compute_zoom(st, + st->zoom_mv.x, st->zoom_mv.y, + st->zoom_mv1.x, st->zoom_mv1.y, + wd->zoom_finger_factor); + + if (!st->zoom_distance_tolerance) + { /* Zoom broke tolerance, report move */ + double d = st->info.zoom - st->next_step; + if (d < 0.0) + d = (-d); + + if (d >= wd->zoom_step) + { /* Report move in steps */ + st->next_step = st->info.zoom; + + ev_flag = _set_state(gesture_zoom, + ELM_GESTURE_STATE_MOVE, + &st->info, EINA_TRUE); + consume_event(wd, event_info, event_type, ev_flag); + } + } /* End of ZOOM_MOVE handling */ + + return; + } + + case EVAS_CALLBACK_MOUSE_UP: + case EVAS_CALLBACK_MULTI_UP: + /* Reset timestamp of finger-up.This is used later + by _zoom_test_reset() to retain finger-down data */ + consume_event(wd, event_info, event_type, ev_flag); + if (((st->zoom_wheel) || (st->zoom_base)) && + (st->zoom_distance_tolerance == 0)) + { + ev_flag = _set_state(gesture_zoom, ELM_GESTURE_STATE_END, + &st->info, EINA_FALSE); + consume_event(wd, event_info, event_type, ev_flag); + + return; + } + + /* if we got here not a ZOOM */ + if (gesture_zoom->state != ELM_GESTURE_STATE_UNDEFINED) + { /* Must be != undefined, if gesture started */ + ev_flag = _set_state(gesture_zoom, + ELM_GESTURE_STATE_ABORT, &st->info, EINA_FALSE); + consume_event(wd, event_info, event_type, ev_flag); + } + + _zoom_test_reset(gesture_zoom); + + return; + + default: + return; + } +} + +static void +_get_rotate_properties(Rotate_Type *st, + Evas_Coord xx1, Evas_Coord yy1, + Evas_Coord xx2, Evas_Coord yy2, + double *angle) +{ /* FIXME: Fix momentum computation, it's wrong */ + double prev_angle = *angle; + st->info.radius = get_finger_gap_length(xx1, yy1, xx2, yy2, + &st->info.x, &st->info.y) / 2; + + *angle = get_angle(xx1, yy1, xx2, yy2); + + if (angle == &st->info.angle) + { /* Fingers are moving, compute momentum */ + unsigned int tm_start = + (st->rotate_st.timestamp > st->rotate_st1.timestamp) + ? st->rotate_st.timestamp : st->rotate_st1.timestamp; + unsigned int tm_end = + (st->rotate_mv.timestamp > st->rotate_mv1.timestamp) + ? st->rotate_mv.timestamp : st->rotate_mv1.timestamp; + + unsigned int tm_total = tm_end - tm_start; + if (tm_total) + { /* Momentum computed as: + accumulated roation angle (deg) divided by time */ + double m = 0;; + if (((prev_angle < 90) && ((*angle) > 270)) || + ((prev_angle > 270) && ((*angle) < 90))) + { /* We circle passing ZERO point */ + prev_angle = (*angle); + } + else m = prev_angle - (*angle); + + st->accum_momentum += m; + + if ((tm_end - st->prev_momentum_tm) < 100) + st->prev_momentum += m; + else + { + if (fabs(st->prev_momentum) < 0.002) + st->accum_momentum = 0.0; /* reset momentum */ + + st->prev_momentum = 0.0; /* Start again */ + } + + st->prev_momentum_tm = tm_end; + st->info.momentum = (st->accum_momentum * 1000) / tm_total; + } + } + else + st->info.momentum = 0; +} + +/** + * @internal + * + * This function is used to test rotation gesture. + * user may combine zoom, rotation together. + * so its possible that both will be detected from input. + * (both are two-finger movement-oriented gestures) + * + * @param obj The gesture-layer object. + * @param event_info Pointer to recent input event. + * @param event_type Recent input event type. + * @param g_type what Gesture we are testing. + * + * @ingroup Elm_Gesture_Layer + */ +static void +_rotate_test(Evas_Object *obj, Pointer_Event *pe, void *event_info, + Evas_Callback_Type event_type, Elm_Gesture_Type g_type) +{ + if (!pe) + return; + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (!wd->gesture[g_type]) return; + + Gesture_Info *gesture = wd->gesture[g_type]; + Rotate_Type *st; + if (gesture) + { + st = gesture->data; + if (!st) + { /* Allocated once on first time */ + st = calloc(1, sizeof(Rotate_Type)); + gesture->data = st; + _rotate_test_reset(gesture); + } + } + + Evas_Event_Flags ev_flag = EVAS_EVENT_FLAG_NONE; + switch (event_type) + { + case EVAS_CALLBACK_MOUSE_MOVE: + case EVAS_CALLBACK_MULTI_MOVE: + /* if non-continues mode and gesture NOT started, ignore MOVE */ + if ((!wd->glayer_continues_enable) && + (!st->rotate_st.timestamp)) + return; + + case EVAS_CALLBACK_MOUSE_DOWN: + case EVAS_CALLBACK_MULTI_DOWN: + { /* Here we take care of rotate-start and rotate move */ + Eina_List *l; + Pointer_Event *p; + + if (eina_list_count(wd->touched) > 2) + { /* Process rotate only when 2 fingers on surface */ + ev_flag = _set_state(gesture, + ELM_GESTURE_STATE_ABORT, &st->info, EINA_FALSE); + consume_event(wd, event_info, event_type, ev_flag); + + return; + } + + if (!st->rotate_st.timestamp) + { /* Now scan touched-devices list and find other finger */ + EINA_LIST_FOREACH(wd->touched, l, p) + { /* Device of other finger <> pe device */ + if (p->device != pe->device) + break; + } + + if (!p) + return; /* Single finger on touch */ + + /* Record down fingers */ + consume_event(wd, event_info, event_type, ev_flag); + memcpy(&st->rotate_st, pe, sizeof(Pointer_Event)); + memcpy(&st->rotate_st1, p, sizeof(Pointer_Event)); + + /* Set mv field as well to be ready for MOVE events */ + memcpy(&st->rotate_mv, pe, sizeof(Pointer_Event)); + memcpy(&st->rotate_mv1, p, sizeof(Pointer_Event)); + + /* Here we have rotate_st, rotate_st1 set, report START */ + /* Set rotate-base after BOTH down events recorded */ + /* Compute length of line between fingers rotate start */ + _get_rotate_properties(st, + st->rotate_st.x, st->rotate_st.y, + st->rotate_st1.x, st->rotate_st1.y, + &st->info.base_angle); + + ev_flag = _set_state(gesture, ELM_GESTURE_STATE_START, + &st->info, EINA_FALSE); + consume_event(wd, event_info, event_type, ev_flag); + + return; /* Rotate started */ + } /* End of ROTATE_START handling */ + + + /* if we got here, we have (exacally) two fingers on surfce */ + /* we also after START, report MOVE */ + /* First detect which finger moved */ + if (pe->device == st->rotate_mv.device) + memcpy(&st->rotate_mv, pe, sizeof(Pointer_Event)); + else if (pe->device == st->rotate_mv1.device) + memcpy(&st->rotate_mv1, pe, sizeof(Pointer_Event)); + + /* Compute change in rotate as fingers move */ + _get_rotate_properties(st, + st->rotate_mv.x, st->rotate_mv.y, + st->rotate_mv1.x, st->rotate_mv1.y, + &st->info.angle); + + if (rotation_broke_tolerance(st)) + { /* Rotation broke tolerance, report move */ + double d = st->info.angle - st->next_step; + if (d < 0) + d = (-d); + + if (d >= wd->rotate_step) + { /* Report move in steps */ + st->next_step = st->info.angle; + + ev_flag = _set_state(gesture, + ELM_GESTURE_STATE_MOVE, &st->info, EINA_TRUE); + consume_event(wd, event_info, event_type, ev_flag); + } + } /* End of ROTATE_MOVE handling */ + + return; + } + + case EVAS_CALLBACK_MOUSE_UP: + case EVAS_CALLBACK_MULTI_UP: + consume_event(wd, event_info, event_type, ev_flag); + /* Reset timestamp of finger-up.This is used later + by rotate_test_reset() to retain finger-down data */ + if (st->rotate_angular_tolerance < 0) + { + ev_flag = _set_state(gesture, ELM_GESTURE_STATE_END, + &st->info, EINA_FALSE); + consume_event(wd, event_info, event_type, ev_flag); + + return; + } + + if (gesture->state != ELM_GESTURE_STATE_UNDEFINED) + { /* Must be != undefined, if gesture started */ + ev_flag = _set_state(gesture, ELM_GESTURE_STATE_ABORT, + &st->info, EINA_FALSE); + consume_event(wd, event_info, event_type, ev_flag); + } + + _rotate_test_reset(gesture); + return; + + default: + return; + } +} + +/** + * @internal + * + * This function is used to save input events in an abstract struct + * to be used later by getsure-testing functions. + * + * @param data The gesture-layer object. + * @param event_info Pointer to recent input event. + * @param event_type Recent input event type. + * @param pe The abstract data-struct (output). + * + * @ingroup Elm_Gesture_Layer + */ +static Eina_Bool +_make_pointer_event(void *data, void *event_info, + Evas_Callback_Type event_type, Pointer_Event *pe) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return EINA_FALSE; + + memset(pe, '\0', sizeof(*pe)); + switch (event_type) + { + case EVAS_CALLBACK_MOUSE_DOWN: + pe->x = ((Evas_Event_Mouse_Down *) event_info)->canvas.x; + pe->y = ((Evas_Event_Mouse_Down *) event_info)->canvas.y; + pe->timestamp = ((Evas_Event_Mouse_Down *) event_info)->timestamp; + pe->device = ELM_MOUSE_DEVICE; + break; + + case EVAS_CALLBACK_MOUSE_UP: + pe->x = ((Evas_Event_Mouse_Up *) event_info)->canvas.x; + pe->y = ((Evas_Event_Mouse_Up *) event_info)->canvas.y; + pe->timestamp = ((Evas_Event_Mouse_Up *) event_info)->timestamp; + pe->device = ELM_MOUSE_DEVICE; + break; + + case EVAS_CALLBACK_MOUSE_MOVE: + pe->x = ((Evas_Event_Mouse_Move *) event_info)->cur.canvas.x; + pe->y = ((Evas_Event_Mouse_Move *) event_info)->cur.canvas.y; + pe->timestamp = ((Evas_Event_Mouse_Move *) event_info)->timestamp; + pe->device = ELM_MOUSE_DEVICE; + break; + + case EVAS_CALLBACK_MULTI_DOWN: + pe->x = ((Evas_Event_Multi_Down *) event_info)->canvas.x; + pe->y = ((Evas_Event_Multi_Down *) event_info)->canvas.y; + pe->timestamp = ((Evas_Event_Multi_Down *) event_info)->timestamp; + pe->device = ((Evas_Event_Multi_Down *) event_info)->device; + break; + + case EVAS_CALLBACK_MULTI_UP: + pe->x = ((Evas_Event_Multi_Up *) event_info)->canvas.x; + pe->y = ((Evas_Event_Multi_Up *) event_info)->canvas.y; + pe->timestamp = ((Evas_Event_Multi_Up *) event_info)->timestamp; + pe->device = ((Evas_Event_Multi_Up *) event_info)->device; + break; + + case EVAS_CALLBACK_MULTI_MOVE: + pe->x = ((Evas_Event_Multi_Move *) event_info)->cur.canvas.x; + pe->y = ((Evas_Event_Multi_Move *) event_info)->cur.canvas.y; + pe->timestamp = ((Evas_Event_Multi_Move *) event_info)->timestamp; + pe->device = ((Evas_Event_Multi_Move *) event_info)->device; + break; + + default: + return EINA_FALSE; + } + + pe->event_type = event_type; + return EINA_TRUE; +} + +/** + * @internal + * + * This function restartes line, flick, zoom and rotate gestures + * when gesture-layer continues-gestures enabled. + * Example of continues-gesture: + * When doing a line, user stops moving finger but keeps fingers on touch. + * This will cause line-end, then as user continues moving his finger + * it re-starts line gesture. + * When continue mode is disabled, user has to lift finger from touch + * to end a gesture. Them touch-again to start a new one. + * + * @param data The gesture-layer object. + * @param wd gesture layer widget data. + * @param states_reset flag that marks gestures were reset in history clear. + * + * @ingroup Elm_Gesture_Layer + */ +static void +continues_gestures_restart(void *data, Eina_Bool states_reset) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + + /* Run through events to restart gestures */ + Gesture_Info *g; + Eina_Bool n_momentum, n_lines, n_flicks, zoom, rotate; + /* We turn-on flag for finished, aborted, not-started gestures */ + g = wd->gesture[ELM_GESTURE_MOMENTUM]; + n_momentum = (g) ? ((states_reset) | ((g->state != ELM_GESTURE_STATE_START) + && (g->state != ELM_GESTURE_STATE_MOVE))) : EINA_FALSE; + if (n_momentum) + { + _momentum_test_reset(wd->gesture[ELM_GESTURE_MOMENTUM]); + _set_state(g, ELM_GESTURE_STATE_UNDEFINED, NULL, EINA_FALSE); + SET_TEST_BIT(g); + } + + g = wd->gesture[ELM_GESTURE_N_LINES]; + n_lines = (g) ? ((states_reset) | ((g->state != ELM_GESTURE_STATE_START) + && (g->state != ELM_GESTURE_STATE_MOVE))) : EINA_FALSE; + if (n_lines) + { + _line_test_reset(wd->gesture[ELM_GESTURE_N_LINES]); + _set_state(g, ELM_GESTURE_STATE_UNDEFINED, NULL, EINA_FALSE); + SET_TEST_BIT(g); + } + + g = wd->gesture[ELM_GESTURE_N_FLICKS]; + n_flicks = (g) ? ((states_reset) | ((g->state != ELM_GESTURE_STATE_START) + && (g->state != ELM_GESTURE_STATE_MOVE))) : EINA_FALSE; + if (n_flicks) + { + _line_test_reset(wd->gesture[ELM_GESTURE_N_FLICKS]); + _set_state(g, ELM_GESTURE_STATE_UNDEFINED, NULL, EINA_FALSE); + SET_TEST_BIT(g); + } + + g = wd->gesture[ELM_GESTURE_ZOOM]; + zoom = (g) ? ((states_reset) | ((g->state != ELM_GESTURE_STATE_START) + && (g->state != ELM_GESTURE_STATE_MOVE))) : EINA_FALSE; + if (zoom) + { + _zoom_test_reset(wd->gesture[ELM_GESTURE_ZOOM]); + _set_state(g, ELM_GESTURE_STATE_UNDEFINED, NULL, EINA_FALSE); + SET_TEST_BIT(g); + } + + g = wd->gesture[ELM_GESTURE_ROTATE]; + rotate = (g) ? ((states_reset) | ((g->state != ELM_GESTURE_STATE_START) + && (g->state != ELM_GESTURE_STATE_MOVE))) : EINA_FALSE; + if (rotate) + { + _rotate_test_reset(wd->gesture[ELM_GESTURE_ROTATE]); + _set_state(g, ELM_GESTURE_STATE_UNDEFINED, NULL, EINA_FALSE); + SET_TEST_BIT(g); + } +} + +/** + * @internal + * + * This function the core-function where input handling is done. + * Here we get user input and stream it to gesture testing. + * We notify user about any gestures with new state: + * Valid states are: + * START - gesture started. + * MOVE - gesture is ongoing. + * END - gesture was completed. + * ABORT - gesture was aborted after START, MOVE (will NOT be completed) + * + * We also check if a gesture was detected, then reset event history + * If no gestures were found we reset gesture test flag + * after streaming event-history to widget. + * (stream to the widget all events not consumed as a gesture) + * + * @param data The gesture-layer object. + * @param event_info Pointer to recent input event. + * @param event_type Recent input event type. + * + * @ingroup Elm_Gesture_Layer + */ +static void +_event_process(void *data, Evas_Object *obj __UNUSED__, + void *event_info, Evas_Callback_Type event_type) +{ + Pointer_Event _pe; + Pointer_Event *pe = NULL; + Widget_Data *wd = elm_widget_data_get(data); + +#if defined(DEBUG_GESTURE_LAYER) + int i; + Gesture_Info *g; + printf("Gesture | State | is tested\n"); + for (i = ELM_GESTURE_N_TAPS; i < ELM_GESTURE_LAST; i++) + { + g = wd->gesture[i]; + if (g) + printf(" %d %d %d\n", i, g->state, g->test); + } +#endif + + /* Start testing candidate gesture from here */ + if (_make_pointer_event(data, event_info, event_type, &_pe)) + pe = &_pe; + + if (IS_TESTED(ELM_GESTURE_N_LONG_TAPS)) + _n_long_tap_test(data, pe, event_info, event_type, + ELM_GESTURE_N_LONG_TAPS); + + /* This takes care of single, double and tripple tap */ + _tap_gestures_test(data, pe, event_info, event_type); + + if (IS_TESTED(ELM_GESTURE_MOMENTUM)) + _momentum_test(data, pe, event_info, event_type, + ELM_GESTURE_MOMENTUM); + + if (IS_TESTED(ELM_GESTURE_N_LINES)) + _n_line_test(data, pe, event_info, event_type, ELM_GESTURE_N_LINES); + + if (IS_TESTED(ELM_GESTURE_N_FLICKS)) + _n_line_test(data, pe, event_info, event_type, ELM_GESTURE_N_FLICKS); + + if (_elm_config->glayer_zoom_finger_enable && IS_TESTED(ELM_GESTURE_ZOOM)) + _zoom_test(data, pe, event_info, event_type, ELM_GESTURE_ZOOM); + + if (IS_TESTED(ELM_GESTURE_ZOOM)) + _zoom_with_wheel_test(data, event_info, event_type, ELM_GESTURE_ZOOM); + + if (_elm_config->glayer_rotate_finger_enable && IS_TESTED(ELM_GESTURE_ROTATE)) + _rotate_test(data, pe, event_info, event_type, ELM_GESTURE_ROTATE); + + if (_get_event_flag(event_info, event_type) & EVAS_EVENT_FLAG_ON_HOLD) + _event_history_add(data, event_info, event_type); + else if ((event_type == EVAS_CALLBACK_MOUSE_UP) || + (event_type == EVAS_CALLBACK_MULTI_UP)) + { + Eina_List *pending = _device_is_pending(wd->pending, event_info, event_type); + if (pending) + { + consume_event(wd, event_info, event_type, EVAS_EVENT_FLAG_ON_HOLD); + _event_history_add(data, event_info, event_type); + } + } + + /* we maintain list of touched devices */ + /* We also use move to track current device x.y pos */ + if ((event_type == EVAS_CALLBACK_MOUSE_DOWN) || + (event_type == EVAS_CALLBACK_MULTI_DOWN) || + (event_type == EVAS_CALLBACK_MOUSE_MOVE) || + (event_type == EVAS_CALLBACK_MULTI_MOVE)) + { + wd->touched = _add_touched_device(wd->touched, pe); + } + else if ((event_type == EVAS_CALLBACK_MOUSE_UP) || + (event_type == EVAS_CALLBACK_MULTI_UP)) + { + wd->touched = _remove_touched_device(wd->touched, pe); + } + + /* Report current states and clear history if needed */ + Eina_Bool states_reset = _clear_if_finished(data); + if (wd->glayer_continues_enable) + continues_gestures_restart(data, states_reset); +} + + +/** + * For all _mouse_* / multi_* functions wethen send this event to + * _event_process function. + * + * @param data The gesture-layer object. + * @param event_info Pointer to recent input event. + * + * @ingroup Elm_Gesture_Layer + */ +static void +_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, + void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + if (((Evas_Event_Mouse_Down *) event_info)->button != 1) + return; /* We only process left-click at the moment */ + + _event_process(data, obj, event_info, EVAS_CALLBACK_MOUSE_DOWN); +} + +static void +_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, + void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + + _event_process(data, obj, event_info, EVAS_CALLBACK_MOUSE_MOVE); +} + +static void +_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, + void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + + _event_process(data, obj, event_info, EVAS_CALLBACK_KEY_DOWN); +} + +static void +_key_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, + void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + + _event_process(data, obj, event_info, EVAS_CALLBACK_KEY_UP); +} + +static void +_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, + void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + + if (((Evas_Event_Mouse_Up *) event_info)->button != 1) + return; /* We only process left-click at the moment */ + + _event_process(data, obj, event_info, EVAS_CALLBACK_MOUSE_UP); +} + +static void +_mouse_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, + void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + + _event_process(data, obj, event_info, EVAS_CALLBACK_MOUSE_WHEEL); +} + +static void +_multi_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, + void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + + _event_process(data, obj, event_info, EVAS_CALLBACK_MULTI_DOWN); +} + +static void +_multi_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, + void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + + _event_process(data, obj, event_info, EVAS_CALLBACK_MULTI_MOVE); +} + +static void +_multi_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, + void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + + _event_process(data, obj, event_info, EVAS_CALLBACK_MULTI_UP); +} + +EAPI Eina_Bool +elm_gesture_layer_hold_events_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + return !wd->repeat_events; +} + +EAPI void +elm_gesture_layer_hold_events_set(Evas_Object *obj, Eina_Bool hold_events) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + wd->repeat_events = !(!!hold_events); +} + +EAPI double +elm_gesture_layer_zoom_step_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; + + return wd->zoom_step; +} + +EAPI void +elm_gesture_layer_zoom_step_set(Evas_Object *obj, double step) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (step < 0) return; + + wd->zoom_step = step; +} + +EAPI double +elm_gesture_layer_rotate_step_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; + + return wd->rotate_step; +} + +EAPI void +elm_gesture_layer_rotate_step_set(Evas_Object *obj, double step) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (step < 0) return; + + wd->rotate_step = step; +} + +EAPI Eina_Bool +elm_gesture_layer_attach(Evas_Object *obj, Evas_Object *target) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + if (!target) return EINA_FALSE; + + /* if was attached before, unregister callbacks first */ + if (wd->target) + _unregister_callbacks(obj); + + wd->target = target; + + _register_callbacks(obj); + return EINA_TRUE; +} + +EAPI void +elm_gesture_layer_cb_set(Evas_Object *obj, Elm_Gesture_Type idx, + Elm_Gesture_State cb_type, Elm_Gesture_Event_Cb cb, void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + + Widget_Data *wd = elm_widget_data_get(obj); + Gesture_Info *p; + if (!wd) return; + + if (!wd->gesture[idx]) + wd->gesture[idx] = calloc(1, sizeof(Gesture_Info)); + if (!wd->gesture[idx]) return; + + p = wd->gesture[idx]; + p->obj = obj; + p->g_type = idx; + p->fn[cb_type].cb = cb; + p->fn[cb_type].user_data = data; + p->state = ELM_GESTURE_STATE_UNDEFINED; + SET_TEST_BIT(p); +} + +static void +_disable_hook(Evas_Object *obj) +{ + if (elm_widget_disabled_get(obj)) + _unregister_callbacks(obj); + else + _register_callbacks(obj); +} + +EAPI Evas_Object * +elm_gesture_layer_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "gesture_layer"); + elm_widget_type_set(obj, "gesture_layer"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_disable_hook_set(obj, _disable_hook); + + wd->target = NULL; + wd->line_min_length =_elm_config->glayer_line_min_length * _elm_config->finger_size; + wd->zoom_distance_tolerance = _elm_config->glayer_zoom_distance_tolerance * _elm_config->finger_size; + wd->line_distance_tolerance = _elm_config->glayer_line_distance_tolerance * _elm_config->finger_size; + wd->zoom_finger_factor = _elm_config->glayer_zoom_finger_factor; + wd->zoom_wheel_factor = _elm_config->glayer_zoom_wheel_factor; /* mouse wheel zoom steps */ + wd->rotate_angular_tolerance = _elm_config->glayer_rotate_angular_tolerance; + wd->line_angular_tolerance = _elm_config->glayer_line_angular_tolerance; + wd->flick_time_limit_ms = _elm_config->glayer_flick_time_limit_ms; + wd->long_tap_start_timeout = _elm_config->glayer_long_tap_start_timeout; + wd->repeat_events = EINA_TRUE; + wd->glayer_continues_enable = _elm_config->glayer_continues_enable; + +#if defined(DEBUG_GESTURE_LAYER) + printf("size of Gestures = <%d>\n", sizeof(wd->gesture)); + printf("initial values:\n\tzoom_finger_factor=<%f>\n\tzoom_distance_tolerance=<%d>\n\tline_min_length=<%d>\n\tline_distance_tolerance=<%d>\n\tzoom_wheel_factor=<%f>\n\trotate_angular_tolerance=<%f>\n\twd->line_angular_tolerance=<%f>\n\twd->flick_time_limit_ms=<%d>\n\twd->long_tap_start_timeout=<%f>\n\twd->zoom_step=<%f>\n\twd->rotate_step=<%f>\n\twd->glayer_continues_enable=<%d>\n ", wd->zoom_finger_factor, wd->zoom_distance_tolerance, wd->line_min_length, wd->line_distance_tolerance, wd->zoom_wheel_factor, wd->rotate_angular_tolerance, wd->line_angular_tolerance, wd->flick_time_limit_ms, wd->long_tap_start_timeout, wd->zoom_step, wd->rotate_step, wd->glayer_continues_enable); +#endif + memset(wd->gesture, 0, sizeof(wd->gesture)); + + return obj; +} diff --git a/libraries/elementary/src/lib/elm_gesture_layer.h b/libraries/elementary/src/lib/elm_gesture_layer.h new file mode 100644 index 0000000..b24babb --- /dev/null +++ b/libraries/elementary/src/lib/elm_gesture_layer.h @@ -0,0 +1,336 @@ +/** + * @defgroup Elm_Gesture_Layer Gesture Layer + * @ingroup Elementary + * + * Gesture Layer Usage: + * + * Use Gesture Layer to detect gestures. + * The advantage is that you don't have to implement + * gesture detection, just set callbacks of gesture state. + * By using gesture layer we make standard interface. + * + * In order to use Gesture Layer you start with @ref elm_gesture_layer_add + * with a parent object parameter. + * Next 'activate' gesture layer with a @ref elm_gesture_layer_attach + * call. Usually with same object as target (2nd parameter). + * + * Now you need to tell gesture layer what gestures you follow. + * This is done with @ref elm_gesture_layer_cb_set call. + * By setting the callback you actually saying to gesture layer: + * I would like to know when the gesture @ref Elm_Gesture_Type + * switches to state @ref Elm_Gesture_State. + * + * Next, you need to implement the actual action that follows the input + * in your callback. + * + * Note that if you like to stop being reported about a gesture, just set + * all callbacks referring this gesture to NULL. + * (again with @ref elm_gesture_layer_cb_set) + * + * The information reported by gesture layer to your callback is depending + * on @ref Elm_Gesture_Type: + * @ref Elm_Gesture_Taps_Info is the info reported for tap gestures: + * @ref ELM_GESTURE_N_TAPS, @ref ELM_GESTURE_N_LONG_TAPS, + * @ref ELM_GESTURE_N_DOUBLE_TAPS, @ref ELM_GESTURE_N_TRIPLE_TAPS. + * + * @ref Elm_Gesture_Momentum_Info is info reported for momentum gestures: + * @ref ELM_GESTURE_MOMENTUM. + * + * @ref Elm_Gesture_Line_Info is the info reported for line gestures: + * (this also contains @ref Elm_Gesture_Momentum_Info internal structure) + * @ref ELM_GESTURE_N_LINES, @ref ELM_GESTURE_N_FLICKS. + * Note that we consider a flick as a line-gesture that should be completed + * in flick-time-limit as defined in @ref Config. + * + * @ref Elm_Gesture_Zoom_Info is the info reported for @ref ELM_GESTURE_ZOOM gesture. + * + * @ref Elm_Gesture_Rotate_Info is the info reported for @ref ELM_GESTURE_ROTATE gesture. + * + * + * Gesture Layer Tweaks: + * + * Note that line, flick, gestures can start without the need to remove fingers from surface. + * When user fingers rests on same-spot gesture is ended and starts again when fingers moved. + * + * Setting glayer_continues_enable to false in @ref Config will change this behavior + * so gesture starts when user touches (a *DOWN event) touch-surface + * and ends when no fingers touches surface (a *UP event). + * + * Supported elm_object common APIs. + * @li @ref elm_object_disabled_set + * @li @ref elm_object_disabled_get + * + */ + +/** + * Enum of supported gesture types. + * @ingroup Elm_Gesture_Layer + */ +typedef enum +{ + ELM_GESTURE_FIRST = 0, + + ELM_GESTURE_N_TAPS, /**< N fingers single taps */ + ELM_GESTURE_N_LONG_TAPS, /**< N fingers single long-taps */ + ELM_GESTURE_N_DOUBLE_TAPS, /**< N fingers double-single taps */ + ELM_GESTURE_N_TRIPLE_TAPS, /**< N fingers triple-single taps */ + + ELM_GESTURE_MOMENTUM, /**< Reports momentum in the direction of move */ + + ELM_GESTURE_N_LINES, /**< N fingers line gesture */ + ELM_GESTURE_N_FLICKS, /**< N fingers flick gesture */ + + ELM_GESTURE_ZOOM, /**< Zoom */ + ELM_GESTURE_ROTATE, /**< Rotate */ + + ELM_GESTURE_LAST +} Elm_Gesture_Type; + +/** + * @enum _Elm_Gesture_State + * Enum of gesture states. + * @ingroup Elm_Gesture_Layer + */ +typedef enum +{ + ELM_GESTURE_STATE_UNDEFINED = -1, /**< Gesture not STARTed */ + ELM_GESTURE_STATE_START, /**< Gesture STARTed */ + ELM_GESTURE_STATE_MOVE, /**< Gesture is ongoing */ + ELM_GESTURE_STATE_END, /**< Gesture completed */ + ELM_GESTURE_STATE_ABORT /**< Ongoing gesture was ABORTed */ +} Elm_Gesture_State; + +/** + * @struct _Elm_Gesture_Taps_Info + * Struct holds taps info for user + * @ingroup Elm_Gesture_Layer + */ +struct _Elm_Gesture_Taps_Info +{ + Evas_Coord x, y; /**< Holds center point between fingers */ + unsigned int n; /**< Number of fingers tapped */ + unsigned int timestamp; /**< event timestamp */ +}; + +/** + * @typedef Elm_Gesture_Taps_Info + * holds taps info for user + * @ingroup Elm_Gesture_Layer + */ +typedef struct _Elm_Gesture_Taps_Info Elm_Gesture_Taps_Info; + +/** + * @struct _Elm_Gesture_Momentum_Info + * Struct holds momentum info for user + * x1 and y1 are not necessarily in sync + * x1 holds x value of x direction starting point + * and same holds for y1. + * This is noticeable when doing V-shape movement + * @ingroup Elm_Gesture_Layer + */ +struct _Elm_Gesture_Momentum_Info /* Report line ends, timestamps, and momentum computed */ +{Evas_Coord x1; /**< Final-swipe direction starting point on X */ + Evas_Coord y1; /**< Final-swipe direction starting point on Y */ + Evas_Coord x2; /**< Final-swipe direction ending point on X */ + Evas_Coord y2; /**< Final-swipe direction ending point on Y */ + + unsigned int tx; /**< Timestamp of start of final x-swipe */ + unsigned int ty; /**< Timestamp of start of final y-swipe */ + + Evas_Coord mx; /**< Momentum on X */ + Evas_Coord my; /**< Momentum on Y */ + + unsigned int n; /**< Number of fingers */ +}; + +/** + * @typedef Elm_Gesture_Momentum_Info + * holds momentum info for user + * @ingroup Elm_Gesture_Layer + */ +typedef struct _Elm_Gesture_Momentum_Info Elm_Gesture_Momentum_Info; + +/** + * @struct _Elm_Gesture_Line_Info + * Struct holds line info for user + * @ingroup Elm_Gesture_Layer + */ +struct _Elm_Gesture_Line_Info /* Report line ends, timestamps, and momentum computed */ +{Elm_Gesture_Momentum_Info momentum; /**< Line momentum info */ + double angle; /**< Angle (direction) of lines */ +}; + +/** + * @typedef Elm_Gesture_Line_Info + * Holds line info for user + * @ingroup Elm_Gesture_Layer + */ +typedef struct _Elm_Gesture_Line_Info Elm_Gesture_Line_Info; + +/** + * @struct _Elm_Gesture_Zoom_Info + * Struct holds zoom info for user + * @ingroup Elm_Gesture_Layer + */ +struct _Elm_Gesture_Zoom_Info +{ + Evas_Coord x, y; /**< Holds zoom center point reported to user */ + Evas_Coord radius; /**< Holds radius between fingers reported to user */ + double zoom; /**< Zoom value: 1.0 means no zoom */ + double momentum; /**< Zoom momentum: zoom growth per second (NOT YET SUPPORTED) */ +}; + +/** + * @typedef Elm_Gesture_Zoom_Info + * Holds zoom info for user + * @ingroup Elm_Gesture_Layer + */ +typedef struct _Elm_Gesture_Zoom_Info Elm_Gesture_Zoom_Info; + +/** + * @struct _Elm_Gesture_Rotate_Info + * Struct holds rotation info for user + * @ingroup Elm_Gesture_Layer + */ +struct _Elm_Gesture_Rotate_Info +{ + Evas_Coord x, y; /**< Holds zoom center point reported to user */ + Evas_Coord radius; /**< Holds radius between fingers reported to user */ + double base_angle; /**< Holds start-angle */ + double angle; /**< Rotation value: 0.0 means no rotation */ + double momentum; /**< Rotation momentum: rotation done per second (NOT YET SUPPORTED) */ +}; + +/** + * @typedef Elm_Gesture_Rotate_Info + * Holds rotation info for user + * @ingroup Elm_Gesture_Layer + */ +typedef struct _Elm_Gesture_Rotate_Info Elm_Gesture_Rotate_Info; + +/** + * @typedef Elm_Gesture_Event_Cb + * User callback used to stream gesture info from gesture layer + * @param data user data + * @param event_info gesture report info + * Returns a flag field to be applied on the causing event. + * You should probably return EVAS_EVENT_FLAG_ON_HOLD if your widget acted + * upon the event, in an irreversible way. + * + * @ingroup Elm_Gesture_Layer + */ +typedef Evas_Event_Flags (*Elm_Gesture_Event_Cb)(void *data, void *event_info); + +/** + * Use function to set callbacks to be notified about + * change of state of gesture. + * When a user registers a callback with this function + * this means this gesture has to be tested. + * + * When ALL callbacks for a gesture are set to NULL + * it means user isn't interested in gesture-state + * and it will not be tested. + * + * @param obj gesture-layer. + * @param idx The gesture you would like to track its state. + * @param cb callback function pointer. + * @param cb_type what event this callback tracks: START, MOVE, END, ABORT. + * @param data user info to be sent to callback (usually, Smart Data) + * + * @ingroup Elm_Gesture_Layer + */ +EAPI void elm_gesture_layer_cb_set(Evas_Object *obj, Elm_Gesture_Type idx, Elm_Gesture_State cb_type, Elm_Gesture_Event_Cb cb, void *data); + +/** + * Call this function to get repeat-events settings. + * + * @param obj gesture-layer. + * + * @return repeat events settings. + * @see elm_gesture_layer_hold_events_set() + * @ingroup Elm_Gesture_Layer + */ +EAPI Eina_Bool elm_gesture_layer_hold_events_get(const Evas_Object *obj); + +/** + * This function is to make gesture-layer repeat events. + * Set this if you like to get the raw events only if gestures were not + * detected. + * Clear this if you like gesture layer to forward events as testing gestures. + * + * @param obj gesture layer. + * @param hold_events hold events or not. + * + * @ingroup Elm_Gesture_Layer + */ +EAPI void elm_gesture_layer_hold_events_set(Evas_Object *obj, Eina_Bool hold_events); + +/** + * This function sets step-value for zoom action. + * Set step to any positive value. + * Cancel step setting by setting to 0 + * + * @param obj gesture-layer. + * @param step new zoom step value. + * + * @see elm_gesture_layer_zoom_step_get() + * @ingroup Elm_Gesture_Layer + */ +EAPI void elm_gesture_layer_zoom_step_set(Evas_Object *obj, double step); + +/** + * This function returns step-value for zoom action. + * + * @param obj gesture-layer. + * @return zoom step value. + * + * @see elm_gesture_layer_zoom_step_set() + * @ingroup Elm_Gesture_Layer + */ +EAPI double elm_gesture_layer_zoom_step_get(const Evas_Object *obj); + +/** + * This function sets step-value for rotate action. + * Set step to any positive value. + * Cancel step setting by setting to 0 + * + * @param obj gesture-layer. + * @param step new rotate step value. + * + * @ingroup Elm_Gesture_Layer + */ +EAPI void elm_gesture_layer_rotate_step_set(Evas_Object *obj, double step); + +/** + * This function returns step-value for rotate action. + * + * @param obj gesture-layer. + * @return rotate step value. + * + * @ingroup Elm_Gesture_Layer + */ +EAPI double elm_gesture_layer_rotate_step_get(const Evas_Object *obj); + +/** + * This function called to attach gesture-layer to an Evas_Object. + * @param obj gesture-layer. + * @param target Pointer to underlying object (AKA Target) + * + * @return TRUE, FALSE on success, failure. + * + * @ingroup Elm_Gesture_Layer + */ +EAPI Eina_Bool elm_gesture_layer_attach(Evas_Object *obj, Evas_Object *target); + +/** + * Call this function to construct a new gesture-layer object. + * This does not activate the gesture layer. You have to + * call elm_gesture_layer_attach in order to 'activate' gesture-layer. + * + * @param parent the parent object. + * + * @return new gesture-layer object. + * + * @ingroup Elm_Gesture_Layer + */ +EAPI Evas_Object *elm_gesture_layer_add(Evas_Object *parent); diff --git a/libraries/elementary/src/lib/elm_getting_started.h b/libraries/elementary/src/lib/elm_getting_started.h new file mode 100644 index 0000000..9b11a54 --- /dev/null +++ b/libraries/elementary/src/lib/elm_getting_started.h @@ -0,0 +1,197 @@ +/** + * @defgroup Start Getting Started + * @ingroup Elementary + * + * To write an Elementary app, you can get started with the following: + * + * @code + * #include + * EAPI_MAIN int + * elm_main(int argc, char **argv) + * { + * // create window(s) here and do any application init + * elm_run(); // run main loop + * elm_shutdown(); // after mainloop finishes running, shutdown + * return 0; // exit 0 for exit code + * } + * ELM_MAIN() + * @endcode + * + * To use autotools (which helps in many ways in the long run, like being able + * to immediately create releases of your software directly from your tree + * and ensure everything needed to build it is there) you will need a + * configure.ac, Makefile.am and autogen.sh file. + * + * configure.ac: + * + * @verbatim + * AC_INIT(myapp, 0.0.0, myname@mydomain.com) + * AC_PREREQ(2.52) + * AC_CONFIG_SRCDIR(configure.ac) + * AM_CONFIG_HEADER(config.h) + * AC_PROG_CC + * AM_INIT_AUTOMAKE(1.6 dist-bzip2) + * PKG_CHECK_MODULES([ELEMENTARY], elementary) + * AC_OUTPUT(Makefile) + * @endverbatim + * + * Makefile.am: + * + * @verbatim + * AUTOMAKE_OPTIONS = 1.4 foreign + * MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.h.in configure depcomp install-sh missing + * + * INCLUDES = -I$(top_srcdir) + * + * bin_PROGRAMS = myapp + * + * myapp_SOURCES = main.c + * myapp_LDADD = @ELEMENTARY_LIBS@ + * myapp_CFLAGS = @ELEMENTARY_CFLAGS@ + * @endverbatim + * + * autogen.sh: + * + * @verbatim + *#!/bin/sh + * echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS || exit 1 + * echo "Running autoheader..." ; autoheader || exit 1 + * echo "Running autoconf..." ; autoconf || exit 1 + * echo "Running automake..." ; automake --add-missing --copy --gnu || exit 1 + * ./configure "$@" + * @endverbatim + * + * To generate all the things needed to bootstrap just run: + * + * @verbatim + * ./autogen.sh + * @endverbatim + * + * This will generate Makefile.in's, the configure script and everything else. + * After this it works like all normal autotools projects: + * @verbatim + * ./configure + * make + * sudo make install + * @endverbatim + * + * Note sudo was assumed to get root permissions, as this would install in + * /usr/local which is system-owned. Use any way you like to gain root, or + * specify a different prefix with configure: + * + * @verbatim + * ./configure --prefix=$HOME/mysoftware + * @endverbatim + * + * Also remember that autotools buys you some useful commands like: + * @verbatim + * make uninstall + * @endverbatim + * + * This uninstalls the software after it was installed with "make install". + * It is very useful to clear up what you built if you wish to clean the + * system. + * + * @verbatim + * make distcheck + * @endverbatim + * + * This firstly checks if your build tree is "clean" and ready for + * distribution. It also builds a tarball (myapp-0.0.0.tar.gz) that is + * ready to upload and distribute to the world, that contains the generated + * Makefile.in's and configure script. The users do not need to run + * autogen.sh - just configure and on. They don't need autotools installed. + * This tarball also builds cleanly, has all the sources it needs to build + * included (that is sources for your application, not libraries it depends + * on like Elementary). It builds cleanly in a buildroot and does not + * contain any files that are temporarily generated like binaries and other + * build-generated files, so the tarball is clean, and no need to worry + * about cleaning up your tree before packaging. + * + * @verbatim + * make clean + * @endverbatim + * + * This cleans up all build files (binaries, objects etc.) from the tree. + * + * @verbatim + * make distclean + * @endverbatim + * + * This cleans out all files from the build and from configure's output too. + * + * @verbatim + * make maintainer-clean + * @endverbatim + * + * This deletes all the files autogen.sh will produce so the tree is clean + * to be put into a revision-control system (like CVS, SVN or GIT for example). + * + * There is a more advanced way of making use of the quicklaunch infrastructure + * in Elementary (which will not be covered here due to its more advanced + * nature). + * + * Now let's actually create an interactive "Hello World" gui that you can + * click the ok button to exit. It's more code because this now does something + * much more significant, but it's still very simple: + * + * @code + * #include + * + * static void + * on_done(void *data, Evas_Object *obj, void *event_info) + * { + * // quit the mainloop (elm_run function will return) + * elm_exit(); + * } + * + * EAPI_MAIN int + * elm_main(int argc, char **argv) + * { + * Evas_Object *win, *box, *lab, *btn; + * + * // new window - do the usual and give it a name (hello) and title (Hello) + * win = elm_win_util_standard_add("hello", "Hello"); + * // when the user clicks "close" on a window there is a request to delete + * evas_object_smart_callback_add(win, "delete,request", on_done, NULL); + * + * // add a box object - default is vertical. a box holds children in a row, + * // either horizontally or vertically. nothing more. + * box = elm_box_add(win); + * // make the box horizontal + * elm_box_horizontal_set(box, EINA_TRUE); + * // add object as a resize object for the window (controls window minimum + * // size as well as gets resized if window is resized) + * elm_win_resize_object_add(win, box); + * evas_object_show(box); + * + * // add a label widget, set the text and put it in the pad frame + * lab = elm_label_add(win); + * // set default text of the label + * elm_object_text_set(lab, "Hello out there world!"); + * // pack the label at the end of the box + * elm_box_pack_end(box, lab); + * evas_object_show(lab); + * + * // add an ok button + * btn = elm_button_add(win); + * // set default text of button to "OK" + * elm_object_text_set(btn, "OK"); + * // pack the button at the end of the box + * elm_box_pack_end(box, btn); + * evas_object_show(btn); + * // call on_done when button is clicked + * evas_object_smart_callback_add(btn, "clicked", on_done, NULL); + * + * // now we are done, show the window + * evas_object_show(win); + * + * // run the mainloop and process events and callbacks + * elm_run(); + * elm_shutdown(); + * return 0; + * } + * ELM_MAIN() + * @endcode + * + */ diff --git a/libraries/elementary/src/lib/elm_glview.c b/libraries/elementary/src/lib/elm_glview.c new file mode 100644 index 0000000..339f23f --- /dev/null +++ b/libraries/elementary/src/lib/elm_glview.c @@ -0,0 +1,462 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *glview_image; + + Elm_GLView_Mode mode; + Elm_GLView_Resize_Policy scale_policy; + Elm_GLView_Render_Policy render_policy; + + Evas_GL *evasgl; + Evas_GL_Config *config; + Evas_GL_Surface *surface; + Evas_GL_Context *context; + + Evas_Coord w, h; + + Elm_GLView_Func_Cb init_func; + Elm_GLView_Func_Cb del_func; + Elm_GLView_Func_Cb resize_func; + Elm_GLView_Func_Cb render_func; + + Ecore_Idle_Enterer *render_idle_enterer; + + Eina_Bool initialized; + Eina_Bool resized; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _on_focus_hook(void *data, Evas_Object *obj); + +static const char SIG_FOCUSED[] = "focused"; +static const char SIG_UNFOCUSED[] = "unfocused"; + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + // Call delete func if it's registered + if (wd->del_func) + { + evas_gl_make_current(wd->evasgl, wd->surface, wd->context); + wd->del_func(obj); + } + + if (wd->render_idle_enterer) ecore_idle_enterer_del(wd->render_idle_enterer); + + if (wd->surface) evas_gl_surface_destroy(wd->evasgl, wd->surface); + if (wd->context) evas_gl_context_destroy(wd->evasgl, wd->context); + if (wd->config) evas_gl_config_free(wd->config); + if (wd->evasgl) evas_gl_free(wd->evasgl); + + free(wd); +} + +static void +_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (elm_widget_focus_get(obj)) + { + evas_object_focus_set(wd->glview_image, EINA_TRUE); + evas_object_smart_callback_call(obj, SIG_FOCUSED, NULL); + } + else + { + evas_object_focus_set(wd->glview_image, EINA_FALSE); + evas_object_smart_callback_call(obj, SIG_UNFOCUSED, NULL); + } +} + +static void +_glview_update_surface(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (wd->surface) + { + evas_object_image_native_surface_set(wd->glview_image, NULL); + evas_gl_surface_destroy(wd->evasgl, wd->surface); + wd->surface = NULL; + } + + evas_object_image_size_set(wd->glview_image, wd->w, wd->h); + + if (!wd->surface) + { + Evas_Native_Surface ns; + + wd->surface = evas_gl_surface_create(wd->evasgl, wd->config, + wd->w, wd->h); + evas_gl_native_surface_get(wd->evasgl, wd->surface, &ns); + evas_object_image_native_surface_set(wd->glview_image, &ns); + elm_glview_changed_set(obj); + } +} + +static void +_glview_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + Evas_Coord w, h; + + if (!wd) return; + + wd->resized = EINA_TRUE; + + if (wd->scale_policy == ELM_GLVIEW_RESIZE_POLICY_RECREATE) + { + evas_object_geometry_get(wd->glview_image, NULL, NULL, &w, &h); + if ((w == 0) || (h == 0)) + { + w = 64; + h = 64; + } + if ((wd->w == w) && (wd->h == h)) return; + wd->w = w; + wd->h = h; + _glview_update_surface(data); + } +} + +static Eina_Bool +_render_cb(void *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + // Do a make current + if (!evas_gl_make_current(wd->evasgl, wd->surface, wd->context)) + { + wd->render_idle_enterer = NULL; + ERR("Failed doing make current.\n"); + return EINA_FALSE; + } + + // Call the init function if it hasn't been called already + if (!wd->initialized) + { + if (wd->init_func) wd->init_func(obj); + wd->initialized = EINA_TRUE; + } + + if (wd->resized) + { + if (wd->resize_func) wd->resize_func(obj); + wd->resized = EINA_FALSE; + } + + // Call the render function + if (wd->render_func) wd->render_func(obj); + + // Depending on the policy return true or false + if (wd->render_policy == ELM_GLVIEW_RENDER_POLICY_ON_DEMAND) + return EINA_TRUE; + else if (wd->render_policy == ELM_GLVIEW_RENDER_POLICY_ALWAYS) + { + // Return false so it only runs once + wd->render_idle_enterer = NULL; + return EINA_FALSE; + } + else + { + ERR("Invalid Render Policy.\n"); + wd->render_idle_enterer = NULL; + return EINA_FALSE; + } + return EINA_TRUE; +} + +static void +_set_render_policy_callback(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + switch (wd->render_policy) + { + case ELM_GLVIEW_RENDER_POLICY_ON_DEMAND: + // Delete idle_enterer if it for some reason is around + if (wd->render_idle_enterer) + { + ecore_idle_enterer_del(wd->render_idle_enterer); + wd->render_idle_enterer = NULL; + } + + // Set pixel getter callback + evas_object_image_pixels_get_callback_set + (wd->glview_image, (Evas_Object_Image_Pixels_Get_Cb)_render_cb, obj); + break; + case ELM_GLVIEW_RENDER_POLICY_ALWAYS: + // Unset the pixel getter callback if set already + evas_object_image_pixels_get_callback_set(wd->glview_image, NULL, NULL); + + break; + default: + ERR("Invalid Render Policy.\n"); + return; + } +} + +EAPI Evas_Object * +elm_glview_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "glview"); + elm_widget_type_set(obj, "glview"); + elm_widget_sub_object_add(parent, obj); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + + // Evas_GL + wd->evasgl = evas_gl_new(e); + if (!wd->evasgl) + { + ERR("Failed Creating an Evas GL Object.\n"); + return NULL; + } + + // Create a default config + wd->config = evas_gl_config_new(); + if (!wd->config) + { + ERR("Failed Creating a Config Object.\n"); + evas_gl_free(wd->evasgl); + return NULL; + } + wd->config->color_format = EVAS_GL_RGB_888; + + // Create image to render Evas_GL Surface + wd->glview_image = evas_object_image_filled_add(e); + evas_object_image_size_set(wd->glview_image, 1, 1); + evas_object_event_callback_add(wd->glview_image, EVAS_CALLBACK_RESIZE, + _glview_resize, obj); + elm_widget_resize_object_set(obj, wd->glview_image); + evas_object_show(wd->glview_image); + + // Initialize variables + wd->mode = 0; + wd->scale_policy = ELM_GLVIEW_RESIZE_POLICY_RECREATE; + wd->render_policy = ELM_GLVIEW_RENDER_POLICY_ON_DEMAND; + wd->surface = NULL; + + // Initialize it to (64,64) (It's an arbitrary value) + wd->w = 64; + wd->h = 64; + + // Initialize the rest of the values + wd->init_func = NULL; + wd->del_func = NULL; + wd->render_func = NULL; + wd->render_idle_enterer = NULL; + wd->initialized = EINA_FALSE; + wd->resized = EINA_FALSE; + + // Create Context + if (!wd->context) + { + wd->context = evas_gl_context_create(wd->evasgl, NULL); + if (!wd->context) + { + ERR("Error Creating an Evas_GL Context.\n"); + return NULL; + } + } + return obj; +} + +EAPI Evas_GL_API * +elm_glview_gl_api_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + return evas_gl_api_get(wd->evasgl); +} + +EAPI Eina_Bool +elm_glview_mode_set(Evas_Object *obj, Elm_GLView_Mode mode) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + // Set the configs + if (mode & ELM_GLVIEW_ALPHA) + wd->config->color_format = EVAS_GL_RGBA_8888; + else + wd->config->color_format = EVAS_GL_RGB_888; + + if (mode & ELM_GLVIEW_DEPTH) + wd->config->depth_bits = EVAS_GL_DEPTH_BIT_24; + else + wd->config->depth_bits = EVAS_GL_DEPTH_NONE; + + if (mode & ELM_GLVIEW_STENCIL) + wd->config->stencil_bits = EVAS_GL_STENCIL_BIT_8; + else + wd->config->stencil_bits = EVAS_GL_STENCIL_NONE; + + if (mode & ELM_GLVIEW_DIRECT) + wd->config->options_bits = EVAS_GL_OPTIONS_DIRECT; + else + wd->config->options_bits = EVAS_GL_OPTIONS_NONE; + + // Check for Alpha Channel and enable it + if (mode & ELM_GLVIEW_ALPHA) + evas_object_image_alpha_set(wd->glview_image, EINA_TRUE); + else + evas_object_image_alpha_set(wd->glview_image, EINA_FALSE); + + wd->mode = mode; + + elm_glview_changed_set(obj); + + return EINA_TRUE; +} + +EAPI Eina_Bool +elm_glview_resize_policy_set(Evas_Object *obj, Elm_GLView_Resize_Policy policy) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + if (policy == wd->scale_policy) return EINA_TRUE; + switch (policy) + { + case ELM_GLVIEW_RESIZE_POLICY_RECREATE: + case ELM_GLVIEW_RESIZE_POLICY_SCALE: + wd->scale_policy = policy; + _glview_update_surface(obj); + elm_glview_changed_set(obj); + return EINA_TRUE; + default: + ERR("Invalid Scale Policy.\n"); + return EINA_FALSE; + } +} + +EAPI Eina_Bool +elm_glview_render_policy_set(Evas_Object *obj, Elm_GLView_Render_Policy policy) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + if ((policy != ELM_GLVIEW_RENDER_POLICY_ON_DEMAND) && + (policy != ELM_GLVIEW_RENDER_POLICY_ALWAYS)) + { + ERR("Invalid Render Policy.\n"); + return EINA_FALSE; + } + if (wd->render_policy == policy) return EINA_TRUE; + wd->render_policy = policy; + _set_render_policy_callback(obj); + _glview_update_surface(obj); + return EINA_TRUE; +} + +EAPI void +elm_glview_size_set(Evas_Object *obj, int w, int h) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if ((w == wd->w) && (h == wd->h)) return; + wd->w = w; + wd->h = h; + _glview_update_surface(obj); + elm_glview_changed_set(obj); +} + +EAPI void +elm_glview_size_get(const Evas_Object *obj, int *w, int *h) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (w) *w = wd->w; + if (h) *h = wd->h; +} + +EAPI void +elm_glview_init_func_set(Evas_Object *obj, Elm_GLView_Func_Cb func) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + wd->initialized = EINA_FALSE; + wd->init_func = func; +} + +EAPI void +elm_glview_del_func_set(Evas_Object *obj, Elm_GLView_Func_Cb func) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + wd->del_func = func; +} + +EAPI void +elm_glview_resize_func_set(Evas_Object *obj, Elm_GLView_Func_Cb func) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) + { + ERR("Invalid Widget Object.\n"); + return; + } + + wd->resize_func = func; +} + +EAPI void +elm_glview_render_func_set(Evas_Object *obj, Elm_GLView_Func_Cb func) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + wd->render_func = func; + _set_render_policy_callback(obj); +} + +EAPI void +elm_glview_changed_set(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + evas_object_image_pixels_dirty_set(wd->glview_image, EINA_TRUE); + if (wd->render_policy == ELM_GLVIEW_RENDER_POLICY_ALWAYS) + { + if (!wd->render_idle_enterer) + wd->render_idle_enterer = ecore_idle_enterer_before_add((Ecore_Task_Cb)_render_cb, obj); + } +} + +/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-3f0^-2{2(0W1st0 :*/ diff --git a/libraries/elementary/src/lib/elm_glview.h b/libraries/elementary/src/lib/elm_glview.h new file mode 100644 index 0000000..30dff2b --- /dev/null +++ b/libraries/elementary/src/lib/elm_glview.h @@ -0,0 +1,226 @@ +/** + * @defgroup GLView GLView + * @ingroup Elementary + * + * A GLView widget allows for simple GL rendering in elementary environment. + * GLView hides all the complicated evas_gl details so that the user only + * has to deal with registering a few callback functions for rendering + * to a surface using OpenGL APIs. + * + * Below is an illustrative example of how to use GLView and and OpenGL + * to render in elementary environment. + * @ref glview_example_01_page + * + */ + +typedef void (*Elm_GLView_Func_Cb)(Evas_Object *obj); + +typedef enum _Elm_GLView_Mode +{ + ELM_GLVIEW_NONE = 0, + ELM_GLVIEW_ALPHA = (1<<1), /**< Alpha channel enabled rendering mode */ + ELM_GLVIEW_DEPTH = (1<<2), /**< Depth buffer enabled rendering mode */ + ELM_GLVIEW_STENCIL = (1<<3), /**< Stencil buffer enabled rendering mode */ + ELM_GLVIEW_DIRECT = (1<<4) /**< Direct rendering optimization hint */ +} Elm_GLView_Mode; + +/** + * Defines a policy for the glview resizing. + * + * The resizing policy tells glview what to do with the underlying + * surface when resize happens. ELM_GLVIEW_RESIZE_POLICY_RECREATE + * will destroy the current surface and recreate the surface to the + * new size. ELM_GLVIEW_RESIZE_POLICY_SCALE will instead keep the + * current surface but only display the result at the desired size + * scaled. + * + * @note Default is ELM_GLVIEW_RESIZE_POLICY_RECREATE + */ +typedef enum +{ + ELM_GLVIEW_RESIZE_POLICY_RECREATE = 1, /**< Resize the internal surface along with the image */ + ELM_GLVIEW_RESIZE_POLICY_SCALE = 2 /**< Only resize the internal image and not the surface */ +} Elm_GLView_Resize_Policy; + +/** + * Defines a policy for gl rendering. + * + * The rendering policy tells glview where to run the gl rendering code. + * ELM_GLVIEW_RENDER_POLICY_ON_DEMAND tells glview to call the rendering + * calls on demand, which means that the rendering code gets called + * only when it is visible. + * + * @note Default is ELM_GLVIEW_RENDER_POLICY_ON_DEMAND + */ +typedef enum +{ + ELM_GLVIEW_RENDER_POLICY_ON_DEMAND = 1, /**< Render only when there is a need for redrawing */ + ELM_GLVIEW_RENDER_POLICY_ALWAYS = 2 /**< Render always even when it is not visible */ +} Elm_GLView_Render_Policy; + +/** + * Add a new glview to the parent + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * @ingroup GLView + */ +EAPI Evas_Object *elm_glview_add(Evas_Object *parent); + +/** + * Sets the size of the glview + * + * @param obj The glview object + * @param w width of the glview object + * @param h height of the glview object + * + * @ingroup GLView + */ +EAPI void elm_glview_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h); + +/** + * Gets the size of the glview. + * + * @param obj The glview object + * @param w width of the glview object + * @param h height of the glview object + * + * Note that this function returns the actual image size of the + * glview. This means that when the scale policy is set to + * ELM_GLVIEW_RESIZE_POLICY_SCALE, it'll return the non-scaled + * size. + * + * @ingroup GLView + */ +EAPI void elm_glview_size_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h); + +/** + * Gets the gl api struct for gl rendering + * + * @param obj The glview object + * @return The api object or NULL if it cannot be created + * + * @ingroup GLView + */ +EAPI Evas_GL_API *elm_glview_gl_api_get(const Evas_Object *obj); + +/** + * Set the mode of the GLView. Supports alpha, depth, stencil. + * + * @param obj The glview object + * @param mode The mode Options OR'ed enabling Alpha, Depth, Stencil, Direct. + * @return True if set properly. + * + * Direct is a hint for the elm_glview to render directly to the window + * given that the right conditions are met. Otherwise it falls back + * to rendering to an offscreen buffer before it gets composited to the + * window. + * + * @ingroup GLView + */ +EAPI Eina_Bool elm_glview_mode_set(Evas_Object *obj, Elm_GLView_Mode mode); + +/** + * Set the resize policy for the glview object. + * + * @param obj The glview object. + * @param policy The scaling policy. + * + * By default, the resize policy is set to ELM_GLVIEW_RESIZE_POLICY_RECREATE. + * When resize is called it destroys the previous surface and recreates the + * newly specified size. If the policy is set to + * ELM_GLVIEW_RESIZE_POLICY_SCALE, however, glview only scales the image + * object and not the underlying GL Surface. + * + * @ingroup GLView + */ +EAPI Eina_Bool elm_glview_resize_policy_set(Evas_Object *obj, Elm_GLView_Resize_Policy policy); + +/** + * Set the render policy for the glview object. + * + * @param obj The glview object. + * @param policy The render policy. + * + * By default, the render policy is set to ELM_GLVIEW_RENDER_POLICY_ON_DEMAND. + * This policy is set such that during the render loop, glview is only + * redrawn if it needs to be redrawn. (i.e. when it is visible) If the policy + * is set to ELM_GLVIEWW_RENDER_POLICY_ALWAYS, it redraws regardless of + * whether it is visible or needs redrawing. + * + * @ingroup GLView + */ +EAPI Eina_Bool elm_glview_render_policy_set(Evas_Object *obj, Elm_GLView_Render_Policy policy); + +/** + * Set the init function that runs once in the main loop. + * + * @param obj The glview object. + * @param func The init function to be registered. + * + * The registered init function gets called once during the render loop. + * This function allows glview to hide all the rendering context/surface + * details and have the user just call GL calls that they desire + * for initialization GL calls. + * + * @ingroup GLView + */ +EAPI void elm_glview_init_func_set(Evas_Object *obj, Elm_GLView_Func_Cb func); + +/** + * Set the render function that runs in the main loop. + * + * @param obj The glview object. + * @param func The delete function to be registered. + * + * The registered del function gets called when GLView object is deleted. + * This function allows glview to hide all the rendering context/surface + * details and have the user just call GL calls that they desire + * when delete happens. + * + * @ingroup GLView + */ +EAPI void elm_glview_del_func_set(Evas_Object *obj, Elm_GLView_Func_Cb func); + +/** + * Set the resize function that gets called when resize happens. + * + * @param obj The glview object. + * @param func The resize function to be registered. + * + * The resize function gets called during the render loop. + * This function allows glview to hide all the rendering context/surface + * details and have the user just call GL calls that they desire + * when resize happens. + * + * @ingroup GLView + */ +EAPI void elm_glview_resize_func_set(Evas_Object *obj, Elm_GLView_Func_Cb func); + +/** + * Set the render function that runs in the main loop. + * + * The render function gets called in the main loop but whether it runs + * depends on the rendering policy and whether elm_glview_changed_set() + * gets called. + * + * @param obj The glview object. + * @param func The render function to be registered. + * + * @ingroup GLView + */ +EAPI void elm_glview_render_func_set(Evas_Object *obj, Elm_GLView_Func_Cb func); + +/** + * Notifies that there has been changes in the GLView. + * + * @param obj The glview object. + * + * @ingroup GLView + */ +EAPI void elm_glview_changed_set(Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_grid.c b/libraries/elementary/src/lib/elm_grid.c new file mode 100644 index 0000000..22f1b23 --- /dev/null +++ b/libraries/elementary/src/lib/elm_grid.c @@ -0,0 +1,177 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *obj, *grd; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + free(wd); +} + +static Eina_Bool +_elm_grid_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next) +{ + Widget_Data *wd = elm_widget_data_get(obj); + const Eina_List *items; + void *(*list_data_get) (const Eina_List *list); + Eina_List *(*list_free) (Eina_List *list); + + if ((!wd) || (!wd->grd)) + return EINA_FALSE; + + /* Focus chain */ + /* TODO: Change this to use other chain */ + if ((items = elm_widget_focus_custom_chain_get(obj))) + { + list_data_get = eina_list_data_get; + list_free = NULL; + } + else + { + items = evas_object_grid_children_get(wd->grd); + list_data_get = eina_list_data_get; + list_free = eina_list_free; + + if (!items) return EINA_FALSE; + } + + Eina_Bool ret = elm_widget_focus_list_next_get(obj, items, list_data_get, + dir, next); + + if (list_free) + list_free((Eina_List *)items); + + return ret; +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (!wd->grd)) return; + evas_object_grid_mirrored_set(wd->grd, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); +} + +EAPI Evas_Object * +elm_grid_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + ELM_SET_WIDTYPE(widtype, "grid"); + elm_widget_type_set(obj, "grid"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_focus_next_hook_set(obj, _elm_grid_focus_next_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); + elm_widget_theme_hook_set(obj, _theme_hook); + + wd->grd = evas_object_grid_add(e); + evas_object_grid_size_set(wd->grd, 100, 100); + elm_widget_resize_object_set(obj, wd->grd); + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + return obj; +} + +EAPI void +elm_grid_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_grid_size_set(wd->grd, w, h); +} + +EAPI void +elm_grid_size_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_grid_size_get(wd->grd, w, h); +} + +EAPI void +elm_grid_pack(Evas_Object *obj, Evas_Object *subobj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_widget_sub_object_add(obj, subobj); + evas_object_grid_pack(wd->grd, subobj, x, y, w, h); +} + +EAPI void +elm_grid_unpack(Evas_Object *obj, Evas_Object *subobj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_widget_sub_object_del(obj, subobj); + evas_object_grid_unpack(wd->grd, subobj); +} + +EAPI void +elm_grid_clear(Evas_Object *obj, Eina_Bool clear) +{ + Eina_List *chld; + Evas_Object *o; + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + chld = evas_object_grid_children_get(wd->grd); + EINA_LIST_FREE(chld, o) elm_widget_sub_object_del(obj, o); + evas_object_grid_clear(wd->grd, clear); +} + +EAPI void +elm_grid_pack_set(Evas_Object *subobj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) +{ + Evas_Object *obj = elm_widget_parent_widget_get(subobj); + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_grid_pack(wd->grd, subobj, x, y, w, h); +} + +EAPI void +elm_grid_pack_get(Evas_Object *subobj, int *x, int *y, int *w, int *h) +{ + Evas_Object *obj = elm_widget_parent_widget_get(subobj); + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_grid_pack_get(wd->grd, subobj, x, y, w, h); +} + +EAPI Eina_List * +elm_grid_children_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return evas_object_grid_children_get(wd->grd); +} diff --git a/libraries/elementary/src/lib/elm_grid.h b/libraries/elementary/src/lib/elm_grid.h new file mode 100644 index 0000000..8168023 --- /dev/null +++ b/libraries/elementary/src/lib/elm_grid.h @@ -0,0 +1,125 @@ +/** + * @defgroup Grid Grid + * @ingroup Elementary + * + * The grid is a grid layout widget that lays out a series of children as a + * fixed "grid" of widgets using a given percentage of the grid width and + * height each using the child object. + * + * The Grid uses a "Virtual resolution" that is stretched to fill the grid + * widgets size itself. The default is 100 x 100, so that means the + * position and sizes of children will effectively be percentages (0 to 100) + * of the width or height of the grid widget + * + * @{ + */ + +/** + * Add a new grid to the parent + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * @ingroup Grid + */ +EAPI Evas_Object *elm_grid_add(Evas_Object *parent); + +/** + * Set the virtual size of the grid + * + * @param obj The grid object + * @param w The virtual width of the grid + * @param h The virtual height of the grid + * + * @ingroup Grid + */ +EAPI void elm_grid_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h); + +/** + * Get the virtual size of the grid + * + * @param obj The grid object + * @param w Pointer to integer to store the virtual width of the grid + * @param h Pointer to integer to store the virtual height of the grid + * + * @ingroup Grid + */ +EAPI void elm_grid_size_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h); + +/** + * Pack child at given position and size + * + * @param obj The grid object + * @param subobj The child to pack + * @param x The virtual x coord at which to pack it + * @param y The virtual y coord at which to pack it + * @param w The virtual width at which to pack it + * @param h The virtual height at which to pack it + * + * @ingroup Grid + */ +EAPI void elm_grid_pack(Evas_Object *obj, Evas_Object *subobj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h); + +/** + * Unpack a child from a grid object + * + * @param obj The grid object + * @param subobj The child to unpack + * + * @ingroup Grid + */ +EAPI void elm_grid_unpack(Evas_Object *obj, Evas_Object *subobj); + +/** + * Faster way to remove all child objects from a grid object. + * + * @param obj The grid object + * @param clear If true, it will delete just removed children + * + * @ingroup Grid + */ +EAPI void elm_grid_clear(Evas_Object *obj, Eina_Bool clear); + +/** + * Set packing of an existing child at to position and size + * + * @param subobj The child to set packing of + * @param x The virtual x coord at which to pack it + * @param y The virtual y coord at which to pack it + * @param w The virtual width at which to pack it + * @param h The virtual height at which to pack it + * + * @ingroup Grid + */ +EAPI void elm_grid_pack_set(Evas_Object *subobj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h); + +/** + * Get packing of a child + * + * @param subobj The child to query + * @param x Pointer to integer to store the virtual x coord + * @param y Pointer to integer to store the virtual y coord + * @param w Pointer to integer to store the virtual width + * @param h Pointer to integer to store the virtual height + * + * @ingroup Grid + */ +EAPI void elm_grid_pack_get(Evas_Object *subobj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); + +/** + * Get the list of the children for the grid. + * + * @param obj The grid object + * + * @note This is a duplicate of the list kept by the grid internally. + It's up to the user to destroy it when it no longer needs it. + It's possible to remove objects from the grid when walking this + list, but these removals won't be reflected on it. + * + * @ingroup Grid + */ +EAPI Eina_List *elm_grid_children_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_hover.c b/libraries/elementary/src/lib/elm_hover.c new file mode 100644 index 0000000..ec92a9c --- /dev/null +++ b/libraries/elementary/src/lib/elm_hover.c @@ -0,0 +1,852 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; +typedef struct _Content_Info Content_Info; + +#ifndef MAX +# define MAX(a, b) (((a) > (b)) ? (a) : (b)) +#endif + +#define ELM_HOVER_PARTS_FOREACH unsigned int i = 0; \ + for (i = 0; i < sizeof(wd->subs) / sizeof(wd->subs[0]); i++) + +static const char *_directions[] = { + "left", + "top-left", + "top", + "top-right", + "right", + "bottom-right", + "bottom", + "bottom-left", + "middle" +}; + +#define _HOV_LEFT (_directions[0]) +#define _HOV_TOP_LEFT (_directions[1]) +#define _HOV_TOP (_directions[2]) +#define _HOV_TOP_RIGHT (_directions[2]) +#define _HOV_RIGHT (_directions[4]) +#define _HOV_BOTTOM_RIGHT (_directions[5]) +#define _HOV_BOTTOM (_directions[6]) +#define _HOV_BOTTOM_LEFT (_directions[7]) +#define _HOV_MIDDLE (_directions[8]) + +struct _Content_Info +{ + const char *swallow; + Evas_Object *obj; +}; + +struct _Widget_Data +{ + Evas_Object *hov, *cov; + Evas_Object *offset, *size; + Evas_Object *parent, *target; + Evas_Object *smt_sub; + Content_Info subs[sizeof(_directions)/sizeof(_directions[0])]; +}; + +static const char *widtype = NULL; +static void _del_pre_hook(Evas_Object *obj); +static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); +static void _theme_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _reval_content(Evas_Object *obj); +static void _sub_del(void *data, Evas_Object *obj, void *event_info); +static void _hov_show_do(Evas_Object *obj); +static void _hov_move(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _hov_resize(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _hov_show(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _hov_hide(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _on_focus_hook(void *data, Evas_Object *obj); +static void _elm_hover_sub_obj_placement_eval_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _elm_hover_sub_obj_placement_eval(Evas_Object *obj); +static void _content_set_hook(Evas_Object *obj, const char *swallow, Evas_Object *content); +static Evas_Object * _content_get_hook(const Evas_Object *obj, const char *swallow); +static Evas_Object * _content_unset_hook(Evas_Object *obj, const char *swallow); + +static const char SIG_CLICKED[] = "clicked"; +static const char SIG_SMART_LOCATION_CHANGED[] = "smart,changed"; +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CLICKED, ""}, + {SIG_SMART_LOCATION_CHANGED, ""}, + {NULL, NULL} +}; + +static void +_del_pre_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) + return; + + if (evas_object_visible_get(obj)) + evas_object_smart_callback_call(obj, SIG_CLICKED, NULL); + elm_hover_target_set(obj, NULL); + elm_hover_parent_set(obj, NULL); + evas_object_event_callback_del_full(wd->hov, EVAS_CALLBACK_MOVE, _hov_move, obj); + evas_object_event_callback_del_full(wd->hov, EVAS_CALLBACK_RESIZE, _hov_resize, obj); + evas_object_event_callback_del_full(wd->hov, EVAS_CALLBACK_SHOW, _hov_show, obj); + evas_object_event_callback_del_full(wd->hov, EVAS_CALLBACK_HIDE, _hov_hide, obj); +} + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + free(wd); +} + +static void +_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (elm_widget_focus_get(obj)) + { + edje_object_signal_emit(wd->cov, "elm,action,focus", "elm"); + evas_object_focus_set(wd->cov, EINA_TRUE); + } + else + { + edje_object_signal_emit(wd->cov, "elm,action,unfocus", "elm"); + evas_object_focus_set(wd->cov, EINA_FALSE); + } +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->cov, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + // FIXME: hover contents doesn't seem to propagate resizes properly + _elm_theme_object_set(obj, wd->cov, "hover", "base", elm_widget_style_get(obj)); + edje_object_scale_set(wd->cov, elm_widget_scale_get(obj) * + _elm_config->scale); + + if (wd->smt_sub) + _elm_hover_sub_obj_placement_eval(obj); + else + _reval_content(obj); + _sizing_eval(obj); + if (evas_object_visible_get(wd->cov)) _hov_show_do(obj); +} + +static void +_signal_emit_hook(Evas_Object *obj, const char *emission, const char *source) +{ + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) + return; + + edje_object_signal_emit(wd->cov, emission, source); +} + +static void +_signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) + return; + + edje_object_signal_callback_add(wd->hov, emission, source, func_cb, data); +} + +static void +_signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + + edje_object_signal_callback_del_full(wd->hov, emission, source, func_cb, + data); +} + +static void +_elm_hover_left_space_calc(Widget_Data *wd, Evas_Coord *spc_l, Evas_Coord *spc_t, Evas_Coord *spc_r, Evas_Coord *spc_b) +{ + Evas_Coord x = 0, y = 0, w = 0, h = 0, x2 = 0, y2 = 0, w2 = 0, h2 = 0; + + if (wd->parent) + evas_object_geometry_get(wd->parent, &x, &y, &w, &h); + if (wd->target) + evas_object_geometry_get(wd->target, &x2, &y2, &w2, &h2); + + *spc_l = x2 - x; + *spc_r = (x + w) - (x2 + w2); + if (*spc_l < 0) + *spc_l = 0; + if (*spc_r < 0) + *spc_r = 0; + + *spc_t = y2 - y; + *spc_b = (y + h) - (y2 + h2); + if (*spc_t < 0) + *spc_t = 0; + if (*spc_b < 0) + *spc_b = 0; +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord ofs_x, x = 0, y = 0, w = 0, h = 0, x2 = 0, y2 = 0, w2 = 0, h2 = 0; + if (!wd) return; + if (wd->parent) evas_object_geometry_get(wd->parent, &x, &y, &w, &h); + if (wd->hov) evas_object_geometry_get(wd->hov, &x2, &y2, &w2, &h2); + + if (elm_widget_mirrored_get(obj)) + ofs_x = w - (x2 - x) - w2; + else + ofs_x = x2 - x; + + evas_object_move(wd->cov, x, y); + evas_object_resize(wd->cov, w, h); + evas_object_size_hint_min_set(wd->offset, ofs_x, y2 - y); + evas_object_size_hint_min_set(wd->size, w2, h2); + edje_object_part_swallow(wd->cov, "elm.swallow.offset", wd->offset); + edje_object_part_swallow(wd->cov, "elm.swallow.size", wd->size); +} + +static void +_reval_content(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) + return; + + ELM_HOVER_PARTS_FOREACH + { + char buf[1024]; + snprintf(buf, sizeof(buf), "elm.swallow.slot.%s", wd->subs[i].swallow); + edje_object_part_swallow(wd->cov, buf, wd->subs[i].obj); + } +} + +static const char * +_elm_hover_smart_content_location_get(Widget_Data *wd, Evas_Coord spc_l, Evas_Coord spc_t, Evas_Coord spc_r, Evas_Coord spc_b) +{ + Evas_Coord c_w = 0, c_h = 0, mid_w, mid_h; + int max; + + evas_object_size_hint_min_get(wd->smt_sub, &c_w, &c_h); + mid_w = c_w / 2; + mid_h = c_h / 2; + + if (spc_l > spc_r) + goto left; + + max = MAX(spc_t, spc_r); + max = MAX(max, spc_b); + + if (max == spc_t) + { + if (mid_w > spc_l) + return _HOV_TOP_RIGHT; + + return _HOV_TOP; + } + + if (max == spc_r) + { + if (mid_h > spc_t) + return _HOV_BOTTOM_RIGHT; + else if (mid_h > spc_b) + return _HOV_TOP_RIGHT; + + return _HOV_RIGHT; + } + + if (mid_h > spc_l) + return _HOV_BOTTOM_RIGHT; + + return _HOV_BOTTOM; + +left: + max = MAX(spc_t, spc_l); + max = MAX(max, spc_b); + + if (max == spc_t) + { + if (mid_w > spc_r) + return _HOV_TOP_LEFT; + + return _HOV_TOP; + } + + if (max == spc_l) + { + if (mid_h > spc_t) + return _HOV_BOTTOM_LEFT; + else if (mid_h > spc_b) + return _HOV_TOP_LEFT; + + return _HOV_LEFT; + } + + if (mid_h > spc_r) + return _HOV_BOTTOM_LEFT; + + return _HOV_BOTTOM; +} + +static void +_sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info) +{ + Widget_Data *wd; + Evas_Object *sub; + + sub = event_info; + wd = elm_widget_data_get(obj); + if (!wd) + return; + + if (wd->smt_sub) + { + if (wd->smt_sub == sub) + wd->smt_sub = NULL; + } + else + { + ELM_HOVER_PARTS_FOREACH + { + if (wd->subs[i].obj == sub) + { + wd->subs[i].obj = NULL; + break; + } + } + } +} + +static void +_hov_show_do(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) + return; + + if (wd->cov) + { + evas_object_show(wd->cov); + edje_object_signal_emit(wd->cov, "elm,action,show", "elm"); + } + + ELM_HOVER_PARTS_FOREACH + { + char buf[1024]; + + if (wd->subs[i].obj) + { + snprintf(buf, sizeof(buf), "elm,action,slot,%s,show", + wd->subs[i].swallow); + edje_object_signal_emit(wd->cov, buf, "elm"); + } + } +} + +static void +_hov_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _sizing_eval(data); +} + +static void +_hov_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _sizing_eval(data); +} + +static void +_hov_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _hov_show_do(data); +} + +static void +_hov_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + if (wd->cov) + { + edje_object_signal_emit(wd->cov, "elm,action,hide", "elm"); + evas_object_hide(wd->cov); + } + + ELM_HOVER_PARTS_FOREACH + { + char buf[1024]; + + if (wd->subs[i].obj) + { + snprintf(buf, sizeof(buf), "elm,action,slot,%s,hide", + wd->subs[i].swallow); + edje_object_signal_emit(wd->cov, buf, "elm"); + } + } +} + +static void +_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + wd->target = NULL; +} + +static void +_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) + return; + + _sizing_eval(data); + _elm_hover_sub_obj_placement_eval(data); +} + +static void +_signal_dismiss(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + evas_object_hide(data); + evas_object_smart_callback_call(data, SIG_CLICKED, NULL); +} + +static void +_parent_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _sizing_eval(data); +} + +static void +_parent_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _sizing_eval(data); +} + +static void +_parent_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ +} + +static void +_parent_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + evas_object_hide(wd->cov); +} + +static void +_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + elm_hover_parent_set(data, NULL); + _sizing_eval(data); +} + +EAPI Evas_Object * +elm_hover_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "hover"); + elm_widget_type_set(obj, "hover"); + elm_widget_sub_object_add(parent, obj); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_data_set(obj, wd); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_can_focus_set(obj, EINA_TRUE); + elm_widget_signal_emit_hook_set(obj, _signal_emit_hook); + elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook); + elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); + + ELM_HOVER_PARTS_FOREACH + wd->subs[i].swallow = _directions[i]; + + wd->hov = evas_object_rectangle_add(e); + evas_object_pass_events_set(wd->hov, EINA_TRUE); + evas_object_color_set(wd->hov, 0, 0, 0, 0); + elm_widget_resize_object_set(obj, wd->hov); + evas_object_event_callback_add(wd->hov, EVAS_CALLBACK_MOVE, _hov_move, obj); + evas_object_event_callback_add(wd->hov, EVAS_CALLBACK_RESIZE, _hov_resize, obj); + evas_object_event_callback_add(wd->hov, EVAS_CALLBACK_SHOW, _hov_show, obj); + evas_object_event_callback_add(wd->hov, EVAS_CALLBACK_HIDE, _hov_hide, obj); + + wd->cov = edje_object_add(e); + _elm_theme_object_set(obj, wd->cov, "hover", "base", "default"); + elm_widget_sub_object_add(obj, wd->cov); + edje_object_signal_callback_add(wd->cov, "elm,action,dismiss", "", + _signal_dismiss, obj); + + wd->offset = evas_object_rectangle_add(e); + evas_object_pass_events_set(wd->offset, EINA_TRUE); + evas_object_color_set(wd->offset, 0, 0, 0, 0); + elm_widget_sub_object_add(obj, wd->offset); + + wd->size = evas_object_rectangle_add(e); + evas_object_pass_events_set(wd->size, EINA_TRUE); + evas_object_color_set(wd->size, 0, 0, 0, 0); + elm_widget_sub_object_add(obj, wd->size); + + edje_object_part_swallow(wd->cov, "elm.swallow.offset", wd->offset); + edje_object_part_swallow(wd->cov, "elm.swallow.size", wd->size); + + evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + + elm_hover_parent_set(obj, parent); + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _sizing_eval(obj); + return obj; +} + +EAPI void +elm_hover_target_set(Evas_Object *obj, Evas_Object *target) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (wd->target) + { + evas_object_event_callback_del_full(wd->target, EVAS_CALLBACK_DEL, + _target_del, obj); + evas_object_event_callback_del_full(wd->target, EVAS_CALLBACK_MOVE, + _target_move, obj); + } + wd->target = target; + if (wd->target) + { + evas_object_event_callback_add(wd->target, EVAS_CALLBACK_DEL, + _target_del, obj); + evas_object_event_callback_add(wd->target, EVAS_CALLBACK_MOVE, + _target_move, obj); + elm_widget_hover_object_set(target, obj); + _sizing_eval(obj); + } +} + + +EAPI void +elm_hover_parent_set(Evas_Object *obj, Evas_Object *parent) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->parent) + { + evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_MOVE, + _parent_move, obj); + evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_RESIZE, + _parent_resize, obj); + evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_SHOW, + _parent_show, obj); + evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_HIDE, + _parent_hide, obj); + evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_DEL, + _parent_del, obj); + } + wd->parent = parent; + if (wd->parent) + { + evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_MOVE, + _parent_move, obj); + evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_RESIZE, + _parent_resize, obj); + evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_SHOW, + _parent_show, obj); + evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_HIDE, + _parent_hide, obj); + evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_DEL, + _parent_del, obj); + // elm_widget_sub_object_add(parent, obj); + } + _sizing_eval(obj); +} + +EAPI Evas_Object * +elm_hover_target_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + return wd->target; +} + +EAPI Evas_Object * +elm_hover_parent_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + return wd->parent; +} + +static void +_elm_hover_subs_del(Widget_Data *wd) +{ + ELM_HOVER_PARTS_FOREACH + { + if (wd->subs[i].obj) + { + evas_object_del(wd->subs[i].obj); + wd->subs[i].obj = NULL; + } + } +} + +static void +_elm_hover_sub_obj_placement_eval(Evas_Object *obj) +{ + Evas_Coord spc_l, spc_r, spc_t, spc_b; + const char *smart_dir; + Widget_Data *wd; + char buf[1024]; + + wd = elm_widget_data_get(obj); + if (!wd->smt_sub) + return; + + _elm_hover_left_space_calc(wd, &spc_l, &spc_t, &spc_r, &spc_b); + + edje_object_part_unswallow(wd->cov, wd->smt_sub); + + smart_dir = _elm_hover_smart_content_location_get(wd, spc_l, spc_t, spc_r, + spc_b); + evas_object_smart_callback_call(obj, SIG_SMART_LOCATION_CHANGED, + (void *)smart_dir); + + if (elm_widget_mirrored_get(obj)) + { + if (smart_dir == _HOV_BOTTOM_LEFT) + smart_dir = _HOV_BOTTOM_RIGHT; + else if (smart_dir == _HOV_BOTTOM_RIGHT) + smart_dir = _HOV_BOTTOM_LEFT; + else if (smart_dir == _HOV_RIGHT) + smart_dir = _HOV_LEFT; + else if (smart_dir == _HOV_LEFT) + smart_dir = _HOV_RIGHT; + else if (smart_dir == _HOV_TOP_RIGHT) + smart_dir = _HOV_TOP_LEFT; + else if (smart_dir == _HOV_TOP_LEFT) + smart_dir = _HOV_TOP_RIGHT; + } + snprintf(buf, sizeof(buf), "elm.swallow.slot.%s", smart_dir); + edje_object_part_swallow(wd->cov, buf, wd->smt_sub); +} + +static void +_elm_hover_sub_obj_placement_eval_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _elm_hover_sub_obj_placement_eval(data); +} + +static void +_elm_hover_sub_obj_unparent(Evas_Object *obj) +{ + Widget_Data *wd; + Evas_Object *smt_sub; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + smt_sub = wd->smt_sub; + elm_widget_sub_object_del(obj, wd->smt_sub); + evas_object_event_callback_del_full(smt_sub, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _elm_hover_sub_obj_placement_eval_cb, + obj); + edje_object_part_unswallow(wd->cov, smt_sub); +} + +EAPI const char * +elm_hover_best_content_location_get(const Evas_Object *obj, Elm_Hover_Axis pref_axis) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + + Evas_Coord spc_l, spc_r, spc_t, spc_b; + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) + return NULL; + + _elm_hover_left_space_calc(wd, &spc_l, &spc_t, &spc_r, &spc_b); + + if (pref_axis == ELM_HOVER_AXIS_HORIZONTAL) + { + if (spc_l < spc_r) return _HOV_RIGHT; + else return _HOV_LEFT; + } + else if (pref_axis == ELM_HOVER_AXIS_VERTICAL) + { + if (spc_t < spc_b) return _HOV_BOTTOM; + else return _HOV_TOP; + } + + if (spc_l < spc_r) + { + if (spc_t > spc_r) return _HOV_TOP; + else if (spc_b > spc_r) return _HOV_BOTTOM; + return _HOV_RIGHT; + } + if (spc_t > spc_r) return _HOV_TOP; + else if (spc_b > spc_r) return _HOV_BOTTOM; + return _HOV_LEFT; +} + +EAPI void +elm_hover_dismiss(Evas_Object *obj) +{ + Widget_Data *wd; + ELM_CHECK_WIDTYPE(obj, widtype); + wd = elm_widget_data_get(obj); + if (!wd) return; + + edje_object_signal_emit(wd->cov, "elm,action,dismiss", ""); +} + +static void +_content_set_hook(Evas_Object *obj, const char *swallow, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (!strcmp(swallow, "smart")) + { + if (wd->smt_sub != content) + { + _elm_hover_subs_del(wd); + wd->smt_sub = content; + } + + if (content) + { + elm_widget_sub_object_add(obj, content); + evas_object_event_callback_add(wd->smt_sub, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _elm_hover_sub_obj_placement_eval_cb, + obj); + + _elm_hover_sub_obj_placement_eval(obj); + } + + goto end; + } + + if (wd->smt_sub) + { + evas_object_del(wd->smt_sub); + wd->smt_sub = NULL; + } + + ELM_HOVER_PARTS_FOREACH + { + if (!strcmp(swallow, wd->subs[i].swallow)) + { + if (content == wd->subs[i].obj) + return; + evas_object_del(wd->subs[i].obj); + wd->subs[i].obj = NULL; + + if (content) + { + char buf[1024]; + + snprintf(buf, sizeof(buf), "elm.swallow.slot.%s", swallow); + elm_widget_sub_object_add(obj, content); + edje_object_part_swallow(wd->cov, buf, content); + wd->subs[i].obj = content; + } + break; + } + } +end: + _sizing_eval(obj); +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *swallow) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + if (!strcmp(swallow, "smart")) + return wd->smt_sub; + + ELM_HOVER_PARTS_FOREACH + if (!strcmp(swallow, wd->subs[i].swallow)) + return wd->subs[i].obj; + + return NULL; +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *swallow) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + if (!strcmp(swallow, "smart")) + { + if (!wd->smt_sub) return NULL; + Evas_Object *content = wd->smt_sub; + _elm_hover_sub_obj_unparent(obj); + return content; + } + + ELM_HOVER_PARTS_FOREACH + { + if (!strcmp(swallow, wd->subs[i].swallow)) + { + if (!wd->subs[i].obj) return NULL; + Evas_Object *content = wd->subs[i].obj; + elm_widget_sub_object_del(obj, wd->subs[i].obj); + edje_object_part_unswallow(wd->cov, content); + return content; + } + } + + return NULL; +} diff --git a/libraries/elementary/src/lib/elm_hover.h b/libraries/elementary/src/lib/elm_hover.h new file mode 100644 index 0000000..1413098 --- /dev/null +++ b/libraries/elementary/src/lib/elm_hover.h @@ -0,0 +1,199 @@ +/** + * @defgroup Hover Hover + * @ingroup Elementary + * + * @image html img/widget/hover/preview-00.png + * @image latex img/widget/hover/preview-00.eps + * + * A Hover object will hover over its @p parent object at the @p target + * location. Anything in the background will be given a darker coloring to + * indicate that the hover object is on top (at the default theme). When the + * hover is clicked it is dismissed(hidden), if the contents of the hover are + * clicked that @b doesn't cause the hover to be dismissed. + * + * A Hover object has two parents. One parent that owns it during creation + * and the other parent being the one over which the hover object spans. + * + * + * @note The hover object will take up the entire space of @p target + * object. + * + * Elementary has the following styles for the hover widget: + * @li default + * @li popout + * @li menu + * @li hoversel_vertical + * + * The following are the available position for content: + * @li left + * @li top-left + * @li top + * @li top-right + * @li right + * @li bottom-right + * @li bottom + * @li bottom-left + * @li middle + * @li smart + * + * Signals that you can add callbacks for are: + * @li "clicked" - the user clicked the empty space in the hover to dismiss + * @li "smart,changed" - a content object placed under the "smart" + * policy was replaced to a new slot direction. + * + * Default content parts of the hover widget that you can use for are: + * @li "left" + * @li "top-left" + * @li "top" + * @li "top-right" + * @li "right" + * @li "bottom-right" + * @li "bottom" + * @li "bottom-left" + * @li "middle" + * @li "smart" + * + * @note These content parts indicates the direction that the content will be + * displayed + * + * All directions may have contents at the same time, except for + * "smart". This is a special placement hint and its use case + * depends of the calculations coming from + * elm_hover_best_content_location_get(). Its use is for cases when + * one desires only one hover content, but with a dynamic special + * placement within the hover area. The content's geometry, whenever + * it changes, will be used to decide on a best location, not + * extrapolating the hover's parent object view to show it in (still + * being the hover's target determinant of its medium part -- move and + * resize it to simulate finger sizes, for example). If one of the + * directions other than "smart" are used, a previously content set + * using it will be deleted, and vice-versa. + * + * Supported elm_object common APIs. + * @li @ref elm_object_signal_emit + * @li @ref elm_object_signal_callback_add + * @li @ref elm_object_signal_callback_del + * @li @ref elm_object_part_content_set + * @li @ref elm_object_part_content_get + * @li @ref elm_object_part_content_unset + * + * See @ref tutorial_hover for more information. + * + * @{ + */ + +/** + * @typedef Elm_Hover_Axis + * + * The orientation axis for the hover object + */ +typedef enum +{ + ELM_HOVER_AXIS_NONE, /**< ELM_HOVER_AXIS_NONE -- no preferred orientation */ + ELM_HOVER_AXIS_HORIZONTAL, /**< ELM_HOVER_AXIS_HORIZONTAL -- horizontal */ + ELM_HOVER_AXIS_VERTICAL, /**< ELM_HOVER_AXIS_VERTICAL -- vertical */ + ELM_HOVER_AXIS_BOTH /**< ELM_HOVER_AXIS_BOTH -- both */ +} Elm_Hover_Axis; + +/** + * @brief Adds a hover object to @p parent + * + * @param parent The parent object + * @return The hover object or NULL if one could not be created + * + * @ingroup Hover + */ +EAPI Evas_Object *elm_hover_add(Evas_Object *parent); + +/** + * @brief Sets the target object for the hover. + * + * @param obj The hover object + * @param target The object to center the hover onto. + * + * This function will cause the hover to be centered on the target object. + * + * @ingroup Hover + */ +EAPI void elm_hover_target_set(Evas_Object *obj, Evas_Object *target); + +/** + * @brief Gets the target object for the hover. + * + * @param obj The hover object + * @return The target object for the hover. + * + * @see elm_hover_target_set() + * + * @ingroup Hover + */ +EAPI Evas_Object *elm_hover_target_get(const Evas_Object *obj); + +/** + * @brief Sets the parent object for the hover. + * + * @param obj The hover object + * @param parent The object to locate the hover over. + * + * This function will cause the hover to take up the entire space that the + * parent object fills. + * + * @ingroup Hover + */ +EAPI void elm_hover_parent_set(Evas_Object *obj, Evas_Object *parent); + +/** + * @brief Gets the parent object for the hover. + * + * @param obj The hover object + * @return The parent object to locate the hover over. + * + * @see elm_hover_parent_set() + * + * @ingroup Hover + */ +EAPI Evas_Object *elm_hover_parent_get(const Evas_Object *obj); + +/** + * @brief Returns the best swallow location for content in the hover. + * + * @param obj The hover object + * @param pref_axis The preferred orientation axis for the hover object to use + * @return The edje location to place content into the hover or @c + * NULL, on errors. + * + * Best is defined here as the location at which there is the most available + * space. + * + * @p pref_axis may be one of + * - @c ELM_HOVER_AXIS_NONE -- no preferred orientation + * - @c ELM_HOVER_AXIS_HORIZONTAL -- horizontal + * - @c ELM_HOVER_AXIS_VERTICAL -- vertical + * - @c ELM_HOVER_AXIS_BOTH -- both + * + * If ELM_HOVER_AXIS_HORIZONTAL is chosen the returned position will + * necessarily be along the horizontal axis("left" or "right"). If + * ELM_HOVER_AXIS_VERTICAL is chosen the returned position will necessarily + * be along the vertical axis("top" or "bottom"). Choosing + * ELM_HOVER_AXIS_BOTH or ELM_HOVER_AXIS_NONE has the same effect and the + * returned position may be in either axis. + * + * @see elm_object_part_content_set() + * + * @ingroup Hover + */ +EAPI const char *elm_hover_best_content_location_get(const Evas_Object *obj, Elm_Hover_Axis pref_axis); + +/** + * @brief Dismiss a hover object + * + * @param obj The hover object + * Use this function to simulate clicking outside the hover to dismiss it. + * In this way, the hover will be hidden and the "clicked" signal will be emitted. + * + * @ingroup Hover + */ +EAPI void elm_hover_dismiss(Evas_Object *obj); +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_icon.c b/libraries/elementary/src/lib/elm_icon.c new file mode 100644 index 0000000..187df0e --- /dev/null +++ b/libraries/elementary/src/lib/elm_icon.c @@ -0,0 +1,1006 @@ +#include +#include "elm_priv.h" +#include "els_icon.h" +#include + +#ifdef ELM_EFREET +#define NON_EXISTING (void *)-1 +static const char *icon_theme = NULL; +#endif + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *img; + const char *stdicon; + Elm_Icon_Lookup_Order lookup_order; + +#ifdef HAVE_ELEMENTARY_ETHUMB + struct + { + struct + { + const char *path; + const char *key; + } file, thumb; + + Ecore_Event_Handler *eeh; + + Ethumb_Thumb_Format format; + + Ethumb_Client_Async *request; + + Eina_Bool retry : 1; + } thumb; +#endif + +#ifdef ELM_EFREET + struct + { + int requested_size; + Eina_Bool use : 1; + } freedesktop; +#endif + int in_eval; + Eina_Bool scale_up : 1; + Eina_Bool scale_down : 1; + Eina_Bool smooth : 1; + Eina_Bool fill_outside : 1; + Eina_Bool no_scale : 1; + + /* for animation feature */ + Ecore_Timer *timer; + int frame_count; + int cur_frame; + double duration; + Eina_Bool anim : 1; + Eina_Bool play : 1; +}; + +#ifdef HAVE_ELEMENTARY_ETHUMB +static Eina_List *_elm_icon_retry = NULL; +static int _icon_pending_request = 0; +#endif + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); + +static Eina_Bool _icon_standard_set(Widget_Data *wd, Evas_Object *obj, const char *name); +static Eina_Bool _icon_freedesktop_set(Widget_Data *wd, Evas_Object *obj, const char *name, int size); + +static const char SIG_CLICKED[] = "clicked"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CLICKED, ""}, + {NULL, NULL} +}; + + +//FIXME: move this code to ecore +#ifdef _WIN32 +static Eina_Bool +_path_is_absolute(const char *path) +{ + //TODO: Check if this works with all absolute paths in windows + return ((isalpha (*path)) && (*(path + 1) == ':') && ((*(path + 2) == '\\') || (*(path + 2) == '/'))); +} +#else +static Eina_Bool +_path_is_absolute(const char *path) +{ + return (*path == '/'); +} +#endif + +static inline int +_icon_size_min_get(Evas_Object *icon) +{ + int size; + _els_smart_icon_size_get(icon, &size, NULL); + return (size < 16) ? 16 : size; +} + +#ifdef HAVE_ELEMENTARY_ETHUMB +static void +_icon_thumb_stop(Widget_Data *wd, void *ethumbd) +{ + if (wd->thumb.request) + { + ethumb_client_thumb_async_cancel(ethumbd, wd->thumb.request); + wd->thumb.request = NULL; + _icon_pending_request--; + } + + if (wd->thumb.retry) + { + _elm_icon_retry = eina_list_remove(_elm_icon_retry, wd); + wd->thumb.retry = EINA_FALSE; + } +} + +static Eina_Bool +_icon_thumb_display(Widget_Data *wd) +{ + Eina_Bool ret = EINA_FALSE; + + if (wd->thumb.format == ETHUMB_THUMB_EET) + { + static const char *extensions[] = { + ".avi", ".mp4", ".ogv", ".mov", ".mpg", ".wmv", NULL + }; + const char **ext, *ptr; + int prefix_size; + Eina_Bool video = EINA_FALSE; + + prefix_size = eina_stringshare_strlen(wd->thumb.file.path) - 4; + if (prefix_size >= 0) + { + ptr = wd->thumb.file.path + prefix_size; + for (ext = extensions; *ext; ++ext) + if (!strcasecmp(ptr, *ext)) + { + video = EINA_TRUE; + break; + } + } + + if (video) + ret = _els_smart_icon_file_edje_set(wd->img, wd->thumb.thumb.path, wd->thumb.thumb.key); + } + + if (!ret) + ret = _els_smart_icon_file_key_set(wd->img, wd->thumb.thumb.path, wd->thumb.thumb.key); + + return ret; +} + +static Eina_Bool +_icon_thumb_retry(Widget_Data *wd) +{ + return _icon_thumb_display(wd); +} + +static void +_icon_thumb_cleanup(Ethumb_Client *ethumbd) +{ + Eina_List *l, *ll; + Widget_Data *wd; + + EINA_LIST_FOREACH_SAFE(_elm_icon_retry, l, ll, wd) + if (_icon_thumb_retry(wd)) + { + _elm_icon_retry = eina_list_remove_list(_elm_icon_retry, l); + wd->thumb.retry = EINA_FALSE; + } + + if (_icon_pending_request == 0) + EINA_LIST_FREE(_elm_icon_retry, wd) + _icon_thumb_stop(wd, ethumbd); +} + +static void +_icon_thumb_finish(Widget_Data *wd, Ethumb_Client *ethumbd) +{ + const char *file = NULL, *group = NULL; + Eina_Bool ret; + + _els_smart_icon_file_get(wd->img, &file, &group); + file = eina_stringshare_ref(file); + group = eina_stringshare_ref(group); + + ret = _icon_thumb_display(wd); + + if (!ret && file) + { + const char *p; + + if (!wd->thumb.retry) + { + _elm_icon_retry = eina_list_append(_elm_icon_retry, wd); + wd->thumb.retry = EINA_TRUE; + } + + /* Back to previous image */ + if (((p = strrchr(file, '.'))) && (!strcasecmp(p, ".edj"))) + _els_smart_icon_file_edje_set(wd->img, file, group); + else + _els_smart_icon_file_key_set(wd->img, file, group); + } + + _icon_thumb_cleanup(ethumbd); + + eina_stringshare_del(file); + eina_stringshare_del(group); +} + +static void +_icon_thumb_done(Ethumb_Client *client, const char *thumb_path, const char *thumb_key, void *data) +{ + Widget_Data *wd = data; + + assert(wd->thumb.request); + + _icon_pending_request--; + wd->thumb.request = NULL; + + eina_stringshare_replace(&wd->thumb.thumb.path, thumb_path); + eina_stringshare_replace(&wd->thumb.thumb.key, thumb_key); + wd->thumb.format = ethumb_client_format_get(client); + + _icon_thumb_finish(wd, client); +} + +static void +_icon_thumb_error(Ethumb_Client *client, void *data) +{ + Widget_Data *wd = data; + + assert(wd->thumb.request); + + _icon_pending_request--; + wd->thumb.request = NULL; + + ERR("could not generate thumbnail for %s (key: %s)", wd->thumb.file.path, wd->thumb.file.key); + _icon_thumb_cleanup(client); +} + +static void +_icon_thumb_apply(Widget_Data *wd) +{ + Ethumb_Client *ethumbd; + + ethumbd = elm_thumb_ethumb_client_get(); + + _icon_thumb_stop(wd, ethumbd); + + if (!wd->thumb.file.path) return ; + + _icon_pending_request++; + if (!ethumb_client_file_set(ethumbd, wd->thumb.file.path, wd->thumb.file.key)) return ; + ethumb_client_size_set(ethumbd, _icon_size_min_get(wd->img), _icon_size_min_get(wd->img)); + wd->thumb.request = ethumb_client_thumb_async_get(ethumbd, _icon_thumb_done, _icon_thumb_error, wd); +} + +static Eina_Bool +_icon_thumb_apply_cb(void *data, int type __UNUSED__, void *ev __UNUSED__) +{ + Widget_Data *wd = data; + + _icon_thumb_apply(wd); + return ECORE_CALLBACK_RENEW; +} +#endif + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); +#ifdef HAVE_ELEMENTARY_ETHUMB + Ethumb_Client *ethumbd; +#endif + + if (!wd) return; + if (wd->stdicon) eina_stringshare_del(wd->stdicon); + +#ifdef HAVE_ELEMENTARY_ETHUMB + ethumbd = elm_thumb_ethumb_client_get(); + _icon_thumb_stop(wd, ethumbd); + + eina_stringshare_del(wd->thumb.file.path); + eina_stringshare_del(wd->thumb.file.key); + eina_stringshare_del(wd->thumb.thumb.path); + eina_stringshare_del(wd->thumb.thumb.key); + + if (wd->thumb.eeh) + ecore_event_handler_del(wd->thumb.eeh); +#endif + + if (wd->timer) + ecore_timer_del(wd->timer); + free(wd); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->stdicon) + _elm_theme_object_icon_set(obj, wd->img, wd->stdicon, elm_widget_style_get(obj)); + _sizing_eval(obj); +} + +static void +_signal_emit_hook(Evas_Object *obj, const char *emission, const char *source) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + Evas_Object *icon_edje; + icon_edje = _els_smart_icon_edje_get(wd->img); + if (!icon_edje) return; + edje_object_signal_emit(icon_edje, emission, source); +} + +static void +_signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + Evas_Object *icon_edje; + icon_edje = _els_smart_icon_edje_get(wd->img); + if (!icon_edje) return; + edje_object_signal_callback_add(icon_edje, emission, source, func_cb, data); +} + +static void +_signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + Evas_Object *icon_edje; + icon_edje = _els_smart_icon_edje_get(wd->img); + if (!icon_edje) return; + edje_object_signal_callback_del_full(icon_edje, emission, source, func_cb, + data); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; + int w, h; + + wd->in_eval++; + _els_smart_icon_size_get(wd->img, &w, &h); +#ifdef ELM_EFREET + if (wd->freedesktop.use && wd->stdicon) + { + int size; + /* This icon has been set to a freedesktop icon, and the requested + appears to have a different size than the requested size, so try to + request another, higher resolution, icon. +FIXME: Find a better heuristic to determine if there should be +an icon with a different resolution. */ + size = ((w / 16) + 1) * 16; + _icon_freedesktop_set(wd, obj, wd->stdicon, size); + } +#endif + _els_smart_icon_scale_up_set(wd->img, wd->scale_up); + _els_smart_icon_scale_down_set(wd->img, wd->scale_down); + _els_smart_icon_smooth_scale_set(wd->img, wd->smooth); + _els_smart_icon_fill_inside_set(wd->img, !(wd->fill_outside)); + if (wd->no_scale) _els_smart_icon_scale_set(wd->img, 1.0); + else + { + _els_smart_icon_scale_set(wd->img, elm_widget_scale_get(obj) * + _elm_config->scale); + _els_smart_icon_size_get(wd->img, &w, &h); + } + if (!wd->scale_down) + { + minw = w; + minh = h; + } + if (!wd->scale_up) + { + maxw = w; + maxh = h; + } + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, maxw, maxh); + wd->in_eval--; +} + +static void +_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Evas_Event_Mouse_Up *ev = event_info; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; + evas_object_smart_callback_call(data, SIG_CLICKED, event_info); +} + +static Eina_Bool +_elm_icon_animate_cb(void *data) +{ + Widget_Data *wd = data; + Evas_Object *img_obj; + + if (!wd) return ECORE_CALLBACK_CANCEL; + if (!wd->anim) return ECORE_CALLBACK_CANCEL; + + img_obj = _els_smart_icon_object_get(wd->img); + wd->cur_frame++; + if (wd->cur_frame > wd->frame_count) + wd->cur_frame = wd->cur_frame % wd->frame_count; + evas_object_image_animated_frame_set(img_obj, wd->cur_frame); + + wd->duration = evas_object_image_animated_frame_duration_get(img_obj, wd->cur_frame, 0); + + if (wd->duration > 0) + ecore_timer_interval_set(wd->timer, wd->duration); + return ECORE_CALLBACK_RENEW; +} + +static Eina_Bool +_icon_standard_set(Widget_Data *wd, Evas_Object *obj, const char *name) +{ + if (_elm_theme_object_icon_set(obj, wd->img, name, "default")) + { +#ifdef ELM_EFREET + /* TODO: elm_unneed_efreet() */ + wd->freedesktop.use = EINA_FALSE; +#endif + return EINA_TRUE; + } + return EINA_FALSE; +} + +static Eina_Bool +#ifdef ELM_EFREET +_icon_file_set(Widget_Data *wd, Evas_Object *obj, const char *path) +#else +_icon_file_set(Widget_Data *wd __UNUSED__, Evas_Object *obj, const char *path) +#endif +{ + if (elm_icon_file_set(obj, path, NULL)) + { +#ifdef ELM_EFREET + /* TODO: elm_unneed_efreet() */ + wd->freedesktop.use = EINA_FALSE; +#endif + return EINA_TRUE; + } + return EINA_FALSE; +} + +static Eina_Bool +#ifdef ELM_EFREET +_icon_freedesktop_set(Widget_Data *wd, Evas_Object *obj, const char *name, int size) +#else +_icon_freedesktop_set(Widget_Data *wd __UNUSED__, Evas_Object *obj __UNUSED__, const char *name __UNUSED__, int size __UNUSED__) +#endif +{ +#ifdef ELM_EFREET + const char *path; + + elm_need_efreet(); + if (icon_theme == NON_EXISTING) return EINA_FALSE; + if (!icon_theme) + { + Efreet_Icon_Theme *theme; + /* TODO: Listen for EFREET_EVENT_ICON_CACHE_UPDATE */ + theme = efreet_icon_theme_find(getenv("E_ICON_THEME")); + if (!theme) + { + const char **itr; + static const char *themes[] = { + "gnome", "Human", "oxygen", "hicolor", NULL + }; + for (itr = themes; *itr; itr++) + { + theme = efreet_icon_theme_find(*itr); + if (theme) break; + } + } + + if (!theme) + { + icon_theme = NON_EXISTING; + return EINA_FALSE; + } + else + icon_theme = eina_stringshare_add(theme->name.internal); + } + path = efreet_icon_path_find(icon_theme, name, size); + wd->freedesktop.use = !!path; + if (wd->freedesktop.use) + { + wd->freedesktop.requested_size = size; + elm_icon_file_set(obj, path, NULL); + return EINA_TRUE; + } +#endif + return EINA_FALSE; +} + +static Eina_Bool +_elm_icon_standard_set(Widget_Data *wd, Evas_Object *obj, const char *name, Eina_Bool *fdo) +{ + char *tmp; + Eina_Bool ret; + + /* try locating the icon using the specified lookup order */ + switch (wd->lookup_order) + { + case ELM_ICON_LOOKUP_FDO: + ret = _icon_freedesktop_set(wd, obj, name, _icon_size_min_get(wd->img)); + if (ret && fdo) *fdo = EINA_TRUE; + break; + case ELM_ICON_LOOKUP_THEME: + ret = _icon_standard_set(wd, obj, name); + break; + case ELM_ICON_LOOKUP_THEME_FDO: + ret = _icon_standard_set(wd, obj, name); + if (!ret) + { + ret = _icon_freedesktop_set(wd, obj, name, _icon_size_min_get(wd->img)); + if (ret && fdo) *fdo = EINA_TRUE; + } + break; + case ELM_ICON_LOOKUP_FDO_THEME: + default: + ret = _icon_freedesktop_set(wd, obj, name, _icon_size_min_get(wd->img)); + if (!ret) + ret = _icon_standard_set(wd, obj, name); + else if (fdo) + *fdo = EINA_TRUE; + break; + } + + if (ret) + { + eina_stringshare_replace(&wd->stdicon, name); + if (!wd->in_eval) _sizing_eval(obj); + return EINA_TRUE; + } + + if (_path_is_absolute(name)) + return _icon_file_set(wd, obj, name); + + /* if that fails, see if icon name is in the format size/name. if so, + try locating a fallback without the size specification */ + if (!(tmp = strchr(name, '/'))) return EINA_FALSE; + ++tmp; + if (*tmp) return elm_icon_standard_set(obj, tmp); + /* give up */ + return EINA_FALSE; +} + +static void +_elm_icon_standard_resize(void *data, + Evas *e __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Widget_Data *wd = data; + const char *refup = eina_stringshare_ref(wd->stdicon); + Eina_Bool fdo = EINA_FALSE; + + if (!_elm_icon_standard_set(wd, obj, wd->stdicon, &fdo) || (!fdo)) + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE, + _elm_icon_standard_resize, wd); + eina_stringshare_del(refup); +} + +#ifdef HAVE_ELEMENTARY_ETHUMB +static void +_elm_icon_thumb_resize(void *data, + Evas *e __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Widget_Data *wd = data; + + if (wd->thumb.file.path) + elm_icon_thumb_set(obj, wd->thumb.file.path, wd->thumb.file.key); +} +#endif + +EAPI Evas_Object * +elm_icon_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "icon"); + elm_widget_type_set(obj, "icon"); + elm_widget_can_focus_set(obj, EINA_FALSE); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_signal_emit_hook_set(obj, _signal_emit_hook); + elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook); + elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook); + + wd->lookup_order = ELM_ICON_LOOKUP_THEME_FDO; + wd->img = _els_smart_icon_add(e); + evas_object_event_callback_add(wd->img, EVAS_CALLBACK_MOUSE_UP, + _mouse_up, obj); + evas_object_repeat_events_set(wd->img, EINA_TRUE); + elm_widget_resize_object_set(obj, wd->img); + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + +#ifdef HAVE_ELEMENTARY_ETHUMB + wd->thumb.request = NULL; +#endif + + wd->smooth = EINA_TRUE; + wd->scale_up = EINA_TRUE; + wd->scale_down = EINA_TRUE; + + _sizing_eval(obj); + return obj; +} + +EAPI Eina_Bool +elm_icon_memfile_set(Evas_Object *obj, const void *img, size_t size, const char *format, const char *key) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + Eina_Bool ret; + + if (!wd) return EINA_FALSE; + EINA_SAFETY_ON_NULL_RETURN_VAL(img, EINA_FALSE); + EINA_SAFETY_ON_TRUE_RETURN_VAL(!size, EINA_FALSE); + eina_stringshare_del(wd->stdicon); + wd->stdicon = NULL; + ret = _els_smart_icon_memfile_set(wd->img, img, size, format, key); + if (!wd->in_eval) _sizing_eval(obj); + return ret; +} + +EAPI Eina_Bool +elm_icon_file_set(Evas_Object *obj, const char *file, const char *group) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + Eina_Bool ret; + + if (!wd) return EINA_FALSE; + EINA_SAFETY_ON_NULL_RETURN_VAL(file, EINA_FALSE); + +#ifdef ELM_EFREET + if (!wd->freedesktop.use) + { + if (wd->stdicon) eina_stringshare_del(wd->stdicon); + wd->stdicon = NULL; + } +#endif + if (eina_str_has_extension(file, ".edj")) + ret = _els_smart_icon_file_edje_set(wd->img, file, group); + else + ret = _els_smart_icon_file_key_set(wd->img, file, group); + if (!wd->in_eval) _sizing_eval(obj); + return ret; +} + +EAPI void +elm_icon_file_get(const Evas_Object *obj, const char **file, const char **group) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _els_smart_icon_file_get(wd->img, file, group); +} + +EAPI void +elm_icon_thumb_set(Evas_Object *obj, const char *file, const char *group) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + +#ifdef HAVE_ELEMENTARY_ETHUMB + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE, + _elm_icon_standard_resize, wd); + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE, + _elm_icon_thumb_resize, wd); + + evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, + _elm_icon_thumb_resize, wd); + + eina_stringshare_replace(&wd->thumb.file.path, file); + eina_stringshare_replace(&wd->thumb.file.key, group); + + if (elm_thumb_ethumb_client_connected_get()) + { + _icon_thumb_apply(wd); + return ; + } + + if (!wd->thumb.eeh) + { + wd->thumb.eeh = ecore_event_handler_add(ELM_ECORE_EVENT_ETHUMB_CONNECT, _icon_thumb_apply_cb, wd); + } +#else + (void) obj; + (void) file; + (void) group; +#endif +} + + +EAPI Eina_Bool +elm_icon_animated_available_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Evas_Object *img_obj ; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + img_obj = _els_smart_icon_object_get(wd->img); + + return evas_object_image_animated_get(img_obj); +} + +EAPI void +elm_icon_animated_set(Evas_Object *obj, Eina_Bool anim) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Evas_Object *img_obj ; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->anim == anim) return; + + img_obj = _els_smart_icon_object_get(wd->img); + if (!evas_object_image_animated_get(img_obj)) return; + if (anim) + { + wd->frame_count = evas_object_image_animated_frame_count_get(img_obj); + wd->cur_frame = 1; + wd->duration = evas_object_image_animated_frame_duration_get(img_obj, wd->cur_frame, 0); + evas_object_image_animated_frame_set(img_obj, wd->cur_frame); + } + else + { + wd->frame_count = -1; + wd->cur_frame = -1; + wd->duration = -1; + } + wd->anim = anim; + return; +} + +EAPI Eina_Bool +elm_icon_animated_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->anim; +} + +EAPI void +elm_icon_animated_play_set(Evas_Object *obj, Eina_Bool play) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (!wd->anim) return; + if (wd->play == play) return; + + if (play) + { + wd->timer = ecore_timer_add(wd->duration, _elm_icon_animate_cb, wd); + } + else + { + if (wd->timer) + { + ecore_timer_del(wd->timer); + wd->timer = NULL; + } + } + wd->play = play; + +} + +EAPI Eina_Bool +elm_icon_animated_play_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->play; +} + +EAPI Eina_Bool +elm_icon_standard_set(Evas_Object *obj, const char *name) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + Eina_Bool fdo = EINA_FALSE; + Eina_Bool ret; + + if ((!wd) || (!name)) return EINA_FALSE; + + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE, + _elm_icon_standard_resize, wd); + + ret = _elm_icon_standard_set(wd, obj, name, &fdo); + + if (fdo) + evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, + _elm_icon_standard_resize, wd); + + return ret; +} + +EAPI const char * +elm_icon_standard_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->stdicon; +} + +EAPI void +elm_icon_order_lookup_set(Evas_Object *obj, Elm_Icon_Lookup_Order order) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (wd) wd->lookup_order = order; +} + +EAPI Elm_Icon_Lookup_Order +elm_icon_order_lookup_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_ICON_LOOKUP_THEME_FDO; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return ELM_ICON_LOOKUP_THEME_FDO; + return wd->lookup_order; +} + +EAPI void +elm_icon_smooth_set(Evas_Object *obj, Eina_Bool smooth) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + wd->smooth = smooth; + if (!wd->in_eval) _sizing_eval(obj); +} + +EAPI Eina_Bool +elm_icon_smooth_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return EINA_FALSE; + return wd->smooth; +} + +EAPI void +elm_icon_no_scale_set(Evas_Object *obj, Eina_Bool no_scale) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + wd->no_scale = no_scale; + if (!wd->in_eval) _sizing_eval(obj); +} + +EAPI Eina_Bool +elm_icon_no_scale_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->no_scale; +} + +EAPI void +elm_icon_resizable_set(Evas_Object *obj, Eina_Bool size_up, Eina_Bool size_down) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + wd->scale_up = size_up; + wd->scale_down = size_down; + if (!wd->in_eval) _sizing_eval(obj); +} + +EAPI void +elm_icon_resizable_get(const Evas_Object *obj, Eina_Bool *size_up, Eina_Bool *size_down) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (size_up) *size_up = wd->scale_up; + if (size_down) *size_down = wd->scale_down; +} + +EAPI void +elm_icon_fill_outside_set(Evas_Object *obj, Eina_Bool fill_outside) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + wd->fill_outside = fill_outside; + if (!wd->in_eval) _sizing_eval(obj); +} + +EAPI void +elm_icon_size_get(const Evas_Object *obj, int *w, int *h) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + _els_smart_icon_size_get(wd->img, w, h); +} + +EAPI Eina_Bool +elm_icon_fill_outside_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return EINA_FALSE; + return wd->fill_outside; +} + +EAPI void +elm_icon_prescale_set(Evas_Object *obj, int size) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + _els_smart_icon_scale_size_set(wd->img, size); +} + +EAPI int +elm_icon_prescale_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return 0; + return _els_smart_icon_scale_size_get(wd->img); +} + +EAPI Evas_Object * +elm_icon_object_get(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return NULL; + return _els_smart_icon_object_get(wd->img); +} + +EAPI void +elm_icon_preload_disabled_set(Evas_Object *obj, Eina_Bool disabled) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + _els_smart_icon_preload_set(wd->img, !!disabled); +} + +EAPI void +elm_icon_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _els_smart_icon_aspect_fixed_set(wd->img, fixed); +} + +EAPI Eina_Bool +elm_icon_aspect_fixed_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return _els_smart_icon_aspect_fixed_get(wd->img); +} diff --git a/libraries/elementary/src/lib/elm_icon.h b/libraries/elementary/src/lib/elm_icon.h new file mode 100644 index 0000000..08d6c11 --- /dev/null +++ b/libraries/elementary/src/lib/elm_icon.h @@ -0,0 +1,566 @@ +/** + * @defgroup Icon Icon + * @ingroup Elementary + * + * @image html img/widget/icon/preview-00.png + * @image latex img/widget/icon/preview-00.eps + * + * An object that provides standard icon images (delete, edit, arrows, etc.) + * or a custom file (PNG, JPG, EDJE, etc.) used for an icon. + * + * The icon image requested can be in the elementary theme, or in the + * freedesktop.org paths. It's possible to set the order of preference from + * where the image will be used. + * + * This API is very similar to @ref Image, but with ready to use images. + * + * Default images provided by the theme are described below. + * + * The first list contains icons that were first intended to be used in + * toolbars, but can be used in many other places too: + * @li home + * @li close + * @li apps + * @li arrow_up + * @li arrow_down + * @li arrow_left + * @li arrow_right + * @li chat + * @li clock + * @li delete + * @li edit + * @li refresh + * @li folder + * @li file + * + * Now some icons that were designed to be used in menus (but again, you can + * use them anywhere else): + * @li menu/home + * @li menu/close + * @li menu/apps + * @li menu/arrow_up + * @li menu/arrow_down + * @li menu/arrow_left + * @li menu/arrow_right + * @li menu/chat + * @li menu/clock + * @li menu/delete + * @li menu/edit + * @li menu/refresh + * @li menu/folder + * @li menu/file + * + * And here we have some media player specific icons: + * @li media_player/forward + * @li media_player/info + * @li media_player/next + * @li media_player/pause + * @li media_player/play + * @li media_player/prev + * @li media_player/rewind + * @li media_player/stop + * + * Signals that you can add callbacks for are: + * + * "clicked" - This is called when a user has clicked the icon + * + * Supported elm_object common APIs. + * @li @ref elm_object_signal_emit + * @li @ref elm_object_signal_callback_add + * @li @ref elm_object_signal_callback_del + * + * An example of usage for this API follows: + * @li @ref tutorial_icon + */ + +/** + * @addtogroup Icon + * @{ + */ + +typedef enum +{ + ELM_ICON_NONE, + ELM_ICON_FILE, + ELM_ICON_STANDARD +} Elm_Icon_Type; + +/** + * @enum _Elm_Icon_Lookup_Order + * @typedef Elm_Icon_Lookup_Order + * + * Lookup order used by elm_icon_standard_set(). Should look for icons in the + * theme, FDO paths, or both? + * + * @ingroup Icon + */ +typedef enum +{ + ELM_ICON_LOOKUP_FDO_THEME, /**< icon look up order: freedesktop, theme */ + ELM_ICON_LOOKUP_THEME_FDO, /**< icon look up order: theme, freedesktop */ + ELM_ICON_LOOKUP_FDO, /**< icon look up order: freedesktop */ + ELM_ICON_LOOKUP_THEME /**< icon look up order: theme */ +} Elm_Icon_Lookup_Order; + +/** + * Add a new icon object to the parent. + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * @see elm_icon_file_set() + * + * @ingroup Icon + */ +EAPI Evas_Object *elm_icon_add(Evas_Object *parent); + +/** + * Set the file that will be used as icon. + * + * @param obj The icon object + * @param file The path to file that will be used as icon image + * @param group The group that the icon belongs to an edje file + * + * @return (@c EINA_TRUE = success, @c EINA_FALSE = error) + * + * @note The icon image set by this function can be changed by + * elm_icon_standard_set(). + * + * @see elm_icon_file_get() + * + * @ingroup Icon + */ +EAPI Eina_Bool elm_icon_file_set(Evas_Object *obj, const char *file, const char *group); + +/** + * Set a location in memory to be used as an icon + * + * @param obj The icon object + * @param img The binary data that will be used as an image + * @param size The size of binary data @p img + * @param format Optional format of @p img to pass to the image loader + * @param key Optional key of @p img to pass to the image loader (eg. if @p img is an edje file) + * + * The @p format string should be something like "png", "jpg", "tga", + * "tiff", "bmp" etc. if it is provided (NULL if not). This improves + * the loader performance as it tries the "correct" loader first before + * trying a range of other possible loaders until one succeeds. + * + * @return (@c EINA_TRUE = success, @c EINA_FALSE = error) + * + * @note The icon image set by this function can be changed by + * elm_icon_standard_set(). + * + * @ingroup Icon + */ +EAPI Eina_Bool elm_icon_memfile_set(Evas_Object *obj, const void *img, size_t size, const char *format, const char *key); + +/** + * Get the file that will be used as icon. + * + * @param obj The icon object + * @param file The path to file that will be used as the icon image + * @param group The group that the icon belongs to, in edje file + * + * @see elm_icon_file_set() + * + * @ingroup Icon + */ +EAPI void elm_icon_file_get(const Evas_Object *obj, const char **file, const char **group); + +/** + * Set the file that will be used, but use a generated thumbnail. + * + * @param obj The icon object + * @param file The path to file that will be used as icon image + * @param group The group that the icon belongs to an edje file + * + * This functions like elm_icon_file_set() but requires the Ethumb library + * support to be enabled successfully with elm_need_ethumb(). When set + * the file indicated has a thumbnail generated and cached on disk for + * future use or will directly use an existing cached thumbnail if it + * is valid. + * + * @see elm_icon_file_set() + * + * @ingroup Icon + */ +EAPI void elm_icon_thumb_set(Evas_Object *obj, const char *file, const char *group); + +/** + * Set the icon by icon standards names. + * + * @param obj The icon object + * @param name The icon name + * + * @return (@c EINA_TRUE = success, @c EINA_FALSE = error) + * + * For example, freedesktop.org defines standard icon names such as "home", + * "network", etc. There can be different icon sets to match those icon + * keys. The @p name given as parameter is one of these "keys", and will be + * used to look in the freedesktop.org paths and elementary theme. One can + * change the lookup order with elm_icon_order_lookup_set(). + * + * If name is not found in any of the expected locations and it is the + * absolute path of an image file, this image will be used. + * + * @note The icon image set by this function can be changed by + * elm_icon_file_set(). + * + * @see elm_icon_standard_get() + * @see elm_icon_file_set() + * + * @ingroup Icon + */ +EAPI Eina_Bool elm_icon_standard_set(Evas_Object *obj, const char *name); + +/** + * Get the icon name set by icon standard names. + * + * @param obj The icon object + * @return The icon name + * + * If the icon image was set using elm_icon_file_set() instead of + * elm_icon_standard_set(), then this function will return @c NULL. + * + * @see elm_icon_standard_set() + * + * @ingroup Icon + */ +EAPI const char *elm_icon_standard_get(const Evas_Object *obj); + +/** + * Set the smooth scaling for an icon object. + * + * @param obj The icon object + * @param smooth @c EINA_TRUE if smooth scaling should be used, @c EINA_FALSE + * otherwise. Default is @c EINA_TRUE. + * + * Set the scaling algorithm to be used when scaling the icon image. Smooth + * scaling provides a better resulting image, but is slower. + * + * The smooth scaling should be disabled when making animations that change + * the icon size, since they will be faster. Animations that don't require + * resizing of the icon can keep the smooth scaling enabled (even if the icon + * is already scaled, since the scaled icon image will be cached). + * + * @see elm_icon_smooth_get() + * + * @ingroup Icon + */ +EAPI void elm_icon_smooth_set(Evas_Object *obj, Eina_Bool smooth); + +/** + * Get whether smooth scaling is enabled for an icon object. + * + * @param obj The icon object + * @return @c EINA_TRUE if smooth scaling is enabled, @c EINA_FALSE otherwise. + * + * @see elm_icon_smooth_set() + * + * @ingroup Icon + */ +EAPI Eina_Bool elm_icon_smooth_get(const Evas_Object *obj); + +/** + * Disable scaling of this object. + * + * @param obj The icon object. + * @param no_scale @c EINA_TRUE if the object is not scalable, @c EINA_FALSE + * otherwise. Default is @c EINA_FALSE. + * + * This function disables scaling of the icon object through the function + * elm_object_scale_set(). However, this does not affect the object + * size/resize in any way. For that effect, take a look at + * elm_icon_resizable_set(). + * + * @see elm_icon_no_scale_get() + * @see elm_icon_resizable_set() + * @see elm_object_scale_set() + * + * @ingroup Icon + */ +EAPI void elm_icon_no_scale_set(Evas_Object *obj, Eina_Bool no_scale); + +/** + * Get whether scaling is disabled on the object. + * + * @param obj The icon object + * @return @c EINA_TRUE if scaling is disabled, @c EINA_FALSE otherwise + * + * @see elm_icon_no_scale_set() + * + * @ingroup Icon + */ +EAPI Eina_Bool elm_icon_no_scale_get(const Evas_Object *obj); + +/** + * Set if the object is (up/down) resizable. + * + * @param obj The icon object + * @param size_up A bool to set if the object is resizable up. Default is + * @c EINA_TRUE. + * @param size_down A bool to set if the object is resizable down. Default + * is @c EINA_TRUE. + * + * This function limits the icon object resize ability. If @p size_up is set to + * @c EINA_FALSE, the object can't have its height or width resized to a value + * higher than the original icon size. Same is valid for @p size_down. + * + * @see elm_icon_resizable_get() + * + * @ingroup Icon + */ +EAPI void elm_icon_resizable_set(Evas_Object *obj, Eina_Bool size_up, Eina_Bool size_down); + +/** + * Get if the object is (up/down) resizable. + * + * @param obj The icon object + * @param size_up A bool to set if the object is resizable up + * @param size_down A bool to set if the object is resizable down + * + * @see elm_icon_resizable_set() + * + * @ingroup Icon + */ +EAPI void elm_icon_resizable_get(const Evas_Object *obj, Eina_Bool *size_up, Eina_Bool *size_down); + +/** + * Get the object's image size + * + * @param obj The icon object + * @param w A pointer to store the width in + * @param h A pointer to store the height in + * + * @ingroup Icon + */ +EAPI void elm_icon_size_get(const Evas_Object *obj, int *w, int *h); + +/** + * Set if the icon fill the entire object area. + * + * @param obj The icon object + * @param fill_outside @c EINA_TRUE if the object is filled outside, + * @c EINA_FALSE otherwise. Default is @c EINA_FALSE. + * + * When the icon object is resized to a different aspect ratio from the + * original icon image, the icon image will still keep its aspect. This flag + * tells how the image should fill the object's area. They are: keep the + * entire icon inside the limits of height and width of the object (@p + * fill_outside is @c EINA_FALSE) or let the extra width or height go outside + * of the object, and the icon will fill the entire object (@p fill_outside + * is @c EINA_TRUE). + * + * @note Unlike @ref Image, there's no option in icon to set the aspect ratio + * retain property to false. Thus, the icon image will always keep its + * original aspect ratio. + * + * @see elm_icon_fill_outside_get() + * @see elm_image_fill_outside_set() + * + * @ingroup Icon + */ +EAPI void elm_icon_fill_outside_set(Evas_Object *obj, Eina_Bool fill_outside); + +/** + * Get if the object is filled outside. + * + * @param obj The icon object + * @return @c EINA_TRUE if the object is filled outside, @c EINA_FALSE otherwise. + * + * @see elm_icon_fill_outside_set() + * + * @ingroup Icon + */ +EAPI Eina_Bool elm_icon_fill_outside_get(const Evas_Object *obj); + +/** + * Set the prescale size for the icon. + * + * @param obj The icon object + * @param size The prescale size. This value is used for both width and + * height. + * + * This function sets a new size for pixmap representation of the given + * icon. It allows the icon to be loaded already in the specified size, + * reducing the memory usage and load time when loading a big icon with load + * size set to a smaller size. + * + * It's equivalent to the elm_bg_load_size_set() function for bg. + * + * @note this is just a hint, the real size of the pixmap may differ + * depending on the type of icon being loaded, being bigger than requested. + * + * @see elm_icon_prescale_get() + * @see elm_bg_load_size_set() + * + * @ingroup Icon + */ +EAPI void elm_icon_prescale_set(Evas_Object *obj, int size); + +/** + * Get the prescale size for the icon. + * + * @param obj The icon object + * @return The prescale size + * + * @see elm_icon_prescale_set() + * + * @ingroup Icon + */ +EAPI int elm_icon_prescale_get(const Evas_Object *obj); + +/** + * Gets the image object of the icon. DO NOT MODIFY THIS. + * + * @param obj The icon object + * @return The internal icon object + * + * @ingroup Icon + */ +EAPI Evas_Object *elm_icon_object_get(Evas_Object *obj); + +/** + * Sets the icon lookup order used by elm_icon_standard_set(). + * + * @param obj The icon object + * @param order The icon lookup order (can be one of + * ELM_ICON_LOOKUP_FDO_THEME, ELM_ICON_LOOKUP_THEME_FDO, ELM_ICON_LOOKUP_FDO + * or ELM_ICON_LOOKUP_THEME) + * + * @see elm_icon_order_lookup_get() + * @see Elm_Icon_Lookup_Order + * + * @ingroup Icon + */ +EAPI void elm_icon_order_lookup_set(Evas_Object *obj, Elm_Icon_Lookup_Order order); + +/** + * Gets the icon lookup order. + * + * @param obj The icon object + * @return The icon lookup order + * + * @see elm_icon_order_lookup_set() + * @see Elm_Icon_Lookup_Order + * + * @ingroup Icon + */ +EAPI Elm_Icon_Lookup_Order elm_icon_order_lookup_get(const Evas_Object *obj); + +/** + * Enable or disable preloading of the icon + * + * @param obj The icon object + * @param disabled If EINA_TRUE, preloading will be disabled + * @ingroup Icon + */ +EAPI void elm_icon_preload_disabled_set(Evas_Object *obj, Eina_Bool disabled); + +/** + * Get if the icon supports animation or not. + * + * @param obj The icon object + * @return @c EINA_TRUE if the icon supports animation, + * @c EINA_FALSE otherwise. + * + * Return if this elm icon's image can be animated. Currently Evas only + * supports gif animation. If the return value is EINA_FALSE, other + * elm_icon_animated_xxx APIs won't work. + * @ingroup Icon + */ +EAPI Eina_Bool elm_icon_animated_available_get(const Evas_Object *obj); + +/** + * Set animation mode of the icon. + * + * @param obj The icon object + * @param animated @c EINA_TRUE if the object do animation job, + * @c EINA_FALSE otherwise. Default is @c EINA_FALSE. + * + * Since the default animation mode is set to EINA_FALSE, + * the icon is shown without animation. Files like animated GIF files + * can animate, and this is supported if you enable animated support + * on the icon. + * Set it to EINA_TRUE when the icon needs to be animated. + * @ingroup Icon + */ +EAPI void elm_icon_animated_set(Evas_Object *obj, Eina_Bool animated); + +/** + * Get animation mode of the icon. + * + * @param obj The icon object + * @return The animation mode of the icon object + * @see elm_icon_animated_set + * @ingroup Icon + */ +EAPI Eina_Bool elm_icon_animated_get(const Evas_Object *obj); + +/** + * Set animation play mode of the icon. + * + * @param obj The icon object + * @param play @c EINA_TRUE the object play animation images, + * @c EINA_FALSE otherwise. Default is @c EINA_FALSE. + * + * To play elm icon's animation, set play to EINA_TRUE. + * For example, you make gif player using this set/get API and click event. + * This literally lets you control current play or paused state. To have + * this work with animated GIF files for example, you first, before + * setting the file have to use elm_icon_animated_set() to enable animation + * at all on the icon. + * + * 1. Click event occurs + * 2. Check play flag using elm_icon_animated_play_get + * 3. If elm icon was playing, set play to EINA_FALSE. + * Then animation will be stopped and vice versa + * @ingroup Icon + */ +EAPI void elm_icon_animated_play_set(Evas_Object *obj, Eina_Bool play); + +/** + * Get animation play mode of the icon. + * + * @param obj The icon object + * @return The play mode of the icon object + * + * @see elm_icon_animated_play_get + * @ingroup Icon + */ +EAPI Eina_Bool elm_icon_animated_play_get(const Evas_Object *obj); + +/** + * Set whether the original aspect ratio of the icon should be kept on resize. + * + * @param obj The icon object. + * @param fixed @c EINA_TRUE if the icon should retain the aspect, + * @c EINA_FALSE otherwise. + * + * The original aspect ratio (width / height) of the icon is usually + * distorted to match the object's size. Enabling this option will retain + * this original aspect, and the way that the icon is fit into the object's + * area depends on the option set by elm_icon_fill_outside_set(). + * + * @see elm_icon_aspect_fixed_get() + * @see elm_icon_fill_outside_set() + * + * @ingroup Icon + */ +EAPI void elm_icon_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed); + +/** + * Get if the object retains the original aspect ratio. + * + * @param obj The icon object. + * @return @c EINA_TRUE if the object keeps the original aspect, @c EINA_FALSE + * otherwise. + * + * @ingroup Icon + */ +EAPI Eina_Bool elm_icon_aspect_fixed_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_image.c b/libraries/elementary/src/lib/elm_image.c new file mode 100644 index 0000000..5d59251 --- /dev/null +++ b/libraries/elementary/src/lib/elm_image.c @@ -0,0 +1,352 @@ +#include +#include "elm_priv.h" +#include "els_icon.h" + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *img; + Eina_Bool scale_up : 1; + Eina_Bool scale_down : 1; + Eina_Bool smooth : 1; + Eina_Bool fill_outside : 1; + Eina_Bool no_scale : 1; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); + +static const char SIG_CLICKED[] = "clicked"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CLICKED, ""}, + {NULL, NULL} +}; + + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + free(wd); +} + +static void +_del_pre_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + evas_object_del(wd->img); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + _sizing_eval(obj); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; + int w, h; + + if (!wd) return; + _els_smart_icon_size_get(wd->img, &w, &h); + _els_smart_icon_scale_up_set(wd->img, wd->scale_up); + _els_smart_icon_scale_down_set(wd->img, wd->scale_down); + _els_smart_icon_smooth_scale_set(wd->img, wd->smooth); + _els_smart_icon_fill_inside_set(wd->img, !(wd->fill_outside)); + if (wd->no_scale) _els_smart_icon_scale_set(wd->img, 1.0); + else + { + _els_smart_icon_scale_set(wd->img, elm_widget_scale_get(obj) * _elm_config->scale); + _els_smart_icon_size_get(wd->img, &w, &h); + } + if (!wd->scale_down) + { + minw = w; + minh = h; + } + if (!wd->scale_up) + { + maxw = w; + maxh = h; + } + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, maxw, maxh); +} + +static void +_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_CLICKED, NULL); +} + +EAPI Evas_Object * +elm_image_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "image"); + elm_widget_type_set(obj, "image"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); + + wd->img = _els_smart_icon_add(e); + evas_object_event_callback_add(wd->img, EVAS_CALLBACK_MOUSE_UP, + _mouse_up, obj); + evas_object_repeat_events_set(wd->img, EINA_TRUE); + elm_widget_resize_object_set(obj, wd->img); + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + wd->smooth = EINA_TRUE; + wd->scale_up = EINA_TRUE; + wd->scale_down = EINA_TRUE; + + _els_smart_icon_scale_size_set(wd->img, 0); + + _sizing_eval(obj); + return obj; +} + +EAPI Eina_Bool +elm_image_file_set(Evas_Object *obj, const char *file, const char *group) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + Eina_Bool ret; + const char *p; + + if (!wd) return EINA_FALSE; + EINA_SAFETY_ON_NULL_RETURN_VAL(file, EINA_FALSE); + if (((p = strrchr(file, '.'))) && (!strcasecmp(p, ".edj"))) + ret = _els_smart_icon_file_edje_set(wd->img, file, group); + else + ret = _els_smart_icon_file_key_set(wd->img, file, group); + _sizing_eval(obj); + return ret; +} + +EAPI void +elm_image_file_get(const Evas_Object *obj, const char **file, const char **group) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _els_smart_icon_file_get(wd->img, file, group); +} + +EAPI void +elm_image_smooth_set(Evas_Object *obj, Eina_Bool smooth) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + wd->smooth = smooth; + _sizing_eval(obj); +} + +EAPI Eina_Bool +elm_image_smooth_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return EINA_FALSE; + return wd->smooth; +} + +EAPI void +elm_image_object_size_get(const Evas_Object *obj, int *w, int *h) +{ + if (w) *w = 0; + if (h) *h = 0; + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + _els_smart_icon_size_get(wd->img, w, h); +} + +EAPI void +elm_image_no_scale_set(Evas_Object *obj, Eina_Bool no_scale) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + wd->no_scale = no_scale; + _sizing_eval(obj); + +} + +EAPI Eina_Bool +elm_image_no_scale_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->no_scale; +} + +EAPI void +elm_image_resizable_set(Evas_Object *obj, Eina_Bool size_up, Eina_Bool size_down) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + wd->scale_up = size_up; + wd->scale_down = size_down; + _sizing_eval(obj); +} + +EAPI void +elm_image_resizable_get(const Evas_Object *obj, Eina_Bool *size_up, Eina_Bool *size_down) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (size_up) *size_up = wd->scale_up; + if (size_down) *size_down = wd->scale_down; +} + +EAPI void +elm_image_fill_outside_set(Evas_Object *obj, Eina_Bool fill_outside) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + wd->fill_outside = fill_outside; + _sizing_eval(obj); +} + +EAPI Eina_Bool +elm_image_fill_outside_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return EINA_FALSE; + return wd->fill_outside; +} + +EAPI void +elm_image_preload_disabled_set(Evas_Object *obj, Eina_Bool disabled) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + _els_smart_icon_preload_set(wd->img, !!disabled); +} + +EAPI void +elm_image_prescale_set(Evas_Object *obj, int size) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + _els_smart_icon_scale_size_set(wd->img, size); +} + +EAPI int +elm_image_prescale_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return 0; + return _els_smart_icon_scale_size_get(wd->img); +} + +EAPI void +elm_image_orient_set(Evas_Object *obj, Elm_Image_Orient orient) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + _els_smart_icon_orient_set(wd->img, orient); +} + +EAPI Elm_Image_Orient +elm_image_orient_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_IMAGE_ORIENT_NONE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return ELM_IMAGE_ORIENT_NONE; + return _els_smart_icon_orient_get(wd->img); +} + +EAPI void +elm_image_editable_set(Evas_Object *obj, Eina_Bool set) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + _els_smart_icon_edit_set(wd->img, set, obj); +} + +EAPI Eina_Bool +elm_image_editable_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return _els_smart_icon_edit_get(wd->img); +} + +EAPI Evas_Object * +elm_image_object_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return _els_smart_icon_object_get(wd->img); +} + +EAPI void +elm_image_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _els_smart_icon_aspect_fixed_set(wd->img, fixed); +} + +EAPI Eina_Bool +elm_image_aspect_fixed_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return _els_smart_icon_aspect_fixed_get(wd->img); +} + +/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-3f0^-2{2(0W1st0 :*/ diff --git a/libraries/elementary/src/lib/elm_image.h b/libraries/elementary/src/lib/elm_image.h new file mode 100644 index 0000000..59a904f --- /dev/null +++ b/libraries/elementary/src/lib/elm_image.h @@ -0,0 +1,390 @@ +/** + * @defgroup Image Image + * @ingroup Elementary + * + * @image html img/widget/image/preview-00.png + * @image latex img/widget/image/preview-00.eps + + * + * An object that allows one to load an image file to it. It can be used + * anywhere like any other elementary widget. + * + * This widget provides most of the functionality provided from @ref Bg or @ref + * Icon, but with a slightly different API (use the one that fits better your + * needs). + * + * The features not provided by those two other image widgets are: + * @li allowing to get the basic @c Evas_Object with elm_image_object_get(); + * @li change the object orientation with elm_image_orient_set(); + * @li and turning the image editable with elm_image_editable_set(). + * + * Signals that you can add callbacks for are: + * + * @li @c "clicked" - This is called when a user has clicked the image + * + * An example of usage for this API follows: + * @li @ref tutorial_image + */ + +/** + * @addtogroup Image + * @{ + */ + +/** + * Possible orientation options for elm_image_orient_set(). + * + * @image html elm_image_orient_set.png + * @image latex elm_image_orient_set.eps width=\textwidth + * + * @ingroup Image + */ +typedef enum +{ + ELM_IMAGE_ORIENT_NONE = 0, /**< no orientation change */ + ELM_IMAGE_ORIENT_0 = 0, /**< no orientation change */ + ELM_IMAGE_ROTATE_90 = 1, /**< rotate 90 degrees clockwise */ + ELM_IMAGE_ROTATE_180 = 2, /**< rotate 180 degrees clockwise */ + ELM_IMAGE_ROTATE_270 = 3, /**< rotate 90 degrees counter-clockwise (i.e. 270 degrees clockwise) */ + ELM_IMAGE_FLIP_HORIZONTAL = 4, /**< flip image horizontally */ + ELM_IMAGE_FLIP_VERTICAL = 5, /**< flip image vertically */ + ELM_IMAGE_FLIP_TRANSPOSE = 6, /**< flip the image along the y = (width - x) line (bottom-left to top-right) */ + ELM_IMAGE_FLIP_TRANSVERSE = 7 /**< flip the image along the y = x line (top-left to bottom-right) */ +} Elm_Image_Orient; + +/** + * Add a new image to the parent. + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * @see elm_image_file_set() + * + * @ingroup Image + */ +EAPI Evas_Object *elm_image_add(Evas_Object *parent); + +/** + * Set the file that will be used as image. + * + * @param obj The image object + * @param file The path to file that will be used as image + * @param group The group that the image belongs in edje file (if it's an + * edje image) + * + * @return (@c EINA_TRUE = success, @c EINA_FALSE = error) + * + * @see elm_image_file_get() + * + * @ingroup Image + */ +EAPI Eina_Bool elm_image_file_set(Evas_Object *obj, const char *file, const char *group); + +/** + * Get the file that will be used as image. + * + * @param obj The image object + * @param file The path to file + * @param group The group that the image belongs in edje file + * + * @see elm_image_file_set() + * + * @ingroup Image + */ +EAPI void elm_image_file_get(const Evas_Object *obj, const char **file, const char **group); + +/** + * Set the smooth effect for an image. + * + * @param obj The image object + * @param smooth @c EINA_TRUE if smooth scaling should be used, @c EINA_FALSE + * otherwise. Default is @c EINA_TRUE. + * + * Set the scaling algorithm to be used when scaling the image. Smooth + * scaling provides a better resulting image, but is slower. + * + * The smooth scaling should be disabled when making animations that change + * the image size, since it will be faster. Animations that don't require + * resizing of the image can keep the smooth scaling enabled (even if the + * image is already scaled, since the scaled image will be cached). + * + * @see elm_image_smooth_get() + * + * @ingroup Image + */ +EAPI void elm_image_smooth_set(Evas_Object *obj, Eina_Bool smooth); + +/** + * Get the smooth effect for an image. + * + * @param obj The image object + * @return @c EINA_TRUE if smooth scaling is enabled, @c EINA_FALSE otherwise. + * + * @see elm_image_smooth_get() + * + * @ingroup Image + */ +EAPI Eina_Bool elm_image_smooth_get(const Evas_Object *obj); + +/** + * Gets the current size of the image. + * + * @param obj The image object. + * @param w Pointer to store width, or NULL. + * @param h Pointer to store height, or NULL. + * + * This is the real size of the image, not the size of the object. + * + * @ingroup Image + */ +EAPI void elm_image_object_size_get(const Evas_Object *obj, int *w, int *h); + +/** + * Disable scaling of this object. + * + * @param obj The image object. + * @param no_scale @c EINA_TRUE if the object is not scalable, @c EINA_FALSE + * otherwise. Default is @c EINA_FALSE. + * + * This function disables scaling of the elm_image widget through the + * function elm_object_scale_set(). However, this does not affect the widget + * size/resize in any way. For that effect, take a look at + * elm_image_resizable_set(). + * + * @see elm_image_no_scale_get() + * @see elm_image_resizable_set() + * @see elm_object_scale_set() + * + * @ingroup Image + */ +EAPI void elm_image_no_scale_set(Evas_Object *obj, Eina_Bool no_scale); + +/** + * Get whether scaling is disabled on the object. + * + * @param obj The image object + * @return @c EINA_TRUE if scaling is disabled, @c EINA_FALSE otherwise + * + * @see elm_image_no_scale_set() + * + * @ingroup Image + */ +EAPI Eina_Bool elm_image_no_scale_get(const Evas_Object *obj); + +/** + * Set if the object is (up/down) resizable. + * + * @param obj The image object + * @param size_up A bool to set if the object is resizable up. Default is + * @c EINA_TRUE. + * @param size_down A bool to set if the object is resizable down. Default + * is @c EINA_TRUE. + * + * This function limits the image resize ability. If @p size_up is set to + * @c EINA_FALSE, the object can't have its height or width resized to a value + * higher than the original image size. Same is valid for @p size_down. + * + * @see elm_image_resizable_get() + * + * @ingroup Image + */ +EAPI void elm_image_resizable_set(Evas_Object *obj, Eina_Bool size_up, Eina_Bool size_down); + +/** + * Get if the object is (up/down) resizable. + * + * @param obj The image object + * @param size_up A bool to set if the object is resizable up + * @param size_down A bool to set if the object is resizable down + * + * @see elm_image_resizable_set() + * + * @ingroup Image + */ +EAPI void elm_image_resizable_get(const Evas_Object *obj, Eina_Bool *size_up, Eina_Bool *size_down); + +/** + * Set if the image fills the entire object area, when keeping the aspect ratio. + * + * @param obj The image object + * @param fill_outside @c EINA_TRUE if the object is filled outside, + * @c EINA_FALSE otherwise. Default is @c EINA_FALSE. + * + * When the image should keep its aspect ratio even if resized to another + * aspect ratio, there are two possibilities to resize it: keep the entire + * image inside the limits of height and width of the object (@p fill_outside + * is @c EINA_FALSE) or let the extra width or height go outside of the object, + * and the image will fill the entire object (@p fill_outside is @c EINA_TRUE). + * + * @note This option will have no effect if + * elm_image_aspect_fixed_set() is set to @c EINA_FALSE. + * + * @see elm_image_fill_outside_get() + * @see elm_image_aspect_fixed_set() + * + * @ingroup Image + */ +EAPI void elm_image_fill_outside_set(Evas_Object *obj, Eina_Bool fill_outside); + +/** + * Get if the object is filled outside + * + * @param obj The image object + * @return @c EINA_TRUE if the object is filled outside, @c EINA_FALSE otherwise. + * + * @see elm_image_fill_outside_set() + * + * @ingroup Image + */ +EAPI Eina_Bool elm_image_fill_outside_get(const Evas_Object *obj); + +/** + * Enable or disable preloading of the image + * + * @param obj The image object + * @param disabled If EINA_TRUE, preloading will be disabled + * @ingroup Icon + */ +EAPI void elm_image_preload_disabled_set(Evas_Object *obj, Eina_Bool disabled); + +/** + * Set the prescale size for the image + * + * @param obj The image object + * @param size The prescale size. This value is used for both width and + * height. + * + * This function sets a new size for pixmap representation of the given + * image. It allows the image to be loaded already in the specified size, + * reducing the memory usage and load time when loading a big image with load + * size set to a smaller size. + * + * It's equivalent to the elm_bg_load_size_set() function for bg. + * + * @note this is just a hint, the real size of the pixmap may differ + * depending on the type of image being loaded, being bigger than requested. + * + * @see elm_image_prescale_get() + * @see elm_bg_load_size_set() + * + * @ingroup Image + */ +EAPI void elm_image_prescale_set(Evas_Object *obj, int size); + +/** + * Get the prescale size for the image + * + * @param obj The image object + * @return The prescale size + * + * @see elm_image_prescale_set() + * + * @ingroup Image + */ +EAPI int elm_image_prescale_get(const Evas_Object *obj); + +/** + * Set the image orientation. + * + * @param obj The image object + * @param orient The image orientation @ref Elm_Image_Orient + * Default is #ELM_IMAGE_ORIENT_NONE. + * + * This function allows to rotate or flip the given image. + * + * @see elm_image_orient_get() + * @see @ref Elm_Image_Orient + * + * @ingroup Image + */ +EAPI void elm_image_orient_set(Evas_Object *obj, Elm_Image_Orient orient); + +/** + * Get the image orientation. + * + * @param obj The image object + * @return The image orientation @ref Elm_Image_Orient + * + * @see elm_image_orient_set() + * @see @ref Elm_Image_Orient + * + * @ingroup Image + */ +EAPI Elm_Image_Orient elm_image_orient_get(const Evas_Object *obj); + +/** + * Make the image 'editable'. + * + * @param obj Image object. + * @param set Turn on or off editability. Default is @c EINA_FALSE. + * + * This means the image is a valid drag target for drag and drop, and can be + * cut or pasted too. + * + * @ingroup Image + */ +EAPI void elm_image_editable_set(Evas_Object *obj, Eina_Bool set); + +/** + * Check if the image is 'editable'. + * + * @param obj Image object. + * @return Editability. + * + * A return value of EINA_TRUE means the image is a valid drag target + * for drag and drop, and can be cut or pasted too. + * + * @ingroup Image + */ +EAPI Eina_Bool elm_image_editable_get(const Evas_Object *obj); + +/** + * Get the inlined image object of the image widget. + * + * @param obj The image object to get the inlined image from + * @return The inlined image object, or NULL if none exists + * + * This function allows one to get the underlying @c Evas_Object of type + * Image from this elementary widget. It can be useful to do things like get + * the pixel data, save the image to a file, etc. + * + * @note Be careful to not manipulate it, as it is under control of + * elementary. + * + * @ingroup Image + */ +EAPI Evas_Object *elm_image_object_get(const Evas_Object *obj); + +/** + * Set whether the original aspect ratio of the image should be kept on resize. + * + * @param obj The image object. + * @param fixed @c EINA_TRUE if the image should retain the aspect, + * @c EINA_FALSE otherwise. + * + * The original aspect ratio (width / height) of the image is usually + * distorted to match the object's size. Enabling this option will retain + * this original aspect, and the way that the image is fit into the object's + * area depends on the option set by elm_image_fill_outside_set(). + * + * @see elm_image_aspect_fixed_get() + * @see elm_image_fill_outside_set() + * + * @ingroup Image + */ +EAPI void elm_image_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed); + +/** + * Get if the object retains the original aspect ratio. + * + * @param obj The image object. + * @return @c EINA_TRUE if the object keeps the original aspect, @c EINA_FALSE + * otherwise. + * + * @ingroup Image + */ +EAPI Eina_Bool elm_image_aspect_fixed_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_index.c b/libraries/elementary/src/lib/elm_index.c new file mode 100644 index 0000000..985b181 --- /dev/null +++ b/libraries/elementary/src/lib/elm_index.c @@ -0,0 +1,932 @@ +#include +#include "elm_priv.h" +#include "els_box.h" + +typedef struct _Widget_Data Widget_Data; +typedef struct _Elm_Index_Item Elm_Index_Item; + +struct _Widget_Data +{ + Evas_Object *base; + Evas_Object *event[2]; + Evas_Object *bx[2]; // 2 - for now all that's supported + Eina_List *items; // 1 list. yes N levels, but only 2 for now and # of items will be small + int level; + Evas_Coord dx, dy; + Ecore_Timer *delay; + Eina_Bool level_active[2]; + Eina_Bool horizontal : 1; + Eina_Bool autohide_disabled : 1; + Eina_Bool down : 1; + Eina_Bool indicator_disabled : 1; +}; + +struct _Elm_Index_Item +{ + ELM_WIDGET_ITEM; + const char *letter; + int level; + Evas_Smart_Cb func; + Eina_Bool selected : 1; +}; + +static const char *widtype = NULL; + +static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); +static void _theme_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _index_box_auto_fill(Evas_Object *obj, Evas_Object *box, int level); +static void _index_box_clear(Evas_Object *obj, Evas_Object *box, int level); +static void _item_free(Elm_Index_Item *it); + +static const char SIG_CHANGED[] = "changed"; +static const char SIG_DELAY_CHANGED[] = "delay,changed"; +static const char SIG_SELECTED[] = "selected"; +static const char SIG_LEVEL_UP[] = "level,up"; +static const char SIG_LEVEL_DOWN[] = "level,down"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CHANGED, ""}, + {SIG_DELAY_CHANGED, ""}, + {SIG_SELECTED, ""}, + {SIG_LEVEL_UP, ""}, + {SIG_LEVEL_DOWN, ""}, + {NULL, NULL} +}; + +static void +_del_pre_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Index_Item *it; + if (!wd) return; + _index_box_clear(obj, wd->bx[wd->level], wd->level); + _index_box_clear(obj, wd->bx[0], 0); + while (wd->items) + { + it = wd->items->data; + _item_free(it); + elm_widget_item_free(it); + } + if (wd->delay) ecore_timer_del(wd->delay); +} + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + free(wd); +} + +static void +_layout(Evas_Object *o, Evas_Object_Box_Data *priv, void *data) +{ + Widget_Data *wd = data; + if (!wd) return; + _els_box_layout(o, priv, wd->horizontal, 1, 0); +} + +static void +_signal_emit_hook(Evas_Object *obj, const char *emission, const char *source) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_signal_emit(wd->base, emission, source); +} + +static void +_signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_signal_callback_add(wd->base, emission, source, func_cb, data); +} + +static void +_signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + edje_object_signal_callback_del_full(wd->base, emission, source, func_cb, + data); +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (!wd->horizontal) + edje_object_mirrored_set(wd->base, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Evas_Coord minw = 0, minh = 0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_widget_mirrored_reload(obj); + + _index_box_clear(obj, wd->bx[0], 0); + _index_box_clear(obj, wd->bx[1], 1); + if (wd->horizontal) + _elm_theme_object_set(obj, wd->base, "index", "base/horizontal", elm_widget_style_get(obj)); + else + { + _elm_theme_object_set(obj, wd->base, "index", "base/vertical", elm_widget_style_get(obj)); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + } + edje_object_part_swallow(wd->base, "elm.swallow.event.0", wd->event[0]); + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + evas_object_size_hint_min_set(wd->event[0], minw, minh); + edje_object_part_swallow(wd->base, "elm.swallow.index.0", wd->bx[0]); + if (edje_object_part_exists(wd->base, "elm.swallow.index.1")) + { + if (!wd->bx[1]) + { + wd->bx[1] = evas_object_box_add(evas_object_evas_get(wd->base)); + evas_object_box_layout_set(wd->bx[1], _layout, wd, NULL); + elm_widget_sub_object_add(obj, wd->bx[1]); + } + edje_object_part_swallow(wd->base, "elm.swallow.index.1", wd->bx[1]); + evas_object_show(wd->bx[1]); + } + else if (wd->bx[1]) + { + evas_object_del(wd->bx[1]); + wd->bx[1] = NULL; + } + if (edje_object_part_exists(wd->base, "elm.swallow.event.1")) + { + if (!wd->event[1]) + { + wd->event[1] = evas_object_rectangle_add(evas_object_evas_get(wd->base)); + evas_object_color_set(wd->event[1], 0, 0, 0, 0); + elm_widget_sub_object_add(obj, wd->event[1]); + } + edje_object_part_swallow(wd->base, "elm.swallow.event.1", wd->event[1]); + evas_object_size_hint_min_set(wd->event[1], minw, minh); + } + else if (wd->event[1]) + { + evas_object_del(wd->event[1]); + wd->event[1] = NULL; + } + edje_object_message_signal_process(wd->base); + edje_object_scale_set(wd->base, elm_widget_scale_get(obj) * _elm_config->scale); + _sizing_eval(obj); + _index_box_auto_fill(obj, wd->bx[0], 0); + + if (wd->autohide_disabled) + { + if (wd->level == 1) _index_box_auto_fill(obj, wd->bx[1], 1); + edje_object_signal_emit(wd->base, "elm,state,active", "elm"); + } + else + edje_object_signal_emit(wd->base, "elm,state,inactive", "elm"); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; + if (!wd) return; + edje_object_size_min_calc(wd->base, &minw, &minh); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, maxw, maxh); +} + +static Eina_Bool +_item_del_pre_hook(Elm_Object_Item *it) +{ + Widget_Data *wd = elm_widget_data_get(WIDGET(it)); + if (!wd) return EINA_FALSE; + _item_free((Elm_Index_Item *)it); + _index_box_clear(WIDGET(it), wd->bx[wd->level], wd->level); + return EINA_TRUE; +} + +static Elm_Index_Item * +_item_new(Evas_Object *obj, const char *letter, Evas_Smart_Cb func, const void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Index_Item *it; + if (!wd) return NULL; + it = elm_widget_item_new(obj, Elm_Index_Item); + if (!it) return NULL; + elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook); + if (letter) it->letter = eina_stringshare_add(letter); + it->func = func; + it->base.data = data; + it->level = wd->level; + return it; +} + +static Elm_Index_Item * +_item_find(Evas_Object *obj, const void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Eina_List *l; + Elm_Index_Item *it; + if (!wd) return NULL; + EINA_LIST_FOREACH(wd->items, l, it) + if (it->base.data == data) return it; + return NULL; +} + +static void +_item_free(Elm_Index_Item *it) +{ + Widget_Data *wd = elm_widget_data_get(WIDGET(it)); + if (!wd) return; + wd->items = eina_list_remove(wd->items, it); + if (it->letter) eina_stringshare_del(it->letter); +} + +// FIXME: always have index filled +static void +_index_box_auto_fill(Evas_Object *obj, Evas_Object *box, int level) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Eina_Bool rtl; + Eina_List *l; + Elm_Index_Item *it; + Evas_Coord mw, mh, w, h; + int i = 0; + if (!wd) return; + if (wd->level_active[level]) return; + rtl = elm_widget_mirrored_get(obj); + evas_object_geometry_get(box, NULL, NULL, &w, &h); + EINA_LIST_FOREACH(wd->items, l, it) + { + Evas_Object *o; + const char *stacking; + + if (it->level != level) continue; + o = edje_object_add(evas_object_evas_get(obj)); + VIEW(it) = o; + edje_object_mirrored_set(VIEW(it), rtl); + + if (wd->horizontal) + { + if (i & 0x1) + _elm_theme_object_set(obj, o, "index", "item_odd/horizontal", + elm_widget_style_get(obj)); + else + _elm_theme_object_set(obj, o, "index", "item/horizontal", + elm_widget_style_get(obj)); + } + else + { + if (i & 0x1) + _elm_theme_object_set(obj, o, "index", "item_odd/vertical", + elm_widget_style_get(obj)); + else + _elm_theme_object_set(obj, o, "index", "item/vertical", + elm_widget_style_get(obj)); + } + + edje_object_part_text_escaped_set(o, "elm.text", it->letter); + edje_object_size_min_restricted_calc(o, &mw, &mh, 0, 0); + evas_object_size_hint_min_set(o, mw, mh); + evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_widget_sub_object_add(obj, o); + evas_object_box_append(box, o); + stacking = edje_object_data_get(o, "stacking"); + if (stacking) + { + if (!strcmp(stacking, "below")) evas_object_lower(o); + else if (!strcmp(stacking, "above")) evas_object_raise(o); + } + evas_object_show(o); + i++; + evas_object_smart_calculate(box); // force a calc so we know the size + evas_object_size_hint_min_get(box, &mw, &mh); + if (mh > h) + { + _index_box_clear(obj, box, level); + if (i > 0) + { + // FIXME: only i objects fit! try again. overflows right now + } + } + } + evas_object_smart_calculate(box); + wd->level_active[level] = 1; +} + +static void +_index_box_clear(Evas_Object *obj, Evas_Object *box __UNUSED__, int level) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Eina_List *l; + Elm_Index_Item *it; + if (!wd) return; + if (!wd->level_active[level]) return; + EINA_LIST_FOREACH(wd->items, l, it) + { + if (!VIEW(it)) continue; + if (it->level != level) continue; + evas_object_del(VIEW(it)); + VIEW(it) = NULL; + } + wd->level_active[level] = 0; +} + +static Eina_Bool +_delay_change(void *data) +{ + Widget_Data *wd = elm_widget_data_get(data); + Elm_Object_Item *item; + if (!wd) return ECORE_CALLBACK_CANCEL; + wd->delay = NULL; + item = elm_index_selected_item_get(data, wd->level); + if (item) evas_object_smart_callback_call(data, SIG_DELAY_CHANGED, item); + return ECORE_CALLBACK_CANCEL; +} + +static void +_sel_eval(Evas_Object *obj, Evas_Coord evx, Evas_Coord evy) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Index_Item *it, *it_closest, *it_last; + Eina_List *l; + Evas_Coord x, y, w, h, bx, by, bw, bh, xx, yy; + double cdv = 0.5; + Evas_Coord dist; + char *label = NULL, *last = NULL; + int i; + if (!wd) return; + for (i = 0; i <= wd->level; i++) + { + it_last = NULL; + it_closest = NULL; + dist = 0x7fffffff; + evas_object_geometry_get(wd->bx[i], &bx, &by, &bw, &bh); + EINA_LIST_FOREACH(wd->items, l, it) + { + if (it->level != i) continue; + if (it->level != wd->level) + { + if (it->selected) + { + it_closest = it; + break; + } + continue; + } + if (it->selected) + { + it_last = it; + it->selected = 0; + } + evas_object_geometry_get(VIEW(it), &x, &y, &w, &h); + xx = x + (w / 2); + yy = y + (h / 2); + x = evx - xx; + y = evy - yy; + x = (x * x) + (y * y); + if ((x < dist) || (!it_closest)) + { + if (wd->horizontal) + cdv = (double)(xx - bx) / (double)bw; + else + cdv = (double)(yy - by) / (double)bh; + it_closest = it; + dist = x; + } + } + if ((i == 0) && (wd->level == 0)) + edje_object_part_drag_value_set(wd->base, "elm.dragable.index.1", + cdv, cdv); + if (it_closest) it_closest->selected = 1; + if (it_closest != it_last) + { + if (it_last) + { + const char *stacking, *selectraise; + + it = it_last; + edje_object_signal_emit(VIEW(it), "elm,state,inactive", "elm"); + stacking = edje_object_data_get(VIEW(it), "stacking"); + selectraise = edje_object_data_get(VIEW(it), "selectraise"); + if ((selectraise) && (!strcmp(selectraise, "on"))) + { + if ((stacking) && (!strcmp(stacking, "below"))) + evas_object_lower(VIEW(it)); + } + } + if (it_closest) + { + const char *selectraise; + + it = it_closest; + edje_object_signal_emit(VIEW(it), "elm,state,active", "elm"); + selectraise = edje_object_data_get(VIEW(it), "selectraise"); + if ((selectraise) && (!strcmp(selectraise, "on"))) + evas_object_raise(VIEW(it)); + evas_object_smart_callback_call((void *)obj, SIG_CHANGED, (void *)it); + if (wd->delay) ecore_timer_del(wd->delay); + wd->delay = ecore_timer_add(0.2, _delay_change, obj); + } + } + if (it_closest) + { + it = it_closest; + if (!last && it->letter) + last = strdup(it->letter); + else + { + if (!label && last) label = strdup(last); + else + { + if (label && last) + { + label = realloc(label, strlen(label) + + strlen(last) + 1); + if (!label) return; + strcat(label, last); + } + } + free(last); + if (it->letter) last = strdup(it->letter); + } + } + } + if (!label) label = strdup(""); + if (!last) last = strdup(""); + edje_object_part_text_escaped_set(wd->base, "elm.text.body", label); + edje_object_part_text_escaped_set(wd->base, "elm.text", last); + free(label); + free(last); +} + +static void +_wheel(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + // Evas_Event_Mouse_Wheel *ev = event_info; + // Evas_Object *obj = o; + if (!wd) return; +} + +static void +_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(data); + Evas_Event_Mouse_Down *ev = event_info; + Evas_Coord x, y, w; + if (!wd) return; + if (ev->button != 1) return; + wd->down = 1; + evas_object_geometry_get(wd->base, &x, &y, &w, NULL); + wd->dx = ev->canvas.x - x; + wd->dy = ev->canvas.y - y; + if (!wd->autohide_disabled) + { + _index_box_clear(data, wd->bx[1], 1); + _index_box_auto_fill(data, wd->bx[0], 0); + edje_object_signal_emit(wd->base, "elm,state,active", "elm"); + } + _sel_eval(data, ev->canvas.x, ev->canvas.y); + edje_object_part_drag_value_set(wd->base, "elm.dragable.pointer", + (!edje_object_mirrored_get(wd->base)) ? wd->dx : (wd->dx - w), wd->dy); + if (wd->items && !wd->indicator_disabled) + edje_object_signal_emit(wd->base, "elm,indicator,state,active", "elm"); +} + +static void +_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(data); + Evas_Event_Mouse_Up *ev = event_info; + Elm_Object_Item *item; + Elm_Index_Item *id_item; + if (!wd) return; + if (ev->button != 1) return; + wd->down = 0; + item = elm_index_selected_item_get(data, wd->level); + if (item) + { + evas_object_smart_callback_call(data, SIG_SELECTED, item); + id_item = (Elm_Index_Item *)item; + if (id_item->func) + id_item->func((void *)id_item->base.data, WIDGET(id_item), id_item); + } + if (!wd->autohide_disabled) + edje_object_signal_emit(wd->base, "elm,state,inactive", "elm"); + edje_object_signal_emit(wd->base, "elm,state,level,0", "elm"); + if (wd->items && !wd->indicator_disabled) + edje_object_signal_emit(wd->base, "elm,indicator,state,inactive", "elm"); +} + +static void +_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(data); + Evas_Event_Mouse_Move *ev = event_info; + Evas_Coord minw = 0, minh = 0, x, y, dx, adx, w; + char buf[1024]; + if (!wd) return; + if (!wd->down) return; + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + evas_object_geometry_get(wd->base, &x, &y, &w, NULL); + x = ev->cur.canvas.x - x; + y = ev->cur.canvas.y - y; + dx = x - wd->dx; + adx = dx; + if (adx < 0) adx = -dx; + edje_object_part_drag_value_set(wd->base, "elm.dragable.pointer" + , (!edje_object_mirrored_get(wd->base)) ? x : (x - w), y); + if (!wd->horizontal) + { + if (adx > minw) + { + if (!wd->level) + { + wd->level = 1; + snprintf(buf, sizeof(buf), "elm,state,level,%i", wd->level); + edje_object_signal_emit(wd->base, buf, "elm"); + evas_object_smart_callback_call(data, SIG_LEVEL_UP, NULL); + } + } + else + { + if (wd->level == 1) + { + wd->level = 0; + snprintf(buf, sizeof(buf), "elm,state,level,%i", wd->level); + edje_object_signal_emit(wd->base, buf, "elm"); + evas_object_smart_callback_call(data, SIG_LEVEL_DOWN, NULL); + } + } + } + _sel_eval(data, ev->cur.canvas.x, ev->cur.canvas.y); +} + +EAPI Evas_Object * +elm_index_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas_Object *o; + Evas *e; + Widget_Data *wd; + Evas_Coord minw, minh; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "index"); + elm_widget_type_set(obj, "index"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_signal_emit_hook_set(obj, _signal_emit_hook); + elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook); + elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); + + wd->indicator_disabled = EINA_FALSE; + wd->horizontal = EINA_FALSE; + wd->autohide_disabled = EINA_FALSE; + + wd->base = edje_object_add(e); + _elm_theme_object_set(obj, wd->base, "index", "base/vertical", "default"); + elm_widget_resize_object_set(obj, wd->base); + + o = evas_object_rectangle_add(e); + wd->event[0] = o; + evas_object_color_set(o, 0, 0, 0, 0); + minw = minh = 0; + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + evas_object_size_hint_min_set(o, minw, minh); + edje_object_part_swallow(wd->base, "elm.swallow.event.0", o); + elm_widget_sub_object_add(obj, o); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_WHEEL, _wheel, obj); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down, obj); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _mouse_up, obj); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move, obj); + evas_object_show(o); + if (edje_object_part_exists(wd->base, "elm.swallow.event.1")) + { + o = evas_object_rectangle_add(e); + wd->event[1] = o; + evas_object_color_set(o, 0, 0, 0, 0); + evas_object_size_hint_min_set(o, minw, minh); + edje_object_part_swallow(wd->base, "elm.swallow.event.1", o); + elm_widget_sub_object_add(obj, o); + } + + wd->bx[0] = evas_object_box_add(e); + evas_object_box_layout_set(wd->bx[0], _layout, wd, NULL); + elm_widget_sub_object_add(obj, wd->bx[0]); + edje_object_part_swallow(wd->base, "elm.swallow.index.0", wd->bx[0]); + evas_object_show(wd->bx[0]); + + if (edje_object_part_exists(wd->base, "elm.swallow.index.1")) + { + wd->bx[1] = evas_object_box_add(e); + evas_object_box_layout_set(wd->bx[1], _layout, wd, NULL); + elm_widget_sub_object_add(obj, wd->bx[1]); + edje_object_part_swallow(wd->base, "elm.swallow.index.1", wd->bx[1]); + evas_object_show(wd->bx[1]); + } + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _sizing_eval(obj); + return obj; +} + +EAPI void +elm_index_autohide_disabled_set(Evas_Object *obj, Eina_Bool disabled) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + disabled = !!disabled; + if (wd->autohide_disabled == disabled) return; + wd->autohide_disabled = disabled; + wd->level = 0; + if (wd->autohide_disabled) + { + _index_box_clear(obj, wd->bx[1], 1); + _index_box_auto_fill(obj, wd->bx[0], 0); + edje_object_signal_emit(wd->base, "elm,state,active", "elm"); + } + else + edje_object_signal_emit(wd->base, "elm,state,inactive", "elm"); + + //FIXME: Should be update indicator based on the indicator visiblility +} + +EAPI Eina_Bool +elm_index_autohide_disabled_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->autohide_disabled; +} + +EAPI void +elm_index_item_level_set(Evas_Object *obj, int level) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->level == level) return; + wd->level = level; +} + +EAPI int +elm_index_item_level_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; + return wd->level; +} + +EAPI void +elm_index_item_selected_set(Elm_Object_Item *it, Eina_Bool selected) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Evas_Coord x, y, w, h; + Widget_Data *wd = elm_widget_data_get(WIDGET(it)); + if (!wd) return; + + //FIXME: Should be update indicator based on the autohidden status & indicator visiblility + + if (selected) + { + evas_object_geometry_get(VIEW(it), &x, &y, &w, &h); + _sel_eval(WIDGET(it), x + (w/2), y + (h/2)); + } + else + _sel_eval(WIDGET(it), -99999, -9999); + +} + +EAPI Elm_Object_Item * +elm_index_selected_item_get(const Evas_Object *obj, int level) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + Eina_List *l; + Elm_Index_Item *it; + if (!wd) return NULL; + EINA_LIST_FOREACH(wd->items, l, it) + { + if ((it->selected) && (it->level == level)) + return (Elm_Object_Item *)it; + } + return NULL; +} + +EAPI Elm_Object_Item * +elm_index_item_append(Evas_Object *obj, const char *letter, Evas_Smart_Cb func, const void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Index_Item *it; + if (!wd) return NULL; + it = _item_new(obj, letter, func, data); + if (!it) return NULL; + wd->items = eina_list_append(wd->items, it); + _index_box_clear(obj, wd->bx[wd->level], wd->level); + return (Elm_Object_Item *)it; +} + +EAPI Elm_Object_Item * +elm_index_item_prepend(Evas_Object *obj, const char *letter, Evas_Smart_Cb func, const void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Index_Item *it; + + if (!wd) return NULL; + it = _item_new(obj, letter, func, data); + if (!it) return NULL; + wd->items = eina_list_prepend(wd->items, it); + _index_box_clear(obj, wd->bx[wd->level], wd->level); + return (Elm_Object_Item *)it; +} + +EINA_DEPRECATED EAPI Elm_Object_Item * +elm_index_item_prepend_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Object_Item *relative) +{ + return elm_index_item_insert_before(obj, (Elm_Object_Item *) relative, letter, NULL, item); +} + +EAPI Elm_Object_Item * +elm_index_item_insert_after(Evas_Object *obj, Elm_Object_Item *after, const char *letter, Evas_Smart_Cb func, const void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Index_Item *it; + if (!wd) return NULL; + if (!after) return elm_index_item_append(obj, letter, func, data); + it = _item_new(obj, letter, func, data); + if (!it) return NULL; + wd->items = eina_list_append_relative(wd->items, it, after); + _index_box_clear(obj, wd->bx[wd->level], wd->level); + return (Elm_Object_Item *)it; +} + +EAPI Elm_Object_Item * +elm_index_item_insert_before(Evas_Object *obj, Elm_Object_Item *before, const char *letter, Evas_Smart_Cb func, const void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Index_Item *it; + if (!wd) return NULL; + if (!before) return elm_index_item_prepend(obj, letter, func, data); + it = _item_new(obj, letter, func, data); + if (!it) return NULL; + wd->items = eina_list_prepend_relative(wd->items, it, before); + _index_box_clear(obj, wd->bx[wd->level], wd->level); + return (Elm_Object_Item *)it; +} + +EAPI Elm_Object_Item * +elm_index_item_sorted_insert(Evas_Object *obj, const char *letter, Evas_Smart_Cb func, const void *data, Eina_Compare_Cb cmp_func, Eina_Compare_Cb cmp_data_func) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + Eina_List *lnear; + Elm_Index_Item *it; + int cmp; + + if (!wd) return NULL; + if (!(wd->items)) + return elm_index_item_append(obj, letter, func, data); + + it = _item_new(obj, letter, func, data); + if (!it) return NULL; + + lnear = eina_list_search_sorted_near_list(wd->items, cmp_func, it, &cmp); + if (cmp < 0) + wd->items = eina_list_append_relative_list(wd->items, it, lnear); + else if (cmp > 0) + wd->items = eina_list_prepend_relative_list(wd->items, it, lnear); + else + { + /* If cmp_data_func is not provided, append a duplicated item */ + if (!cmp_data_func) + wd->items = eina_list_append_relative_list(wd->items, it, lnear); + else + { + Elm_Index_Item *p_it = eina_list_data_get(lnear); + if (cmp_data_func(p_it->base.data, it->base.data) >= 0) + p_it->base.data = it->base.data; + _item_free(it); + elm_widget_item_free(it); + } + } + _index_box_clear(obj, wd->bx[wd->level], wd->level); + return (Elm_Object_Item *)it; +} + +EAPI Elm_Object_Item * +elm_index_item_find(Evas_Object *obj, const void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return (Elm_Object_Item *) _item_find(obj, data); +} + +EAPI void +elm_index_item_clear(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Index_Item *it; + Eina_List *l, *clear = NULL; + if (!wd) return; + _index_box_clear(obj, wd->bx[wd->level], wd->level); + EINA_LIST_FOREACH(wd->items, l, it) + { + if (it->level != wd->level) continue; + clear = eina_list_append(clear, it); + } + EINA_LIST_FREE(clear, it) + { + _item_free(it); + elm_widget_item_free(it); + } +} + +EAPI void +elm_index_level_go(Evas_Object *obj, int level __UNUSED__) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _index_box_auto_fill(obj, wd->bx[0], 0); + if (wd->level == 1) _index_box_auto_fill(obj, wd->bx[1], 1); +} + +EAPI void +elm_index_indicator_disabled_set(Evas_Object *obj, Eina_Bool disabled) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + disabled = !!disabled; + if (wd->indicator_disabled == disabled) return; + wd->indicator_disabled = disabled; + if (!wd->items) return; + if (disabled) + edje_object_signal_emit(wd->base, "elm,indicator,state,inactive", "elm"); + else + edje_object_signal_emit(wd->base, "elm,indicator,state,active", "elm"); +} + +EAPI Eina_Bool +elm_index_indicator_disabled_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + return wd->indicator_disabled; +} + +EAPI const char * +elm_index_item_letter_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + return ((Elm_Index_Item *)it)->letter; +} + +EAPI void +elm_index_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + horizontal = !!horizontal; + if (horizontal == wd->horizontal) return; + wd->horizontal = horizontal; + _theme_hook(obj); +} + +EAPI Eina_Bool +elm_index_horizontal_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->horizontal; +} + + diff --git a/libraries/elementary/src/lib/elm_index.h b/libraries/elementary/src/lib/elm_index.h new file mode 100644 index 0000000..33e41be --- /dev/null +++ b/libraries/elementary/src/lib/elm_index.h @@ -0,0 +1,373 @@ +/** + * @defgroup Index Index + * @ingroup Elementary + * + * @image html img/widget/index/preview-00.png + * @image latex img/widget/index/preview-00.eps + * + * An index widget gives you an index for fast access to whichever + * group of other UI items one might have. It's a list of text + * items (usually letters, for alphabetically ordered access). + * + * Index widgets are by default hidden and just appear when the + * user clicks over it's reserved area in the canvas. In its + * default theme, it's an area one @ref Fingers "finger" wide on + * the right side of the index widget's container. + * + * When items on the index are selected, smart callbacks get + * called, so that its user can make other container objects to + * show a given area or child object depending on the index item + * selected. You'd probably be using an index together with @ref + * List "lists", @ref Genlist "generic lists" or @ref Gengrid + * "general grids". + * + * Smart events one can add callbacks for are: + * - @c "changed" - When the selected index item changes. @c + * event_info is the selected item's data pointer. + * - @c "delay,changed" - When the selected index item changes, but + * after a small idling period. @c event_info is the selected + * item's data pointer. + * - @c "selected" - When the user releases a mouse button and + * selects an item. @c event_info is the selected item's data + * pointer. + * - @c "level,up" - when the user moves a finger from the first + * level to the second level + * - @c "level,down" - when the user moves a finger from the second + * level to the first level + * + * The @c "delay,changed" event is so that it'll wait a small time + * before actually reporting those events and, moreover, just the + * last event happening on those time frames will actually be + * reported. + * + * Here are some examples on its usage: + * @li @ref index_example_01 + * @li @ref index_example_02 + */ + +/** + * @addtogroup Index + * @{ + */ + +/** + * Add a new index widget to the given parent Elementary + * (container) object + * + * @param parent The parent object + * @return a new index widget handle or @c NULL, on errors + * + * This function inserts a new index widget on the canvas. + * + * @ingroup Index + */ +EAPI Evas_Object *elm_index_add(Evas_Object *parent); + +/** + * Enable or disable auto hiding feature for a given index widget. + * + * @param obj The index object + * @param disabled @c EINA_TRUE to disable auto hiding, @c EINA_FALSE to enable + * + * @see elm_index_autohide_disabled_get() + * + * @ingroup Index + */ +EAPI void elm_index_autohide_disabled_set(Evas_Object *obj, Eina_Bool disabled); + +/** + * Get whether auto hiding feature is enabled or not for a given index widget. + * + * @param obj The index object + * @return @c EINA_TRUE, if auto hiding is disabled, @c EINA_FALSE otherwise + * + * @see elm_index_autohide_disabled_set() for more details + * + * @ingroup Index + */ +EAPI Eina_Bool elm_index_autohide_disabled_get(const Evas_Object *obj); + +/** + * Set the items level for a given index widget. + * + * @param obj The index object. + * @param level @c 0 or @c 1, the currently implemented levels. + * + * @see elm_index_item_level_get() + * + * @ingroup Index + */ +EAPI void elm_index_item_level_set(Evas_Object *obj, int level); + +/** + * Get the items level set for a given index widget. + * + * @param obj The index object. + * @return @c 0 or @c 1, which are the levels @p obj might be at. + * + * @see elm_index_item_level_set() for more information + * + * @ingroup Index + */ +EAPI int elm_index_item_level_get(const Evas_Object *obj); + +/** + * Set the selected state of an item. + * + * @param it The index item + * @param selected The selected state + * + * This sets the selected state of the given item @p it. + * @c EINA_TRUE for selected, @c EINA_FALSE for not selected. + * + * If a new item is selected the previously selected will be unselected. + * Previously selected item can be get with function + * elm_index_selected_item_get(). + * + * Selected items will be highlighted. + * + * @see elm_index_selected_item_get() + * + * @ingroup Index + */ +EAPI void elm_index_item_selected_set(Elm_Object_Item *it, Eina_Bool selected); + +/** + * Returns the last selected item, for a given index widget. + * + * @param obj The index object. + * @param level @c 0 or @c 1, the currently implemented levels. + * @return The last item @b selected on @p obj (or @c NULL, on errors). + * + * @ingroup Index + */ +EAPI Elm_Object_Item *elm_index_selected_item_get(const Evas_Object *obj, int level); + +/** + * Append a new item on a given index widget. + * + * @param obj The index object. + * @param letter Letter under which the item should be indexed + * @param func The function to call when the item is selected. + * @param data The item data to set for the index's item + * @return A handle to the item added or @c NULL, on errors + * + * Despite the most common usage of the @p letter argument is for + * single char strings, one could use arbitrary strings as index + * entries. + * + * @c item will be the pointer returned back on @c "changed", @c + * "delay,changed" and @c "selected" smart events. + * + * @ingroup Index + */ +EAPI Elm_Object_Item *elm_index_item_append(Evas_Object *obj, const char *letter, Evas_Smart_Cb func, const void *data); + +/** + * Prepend a new item on a given index widget. + * + * @param obj The index object. + * @param letter Letter under which the item should be indexed + * @param func The function to call when the item is selected. + * @param data The item data to set for the index's item + * @return A handle to the item added or @c NULL, on errors + * + * Despite the most common usage of the @p letter argument is for + * single char strings, one could use arbitrary strings as index + * entries. + * + * @c item will be the pointer returned back on @c "changed", @c + * "delay,changed" and @c "selected" smart events. + * + * @ingroup Index + */ +EAPI Elm_Object_Item *elm_index_item_prepend(Evas_Object *obj, const char *letter, Evas_Smart_Cb func, const void *data); + +/** + * Insert a new item into the index object after item @p after. + * + * @param obj The index object. + * @param after The index item to insert after. + * @param letter Letter under which the item should be indexed + * @param func The function to call when the item is clicked. + * @param data The item data to set for the index's item + * @return A handle to the item added or @c NULL, on errors + * + * Despite the most common usage of the @p letter argument is for + * single char strings, one could use arbitrary strings as index + * entries. + * + * @c item will be the pointer returned back on @c "changed", @c + * "delay,changed" and @c "selected" smart events. + * + * @note If @p relative is @c NULL this function will behave as + * elm_index_item_append(). + * + * @ingroup Index + */ +EAPI Elm_Object_Item *elm_index_item_insert_after(Evas_Object *obj, Elm_Object_Item *after, const char *letter, Evas_Smart_Cb func, const void *data); + +/** + * Insert a new item into the index object before item @p before. + * + * @param obj The index object. + * @param before The index item to insert after. + * @param letter Letter under which the item should be indexed + * @param func The function to call when the item is clicked. + * @param data The item data to set for the index's item + * @return A handle to the item added or @c NULL, on errors + * + * Despite the most common usage of the @p letter argument is for + * single char strings, one could use arbitrary strings as index + * entries. + * + * @c item will be the pointer returned back on @c "changed", @c + * "delay,changed" and @c "selected" smart events. + * + * @note If @p relative is @c NULL this function will behave as + * elm_index_item_prepend(). + * + * @ingroup Index + */ +EAPI Elm_Object_Item *elm_index_item_insert_before(Evas_Object *obj, Elm_Object_Item *before, const char *letter, Evas_Smart_Cb func, const void *data); + +/** + * Insert a new item into the given index widget, using @p cmp_func + * function to sort items (by item handles). + * + * @param obj The index object. + * @param letter Letter under which the item should be indexed + * @param func The function to call when the item is clicked. + * @param data The item data to set for the index's item + * @param cmp_func The comparing function to be used to sort index + * items by #index item handles + * @param cmp_data_func A @b fallback function to be called for the + * sorting of index items by item data). It will be used + * when @p cmp_func returns @c 0 (equality), which means an index + * item with provided item data already exists. To decide which + * data item should be pointed to by the index item in question, @p + * cmp_data_func will be used. If @p cmp_data_func returns a + * non-negative value, the previous index item data will be + * replaced by the given @p item pointer. If the previous data need + * to be freed, it should be done by the @p cmp_data_func function, + * because all references to it will be lost. If this function is + * not provided (@c NULL is given), index items will be @b + * duplicated, if @p cmp_func returns @c 0. + * @return A handle to the item added or @c NULL, on errors + * + * Despite the most common usage of the @p letter argument is for + * single char strings, one could use arbitrary strings as index + * entries. + * + * @c item will be the pointer returned back on @c "changed", @c + * "delay,changed" and @c "selected" smart events. + * + * @ingroup Index + */ +EAPI Elm_Object_Item *elm_index_item_sorted_insert(Evas_Object *obj, const char *letter, Evas_Smart_Cb func, const void *data, Eina_Compare_Cb cmp_func, Eina_Compare_Cb cmp_data_func); + +/** + * Find a given index widget's item, using item data. + * + * @param obj The index object + * @param data The item data pointed to by the desired index item + * @return The index item handle, if found, or @c NULL otherwise + * + * @ingroup Index + */ +EAPI Elm_Object_Item *elm_index_item_find(Evas_Object *obj, const void *data); + +/** + * Removes @b all items from a given index widget. + * + * @param obj The index object. + * + * If deletion callbacks are set, via elm_object_item_del_cb_set(), + * that callback function will be called for each item in @p obj. + * + * @ingroup Index + */ +EAPI void elm_index_item_clear(Evas_Object *obj); + +/** + * Go to a given items level on a index widget + * + * @param obj The index object + * @param level The index level (one of @c 0 or @c 1) + * + * @ingroup Index + */ +EAPI void elm_index_level_go(Evas_Object *obj, int level); + +/** + * Get the letter (string) set on a given index widget item. + * + * @param item The index item handle + * @return The letter string set on @p it + * + * @ingroup Index + */ +EAPI const char *elm_index_item_letter_get(const Elm_Object_Item *item); + +/** + * Set the indicator as to be disabled. + * + * @param obj The index object + * @param disabled @c EINA_TRUE to disable it, @c EINA_FALSE to enable it + * + * In Index widget, Indicator notes popup text, which shows a letter has been selecting. + * + * @see elm_index_indicator_disabled_get() + * + * @ingroup Index + */ +EAPI void elm_index_indicator_disabled_set(Evas_Object *obj, Eina_Bool disabled); + +/** + * Get the value of indicator's disabled status. + * + * @param obj The index object + * @return EINA_TRUE if the indicator is disabled. + * + * @see elm_index_indicator_disabled_set() + * + * @ingroup Index + */ +EAPI Eina_Bool elm_index_indicator_disabled_get(const Evas_Object *obj); + +/** + * Enable or disable horizontal mode on the index object + * + * @param obj The index object. + * @param horizontal @c EINA_TRUE to enable horizontal or @c EINA_FALSE to + * disable it, i.e., to enable vertical mode. it's an area one @ref Fingers + * "finger" wide on the bottom side of the index widget's container. + * + * @note Vertical mode is set by default. + * + * On horizontal mode items are displayed on index from left to right, + * instead of from top to bottom. Also, the index will scroll horizontally. + * + * @see elm_index_horizontal_get() + * + * @ingroup Index + */ +EAPI void elm_index_horizontal_set(Evas_Object *obj, Eina_Bool horizontal); + +/** + * Get a value whether horizontal mode is enabled or not. + * + * @param obj The index object. + * @return @c EINA_TRUE means horizontal mode selection is enabled. + * @c EINA_FALSE indicates it's disabled. If @p obj is @c NULL, + * @c EINA_FALSE is returned. + * + * @see elm_index_horizontal_set() for details. + * + * @ingroup Index + */ +EAPI Eina_Bool elm_index_horizontal_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_intro.h b/libraries/elementary/src/lib/elm_intro.h new file mode 100644 index 0000000..2dd8879 --- /dev/null +++ b/libraries/elementary/src/lib/elm_intro.h @@ -0,0 +1,34 @@ +/** + * @mainpage Elementary + * @image html elementary.png + * @version 0.8.0 + * @date 2008-2012 + * + * @section intro What is Elementary? + * + * This is a VERY SIMPLE toolkit. It is not meant for writing extensive desktop + * applications (yet). Small simple ones with simple needs. + * + * It is meant to make the programmers work almost brainless but give them lots + * of flexibility. + * + * @li @ref Start - Go here to quickly get started with writing Apps + * + * @section organization Organization + * + * One can divide Elementary into three main groups: + * @li @ref infralist - These are modules that deal with Elementary as a whole. + * @li @ref widgetslist - These are the widgets you'll compose your UI out of. + * @li @ref containerslist - These are the containers which hold the widgets. + * + * @section license License + * + * LGPL v2 (see COPYING in the base of Elementary's source). This applies to + * all files in the source tree. + * + * @section ack Acknowledgements + * There is a lot that goes into making a widget set, and they don't happen out of + * nothing. It's like trying to make everyone everywhere happy, regardless of age, + * gender, race or nationality - and that is really tough. So thanks to people and + * organizations behind this, as listed in the @ref authors page. + */ diff --git a/libraries/elementary/src/lib/elm_label.c b/libraries/elementary/src/lib/elm_label.c new file mode 100644 index 0000000..b31ef2f --- /dev/null +++ b/libraries/elementary/src/lib/elm_label.c @@ -0,0 +1,543 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *lbl; + const char *label; + const char *format; + Ecore_Job *deferred_recalc_job; + double slide_duration; + Evas_Coord lastw; + Evas_Coord wrap_w; + Elm_Wrap_Type linewrap; + Eina_Bool changed : 1; + Eina_Bool ellipsis : 1; + Eina_Bool slidingmode : 1; + Eina_Bool slidingellipsis : 1; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); +static void _theme_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static int _get_value_in_key_string(const char *oldstring, const char *key, char **value); +static int _strbuf_key_value_replace(Eina_Strbuf *srcbuf, const char *key, const char *value, int deleteflag); +static int _stringshare_key_value_replace(const char **srcstring, const char *key, const char *value, int deleteflag); +static void _label_sliding_change(Evas_Object *obj); +static void _label_format_set(Evas_Object *obj, const char *format); + +static void +_elm_recalc_job(void *data) +{ + Widget_Data *wd = elm_widget_data_get(data); + Evas_Coord minw = -1, minh = -1; + Evas_Coord resw; + if (!wd) return; + evas_event_freeze(evas_object_evas_get(data)); + wd->deferred_recalc_job = NULL; + evas_object_geometry_get(wd->lbl, NULL, NULL, &resw, NULL); + if (wd->wrap_w > resw) + resw = wd->wrap_w; + + edje_object_size_min_restricted_calc(wd->lbl, &minw, &minh, resw, 0); + /* This is a hack to workaround the way min size hints are treated. + * If the minimum width is smaller than the restricted width, it means + * the mininmum doesn't matter. */ + if ((minw <= resw) && (minw != wd->wrap_w)) + { + Evas_Coord ominw = -1; + evas_object_size_hint_min_get(data, &ominw, NULL); + minw = ominw; + } + evas_object_size_hint_min_set(data, minw, minh); + evas_event_thaw(evas_object_evas_get(data)); + evas_event_thaw_eval(evas_object_evas_get(data)); +} + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_event_freeze(evas_object_evas_get(obj)); + if (wd->deferred_recalc_job) ecore_job_del(wd->deferred_recalc_job); + if (wd->label) eina_stringshare_del(wd->label); + free(wd); + evas_event_thaw(evas_object_evas_get(obj)); + evas_event_thaw_eval(evas_object_evas_get(obj)); +} + +static void +_theme_change(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + _elm_theme_object_set(obj, wd->lbl, "label", "base", + elm_widget_style_get(obj)); +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->lbl, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_event_freeze(evas_object_evas_get(obj)); + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _theme_change(obj); + _label_format_set(wd->lbl, wd->format); + edje_object_part_text_set(wd->lbl, "elm.text", wd->label); + edje_object_scale_set(wd->lbl, elm_widget_scale_get(obj) * + _elm_config->scale); + _label_sliding_change(obj); + _sizing_eval(obj); + evas_event_thaw(evas_object_evas_get(obj)); + evas_event_thaw_eval(evas_object_evas_get(obj)); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1; + Evas_Coord resw, resh; + if (!wd) return; + + if (wd->linewrap) + { + evas_object_geometry_get(wd->lbl, NULL, NULL, &resw, &resh); + if ((resw == wd->lastw) && (!wd->changed)) return; + wd->changed = EINA_FALSE; + wd->lastw = resw; + _elm_recalc_job(obj); + // FIXME: works ok. but NOT for genlist. what should genlist do? + // if (wd->deferred_recalc_job) ecore_job_del(wd->deferred_recalc_job); + // wd->deferred_recalc_job = ecore_job_add(_elm_recalc_job, obj); + } + else + { + evas_event_freeze(evas_object_evas_get(obj)); + evas_object_geometry_get(wd->lbl, NULL, NULL, &resw, &resh); + edje_object_size_min_calc(wd->lbl, &minw, &minh); + if (wd->wrap_w > 0 && minw > wd->wrap_w) minw = wd->wrap_w; + evas_object_size_hint_min_set(obj, minw, minh); + evas_event_thaw(evas_object_evas_get(obj)); + evas_event_thaw_eval(evas_object_evas_get(obj)); + } +} + +static void +_lbl_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + if (wd->linewrap) _sizing_eval(data); +} + +static void +_label_format_set(Evas_Object *obj, const char *format) +{ + if (format) + edje_object_part_text_style_user_push(obj, "elm.text", format); + else + edje_object_part_text_style_user_pop(obj, "elm.text"); +} + +static int +_get_value_in_key_string(const char *oldstring, const char *key, char **value) +{ + char *curlocater, *endtag; + int firstindex = 0, foundflag = -1; + + curlocater = strstr(oldstring, key); + if (curlocater) + { + int key_len = strlen(key); + endtag = curlocater + key_len; + if ((!endtag) || (*endtag != '=')) + { + foundflag = 0; + return -1; + } + firstindex = abs(oldstring - curlocater); + firstindex += key_len + 1; // strlen("key") + strlen("=") + *value = (char *)oldstring + firstindex; + + foundflag = 1; + } + else + { + foundflag = 0; + } + + if (foundflag == 1) return 0; + + return -1; +} + + +static int +_strbuf_key_value_replace(Eina_Strbuf *srcbuf, const char *key, const char *value, int deleteflag) +{ + char *kvalue; + const char *srcstring = NULL; + + srcstring = eina_strbuf_string_get(srcbuf); + + if (_get_value_in_key_string(srcstring, key, &kvalue) == 0) + { + const char *val_end; + int val_end_idx = 0; + int key_start_idx = 0; + val_end = strchr(kvalue, ' '); + + if (val_end) + val_end_idx = val_end - srcstring; + else + val_end_idx = kvalue - srcstring + strlen(kvalue) - 1; + + /* -1 is because of the '=' */ + key_start_idx = kvalue - srcstring - 1 - strlen(key); + eina_strbuf_remove(srcbuf, key_start_idx, val_end_idx); + if (!deleteflag) + { + eina_strbuf_insert_printf(srcbuf, "%s=%s", key_start_idx, key, + value); + } + } + else if (!deleteflag) + { + if (*srcstring) + { + /* -1 because we want it before the ' */ + eina_strbuf_insert_printf(srcbuf, " %s=%s", + eina_strbuf_length_get(srcbuf) - 1, key, value); + } + else + { + eina_strbuf_append_printf(srcbuf, "DEFAULT='%s=%s'", key, value); + } + } + return 0; +} + +static int +_stringshare_key_value_replace(const char **srcstring, const char *key, const char *value, int deleteflag) +{ + Eina_Strbuf *sharebuf = NULL; + + sharebuf = eina_strbuf_new(); + eina_strbuf_append(sharebuf, *srcstring); + _strbuf_key_value_replace(sharebuf, key, value, deleteflag); + eina_stringshare_del(*srcstring); + *srcstring = eina_stringshare_add(eina_strbuf_string_get(sharebuf)); + eina_strbuf_free(sharebuf); + + return 0; +} + +static void +_label_sliding_change(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + char *plaintxt; + int plainlen = 0; + + // dosen't support multiline sliding effect + if (wd->linewrap) + { + wd->slidingmode = EINA_FALSE; + return; + } + + plaintxt = _elm_util_mkup_to_text(edje_object_part_text_get(wd->lbl, "elm.text")); + if (plaintxt != NULL) + { + plainlen = strlen(plaintxt); + free(plaintxt); + } + // too short to slide label + if (plainlen < 1) + { + wd->slidingmode = EINA_TRUE; + return; + } + + if (wd->slidingmode) + { + Edje_Message_Float_Set *msg = alloca(sizeof(Edje_Message_Float_Set) + (sizeof(double))); + + if (wd->ellipsis) + { + wd->slidingellipsis = EINA_TRUE; + elm_label_ellipsis_set(obj, EINA_FALSE); + } + + msg->count = 1; + msg->val[0] = wd->slide_duration; + + edje_object_message_send(wd->lbl, EDJE_MESSAGE_FLOAT_SET, 0, msg); + edje_object_signal_emit(wd->lbl, "elm,state,slide,start", "elm"); + } + else + { + edje_object_signal_emit(wd->lbl, "elm,state,slide,stop", "elm"); + if (wd->slidingellipsis) + { + wd->slidingellipsis = EINA_FALSE; + elm_label_ellipsis_set(obj, EINA_TRUE); + } + } +} + +static void +_elm_label_label_set(Evas_Object *obj, const char *item, const char *label) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (item && strcmp(item, "default")) return; + if (!label) label = ""; + eina_stringshare_replace(&wd->label, label); + _label_format_set(wd->lbl, wd->format); + edje_object_part_text_set(wd->lbl, "elm.text", wd->label); + wd->changed = 1; + _sizing_eval(obj); +} + +static const char * +_elm_label_label_get(const Evas_Object *obj, const char *item) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (item && strcmp(item, "default")) return NULL; + if (!wd) return NULL; + return wd->label; +} + +static void +_translate_hook(Evas_Object *obj) +{ + evas_object_smart_callback_call(obj, "language,changed", NULL); +} + +EAPI Evas_Object * +elm_label_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "label"); + elm_widget_type_set(obj, "label"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); + elm_widget_text_set_hook_set(obj, _elm_label_label_set); + elm_widget_text_get_hook_set(obj, _elm_label_label_get); + elm_widget_translate_hook_set(obj, _translate_hook); + + wd->linewrap = ELM_WRAP_NONE; + wd->ellipsis = EINA_FALSE; + wd->slidingmode = EINA_FALSE; + wd->slidingellipsis = EINA_FALSE; + wd->wrap_w = -1; + wd->slide_duration = 10; + + wd->lbl = edje_object_add(e); + _elm_theme_object_set(obj, wd->lbl, "label", "base", "default"); + wd->format = eina_stringshare_add(""); + wd->label = eina_stringshare_add("
"); + _label_format_set(wd->lbl, wd->format); + edje_object_part_text_set(wd->lbl, "elm.text", wd->label); + + elm_widget_resize_object_set(obj, wd->lbl); + + evas_object_event_callback_add(wd->lbl, EVAS_CALLBACK_RESIZE, _lbl_resize, obj); + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + wd->changed = 1; + _sizing_eval(obj); + return obj; +} + +EAPI void +elm_label_line_wrap_set(Evas_Object *obj, Elm_Wrap_Type wrap) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + const char *wrap_str; + int len; + + if (!wd) return; + if (wd->linewrap == wrap) return; + wd->linewrap = wrap; + len = strlen(wd->label); + if (len <= 0) return; + + switch (wrap) + { + case ELM_WRAP_CHAR: + wrap_str = "char"; + break; + case ELM_WRAP_WORD: + wrap_str = "word"; + break; + case ELM_WRAP_MIXED: + wrap_str = "mixed"; + break; + default: + wrap_str = "none"; + break; + } + + if (_stringshare_key_value_replace(&wd->format, + "wrap", wrap_str, 0) == 0) + { + _label_format_set(wd->lbl, wd->format); + edje_object_part_text_set(wd->lbl, "elm.text", wd->label); + wd->changed = 1; + _sizing_eval(obj); + } +} + +EAPI Elm_Wrap_Type +elm_label_line_wrap_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->linewrap; +} + +EAPI void +elm_label_wrap_width_set(Evas_Object *obj, Evas_Coord w) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (w < 0) w = 0; + if (wd->wrap_w == w) return; + if (wd->ellipsis) + { + _label_format_set(wd->lbl, wd->format); + edje_object_part_text_set(wd->lbl, "elm.text", wd->label); + } + wd->wrap_w = w; + _sizing_eval(obj); +} + +EAPI Evas_Coord +elm_label_wrap_width_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; + return wd->wrap_w; +} + +EAPI void +elm_label_ellipsis_set(Evas_Object *obj, Eina_Bool ellipsis) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + Eina_Strbuf *fontbuf = NULL; + int len, removeflag = 0; + + if (!wd) return; + if (wd->ellipsis == ellipsis) return; + wd->ellipsis = ellipsis; + len = strlen(wd->label); + if (len <= 0) return; + + if (ellipsis == EINA_FALSE) removeflag = 1; // remove fontsize tag + + fontbuf = eina_strbuf_new(); + eina_strbuf_append_printf(fontbuf, "%f", 1.0); + + if (_stringshare_key_value_replace(&wd->format, + "ellipsis", eina_strbuf_string_get(fontbuf), removeflag) == 0) + { + _label_format_set(wd->lbl, wd->format); + edje_object_part_text_set(wd->lbl, "elm.text", wd->label); + wd->changed = 1; + _sizing_eval(obj); + } + eina_strbuf_free(fontbuf); + +} + +EAPI Eina_Bool +elm_label_ellipsis_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->ellipsis; +} + +EAPI void +elm_label_slide_set(Evas_Object *obj, + Eina_Bool slide) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (wd->slidingmode == slide) return; + wd->slidingmode = slide; + _label_sliding_change(obj); + wd->changed = 1; + _sizing_eval(obj); +} + +EAPI Eina_Bool +elm_label_slide_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->slidingmode; +} + +EAPI void +elm_label_slide_duration_set(Evas_Object *obj, double duration) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + Edje_Message_Float_Set *msg = alloca(sizeof(Edje_Message_Float_Set) + (sizeof(double))); + + if (!wd) return; + wd->slide_duration = duration; + msg->count = 1; + msg->val[0] = wd->slide_duration; + edje_object_message_send(wd->lbl, EDJE_MESSAGE_FLOAT_SET, 0, msg); +} + +EAPI double +elm_label_slide_duration_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0.0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; + return wd->slide_duration; +} + diff --git a/libraries/elementary/src/lib/elm_label.h b/libraries/elementary/src/lib/elm_label.h new file mode 100644 index 0000000..7fdc619 --- /dev/null +++ b/libraries/elementary/src/lib/elm_label.h @@ -0,0 +1,180 @@ +/** + * @defgroup Label Label + * @ingroup Elementary + * + * @image html img/widget/label/preview-00.png + * @image latex img/widget/label/preview-00.eps + * + * @brief Widget to display text, with simple html-like markup. + * + * The Label widget @b doesn't allow text to overflow its boundaries, if the + * text doesn't fit the geometry of the label it will be ellipsized or be + * cut. Elementary provides several styles for this widget: + * @li default - No animation + * @li marker - Centers the text in the label and makes it bold by default + * @li slide_long - The entire text appears from the right of the screen and + * slides until it disappears in the left of the screen(reappearing on the + * right again). + * @li slide_short - The text appears in the left of the label and slides to + * the right to show the overflow. When all of the text has been shown the + * position is reset. + * @li slide_bounce - The text appears in the left of the label and slides to + * the right to show the overflow. When all of the text has been shown the + * animation reverses, moving the text to the left. + * + * Custom themes can of course invent new markup tags and style them any way + * they like. + * + * The following signals may be emitted by the label widget: + * @li "language,changed": The program's language changed. + * + * See @ref tutorial_label for a demonstration of how to use a label widget. + * @{ + */ + +/** + * @brief Add a new label to the parent + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * @ingroup Label + */ +EAPI Evas_Object *elm_label_add(Evas_Object *parent); + +/** + * @brief Set the wrapping behavior of the label + * + * @param obj The label object + * @param wrap To wrap text or not + * + * By default no wrapping is done. Possible values for @p wrap are: + * @li ELM_WRAP_NONE - No wrapping + * @li ELM_WRAP_CHAR - wrap between characters + * @li ELM_WRAP_WORD - wrap between words + * @li ELM_WRAP_MIXED - Word wrap, and if that fails, char wrap + * + * @ingroup Label + */ +EAPI void elm_label_line_wrap_set(Evas_Object *obj, Elm_Wrap_Type wrap); + +/** + * @brief Get the wrapping behavior of the label + * + * @param obj The label object + * @return Wrap type + * + * @see elm_label_line_wrap_set() + * + * @ingroup Label + */ +EAPI Elm_Wrap_Type elm_label_line_wrap_get(const Evas_Object *obj); + +/** + * @brief Set wrap width of the label + * + * @param obj The label object + * @param w The wrap width in pixels at a minimum where words need to wrap + * + * This function sets the maximum width size hint of the label. + * + * @warning This is only relevant if the label is inside a container. + * + * @ingroup Label + */ +EAPI void elm_label_wrap_width_set(Evas_Object *obj, Evas_Coord w); + +/** + * @brief Get wrap width of the label + * + * @param obj The label object + * @return The wrap width in pixels at a minimum where words need to wrap + * + * @see elm_label_wrap_width_set() + * + * @ingroup Label + */ +EAPI Evas_Coord elm_label_wrap_width_get(const Evas_Object *obj); + +/** + * @brief Set the ellipsis behavior of the label + * + * @param obj The label object + * @param ellipsis To ellipsis text or not + * + * If set to true and the text doesn't fit in the label an ellipsis("...") + * will be shown at the end of the widget. + * + * @warning This doesn't work with slide(elm_label_slide_set()) or if the + * chosen wrap method was ELM_WRAP_WORD. + * + * @ingroup Label + */ +EAPI void elm_label_ellipsis_set(Evas_Object *obj, Eina_Bool ellipsis); + +/** + * @brief Get the ellipsis behavior of the label + * + * @param obj The label object + * @return If true, an ellipsis will be shown at the end of the label area. + * + * @see elm_label_ellipsis_set() + * + * @ingroup Label + */ +EAPI Eina_Bool elm_label_ellipsis_get(const Evas_Object *obj); + +/** + * @brief Set sliding effect of label widget. + * + * @param obj The label object + * @param slide If true, sliding effect will be shown + * + * If set to true, the text of the label will slide/scroll through the length of + * label. + * + * @warning This only works with the themes "slide_short", "slide_long" and + * "slide_bounce". + * + * @ingroup Label + */ +EAPI void elm_label_slide_set(Evas_Object *obj, Eina_Bool slide); + +/** + * @brief Get whether sliding effect is shown or not. + * + * @param obj The label object + * @return If true, sliding effect is shown. + * + * @see elm_label_slide_set() + * + * @ingroup Label + */ +EAPI Eina_Bool elm_label_slide_get(const Evas_Object *obj); + +/** + * @brief Set the slide duration(speed) of the label + * + * @param obj The label object + * @param duration The duration in seconds in moving text from slide begin position + * to slide end position + * + * @ingroup Label + */ +EAPI void elm_label_slide_duration_set(Evas_Object *obj, double duration); + +/** + * @brief Get the slide duration(speed) of the label + * + * @param obj The label object + * @return The duration time in moving text from slide begin position to slide end position + * + * @see elm_label_slide_duration_set() + * + * @ingroup Label + */ +EAPI double elm_label_slide_duration_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_layout.c b/libraries/elementary/src/lib/elm_layout.c new file mode 100644 index 0000000..6f14484 --- /dev/null +++ b/libraries/elementary/src/lib/elm_layout.c @@ -0,0 +1,967 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; +typedef struct _Subinfo Subinfo; +typedef struct _Part_Cursor Part_Cursor; + +struct _Widget_Data +{ + Evas_Object *obj; + Evas_Object *lay; + Eina_List *subs; + Eina_List *parts_cursors; + Eina_Bool needs_size_calc:1; + const char *clas, *group, *style; +}; + +struct _Subinfo +{ + const char *part; + Evas_Object *obj; + enum + { + SWALLOW, + BOX_APPEND, + BOX_PREPEND, + BOX_INSERT_BEFORE, + BOX_INSERT_AT, + TABLE_PACK, + TEXT + } type; + union + { + union + { + const Evas_Object *reference; + unsigned int pos; + } box; + struct + { + unsigned short col, row, colspan, rowspan; + } table; + struct + { + const char *text; + } text; + } p; +}; + +struct _Part_Cursor +{ + Evas_Object *obj; + const char *part; + const char *cursor; + const char *style; + Eina_Bool engine_only:1; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); +static void _theme_hook(Evas_Object *obj); +static void _sizing_eval(Widget_Data *wd); +static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _sub_del(void *data, Evas_Object *obj, void *event_info); +static void _part_cursor_free(Part_Cursor *pc); + +static const char SIG_THEME_CHANGED[] = "theme,changed"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_THEME_CHANGED, ""}, + {NULL, NULL} +}; + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Subinfo *si; + Part_Cursor *pc; + + if (!wd) return; + EINA_LIST_FREE(wd->subs, si) + { + eina_stringshare_del(si->part); + if (si->type == TEXT) + eina_stringshare_del(si->p.text.text); + free(si); + } + EINA_LIST_FREE(wd->parts_cursors, pc) _part_cursor_free(pc); + free(wd); +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->lay, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _elm_theme_object_set(obj, wd->lay, wd->clas, wd->group, wd->style); + edje_object_scale_set(wd->lay, elm_widget_scale_get(obj) * + _elm_config->scale); + evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL); + _sizing_eval(wd); +} + +static void +_changed_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->needs_size_calc) + { + _sizing_eval(wd); + wd->needs_size_calc = 0; + } +} + +static void +_signal_emit_hook(Evas_Object *obj, const char *emission, const char *source) +{ + Widget_Data *wd = elm_widget_data_get(obj); + edje_object_signal_emit(wd->lay, emission, source); +} + +static void +_signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + edje_object_signal_callback_add(wd->lay, emission, source, func_cb, data); +} + +static void +_signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + edje_object_signal_callback_del_full(wd->lay, emission, source, func_cb, + data); +} + + +static void * +_elm_layout_list_data_get(const Eina_List *list) +{ + Subinfo *si = eina_list_data_get(list); + return si->obj; +} + +static Eina_Bool +_elm_layout_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next) +{ + Widget_Data *wd = elm_widget_data_get(obj); + const Eina_List *items; + void *(*list_data_get) (const Eina_List *list); + + if ((!wd) || (!wd->subs)) + return EINA_FALSE; + + /* Focus chain (This block is diferent of elm_win cycle)*/ + if ((items = elm_widget_focus_custom_chain_get(obj))) + list_data_get = eina_list_data_get; + else + { + items = wd->subs; + list_data_get = _elm_layout_list_data_get; + + if (!items) return EINA_FALSE; + } + + return elm_widget_focus_list_next_get(obj, items, list_data_get, dir, + next); +} + +static void +_sizing_eval(Widget_Data *wd) +{ + Evas_Coord minw = -1, minh = -1; + edje_object_size_min_calc(wd->lay, &minw, &minh); + evas_object_size_hint_min_set(wd->obj, minw, minh); + evas_object_size_hint_max_set(wd->obj, -1, -1); +} + +static void +_request_sizing_eval(Widget_Data *wd) +{ + if (wd->needs_size_calc) return; + wd->needs_size_calc = 1; + evas_object_smart_changed(wd->obj); +} + +static void +_part_cursor_free(Part_Cursor *pc) +{ + eina_stringshare_del(pc->part); + eina_stringshare_del(pc->style); + eina_stringshare_del(pc->cursor); + free(pc); +} + +static void +_part_cursor_part_apply(const Part_Cursor *pc) +{ + elm_object_cursor_set(pc->obj, pc->cursor); + elm_object_cursor_style_set(pc->obj, pc->style); + elm_object_cursor_theme_search_enabled_set(pc->obj, pc->engine_only); +} + +static Part_Cursor * +_parts_cursors_find(Widget_Data *wd, const char *part) +{ + const Eina_List *l; + Part_Cursor *pc; + EINA_LIST_FOREACH(wd->parts_cursors, l, pc) + { + if (!strcmp(pc->part, part)) + return pc; + } + return NULL; +} + +static void +_parts_cursors_apply(Widget_Data *wd) +{ + const char *file, *group; + const Eina_List *l; + Part_Cursor *pc; + + edje_object_file_get(wd->lay, &file, &group); + + EINA_LIST_FOREACH(wd->parts_cursors, l, pc) + { + Evas_Object *obj = (Evas_Object *)edje_object_part_object_get + (wd->lay, pc->part); + + if (!obj) + { + pc->obj = NULL; + WRN("no part '%s' in group '%s' of file '%s'. " + "Cannot set cursor '%s'", + pc->part, group, file, pc->cursor); + continue; + } + else if (evas_object_pass_events_get(obj)) + { + pc->obj = NULL; + WRN("part '%s' in group '%s' of file '%s' has mouse_events: 0. " + "Cannot set cursor '%s'", + pc->part, group, file, pc->cursor); + continue; + } + + pc->obj = obj; + _part_cursor_part_apply(pc); + } +} + +static void +_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _request_sizing_eval(data); +} + +static void +_sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *sub = event_info; + Eina_List *l; + Subinfo *si; + if (!wd) return; + EINA_LIST_FOREACH(wd->subs, l, si) + { + if (si->obj == sub) + { + evas_object_event_callback_del_full(sub, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, + wd); + wd->subs = eina_list_remove_list(wd->subs, l); + eina_stringshare_del(si->part); + free(si); + break; + } + } +} + +static void +_signal_size_eval(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + _request_sizing_eval(data); +} + +static void +_parts_text_fix(Widget_Data *wd) +{ + const Eina_List *l; + Subinfo *si; + + EINA_LIST_FOREACH(wd->subs, l, si) + { + if (si->type == TEXT) + edje_object_part_text_escaped_set(wd->lay, si->part, si->p.text.text); + } +} + +static void +_elm_layout_label_set(Evas_Object *obj, const char *part, const char *text) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Subinfo *si = NULL; + Eina_List *l; + ELM_CHECK_WIDTYPE(obj, widtype); + if (!part) part = "elm.text"; + + EINA_LIST_FOREACH(wd->subs, l, si) + { + if ((si->type == TEXT) && (!strcmp(part, si->part))) + { + if (!text) + { + eina_stringshare_del(si->part); + eina_stringshare_del(si->p.text.text); + free(si); + edje_object_part_text_escaped_set(wd->lay, part, NULL); + wd->subs = eina_list_remove_list(wd->subs, l); + return; + } + else + break; + } + si = NULL; + } + + if (!si) + { + si = ELM_NEW(Subinfo); + if (!si) return; + si->type = TEXT; + si->part = eina_stringshare_add(part); + wd->subs = eina_list_append(wd->subs, si); + } + + eina_stringshare_replace(&si->p.text.text, text); + edje_object_part_text_escaped_set(wd->lay, part, text); + _request_sizing_eval(wd); +} + +static const char * +_elm_layout_label_get(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!part) part = "elm.text"; + return edje_object_part_text_get(wd->lay, part); +} + +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + Subinfo *si; + const Eina_List *l; + if (!wd) return; + EINA_SAFETY_ON_NULL_RETURN(part); + EINA_LIST_FOREACH(wd->subs, l, si) + { + if ((si->type == SWALLOW) && (!strcmp(part, si->part))) + { + if (content == si->obj) return; + evas_object_del(si->obj); + break; + } + } + if (content) + { + elm_widget_sub_object_add(obj, content); + evas_object_event_callback_add(content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, wd); + if (!edje_object_part_swallow(wd->lay, part, content)) + WRN("could not swallow %p into part '%s'", content, part); + si = ELM_NEW(Subinfo); + si->type = SWALLOW; + si->part = eina_stringshare_add(part); + si->obj = content; + wd->subs = eina_list_append(wd->subs, si); + } + _request_sizing_eval(wd); +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + Widget_Data *wd = elm_widget_data_get(obj); + const Eina_List *l; + Subinfo *si; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + + EINA_LIST_FOREACH(wd->subs, l, si) + { + if ((si->type == SWALLOW) && !strcmp(part, si->part)) + return si->obj; + } + return NULL; +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + Subinfo *si; + const Eina_List *l; + if (!wd) return NULL; + EINA_LIST_FOREACH(wd->subs, l, si) + { + if ((si->type == SWALLOW) && (!strcmp(part, si->part))) + { + Evas_Object *content; + if (!si->obj) return NULL; + content = si->obj; /* si will die in _sub_del due elm_widget_sub_object_del() */ + elm_widget_sub_object_del(obj, content); + evas_object_event_callback_del_full(content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, wd); + edje_object_part_unswallow(wd->lay, content); + return content; + } + } + return NULL; +} + +EAPI Evas_Object * +elm_layout_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "layout"); + elm_widget_type_set(obj, "layout"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_changed_hook_set(obj, _changed_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); + elm_widget_focus_next_hook_set(obj, _elm_layout_focus_next_hook); + elm_widget_signal_emit_hook_set(obj, _signal_emit_hook); + elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook); + elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook); + elm_widget_text_set_hook_set(obj, _elm_layout_label_set); + elm_widget_text_get_hook_set(obj, _elm_layout_label_get); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); + + wd->obj = obj; + wd->lay = edje_object_add(e); + elm_widget_resize_object_set(obj, wd->lay); + edje_object_signal_callback_add(wd->lay, "size,eval", "elm", + _signal_size_eval, wd); + + evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _request_sizing_eval(wd); + return obj; +} + +EAPI Eina_Bool +elm_layout_file_set(Evas_Object *obj, const char *file, const char *group) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + Eina_Bool ret = edje_object_file_set(wd->lay, file, group); + if (ret) + { + _parts_text_fix(wd); + _request_sizing_eval(wd); + _parts_cursors_apply(wd); + } + else DBG("failed to set edje file '%s', group '%s': %s", + file, group, + edje_load_error_str(edje_object_load_error_get(wd->lay))); + return ret; +} + +EAPI Eina_Bool +elm_layout_theme_set(Evas_Object *obj, const char *clas, const char *group, const char *style) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + Eina_Bool ret = _elm_theme_object_set(obj, wd->lay, clas, group, style); + wd->clas = clas; + wd->group = group; + wd->style = style; + if (ret) + { + _parts_text_fix(wd); + _request_sizing_eval(wd); + _parts_cursors_apply(wd); + } + return ret; +} + +EAPI Eina_Bool +elm_layout_box_append(Evas_Object *obj, const char *part, Evas_Object *child) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + Subinfo *si; + if (!wd) return EINA_FALSE; + + if (!edje_object_part_box_append(wd->lay, part, child)) + WRN("child %p could not be appended to box part '%s'", child, part); + elm_widget_sub_object_add(obj, child); + evas_object_event_callback_add + (child, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, wd); + + si = ELM_NEW(Subinfo); + si->type = BOX_APPEND; + si->part = eina_stringshare_add(part); + si->obj = child; + wd->subs = eina_list_append(wd->subs, si); + _request_sizing_eval(wd); + + return EINA_TRUE; +} + +EAPI Eina_Bool +elm_layout_box_prepend(Evas_Object *obj, const char *part, Evas_Object *child) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + Subinfo *si; + if (!wd) return EINA_FALSE; + + if (!edje_object_part_box_prepend(wd->lay, part, child)) + WRN("child %p could not be prepended to box part '%s'", child, part); + elm_widget_sub_object_add(obj, child); + evas_object_event_callback_add + (child, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, wd); + + si = ELM_NEW(Subinfo); + si->type = BOX_PREPEND; + si->part = eina_stringshare_add(part); + si->obj = child; + wd->subs = eina_list_prepend(wd->subs, si); + _request_sizing_eval(wd); + + return EINA_TRUE; +} + +static void +_box_reference_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Subinfo *si = data; + si->p.box.reference = NULL; +} + +EAPI Eina_Bool +elm_layout_box_insert_before(Evas_Object *obj, const char *part, Evas_Object *child, const Evas_Object *reference) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + Subinfo *si; + if (!wd) return EINA_FALSE; + + if (!edje_object_part_box_insert_before(wd->lay, part, child, reference)) + WRN("child %p could not be inserted before %p inf box part '%s'", + child, reference, part); + + si = ELM_NEW(Subinfo); + si->type = BOX_INSERT_BEFORE; + si->part = eina_stringshare_add(part); + si->obj = child; + si->p.box.reference = reference; + + elm_widget_sub_object_add(obj, child); + evas_object_event_callback_add + (child, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, wd); + evas_object_event_callback_add + ((Evas_Object *)reference, EVAS_CALLBACK_DEL, _box_reference_del, si); + + wd->subs = eina_list_append(wd->subs, si); + _request_sizing_eval(wd); + + return EINA_TRUE; +} + +EAPI Eina_Bool +elm_layout_box_insert_at(Evas_Object *obj, const char *part, Evas_Object *child, unsigned int pos) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + Subinfo *si; + if (!wd) return EINA_FALSE; + + if (!edje_object_part_box_insert_at(wd->lay, part, child, pos)) + WRN("child %p could not be inserted at %u to box part '%s'", + child, pos, part); + + elm_widget_sub_object_add(obj, child); + evas_object_event_callback_add + (child, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, wd); + + si = ELM_NEW(Subinfo); + si->type = BOX_INSERT_AT; + si->part = eina_stringshare_add(part); + si->obj = child; + si->p.box.pos = pos; + wd->subs = eina_list_append(wd->subs, si); + _request_sizing_eval(wd); + + return EINA_TRUE; +} + +static Evas_Object * +_sub_box_remove(Widget_Data *wd, Subinfo *si) +{ + Evas_Object *child; + + if (si->type == BOX_INSERT_BEFORE) + evas_object_event_callback_del_full + ((Evas_Object *)si->p.box.reference, + EVAS_CALLBACK_DEL, _box_reference_del, si); + + child = si->obj; /* si will die in _sub_del due elm_widget_sub_object_del() */ + edje_object_part_box_remove(wd->lay, si->part, child); + elm_widget_sub_object_del(wd->obj, child); + return child; +} + +static Evas_Object * +_sub_table_remove(Widget_Data *wd, Subinfo *si) +{ + Evas_Object *child; + + child = si->obj; /* si will die in _sub_del due elm_widget_sub_object_del() */ + edje_object_part_table_unpack(wd->lay, si->part, child); + elm_widget_sub_object_del(wd->obj, child); + return child; +} + +static Eina_Bool +_sub_box_is(const Subinfo *si) +{ + switch (si->type) + { + case BOX_APPEND: + case BOX_PREPEND: + case BOX_INSERT_BEFORE: + case BOX_INSERT_AT: + return EINA_TRUE; + default: + return EINA_FALSE; + } +} + +EAPI Evas_Object * +elm_layout_box_remove(Evas_Object *obj, const char *part, Evas_Object *child) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + const Eina_List *l; + Subinfo *si; + + if (!wd) return NULL; + + EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(child, NULL); + EINA_LIST_FOREACH(wd->subs, l, si) + { + if (!_sub_box_is(si)) continue; + if ((si->obj == child) && (!strcmp(si->part, part))) + return _sub_box_remove(wd, si); + } + return NULL; +} + +EAPI Eina_Bool +elm_layout_box_remove_all(Evas_Object *obj, const char *part, Eina_Bool clear) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + Subinfo *si; + Eina_List *lst; + + if (!wd) return EINA_FALSE; + EINA_SAFETY_ON_NULL_RETURN_VAL(part, EINA_FALSE); + + lst = eina_list_clone(wd->subs); + EINA_LIST_FREE(lst, si) + { + if (!_sub_box_is(si)) continue; + if (!strcmp(si->part, part)) + { + Evas_Object *child = _sub_box_remove(wd, si); + if ((clear) && (child)) evas_object_del(child); + } + } + /* eventually something may not be added with layout, del them as well */ + edje_object_part_box_remove_all(wd->lay, part, clear); + + return EINA_TRUE; +} + +EAPI Eina_Bool +elm_layout_table_pack(Evas_Object *obj, const char *part, Evas_Object *child, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + Subinfo *si; + if (!wd) return EINA_FALSE; + + if (!edje_object_part_table_pack + (wd->lay, part, child, col, row, colspan, rowspan)) + WRN("child %p could not be packed into box part '%s' col=%uh, row=%hu, " + "colspan=%hu, rowspan=%hu", child, part, col, row, colspan, rowspan); + + elm_widget_sub_object_add(obj, child); + evas_object_event_callback_add + (child, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, wd); + + si = ELM_NEW(Subinfo); + si->type = TABLE_PACK; + si->part = eina_stringshare_add(part); + si->obj = child; + si->p.table.col = col; + si->p.table.row = row; + si->p.table.colspan = colspan; + si->p.table.rowspan = rowspan; + wd->subs = eina_list_append(wd->subs, si); + _request_sizing_eval(wd); + + return EINA_TRUE; +} + +EAPI Evas_Object * +elm_layout_table_unpack(Evas_Object *obj, const char *part, Evas_Object *child) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + const Eina_List *l; + Subinfo *si; + + if (!wd) return NULL; + + EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(child, NULL); + EINA_LIST_FOREACH(wd->subs, l, si) + { + if (si->type != TABLE_PACK) continue; + if ((si->obj == child) && (!strcmp(si->part, part))) + return _sub_table_remove(wd, si); + } + return NULL; +} + +EAPI Eina_Bool +elm_layout_table_clear(Evas_Object *obj, const char *part, Eina_Bool clear) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + Subinfo *si; + Eina_List *lst; + + if (!wd) return EINA_FALSE; + EINA_SAFETY_ON_NULL_RETURN_VAL(part, EINA_FALSE); + + lst = eina_list_clone(wd->subs); + EINA_LIST_FREE(lst, si) + { + if (si->type != TABLE_PACK) continue; + if (!strcmp(si->part, part)) + { + Evas_Object *child = _sub_table_remove(wd, si); + if ((clear) && (child)) evas_object_del(child); + } + } + /* eventually something may not be added with layout, del them as well */ + edje_object_part_table_clear(wd->lay, part, clear); + + return EINA_TRUE; +} + +EAPI Evas_Object * +elm_layout_edje_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->lay; +} + +EAPI const char * +elm_layout_data_get(const Evas_Object *obj, const char *key) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + return edje_object_data_get(wd->lay, key); +} + +EAPI void +elm_layout_sizing_eval(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(wd); + _request_sizing_eval(wd); +} + +EAPI Eina_Bool +elm_layout_part_cursor_set(Evas_Object *obj, const char *part_name, const char *cursor) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, EINA_FALSE); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EINA_FALSE); + Evas_Object *part_obj; + Part_Cursor *pc; + + part_obj = (Evas_Object *)edje_object_part_object_get(wd->lay, part_name); + if (!part_obj) + { + const char *group, *file; + edje_object_file_get(wd->lay, &file, &group); + WRN("no part '%s' in group '%s' of file '%s'. Cannot set cursor '%s'", + part_name, group, file, cursor); + return EINA_FALSE; + } + if (evas_object_pass_events_get(part_obj)) + { + const char *group, *file; + edje_object_file_get(wd->lay, &file, &group); + WRN("part '%s' in group '%s' of file '%s' has mouse_events: 0. " + "Cannot set cursor '%s'", + part_name, group, file, cursor); + return EINA_FALSE; + } + + pc = _parts_cursors_find(wd, part_name); + if (pc) eina_stringshare_replace(&pc->cursor, cursor); + else + { + pc = calloc(1, sizeof(*pc)); + pc->part = eina_stringshare_add(part_name); + pc->cursor = eina_stringshare_add(cursor); + pc->style = eina_stringshare_add("default"); + wd->parts_cursors = eina_list_append(wd->parts_cursors, pc); + } + + pc->obj = part_obj; + elm_object_sub_cursor_set(part_obj, obj, pc->cursor); + return EINA_TRUE; +} + +EAPI const char * +elm_layout_part_cursor_get(const Evas_Object *obj, const char *part_name) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, NULL); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); + Part_Cursor *pc = _parts_cursors_find(wd, part_name); + EINA_SAFETY_ON_NULL_RETURN_VAL(pc, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(pc->obj, NULL); + return elm_object_cursor_get(pc->obj); +} + +EAPI Eina_Bool +elm_layout_part_cursor_unset(Evas_Object *obj, const char *part_name) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, EINA_FALSE); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EINA_FALSE); + Eina_List *l; + Part_Cursor *pc; + + EINA_LIST_FOREACH(wd->parts_cursors, l, pc) + { + if (!strcmp(part_name, pc->part)) + { + if (pc->obj) elm_object_cursor_unset(pc->obj); + _part_cursor_free(pc); + wd->parts_cursors = eina_list_remove_list(wd->parts_cursors, l); + return EINA_TRUE; + } + } + + return EINA_FALSE; +} + +EAPI Eina_Bool +elm_layout_part_cursor_style_set(Evas_Object *obj, const char *part_name, const char *style) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, EINA_FALSE); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EINA_FALSE); + Part_Cursor *pc = _parts_cursors_find(wd, part_name); + EINA_SAFETY_ON_NULL_RETURN_VAL(pc, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(pc->obj, EINA_FALSE); + + eina_stringshare_replace(&pc->style, style); + elm_object_cursor_style_set(pc->obj, pc->style); + return EINA_TRUE; +} + +EAPI const char * +elm_layout_part_cursor_style_get(const Evas_Object *obj, const char *part_name) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, NULL); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); + Part_Cursor *pc = _parts_cursors_find(wd, part_name); + EINA_SAFETY_ON_NULL_RETURN_VAL(pc, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(pc->obj, NULL); + return elm_object_cursor_style_get(pc->obj); +} + +EAPI Eina_Bool +elm_layout_part_cursor_engine_only_set(Evas_Object *obj, const char *part_name, Eina_Bool engine_only) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, EINA_FALSE); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EINA_FALSE); + Part_Cursor *pc = _parts_cursors_find(wd, part_name); + EINA_SAFETY_ON_NULL_RETURN_VAL(pc, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(pc->obj, EINA_FALSE); + + pc->engine_only = !!engine_only; + elm_object_cursor_theme_search_enabled_set(pc->obj, pc->engine_only); + return EINA_TRUE; +} + +EAPI Eina_Bool +elm_layout_part_cursor_engine_only_get(const Evas_Object *obj, const char *part_name) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, EINA_FALSE); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EINA_FALSE); + Part_Cursor *pc = _parts_cursors_find(wd, part_name); + EINA_SAFETY_ON_NULL_RETURN_VAL(pc, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(pc->obj, EINA_FALSE); + return elm_object_cursor_theme_search_enabled_get(pc->obj); +} diff --git a/libraries/elementary/src/lib/elm_layout.h b/libraries/elementary/src/lib/elm_layout.h new file mode 100644 index 0000000..84ecbff --- /dev/null +++ b/libraries/elementary/src/lib/elm_layout.h @@ -0,0 +1,638 @@ +/** + * @defgroup Layout Layout + * @ingroup Elementary + * + * @image html img/widget/layout/preview-00.png + * @image latex img/widget/layout/preview-00.eps width=\textwidth + * + * @image html img/layout-predefined.png + * @image latex img/layout-predefined.eps width=\textwidth + * + * This is a container widget that takes a standard Edje design file and + * wraps it very thinly in a widget. + * + * An Edje design (theme) file has a very wide range of possibilities to + * describe the behavior of elements added to the Layout. Check out the Edje + * documentation and the EDC reference to get more information about what can + * be done with Edje. + * + * Just like @ref List, @ref Box, and other container widgets, any + * object added to the Layout will become its child, meaning that it will be + * deleted if the Layout is deleted, move if the Layout is moved, and so on. + * + * The Layout widget can contain as many Contents, Boxes or Tables as + * described in its theme file. For instance, objects can be added to + * different Tables by specifying the respective Table part names. The same + * is valid for Content and Box. + * + * The objects added as child of the Layout will behave as described in the + * part description where they were added. There are 3 possible types of + * parts where a child can be added: + * + * @section secContent Content (SWALLOW part) + * + * Only one object can be added to the @c SWALLOW part (but you still can + * have many @c SWALLOW parts and one object on each of them). Use the @c + * elm_object_content_set/get/unset functions to set, retrieve and unset + * objects as content of the @c SWALLOW. After being set to this part, the + * object size, position, visibility, clipping and other description + * properties will be totally controlled by the description of the given part + * (inside the Edje theme file). + * + * One can use @c evas_object_size_hint_* functions on the child to have some + * kind of control over its behavior, but the resulting behavior will still + * depend heavily on the @c SWALLOW part description. + * + * The Edje theme also can change the part description, based on signals or + * scripts running inside the theme. This change can also be animated. All of + * this will affect the child object set as content accordingly. The object + * size will be changed if the part size is changed, it will animate move if + * the part is moving, and so on. + * + * The following picture demonstrates a Layout widget with a child object + * added to its @c SWALLOW: + * + * @image html layout_swallow.png + * @image latex layout_swallow.eps width=\textwidth + * + * @section secBox Box (BOX part) + * + * An Edje @c BOX part is very similar to the Elementary @ref Box widget. It + * allows one to add objects to the box and have them distributed along its + * area, accordingly to the specified @a layout property (now by @a layout we + * mean the chosen layouting design of the Box, not the Layout widget + * itself). + * + * A similar effect for having a box with its position, size and other things + * controlled by the Layout theme would be to create an Elementary @ref Box + * widget and add it as a Content in the @c SWALLOW part. + * + * The main difference of using the Layout Box is that its behavior, the box + * properties like layouting format, padding, align, etc. will be all + * controlled by the theme. This means, for example, that a signal could be + * sent to the Layout theme (with elm_object_signal_emit()) and the theme + * handled the signal by changing the box padding, or align, or both. Using + * the Elementary @ref Box widget is not necessarily harder or easier, it + * just depends on the circumstances and requirements. + * + * The Layout Box can be used through the @c elm_layout_box_* set of + * functions. + * + * The following picture demonstrates a Layout widget with many child objects + * added to its @c BOX part: + * + * @image html layout_box.png + * @image latex layout_box.eps width=\textwidth + * + * @section secTable Table (TABLE part) + * + * Just like the @ref secBox, the Layout Table is very similar to the + * Elementary @ref Table widget. It allows one to add objects to the Table + * specifying the row and column where the object should be added, and any + * column or row span if necessary. + * + * Again, we could have this design by adding a @ref Table widget to the @c + * SWALLOW part using elm_object_part_content_set(). The same difference happens + * here when choosing to use the Layout Table (a @c TABLE part) instead of + * the @ref Table plus @c SWALLOW part. It's just a matter of convenience. + * + * The Layout Table can be used through the @c elm_layout_table_* set of + * functions. + * + * The following picture demonstrates a Layout widget with many child objects + * added to its @c TABLE part: + * + * @image html layout_table.png + * @image latex layout_table.eps width=\textwidth + * + * @section secPredef Predefined Layouts + * + * Another interesting thing about the Layout widget is that it offers some + * predefined themes that come with the default Elementary theme. These + * themes can be set by the call elm_layout_theme_set(), and provide some + * basic functionality depending on the theme used. + * + * Most of them already send some signals, some already provide a toolbar or + * back and next buttons. + * + * These are available predefined theme layouts. All of them have class = @c + * layout, group = @c application, and style = one of the following options: + * + * @li @c toolbar-content - application with toolbar and main content area + * @li @c toolbar-content-back - application with toolbar and main content + * area with a back button and title area + * @li @c toolbar-content-back-next - application with toolbar and main + * content area with a back and next buttons and title area + * @li @c content-back - application with a main content area with a back + * button and title area + * @li @c content-back-next - application with a main content area with a + * back and next buttons and title area + * @li @c toolbar-vbox - application with toolbar and main content area as a + * vertical box + * @li @c toolbar-table - application with toolbar and main content area as a + * table + * + * Supported elm_object common APIs. + * @li @ref elm_object_signal_emit + * @li @ref elm_object_signal_callback_add + * @li @ref elm_object_signal_callback_del + * @li @ref elm_object_part_text_set + * @li @ref elm_object_part_text_get + * @li @ref elm_object_part_content_set + * @li @ref elm_object_part_content_get + * @li @ref elm_object_part_content_unset + * + * @section secExamples Examples + * + * Some examples of the Layout widget can be found here: + * @li @ref layout_example_01 + * @li @ref layout_example_02 + * @li @ref layout_example_03 + * @li @ref layout_example_edc + * + */ + +/** + * Add a new layout to the parent + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * @see elm_layout_file_set() + * @see elm_layout_theme_set() + * + * @ingroup Layout + */ +EAPI Evas_Object *elm_layout_add(Evas_Object *parent); + +/** + * Set the file that will be used as layout + * + * @param obj The layout object + * @param file The path to file (edj) that will be used as layout + * @param group The group that the layout belongs in edje file + * + * @return (1 = success, 0 = error) + * + * @ingroup Layout + */ +EAPI Eina_Bool elm_layout_file_set(Evas_Object *obj, const char *file, const char *group); + +/** + * Set the edje group from the elementary theme that will be used as layout + * + * @param obj The layout object + * @param clas the class of the group + * @param group the group + * @param style the style to used + * + * @return (1 = success, 0 = error) + * + * @ingroup Layout + */ +EAPI Eina_Bool elm_layout_theme_set(Evas_Object *obj, const char *clas, const char *group, const char *style); + +/** + * Append child to layout box part. + * + * @param obj the layout object + * @param part the box part to which the object will be appended. + * @param child the child object to append to box. + * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise + * + * Once the object is appended, it will become child of the layout. Its + * lifetime will be bound to the layout, whenever the layout dies the child + * will be deleted automatically. One should use elm_layout_box_remove() to + * make this layout forget about the object. + * + * @see elm_layout_box_prepend() + * @see elm_layout_box_insert_before() + * @see elm_layout_box_insert_at() + * @see elm_layout_box_remove() + * + * @ingroup Layout + */ +EAPI Eina_Bool elm_layout_box_append(Evas_Object *obj, const char *part, Evas_Object *child); + +/** + * Prepend child to layout box part. + * + * @param obj the layout object + * @param part the box part to prepend. + * @param child the child object to prepend to box. + * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise + * + * Once the object is prepended, it will become child of the layout. Its + * lifetime will be bound to the layout, whenever the layout dies the child + * will be deleted automatically. One should use elm_layout_box_remove() to + * make this layout forget about the object. + * + * @see elm_layout_box_append() + * @see elm_layout_box_insert_before() + * @see elm_layout_box_insert_at() + * @see elm_layout_box_remove() + * + * @ingroup Layout + */ +EAPI Eina_Bool elm_layout_box_prepend(Evas_Object *obj, const char *part, Evas_Object *child); + +/** + * Insert child to layout box part before a reference object. + * + * @param obj the layout object + * @param part the box part to insert. + * @param child the child object to insert into box. + * @param reference another reference object to insert before in box. + * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise + * + * Once the object is inserted, it will become child of the layout. Its + * lifetime will be bound to the layout, whenever the layout dies the child + * will be deleted automatically. One should use elm_layout_box_remove() to + * make this layout forget about the object. + * + * @see elm_layout_box_append() + * @see elm_layout_box_prepend() + * @see elm_layout_box_insert_before() + * @see elm_layout_box_remove() + * + * @ingroup Layout + */ +EAPI Eina_Bool elm_layout_box_insert_before(Evas_Object *obj, const char *part, Evas_Object *child, const Evas_Object *reference); + +/** + * Insert child to layout box part at a given position. + * + * @param obj the layout object + * @param part the box part to insert. + * @param child the child object to insert into box. + * @param pos the numeric position >=0 to insert the child. + * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise + * + * Once the object is inserted, it will become child of the layout. Its + * lifetime will be bound to the layout, whenever the layout dies the child + * will be deleted automatically. One should use elm_layout_box_remove() to + * make this layout forget about the object. + * + * @see elm_layout_box_append() + * @see elm_layout_box_prepend() + * @see elm_layout_box_insert_before() + * @see elm_layout_box_remove() + * + * @ingroup Layout + */ +EAPI Eina_Bool elm_layout_box_insert_at(Evas_Object *obj, const char *part, Evas_Object *child, unsigned int pos); + +/** + * Remove a child of the given part box. + * + * @param obj The layout object + * @param part The box part name to remove child. + * @param child The object to remove from box. + * @return The object that was being used, or NULL if not found. + * + * The object will be removed from the box part and its lifetime will + * not be handled by the layout anymore. This is equivalent to + * elm_object_part_content_unset() for box. + * + * @see elm_layout_box_append() + * @see elm_layout_box_remove_all() + * + * @ingroup Layout + */ +EAPI Evas_Object *elm_layout_box_remove(Evas_Object *obj, const char *part, Evas_Object *child); + +/** + * Remove all children of the given part box. + * + * @param obj The layout object + * @param part The box part name to remove child. + * @param clear If EINA_TRUE, then all objects will be deleted as + * well, otherwise they will just be removed and will be + * dangling on the canvas. + * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise + * + * The objects will be removed from the box part and their lifetime will + * not be handled by the layout anymore. This is equivalent to + * elm_layout_box_remove() for all box children. + * + * @see elm_layout_box_append() + * @see elm_layout_box_remove() + * + * @ingroup Layout + */ +EAPI Eina_Bool elm_layout_box_remove_all(Evas_Object *obj, const char *part, Eina_Bool clear); + +/** + * Insert child to layout table part. + * + * @param obj the layout object + * @param part the box part to pack child. + * @param child_obj the child object to pack into table. + * @param col the column to which the child should be added. (>= 0) + * @param row the row to which the child should be added. (>= 0) + * @param colspan how many columns should be used to store this object. (>= + * 1) + * @param rowspan how many rows should be used to store this object. (>= 1) + * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise + * + * Once the object is inserted, it will become child of the table. Its + * lifetime will be bound to the layout, and whenever the layout dies the + * child will be deleted automatically. One should use + * elm_layout_table_remove() to make this layout forget about the object. + * + * If @p colspan or @p rowspan are bigger than 1, that object will occupy + * more space than a single cell. For instance, the following code: + * @code + * elm_layout_table_pack(layout, "table_part", child, 0, 1, 3, 1); + * @endcode + * + * Would result in an object being added like the following picture: + * + * @image html layout_colspan.png + * @image latex layout_colspan.eps width=\textwidth + * + * @see elm_layout_table_unpack() + * @see elm_layout_table_clear() + * + * @ingroup Layout + */ +EAPI Eina_Bool elm_layout_table_pack(Evas_Object *obj, const char *part, Evas_Object *child_obj, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan); + +/** + * Unpack (remove) a child of the given part table. + * + * @param obj The layout object + * @param part The table part name to remove child. + * @param child_obj The object to remove from table. + * @return The object that was being used, or NULL if not found. + * + * The object will be unpacked from the table part and its lifetime + * will not be handled by the layout anymore. This is equivalent to + * elm_object_part_content_unset() for table. + * + * @see elm_layout_table_pack() + * @see elm_layout_table_clear() + * + * @ingroup Layout + */ +EAPI Evas_Object *elm_layout_table_unpack(Evas_Object *obj, const char *part, Evas_Object *child_obj); + +/** + * Remove all the child objects of the given part table. + * + * @param obj The layout object + * @param part The table part name to remove child. + * @param clear If EINA_TRUE, then all objects will be deleted as + * well, otherwise they will just be removed and will be + * dangling on the canvas. + * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise + * + * The objects will be removed from the table part and their lifetime will + * not be handled by the layout anymore. This is equivalent to + * elm_layout_table_unpack() for all table children. + * + * @see elm_layout_table_pack() + * @see elm_layout_table_unpack() + * + * @ingroup Layout + */ +EAPI Eina_Bool elm_layout_table_clear(Evas_Object *obj, const char *part, Eina_Bool clear); + +/** + * Get the edje layout + * + * @param obj The layout object + * + * @return A Evas_Object with the edje layout settings loaded + * with function elm_layout_file_set + * + * This returns the edje object. It is not expected to be used to then + * swallow objects via edje_object_part_swallow() for example. Use + * elm_object_part_content_set() instead so child object handling and sizing is + * done properly. + * + * @note This function should only be used if you really need to call some + * low level Edje function on this edje object. All the common stuff (setting + * text, emitting signals, hooking callbacks to signals, etc.) can be done + * with proper elementary functions. + * + * @see elm_object_signal_callback_add() + * @see elm_object_signal_emit() + * @see elm_object_part_text_set() + * @see elm_object_part_content_set() + * @see elm_layout_box_append() + * @see elm_layout_table_pack() + * @see elm_layout_data_get() + * + * @ingroup Layout + */ +EAPI Evas_Object *elm_layout_edje_get(const Evas_Object *obj); + +/** + * Get the edje data from the given layout + * + * @param obj The layout object + * @param key The data key + * + * @return The edje data string + * + * This function fetches data specified inside the edje theme of this layout. + * This function return NULL if data is not found. + * + * In EDC this comes from a data block within the group block that @p + * obj was loaded from. E.g. + * + * @code + * collections { + * group { + * name: "a_group"; + * data { + * item: "key1" "value1"; + * item: "key2" "value2"; + * } + * } + * } + * @endcode + * + * @ingroup Layout + */ +EAPI const char *elm_layout_data_get(const Evas_Object *obj, const char *key); + +/** + * Eval sizing + * + * @param obj The layout object + * + * Manually forces a sizing re-evaluation. This is useful when the minimum + * size required by the edje theme of this layout has changed. The change on + * the minimum size required by the edje theme is not immediately reported to + * the elementary layout, so one needs to call this function in order to tell + * the widget (layout) that it needs to reevaluate its own size. + * + * The minimum size of the theme is calculated based on minimum size of + * parts, the size of elements inside containers like box and table, etc. All + * of this can change due to state changes, and that's when this function + * should be called. + * + * Also note that a standard signal of "size,eval" "elm" emitted from the + * edje object will cause this to happen too. + * + * @ingroup Layout + */ +EAPI void elm_layout_sizing_eval(Evas_Object *obj); + +/** + * Sets a specific cursor for an edje part. + * + * @param obj The layout object. + * @param part_name a part from loaded edje group. + * @param cursor cursor name to use, see Elementary_Cursor.h + * + * @return EINA_TRUE on success or EINA_FALSE on failure, that may be + * part not exists or it has "mouse_events: 0". + * + * @ingroup Layout + */ +EAPI Eina_Bool elm_layout_part_cursor_set(Evas_Object *obj, const char *part_name, const char *cursor); + +/** + * Get the cursor to be shown when mouse is over an edje part + * + * @param obj The layout object. + * @param part_name a part from loaded edje group. + * @return the cursor name. + * + * @ingroup Layout + */ +EAPI const char *elm_layout_part_cursor_get(const Evas_Object *obj, const char *part_name); + +/** + * Unsets a cursor previously set with elm_layout_part_cursor_set(). + * + * @param obj The layout object. + * @param part_name a part from loaded edje group, that had a cursor set + * with elm_layout_part_cursor_set(). + * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise + * + * @ingroup Layout + */ +EAPI Eina_Bool elm_layout_part_cursor_unset(Evas_Object *obj, const char *part_name); + +/** + * Sets a specific cursor style for an edje part. + * + * @param obj The layout object. + * @param part_name a part from loaded edje group. + * @param style the theme style to use (default, transparent, ...) + * + * @return EINA_TRUE on success or EINA_FALSE on failure, that may be + * part not exists or it did not had a cursor set. + * + * @ingroup Layout + */ +EAPI Eina_Bool elm_layout_part_cursor_style_set(Evas_Object *obj, const char *part_name, const char *style); + +/** + * Gets a specific cursor style for an edje part. + * + * @param obj The layout object. + * @param part_name a part from loaded edje group. + * + * @return the theme style in use, defaults to "default". If the + * object does not have a cursor set, then NULL is returned. + * + * @ingroup Layout + */ +EAPI const char *elm_layout_part_cursor_style_get(const Evas_Object *obj, const char *part_name); + +/** + * Sets if the cursor set should be searched on the theme or should use + * the provided by the engine, only. + * + * @note before you set if should look on theme you should define a + * cursor with elm_layout_part_cursor_set(). By default it will only + * look for cursors provided by the engine. + * + * @param obj The layout object. + * @param part_name a part from loaded edje group. + * @param engine_only if cursors should be just provided by the engine (EINA_TRUE) + * or should also search on widget's theme as well (EINA_FALSE) + * + * @return EINA_TRUE on success or EINA_FALSE on failure, that may be + * part not exists or it did not had a cursor set. + * + * @ingroup Layout + */ +EAPI Eina_Bool elm_layout_part_cursor_engine_only_set(Evas_Object *obj, const char *part_name, Eina_Bool engine_only); + +/** + * Gets a specific cursor engine_only for an edje part. + * + * @param obj The layout object. + * @param part_name a part from loaded edje group. + * + * @return whenever the cursor is just provided by engine or also from theme. + * + * @ingroup Layout + */ +EAPI Eina_Bool elm_layout_part_cursor_engine_only_get(const Evas_Object *obj, const char *part_name); + +/** + * @def elm_layout_icon_set + * Convenience macro to set the icon object in a layout that follows the + * Elementary naming convention for its parts. + * + * @ingroup Layout + */ +#define elm_layout_icon_set(_ly, _obj) \ + do { \ + const char *sig; \ + elm_object_part_content_set((_ly), "elm.swallow.icon", (_obj)); \ + if ((_obj)) sig = "elm,state,icon,visible"; \ + else sig = "elm,state,icon,hidden"; \ + elm_object_signal_emit((_ly), sig, "elm"); \ + } while (0) + +/** + * @def elm_layout_icon_get + * Convenience macro to get the icon object from a layout that follows the + * Elementary naming convention for its parts. + * + * @ingroup Layout + */ +#define elm_layout_icon_get(_ly) \ + elm_object_part_content_get((_ly), "elm.swallow.icon") + +/** + * @def elm_layout_end_set + * Convenience macro to set the end object in a layout that follows the + * Elementary naming convention for its parts. + * + * @ingroup Layout + */ +#define elm_layout_end_set(_ly, _obj) \ + do { \ + const char *sig; \ + elm_object_part_content_set((_ly), "elm.swallow.end", (_obj)); \ + if ((_obj)) sig = "elm,state,end,visible"; \ + else sig = "elm,state,end,hidden"; \ + elm_object_signal_emit((_ly), sig, "elm"); \ + } while (0) + +/** + * @def elm_layout_end_get + * Convenience macro to get the end object in a layout that follows the + * Elementary naming convention for its parts. + * + * @ingroup Layout + */ +#define elm_layout_end_get(_ly) \ + elm_object_part_content_get((_ly), "elm.swallow.end") + +/* smart callbacks called: + * "theme,changed" - when elm theme is changed. + */ + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_list.c b/libraries/elementary/src/lib/elm_list.c new file mode 100644 index 0000000..d370baa --- /dev/null +++ b/libraries/elementary/src/lib/elm_list.c @@ -0,0 +1,2004 @@ +#include +#include "elm_priv.h" +#include "els_scroller.h" + +#define SWIPE_MOVES 12 + +typedef struct _Widget_Data Widget_Data; +typedef struct _Elm_List_Item Elm_List_Item; + +struct _Widget_Data +{ + Evas_Object *scr, *box, *self; + Eina_List *items, *selected, *to_delete; + Elm_Object_Item *last_selected_item; + Elm_List_Mode mode; + Elm_List_Mode h_mode; + Evas_Coord minw[2], minh[2]; + Elm_Object_Select_Mode select_mode; + int walking; + int movements; + struct + { + Evas_Coord x, y; + } history[SWIPE_MOVES]; + Eina_Bool scr_minw : 1; + Eina_Bool scr_minh : 1; + Eina_Bool swipe : 1; + Eina_Bool fix_pending : 1; + Eina_Bool on_hold : 1; + Eina_Bool multi : 1; + Eina_Bool longpressed : 1; + Eina_Bool wasselected : 1; +}; + +struct _Elm_List_Item +{ + ELM_WIDGET_ITEM; + Widget_Data *wd; + Eina_List *node; + const char *label; + Evas_Object *icon, *end; + Evas_Smart_Cb func; + Ecore_Timer *long_timer; + Ecore_Timer *swipe_timer; + Eina_Bool deleted : 1; + Eina_Bool even : 1; + Eina_Bool is_even : 1; + Eina_Bool is_separator : 1; + Eina_Bool fixed : 1; + Eina_Bool selected : 1; + Eina_Bool highlighted : 1; + Eina_Bool dummy_icon : 1; + Eina_Bool dummy_end : 1; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); +static void _theme_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _disable_hook(Evas_Object *obj); +static void _on_focus_hook(void *data, Evas_Object *obj); +static void _signal_emit_hook(Evas_Object *obj, const char *emission, const char *source); +static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _sub_del(void *data, Evas_Object *obj, void *event_info); +static void _fix_items(Evas_Object *obj); +static void _mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info); +static void _mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info); +static void _mouse_move(void *data, Evas *evas, Evas_Object *obj, void *event_info); +static void _edge_left(void *data, Evas_Object *scr, void *event_info); +static void _edge_right(void *data, Evas_Object *scr, void *event_info); +static void _edge_top(void *data, Evas_Object *scr, void *event_info); +static void _edge_bottom(void *data, Evas_Object *scr, void *event_info); +static Eina_Bool _item_multi_select_up(Widget_Data *wd); +static Eina_Bool _item_multi_select_down(Widget_Data *wd); +static Eina_Bool _item_single_select_up(Widget_Data *wd); +static Eina_Bool _item_single_select_down(Widget_Data *wd); +static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src, + Evas_Callback_Type type, void *event_info); +static Eina_Bool _deselect_all_items(Widget_Data *wd); + +static const char SIG_ACTIVATED[] = "activated"; +static const char SIG_CLICKED_DOUBLE[] = "clicked,double"; +static const char SIG_SELECTED[] = "selected"; +static const char SIG_UNSELECTED[] = "unselected"; +static const char SIG_LONGPRESSED[] = "longpressed"; +static const char SIG_EDGE_TOP[] = "edge,top"; +static const char SIG_EDGE_BOTTOM[] = "edge,bottom"; +static const char SIG_EDGE_LEFT[] = "edge,left"; +static const char SIG_EDGE_RIGHT[] = "edge,right"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_ACTIVATED, ""}, + {SIG_CLICKED_DOUBLE, ""}, + {SIG_SELECTED, ""}, + {SIG_UNSELECTED, ""}, + {SIG_LONGPRESSED, ""}, + {SIG_EDGE_TOP, ""}, + {SIG_EDGE_BOTTOM, ""}, + {SIG_EDGE_LEFT, ""}, + {SIG_EDGE_RIGHT, ""}, + {NULL, NULL} +}; + +#define ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, ...) \ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, __VA_ARGS__); \ +if (((Elm_List_Item *)it)->deleted) \ +{ \ + ERR("ERROR: "#it" has been DELETED.\n"); \ + return __VA_ARGS__; \ +} + +static inline void +_elm_list_item_free(Elm_List_Item *it) +{ + evas_object_event_callback_del_full + (VIEW(it), EVAS_CALLBACK_MOUSE_DOWN, _mouse_down, it); + evas_object_event_callback_del_full + (VIEW(it), EVAS_CALLBACK_MOUSE_UP, _mouse_up, it); + evas_object_event_callback_del_full + (VIEW(it), EVAS_CALLBACK_MOUSE_MOVE, _mouse_move, it); + + if (it->icon) + evas_object_event_callback_del_full + (it->icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, WIDGET(it)); + + if (it->end) + evas_object_event_callback_del_full + (it->end, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, WIDGET(it)); + + eina_stringshare_del(it->label); + + if (it->swipe_timer) ecore_timer_del(it->swipe_timer); + it->swipe_timer = NULL; + if (it->long_timer) ecore_timer_del(it->long_timer); + it->long_timer = NULL; + if (it->icon) evas_object_del(it->icon); + if (it->end) evas_object_del(it->end); +} + +static Eina_Bool +_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info) +{ + if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE; + Evas_Event_Key_Down *ev = event_info; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + if (!wd->items) return EINA_FALSE; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; + if (elm_widget_disabled_get(obj)) return EINA_FALSE; + + Elm_List_Item *it = NULL; + Evas_Coord x = 0; + Evas_Coord y = 0; + Evas_Coord step_x = 0; + Evas_Coord step_y = 0; + Evas_Coord v_w = 0; + Evas_Coord v_h = 0; + Evas_Coord page_x = 0; + Evas_Coord page_y = 0; + + elm_smart_scroller_child_pos_get(wd->scr, &x, &y); + elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y); + elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y); + elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h); + + /* TODO: fix logic for horizontal mode */ + if ((!strcmp(ev->keyname, "Left")) || + ((!strcmp(ev->keyname, "KP_Left")) && !ev->string)) + { + if ((wd->h_mode) && + (((evas_key_modifier_is_set(ev->modifiers, "Shift")) && + (_item_multi_select_up(wd))) + || (_item_single_select_up(wd)))) + { + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else + x -= step_x; + } + else if ((!strcmp(ev->keyname, "Right")) || + ((!strcmp(ev->keyname, "KP_Right")) && !ev->string)) + { + if ((wd->h_mode) && + (((evas_key_modifier_is_set(ev->modifiers, "Shift")) && + (_item_multi_select_down(wd))) + || (_item_single_select_down(wd)))) + { + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else + x += step_x; + } + else if ((!strcmp(ev->keyname, "Up")) || + ((!strcmp(ev->keyname, "KP_Up")) && !ev->string)) + { + if ((!wd->h_mode) && + (((evas_key_modifier_is_set(ev->modifiers, "Shift")) && + (_item_multi_select_up(wd))) + || (_item_single_select_up(wd)))) + { + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else + y -= step_y; + } + else if ((!strcmp(ev->keyname, "Down")) || + ((!strcmp(ev->keyname, "KP_Down")) && !ev->string)) + { + if ((!wd->h_mode) && + (((evas_key_modifier_is_set(ev->modifiers, "Shift")) && + (_item_multi_select_down(wd))) + || (_item_single_select_down(wd)))) + { + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else + y += step_y; + } + else if ((!strcmp(ev->keyname, "Home")) || + ((!strcmp(ev->keyname, "KP_Home")) && !ev->string)) + { + it = eina_list_data_get(wd->items); + elm_list_item_bring_in((Elm_Object_Item *)it); + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else if ((!strcmp(ev->keyname, "End")) || + ((!strcmp(ev->keyname, "KP_End")) && !ev->string)) + { + it = eina_list_data_get(eina_list_last(wd->items)); + elm_list_item_bring_in((Elm_Object_Item *)it); + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else if ((!strcmp(ev->keyname, "Prior")) || + ((!strcmp(ev->keyname, "KP_Prior")) && !ev->string)) + { + if (wd->h_mode) + { + if (page_x < 0) + x -= -(page_x * v_w) / 100; + else + x -= page_x; + } + else + { + if (page_y < 0) + y -= -(page_y * v_h) / 100; + else + y -= page_y; + } + } + else if ((!strcmp(ev->keyname, "Next")) || + ((!strcmp(ev->keyname, "KP_Next")) && !ev->string)) + { + if (wd->h_mode) + { + if (page_x < 0) + x += -(page_x * v_w) / 100; + else + x += page_x; + } + else + { + if (page_y < 0) + y += -(page_y * v_h) / 100; + else + y += page_y; + } + } + else if (((!strcmp(ev->keyname, "Return")) || + (!strcmp(ev->keyname, "KP_Enter")) || + (!strcmp(ev->keyname, "space"))) + && (!wd->multi) && (wd->selected)) + { + it = (Elm_List_Item *) elm_list_selected_item_get(obj); + evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it); + } + else if (!strcmp(ev->keyname, "Escape")) + { + if (!_deselect_all_items(wd)) return EINA_FALSE; + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else return EINA_FALSE; + + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + elm_smart_scroller_child_pos_set(wd->scr, x, y); + return EINA_TRUE; +} + +static void +_translate_hook(Evas_Object *obj) +{ + evas_object_smart_callback_call(obj, "language,changed", NULL); +} + +static Eina_Bool +_deselect_all_items(Widget_Data *wd) +{ + if (!wd->selected) return EINA_FALSE; + while (wd->selected) + elm_list_item_selected_set((Elm_Object_Item *) wd->selected->data, + EINA_FALSE); + + return EINA_TRUE; +} + +static Eina_Bool +_item_multi_select_up(Widget_Data *wd) +{ + if (!wd->selected) return EINA_FALSE; + if (!wd->multi) return EINA_FALSE; + + Elm_Object_Item *prev = elm_list_item_prev(wd->last_selected_item); + if (!prev) return EINA_TRUE; + + if (elm_list_item_selected_get(prev)) + { + elm_list_item_selected_set(wd->last_selected_item, EINA_FALSE); + wd->last_selected_item = prev; + elm_list_item_show(wd->last_selected_item); + } + else + { + elm_list_item_selected_set(prev, EINA_TRUE); + elm_list_item_show(prev); + } + return EINA_TRUE; +} + +static Eina_Bool +_item_multi_select_down(Widget_Data *wd) +{ + if (!wd->selected) return EINA_FALSE; + if (!wd->multi) return EINA_FALSE; + + Elm_Object_Item *next = elm_list_item_next(wd->last_selected_item); + if (!next) return EINA_TRUE; + + if (elm_list_item_selected_get(next)) + { + elm_list_item_selected_set(wd->last_selected_item, EINA_FALSE); + wd->last_selected_item = next; + elm_list_item_show(wd->last_selected_item); + } + else + { + elm_list_item_selected_set(next, EINA_TRUE); + elm_list_item_show(next); + } + return EINA_TRUE; +} + +static Eina_Bool +_item_single_select_up(Widget_Data *wd) +{ + Elm_Object_Item *prev; + + if (!wd->selected) prev = eina_list_data_get(eina_list_last(wd->items)); + else prev = elm_list_item_prev(wd->last_selected_item); + if (!prev) return EINA_FALSE; + + _deselect_all_items(wd); + + elm_list_item_selected_set(prev, EINA_TRUE); + elm_list_item_show(prev); + return EINA_TRUE; +} + +static Eina_Bool +_item_single_select_down(Widget_Data *wd) +{ + Elm_Object_Item *next; + + if (!wd->selected) next = eina_list_data_get(wd->items); + else next = elm_list_item_next(wd->last_selected_item); + if (!next) return EINA_FALSE; + + _deselect_all_items(wd); + + elm_list_item_selected_set(next, EINA_TRUE); + elm_list_item_show(next); + return EINA_TRUE; +} + +static void +_elm_list_process_deletions(Widget_Data *wd) +{ + Elm_List_Item *it; + + wd->walking++; // avoid nested deletion and also _sub_del() fix_items + + EINA_LIST_FREE(wd->to_delete, it) + { + wd->items = eina_list_remove_list(wd->items, it->node); + _elm_list_item_free(it); + elm_widget_item_free(it); + } + + wd->walking--; +} + +static inline void +_elm_list_walk(Widget_Data *wd) +{ + if (wd->walking < 0) + { + ERR("ERROR: walking was negative. fixed!\n"); + wd->walking = 0; + } + wd->walking++; +} + +static inline void +_elm_list_unwalk(Widget_Data *wd) +{ + wd->walking--; + if (wd->walking < 0) + { + ERR("ERROR: walking became negative. fixed!\n"); + wd->walking = 0; + } + + if (wd->walking) + return; + + if (wd->to_delete) + _elm_list_process_deletions(wd); + + if (wd->fix_pending) + { + wd->fix_pending = EINA_FALSE; + _fix_items(wd->self); + _sizing_eval(wd->self); + } +} + +static void +_del_pre_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + const Eina_List *l; + Elm_List_Item *it; + + evas_object_smart_callback_del(obj, "sub-object-del", _sub_del); + + if (!wd) return; + + EINA_LIST_FOREACH(wd->items, l, it) + { + if (it->icon) + evas_object_event_callback_del(it->icon, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints); + if (it->end) + evas_object_event_callback_del(it->end, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints); + } + + evas_object_event_callback_del(wd->scr, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints); + evas_object_event_callback_del(wd->box, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints); +} + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Elm_List_Item *it; + Eina_List *n; + + if (!wd) return; + if (wd->walking) + ERR("ERROR: list deleted while walking.\n"); + + _elm_list_walk(wd); + EINA_LIST_FOREACH(wd->items, n, it) elm_widget_item_pre_notify_del(it); + _elm_list_unwalk(wd); + if (wd->to_delete) + ERR("ERROR: leaking nodes!\n"); + + EINA_LIST_FREE(wd->items, it) + { + _elm_list_item_free(it); + elm_widget_item_free(it); + } + eina_list_free(wd->selected); + free(wd); +} + +static void +_show_region_hook(void *data, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(data); + Evas_Coord x, y, w, h; + if (!wd) return; + elm_widget_show_region_get(obj, &x, &y, &w, &h); + elm_smart_scroller_child_region_set(wd->scr, x, y, w, h); +} + +static void +_disable_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (elm_widget_disabled_get(obj)) + { + _signal_emit_hook(obj, "elm,state,disabled", "elm"); + elm_widget_scroll_freeze_push(obj); + elm_widget_scroll_hold_push(obj); + /* FIXME: if we get to have a way to only un-highlight items + * in the future, keeping them selected... */ + _deselect_all_items(wd); + } + else + { + _signal_emit_hook(obj, "elm,state,enabled", "elm"); + elm_widget_scroll_freeze_pop(obj); + elm_widget_scroll_hold_pop(obj); + } +} + +static void +_sizing_eval(Evas_Object *obj) +{ + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + Evas_Coord vw, vh, minw, minh, maxw, maxh, w, h, vmw, vmh; + double xw, yw; + + evas_object_size_hint_min_get(wd->box, &minw, &minh); + evas_object_size_hint_max_get(wd->box, &maxw, &maxh); + evas_object_size_hint_weight_get(wd->box, &xw, &yw); + if (!wd->scr) return; + elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh); + if (xw > 0.0) + { + if ((minw > 0) && (vw < minw)) vw = minw; + else if ((maxw > 0) && (vw > maxw)) vw = maxw; + } + else if (minw > 0) vw = minw; + if (yw > 0.0) + { + if ((minh > 0) && (vh < minh)) vh = minh; + else if ((maxh > 0) && (vh > maxh)) vh = maxh; + } + else if (minh > 0) vh = minh; + evas_object_resize(wd->box, vw, vh); + w = -1; + h = -1; + edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), + &vmw, &vmh); + if (wd->scr_minw) w = vmw + minw; + if (wd->scr_minh) h = vmh + minh; + + evas_object_size_hint_max_get(obj, &maxw, &maxh); + if ((maxw > 0) && (w > maxw)) + w = maxw; + if ((maxh > 0) && (h > maxh)) + h = maxh; + + evas_object_size_hint_min_set(obj, w, h); +} + +static void +_signal_emit_hook(Evas_Object *obj, const char *emission, const char *source) +{ + Widget_Data *wd = elm_widget_data_get(obj); + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), + emission, source); +} + +static void +_signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + edje_object_signal_callback_add(elm_smart_scroller_edje_object_get(wd->scr), + emission, source, func_cb, data); +} + +static void +_signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + edje_object_signal_callback_del_full( + elm_smart_scroller_edje_object_get(wd->scr), + emission, source, func_cb, data); +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Elm_List_Item *it; + Eina_List *n; + + if (!wd) return; + if (wd->scr) + elm_smart_scroller_mirrored_set(wd->scr, rtl); + + EINA_LIST_FOREACH(wd->items, n, it) + edje_object_mirrored_set(VIEW(it), rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Elm_List_Item *it; + Eina_List *n; + + if (!wd) return; + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + + if (wd->scr) + { + Evas_Object *edj; + const char *str; + + elm_smart_scroller_object_theme_set(obj, wd->scr, "list", "base", + elm_widget_style_get(obj)); + // edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale); + edj = elm_smart_scroller_edje_object_get(wd->scr); + str = edje_object_data_get(edj, "focus_highlight"); + if ((str) && (!strcmp(str, "on"))) + elm_widget_highlight_in_theme_set(obj, EINA_TRUE); + else + elm_widget_highlight_in_theme_set(obj, EINA_FALSE); + elm_object_style_set(wd->scr, elm_widget_style_get(obj)); + } + EINA_LIST_FOREACH(wd->items, n, it) + { + edje_object_scale_set(VIEW(it), elm_widget_scale_get(obj) * _elm_config->scale); + it->fixed = 0; + } + _fix_items(obj); + _sizing_eval(obj); +} + +static void +_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (elm_widget_focus_get(obj)) + { + edje_object_signal_emit(wd->self, "elm,action,focus", "elm"); + evas_object_focus_set(wd->self, EINA_TRUE); + + if ((wd->selected) && (!wd->last_selected_item)) + wd->last_selected_item = eina_list_data_get(wd->selected); + } + else + { + edje_object_signal_emit(wd->self, "elm,action,unfocus", "elm"); + evas_object_focus_set(wd->self, EINA_FALSE); + } +} + +static void +_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + _fix_items(data); + _sizing_eval(data); +} + +static void +_sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *sub = event_info; + const Eina_List *l; + Elm_List_Item *it; + + if (!wd) return; + if (!sub) abort(); + if ((sub == wd->box) || (sub == wd->scr)) return; + + EINA_LIST_FOREACH(wd->items, l, it) + { + if ((sub == it->icon) || (sub == it->end)) + { + if (it->icon == sub) it->icon = NULL; + if (it->end == sub) it->end = NULL; + evas_object_event_callback_del_full + (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, + obj); + if (!wd->walking) + { + _fix_items(obj); + _sizing_eval(obj); + } + else + wd->fix_pending = EINA_TRUE; + break; + } + } +} + +static void +_item_highlight(Elm_List_Item *it) +{ + Evas_Object *obj = WIDGET(it); + Widget_Data *wd = elm_widget_data_get(obj); + const char *selectraise; + + if (!wd) return; + ELM_LIST_ITEM_CHECK_DELETED_RETURN(it); + if ((it->highlighted) || (it->base.disabled) || + (wd->select_mode == ELM_OBJECT_SELECT_MODE_NONE)) return; + + evas_object_ref(obj); + _elm_list_walk(wd); + + edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm"); + selectraise = edje_object_data_get(VIEW(it), "selectraise"); + if ((selectraise) && (!strcmp(selectraise, "on"))) + evas_object_raise(VIEW(it)); + it->highlighted = EINA_TRUE; + + _elm_list_unwalk(wd); + evas_object_unref(obj); +} + +static void +_item_select(Elm_List_Item *it) +{ + Evas_Object *obj = WIDGET(it); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + ELM_LIST_ITEM_CHECK_DELETED_RETURN(it); + if (it->base.disabled || (wd->select_mode == ELM_OBJECT_SELECT_MODE_NONE)) return; + if (it->selected) + { + if (wd->select_mode == ELM_OBJECT_SELECT_MODE_ALWAYS) goto call; + return; + } + it->selected = EINA_TRUE; + wd->selected = eina_list_append(wd->selected, it); + +call: + evas_object_ref(obj); + _elm_list_walk(wd); + + if (it->func) it->func((void *)it->base.data, WIDGET(it), it); + evas_object_smart_callback_call(obj, SIG_SELECTED, it); + it->wd->last_selected_item = (Elm_Object_Item *)it; + + _elm_list_unwalk(wd); + evas_object_unref(obj); +} + +static void +_item_unselect(Elm_List_Item *it) +{ + Evas_Object *obj = WIDGET(it); + Widget_Data *wd = elm_widget_data_get(obj); + const char *stacking, *selectraise; + + if (!wd) return; + ELM_LIST_ITEM_CHECK_DELETED_RETURN(it); + if (!it->highlighted) return; + + evas_object_ref(obj); + _elm_list_walk(wd); + + edje_object_signal_emit(VIEW(it), "elm,state,unselected", "elm"); + stacking = edje_object_data_get(VIEW(it), "stacking"); + selectraise = edje_object_data_get(VIEW(it), "selectraise"); + if ((selectraise) && (!strcmp(selectraise, "on"))) + { + if ((stacking) && (!strcmp(stacking, "below"))) + evas_object_lower(VIEW(it)); + } + it->highlighted = EINA_FALSE; + if (it->selected) + { + it->selected = EINA_FALSE; + wd->selected = eina_list_remove(wd->selected, it); + evas_object_smart_callback_call(WIDGET(it), SIG_UNSELECTED, it); + } + + _elm_list_unwalk(wd); + evas_object_unref(obj); +} + +static Eina_Bool +_swipe_cancel(void *data) +{ + Elm_List_Item *it = data; + Widget_Data *wd = elm_widget_data_get(WIDGET(it)); + + if (!wd) return ECORE_CALLBACK_CANCEL; + ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, ECORE_CALLBACK_CANCEL); + wd->swipe = EINA_FALSE; + wd->movements = 0; + return ECORE_CALLBACK_RENEW; +} + +static void +_mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_List_Item *it = data; + Evas_Object *obj2 = WIDGET(it); + Widget_Data *wd = elm_widget_data_get(obj2); + Evas_Event_Mouse_Move *ev = event_info; + + if (!wd) return; + ELM_LIST_ITEM_CHECK_DELETED_RETURN(it); + + evas_object_ref(obj2); + _elm_list_walk(wd); + + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) + { + if (!wd->on_hold) + { + wd->on_hold = EINA_TRUE; + if (it->long_timer) + { + ecore_timer_del(it->long_timer); + it->long_timer = NULL; + } + if (!wd->wasselected) + _item_unselect(it); + } + if (wd->movements == SWIPE_MOVES) wd->swipe = EINA_TRUE; + else + { + wd->history[wd->movements].x = ev->cur.canvas.x; + wd->history[wd->movements].y = ev->cur.canvas.y; + if (abs((wd->history[wd->movements].x - wd->history[0].x)) > 40) + wd->swipe = EINA_TRUE; + else + wd->movements++; + } + } + + _elm_list_unwalk(wd); + evas_object_unref(obj2); +} + +static void +_edge_left(void *data, Evas_Object *scr __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *obj = data; + evas_object_smart_callback_call(obj, SIG_EDGE_LEFT, NULL); +} + +static void +_edge_right(void *data, Evas_Object *scr __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *obj = data; + evas_object_smart_callback_call(obj, SIG_EDGE_RIGHT, NULL); +} + +static void +_edge_top(void *data, Evas_Object *scr __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *obj = data; + evas_object_smart_callback_call(obj, SIG_EDGE_TOP, NULL); +} + +static void +_edge_bottom(void *data, Evas_Object *scr __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *obj = data; + evas_object_smart_callback_call(obj, SIG_EDGE_BOTTOM, NULL); +} + +static Eina_Bool +_long_press(void *data) +{ + Elm_List_Item *it = data; + Evas_Object *obj = WIDGET(it); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) goto end; + + ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, ECORE_CALLBACK_CANCEL); + it->long_timer = NULL; + if (it->base.disabled) goto end; + + wd->longpressed = EINA_TRUE; + evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, it); + +end: + return ECORE_CALLBACK_CANCEL; +} + +static void +_swipe(Elm_List_Item *it) +{ + int i, sum = 0; + Widget_Data *wd = elm_widget_data_get(WIDGET(it)); + + ELM_LIST_ITEM_CHECK_DELETED_RETURN(it); + if (!wd) return; + wd->swipe = EINA_FALSE; + for (i = 0; i < wd->movements; i++) + { + sum += wd->history[i].x; + if (abs(wd->history[0].y - wd->history[i].y) > 10) return; + } + + sum /= wd->movements; + if (abs(sum - wd->history[0].x) <= 10) return; + evas_object_smart_callback_call(WIDGET(it), "swipe", it); +} + +static void +_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_List_Item *it = data; + Evas_Object *obj2 = WIDGET(it); + Widget_Data *wd = elm_widget_data_get(obj2); + Evas_Event_Mouse_Down *ev = event_info; + + if (!wd) return; + ELM_LIST_ITEM_CHECK_DELETED_RETURN(it); + if (ev->button != 1) return; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) wd->on_hold = EINA_TRUE; + else wd->on_hold = EINA_FALSE; + if (wd->on_hold) return; + wd->wasselected = it->selected; + + evas_object_ref(obj2); + _elm_list_walk(wd); + + _item_highlight(it); + wd->longpressed = EINA_FALSE; + if (it->long_timer) ecore_timer_del(it->long_timer); + it->long_timer = ecore_timer_add(_elm_config->longpress_timeout, _long_press, it); + if (it->swipe_timer) ecore_timer_del(it->swipe_timer); + it->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it); + /* Always call the callbacks last - the user may delete our context! */ + if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) + { + evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it); + evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it); + } + wd->swipe = EINA_FALSE; + wd->movements = 0; + + _elm_list_unwalk(wd); + evas_object_unref(obj2); +} + +static void +_mouse_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_List_Item *it = data; + Evas_Object *obj2 = WIDGET(it); + Widget_Data *wd = elm_widget_data_get(obj2); + Evas_Event_Mouse_Up *ev = event_info; + + if (!wd) return; + ELM_LIST_ITEM_CHECK_DELETED_RETURN(it); + if (ev->button != 1) return; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) wd->on_hold = EINA_TRUE; + else wd->on_hold = EINA_FALSE; + wd->longpressed = EINA_FALSE; + if (it->long_timer) + { + ecore_timer_del(it->long_timer); + it->long_timer = NULL; + } + if (it->swipe_timer) + { + ecore_timer_del(it->swipe_timer); + it->swipe_timer = NULL; + } + if (wd->on_hold) + { + if (wd->swipe) _swipe(data); + wd->on_hold = EINA_FALSE; + return; + } + if (wd->longpressed) + { + if (!wd->wasselected) _item_unselect(it); + wd->wasselected = 0; + return; + } + + if (it->base.disabled) + return; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; + + evas_object_ref(obj2); + _elm_list_walk(wd); + + if (wd->multi) + { + if (!it->selected) + { + _item_highlight(it); + _item_select(it); + } + else _item_unselect(it); + } + else + { + if (!it->selected) + { + while (wd->selected) + _item_unselect(wd->selected->data); + _item_highlight(it); + _item_select(it); + } + else + { + const Eina_List *l, *l_next; + Elm_List_Item *it2; + + EINA_LIST_FOREACH_SAFE(wd->selected, l, l_next, it2) + if (it2 != it) _item_unselect(it2); + _item_highlight(it); + _item_select(it); + } + } + + _elm_list_unwalk(wd); + evas_object_unref(obj2); +} + +static void +_item_disable(Elm_Object_Item *it) +{ + Elm_List_Item *item = (Elm_List_Item *)it; + if (item->base.disabled) + edje_object_signal_emit(VIEW(item), "elm,state,disabled", "elm"); + else + edje_object_signal_emit(VIEW(item), "elm,state,enabled", "elm"); +} + +static void +_item_content_set_hook(Elm_Object_Item *it, const char *part, Evas_Object *content) +{ + Elm_List_Item *item = (Elm_List_Item *)it; + Evas_Object **icon_p = NULL; + Eina_Bool dummy = EINA_FALSE; + + if ((!part) || (!strcmp(part, "start"))) + { + icon_p = &(item->icon); + dummy = item->dummy_icon; + if (!content) item->dummy_icon = EINA_TRUE; + else item->dummy_icon = EINA_FALSE; + } + else if (!strcmp(part, "end")) + { + icon_p = &(item->end); + dummy = item->dummy_end; + if (!content) item->dummy_end = EINA_TRUE; + else item->dummy_end = EINA_FALSE; + } + else + return; + + if (content == *icon_p) return; + if ((dummy) && (!content)) return; + if (dummy) evas_object_del(*icon_p); + if (!content) + { + content = evas_object_rectangle_add(evas_object_evas_get(WIDGET(item))); + evas_object_color_set(content, 0, 0, 0, 0); + } + if (*icon_p) + { + evas_object_del(*icon_p); + *icon_p = NULL; + } + *icon_p = content; + if (VIEW(item)) + edje_object_part_swallow(VIEW(item), "elm.swallow.icon", content); +} + +static Evas_Object * +_item_content_get_hook(const Elm_Object_Item *it, const char *part) +{ + Elm_List_Item *item = (Elm_List_Item *)it; + + if ((!part) || (!strcmp(part, "start"))) + { + if (item->dummy_icon) return NULL; + return item->icon; + } + else if (!strcmp(part, "end")) + { + if (item->dummy_end) return NULL; + return item->end; + } + return NULL; +} + +static Evas_Object * +_item_content_unset_hook(const Elm_Object_Item *it, const char *part) +{ + Elm_List_Item *item = (Elm_List_Item *)it; + + if ((!part) || (!strcmp(part, "start"))) + { + Evas_Object *obj = item->icon; + _item_content_set_hook((Elm_Object_Item *)it, part, NULL); + return obj; + } + else if (!strcmp(part, "end")) + { + Evas_Object *obj = item->end; + _item_content_set_hook((Elm_Object_Item *)it, part, NULL); + return obj; + } + return NULL; +} + +static void +_item_text_set_hook(Elm_Object_Item *it, const char *part, const char *text) +{ + Elm_List_Item *list_it = (Elm_List_Item *)it; + if (part && strcmp(part, "default")) return; + if (!eina_stringshare_replace(&list_it->label, text)) return; + if (VIEW(list_it)) + edje_object_part_text_escaped_set(VIEW(list_it), "elm.text", text); +} + +static const char * +_item_text_get_hook(const Elm_Object_Item *it, const char *part) +{ + if (part && strcmp(part, "default")) return NULL; + return ((Elm_List_Item *)it)->label; +} + +static Eina_Bool +_item_del_pre_hook(Elm_Object_Item *it) +{ + Evas_Object *obj = WIDGET(it); + Elm_List_Item *item = (Elm_List_Item *)it; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + if (item->selected) _item_unselect(item); + + if (wd->walking > 0) + { + if (item->deleted) return EINA_FALSE; + item->deleted = EINA_TRUE; + wd->to_delete = eina_list_append(wd->to_delete, item); + return EINA_FALSE; + } + + wd->items = eina_list_remove_list(wd->items, item->node); + + evas_object_ref(obj); + _elm_list_walk(wd); + + _elm_list_item_free(item); + + _elm_list_unwalk(wd); + evas_object_unref(obj); + + return EINA_TRUE; +} + +static Elm_List_Item * +_item_new(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Elm_List_Item *it; + + if (!wd) return NULL; + it = elm_widget_item_new(obj, Elm_List_Item); + it->wd = wd; + it->label = eina_stringshare_add(label); + it->icon = icon; + it->end = end; + it->func = func; + it->base.data = data; + VIEW(it) = edje_object_add(evas_object_evas_get(obj)); + edje_object_mirrored_set(VIEW(it), elm_widget_mirrored_get(obj)); + evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_DOWN, + _mouse_down, it); + evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_UP, + _mouse_up, it); + evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_MOVE, + _mouse_move, it); + evas_object_size_hint_weight_set(VIEW(it), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(VIEW(it), EVAS_HINT_FILL, EVAS_HINT_FILL); + if (it->icon) + { + elm_widget_sub_object_add(obj, it->icon); + evas_object_event_callback_add(it->icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + } + if (it->end) + { + elm_widget_sub_object_add(obj, it->end); + evas_object_event_callback_add(it->end, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + } + elm_widget_item_disable_hook_set(it, _item_disable); + elm_widget_item_content_set_hook_set(it, _item_content_set_hook); + elm_widget_item_content_get_hook_set(it, _item_content_get_hook); + elm_widget_item_content_unset_hook_set(it, _item_content_unset_hook); + elm_widget_item_text_set_hook_set(it, _item_text_set_hook); + elm_widget_item_text_get_hook_set(it, _item_text_get_hook); + elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook); + return it; +} + +static void +_elm_list_mode_set_internal(Widget_Data *wd) +{ + if (!wd->scr) + return; + + if (wd->mode == ELM_LIST_LIMIT) + { + if (!wd->h_mode) + { + wd->scr_minw = EINA_TRUE; + wd->scr_minh = EINA_FALSE; + } + else + { + wd->scr_minw = EINA_FALSE; + wd->scr_minh = EINA_TRUE; + } + } + else if (wd->mode == ELM_LIST_EXPAND) + { + wd->scr_minw = EINA_TRUE; + wd->scr_minh = EINA_TRUE; + } + else + { + wd->scr_minw = EINA_FALSE; + wd->scr_minh = EINA_FALSE; + } + + _sizing_eval(wd->self); +} + +static void +_fix_items(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + const Eina_List *l; + Elm_List_Item *it; + Evas_Coord minw[2] = { 0, 0 }, minh[2] = { 0, 0 }; + Evas_Coord mw, mh; + int i, redo = 0; + const char *style = elm_widget_style_get(obj); + const char *it_plain = wd->h_mode ? "h_item" : "item"; + const char *it_odd = wd->h_mode ? "h_item_odd" : "item_odd"; + const char *it_compress = wd->h_mode ? "h_item_compress" : "item_compress"; + const char *it_compress_odd = wd->h_mode ? "h_item_compress_odd" : "item_compress_odd"; + + if (wd->walking) + { + wd->fix_pending = EINA_TRUE; + return; + } + + evas_object_ref(obj); + _elm_list_walk(wd); // watch out "return" before unwalk! + + EINA_LIST_FOREACH(wd->items, l, it) + { + if (it->deleted) continue; + if (it->icon) + { + evas_object_size_hint_min_get(it->icon, &mw, &mh); + if (mw > minw[0]) minw[0] = mw; + if (mh > minh[0]) minh[0] = mh; + } + if (it->end) + { + evas_object_size_hint_min_get(it->end, &mw, &mh); + if (mw > minw[1]) minw[1] = mw; + if (mh > minh[1]) minh[1] = mh; + } + } + + if ((minw[0] != wd->minw[0]) || (minw[1] != wd->minw[1]) || + (minw[0] != wd->minh[0]) || (minh[1] != wd->minh[1])) + { + wd->minw[0] = minw[0]; + wd->minw[1] = minw[1]; + wd->minh[0] = minh[0]; + wd->minh[1] = minh[1]; + redo = 1; + } + i = 0; + EINA_LIST_FOREACH(wd->items, l, it) + { + if (it->deleted) + continue; + + it->even = i & 0x1; + if ((it->even != it->is_even) || (!it->fixed) || (redo)) + { + const char *stacking; + + /* FIXME: separators' themes seem to be b0rked */ + if (it->is_separator) + _elm_theme_object_set(obj, VIEW(it), "separator", + wd->h_mode ? "horizontal" : "vertical", + style); + else if (wd->mode == ELM_LIST_COMPRESS) + { + if (it->even) + _elm_theme_object_set(obj, VIEW(it), "list", + it_compress, style); + else + _elm_theme_object_set(obj, VIEW(it), "list", + it_compress_odd, style); + } + else + { + if (it->even) + _elm_theme_object_set(obj, VIEW(it), "list", it_plain, + style); + else + _elm_theme_object_set(obj, VIEW(it), "list", it_odd, + style); + } + stacking = edje_object_data_get(VIEW(it), "stacking"); + if (stacking) + { + if (!strcmp(stacking, "below")) + evas_object_lower(VIEW(it)); + else if (!strcmp(stacking, "above")) + evas_object_raise(VIEW(it)); + } + edje_object_part_text_escaped_set(VIEW(it), "elm.text", it->label); + + if ((!it->icon) && (minh[0] > 0)) + { + it->icon = evas_object_rectangle_add(evas_object_evas_get(VIEW(it))); + evas_object_color_set(it->icon, 0, 0, 0, 0); + it->dummy_icon = EINA_TRUE; + } + if ((!it->end) && (minh[1] > 0)) + { + it->end = evas_object_rectangle_add(evas_object_evas_get(VIEW(it))); + evas_object_color_set(it->end, 0, 0, 0, 0); + it->dummy_end = EINA_TRUE; + } + if (it->icon) + { + evas_object_size_hint_min_set(it->icon, minw[0], minh[0]); + evas_object_size_hint_max_set(it->icon, 99999, 99999); + edje_object_part_swallow(VIEW(it), "elm.swallow.icon", it->icon); + } + if (it->end) + { + evas_object_size_hint_min_set(it->end, minw[1], minh[1]); + evas_object_size_hint_max_set(it->end, 99999, 99999); + edje_object_part_swallow(VIEW(it), "elm.swallow.end", it->end); + } + if (!it->fixed) + { + // this may call up user and it may modify the list item + // but we're safe as we're flagged as walking. + // just don't process further + edje_object_message_signal_process(VIEW(it)); + if (it->deleted) + continue; + mw = mh = -1; + elm_coords_finger_size_adjust(1, &mw, 1, &mh); + edje_object_size_min_restricted_calc(VIEW(it), &mw, &mh, mw, mh); + elm_coords_finger_size_adjust(1, &mw, 1, &mh); + evas_object_size_hint_min_set(VIEW(it), mw, mh); + evas_object_show(VIEW(it)); + } + if ((it->selected) || (it->highlighted)) + { + const char *selectraise; + + // this may call up user and it may modify the list item + // but we're safe as we're flagged as walking. + // just don't process further + edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm"); + if (it->deleted) + continue; + + selectraise = edje_object_data_get(VIEW(it), "selectraise"); + if ((selectraise) && (!strcmp(selectraise, "on"))) + evas_object_raise(VIEW(it)); + } + if (it->base.disabled) + edje_object_signal_emit(VIEW(it), "elm,state,disabled", + "elm"); + + it->fixed = EINA_TRUE; + it->is_even = it->even; + } + i++; + } + + mw = 0; mh = 0; + evas_object_size_hint_min_get(wd->box, &mw, &mh); + + _elm_list_mode_set_internal(wd); + + _elm_list_unwalk(wd); + evas_object_unref(obj); +} + +static void +_hold_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->scr) + elm_smart_scroller_hold_set(wd->scr, EINA_TRUE); +} + +static void +_hold_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->scr) + elm_smart_scroller_hold_set(wd->scr, EINA_FALSE); +} + +static void +_freeze_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->scr) + elm_smart_scroller_freeze_set(wd->scr, EINA_TRUE); +} + +static void +_freeze_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->scr) + elm_smart_scroller_freeze_set(wd->scr, EINA_FALSE); +} + +static void +_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _sizing_eval(data); +} + +EAPI Evas_Object * +elm_list_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + Evas_Coord minw, minh; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "list"); + elm_widget_type_set(obj, "list"); + elm_widget_sub_object_add(parent, obj); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_data_set(obj, wd); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_disable_hook_set(obj, _disable_hook); + elm_widget_can_focus_set(obj, EINA_TRUE); + elm_widget_signal_emit_hook_set(obj, _signal_emit_hook); + elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook); + elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook); + elm_widget_event_hook_set(obj, _event_hook); + elm_widget_translate_hook_set(obj, _translate_hook); + + wd->self = obj; + wd->scr = elm_smart_scroller_add(e); + elm_smart_scroller_widget_set(wd->scr, obj); + elm_widget_resize_object_set(obj, wd->scr); + evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), &minw, &minh); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj); + + elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE, + _elm_config->thumbscroll_bounce_enable); + + wd->box = elm_box_add(parent); + elm_box_homogeneous_set(wd->box, 1); + evas_object_size_hint_weight_set(wd->box, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(wd->box, EVAS_HINT_FILL, 0.0); + elm_widget_on_show_region_hook_set(wd->box, _show_region_hook, obj); + elm_widget_sub_object_add(obj, wd->box); + elm_smart_scroller_child_set(wd->scr, wd->box); + evas_object_event_callback_add(wd->box, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + + evas_object_show(wd->box); + + _theme_hook(obj); + + wd->mode = ELM_LIST_SCROLL; + + evas_object_smart_callback_add(wd->scr, "edge,left", _edge_left, obj); + evas_object_smart_callback_add(wd->scr, "edge,right", _edge_right, obj); + evas_object_smart_callback_add(wd->scr, "edge,top", _edge_top, obj); + evas_object_smart_callback_add(wd->scr, "edge,bottom", _edge_bottom, obj); + + evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj); + evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj); + evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj); + evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj); + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _sizing_eval(obj); + return obj; +} + +EAPI void +elm_list_go(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _fix_items(obj); +} + +EAPI void +elm_list_multi_select_set(Evas_Object *obj, Eina_Bool multi) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->multi = multi; +} + +EAPI Eina_Bool +elm_list_multi_select_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->multi; +} + +EAPI void +elm_list_mode_set(Evas_Object *obj, Elm_List_Mode mode) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) + return; + if (wd->mode == mode) + return; + wd->mode = mode; + + _elm_list_mode_set_internal(wd); +} + +EAPI Elm_List_Mode +elm_list_mode_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_LAST; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return ELM_LIST_LAST; + return wd->mode; +} + +EAPI void +elm_list_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + + Widget_Data *wd; + Eina_Bool bounce = _elm_config->thumbscroll_bounce_enable; + + wd = elm_widget_data_get(obj); + if (!wd) + return; + + if (wd->h_mode == horizontal) + return; + + wd->h_mode = horizontal; + elm_box_horizontal_set(wd->box, horizontal); + + if (horizontal) + { + evas_object_size_hint_weight_set(wd->box, 0.0, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(wd->box, 0.0, EVAS_HINT_FILL); + elm_smart_scroller_bounce_allow_set(wd->scr, bounce, EINA_FALSE); + } + else + { + evas_object_size_hint_weight_set(wd->box, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(wd->box, EVAS_HINT_FILL, 0.0); + elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE, bounce); + } + + _elm_list_mode_set_internal(wd); +} + +EAPI Eina_Bool +elm_list_horizontal_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) + return EINA_FALSE; + + return wd->h_mode; +} + +EAPI void +elm_list_select_mode_set(Evas_Object *obj, Elm_Object_Select_Mode mode) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (mode >= ELM_OBJECT_SELECT_MODE_MAX) + return; + if (wd->select_mode != mode) + wd->select_mode = mode; +} + +EAPI Elm_Object_Select_Mode +elm_list_select_mode_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_OBJECT_SELECT_MODE_MAX; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return ELM_OBJECT_SELECT_MODE_MAX; + return wd->select_mode; +} + +EAPI void +elm_list_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->scr) + elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce); +} + +EAPI void +elm_list_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_smart_scroller_bounce_allow_get(wd->scr, h_bounce, v_bounce); +} + +EAPI void +elm_list_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (!wd->scr)) return; + if ((policy_h >= ELM_SCROLLER_POLICY_LAST) || + (policy_v >= ELM_SCROLLER_POLICY_LAST)) + return; + elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v); +} + +EAPI void +elm_list_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Smart_Scroller_Policy s_policy_h, s_policy_v; + if ((!wd) || (!wd->scr)) return; + elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v); + if (policy_h) *policy_h = (Elm_Scroller_Policy) s_policy_h; + if (policy_v) *policy_v = (Elm_Scroller_Policy) s_policy_v; +} + +EAPI void +elm_list_clear(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + Elm_List_Item *it; + + if (!wd) return; + if (!wd->items) return; + + eina_list_free(wd->selected); + wd->selected = NULL; + + if (wd->walking > 0) + { + Eina_List *n; + + EINA_LIST_FOREACH(wd->items, n, it) + { + if (it->deleted) continue; + it->deleted = EINA_TRUE; + wd->to_delete = eina_list_append(wd->to_delete, it); + } + return; + } + + evas_object_ref(obj); + _elm_list_walk(wd); + + EINA_LIST_FREE(wd->items, it) + { + _elm_list_item_free(it); + elm_widget_item_free(it); + } + + _elm_list_unwalk(wd); + + _fix_items(obj); + _sizing_eval(obj); + evas_object_unref(obj); +} + +EAPI const Eina_List * +elm_list_items_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->items; +} + +EAPI Elm_Object_Item * +elm_list_selected_item_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (wd->selected) return (Elm_Object_Item *) wd->selected->data; + return NULL; +} + +EAPI const Eina_List * +elm_list_selected_items_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->selected; +} + +EAPI Elm_Object_Item * +elm_list_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + Elm_List_Item *it = _item_new(obj, label, icon, end, func, data); + + wd->items = eina_list_append(wd->items, it); + it->node = eina_list_last(wd->items); + elm_box_pack_end(wd->box, VIEW(it)); + return (Elm_Object_Item *)it; +} + +EAPI Elm_Object_Item * +elm_list_item_prepend(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + Elm_List_Item *it = _item_new(obj, label, icon, end, func, data); + + wd->items = eina_list_prepend(wd->items, it); + it->node = wd->items; + elm_box_pack_start(wd->box, VIEW(it)); + return (Elm_Object_Item *)it; +} + +EAPI Elm_Object_Item * +elm_list_item_insert_before(Evas_Object *obj, Elm_Object_Item *before, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + ELM_LIST_ITEM_CHECK_DELETED_RETURN(before, NULL); + + Widget_Data *wd; + Elm_List_Item *it, *before_it; + + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + before_it = (Elm_List_Item *) before; + if (!before_it->node) return NULL; + + it = _item_new(obj, label, icon, end, func, data); + wd->items = eina_list_prepend_relative_list(wd->items, it, before_it->node); + it->node = before_it->node->prev; + elm_box_pack_before(wd->box, VIEW(it), VIEW(before_it)); + return (Elm_Object_Item *)it; +} + +EAPI Elm_Object_Item * +elm_list_item_insert_after(Evas_Object *obj, Elm_Object_Item *after, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + ELM_LIST_ITEM_CHECK_DELETED_RETURN(after, NULL); + + Widget_Data *wd; + Elm_List_Item *it, *after_it; + + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + after_it = (Elm_List_Item *) after; + if (!after_it->node) return NULL; + + it = _item_new(obj, label, icon, end, func, data); + wd->items = eina_list_append_relative_list(wd->items, it, after_it->node); + it->node = after_it->node->next; + elm_box_pack_after(wd->box, VIEW(it), VIEW(after_it)); + return (Elm_Object_Item *)it; +} + +EAPI Elm_Object_Item * +elm_list_item_sorted_insert(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data, Eina_Compare_Cb cmp_func) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + Elm_List_Item *it = _item_new(obj, label, icon, end, func, data); + Eina_List *l; + + wd->items = eina_list_sorted_insert(wd->items, cmp_func, it); + l = eina_list_data_find_list(wd->items, it); + l = eina_list_next(l); + if (!l) + { + it->node = eina_list_last(wd->items); + elm_box_pack_end(wd->box, VIEW(it)); + } + else + { + Elm_List_Item *before = eina_list_data_get(l); + it->node = before->node->prev; + elm_box_pack_before(wd->box, VIEW(it), VIEW(before)); + } + return (Elm_Object_Item *)it; +} + +EAPI void +elm_list_item_separator_set(Elm_Object_Item *it, Eina_Bool setting) +{ + ELM_LIST_ITEM_CHECK_DELETED_RETURN(it); + ((Elm_List_Item *)it)->is_separator = !!setting; +} + +EAPI Eina_Bool +elm_list_item_separator_get(const Elm_Object_Item *it) +{ + ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, EINA_FALSE); + return ((Elm_List_Item *)it)->is_separator; +} + +EAPI void +elm_list_item_selected_set(Elm_Object_Item *it, Eina_Bool selected) +{ + ELM_LIST_ITEM_CHECK_DELETED_RETURN(it); + Evas_Object *obj = WIDGET(it); + Widget_Data *wd = elm_widget_data_get(obj); + Elm_List_Item *item = (Elm_List_Item *)it; + if (!wd) return; + + selected = !!selected; + if (item->selected == selected) return; + + evas_object_ref(obj); + _elm_list_walk(wd); + + if (selected) + { + if (!wd->multi) + { + while (wd->selected) + _item_unselect(wd->selected->data); + } + _item_highlight(item); + _item_select(item); + } + else + _item_unselect(item); + + _elm_list_unwalk(wd); + evas_object_unref(obj); +} + +EAPI Eina_Bool +elm_list_item_selected_get(const Elm_Object_Item *it) +{ + ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, EINA_FALSE); + return ((Elm_List_Item *)it)->selected; +} + +EAPI void +elm_list_item_show(Elm_Object_Item *it) +{ + ELM_LIST_ITEM_CHECK_DELETED_RETURN(it); + Widget_Data *wd = elm_widget_data_get(WIDGET(it)); + if (!wd) return; + Evas_Coord bx, by, bw, bh; + Evas_Coord x, y, w, h; + + evas_smart_objects_calculate(evas_object_evas_get(wd->box)); + evas_object_geometry_get(wd->box, &bx, &by, &bw, &bh); + evas_object_geometry_get(VIEW(it), &x, &y, &w, &h); + x -= bx; + y -= by; + if (wd->scr) elm_smart_scroller_child_region_show(wd->scr, x, y, w, h); +} + +EAPI void +elm_list_item_bring_in(Elm_Object_Item *it) +{ + ELM_LIST_ITEM_CHECK_DELETED_RETURN(it); + Widget_Data *wd = elm_widget_data_get(WIDGET(it)); + if (!wd) return; + Evas_Coord bx, by, bw, bh; + Evas_Coord x, y, w, h; + + evas_smart_objects_calculate(evas_object_evas_get(wd->box)); + evas_object_geometry_get(wd->box, &bx, &by, &bw, &bh); + evas_object_geometry_get(VIEW(it), &x, &y, &w, &h); + x -= bx; + y -= by; + if (wd->scr) elm_smart_scroller_region_bring_in(wd->scr, x, y, w, h); +} + +EAPI Evas_Object * +elm_list_item_object_get(const Elm_Object_Item *it) +{ + ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, NULL); + return VIEW(it); +} + +EAPI Elm_Object_Item * +elm_list_item_prev(const Elm_Object_Item *it) +{ + ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, NULL); + Elm_List_Item *item = (Elm_List_Item *)it; + if (item->node->prev) return item->node->prev->data; + else return NULL; +} + +EAPI Elm_Object_Item * +elm_list_item_next(const Elm_Object_Item *it) +{ + ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, NULL); + Elm_List_Item *item = (Elm_List_Item *)it; + if (item->node->next) return item->node->next->data; + else return NULL; +} + +EAPI Elm_Object_Item * +elm_list_first_item_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (!wd->items) return NULL; + return eina_list_data_get(wd->items); +} + +EAPI Elm_Object_Item * +elm_list_last_item_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (!wd->items) return NULL; + return eina_list_data_get(eina_list_last(wd->items)); +} diff --git a/libraries/elementary/src/lib/elm_list.h b/libraries/elementary/src/lib/elm_list.h new file mode 100644 index 0000000..933a28e --- /dev/null +++ b/libraries/elementary/src/lib/elm_list.h @@ -0,0 +1,779 @@ +/** + * @defgroup List List + * @ingroup Elementary + * + * @image html img/widget/list/preview-00.png + * @image latex img/widget/list/preview-00.eps width=\textwidth + * + * @image html img/list.png + * @image latex img/list.eps width=\textwidth + * + * A list widget is a container whose children are displayed vertically or + * horizontally, in order, and can be selected. + * The list can accept only one or multiple items selection. Also has many + * modes of items displaying. + * + * A list is a very simple type of list widget. For more robust + * lists, @ref Genlist should probably be used. + * + * Smart callbacks one can listen to: + * - @c "activated" - The user has double-clicked or pressed + * (enter|return|spacebar) on an item. The @c event_info parameter + * is the item that was activated. + * - @c "clicked,double" - The user has double-clicked an item. + * The @c event_info parameter is the item that was double-clicked. + * - "selected" - when the user selected an item + * - "unselected" - when the user unselected an item + * - "longpressed" - an item in the list is long-pressed + * - "edge,top" - the list is scrolled until the top edge + * - "edge,bottom" - the list is scrolled until the bottom edge + * - "edge,left" - the list is scrolled until the left edge + * - "edge,right" - the list is scrolled until the right edge + * - "language,changed" - the program's language changed + * + * Available styles for it: + * - @c "default" + * + * Default content parts of the list items that you can use for are: + * @li "start" - A start position object in the list item + * @li "end" - A end position object in the list item + * + * Default text parts of the list items that you can use for are: + * @li "default" - label in the list item + * + * Supported elm_object_item common APIs. + * @li @ref elm_object_item_disabled_set + * @li @ref elm_object_item_disabled_get + * @li @ref elm_object_item_part_text_set + * @li @ref elm_object_item_part_text_get + * @li @ref elm_object_item_part_content_set + * @li @ref elm_object_item_part_content_get + * @li @ref elm_object_item_part_content_unset + * + * List of examples: + * @li @ref list_example_01 + * @li @ref list_example_02 + * @li @ref list_example_03 + */ + +/** + * @addtogroup List + * @{ + */ + +/** + * @enum _Elm_List_Mode + * @typedef Elm_List_Mode + * + * Set list's resize behavior, transverse axis scroll and + * items cropping. See each mode's description for more details. + * + * @note Default value is #ELM_LIST_SCROLL. + * + * Values don't work as bitmask, only one can be chosen. + * + * @see elm_list_mode_set() + * @see elm_list_mode_get() + * + * @ingroup List + */ +typedef enum +{ + ELM_LIST_COMPRESS = 0, /**< Won't set any of its size hints to inform how a possible container should resize it. Then, if it's not created as a "resize object", it might end with zero dimensions. The list will respect the container's geometry and, if any of its items won't fit into its transverse axis, one won't be able to scroll it in that direction. */ + ELM_LIST_SCROLL, /**< Default value. Won't set any of its size hints to inform how a possible container should resize it. Then, if it's not created as a "resize object", it might end with zero dimensions. The list will respect the container's geometry and, if any of its items won't fit into its transverse axis, one will be able to scroll it in that direction (large items will get cropped). */ + ELM_LIST_LIMIT, /**< Set a minimum size hint on the list object, so that containers may respect it (and resize itself to fit the child properly). More specifically, a minimum size hint will be set for its transverse axis, so that the @b largest item in that direction fits well. Can have effects bounded by setting the list object's maximum size hints. */ + ELM_LIST_EXPAND, /**< Besides setting a minimum size on the transverse axis, just like the previous mode, will set a minimum size on the longitudinal axis too, trying to reserve space to all its children to be visible at a time. Can have effects bounded by setting the list object's maximum size hints. */ + ELM_LIST_LAST /**< Indicates error if returned by elm_list_mode_get() */ +} Elm_List_Mode; + +/** + * Add a new list widget to the given parent Elementary + * (container) object. + * + * @param parent The parent object. + * @return a new list widget handle or @c NULL, on errors. + * + * This function inserts a new list widget on the canvas. + * + * @ingroup List + */ +EAPI Evas_Object *elm_list_add(Evas_Object *parent); + +/** + * Starts the list. + * + * @param obj The list object + * + * @note Call before running show() on the list object. + * @warning If not called, it won't display the list properly. + * + * @code + * li = elm_list_add(win); + * elm_list_item_append(li, "First", NULL, NULL, NULL, NULL); + * elm_list_item_append(li, "Second", NULL, NULL, NULL, NULL); + * elm_list_go(li); + * evas_object_show(li); + * @endcode + * + * @ingroup List + */ +EAPI void elm_list_go(Evas_Object *obj); + +/** + * Enable or disable multiple items selection on the list object. + * + * @param obj The list object + * @param multi @c EINA_TRUE to enable multi selection or @c EINA_FALSE to + * disable it. + * + * Disabled by default. If disabled, the user can select a single item of + * the list each time. Selected items are highlighted on list. + * If enabled, many items can be selected. + * + * If a selected item is selected again, it will be unselected. + * + * @see elm_list_multi_select_get() + * + * @ingroup List + */ +EAPI void elm_list_multi_select_set(Evas_Object *obj, Eina_Bool multi); + +/** + * Get a value whether multiple items selection is enabled or not. + * + * @see elm_list_multi_select_set() for details. + * + * @param obj The list object. + * @return @c EINA_TRUE means multiple items selection is enabled. + * @c EINA_FALSE indicates it's disabled. If @p obj is @c NULL, + * @c EINA_FALSE is returned. + * + * @ingroup List + */ +EAPI Eina_Bool elm_list_multi_select_get(const Evas_Object *obj); + +/** + * Set which mode to use for the list object. + * + * @param obj The list object + * @param mode One of #Elm_List_Mode: #ELM_LIST_COMPRESS, #ELM_LIST_SCROLL, + * #ELM_LIST_LIMIT or #ELM_LIST_EXPAND. + * + * Set list's resize behavior, transverse axis scroll and + * items cropping. See each mode's description for more details. + * + * @note Default value is #ELM_LIST_SCROLL. + * + * Only one can be set, if a previous one was set, it will be changed + * by the new mode set. Bitmask won't work as well. + * + * @see elm_list_mode_get() + * + * @ingroup List + */ +EAPI void elm_list_mode_set(Evas_Object *obj, Elm_List_Mode mode); + +/** + * Get the mode the list is at. + * + * @param obj The list object + * @return One of #Elm_List_Mode: #ELM_LIST_COMPRESS, #ELM_LIST_SCROLL, + * #ELM_LIST_LIMIT, #ELM_LIST_EXPAND or #ELM_LIST_LAST on errors. + * + * @note see elm_list_mode_set() for more information. + * + * @ingroup List + */ +EAPI Elm_List_Mode elm_list_mode_get(const Evas_Object *obj); + +/** + * Enable or disable horizontal mode on the list object. + * + * @param obj The list object. + * @param horizontal @c EINA_TRUE to enable horizontal or @c EINA_FALSE to + * disable it, i.e., to enable vertical mode. + * + * @note Vertical mode is set by default. + * + * On horizontal mode items are displayed on list from left to right, + * instead of from top to bottom. Also, the list will scroll horizontally. + * Each item will presents left icon on top and right icon, or end, at + * the bottom. + * + * @see elm_list_horizontal_get() + * + * @ingroup List + */ +EAPI void elm_list_horizontal_set(Evas_Object *obj, Eina_Bool horizontal); + +/** + * Get a value whether horizontal mode is enabled or not. + * + * @param obj The list object. + * @return @c EINA_TRUE means horizontal mode selection is enabled. + * @c EINA_FALSE indicates it's disabled. If @p obj is @c NULL, + * @c EINA_FALSE is returned. + * + * @see elm_list_horizontal_set() for details. + * + * @ingroup List + */ +EAPI Eina_Bool elm_list_horizontal_get(const Evas_Object *obj); + +/** + * Set the list select mode. + * + * @param obj The list object + * @param mode The select mode + * + * elm_list_select_mode_set() changes item select mode in the list widget. + * - ELM_OBJECT_SELECT_MODE_DEFAULT : Items will only call their selection func and + * callback when first becoming selected. Any further clicks will + * do nothing, unless you set always select mode. + * - ELM_OBJECT_SELECT_MODE_ALWAYS : This means that, even if selected, + * every click will make the selected callbacks be called. + * - ELM_OBJECT_SELECT_MODE_NONE : This will turn off the ability to select items + * entirely and they will neither appear selected nor call selected + * callback functions. + * + * @see elm_list_select_mode_get() + * + * @ingroup List + */ +EAPI void +elm_list_select_mode_set(Evas_Object *obj, Elm_Object_Select_Mode mode); + +/** + * Get the list select mode. + * + * @param obj The list object + * @return The select mode + * (If getting mode is failed, it returns ELM_OBJECT_SELECT_MODE_MAX) + * + * @see elm_list_select_mode_set() + * + * @ingroup List + */ +EAPI Elm_Object_Select_Mode +elm_list_select_mode_get(const Evas_Object *obj); + +/** + * Set bouncing behaviour when the scrolled content reaches an edge. + * + * Tell the internal scroller object whether it should bounce or not + * when it reaches the respective edges for each axis. + * + * @param obj The list object + * @param h_bounce Whether to bounce or not in the horizontal axis. + * @param v_bounce Whether to bounce or not in the vertical axis. + * + * @see elm_scroller_bounce_set() + * + * @ingroup List + */ +EAPI void elm_list_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce); + +/** + * Get the bouncing behaviour of the internal scroller. + * + * Get whether the internal scroller should bounce when the edge of each + * axis is reached scrolling. + * + * @param obj The list object. + * @param h_bounce Pointer to store the bounce state of the horizontal + * axis. + * @param v_bounce Pointer to store the bounce state of the vertical + * axis. + * + * @see elm_scroller_bounce_get() + * @see elm_list_bounce_set() + * + * @ingroup List + */ +EAPI void elm_list_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce); + +/** + * Set the scrollbar policy. + * + * @param obj The list object + * @param policy_h Horizontal scrollbar policy. + * @param policy_v Vertical scrollbar policy. + * + * This sets the scrollbar visibility policy for the given scroller. + * #ELM_SCROLLER_POLICY_AUTO means the scrollbar is made visible if it + * is needed, and otherwise kept hidden. #ELM_SCROLLER_POLICY_ON turns + * it on all the time, and #ELM_SCROLLER_POLICY_OFF always keeps it off. + * This applies respectively for the horizontal and vertical scrollbars. + * + * The both are disabled by default, i.e., are set to + * #ELM_SCROLLER_POLICY_OFF. + * + * @ingroup List + */ +EAPI void elm_list_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v); + +/** + * Get the scrollbar policy. + * + * @see elm_list_scroller_policy_get() for details. + * + * @param obj The list object. + * @param policy_h Pointer to store horizontal scrollbar policy. + * @param policy_v Pointer to store vertical scrollbar policy. + * + * @ingroup List + */ +EAPI void elm_list_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v); + +/** + * Append a new item to the list object. + * + * @param obj The list object. + * @param label The label of the list item. + * @param icon The icon object to use for the left side of the item. An + * icon can be any Evas object, but usually it is an icon created + * with elm_icon_add(). + * @param end The icon object to use for the right side of the item. An + * icon can be any Evas object. + * @param func The function to call when the item is clicked. + * @param data The data to associate with the item for related callbacks. + * + * @return The created item or @c NULL upon failure. + * + * A new item will be created and appended to the list, i.e., will + * be set as @b last item. + * + * Items created with this method can be deleted with elm_object_item_del(). + * + * Associated @p data can be properly freed when item is deleted if a + * callback function is set with elm_widget_item_del_cb_set(). + * + * If a function is passed as argument, it will be called every time this item + * is selected, i.e., the user clicks over an unselected item. + * If always select is enabled it will call this function every time + * user clicks over an item (already selected or not). + * If such function isn't needed, just passing + * @c NULL as @p func is enough. The same should be done for @p data. + * + * Simple example (with no function callback or data associated): + * @code + * li = elm_list_add(win); + * ic = elm_icon_add(win); + * elm_icon_file_set(ic, "path/to/image", NULL); + * elm_icon_resizable_set(ic, EINA_TRUE, EINA_TRUE); + * elm_list_item_append(li, "label", ic, NULL, NULL, NULL); + * elm_list_go(li); + * evas_object_show(li); + * @endcode + * + * @see elm_list_select_mode_set() + * @see elm_object_item_del() + * @see elm_widget_item_del_cb_set() + * @see elm_list_clear() + * @see elm_icon_add() + * + * @ingroup List + */ +EAPI Elm_Object_Item *elm_list_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data); + +/** + * Prepend a new item to the list object. + * + * @param obj The list object. + * @param label The label of the list item. + * @param icon The icon object to use for the left side of the item. An + * icon can be any Evas object, but usually it is an icon created + * with elm_icon_add(). + * @param end The icon object to use for the right side of the item. An + * icon can be any Evas object. + * @param func The function to call when the item is clicked. + * @param data The data to associate with the item for related callbacks. + * + * @return The created item or @c NULL upon failure. + * + * A new item will be created and prepended to the list, i.e., will + * be set as @b first item. + * + * Items created with this method can be deleted with elm_object_item_del(). + * + * Associated @p data can be properly freed when item is deleted if a + * callback function is set with elm_widget_item_del_cb_set(). + * + * If a function is passed as argument, it will be called every time this item + * is selected, i.e., the user clicks over an unselected item. + * If always select is enabled it will call this function every time + * user clicks over an item (already selected or not). + * If such function isn't needed, just passing + * @c NULL as @p func is enough. The same should be done for @p data. + * + * @see elm_list_item_append() for a simple code example. + * @see elm_list_select_mode_set() + * @see elm_object_item_del() + * @see elm_widget_item_del_cb_set() + * @see elm_list_clear() + * @see elm_icon_add() + * + * @ingroup List + */ +EAPI Elm_Object_Item *elm_list_item_prepend(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data); + +/** + * Insert a new item into the list object before item @p before. + * + * @param obj The list object. + * @param before The list item to insert before. + * @param label The label of the list item. + * @param icon The icon object to use for the left side of the item. An + * icon can be any Evas object, but usually it is an icon created + * with elm_icon_add(). + * @param end The icon object to use for the right side of the item. An + * icon can be any Evas object. + * @param func The function to call when the item is clicked. + * @param data The data to associate with the item for related callbacks. + * + * @return The created item or @c NULL upon failure. + * + * A new item will be created and added to the list. Its position in + * this list will be just before item @p before. + * + * Items created with this method can be deleted with elm_object_item_del(). + * + * Associated @p data can be properly freed when item is deleted if a + * callback function is set with elm_widget_item_del_cb_set(). + * + * If a function is passed as argument, it will be called every time this item + * is selected, i.e., the user clicks over an unselected item. + * If always select is enabled it will call this function every time + * user clicks over an item (already selected or not). + * If such function isn't needed, just passing + * @c NULL as @p func is enough. The same should be done for @p data. + * + * @see elm_list_item_append() for a simple code example. + * @see elm_list_select_mode_set() + * @see elm_object_item_del() + * @see elm_widget_item_del_cb_set() + * @see elm_list_clear() + * @see elm_icon_add() + * + * @ingroup List + */ +EAPI Elm_Object_Item *elm_list_item_insert_before(Evas_Object *obj, Elm_Object_Item *before, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data); + +/** + * Insert a new item into the list object after item @p after. + * + * @param obj The list object. + * @param after The list item to insert after. + * @param label The label of the list item. + * @param icon The icon object to use for the left side of the item. An + * icon can be any Evas object, but usually it is an icon created + * with elm_icon_add(). + * @param end The icon object to use for the right side of the item. An + * icon can be any Evas object. + * @param func The function to call when the item is clicked. + * @param data The data to associate with the item for related callbacks. + * + * @return The created item or @c NULL upon failure. + * + * A new item will be created and added to the list. Its position in + * this list will be just after item @p after. + * + * Items created with this method can be deleted with elm_object_item_del(). + * + * Associated @p data can be properly freed when item is deleted if a + * callback function is set with elm_widget_item_del_cb_set(). + * + * If a function is passed as argument, it will be called every time this item + * is selected, i.e., the user clicks over an unselected item. + * If always select is enabled it will call this function every time + * user clicks over an item (already selected or not). + * If such function isn't needed, just passing + * @c NULL as @p func is enough. The same should be done for @p data. + * + * @see elm_list_item_append() for a simple code example. + * @see elm_list_select_mode_set() + * @see elm_object_item_del() + * @see elm_widget_item_del_cb_set() + * @see elm_list_clear() + * @see elm_icon_add() + * + * @ingroup List + */ +EAPI Elm_Object_Item *elm_list_item_insert_after(Evas_Object *obj, Elm_Object_Item *after, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data); + +/** + * Insert a new item into the sorted list object. + * + * @param obj The list object. + * @param label The label of the list item. + * @param icon The icon object to use for the left side of the item. An + * icon can be any Evas object, but usually it is an icon created + * with elm_icon_add(). + * @param end The icon object to use for the right side of the item. An + * icon can be any Evas object. + * @param func The function to call when the item is clicked. + * @param data The data to associate with the item for related callbacks. + * @param cmp_func The comparing function to be used to sort list + * items by #Elm_Object_Item item handles. This function will + * receive two items and compare them, returning a non-negative integer + * if the second item should be place after the first, or negative value + * if should be placed before. + * + * @return The created item or @c NULL upon failure. + * + * @note This function inserts values into a list object assuming it was + * sorted and the result will be sorted. + * + * A new item will be created and added to the list. Its position in + * this list will be found comparing the new item with previously inserted + * items using function @p cmp_func. + * + * Items created with this method can be deleted with elm_object_item_del(). + * + * Associated @p data can be properly freed when item is deleted if a + * callback function is set with elm_widget_item_del_cb_set(). + * + * If a function is passed as argument, it will be called every time this item + * is selected, i.e., the user clicks over an unselected item. + * If always select is enabled it will call this function every time + * user clicks over an item (already selected or not). + * If such function isn't needed, just passing + * @c NULL as @p func is enough. The same should be done for @p data. + * + * @see elm_list_item_append() for a simple code example. + * @see elm_list_select_mode_set() + * @see elm_object_item_del() + * @see elm_widget_item_del_cb_set() + * @see elm_list_clear() + * @see elm_icon_add() + * + * @ingroup List + */ +EAPI Elm_Object_Item *elm_list_item_sorted_insert(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data, Eina_Compare_Cb cmp_func); + +/** + * Remove all list's items. + * + * @param obj The list object + * + * @see elm_object_item_del() + * @see elm_list_item_append() + * + * @ingroup List + */ +EAPI void elm_list_clear(Evas_Object *obj); + +/** + * Get a list of all the list items. + * + * @param obj The list object + * @return An @c Eina_List of list items, #Elm_Object_Item, + * or @c NULL on failure. + * + * @see elm_list_item_append() + * @see elm_object_item_del() + * @see elm_list_clear() + * + * @ingroup List + */ +EAPI const Eina_List *elm_list_items_get(const Evas_Object *obj); + +/** + * Get the selected item. + * + * @param obj The list object. + * @return The selected list item. + * + * The selected item can be unselected with function + * elm_list_item_selected_set(). + * + * The selected item always will be highlighted on list. + * + * @see elm_list_selected_items_get() + * + * @ingroup List + */ +EAPI Elm_Object_Item *elm_list_selected_item_get(const Evas_Object *obj); + +/** + * Return a list of the currently selected list items. + * + * @param obj The list object. + * @return An @c Eina_List of list items, #Elm_Object_Item, + * or @c NULL on failure. + * + * Multiple items can be selected if multi select is enabled. It can be + * done with elm_list_multi_select_set(). + * + * @see elm_list_selected_item_get() + * @see elm_list_multi_select_set() + * + * @ingroup List + */ +EAPI const Eina_List *elm_list_selected_items_get(const Evas_Object *obj); + +/** + * Set the selected state of an item. + * + * @param it The list item + * @param selected The selected state + * + * This sets the selected state of the given item @p it. + * @c EINA_TRUE for selected, @c EINA_FALSE for not selected. + * + * If a new item is selected the previously selected will be unselected, + * unless multiple selection is enabled with elm_list_multi_select_set(). + * Previously selected item can be get with function + * elm_list_selected_item_get(). + * + * Selected items will be highlighted. + * + * @see elm_list_item_selected_get() + * @see elm_list_selected_item_get() + * @see elm_list_multi_select_set() + * + * @ingroup List + */ +EAPI void elm_list_item_selected_set(Elm_Object_Item *it, Eina_Bool selected); + +/* + * Get whether the @p item is selected or not. + * + * @param it The list item. + * @return @c EINA_TRUE means item is selected. @c EINA_FALSE indicates + * it's not. If @p obj is @c NULL, @c EINA_FALSE is returned. + * + * @see elm_list_selected_item_set() for details. + * @see elm_list_item_selected_get() + * + * @ingroup List + */ +EAPI Eina_Bool elm_list_item_selected_get(const Elm_Object_Item *it); + +/** + * Set or unset item as a separator. + * + * @param it The list item. + * @param setting @c EINA_TRUE to set item @p it as separator or + * @c EINA_FALSE to unset, i.e., item will be used as a regular item. + * + * Items aren't set as separator by default. + * + * If set as separator it will display separator theme, so won't display + * icons or label. + * + * @see elm_list_item_separator_get() + * + * @ingroup List + */ +EAPI void elm_list_item_separator_set(Elm_Object_Item *it, Eina_Bool setting); + +/** + * Get a value whether item is a separator or not. + * + * @see elm_list_item_separator_set() for details. + * + * @param it The list item. + * @return @c EINA_TRUE means item @p it is a separator. @c EINA_FALSE + * indicates it's not. If @p it is @c NULL, @c EINA_FALSE is returned. + * + * @ingroup List + */ +EAPI Eina_Bool elm_list_item_separator_get(const Elm_Object_Item *it); + +/** + * Show @p item in the list view. + * + * @param it The list item to be shown. + * + * It won't animate list until item is visible. If such behavior is wanted, + * use elm_list_bring_in() instead. + * + * @ingroup List + */ +EAPI void elm_list_item_show(Elm_Object_Item *it); + +/** + * Bring in the given item to list view. + * + * @param it The item. + * + * This causes list to jump to the given item @p item and show it + * (by scrolling), if it is not fully visible. + * + * This may use animation to do so and take a period of time. + * + * If animation isn't wanted, elm_list_item_show() can be used. + * + * @ingroup List + */ +EAPI void elm_list_item_bring_in(Elm_Object_Item *it); + +/** + * Gets the base object of the item. + * + * @param it The list item + * @return The base object associated with @p item + * + * Base object is the @c Evas_Object that represents that item. + * + * @ingroup List + */ +EAPI Evas_Object *elm_list_item_object_get(const Elm_Object_Item *it); + +/** + * Get the item before @p it in list. + * + * @param it The list item. + * @return The item before @p it, or @c NULL if none or on failure. + * + * @note If it is the first item, @c NULL will be returned. + * + * @see elm_list_item_append() + * @see elm_list_items_get() + * + * @ingroup List + */ +EAPI Elm_Object_Item *elm_list_item_prev(const Elm_Object_Item *it); + +/** + * Get the item after @p it in list. + * + * @param it The list item. + * @return The item after @p it, or @c NULL if none or on failure. + * + * @note If it is the last item, @c NULL will be returned. + * + * @see elm_list_item_append() + * @see elm_list_items_get() + * + * @ingroup List + */ +EAPI Elm_Object_Item *elm_list_item_next(const Elm_Object_Item *it); + +/** + * Get the first item in the list + * + * This returns the first item in the list. + * + * @param obj The list object + * @return The first item, or NULL if none + * + * @ingroup List + */ +EAPI Elm_Object_Item *elm_list_first_item_get(const Evas_Object *obj); + +/** + * Get the last item in the list + * + * This returns the last item in the list. + * + * @return The last item, or NULL if none + * + * @ingroup List + */ +EAPI Elm_Object_Item *elm_list_last_item_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_macros.h b/libraries/elementary/src/lib/elm_macros.h new file mode 100644 index 0000000..906b883 --- /dev/null +++ b/libraries/elementary/src/lib/elm_macros.h @@ -0,0 +1,3 @@ +/* handy macros */ +#define ELM_RECTS_INTERSECT(x, y, w, h, xx, yy, ww, hh) (((x) < ((xx) + (ww))) && ((y) < ((yy) + (hh))) && (((x) + (w)) > (xx)) && (((y) + (h)) > (yy))) +#define ELM_PI 3.14159265358979323846 diff --git a/libraries/elementary/src/lib/elm_main.c b/libraries/elementary/src/lib/elm_main.c new file mode 100644 index 0000000..4f860ba --- /dev/null +++ b/libraries/elementary/src/lib/elm_main.c @@ -0,0 +1,1490 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +#ifdef HAVE_FORK +#include /* dlopen,dlclose,etc */ +#endif + +#ifdef HAVE_CRT_EXTERNS_H +# include +#endif + +#ifdef HAVE_EVIL +# include +#endif + +#include +#include "elm_priv.h" + +#define SEMI_BROKEN_QUICKLAUNCH 1 + +static Elm_Version _version = { VMAJ, VMIN, VMIC, VREV }; +EAPI Elm_Version *elm_version = &_version; + +Eina_Bool +_elm_dangerous_call_check(const char *call) +{ + char buf[256]; + const char *eval; + + snprintf(buf, sizeof(buf), "%i.%i.%i.%i", VMAJ, VMIN, VMIC, VREV); + eval = getenv("ELM_NO_FINGER_WAGGLING"); + if ((eval) && (!strcmp(eval, buf))) + return 0; + printf("ELEMENTARY FINGER WAGGLE!!!!!!!!!!\n" + "\n" + " %s() used.\n" + "PLEASE see the API documentation for this function. This call\n" + "should almost never be used. Only in very special cases.\n" + "\n" + "To remove this warning please set the environment variable:\n" + " ELM_NO_FINGER_WAGGLING\n" + "To the value of the Elementary version + revision number. e.g.:\n" + " 1.2.5.40295\n" + "\n" + , + call); + return 1; +} + +static Eina_Bool _elm_signal_exit(void *data, + int ev_type, + void *ev); + +static Eina_Prefix *pfx = NULL; +char *_elm_appname = NULL; +const char *_elm_data_dir = NULL; +const char *_elm_lib_dir = NULL; +int _elm_log_dom = -1; + +EAPI int ELM_EVENT_POLICY_CHANGED = 0; + +static int _elm_init_count = 0; +static int _elm_sub_init_count = 0; +static int _elm_ql_init_count = 0; +static int _elm_policies[ELM_POLICY_LAST]; +static Ecore_Event_Handler *_elm_exit_handler = NULL; +static Eina_Bool quicklaunch_on = 0; + +static Eina_Bool +_elm_signal_exit(void *data __UNUSED__, + int ev_type __UNUSED__, + void *ev __UNUSED__) +{ + elm_exit(); + return ECORE_CALLBACK_PASS_ON; +} + +void +_elm_rescale(void) +{ + edje_scale_set(_elm_config->scale); + _elm_win_rescale(NULL, EINA_FALSE); + _elm_ews_wm_rescale(NULL, EINA_FALSE); +} + +static void *app_mainfunc = NULL; +static const char *app_domain = NULL; +static const char *app_checkfile = NULL; + +static const char *app_compile_bin_dir = NULL; +static const char *app_compile_lib_dir = NULL; +static const char *app_compile_data_dir = NULL; +static const char *app_compile_locale_dir = NULL; +static const char *app_prefix_dir = NULL; +static const char *app_bin_dir = NULL; +static const char *app_lib_dir = NULL; +static const char *app_data_dir = NULL; +static const char *app_locale_dir = NULL; + +static Eina_Prefix *app_pfx = NULL; + +static void +_prefix_check(void) +{ + int argc = 0; + char **argv = NULL; + const char *dirs[4] = { NULL, NULL, NULL, NULL }; + char *caps = NULL, *p1, *p2; + char buf[PATH_MAX]; + + if (app_pfx) return; + if (!app_domain) return; + + ecore_app_args_get(&argc, &argv); + if (argc < 1) return; + + dirs[0] = app_compile_bin_dir; + dirs[1] = app_compile_lib_dir; + dirs[2] = app_compile_data_dir; + dirs[3] = app_compile_locale_dir; + + if (!dirs[0]) dirs[0] = "/usr/local/bin"; + if (!dirs[1]) dirs[1] = "/usr/local/lib"; + if (!dirs[2]) + { + snprintf(buf, sizeof(buf), "/usr/local/share/%s", app_domain); + dirs[2] = buf; + } + if (!dirs[3]) dirs[3] = dirs[2]; + + if (app_domain) + { + caps = alloca(strlen(app_domain) + 1); + for (p1 = (char *)app_domain, p2 = caps; *p1; p1++, p2++) + *p2 = toupper(*p1); + *p2 = 0; + } + app_pfx = eina_prefix_new(argv[0], app_mainfunc, caps, app_domain, + app_checkfile, dirs[0], dirs[1], dirs[2], dirs[3]); +} + +static void +_prefix_shutdown(void) +{ + if (app_pfx) eina_prefix_free(app_pfx); + if (app_domain) eina_stringshare_del(app_domain); + if (app_checkfile) eina_stringshare_del(app_checkfile); + if (app_compile_bin_dir) eina_stringshare_del(app_compile_bin_dir); + if (app_compile_lib_dir) eina_stringshare_del(app_compile_lib_dir); + if (app_compile_data_dir) eina_stringshare_del(app_compile_data_dir); + if (app_compile_locale_dir) eina_stringshare_del(app_compile_locale_dir); + if (app_prefix_dir) eina_stringshare_del(app_prefix_dir); + if (app_bin_dir) eina_stringshare_del(app_bin_dir); + if (app_lib_dir) eina_stringshare_del(app_lib_dir); + if (app_data_dir) eina_stringshare_del(app_data_dir); + if (app_locale_dir) eina_stringshare_del(app_locale_dir); + app_mainfunc = NULL; + app_domain = NULL; + app_checkfile = NULL; + app_compile_bin_dir = NULL; + app_compile_lib_dir = NULL; + app_compile_data_dir = NULL; + app_compile_locale_dir = NULL; + app_prefix_dir = NULL; + app_bin_dir = NULL; + app_lib_dir = NULL; + app_data_dir = NULL; + app_locale_dir = NULL; + app_pfx = NULL; +} + +EAPI int +elm_init(int argc, + char **argv) +{ + _elm_init_count++; + if (_elm_init_count > 1) return _elm_init_count; + elm_quicklaunch_init(argc, argv); + elm_quicklaunch_sub_init(argc, argv); + _prefix_shutdown(); + return _elm_init_count; +} + +EAPI int +elm_shutdown(void) +{ + _elm_init_count--; + if (_elm_init_count > 0) return _elm_init_count; + _elm_win_shutdown(); + while (_elm_win_deferred_free) ecore_main_loop_iterate(); +// wrningz :( +// _prefix_shutdown(); + elm_quicklaunch_sub_shutdown(); + elm_quicklaunch_shutdown(); + return _elm_init_count; +} + +EAPI void +elm_app_info_set(void *mainfunc, const char *dom, const char *checkfile) +{ + app_mainfunc = mainfunc; + eina_stringshare_replace(&app_domain, dom); + eina_stringshare_replace(&app_checkfile, checkfile); +} + +EAPI void +elm_app_compile_bin_dir_set(const char *dir) +{ + eina_stringshare_replace(&app_compile_bin_dir, dir); +} + +EAPI void +elm_app_compile_lib_dir_set(const char *dir) +{ + eina_stringshare_replace(&app_compile_lib_dir, dir); +} + +EAPI void +elm_app_compile_data_dir_set(const char *dir) +{ + eina_stringshare_replace(&app_compile_data_dir, dir); +} + +EAPI void +elm_app_compile_locale_set(const char *dir) +{ + eina_stringshare_replace(&app_compile_locale_dir, dir); +} + +EAPI const char * +elm_app_prefix_dir_get(void) +{ + if (app_prefix_dir) return app_prefix_dir; + _prefix_check(); + if (!app_pfx) return ""; + app_prefix_dir = eina_prefix_get(app_pfx); + return app_prefix_dir; +} + +EAPI const char * +elm_app_bin_dir_get(void) +{ + if (app_bin_dir) return app_bin_dir; + _prefix_check(); + if (!app_pfx) return ""; + app_bin_dir = eina_prefix_bin_get(app_pfx); + return app_bin_dir; +} + +EAPI const char * +elm_app_lib_dir_get(void) +{ + if (app_lib_dir) return app_lib_dir; + _prefix_check(); + if (!app_pfx) return ""; + app_lib_dir = eina_prefix_lib_get(app_pfx); + return app_lib_dir; +} + +EAPI const char * +elm_app_data_dir_get(void) +{ + if (app_data_dir) return app_data_dir; + _prefix_check(); + if (!app_pfx) return ""; + app_data_dir = eina_prefix_data_get(app_pfx); + return app_data_dir; +} + +EAPI const char * +elm_app_locale_dir_get(void) +{ + if (app_locale_dir) return app_locale_dir; + _prefix_check(); + if (!app_pfx) return ""; + app_locale_dir = eina_prefix_locale_get(app_pfx); + return app_locale_dir; +} + +#ifdef ELM_EDBUS +static int _elm_need_e_dbus = 0; +#endif +EAPI Eina_Bool +elm_need_e_dbus(void) +{ +#ifdef ELM_EDBUS + if (_elm_need_e_dbus++) return EINA_TRUE; + e_dbus_init(); + return EINA_TRUE; +#else + return EINA_FALSE; +#endif +} + +static void +_elm_unneed_e_dbus(void) +{ +#ifdef ELM_EDBUS + if (--_elm_need_e_dbus) return; + + _elm_need_e_dbus = 0; + e_dbus_shutdown(); +#endif +} + +#ifdef ELM_EFREET +static int _elm_need_efreet = 0; +#endif +EAPI Eina_Bool +elm_need_efreet(void) +{ +#ifdef ELM_EFREET + if (_elm_need_efreet++) return EINA_TRUE; + efreet_init(); + efreet_mime_init(); + efreet_trash_init(); + /* + { + Eina_List **list; + + list = efreet_icon_extra_list_get(); + if (list) + { + e_user_dir_concat_static(buf, "icons"); + *list = eina_list_prepend(*list, (void *)eina_stringshare_add(buf)); + e_prefix_data_concat_static(buf, "data/icons"); + *list = eina_list_prepend(*list, (void *)eina_stringshare_add(buf)); + } + } + */ + return EINA_TRUE; +#else + return EINA_FALSE; +#endif +} + +static void +_elm_unneed_efreet(void) +{ +#ifdef ELM_EFREET + if (--_elm_need_efreet) return; + + _elm_need_efreet = 0; + efreet_trash_shutdown(); + efreet_mime_shutdown(); + efreet_shutdown(); +#endif +} + +EAPI void +elm_quicklaunch_mode_set(Eina_Bool ql_on) +{ + quicklaunch_on = ql_on; +} + +EAPI Eina_Bool +elm_quicklaunch_mode_get(void) +{ + return quicklaunch_on; +} + +EAPI int +elm_quicklaunch_init(int argc, + char **argv) +{ + _elm_ql_init_count++; + if (_elm_ql_init_count > 1) return _elm_ql_init_count; + eina_init(); + _elm_log_dom = eina_log_domain_register("elementary", EINA_COLOR_LIGHTBLUE); + if (!_elm_log_dom) + { + EINA_LOG_ERR("could not register elementary log domain."); + _elm_log_dom = EINA_LOG_DOMAIN_GLOBAL; + } + + eet_init(); + ecore_init(); + +#ifdef HAVE_ELEMENTARY_EMAP + emap_init(); +#endif + ecore_app_args_set(argc, (const char **)argv); + + memset(_elm_policies, 0, sizeof(_elm_policies)); + if (!ELM_EVENT_POLICY_CHANGED) + ELM_EVENT_POLICY_CHANGED = ecore_event_type_new(); + + ecore_file_init(); + + _elm_exit_handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, _elm_signal_exit, NULL); + + if (argv) _elm_appname = strdup(ecore_file_file_get(argv[0])); + + pfx = eina_prefix_new(argv ? argv[0] : NULL, elm_quicklaunch_init, + "ELM", "elementary", "config/profile.cfg", + PACKAGE_LIB_DIR, /* don't have a bin dir currently */ + PACKAGE_LIB_DIR, + PACKAGE_DATA_DIR, + LOCALE_DIR); + if (pfx) + { + _elm_data_dir = eina_stringshare_add(eina_prefix_data_get(pfx)); + _elm_lib_dir = eina_stringshare_add(eina_prefix_lib_get(pfx)); + } + if (!_elm_data_dir) _elm_data_dir = eina_stringshare_add("/"); + if (!_elm_lib_dir) _elm_lib_dir = eina_stringshare_add("/"); + + return _elm_ql_init_count; +} + +EAPI int +elm_quicklaunch_sub_init(int argc, + char **argv) +{ + _elm_sub_init_count++; + if (_elm_sub_init_count > 1) return _elm_sub_init_count; + if (quicklaunch_on) + { + _elm_config_init(); +#ifdef SEMI_BROKEN_QUICKLAUNCH + return _elm_sub_init_count; +#endif + } + if (!quicklaunch_on) + { + ecore_app_args_set(argc, (const char **)argv); + evas_init(); + edje_init(); + _elm_module_init(); + _elm_config_init(); + _elm_config_sub_init(); + ecore_evas_init(); // FIXME: check errors +#ifdef HAVE_ELEMENTARY_ECORE_IMF + ecore_imf_init(); +#endif +#ifdef HAVE_ELEMENTARY_ECORE_CON + ecore_con_init(); + ecore_con_url_init(); +#endif + _elm_ews_wm_init(); + } + return _elm_sub_init_count; +} + +EAPI int +elm_quicklaunch_sub_shutdown(void) +{ + _elm_sub_init_count--; + if (_elm_sub_init_count > 0) return _elm_sub_init_count; + if (quicklaunch_on) + { +#ifdef SEMI_BROKEN_QUICKLAUNCH + return _elm_sub_init_count; +#endif + } + if (!quicklaunch_on) + { + _elm_win_shutdown(); + _elm_module_shutdown(); + _elm_ews_wm_shutdown(); +#ifdef HAVE_ELEMENTARY_ECORE_CON + ecore_con_url_shutdown(); + ecore_con_shutdown(); +#endif +#ifdef HAVE_ELEMENTARY_ECORE_IMF + ecore_imf_shutdown(); +#endif + ecore_evas_shutdown(); + _elm_config_sub_shutdown(); +#define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name)) + if (ENGINE_COMPARE(ELM_SOFTWARE_X11) || + ENGINE_COMPARE(ELM_SOFTWARE_16_X11) || + ENGINE_COMPARE(ELM_XRENDER_X11) || + ENGINE_COMPARE(ELM_OPENGL_X11) || + ENGINE_COMPARE(ELM_SOFTWARE_SDL) || + ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) || + ENGINE_COMPARE(ELM_OPENGL_SDL) || + ENGINE_COMPARE(ELM_OPENGL_COCOA) || + ENGINE_COMPARE(ELM_SOFTWARE_WIN32) || + ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) || + ENGINE_COMPARE(ELM_EWS)) +#undef ENGINE_COMPARE + evas_cserve_disconnect(); + edje_shutdown(); + evas_shutdown(); + } + return _elm_sub_init_count; +} + +EAPI int +elm_quicklaunch_shutdown(void) +{ + _elm_ql_init_count--; + if (_elm_ql_init_count > 0) return _elm_ql_init_count; + if (pfx) eina_prefix_free(pfx); + pfx = NULL; + eina_stringshare_del(_elm_data_dir); + _elm_data_dir = NULL; + eina_stringshare_del(_elm_lib_dir); + _elm_lib_dir = NULL; + + free(_elm_appname); + _elm_appname = NULL; + + _elm_config_shutdown(); + + ecore_event_handler_del(_elm_exit_handler); + _elm_exit_handler = NULL; + + _elm_theme_shutdown(); + _elm_unneed_efreet(); + _elm_unneed_e_dbus(); + _elm_unneed_ethumb(); + _elm_unneed_web(); + ecore_file_shutdown(); + +#ifdef HAVE_ELEMENTARY_EMAP + emap_shutdown(); +#endif + + ecore_shutdown(); + eet_shutdown(); + + if ((_elm_log_dom > -1) && (_elm_log_dom != EINA_LOG_DOMAIN_GLOBAL)) + { + eina_log_domain_unregister(_elm_log_dom); + _elm_log_dom = -1; + } + + _elm_widget_type_clear(); + + eina_shutdown(); + return _elm_ql_init_count; +} + +EAPI void +elm_quicklaunch_seed(void) +{ +#ifndef SEMI_BROKEN_QUICKLAUNCH + if (quicklaunch_on) + { + Evas_Object *win, *bg, *bt; + + win = elm_win_add(NULL, "seed", ELM_WIN_BASIC); + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + bt = elm_button_add(win); + elm_object_text_set(bt, " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~-_=+\\|]}[{;:'\",<.>/?"); + elm_win_resize_object_add(win, bt); + ecore_main_loop_iterate(); + evas_object_del(win); + ecore_main_loop_iterate(); +#define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name)) + if (ENGINE_COMPARE(ELM_SOFTWARE_X11) || + ENGINE_COMPARE(ELM_SOFTWARE_16_X11) || + ENGINE_COMPARE(ELM_XRENDER_X11) || + ENGINE_COMPARE(ELM_OPENGL_X11)) +#undef ENGINE_COMPARE + { +# ifdef HAVE_ELEMENTARY_X + ecore_x_sync(); +# endif + } + ecore_main_loop_iterate(); + } +#endif +} + +#ifdef HAVE_FORK +static void *qr_handle = NULL; +#endif +static int (*qr_main)(int argc, + char **argv) = NULL; + +EAPI Eina_Bool +elm_quicklaunch_prepare(int argc __UNUSED__, + char **argv) +{ +#ifdef HAVE_FORK + char *exe = elm_quicklaunch_exe_path_get(argv[0]); + if (!exe) + { + ERR("requested quicklaunch binary '%s' does not exist\n", argv[0]); + return EINA_FALSE; + } + else + { + char *exe2, *p; + char *exename; + + exe2 = malloc(strlen(exe) + 1 + 10); + strcpy(exe2, exe); + p = strrchr(exe2, '/'); + if (p) p++; + else p = exe2; + exename = alloca(strlen(p) + 1); + strcpy(exename, p); + *p = 0; + strcat(p, "../lib/"); + strcat(p, exename); + strcat(p, ".so"); + if (!access(exe2, R_OK | X_OK)) + { + free(exe); + exe = exe2; + } + else + free(exe2); + } + qr_handle = dlopen(exe, RTLD_NOW | RTLD_GLOBAL); + if (!qr_handle) + { + fprintf(stderr, "dlerr: %s\n", dlerror()); + WRN("dlopen('%s') failed: %s", exe, dlerror()); + free(exe); + return EINA_FALSE; + } + INF("dlopen('%s') = %p", exe, qr_handle); + qr_main = dlsym(qr_handle, "elm_main"); + INF("dlsym(%p, 'elm_main') = %p", qr_handle, qr_main); + if (!qr_main) + { + WRN("not quicklauncher capable: no elm_main in '%s'", exe); + dlclose(qr_handle); + qr_handle = NULL; + free(exe); + return EINA_FALSE; + } + free(exe); + return EINA_TRUE; +#else + return EINA_FALSE; + (void)argv; +#endif +} + +#ifdef HAVE_FORK +static void +save_env(void) +{ + int i, size; + extern char **environ; + char **oldenv, **p; + + oldenv = environ; + + for (i = 0, size = 0; environ[i]; i++) + size += strlen(environ[i]) + 1; + + p = malloc((i + 1) * sizeof(char *)); + if (!p) return; + + environ = p; + + for (i = 0; oldenv[i]; i++) + environ[i] = strdup(oldenv[i]); + environ[i] = NULL; +} + +#endif + +EAPI Eina_Bool +elm_quicklaunch_fork(int argc, + char **argv, + char *cwd, + void (postfork_func) (void *data), + void *postfork_data) +{ +#ifdef HAVE_FORK + pid_t child; + int ret; + int real_argc; + char **real_argv; + + // FIXME: + // need to accept current environment from elementary_run + if (!qr_main) + { + int i; + char **args; + + child = fork(); + if (child > 0) return EINA_TRUE; + else if (child < 0) + { + perror("could not fork"); + return EINA_FALSE; + } + setsid(); + if (chdir(cwd) != 0) + perror("could not chdir"); + args = alloca((argc + 1) * sizeof(char *)); + for (i = 0; i < argc; i++) args[i] = argv[i]; + args[argc] = NULL; + WRN("%s not quicklaunch capable, fallback...", argv[0]); + execvp(argv[0], args); + ERR("failed to execute '%s': %s", argv[0], strerror(errno)); + exit(-1); + } + child = fork(); + if (child > 0) return EINA_TRUE; + else if (child < 0) + { + perror("could not fork"); + return EINA_FALSE; + } + if (postfork_func) postfork_func(postfork_data); + + if (quicklaunch_on) + { +#ifdef SEMI_BROKEN_QUICKLAUNCH + ecore_app_args_set(argc, (const char **)argv); + evas_init(); + edje_init(); + _elm_config_sub_init(); +#define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name)) + if (ENGINE_COMPARE(ELM_SOFTWARE_X11) || + ENGINE_COMPARE(ELM_SOFTWARE_16_X11) || + ENGINE_COMPARE(ELM_XRENDER_X11) || + ENGINE_COMPARE(ELM_OPENGL_X11)) +#undef ENGINE_COMPARE + { +# ifdef HAVE_ELEMENTARY_X + ecore_x_init(NULL); +# endif + } + ecore_evas_init(); // FIXME: check errors +# ifdef HAVE_ELEMENTARY_ECORE_IMF + ecore_imf_init(); +# endif + _elm_module_init(); +#endif + } + + setsid(); + if (chdir(cwd) != 0) + perror("could not chdir"); + // FIXME: this is very linux specific. it changes argv[0] of the process + // so ps etc. report what you'd expect. for other unixes and os's this + // may just not work + save_env(); + if (argv) + { + char *lastarg, *p; + + ecore_app_args_get(&real_argc, &real_argv); + lastarg = real_argv[real_argc - 1] + strlen(real_argv[real_argc - 1]); + for (p = real_argv[0]; p < lastarg; p++) *p = 0; + strcpy(real_argv[0], argv[0]); + } + ecore_app_args_set(argc, (const char **)argv); + ret = qr_main(argc, argv); + exit(ret); + return EINA_TRUE; +#else + return EINA_FALSE; + (void)argc; + (void)argv; + (void)cwd; + (void)postfork_func; + (void)postfork_data; +#endif +} + +EAPI void +elm_quicklaunch_cleanup(void) +{ +#ifdef HAVE_FORK + if (qr_handle) + { + dlclose(qr_handle); + qr_handle = NULL; + qr_main = NULL; + } +#endif +} + +EAPI int +elm_quicklaunch_fallback(int argc, + char **argv) +{ + int ret; + elm_quicklaunch_init(argc, argv); + elm_quicklaunch_sub_init(argc, argv); + elm_quicklaunch_prepare(argc, argv); + ret = qr_main(argc, argv); + exit(ret); + return ret; +} + +EAPI char * +elm_quicklaunch_exe_path_get(const char *exe) +{ + static char *path = NULL; + static Eina_List *pathlist = NULL; + const char *pathitr; + const Eina_List *l; + char buf[PATH_MAX]; + if (exe[0] == '/') return strdup(exe); + if ((exe[0] == '.') && (exe[1] == '/')) return strdup(exe); + if ((exe[0] == '.') && (exe[1] == '.') && (exe[2] == '/')) return strdup(exe); + if (!path) + { + const char *p, *pp; + char *buf2; + path = getenv("PATH"); + buf2 = alloca(strlen(path) + 1); + p = path; + pp = p; + for (;; ) + { + if ((*p == ':') || (!*p)) + { + int len; + + len = p - pp; + strncpy(buf2, pp, len); + buf2[len] = 0; + pathlist = eina_list_append(pathlist, eina_stringshare_add(buf2)); + if (!*p) break; + p++; + pp = p; + } + else + { + if (!*p) break; + p++; + } + } + } + EINA_LIST_FOREACH(pathlist, l, pathitr) + { + snprintf(buf, sizeof(buf), "%s/%s", pathitr, exe); + if (!access(buf, R_OK | X_OK)) return strdup(buf); + } + return NULL; +} + +EAPI void +elm_run(void) +{ + ecore_main_loop_begin(); +} + +EAPI void +elm_exit(void) +{ + ecore_main_loop_quit(); +} + +EAPI Eina_Bool +elm_policy_set(unsigned int policy, + int value) +{ + Elm_Event_Policy_Changed *ev; + + if (policy >= ELM_POLICY_LAST) + return EINA_FALSE; + + if (value == _elm_policies[policy]) + return EINA_TRUE; + + /* TODO: validade policy? */ + + ev = malloc(sizeof(*ev)); + ev->policy = policy; + ev->new_value = value; + ev->old_value = _elm_policies[policy]; + + _elm_policies[policy] = value; + + ecore_event_add(ELM_EVENT_POLICY_CHANGED, ev, NULL, NULL); + + return EINA_TRUE; +} + +EAPI int +elm_policy_get(unsigned int policy) +{ + if (policy >= ELM_POLICY_LAST) + return 0; + return _elm_policies[policy]; +} + +EAPI void +elm_language_set(const char *lang) +{ + setlocale(LC_ALL, lang); + _elm_win_translate(); +} + +EAPI Eina_Bool +elm_object_mirrored_get(const Evas_Object *obj) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); + return elm_widget_mirrored_get(obj); +} + +EAPI void +elm_object_mirrored_set(Evas_Object *obj, Eina_Bool mirrored) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + elm_widget_mirrored_set(obj, mirrored); +} + +EAPI Eina_Bool +elm_object_mirrored_automatic_get(const Evas_Object *obj) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); + return elm_widget_mirrored_automatic_get(obj); +} + +EAPI void +elm_object_mirrored_automatic_set(Evas_Object *obj, Eina_Bool automatic) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + elm_widget_mirrored_automatic_set(obj, automatic); +} + +/** + * @} + */ + +EAPI void +elm_object_scale_set(Evas_Object *obj, + double scale) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + elm_widget_scale_set(obj, scale); +} + +EAPI double +elm_object_scale_get(const Evas_Object *obj) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, 0.0); + return elm_widget_scale_get(obj); +} + +EAPI void +elm_object_part_text_set(Evas_Object *obj, const char *part, const char *label) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + elm_widget_text_part_set(obj, part, label); +} + +EAPI const char * +elm_object_part_text_get(const Evas_Object *obj, const char *part) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); + return elm_widget_text_part_get(obj, part); +} + +EAPI void +elm_object_domain_translatable_text_part_set(Evas_Object *obj, const char *part, const char *domain, const char *text) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + elm_widget_domain_translatable_text_part_set(obj, part, domain, text); +} + +EAPI const char * +elm_object_translatable_text_part_get(const Evas_Object *obj, const char *part) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); + return elm_widget_translatable_text_part_get(obj, part); +} + +EAPI void +elm_object_part_content_set(Evas_Object *obj, const char *part, Evas_Object *content) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + elm_widget_content_part_set(obj, part, content); +} + +EAPI Evas_Object * +elm_object_part_content_get(const Evas_Object *obj, const char *part) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); + return elm_widget_content_part_get(obj, part); +} + +EAPI Evas_Object * +elm_object_part_content_unset(Evas_Object *obj, const char *part) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); + return elm_widget_content_part_unset(obj, part); +} + +EAPI Eina_Bool +elm_object_style_set(Evas_Object *obj, + const char *style) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); + return elm_widget_style_set(obj, style); +} + +EAPI const char * +elm_object_style_get(const Evas_Object *obj) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); + return elm_widget_style_get(obj); +} + +EAPI void +elm_object_disabled_set(Evas_Object *obj, + Eina_Bool disabled) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + elm_widget_disabled_set(obj, disabled); +} + +EAPI Eina_Bool +elm_object_disabled_get(const Evas_Object *obj) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); + return elm_widget_disabled_get(obj); +} + +EAPI void +elm_cache_all_flush(void) +{ + const Eina_List *l; + Evas_Object *obj; + + edje_file_cache_flush(); + edje_collection_cache_flush(); + eet_clearcache(); + EINA_LIST_FOREACH(_elm_win_list, l, obj) + { + Evas *e = evas_object_evas_get(obj); + evas_image_cache_flush(e); + evas_font_cache_flush(e); + evas_render_dump(e); + } +} + +EAPI Eina_Bool +elm_object_focus_get(const Evas_Object *obj) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); + return elm_widget_focus_get(obj); +} + +EAPI void +elm_object_focus_set(Evas_Object *obj, + Eina_Bool focus) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + + if (focus == elm_widget_focus_get(obj)) return; + + if (focus) + elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT); + else + elm_widget_focused_object_clear(obj); +} + +EAPI void +elm_object_focus_allow_set(Evas_Object *obj, + Eina_Bool enable) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + elm_widget_can_focus_set(obj, enable); +/*FIXME: According to the elm_object_focus_allow_get(), child_can_focus field +of the parent should be updated. Otherwise, the checking of it's child focus allow states should not be in elm_object_focus_allow_get() */ +} + +EAPI Eina_Bool +elm_object_focus_allow_get(const Evas_Object *obj) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); + return (elm_widget_can_focus_get(obj)) || (elm_widget_child_can_focus_get(obj)); +} + +EAPI void +elm_object_focus_custom_chain_set(Evas_Object *obj, + Eina_List *objs) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + elm_widget_focus_custom_chain_set(obj, objs); +} + +EAPI void +elm_object_focus_custom_chain_unset(Evas_Object *obj) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + elm_widget_focus_custom_chain_unset(obj); +} + +EAPI const Eina_List * +elm_object_focus_custom_chain_get(const Evas_Object *obj) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); + return elm_widget_focus_custom_chain_get(obj); +} + +EAPI void +elm_object_focus_custom_chain_append(Evas_Object *obj, + Evas_Object *child, + Evas_Object *relative_child) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + elm_widget_focus_custom_chain_append(obj, child, relative_child); +} + +EAPI void +elm_object_focus_custom_chain_prepend(Evas_Object *obj, + Evas_Object *child, + Evas_Object *relative_child) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + elm_widget_focus_custom_chain_prepend(obj, child, relative_child); +} + +EINA_DEPRECATED EAPI void +elm_object_focus_cycle(Evas_Object *obj, + Elm_Focus_Direction dir) +{ + elm_object_focus_next(obj, dir); +} + +EAPI void +elm_object_focus_next(Evas_Object *obj, + Elm_Focus_Direction dir) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + elm_widget_focus_cycle(obj, dir); +} + +EAPI void +elm_object_tree_focus_allow_set(Evas_Object *obj, + Eina_Bool tree_focusable) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + elm_widget_tree_unfocusable_set(obj, !tree_focusable); +} + +EAPI Eina_Bool +elm_object_tree_focus_allow_get(const Evas_Object *obj) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); + return !elm_widget_tree_unfocusable_get(obj); +} + +EAPI void +elm_object_scroll_hold_push(Evas_Object *obj) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + elm_widget_scroll_hold_push(obj); +} + +EAPI void +elm_object_scroll_hold_pop(Evas_Object *obj) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + elm_widget_scroll_hold_pop(obj); +} + +EAPI void +elm_object_scroll_freeze_push(Evas_Object *obj) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + elm_widget_scroll_freeze_push(obj); +} + +EAPI void +elm_object_scroll_lock_x_set(Evas_Object *obj, + Eina_Bool lock) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + elm_widget_drag_lock_x_set(obj, lock); +} + +EAPI void +elm_object_scroll_lock_y_set(Evas_Object *obj, + Eina_Bool lock) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + elm_widget_drag_lock_y_set(obj, lock); +} + +EAPI Eina_Bool +elm_object_scroll_lock_x_get(const Evas_Object *obj) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); + return elm_widget_drag_lock_x_get(obj); +} + +EAPI Eina_Bool +elm_object_scroll_lock_y_get(const Evas_Object *obj) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); + return elm_widget_drag_lock_y_get(obj); +} + +EAPI void +elm_object_scroll_freeze_pop(Evas_Object *obj) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + elm_widget_scroll_freeze_pop(obj); +} + +EAPI Eina_Bool +elm_object_widget_check(const Evas_Object *obj) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); + return elm_widget_is(obj); +} + +EAPI Evas_Object * +elm_object_parent_widget_get(const Evas_Object *obj) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); + return elm_widget_parent_widget_get(obj); +} + +EAPI Evas_Object * +elm_object_top_widget_get(const Evas_Object *obj) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); + return elm_widget_top_get(obj); +} + +EAPI const char * +elm_object_widget_type_get(const Evas_Object *obj) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); + return elm_widget_type_get(obj); +} + +EAPI void +elm_object_signal_emit(Evas_Object *obj, + const char *emission, + const char *source) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + elm_widget_signal_emit(obj, emission, source); +} + +EAPI void +elm_object_signal_callback_add(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + EINA_SAFETY_ON_NULL_RETURN(func); + elm_widget_signal_callback_add(obj, emission, source, func, data); +} + +EAPI void * +elm_object_signal_callback_del(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL); + return elm_widget_signal_callback_del(obj, emission, source, func); +} + +EAPI void +elm_object_event_callback_add(Evas_Object *obj, Elm_Event_Cb func, const void *data) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + EINA_SAFETY_ON_NULL_RETURN(func); + elm_widget_event_callback_add(obj, func, data); +} + +EAPI void * +elm_object_event_callback_del(Evas_Object *obj, Elm_Event_Cb func, const void *data) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL); + return elm_widget_event_callback_del(obj, func, data); +} + +EAPI void +elm_object_tree_dump(const Evas_Object *top) +{ +#ifdef ELM_DEBUG + elm_widget_tree_dump(top); +#else + return; + (void)top; +#endif +} + +EAPI void +elm_object_tree_dot_dump(const Evas_Object *top, + const char *file) +{ +#ifdef ELM_DEBUG + FILE *f = fopen(file, "wb"); + elm_widget_tree_dot_dump(top, f); + fclose(f); +#else + return; + (void)top; + (void)file; +#endif +} + +EAPI void +elm_coords_finger_size_adjust(int times_w, + Evas_Coord *w, + int times_h, + Evas_Coord *h) +{ + if ((w) && (*w < (_elm_config->finger_size * times_w))) + *w = _elm_config->finger_size * times_w; + if ((h) && (*h < (_elm_config->finger_size * times_h))) + *h = _elm_config->finger_size * times_h; +} + +EAPI Evas_Object * +elm_object_item_widget_get(const Elm_Object_Item *it) +{ + return WIDGET(it); +} + +EAPI void +elm_object_item_part_content_set(Elm_Object_Item *it, + const char *part, + Evas_Object *content) +{ + _elm_widget_item_part_content_set((Elm_Widget_Item *)it, part, content); +} + +EAPI Evas_Object * +elm_object_item_part_content_get(const Elm_Object_Item *it, + const char *part) +{ + return _elm_widget_item_part_content_get((Elm_Widget_Item *)it, part); +} + +EAPI Evas_Object * +elm_object_item_part_content_unset(Elm_Object_Item *it, const char *part) +{ + return _elm_widget_item_part_content_unset((Elm_Widget_Item *)it, part); +} + +EAPI void +elm_object_item_part_text_set(Elm_Object_Item *it, + const char *part, + const char *label) +{ + _elm_widget_item_part_text_set((Elm_Widget_Item *)it, part, label); +} + +EAPI const char * +elm_object_item_part_text_get(const Elm_Object_Item *it, const char *part) +{ + return _elm_widget_item_part_text_get((Elm_Widget_Item *)it, part); +} + +EAPI void +elm_object_access_info_set(Evas_Object *obj, const char *txt) +{ + elm_widget_access_info_set(obj, txt); +} + +EAPI Evas_Object * +elm_object_name_find(const Evas_Object *obj, const char *name, int recurse) +{ + return elm_widget_name_find(obj, name, recurse); +} + +EAPI void +elm_object_item_access_info_set(Elm_Object_Item *it, const char *txt) +{ + _elm_widget_item_access_info_set((Elm_Widget_Item *)it, txt); +} + +EAPI void * +elm_object_item_data_get(const Elm_Object_Item *it) +{ + return elm_widget_item_data_get(it); +} + +EAPI void +elm_object_item_data_set(Elm_Object_Item *it, void *data) +{ + elm_widget_item_data_set(it, data); +} + +EAPI void +elm_object_item_signal_emit(Elm_Object_Item *it, const char *emission, const char *source) +{ + _elm_widget_item_signal_emit((Elm_Widget_Item *)it, emission, source); +} + +EAPI void elm_object_item_disabled_set(Elm_Object_Item *it, Eina_Bool disabled) +{ + _elm_widget_item_disabled_set((Elm_Widget_Item *)it, disabled); +} + +EAPI Eina_Bool elm_object_item_disabled_get(const Elm_Object_Item *it) +{ + return _elm_widget_item_disabled_get((Elm_Widget_Item *)it); +} + +EAPI void elm_object_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb del_cb) +{ + _elm_widget_item_del_cb_set((Elm_Widget_Item *)it, del_cb); +} + +EAPI void elm_object_item_del(Elm_Object_Item *it) +{ + _elm_widget_item_del((Elm_Widget_Item *)it); +} + +EAPI void +elm_object_item_tooltip_text_set(Elm_Object_Item *it, const char *text) +{ + elm_widget_item_tooltip_text_set(it, text); +} + +EAPI void +elm_object_item_tooltip_content_cb_set(Elm_Object_Item *it, Elm_Tooltip_Item_Content_Cb func, const void *data, Evas_Smart_Cb del_cb) +{ + elm_widget_item_tooltip_content_cb_set(it, func, data, del_cb); +} + +EAPI void +elm_object_item_tooltip_unset(Elm_Object_Item *it) +{ + elm_widget_item_tooltip_unset(it); +} + +EAPI Eina_Bool +elm_object_item_tooltip_window_mode_set(Elm_Object_Item *it, Eina_Bool disable) +{ + return elm_widget_item_tooltip_window_mode_set(it, disable); +} + +EAPI Eina_Bool +elm_object_item_tooltip_window_mode_get(const Elm_Object_Item *it) +{ + return elm_widget_item_tooltip_window_mode_get(it); +} + +EAPI void +elm_object_item_tooltip_style_set(Elm_Object_Item *it, const char *style) +{ + elm_widget_item_tooltip_style_set(it, style); +} + +EAPI const char * +elm_object_item_tooltip_style_get(const Elm_Object_Item *it) +{ + return elm_widget_item_tooltip_style_get(it); +} + +EAPI void +elm_object_item_cursor_set(Elm_Object_Item *it, const char *cursor) +{ + elm_widget_item_cursor_set(it, cursor); +} + +EAPI const char * +elm_object_item_cursor_get(const Elm_Object_Item *it) +{ + return elm_widget_item_cursor_get(it); +} + +EAPI void +elm_object_item_cursor_unset(Elm_Object_Item *it) +{ + elm_widget_item_cursor_unset(it); +} + +EAPI void +elm_object_item_cursor_style_set(Elm_Object_Item *it, const char *style) +{ + elm_widget_item_cursor_style_set(it, style); +} + +EAPI const char * +elm_object_item_cursor_style_get(const Elm_Object_Item *it) +{ + return elm_widget_item_cursor_style_get(it); +} + +EAPI void +elm_object_item_cursor_engine_only_set(Elm_Object_Item *it, Eina_Bool engine_only) +{ + elm_widget_item_cursor_engine_only_set(it, engine_only); +} + +EAPI Eina_Bool +elm_object_item_cursor_engine_only_get(const Elm_Object_Item *it) +{ + return elm_widget_item_cursor_engine_only_get(it); +} diff --git a/libraries/elementary/src/lib/elm_map.c b/libraries/elementary/src/lib/elm_map.c new file mode 100644 index 0000000..54b7292 --- /dev/null +++ b/libraries/elementary/src/lib/elm_map.c @@ -0,0 +1,5669 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +#include "Elementary.h" +#include "elm_priv.h" +#include "els_scroller.h" + +#define OVERLAY_CLASS_ZOOM_MAX 255 + +#ifdef HAVE_ELEMENTARY_ECORE_CON + +typedef struct _Widget_Data Widget_Data; +typedef struct _Path Path; +typedef struct _Color Color; +typedef struct _Region Region; +typedef struct _Pan Pan; +typedef struct _Grid Grid; +typedef struct _Grid_Item Grid_Item; +typedef struct _Overlay_Default Overlay_Default; +typedef struct _Overlay_Class Overlay_Class; +typedef struct _Overlay_Group Overlay_Group; +typedef struct _Overlay_Bubble Overlay_Bubble; +typedef struct _Overlay_Route Overlay_Route; +typedef struct _Overlay_Line Overlay_Line; +typedef struct _Overlay_Polygon Overlay_Polygon; +typedef struct _Overlay_Circle Overlay_Circle; +typedef struct _Overlay_Scale Overlay_Scale; +typedef struct _Path_Node Path_Node; +typedef struct _Path_Waypoint Path_Waypoint; +typedef struct _Route_Dump Route_Dump; +typedef struct _Name_Dump Name_Dump; +typedef struct _Delayed_Data Delayed_Data; +typedef struct _Source_Tile Source_Tile; +typedef struct _Source_Route Source_Route; +typedef struct _Source_Name Source_Name; + +typedef char *(*Elm_Map_Module_Source_Name_Func)(void); +typedef int (*Elm_Map_Module_Tile_Zoom_Min_Func)(void); +typedef int (*Elm_Map_Module_Tile_Zoom_Max_Func)(void); +typedef char *(*Elm_Map_Module_Tile_Url_Func)(const Evas_Object *obj, int x, int y, int zoom); +typedef Eina_Bool (*Elm_Map_Module_Tile_Geo_to_Coord_Func)(const Evas_Object *obj, int zoom, double lon, double lat, int size, int *x, int *y); +typedef Eina_Bool (*Elm_Map_Module_Tile_Coord_to_Geo_Func)(const Evas_Object *obj, int zoom, int x, int y, int size, double *lon, double *lat); +typedef double (*Elm_Map_Module_Tile_Scale_Func)(const Evas_Object *obj, double lon, double lat, int zoom); +typedef char *(*Elm_Map_Module_Route_Url_Func)(const Evas_Object *obj, const char *type_name, int method, double flon, double flat, double tlon, double tlat); +typedef char *(*Elm_Map_Module_Name_Url_Func)(const Evas_Object *obj, int method, const char *name, double lon, double lat); + +#define ROUND(z) (((z) < 0) ? (int)ceil((z) - 0.005) : (int)floor((z) + 0.005)) +#define EVAS_MAP_POINT 4 +#define DEFAULT_TILE_SIZE 256 +#define MAX_CONCURRENT_DOWNLOAD 10 +#define MARER_MAX_NUMBER 30 +#define OVERLAY_GROUPING_SCALE 2 + +#define CACHE_ROOT "/tmp/elm_map" +#define CACHE_TILE_ROOT CACHE_ROOT"/%d/%d/%d" +#define CACHE_TILE_PATH "%s/%d.png" +#define CACHE_ROUTE_ROOT CACHE_ROOT"/route" +#define CACHE_NAME_ROOT CACHE_ROOT"/name" + +#define ROUTE_YOURS_URL "http://www.yournavigation.org/api/dev/route.php" +#define ROUTE_TYPE_MOTORCAR "motocar" +#define ROUTE_TYPE_BICYCLE "bicycle" +#define ROUTE_TYPE_FOOT "foot" +#define YOURS_DISTANCE "distance" +#define YOURS_DESCRIPTION "description" +#define YOURS_COORDINATES "coordinates" + +#define NAME_NOMINATIM_URL "http://nominatim.openstreetmap.org" +#define NOMINATIM_RESULT "result" +#define NOMINATIM_PLACE "place" +#define NOMINATIM_ATTR_LON "lon" +#define NOMINATIM_ATTR_LAT "lat" + +enum _Route_Xml_Attribute +{ + ROUTE_XML_NONE, + ROUTE_XML_DISTANCE, + ROUTE_XML_DESCRIPTION, + ROUTE_XML_COORDINATES, + ROUTE_XML_LAST +} Route_Xml_Attibute; + +enum _Name_Xml_Attribute +{ + NAME_XML_NONE, + NAME_XML_NAME, + NAME_XML_LON, + NAME_XML_LAT, + NAME_XML_LAST +} Name_Xml_Attibute; + +enum _Track_Xml_Attribute +{ + TRACK_XML_NONE, + TRACK_XML_COORDINATES, + TRACK_XML_LAST +} Track_Xml_Attibute; + +struct _Path +{ + Evas_Coord x, y; +}; + +struct _Region +{ + double lon, lat; +}; + +struct _Delayed_Data +{ + void (*func)(void *data); + Widget_Data *wd; + Elm_Map_Zoom_Mode mode; + int zoom; + double lon, lat; + Eina_List *overlays; +}; + +// FIXME: Currently tile size must be 256*256 +// and the map size is pow(2.0, z) * (tile size) +struct _Source_Tile +{ + const char *name; + int zoom_min; + int zoom_max; + Elm_Map_Module_Tile_Url_Func url_cb; + Elm_Map_Module_Tile_Geo_to_Coord_Func geo_to_coord; + Elm_Map_Module_Tile_Coord_to_Geo_Func coord_to_geo; + Elm_Map_Module_Tile_Scale_Func scale_cb; +}; + +struct _Source_Route +{ + const char *name; + Elm_Map_Module_Route_Url_Func url_cb; +}; + +struct _Source_Name +{ + const char *name; + Elm_Map_Module_Name_Url_Func url_cb; +}; + +struct _Color +{ + int r, g, b, a; +}; + +struct _Overlay_Group +{ + Widget_Data *wd; + Elm_Map_Overlay *overlay; // virtual group type overlay + Elm_Map_Overlay *clas; // class overlay for this virtual group + Overlay_Default *ovl; // rendered overlay + Eina_List *members; + Eina_Bool in : 1; + Eina_Bool boss : 1; +}; + +struct _Overlay_Default +{ + Widget_Data *wd; + Evas_Coord w, h; + + double lon, lat; + Evas_Coord x, y; + + // Display priority is content > icon > clas_obj > clas_icon > layout + Evas_Object *content; + Evas_Object *icon; + + Color c; + // if clas_content or icon exists, do not inherit from class + Evas_Object *clas_content; // Duplicated from class content + Evas_Object *clas_icon; // Duplicated from class icon + Evas_Object *layout; +}; + +struct _Overlay_Class +{ + Widget_Data *wd; + Eina_List *members; + int zoom_max; + Evas_Object *content; + Evas_Object *icon; +}; + +struct _Overlay_Bubble +{ + Widget_Data *wd; + Evas_Object *pobj; + Evas_Object *obj, *sc, *bx; + double lon, lat; + Evas_Coord x, y, w, h; +}; + +struct _Overlay_Route +{ + Widget_Data *wd; + + Evas_Object *obj; + Eina_List *paths; + Eina_List *nodes; +}; + +struct _Overlay_Line +{ + Widget_Data *wd; + double flon, flat, tlon, tlat; + Evas_Object *obj; +}; + +struct _Overlay_Polygon +{ + Widget_Data *wd; + Eina_List *regions; // list of Regions + Evas_Object *obj; +}; + +struct _Overlay_Circle +{ + Widget_Data *wd; + double lon, lat; + double radius; // Intial pixel in intial view + double ratio; // initial-radius/map-size + Evas_Object *obj; +}; + +struct _Overlay_Scale +{ + Widget_Data *wd; + Evas_Coord x, y; + Evas_Coord w, h; + Evas_Object *obj; + }; + +struct _Elm_Map_Overlay +{ + Widget_Data *wd; + + Eina_Bool paused : 1; + Eina_Bool hide : 1; + Evas_Coord zoom_min; + Color c; + void *data; // user set data + + Elm_Map_Overlay_Type type; + void *ovl; // Overlay Data for each type + + Elm_Map_Overlay_Get_Cb cb; + void *cb_data; + + // These are not used if overlay type is class or group + Overlay_Group *grp; +}; + +struct _Elm_Map_Route +{ + Widget_Data *wd; + + char *fname; + Elm_Map_Route_Type type; + Elm_Map_Route_Method method; + double flon, flat, tlon, tlat; + Elm_Map_Route_Cb cb; + void *data; + Ecore_File_Download_Job *job; + + + Eina_List *nodes; + Eina_List *waypoint; + struct + { + int node_count; + int waypoint_count; + const char *nodes; + const char *waypoints; + double distance; /* unit : km */ + } info; + + Path_Node *n; + Path_Waypoint *w; +}; + +struct _Path_Node +{ + Widget_Data *wd; + + int idx; + struct + { + double lon, lat; + char *address; + } pos; +}; + +struct _Path_Waypoint +{ + Widget_Data *wd; + + const char *point; +}; + +struct _Elm_Map_Name +{ + Widget_Data *wd; + + int method; + char *address; + double lon, lat; + + char *fname; + Ecore_File_Download_Job *job; + Elm_Map_Name_Cb cb; + void *data; +}; + +struct _Route_Dump +{ + int id; + char *fname; + double distance; + char *description; + char *coordinates; +}; + +struct _Name_Dump +{ + int id; + char *address; + double lon; + double lat; +}; + +struct _Grid_Item +{ + Grid *g; + + Widget_Data *wd; + Evas_Object *img; + const char *file; + const char *url; + int x, y; // Tile coordinate + Eina_Bool file_have : 1; + + Ecore_File_Download_Job *job; +}; + +struct _Grid +{ + Widget_Data *wd; + int zoom; // zoom level tiles want for optimal display (1, 2, 4, 8) + int tw, th; // size of grid in tiles + Eina_Matrixsparse *grid; +}; + +struct _Pan +{ + Evas_Object_Smart_Clipped_Data __clipped_data; + Widget_Data *wd; +}; + +struct _Widget_Data +{ + Evas_Object *obj; + Evas_Object *scr; + Evas_Object *ges; + Evas_Object *pan_smart; + Evas_Object *sep_maps_overlays; // Tiles are below this and overlays are on top + Evas_Map *map; + + Eina_Array *src_tile_mods; + Source_Tile *src_tile; + Eina_List *src_tiles; + const char **src_tile_names; + + Eina_Array *src_route_mods; + Source_Route *src_route; + Eina_List *src_routes; + const char **src_route_names; + + Eina_Array *src_name_mods; + Source_Name *src_name; + Eina_List *src_names; + const char **src_name_names; + + int zoom_min, zoom_max; + int tsize; + + int id; + Eina_List *grids; + + int zoom; + double zoom_detail; + struct + { + int w, h; // Current pixel width, heigth of a grid + int tile; // Current pixel size of a grid item + } size; + Elm_Map_Zoom_Mode mode; + struct + { + double zoom; + double diff; + int cnt; + } ani; + Ecore_Timer *zoom_timer; + Ecore_Animator *zoom_animator; + + int try_num; + int finish_num; + int download_num; + Eina_List *download_list; + Ecore_Idler *download_idler; + Eina_Hash *ua; + const char *user_agent; + + Evas_Coord pan_x, pan_y; + Eina_List *delayed_jobs; + + Ecore_Timer *scr_timer; + Ecore_Timer *long_timer; + Evas_Event_Mouse_Down ev; + Eina_Bool on_hold : 1; + Eina_Bool paused : 1; + + double pinch_zoom; + struct + { + Evas_Coord cx, cy; + double a, d; + } rotate; + + Eina_Bool wheel_disabled : 1; + + Eina_List *routes; + Eina_List *track; + Eina_List *names; + + Eina_List *overlays; +}; + +static char *_mapnik_url_cb(const Evas_Object *obj __UNUSED__, int x, int y, int zoom); +static char *_osmarender_url_cb(const Evas_Object *obj __UNUSED__, int x, int y, int zoom); +static char *_cyclemap_url_cb(const Evas_Object *obj __UNUSED__, int x, int y, int zoom); +static char *_mapquest_url_cb(const Evas_Object *obj __UNUSED__, int x, int y, int zoom); +static char *_mapquest_aerial_url_cb(const Evas_Object *obj __UNUSED__, int x, int y, int zoom); +static char *_yours_url_cb(const Evas_Object *obj __UNUSED__, const char *type_name, int method, double flon, double flat, double tlon, double tlat); +static char *_nominatim_url_cb(const Evas_Object *obj, int method, const char *name, double lon, double lat); +/* +static char *_monav_url_cb(Evas_Object *obj __UNUSED__, char *type_name, int method, double flon, double flat, double tlon, double tlat) +static char *_ors_url_cb(Evas_Object *obj __UNUSED__, char *type_name, int method, double flon, double flat, double tlon, double tlat); +*/ +static double _scale_cb(const Evas_Object *obj __UNUSED__, double lon __UNUSED__, double lat, int zoom); + +const Source_Tile src_tiles[] = +{ + {"Mapnik", 0, 18, _mapnik_url_cb, NULL, NULL, _scale_cb}, + {"Osmarender", 0, 17, _osmarender_url_cb, NULL, NULL, _scale_cb}, + {"CycleMap", 0, 16, _cyclemap_url_cb, NULL, NULL, _scale_cb}, + {"MapQuest", 0, 18, _mapquest_url_cb, NULL, NULL, _scale_cb}, + {"MapQuest Open Aerial", 0, 11, _mapquest_aerial_url_cb, NULL, NULL, _scale_cb} +}; + +// FIXME: Fix more open sources +const Source_Route src_routes[] = +{ + {"Yours", _yours_url_cb} // http://www.yournavigation.org/ + //{"Monav", _monav_url_cb}, + //{"ORS", _ors_url_cb}, // http://www.openrouteservice.org +}; + +// Refer : http://wiki.openstreetmap.org/wiki/FAQ +// meters per pixel when latitude is 0 (equator) +// meters per pixel = _osm_scale_meter[zoom] * cos (latitude) +const double _osm_scale_meter[] = +{78206, 39135.758482, 19567.879241, 9783.939621, 4891.969810, + 2445.984905, 1222.992453, 611.496226, 305.748113, 152.874057, 76.437028, + 38.218514, 19.109257, 9.554629, 4.777314, 2.388657, 1.194329, 0.597164, + 0.29858}; + +// Scale in meters +const double _scale_tb[] = +{10000000, 5000000, 2000000, 1000000, 500000, 200000, 100000, 50000, + 20000, 10000, 5000, 2000, 1000, 500, 500, 200, 100, 50, 20, 10, 5, 2, 1}; + +// FIXME: Add more open sources +const Source_Name src_names[] = +{ + {"Nominatim", _nominatim_url_cb} +}; + +static const char *widtype = NULL; +static Evas_Smart_Class parent_sc = EVAS_SMART_CLASS_INIT_NULL; +static Evas_Smart_Class sc; +static Evas_Smart *smart; +static int idnum = 1; + +static const char SIG_CLICKED[] = "clicked"; +static const char SIG_CLICKED_DOUBLE[] = "clicked,double"; +static const char SIG_PRESS[] = "press"; +static const char SIG_LONGPRESSED[] = "longpressed"; +static const char SIG_SCROLL[] = "scroll"; +static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start"; +static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop"; +static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start"; +static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop"; +static const char SIG_ZOOM_START[] = "zoom,start"; +static const char SIG_ZOOM_STOP[] = "zoom,stop"; +static const char SIG_ZOOM_CHANGE[] = "zoom,change"; +static const char SIG_TILE_LOAD[] = "tile,load"; +static const char SIG_TILE_LOADED[] = "tile,loaded"; +static const char SIG_TILE_LOADED_FAIL[] = "tile,loaded,fail"; +static const char SIG_ROUTE_LOAD[] = "route,load"; +static const char SIG_ROUTE_LOADED[] = "route,loaded"; +static const char SIG_ROUTE_LOADED_FAIL[] = "route,loaded,fail"; +static const char SIG_NAME_LOAD[] = "name,load"; +static const char SIG_NAME_LOADED[] = "name,loaded"; +static const char SIG_NAME_LOADED_FAIL[] = "name,loaded,fail"; +static const char SIG_OVERLAY_CLICKED[] = "overlay,clicked"; +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CLICKED, ""}, + {SIG_CLICKED_DOUBLE, ""}, + {SIG_PRESS, ""}, + {SIG_LONGPRESSED, ""}, + {SIG_SCROLL, ""}, + {SIG_SCROLL_DRAG_START, ""}, + {SIG_SCROLL_DRAG_STOP, ""}, + {SIG_SCROLL_ANIM_START, ""}, + {SIG_SCROLL_ANIM_STOP, ""}, + {SIG_ZOOM_START, ""}, + {SIG_ZOOM_STOP, ""}, + {SIG_ZOOM_CHANGE, ""}, + {SIG_TILE_LOAD, ""}, + {SIG_TILE_LOADED, ""}, + {SIG_TILE_LOADED_FAIL, ""}, + {SIG_ROUTE_LOAD, ""}, + {SIG_ROUTE_LOADED, ""}, + {SIG_ROUTE_LOADED_FAIL, ""}, + {SIG_NAME_LOAD, ""}, + {SIG_NAME_LOADED, ""}, + {SIG_NAME_LOADED_FAIL, ""}, + {SIG_OVERLAY_CLICKED, ""}, + {NULL, NULL} +}; + +static void +_edj_overlay_size_get(Widget_Data *wd, Evas_Coord *w, Evas_Coord *h) +{ + EINA_SAFETY_ON_NULL_RETURN(wd); + EINA_SAFETY_ON_NULL_RETURN(w); + EINA_SAFETY_ON_NULL_RETURN(h); + + Evas_Object *edj; + const char *s; + + edj = edje_object_add(evas_object_evas_get(wd->obj)); + _elm_theme_object_set(wd->obj, edj, "map/marker", "radio", + elm_widget_style_get(wd->obj)); + s = edje_object_data_get(edj, "size_w"); + if (s) *w = atoi(s); + else *w = 0; + s = edje_object_data_get(edj, "size_h"); + if (s) *h = atoi(s); + else *h = 0; + evas_object_del(edj); +} + +static void +_rotate(Evas_Coord x, Evas_Coord y, Evas_Coord cx, Evas_Coord cy, double degree, Evas_Coord *xx, Evas_Coord *yy) +{ + double r = (degree * M_PI) / 180.0; + if (xx) *xx = ((x - cx) * cos(r)) + ((y - cy) * cos(r + M_PI_2)) + cx; + if (yy) *yy = ((x - cx) * sin(r)) + ((y - cy) * sin(r + M_PI_2)) + cy; +} + +static void +_obj_rotate(Widget_Data *wd, Evas_Object *obj) +{ + Evas_Coord w, h, ow, oh; + evas_map_util_points_populate_from_object(wd->map, obj); + + evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); + evas_object_image_size_get(obj, &w, &h); + if ((w > ow) || (h > oh)) + { + evas_map_point_image_uv_set(wd->map, 0, 0, 0); + evas_map_point_image_uv_set(wd->map, 1, w, 0); + evas_map_point_image_uv_set(wd->map, 2, w, h); + evas_map_point_image_uv_set(wd->map, 3, 0, h); + } + evas_map_util_rotate(wd->map, wd->rotate.d, wd->rotate.cx, wd->rotate.cy); + + evas_object_map_set(obj, wd->map); + evas_object_map_enable_set(obj, EINA_TRUE); +} + +static void +_obj_place(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + + evas_object_move(obj, x, y); + evas_object_resize(obj, w, h); + evas_object_show(obj); +} + +static void +_coord_to_region_convert(Widget_Data *wd, Evas_Coord x, Evas_Coord y, Evas_Coord size, double *lon, double *lat) +{ + EINA_SAFETY_ON_NULL_RETURN(wd); + int zoom = floor(log(size / wd->size.tile) / log(2)); + if ((wd->src_tile) && (wd->src_tile->coord_to_geo)) + { + if (wd->src_tile->coord_to_geo(wd->obj, zoom, x, y, size, lon, lat)) + return; + } + + if (lon) *lon = (x / (double)size * 360.0) - 180; + if (lat) + { + double n = ELM_PI - (2.0 * ELM_PI * y / size); + *lat = 180.0 / ELM_PI * atan(0.5 * (exp(n) - exp(-n))); + } +} + +static void +_region_to_coord_convert(Widget_Data *wd, double lon, double lat, Evas_Coord size, Evas_Coord *x, Evas_Coord *y) +{ + EINA_SAFETY_ON_NULL_RETURN(wd); + + int zoom = floor(log(size / 256) / log(2)); + if ((wd->src_tile) && (wd->src_tile->geo_to_coord)) + { + if (wd->src_tile->geo_to_coord(wd->obj, zoom, lon, lat, size, x, y)) return; + } + + if (x) *x = floor((lon + 180.0) / 360.0 * size); + if (y) + *y = floor((1.0 - log(tan(lat * ELM_PI / 180.0) + (1.0 / cos(lat * ELM_PI / 180.0))) + / ELM_PI) / 2.0 * size); +} + +static void +_viewport_coord_get(Widget_Data *wd, Evas_Coord *vx, Evas_Coord *vy, Evas_Coord *vw, Evas_Coord *vh) +{ + EINA_SAFETY_ON_NULL_RETURN(wd); + + Evas_Coord x, y, w, h; + elm_smart_scroller_child_pos_get(wd->scr, &x, &y); + elm_smart_scroller_child_viewport_size_get(wd->scr, &w, &h); + if (w > wd->size.w) x -= ((w - wd->size.w) / 2); + if (h > wd->size.h) y -= ((h - wd->size.h) / 2); + if (vx) *vx = x; + if (vy) *vy = y; + if (vw) *vw = w; + if (vh) *vh = h; +} + +// Map coordinates to canvas geometry without rotate +static void +_coord_to_canvas_no_rotate(Widget_Data *wd, Evas_Coord x, Evas_Coord y, Evas_Coord *xx, Evas_Coord *yy) +{ + Evas_Coord vx, vy, sx, sy; + _viewport_coord_get(wd, &vx, &vy, NULL, NULL); + evas_object_geometry_get(wd->pan_smart, &sx, &sy, NULL, NULL); + if (xx) *xx = x - vx + sx; + if (yy) *yy = y - vy + sy; +} + +// Map coordinates to canvas geometry +static void +_coord_to_canvas(Widget_Data *wd, Evas_Coord x, Evas_Coord y, Evas_Coord *xx, Evas_Coord *yy) +{ + _coord_to_canvas_no_rotate(wd, x, y, &x, &y); + _rotate(x, y, wd->rotate.cx, wd->rotate.cy, wd->rotate.d, &x, &y); + if (xx) *xx = x; + if (yy) *yy = y; +} + +// Canvas geometry to map coordinates +static void +_canvas_to_coord(Widget_Data *wd, Evas_Coord x, Evas_Coord y, Evas_Coord *xx, Evas_Coord *yy) +{ + Evas_Coord vx, vy, sx, sy; + _viewport_coord_get(wd, &vx, &vy, NULL, NULL); + evas_object_geometry_get(wd->pan_smart, &sx, &sy, NULL, NULL); + _rotate(x - sx + vx, y - sy + vy, wd->rotate.cx - sx + vx, + wd->rotate.cy - sy + vy, -wd->rotate.d, &x, &y); + if (xx) *xx = x; + if (yy) *yy = y; +} + +static void +_region_show(void *data) +{ + EINA_SAFETY_ON_NULL_RETURN(data); + Delayed_Data *dd = data; + int x, y, w, h; + + _region_to_coord_convert(dd->wd, dd->lon, dd->lat, dd->wd->size.w, &x, &y); + _viewport_coord_get(dd->wd, NULL, NULL, &w, &h); + x = x - (w / 2); + y = y - (h / 2); + elm_smart_scroller_child_region_show(dd->wd->scr, x, y, w, h); + evas_object_smart_changed(dd->wd->pan_smart); +} + +static void +_grid_item_coord_get(Grid_Item *gi, int *x, int *y, int *w, int *h) +{ + EINA_SAFETY_ON_NULL_RETURN(gi); + + if (x) *x = gi->x * gi->wd->size.tile; + if (y) *y = gi->y * gi->wd->size.tile; + if (w) *w = gi->wd->size.tile; + if (h) *h = gi->wd->size.tile; +} + +static Eina_Bool +_grid_item_in_viewport(Grid_Item *gi) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(gi, EINA_FALSE); + + Evas_Coord vx, vy, vw, vh; + Evas_Coord x, y, w, h; + + _viewport_coord_get(gi->wd, &vx, &vy, &vw, &vh); + _grid_item_coord_get(gi, &x, &y, &w, &h); + return ELM_RECTS_INTERSECT(x, y, w, h, vx, vy, vw, vh); +} + +static void +_grid_item_update(Grid_Item *gi) +{ + evas_object_image_file_set(gi->img, gi->file, NULL); + if (!gi->wd->zoom_timer && !gi->wd->scr_timer) + evas_object_image_smooth_scale_set(gi->img, EINA_TRUE); + else evas_object_image_smooth_scale_set(gi->img, EINA_FALSE); + + Evas_Load_Error err = evas_object_image_load_error_get(gi->img); + if (err != EVAS_LOAD_ERROR_NONE) + { + ERR("Image loading error (%s): %s", gi->file, evas_load_error_str(err)); + ecore_file_remove(gi->file); + gi->file_have = EINA_FALSE; + } + else + { + Evas_Coord x, y, w, h; + _grid_item_coord_get(gi, &x, &y, &w, &h); + _coord_to_canvas_no_rotate(gi->wd, x, y, &x, &y); + _obj_place(gi->img, x, y, w, h); + _obj_rotate(gi->wd, gi->img); + gi->file_have = EINA_TRUE; + } +} + +static void +_grid_item_load(Grid_Item *gi) +{ + EINA_SAFETY_ON_NULL_RETURN(gi); + if (gi->file_have) _grid_item_update(gi); + else if (!gi->job) + { + gi->wd->download_list = eina_list_remove(gi->wd->download_list, gi); + gi->wd->download_list = eina_list_append(gi->wd->download_list, gi); + } +} + +static void +_grid_item_unload(Grid_Item *gi) +{ + EINA_SAFETY_ON_NULL_RETURN(gi); + if (gi->file_have) + { + evas_object_hide(gi->img); + evas_object_image_file_set(gi->img, NULL, NULL); + } + else if (gi->job) + { + ecore_file_download_abort(gi->job); + ecore_file_remove(gi->file); + gi->job = NULL; + gi->wd->try_num--; + } + else gi->wd->download_list = eina_list_remove(gi->wd->download_list, gi); + +} + +static Grid_Item * +_grid_item_create(Grid *g, Evas_Coord x, Evas_Coord y) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(g, NULL); + char buf[PATH_MAX]; + char buf2[PATH_MAX]; + char *url; + Grid_Item *gi; + + gi = ELM_NEW(Grid_Item); + gi->wd = g->wd; + gi->g = g; + gi->x = x; + gi->y = y; + + gi->file_have = EINA_FALSE; + gi->job = NULL; + + gi->img = evas_object_image_add(evas_object_evas_get(g->wd->obj)); + evas_object_image_smooth_scale_set(gi->img, EINA_FALSE); + evas_object_image_scale_hint_set(gi->img, EVAS_IMAGE_SCALE_HINT_DYNAMIC); + evas_object_image_filled_set(gi->img, EINA_TRUE); + evas_object_smart_member_add(gi->img, g->wd->pan_smart); + evas_object_pass_events_set(gi->img, EINA_TRUE); + evas_object_stack_below(gi->img, g->wd->sep_maps_overlays); + + snprintf(buf, sizeof(buf), CACHE_TILE_ROOT, g->wd->id, g->zoom, x); + snprintf(buf2, sizeof(buf2), CACHE_TILE_PATH, buf, y); + if (!ecore_file_exists(buf)) ecore_file_mkpath(buf); + + eina_stringshare_replace(&gi->file, buf2); + url = g->wd->src_tile->url_cb(g->wd->obj, x, y, g->zoom); + if ((!url) || (!strlen(url))) + { + eina_stringshare_replace(&gi->url, NULL); + ERR("Getting source url failed: %s", gi->file); + } + else eina_stringshare_replace(&gi->url, url); + if (url) free(url); + eina_matrixsparse_data_idx_set(g->grid, y, x, gi); + return gi; +} + +static void +_grid_item_free(Grid_Item *gi) +{ + EINA_SAFETY_ON_NULL_RETURN(gi); + _grid_item_unload(gi); + if (gi->g && gi->g->grid) eina_matrixsparse_data_idx_set(gi->g->grid, + gi->y, gi->x, NULL); + if (gi->url) eina_stringshare_del(gi->url); + if (gi->file) eina_stringshare_del(gi->file); + if (gi->img) evas_object_del(gi->img); + if (gi->file_have) ecore_file_remove(gi->file); + free(gi); +} + +static void +_downloaded_cb(void *data, const char *file __UNUSED__, int status) +{ + Grid_Item *gi = data; + + if (status == 200) + { + DBG("Download success from %s to %s", gi->url, gi->file); + _grid_item_update(gi); + gi->wd->finish_num++; + evas_object_smart_callback_call(gi->wd->obj, SIG_TILE_LOADED, NULL); + } + else + { + WRN("Download failed from %s to %s (%d) ", gi->url, gi->file, status); + ecore_file_remove(gi->file); + gi->file_have = EINA_FALSE; + evas_object_smart_callback_call(gi->wd->obj, SIG_TILE_LOADED_FAIL, NULL); + } + + gi->job = NULL; + gi->wd->download_num--; + if (!gi->wd->download_num) + edje_object_signal_emit(elm_smart_scroller_edje_object_get(gi->wd->scr), + "elm,state,busy,stop", "elm"); +} + +static Eina_Bool +_download_job(void *data) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(data, ECORE_CALLBACK_CANCEL); + Widget_Data *wd = data; + + Eina_List *l, *ll; + Grid_Item *gi; + + if (!eina_list_count(wd->download_list)) + { + wd->download_idler = NULL; + return ECORE_CALLBACK_CANCEL; + } + + EINA_LIST_REVERSE_FOREACH_SAFE(wd->download_list, l, ll, gi) + { + if ((gi->g->zoom != wd->zoom) || !(_grid_item_in_viewport(gi))) + { + wd->download_list = eina_list_remove(wd->download_list, gi); + continue; + } + if (wd->download_num >= MAX_CONCURRENT_DOWNLOAD) + return ECORE_CALLBACK_RENEW; + + Eina_Bool ret = ecore_file_download_full(gi->url, gi->file, + _downloaded_cb, NULL, + gi, &(gi->job), wd->ua); + if ((!ret) || (!gi->job)) + ERR("Can't start to download from %s to %s", gi->url, gi->file); + else + { + wd->download_list = eina_list_remove(wd->download_list, gi); + wd->try_num++; + wd->download_num++; + evas_object_smart_callback_call(gi->wd->obj, SIG_TILE_LOAD, + NULL); + if (wd->download_num == 1) + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), + "elm,state,busy,start", "elm"); + } + } + return ECORE_CALLBACK_RENEW; +} + +static void +_grid_viewport_get(Grid *g, int *x, int *y, int *w, int *h) +{ + EINA_SAFETY_ON_NULL_RETURN(g); + int xx, yy, ww, hh; + Evas_Coord vx, vy, vw, vh; + + _viewport_coord_get(g->wd, &vx, &vy, &vw, &vh); + if (vx < 0) vx = 0; + if (vy < 0) vy = 0; + + xx = (vx / g->wd->size.tile) - 1; + if (xx < 0) xx = 0; + + yy = (vy / g->wd->size.tile) - 1; + if (yy < 0) yy = 0; + + ww = (vw / g->wd->size.tile) + 3; + if (xx + ww >= g->tw) ww = g->tw - xx; + + hh = (vh / g->wd->size.tile) + 3; + if (yy + hh >= g->th) hh = g->th - yy; + + if (x) *x = xx; + if (y) *y = yy; + if (w) *w = ww; + if (h) *h = hh; +} + +static void +_grid_unload(Grid *g) +{ + EINA_SAFETY_ON_NULL_RETURN(g); + Eina_Iterator *it; + Eina_Matrixsparse_Cell *cell; + Grid_Item *gi; + + it = eina_matrixsparse_iterator_new(g->grid); + EINA_ITERATOR_FOREACH(it, cell) + { + gi = eina_matrixsparse_cell_data_get(cell); + _grid_item_unload(gi); + } + eina_iterator_free(it); +} + +static void +_grid_load(Grid *g) +{ + EINA_SAFETY_ON_NULL_RETURN(g); + int x, y, xx, yy, ww, hh; + Eina_Iterator *it; + Eina_Matrixsparse_Cell *cell; + Grid_Item *gi; + + it = eina_matrixsparse_iterator_new(g->grid); + EINA_ITERATOR_FOREACH(it, cell) + { + gi = eina_matrixsparse_cell_data_get(cell); + if (!_grid_item_in_viewport(gi)) _grid_item_unload(gi); + } + eina_iterator_free(it); + + _grid_viewport_get(g, &xx, &yy, &ww, &hh); + for (y = yy; y < yy + hh; y++) + { + for (x = xx; x < xx + ww; x++) + { + gi = eina_matrixsparse_data_idx_get(g->grid, y, x); + if (!gi) gi = _grid_item_create(g, x, y); + _grid_item_load(gi); + } + } +} + +static void +_grid_place(Widget_Data *wd) +{ + EINA_SAFETY_ON_NULL_RETURN(wd); + Eina_List *l; + Grid *g; + + EINA_LIST_FOREACH(wd->grids, l, g) + { + if (wd->zoom == g->zoom) _grid_load(g); + else _grid_unload(g); + } + if (!wd->download_idler) wd->download_idler = ecore_idler_add(_download_job, wd); +} + +static void +_grid_all_create(Widget_Data *wd) +{ + EINA_SAFETY_ON_NULL_RETURN(wd); + EINA_SAFETY_ON_NULL_RETURN(wd->src_tile); + + int zoom; + for (zoom = wd->src_tile->zoom_min; zoom <= wd->src_tile->zoom_max; zoom++) + { + Grid *g; + int tnum; + g = ELM_NEW(Grid); + g->wd = wd; + g->zoom = zoom; + tnum = pow(2.0, g->zoom); + g->tw = tnum; + g->th = tnum; + g->grid = eina_matrixsparse_new(g->th, g->tw, NULL, NULL); + wd->grids = eina_list_append(wd->grids, g); + } +} + +static void +_grid_all_clear(Widget_Data *wd) +{ + EINA_SAFETY_ON_NULL_RETURN(wd); + + Grid *g; + EINA_LIST_FREE(wd->grids, g) + { + Eina_Matrixsparse_Cell *cell; + Eina_Iterator *it = eina_matrixsparse_iterator_new(g->grid); + EINA_ITERATOR_FOREACH(it, cell) + { + Grid_Item *gi; + gi = eina_matrixsparse_cell_data_get(cell); + if (gi) _grid_item_free(gi); + } + eina_iterator_free(it); + + eina_matrixsparse_free(g->grid); + free(g); + } +} + +static void +_track_place(Widget_Data *wd) +{ +#ifdef ELM_EMAP + EINA_SAFETY_ON_NULL_RETURN(wd); + + Eina_List *l; + Evas_Object *route; + int xmin, xmax, ymin, ymax; + Evas_Coord px, py, ow, oh; + px = wd->pan_x; + py = wd->pan_y; + _viewport_coord_get(wd, NULL, NULL, &ow, &oh); + + Evas_Coord size = wd->size.w; + + EINA_LIST_FOREACH(wd->track, l, route) + { + double lon_min, lon_max; + double lat_min, lat_max; + elm_route_longitude_min_max_get(route, &lon_min, &lon_max); + elm_route_latitude_min_max_get(route, &lat_min, &lat_max); + _region_to_coord_convert(wd, lon_min, lat_max, size, &xmin, &ymin); + _region_to_coord_convert(wd, lon_max, lat_min, size, &xmax, &ymax); + + if ( !(xmin < px && xmax < px) && !(xmin > px+ow && xmax > px+ow)) + { + if ( !(ymin < py && ymax < py) && !(ymin > py+oh && ymax > py+oh)) + { + //display the route + evas_object_move(route, xmin - px, ymin - py); + evas_object_resize(route, xmax - xmin, ymax - ymin); + + evas_object_raise(route); + _obj_rotate(wd, route); + evas_object_show(route); + + continue; + } + } + //the route is not display + evas_object_hide(route); + } +#else + (void) wd; +#endif +} + +static void +_delayed_do(Widget_Data *wd) +{ + Delayed_Data *dd; + dd = eina_list_nth(wd->delayed_jobs, 0); + if (dd && !dd->wd->zoom_animator) + { + dd->func(dd); + wd->delayed_jobs = eina_list_remove(wd->delayed_jobs, dd); + free(dd); + } +} + +static void +_smooth_update(Widget_Data *wd) +{ + EINA_SAFETY_ON_NULL_RETURN(wd); + Eina_List *l; + Grid *g; + + EINA_LIST_FOREACH(wd->grids, l, g) + { + Eina_Iterator *it = eina_matrixsparse_iterator_new(g->grid); + Eina_Matrixsparse_Cell *cell; + + EINA_ITERATOR_FOREACH(it, cell) + { + Grid_Item *gi = eina_matrixsparse_cell_data_get(cell); + if (_grid_item_in_viewport(gi)) + evas_object_image_smooth_scale_set(gi->img, EINA_TRUE); + } + eina_iterator_free(it); + } +} + +static Eina_Bool +_zoom_timeout(void *data) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(data, ECORE_CALLBACK_CANCEL); + Widget_Data *wd = data; + _smooth_update(wd); + wd->zoom_timer = NULL; + evas_object_smart_callback_call(wd->obj, SIG_ZOOM_STOP, NULL); + return ECORE_CALLBACK_CANCEL; +} + +static void +zoom_do(Widget_Data *wd, double zoom) +{ + EINA_SAFETY_ON_NULL_RETURN(wd); + if (zoom > wd->src_tile->zoom_max) zoom = wd->src_tile->zoom_max; + else if (zoom < wd->src_tile->zoom_min) zoom = wd->src_tile->zoom_min; + if (zoom > wd->zoom_max) zoom = wd->zoom_max; + else if (zoom < wd->zoom_min) zoom = wd->zoom_min; + + Evas_Coord vx, vy, vw, vh; + Evas_Coord ow, oh; + + wd->zoom = ROUND(zoom); + wd->zoom_detail = zoom; + ow = wd->size.w; + oh = wd->size.h; + wd->size.tile = pow(2.0, (zoom - wd->zoom)) * wd->tsize; + wd->size.w = pow(2.0, wd->zoom) * wd->size.tile; + wd->size.h = wd->size.w;; + + // Fix to zooming with (viewport center vx, vy) as the center to prevent + // from zooming with (0,0) as the cetner. (scroller default behavior) + _viewport_coord_get(wd, &vx, &vy, &vw, &vh); + if ((vw > 0) && (vh > 0) && (ow > 0) && (oh > 0)) + { + Evas_Coord x, y; + double sx, sy; + if (vw > ow) sx = 0.5; + else sx = (double)(vx + (double)(vw / 2)) / ow; + if (vh > oh) sy = 0.5; + else sy = (double)(vy + (double)(vh / 2)) / oh; + + if (sx > 1.0) sx = 1.0; + if (sy > 1.0) sy = 1.0; + + x = ceil((sx * wd->size.w) - (vw / 2)); + y = ceil((sy * wd->size.h) - (vh / 2)); + if (x < 0) x = 0; + else if (x > (wd->size.w - vw)) x = wd->size.w - vw; + if (y < 0) y = 0; + else if (y > (wd->size.h - vh)) y = wd->size.h - vh; + elm_smart_scroller_child_region_show(wd->scr, x, y, vw, vh); + } + if (wd->zoom_timer) ecore_timer_del(wd->zoom_timer); + else evas_object_smart_callback_call(wd->obj, SIG_ZOOM_START, NULL); + wd->zoom_timer = ecore_timer_add(0.25, _zoom_timeout, wd); + evas_object_smart_callback_call(wd->obj, SIG_ZOOM_CHANGE, NULL); + + evas_object_smart_callback_call(wd->pan_smart, "changed", NULL); + evas_object_smart_changed(wd->pan_smart); +} + +static Eina_Bool +_zoom_anim(void *data) +{ + Widget_Data *wd = data; + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, ECORE_CALLBACK_CANCEL); + + if (wd->ani.cnt <= 0) + { + wd->zoom_animator = NULL; + evas_object_smart_changed(wd->pan_smart); + return ECORE_CALLBACK_CANCEL; + } + else + { + wd->ani.zoom += wd->ani.diff; + wd->ani.cnt--; + zoom_do(wd, wd->ani.zoom); + return ECORE_CALLBACK_RENEW; + } +} + +static void +zoom_with_animation(Widget_Data *wd, double zoom, int cnt) +{ + EINA_SAFETY_ON_NULL_RETURN(wd); + if (cnt == 0) return; + + wd->ani.cnt = cnt; + wd->ani.zoom = wd->zoom; + wd->ani.diff = (double)(zoom - wd->zoom) / cnt; + if (wd->zoom_animator) ecore_animator_del(wd->zoom_animator); + wd->zoom_animator = ecore_animator_add(_zoom_anim, wd); +} + +static void +_sizing_eval(Widget_Data *wd) +{ + EINA_SAFETY_ON_NULL_RETURN(wd); + + Evas_Coord maxw = -1, maxh = -1; + + evas_object_size_hint_max_get(wd->scr, &maxw, &maxh); + evas_object_size_hint_max_set(wd->obj, maxw, maxh); +} + +static void +_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _sizing_eval(data); +} + +static Eina_Bool +_scr_timeout(void *data) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(data, ECORE_CALLBACK_CANCEL); + Widget_Data *wd = data; + _smooth_update(wd); + wd->scr_timer = NULL; + evas_object_smart_callback_call(wd->obj, SIG_SCROLL_DRAG_STOP, NULL); + return ECORE_CALLBACK_CANCEL; +} + +static void +_scr(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + EINA_SAFETY_ON_NULL_RETURN(data); + Widget_Data *wd = data; + + if (wd->scr_timer) ecore_timer_del(wd->scr_timer); + else evas_object_smart_callback_call(wd->obj, SIG_SCROLL_DRAG_START, NULL); + wd->scr_timer = ecore_timer_add(0.25, _scr_timeout, wd); + evas_object_smart_callback_call(wd->obj, SIG_SCROLL, NULL); +} + +static void +_scr_anim_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + EINA_SAFETY_ON_NULL_RETURN(data); + Widget_Data *wd = data; + evas_object_smart_callback_call(wd->obj, SIG_SCROLL_ANIM_START, NULL); +} + +static void +_scr_anim_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + EINA_SAFETY_ON_NULL_RETURN(data); + Widget_Data *wd = data; + evas_object_smart_callback_call(wd->obj, SIG_SCROLL_ANIM_STOP, NULL); +} + +static Eina_Bool +_long_press(void *data) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(data, ECORE_CALLBACK_CANCEL); + Widget_Data *wd = data; + + wd->long_timer = NULL; + evas_object_smart_callback_call(wd->obj, SIG_LONGPRESSED, &wd->ev); + return ECORE_CALLBACK_CANCEL; +} + +static void +_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + EINA_SAFETY_ON_NULL_RETURN(data); + Widget_Data *wd = data; + Evas_Event_Mouse_Down *ev = event_info; + + if (ev->button != 1) return; + + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) wd->on_hold = EINA_TRUE; + else wd->on_hold = EINA_FALSE; + + if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) + evas_object_smart_callback_call(wd->obj, SIG_CLICKED_DOUBLE, ev); + else evas_object_smart_callback_call(wd->obj, SIG_PRESS, ev); + + if (wd->long_timer) ecore_timer_del(wd->long_timer); + wd->ev = *ev; + wd->long_timer = ecore_timer_add(_elm_config->longpress_timeout, _long_press, wd); +} + +static void +_mouse_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + EINA_SAFETY_ON_NULL_RETURN(data); + Widget_Data *wd = data; + + Evas_Event_Mouse_Up *ev = event_info; + EINA_SAFETY_ON_NULL_RETURN(ev); + + if (ev->button != 1) return; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) wd->on_hold = EINA_TRUE; + else wd->on_hold = EINA_FALSE; + if (wd->long_timer) + { + ecore_timer_del(wd->long_timer); + wd->long_timer = NULL; + } + if (!wd->on_hold) evas_object_smart_callback_call(wd->obj, SIG_CLICKED, ev); + wd->on_hold = EINA_FALSE; +} + +static void +_mouse_wheel_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + EINA_SAFETY_ON_NULL_RETURN(data); + Widget_Data *wd = data; + + if (!wd->paused) + { + Evas_Event_Mouse_Wheel *ev = (Evas_Event_Mouse_Wheel*) event_info; + zoom_do(wd, wd->zoom_detail - ((double)ev->z / 10)); + } +} + +static void +_region_max_min_get(Eina_List *overlays, double *max_longitude, double *min_longitude, double *max_latitude, double *min_latitude) +{ + double max_lon = -180, min_lon = 180; + double max_lat = -90, min_lat = 90; + Elm_Map_Overlay *overlay; + EINA_LIST_FREE(overlays, overlay) + { + double lon, lat; + if (overlay->type == ELM_MAP_OVERLAY_TYPE_DEFAULT) + { + Overlay_Default *ovl = overlay->ovl; + lon = ovl->lon; + lat = ovl->lat; + } + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_CLASS) + { + // FIXME: class center coord is alright?? + Overlay_Class *ovl = overlay->ovl; + double max_lo, min_lo, max_la, min_la; + _region_max_min_get(ovl->members, &max_lo, &min_lo, &max_la, + &min_la); + lon = (max_lo + min_lo) / 2; + lat = (max_la + min_la) / 2; + } + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_BUBBLE) + { + Overlay_Bubble *ovl = overlay->ovl; + lon = ovl->lon; + lat = ovl->lat; + } + else + { + WRN("Not supported overlay type: %d", overlay->type); + continue; + } + if (lon> max_lon) max_lon = lon; + if (lon< min_lon) min_lon = lon; + if (lat > max_lat) max_lat = lat; + if (lat < min_lat) min_lat = lat; + } + if (max_longitude) *max_longitude = max_lon; + if (min_longitude) *min_longitude = min_lon; + if (max_latitude) *max_latitude = max_lat; + if (min_latitude) *min_latitude = min_lat; +} + +static Evas_Object * +_icon_dup(const Evas_Object *icon, Evas_Object *parent) +{ + if (!icon || !parent) return NULL; + // Evas_Object do not support object duplication?? + const char *file = NULL, *group = NULL; + Eina_Bool size_up, size_down; + Evas_Object *dupp; + + dupp = elm_icon_add(parent); + elm_icon_file_get(icon, &file, &group); + elm_icon_file_set(dupp, file, group); + elm_icon_animated_set(dupp, elm_icon_animated_get(icon)); + elm_icon_animated_play_set(dupp, elm_icon_animated_play_get(icon)); + elm_icon_standard_set(dupp, elm_icon_standard_get(icon)); + elm_icon_order_lookup_set(dupp, elm_icon_order_lookup_get(icon)); + elm_icon_no_scale_set(dupp, elm_icon_no_scale_get(icon)); + elm_icon_resizable_get(icon, &size_up, &size_down); + elm_icon_resizable_set(dupp, size_up, size_down); + elm_icon_fill_outside_set(dupp, elm_icon_fill_outside_get(icon)); + elm_icon_prescale_set(dupp, elm_icon_prescale_get(icon)); + elm_icon_aspect_fixed_set(dupp, elm_icon_aspect_fixed_get(icon)); + return dupp; +} + +static void +_overlay_clicked_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *ev __UNUSED__) +{ + EINA_SAFETY_ON_NULL_RETURN(data); + Elm_Map_Overlay *overlay = data; + + evas_object_smart_callback_call(overlay->wd->obj, SIG_OVERLAY_CLICKED, + overlay); + if (overlay->cb) overlay->cb(overlay->cb_data, overlay->wd->obj, + overlay); +} + +static void +_overlay_default_hide(Overlay_Default *ovl) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + if (ovl->content) evas_object_hide(ovl->content); + if (ovl->icon) evas_object_hide(ovl->icon); + if (ovl->clas_content) evas_object_hide(ovl->clas_content); + if (ovl->clas_icon) evas_object_hide(ovl->clas_icon); + if (ovl->layout) evas_object_hide(ovl->layout); +} + +static void +_overlay_default_show(Overlay_Default *ovl) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + Evas_Object *disp; + Evas_Coord x, y, w, h; + + evas_object_hide(ovl->layout); + if (ovl->content) + { + disp = ovl->content; + evas_object_geometry_get(disp, NULL, NULL, &w, &h); + if (w <= 0 || h <= 0) evas_object_size_hint_min_get(disp, &w, &h); + } + else if (!(ovl->icon) && ovl->clas_content) + { + disp = ovl->clas_content; + + evas_object_geometry_get(disp, NULL, NULL, &w, &h); + if (w <= 0 || h <= 0) evas_object_size_hint_min_get(disp, &w, &h); + } + else + { + if (ovl->icon) evas_object_show(ovl->icon); + else if (ovl->clas_icon) evas_object_show(ovl->clas_icon); + disp = ovl->layout; + w = ovl->w; + h = ovl->h; + } + _coord_to_canvas(ovl->wd, ovl->x, ovl->y, &x, &y); + _obj_place(disp, x - (w / 2), y - (h / 2), w, h); +} + +static void +_overlay_default_coord_get(Overlay_Default *ovl, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + if (x) *x = ovl->x; + if (y) *y = ovl->y; + if (w) *w = ovl->w; + if (h) *h = ovl->h; +} + +static void +_overlay_default_coord_set(Overlay_Default *ovl, Evas_Coord x, Evas_Coord y) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + ovl->x = x; + ovl->y = y; +} + +static void +_overlay_default_coord_update(Overlay_Default *ovl) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + _region_to_coord_convert(ovl->wd, ovl->lon, ovl->lat, ovl->wd->size.w, + &ovl->x, &ovl->y); +} + +static void +_overlay_default_layout_text_update(Overlay_Default *ovl, const char *text) +{ + if (!ovl->content && !ovl->icon && !ovl->clas_content && !ovl->clas_icon) + edje_object_part_text_escaped_set(elm_layout_edje_get(ovl->layout), "elm.text", + text); +} + +static void +_overlay_default_content_update(Overlay_Default *ovl, Evas_Object *content, Elm_Map_Overlay *overlay) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + if (ovl->content == content) return; + if (ovl->content) evas_object_del(ovl->content); + ovl->content = content; + + if (ovl->content) + evas_object_event_callback_add(ovl->content, EVAS_CALLBACK_MOUSE_DOWN, + _overlay_clicked_cb, overlay); +} + +static void +_overlay_default_clas_content_update(Overlay_Default *ovl, const Evas_Object *content __UNUSED__) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + if (ovl->clas_content) evas_object_del(ovl->clas_content); + // Evas_Object can not be duplicated. + //ovl->clas_content = _content_dup(content); +} + +static void +_overlay_default_layout_update(Overlay_Default *ovl) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + if (ovl->icon) + { + evas_object_color_set(ovl->layout, 255, 255, 255, 255); + elm_layout_theme_set(ovl->layout, "map/marker", "empty", + elm_widget_style_get(ovl->wd->obj)); + elm_object_part_content_set(ovl->layout, "elm.icon", ovl->icon); + } + else if (!ovl->icon && ovl->clas_icon) + { + evas_object_color_set(ovl->layout, 255, 255, 255, 255); + elm_layout_theme_set(ovl->layout, "map/marker", "empty", + elm_widget_style_get(ovl->wd->obj)); + elm_object_part_content_set(ovl->layout, "elm.icon", ovl->clas_icon); + } + else + { + evas_object_color_set(ovl->layout, ovl->c.r, ovl->c.g, ovl->c.b, ovl->c.a); + elm_layout_theme_set(ovl->layout, "map/marker", "radio", + elm_widget_style_get(ovl->wd->obj)); + } +} + +static void +_overlay_default_icon_update(Overlay_Default *ovl, Evas_Object *icon) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + if (ovl->icon == icon) return; + if (ovl->icon) evas_object_del(ovl->icon); + ovl->icon = icon; + _overlay_default_layout_update(ovl); +} + +static void +_overlay_default_clas_icon_update(Overlay_Default *ovl, const Evas_Object *icon) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + if (ovl->clas_icon) evas_object_del(ovl->clas_icon); + ovl->clas_icon = _icon_dup(icon, ovl->layout); + _overlay_default_layout_update(ovl); +} + +static void +_overlay_default_color_update(Overlay_Default *ovl, Color c) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + ovl->c = c; + _overlay_default_layout_update(ovl); +} + +static void +_overlay_default_free(Overlay_Default *ovl) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + if (ovl->content) evas_object_del(ovl->content); + if (ovl->icon) evas_object_del(ovl->icon); + if (ovl->clas_content) evas_object_del(ovl->clas_content); + if (ovl->clas_icon) evas_object_del(ovl->clas_icon); + if (ovl->layout) evas_object_del(ovl->layout); + free(ovl); +} + +static Overlay_Default * +_overlay_default_new(Elm_Map_Overlay *overlay, double lon, double lat, Color c, double scale) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(overlay, NULL); + + Overlay_Default *ovl = ELM_NEW(Overlay_Default); + ovl->wd = overlay->wd; + _edj_overlay_size_get(ovl->wd, &(ovl->w), &(ovl->h)); + ovl->w *= scale; + ovl->h *= scale; + ovl->layout = elm_layout_add(ovl->wd->obj); + evas_object_smart_member_add(ovl->layout, ovl->wd->pan_smart); + evas_object_stack_above(ovl->layout, ovl->wd->sep_maps_overlays); + elm_layout_theme_set(ovl->layout, "map/marker", "radio", + elm_widget_style_get(ovl->wd->obj)); + evas_object_event_callback_add(ovl->layout, EVAS_CALLBACK_MOUSE_DOWN, + _overlay_clicked_cb, overlay); + ovl->lon = lon; + ovl->lat = lat; + _overlay_default_color_update(ovl, c); + return ovl; +} + +static void +_overlay_group_hide(Overlay_Group *grp) +{ + EINA_SAFETY_ON_NULL_RETURN(grp); + if (grp->ovl) _overlay_default_hide(grp->ovl); +} + +static void +_overlay_group_show(Overlay_Group *grp) +{ + EINA_SAFETY_ON_NULL_RETURN(grp); + if (grp->ovl) _overlay_default_show(grp->ovl); +} + +static void +_overlay_group_coord_member_update(Overlay_Group *grp, Evas_Coord x, Evas_Coord y, Eina_List *members) +{ + EINA_SAFETY_ON_NULL_RETURN(grp); + if (!grp->ovl) return; + char text[32]; + + _overlay_default_coord_set(grp->ovl, x, y); + if (grp->members) eina_list_free(grp->members); + grp->members = members; + snprintf(text, sizeof(text), "%d", eina_list_count(members)); + _overlay_default_layout_text_update(grp->ovl, text); +} + +static void +_overlay_group_region_get(Overlay_Group *grp, double *lon, double *lat) +{ + EINA_SAFETY_ON_NULL_RETURN(grp); + Evas_Coord xx, yy; + _overlay_default_coord_get(grp->ovl, &xx, &yy, NULL, NULL); + _coord_to_canvas(grp->wd, xx, yy, &xx, &yy); + elm_map_canvas_to_region_convert(grp->wd->obj, xx, yy, lon, lat); +} + +static void +_overlay_group_icon_update(Overlay_Group *grp, const Evas_Object *icon) +{ + EINA_SAFETY_ON_NULL_RETURN(grp); + if (grp->ovl) _overlay_default_icon_update(grp->ovl, + _icon_dup(icon, grp->wd->obj)); +} + +static void +_overlay_group_content_update(Overlay_Group *grp __UNUSED__, const Evas_Object *content __UNUSED__) +{ + EINA_SAFETY_ON_NULL_RETURN(grp); + // Evas_Object can not be duplicated. + //_overlay_default_content_update(grp->ovl, _content_dup(content)); + return; +} + +static void +_overlay_group_color_update(Overlay_Group *grp, Color c) +{ + EINA_SAFETY_ON_NULL_RETURN(grp); + _overlay_default_color_update(grp->ovl, c); +} + +static void +_overlay_group_cb_set(Overlay_Group *grp, Elm_Map_Overlay_Get_Cb cb, void *data) +{ + EINA_SAFETY_ON_NULL_RETURN(grp); + grp->overlay->cb = cb; + grp->overlay->data = data; +} + +static void +_overlay_group_free(Overlay_Group *grp) +{ + EINA_SAFETY_ON_NULL_RETURN(grp); + if (grp->overlay) free(grp->overlay); + if (grp->ovl) _overlay_default_free(grp->ovl); + if (grp->members) eina_list_free(grp->members); + free(grp); +} + +static Overlay_Group * +_overlay_group_new(Widget_Data *wd) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); + + Overlay_Group *grp = ELM_NEW(Overlay_Group); + grp->wd = wd; + grp->overlay = ELM_NEW(Elm_Map_Overlay); // this is a virtual overlay + grp->overlay->wd = wd; + grp->overlay->type = ELM_MAP_OVERLAY_TYPE_GROUP; + grp->overlay->ovl = grp; + Color c = {0x90, 0xee, 0x90, 0xff}; + grp->ovl = _overlay_default_new(grp->overlay, -1, -1, c, 2); + return grp; +} + +static void +_overlay_class_cb_set(Overlay_Class *ovl, Elm_Map_Overlay_Get_Cb cb, void *data) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + + Eina_List *l; + Elm_Map_Overlay *overlay; + + // Update class members' callbacks + EINA_LIST_FOREACH(ovl->members, l, overlay) + _overlay_group_cb_set(overlay->grp, cb, data); +} + +static void +_overlay_class_icon_update(Overlay_Class *ovl, Evas_Object *icon) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + + Eina_List *l; + Elm_Map_Overlay *overlay; + if (ovl->icon == icon) return; + if (ovl->icon) evas_object_del(ovl->icon); + ovl->icon = icon; + + // Update class members' class icons + EINA_LIST_FOREACH(ovl->members, l, overlay) + { + _overlay_group_icon_update(overlay->grp, icon); + + if (overlay->type == ELM_MAP_OVERLAY_TYPE_DEFAULT) + _overlay_default_clas_icon_update(overlay->ovl, icon); + + } +} + +static void +_overlay_class_content_update(Overlay_Class *ovl, Evas_Object *content) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + + Eina_List *l; + Elm_Map_Overlay *overlay; + if (ovl->content == content) return; + if (ovl->content) evas_object_del(ovl->content); + ovl->content = content; + + // Update class members' class contents + EINA_LIST_FOREACH(ovl->members, l, overlay) + { + _overlay_group_content_update(overlay->grp, content); + + if (overlay->type == ELM_MAP_OVERLAY_TYPE_DEFAULT) + _overlay_default_clas_content_update(overlay->ovl, content); + } +} + +static void +_overlay_class_color_update(Overlay_Class *ovl, Color c) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + + Eina_List *l; + Elm_Map_Overlay *overlay; + + // Update class members' class contents + EINA_LIST_FOREACH(ovl->members, l, overlay) + _overlay_group_color_update(overlay->grp, c); +} + +static void +_overlay_class_free(Overlay_Class *clas) +{ + EINA_SAFETY_ON_NULL_RETURN(clas); + + Eina_List *l; + Elm_Map_Overlay *overlay; + + // Update class members' class contents + EINA_LIST_FOREACH(clas->members, l, overlay) + { + overlay->grp->clas = NULL; + _overlay_group_content_update(overlay->grp, NULL); + _overlay_group_icon_update(overlay->grp, NULL); + + if (overlay->type == ELM_MAP_OVERLAY_TYPE_DEFAULT) + { + _overlay_default_clas_content_update(overlay->ovl, NULL); + _overlay_default_clas_icon_update(overlay->ovl, NULL); + } + } + if (clas->icon) evas_object_del(clas->icon); + if (clas->members) eina_list_free(clas->members); + free(clas); +} + +static Overlay_Class * +_overlay_class_new(Widget_Data *wd) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); + Overlay_Class *ovl = ELM_NEW(Overlay_Class); + ovl->wd = wd; + ovl->icon = NULL; + ovl->zoom_max = OVERLAY_CLASS_ZOOM_MAX; + return ovl; +} + +static void +_overlay_bubble_hide(Overlay_Bubble *bubble) +{ + EINA_SAFETY_ON_NULL_RETURN(bubble); + if (bubble->obj) evas_object_hide(bubble->obj); +} + +static void +_overlay_bubble_coord_update(Overlay_Bubble *bubble) +{ + EINA_SAFETY_ON_NULL_RETURN(bubble); + if (!(bubble->pobj)) + { + _region_to_coord_convert(bubble->wd, bubble->lon, bubble->lat, + bubble->wd->size.w, &bubble->x, &bubble->y); + } +} + +static void +_overlay_bubble_coord_get(Overlay_Bubble *bubble, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) +{ + EINA_SAFETY_ON_NULL_RETURN(bubble); + if (!(bubble->pobj)) + { + if (x) *x = bubble->x; + if (y) *y = bubble->y; + if (w) *w = bubble->w; + if (h) *h = bubble->h; + } + else + { + if (x) *x = 0; + if (y) *y = 0; + if (w) *w = 0; + if (h) *h = 0; + } +} + +static void +_overlay_bubble_show(Overlay_Bubble *bubble) +{ + EINA_SAFETY_ON_NULL_RETURN(bubble); + if (!(bubble->pobj)) + { + _coord_to_canvas(bubble->wd, bubble->x, bubble->y, + &(bubble->x), &(bubble->y)); + _obj_place(bubble->obj, bubble->x - (bubble->w /2), + bubble->y - (bubble->h /2), bubble->w, bubble->h); + } +} + +static void +_overlay_bubble_chase(Overlay_Bubble *bubble) +{ + EINA_SAFETY_ON_NULL_RETURN(bubble); + EINA_SAFETY_ON_NULL_RETURN(bubble->pobj); + + Evas_Coord x, y, w; + evas_object_geometry_get(bubble->pobj, &x, &y, &w, NULL); + x = x + (w / 2) - (bubble->w / 2); + y = y - bubble->h; + _obj_place(bubble->obj, x, y, bubble->w, bubble->h); + evas_object_raise(bubble->obj); +} + +static void +_overlay_bubble_hide_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + EINA_SAFETY_ON_NULL_RETURN(data); + _overlay_bubble_hide(data); +} + +static void +_overlay_bubble_chase_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + EINA_SAFETY_ON_NULL_RETURN(data); + _overlay_bubble_chase(data); +} + +static void +_overlay_bubble_free(Overlay_Bubble* bubble) +{ + EINA_SAFETY_ON_NULL_RETURN(bubble); + + evas_object_del(bubble->bx); + evas_object_del(bubble->sc); + evas_object_del(bubble->obj); + if (bubble->pobj) + { + evas_object_event_callback_del_full(bubble->pobj, EVAS_CALLBACK_HIDE, + _overlay_bubble_hide_cb, bubble); + evas_object_event_callback_del_full(bubble->pobj, EVAS_CALLBACK_SHOW, + _overlay_bubble_chase_cb, bubble); + evas_object_event_callback_del_full(bubble->pobj, EVAS_CALLBACK_MOVE, + _overlay_bubble_chase_cb, bubble); + } + free(bubble); +} + +static Overlay_Bubble* +_overlay_bubble_new(Elm_Map_Overlay *overlay) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(overlay, NULL); + + Evas_Coord h; + const char *s; + Overlay_Bubble *bubble = ELM_NEW(Overlay_Bubble); + bubble->wd = overlay->wd; + + bubble->obj = edje_object_add(evas_object_evas_get(overlay->wd->obj)); + _elm_theme_object_set(overlay->wd->obj, bubble->obj , "map", "marker_bubble", + elm_widget_style_get(overlay->wd->obj)); + evas_object_event_callback_add(bubble->obj, EVAS_CALLBACK_MOUSE_UP, + _overlay_bubble_chase_cb, bubble); + evas_object_event_callback_add(bubble->obj, EVAS_CALLBACK_MOUSE_DOWN, + _overlay_clicked_cb, overlay); + + bubble->sc = elm_scroller_add(bubble->obj); + elm_widget_style_set(bubble->sc, "map_bubble"); + elm_scroller_content_min_limit(bubble->sc, EINA_FALSE, EINA_TRUE); + elm_scroller_policy_set(bubble->sc, ELM_SCROLLER_POLICY_AUTO, + ELM_SCROLLER_POLICY_OFF); + elm_scroller_bounce_set(bubble->sc, _elm_config->thumbscroll_bounce_enable, + EINA_FALSE); + edje_object_part_swallow(bubble->obj, "elm.swallow.content", bubble->sc); + + bubble->bx = elm_box_add(bubble->sc); + evas_object_size_hint_align_set(bubble->bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bubble->bx, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_box_horizontal_set(bubble->bx, EINA_TRUE); + elm_object_content_set(bubble->sc, bubble->bx); + + s = edje_object_data_get(bubble->obj, "size_w"); + if (s) bubble->w = atoi(s); + else bubble->w = 0; + + edje_object_size_min_calc(bubble->obj, NULL, &(bubble->h)); + s = edje_object_data_get(bubble->obj, "size_h"); + if (s) h = atoi(s); + else h = 0; + if (bubble->h < h) bubble->h = h; + + bubble->lon = -1; + bubble->lat = -1; + bubble->x = -1; + bubble->y = -1; + return bubble; +} + +static void +_overlay_route_color_update(Overlay_Route *ovl, Color c) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + evas_object_color_set(ovl->obj, c.r, c.g, c.b, c.a); +} + +static void +_overlay_route_hide(Overlay_Route *ovl) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + evas_object_hide(ovl->obj); +} + +static void +_overlay_route_show(Overlay_Route *r) +{ + EINA_SAFETY_ON_NULL_RETURN(r); + EINA_SAFETY_ON_NULL_RETURN(r->wd); + + Eina_List *l; + Path *p; + Path_Node *n; + + evas_object_polygon_points_clear(r->obj); + EINA_LIST_FOREACH(r->nodes, l, n) + { + p = eina_list_nth(r->paths, n->idx); + if (!p) continue; + _region_to_coord_convert(r->wd, n->pos.lon, n->pos.lat, r->wd->size.w, + &p->x, &p->y); + _coord_to_canvas(r->wd, p->x, p->y, &p->x, &p->y); + } + EINA_LIST_FOREACH(r->paths, l, p) + evas_object_polygon_point_add(r->obj, p->x - 3, p->y - 3); + + EINA_LIST_REVERSE_FOREACH(r->paths, l, p) + evas_object_polygon_point_add(r->obj, p->x + 3, p->y + 3); + evas_object_show(r->obj); +} + +static void +_overlay_route_free(Overlay_Route* route) +{ + EINA_SAFETY_ON_NULL_RETURN(route); + Path *p; + Path_Node *n; + + evas_object_del(route->obj); + EINA_LIST_FREE(route->paths, p) free(p); + EINA_LIST_FREE(route->nodes, n) + { + if (n->pos.address) eina_stringshare_del(n->pos.address); + free(n); + } + free(route); +} + +static Overlay_Route * +_overlay_route_new(Widget_Data *wd, const Elm_Map_Route *route, Color c) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(route, NULL); + + Eina_List *l; + Path_Node *n; + + Overlay_Route *ovl = ELM_NEW(Overlay_Route); + ovl->wd = wd; + ovl->obj = evas_object_polygon_add(evas_object_evas_get(wd->obj)); + evas_object_smart_member_add(ovl->obj, wd->pan_smart); + _overlay_route_color_update(ovl, c); + + EINA_LIST_FOREACH(route->nodes, l, n) + { + Path *path; + Path_Node *node; + + node = ELM_NEW(Path_Node); + node->idx = n->idx; + node->pos.lon = n->pos.lon; + node->pos.lat = n->pos.lat; + if (n->pos.address) node->pos.address = strdup(n->pos.address); + ovl->nodes = eina_list_append(ovl->nodes, node); + + path = ELM_NEW(Path); + ovl->paths = eina_list_append(ovl->paths, path); + } + return ovl; +} + +static void +_overlay_line_color_update(Overlay_Line *ovl, Color c) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + evas_object_color_set(ovl->obj, c.r, c.g, c.b, c.a); +} + +static void +_overlay_line_hide(Overlay_Line *ovl) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + if (ovl->obj) evas_object_hide(ovl->obj); +} + +static void +_overlay_line_show(Overlay_Line *ovl) +{ + Evas_Coord fx, fy, tx, ty; + Widget_Data *wd = ovl->wd; + + _region_to_coord_convert(wd, ovl->flon, ovl->flat, wd->size.w, &fx, &fy); + _region_to_coord_convert(wd, ovl->tlon, ovl->tlat, wd->size.w, &tx, &ty); + _coord_to_canvas(wd, fx, fy, &fx, &fy); + _coord_to_canvas(wd, tx, ty, &tx, &ty); + evas_object_line_xy_set(ovl->obj, fx, fy, tx, ty); + evas_object_show(ovl->obj); +} + +static void +_overlay_line_free(Overlay_Line *ovl) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + evas_object_del(ovl->obj); + free(ovl); +} + +static Overlay_Line * +_overlay_line_new(Widget_Data *wd, double flon, double flat, double tlon, double tlat, Color c) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); + + Overlay_Line *ovl = ELM_NEW(Overlay_Line); + ovl->wd = wd; + ovl->flon = flon; + ovl->flat = flat; + ovl->tlon = tlon; + ovl->tlat = tlat; + ovl->obj = evas_object_line_add(evas_object_evas_get(wd->obj)); + evas_object_smart_member_add(ovl->obj, wd->pan_smart); + _overlay_line_color_update(ovl, c); + return ovl; +} + +static void +_overlay_polygon_color_update(Overlay_Polygon *ovl, Color c) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + evas_object_color_set(ovl->obj, c.r, c.g, c.b, c.a); +} + +static void +_overlay_polygon_hide(Overlay_Polygon *ovl) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + if (ovl->obj) evas_object_hide(ovl->obj); +} + +static void +_overlay_polygon_show(Overlay_Polygon *ovl) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + Eina_List *l; + Region *r; + Widget_Data *wd = ovl->wd; + + evas_object_polygon_points_clear(ovl->obj); + EINA_LIST_FOREACH(ovl->regions, l, r) + { + Evas_Coord x, y; + _region_to_coord_convert(wd, r->lon, r->lat, wd->size.w, &x, &y); + _coord_to_canvas(wd, x, y, &x, &y); + evas_object_polygon_point_add(ovl->obj, x, y); + } + evas_object_show(ovl->obj); +} + +static void +_overlay_polygon_free(Overlay_Polygon *ovl) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + Region *r; + evas_object_del(ovl->obj); + EINA_LIST_FREE(ovl->regions, r) free(r); + free(ovl); +} + +static Overlay_Polygon * +_overlay_polygon_new(Widget_Data *wd, Color c) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); + + Overlay_Polygon *ovl = ELM_NEW(Overlay_Polygon); + ovl->wd = wd; + ovl->obj = evas_object_polygon_add(evas_object_evas_get(wd->obj)); + evas_object_smart_member_add(ovl->obj, wd->pan_smart); + _overlay_polygon_color_update(ovl, c); + return ovl; +} + +static void +_overlay_circle_color_update(Overlay_Circle *ovl, Color c) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + Evas_Object *obj = elm_layout_edje_get(ovl->obj); + evas_object_color_set(obj, c.r, c.g, c.b, c.a); +} + +static void +_overlay_circle_hide(Overlay_Circle *ovl) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + if (ovl->obj) evas_object_hide(ovl->obj); +} + +static void +_overlay_circle_show(Overlay_Circle *ovl) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + double r; + Evas_Coord x, y; + Widget_Data *wd = ovl->wd; + + r = (ovl->ratio) * wd->size.w; + _region_to_coord_convert(wd, ovl->lon, ovl->lat, wd->size.w, &x, &y); + _coord_to_canvas(wd, x, y, &x, &y); + _obj_place(ovl->obj, x - r, y - r, r * 2, r * 2); +} + +static void +_overlay_circle_free(Overlay_Circle *ovl) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + evas_object_del(ovl->obj); + free(ovl); +} + +static Overlay_Circle * +_overlay_circle_new(Widget_Data *wd, double lon, double lat, double radius, Color c) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); + + Overlay_Circle *ovl = ELM_NEW(Overlay_Circle); + ovl->wd = wd; + ovl->lon = lon; + ovl->lat = lat; + ovl->radius = radius; + ovl->ratio = radius / wd->size.w; + + ovl->obj = elm_layout_add(wd->obj); + evas_object_smart_member_add(ovl->obj, wd->pan_smart); + evas_object_stack_above(ovl->obj, wd->sep_maps_overlays); + elm_layout_theme_set(ovl->obj, "map/circle", "base", + elm_widget_style_get(wd->obj)); + _overlay_circle_color_update(ovl, c); + return ovl; +} + +static void +_overlay_scale_color_update(Overlay_Scale *ovl, Color c) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + evas_object_color_set(ovl->obj, c.r, c.g, c.b, c.a); +} + +static void +_overlay_scale_hide(Overlay_Scale *ovl) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + if (ovl->obj) evas_object_hide(ovl->obj); +} + + static void +_overlay_scale_show(Overlay_Scale *ovl) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + Evas_Coord w; + double lon, lat; + double text; + char buf[32]; + double meter; + Widget_Data *wd = ovl->wd; + + if ((int)sizeof(_scale_tb) <= wd->zoom) + { + ERR("Zoom level is too high"); + return; + } + + elm_map_region_get(wd->obj, &lon, &lat); + meter = wd->src_tile->scale_cb(wd->obj, lon, lat, wd->zoom); + + w = (_scale_tb[wd->zoom] / meter) * (wd->zoom_detail - wd->zoom + 1); + + text = _scale_tb[wd->zoom]/1000; + if (text < 1) snprintf(buf, sizeof(buf), "%d m", (int)(text * 1000)); + else snprintf(buf, sizeof(buf), "%d km", (int)text); + + edje_object_part_text_escaped_set(elm_layout_edje_get(ovl->obj), "elm.text", buf); + _obj_place(ovl->obj, ovl->x, ovl->y, w, ovl->h); +} + + static void +_overlay_scale_free(Overlay_Scale *ovl) +{ + EINA_SAFETY_ON_NULL_RETURN(ovl); + evas_object_del(ovl->obj); + free(ovl); +} + +static Overlay_Scale * +_overlay_scale_new(Widget_Data *wd, Evas_Coord x, Evas_Coord y, Color c) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); + const char *s; + + Overlay_Scale *ovl = ELM_NEW(Overlay_Scale); + ovl->wd = wd; + ovl->x = x; + ovl->y = y; + + ovl->obj = elm_layout_add(wd->obj); + evas_object_smart_member_add(ovl->obj, wd->pan_smart); + evas_object_stack_above(ovl->obj, wd->sep_maps_overlays); + elm_layout_theme_set(ovl->obj, "map/scale", "base", + elm_widget_style_get(wd->obj)); + s = edje_object_data_get(elm_layout_edje_get(ovl->obj), "size_w"); + if (s) ovl->w = atoi(s); + else ovl->w = 100; + s = edje_object_data_get(elm_layout_edje_get(ovl->obj), "size_h"); + if (s) ovl->h = atoi(s); + else ovl->h = 60; + _overlay_scale_color_update(ovl, c); + return ovl; +} + +static void +_overlay_grouping(Eina_List *clas_membs, Elm_Map_Overlay *boss) +{ + EINA_SAFETY_ON_NULL_RETURN(clas_membs); + EINA_SAFETY_ON_NULL_RETURN(boss); + + Eina_List *l; + Eina_List *grp_membs = NULL; + Elm_Map_Overlay *memb; + + int sum_x = 0, sum_y = 0, cnt = 0; + Evas_Coord bx = 0, by = 0, bw = 0, bh = 0; + + if (boss->type == ELM_MAP_OVERLAY_TYPE_DEFAULT) + _overlay_default_coord_get(boss->ovl, &bx, &by, &bw, &bh); + else if (boss->type == ELM_MAP_OVERLAY_TYPE_BUBBLE) + _overlay_bubble_coord_get(boss->ovl, &bx, &by, &bw, &bh); + + EINA_LIST_FOREACH(clas_membs, l, memb) + { + Evas_Coord x = 0, y = 0, w = 0, h = 0; + + if (boss == memb || memb->grp->in) continue; + if ((memb->hide) || (memb->zoom_min > memb->wd->zoom)) continue; + + if (memb->type == ELM_MAP_OVERLAY_TYPE_DEFAULT) + _overlay_default_coord_get(memb->ovl, &x, &y, &w, &h); + else if (memb->type == ELM_MAP_OVERLAY_TYPE_BUBBLE) + _overlay_bubble_coord_get(memb->ovl, &x, &y, &w, &h); + + if (bw <= 0 || bh <= 0 || w <= 0 || h <= 0) continue; + if (ELM_RECTS_INTERSECT(x, y, w, h, bx, by, + bw * OVERLAY_GROUPING_SCALE, + bh * OVERLAY_GROUPING_SCALE)) + { + // Join group. + memb->grp->boss = EINA_FALSE; + memb->grp->in = EINA_TRUE; + sum_x += x; + sum_y += y; + cnt++; + grp_membs = eina_list_append(grp_membs, memb); + } + } + + if (cnt >= 1) + { + // Mark as boss + boss->grp->boss = EINA_TRUE; + boss->grp->in = EINA_TRUE; + sum_x = (sum_x + bx) / (cnt + 1); + sum_y = (sum_y + by) / (cnt + 1); + grp_membs = eina_list_append(grp_membs, boss); + _overlay_group_coord_member_update(boss->grp, sum_x, sum_y, grp_membs); + } +} + +static void +_overlay_show(Elm_Map_Overlay *overlay) +{ + Widget_Data *wd = overlay->wd; + Eina_Bool hide = EINA_FALSE; + + if (overlay->type == ELM_MAP_OVERLAY_TYPE_CLASS) return; + + if (overlay->paused) return; + if ((overlay->grp->clas) && (overlay->grp->clas->paused)) return; + + if (((overlay->grp->in) || (overlay->hide) || + (overlay->zoom_min > wd->zoom))) + hide = EINA_TRUE; + if ((overlay->grp->clas) && ((overlay->grp->clas->hide) || + (overlay->grp->clas->zoom_min > wd->zoom))) + hide = EINA_TRUE; + + if (overlay->type == ELM_MAP_OVERLAY_TYPE_DEFAULT) + { + if (hide) _overlay_default_hide(overlay->ovl); + else _overlay_default_show(overlay->ovl); + } + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_BUBBLE) + { + if (hide) _overlay_bubble_hide(overlay->ovl); + else _overlay_bubble_show(overlay->ovl); + } + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_ROUTE) + { + if (hide) _overlay_route_hide(overlay->ovl); + else _overlay_route_show(overlay->ovl); + } + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_LINE) + { + if (hide) _overlay_line_hide(overlay->ovl); + else _overlay_line_show(overlay->ovl); + } + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_POLYGON) + { + if (hide) _overlay_polygon_hide(overlay->ovl); + else _overlay_polygon_show(overlay->ovl); + } + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_CIRCLE) + { + if (hide) _overlay_circle_hide(overlay->ovl); + else _overlay_circle_show(overlay->ovl); + } + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_SCALE) + { + if (hide) _overlay_scale_hide(overlay->ovl); + else _overlay_scale_show(overlay->ovl); + } +} + +static void +_overlay_place(Widget_Data *wd) +{ + EINA_SAFETY_ON_NULL_RETURN(wd); + + Eina_List *l, *ll; + Elm_Map_Overlay *overlay; + + // Reset group & Update overlays coord + EINA_LIST_FOREACH(wd->overlays, l, overlay) + { + if (overlay->type == ELM_MAP_OVERLAY_TYPE_CLASS) continue; + overlay->grp->in = EINA_FALSE; + overlay->grp->boss = EINA_FALSE; + + if (overlay->type == ELM_MAP_OVERLAY_TYPE_DEFAULT) + _overlay_default_coord_update(overlay->ovl); + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_BUBBLE) + _overlay_bubble_coord_update(overlay->ovl); + } + + // Classify into group boss or follwer + EINA_LIST_FOREACH(wd->overlays, l, overlay) + { + Elm_Map_Overlay *boss; + Overlay_Class *clas; + + if (overlay->type != ELM_MAP_OVERLAY_TYPE_CLASS) continue; + if (overlay->hide || (overlay->zoom_min > wd->zoom)) continue; + + clas = overlay->ovl; + if (clas->zoom_max < wd->zoom) continue; + EINA_LIST_FOREACH(clas->members, ll, boss) + { + if (boss->type == ELM_MAP_OVERLAY_TYPE_CLASS) continue; + if (boss->hide || (boss->zoom_min > wd->zoom)) continue; + if (boss->grp->in) continue; + _overlay_grouping(clas->members, boss); + } + } + + // Place overlays + EINA_LIST_FOREACH(wd->overlays, l, overlay) _overlay_show(overlay); + + // Place group overlays on top of overlays + EINA_LIST_FOREACH(wd->overlays, l, overlay) + { + if (overlay->type == ELM_MAP_OVERLAY_TYPE_CLASS) continue; + if (overlay->grp->boss) _overlay_group_show(overlay->grp); + else _overlay_group_hide(overlay->grp); + } +} + +static Evas_Object * +_overlay_obj_get(const Elm_Map_Overlay *overlay) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(overlay, NULL); + if (overlay->type == ELM_MAP_OVERLAY_TYPE_GROUP) + { + Overlay_Group *ovl = overlay->ovl; + Overlay_Default *df = ovl->ovl; + return df->layout; + } + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_DEFAULT) + { + Overlay_Default *ovl = overlay->ovl; + return ovl->layout; + } + else + { + ERR("Not supported overlay type: %d", overlay->type); + return NULL; + } +} + +static void +_overlays_show(void *data) +{ + EINA_SAFETY_ON_NULL_RETURN(data); + Delayed_Data *dd = data; + + int zoom, zoom_max; + double max_lon, min_lon, max_lat, min_lat; + Evas_Coord vw, vh; + + _region_max_min_get(dd->overlays, &max_lon, &min_lon, &max_lat, &min_lat); + dd->lon = (max_lon + min_lon) / 2; + dd->lat = (max_lat + min_lat) / 2; + + zoom = dd->wd->src_tile->zoom_min; + _viewport_coord_get(dd->wd, NULL, NULL, &vw, &vh); + if (dd->wd->src_tile->zoom_max < dd->wd->zoom_max) + zoom_max = dd->wd->src_tile->zoom_max; + else zoom_max = dd->wd->zoom_max; + while (zoom <= zoom_max) + { + Evas_Coord size, max_x, max_y, min_x, min_y; + size = pow(2.0, zoom) * dd->wd->tsize; + _region_to_coord_convert(dd->wd, min_lon, max_lat, size, &min_x, &max_y); + _region_to_coord_convert(dd->wd, max_lon, min_lat, size, &max_x, &min_y); + if ((max_x - min_x) > vw || (max_y - min_y) > vh) break; + zoom++; + } + zoom--; + + zoom_do(dd->wd, zoom); + _region_show(dd); + evas_object_smart_changed(dd->wd->pan_smart); +} + +static void +_pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y) +{ + Pan *sd = evas_object_smart_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(sd); + if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return; + + sd->wd->pan_x = x; + sd->wd->pan_y = y; + evas_object_smart_changed(obj); +} + +static void +_pan_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y) +{ + Pan *sd = evas_object_smart_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(sd); + if (x) *x = sd->wd->pan_x; + if (y) *y = sd->wd->pan_y; +} + +static void +_pan_max_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y) +{ + Pan *sd = evas_object_smart_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(sd); + Evas_Coord ow, oh; + evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); + ow = sd->wd->size.w - ow; + oh = sd->wd->size.h - oh; + if (ow < 0) ow = 0; + if (oh < 0) oh = 0; + if (x) *x = ow; + if (y) *y = oh; +} + +static void +_pan_min_get(Evas_Object *obj __UNUSED__, Evas_Coord *x, Evas_Coord *y) +{ + if (x) *x = 0; + if (y) *y = 0; +} + +static void +_pan_child_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) +{ + Pan *sd = evas_object_smart_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(sd); + if (w) *w = sd->wd->size.w; + if (h) *h = sd->wd->size.h; +} + +static void +_pan_add(Evas_Object *obj) +{ + Pan *sd; + Evas_Object_Smart_Clipped_Data *cd; + parent_sc.add(obj); + cd = evas_object_smart_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(cd); + sd = ELM_NEW(Pan); + sd->__clipped_data = *cd; + free(cd); + evas_object_smart_data_set(obj, sd); +} + +static void +_pan_resize(Evas_Object *obj, Evas_Coord w __UNUSED__, Evas_Coord h __UNUSED__) +{ + Pan *sd = evas_object_smart_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(sd); + + _sizing_eval(sd->wd); + elm_map_zoom_mode_set(sd->wd->obj, sd->wd->mode); + evas_object_smart_changed(obj); +} + +static void +_pan_calculate(Evas_Object *obj) +{ + Pan *sd = evas_object_smart_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(sd); + + Evas_Coord w, h; + evas_object_geometry_get(obj, NULL, NULL, &w, &h); + if (w <= 0 || h <= 0) return; + + _grid_place(sd->wd); + _overlay_place(sd->wd); + _track_place(sd->wd); + _delayed_do(sd->wd); +} + +static void +_pan_move(Evas_Object *obj, Evas_Coord x __UNUSED__, Evas_Coord y __UNUSED__) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + evas_object_smart_changed(obj); +} + +static void +_hold_on(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + EINA_SAFETY_ON_NULL_RETURN(data); + Widget_Data *wd = data; + elm_smart_scroller_hold_set(wd->scr, 1); +} + +static void +_hold_off(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + EINA_SAFETY_ON_NULL_RETURN(data); + Widget_Data *wd = data; + elm_smart_scroller_hold_set(wd->scr, 0); +} + +static void +_freeze_on(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + EINA_SAFETY_ON_NULL_RETURN(data); + Widget_Data *wd = data; + elm_smart_scroller_freeze_set(wd->scr, 1); +} + +static void +_freeze_off(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + EINA_SAFETY_ON_NULL_RETURN(data); + Widget_Data *wd = data; + elm_smart_scroller_freeze_set(wd->scr, 0); +} + +static Eina_Bool +cb_dump_name_attrs(void *data, const char *key, const char *value) +{ + Name_Dump *dump = (Name_Dump*)data; + if (!dump) return EINA_FALSE; + + if (!strncmp(key, NOMINATIM_ATTR_LON, sizeof(NOMINATIM_ATTR_LON))) dump->lon = atof(value); + else if (!strncmp(key, NOMINATIM_ATTR_LAT, sizeof(NOMINATIM_ATTR_LAT))) dump->lat = atof(value); + + return EINA_TRUE; +} + +static Eina_Bool +cb_route_dump(void *data, Eina_Simple_XML_Type type, const char *value, unsigned offset __UNUSED__, unsigned length) +{ + Route_Dump *dump = data; + if (!dump) return EINA_FALSE; + + switch (type) + { + case EINA_SIMPLE_XML_OPEN: + case EINA_SIMPLE_XML_OPEN_EMPTY: + { + const char *attrs; + + attrs = eina_simple_xml_tag_attributes_find(value, length); + if (!attrs) + { + if (!strncmp(value, YOURS_DISTANCE, length)) dump->id = ROUTE_XML_DISTANCE; + else if (!strncmp(value, YOURS_DESCRIPTION, length)) dump->id = ROUTE_XML_DESCRIPTION; + else if (!strncmp(value, YOURS_COORDINATES, length)) dump->id = ROUTE_XML_COORDINATES; + else dump->id = ROUTE_XML_NONE; + } + } + break; + case EINA_SIMPLE_XML_DATA: + { + char *buf = malloc(length); + if (!buf) return EINA_FALSE; + snprintf(buf, length, "%s", value); + if (dump->id == ROUTE_XML_DISTANCE) dump->distance = atof(buf); + else if (!(dump->description) && (dump->id == ROUTE_XML_DESCRIPTION)) dump->description = strdup(buf); + else if (dump->id == ROUTE_XML_COORDINATES) dump->coordinates = strdup(buf); + free(buf); + } + break; + default: + break; + } + + return EINA_TRUE; +} + +static Eina_Bool +cb_name_dump(void *data, Eina_Simple_XML_Type type, const char *value, unsigned offset __UNUSED__, unsigned length) +{ + Name_Dump *dump = data; + if (!dump) return EINA_FALSE; + + switch (type) + { + case EINA_SIMPLE_XML_OPEN: + case EINA_SIMPLE_XML_OPEN_EMPTY: + { + const char *attrs; + attrs = eina_simple_xml_tag_attributes_find(value, length); + if (attrs) + { + if (!strncmp(value, NOMINATIM_RESULT, sizeof(NOMINATIM_RESULT) - 1)) dump->id = NAME_XML_NAME; + else dump->id = NAME_XML_NONE; + + eina_simple_xml_attributes_parse + (attrs, length - (attrs - value), cb_dump_name_attrs, dump); + } + } + break; + case EINA_SIMPLE_XML_DATA: + { + char *buf = malloc(length + 1); + if (!buf) return EINA_FALSE; + snprintf(buf, length + 1, "%s", value); + if (dump->id == NAME_XML_NAME) dump->address = strdup(buf); + free(buf); + } + break; + default: + break; + } + + return EINA_TRUE; +} + +static void +_kml_parse(Elm_Map_Route *r) +{ + EINA_SAFETY_ON_NULL_RETURN(r); + EINA_SAFETY_ON_NULL_RETURN(r->fname); + + FILE *f; + char **str; + unsigned int ele, idx; + double lon, lat; + + Route_Dump dump = {0, r->fname, 0.0, NULL, NULL}; + + f = fopen(r->fname, "rb"); + if (f) + { + long sz; + + fseek(f, 0, SEEK_END); + sz = ftell(f); + if (sz > 0) + { + char *buf; + + fseek(f, 0, SEEK_SET); + buf = malloc(sz); + if (buf) + { + if (fread(buf, 1, sz, f)) + { + eina_simple_xml_parse(buf, sz, EINA_TRUE, cb_route_dump, + &dump); + free(buf); + } + } + } + fclose(f); + + if (dump.distance) r->info.distance = dump.distance; + if (dump.description) + { + eina_stringshare_replace(&r->info.waypoints, dump.description); + str = eina_str_split_full(dump.description, "\n", 0, &ele); + r->info.waypoint_count = ele; + for (idx = 0; idx < ele; idx++) + { + Path_Waypoint *wp = ELM_NEW(Path_Waypoint); + if (wp) + { + wp->wd = r->wd; + wp->point = eina_stringshare_add(str[idx]); + DBG("%s", str[idx]); + r->waypoint = eina_list_append(r->waypoint, wp); + } + } + if (str && str[0]) + { + free(str[0]); + free(str); + } + } + else WRN("description is not found !"); + + if (dump.coordinates) + { + eina_stringshare_replace(&r->info.nodes, dump.coordinates); + str = eina_str_split_full(dump.coordinates, "\n", 0, &ele); + r->info.node_count = ele; + for (idx = 0; idx < ele; idx++) + { + sscanf(str[idx], "%lf,%lf", &lon, &lat); + Path_Node *n = ELM_NEW(Path_Node); + if (n) + { + n->wd = r->wd; + n->pos.lon = lon; + n->pos.lat = lat; + n->idx = idx; + DBG("%lf:%lf", lon, lat); + n->pos.address = NULL; + r->nodes = eina_list_append(r->nodes, n); + } + } + if (str && str[0]) + { + free(str[0]); + free(str); + } + } + } +} + +static void +_name_parse(Elm_Map_Name *n) +{ + EINA_SAFETY_ON_NULL_RETURN(n); + EINA_SAFETY_ON_NULL_RETURN(n->fname); + + FILE *f; + + Name_Dump dump = {0, NULL, 0.0, 0.0}; + + f = fopen(n->fname, "rb"); + if (f) + { + long sz; + + fseek(f, 0, SEEK_END); + sz = ftell(f); + if (sz > 0) + { + char *buf; + + fseek(f, 0, SEEK_SET); + buf = malloc(sz); + if (buf) + { + if (fread(buf, 1, sz, f)) + { + eina_simple_xml_parse(buf, sz, EINA_TRUE, cb_name_dump, &dump); + free(buf); + } + } + } + fclose(f); + + if (dump.address) + { + INF("[%lf : %lf] ADDRESS : %s", n->lon, n->lat, dump.address); + n->address = strdup(dump.address); + } + n->lon = dump.lon; + n->lat = dump.lat; + } +} + +Grid *_get_current_grid(Widget_Data *wd) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); + Eina_List *l; + Grid *g = NULL, *ret = NULL; + EINA_LIST_FOREACH(wd->grids, l, g) + { + if (wd->zoom == g->zoom) + { + ret = g; + break; + } + } + return ret; +} + +static void +_route_cb(void *data, const char *file, int status) +{ + EINA_SAFETY_ON_NULL_RETURN(data); + EINA_SAFETY_ON_NULL_RETURN(file); + + Elm_Map_Route *route = data; + Widget_Data *wd = route->wd; + EINA_SAFETY_ON_NULL_RETURN(wd); + + route->job = NULL; + if (status == 200) + { + _kml_parse(route); + INF("Route request success from (%lf, %lf) to (%lf, %lf)", + route->flon, route->flat, route->tlon, route->tlat); + if (route->cb) route->cb(route->data, wd->obj, route); + evas_object_smart_callback_call(wd->obj, SIG_ROUTE_LOADED, NULL); + } + else + { + ERR("Route request failed: %d", status); + if (route->cb) route->cb(route->data, wd->obj, NULL); + evas_object_smart_callback_call(wd->obj, SIG_ROUTE_LOADED_FAIL, NULL); + } + + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), + "elm,state,busy,stop", "elm"); +} + +static void +_name_cb(void *data, const char *file, int status) +{ + EINA_SAFETY_ON_NULL_RETURN(data); + EINA_SAFETY_ON_NULL_RETURN(file); + + Elm_Map_Name *name = data; + Widget_Data *wd = name->wd; + EINA_SAFETY_ON_NULL_RETURN(wd); + + name->job = NULL; + if (status == 200) + { + _name_parse(name); + INF("Name request success address:%s, lon:%lf, lat:%lf", + name->address, name->lon, name->lat); + if (name->cb) name->cb(name->data, wd->obj, name); + evas_object_smart_callback_call(wd->obj, SIG_NAME_LOADED, NULL); + } + else + { + ERR("Name request failed: %d", status); + if (name->cb) name->cb(name->data, wd->obj, NULL); + evas_object_smart_callback_call(wd->obj, SIG_NAME_LOADED_FAIL, NULL); + } + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), + "elm,state,busy,stop", "elm"); +} + + + +static Elm_Map_Name * +_name_request(const Evas_Object *obj, int method, const char *address, double lon, double lat, Elm_Map_Name_Cb name_cb, void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd->src_name, NULL); + + + char *url; + char fname[PATH_MAX]; + + if (!ecore_file_exists(CACHE_NAME_ROOT)) ecore_file_mkpath(CACHE_NAME_ROOT); + + url = wd->src_name->url_cb(wd->obj, method, address, lon, lat); + if (!url) + { + ERR("Name URL is NULL"); + return NULL; + } + + Elm_Map_Name *name = ELM_NEW(Elm_Map_Name); + name->wd = wd; + snprintf(fname, sizeof(fname), CACHE_NAME_ROOT"/%d", rand()); + name->fname = strdup(fname); + name->method = method; + if (method == ELM_MAP_NAME_METHOD_SEARCH) name->address = strdup(address); + else if (method == ELM_MAP_NAME_METHOD_REVERSE) + { + name->lon = lon; + name->lat = lat; + } + name->cb = name_cb; + name->data = data; + + if (!ecore_file_download_full(url, name->fname, _name_cb, NULL, name, + &(name->job), wd->ua) || !(name->job)) + { + ERR("Can't request Name from %s to %s", url, name->fname); + if (name->address) free(name->address); + free(name->fname); + free(name); + return NULL; + } + INF("Name requested from %s to %s", url, name->fname); + free(url); + + wd->names = eina_list_append(wd->names, name); + evas_object_smart_callback_call(wd->obj, SIG_NAME_LOAD, name); + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), + "elm,state,busy,start", "elm"); + return name; +} + +static Evas_Event_Flags +_pinch_zoom_start_cb(void *data, void *event_info __UNUSED__) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(data, EVAS_EVENT_FLAG_NONE); + Widget_Data *wd = data; + + wd->pinch_zoom = wd->zoom_detail; + return EVAS_EVENT_FLAG_NONE; +} + +static Evas_Event_Flags +_pinch_zoom_cb(void *data, void *event_info) +{ + Widget_Data *wd = data; + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EVAS_EVENT_FLAG_NONE); + + if (!wd->paused) + { + Elm_Gesture_Zoom_Info *ei = event_info; + zoom_do(wd, wd->pinch_zoom + ei->zoom - 1); + } + return EVAS_EVENT_FLAG_NONE; +} + +static Evas_Event_Flags +_pinch_rotate_cb(void *data, void *event_info) +{ + Widget_Data *wd = data; + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EVAS_EVENT_FLAG_NONE); + + if (!wd->paused) + { + int x, y, w, h; + Elm_Gesture_Rotate_Info *ei = event_info; + evas_object_geometry_get(wd->obj, &x, &y, &w, &h); + + wd->rotate.d = wd->rotate.a + ei->angle - ei->base_angle; + wd->rotate.cx = x + ((double)w * 0.5); + wd->rotate.cy = y + ((double)h * 0.5); + + evas_object_smart_changed(wd->pan_smart); + } + return EVAS_EVENT_FLAG_NONE; +} + +static Evas_Event_Flags +_pinch_rotate_end_cb(void *data, void *event_info __UNUSED__) +{ + Widget_Data *wd = data; + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EVAS_EVENT_FLAG_NONE); + + wd->rotate.a = wd->rotate.d; + + return EVAS_EVENT_FLAG_NONE; +} + +static Eina_Bool +_source_tile_mod_cb(Eina_Module *m, void *data) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(data, EINA_FALSE); + + Widget_Data *wd = data; + Source_Tile *s; + Elm_Map_Module_Source_Name_Func name_cb; + Elm_Map_Module_Tile_Zoom_Min_Func zoom_min; + Elm_Map_Module_Tile_Zoom_Max_Func zoom_max; + Elm_Map_Module_Tile_Url_Func url_cb; + Elm_Map_Module_Tile_Geo_to_Coord_Func geo_to_coord; + Elm_Map_Module_Tile_Coord_to_Geo_Func coord_to_geo; + Elm_Map_Module_Tile_Scale_Func scale_cb; + const char *file; + + file = eina_module_file_get(m); + if (!eina_module_load(m)) + { + ERR("Could not load module \"%s\": %s", file, + eina_error_msg_get(eina_error_get())); + return EINA_FALSE; + } + + name_cb = eina_module_symbol_get(m, "map_module_source_name_get"); + zoom_min = eina_module_symbol_get(m, "map_module_tile_zoom_min_get"); + zoom_max = eina_module_symbol_get(m, "map_module_tile_zoom_max_get"); + url_cb = eina_module_symbol_get(m, "map_module_tile_url_get"); + geo_to_coord = eina_module_symbol_get(m, "map_module_tile_geo_to_coord"); + coord_to_geo = eina_module_symbol_get(m, "map_module_tile_coord_to_geo"); + scale_cb = eina_module_symbol_get(m, "map_module_tile_scale_get"); + if ((!name_cb) || (!zoom_min) || (!zoom_max) || (!url_cb) || + (!geo_to_coord) || (!coord_to_geo) || (!scale_cb)) + { + WRN("Could not find map module functions from module \"%s\": %s", + file, eina_error_msg_get(eina_error_get())); + eina_module_unload(m); + return EINA_FALSE; + } + s = ELM_NEW(Source_Tile); + s->name = name_cb(); + s->zoom_min = zoom_min(); + s->zoom_max = zoom_max(); + s->url_cb = url_cb; + s->geo_to_coord = geo_to_coord; + s->coord_to_geo = coord_to_geo; + s->scale_cb = scale_cb; + wd->src_tiles = eina_list_append(wd->src_tiles, s); + + return EINA_TRUE; +} + +static void +_source_tile_load(Widget_Data *wd) +{ + unsigned int idx; + Eina_List *l; + Source_Tile *s; + + // Load from hard coded data + for (idx = 0; idx < (sizeof(src_tiles) / sizeof(Source_Tile)); idx++) + { + s= ELM_NEW(Source_Tile); + s->name = src_tiles[idx].name; + s->zoom_min = src_tiles[idx].zoom_min; + s->zoom_max = src_tiles[idx].zoom_max; + s->url_cb = src_tiles[idx].url_cb; + s->geo_to_coord = src_tiles[idx].geo_to_coord; + s->coord_to_geo = src_tiles[idx].coord_to_geo; + s->scale_cb = src_tiles[idx].scale_cb; + wd->src_tiles = eina_list_append(wd->src_tiles, s); + } + + // Load from modules + wd->src_tile_mods = eina_module_list_get(wd->src_tile_mods, MODULES_PATH, 1, + &_source_tile_mod_cb, wd); + + // Set default source + wd->src_tile = eina_list_nth(wd->src_tiles, 0); + + // Make name strings + idx = 0; + wd->src_tile_names = calloc((eina_list_count(wd->src_tiles) + 1), + sizeof(char *)); + EINA_LIST_FOREACH(wd->src_tiles, l, s) + { + eina_stringshare_replace(&wd->src_tile_names[idx], s->name); + INF("source : %s", wd->src_tile_names[idx]); + idx++; + } +} + +static void +_source_tile_unload(Widget_Data *wd) +{ + int idx = 0; + Source_Tile *s; + + for (idx = 0; wd->src_tile_names[idx]; idx++) + eina_stringshare_del(wd->src_tile_names[idx]); + EINA_LIST_FREE(wd->src_tiles, s) free(s); + eina_module_list_free(wd->src_tile_mods); +} + +static void +_source_tile_set(Widget_Data *wd, const char *source_name) +{ + EINA_SAFETY_ON_NULL_RETURN(wd); + EINA_SAFETY_ON_NULL_RETURN(source_name); + Source_Tile *s; + Eina_List *l; + + if (wd->src_tile && !strcmp(wd->src_tile->name, source_name)) return; + + EINA_LIST_FOREACH(wd->src_tiles, l, s) + { + if (!strcmp(s->name, source_name)) + { + wd->src_tile = s; + break; + } + } + if (!wd->src_tile) + { + ERR("source name (%s) is not found", source_name); + return; + } + + if (wd->src_tile->zoom_max < wd->zoom) + wd->zoom = wd->src_tile->zoom_max; + else if (wd->src_tile->zoom_min > wd->zoom) + wd->zoom = wd->src_tile->zoom_min; + + if (wd->src_tile->zoom_max < wd->zoom_max) + wd->zoom_max = wd->src_tile->zoom_max; + if (wd->src_tile->zoom_min > wd->zoom_min) + wd->zoom_min = wd->src_tile->zoom_min; + + _grid_all_clear(wd); + _grid_all_create(wd); + zoom_do(wd, wd->zoom); +} + +static Eina_Bool +_source_route_mod_cb(Eina_Module *m, void *data) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(data, EINA_FALSE); + + Widget_Data *wd = data; + Source_Route *s; + Elm_Map_Module_Source_Name_Func name_cb; + Elm_Map_Module_Route_Url_Func url_cb; + const char *file; + + file = eina_module_file_get(m); + if (!eina_module_load(m)) + { + ERR("Could not load module \"%s\": %s", file, + eina_error_msg_get(eina_error_get())); + return EINA_FALSE; + } + + name_cb = eina_module_symbol_get(m, "map_module_source_name_get"); + url_cb = eina_module_symbol_get(m, "map_module_route_url_get"); + + if ((!name_cb) || (!url_cb)) + { + WRN("Could not find map module functions from module \"%s\": %s", + file, eina_error_msg_get(eina_error_get())); + eina_module_unload(m); + return EINA_FALSE; + } + s = ELM_NEW(Source_Tile); + s->name = name_cb(); + s->url_cb = url_cb; + wd->src_routes = eina_list_append(wd->src_routes, s); + + eina_module_unload(m); + return EINA_TRUE; +} + +static void +_source_route_load(Widget_Data *wd) +{ + unsigned int idx; + Eina_List *l; + Source_Route *s; + + // Load from hard coded data + for (idx = 0; idx < (sizeof(src_routes) / sizeof(Source_Route)); idx++) + { + s= ELM_NEW(Source_Route); + s->name = src_routes[idx].name; + s->url_cb = src_routes[idx].url_cb; + wd->src_routes = eina_list_append(wd->src_routes, s); + } + + // Load from modules + wd->src_route_mods = eina_module_list_get(wd->src_route_mods, MODULES_PATH, + 1, &_source_route_mod_cb, wd); + + // Set default source + wd->src_route = eina_list_nth(wd->src_routes, 0); + + // Make name strings + idx = 0; + wd->src_route_names = calloc((eina_list_count(wd->src_routes) + 1), + sizeof(char *)); + EINA_LIST_FOREACH(wd->src_routes, l, s) + { + eina_stringshare_replace(&wd->src_route_names[idx], s->name); + INF("source : %s", wd->src_route_names[idx]); + idx++; + } +} + +static void +_source_route_unload(Widget_Data *wd) +{ + int idx = 0; + Source_Route *s; + + for (idx = 0; wd->src_route_names[idx]; idx++) + eina_stringshare_del(wd->src_route_names[idx]); + EINA_LIST_FREE(wd->src_routes, s) free(s); + eina_module_list_free(wd->src_route_mods); +} + +static void +_source_route_set(Widget_Data *wd, const char *source_name) +{ + EINA_SAFETY_ON_NULL_RETURN(wd); + EINA_SAFETY_ON_NULL_RETURN(source_name); + Source_Route *s; + Eina_List *l; + + if (wd->src_route && !strcmp(wd->src_route->name, source_name)) return; + + EINA_LIST_FOREACH(wd->src_routes, l, s) + { + if (!strcmp(s->name, source_name)) + { + wd->src_route = s; + break; + } + } + if (!wd->src_route) + { + ERR("source name (%s) is not found", source_name); + return; + } +} + +static Eina_Bool +_source_name_mod_cb(Eina_Module *m, void *data) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(data, EINA_FALSE); + + Widget_Data *wd = data; + Source_Name *s; + Elm_Map_Module_Source_Name_Func name_cb; + Elm_Map_Module_Name_Url_Func url_cb; + const char *file; + + file = eina_module_file_get(m); + if (!eina_module_load(m)) + { + ERR("Could not load module \"%s\": %s", file, + eina_error_msg_get(eina_error_get())); + return EINA_FALSE; + } + + name_cb = eina_module_symbol_get(m, "map_module_source_name_get"); + url_cb = eina_module_symbol_get(m, "map_module_name_url_get"); + + if ((!name_cb) || (!url_cb)) + { + WRN("Could not find map module functions from module \"%s\": %s", + file, eina_error_msg_get(eina_error_get())); + eina_module_unload(m); + return EINA_FALSE; + } + s = ELM_NEW(Source_Tile); + s->name = name_cb(); + s->url_cb = url_cb; + wd->src_names = eina_list_append(wd->src_names, s); + + eina_module_unload(m); + return EINA_TRUE; +} + +static void +_source_name_load(Widget_Data *wd) +{ + unsigned int idx; + Eina_List *l; + Source_Name *s; + + // Load from hard coded data + for (idx = 0; idx < (sizeof(src_names) / sizeof(Source_Name)); idx++) + { + s= ELM_NEW(Source_Name); + s->name = src_names[idx].name; + s->url_cb = src_names[idx].url_cb; + wd->src_names = eina_list_append(wd->src_names, s); + } + + // Load from modules + wd->src_name_mods = eina_module_list_get(wd->src_name_mods, MODULES_PATH, 1, + &_source_name_mod_cb, wd); + + // Set default source + wd->src_name = eina_list_nth(wd->src_names, 0); + + // Make name strings + idx = 0; + wd->src_name_names = calloc((eina_list_count(wd->src_names) + 1), + sizeof(char *)); + EINA_LIST_FOREACH(wd->src_names, l, s) + { + eina_stringshare_replace(&wd->src_name_names[idx], s->name); + INF("source : %s", wd->src_name_names[idx]); + idx++; + } +} + +static void +_source_name_unload(Widget_Data *wd) +{ + int idx = 0; + Source_Name *s; + + for (idx = 0; wd->src_name_names[idx]; idx++) + eina_stringshare_del(wd->src_name_names[idx]); + EINA_LIST_FREE(wd->src_names, s) free(s); + eina_module_list_free(wd->src_name_mods); +} + +static void +_source_name_set(Widget_Data *wd, const char *source_name) +{ + EINA_SAFETY_ON_NULL_RETURN(wd); + EINA_SAFETY_ON_NULL_RETURN(source_name); + + Source_Name *s; + Eina_List *l; + + if (wd->src_name && !strcmp(wd->src_name->name, source_name)) return; + + EINA_LIST_FOREACH(wd->src_names, l, s) + { + if (!strcmp(s->name, source_name)) + { + wd->src_name = s; + break; + } + } + if (!wd->src_name) + { + ERR("source name (%s) is not found", source_name); + return; + } +} + +static void +_source_all_load(Widget_Data *wd) +{ + EINA_SAFETY_ON_NULL_RETURN(wd); + _source_tile_load(wd); + _source_route_load(wd); + _source_name_load(wd); +} + +static void +_source_all_unload(Widget_Data *wd) +{ + EINA_SAFETY_ON_NULL_RETURN(wd); + _source_tile_unload(wd); + _source_route_unload(wd); + _source_name_unload(wd); +} + +static void +_zoom_mode_set(void *data) +{ + EINA_SAFETY_ON_NULL_RETURN(data); + Delayed_Data *dd = data; + + dd->wd->mode = dd->mode; + if (dd->mode != ELM_MAP_ZOOM_MODE_MANUAL) + { + Evas_Coord w, h; + Evas_Coord vw, vh; + + double zoom; + double diff; + + w = dd->wd->size.w; + h = dd->wd->size.h; + zoom = dd->wd->zoom_detail; + _viewport_coord_get(dd->wd, NULL, NULL, &vw, &vh); + + if (dd->mode == ELM_MAP_ZOOM_MODE_AUTO_FIT) + { + if ((w < vw) && (h < vh)) + { + diff = 0.01; + while ((w < vw) && (h < vh)) + { + zoom += diff; + w = pow(2.0, zoom) * dd->wd->tsize; + h = pow(2.0, zoom) * dd->wd->tsize; + } + } + else + { + diff = -0.01; + while ((w > vw) || (h > vh)) + { + zoom += diff; + w = pow(2.0, zoom) * dd->wd->tsize; + h = pow(2.0, zoom) * dd->wd->tsize; + } + } + + } + else if (dd->mode == ELM_MAP_ZOOM_MODE_AUTO_FILL) + { + if ((w < vw) || (h < vh)) + { + diff = 0.01; + while ((w < vw) || (h < vh)) + { + zoom += diff; + w = pow(2.0, zoom) * dd->wd->tsize; + h = pow(2.0, zoom) * dd->wd->tsize; + } + } + else + { + diff = -0.01; + while ((w > vw) && (h > vh)) + { + zoom += diff; + w = pow(2.0, zoom) * dd->wd->tsize; + h = pow(2.0, zoom) * dd->wd->tsize; + } + } + } + zoom_do(dd->wd, zoom); + } +} + +static void +_zoom_set(void *data) +{ + EINA_SAFETY_ON_NULL_RETURN(data); + Delayed_Data *dd = data; + + if (dd->wd->paused) zoom_do(dd->wd, dd->zoom); + else zoom_with_animation(dd->wd, dd->zoom, 10); + evas_object_smart_changed(dd->wd->pan_smart); +} + +static void +_region_bring_in(void *data) +{ + EINA_SAFETY_ON_NULL_RETURN(data); + Delayed_Data *dd = data; + int x, y, w, h; + + _region_to_coord_convert(dd->wd, dd->lon, dd->lat, dd->wd->size.w, &x, &y); + _viewport_coord_get(dd->wd, NULL, NULL, &w, &h); + x = x - (w / 2); + y = y - (h / 2); + elm_smart_scroller_region_bring_in(dd->wd->scr, x, y, w, h); + evas_object_smart_changed(dd->wd->pan_smart); +} + +static char * +_mapnik_url_cb(const Evas_Object *obj __UNUSED__, int x, int y, int zoom) +{ + char buf[PATH_MAX]; + // ((x+y+zoom)%3)+'a' is requesting map images from distributed tile servers (eg., a, b, c) + snprintf(buf, sizeof(buf), "http://%c.tile.openstreetmap.org/%d/%d/%d.png", + ((x + y + zoom) % 3) + 'a', zoom, x, y); + return strdup(buf); +} + +static char * +_osmarender_url_cb(const Evas_Object *obj __UNUSED__, int x, int y, int zoom) +{ + char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), + "http://%c.tah.openstreetmap.org/Tiles/tile/%d/%d/%d.png", + ((x + y + zoom) % 3) + 'a', zoom, x, y); + return strdup(buf); +} + +static char * +_cyclemap_url_cb(const Evas_Object *obj __UNUSED__, int x, int y, int zoom) +{ + char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), + "http://%c.tile.opencyclemap.org/cycle/%d/%d/%d.png", + (( x + y + zoom) % 3) + 'a', zoom, x, y); + return strdup(buf); +} + +static char * +_mapquest_url_cb(const Evas_Object *obj __UNUSED__, int x, int y, int zoom) +{ + char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), + "http://otile%d.mqcdn.com/tiles/1.0.0/osm/%d/%d/%d.png", + ((x + y + zoom) % 4) + 1, zoom, x, y); + return strdup(buf); +} + +static char * +_mapquest_aerial_url_cb(const Evas_Object *obj __UNUSED__, int x, int y, int zoom) +{ + char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), "http://oatile%d.mqcdn.com/naip/%d/%d/%d.png", + ((x + y + zoom) % 4) + 1, zoom, x, y); + return strdup(buf); +} + +static char *_yours_url_cb(const Evas_Object *obj __UNUSED__, const char *type_name, int method, double flon, double flat, double tlon, double tlat) +{ + char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), + "%s?flat=%lf&flon=%lf&tlat=%lf&tlon=%lf&v=%s&fast=%d&instructions=1", + ROUTE_YOURS_URL, flat, flon, tlat, tlon, type_name, method); + + return strdup(buf); +} + +// TODO: fix monav api +/* +static char *_monav_url_cb(const Evas_Object *obj __UNUSED__, char *type_name, int method, double flon, double flat, double tlon, double tlat) +{ + char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), + "%s?flat=%f&flon=%f&tlat=%f&tlon=%f&v=%s&fast=%d&instructions=1", + ROUTE_MONAV_URL, flat, flon, tlat, tlon, type_name, method); + + return strdup(buf); +} +*/ + +// TODO: fix ors api +/* +static char *_ors_url_cb(const Evas_Object *obj __UNUSED__, char *type_name, int method, double flon, double flat, double tlon, double tlat) +{ + char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), + "%s?flat=%f&flon=%f&tlat=%f&tlon=%f&v=%s&fast=%d&instructions=1", + ROUTE_ORS_URL, flat, flon, tlat, tlon, type_name, method); + + return strdup(buf); +} +*/ + +static char * +_nominatim_url_cb(const Evas_Object *obj, int method, const char *name, double lon, double lat) +{ + ELM_CHECK_WIDTYPE(obj, widtype) strdup(""); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, strdup("")); + + char **str; + unsigned int ele, idx; + char search_url[PATH_MAX]; + char buf[PATH_MAX]; + + if (method == ELM_MAP_NAME_METHOD_SEARCH) + { + search_url[0] = '\0'; + str = eina_str_split_full(name, " ", 0, &ele); + for (idx = 0; idx < ele; idx++) + { + eina_strlcat(search_url, str[idx], sizeof(search_url)); + if (!(idx == (ele-1))) + eina_strlcat(search_url, "+", sizeof(search_url)); + } + snprintf(buf, sizeof(buf), + "%s/search?q=%s&format=xml&polygon=0&addressdetails=0", + NAME_NOMINATIM_URL, search_url); + + if (str && str[0]) + { + free(str[0]); + free(str); + } + } + else if (method == ELM_MAP_NAME_METHOD_REVERSE) + snprintf(buf, sizeof(buf), + "%s/reverse?format=xml&lat=%lf&lon=%lf&zoom=%d&addressdetails=0", + NAME_NOMINATIM_URL, lat, lon, (int)wd->zoom); + else strcpy(buf, ""); + + return strdup(buf); +} + +static double +_scale_cb(const Evas_Object *obj __UNUSED__, double lon __UNUSED__, double lat, int zoom) +{ + if (zoom < 0 || zoom >= (int)sizeof(_osm_scale_meter)) return 0; + return _osm_scale_meter[zoom] / cos(lat * ELM_PI / 180.0); +} + +static void +_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(wd); + + if (elm_widget_focus_get(obj)) + { + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), "elm,action,focus", "elm"); + evas_object_focus_set(wd->obj, EINA_TRUE); + } + else + { + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), "elm,action,unfocus", "elm"); + evas_object_focus_set(wd->obj, EINA_FALSE); + } +} + +static void +_del_hook(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(wd); + + if (wd->map) evas_map_free(wd->map); + free(wd); +} + +static void +_del_pre_hook(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(wd); + + Eina_List *l, *ll; + Elm_Map_Route *r; + Elm_Map_Name *na; + Evas_Object *track; + Elm_Map_Overlay *overlay; + Delayed_Data *dd; + + EINA_LIST_FOREACH_SAFE(wd->routes, l, ll, r) elm_map_route_del(r); + eina_list_free(wd->routes); + + EINA_LIST_FOREACH_SAFE(wd->names, l, ll, na) elm_map_name_del(na); + eina_list_free(wd->names); + + EINA_LIST_FOREACH_SAFE(wd->overlays, l, ll, overlay) + elm_map_overlay_del(overlay); + eina_list_free(wd->overlays); + + EINA_LIST_FREE(wd->track, track) evas_object_del(track); + + if (wd->scr_timer) ecore_timer_del(wd->scr_timer); + if (wd->long_timer) ecore_timer_del(wd->long_timer); + + if (wd->delayed_jobs) EINA_LIST_FREE(wd->delayed_jobs, dd) free(dd); + + if (wd->user_agent) eina_stringshare_del(wd->user_agent); + if (wd->ua) eina_hash_free(wd->ua); + + if (wd->zoom_timer) ecore_timer_del(wd->zoom_timer); + if (wd->zoom_animator) ecore_animator_del(wd->zoom_animator); + + _grid_all_clear(wd); + // Removal of download list should be after grid clear. + if (wd->download_idler) ecore_idler_del(wd->download_idler); + eina_list_free(wd->download_list); + + _source_all_unload(wd); + + if (!ecore_file_recursive_rm(CACHE_ROOT)) + ERR("Deletion of %s failed", CACHE_ROOT); +} + +static void +_theme_hook(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(wd); + + elm_smart_scroller_object_theme_set(obj, wd->scr, "map", "base", elm_widget_style_get(obj)); + _sizing_eval(wd); +} + +static Eina_Bool +_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EINA_FALSE); + + Evas_Coord x, y; + Evas_Coord vh; + Evas_Coord step_x, step_y, page_x, page_y; + + if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE; + Evas_Event_Key_Down *ev = event_info; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; + + elm_smart_scroller_child_pos_get(wd->scr, &x, &y); + elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y); + elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y); + elm_smart_scroller_child_viewport_size_get(wd->scr, NULL, &vh); + + if ((!strcmp(ev->keyname, "Left")) || + ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string))) + { + x -= step_x; + } + else if ((!strcmp(ev->keyname, "Right")) || + ((!strcmp(ev->keyname, "KP_Right")) && (!ev->string))) + { + x += step_x; + } + else if ((!strcmp(ev->keyname, "Up")) || + ((!strcmp(ev->keyname, "KP_Up")) && (!ev->string))) + { + y -= step_y; + } + else if ((!strcmp(ev->keyname, "Down")) || + ((!strcmp(ev->keyname, "KP_Down")) && (!ev->string))) + { + y += step_y; + } + else if ((!strcmp(ev->keyname, "Prior")) || + ((!strcmp(ev->keyname, "KP_Prior")) && (!ev->string))) + { + if (page_y < 0) + y -= -(page_y * vh) / 100; + else + y -= page_y; + } + else if ((!strcmp(ev->keyname, "Next")) || + ((!strcmp(ev->keyname, "KP_Next")) && (!ev->string))) + { + if (page_y < 0) + y += -(page_y * vh) / 100; + else + y += page_y; + } + else if (!strcmp(ev->keyname, "KP_Add")) + { + zoom_with_animation(wd, wd->zoom + 1, 10); + return EINA_TRUE; + } + else if (!strcmp(ev->keyname, "KP_Subtract")) + { + zoom_with_animation(wd, wd->zoom - 1, 10); + return EINA_TRUE; + } + else return EINA_FALSE; + + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + elm_smart_scroller_child_pos_set(wd->scr, x, y); + + return EINA_TRUE; +} +#endif + +EAPI Evas_Object * +elm_map_add(Evas_Object *parent) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + Evas *e; + Widget_Data *wd; + Evas_Object *obj; + Evas_Coord minw, minh; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + ELM_SET_WIDTYPE(widtype, "map"); + elm_widget_type_set(obj, "map"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_can_focus_set(obj, EINA_TRUE); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_event_hook_set(obj, _event_hook); + evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, wd); + evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, wd); + evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, wd); + evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, wd); + evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_DOWN, + _mouse_down, wd); + evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_UP, + _mouse_up, wd); + evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_WHEEL, + _mouse_wheel_cb,wd); + wd->obj = obj; + + wd->scr = elm_smart_scroller_add(e); + elm_widget_sub_object_add(obj, wd->scr); + elm_smart_scroller_widget_set(wd->scr, obj); + elm_smart_scroller_object_theme_set(obj, wd->scr, "map", "base", "default"); + elm_widget_resize_object_set(obj, wd->scr); + elm_smart_scroller_wheel_disabled_set(wd->scr, EINA_TRUE); + elm_smart_scroller_bounce_allow_set(wd->scr, + _elm_config->thumbscroll_bounce_enable, + _elm_config->thumbscroll_bounce_enable); + evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, wd); + evas_object_smart_callback_add(wd->scr, "scroll", _scr, wd); + evas_object_smart_callback_add(wd->scr, "drag", _scr, wd); + evas_object_smart_callback_add(wd->scr, "animate,start", _scr_anim_start, wd); + evas_object_smart_callback_add(wd->scr, "animate,stop", _scr_anim_stop, wd); + + if (!smart) + { + evas_object_smart_clipped_smart_set(&parent_sc); + sc = parent_sc; + sc.name = "elm_map_pan"; + sc.version = EVAS_SMART_CLASS_VERSION; + sc.add = _pan_add; + sc.resize = _pan_resize; + sc.move = _pan_move; + sc.calculate = _pan_calculate; + smart = evas_smart_class_new(&sc); + } + if (smart) + { + Pan *pan; + wd->pan_smart = evas_object_smart_add(e, smart); + pan = evas_object_smart_data_get(wd->pan_smart); + pan->wd = wd; + } + elm_widget_sub_object_add(obj, wd->pan_smart); + + elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart, + _pan_set, _pan_get, _pan_max_get, + _pan_min_get, _pan_child_size_get); + edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), + &minw, &minh); + evas_object_size_hint_min_set(obj, minw, minh); + + wd->ges = elm_gesture_layer_add(obj); + if (!wd->ges) ERR("elm_gesture_layer_add() failed"); + elm_gesture_layer_attach(wd->ges, obj); + elm_gesture_layer_cb_set(wd->ges, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_START, + _pinch_zoom_start_cb, wd); + elm_gesture_layer_cb_set(wd->ges, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_MOVE, + _pinch_zoom_cb, wd); + elm_gesture_layer_cb_set(wd->ges, ELM_GESTURE_ROTATE, ELM_GESTURE_STATE_MOVE, + _pinch_rotate_cb, wd); + elm_gesture_layer_cb_set(wd->ges, ELM_GESTURE_ROTATE, ELM_GESTURE_STATE_END, + _pinch_rotate_end_cb, wd); + elm_gesture_layer_cb_set(wd->ges, ELM_GESTURE_ROTATE, ELM_GESTURE_STATE_ABORT, + _pinch_rotate_end_cb, wd); + + wd->sep_maps_overlays = evas_object_rectangle_add(evas_object_evas_get(obj)); + elm_widget_sub_object_add(obj, wd->sep_maps_overlays); + evas_object_smart_member_add(wd->sep_maps_overlays, wd->pan_smart); + + wd->map = evas_map_new(EVAS_MAP_POINT); + + _source_all_load(wd); + wd->zoom_min = wd->src_tile->zoom_min; + wd->zoom_max = wd->src_tile->zoom_max; + // FIXME: Tile Provider is better to provide tile size! + wd->tsize = DEFAULT_TILE_SIZE; + + srand(time(NULL)); + + wd->id = ((int)getpid() << 16) | idnum; + idnum++; + _grid_all_create(wd); + + zoom_do(wd, 0); + + wd->mode = ELM_MAP_ZOOM_MODE_MANUAL; + + // TODO: convert Elementary to subclassing of Evas_Smart_Class + // TODO: and save some bytes, making descriptions per-class and not instance! + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + if (!ecore_file_download_protocol_available("http://")) + ERR("Ecore must be built with curl support for the map widget!"); + + return obj; +#else + (void) parent; + return NULL; +#endif +} + +EAPI void +elm_map_zoom_set(Evas_Object *obj, int zoom) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(wd); + EINA_SAFETY_ON_NULL_RETURN(wd->src_tile); + + if (wd->mode != ELM_MAP_ZOOM_MODE_MANUAL) return; + if (zoom < 0) zoom = 0; + if (wd->zoom == zoom) return; + Delayed_Data *data = ELM_NEW(Delayed_Data); + data->func = _zoom_set; + data->wd = wd; + data->zoom = zoom; + data->wd->delayed_jobs = eina_list_append(data->wd->delayed_jobs, data); + evas_object_smart_changed(data->wd->pan_smart); +#else + (void) obj; + (void) zoom; +#endif +} + +EAPI int +elm_map_zoom_get(const Evas_Object *obj) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype) 0; + Widget_Data *wd = elm_widget_data_get(obj); + + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, 0); + return wd->zoom; +#else + (void) obj; + return 0; +#endif +} + +EAPI void +elm_map_zoom_mode_set(Evas_Object *obj, Elm_Map_Zoom_Mode mode) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(wd); + + if ((mode == ELM_MAP_ZOOM_MODE_MANUAL) && (wd->mode == !!mode)) return; + + Delayed_Data *data = ELM_NEW(Delayed_Data); + data->mode = mode; + data->func = _zoom_mode_set; + data->wd = wd; + data->wd->delayed_jobs = eina_list_append(data->wd->delayed_jobs, data); + evas_object_smart_changed(data->wd->pan_smart); +#else + (void) obj; + (void) mode; +#endif +} + +EAPI Elm_Map_Zoom_Mode +elm_map_zoom_mode_get(const Evas_Object *obj) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype) ELM_MAP_ZOOM_MODE_MANUAL; + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, ELM_MAP_ZOOM_MODE_MANUAL); + + return wd->mode; +#else + (void) obj; + return ELM_MAP_ZOOM_MODE_MANUAL; +#endif +} + +EAPI void +elm_map_zoom_max_set(Evas_Object *obj, int zoom) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(wd); + EINA_SAFETY_ON_NULL_RETURN(wd->src_tile); + + wd->zoom_max = zoom; +#else + (void) obj; + (void) zoom; +#endif +} + +EAPI int +elm_map_zoom_max_get(const Evas_Object *obj) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype) -1; + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, -1); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd->src_tile, -1); + + return wd->zoom_max; +#else + (void) obj; + return -1; +#endif +} + +EAPI void +elm_map_zoom_min_set(Evas_Object *obj, int zoom) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(wd); + EINA_SAFETY_ON_NULL_RETURN(wd->src_tile); + + wd->zoom_min = zoom; +#else + (void) obj; + (void) zoom; +#endif +} + +EAPI int +elm_map_zoom_min_get(const Evas_Object *obj) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype) -1; + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, -1); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd->src_tile, -1); + + return wd->zoom_min; +#else + (void) obj; + return -1; +#endif +} + +EAPI void +elm_map_region_bring_in(Evas_Object *obj, double lon, double lat) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + Delayed_Data *data = ELM_NEW(Delayed_Data); + data->func = _region_bring_in; + data->wd = wd; + data->lon = lon; + data->lat = lat; + data->wd->delayed_jobs = eina_list_append(data->wd->delayed_jobs, data); + evas_object_smart_changed(data->wd->pan_smart); +#else + (void) obj; + (void) lon; + (void) lat; +#endif +} + +EAPI void +elm_map_region_show(Evas_Object *obj, double lon, double lat) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + Delayed_Data *data = ELM_NEW(Delayed_Data); + data->func = _region_show; + data->wd = wd; + data->lon = lon; + data->lat = lat; + data->wd->delayed_jobs = eina_list_append(data->wd->delayed_jobs, data); + evas_object_smart_changed(data->wd->pan_smart); +#else + (void) obj; + (void) lon; + (void) lat; +#endif +} + +EAPI void +elm_map_region_get(const Evas_Object *obj, double *lon, double *lat) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(wd); + + double tlon, tlat; + Evas_Coord vx, vy, vw, vh; + + _viewport_coord_get(wd, &vx, &vy, &vw, &vh); + _coord_to_region_convert(wd, vx + vw/2, vy + vh/2, wd->size.w, &tlon, &tlat); + if (lon) *lon = tlon; + if (lat) *lat = tlat; +#else + (void) obj; + (void) lon; + (void) lat; +#endif +} + +EAPI void +elm_map_paused_set(Evas_Object *obj, Eina_Bool paused) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(wd); + + if (wd->paused == !!paused) return; + wd->paused = !!paused; + if (wd->paused) + { + if (wd->zoom_animator) + { + if (wd->zoom_animator) ecore_animator_del(wd->zoom_animator); + wd->zoom_animator = NULL; + zoom_do(wd, wd->zoom); + } + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), + "elm,state,busy,stop", "elm"); + } + else + { + if (wd->download_num >= 1) + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), + "elm,state,busy,start", "elm"); + } +#else + (void) obj; + (void) paused; +#endif +} + +EAPI Eina_Bool +elm_map_paused_get(const Evas_Object *obj) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EINA_FALSE); + + return wd->paused; +#else + (void) obj; + return EINA_FALSE; +#endif +} + +EAPI void +elm_map_rotate_set(Evas_Object *obj, double degree, Evas_Coord cx, Evas_Coord cy) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(wd); + + wd->rotate.d = degree; + wd->rotate.cx = cx; + wd->rotate.cy = cy; + + evas_object_smart_changed(wd->pan_smart); +#else + (void) obj; + (void) degree; + (void) cx; + (void) cy; +#endif +} + +EAPI void +elm_map_rotate_get(const Evas_Object *obj, double *degree, Evas_Coord *cx, Evas_Coord *cy) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(wd); + + if (degree) *degree = wd->rotate.d; + if (cx) *cx = wd->rotate.cx; + if (cy) *cy = wd->rotate.cy; +#else + (void) obj; + (void) degree; + (void) cx; + (void) cy; +#endif +} + +EAPI void +elm_map_wheel_disabled_set(Evas_Object *obj, Eina_Bool disabled) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(wd); + + if ((!wd->wheel_disabled) && (disabled)) + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOUSE_WHEEL, _mouse_wheel_cb, wd); + else if ((wd->wheel_disabled) && (!disabled)) + evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_WHEEL, _mouse_wheel_cb, wd); + wd->wheel_disabled = !!disabled; +#else + (void) obj; + (void) disabled; +#endif +} + +EAPI Eina_Bool +elm_map_wheel_disabled_get(const Evas_Object *obj) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EINA_FALSE); + + return wd->wheel_disabled; +#else + (void) obj; + return EINA_FALSE; +#endif +} + +EAPI void +elm_map_tile_load_status_get(const Evas_Object *obj, int *try_num, int *finish_num) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(wd); + + if (try_num) *try_num = wd->try_num; + if (finish_num) *finish_num = wd->finish_num; +#else + (void) obj; + (void) try_num; + (void) finish_num; +#endif +} + +EAPI void +elm_map_canvas_to_region_convert(const Evas_Object *obj, Evas_Coord x, Evas_Coord y, double *lon, double *lat) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(wd); + EINA_SAFETY_ON_NULL_RETURN(lon); + EINA_SAFETY_ON_NULL_RETURN(lat); + + _canvas_to_coord(wd, x, y, &x, &y); + _coord_to_region_convert(wd, x, y, wd->size.w, lon, lat); +#else + (void) obj; + (void) x; + (void) y; + (void) lon; + (void) lat; +#endif +} + +EAPI void +elm_map_region_to_canvas_convert(const Evas_Object *obj, double lon, double lat, Evas_Coord *x, Evas_Coord *y) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(wd); + EINA_SAFETY_ON_NULL_RETURN(x); + EINA_SAFETY_ON_NULL_RETURN(y); + + _region_to_coord_convert(wd, lon, lat, wd->size.w, x, y); + _coord_to_canvas(wd, *x, *y, x, y); +#else + (void) obj; + (void) lon; + (void) lat; + (void) x; + (void) y; +#endif +} + +EAPI void +elm_map_user_agent_set(Evas_Object *obj, const char *user_agent) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(wd); + EINA_SAFETY_ON_NULL_RETURN(user_agent); + + eina_stringshare_replace(&wd->user_agent, user_agent); + + if (!wd->ua) wd->ua = eina_hash_string_small_new(NULL); + eina_hash_set(wd->ua, "User-Agent", wd->user_agent); +#else + (void) obj; + (void) user_agent; +#endif +} + +EAPI const char * +elm_map_user_agent_get(const Evas_Object *obj) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); + + return wd->user_agent; +#else + (void) obj; + return NULL; +#endif +} + +EAPI void +elm_map_source_set(Evas_Object *obj, Elm_Map_Source_Type type, const char *source_name) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(wd); + EINA_SAFETY_ON_NULL_RETURN(source_name); + + if (type == ELM_MAP_SOURCE_TYPE_TILE) _source_tile_set(wd, source_name); + else if (type == ELM_MAP_SOURCE_TYPE_ROUTE) + _source_route_set(wd, source_name); + else if (type == ELM_MAP_SOURCE_TYPE_NAME) _source_name_set(wd, source_name); + else ERR("Not supported map source type: %d", type); + +#else + (void) obj; + (void) source_name; +#endif +} + +EAPI const char * +elm_map_source_get(const Evas_Object *obj, Elm_Map_Source_Type type) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd->src_tile, NULL); + + if (type == ELM_MAP_SOURCE_TYPE_TILE) return wd->src_tile->name; + else if (type == ELM_MAP_SOURCE_TYPE_ROUTE) return wd->src_route->name; + else if (type == ELM_MAP_SOURCE_TYPE_NAME) return wd->src_name->name; + else ERR("Not supported map source type: %d", type); + return NULL; +#else + (void) obj; + return NULL; +#endif +} + +EAPI const char ** +elm_map_sources_get(const Evas_Object *obj, Elm_Map_Source_Type type) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); + + if (type == ELM_MAP_SOURCE_TYPE_TILE) return wd->src_tile_names; + else if (type == ELM_MAP_SOURCE_TYPE_ROUTE) return wd->src_route_names; + else if (type == ELM_MAP_SOURCE_TYPE_NAME) return wd->src_name_names; + else ERR("Not supported map source type: %d", type); + return NULL; +#else + (void) obj; + return NULL; +#endif +} + +EAPI Elm_Map_Route * +elm_map_route_add(Evas_Object *obj, Elm_Map_Route_Type type, Elm_Map_Route_Method method, double flon, double flat, double tlon, double tlat, Elm_Map_Route_Cb route_cb, void *data) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd->src_route, NULL); + + char *type_name; + char *url; + char fname[PATH_MAX]; + + if (!ecore_file_exists(CACHE_ROUTE_ROOT)) + ecore_file_mkpath(CACHE_ROUTE_ROOT); + + if (type == ELM_MAP_ROUTE_TYPE_MOTOCAR) + type_name = strdup(ROUTE_TYPE_MOTORCAR); + else if (type == ELM_MAP_ROUTE_TYPE_BICYCLE) + type_name = strdup(ROUTE_TYPE_BICYCLE); + else if (type == ELM_MAP_ROUTE_TYPE_FOOT) + type_name = strdup(ROUTE_TYPE_FOOT); + else type_name = NULL; + + url = wd->src_route->url_cb(obj, type_name, method, flon, flat, tlon, tlat); + if (!url) + { + ERR("Route URL is NULL"); + if (type_name) free(type_name); + return NULL; + } + if (type_name) free(type_name); + + Elm_Map_Route *route = ELM_NEW(Elm_Map_Route); + route->wd = wd; + snprintf(fname, sizeof(fname), CACHE_ROUTE_ROOT"/%d", rand()); + route->fname = strdup(fname); + route->type = type; + route->method = method; + route->flon = flon; + route->flat = flat; + route->tlon = tlon; + route->tlat = tlat; + route->cb = route_cb; + route->data = data; + + if (!ecore_file_download_full(url, route->fname, _route_cb, NULL, route, + &(route->job), wd->ua) || !(route->job)) + { + ERR("Can't request Route from %s to %s", url, route->fname); + free(route->fname); + free(route); + return NULL; + } + INF("Route requested from %s to %s", url, route->fname); + free(url); + + wd->routes = eina_list_append(wd->routes, route); + evas_object_smart_callback_call(wd->obj, SIG_ROUTE_LOAD, route); + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), + "elm,state,busy,start", "elm"); + return route; +#else + (void) obj; + (void) type; + (void) method; + (void) flon; + (void) flat; + (void) tlon; + (void) tlat; + (void) route_cb; + (void) data; + return NULL; +#endif +} + + +EAPI void +elm_map_route_del(Elm_Map_Route *route) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN(route); + EINA_SAFETY_ON_NULL_RETURN(route->wd); + ELM_CHECK_WIDTYPE(route->wd->obj, widtype); + + Path_Waypoint *w; + Path_Node *n; + + if (route->job) ecore_file_download_abort(route->job); + + EINA_LIST_FREE(route->waypoint, w) + { + if (w->point) eina_stringshare_del(w->point); + free(w); + } + + EINA_LIST_FREE(route->nodes, n) + { + if (n->pos.address) eina_stringshare_del(n->pos.address); + free(n); + } + + if (route->fname) + { + ecore_file_remove(route->fname); + free(route->fname); + } + + route->wd->routes = eina_list_remove(route->wd->routes, route); + free(route); +#else + (void) route; +#endif +} + +EAPI double +elm_map_route_distance_get(const Elm_Map_Route *route) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN_VAL(route, 0.0); + return route->info.distance; +#else + (void) route; + return 0.0; +#endif +} + +EAPI const char* +elm_map_route_node_get(const Elm_Map_Route *route) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN_VAL(route, NULL); + return route->info.nodes; +#else + (void) route; + return NULL; +#endif +} + +EAPI const char* +elm_map_route_waypoint_get(const Elm_Map_Route *route) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN_VAL(route, NULL); + return route->info.waypoints; +#else + (void) route; + return NULL; +#endif +} + +EAPI Elm_Map_Name * +elm_map_name_add(const Evas_Object *obj, const char *address, double lon, double lat, Elm_Map_Name_Cb name_cb, void *data) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + + if (address) + return _name_request(obj, ELM_MAP_NAME_METHOD_SEARCH, address, 0, 0, + name_cb, data); + else + return _name_request(obj, ELM_MAP_NAME_METHOD_REVERSE, NULL, lon, lat, + name_cb, data); +#else + (void) obj; + (void) address; + (void) lon; + (void) lat; + (void) name_cb; + (void) data; + return NULL; +#endif +} + +EAPI void +elm_map_name_del(Elm_Map_Name *name) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN(name); + EINA_SAFETY_ON_NULL_RETURN(name->wd); + ELM_CHECK_WIDTYPE(name->wd->obj, widtype); + + if (name->job) ecore_file_download_abort(name->job); + if (name->address) free(name->address); + if (name->fname) + { + ecore_file_remove(name->fname); + free(name->fname); + } + + name->wd->names = eina_list_remove(name->wd->names, name); + free(name); +#else + (void) name; +#endif +} + +EAPI const char * +elm_map_name_address_get(const Elm_Map_Name *name) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN_VAL(name, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(name->wd, NULL); + ELM_CHECK_WIDTYPE(name->wd->obj, widtype) NULL; + + return name->address; +#else + (void) name; + return NULL; +#endif +} + +EAPI void +elm_map_name_region_get(const Elm_Map_Name *name, double *lon, double *lat) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN(name); + EINA_SAFETY_ON_NULL_RETURN(name->wd); + ELM_CHECK_WIDTYPE(name->wd->obj, widtype); + + if (lon) *lon = name->lon; + if (lat) *lat = name->lat; +#else + (void) name; + (void) lon; + (void) lat; +#endif +} + +EAPI Elm_Map_Overlay * +elm_map_overlay_add(Evas_Object *obj, double lon, double lat) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); + + Elm_Map_Overlay *overlay = ELM_NEW(Elm_Map_Overlay); + overlay->wd = wd; + overlay->type = ELM_MAP_OVERLAY_TYPE_DEFAULT; + overlay->c.r = 0x87; + overlay->c.g = 0xce; + overlay->c.b = 0xeb; + overlay->c.a = 255; + overlay->ovl = _overlay_default_new(overlay, lon, lat, overlay->c, 1); + overlay->grp = _overlay_group_new(wd); + wd->overlays = eina_list_append(wd->overlays, overlay); + + evas_object_smart_changed(wd->pan_smart); + return overlay; +#else + (void) obj; + (void) lon; + (void) lat; + return NULL; +#endif +} + +EAPI void +elm_map_overlay_del(Elm_Map_Overlay *overlay) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN(overlay); + EINA_SAFETY_ON_NULL_RETURN(overlay->wd); + ELM_CHECK_WIDTYPE(overlay->wd->obj, widtype); + + if (overlay->grp) + { + if (overlay->grp->clas) + elm_map_overlay_class_remove(overlay->grp->clas, overlay); + _overlay_group_free(overlay->grp); + } + + if (overlay->type == ELM_MAP_OVERLAY_TYPE_DEFAULT) + _overlay_default_free(overlay->ovl); + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_BUBBLE) + _overlay_bubble_free(overlay->ovl); + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_CLASS) + _overlay_class_free(overlay->ovl); + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_ROUTE) + _overlay_route_free(overlay->ovl); + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_LINE) + _overlay_line_free(overlay->ovl); + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_POLYGON) + _overlay_polygon_free(overlay->ovl); + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_CIRCLE) + _overlay_circle_free(overlay->ovl); + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_SCALE) + _overlay_scale_free(overlay->ovl); + else ERR("Invalid overlay type: %d", overlay->type); + + overlay->wd->overlays = eina_list_remove(overlay->wd->overlays, overlay); + evas_object_smart_changed(overlay->wd->pan_smart); + + free(overlay); +#else + (void) overlay; +#endif +} + +EAPI Elm_Map_Overlay_Type +elm_map_overlay_type_get(const Elm_Map_Overlay *overlay) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN_VAL(overlay, ELM_MAP_OVERLAY_TYPE_NONE); + EINA_SAFETY_ON_NULL_RETURN_VAL(overlay->wd, ELM_MAP_OVERLAY_TYPE_NONE); + ELM_CHECK_WIDTYPE(overlay->wd->obj, widtype) ELM_MAP_OVERLAY_TYPE_NONE; + + return overlay->type; +#else + (void) overlay; + return ELM_MAP_OVERLAY_TYPE_NONE; +#endif +} + +EAPI void +elm_map_overlay_data_set(Elm_Map_Overlay *overlay, void *data) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN(overlay); + EINA_SAFETY_ON_NULL_RETURN(overlay->wd); + ELM_CHECK_WIDTYPE(overlay->wd->obj, widtype); + + overlay->data = data; +#else + (void) overlay; + (void) data; +#endif +} + +EAPI void * +elm_map_overlay_data_get(const Elm_Map_Overlay *overlay) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN_VAL(overlay, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(overlay->wd, NULL); + ELM_CHECK_WIDTYPE(overlay->wd->obj, widtype) NULL; + + return overlay->data; +#else + (void) overlay; + return NULL; +#endif +} + +EAPI void +elm_map_overlay_hide_set(Elm_Map_Overlay *overlay, Eina_Bool hide) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN(overlay); + EINA_SAFETY_ON_NULL_RETURN(overlay->wd); + ELM_CHECK_WIDTYPE(overlay->wd->obj, widtype); + + if (overlay->hide == !!hide) return; + overlay->hide = hide; + + evas_object_smart_changed(overlay->wd->pan_smart); +#else + (void) overlay; + (void) hide; +#endif +} + +EAPI Eina_Bool +elm_map_overlay_hide_get(const Elm_Map_Overlay *overlay) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN_VAL(overlay, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(overlay->wd, EINA_FALSE); + ELM_CHECK_WIDTYPE(overlay->wd->obj, widtype) EINA_FALSE; + + return overlay->hide; +#else + (void) overlay; + return EINA_FALSE; +#endif +} + +EAPI void +elm_map_overlay_displayed_zoom_min_set(Elm_Map_Overlay *overlay, int zoom) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN(overlay); + EINA_SAFETY_ON_NULL_RETURN(overlay->wd); + ELM_CHECK_WIDTYPE(overlay->wd->obj, widtype); + + overlay->zoom_min = zoom; + evas_object_smart_changed(overlay->wd->pan_smart); +#else + (void) overlay; + (void) zoom; +#endif +} + +EAPI int +elm_map_overlay_displayed_zoom_min_get(const Elm_Map_Overlay *overlay) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN_VAL(overlay, 0); + EINA_SAFETY_ON_NULL_RETURN_VAL(overlay->wd, 0); + ELM_CHECK_WIDTYPE(overlay->wd->obj, widtype) 0; + + return overlay->zoom_min; +#else + (void) overlay; + return 0; +#endif +} + +EAPI void +elm_map_overlay_paused_set(Elm_Map_Overlay *overlay, Eina_Bool paused) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN(overlay); + EINA_SAFETY_ON_NULL_RETURN(overlay->wd); + ELM_CHECK_WIDTYPE(overlay->wd->obj, widtype); + + if (overlay->paused == !!paused) return; + overlay->paused = paused; + + evas_object_smart_changed(overlay->wd->pan_smart); +#else + (void) overlay; + (void) paused; +#endif +} + +EAPI Eina_Bool +elm_map_overlay_paused_get(const Elm_Map_Overlay *overlay) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN_VAL(overlay, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(overlay->wd, EINA_FALSE); + ELM_CHECK_WIDTYPE(overlay->wd->obj, widtype) EINA_FALSE; + + return overlay->paused; +#else + (void) overlay; + return EINA_FALSE; +#endif +} + +EAPI void +elm_map_overlay_show(Elm_Map_Overlay *overlay) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN(overlay); + EINA_SAFETY_ON_NULL_RETURN(overlay->wd); + ELM_CHECK_WIDTYPE(overlay->wd->obj, widtype); + + if (overlay->type == ELM_MAP_OVERLAY_TYPE_DEFAULT) + { + Overlay_Default *ovl = overlay->ovl; + elm_map_region_show(overlay->wd->obj, ovl->lon, ovl->lat); + } + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_BUBBLE) + { + Overlay_Bubble *ovl = overlay->ovl; + elm_map_region_show(overlay->wd->obj, ovl->lon, ovl->lat); + } + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_CLASS) + { + Overlay_Class *ovl = overlay->ovl; + double lon, lat, max_lo, min_lo, max_la, min_la; + _region_max_min_get(ovl->members, &max_lo, &min_lo, &max_la, &min_la); + lon = (max_lo + min_lo) / 2; + lat = (max_la + min_la) / 2; + elm_map_region_show(overlay->wd->obj, lon, lat); + } + else ERR("Not supported overlay type: %d", overlay->type); + + evas_object_smart_changed(overlay->wd->pan_smart); +#else + (void) overlay; +#endif +} + +EAPI void +elm_map_overlays_show(Eina_List *overlays) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN(overlays); + EINA_SAFETY_ON_FALSE_RETURN(eina_list_count(overlays)); + + Elm_Map_Overlay *overlay; + overlay = eina_list_data_get(overlays); + + Delayed_Data *data = ELM_NEW(Delayed_Data); + data->func = _overlays_show; + data->wd = overlay->wd; + data->overlays = eina_list_clone(overlays); + data->wd->delayed_jobs = eina_list_append(data->wd->delayed_jobs, data); + evas_object_smart_changed(data->wd->pan_smart); +#else + (void) overlays; +#endif +} + +EAPI void +elm_map_overlay_region_set(Elm_Map_Overlay *overlay, double lon, double lat) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN(overlay); + EINA_SAFETY_ON_NULL_RETURN(overlay->wd); + ELM_CHECK_WIDTYPE(overlay->wd->obj, widtype); + + if (overlay->type == ELM_MAP_OVERLAY_TYPE_DEFAULT) + { + Overlay_Default *ovl = overlay->ovl; + ovl->lon = lon; + ovl->lat = lat; + } + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_BUBBLE) + { + Overlay_Bubble *ovl = overlay->ovl; + ovl->lon = lon; + ovl->lat = lat; + } + else ERR("Not supported overlay type: %d", overlay->type); + + evas_object_smart_changed(overlay->wd->pan_smart); +#else + (void) overlay; + (void) lon; + (void) lat; +#endif +} + +EAPI void +elm_map_overlay_region_get(const Elm_Map_Overlay *overlay, double *lon, double *lat) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN(overlay); + EINA_SAFETY_ON_NULL_RETURN(overlay->wd); + ELM_CHECK_WIDTYPE(overlay->wd->obj, widtype); + + if (overlay->type == ELM_MAP_OVERLAY_TYPE_GROUP) + { + Overlay_Group *ovl = overlay->ovl; + _overlay_group_region_get(ovl, lon, lat); + } + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_DEFAULT) + { + const Overlay_Default *ovl = overlay->ovl; + if (lon) *lon = ovl->lon; + if (lat) *lat = ovl->lat; + } + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_BUBBLE) + { + const Overlay_Bubble *ovl = overlay->ovl; + if (lon) *lon = ovl->lon; + if (lat) *lat = ovl->lat; + } + else ERR("Not supported overlay type: %d", overlay->type); +#else + (void) overlay; + (void) lon; + (void) lat; +#endif +} + +EAPI void +elm_map_overlay_icon_set(Elm_Map_Overlay *overlay, Evas_Object *icon) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN(overlay); + EINA_SAFETY_ON_NULL_RETURN(icon); + EINA_SAFETY_ON_NULL_RETURN(overlay->wd); + ELM_CHECK_WIDTYPE(overlay->wd->obj, widtype); + + if (overlay->type == ELM_MAP_OVERLAY_TYPE_DEFAULT) + _overlay_default_icon_update(overlay->ovl, icon); + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_CLASS) + _overlay_class_icon_update(overlay->ovl, icon); + else ERR("Not supported overlay type: %d", overlay->type); + + evas_object_smart_changed(overlay->wd->pan_smart); +#else + (void) overlay; + (void) icon; +#endif +} + +EAPI const Evas_Object * +elm_map_overlay_icon_get(const Elm_Map_Overlay *overlay) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN_VAL(overlay, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(overlay->wd, NULL); + ELM_CHECK_WIDTYPE(overlay->wd->obj, widtype) NULL; + + if (overlay->type == ELM_MAP_OVERLAY_TYPE_DEFAULT) + { + const Overlay_Default *ovl = overlay->ovl; + return ovl->icon; + } + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_CLASS) + { + const Overlay_Class *ovl = overlay->ovl; + return ovl->icon; + } + else + { + ERR("Not supported overlay type: %d", overlay->type); + return NULL; + } +#else + (void) overlay; + return NULL; +#endif +} + +EAPI void +elm_map_overlay_content_set(Elm_Map_Overlay *overlay, Evas_Object *content) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN(overlay); + EINA_SAFETY_ON_NULL_RETURN(content); + EINA_SAFETY_ON_NULL_RETURN(overlay->wd); + ELM_CHECK_WIDTYPE(overlay->wd->obj, widtype); + + if (overlay->type == ELM_MAP_OVERLAY_TYPE_DEFAULT) + _overlay_default_content_update(overlay->ovl, content, overlay); + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_CLASS) + _overlay_class_content_update(overlay->ovl, content); + else ERR("Not supported overlay type: %d", overlay->type); + + evas_object_smart_changed(overlay->wd->pan_smart); +#else + (void) overlay; + (void) obj; +#endif +} + +EAPI const Evas_Object * +elm_map_overlay_content_get(const Elm_Map_Overlay *overlay) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN_VAL(overlay, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(overlay->wd, NULL); + ELM_CHECK_WIDTYPE(overlay->wd->obj, widtype) NULL; + + if (overlay->type == ELM_MAP_OVERLAY_TYPE_DEFAULT) + { + const Overlay_Default *ovl = overlay->ovl; + return ovl->content; + } + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_CLASS) + { + const Overlay_Class *ovl = overlay->ovl; + return ovl->content; + } + else + { + ERR("Not supported overlay type: %d", overlay->type); + return NULL; + } +#else + (void) overlay; + return NULL; +#endif +} + +EAPI void +elm_map_overlay_color_set(Elm_Map_Overlay *overlay, int r, int g , int b, int a) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN(overlay); + EINA_SAFETY_ON_NULL_RETURN(overlay->wd); + ELM_CHECK_WIDTYPE(overlay->wd->obj, widtype); + + overlay->c.r = r; + overlay->c.g = g; + overlay->c.b = b; + overlay->c.a = a; + + if (overlay->type == ELM_MAP_OVERLAY_TYPE_CLASS) + _overlay_class_color_update(overlay->ovl, overlay->c); + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_DEFAULT) + _overlay_default_color_update(overlay->ovl, overlay->c); + else if (overlay->type == ELM_MAP_OVERLAY_TYPE_ROUTE) + _overlay_route_color_update(overlay->ovl, overlay->c); + else + { + ERR("Not supported overlay type: %d", overlay->type); + } + +#else + (void) overlay; + (void) r; + (void) g; + (void) b; + (void) a; +#endif +} + +EAPI void +elm_map_overlay_color_get(const Elm_Map_Overlay *overlay, int *r, int *g , int *b, int *a) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN(overlay); + EINA_SAFETY_ON_NULL_RETURN(overlay->wd); + ELM_CHECK_WIDTYPE(overlay->wd->obj, widtype); + + if (overlay->type == ELM_MAP_OVERLAY_TYPE_ROUTE) + { + if (r) *r = overlay->c.r; + if (g) *g = overlay->c.g; + if (b) *b = overlay->c.b; + if (a) *a = overlay->c.a; + } + else ERR("Not supported overlay type: %d", overlay->type); +#else + (void) overlay; + (void) r; + (void) g; + (void) b; + (void) a; +#endif +} + +EAPI void +elm_map_overlay_get_cb_set(Elm_Map_Overlay *overlay, Elm_Map_Overlay_Get_Cb get_cb, void *data) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN(overlay); + EINA_SAFETY_ON_NULL_RETURN(overlay->wd); + ELM_CHECK_WIDTYPE(overlay->wd->obj, widtype); + + overlay->cb = get_cb; + overlay->cb_data = data; + + if (overlay->type == ELM_MAP_OVERLAY_TYPE_CLASS) + _overlay_class_cb_set(overlay->ovl, get_cb, data); +#else + (void) overlay; + (void) get_cb; + (void) data; +#endif +} + +EAPI Elm_Map_Overlay * +elm_map_overlay_class_add(Evas_Object *obj) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); + + Elm_Map_Overlay *overlay = ELM_NEW(Elm_Map_Overlay); + overlay->wd = wd; + overlay->type = ELM_MAP_OVERLAY_TYPE_CLASS; + overlay->ovl = _overlay_class_new(wd); + overlay->c.r = 0x90; + overlay->c.g = 0xee; + overlay->c.b = 0x90; + overlay->c.a = 0xff; + wd->overlays = eina_list_append(wd->overlays, overlay); + + evas_object_smart_changed(wd->pan_smart); + return overlay; +#else + (void) obj; + return NULL; +#endif +} + +EAPI void +elm_map_overlay_class_append(Elm_Map_Overlay *clas, Elm_Map_Overlay *overlay) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN(clas); + EINA_SAFETY_ON_NULL_RETURN(overlay); + EINA_SAFETY_ON_NULL_RETURN(clas->wd); + ELM_CHECK_WIDTYPE(clas->wd->obj, widtype); + EINA_SAFETY_ON_FALSE_RETURN(clas->type == ELM_MAP_OVERLAY_TYPE_CLASS); + + Overlay_Class *clas_ovl = clas->ovl; + if (eina_list_data_find(clas_ovl->members, overlay)) + { + ERR("Already added overlay into clas"); + return; + } + clas_ovl->members = eina_list_append(clas_ovl->members, overlay); + + // Update group by class + overlay->grp->clas = clas; + _overlay_group_icon_update(overlay->grp, clas_ovl->icon); + _overlay_group_content_update(overlay->grp, clas_ovl->content); + _overlay_group_color_update(overlay->grp, clas->c); + _overlay_group_cb_set(overlay->grp, clas->cb, clas->data); + if (overlay->type == ELM_MAP_OVERLAY_TYPE_DEFAULT) + { + _overlay_default_clas_icon_update(overlay->ovl, clas_ovl->icon); + _overlay_default_clas_content_update(overlay->ovl, clas_ovl->content); + } + + evas_object_smart_changed(clas->wd->pan_smart); +#else + (void) clas; + (void) overlay; +#endif +} + +EAPI void +elm_map_overlay_class_remove(Elm_Map_Overlay *clas, Elm_Map_Overlay *overlay) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN(clas); + EINA_SAFETY_ON_NULL_RETURN(overlay); + EINA_SAFETY_ON_NULL_RETURN(clas->wd); + ELM_CHECK_WIDTYPE(clas->wd->obj, widtype); + EINA_SAFETY_ON_FALSE_RETURN(clas->type == ELM_MAP_OVERLAY_TYPE_CLASS); + + Overlay_Class *ovl = clas->ovl; + ovl->members = eina_list_remove(ovl->members, overlay); + + overlay->grp->clas = NULL; + _overlay_group_icon_update(overlay->grp, NULL); + _overlay_group_content_update(overlay->grp, NULL); + if (overlay->type == ELM_MAP_OVERLAY_TYPE_DEFAULT) + { + _overlay_default_clas_icon_update(overlay->ovl, NULL); + _overlay_default_clas_content_update(overlay->ovl, NULL); + } + + evas_object_smart_changed(clas->wd->pan_smart); +#else + (void) clas; + (void) overlay; +#endif +} + +EAPI void +elm_map_overlay_class_zoom_max_set(Elm_Map_Overlay *clas, int zoom) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN(clas); + EINA_SAFETY_ON_NULL_RETURN(clas->wd); + ELM_CHECK_WIDTYPE(clas->wd->obj, widtype); + EINA_SAFETY_ON_FALSE_RETURN(clas->type == ELM_MAP_OVERLAY_TYPE_CLASS); + + Overlay_Class *ovl = clas->ovl; + if (ovl->zoom_max == !!zoom) return; + ovl->zoom_max = zoom; + + evas_object_smart_changed(clas->wd->pan_smart); +#else + (void) clas; + (void) zoom; +#endif +} + +EAPI int +elm_map_overlay_class_zoom_max_get(const Elm_Map_Overlay *clas) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN_VAL(clas, OVERLAY_CLASS_ZOOM_MAX); + EINA_SAFETY_ON_NULL_RETURN_VAL(clas->wd, OVERLAY_CLASS_ZOOM_MAX); + ELM_CHECK_WIDTYPE(clas->wd->obj, widtype) OVERLAY_CLASS_ZOOM_MAX; + EINA_SAFETY_ON_FALSE_RETURN_VAL(clas->type == ELM_MAP_OVERLAY_TYPE_CLASS, OVERLAY_CLASS_ZOOM_MAX); + + const Overlay_Class *ovl = clas->ovl; + return ovl->zoom_max; +#else + (void) clas; + return OVERLAY_CLASS_ZOOM_MAX; +#endif +} + +EAPI Eina_List * +elm_map_overlay_group_members_get(const Elm_Map_Overlay *grp) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN_VAL(grp, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(grp->wd, NULL); + ELM_CHECK_WIDTYPE(grp->wd->obj, widtype) NULL; + EINA_SAFETY_ON_FALSE_RETURN_VAL(grp->type == ELM_MAP_OVERLAY_TYPE_GROUP, NULL); + + Overlay_Group *ovl = grp->ovl; + return ovl->members; +#else + (void) clas; + return OVERLAY_CLASS_ZOOM_MAX; +#endif +} + +EAPI Elm_Map_Overlay * +elm_map_overlay_bubble_add(Evas_Object *obj) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); + + Elm_Map_Overlay *overlay = ELM_NEW(Elm_Map_Overlay); + overlay->wd = wd; + overlay->type = ELM_MAP_OVERLAY_TYPE_BUBBLE; + overlay->c.r = 255; + overlay->c.g = 255; + overlay->c.b = 255; + overlay->c.a = 255; + overlay->ovl = _overlay_bubble_new(overlay); + overlay->grp = _overlay_group_new(wd); + wd->overlays = eina_list_append(wd->overlays, overlay); + + evas_object_smart_changed(wd->pan_smart); + return overlay; +#else + (void) obj; + return NULL; +#endif +} + +EAPI void +elm_map_overlay_bubble_follow(Elm_Map_Overlay *bubble, const Elm_Map_Overlay *parent) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN(bubble); + EINA_SAFETY_ON_NULL_RETURN(parent); + ELM_CHECK_WIDTYPE(bubble->wd->obj, widtype); + EINA_SAFETY_ON_FALSE_RETURN(bubble->type == ELM_MAP_OVERLAY_TYPE_BUBBLE); + + Overlay_Bubble *ovl = bubble->ovl; + Evas_Object *pobj = _overlay_obj_get(parent); + if (!pobj) return; + + if (ovl->pobj) + { + evas_object_event_callback_del_full(ovl->pobj, EVAS_CALLBACK_HIDE, + _overlay_bubble_hide_cb, ovl); + evas_object_event_callback_del_full(ovl->pobj, EVAS_CALLBACK_SHOW, + _overlay_bubble_chase_cb, ovl); + evas_object_event_callback_del_full(ovl->pobj, EVAS_CALLBACK_MOVE, + _overlay_bubble_chase_cb, ovl); + } + + ovl->pobj = pobj; + evas_object_event_callback_add(ovl->pobj, EVAS_CALLBACK_HIDE, + _overlay_bubble_hide_cb, ovl); + evas_object_event_callback_add(ovl->pobj, EVAS_CALLBACK_SHOW, + _overlay_bubble_chase_cb, ovl); + evas_object_event_callback_add(ovl->pobj, EVAS_CALLBACK_MOVE, + _overlay_bubble_chase_cb, ovl); + + _overlay_bubble_chase(ovl); + evas_object_smart_changed(bubble->wd->pan_smart); +#else + (void) bubble; + (void) parent; +#endif +} + +EAPI void +elm_map_overlay_bubble_content_append(Elm_Map_Overlay *bubble, Evas_Object *content) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN(bubble); + EINA_SAFETY_ON_NULL_RETURN(content); + ELM_CHECK_WIDTYPE(bubble->wd->obj, widtype); + EINA_SAFETY_ON_FALSE_RETURN(bubble->type == ELM_MAP_OVERLAY_TYPE_BUBBLE); + + Overlay_Bubble *bb = bubble->ovl; + elm_box_pack_end(bb->bx, content); + + evas_object_smart_changed(bubble->wd->pan_smart); +#else + (void) bubble; + (void) content; +#endif +} + +EAPI void +elm_map_overlay_bubble_content_clear(Elm_Map_Overlay *bubble) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN(bubble); + ELM_CHECK_WIDTYPE(bubble->wd->obj, widtype); + EINA_SAFETY_ON_FALSE_RETURN(bubble->type == ELM_MAP_OVERLAY_TYPE_BUBBLE); + + Overlay_Bubble *bb = bubble->ovl; + elm_box_clear(bb->bx); + + evas_object_smart_changed(bubble->wd->pan_smart); +#else + (void) bubble; +#endif +} + +EAPI Elm_Map_Overlay * +elm_map_overlay_route_add(Evas_Object *obj, const Elm_Map_Route *route) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(route, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(route->wd, NULL); + EINA_SAFETY_ON_FALSE_RETURN_VAL(obj == route->wd->obj, NULL); + + Elm_Map_Overlay *overlay = ELM_NEW(Elm_Map_Overlay); + overlay->wd = wd; + overlay->type = ELM_MAP_OVERLAY_TYPE_ROUTE; + overlay->c.r = 0xff; + overlay->c.g = 0x00; + overlay->c.b = 0x00; + overlay->c.a = 0xff; + overlay->ovl = _overlay_route_new(wd, route, overlay->c); + overlay->grp = _overlay_group_new(wd); + wd->overlays = eina_list_append(wd->overlays, overlay); + + evas_object_smart_changed(wd->pan_smart); + return overlay; +#else + (void) obj; + (void) route; + return NULL; +#endif +} + +EAPI Elm_Map_Overlay * +elm_map_overlay_line_add(Evas_Object *obj, double flon, double flat, double tlon, double tlat) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); + + Elm_Map_Overlay *overlay = ELM_NEW(Elm_Map_Overlay); + overlay->wd = wd; + overlay->type = ELM_MAP_OVERLAY_TYPE_LINE; + overlay->c.r = 0xff; + overlay->c.g = 0x00; + overlay->c.b = 0x00; + overlay->c.a = 0xff; + overlay->ovl = _overlay_line_new(wd, flon, flat, tlon, tlat, overlay->c); + overlay->grp = _overlay_group_new(wd); + wd->overlays = eina_list_append(wd->overlays, overlay); + + evas_object_smart_changed(wd->pan_smart); + return overlay; +#else + (void) obj; + (void) flon; + (void) flat + (void) tlon; + (void) tlat; + return NULL; +#endif +} + +EAPI Elm_Map_Overlay * +elm_map_overlay_polygon_add(Evas_Object *obj) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); + + Elm_Map_Overlay *overlay = ELM_NEW(Elm_Map_Overlay); + overlay->wd = wd; + overlay->type = ELM_MAP_OVERLAY_TYPE_POLYGON; + overlay->c.r = 0xdc; + overlay->c.g = 0x14; + overlay->c.b = 0x3c; + overlay->c.a = 200; + overlay->ovl = _overlay_polygon_new(wd, overlay->c); + overlay->grp = _overlay_group_new(wd); + wd->overlays = eina_list_append(wd->overlays, overlay); + evas_object_smart_changed(wd->pan_smart); + return overlay; +#else + (void) obj; + return NULL; +#endif +} + +EAPI void +elm_map_overlay_polygon_region_add(Elm_Map_Overlay *overlay, double lon, double lat) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EINA_SAFETY_ON_NULL_RETURN(overlay); + ELM_CHECK_WIDTYPE(overlay->wd->obj, widtype); + EINA_SAFETY_ON_FALSE_RETURN(overlay->type == ELM_MAP_OVERLAY_TYPE_POLYGON); + + Overlay_Polygon *ovl = overlay->ovl; + Region *r = ELM_NEW(Region); + r->lon = lon; + r->lat = lat; + ovl->regions = eina_list_append(ovl->regions, r); + + evas_object_smart_changed(ovl->wd->pan_smart); +#else + (void) overlay; + (void) lon; + (void) lat + #endif +} + +EAPI Elm_Map_Overlay * +elm_map_overlay_circle_add(Evas_Object *obj, double lon, double lat, double radius) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); + + Elm_Map_Overlay *overlay = ELM_NEW(Elm_Map_Overlay); + overlay->wd = wd; + overlay->type = ELM_MAP_OVERLAY_TYPE_CIRCLE; + overlay->c.r = 0xdc; + overlay->c.g = 0x14; + overlay->c.b = 0x3c; + overlay->c.a = 200; + overlay->ovl = _overlay_circle_new(wd, lon, lat, radius, overlay->c); + overlay->grp = _overlay_group_new(wd); + wd->overlays = eina_list_append(wd->overlays, overlay); + + evas_object_smart_changed(wd->pan_smart); + return overlay; +#else + (void) obj; + return NULL; +#endif +} + +EAPI Elm_Map_Overlay * +elm_map_overlay_scale_add(Evas_Object *obj, Evas_Coord x, Evas_Coord y) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); + + Elm_Map_Overlay *overlay = ELM_NEW(Elm_Map_Overlay); + overlay->wd = wd; + overlay->type = ELM_MAP_OVERLAY_TYPE_SCALE; + overlay->c.r = 0; + overlay->c.g = 0; + overlay->c.b = 0; + overlay->c.a = 255; + overlay->ovl = _overlay_scale_new(wd, x, y, overlay->c); + overlay->grp = _overlay_group_new(wd); + wd->overlays = eina_list_append(wd->overlays, overlay); + + evas_object_smart_changed(wd->pan_smart); + return overlay; +#else + (void) obj; + return NULL; +#endif +} + +#ifdef ELM_EMAP +EAPI Evas_Object * +elm_map_track_add(Evas_Object *obj, void *emap) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + EMap_Route *emapr = emap; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EINA_FALSE); + + Evas_Object *route = elm_route_add(obj); + elm_route_emap_set(route, emapr); + wd->track = eina_list_append(wd->track, route); + + return route; +#else + (void) obj; + (void) emap; + return NULL; +#endif +} + +EAPI void +elm_map_track_remove(Evas_Object *obj, Evas_Object *route) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype) ; + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(wd); + + wd->track = eina_list_remove(wd->track, route); + evas_object_del(route); +#else + (void) obj; + (void) route; +#endif +} +#else +EAPI Evas_Object * +elm_map_track_add(Evas_Object *obj __UNUSED__, void *emap __UNUSED__) +{ + return NULL; +} + +EAPI void +elm_map_track_remove(Evas_Object *obj __UNUSED__, Evas_Object *route __UNUSED__) +{ +} +#endif diff --git a/libraries/elementary/src/lib/elm_map.h b/libraries/elementary/src/lib/elm_map.h new file mode 100644 index 0000000..c7b58df --- /dev/null +++ b/libraries/elementary/src/lib/elm_map.h @@ -0,0 +1,1503 @@ +/** + * @defgroup Map Map + * @ingroup Elementary + * + * @image html img/widget/map/preview-00.png + * @image latex img/widget/map/preview-00.eps + * + * This is a widget specifically for displaying a map. It uses basically + * OpenStreetMap provider http://www.openstreetmap.org/, + * but custom providers can be added. + * + * It supports some basic but yet nice features: + * @li zoom and scroll + * @li markers with content to be displayed when user clicks over it + * @li group of markers + * @li routes + * + * Smart callbacks one can listen to: + * + * - "clicked" - This is called when a user has clicked the map without + * dragging around. + * - "clicked,double" - This is called when a user has double-clicked + * the map. + * - "press" - This is called when a user has pressed down on the map. + * - "longpressed" - This is called when a user has pressed down on the map + * for a long time without dragging around. + * - "scroll" - the content has been scrolled (moved). + * - "scroll,drag,start" - dragging the contents around has started. + * - "scroll,drag,stop" - dragging the contents around has stopped. + * - "scroll,anim,start" - scrolling animation has started. + * - "scroll,anim,stop" - scrolling animation has stopped. + * - "zoom,start" - Zoom animation started. + * - "zoom,stop" - Zoom animation stopped. + * - "zoom,change" - Zoom changed when using an auto zoom mode. + * - "tile,load" - A map tile image load begins. + * - "tile,loaded" - A map tile image load ends. + * - "tile,loaded,fail" - A map tile image load fails. + * - "route,load" - Route request begins. + * - "route,loaded" - Route request ends. + * - "route,loaded,fail" - Route request fails. + * - "name,load" - Name request begins. + * - "name,loaded" - Name request ends. + * - "name,loaded,fail" - Name request fails. + * - "overlay,clicked" - A overlay is clicked. + * + * Available style for map widget: + * - @c "default" + * + * Available style for markers: + * - @c "radio" + * - @c "radio2" + * - @c "empty" + * + * Available style for marker bubble: + * - @c "default" + * + * List of examples: + * @li @ref map_example_01 + * @li @ref map_example_02 + * @li @ref map_example_03 + */ + +/** + * @addtogroup Map + * @{ + */ + +/** + * Set map's zoom behavior. It can be set to manual or automatic. + * + * Default value is #ELM_MAP_ZOOM_MODE_MANUAL. + * + * Values don't work as bitmask, only one can be chosen. + * + * @note Valid sizes are 2^zoom, consequently the map may be smaller + * than the scroller view. + * + * @see elm_map_zoom_mode_set() + * @see elm_map_zoom_mode_get() + * + * @ingroup Map + */ +typedef enum +{ + ELM_MAP_ZOOM_MODE_MANUAL, /**< Zoom controlled manually by elm_map_zoom_set(). It's set by default. */ + ELM_MAP_ZOOM_MODE_AUTO_FIT, /**< Zoom until map fits inside the scroll frame with no pixels outside this area. */ + ELM_MAP_ZOOM_MODE_AUTO_FILL, /**< Zoom until map fills scroll, ensuring no pixels are left unfilled. */ + ELM_MAP_ZOOM_MODE_LAST +} Elm_Map_Zoom_Mode; + +/** + * Set type of a external source (provider). + * + * @see elm_map_sources_get() + * @see elm_map_source_get() + * @see elm_map_source_set() + * + * @ingroup Map + */ +typedef enum +{ + ELM_MAP_SOURCE_TYPE_TILE, /**< Map tile provider. */ + ELM_MAP_SOURCE_TYPE_ROUTE, /**< Route service provider. */ + ELM_MAP_SOURCE_TYPE_NAME, /**< Name service provider. */ + ELM_MAP_SOURCE_TYPE_LAST +} Elm_Map_Source_Type; + +/** + * Set type of transport used on route. + * + * @see elm_map_route_add() + * + * @ingroup Map + */ +typedef enum +{ + ELM_MAP_ROUTE_TYPE_MOTOCAR, /**< Route should consider an automobile will be used. */ + ELM_MAP_ROUTE_TYPE_BICYCLE, /**< Route should consider a bicycle will be used by the user. */ + ELM_MAP_ROUTE_TYPE_FOOT, /**< Route should consider user will be walking. */ + ELM_MAP_ROUTE_TYPE_LAST +} Elm_Map_Route_Type; + +/** + * Set the routing method, what should be prioritized, time or distance. + * + * @see elm_map_route_add() + * + * @ingroup Map + */ +typedef enum +{ + ELM_MAP_ROUTE_METHOD_FASTEST, /**< Route should prioritize time. */ + ELM_MAP_ROUTE_METHOD_SHORTEST, /**< Route should prioritized distance. */ + ELM_MAP_ROUTE_METHOD_LAST +} Elm_Map_Route_Method; + +/** + * Set the name search method. + * + * This is for name module interface. + * + * @ingroup Map + */ +typedef enum +{ + ELM_MAP_NAME_METHOD_SEARCH, + ELM_MAP_NAME_METHOD_REVERSE, + ELM_MAP_NAME_METHOD_LAST +} Elm_Map_Name_Method; + +/** + * Set overlay type to be used. This type is resolved + * when the overlay is created. + * You can get this value by elm_map_overlay_type_get(). + * + * @see elm_map_overlay_type_get() + * @see elm_map_overlay_add() + * @see elm_map_overlay_class_add() + * @see elm_map_overlay_bubble_add() + * + * @ingroup Map + */ +typedef enum _Elm_Map_Overlay_Type +{ + ELM_MAP_OVERLAY_TYPE_NONE = 0, + ELM_MAP_OVERLAY_TYPE_DEFAULT, + ELM_MAP_OVERLAY_TYPE_CLASS, + ELM_MAP_OVERLAY_TYPE_GROUP, + ELM_MAP_OVERLAY_TYPE_BUBBLE, + ELM_MAP_OVERLAY_TYPE_ROUTE, + ELM_MAP_OVERLAY_TYPE_LINE, + ELM_MAP_OVERLAY_TYPE_POLYGON, + ELM_MAP_OVERLAY_TYPE_CIRCLE, + ELM_MAP_OVERLAY_TYPE_SCALE + +} Elm_Map_Overlay_Type; + +typedef struct _Elm_Map_Marker Elm_Map_Marker; /**< A marker to be shown in a specific point of the map. Can be created with elm_map_marker_add() and deleted with elm_map_marker_remove(). */ +typedef struct _Elm_Map_Marker_Class Elm_Map_Marker_Class; /**< Each marker must be associated to a class. It's required to add a mark. The class defines the style of the marker when a marker is displayed alone (not grouped). A new class can be created with elm_map_marker_class_new(). */ +typedef struct _Elm_Map_Group_Class Elm_Map_Group_Class; /**< Each marker must be associated to a group class. It's required to add a mark. The group class defines the style of the marker when a marker is grouped to other markers. Markers with the same group are grouped if they are close. A new group class can be created with elm_map_marker_group_class_new(). */ +typedef struct _Elm_Map_Route Elm_Map_Route; /**< A route to be shown in the map. Can be created with elm_map_route_add() and deleted with elm_map_route_remove(). */ +typedef struct _Elm_Map_Name Elm_Map_Name; /**< A handle for specific coordinates. */ +typedef struct _Elm_Map_Overlay Elm_Map_Overlay; /**< A overlay to be shown in a specific point of the map. This can be created by elm_map_overlay_add() and similar functions and deleted by elm_map_overlay_del(). */ + +typedef Evas_Object *(*Elm_Map_Marker_Get_Func)(Evas_Object *obj, Elm_Map_Marker *marker, void *data); /**< Bubble content fetching class function for marker classes. When the user click on a marker, a bubble is displayed with a content. */ +typedef void (*Elm_Map_Marker_Del_Func)(Evas_Object *obj, Elm_Map_Marker *marker, void *data, Evas_Object *o); /**< Function to delete bubble content for marker classes. */ +typedef Evas_Object *(*Elm_Map_Marker_Icon_Get_Func)(Evas_Object *obj, Elm_Map_Marker *marker, void *data); /**< Icon fetching class function for marker classes. */ +typedef Evas_Object *(*Elm_Map_Group_Icon_Get_Func)(Evas_Object *obj, void *data); /**< Icon fetching class function for markers group classes. */ + +typedef void (*Elm_Map_Overlay_Get_Cb)(void *data, Evas_Object *map, Elm_Map_Overlay *overlay); /**< Get callback function for the overlay. */ +typedef void (*Elm_Map_Name_Cb)(void *data, Evas_Object *map, Elm_Map_Name *name); /**< Async-callback function for the name request. */ +typedef void (*Elm_Map_Route_Cb)(void *data, Evas_Object *map, Elm_Map_Route *route); /**< Async-callback function for the route request. */ + +/** + * Add a new map widget to the given parent Elementary (container) object. + * + * @param parent The parent object. + * @return a new map widget handle or @c NULL, on errors. + * + * This function inserts a new map widget on the canvas. + * + * @ingroup Map + */ +EAPI Evas_Object *elm_map_add(Evas_Object *parent); + +/** + * Set the zoom level of the map. + * + * @param obj The map object. + * @param zoom The zoom level to set. + * + * This sets the zoom level. + * + * It will respect limits defined by elm_map_zoom_min_set() and + * elm_map_zoom_max_set(). + * + * By default these values are 0 (world map) and 18 (maximum zoom). + * + * This function should be used when zoom mode is set to + * #ELM_MAP_ZOOM_MODE_MANUAL. This is the default mode, and can be set + * with elm_map_zoom_mode_set(). + * + * @see elm_map_zoom_mode_set() + * @see elm_map_zoom_get() + * + * @ingroup Map + */ +EAPI void elm_map_zoom_set(Evas_Object *obj, int zoom); + +/** + * Get the zoom level of the map. + * + * @param obj The map object. + * @return The current zoom level. + * + * This returns the current zoom level of the map object. + * + * Note that if you set the fill mode to other than #ELM_MAP_ZOOM_MODE_MANUAL + * (which is the default), the zoom level may be changed at any time by the + * map object itself to account for map size and map viewport size. + * + * @see elm_map_zoom_set() for details. + * + * @ingroup Map + */ +EAPI int elm_map_zoom_get(const Evas_Object *obj); + +/** + * Set the zoom mode used by the map object. + * + * @param obj The map object. + * @param mode The zoom mode of the map, being it one of + * #ELM_MAP_ZOOM_MODE_MANUAL (default), #ELM_MAP_ZOOM_MODE_AUTO_FIT, + * or #ELM_MAP_ZOOM_MODE_AUTO_FILL. + * + * This sets the zoom mode to manual or one of the automatic levels. + * Manual (#ELM_MAP_ZOOM_MODE_MANUAL) means that zoom is set manually by + * elm_map_zoom_set() and will stay at that level until changed by code + * or until zoom mode is changed. This is the default mode. + * + * The Automatic modes will allow the map object to automatically + * adjust zoom mode based on properties. #ELM_MAP_ZOOM_MODE_AUTO_FIT will + * adjust zoom so the map fits inside the scroll frame with no pixels + * outside this area. #ELM_MAP_ZOOM_MODE_AUTO_FILL will be similar but + * ensure no pixels within the frame are left unfilled. Do not forget that + * the valid sizes are 2^zoom, consequently the map may be smaller than + * the scroller view. + * + * @see elm_map_zoom_set() + * + * @ingroup Map + */ +EAPI void elm_map_zoom_mode_set(Evas_Object *obj, Elm_Map_Zoom_Mode mode); + +/** + * Get the zoom mode used by the map object. + * + * @param obj The map object. + * @return The zoom mode of the map, being it one of + * #ELM_MAP_ZOOM_MODE_MANUAL (default), #ELM_MAP_ZOOM_MODE_AUTO_FIT, + * or #ELM_MAP_ZOOM_MODE_AUTO_FILL. + * + * This function returns the current zoom mode used by the map object. + * + * @see elm_map_zoom_mode_set() for more details. + * + * @ingroup Map + */ +EAPI Elm_Map_Zoom_Mode elm_map_zoom_mode_get(const Evas_Object *obj); + +/** + * Set the minimum zoom of the source. + * + * @param obj The map object. + * @param zoom New minimum zoom value to be used. + * + * @see elm_map_zoom_min_get() for details. + * + * @ingroup Map + */ +EAPI void elm_map_zoom_min_set(Evas_Object *obj, int zoom); + +/** + * Get the minimum zoom of the source. + * + * @param obj The map object. + * @return Returns the minimum zoom of the source. + * + * @see elm_map_zoom_min_set() for details. + * + * @ingroup Map + */ +EAPI int elm_map_zoom_min_get(const Evas_Object *obj); + +/** + * Set the maximum zoom of the source. + * + * @param obj The map object. + * @param zoom New maximum zoom value to be used. + * + * @see elm_map_zoom_max_get() for details. + * + * @ingroup Map + */ +EAPI void elm_map_zoom_max_set(Evas_Object *obj, int zoom); + +/** + * Get the maximum zoom of the source. + * + * @param obj The map object. + * @return Returns the maximum zoom of the source. + * + * @see elm_map_zoom_max_set() for details. + * + * @ingroup Map + */ +EAPI int elm_map_zoom_max_get(const Evas_Object *obj); + +/** + * Get the current geographic coordinates of the map. + * + * @param obj The map object. + * @param lon Pointer to store longitude. + * @param lat Pointer to store latitude. + * + * This gets the current center coordinates of the map object. It can be + * set by elm_map_region_bring_in() and elm_map_region_show(). + * + * @see elm_map_region_bring_in() + * @see elm_map_region_show() + * + * @ingroup Map + */ +EAPI void elm_map_region_get(const Evas_Object *obj, double *lon, double *lat); + +/** + * Animatedly bring in given coordinates to the center of the map. + * + * @param obj The map object. + * @param lon Longitude to center at. + * @param lat Latitude to center at. + * + * This causes map to jump to the given @p lat and @p lon coordinates + * and show it (by scrolling) in the center of the viewport, if it is not + * already centered. This will use animation to do so and take a period + * of time to complete. + * + * @see elm_map_region_show() for a function to avoid animation. + * @see elm_map_region_get() + * + * @ingroup Map + */ +EAPI void elm_map_region_bring_in(Evas_Object *obj, double lon, double lat); + +/** + * Show the given coordinates at the center of the map, @b immediately. + * + * @param obj The map object. + * @param lon Longitude to center at. + * @param lat Latitude to center at. + * + * This causes map to @b redraw its viewport's contents to the + * region containing the given @p lat and @p lon, that will be moved to the + * center of the map. + * + * @see elm_map_region_bring_in() for a function to move with animation. + * @see elm_map_region_get() + * + * @ingroup Map + */ +EAPI void elm_map_region_show(Evas_Object *obj, double lon, double lat); + +/** + * Convert canvas coordinates into geographic coordinates + * (longitude, latitude). + * + * @param obj The map object. + * @param x horizontal coordinate of the point to convert. + * @param y vertical coordinate of the point to convert. + * @param lon A pointer to the longitude. + * @param lat A pointer to the latitude. + * + * This gets longitude and latitude from canvas x, y coordinates. The canvas + * coordinates mean x, y coordinate from current viewport. + * + * see elm_map_region_to_canvas_convert() + * + * @ingroup Map + */ +EAPI void elm_map_canvas_to_region_convert(const Evas_Object *obj, const Evas_Coord x, const Evas_Coord y, double *lon, double *lat); + +/** + * Convert geographic coordinates (longitude, latitude) + * into canvas coordinates. + * + * @param obj The map object. + * @param lon The longitude to convert. + * @param lat The latitude to convert. + * @param x A pointer to horizontal coordinate. + * @param y A pointer to vertical coordinate. + * + * This gets canvas x, y coordinates from longitude and latitude. The canvas + * coordinates mean x, y coordinate from current viewport. + * + * see elm_map_canvas_to_region_convert() + * + * @ingroup Map + */ +EAPI void elm_map_region_to_canvas_convert(const Evas_Object *obj, double lon, double lat, Evas_Coord *x, Evas_Coord *y); + +/** + * Pause or unpause the map. + * + * @param obj The map object. + * @param paused Use @c EINA_TRUE to pause the map @p obj or @c EINA_FALSE + * to unpause it. + * + * This sets the paused state to on (@c EINA_TRUE) or off (@c EINA_FALSE) + * for map. + * + * The default is off. + * + * This will stop zooming using animation, changing zoom levels will + * change instantly. This will stop any existing animations that are running. + * + * @see elm_map_paused_get() + * + * @ingroup Map + */ +EAPI void elm_map_paused_set(Evas_Object *obj, Eina_Bool paused); + +/** + * Get a value whether map is paused or not. + * + * @param obj The map object. + * @return @c EINA_TRUE means map is pause. @c EINA_FALSE indicates + * it is not. + * + * This gets the current paused state for the map object. + * + * @see elm_map_paused_set() for details. + * + * @ingroup Map + */ +EAPI Eina_Bool elm_map_paused_get(const Evas_Object *obj); + +/** + * Rotate the map. + * + * @param obj The map object. + * @param degree Angle from 0.0 to 360.0 to rotate around Z axis. + * @param cx Rotation's center horizontal position. + * @param cy Rotation's center vertical position. + * + * @see elm_map_rotate_get() + * + * @ingroup Map + */ +EAPI void elm_map_rotate_set(Evas_Object *obj, double degree, Evas_Coord cx, Evas_Coord cy); + +/** + * Get the rotate degree of the map + * + * @param obj The map object + * @param degree Pointer to store degrees from 0.0 to 360.0 + * to rotate around Z axis. + * @param cx Pointer to store rotation's center horizontal position. + * @param cy Pointer to store rotation's center vertical position. + * + * @see elm_map_rotate_set() to set map rotation. + * + * @ingroup Map + */ +EAPI void elm_map_rotate_get(const Evas_Object *obj, double *degree, Evas_Coord *cx, Evas_Coord *cy); + +/** + * Enable or disable mouse wheel to be used to zoom in / out the map. + * + * @param obj The map object. + * @param disabled Use @c EINA_TRUE to disable mouse wheel or @c EINA_FALSE + * to enable it. + * + * Mouse wheel can be used for the user to zoom in or zoom out the map. + * + * It's disabled by default. + * + * @see elm_map_wheel_disabled_get() + * + * @ingroup Map + */ +EAPI void elm_map_wheel_disabled_set(Evas_Object *obj, Eina_Bool disabled); + +/** + * Get a value whether mouse wheel is enabled or not. + * + * @param obj The map object. + * @return @c EINA_TRUE means map is disabled. @c EINA_FALSE indicates + * it is enabled. + * + * Mouse wheel can be used for the user to zoom in or zoom out the map. + * + * @see elm_map_wheel_disabled_set() for details. + * + * @ingroup Map + */ +EAPI Eina_Bool elm_map_wheel_disabled_get(const Evas_Object *obj); + +/** + * Set the user agent used by the map object to access routing services. + * + * @param obj The map object. + * @param user_agent The user agent to be used by the map. + * + * User agent is a client application implementing a network protocol used + * in communications within a client–server distributed computing system + * + * The @p user_agent identification string will transmitted in a header + * field @c User-Agent. + * + * @see elm_map_user_agent_get() + * + * @ingroup Map + */ +EAPI void elm_map_user_agent_set(Evas_Object *obj, const char *user_agent); + +/** + * Get the user agent used by the map object. + * + * @param obj The map object. + * @return The user agent identification string used by the map. + * + * @see elm_map_user_agent_set() for details. + * + * @ingroup Map + */ +EAPI const char *elm_map_user_agent_get(const Evas_Object *obj); + + +/** + * Add a new overlay to the map object. This overlay has a default type. + * + * @param obj The map object to add a new overlay. + * @param lon The longitude of the overlay. + * @param lat The latitude of the overlay. + * @return The created overlay or @c NULL upon failure. + * + * A overlay will be created and shown in a specific point of the map, defined + * by @p lon and @p lat. + * + * The created overlay has a default style layout before content or + * icon is set. + * If content or icon is set, those are displayed instead of default style + * layout. + * You can set by using elm_map_overlay_content_set() or + * elm_map_overlay_icon_set(). If NULL is set, default style + * is shown again. + * + * Overlay created with this method can be deleted by elm_map_overlay_del(). + * + * @see elm_map_overlay_del() + * @see elm_map_overlay_class_add() + * @see elm_map_overlay_bubble_add() + * @see elm_map_overlay_content_set() + * @see elm_map_overlay_icon_set() + * + * @ingroup Map + */ +EAPI Elm_Map_Overlay * elm_map_overlay_add(Evas_Object *obj, double lon, double lat); + +/** + * Delete a overlay from the map. This function can delete all types + * of overlays. + * + * @param overlay The overlay to be deleted. + * + * @see elm_map_overlay_add() + * @see elm_map_overlay_class_add() + * @see elm_map_overlay_bubble_add() + * + * @ingroup Map + */ +EAPI void elm_map_overlay_del(Elm_Map_Overlay *overlay); + +/** + * Get the overlay type. + * + * @param overlay The overlay to return type. + * @return Return the overlay type. + * + * This type is resolved when the overlay is created. + * + * @see elm_map_overlay_add() + * @see elm_map_overlay_class_add() + * @see elm_map_overlay_bubble_add() + * + * @ingroup Map + */ +EAPI Elm_Map_Overlay_Type elm_map_overlay_type_get(const Elm_Map_Overlay *overlay); + + /** + * Set a pointer of user data for a overlay. + * + * @param overlay The overlay to own the user data. + * @param data A pointer of user data + * + * @see elm_map_overlay_data_get() + * + * @ingroup Map + */ +EAPI void elm_map_overlay_data_set(Elm_Map_Overlay *overlay, void *data); + +/** + * Get the user data stored on a overlay. + * + * @param overlay The overlay to return the user data. + * @return A pointer to data stored using elm_map_overlay_data_set(), + * or @c NULL, if none has been set. + * + * @see elm_map_overlay_data_set() + * + * @ingroup Map + */ +EAPI void * elm_map_overlay_data_get(const Elm_Map_Overlay *overlay); + +/** + * Set if the overlay is hidden or not. + * + * @param overlay The overlay to be hidden. + * @param hide Use @c EINA_TRUE to hide the overlay or @c EINA_FALSE to show. + * + * @see elm_map_overlay_hide_get() + * + * @ingroup Map + */ +EAPI void elm_map_overlay_hide_set(Elm_Map_Overlay *overlay, Eina_Bool hide); + +/** + * Get a value whether the overlay is hidden or not. + * + * @param overlay The overlay to return the hidden state. + * @return @c EINA_TRUE means the overlay is hidden. @c EINA_FALSE indicates + * it is not. + * + * This gets the current hidden state for the overlay. + * + * @see elm_map_overlay_hide_set() + * + * @ingroup Map + */ +EAPI Eina_Bool elm_map_overlay_hide_get(const Elm_Map_Overlay *overlay); + +/** + * Set the minimum zoom from where the overlay is displayed. + * + * @param overlay The overlay to be set the minimum zoom. + * @param zoom The minimum zoom. + * + * The overlay only will be displayed when the map is displayed at @p zoom + * or bigger. + * + * @see elm_map_overlay_displayed_zoom_min_get() + * + * @ingroup Map + */ +EAPI void elm_map_overlay_displayed_zoom_min_set(Elm_Map_Overlay *overlay, int zoom); + +/** + * Get the minimum zoom from where the overlay is displayed. + * + * @param overlay The overlay to return the minimum zoom. + * @return zoom The minimum zoom. + * + * @see elm_map_overlay_displayed_zoom_min_set() + * + * @ingroup Map + */ +EAPI int elm_map_overlay_displayed_zoom_min_get(const Elm_Map_Overlay *overlay); + +/** + * Pause or unpause the overlay. + * + * @param overlay The overlay to be paused. + * @param paused Use @c EINA_TRUE to pause the @p overlay or @c EINA_FALSE + * to unpause it. + * + * This sets the paused state to on (@c EINA_TRUE) or off (@c EINA_FALSE) + * for the overlay. + * + * The default is off. + * + * This will stop moving the overlay coordinates instantly. + * even if map being scrolled or zoomed. + * + * @see elm_map_overlay_paused_get() + * + * @ingroup Map + */ +EAPI void elm_map_overlay_paused_set(Elm_Map_Overlay *overlay, Eina_Bool paused); + +/** + * Get a value whether the overlay is paused or not. + * + * @param overlay The overlay to return paused state. + * @return @c EINA_TRUE means overlay is paused. @c EINA_FALSE indicates + * it is not. + * + * This gets the current paused state for the overlay. + * + * @see elm_map_overlay_paused_set() + * + * @ingroup Map + */ +EAPI Eina_Bool elm_map_overlay_paused_get(const Elm_Map_Overlay *overlay); + +/** + * Set the content object of the overlay. + * + * @param overlay The overlay to be set the content. + * @param obj The evas object will be used to display the overlay. + * + * Only default and class type overlay support this function. + * + * The content should be resized or set size hints before set to the overlay. + * Do not modify this object (move, show, hide, del, etc.), + * after set. + * You can only resize this. + * + * This content is what will be inside the overlay that will be displayed. + * If a content is set, icon and default style layout are no more used before + * the content is deleted. + * + * If @p obj is @c NULL, content inside the overlay is deleted. + * + * @see elm_map_overlay_content_get() + * + * @ingroup Map + */ +EAPI void elm_map_overlay_content_set(Elm_Map_Overlay *overlay, Evas_Object *obj); + +/** + * Get the content object. + * + * @param overlay The overlay to return the content. + * @return Return the evas object if it exists, else @c NULL. + * + * Only default and class type overlay support this function. + * + * Returned content is what being inside the overlay that being displayed. + * + * Do not modify this object (move, show, hide, del, etc.). + * You can only resize this. + * + * The content can be set by elm_map_overlay_content_set(). + * + * @see elm_map_overlay_content_set() + * + * @ingroup Map + */ +EAPI const Evas_Object * elm_map_overlay_content_get(const Elm_Map_Overlay *overlay); + +/** + * Set a icon of the overlay. + * + * @param overlay The overlay to be set the icon. + * @param icon The icon will be used to display the overlay. + * + * Only default and class type overlay support this function. + * + * Do not modify this object (move, show, hide, resize, del, etc.), + * after set. + * + * If icon is set, default style layout will not be used. + * + * If @p icon is @c NULL, icon inside the overlay will be deleted. + * + * @see elm_map_overlay_icon_get() + * + * @ingroup Map + */ +EAPI void elm_map_overlay_icon_set(Elm_Map_Overlay *overlay, Evas_Object *icon); + +/** + * Get the icon object. + * + * @param overlay The overlay to return the icon. + * @return Return the icon object if it exists, else @c NULL. + * + * Only default and class type overlay support this function. + * + * Returned icon is what being inside the overlay that being displayed. + * + * Do not modify this icon (move, show, hide, resize, del, etc.). + * + * The icon can be set by elm_map_overlay_icon_set(). + * + * @see elm_map_overlay_icon_set() + * + * @ingroup Map + */ +EAPI const Evas_Object * elm_map_overlay_icon_get(const Elm_Map_Overlay *overlay); + +/** + * Set the geographic coordinates of the overlay. + * + * @param overlay The overlay to be set geographic coordinates. + * @param lon Longitude to be set. + * @param lat Latitude to be set. + * + * Only default and bubble type overlay support this function. + * + * This sets the center coordinates of the overlay. It can be + * get by elm_map_overlay_region_get(). + * + * @see elm_map_overlay_region_get() + * + * @ingroup Map + */ +EAPI void elm_map_overlay_region_set(Elm_Map_Overlay *overlay, double lon, double lat); + +/** + * Get the geographic coordinates of the overlay. + * + * @param overlay The overlay to return geographic coordinates. + * @param lon Pointer to store longitude. + * @param lat Pointer to store latitude. + * + * Only default and bubble type overlay support this function. + * + * This returns the center coordinates of the overlay. It can be + * set by elm_map_overlay_region_set(). + * + * @see elm_map_overlay_region_set() + * + * @ingroup Map + */ +EAPI void elm_map_overlay_region_get(const Elm_Map_Overlay *overlay, double *lon, double *lat); + + +/** + * Set the object color of the overlay. + * + * @param overlay The overlay to be set color. + * @param r Red channel value, from 0 to 255. + * @param g Green channel value, from 0 to 255. + * @param b Blue channel value, from 0 to 255. + * @param a Alpha channel value, from 0 to 255. + * + * It uses an additive color model, so each color channel represents + * how much of each primary colors must to be used. 0 represents + * absence of this color, so if all of the three are set to 0, + * the color will be black. + * + * These component values should be integers in the range 0 to 255, + * (single 8-bit byte). + * + * This sets the color used for the overlay. By default, it is set to + * solid red (r = 255, g = 0, b = 0, a = 255). + * + * For alpha channel, 0 represents completely transparent, and 255, opaque. + * + * @see elm_map_overlay_color_get() + * + * @ingroup Map + */ +EAPI void elm_map_overlay_color_set(Elm_Map_Overlay *overlay, int r, int g, int b, int a); + +/** + * Get the object color of the overlay. + * + * @param overlay The overlay to return color. + * @param r Pointer to store the red channel value. + * @param g Pointer to store the green channel value. + * @param b Pointer to store the blue channel value. + * @param a Pointer to store the alpha channel value. + * + * @see elm_map_overlay_color_set() + * + * @ingroup Map + */ +EAPI void elm_map_overlay_color_get(const Elm_Map_Overlay *overlay, int *r, int *g, int *b, int *a); + +/** + * Show the given overlay at the center of the map, immediately. + * + * @param overlay The overlay to be center at. + * + * This causes map to @b redraw its viewport's contents to the + * region containing the given @p overlay's coordinates, that will be + * moved to the center of the map. + * + * @see elm_map_overlays_show() if more than one overlay need to be displayed. + * + * @ingroup Map + */ +EAPI void elm_map_overlay_show(Elm_Map_Overlay *overlay); + +/** + * Move and zoom the map to display a list of overlays. + * + * @param overlays A list of #Elm_Map_Overlay handles. + * + * The map will be centered on the center point of the overlays in the list. + * Then the map will be zoomed in order to fit the overlays using the maximum + * zoom which allows display of all the overlays. + * + * @warning All the overlays should belong to the same map object. + * + * @see elm_map_overlay_show() to show a single overlay. + * + * @ingroup Map + */ +EAPI void elm_map_overlays_show(Eina_List *overlays); + +/** + * Set the get callback function of the overlay. + * + * @param overlay The overlay to own the get callback function. + * @param get_cb The callback function. + * @param data The user callback data. + * + * If the overlay is clicked, the callback wll be called. + * The clicked overlay is returned by callback. + * + * You can add callback to the class overlay. If one of the group overlays in this class + * is clicked, callback will be called and return a virtual group overlays. + * + * You can delete this callback function by setting @c NULL. + * + * @ingroup Map + */ +EAPI void elm_map_overlay_get_cb_set(Elm_Map_Overlay *overlay, Elm_Map_Overlay_Get_Cb get_cb, void *data); + + +/** + * Add a new class overlay to the map object. + * This overlay has a class type. + * + * @param obj The map object to add a new overlay. + * @return The created overlay or @c NULL upon failure. + * + * This overlay is not shown before overlay members are appended. + * if overlay members in the same class are close, group overlays + * are created. If they are far away, group overlays are hidden. + * When group overlays are shown, they have default style layouts at first. + * + * You can change the state (hidden, paused, etc.) or set the content + * or icon of the group overlays by chaning the state of the class overlay. + * Do not modifty the group overlay itself. + * + * Also these changes have a influence on the overlays in the same class + * even if each overlay is alone and is not grouped. + * + * @see elm_map_overlay_del() + * @see elm_map_overlay_add() + * @see elm_map_overlay_bubble_add() + * + * @ingroup Map + */ +EAPI Elm_Map_Overlay * elm_map_overlay_class_add(Evas_Object *obj); + +/** + * Add a new overlay member to the class overlay. + * + * @param clas The class overlay to add a new overlay. + * @param overlay The overlay to be added to the class overlay. + * + * @see elm_map_overlay_class_remove() + * + * @ingroup Map + */ +EAPI void elm_map_overlay_class_append(Elm_Map_Overlay *clas, Elm_Map_Overlay *overlay); + +/** + * Remove a overlay from the class. + * + * @param clas The class overlay to delete the overlay. + * @param overlay The overlay to be deleted from the class overlay. + * + * @see elm_map_overlay_class_append() + * + * @ingroup Map + */ +EAPI void elm_map_overlay_class_remove(Elm_Map_Overlay *clas, Elm_Map_Overlay *overlay); + +/** + * Set the maximum zoom from where the overlay members in the class can be + * grouped. + * + * @param clas The overlay class has overlay members. + * @param zoom The maximum zoom. + * + * Overlay members in the class only will be grouped when the map + * is displayed at less than @p zoom. + * + * @see elm_map_overlay_class_zoom_max_get() + * + * @ingroup Map + */ +EAPI void elm_map_overlay_class_zoom_max_set(Elm_Map_Overlay *clas, int zoom); + +/** + * Get the maximum zoom from where the overlay members in the class can be + * grouped. + * + * @param clas The overlay class has overlay members. + * + * @return The maximum zoom. + * + * @see elm_map_overlay_class_zoom_max_set() + * + * @ingroup Map + */ +EAPI int elm_map_overlay_class_zoom_max_get(const Elm_Map_Overlay *clas); + +/** + * Get the overlay members of the group overlay. + * + * @param grp The group overlay has overlay members. + * + * @return The list of group overlay members. + * + * The group overlays are virtualy overlays. Those are shown and hidden dynamically. + * You can add callback to the class overlay. If one of the group overlays in this class + * is clicked, callback will be called and return a virtual group overlays. + * + * You can change the state (hidden, paused, etc.) or set the content + * or icon of the group overlays by chaning the state of the class overlay. + * Do not modifty the group overlay itself. + * + * @see elm_map_overlay_class_add() + * + * @ingroup Map + */ +EAPI Eina_List * elm_map_overlay_group_members_get(const Elm_Map_Overlay *grp); + +/** + * Add a new bubble overlay to the map object. + * This overlay has a bubble type. + * + * @param obj The map object to add a new overlay. + * @return The created overlay or @c NULL upon failure. + * + * A bubble will not be displayed before geographic coordinates are set or + * any other overlays are followed. + * + * This overlay has a bubble style layout and icon or content can not + * be set. + * + * Overlay created with this method can be deleted with elm_map_overlay_del(). + * + * @see elm_map_overlay_del() + * @see elm_map_overlay_add() + * @see elm_map_overlay_class_add() + * @see elm_map_overlay_region_set() + * @see elm_map_overlay_bubble_follow() + * + * @ingroup Map + */ +EAPI Elm_Map_Overlay * elm_map_overlay_bubble_add(Evas_Object *obj); + +/** + * Follow a other overlay. + * + * @param bubble The bubble overlay to follow a parent overlay. + * @param parent The parent overlay to be followed by the bubble overlay. + * + * Bubble overlay will follow the parent overlay's movement (hide, show, move). + * + * @see elm_map_overlay_bubble_add() + * + * @ingroup Map + */ +EAPI void elm_map_overlay_bubble_follow(Elm_Map_Overlay *bubble, const Elm_Map_Overlay *parent); + +/** + * Add a content object to the bubble overlay. + * + * @param bubble The bubble overlay to add a content. + * @param content The content to be added to the bubble overlay. + * + * Added contents will be displayed inside the bubble overlay. + * + * @see elm_map_overlay_bubble_content_clear() + * + * @ingroup Map + */ +EAPI void elm_map_overlay_bubble_content_append(Elm_Map_Overlay *bubble, Evas_Object *content); + +/** + * Clear all contents inside the bubble overlay. + * + * @param bubble The bubble overlay to clear the contents. + * + * This will delete all contents inside the bubble overlay. + * + * @see elm_map_overlay_bubble_content_append() + * + * @ingroup Map + */ +EAPI void elm_map_overlay_bubble_content_clear(Elm_Map_Overlay *bubble); + +/** + * Add a new route overlay to the map object. + * This overlay has a route type. + * + * @param obj The map object to add a new overlay. + * @param route The route object to make a overlay. + * @return The created overlay or @c NULL upon failure. + * + * This overlay has a route style layout and icon or content can not + * be set. + * + * The color scheme can be changed by elm_map_overlay_content_set(). + * + * Overlay created with this method can be deleted with elm_map_overlay_del(). + * + * @see elm_map_overlay_del() + * @see elm_map_overlay_class_add() + * @see elm_map_overlay_content_set() + * @see elm_map_overlay_content_get() + * + * @ingroup Map + */ +EAPI Elm_Map_Overlay * elm_map_overlay_route_add(Evas_Object *obj, const Elm_Map_Route *route); + +/** + * Add a new line overlay to the map object. + * This overlay has a line type. + * + * @param obj The map object to add a new overlay. + * @param flon The start longitude. + * @param flat The start latitude. + * @param tlon The destination longitude. + * @param tlat The destination latitude. + * @return The created overlay or @c NULL upon failure. + * + * Overlay created with this method can be deleted with elm_map_overlay_del(). + * + * @see elm_map_overlay_del() + * + * @ingroup Map + */ +EAPI Elm_Map_Overlay * elm_map_overlay_line_add(Evas_Object *obj, double flon, double flat, double tlon, double tlat); + +/** + * Add a new polygon overlay to the map object. + * This overlay has a polygon type. + * + * @param obj The map object to add a new overlay. + * @return The created overlay or @c NULL upon failure. + * + * At least 3 regions should be added to show the polygon overlay. + * + * Overlay created with this method can be deleted with elm_map_overlay_del(). + * + * @see elm_map_overlay_polygon_region_add() + * @see elm_map_overlay_del() + * + * @ingroup Map + */ +EAPI Elm_Map_Overlay * elm_map_overlay_polygon_add(Evas_Object *obj); + +/** + * Add a geographic coordinates to the polygon overlay. + * + * @param overlay The polygon overlay to get a region. + * @param lon The longitude. + * @param lat The latitude. + * + * At least 3 regions should be added to show the polygon overlay. + * + * Overlay created with this method can be deleted with elm_map_overlay_del(). + * + * @see elm_map_overlay_polygon_add() + * @see elm_map_overlay_del() + * + * @ingroup Map + */ +EAPI void elm_map_overlay_polygon_region_add(Elm_Map_Overlay *overlay, double lon, double lat); + +/** + * Add a new circle overlay to the map object. + * This overlay has a circle type. + * + * @param obj The map object to add a new overlay. + * @param lon The center longitude. + * @param lat The center latitude. + * @param radius The pixel length of radius. + * @return The created overlay or @c NULL upon failure. + * + * Overlay created with this method can be deleted with elm_map_overlay_del(). + * + * @see elm_map_overlay_del() + * + * @ingroup Map + */ +EAPI Elm_Map_Overlay * elm_map_overlay_circle_add(Evas_Object *obj, double lon, double lat, double radius); + +/** + * Add a new scale overlay to the map object. + * This overlay has a scale type. + * + * @param obj The map object to add a new overlay. + * @param x horizontal pixel coordinate. + * @param y vertical pixel coordinate + * @return The created overlay or @c NULL upon failure. + * + * The scale overlay shows the ratio of a distance on the map to the corresponding distance. + * + * Overlay created with this method can be deleted with elm_map_overlay_del(). + * + * @see elm_map_overlay_del() + * + * @ingroup Map + */ +EAPI Elm_Map_Overlay * elm_map_overlay_scale_add(Evas_Object *obj, Evas_Coord x, Evas_Coord y); + +/** + * Get the information of tile load status. + * + * @param obj The map object. + * @param try_num Pointer to store number of tiles download requested. + * @param finish_num Pointer to store number of tiles successfully downloaded. + * + * This gets the current tile loaded status for the map object. + * + * @ingroup Map + */ +EAPI void elm_map_tile_load_status_get(const Evas_Object *obj, int *try_num, int *finish_num); + +/** + * Get the names of available sources for a specific type. + * + * @param obj The map object. + * @param type source type. + * @return The char pointer array of source names. + * + * It will provide a list with all available sources. + * Current source can be set by elm_map_source_set(), or get with + * elm_map_source_get(). + * + * At least available sources of tile type: + * @li "Mapnik" + * @li "Osmarender" + * @li "CycleMap" + * @li "Maplint" + * + * At least available sources of route type: + * @li "Yours" + * + * At least available sources of name type: + * @li "Nominatim" + * + * @see elm_map_source_set() + * @see elm_map_source_get() + * + * @ingroup Map + */ +EAPI const char **elm_map_sources_get(const Evas_Object *obj, Elm_Map_Source_Type type); + +/** + * Set the current source of the map for a specific type. + * + * @param obj The map object. + * @param type source type. + * @param source_name The source to be used. + * + * Map widget retrieves tile images that composes the map from a web service. + * This web service can be set with this method + * for ELM_MAP_SOURCE_TYPE_TILE type. + * A different service can return a different maps with different + * information and it can use different zoom values. + * + * Map widget provides route data based on a external web service. + * This web service can be set with this method + * for ELM_MAP_SOURCE_TYPE_ROUTE type. + * + * Map widget also provide geoname data based on a external web service. + * This web service can be set with this method + * for ELM_MAP_SOURCE_TYPE_NAME type. + * + * The @p source_name need to match one of the names provided by + * elm_map_sources_get(). + * + * The current source can be get using elm_map_source_get(). + * + * @see elm_map_sources_get() + * @see elm_map_source_get() + * + * @ingroup Map + */ +EAPI void elm_map_source_set(Evas_Object *obj, Elm_Map_Source_Type type, const char *source_name); + +/** + * Get the name of currently used source for a specific type. + * + * @param obj The map object. + * @param type source type. + * @return Returns the name of the source in use. + * + * @see elm_map_sources_get() + * @see elm_map_source_set() + * + * @ingroup Map + */ +EAPI const char *elm_map_source_get(const Evas_Object *obj, Elm_Map_Source_Type type); + +/** + * Add a new route to the map object. + * + * @param obj The map object. + * @param type The type of transport to be considered when tracing a route. + * @param method The routing method, what should be prioritized. + * @param flon The start longitude. + * @param flat The start latitude. + * @param tlon The destination longitude. + * @param tlat The destination latitude. + * + * @return The created route or @c NULL upon failure. + * + * A route will be traced by point on coordinates (@p flat, @p flon) + * to point on coordinates (@p tlat, @p tlon), using the route service + * set with elm_map_source_set(). + * + * It will take @p type on consideration to define the route, + * depending if the user will be walking or driving, the route may vary. + * One of #ELM_MAP_ROUTE_TYPE_MOTOCAR, #ELM_MAP_ROUTE_TYPE_BICYCLE, or + * #ELM_MAP_ROUTE_TYPE_FOOT need to be used. + * + * Another parameter is what the route should prioritize, the minor distance + * or the less time to be spend on the route. So @p method should be one + * of #ELM_MAP_ROUTE_METHOD_SHORTEST or #ELM_MAP_ROUTE_METHOD_FASTEST. + * + * Routes created with this method can be deleted with + * elm_map_route_remove(), + * and distance can be get with elm_map_route_distance_get(). + * + * @see elm_map_route_remove() + * @see elm_map_route_distance_get() + * @see elm_map_source_set() + * + * @ingroup Map + */ +EAPI Elm_Map_Route *elm_map_route_add(Evas_Object *obj, Elm_Map_Route_Type type, Elm_Map_Route_Method method, double flon, double flat, double tlon, double tlat, Elm_Map_Route_Cb route_cb, void *data); + +/** + * Remove a route from the map. + * + * @param route The route to remove. + * + * @see elm_map_route_add() + * + * @ingroup Map + */ +EAPI void elm_map_route_del(Elm_Map_Route *route); + +/** + * Get the route distance in kilometers. + * + * @param route The route object. + * @return The distance of route (unit : km). + * + * @ingroup Map + */ +EAPI double elm_map_route_distance_get(const Elm_Map_Route *route); + +/** + * Get the information of route nodes. + * + * @param route The route object. + * @return Returns a string with the nodes of route. + * + * @ingroup Map + */ +EAPI const char *elm_map_route_node_get(const Elm_Map_Route *route); + +/** + * Get the information of route waypoint. + * + * @param route the route object. + * @return Returns a string with information about waypoint of route. + * + * @ingroup Map + */ +EAPI const char *elm_map_route_waypoint_get(const Elm_Map_Route *route); + +/** + * Request a address or geographic coordinates(longitude, latitude) + * from a given address or geographic coordinate(longitude, latitude). + * + * @param obj The map object. + * @param address The address. + * @param lon The longitude. + * @param lat The latitude. + * @param name_cb The callback function. + * @param data The user callback data. + * @return name A #Elm_Map_Name handle for this coordinate. + * + * If you want to get address from geographic coordinates, set input @p address + * as NULL and set @p lon, @p lat as you want to convert. + * If address is set except NULL, @p lon and @p lat are checked. + * + * To get the string for this address, elm_map_name_address_get() + * should be used after callback or "name,loaded" signal is called. + * + * To get the longitude and latitude, elm_map_name_region_get() + * should be used. + * + * @ingroup Map + */ +EAPI Elm_Map_Name *elm_map_name_add(const Evas_Object *obj, const char *address, double lon, double lat, Elm_Map_Name_Cb name_cb, void *data); + +/** + * Get the address of the name. + * + * @param name The name handle. + * @return Returns the address string of @p name. + * + * This gets the coordinates of the @p name, created with one of the + * conversion functions. + * + * @see elm_map_name_add() + * + * @ingroup Map + */ +EAPI const char *elm_map_name_address_get(const Elm_Map_Name *name); + +/** + * Get the current coordinates of the name. + * + * @param name The name handle. + * @param lat Pointer to store the latitude. + * @param lon Pointer to store The longitude. + * + * This gets the coordinates of the @p name, created with one of the + * conversion functions. + * + * @see elm_map_name_add() + * + * @ingroup Map + */ +EAPI void elm_map_name_region_get(const Elm_Map_Name *name, double *lon, double *lat); + +/** + * Remove a name from the map. + * + * @param name The name to remove. + * + * Basically the struct handled by @p name will be freed, so conversions + * between address and coordinates will be lost. + * + * @see elm_map_name_add() + * + * @ingroup Map + */ +EAPI void elm_map_name_del(Elm_Map_Name *name); + +/** + * Add a track on the map + * + * @param obj The map object. + * @param emap The emap route object. + * @return The route object. This is an elm object of type Route. + * + * @see elm_route_add() for details. + * + * @ingroup Map + */ +EAPI Evas_Object *elm_map_track_add(Evas_Object *obj, void *emap); + +/** + * Remove a track from the map + * + * @param obj The map object. + * @param route The track to remove. + * + * @ingroup Map + */ +EAPI void elm_map_track_remove(Evas_Object *obj, Evas_Object *route); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_mapbuf.c b/libraries/elementary/src/lib/elm_mapbuf.c new file mode 100644 index 0000000..4608872 --- /dev/null +++ b/libraries/elementary/src/lib/elm_mapbuf.c @@ -0,0 +1,305 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *content, *clip; + Eina_Bool enabled : 1; + Eina_Bool alpha : 1; + Eina_Bool smooth : 1; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _sub_del(void *data, Evas_Object *obj, void *event_info); + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + free(wd); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _sizing_eval(obj); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1; + Evas_Coord maxw = -1, maxh = -1; + if (!wd) return; + if (wd->content) + { + evas_object_size_hint_min_get(wd->content, &minw, &minh); + evas_object_size_hint_max_get(wd->content, &maxw, &maxh); + } + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, maxw, maxh); +} + +static void +_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + _sizing_eval(data); +} + +static void +_sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *sub = event_info; + if (!wd) return; + if (sub == wd->content) + { + evas_object_event_callback_del_full(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + wd->content = NULL; + _sizing_eval(obj); + } +} + +static void +_mapbuf(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord x, y, w, h; + if (!wd) return; + evas_object_geometry_get(wd->clip, &x, &y, &w, &h); + if (wd->enabled) + { + Evas_Map *m; + + m = evas_map_new(4); + evas_map_util_points_populate_from_geometry(m, x, y, w, h, 0); + evas_map_smooth_set(m, wd->smooth); + evas_map_alpha_set(m, wd->alpha); + evas_object_map_set(wd->content, m); + evas_object_map_enable_set(wd->content, EINA_TRUE); + evas_map_free(m); + } + else + { + evas_object_map_set(wd->content, NULL); + evas_object_map_enable_set(wd->content, EINA_FALSE); + evas_object_move(wd->content, x, y); + evas_object_resize(wd->content, w, h); + } +} + +static void +_configure(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->content) + { + Evas_Coord x, y, w, h, x2, y2; + + evas_object_geometry_get(wd->clip, &x, &y, &w, &h); + evas_object_geometry_get(wd->content, &x2, &y2, NULL, NULL); + if ((x != x2) || (y != y2)) + { + if (!wd->enabled) + evas_object_move(wd->content, x, y); + else + { + + Evas *e = evas_object_evas_get(obj); + evas_smart_objects_calculate(e); + evas_nochange_push(e); + evas_object_move(wd->content, x, y); + evas_smart_objects_calculate(e); + evas_nochange_pop(e); + } + } + evas_object_resize(wd->content, w, h); + _mapbuf(obj); + } +} + +static void +_move(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _configure(data); +} + +static void +_resize(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _configure(data); +} + +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd; + + if (part && strcmp(part, "default")) return; + wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->content == content) return; + if (wd->content) evas_object_del(wd->content); + wd->content = content; + if (content) + { + evas_object_data_set(content, "_elm_leaveme", (void *)1); + elm_widget_sub_object_add(obj, content); + evas_object_smart_member_add(content, obj); + evas_object_clip_set(content, wd->clip); + evas_object_color_set(wd->clip, 255, 255, 255, 255); + evas_object_event_callback_add(content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + } + else + evas_object_color_set(wd->clip, 0, 0, 0, 0); + _sizing_eval(obj); + _configure(obj); +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + + if (part && strcmp(part, "default")) return NULL; + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->content; +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + Evas_Object *content; + + if (part && strcmp(part, "default")) return NULL; + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (!wd->content) return NULL; + content = wd->content; + elm_widget_sub_object_del(obj, content); + evas_object_smart_member_del(content); + evas_object_color_set(wd->clip, 0, 0, 0, 0); + evas_object_data_del(content, "_elm_leaveme"); + return content; +} + +EAPI Evas_Object * +elm_mapbuf_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "mapbuf"); + elm_widget_type_set(obj, "mapbuf"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); + + wd->clip = evas_object_rectangle_add(e); + evas_object_static_clip_set(wd->clip, EINA_TRUE); + evas_object_pass_events_set(wd->clip, EINA_TRUE); + evas_object_color_set(wd->clip, 0, 0, 0, 0); + + evas_object_event_callback_add(wd->clip, EVAS_CALLBACK_MOVE, _move, obj); + evas_object_event_callback_add(wd->clip, EVAS_CALLBACK_RESIZE, _resize, obj); + evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + + elm_widget_resize_object_set(obj, wd->clip); + + wd->enabled = 0; + wd->alpha = 1; + wd->smooth = 1; + + _sizing_eval(obj); + return obj; +} + +EAPI void +elm_mapbuf_enabled_set(Evas_Object *obj, Eina_Bool enabled) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->enabled == enabled) return; + wd->enabled = enabled; + if (wd->content) evas_object_static_clip_set(wd->content, wd->enabled); + _configure(obj); +} + +EAPI Eina_Bool +elm_mapbuf_enabled_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->enabled; +} + +EAPI void +elm_mapbuf_smooth_set(Evas_Object *obj, Eina_Bool smooth) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->smooth == smooth) return; + wd->smooth = smooth; + _configure(obj); +} + +EAPI Eina_Bool +elm_mapbuf_smooth_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->smooth; +} + +EAPI void +elm_mapbuf_alpha_set(Evas_Object *obj, Eina_Bool alpha) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->alpha == alpha) return; + wd->alpha = alpha; + _configure(obj); +} + +EAPI Eina_Bool +elm_mapbuf_alpha_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->alpha; +} diff --git a/libraries/elementary/src/lib/elm_mapbuf.h b/libraries/elementary/src/lib/elm_mapbuf.h new file mode 100644 index 0000000..462d758 --- /dev/null +++ b/libraries/elementary/src/lib/elm_mapbuf.h @@ -0,0 +1,149 @@ +/** + * @defgroup Mapbuf Mapbuf + * @ingroup Elementary + * + * @image html img/widget/mapbuf/preview-00.png + * @image latex img/widget/mapbuf/preview-00.eps width=\textwidth + * + * This holds one content object and uses an Evas Map of transformation + * points to be later used with this content. So the content will be + * moved, resized, etc as a single image. So it will improve performance + * when you have a complex interface, with a lot of elements, and will + * need to resize or move it frequently (the content object and its + * children). + * + * Default content parts of the mapbuf widget that you can use for are: + * @li "default" - A content of the mapbuf + * + * Supported elm_object common APIs. + * @li @ref elm_object_part_content_set + * @li @ref elm_object_part_content_get + * @li @ref elm_object_part_content_unset + * + * To enable map, elm_mapbuf_enabled_set() should be used. + * + * See how to use this widget in this example: + * @ref mapbuf_example + */ + +/** + * @addtogroup Mapbuf + * @{ + */ + +/** + * Add a new mapbuf widget to the given parent Elementary + * (container) object. + * + * @param parent The parent object. + * @return A new mapbuf widget handle or @c NULL, on errors. + * + * This function inserts a new mapbuf widget on the canvas. + * + * @ingroup Mapbuf + */ +EAPI Evas_Object *elm_mapbuf_add(Evas_Object *parent); + +/** + * Enable or disable the map. + * + * @param obj The mapbuf object. + * @param enabled @c EINA_TRUE to enable map or @c EINA_FALSE to disable it. + * + * This enables the map that is set or disables it. On enable, the object + * geometry will be saved, and the new geometry will change (position and + * size) to reflect the map geometry set. + * + * Also, when enabled, alpha and smooth states will be used, so if the + * content isn't solid, alpha should be enabled, for example, otherwise + * a black rectangle will fill the content. + * + * When disabled, the stored map will be freed and geometry prior to + * enabling the map will be restored. + * + * It's disabled by default. + * + * @see elm_mapbuf_alpha_set() + * @see elm_mapbuf_smooth_set() + * + * @ingroup Mapbuf + */ +EAPI void elm_mapbuf_enabled_set(Evas_Object *obj, Eina_Bool enabled); + +/** + * Get a value whether map is enabled or not. + * + * @param obj The mapbuf object. + * @return @c EINA_TRUE means map is enabled. @c EINA_FALSE indicates + * it's disabled. If @p obj is @c NULL, @c EINA_FALSE is returned. + * + * @see elm_mapbuf_enabled_set() for details. + * + * @ingroup Mapbuf + */ +EAPI Eina_Bool elm_mapbuf_enabled_get(const Evas_Object *obj); + +/** + * Enable or disable smooth map rendering. + * + * @param obj The mapbuf object. + * @param smooth @c EINA_TRUE to enable smooth map rendering or @c EINA_FALSE + * to disable it. + * + * This sets smoothing for map rendering. If the object is a type that has + * its own smoothing settings, then both the smooth settings for this object + * and the map must be turned off. + * + * By default smooth maps are enabled. + * + * @ingroup Mapbuf + */ +EAPI void elm_mapbuf_smooth_set(Evas_Object *obj, Eina_Bool smooth); + +/** + * Get a value whether smooth map rendering is enabled or not. + * + * @param obj The mapbuf object. + * @return @c EINA_TRUE means smooth map rendering is enabled. @c EINA_FALSE + * indicates it's disabled. If @p obj is @c NULL, @c EINA_FALSE is returned. + * + * @see elm_mapbuf_smooth_set() for details. + * + * @ingroup Mapbuf + */ +EAPI Eina_Bool elm_mapbuf_smooth_get(const Evas_Object *obj); + +/** + * Set or unset alpha flag for map rendering. + * + * @param obj The mapbuf object. + * @param alpha @c EINA_TRUE to enable alpha blending or @c EINA_FALSE + * to disable it. + * + * This sets alpha flag for map rendering. If the object is a type that has + * its own alpha settings, then this will take precedence. Only image objects + * have this currently. It stops alpha blending of the map area, and is + * useful if you know the object and/or all sub-objects is 100% solid. + * + * Alpha is enabled by default. + * + * @ingroup Mapbuf + */ +EAPI void elm_mapbuf_alpha_set(Evas_Object *obj, Eina_Bool alpha); + +/** + * Get a value whether alpha blending is enabled or not. + * + * @param obj The mapbuf object. + * @return @c EINA_TRUE means alpha blending is enabled. @c EINA_FALSE + * indicates it's disabled. If @p obj is @c NULL, @c EINA_FALSE is returned. + * + * @see elm_mapbuf_alpha_set() for details. + * + * @ingroup Mapbuf + */ +EAPI Eina_Bool elm_mapbuf_alpha_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_menu.c b/libraries/elementary/src/lib/elm_menu.c new file mode 100644 index 0000000..0cb0da0 --- /dev/null +++ b/libraries/elementary/src/lib/elm_menu.c @@ -0,0 +1,968 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; +typedef struct _Elm_Menu_Item Elm_Menu_Item; + +struct _Elm_Menu_Item +{ + ELM_WIDGET_ITEM; + Elm_Menu_Item *parent; + Evas_Object *content; + const char *icon_str; + const char *label; + Evas_Smart_Cb func; + unsigned int idx; + + struct + { + Evas_Object *hv, *bx, *location; + Eina_List *items; + Eina_Bool open : 1; + } submenu; + + Eina_Bool separator : 1; + Eina_Bool selected : 1; + Eina_Bool object_item : 1; +}; + +struct _Widget_Data +{ + Evas_Object *hv, *bx, *location, *parent, *obj; + Eina_List *items; + Evas_Coord xloc, yloc; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); +static void _item_disable_hook(Elm_Object_Item *it); +static void _sizing_eval(Evas_Object *obj); +static void _submenu_sizing_eval(Elm_Menu_Item *parent); +static void _item_sizing_eval(Elm_Menu_Item *item); +static void _submenu_hide(Elm_Menu_Item *item); +static void _submenu_open(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _parent_resize(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _menu_hide(void *data, Evas_Object *obj, void *event_info); + +static const char SIG_CLICKED[] = "clicked"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CLICKED, ""}, + {NULL, NULL} +}; + + +static void +_del_item(Elm_Menu_Item *item) +{ + Elm_Menu_Item *child; + + EINA_LIST_FREE(item->submenu.items, child) + _del_item(child); + + if (item->label) eina_stringshare_del(item->label); + if (item->submenu.hv) evas_object_del(item->submenu.hv); + if (item->submenu.location) evas_object_del(item->submenu.location); + if (item->icon_str) eina_stringshare_del(item->icon_str); + elm_widget_item_free(item); +} + +static void +_del_pre_hook(Evas_Object *obj) +{ + Elm_Menu_Item *item; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_RESIZE, _parent_resize, obj); + evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_DEL, _parent_del, wd); + + EINA_LIST_FREE(wd->items, item) + _del_item(item); + + if (wd->hv) evas_object_del(wd->hv); + if (wd->location) evas_object_del(wd->location); +} + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + free(wd); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Eina_List *l, *_l, *_ll, *ll = NULL; + Elm_Menu_Item *item; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_widget_mirrored_reload(obj); + ll = eina_list_append(ll, wd->items); + EINA_LIST_FOREACH(ll, _ll, l) + { + EINA_LIST_FOREACH(l, _l, item) + { + edje_object_mirrored_set(VIEW(item), elm_widget_mirrored_get(obj)); + ll = eina_list_append(ll, item->submenu.items); + if (item->separator) + _elm_theme_object_set(obj, VIEW(item), "menu", "separator", + elm_widget_style_get(obj)); + else if (item->submenu.bx) + { + _elm_theme_object_set + (obj, VIEW(item), "menu", "item_with_submenu", + elm_widget_style_get(obj)); + elm_object_item_text_set((Elm_Object_Item *)item, + item->label); + elm_menu_item_icon_name_set((Elm_Object_Item *)item, + item->icon_str); + } + else + { + _elm_theme_object_set(obj, VIEW(item), "menu", "item", + elm_widget_style_get(obj)); + elm_object_item_text_set((Elm_Object_Item *)item, + item->label); + elm_menu_item_icon_name_set((Elm_Object_Item *)item, + item->icon_str); + } + _item_disable_hook((Elm_Object_Item *)item); + edje_object_scale_set(VIEW(item), elm_widget_scale_get(obj) * + _elm_config->scale); + } + } + _sizing_eval(obj); +} + +static void +_item_text_set_hook(Elm_Object_Item *it, + const char *part, + const char *label) +{ + Elm_Menu_Item *item; + + if (part && strcmp(part, "default")) return; + + item = (Elm_Menu_Item *)it; + + eina_stringshare_replace(&item->label, label); + + if (label) + edje_object_signal_emit(VIEW(item), "elm,state,text,visible", "elm"); + else + edje_object_signal_emit(VIEW(item), "elm,state,text,hidden", "elm"); + + edje_object_message_signal_process(VIEW(item)); + edje_object_part_text_set(VIEW(item), "elm.text", label); + _sizing_eval(WIDGET(item)); +} + +static const char * +_item_text_get_hook(const Elm_Object_Item *it, const char *part) +{ + if (part && strcmp(part, "default")) return NULL; + return ((Elm_Menu_Item *)it)->label; +} + +static void +_item_content_set_hook(Elm_Object_Item *it, + const char *part, + Evas_Object *content) +{ + Elm_Menu_Item *item; + if (part && strcmp(part, "default")) return; + + item = (Elm_Menu_Item *)it; + if (content == item->content) return; + + if (item->content) evas_object_del(item->content); + + item->content = content; + elm_widget_sub_object_add(WIDGET(item), item->content); + if (item->content) + edje_object_part_swallow(VIEW(item), "elm.swallow.content", item->content); + _sizing_eval(WIDGET(item)); +} + +static Evas_Object * +_item_content_get_hook(const Elm_Object_Item *it, const char *part) +{ + if (part && strcmp(part, "default")) return NULL; + return ((Elm_Menu_Item *)it)->content; +} + +static void +_item_disable_hook(Elm_Object_Item *it) +{ + Elm_Menu_Item *item = (Elm_Menu_Item *)it; + + if (elm_widget_item_disabled_get(item)) + { + edje_object_signal_emit(VIEW(item), "elm,state,disabled", "elm"); + if (item->submenu.open) _submenu_hide(item); + } + else + edje_object_signal_emit(VIEW(item), "elm,state,enabled", "elm"); + + edje_object_message_signal_process(VIEW(item)); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Eina_List *l; + Elm_Menu_Item *item; + Evas_Coord x_p, y_p, w_p, h_p, x2, y2, w2, h2, bx, by, bw, bh; + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (!wd->parent)) return; + EINA_LIST_FOREACH(wd->items,l,item) _item_sizing_eval(item); + evas_object_geometry_get(wd->location, &x_p, &y_p, &w_p, &h_p); + evas_object_geometry_get(wd->parent, &x2, &y2, &w2, &h2); + evas_object_geometry_get(wd->bx, &bx, &by, &bw, &bh); + + x_p = wd->xloc; + y_p = wd->yloc; + + if (elm_widget_mirrored_get(obj)) + x_p -= w_p; + + if (x_p+bw > x2+w2) x_p -= x_p+bw - (x2+w2); + if (x_p < x2) x_p += x2 - x_p; + + if (y_p+h_p+bh > y2+h2) y_p -= y_p+h_p+bh - (y2+h2); + if (y_p < y2) y_p += y2 - y_p; + + + evas_object_move(wd->location, x_p, y_p); + evas_object_resize(wd->location, bw, h_p); + evas_object_size_hint_min_set(wd->location, bw, h_p); + evas_object_size_hint_max_set(wd->location, bw, h_p); + elm_hover_target_set(wd->hv, wd->location); + + EINA_LIST_FOREACH(wd->items,l,item) + { + if (item->submenu.open) _submenu_sizing_eval(item); + } +} + +static void +_submenu_sizing_eval(Elm_Menu_Item *parent) +{ + Eina_List *l; + Elm_Menu_Item *item; + Evas_Coord x_p, y_p, w_p, h_p, x2, y2, w2, h2, bx, by, bw, bh, px, py, pw, ph; + Widget_Data *wd = elm_widget_data_get(WIDGET(parent)); + if (!wd) return; + EINA_LIST_FOREACH(parent->submenu.items, l, item) _item_sizing_eval(item); + evas_object_geometry_get(parent->submenu.location, &x_p, &y_p, &w_p, &h_p); + evas_object_geometry_get(VIEW(parent), &x2, &y2, &w2, &h2); + evas_object_geometry_get(parent->submenu.bx, &bx, &by, &bw, &bh); + evas_object_geometry_get(wd->parent, &px, &py, &pw, &ph); + + x_p = x2+w2; + y_p = y2; + + /* If it overflows on the right, adjust the x */ + if ((x_p + bw > px + pw) || elm_widget_mirrored_get(WIDGET(parent))) + x_p = x2-bw; + + /* If it overflows on the left, adjust the x - usually only happens + * with an RTL interface */ + if (x_p < px) + x_p = x2 + w2; + + /* If after all the adjustments it still overflows, fix it */ + if (x_p + bw > px + pw) + x_p = x2-bw; + + if (y_p+bh > py+ph) + y_p -= y_p+bh - (py+ph); + if (y_p < py) + y_p += y_p - y_p; + + evas_object_move(parent->submenu.location, x_p, y_p); + evas_object_resize(parent->submenu.location, bw, h_p); + evas_object_size_hint_min_set(parent->submenu.location, bw, h_p); + evas_object_size_hint_max_set(parent->submenu.location, bw, h_p); + elm_hover_target_set(parent->submenu.hv, parent->submenu.location); + + EINA_LIST_FOREACH(parent->submenu.items, l, item) + { + if (item->submenu.open) + _submenu_sizing_eval(item); + } +} + +static void +_item_sizing_eval(Elm_Menu_Item *item) +{ + Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; + if (!item->separator) + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + edje_object_size_min_restricted_calc(VIEW(item), &minw, &minh, minw, minh); + if (!item->separator) + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + evas_object_size_hint_min_set(VIEW(item), minw, minh); + evas_object_size_hint_max_set(VIEW(item), maxw, maxh); +} + +static void +_menu_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _sizing_eval(data); +} + +static void +_parent_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _sizing_eval(data); +} + +static void +_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = data; + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE, _parent_resize, wd->obj); + wd->parent = NULL; +} + +static void +_item_move_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Menu_Item *item = data; + if (item->submenu.open) _submenu_sizing_eval(item); +} + +static void +_hover_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + _menu_hide(data, obj, event_info); + evas_object_smart_callback_call(data, SIG_CLICKED, NULL); +} + +static void +_menu_hide(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Eina_List *l; + Elm_Menu_Item *item2; + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + evas_object_hide(wd->hv); + evas_object_hide(data); + + EINA_LIST_FOREACH(wd->items, l, item2) + { + if (item2->submenu.open) _submenu_hide(item2); + } +} + +static void +_submenu_hide(Elm_Menu_Item *item) +{ + Eina_List *l; + Elm_Menu_Item *item2; + evas_object_hide(item->submenu.hv); + item->submenu.open = EINA_FALSE; + EINA_LIST_FOREACH(item->submenu.items, l, item2) + { + if (item2->submenu.open) _submenu_hide(item2); + } +} + +static void +_menu_item_select(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Elm_Menu_Item *item = data; + if (item->submenu.items) + { + if (!item->submenu.open) _submenu_open(item, NULL, NULL, NULL); + else _submenu_hide(item); + } + else + _menu_hide(WIDGET(item), NULL, NULL); + + if (item->func) item->func((void *)(item->base.data), WIDGET(item), item); +} + +static void +_menu_item_activate(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Eina_List *l; + Elm_Menu_Item *item2; + Elm_Menu_Item *item = data; + item->selected = 1; + if (item->parent) + { + EINA_LIST_FOREACH(item->parent->submenu.items, l, item2) + { + if (item2 != item) + elm_menu_item_selected_set((Elm_Object_Item *)item2, 0); + } + } + else + { + Widget_Data *wd = elm_widget_data_get(WIDGET(item)); + EINA_LIST_FOREACH(wd->items, l, item2) + { + if (item2 != item) + elm_menu_item_selected_set((Elm_Object_Item *)item2, 0); + } + } +} + +static void +_menu_item_inactivate(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Elm_Menu_Item *item = data; + item->selected = 0; + if (item->submenu.open) _submenu_hide(item); +} + +static void +_submenu_open(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Elm_Menu_Item *item = data; + item->submenu.open = EINA_TRUE; + evas_object_show(item->submenu.hv); + _submenu_sizing_eval(item); +} + +static void +_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + evas_object_show(wd->hv); +} + +static void +_item_obj_create(Elm_Menu_Item *item) +{ + Widget_Data *wd = elm_widget_data_get(WIDGET(item)); + if (!wd) return; + VIEW(item) = edje_object_add(evas_object_evas_get(wd->bx)); + edje_object_mirrored_set(VIEW(item), elm_widget_mirrored_get(WIDGET(item))); + evas_object_size_hint_weight_set(VIEW(item), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_fill_set(VIEW(item), EVAS_HINT_FILL, EVAS_HINT_FILL); + _elm_theme_object_set(WIDGET(item), VIEW(item), "menu", "item", elm_widget_style_get(WIDGET(item))); + edje_object_signal_callback_add(VIEW(item), "elm,action,click", "", + _menu_item_select, item); + edje_object_signal_callback_add(VIEW(item), "elm,action,activate", "", + _menu_item_activate, item); + edje_object_signal_callback_add(VIEW(item), "elm,action,inactivate", "", + _menu_item_inactivate, item); + evas_object_show(VIEW(item)); +} + +static void +_item_separator_obj_create(Elm_Menu_Item *item) +{ + Widget_Data *wd = elm_widget_data_get(WIDGET(item)); + if (!wd) return; + VIEW(item) = edje_object_add(evas_object_evas_get(wd->bx)); + evas_object_size_hint_weight_set(VIEW(item), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_fill_set(VIEW(item), EVAS_HINT_FILL, EVAS_HINT_FILL); + _elm_theme_object_set(WIDGET(item), VIEW(item), "menu", "separator", elm_widget_style_get(WIDGET(item))); + edje_object_signal_callback_add(VIEW(item), "elm,action,activate", "", + _menu_item_activate, item); + evas_object_show(VIEW(item)); +} + +static void +_item_submenu_obj_create(Elm_Menu_Item *item) +{ + Widget_Data *wd = elm_widget_data_get(WIDGET(item)); + if (!wd) return; + item->submenu.location = elm_icon_add(wd->bx); + item->submenu.hv = elm_hover_add(wd->bx); + elm_widget_mirrored_set(item->submenu.hv, EINA_FALSE); + elm_hover_target_set(item->submenu.hv, item->submenu.location); + elm_hover_parent_set(item->submenu.hv, wd->parent); + elm_object_style_set(item->submenu.hv, "submenu"); + + item->submenu.bx = elm_box_add(wd->bx); + elm_widget_mirrored_set(item->submenu.bx, EINA_FALSE); + evas_object_size_hint_weight_set(item->submenu.bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(item->submenu.bx); + elm_object_part_content_set(item->submenu.hv, elm_hover_best_content_location_get(item->submenu.hv, ELM_HOVER_AXIS_VERTICAL), item->submenu.bx); + + edje_object_mirrored_set(VIEW(item), elm_widget_mirrored_get(WIDGET(item))); + _elm_theme_object_set(WIDGET(item), VIEW(item), "menu", "item_with_submenu", elm_widget_style_get(WIDGET(item))); + elm_object_item_text_set((Elm_Object_Item *)item, + item->label); + if (item->icon_str) + elm_menu_item_icon_name_set((Elm_Object_Item *)item, + item->icon_str); + edje_object_signal_callback_add(VIEW(item), "elm,action,open", "", + _submenu_open, item); + evas_object_event_callback_add(VIEW(item), EVAS_CALLBACK_MOVE, _item_move_resize, item); + evas_object_event_callback_add(VIEW(item), EVAS_CALLBACK_RESIZE, _item_move_resize, item); + + evas_object_event_callback_add(item->submenu.bx, EVAS_CALLBACK_RESIZE, _menu_resize, WIDGET(item)); +} + +EAPI Evas_Object * +elm_menu_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "menu"); + elm_widget_type_set(obj, "menu"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); + + wd->location = elm_icon_add(obj); + wd->parent = parent; + wd->obj = obj; + + wd->hv = elm_hover_add(obj); + elm_widget_mirrored_set(wd->hv, EINA_FALSE); + elm_hover_parent_set(wd->hv, parent); + elm_hover_target_set(wd->hv, wd->location); + elm_object_style_set(wd->hv, "menu"); + evas_object_smart_callback_add(wd->hv, "clicked", _hover_clicked_cb, obj); + + wd->bx = elm_box_add(obj); + elm_widget_mirrored_set(wd->bx, EINA_FALSE); + evas_object_size_hint_weight_set(wd->bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(wd->bx); + elm_object_part_content_set(wd->hv, elm_hover_best_content_location_get(wd->hv, ELM_HOVER_AXIS_VERTICAL), wd->bx); + + evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_RESIZE, _parent_resize, wd->obj); + evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_DEL, _parent_del, wd); + + evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _show, obj); + + evas_object_event_callback_add(wd->bx, EVAS_CALLBACK_RESIZE, _menu_resize, obj); + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + _sizing_eval(obj); + return obj; +} + +EAPI void +elm_menu_parent_set(Evas_Object *obj, Evas_Object *parent) +{ + Eina_List *l, *_l, *_ll, *ll = NULL; + Elm_Menu_Item *item; + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (wd->parent == parent) return; + if (wd->parent) + { + evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_RESIZE, _parent_resize, wd->obj); + evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_DEL, _parent_del, wd); + } + wd->parent = parent; + if (wd->parent) + { + evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_RESIZE, _parent_resize, wd->obj); + evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_DEL, _parent_del, wd); + } + elm_hover_parent_set(wd->hv, parent); + + ll = eina_list_append(ll, wd->items); + EINA_LIST_FOREACH(ll, _ll, l) + { + EINA_LIST_FOREACH(l, _l, item) + { + if (item->submenu.hv) + { + elm_hover_parent_set(item->submenu.hv, parent); + ll = eina_list_append(ll, item->submenu.items); + } + } + } + _sizing_eval(obj); +} + +EAPI Evas_Object * +elm_menu_parent_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->parent; +} + +EAPI void +elm_menu_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->xloc = x; + wd->yloc = y; + _sizing_eval(obj); +} + +EAPI void +elm_menu_close(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + _menu_hide(obj, wd->hv, NULL); +} + +EAPI Evas_Object * +elm_menu_item_object_get(const Elm_Object_Item *it) +{ + return VIEW(((Elm_Menu_Item *)it)); +} + +static void +_item_clone(Evas_Object *obj, Elm_Menu_Item *parent, Elm_Menu_Item *item) +{ + Elm_Object_Item *new_item; + Elm_Menu_Item *subitem; + Eina_List *iter; + + if (item->separator) + new_item = elm_menu_item_separator_add(obj, (Elm_Object_Item *) parent); + else + new_item = elm_menu_item_add(obj, + (Elm_Object_Item *) parent, + item->icon_str, + item->label, + item->func, + item->base.data); + elm_object_item_disabled_set(new_item, + elm_widget_item_disabled_get(item)); + + EINA_LIST_FOREACH(item->submenu.items, iter, subitem) + _item_clone(obj, (Elm_Menu_Item *) new_item, subitem); +} + +void +elm_menu_clone(Evas_Object *from_menu, Evas_Object *to_menu, Elm_Object_Item *parent) +{ + ELM_CHECK_WIDTYPE(from_menu, widtype); + ELM_CHECK_WIDTYPE(to_menu, widtype); + Widget_Data *from_wd = elm_widget_data_get(from_menu); + Eina_List *iter; + Elm_Menu_Item *item; + + if (!from_wd) return; + EINA_LIST_FOREACH(from_wd->items, iter, item) + _item_clone(to_menu, (Elm_Menu_Item *) parent, item); +} + +static void +_elm_menu_item_add_helper(Evas_Object *obj, Elm_Menu_Item *parent, Elm_Menu_Item *subitem, Widget_Data *wd) +{ + if (parent) + { + if (!parent->submenu.bx) _item_submenu_obj_create(parent); + elm_box_pack_end(parent->submenu.bx, VIEW(subitem)); + parent->submenu.items = eina_list_append(parent->submenu.items, subitem); + subitem->idx = eina_list_count(parent->submenu.items) - 1; + } + else + { + elm_box_pack_end(wd->bx, VIEW(subitem)); + wd->items = eina_list_append(wd->items, subitem); + subitem->idx = eina_list_count(wd->items) - 1; + } + + _sizing_eval(obj); +} + +static Eina_Bool +_item_del_pre_hook(Elm_Object_Item *it) +{ + Elm_Menu_Item *item = (Elm_Menu_Item *)it; + Elm_Object_Item *_item; + + EINA_LIST_FREE(item->submenu.items, _item) elm_object_item_del(_item); + if (item->label) eina_stringshare_del(item->label); + if (item->content) evas_object_del(item->content); + if (item->submenu.hv) evas_object_del(item->submenu.hv); + if (item->submenu.location) evas_object_del(item->submenu.location); + + if (item->parent) + item->parent->submenu.items = eina_list_remove(item->parent->submenu.items, item); + else + { + Widget_Data *wd = elm_widget_data_get(WIDGET(item)); + wd->items = eina_list_remove(wd->items, item); + } + + return EINA_TRUE; +} + +EAPI Elm_Object_Item * +elm_menu_item_add(Evas_Object *obj, Elm_Object_Item *parent, const char *icon, const char *label, Evas_Smart_Cb func, const void *data) +{ + Elm_Menu_Item *subitem; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *icon_obj; + + if (!wd) return NULL; + icon_obj = elm_icon_add(obj); + if (!icon_obj) return NULL; + subitem = elm_widget_item_new(obj, Elm_Menu_Item); + if (!subitem) + { + evas_object_del(icon_obj); + return NULL; + } + + elm_widget_item_del_pre_hook_set(subitem, _item_del_pre_hook); + elm_widget_item_disable_hook_set(subitem, _item_disable_hook); + elm_widget_item_text_set_hook_set(subitem, _item_text_set_hook); + elm_widget_item_text_get_hook_set(subitem, _item_text_get_hook); + elm_widget_item_content_set_hook_set(subitem, _item_content_set_hook); + elm_widget_item_content_get_hook_set(subitem, _item_content_get_hook); + + subitem->base.data = data; + subitem->func = func; + subitem->parent = (Elm_Menu_Item *) parent; + subitem->content = icon_obj; + + _item_obj_create(subitem); + elm_object_item_text_set((Elm_Object_Item *) subitem, label); + + elm_widget_sub_object_add(WIDGET(subitem), subitem->content); + edje_object_part_swallow(VIEW(subitem), "elm.swallow.content", subitem->content); + if (icon) + elm_menu_item_icon_name_set((Elm_Object_Item *) subitem, icon); + + _elm_menu_item_add_helper(obj, (Elm_Menu_Item *) parent, subitem, wd); + + return (Elm_Object_Item *) subitem; +} + +EAPI unsigned int +elm_menu_item_index_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, 0); + return ((Elm_Menu_Item *)it)->idx; +} + +EAPI void +elm_menu_item_icon_name_set(Elm_Object_Item *it, const char *icon) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + EINA_SAFETY_ON_NULL_RETURN(icon); + char icon_tmp[512]; + Elm_Menu_Item *item = (Elm_Menu_Item *)it; + + if (!*icon) return; + if ((item->icon_str) && (!strcmp(item->icon_str, icon))) return; + if ((snprintf(icon_tmp, sizeof(icon_tmp), "menu/%s", icon) > 0) && + (elm_icon_standard_set(item->content, icon_tmp) || + elm_icon_standard_set(item->content, icon))) + { + eina_stringshare_replace(&item->icon_str, icon); + edje_object_signal_emit(VIEW(item), "elm,state,icon,visible", "elm"); + } + else + edje_object_signal_emit(VIEW(item), "elm,state,icon,hidden", "elm"); + edje_object_message_signal_process(VIEW(item)); + _sizing_eval(WIDGET(item)); +} + +EAPI Elm_Object_Item * +elm_menu_item_separator_add(Evas_Object *obj, Elm_Object_Item *parent) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Elm_Menu_Item *subitem; + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Menu_Item *p_item = (Elm_Menu_Item *) parent; + if (!wd) return NULL; + /* don't add a separator as the first item */ + if (!wd->items) return NULL; + /* don't allow adding more than one separator in a row */ + if (p_item) subitem = eina_list_last(p_item->submenu.items)->data; + else subitem = eina_list_last(wd->items)->data; + if (subitem->separator) return NULL; + + subitem = elm_widget_item_new(obj, Elm_Menu_Item); + if (!subitem) return NULL; + + elm_widget_item_del_pre_hook_set(subitem, _item_del_pre_hook); + elm_widget_item_disable_hook_set(subitem, _item_disable_hook); + elm_widget_item_text_set_hook_set(subitem, _item_text_set_hook); + elm_widget_item_text_get_hook_set(subitem, _item_text_get_hook); + elm_widget_item_content_set_hook_set(subitem, _item_content_set_hook); + elm_widget_item_content_get_hook_set(subitem, _item_content_get_hook); + + subitem->separator = EINA_TRUE; + _item_separator_obj_create(subitem); + if (!p_item) + { + elm_box_pack_end(wd->bx, VIEW(subitem)); + wd->items = eina_list_append(wd->items, subitem); + } + else + { + if (!p_item->submenu.bx) _item_submenu_obj_create(p_item); + elm_box_pack_end(p_item->submenu.bx, VIEW(subitem)); + p_item->submenu.items = eina_list_append(p_item->submenu.items, + subitem); + } + _sizing_eval(obj); + return (Elm_Object_Item *) subitem; +} + +EAPI const char * +elm_menu_item_icon_name_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + return ((Elm_Menu_Item *)it)->icon_str; +} + +EAPI Eina_Bool +elm_menu_item_is_separator(Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE); + return ((Elm_Menu_Item *)it)->separator; +} + +EAPI const Eina_List * +elm_menu_item_subitems_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + return ((Elm_Menu_Item *)it)->submenu.items; +} + +EAPI const Eina_List * +elm_menu_items_get(const Evas_Object * obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + return wd->items; +} + +EAPI void +elm_menu_item_selected_set(Elm_Object_Item *it, Eina_Bool selected) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Menu_Item *item = (Elm_Menu_Item *)it; + + if (selected == item->selected) return; + item->selected = selected; + if (selected) + { + edje_object_signal_emit(VIEW(item), "elm,state,selected", "elm"); + _menu_item_activate(item, NULL, NULL, NULL); + } + else + { + edje_object_signal_emit(VIEW(item), "elm,state,unselected", "elm"); + _menu_item_inactivate(item, NULL, NULL, NULL); + } + edje_object_message_signal_process(VIEW(item)); +} + +EAPI Eina_Bool +elm_menu_item_selected_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE); + return ((Elm_Menu_Item *)it)->selected; +} + +EAPI Elm_Object_Item * +elm_menu_item_prev_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + Elm_Menu_Item *item = (Elm_Menu_Item *)it; + + if (item->parent) + { + Eina_List *l = eina_list_data_find_list(item->parent->submenu.items, + item); + l = eina_list_prev(l); + if (!l) return NULL; + return l->data; + } + else + { + Widget_Data *wd = elm_widget_data_get(WIDGET(item)); + if (!wd || !wd->items) return NULL; + Eina_List *l = eina_list_data_find_list(wd->items, item); + l = eina_list_prev(l); + if (!l) return NULL; + return l->data; + } + return NULL; +} + +EAPI Elm_Object_Item * +elm_menu_item_next_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + Elm_Menu_Item *item = (Elm_Menu_Item *)it; + + if (item->parent) + { + Eina_List *l = eina_list_data_find_list(item->parent->submenu.items, + item); + l = eina_list_next(l); + if (!l) return NULL; + return l->data; + } + else + { + Widget_Data *wd = elm_widget_data_get(WIDGET(item)); + if (!wd || !wd->items) return NULL; + Eina_List *l = eina_list_data_find_list(wd->items, item); + l = eina_list_next(l); + if (!l) return NULL; + return l->data; + } + return NULL; +} + +EAPI Elm_Object_Item * +elm_menu_first_item_get(const Evas_Object * obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (wd->items) return wd->items->data; + return NULL; +} + +EAPI Elm_Object_Item * +elm_menu_last_item_get(const Evas_Object * obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + Eina_List *l = eina_list_last(wd->items); + if (l) return l->data; + return NULL; +} + +EAPI Elm_Object_Item * +elm_menu_selected_item_get(const Evas_Object * obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + Eina_List *l; + Elm_Menu_Item *item; + EINA_LIST_FOREACH(wd->items, l, item) + { + if (item->selected) return ((Elm_Object_Item *)item); + } + return NULL; +} + diff --git a/libraries/elementary/src/lib/elm_menu.h b/libraries/elementary/src/lib/elm_menu.h new file mode 100644 index 0000000..fcb40e1 --- /dev/null +++ b/libraries/elementary/src/lib/elm_menu.h @@ -0,0 +1,283 @@ +/** + * @defgroup Menu Menu + * @ingroup Elementary + * + * @image html img/widget/menu/preview-00.png + * @image latex img/widget/menu/preview-00.eps + * + * A menu is a list of items displayed above its parent. When the menu is + * showing its parent is darkened. Each item can have a sub-menu. The menu + * object can be used to display a menu on a right click event, in a toolbar, + * anywhere. + * + * Signals that you can add callbacks for are: + * @li "clicked" - the user clicked the empty space in the menu to dismiss. + * + * Default content parts of the menu items that you can use for are: + * @li "default" - A main content of the menu item + * + * Default text parts of the menu items that you can use for are: + * @li "default" - label in the menu item + * + * Supported elm_object_item common APIs. + * @li @ref elm_object_item_part_text_set + * @li @ref elm_object_item_part_text_get + * @li @ref elm_object_item_part_content_set + * @li @ref elm_object_item_part_content_get + * @li @ref elm_object_item_disabled_set + * @li @ref elm_object_item_disabled_get + * + * @see @ref tutorial_menu + * @{ + */ + +/** + * @brief Add a new menu to the parent + * + * @param parent The parent object. + * @return The new object or NULL if it cannot be created. + * + * @ingroup Menu + */ +EAPI Evas_Object *elm_menu_add(Evas_Object *parent); + +/** + * @brief Set the parent for the given menu widget + * + * @param obj The menu object. + * @param parent The new parent. + * + * @ingroup Menu + */ +EAPI void elm_menu_parent_set(Evas_Object *obj, Evas_Object *parent); + +/** + * @brief Get the parent for the given menu widget + * + * @param obj The menu object. + * @return The parent. + * + * @see elm_menu_parent_set() + * + * @ingroup Menu + */ +EAPI Evas_Object *elm_menu_parent_get(const Evas_Object *obj); + +/** + * @brief Move the menu to a new position + * + * @param obj The menu object. + * @param x The new position. + * @param y The new position. + * + * Sets the top-left position of the menu to (@p x,@p y). + * + * @note @p x and @p y coordinates are relative to parent. + * + * @ingroup Menu + */ +EAPI void elm_menu_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y); + +/** + * @brief Close a opened menu + * + * @param obj the menu object + * @return void + * + * Hides the menu and all it's sub-menus. + * + * @ingroup Menu + */ +EAPI void elm_menu_close(Evas_Object *obj); + +/** + * @brief Returns a list of @p item's items. + * + * @param obj The menu object + * @return An Eina_List* of @p item's items + * + * @ingroup Menu + */ +EAPI const Eina_List *elm_menu_items_get(const Evas_Object *obj); + +/** + * @brief Get the Evas_Object of an Elm_Object_Item + * + * @param it The menu item object. + * @return The edje object containing the swallowed content + * + * @warning Don't manipulate this object! + * + * @ingroup Menu + */ +EAPI Evas_Object *elm_menu_item_object_get(const Elm_Object_Item *it); + +/** + * @brief Add an item at the end of the given menu widget + * + * @param obj The menu object. + * @param parent The parent menu item (optional) + * @param icon An icon display on the item. The icon will be destroyed by the menu. + * @param label The label of the item. + * @param func Function called when the user select the item. + * @param data Data sent by the callback. + * @return Returns the new item. + * + * @ingroup Menu + */ +EAPI Elm_Object_Item *elm_menu_item_add(Evas_Object *obj, Elm_Object_Item *parent, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); + +/** + * @brief Set the icon of a menu item to the standard icon with name @p icon + * + * @param it The menu item object. + * @param icon The name of icon object to set for the content of @p item + * + * Once this icon is set, any previously set icon will be deleted. + * + * @ingroup Menu + */ +EAPI void elm_menu_item_icon_name_set(Elm_Object_Item *it, const char *icon); + +/** + * @brief Get the string representation from the icon of a menu item + * + * @param it The menu item object. + * @return The string representation of @p item's icon or NULL + * + * @see elm_menu_item_icon_name_set() + * + * @ingroup Menu + */ +EAPI const char *elm_menu_item_icon_name_get(const Elm_Object_Item *it); + +/** + * @brief Set the selected state of @p item. + * + * @param it The menu item object. + * @param selected The selected/unselected state of the item + * + * @ingroup Menu + */ +EAPI void elm_menu_item_selected_set(Elm_Object_Item *it, Eina_Bool selected); + +/** + * @brief Get the selected state of @p item. + * + * @param it The menu item object. + * @return The selected/unselected state of the item + * + * @see elm_menu_item_selected_set() + * + * @ingroup Menu + */ +EAPI Eina_Bool elm_menu_item_selected_get(const Elm_Object_Item *it); + +/** + * @brief Add a separator item to menu @p obj under @p parent. + * + * @param obj The menu object + * @param parent The item to add the separator under + * @return The created item or NULL on failure + * + * This is item is a @ref Separator. + * + * @ingroup Menu + */ +EAPI Elm_Object_Item *elm_menu_item_separator_add(Evas_Object *obj, Elm_Object_Item *parent); + +/** + * @brief Returns whether @p item is a separator. + * + * @param it The item to check + * @return If true, @p item is a separator + * + * @see elm_menu_item_separator_add() + * + * @ingroup Menu + */ +EAPI Eina_Bool elm_menu_item_is_separator(Elm_Object_Item *it); + +/** + * @brief Returns a list of @p item's subitems. + * + * @param it The item + * @return An Eina_List* of @p item's subitems + * + * @see elm_menu_add() + * + * @ingroup Menu + */ +EAPI const Eina_List *elm_menu_item_subitems_get(const Elm_Object_Item *it); + +/** + * @brief Get the position of a menu item + * + * @param it The menu item + * @return The item's index + * + * This function returns the index position of a menu item in a menu. + * For a sub-menu, this number is relative to the first item in the sub-menu. + * + * @note Index values begin with 0 + * + * @ingroup Menu + */ +EAPI unsigned int elm_menu_item_index_get(const Elm_Object_Item *it); + +/** + * @brief Get the selected item in the menu + * + * @param obj The menu object + * @return The selected item, or NULL if none + * + * @see elm_menu_item_selected_get() + * @see elm_menu_item_selected_set() + * + * @ingroup Menu + */ +EAPI Elm_Object_Item *elm_menu_selected_item_get(const Evas_Object *obj); + +/** + * @brief Get the last item in the menu + * + * @param obj The menu object + * @return The last item, or NULL if none + * + * @ingroup Menu + */ +EAPI Elm_Object_Item *elm_menu_last_item_get(const Evas_Object *obj); + +/** + * @brief Get the first item in the menu + * + * @param obj The menu object + * @return The first item, or NULL if none + * + * @ingroup Menu + */ +EAPI Elm_Object_Item *elm_menu_first_item_get(const Evas_Object *obj); + +/** + * @brief Get the next item in the menu. + * + * @param it The menu item object. + * @return The item after it, or NULL if none + * + * @ingroup Menu + */ +EAPI Elm_Object_Item *elm_menu_item_next_get(const Elm_Object_Item *it); + +/** + * @brief Get the previous item in the menu. + * + * @param it The menu item object. + * @return The item before it, or NULL if none + * + * @ingroup Menu + */ +EAPI Elm_Object_Item *elm_menu_item_prev_get(const Elm_Object_Item *it); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_mirroring.h b/libraries/elementary/src/lib/elm_mirroring.h new file mode 100644 index 0000000..24baa48 --- /dev/null +++ b/libraries/elementary/src/lib/elm_mirroring.h @@ -0,0 +1,59 @@ +/** + * @defgroup Mirroring Mirroring + * @ingroup Elementary + * + * These functions allow you to set ui-mirroring on specific + * widgets or the whole interface. Widgets can be in one of two + * modes, automatic and manual. Automatic means they'll be changed + * according to the system mirroring mode and manual means only + * explicit changes will matter. You are not supposed to change + * mirroring state of a widget set to automatic, will mostly work, + * but the behavior is not really defined. + * + * @{ + */ + +/** + * Get the widget's mirrored mode. + * + * @param obj The widget. + * @return EINA_TRUE if mirrored is set, EINA_FALSE otherwise + * + * @ingroup Mirroring + */ +EAPI Eina_Bool elm_object_mirrored_get(const Evas_Object *obj); + +/** + * Set the widget's mirrored mode. + * + * @param obj The widget. + * @param mirrored EINA_TRUE to set mirrored mode, EINA_FALSE to unset it. + * + * @ingroup Mirroring + */ +EAPI void elm_object_mirrored_set(Evas_Object *obj, Eina_Bool mirrored); + +/** + * Returns the widget's mirrored mode setting. + * + * @param obj The widget. + * @return mirrored mode setting of the object. + * + * @ingroup Mirroring + */ +EAPI Eina_Bool elm_object_mirrored_automatic_get(const Evas_Object *obj); + +/** + * Sets the widget's mirrored mode setting. + * When widget in automatic mode, it follows the system mirrored mode set by + * elm_mirrored_set(). + * @param obj The widget. + * @param automatic EINA_TRUE for auto mirrored mode. EINA_FALSE for manual. + * + * @ingroup Mirroring + */ +EAPI void elm_object_mirrored_automatic_set(Evas_Object *obj, Eina_Bool automatic); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_module.c b/libraries/elementary/src/lib/elm_module.c new file mode 100644 index 0000000..396e9de --- /dev/null +++ b/libraries/elementary/src/lib/elm_module.c @@ -0,0 +1,251 @@ +#include +#include "elm_priv.h" + +/* what are moodules in elementary for? for modularising behavior and features + * so they can be plugged in and out where you dont want the core source to + * always behave like that or do it that way. plug it at runtime! + * + * they have module names (in config) and "slots" to plug that module into + * to server a purpose. eg you plug plugin "xx" into the "entry-copy-paste" + * slot so it would provide replacement copy & paste ui functionality and + * specific symbols + * + * config is something like: + * + * export ELM_MODULES="xx>slot1:yy>slot2" + * + * where a module named xx is plugged into slot1 & yy is plugged into slot2 + * + * real examples: + * + * export ELM_MODULES="my_module>entry/api" + * + * this loads the module called "my_module" into the slot "entry/api" which + * is an api slot for entry modules to modify behavior and hook to + * creation/deletion of the entry as well as replace the longpress behavior. + */ + +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +static Eina_Hash *modules = NULL; +static Eina_Hash *modules_as = NULL; + +void +_elm_module_init(void) +{ + modules = eina_hash_string_small_new(NULL); + modules_as = eina_hash_string_small_new(NULL); +} + +void +_elm_module_shutdown(void) +{ + // FIXME: unload all modules + if (modules) eina_hash_free(modules); + modules = NULL; + if (modules_as) eina_hash_free(modules_as); + modules_as = NULL; +} + +void +_elm_module_parse(const char *s) +{ + const char *p, *pe; + + p = s; + pe = p; + for (;;) + { + if ((*pe == ':') || (!*pe)) + { // p -> pe == 'name:' + if (pe > p) + { + char *n = malloc(pe - p + 1); + if (n) + { + char *nn; + + strncpy(n, p, pe - p); + n[pe - p] = 0; + nn = strchr(n, '>'); + if (nn) + { + *nn = 0; + nn++; + _elm_module_add(n, nn); + } + free(n); + } + } + if (!*pe) break; + p = pe + 1; + pe = p; + } + else + pe++; + } +} + +Elm_Module * +_elm_module_find_as(const char *as) +{ + Elm_Module *m; + + m = eina_hash_find(modules_as, as); + if (!m) return NULL; + + if (!_elm_module_load(m)) + { + _elm_module_del(m); + return NULL; + } + return m; +} + +Eina_Bool +_elm_module_load(Elm_Module *m) +{ + const char *home; + char buf[PATH_MAX]; + + if (m->module) return EINA_TRUE; + + home = getenv("HOME"); + if (home) + { + snprintf(buf, sizeof(buf), "%s/"ELEMENTARY_BASE_DIR"/modules/%s/%s/module" EFL_SHARED_EXTENSION, home, m->name, MODULE_ARCH); + m->module = eina_module_new(buf); + if (m->module && eina_module_load (m->module) == EINA_TRUE) + { + m->init_func = eina_module_symbol_get(m->module, "elm_modapi_init"); + if (m->init_func) + { + m->shutdown_func = eina_module_symbol_get(m->module, "elm_modapi_shutdown"); + m->so_path = eina_stringshare_add(buf); + snprintf(buf, sizeof(buf), "%s/"ELEMENTARY_BASE_DIR"/modules/%s/%s", home, m->name, MODULE_ARCH); + m->bin_dir = eina_stringshare_add(buf); + snprintf(buf, sizeof(buf), "%s/"ELEMENTARY_BASE_DIR"/modules/%s", home, m->name); + m->data_dir = eina_stringshare_add(buf); + } + else + { + if (m->module) + { + eina_module_unload(m->module); + eina_module_free(m->module); + m->module = NULL; + } + return EINA_FALSE; + } + } + else if (m->module) + { + eina_module_free(m->module); + m->module = NULL; + } + } + + if (!m->module) + { + snprintf(buf, sizeof(buf), "%s/elementary/modules/%s/%s/module" EFL_SHARED_EXTENSION, _elm_lib_dir, m->name, MODULE_ARCH); + m->module = eina_module_new(buf); + if (m->module && eina_module_load (m->module) == EINA_TRUE) + { + m->init_func = eina_module_symbol_get(m->module, "elm_modapi_init"); + if (m->init_func) + { + m->shutdown_func = eina_module_symbol_get(m->module, "elm_modapi_shutdown"); + m->so_path = eina_stringshare_add(buf); + snprintf(buf, sizeof(buf), "%s/elementary/modules/%s/%s", _elm_lib_dir, m->name, MODULE_ARCH); + m->bin_dir = eina_stringshare_add(buf); + snprintf(buf, sizeof(buf), "%s/elementary/modules/%s", _elm_lib_dir, m->name); + m->data_dir = eina_stringshare_add(buf); + } + else + { + if (m->module) + { + eina_module_unload(m->module); + eina_module_free(m->module); + m->module = NULL; + } + return EINA_FALSE; + } + } + } + else if (m->module) + { + eina_module_free(m->module); + m->module = NULL; + } + + if (!m->module) return EINA_FALSE; + return EINA_TRUE; +} + +void +_elm_module_unload(Elm_Module *m) +{ + eina_stringshare_del(m->so_path); + eina_stringshare_del(m->data_dir); + eina_stringshare_del(m->bin_dir); + if (m->api) + { + free(m->api); + m->api = NULL; + } + if (m->module) + { + if (m->shutdown_func) m->shutdown_func(m); + eina_module_unload(m->module); + eina_module_free(m->module); + m->module = NULL; + } + m->shutdown_func = NULL; + m->init_func = NULL; +} + +Elm_Module * +_elm_module_add(const char *name, const char *as) +{ + Elm_Module *m; + + if (name[0] == '/') return NULL; + + m = eina_hash_find(modules, name); + if (m) + { + m->references++; + return m; + } + m = calloc(1, sizeof(Elm_Module)); + if (!m) return NULL; + m->version = 1; + m->name = eina_stringshare_add(name); + m->references = 1; + eina_hash_direct_add(modules, m->name, m); + m->as = eina_stringshare_add(as); + eina_hash_direct_add(modules_as, m->as, m); + return m; +} + +void +_elm_module_del(Elm_Module *m) +{ + m->references--; + if (m->references > 0) return; + _elm_module_unload(m); + eina_hash_del(modules, m->name, m); + eina_hash_del(modules_as, m->as, m); + eina_stringshare_del(m->name); + eina_stringshare_del(m->as); + free(m); +} + +const void * +_elm_module_symbol_get(Elm_Module *m, const char *name) +{ + return eina_module_symbol_get(m->module, name); +} diff --git a/libraries/elementary/src/lib/elm_need.h b/libraries/elementary/src/lib/elm_need.h new file mode 100644 index 0000000..1e43269 --- /dev/null +++ b/libraries/elementary/src/lib/elm_need.h @@ -0,0 +1,49 @@ +/** + * Request that your elementary application needs Efreet + * + * This initializes the Efreet library when called and if support exists + * it returns EINA_TRUE, otherwise returns EINA_FALSE. This must be called + * before any efreet calls. + * + * @return EINA_TRUE if support exists and initialization succeeded. + * + * @ingroup Efreet + */ +EAPI Eina_Bool elm_need_efreet(void); + +/** + * Request that your elementary application needs e_dbus + * + * This initializes the E_dbus library when called and if support exists + * it returns EINA_TRUE, otherwise returns EINA_FALSE. This must be called + * before any e_dbus calls. + * + * @return EINA_TRUE if support exists and initialization succeeded. + * + * @ingroup E_dbus + */ +EAPI Eina_Bool elm_need_e_dbus(void); + +/** + * Request that your elementary application needs ethumb + * + * This initializes the Ethumb library when called and if support exists + * it returns EINA_TRUE, otherwise returns EINA_FALSE. + * This must be called before any other function that deals with + * elm_thumb objects or ethumb_client instances. + * + * @ingroup Thumb + */ +EAPI Eina_Bool elm_need_ethumb(void); + +/** + * Request that your elementary application needs web support + * + * This initializes the Ewebkit library when called and if support exists + * it returns EINA_TRUE, otherwise returns EINA_FALSE. + * This must be called before any other function that deals with + * elm_web objects or ewk_view instances. + * + * @ingroup Web + */ +EAPI Eina_Bool elm_need_web(void); diff --git a/libraries/elementary/src/lib/elm_notify.c b/libraries/elementary/src/lib/elm_notify.c new file mode 100644 index 0000000..1b68390 --- /dev/null +++ b/libraries/elementary/src/lib/elm_notify.c @@ -0,0 +1,626 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *notify, *content, *parent; + + Elm_Notify_Orient orient; + Eina_Bool allow_events; + Evas_Object *block_events; + + double timeout; + Ecore_Timer *timer; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); +static void _theme_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _sub_del(void *data, Evas_Object *obj, void *event_info); +static void _signal_block_clicked(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _calc(Evas_Object *obj); +static void _content_resize(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _show(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _hide(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _parent_hide(void *data, Evas *e, Evas_Object *obj, void *event_info); + +static void _resize(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _restack(void *data, Evas *e, Evas_Object *obj, void *event_info); + +static const char SIG_BLOCK_CLICKED[] = "block,clicked"; +static const char SIG_TIMEOUT[] = "timeout"; +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_BLOCK_CLICKED, ""}, + {SIG_TIMEOUT, ""}, + {NULL, NULL} +}; + +static void +_del_pre_hook(Evas_Object *obj) +{ + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE, _resize, obj); + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE, _resize, obj); + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_SHOW, _show, obj); + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_HIDE, _hide, obj); + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESTACK, _restack, obj); +} + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_notify_parent_set(obj, NULL); + elm_notify_allow_events_set(obj, EINA_TRUE); + if (wd->timer) + { + ecore_timer_del(wd->timer); + wd->timer = NULL; + } + free(wd); +} + +/** + * Return Notification orientation with RTL + * + * This function switches-sides of notification area when in RTL mode. + * + * @param obj notification object. + * + * @param orient Original notification orientation. + * + * @return notification orientation with respect to the object RTL mode. + * + * @internal + **/ +static Elm_Notify_Orient +_notify_orientation_with_rtl(Evas_Object *obj, Elm_Notify_Orient orient) +{ + if (elm_widget_mirrored_get(obj)) + { + switch (orient) + { + case ELM_NOTIFY_ORIENT_LEFT: + orient = ELM_NOTIFY_ORIENT_RIGHT; + break; + case ELM_NOTIFY_ORIENT_RIGHT: + orient = ELM_NOTIFY_ORIENT_LEFT; + break; + case ELM_NOTIFY_ORIENT_TOP_LEFT: + orient = ELM_NOTIFY_ORIENT_TOP_RIGHT; + break; + case ELM_NOTIFY_ORIENT_TOP_RIGHT: + orient = ELM_NOTIFY_ORIENT_TOP_LEFT; + break; + case ELM_NOTIFY_ORIENT_BOTTOM_LEFT: + orient = ELM_NOTIFY_ORIENT_BOTTOM_RIGHT; + break; + case ELM_NOTIFY_ORIENT_BOTTOM_RIGHT: + orient = ELM_NOTIFY_ORIENT_BOTTOM_LEFT; + break; + default: + break; + } + } + + return orient; +} + +static void +_notify_theme_apply(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + const char *style = elm_widget_style_get(obj); + + switch (wd->orient) + { + case ELM_NOTIFY_ORIENT_TOP: + _elm_theme_object_set(obj, wd->notify, "notify", "top", style); + break; + case ELM_NOTIFY_ORIENT_CENTER: + _elm_theme_object_set(obj, wd->notify, "notify", "center", style); + break; + case ELM_NOTIFY_ORIENT_BOTTOM: + _elm_theme_object_set(obj, wd->notify, "notify", "bottom", style); + break; + case ELM_NOTIFY_ORIENT_LEFT: + _elm_theme_object_set(obj, wd->notify, "notify", "left", style); + break; + case ELM_NOTIFY_ORIENT_RIGHT: + _elm_theme_object_set(obj, wd->notify, "notify", "right", style); + break; + case ELM_NOTIFY_ORIENT_TOP_LEFT: + _elm_theme_object_set(obj, wd->notify, "notify", "top_left", style); + break; + case ELM_NOTIFY_ORIENT_TOP_RIGHT: + _elm_theme_object_set(obj, wd->notify, "notify", "top_right", style); + break; + case ELM_NOTIFY_ORIENT_BOTTOM_LEFT: + _elm_theme_object_set(obj, wd->notify, "notify", "bottom_left", style); + break; + case ELM_NOTIFY_ORIENT_BOTTOM_RIGHT: + _elm_theme_object_set(obj, wd->notify, "notify", "bottom_right", style); + break; + case ELM_NOTIFY_ORIENT_LAST: + break; + } +} + +/** + * Moves notification to orientation. + * + * This fucntion moves notification to orientation + * according to object RTL orientation. + * + * @param obj notification object. + * + * @param orient notification orientation. + * + * @internal + **/ +static void +_notify_move_to_orientation(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + int offx; + int offy; + Evas_Coord minw = -1, minh = -1; + Evas_Coord x, y, w, h; + + if (!wd) return; + evas_object_geometry_get(obj, &x, &y, &w, &h); + edje_object_size_min_get(wd->notify, &minw, &minh); + edje_object_size_min_restricted_calc(wd->notify, &minw, &minh, minw, minh); + offx = (w - minw) / 2; + offy = (h - minh) / 2; + + switch (_notify_orientation_with_rtl(obj, wd->orient)) + { + case ELM_NOTIFY_ORIENT_TOP: + evas_object_move(wd->notify, x + offx, y); + break; + case ELM_NOTIFY_ORIENT_CENTER: + evas_object_move(wd->notify, x + offx, y + offy); + break; + case ELM_NOTIFY_ORIENT_BOTTOM: + evas_object_move(wd->notify, x + offx, y + h - minh); + break; + case ELM_NOTIFY_ORIENT_LEFT: + evas_object_move(wd->notify, x, y + offy); + break; + case ELM_NOTIFY_ORIENT_RIGHT: + evas_object_move(wd->notify, x + w - minw, y + offy); + break; + case ELM_NOTIFY_ORIENT_TOP_LEFT: + evas_object_move(wd->notify, x, y); + break; + case ELM_NOTIFY_ORIENT_TOP_RIGHT: + evas_object_move(wd->notify, x + w - minw, y); + break; + case ELM_NOTIFY_ORIENT_BOTTOM_LEFT: + evas_object_move(wd->notify, x, y + h - minh); + break; + case ELM_NOTIFY_ORIENT_BOTTOM_RIGHT: + evas_object_move(wd->notify, x + w - minw, y + h - minh); + break; + case ELM_NOTIFY_ORIENT_LAST: + break; + } +} + +static void +_block_events_theme_apply(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + const char *style = elm_widget_style_get(obj); + _elm_theme_object_set(obj, wd->block_events, "notify", "block_events", style); +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->notify, rtl); + _notify_move_to_orientation(obj); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _notify_theme_apply(obj); + if (wd->block_events) _block_events_theme_apply(obj); + edje_object_scale_set(wd->notify, elm_widget_scale_get(obj) * + _elm_config->scale); + _sizing_eval(obj); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord x,y,w,h; + if (!wd) return; + if (!wd->parent) return; + evas_object_geometry_get(wd->parent, &x, &y, &w, &h); + evas_object_move(obj, x, y); + evas_object_resize(obj, w, h); +} + +static void +_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _calc(data); +} + +static void +_sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *sub = event_info; + if (!wd) return; + + if (sub == wd->content) + { + evas_object_event_callback_del_full(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + evas_object_event_callback_del_full(sub, EVAS_CALLBACK_RESIZE, + _content_resize, obj); + wd->content = NULL; + } +} + +static void +_signal_block_clicked(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + evas_object_smart_callback_call(data, SIG_BLOCK_CLICKED, NULL); +} + +static void +_restack(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_layer_set(wd->notify, + evas_object_layer_get(obj)); +} + +static void +_resize(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + _calc(obj); +} + +static void +_content_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _calc(data); +} + +static void +_calc(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1; + Evas_Coord x, y, w, h; + + if (!wd) return; + _sizing_eval(obj); + + evas_object_geometry_get(obj, &x, &y, &w, &h); + edje_object_size_min_get(wd->notify, &minw, &minh); + edje_object_size_min_restricted_calc(wd->notify, &minw, &minh, minw, minh); + + if (wd->content) + { + _notify_move_to_orientation(obj); + evas_object_resize(wd->notify, minw, minh); + } +} + +static Eina_Bool +_timer_cb(void *data) +{ + Evas_Object *obj = data; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return ECORE_CALLBACK_CANCEL; + wd->timer = NULL; + evas_object_hide(obj); + evas_object_smart_callback_call(obj, SIG_TIMEOUT, NULL); + return ECORE_CALLBACK_CANCEL; +} + +static void +_timer_init(Evas_Object *obj, Widget_Data *wd) +{ + if (wd->timer) + { + ecore_timer_del(wd->timer); + wd->timer = NULL; + } + if ((evas_object_visible_get(obj)) && (wd->timeout > 0.0)) + wd->timer = ecore_timer_add(wd->timeout, _timer_cb, obj); +} + +static void +_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_show(wd->notify); + if (!wd->allow_events) evas_object_show(wd->block_events); + _timer_init(obj, wd); + elm_object_focus_set(obj, EINA_TRUE); +} + +static void +_hide(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_hide(wd->notify); + if (!wd->allow_events) evas_object_hide(wd->block_events); + if (wd->timer) + { + ecore_timer_del(wd->timer); + wd->timer = NULL; + } +} + +static void +_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + wd->parent = NULL; + evas_object_hide(data); +} + +static void +_parent_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + evas_object_hide(data); +} + +static Eina_Bool +_elm_notify_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *cur; + + if ((!wd) || (!wd->content)) + return EINA_FALSE; + + cur = wd->content; + + /* Try Focus cycle in subitem */ + return elm_widget_focus_next_get(cur, dir, next); +} + +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd; + if (part && strcmp(part ,"default")) return; + wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->content == content) return; + if (wd->content) evas_object_del(wd->content); + wd->content = content; + + if (content) + { + elm_widget_sub_object_add(obj, content); + evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + evas_object_event_callback_add(content, EVAS_CALLBACK_RESIZE, + _content_resize, obj); + edje_object_part_swallow(wd->notify, "elm.swallow.content", content); + } + _sizing_eval(obj); + _calc(obj); +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + if (part && strcmp(part ,"default")) return NULL; + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->content; +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + Evas_Object *content; + if (part && strcmp(part ,"default")) return NULL; + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (!wd->content) return NULL; + content = wd->content; + elm_widget_sub_object_del(obj, wd->content); + edje_object_part_unswallow(wd->notify, content); + return content; +} + +EAPI Evas_Object * +elm_notify_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "notify"); + elm_widget_type_set(obj, "notify"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); + elm_widget_focus_next_hook_set(obj, _elm_notify_focus_next_hook); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); + + wd->allow_events = EINA_TRUE; + + wd->notify = edje_object_add(e); + wd->orient = -1; + elm_notify_orient_set(obj, ELM_NOTIFY_ORIENT_TOP); + + elm_notify_parent_set(obj, parent); + + evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj); + evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _resize, obj); + evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _show, obj); + evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _hide, obj); + evas_object_event_callback_add(obj, EVAS_CALLBACK_RESTACK, _restack, obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _sizing_eval(obj); + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + return obj; +} + +EAPI void +elm_notify_parent_set(Evas_Object *obj, Evas_Object *parent) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->parent) + { + evas_object_event_callback_del_full(wd->parent, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_RESIZE, + _changed_size_hints, obj); + evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_MOVE, + _changed_size_hints, obj); + evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_DEL, + _parent_del, obj); + evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_HIDE, + _parent_hide, obj); + wd->parent = NULL; + } + + if (parent) + { + wd->parent = parent; + evas_object_event_callback_add(parent, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + evas_object_event_callback_add(parent, EVAS_CALLBACK_RESIZE, + _changed_size_hints, obj); + evas_object_event_callback_add(parent, EVAS_CALLBACK_MOVE, + _changed_size_hints, obj); + evas_object_event_callback_add(parent, EVAS_CALLBACK_DEL, + _parent_del, obj); + evas_object_event_callback_add(parent, EVAS_CALLBACK_HIDE, + _parent_hide, obj); + _sizing_eval(obj); + } + _calc(obj); +} + +EAPI Evas_Object * +elm_notify_parent_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->parent; +} + +EAPI void +elm_notify_orient_set(Evas_Object *obj, Elm_Notify_Orient orient) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->orient == orient) return; + wd->orient = orient; + _notify_theme_apply(obj); + _resize(obj, NULL, obj, NULL); +} + +EAPI Elm_Notify_Orient +elm_notify_orient_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) -1; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return -1; + return wd->orient; +} + +EAPI void +elm_notify_timeout_set(Evas_Object *obj, double timeout) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->timeout = timeout; + _timer_init(obj, wd); +} + +EAPI double +elm_notify_timeout_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0.0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0.0; + return wd->timeout; +} + +EAPI void +elm_notify_allow_events_set(Evas_Object *obj, Eina_Bool allow) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (allow == wd->allow_events) return; + wd->allow_events = allow; + if (!allow) + { + wd->block_events = edje_object_add(evas_object_evas_get(obj)); + _block_events_theme_apply(obj); + elm_widget_resize_object_set(obj, wd->block_events); + edje_object_signal_callback_add(wd->block_events, "elm,action,click", + "elm", _signal_block_clicked, obj); + } + else + evas_object_del(wd->block_events); +} + +EAPI Eina_Bool +elm_notify_allow_events_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->allow_events; +} diff --git a/libraries/elementary/src/lib/elm_notify.h b/libraries/elementary/src/lib/elm_notify.h new file mode 100644 index 0000000..0fab742 --- /dev/null +++ b/libraries/elementary/src/lib/elm_notify.h @@ -0,0 +1,173 @@ +/** + * @defgroup Notify Notify + * @ingroup Elementary + * + * @image html img/widget/notify/preview-00.png + * @image latex img/widget/notify/preview-00.eps + * + * Display a container in a particular region of the parent(top, bottom, + * etc). A timeout can be set to automatically hide the notify. This is so + * that, after an evas_object_show() on a notify object, if a timeout was set + * on it, it will @b automatically get hidden after that time. + * + * Signals that you can add callbacks for are: + * @li "timeout" - when timeout happens on notify and it's hidden + * @li "block,clicked" - when a click outside of the notify happens + * + * Default content parts of the notify widget that you can use for are: + * @li "default" - A content of the notify + * + * Supported elm_object common APIs. + * @li @ref elm_object_part_content_set + * @li @ref elm_object_part_content_get + * @li @ref elm_object_part_content_unset + * + * @ref tutorial_notify show usage of the API. + * + * @{ + */ + +/** + * @brief Possible orient values for notify. + * + * This values should be used in conjunction to elm_notify_orient_set() to + * set the position in which the notify should appear(relative to its parent) + * and in conjunction with elm_notify_orient_get() to know where the notify + * is appearing. + */ +typedef enum +{ + ELM_NOTIFY_ORIENT_TOP, /**< Notify should appear in the top of parent, default */ + ELM_NOTIFY_ORIENT_CENTER, /**< Notify should appear in the center of parent */ + ELM_NOTIFY_ORIENT_BOTTOM, /**< Notify should appear in the bottom of parent */ + ELM_NOTIFY_ORIENT_LEFT, /**< Notify should appear in the left of parent */ + ELM_NOTIFY_ORIENT_RIGHT, /**< Notify should appear in the right of parent */ + ELM_NOTIFY_ORIENT_TOP_LEFT, /**< Notify should appear in the top left of parent */ + ELM_NOTIFY_ORIENT_TOP_RIGHT, /**< Notify should appear in the top right of parent */ + ELM_NOTIFY_ORIENT_BOTTOM_LEFT, /**< Notify should appear in the bottom left of parent */ + ELM_NOTIFY_ORIENT_BOTTOM_RIGHT, /**< Notify should appear in the bottom right of parent */ + ELM_NOTIFY_ORIENT_LAST /**< Sentinel value, @b don't use */ +} Elm_Notify_Orient; + +/** + * @brief Add a new notify to the parent + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * @ingroup Notify + */ +EAPI Evas_Object *elm_notify_add(Evas_Object *parent); + +/** + * @brief Set the notify parent + * + * @param obj The notify object + * @param parent The new parent + * + * Once the parent object is set, a previously set one will be disconnected + * and replaced. + * + * @ingroup Notify + */ +EAPI void elm_notify_parent_set(Evas_Object *obj, Evas_Object *parent); + +/** + * @brief Get the notify parent + * + * @param obj The notify object + * @return The parent + * + * @see elm_notify_parent_set() + * + * @ingroup Notify + */ +EAPI Evas_Object *elm_notify_parent_get(const Evas_Object *obj); + +/** + * @brief Set the orientation + * + * @param obj The notify object + * @param orient The new orientation + * + * Sets the position in which the notify will appear in its parent. + * + * @see @ref Elm_Notify_Orient for possible values. + * + * @ingroup Notify + */ +EAPI void elm_notify_orient_set(Evas_Object *obj, Elm_Notify_Orient orient); + +/** + * @brief Return the orientation + * @param obj The notify object + * @return The orientation of the notification + * + * @see elm_notify_orient_set() + * @see Elm_Notify_Orient + * + * @ingroup Notify + */ +EAPI Elm_Notify_Orient elm_notify_orient_get(const Evas_Object *obj); + +/** + * @brief Set the time interval after which the notify window is going to be + * hidden. + * + * @param obj The notify object + * @param timeout The timeout in seconds + * + * This function sets a timeout and starts the timer controlling when the + * notify is hidden. Since calling evas_object_show() on a notify restarts + * the timer controlling when the notify is hidden, setting this before the + * notify is shown will in effect mean starting the timer when the notify is + * shown. + * + * @note Set a value <= 0.0 to disable a running timer. + * + * @note If the value > 0.0 and the notify is previously visible, the + * timer will be started with this value, canceling any running timer. + * + * @ingroup Notify + */ +EAPI void elm_notify_timeout_set(Evas_Object *obj, double timeout); + +/** + * @brief Return the timeout value (in seconds) + * @param obj the notify object + * + * @see elm_notify_timeout_set() + * + * @ingroup Notify + */ +EAPI double elm_notify_timeout_get(const Evas_Object *obj); + +/** + * @brief Sets whether events should be passed to by a click outside + * its area. + * + * @param obj The notify object + * @param allow EINA_TRUE If events are allowed, otherwise not + * + * When true if the user clicks outside the window the events will be caught + * by the others widgets, else the events are blocked. + * + * @note The default value is EINA_TRUE. + * + * @ingroup Notify + */ +EAPI void elm_notify_allow_events_set(Evas_Object *obj, Eina_Bool allow); + +/** + * @brief Return true if events are allowed below the notify object + * @param obj the notify object + * + * @see elm_notify_allow_events_set() + * + * @ingroup Notify + */ +EAPI Eina_Bool elm_notify_allow_events_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_object.h b/libraries/elementary/src/lib/elm_object.h new file mode 100644 index 0000000..68a863d --- /dev/null +++ b/libraries/elementary/src/lib/elm_object.h @@ -0,0 +1,376 @@ +/** + * Set a label of an object + * + * @param obj The Elementary object + * @param part The text part name to set (NULL for the default label) + * @param label The new text of the label + * + * @note Elementary objects may have many labels (e.g. Action Slider) + * + * @ingroup General + */ +EAPI void elm_object_part_text_set(Evas_Object *obj, const char *part, const char *label); + +#define elm_object_text_set(obj, label) elm_object_part_text_set((obj), NULL, (label)) + +/** + * Get a label of an object + * + * @param obj The Elementary object + * @param part The text part name to get (NULL for the default label) + * @return text of the label or NULL for any error + * + * @note Elementary objects may have many labels (e.g. Action Slider) + * + * @ingroup General + */ +EAPI const char *elm_object_part_text_get(const Evas_Object *obj, const char *part); + +#define elm_object_text_get(obj) elm_object_part_text_get((obj), NULL) + +/** + * Set a content of an object + * + * @param obj The Elementary object + * @param part The content part name to set (NULL for the default content) + * @param content The new content of the object + * + * This sets a new object to a widget as a content object. If any object was + * already set as a content object in the same part, previous object will be + * deleted automatically. + * + * @note Elementary objects may have many contents + * + * @ingroup General + */ +EAPI void elm_object_part_content_set(Evas_Object *obj, const char *part, Evas_Object *content); + +#define elm_object_content_set(obj, content) elm_object_part_content_set((obj), NULL, (content)) + +/** + * Get a content of an object + * + * @param obj The Elementary object + * @param part The content part name to get (NULL for the default content) + * @return content of the object or NULL for any error + * + * @note Elementary objects may have many contents + * + * @ingroup General + */ +EAPI Evas_Object *elm_object_part_content_get(const Evas_Object *obj, const char *part); + +#define elm_object_content_get(obj) elm_object_part_content_get((obj), NULL) + +/** + * Unset a content of an object + * + * @param obj The Elementary object + * @param part The content part name to unset (NULL for the default content) + * + * @note Elementary objects may have many contents + * + * @ingroup General + */ +EAPI Evas_Object *elm_object_part_content_unset(Evas_Object *obj, const char *part); + +#define elm_object_content_unset(obj) elm_object_part_content_unset((obj), NULL) + +/** + * Set the text to read out when in accessibility mode + * + * @param obj The object which is to be described + * @param txt The text that describes the widget to people with poor or no vision + * + * @ingroup General + */ +EAPI void elm_object_access_info_set(Evas_Object *obj, const char *txt); + +/** + * Get a named object from the children + * + * @param obj The parent object whose children to look at + * @param name The name of the child to find + * @param recurse Set to the maximum number of levels to recurse (0 == none, 1 is only look at 1 level of children etc.) + * @return The found object of that name, or NULL if none is found + * + * This function searches the children (or recursively children of + * children and so on) of the given @p obj object looking for a child with + * the name of @p name. If the child is found the object is returned, or + * NULL is returned. You can set the name of an object with + * evas_object_name_set(). If the name is not unique within the child + * objects (or the tree is @p recurse is greater than 0) then it is + * undefined as to which child of that name is returned, so ensure the name + * is unique amongst children. If recurse is set to -1 it will recurse + * without limit. + * + * @ingroup General + */ +EAPI Evas_Object *elm_object_name_find(const Evas_Object *obj, const char *name, int recurse); + +/** + * @defgroup Styles Styles + * + * Widgets can have different styles of look. These generic API's + * set styles of widgets, if they support them (and if the theme(s) + * do). + * + * @ref general_functions_example_page "This" example contemplates + * some of these functions. + */ + +/** + * Set the style to used by a given widget + * + * @param obj The Elementary widget to style + * @param style The name of the style to use on it + * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise + * + * This sets the style (by name) that will define the appearance of a + * widget. Styles vary from widget to widget and may also be defined + * by other themes by means of extensions and overlays. + * + * @see elm_theme_extension_add() + * @see elm_theme_extension_del() + * @see elm_theme_overlay_add() + * @see elm_theme_overlay_del() + * + * @ingroup Styles + */ +EAPI Eina_Bool elm_object_style_set(Evas_Object *obj, const char *style); + +/** + * Get the style used by the widget + * + * This gets the style being used for that widget. Note that the string + * pointer is only valid as long as the object is valid and the style doesn't + * change. + * + * @param obj The Elementary widget to query for its style + * @return The style name used + * + * @see elm_object_style_set() + * + * @ingroup Styles + */ +EAPI const char *elm_object_style_get(const Evas_Object *obj); + +/** + * Set the disabled state of an Elementary object. + * + * @param obj The Elementary object to operate on + * @param disabled The state to put in in: @c EINA_TRUE for + * disabled, @c EINA_FALSE for enabled + * + * Elementary objects can be @b disabled, in which state they won't + * receive input and, in general, will be themed differently from + * their normal state, usually greyed out. Useful for contexts + * where you don't want your users to interact with some of the + * parts of you interface. + * + * This sets the state for the widget, either disabling it or + * enabling it back. + * + * @ingroup Styles + */ +EAPI void elm_object_disabled_set(Evas_Object *obj, Eina_Bool disabled); + +/** + * Get the disabled state of an Elementary object. + * + * @param obj The Elementary object to operate on + * @return @c EINA_TRUE, if the widget is disabled, @c EINA_FALSE + * if it's enabled (or on errors) + * + * This gets the state of the widget, which might be enabled or disabled. + * + * @ingroup Styles + */ +EAPI Eina_Bool elm_object_disabled_get(const Evas_Object *obj); + +/** + * @defgroup WidgetNavigation Widget Tree Navigation + * + * These functions provide checks for if a Evas_Object is an Elementary widget, + * the possibility of getting a widget's parent, top level parent and getting a + * string representation of a widget's type. + */ + +/** + * Check if the given Evas Object is an Elementary widget. + * + * @param obj the object to query. + * @return @c EINA_TRUE if it is an elementary widget variant, + * @c EINA_FALSE otherwise + * @ingroup WidgetNavigation + */ +EAPI Eina_Bool elm_object_widget_check(const Evas_Object *obj); + +/** + * Get the first parent of the given object that is an Elementary + * widget. + * + * @param obj the Elementary object to query parent from. + * @return the parent object that is an Elementary widget, or @c + * NULL, if it was not found. + * + * Use this to query for an object's parent widget. + * + * @note Most of Elementary users wouldn't be mixing non-Elementary + * smart objects in the objects tree of an application, as this is + * an advanced usage of Elementary with Evas. So, except for the + * application's window, which is the root of that tree, all other + * objects would have valid Elementary widget parents. + * + * @ingroup WidgetNavigation + */ +EAPI Evas_Object *elm_object_parent_widget_get(const Evas_Object *obj); + +/** + * Get the top level parent of an Elementary widget. + * + * @param obj The object to query. + * @return The top level Elementary widget, or @c NULL if parent cannot be + * found. + * @ingroup WidgetNavigation + */ +EAPI Evas_Object *elm_object_top_widget_get(const Evas_Object *obj); + +/** + * Get the string that represents this Elementary widget. + * + * @note Elementary is weird and exposes itself as a single + * Evas_Object_Smart_Class of type "elm_widget", so + * evas_object_type_get() always return that, making debug and + * language bindings hard. This function tries to mitigate this + * problem, but the solution is to change Elementary to use + * proper inheritance. + * + * @param obj the object to query. + * @return Elementary widget name, or @c NULL if not a valid widget. + * @ingroup WidgetNavigation + */ +EAPI const char *elm_object_widget_type_get(const Evas_Object *obj); + +/** + * Send a signal to the widget edje object. + * + * This function sends a signal to the edje object of the obj. An + * edje program can respond to a signal by specifying matching + * 'signal' and 'source' fields. + * + * @param obj The object + * @param emission The signal's name. + * @param source The signal's source. + * @ingroup General + */ +EAPI void elm_object_signal_emit(Evas_Object *obj, const char *emission, const char *source); + +/** + * Add a callback for a signal emitted by widget edje object. + * + * This function connects a callback function to a signal emitted by the + * edje object of the obj. + * Globs can occur in either the emission or source name. + * + * @param obj The object + * @param emission The signal's name. + * @param source The signal's source. + * @param func The callback function to be executed when the signal is + * emitted. + * @param data A pointer to data to pass in to the callback function. + * @ingroup General + */ +EAPI void elm_object_signal_callback_add(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data); + +/** + * Remove a signal-triggered callback from a widget edje object. + * + * @param obj The object handle + * @param emission The signal's name. + * @param source The signal's source. + * @param func The callback function to be executed when the signal is + * emitted. + * @return The data pointer of the signal callback or @c NULL, on + * errors. + * + * This function removes the @b last callback, previously attached to + * a signal emitted by an undelying Edje object of @a obj, whose + * parameters @a emission, @a source and @c func match exactly with + * those passed to a previous call to + * elm_object_signal_callback_add(). The data pointer that was passed + * to this call will be returned. + * + * @ingroup General + */ +EAPI void *elm_object_signal_callback_del(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func); + +/** + * Add a callback for input events (key up, key down, mouse wheel) + * on a given Elementary widget + * + * @param obj The widget to add an event callback on + * @param func The callback function to be executed when the event + * happens + * @param data Data to pass in to @p func + * + * Every widget in an Elementary interface set to receive focus, + * with elm_object_focus_allow_set(), will propagate @b all of its + * key up, key down and mouse wheel input events up to its parent + * object, and so on. All of the focusable ones in this chain which + * had an event callback set, with this call, will be able to treat + * those events. There are two ways of making the propagation of + * these event upwards in the tree of widgets to @b cease: + * - Just return @c EINA_TRUE on @p func. @c EINA_FALSE will mean + * the event was @b not processed, so the propagation will go on. + * - The @c event_info pointer passed to @p func will contain the + * event's structure and, if you OR its @c event_flags inner + * value to @c EVAS_EVENT_FLAG_ON_HOLD, you're telling Elementary + * one has already handled it, thus killing the event's + * propagation, too. + * + * @note Your event callback will be issued on those events taking + * place only if no other child widget of @p obj has consumed the + * event already. + * + * @note Not to be confused with @c + * evas_object_event_callback_add(), which will add event callbacks + * per type on general Evas objects (no event propagation + * infrastructure taken in account). + * + * @note Not to be confused with @c + * elm_object_signal_callback_add(), which will add callbacks to @b + * signals coming from a widget's theme, not input events. + * + * @note Not to be confused with @c + * edje_object_signal_callback_add(), which does the same as + * elm_object_signal_callback_add(), but directly on an Edje + * object. + * + * @note Not to be confused with @c + * evas_object_smart_callback_add(), which adds callbacks to smart + * objects' smart events, and not input events. + * + * @see elm_object_event_callback_del() + * + * @ingroup General + */ +EAPI void elm_object_event_callback_add(Evas_Object *obj, Elm_Event_Cb func, const void *data); + +/** + * Remove an event callback from a widget. + * + * This function removes a callback, previously attached to event emission + * by the @p obj. + * The parameters func and data must match exactly those passed to + * a previous call to elm_object_event_callback_add(). The data pointer that + * was passed to this call will be returned. + * + * @param obj The object + * @param func The callback function to be executed when the event is + * emitted. + * @param data Data to pass in to the callback function. + * @return The data pointer + * @ingroup General + */ +EAPI void *elm_object_event_callback_del(Evas_Object *obj, Elm_Event_Cb func, const void *data); diff --git a/libraries/elementary/src/lib/elm_object_item.h b/libraries/elementary/src/lib/elm_object_item.h new file mode 100644 index 0000000..01bb6b6 --- /dev/null +++ b/libraries/elementary/src/lib/elm_object_item.h @@ -0,0 +1,434 @@ +/** + * Get the widget object's handle which contains a given item + * + * @param it The Elementary object item + * @return The widget object + * + * @note This returns the widget object itself that an item belongs to. + * @note Every elm_object_item supports this API + * @ingroup General + */ +EAPI Evas_Object *elm_object_item_widget_get(const Elm_Object_Item *it); + +/** + * Set a content of an object item + * + * @param it The Elementary object item + * @param part The content part name to set (NULL for the default content) + * @param content The new content of the object item + * + * This sets a new object to an item as a content object. If any object was + * already set as a content object in the same part, previous object will be + * deleted automatically. + * + * @note Elementary object items may have many contents + * + * @ingroup General + */ +EAPI void elm_object_item_part_content_set(Elm_Object_Item *it, const char *part, Evas_Object *content); + +#define elm_object_item_content_set(it, content) elm_object_item_part_content_set((it), NULL, (content)) + +/** + * Get a content of an object item + * + * @param it The Elementary object item + * @param part The content part name to unset (NULL for the default content) + * @return content of the object item or NULL for any error + * + * @note Elementary object items may have many contents + * + * @ingroup General + */ +EAPI Evas_Object *elm_object_item_part_content_get(const Elm_Object_Item *it, const char *part); + +#define elm_object_item_content_get(it) elm_object_item_part_content_get((it), NULL) + +/** + * Unset a content of an object item + * + * @param it The Elementary object item + * @param part The content part name to unset (NULL for the default content) + * + * @note Elementary object items may have many contents + * + * @ingroup General + */ +EAPI Evas_Object *elm_object_item_part_content_unset(Elm_Object_Item *it, const char *part); + +#define elm_object_item_content_unset(it) elm_object_item_part_content_unset((it), NULL) + +/** + * Set a label of an object item + * + * @param it The Elementary object item + * @param part The text part name to set (NULL for the default label) + * @param label The new text of the label + * + * @note Elementary object items may have many labels + * + * @ingroup General + */ +EAPI void elm_object_item_part_text_set(Elm_Object_Item *it, const char *part, const char *label); + +#define elm_object_item_text_set(it, label) elm_object_item_part_text_set((it), NULL, (label)) + +/** + * Get a label of an object item + * + * @param it The Elementary object item + * @param part The text part name to get (NULL for the default label) + * @return text of the label or NULL for any error + * + * @note Elementary object items may have many labels + * + * @ingroup General + */ +EAPI const char *elm_object_item_part_text_get(const Elm_Object_Item *it, const char *part); + +#define elm_object_item_text_get(it) elm_object_item_part_text_get((it), NULL) + +/** + * Set the text to read out when in accessibility mode + * + * @param it The object item which is to be described + * @param txt The text that describes the widget to people with poor or no vision + * + * @ingroup General + */ +EAPI void elm_object_item_access_info_set(Elm_Object_Item *it, const char *txt); + +/** + * Get the data associated with an object item + * @param it The Elementary object item + * @return The data associated with @p it + * + * @note Every elm_object_item supports this API + * @ingroup General + */ +EAPI void *elm_object_item_data_get(const Elm_Object_Item *it); + +/** + * Set the data associated with an object item + * @param it The Elementary object item + * @param data The data to be associated with @p it + * + * @note Every elm_object_item supports this API + * @ingroup General + */ +EAPI void elm_object_item_data_set(Elm_Object_Item *it, void *data); + +/** + * Send a signal to the edje object of the widget item. + * + * This function sends a signal to the edje object of the obj item. An + * edje program can respond to a signal by specifying matching + * 'signal' and 'source' fields. + * + * @param it The Elementary object item + * @param emission The signal's name. + * @param source The signal's source. + * @ingroup General + */ +EAPI void elm_object_item_signal_emit(Elm_Object_Item *it, const char *emission, const char *source); + +/** + * Set the disabled state of an widget item. + * + * @param it The Elementary object item + * @param disabled The state to put in in: @c EINA_TRUE for + * disabled, @c EINA_FALSE for enabled + * + * Elementary object item can be @b disabled, in which state they won't + * receive input and, in general, will be themed differently from + * their normal state, usually greyed out. Useful for contexts + * where you don't want your users to interact with some of the + * parts of you interface. + * + * This sets the state for the widget item, either disabling it or + * enabling it back. + * + * @ingroup Styles + */ +EAPI void elm_object_item_disabled_set(Elm_Object_Item *it, Eina_Bool disabled); + +/** + * Get the disabled state of an widget item. + * + * @param it The Elementary object item + * @return @c EINA_TRUE, if the widget item is disabled, @c EINA_FALSE + * if it's enabled (or on errors) + * + * This gets the state of the widget, which might be enabled or disabled. + * + * @ingroup Styles + */ +EAPI Eina_Bool elm_object_item_disabled_get(const Elm_Object_Item *it); + +/** + * @brief Set the function to be called when an item from the widget is + * freed. + * + * @param it The item to set the callback on + * @param del_cb The function called + * + * That function will receive these parameters: + * @li void * item data + * @li Evas_Object * widget object + * @li Elm_Object_Item * widget item + * + * @note Every elm_object_item supports this API + * + * @see elm_object_item_del() + * @ingroup General + */ +EAPI void elm_object_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb del_cb); + +/** + * Delete the given item. + * + * @param it The item to be deleted. + * + * @ingroup General + */ +EAPI void elm_object_item_del(Elm_Object_Item *it); + +/** + * Set the text to be shown in a given object item's tooltips. + * + * @param it Target item. + * @param text The text to set in the content. + * + * Setup the text as tooltip to object. The item can have only one tooltip, + * so any previous tooltip data - set with this function or + * elm_object_item_tooltip_content_cb_set() - is removed. + * + * @see elm_object_tooltip_text_set() for more details. + * + * @ingroup General + */ +EAPI void elm_object_item_tooltip_text_set(Elm_Object_Item *it, const char *text); + +/** + * @brief Disable size restrictions on an object's tooltip + * @param it The tooltip's anchor object + * @param disable If EINA_TRUE, size restrictions are disabled + * @return EINA_FALSE on failure, EINA_TRUE on success + * + * This function allows a tooltip to expand beyond its parent window's canvas. + * It will instead be limited only by the size of the display. + */ +EAPI Eina_Bool elm_object_item_tooltip_window_mode_set(Elm_Object_Item *it, Eina_Bool disable); + +/** + * @brief Retrieve size restriction state of an object's tooltip + * @param it The tooltip's anchor object + * @return If EINA_TRUE, size restrictions are disabled + * + * This function returns whether a tooltip is allowed to expand beyond + * its parent window's canvas. + * It will instead be limited only by the size of the display. + */ +EAPI Eina_Bool elm_object_item_tooltip_window_mode_get(const Elm_Object_Item *it); + +/** + * Set the content to be shown in the tooltip item. + * + * Setup the tooltip to item. The item can have only one tooltip, + * so any previous tooltip data is removed. @p func(with @p data) will + * be called every time that need show the tooltip and it should + * return a valid Evas_Object. This object is then managed fully by + * tooltip system and is deleted when the tooltip is gone. + * + * @param it the object item being attached a tooltip. + * @param func the function used to create the tooltip contents. + * @param data what to provide to @a func as callback data/context. + * @param del_cb called when data is not needed anymore, either when + * another callback replaces @a func, the tooltip is unset with + * elm_object_item_tooltip_unset() or the owner @a item + * dies. This callback receives as the first parameter the + * given @a data, and @c event_info is the item. + * + * @see elm_object_tooltip_content_cb_set() for more details. + * + * @ingroup General + */ +EAPI void elm_object_item_tooltip_content_cb_set(Elm_Object_Item *it, Elm_Tooltip_Item_Content_Cb func, const void *data, Evas_Smart_Cb del_cb); + +/** + * Unset tooltip from item. + * + * @param it object item to remove previously set tooltip. + * + * Remove tooltip from item. The callback provided as del_cb to + * elm_object_item_tooltip_content_cb_set() will be called to notify + * it is not used anymore. + * + * @see elm_object_tooltip_unset() for more details. + * @see elm_object_item_tooltip_content_cb_set() + * + * @ingroup General + */ +EAPI void elm_object_item_tooltip_unset(Elm_Object_Item *it); + +/** + * Sets a different style for this item tooltip. + * + * @note before you set a style you should define a tooltip with + * elm_object_item_tooltip_content_cb_set() or + * elm_object_item_tooltip_text_set() + * + * @param it object item with tooltip already set. + * @param style the theme style to use (default, transparent, ...) + * + * @see elm_object_tooltip_style_set() for more details. + * + * @ingroup General + */ +EAPI void elm_object_item_tooltip_style_set(Elm_Object_Item *it, const char *style); + +/** + * Get the style for this item tooltip. + * + * @param it object item with tooltip already set. + * @return style the theme style in use, defaults to "default". If the + * object does not have a tooltip set, then NULL is returned. + * + * @see elm_object_tooltip_style_get() for more details. + * @see elm_object_item_tooltip_style_set() + * + * @ingroup General + */ +EAPI const char *elm_object_item_tooltip_style_get(const Elm_Object_Item *it); + +/** + * Set the type of mouse pointer/cursor decoration to be shown, + * when the mouse pointer is over the given item + * + * @param it item to customize cursor on + * @param cursor the cursor type's name + * + * This function works analogously as elm_object_cursor_set(), but + * here the cursor's changing area is restricted to the item's + * area, and not the whole widget's. Note that that item cursors + * have precedence over widget cursors, so that a mouse over an + * item with custom cursor set will always show @b that cursor. + * + * If this function is called twice for an object, a previously set + * cursor will be unset on the second call. + * + * @see elm_object_cursor_set() + * @see elm_object_item_cursor_get() + * @see elm_object_item_cursor_unset() + * + * @ingroup General + */ +EAPI void elm_object_item_cursor_set(Elm_Object_Item *it, const char *cursor); + +/* + * Get the type of mouse pointer/cursor decoration set to be shown, + * when the mouse pointer is over the given item + * + * @param it item with custom cursor set + * @return the cursor type's name or @c NULL, if no custom cursors + * were set to @p item (and on errors) + * + * @see elm_object_cursor_get() + * @see elm_object_item_cursor_set() + * @see elm_object_item_cursor_unset() + * + * @ingroup General + */ +EAPI const char *elm_object_item_cursor_get(const Elm_Object_Item *it); + +/** + * Unset any custom mouse pointer/cursor decoration set to be + * shown, when the mouse pointer is over the given + * item, thus making it show the @b default cursor again. + * + * @param it the item + * + * Use this call to undo any custom settings on this item's cursor + * decoration, bringing it back to defaults (no custom style set). + * + * @see elm_object_cursor_unset() + * @see elm_object_item_cursor_set() + * + * @ingroup General + */ +EAPI void elm_object_item_cursor_unset(Elm_Object_Item *it); + +/** + * Set a different @b style for a given custom cursor set for an + * item. + * + * @param it item with custom cursor set + * @param style the theme style to use (e.g. @c "default", + * @c "transparent", etc) + * + * This function only makes sense when one is using custom mouse + * cursor decorations defined in a theme file, which can have, + * given a cursor name/type, alternate styles on it. It + * works analogously as elm_object_cursor_style_set(), but here + * applies only to item objects. + * + * @warning Before you set a cursor style you should have defined a + * custom cursor previously on the item, with + * elm_object_item_cursor_set() + * + * @see elm_object_item_cursor_engine_only_set() + * @see elm_object_item_cursor_style_get() + * + * @ingroup General + */ +EAPI void elm_object_item_cursor_style_set(Elm_Object_Item *it, const char *style); + +/** + * Get the current @b style set for a given item's custom + * cursor + * + * @param it item with custom cursor set. + * @return style the cursor style in use. If the object does not + * have a cursor set, then @c NULL is returned. + * + * @see elm_object_item_cursor_style_set() for more details + * + * @ingroup General + */ +EAPI const char *elm_object_item_cursor_style_get(const Elm_Object_Item *it); + +/** + * Set if the (custom)cursor for a given item should be + * searched in its theme, also, or should only rely on the + * rendering engine. + * + * @param it item with custom (custom) cursor already set on + * @param engine_only Use @c EINA_TRUE to have cursors looked for + * only on those provided by the rendering engine, @c EINA_FALSE to + * have them searched on the widget's theme, as well. + * + * @note This call is of use only if you've set a custom cursor + * for items, with elm_object_item_cursor_set(). + * + * @note By default, cursors will only be looked for between those + * provided by the rendering engine. + * + * @ingroup General + */ +EAPI void elm_object_item_cursor_engine_only_set(Elm_Object_Item *it, Eina_Bool engine_only); + +/** + * Get if the (custom) cursor for a given item is being + * searched in its theme, also, or is only relying on the rendering + * engine. + * + * @param it an object item + * @return @c EINA_TRUE, if cursors are being looked for only on + * those provided by the rendering engine, @c EINA_FALSE if they + * are being searched on the widget's theme, as well. + * + * @see elm_object_item_cursor_engine_only_set(), for more details + * + * @ingroup General + */ +EAPI Eina_Bool elm_object_item_cursor_engine_only_get(const Elm_Object_Item *it); diff --git a/libraries/elementary/src/lib/elm_panel.c b/libraries/elementary/src/lib/elm_panel.c new file mode 100644 index 0000000..a93a7e0 --- /dev/null +++ b/libraries/elementary/src/lib/elm_panel.c @@ -0,0 +1,399 @@ +#include +#include "elm_priv.h" +#include "els_scroller.h" +#include "els_box.h" + +typedef struct _Widget_Data Widget_Data; +struct _Widget_Data +{ + Evas_Object *scr, *bx, *content; + Elm_Panel_Orient orient; + Eina_Bool hidden : 1; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); +static void _on_focus_hook(void *data, Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _resize(void *data, Evas *evas, Evas_Object *obj, void *event); +static void _layout(Evas_Object *o, Evas_Object_Box_Data *priv, void *data); +static void _toggle_panel(void *data, Evas_Object *obj, const char *emission, const char *source); + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + free(wd); +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (wd->scr) + { + elm_widget_mirrored_set(wd->bx, rtl); + elm_panel_orient_set(obj, elm_panel_orient_get(obj)); + } +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_widget_mirrored_reload(obj); + if (wd->scr) + { + Evas_Object *edj; + const char *str; + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + elm_smart_scroller_object_theme_set(obj, wd->scr, "panel", "base", + elm_widget_style_get(obj)); + // scale = (elm_widget_scale_get(obj) * _elm_config->scale); + // edje_object_scale_set(wd->scr, scale); + edj = elm_smart_scroller_edje_object_get(wd->scr); + str = edje_object_data_get(edj, "focus_highlight"); + if ((str) && (!strcmp(str, "on"))) + elm_widget_highlight_in_theme_set(obj, EINA_TRUE); + else + elm_widget_highlight_in_theme_set(obj, EINA_FALSE); + } + + _sizing_eval(obj); +} + +static void +_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (elm_widget_focus_get(obj)) + evas_object_focus_set(obj, EINA_TRUE); + else + evas_object_focus_set(obj, EINA_FALSE); +} + +static Eina_Bool +_elm_panel_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *cur; + + if ((!wd) || (!wd->content)) + return EINA_FALSE; + + cur = wd->content; + + /* Try Focus cycle in subitem */ + if (!wd->hidden) + return elm_widget_focus_next_get(cur, dir, next); + + /* Return */ + *next = (Evas_Object *)obj; + return !elm_widget_focus_get(obj); +} + +static void +_signal_emit_hook(Evas_Object *obj, const char *emission, const char *source) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), + emission, source); +} + +static void +_signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_signal_callback_add(elm_smart_scroller_edje_object_get(wd->scr), + emission, source, func_cb, data); +} + +static void +_signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + edje_object_signal_callback_del_full( + elm_smart_scroller_edje_object_get(wd->scr), emission, source, + func_cb, data); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord mw = -1, mh = -1; + Evas_Coord vw = 0, vh = 0; + Evas_Coord w, h; + if (!wd) return; + evas_object_smart_calculate(wd->bx); + edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), + &mw, &mh); + evas_object_geometry_get(obj, NULL, NULL, &w, &h); + if (w < mw) w = mw; + if (h < mh) h = mh; + evas_object_resize(wd->scr, w, h); + + evas_object_size_hint_min_get(wd->bx, &mw, &mh); + if (w > mw) mw = w; + if (h > mh) mh = h; + evas_object_resize(wd->bx, mw, mh); + + elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh); + mw = mw + (w - vw); + mh = mh + (h - vh); + evas_object_size_hint_min_set(obj, mw, mh); + evas_object_size_hint_max_set(obj, -1, -1); +} + +static void +_resize(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + Evas_Coord mw, mh, vw, vh, w, h; + if (!wd) return; + elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh); + evas_object_size_hint_min_get(wd->bx, &mw, &mh); + evas_object_geometry_get(wd->bx, NULL, NULL, &w, &h); + if ((vw >= mw) || (vh >= mh)) + { + if ((w != vw) || (h != vh)) evas_object_resize(wd->bx, vw, vh); + } +} + +static void +_layout(Evas_Object *o, Evas_Object_Box_Data *priv, void *data) +{ + Widget_Data *wd = data; + if (!wd) return; + _els_box_layout(o, priv, EINA_TRUE, EINA_FALSE, EINA_FALSE); +} + +static void +_toggle_panel(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + if (wd->hidden) + { + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), + "elm,action,show", "elm"); + wd->hidden = EINA_FALSE; + evas_object_repeat_events_set(obj, EINA_FALSE); + } + else + { + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), + "elm,action,hide", "elm"); + wd->hidden = EINA_TRUE; + evas_object_repeat_events_set(obj, EINA_TRUE); + if (elm_widget_focus_get(wd->content)) + { + elm_widget_focused_object_clear(obj); + elm_widget_focus_steal(obj); + } + } +} + +static Eina_Bool +_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info) +{ + if ((src != obj) || (type != EVAS_CALLBACK_KEY_DOWN)) return EINA_FALSE; + + Evas_Event_Key_Down *ev = event_info; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; + + if ((strcmp(ev->keyname, "Return")) && + (strcmp(ev->keyname, "KP_Enter")) && + (strcmp(ev->keyname, "space"))) + return EINA_FALSE; + + _toggle_panel(obj, NULL, "elm,action,panel,toggle", "*"); + + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; +} + +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd; + + if (part && strcmp(part, "default")) return; + wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->content == content) return; + if (wd->content) + evas_object_box_remove_all(wd->bx, EINA_TRUE); + wd->content = content; + if (content) + { + evas_object_box_append(wd->bx, wd->content); + evas_object_show(wd->content); + } + _sizing_eval(obj); +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + + if (part && strcmp(part, "default")) return NULL; + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->content; +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + Evas_Object *content; + if (part && strcmp(part, "default")) return NULL; + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (!wd->content) return NULL; + content = wd->content; + evas_object_box_remove_all(wd->bx, EINA_FALSE); + wd->content = NULL; + return content; +} + +EAPI Evas_Object * +elm_panel_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "panel"); + elm_widget_type_set(obj, "panel"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_signal_emit_hook_set(obj, _signal_emit_hook); + elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook); + elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook); + elm_widget_focus_next_hook_set(obj, _elm_panel_focus_next_hook); + elm_widget_can_focus_set(obj, EINA_TRUE); + elm_widget_event_hook_set(obj, _event_hook); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); + + wd->scr = elm_smart_scroller_add(e); + elm_smart_scroller_widget_set(wd->scr, obj); + _theme_hook(obj); + elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE, EINA_FALSE); + elm_widget_resize_object_set(obj, wd->scr); + elm_smart_scroller_policy_set(wd->scr, ELM_SMART_SCROLLER_POLICY_OFF, + ELM_SMART_SCROLLER_POLICY_OFF); + + wd->hidden = EINA_FALSE; + wd->orient = ELM_PANEL_ORIENT_LEFT; + + wd->bx = evas_object_box_add(e); + evas_object_size_hint_align_set(wd->bx, 0.5, 0.5); + evas_object_box_layout_set(wd->bx, _layout, wd, NULL); + elm_widget_sub_object_add(obj, wd->bx); + elm_smart_scroller_child_set(wd->scr, wd->bx); + evas_object_show(wd->bx); + + edje_object_signal_callback_add(elm_smart_scroller_edje_object_get(wd->scr), + "elm,action,panel,toggle", "*", + _toggle_panel, obj); + + evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_RESIZE, _resize, obj); + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _sizing_eval(obj); + return obj; +} + +EAPI void +elm_panel_orient_set(Evas_Object *obj, Elm_Panel_Orient orient) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->orient = orient; + switch (orient) + { + case ELM_PANEL_ORIENT_TOP: + elm_smart_scroller_object_theme_set(obj, wd->scr, "panel", "base", "top"); + break; + case ELM_PANEL_ORIENT_BOTTOM: + elm_smart_scroller_object_theme_set(obj, wd->scr, "panel", "base", "bottom"); + break; + case ELM_PANEL_ORIENT_LEFT: + if (!elm_widget_mirrored_get(obj)) + elm_smart_scroller_object_theme_set(obj, wd->scr, "panel", "base", "left"); + else + elm_smart_scroller_object_theme_set(obj, wd->scr, "panel", "base", "right"); + break; + case ELM_PANEL_ORIENT_RIGHT: + if (!elm_widget_mirrored_get(obj)) + elm_smart_scroller_object_theme_set(obj, wd->scr, "panel", "base", "right"); + else + elm_smart_scroller_object_theme_set(obj, wd->scr, "panel", "base", "left"); + break; + } + + _sizing_eval(obj); +} + +EAPI Elm_Panel_Orient +elm_panel_orient_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_PANEL_ORIENT_LEFT; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return ELM_PANEL_ORIENT_LEFT; + return wd->orient; +} + +EAPI void +elm_panel_hidden_set(Evas_Object *obj, Eina_Bool hidden) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->hidden == hidden) return; + _toggle_panel(obj, NULL, "elm,action,panel,toggle", "*"); +} + +EAPI Eina_Bool +elm_panel_hidden_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->hidden; +} + +EAPI void +elm_panel_toggle(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _toggle_panel(obj, NULL, "elm,action,panel,toggle", "*"); +} diff --git a/libraries/elementary/src/lib/elm_panel.h b/libraries/elementary/src/lib/elm_panel.h new file mode 100644 index 0000000..fabbcc0 --- /dev/null +++ b/libraries/elementary/src/lib/elm_panel.h @@ -0,0 +1,105 @@ +/** + * @defgroup Panel Panel + * @ingroup Elementary + * + * @image html img/widget/panel/preview-00.png + * @image latex img/widget/panel/preview-00.eps + * + * @brief A panel is a type of animated container that contains subobjects. + * It can be expanded or contracted by clicking the button on it's edge. + * + * Orientations are as follows: + * @li ELM_PANEL_ORIENT_TOP + * @li ELM_PANEL_ORIENT_LEFT + * @li ELM_PANEL_ORIENT_RIGHT + * + * Default content parts of the panel widget that you can use for are: + * @li "default" - A content of the panel + * + * Supported elm_object common APIs. + * @li @ref elm_object_signal_emit + * @li @ref elm_object_signal_callback_add + * @li @ref elm_object_signal_callback_del + * @li @ref elm_object_part_content_set + * @li @ref elm_object_part_content_get + * @li @ref elm_object_part_content_unset + * + * @ref tutorial_panel shows one way to use this widget. + * @{ + */ +typedef enum +{ + ELM_PANEL_ORIENT_TOP, /**< Panel (dis)appears from the top */ + ELM_PANEL_ORIENT_BOTTOM, /**< Not implemented */ + ELM_PANEL_ORIENT_LEFT, /**< Panel (dis)appears from the left */ + ELM_PANEL_ORIENT_RIGHT, /**< Panel (dis)appears from the right */ +} Elm_Panel_Orient; + +/** + * @brief Adds a panel object + * + * @param parent The parent object + * + * @return The panel object, or NULL on failure + * + * @ingroup Panel + */ +EAPI Evas_Object *elm_panel_add(Evas_Object *parent); + +/** + * @brief Sets the orientation of the panel + * + * @param obj The panel object + * @param orient The panel orientation. Can be one of the following: + * @li ELM_PANEL_ORIENT_TOP + * @li ELM_PANEL_ORIENT_LEFT + * @li ELM_PANEL_ORIENT_RIGHT + * + * Sets from where the panel will (dis)appear. + * + * @ingroup Panel + */ +EAPI void elm_panel_orient_set(Evas_Object *obj, Elm_Panel_Orient orient); + +/** + * @brief Get the orientation of the panel. + * + * @param obj The panel object + * @return The Elm_Panel_Orient, or ELM_PANEL_ORIENT_LEFT on failure. + * + * @ingroup Panel + */ +EAPI Elm_Panel_Orient elm_panel_orient_get(const Evas_Object *obj); + +/** + * @brief Set the state of the panel. + * + * @param obj The panel object + * @param hidden If true, the panel will run the animation to disappear. + * + * @ingroup Panel + */ +EAPI void elm_panel_hidden_set(Evas_Object *obj, Eina_Bool hidden); + +/** + * @brief Get the state of the panel. + * + * @param obj The panel object + * @return EINA_TRUE if it is hidden state + * + * @ingroup Panel + */ +EAPI Eina_Bool elm_panel_hidden_get(const Evas_Object *obj); + +/** + * @brief Toggle the hidden state of the panel from code + * + * @param obj The panel object + * + * @ingroup Panel + */ +EAPI void elm_panel_toggle(Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_panes.c b/libraries/elementary/src/lib/elm_panes.c new file mode 100644 index 0000000..249f9e2 --- /dev/null +++ b/libraries/elementary/src/lib/elm_panes.c @@ -0,0 +1,470 @@ +#include +#include "elm_priv.h" + +/** + * TODO + * Update the minimun height of the bar in the theme. + * No minimun should be set in the vertical theme + * Add events (move, start ...) + */ + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *panes; + + struct + { + Evas_Object *left; + Evas_Object *right; + } contents; + + struct + { + int x_diff; + int y_diff; + Eina_Bool move; + } move; + + Eina_Bool clicked_double; + Eina_Bool horizontal; + Eina_Bool fixed; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); +static void _theme_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); + +static const char SIG_CLICKED[] = "clicked"; +static const char SIG_PRESS[] = "press"; +static const char SIG_UNPRESS[] = "unpress"; +static const char SIG_CLICKED_DOUBLE[] = "clicked,double"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CLICKED, ""}, + {SIG_PRESS, ""}, + {SIG_UNPRESS, ""}, + {SIG_CLICKED_DOUBLE, ""}, + {NULL, NULL} +}; + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + free(wd); +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->panes, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + const char *style = elm_widget_style_get(obj); + double size; + + if (!wd) return; + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + size = elm_panes_content_left_size_get(obj); + + if (wd->horizontal) + _elm_theme_object_set(obj, wd->panes, "panes", "horizontal", style); + else + _elm_theme_object_set(obj, wd->panes, "panes", "vertical", style); + + if (wd->contents.left) + edje_object_part_swallow(wd->panes, "elm.swallow.left", wd->contents.left); + if (wd->contents.right) + edje_object_part_swallow(wd->panes, "elm.swallow.right", wd->contents.right); + if (wd->fixed) + edje_object_signal_emit(wd->panes, "elm.panes.fixed", "elm"); + + edje_object_scale_set(wd->panes, elm_widget_scale_get(obj) * + _elm_config->scale); + _sizing_eval(obj); + elm_panes_content_left_size_set(obj, size); +} + +static Eina_Bool +_elm_panes_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + double w, h; + edje_object_part_drag_value_get(wd->panes, "elm.bar", &w, &h); + if (((wd->horizontal) && ( h == 0.0 )) || ((!wd->horizontal) && ( w == 0.0 ))) + return elm_widget_focus_next_get(wd->contents.right, dir, next); + + Evas_Object *chain[2]; + + /* Direction */ + if (dir == ELM_FOCUS_PREVIOUS) + { + chain[0] = wd->contents.right; + chain[1] = wd->contents.left; + } + else if (dir == ELM_FOCUS_NEXT) + { + chain[0] = wd->contents.left; + chain[1] = wd->contents.right; + } + else + return EINA_FALSE; + + unsigned char i = elm_widget_focus_get(chain[1]); + + if (elm_widget_focus_next_get(chain[i], dir, next)) + return EINA_TRUE; + + i = !i; + + Evas_Object *to_focus; + if (elm_widget_focus_next_get(chain[i], dir, &to_focus)) + { + *next = to_focus; + return !!i; + } + + return EINA_FALSE; +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; +} + +static void +_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _sizing_eval(data); +} + +static void +_sub_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *sub = event_info; + + if (!wd) return; + if (sub == wd->contents.left) + { + evas_object_event_callback_del_full(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + edje_object_part_unswallow(wd->panes, sub); + wd->contents.left = NULL; + _sizing_eval(obj); + } + else if (sub == wd->contents.right) + { + evas_object_event_callback_del_full(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + edje_object_part_unswallow(wd->panes, sub); + wd->contents.right= NULL; + _sizing_eval(obj); + } +} + +static void +_clicked(void *data, Evas_Object *obj __UNUSED__ , const char *emission __UNUSED__, const char *source __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_CLICKED, NULL); +} + +static void +_clicked_double(void *data, Evas_Object *obj __UNUSED__ , const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + + wd->clicked_double = EINA_TRUE; +} + +static void +_press(void *data, Evas_Object *obj __UNUSED__ , const char *emission __UNUSED__, const char *source __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_PRESS, NULL); +} + +static void +_unpress(void *data, Evas_Object *obj __UNUSED__ , const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + evas_object_smart_callback_call(data, SIG_UNPRESS, NULL); + + if (wd->clicked_double) + { + evas_object_smart_callback_call(data, SIG_CLICKED_DOUBLE, NULL); + wd->clicked_double = EINA_FALSE; + } +} + +static void +_content_left_set(Evas_Object *obj, Evas_Object *content) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (wd->contents.left == content) return; + if (wd->contents.left) + evas_object_del(wd->contents.left); + wd->contents.left = content; + if (content) + { + elm_widget_sub_object_add(obj, content); + edje_object_part_swallow(wd->panes, "elm.swallow.left", content); + } +} + +static void +_content_right_set(Evas_Object *obj, Evas_Object *content) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (wd->contents.right == content) return; + if (wd->contents.right) + evas_object_del(wd->contents.right); + wd->contents.right = content; + if (content) + { + elm_widget_sub_object_add(obj, content); + edje_object_part_swallow(wd->panes, "elm.swallow.right", content); + } +} + +static Evas_Object * +_content_left_unset(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd->contents.left) return NULL; + Evas_Object *content = wd->contents.left; + elm_widget_sub_object_del(obj, content); + return content; +} + +static Evas_Object * +_content_right_unset(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd->contents.right) return NULL; + Evas_Object *content = wd->contents.right; + elm_widget_sub_object_del(obj, content); + return content; +} + +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (part && (!strncmp(part, "elm.swallow.", 12))) part += 12; + if (!part || !strcmp(part, "left")) + _content_left_set(obj, content); + else if (!strcmp(part, "right")) + _content_right_set(obj, content); +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (part && (!strncmp(part, "elm.swallow.", 12))) part += 12; + if (!part || !strcmp(part, "left")) + return wd->contents.left; + else if (!strcmp(part, "right")) + return wd->contents.right; + return NULL; +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (part && (!strncmp(part, "elm.swallow.", 12))) part += 12; + if (!part || !strcmp(part, "left")) + return _content_left_unset(obj); + else if (!strcmp(part, "right")) + return _content_right_unset(obj); + return NULL; +} + +EAPI Evas_Object * +elm_panes_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "panes"); + elm_widget_type_set(obj, "panes"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_focus_next_hook_set(obj, _elm_panes_focus_next_hook); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); + + wd->panes = edje_object_add(e); + _elm_theme_object_set(obj, wd->panes, "panes", "vertical", "default"); + elm_widget_resize_object_set(obj, wd->panes); + evas_object_show(wd->panes); + + elm_panes_content_left_size_set(obj, 0.5); + + edje_object_signal_callback_add(wd->panes, "elm,action,click", "", + _clicked, obj); + edje_object_signal_callback_add(wd->panes, "elm,action,click,double", "", + _clicked_double, obj); + edje_object_signal_callback_add(wd->panes, "elm,action,press", "", + _press, obj); + edje_object_signal_callback_add(wd->panes, "elm,action,unpress", "", + _unpress, obj); + + evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + evas_object_event_callback_add(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _sizing_eval(obj); + return obj; +} + +EINA_DEPRECATED EAPI void +elm_panes_content_left_set(Evas_Object *obj, Evas_Object *content) +{ + _content_set_hook(obj, "left", content); +} + +EINA_DEPRECATED EAPI void +elm_panes_content_right_set(Evas_Object *obj, Evas_Object *content) +{ + _content_set_hook(obj, "right", content); +} + +EINA_DEPRECATED EAPI Evas_Object * +elm_panes_content_left_get(const Evas_Object *obj) +{ + return _content_get_hook(obj, "left"); +} + +EINA_DEPRECATED EAPI Evas_Object * +elm_panes_content_right_get(const Evas_Object *obj) +{ + return _content_get_hook(obj, "right"); +} + +EINA_DEPRECATED EAPI Evas_Object * +elm_panes_content_left_unset(Evas_Object *obj) +{ + return _content_unset_hook(obj, "left"); +} + +EINA_DEPRECATED EAPI Evas_Object * +elm_panes_content_right_unset(Evas_Object *obj) +{ + return _content_unset_hook(obj, "right"); +} + +EAPI double +elm_panes_content_left_size_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0.0; + Widget_Data *wd = elm_widget_data_get(obj); + double w, h; + + if (!wd) return 0; + edje_object_part_drag_value_get(wd->panes, "elm.bar", &w, &h); + if (wd->horizontal) return h; + else return w; +} + +EAPI void +elm_panes_content_left_size_set(Evas_Object *obj, double size) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (size < 0.0) size = 0.0; + else if (size > 1.0) size = 1.0; + if (wd->horizontal) + edje_object_part_drag_value_set(wd->panes, "elm.bar", 0.0, size); + else + edje_object_part_drag_value_set(wd->panes, "elm.bar", size, 0.0); +} + +EAPI double +elm_panes_content_right_size_get(const Evas_Object *obj) +{ + return (1.0 - elm_panes_content_left_size_get(obj)); +} + +EAPI void +elm_panes_content_right_size_set(Evas_Object *obj, double size) +{ + elm_panes_content_left_size_set(obj, (1.0 - size)); +} + +EAPI void +elm_panes_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->horizontal = horizontal; + _theme_hook(obj); + elm_panes_content_left_size_set(obj, 0.5); +} + +EAPI Eina_Bool +elm_panes_horizontal_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->horizontal; +} + +EAPI void +elm_panes_fixed_set(Evas_Object *obj, Eina_Bool fixed) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->fixed = !!fixed; + if (wd->fixed == EINA_TRUE) + edje_object_signal_emit(wd->panes, "elm.panes.fixed", "elm"); + else + edje_object_signal_emit(wd->panes, "elm.panes.unfixed", "elm"); +} + +EAPI Eina_Bool +elm_panes_fixed_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->fixed; +} diff --git a/libraries/elementary/src/lib/elm_panes.h b/libraries/elementary/src/lib/elm_panes.h new file mode 100644 index 0000000..f0fa004 --- /dev/null +++ b/libraries/elementary/src/lib/elm_panes.h @@ -0,0 +1,205 @@ +/** + * @defgroup Panes Panes + * @ingroup Elementary + * + * @image html img/widget/panes/preview-00.png + * @image latex img/widget/panes/preview-00.eps width=\textwidth + * + * @image html img/panes.png + * @image latex img/panes.eps width=\textwidth + * + * The panes widget adds a draggable bar between two contents. When dragged + * this bar will resize contents' size. + * + * Panes can be displayed vertically or horizontally, and contents + * size proportion can be customized (homogeneous by default). + * + * Smart callbacks one can listen to: + * - "press" - The panes has been pressed (button wasn't released yet). + * - "unpressed" - The panes was released after being pressed. + * - "clicked" - The panes has been clicked> + * - "clicked,double" - The panes has been double clicked + * + * Available styles for it: + * - @c "default" + * + * Default content parts of the panes widget that you can use are: + * @li "left" - A leftside content of the panes + * @li "right" - A rightside content of the panes + * + * If panes are displayed vertically, left content will be displayed on + * top. + * + * Supported elm_object common APIs. + * @li @ref elm_object_part_content_set + * @li @ref elm_object_part_content_get + * @li @ref elm_object_part_content_unset + * + * Here is an example on its usage: + * @li @ref panes_example + */ + +/** + * @addtogroup Panes + * @{ + */ + +/** + * Add a new panes widget to the given parent Elementary + * (container) object. + * + * @param parent The parent object. + * @return a new panes widget handle or @c NULL, on errors. + * + * This function inserts a new panes widget on the canvas. + * + * @ingroup Panes + */ +EAPI Evas_Object *elm_panes_add(Evas_Object *parent); + +/** + * Set whether the left and right panes resize homogeneously or not. + * + * @param obj The panes object. + * @param fixed Use @c EINA_TRUE to make @p obj to be + * resize the left and right panes @b homogeneously. + * Use @c EINA_FALSE to make use of the values specified in + * elm_panes_content_left_size_set() and + * elm_panes_content_right_size_set() + * to resize the left and right panes. + * + * By default panes are resized homogeneously. + * + * @see elm_panes_fixed_get() + * @see elm_panes_content_left_size_set() + * @see elm_panes_content_right_size_set() + * + * @ingroup Panes + */ +EAPI void elm_panes_fixed_set(Evas_Object *obj, Eina_Bool fixed); + +/** + * Retrieve the resize mode for the panes of a given panes widget. + * + * @param obj The panes object. + * @return @c EINA_TRUE, if @p obj is set to be resized @b homogeneously, + * + * @see elm_panes_fixed_set() for more details. + * @see elm_panes_content_left_size_get() + * @see elm_panes_content_right_size_get() + * + * @ingroup Panes + */ +EAPI Eina_Bool elm_panes_fixed_get(const Evas_Object *obj); + +/** + * Get the size proportion of panes widget's left side. + * + * @param obj The panes object. + * @return float value between 0.0 and 1.0 representing size proportion + * of left side. + * + * @see elm_panes_content_left_size_set() for more details. + * + * @ingroup Panes + */ +EAPI double elm_panes_content_left_size_get(const Evas_Object *obj); + +/** + * Set the size proportion of panes widget's left side. + * + * @param obj The panes object. + * @param size Value between 0.0 and 1.0 representing size proportion + * of left side. + * + * By default it's homogeneous, i.e., both sides have the same size. + * + * If something different is required, it can be set with this function. + * For example, if the left content should be displayed over + * 75% of the panes size, @p size should be passed as @c 0.75. + * This way, right content will be resized to 25% of panes size. + * + * If displayed vertically, left content is displayed at top, and + * right content at bottom. + * + * @note This proportion will change when user drags the panes bar. + * + * @see elm_panes_content_left_size_get() + * + * @ingroup Panes + */ +EAPI void elm_panes_content_left_size_set(Evas_Object *obj, double size); + +/** + * Get the size proportion of panes widget's right side. + * + * @param obj The panes object. + * @return float value between 0.0 and 1.0 representing size proportion + * of right side. + * + * @see elm_panes_content_right_size_set() for more details. + * + * @ingroup Panes + */ +EAPI double elm_panes_content_right_size_get(const Evas_Object *obj); + +/** + * Set the size proportion of panes widget's right side. + * + * @param obj The panes object. + * @param size Value between 0.0 and 1.0 representing size proportion + * of right side. + * + * By default it's homogeneous, i.e., both sides have the same size. + * + * If something different is required, it can be set with this function. + * For example, if the right content should be displayed over + * 75% of the panes size, @p size should be passed as @c 0.75. + * This way, left content will be resized to 25% of panes size. + * + * If displayed vertically, left content is displayed at top, and + * right content at bottom. + * + * @note This proportion will change when user drags the panes bar. + * + * @see elm_panes_content_right_size_get() + * + * @ingroup Panes + */ +EAPI void elm_panes_content_right_size_set(Evas_Object *obj, double size); + + +/** + * Set the orientation of a given panes widget. + * + * @param obj The panes object. + * @param horizontal Use @c EINA_TRUE to make @p obj to be + * @b horizontal, @c EINA_FALSE to make it @b vertical. + * + * Use this function to change how your panes is to be + * disposed: vertically or horizontally. + * + * By default it's displayed horizontally. + * + * @see elm_panes_horizontal_get() + * + * @ingroup Panes + */ +EAPI void elm_panes_horizontal_set(Evas_Object *obj, Eina_Bool horizontal); + +/** + * Retrieve the orientation of a given panes widget. + * + * @param obj The panes object. + * @return @c EINA_TRUE, if @p obj is set to be @b horizontal, + * @c EINA_FALSE if it's @b vertical (and on errors). + * + * @see elm_panes_horizontal_set() for more details. + * + * @ingroup Panes + */ +EAPI Eina_Bool elm_panes_horizontal_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_photo.c b/libraries/elementary/src/lib/elm_photo.c new file mode 100644 index 0000000..275f52f --- /dev/null +++ b/libraries/elementary/src/lib/elm_photo.c @@ -0,0 +1,633 @@ +#include +#include "elm_priv.h" +#include "els_icon.h" +#include "els_scroller.h" + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *frm; + Evas_Object *img; + int size; + Eina_Bool fill; + Ecore_Timer *longtimer; + +#ifdef HAVE_ELEMENTARY_ETHUMB + struct + { + int id; + + struct + { + const char *path; + const char *key; + } file, thumb; + + Ethumb_Exists *exists; + + Ecore_Event_Handler *eeh; + + Ethumb_Thumb_Format format; + + Eina_Bool retry : 1; + } thumb; +#endif + +}; + +#ifdef HAVE_ELEMENTARY_ETHUMB +static Eina_List *_elm_icon_retry = NULL; +static int _icon_pending_request = 0; + +static void _icon_thumb_exists(void *data, Ethumb_Client *client __UNUSED__, Ethumb_Exists *thread, Eina_Bool exists); +static void _icon_thumb_stop(Widget_Data *wd, void *ethumbd); +#endif + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); +static void _theme_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info); + +static const char SIG_CLICKED[] = "clicked"; +static const char SIG_DRAG_START[] = "drag,start"; +static const char SIG_DRAG_END[] = "drag,end"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CLICKED, ""}, + {SIG_DRAG_START, ""}, + {SIG_DRAG_END, ""}, + {NULL, NULL} +}; + + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); +#ifdef HAVE_ELEMENTARY_ETHUMB + Ethumb_Client *ethumbd; +#endif + if (!wd) return; + +#ifdef HAVE_ELEMENTARY_ETHUMB + ethumbd = elm_thumb_ethumb_client_get(); + _icon_thumb_stop(wd, ethumbd); + + eina_stringshare_del(wd->thumb.file.path); + eina_stringshare_del(wd->thumb.file.key); + eina_stringshare_del(wd->thumb.thumb.path); + eina_stringshare_del(wd->thumb.thumb.key); + + if (wd->thumb.eeh) + ecore_event_handler_del(wd->thumb.eeh); +#endif + + free(wd); +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->frm, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_widget_mirrored_reload(obj); + _mirrored_set(wd->frm, elm_widget_mirrored_get(obj)); + _elm_theme_object_set(obj, wd->frm, "photo", "base", + elm_widget_style_get(obj)); + edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->img); + edje_object_scale_set(wd->frm, elm_widget_scale_get(obj) * + _elm_config->scale); + _sizing_eval(obj); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; + + if (!wd) return; + if (wd->size > 0) + { + double scale = 0.0; + + scale = (wd->size * elm_widget_scale_get(obj) * _elm_config->scale); + evas_object_size_hint_min_set(wd->img, scale, scale); + edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->img); + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + edje_object_size_min_restricted_calc(wd->frm, &minw, &minh, minw, minh); + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + maxw = minw; + maxh = minh; + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, maxw, maxh); + } +} + +static void +_icon_move_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Coord w, h; + Widget_Data *wd = elm_widget_data_get(data); + + if (!wd) return; + if (wd->fill) + { + Edje_Message_Int_Set *msg; + Evas_Object *icon = _els_smart_icon_object_get(wd->img); + + evas_object_geometry_get(icon, NULL, NULL, &w, &h); + msg = alloca(sizeof(Edje_Message_Int_Set) + (sizeof(int))); + msg->count=2; + msg->val[0] = (int)w; + msg->val[1] = (int)h; + + edje_object_message_send(wd->frm, EDJE_MESSAGE_INT_SET, 0, msg); + } + +#ifdef HAVE_ELEMENTARY_ETHUMB + if (wd->thumb.file.path) + elm_photo_thumb_set(data, wd->thumb.file.path, wd->thumb.file.key); +#endif +} + + +static void +_drag_done_cb(void *unused __UNUSED__, Evas_Object *obj) +{ + elm_object_scroll_freeze_pop(obj); + evas_object_smart_callback_call(obj, SIG_DRAG_END, NULL); +} + +static Eina_Bool +_longpress(void *objv) +{ + Widget_Data *wd = elm_widget_data_get(objv); + Evas_Object *tmp; + const char *file; + + DBG("Long press: start drag!"); + wd->longtimer = NULL; /* clear: must return NULL now */ + evas_object_event_callback_del(objv, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move); + + tmp = _els_smart_icon_object_get(wd->img); + file = NULL; + evas_object_image_file_get(tmp,&file,NULL); + if (file) + { + char buf[4096 + 7]; + /* FIXME: Deal with relative paths; use PATH_MAX */ + snprintf(buf, sizeof(buf), "file://%s", file); + if (elm_drag_start(objv, ELM_SEL_FORMAT_IMAGE, + buf, _drag_done_cb, NULL)) + { + elm_object_scroll_freeze_push(objv); + evas_object_smart_callback_call(objv, SIG_DRAG_START, NULL); + } + } + + return 0; /* Don't call again */ +} + +static void +_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event) +{ + Widget_Data *wd = elm_widget_data_get(data); + Evas_Event_Mouse_Move *move = event; + + /* Sanity */ + if (!wd->longtimer) + { + evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move); + return; + } + + /* if the event is held, stop waiting */ + if (move->event_flags & EVAS_EVENT_FLAG_ON_HOLD) + { + /* Moved too far: No longpress for you! */ + ecore_timer_del(wd->longtimer); + wd->longtimer = NULL; + evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_MOVE, + _mouse_move); + } +} + +static void +_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + + if (wd->longtimer) ecore_timer_del(wd->longtimer); + + /* FIXME: Hard coded timeout */ + wd->longtimer = ecore_timer_add(0.7, _longpress, data); + evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_MOVE, + _mouse_move, data); +} + +static void +_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + + if ((wd) && (wd->longtimer)) + { + ecore_timer_del(wd->longtimer); + wd->longtimer = NULL; + } + + evas_object_smart_callback_call(data, SIG_CLICKED, NULL); +} + +static inline int +_icon_size_min_get(Evas_Object *icon) +{ + int size; + _els_smart_icon_size_get(icon, &size, NULL); + return (size < 32) ? 32 : size; +} + + +#ifdef HAVE_ELEMENTARY_ETHUMB +static void +_icon_thumb_stop(Widget_Data *wd, void *ethumbd) +{ + if (wd->thumb.id >= 0) + { + ethumb_client_generate_cancel(ethumbd, wd->thumb.id, NULL, NULL, NULL); + wd->thumb.id = -1; + _icon_pending_request--; + } + + if (wd->thumb.exists) + { + ethumb_client_thumb_exists_cancel(wd->thumb.exists); + wd->thumb.exists = NULL; + _icon_pending_request--; + } + + if (wd->thumb.retry) + { + _elm_icon_retry = eina_list_remove(_elm_icon_retry, wd); + wd->thumb.retry = EINA_FALSE; + } +} + +static Eina_Bool +_icon_thumb_display(Widget_Data *wd) +{ + Eina_Bool ret = EINA_FALSE; + + if (wd->thumb.format == ETHUMB_THUMB_EET) + { + static const char *extensions[] = { + ".avi", ".mp4", ".ogv", ".mov", ".mpg", ".wmv", NULL + }; + const char **ext, *ptr; + int prefix_size; + Eina_Bool video = EINA_FALSE; + + prefix_size = eina_stringshare_strlen(wd->thumb.file.path) - 4; + if (prefix_size >= 0) + { + ptr = wd->thumb.file.path + prefix_size; + for (ext = extensions; *ext; ++ext) + if (!strcasecmp(ptr, *ext)) + { + video = EINA_TRUE; + break; + } + } + + if (video) + ret = _els_smart_icon_file_edje_set(wd->img, wd->thumb.thumb.path, wd->thumb.thumb.key); + } + + if (!ret) + ret = _els_smart_icon_file_key_set(wd->img, wd->thumb.thumb.path, wd->thumb.thumb.key); + + return ret; +} + +static Eina_Bool +_icon_thumb_retry(Widget_Data *wd) +{ + return _icon_thumb_display(wd); +} + +static void +_icon_thumb_cleanup(Ethumb_Client *ethumbd) +{ + Eina_List *l, *ll; + Widget_Data *wd; + + EINA_LIST_FOREACH_SAFE(_elm_icon_retry, l, ll, wd) + if (_icon_thumb_retry(wd)) + { + _elm_icon_retry = eina_list_remove_list(_elm_icon_retry, l); + wd->thumb.retry = EINA_FALSE; + } + + if (_icon_pending_request == 0) + EINA_LIST_FREE(_elm_icon_retry, wd) + _icon_thumb_stop(wd, ethumbd); +} + +static void +_icon_thumb_finish(Widget_Data *wd, Ethumb_Client *ethumbd) +{ + const char *file = NULL, *group = NULL; + Eina_Bool ret; + + _els_smart_icon_file_get(wd->img, &file, &group); + file = eina_stringshare_ref(file); + group = eina_stringshare_ref(group); + + ret = _icon_thumb_display(wd); + + if (!ret && file) + { + const char *p; + + if (!wd->thumb.retry) + { + _elm_icon_retry = eina_list_append(_elm_icon_retry, wd); + wd->thumb.retry = EINA_TRUE; + } + + /* Back to previous image */ + if (((p = strrchr(file, '.'))) && (!strcasecmp(p, ".edj"))) + _els_smart_icon_file_edje_set(wd->img, file, group); + else + _els_smart_icon_file_key_set(wd->img, file, group); + } + + _icon_thumb_cleanup(ethumbd); + + eina_stringshare_del(file); + eina_stringshare_del(group); +} + +static void +_icon_thumb_cb(void *data, + Ethumb_Client *ethumbd, + int id, + const char *file __UNUSED__, + const char *key __UNUSED__, + const char *thumb_path, + const char *thumb_key, + Eina_Bool success) +{ + Widget_Data *wd = data; + + EINA_SAFETY_ON_FALSE_RETURN(wd->thumb.id == id); + wd->thumb.id = -1; + + _icon_pending_request--; + + if (success) + { + eina_stringshare_replace(&wd->thumb.thumb.path, thumb_path); + eina_stringshare_replace(&wd->thumb.thumb.key, thumb_key); + wd->thumb.format = ethumb_client_format_get(ethumbd); + + _icon_thumb_finish(wd, ethumbd); + } + else + { + ERR("could not generate thumbnail for %s (key: %s)", file, key); + _icon_thumb_cleanup(ethumbd); + } +} + +static void +_icon_thumb_exists(void *data, Ethumb_Client *client __UNUSED__, Ethumb_Exists *thread, Eina_Bool exists) +{ + Widget_Data *wd = data; + Ethumb_Client *ethumbd; + + if (ethumb_client_thumb_exists_check(thread)) + return ; + + wd->thumb.exists = NULL; + + ethumbd = elm_thumb_ethumb_client_get(); + + if (exists) + { + const char *thumb_path, *thumb_key; + + _icon_pending_request--; + ethumb_client_thumb_path_get(ethumbd, &thumb_path, &thumb_key); + eina_stringshare_replace(&wd->thumb.thumb.path, thumb_path); + eina_stringshare_replace(&wd->thumb.thumb.key, thumb_key); + wd->thumb.format = ethumb_client_format_get(ethumbd); + + _icon_thumb_finish(wd, ethumbd); + } + else if ((wd->thumb.id = ethumb_client_generate(ethumbd, _icon_thumb_cb, wd, NULL)) == -1) + { + ERR("Generate was unable to start !"); + /* Failed to generate thumbnail */ + _icon_pending_request--; + } +} + +static void +_icon_thumb_apply(Widget_Data *wd) +{ + Ethumb_Client *ethumbd; + + ethumbd = elm_thumb_ethumb_client_get(); + + _icon_thumb_stop(wd, ethumbd); + + if (!wd->thumb.file.path) return ; + + _icon_pending_request++; + if (!ethumb_client_file_set(ethumbd, wd->thumb.file.path, wd->thumb.file.key)) return ; + ethumb_client_size_set(ethumbd, _icon_size_min_get(wd->img), _icon_size_min_get(wd->img)); + wd->thumb.exists = ethumb_client_thumb_exists(ethumbd, _icon_thumb_exists, wd); +} + +static Eina_Bool +_icon_thumb_apply_cb(void *data, int type __UNUSED__, void *ev __UNUSED__) +{ + Widget_Data *wd = data; + + _icon_thumb_apply(wd); + return ECORE_CALLBACK_RENEW; +} +#endif + +EAPI Evas_Object * +elm_photo_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + Evas_Object *icon; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "photo"); + elm_widget_type_set(obj, "photo"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); + + wd->frm = edje_object_add(e); + _elm_theme_object_set(obj, wd->frm, "photo", "base", "default"); + elm_widget_resize_object_set(obj, wd->frm); + + wd->img = _els_smart_icon_add(e); + _els_smart_icon_scale_up_set(wd->img, 1); + _els_smart_icon_scale_down_set(wd->img, 1); + _els_smart_icon_smooth_scale_set(wd->img, 1); + _els_smart_icon_fill_inside_set(wd->img, 0); + _els_smart_icon_scale_size_set(wd->img, 0); + wd->fill = EINA_FALSE; + _els_smart_icon_scale_set(wd->img, + elm_widget_scale_get(obj) * _elm_config->scale); + evas_object_event_callback_add(wd->img, EVAS_CALLBACK_MOUSE_UP, + _mouse_up, obj); + evas_object_event_callback_add(wd->img, EVAS_CALLBACK_MOUSE_DOWN, + _mouse_down, obj); + evas_object_repeat_events_set(wd->img, 1); + edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->img); + evas_object_show(wd->img); + elm_widget_sub_object_add(obj, wd->img); + + wd->longtimer = NULL; + + icon = _els_smart_icon_object_get(wd->img); + evas_object_event_callback_add(icon, EVAS_CALLBACK_MOVE, + _icon_move_resize, obj); + evas_object_event_callback_add(icon, EVAS_CALLBACK_RESIZE, + _icon_move_resize, obj); + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + +#ifdef HAVE_ELEMENTARY_ETHUMB + wd->thumb.id = -1; +#endif + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _sizing_eval(obj); + return obj; +} + +EAPI Eina_Bool +elm_photo_file_set(Evas_Object *obj, const char *file) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return EINA_FALSE; + if (!_els_smart_icon_file_key_set(wd->img, file, NULL)) + return EINA_FALSE; + + _sizing_eval(obj); + return EINA_TRUE; +} + +EAPI void +elm_photo_size_set(Evas_Object *obj, int size) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + wd->size = (size > 0) ? size : 0; + + _els_smart_icon_scale_size_set(wd->img, wd->size); + + _sizing_eval(obj); +} + +EAPI void +elm_photo_fill_inside_set(Evas_Object *obj, Eina_Bool fill) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + _els_smart_icon_fill_inside_set(wd->img, fill); + wd->fill = fill; + _sizing_eval(obj); +} + +EAPI void +elm_photo_editable_set(Evas_Object *obj, Eina_Bool set) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return;; + _els_smart_icon_edit_set(wd->img, set, obj); +} + +EAPI void +elm_photo_thumb_set(const Evas_Object *obj, const char *file, const char *group) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + +#ifdef HAVE_ELEMENTARY_ETHUMB + eina_stringshare_replace(&wd->thumb.file.path, file); + eina_stringshare_replace(&wd->thumb.file.key, group); + + if (elm_thumb_ethumb_client_connected_get()) + { + _icon_thumb_apply(wd); + return ; + } + + if (!wd->thumb.eeh) + { + wd->thumb.eeh = ecore_event_handler_add(ELM_ECORE_EVENT_ETHUMB_CONNECT, _icon_thumb_apply_cb, wd); + } +#else + (void) obj; + (void) file; + (void) group; +#endif +} + +EAPI void +elm_photo_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + return _els_smart_icon_aspect_fixed_set(wd->img, fixed); +} + +EAPI Eina_Bool +elm_photo_aspect_fixed_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return _els_smart_icon_aspect_fixed_get(wd->img); +} + + + +/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-3f0^-2{2(0W1st0 :*/ diff --git a/libraries/elementary/src/lib/elm_photo.h b/libraries/elementary/src/lib/elm_photo.h new file mode 100644 index 0000000..b5e9d78 --- /dev/null +++ b/libraries/elementary/src/lib/elm_photo.h @@ -0,0 +1,113 @@ +/** + * @defgroup Photo Photo + * @ingroup Elementary + * + * For displaying a photo, for ex., a person (contact). Simple, yet + * with a very specific purpose. + * + * Signals that you can add callbacks for are: + * + * "clicked" - This is called when a user has clicked the photo + * "drag,start" - dragging the image out of the photo object + * "drag,end" - Drop the dragged item + * + * @{ + */ + +/** + * Add a new photo to the parent + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * @ingroup Photo + */ +EAPI Evas_Object *elm_photo_add(Evas_Object *parent); + +/** + * Set the file that will be used as photo + * + * @param obj The photo object + * @param file The path to file that will be used as photo + * + * @return (1 = success, 0 = error) + * + * @ingroup Photo + */ +EAPI Eina_Bool elm_photo_file_set(Evas_Object *obj, const char *file); + +/** + * Set the file that will be used as thumbnail in the photo. + * + * @param obj The photo object. + * @param file The path to file that will be used as thumbnail. + * @param group The key used in case of an EET file. + * + * @ingroup Photo + */ +EAPI void elm_photo_thumb_set(const Evas_Object *obj, const char *file, const char *group); + +/** + * Set the size that will be used on the photo + * + * @param obj The photo object + * @param size The size of the photo + * + * @ingroup Photo + */ +EAPI void elm_photo_size_set(Evas_Object *obj, int size); + +/** + * Set if the photo should be completely visible or not. + * + * @param obj The photo object + * @param fill if true the photo will be completely visible + * + * @ingroup Photo + */ +EAPI void elm_photo_fill_inside_set(Evas_Object *obj, Eina_Bool fill); + +/** + * Set editability of the photo. + * + * An editable photo can be dragged to or from, and can be cut or + * pasted too. Note that pasting an image or dropping an item on + * the image will delete the existing content. + * + * @param obj The photo object. + * @param set To set of clear editability. + */ +EAPI void elm_photo_editable_set(Evas_Object *obj, Eina_Bool set); + +/** + * Set whether the original aspect ratio of the photo should be kept on resize. + * + * @param obj The photo object. + * @param fixed @c EINA_TRUE if the photo should fix the aspect, + * @c EINA_FALSE otherwise. + * + * The original aspect ratio (width / height) of the photo is usually + * distorted to match the object's size. Enabling this option will fix + * this original aspect, and the way that the photo is fit into + * the object's area + * + * @see elm_photo_aspect_fixed_get() + * + * @ingroup Photo + */ +EAPI void elm_photo_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed); + +/** + * Get if the object keeps the original aspect ratio. + * + * @param obj The photo object. + * @return @c EINA_TRUE if the object keeps the original aspect, @c EINA_FALSE + * otherwise. + * + * @ingroup Photo + */ +EAPI Eina_Bool elm_photo_aspect_fixed_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_photocam.c b/libraries/elementary/src/lib/elm_photocam.c new file mode 100644 index 0000000..021ddcf --- /dev/null +++ b/libraries/elementary/src/lib/elm_photocam.c @@ -0,0 +1,1962 @@ +#include +#include "elm_priv.h" +#include "els_scroller.h" + +/* + * TODO (maybe - optional future stuff): + * + * 1. wrap photo in theme edje so u can have styling around photo (like white + * photo bordering). + * 2. exif handling + * 3. rotation flags in exif handling (nasty! should have rot in evas) + */ + +typedef struct _Widget_Data Widget_Data; +typedef struct _Pan Pan; +typedef struct _Grid Grid; +typedef struct _Grid_Item Grid_Item; + +struct _Grid_Item +{ + Widget_Data *wd; + Evas_Object *img; + struct + { + int x, y, w, h; + } src, out; + Eina_Bool want : 1; + Eina_Bool have : 1; +}; + +struct _Grid +{ + int tsize; // size of tile (tsize x tsize pixels) + int zoom; // zoom level tiles want for optimal display (1, 2, 4, 8) + int iw, ih; // size of image in pixels + int w, h; // size of grid image in pixels (represented by grid) + int gw, gh; // size of grid in tiles + Grid_Item *grid; // the grid (gw * gh items) + Eina_Bool dead : 1; // old grid. will die as soon as anim is over +}; + +struct _Widget_Data +{ + Evas_Object *obj; + Evas_Object *scr; + Evas_Object *pan_smart; + Evas_Object *gest; + double gest_start; + + Pan *pan; + Evas_Coord pan_x, pan_y, minw, minh; + + double zoom; + Elm_Photocam_Zoom_Mode mode; + Evas_Coord pvx, pvy, px, py, zoom_point_x, zoom_point_y; + struct + { + int imx, imy; + struct + { + int x_start, y_start; + int x_end, y_end; + double t_start; + double t_end; + Ecore_Animator *animator; + } bounce; + } gzoom; + const char *file; + + Ecore_Job *calc_job; + Ecore_Timer *scr_timer; + Ecore_Timer *long_timer; + Ecore_Animator *zoom_animator; + double t_start, t_end; + struct + { + int imw, imh; + int w, h; + int ow, oh, nw, nh; + struct + { + double x, y; + } spos; + } size; + struct + { + Eina_Bool show : 1; + Evas_Coord x, y ,w ,h; + } show; + int tsize; + Evas_Object *img; // low res version of image (scale down == 8) + int nosmooth; + int preload_num; + Eina_List *grids; + Eina_Bool main_load_pending : 1; + Eina_Bool resized : 1; + Eina_Bool longpressed : 1; + Eina_Bool on_hold : 1; + Eina_Bool paused : 1; + Eina_Bool do_region : 1; + Eina_Bool do_gesture : 1; + Eina_Bool zoom_gest : 1; +}; + +struct _Pan +{ + Evas_Object_Smart_Clipped_Data __clipped_data; + Widget_Data *wd; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); +static void _on_focus_hook(void *data, Evas_Object *obj); +//static void _show_region_hook(void *data, Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _calc_job(void *data); +static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, + Evas_Callback_Type type, void *event_info); +static void grid_place(Evas_Object *obj, Grid *g, Evas_Coord px, Evas_Coord py, Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh); +static void grid_clear(Evas_Object *obj, Grid *g); +static Grid *grid_create(Evas_Object *obj); +static void grid_load(Evas_Object *obj, Grid *g); + +static const char SIG_CLICKED[] = "clicked"; +static const char SIG_PRESS[] = "press"; +static const char SIG_LONGPRESSED[] = "longpressed"; +static const char SIG_CLICKED_DOUBLE[] = "clicked,double"; +static const char SIG_LOAD[] = "load"; +static const char SIG_LOADED[] = "loaded"; +static const char SIG_LOAD_DETAIL[] = "load,detail"; +static const char SIG_LOADED_DETAIL[] = "loaded,detail"; +static const char SIG_ZOOM_START[] = "zoom,start"; +static const char SIG_ZOOM_STOP[] = "zoom,stop"; +static const char SIG_ZOOM_CHANGE[] = "zoom,change"; +static const char SIG_SCROLL[] = "scroll"; +static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start"; +static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop"; +static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start"; +static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CLICKED, ""}, + {SIG_PRESS, ""}, + {SIG_LONGPRESSED, ""}, + {SIG_CLICKED_DOUBLE, ""}, + {SIG_LOAD, ""}, + {SIG_LOADED, ""}, + {SIG_LOAD_DETAIL, ""}, + {SIG_LOADED_DETAIL, ""}, + {SIG_ZOOM_START, ""}, + {SIG_ZOOM_STOP, ""}, + {SIG_ZOOM_CHANGE, ""}, + {SIG_SCROLL, ""}, + {SIG_SCROLL_ANIM_START, ""}, + {SIG_SCROLL_ANIM_STOP, ""}, + {SIG_SCROLL_DRAG_START, ""}, + {SIG_SCROLL_DRAG_STOP, ""}, + {NULL, NULL} +}; + + +static int +nearest_pow2(int num) +{ + unsigned int n = num - 1; + n |= n >> 1; + n |= n >> 2; + n |= n >> 4; + n |= n >> 8; + n |= n >> 16; + return n + 1; +} + +static void +img_place(Evas_Object *obj, Evas_Coord px, Evas_Coord py, Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord ax, ay, gw, gh; + if (!wd) return; + ax = 0; + ay = 0; + gw = wd->size.w; + gh = wd->size.h; + if (!wd->zoom_gest) + { + if (ow > gw) ax = (ow - gw) / 2; + if (oh > gh) ay = (oh - gh) / 2; + } + evas_object_move(wd->img, ox + 0 - px + ax, oy + 0 - py + ay); + evas_object_resize(wd->img, gw, gh); + + if (wd->show.show) + { + wd->show.show = EINA_FALSE; + elm_smart_scroller_child_region_show(wd->scr, wd->show.x, wd->show.y, wd->show.w, wd->show.h); + } +} + +static void +grid_place(Evas_Object *obj, Grid *g, Evas_Coord px, Evas_Coord py, Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord ax, ay, gw, gh, tx, ty; + int x, y; + if (!wd) return; + ax = 0; + ay = 0; + gw = wd->size.w; + gh = wd->size.h; + if (!wd->zoom_gest) + { + if (ow > gw) ax = (ow - gw) / 2; + if (oh > gh) ay = (oh - gh) / 2; + } + for (y = 0; y < g->gh; y++) + { + for (x = 0; x < g->gw; x++) + { + int tn, xx, yy, ww, hh; + + tn = (y * g->gw) + x; + xx = g->grid[tn].out.x; + yy = g->grid[tn].out.y; + ww = g->grid[tn].out.w; + hh = g->grid[tn].out.h; + if ((gw != g->w) && (g->w > 0)) + { + tx = xx; + xx = (gw * xx) / g->w; + ww = ((gw * (tx + ww)) / g->w) - xx; + } + if ((gh != g->h) && (g->h > 0)) + { + ty = yy; + yy = (gh * yy) / g->h; + hh = ((gh * (ty + hh)) / g->h) - yy; + } + evas_object_move(g->grid[tn].img, + ox + xx - px + ax, + oy + yy - py + ay); + evas_object_resize(g->grid[tn].img, ww, hh); + } + } +} + +static void +grid_clear(Evas_Object *obj, Grid *g) +{ + Widget_Data *wd = elm_widget_data_get(obj); + int x, y; + if (!wd) return; + if (!g->grid) return; + for (y = 0; y < g->gh; y++) + { + for (x = 0; x < g->gw; x++) + { + int tn; + + tn = (y * g->gw) + x; + evas_object_del(g->grid[tn].img); + if (g->grid[tn].want) + { + wd->preload_num--; + if (!wd->preload_num) + { + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), + "elm,state,busy,stop", "elm"); + evas_object_smart_callback_call(obj, SIG_LOAD_DETAIL, NULL); + } + } + } + } + free(g->grid); + g->grid = NULL; + g->gw = 0; + g->gh = 0; +} + +static void +_tile_preloaded(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__) +{ + Grid_Item *git = data; + + if (git->want) + { + git->want = 0; + evas_object_show(git->img); + git->have = 1; + git->wd->preload_num--; + if (!git->wd->preload_num) + { + edje_object_signal_emit(elm_smart_scroller_edje_object_get(git->wd->scr), + "elm,state,busy,stop", "elm"); + evas_object_smart_callback_call(git->wd->obj, SIG_LOADED_DETAIL, NULL); + } + } +} + +static int +grid_zoom_calc(double zoom) +{ + int z = zoom; + if (z < 1) z = 1; + return nearest_pow2(z); +} + +static Grid * +grid_create(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + int x, y; + Grid *g; + + if (!wd) return NULL; + g = calloc(1, sizeof(Grid)); + if (!g) return NULL; + + g->zoom = grid_zoom_calc(wd->zoom); + g->tsize = wd->tsize; + g->iw = wd->size.imw; + g->ih = wd->size.imh; + + g->w = g->iw / g->zoom; + g->h = g->ih / g->zoom; + if (g->zoom >= 8) + { + free(g); + return NULL; + } + if (wd->do_region) + { + g->gw = (g->w + g->tsize - 1) / g->tsize; + g->gh = (g->h + g->tsize - 1) / g->tsize; + } + else + { + g->gw = 1; + g->gh = 1; + } + g->grid = calloc(1, sizeof(Grid_Item) * g->gw * g->gh); + if (!g->grid) + { + g->gw = 0; + g->gh = 0; + return g; + } + for (y = 0; y < g->gh; y++) + { + for (x = 0; x < g->gw; x++) + { + int tn; + + tn = (y * g->gw) + x; + g->grid[tn].src.x = x * g->tsize; + if (x == (g->gw - 1)) + g->grid[tn].src.w = g->w - ((g->gw - 1) * g->tsize); + else + g->grid[tn].src.w = g->tsize; + g->grid[tn].src.y = y * g->tsize; + if (y == (g->gh - 1)) + g->grid[tn].src.h = g->h - ((g->gh - 1) * g->tsize); + else + g->grid[tn].src.h = g->tsize; + + g->grid[tn].out.x = g->grid[tn].src.x; + g->grid[tn].out.y = g->grid[tn].src.y; + g->grid[tn].out.w = g->grid[tn].src.w; + g->grid[tn].out.h = g->grid[tn].src.h; + + g->grid[tn].wd = wd; + g->grid[tn].img = + evas_object_image_add(evas_object_evas_get(obj)); + evas_object_image_load_orientation_set(g->grid[tn].img, EINA_TRUE); + evas_object_image_scale_hint_set + (g->grid[tn].img, EVAS_IMAGE_SCALE_HINT_DYNAMIC); + evas_object_pass_events_set(g->grid[tn].img, EINA_TRUE); + evas_object_smart_member_add(g->grid[tn].img, + wd->pan_smart); + elm_widget_sub_object_add(obj, g->grid[tn].img); + evas_object_image_filled_set(g->grid[tn].img, 1); + evas_object_event_callback_add(g->grid[tn].img, + EVAS_CALLBACK_IMAGE_PRELOADED, + _tile_preloaded, + &(g->grid[tn])); + } + } + return g; +} + +static void +grid_load(Evas_Object *obj, Grid *g) +{ + Widget_Data *wd = elm_widget_data_get(obj); + int x, y; + Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh, gw, gh, tx, ty; + if (!wd) return; + evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh); + evas_output_viewport_get(evas_object_evas_get(wd->obj), &cvx, &cvy, &cvw, &cvh); + gw = wd->size.w; + gh = wd->size.h; + for (y = 0; y < g->gh; y++) + { + for (x = 0; x < g->gw; x++) + { + int tn, xx, yy, ww, hh; + Eina_Bool visible = EINA_FALSE; + + tn = (y * g->gw) + x; + xx = g->grid[tn].out.x; + yy = g->grid[tn].out.y; + ww = g->grid[tn].out.w; + hh = g->grid[tn].out.h; + if ((gw != g->w) && (g->w > 0)) + { + tx = xx; + xx = (gw * xx) / g->w; + ww = ((gw * (tx + ww)) / g->w) - xx; + } + if ((gh != g->h) && (g->h > 0)) + { + ty = yy; + yy = (gh * yy) / g->h; + hh = ((gh * (ty + hh)) / g->h) - yy; + } + if (ELM_RECTS_INTERSECT(xx - wd->pan_x + ox, + yy - wd->pan_y + oy, + ww, hh, + cvx, cvy, cvw, cvh)) + visible = 1; + if ((visible) && (!g->grid[tn].have) && (!g->grid[tn].want)) + { + g->grid[tn].want = 1; + evas_object_hide(g->grid[tn].img); + evas_object_image_file_set(g->grid[tn].img, NULL, NULL); + evas_object_image_load_scale_down_set(g->grid[tn].img, g->zoom); + evas_object_image_load_region_set(g->grid[tn].img, + g->grid[tn].src.x, + g->grid[tn].src.y, + g->grid[tn].src.w, + g->grid[tn].src.h); + evas_object_image_file_set(g->grid[tn].img, wd->file, NULL); + evas_object_image_preload(g->grid[tn].img, 0); + wd->preload_num++; + if (wd->preload_num == 1) + { + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), + "elm,state,busy,start", "elm"); + evas_object_smart_callback_call(obj, SIG_LOAD_DETAIL, NULL); + } + } + else if ((g->grid[tn].want) && (!visible)) + { + wd->preload_num--; + if (!wd->preload_num) + { + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), + "elm,state,busy,stop", "elm"); + evas_object_smart_callback_call(obj, SIG_LOADED_DETAIL, NULL); + } + g->grid[tn].want = 0; + evas_object_hide(g->grid[tn].img); + evas_object_image_preload(g->grid[tn].img, 1); + evas_object_image_file_set(g->grid[tn].img, NULL, NULL); + } + else if ((g->grid[tn].have) && (!visible)) + { + g->grid[tn].have = 0; + evas_object_hide(g->grid[tn].img); + evas_object_image_preload(g->grid[tn].img, 1); + evas_object_image_file_set(g->grid[tn].img, NULL, NULL); + } + } + } +} + +static void +grid_clearall(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Grid *g; + if (!wd) return; + EINA_LIST_FREE(wd->grids, g) + { + grid_clear(obj, g); + free(g); + } +} + +static void +_smooth_update(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + int x, y; + Eina_List *l; + Grid *g; + if (!wd) return; + EINA_LIST_FOREACH(wd->grids, l, g) + { + for (y = 0; y < g->gh; y++) + { + for (x = 0; x < g->gw; x++) + { + int tn; + + tn = (y * g->gw) + x; + evas_object_image_smooth_scale_set(g->grid[tn].img, (!wd->nosmooth)); + } + } + } + evas_object_image_smooth_scale_set(wd->img, (!wd->nosmooth)); +} + +static void +_grid_raise(Grid *g) +{ + int x, y; + + for (y = 0; y < g->gh; y++) + { + for (x = 0; x < g->gw; x++) + { + int tn; + + tn = (y * g->gw) + x; + evas_object_raise(g->grid[tn].img); + } + } +} + +static Eina_Bool +_scr_timeout(void *data) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return ECORE_CALLBACK_CANCEL; + wd->nosmooth--; + if (!wd->nosmooth) _smooth_update(data); + wd->scr_timer = NULL; + return ECORE_CALLBACK_CANCEL; +} + +static void +_scr(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + if (!wd->scr_timer) + { + wd->nosmooth++; + if (wd->nosmooth == 1) _smooth_update(data); + } + if (wd->scr_timer) ecore_timer_del(wd->scr_timer); + wd->scr_timer = ecore_timer_add(0.5, _scr_timeout, data); +} + +static void +_main_preloaded(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *obj = data; + Widget_Data *wd = elm_widget_data_get(obj); + Grid *g; + if (!wd) return; + evas_object_show(wd->img); + wd->main_load_pending = 0; + g = grid_create(obj); + if (g) + { + wd->grids = eina_list_prepend(wd->grids, g); + grid_load(wd->obj, g); + } + if (wd->calc_job) ecore_job_del(wd->calc_job); + wd->calc_job = ecore_job_add(_calc_job, wd); + evas_object_smart_callback_call(data, SIG_LOADED, NULL); + wd->preload_num--; + if (!wd->preload_num) + { + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), + "elm,state,busy,stop", "elm"); + evas_object_smart_callback_call(obj, SIG_LOADED_DETAIL, NULL); + } +} + +static Eina_Bool +zoom_do(Evas_Object *obj, double t) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord xx, yy, ow, oh; + if (!wd) return ECORE_CALLBACK_CANCEL; + wd->size.w = (wd->size.ow * (1.0 - t)) + (wd->size.nw * t); + wd->size.h = (wd->size.oh * (1.0 - t)) + (wd->size.nh * t); + elm_smart_scroller_child_viewport_size_get(wd->scr, &ow, &oh); + xx = (wd->size.spos.x * wd->size.w) - (ow / 2); + yy = (wd->size.spos.y * wd->size.h) - (oh / 2); + if (xx < 0) xx = 0; + else if (xx > (wd->size.w - ow)) xx = wd->size.w - ow; + if (yy < 0) yy = 0; + else if (yy > (wd->size.h - oh)) yy = wd->size.h - oh; + + wd->show.show = EINA_TRUE; + wd->show.x = xx; + wd->show.y = yy; + wd->show.w = ow; + wd->show.h = oh; + + if (wd->calc_job) ecore_job_del(wd->calc_job); + wd->calc_job = ecore_job_add(_calc_job, wd); + if (t >= 1.0) + { + Eina_List *l, *l_next; + Grid *g; + + EINA_LIST_FOREACH_SAFE(wd->grids, l, l_next, g) + { + if (g->dead) + { + wd->grids = eina_list_remove_list(wd->grids, l); + grid_clear(obj, g); + free(g); + } + } + return ECORE_CALLBACK_CANCEL; + } + return ECORE_CALLBACK_RENEW; +} + + +static Eina_Bool +_zoom_anim(void *data) +{ + Evas_Object *obj = data; + Widget_Data *wd = elm_widget_data_get(obj); + double t; + Eina_Bool go; + if (!wd) return ECORE_CALLBACK_CANCEL; + t = ecore_loop_time_get(); + if (t >= wd->t_end) + t = 1.0; + else if (wd->t_end > wd->t_start) + t = (t - wd->t_start) / (wd->t_end - wd->t_start); + else + t = 1.0; + t = 1.0 - t; + t = 1.0 - (t * t); + go = zoom_do(obj, t); + if (!go) + { + wd->nosmooth--; + if (!wd->nosmooth) _smooth_update(data); + wd->zoom_animator = NULL; + evas_object_smart_callback_call(obj, SIG_ZOOM_STOP, NULL); + } + return go; +} + +static void +_mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + // Evas_Event_Mouse_Move *ev = event_info; + if (!wd) return; +} + +static Eina_Bool +_long_press(void *data) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return ECORE_CALLBACK_CANCEL; + wd->long_timer = NULL; + wd->longpressed = EINA_TRUE; + evas_object_smart_callback_call(data, SIG_LONGPRESSED, NULL); + return ECORE_CALLBACK_CANCEL; +} + +static void +_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(data); + Evas_Event_Mouse_Down *ev = event_info; + if (!wd) return; + if (ev->button != 1) return; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) wd->on_hold = EINA_TRUE; + else wd->on_hold = EINA_FALSE; + if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) + evas_object_smart_callback_call(data, SIG_CLICKED_DOUBLE, NULL); + else + evas_object_smart_callback_call(data, SIG_PRESS, NULL); + wd->longpressed = EINA_FALSE; + if (wd->long_timer) ecore_timer_del(wd->long_timer); + wd->long_timer = ecore_timer_add(_elm_config->longpress_timeout, _long_press, data); +} + +static void +_mouse_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(data); + Evas_Event_Mouse_Up *ev = event_info; + if (!wd) return; + if (ev->button != 1) return; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) wd->on_hold = EINA_TRUE; + else wd->on_hold = EINA_FALSE; + if (wd->long_timer) + { + ecore_timer_del(wd->long_timer); + wd->long_timer = NULL; + } + if (!wd->on_hold) + evas_object_smart_callback_call(data, SIG_CLICKED, NULL); + wd->on_hold = EINA_FALSE; +} + +static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_NULL; + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Grid *g; + if (!wd) return; + EINA_LIST_FREE(wd->grids, g) + { + if (g->grid) free(g->grid); + free(g); + } + evas_object_del(wd->pan_smart); + wd->pan_smart = NULL; + if (wd->file) eina_stringshare_del(wd->file); + if (wd->calc_job) ecore_job_del(wd->calc_job); + if (wd->scr_timer) ecore_timer_del(wd->scr_timer); + if (wd->zoom_animator) ecore_animator_del(wd->zoom_animator); + if (wd->gzoom.bounce.animator) ecore_animator_del(wd->gzoom.bounce.animator); + if (wd->long_timer) ecore_timer_del(wd->long_timer); + free(wd); +} + +static void +_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (elm_widget_focus_get(obj)) + { + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), "elm,action,focus", "elm"); + evas_object_focus_set(wd->obj, EINA_TRUE); + } + else + { + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), "elm,action,unfocus", "elm"); + evas_object_focus_set(wd->obj, EINA_FALSE); + } +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_smart_scroller_object_theme_set(obj, wd->scr, "photocam", "base", elm_widget_style_get(obj)); + // edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale); + _sizing_eval(obj); +} + +/* +static void +_show_region_hook(void *data, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(data); + Evas_Coord x, y, w, h; + if (!wd) return; + elm_widget_show_region_get(obj, &x, &y, &w, &h); + elm_smart_scroller_child_region_show(wd->scr, x, y, w, h); +} +*/ + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; + if (!wd) return; + // evas_object_size_hint_min_get(wd->scr, &minw, &minh); + evas_object_size_hint_max_get(wd->scr, &maxw, &maxh); + // minw = -1; + // minh = -1; + // if (wd->mode != ELM_LIST_LIMIT) minw = -1; + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, maxw, maxh); +} + +static void +_calc_job(void *data) +{ + Widget_Data *wd = data; + Evas_Coord minw, minh; + if (!wd) return; + minw = wd->size.w; + minh = wd->size.h; + if (wd->resized) + { + wd->resized = 0; + if (wd->mode != ELM_PHOTOCAM_ZOOM_MODE_MANUAL) + { + double tz = wd->zoom; + wd->zoom = 0.0; + elm_photocam_zoom_set(wd->obj, tz); + } + } + if ((minw != wd->minw) || (minh != wd->minh)) + { + wd->minw = minw; + wd->minh = minh; + evas_object_smart_callback_call(wd->pan_smart, "changed", NULL); + _sizing_eval(wd->obj); + } + wd->calc_job = NULL; + evas_object_smart_changed(wd->pan_smart); +} + +static void +_pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y) +{ + Pan *sd = evas_object_smart_data_get(obj); + if (!sd) return; + if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return; + sd->wd->pan_x = x; + sd->wd->pan_y = y; + evas_object_smart_changed(obj); +} + +static void +_pan_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y) +{ + Pan *sd = evas_object_smart_data_get(obj); + if (!sd) return; + if (x) *x = sd->wd->pan_x; + if (y) *y = sd->wd->pan_y; +} + +static void +_pan_max_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y) +{ + Pan *sd = evas_object_smart_data_get(obj); + Evas_Coord ow, oh; + if (!sd) return; + evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); + ow = sd->wd->minw - ow; + if (ow < 0) ow = 0; + oh = sd->wd->minh - oh; + if (oh < 0) oh = 0; + if (x) *x = ow; + if (y) *y = oh; +} + +static void +_pan_min_get(Evas_Object *obj __UNUSED__, Evas_Coord *x, Evas_Coord *y) +{ + if (x) *x = 0; + if (y) *y = 0; +} + +static void +_pan_child_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) +{ + Pan *sd = evas_object_smart_data_get(obj); + if (!sd) return; + if (w) *w = sd->wd->minw; + if (h) *h = sd->wd->minh; +} + +static void +_pan_add(Evas_Object *obj) +{ + Pan *sd; + Evas_Object_Smart_Clipped_Data *cd; + _pan_sc.add(obj); + cd = evas_object_smart_data_get(obj); + if (!cd) return; + sd = calloc(1, sizeof(Pan)); + if (!sd) return; + sd->__clipped_data = *cd; + free(cd); + evas_object_smart_data_set(obj, sd); +} + +static void +_pan_del(Evas_Object *obj) +{ + Pan *sd = evas_object_smart_data_get(obj); + if (!sd) return; + _pan_sc.del(obj); +} + +static void +_pan_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) +{ + Pan *sd = evas_object_smart_data_get(obj); + Evas_Coord ow, oh; + if (!sd) return; + evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); + if ((ow == w) && (oh == h)) return; + sd->wd->resized = 1; + if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job); + sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd); +} + +static void +_pan_calculate(Evas_Object *obj) +{ + Pan *sd = evas_object_smart_data_get(obj); + Evas_Coord ox, oy, ow, oh; + Eina_List *l; + Grid *g; + if (!sd) return; + evas_object_geometry_get(obj, &ox, &oy, &ow, &oh); + img_place(sd->wd->obj, sd->wd->pan_x, sd->wd->pan_y, + ox - sd->wd->gzoom.imx, oy - sd->wd->gzoom.imy, ow, oh); + EINA_LIST_FOREACH(sd->wd->grids, l, g) + { + grid_load(sd->wd->obj, g); + grid_place(sd->wd->obj, g, sd->wd->pan_x, sd->wd->pan_y, + ox - sd->wd->gzoom.imx, oy - sd->wd->gzoom.imy, ow, oh); + } +} + +static void +_pan_move(Evas_Object *obj, Evas_Coord x __UNUSED__, Evas_Coord y __UNUSED__) +{ + Pan *sd = evas_object_smart_data_get(obj); + if (!sd) return; + if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job); + sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd); +} + +static void +_hold_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_smart_scroller_hold_set(wd->scr, 1); +} + +static void +_hold_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_smart_scroller_hold_set(wd->scr, 0); +} + +static void +_freeze_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_smart_scroller_freeze_set(wd->scr, 1); +} + +static void +_freeze_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_smart_scroller_freeze_set(wd->scr, 0); +} + +static void +_scr_anim_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_START, NULL); +} + +static void +_scr_anim_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_STOP, NULL); +} + +static void +_scr_drag_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START, NULL); +} + +static void +_scr_drag_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP, NULL); +} + +static void +_scr_scroll(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_SCROLL, NULL); +} + +static Eina_Bool +_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, + Evas_Callback_Type type, void *event_info) +{ + double zoom; + if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE; + Evas_Event_Key_Down *ev = event_info; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; + + Evas_Coord x = 0; + Evas_Coord y = 0; + Evas_Coord step_x = 0; + Evas_Coord step_y = 0; + Evas_Coord v_w = 0; + Evas_Coord v_h = 0; + Evas_Coord page_x = 0; + Evas_Coord page_y = 0; + + elm_smart_scroller_child_pos_get(wd->scr, &x, &y); + elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y); + elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y); + elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h); + + if ((!strcmp(ev->keyname, "Left")) || + ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string))) + { + x -= step_x; + } + else if ((!strcmp(ev->keyname, "Right")) || + ((!strcmp(ev->keyname, "KP_Right")) && (!ev->string))) + { + x += step_x; + } + else if ((!strcmp(ev->keyname, "Up")) || + ((!strcmp(ev->keyname, "KP_Up")) && (!ev->string))) + { + y -= step_y; + } + else if ((!strcmp(ev->keyname, "Down")) || + ((!strcmp(ev->keyname, "KP_Down")) && (!ev->string))) + { + y += step_y; + } + else if ((!strcmp(ev->keyname, "Prior")) || + ((!strcmp(ev->keyname, "KP_Prior")) && (!ev->string))) + { + if (page_y < 0) + y -= -(page_y * v_h) / 100; + else + y -= page_y; + } + else if ((!strcmp(ev->keyname, "Next")) || + ((!strcmp(ev->keyname, "KP_Next")) && (!ev->string))) + { + if (page_y < 0) + y += -(page_y * v_h) / 100; + else + y += page_y; + } + else if ((!strcmp(ev->keyname, "KP_Add"))) + { + zoom = elm_photocam_zoom_get(obj); + zoom -= 0.5; + elm_photocam_zoom_mode_set(obj, ELM_PHOTOCAM_ZOOM_MODE_MANUAL); + elm_photocam_zoom_set(obj, zoom); + return EINA_TRUE; + } + else if ((!strcmp(ev->keyname, "KP_Subtract"))) + { + zoom = elm_photocam_zoom_get(obj); + zoom += 0.5; + elm_photocam_zoom_mode_set(obj, ELM_PHOTOCAM_ZOOM_MODE_MANUAL); + elm_photocam_zoom_set(obj, zoom); + return EINA_TRUE; + } + else return EINA_FALSE; + + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + elm_smart_scroller_child_pos_set(wd->scr, x, y); + + return EINA_TRUE; +} + +Eina_Bool +_bounce_eval(void *_wd) +{ + Widget_Data *wd = (Widget_Data *)_wd; + double t, tt; + + if (!wd) return ECORE_CALLBACK_CANCEL; + if ((wd->gzoom.imx == wd->gzoom.bounce.x_end) && + (wd->gzoom.imy == wd->gzoom.bounce.y_end)) + { + wd->gzoom.imx = 0; + wd->gzoom.imy = 0; + wd->zoom_gest = EINA_FALSE; + wd->gzoom.bounce.animator = NULL; + _freeze_off(NULL, wd->obj, NULL); + return ECORE_CALLBACK_CANCEL; + } + + t = ecore_loop_time_get(); + tt = (t - wd->gzoom.bounce.t_start) / (wd->gzoom.bounce.t_end - wd->gzoom.bounce.t_start); + tt = 1.0 - tt; + tt = 1.0 - (tt * tt); + + if (t > wd->gzoom.bounce.t_end) + { + wd->gzoom.imx = 0; + wd->gzoom.imy = 0; + wd->zoom_gest = EINA_FALSE; + _freeze_off(NULL, wd->obj, NULL); + zoom_do(wd->obj, 1.0); + wd->gzoom.bounce.animator = NULL; + return ECORE_CALLBACK_CANCEL; + } + + if (wd->gzoom.imx != wd->gzoom.bounce.x_end) + wd->gzoom.imx = wd->gzoom.bounce.x_start * (1.0 - tt) + wd->gzoom.bounce.x_end * tt; + + if (wd->gzoom.imy != wd->gzoom.bounce.y_end) + wd->gzoom.imy = wd->gzoom.bounce.y_start * (1.0 - tt) + wd->gzoom.bounce.y_end * tt; + + zoom_do(wd->obj, 1.0 - (1.0 - tt)); + return ECORE_CALLBACK_RENEW; +} + +static void +_gzoom(Widget_Data *_wd, Evas_Coord px, Evas_Coord py, Elm_Gesture_Zoom_Info* gest) +{ + Widget_Data *wd = (Widget_Data *)_wd; + Evas_Coord rx, ry, rw, rh; + int regx, regy, regw, regh, ix, iy, iw, ih; + int xx, yy; + + if (!wd) return; + wd->mode = ELM_PHOTOCAM_ZOOM_MODE_MANUAL; + wd->zoom = wd->gest_start / gest->zoom; + wd->size.ow = wd->size.w; + wd->size.oh = wd->size.h; + elm_smart_scroller_child_pos_get(wd->scr, &rx, &ry); + elm_smart_scroller_child_viewport_size_get(wd->scr, &rw, &rh); + if ((rw <= 0) || (rh <= 0)) return; + + wd->size.nw = (double)wd->size.imw / wd->zoom; + wd->size.nh = (double)wd->size.imh / wd->zoom; + + elm_photocam_image_region_get(wd->obj, ®x, ®y, ®w, ®h); + evas_object_geometry_get(wd->img, &ix, &iy, &iw, &ih); + + wd->pvx = gest->x; + wd->pvy = gest->y; + + xx = (px / wd->zoom) - wd->pvx; + yy = (py / wd->zoom) - wd->pvy; + wd->gzoom.imx = 0; + wd->gzoom.imy = 0; + + if ((xx < 0) || (rw > wd->size.nw)) + { + wd->gzoom.imx = xx; + xx = 0; + } + else if ((xx + rw) > wd->size.nw) + { + wd->gzoom.imx = xx + rw - wd->size.nw; + xx = wd->size.nw - rw; + } + + if ((yy < 0) || (rh > wd->size.nh)) + { + wd->gzoom.imy = yy; + yy = 0; + } + else if ((yy + rh) > wd->size.nh) + { + wd->gzoom.imy = yy + rh - wd->size.nh; + yy = wd->size.nh - rh; + } + + wd->size.spos.x = (double)(xx + (rw / 2)) / (double)(wd->size.nw); + wd->size.spos.y = (double)(yy + (rh / 2)) / (double)(wd->size.nh); + + zoom_do(wd->obj, 1.0); +} + +static Evas_Event_Flags +_gzoom_start(void *_wd, void *event_info) +{ + Widget_Data *wd = (Widget_Data *)_wd; + Elm_Gesture_Zoom_Info *p = (Elm_Gesture_Zoom_Info *) event_info; + Evas_Coord rw, rh; + int x,y,w,h; + double marginx = 0, marginy = 0; + + if (wd->gzoom.bounce.animator) + { + ecore_animator_del(wd->gzoom.bounce.animator); + wd->gzoom.bounce.animator = NULL; + } + wd->zoom_gest = EINA_TRUE; + _freeze_on(NULL, wd->obj, NULL); + + elm_photocam_image_region_get(wd->obj, &x, &y, &w, &h); + elm_smart_scroller_child_viewport_size_get(wd->scr, &rw, &rh); + + if (rw > wd->size.nw) + marginx = (rw - wd->size.nw) / 2; + if (rh > wd->size.nh) + marginy = (rh - wd->size.nh) / 2; + + wd->gest_start = wd->zoom; + + wd->zoom_point_x = x + ((p->x - marginx) * wd->zoom) + wd->gzoom.imx; + wd->zoom_point_y = y + ((p->y - marginy) * wd->zoom) + wd->gzoom.imy; + + return EVAS_EVENT_FLAG_NONE; +} + +static Evas_Event_Flags +_gzoom_move(void *_wd, void *event_info) +{ + Widget_Data *wd = (Widget_Data *)_wd; + Elm_Gesture_Zoom_Info *p = (Elm_Gesture_Zoom_Info *) event_info; + + _gzoom(wd, wd->zoom_point_x, wd->zoom_point_y, p); + return EVAS_EVENT_FLAG_NONE; +} + +static Evas_Event_Flags +_gzoom_end(void *_wd, void *event_info __UNUSED__) +{ + Widget_Data *wd = (Widget_Data *)_wd; + Evas_Coord rw, rh; + + elm_smart_scroller_child_viewport_size_get(wd->scr, &rw, &rh); + wd->gest_start = 1.0; + + if (wd->gzoom.imx || wd->gzoom.imy) + { + double t; + + t = ecore_loop_time_get(); + wd->gzoom.bounce.x_start = wd->gzoom.imx; + wd->gzoom.bounce.y_start = wd->gzoom.imy; + wd->gzoom.bounce.x_end = 0; + wd->gzoom.bounce.y_end = 0; + + if (rw > wd->size.nw && + rh > wd->size.nh) + { + Evas_Coord pw, ph; + double z; + + if ((wd->size.imw < rw) && (wd->size.imh < rh)) + { + wd->zoom = 1; + wd->size.nw = wd->size.imw; + wd->size.nh = wd->size.imh; + } + else + { + ph = (wd->size.imh * rw) / wd->size.imw; + if (ph > rh) + { + pw = (wd->size.imw * rh) / wd->size.imh; + ph = rh; + } + else + { + pw = rw; + } + if (wd->size.imw > wd->size.imh) + z = (double)wd->size.imw / pw; + else + z = (double)wd->size.imh / ph; + + wd->zoom = z; + wd->size.nw = pw; + wd->size.nh = ph; + } + wd->gzoom.bounce.x_end = (wd->size.nw - rw) / 2; + wd->gzoom.bounce.y_end = (wd->size.nh - rh) / 2; + } + else + { + int xx, yy; + + xx = (wd->zoom_point_x / wd->zoom) - wd->pvx; + yy = (wd->zoom_point_y / wd->zoom) - wd->pvy; + + if (xx < 0) xx = 0; + if (yy < 0) yy = 0; + + if (rw > wd->size.nw) + wd->gzoom.bounce.x_end = (wd->size.nw -rw) / 2; + if ((xx + rw) > wd->size.nw) + xx = wd->size.nw - rw; + + if (rh > wd->size.nh) + wd->gzoom.bounce.y_end = (wd->size.nh - rh) / 2; + if ((yy + rh) > wd->size.nh) + yy = wd->size.nh - rh; + + wd->size.spos.x = (double)(xx + (rw / 2)) / (double)(wd->size.nw); + wd->size.spos.y = (double)(yy + (rh / 2)) / (double)(wd->size.nh); + } + + wd->gzoom.bounce.t_start = t; + wd->gzoom.bounce.t_end = t + _elm_config->page_scroll_friction; + + wd->gzoom.bounce.animator = ecore_animator_add(_bounce_eval, wd); + } + else + { + _freeze_off(NULL, wd->obj, NULL); + wd->zoom_gest = EINA_FALSE; + } + + return EVAS_EVENT_FLAG_NONE; +} + +EAPI Evas_Object * +elm_photocam_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + Evas_Coord minw, minh; + static Evas_Smart *smart = NULL; + Eina_Bool bounce = _elm_config->thumbscroll_bounce_enable; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "photocam"); + elm_widget_type_set(obj, "photocam"); + elm_widget_sub_object_add(parent, obj); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_can_focus_set(obj, EINA_TRUE); + elm_widget_event_hook_set(obj, _event_hook); + + wd->scr = elm_smart_scroller_add(e); + elm_smart_scroller_widget_set(wd->scr, obj); + elm_smart_scroller_object_theme_set(obj, wd->scr, "photocam", "base", "default"); + evas_object_smart_callback_add(wd->scr, "scroll", _scr, obj); + evas_object_smart_callback_add(wd->scr, "drag", _scr, obj); + elm_widget_resize_object_set(obj, wd->scr); + + evas_object_smart_callback_add(wd->scr, "animate,start", _scr_anim_start, obj); + evas_object_smart_callback_add(wd->scr, "animate,stop", _scr_anim_stop, obj); + evas_object_smart_callback_add(wd->scr, "drag,start", _scr_drag_start, obj); + evas_object_smart_callback_add(wd->scr, "drag,stop", _scr_drag_stop, obj); + evas_object_smart_callback_add(wd->scr, "scroll", _scr_scroll, obj); + + elm_smart_scroller_bounce_allow_set(wd->scr, bounce, bounce); + + wd->obj = obj; + + evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj); + evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj); + evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj); + evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj); + + if (!smart) + { + static Evas_Smart_Class sc; + + evas_object_smart_clipped_smart_set(&_pan_sc); + sc = _pan_sc; + sc.name = "elm_photocam_pan"; + sc.version = EVAS_SMART_CLASS_VERSION; + sc.add = _pan_add; + sc.del = _pan_del; + sc.resize = _pan_resize; + sc.move = _pan_move; + sc.calculate = _pan_calculate; + smart = evas_smart_class_new(&sc); + } + if (smart) + { + wd->pan_smart = evas_object_smart_add(e, smart); + wd->pan = evas_object_smart_data_get(wd->pan_smart); + wd->pan->wd = wd; + } + + elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart, + _pan_set, _pan_get, _pan_max_get, + _pan_min_get, _pan_child_size_get); + + wd->zoom_gest = EINA_FALSE; + wd->gest_start = 1.0; + wd->zoom = 1; + wd->mode = ELM_PHOTOCAM_ZOOM_MODE_MANUAL; + wd->tsize = 512; + + wd->img = evas_object_image_add(e); + evas_object_image_load_orientation_set(wd->img, EINA_TRUE); + evas_object_image_scale_hint_set(wd->img, EVAS_IMAGE_SCALE_HINT_DYNAMIC); + evas_object_event_callback_add(wd->img, EVAS_CALLBACK_MOUSE_DOWN, + _mouse_down, obj); + evas_object_event_callback_add(wd->img, EVAS_CALLBACK_MOUSE_UP, + _mouse_up, obj); + evas_object_event_callback_add(wd->img, EVAS_CALLBACK_MOUSE_MOVE, + _mouse_move, obj); + evas_object_image_scale_hint_set(wd->img, EVAS_IMAGE_SCALE_HINT_STATIC); + evas_object_smart_member_add(wd->img, wd->pan_smart); + elm_widget_sub_object_add(obj, wd->img); + evas_object_image_filled_set(wd->img, 1); + evas_object_event_callback_add(wd->img, EVAS_CALLBACK_IMAGE_PRELOADED, + _main_preloaded, obj); + + edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), + &minw, &minh); + evas_object_size_hint_min_set(obj, minw, minh); + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + _sizing_eval(obj); + return obj; +} + +EAPI Evas_Load_Error +elm_photocam_file_set(Evas_Object *obj, const char *file) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EVAS_LOAD_ERROR_NONE; + Widget_Data *wd = elm_widget_data_get(obj); + int w, h; + if (!wd) return EVAS_LOAD_ERROR_GENERIC; + if (!eina_stringshare_replace(&wd->file, file)) return EVAS_LOAD_ERROR_NONE; + grid_clearall(obj); + + evas_object_hide(wd->img); + evas_object_image_smooth_scale_set(wd->img, (wd->nosmooth == 0)); + evas_object_image_file_set(wd->img, NULL, NULL); + evas_object_image_load_scale_down_set(wd->img, 0); + evas_object_image_file_set(wd->img, wd->file, NULL); + evas_object_image_size_get(wd->img, &w, &h); + wd->do_region = evas_object_image_region_support_get(wd->img); + wd->size.imw = w; + wd->size.imh = h; + wd->size.w = wd->size.imw / wd->zoom; + wd->size.h = wd->size.imh / wd->zoom; + if (wd->gzoom.bounce.animator) + { + ecore_animator_del(wd->gzoom.bounce.animator); + wd->gzoom.bounce.animator = NULL; + } + if (wd->zoom_animator) + { + wd->nosmooth--; + if (wd->nosmooth == 0) _smooth_update(obj); + ecore_animator_del(wd->zoom_animator); + wd->zoom_animator = NULL; + } + evas_object_image_file_set(wd->img, NULL, NULL); + evas_object_image_load_scale_down_set(wd->img, 8); + evas_object_image_file_set(wd->img, wd->file, NULL); + evas_object_image_preload(wd->img, 0); + wd->main_load_pending = 1; + if (wd->calc_job) ecore_job_del(wd->calc_job); + wd->calc_job = ecore_job_add(_calc_job, wd); + evas_object_smart_callback_call(obj, SIG_LOAD, NULL); + wd->preload_num++; + if (wd->preload_num == 1) + { + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), + "elm,state,busy,start", "elm"); + evas_object_smart_callback_call(obj, SIG_LOAD_DETAIL, NULL); + } + { + double tz = wd->zoom; + wd->zoom = 0.0; + elm_photocam_zoom_set(wd->obj, tz); + } + return evas_object_image_load_error_get(wd->img); +} + +EAPI const char * +elm_photocam_file_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->file; +} + +EAPI void +elm_photocam_zoom_set(Evas_Object *obj, double zoom) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + Eina_List *l; + Grid *g, *g_zoom = NULL; + Evas_Coord pw, ph, rx, ry, rw, rh; + double z; + int zoom_changed = 0, started = 0; + Ecore_Animator *an; + if (!wd) return; + if (zoom <= (1.0 / 256.0)) zoom = (1.0 / 256.0); + if (zoom == wd->zoom) return; + wd->zoom = zoom; + wd->size.ow = wd->size.w; + wd->size.oh = wd->size.h; + elm_smart_scroller_child_pos_get(wd->scr, &rx, &ry); + elm_smart_scroller_child_viewport_size_get(wd->scr, &rw, &rh); + if ((rw <= 0) || (rh <= 0)) return; + + if (wd->mode == ELM_PHOTOCAM_ZOOM_MODE_MANUAL) + { + wd->size.nw = (double)wd->size.imw / wd->zoom; + wd->size.nh = (double)wd->size.imh / wd->zoom; + } + else if (wd->mode == ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT) + { + if ((wd->size.imw < 1) || (wd->size.imh < 1)) + { + wd->size.nw = 0; + wd->size.nh = 0; + } + else + { + ph = (wd->size.imh * rw) / wd->size.imw; + if (ph > rh) + { + pw = (wd->size.imw * rh) / wd->size.imh; + ph = rh; + } + else + { + pw = rw; + } + if (wd->size.imw > wd->size.imh) + z = (double)wd->size.imw / pw; + else + z = (double)wd->size.imh / ph; + if (z != wd->zoom) + zoom_changed = 1; + wd->zoom = z; + wd->size.nw = pw; + wd->size.nh = ph; + } + } + else if (wd->mode == ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL) + { + if ((wd->size.imw < 1) || (wd->size.imh < 1)) + { + wd->size.nw = 0; + wd->size.nw = 0; + } + else + { + ph = (wd->size.imh * rw) / wd->size.imw; + if (ph < rh) + { + pw = (wd->size.imw * rh) / wd->size.imh; + ph = rh; + } + else + { + pw = rw; + } + if (wd->size.imw > wd->size.imh) + z = (double)wd->size.imw / pw; + else + z = (double)wd->size.imh / ph; + if (z != wd->zoom) + zoom_changed = 1; + wd->zoom = z; + wd->size.nw = pw; + wd->size.nh = ph; + } + } + else if (wd->mode == ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT_IN) + { + if ((wd->size.imw < 1) || (wd->size.imh < 1)) + { + wd->size.nw = 0; + wd->size.nh = 0; + } + else if ((wd->size.imw < rw) && (wd->size.imh < rh)) + { + if (1 != wd->zoom) zoom_changed = 1; + wd->zoom = 1; + wd->size.nw = wd->size.imw; + wd->size.nh = wd->size.imh; + } + else + { + ph = (wd->size.imh * rw) / wd->size.imw; + if (ph > rh) + { + pw = (wd->size.imw * rh) / wd->size.imh; + ph = rh; + } + else + pw = rw; + if (wd->size.imw > wd->size.imh) + z = (double)wd->size.imw / pw; + else + z = (double)wd->size.imh / ph; + if (z != wd->zoom) + zoom_changed = 1; + wd->zoom = z; + wd->size.nw = pw; + wd->size.nh = ph; + } + } + if (wd->main_load_pending) + { + wd->size.w = wd->size.nw; + wd->size.h = wd->size.nh; + goto done; + } + EINA_LIST_FOREACH(wd->grids, l, g) + { + if (g->zoom == grid_zoom_calc(wd->zoom)) + { + wd->grids = eina_list_remove(wd->grids, g); + wd->grids = eina_list_prepend(wd->grids, g); + _grid_raise(g); + goto done; + } + } + g = grid_create(obj); + if (g) + { + if (eina_list_count(wd->grids) > 1) + { + g_zoom = eina_list_last(wd->grids)->data; + wd->grids = eina_list_remove(wd->grids, g_zoom); + grid_clear(obj, g_zoom); + free(g_zoom); + EINA_LIST_FOREACH(wd->grids, l, g_zoom) + { + g_zoom->dead = 1; + } + } + wd->grids = eina_list_prepend(wd->grids, g); + } + else + { + EINA_LIST_FREE(wd->grids, g) + { + grid_clear(obj, g); + free(g); + } + } + done: + wd->t_start = ecore_loop_time_get(); + wd->t_end = wd->t_start + _elm_config->zoom_friction; + if ((wd->size.w > 0) && (wd->size.h > 0)) + { + wd->size.spos.x = (double)(rx + (rw / 2)) / (double)wd->size.w; + wd->size.spos.y = (double)(ry + (rh / 2)) / (double)wd->size.h; + } + else + { + wd->size.spos.x = 0.5; + wd->size.spos.y = 0.5; + } + if (rw > wd->size.w) wd->size.spos.x = 0.5; + if (rh > wd->size.h) wd->size.spos.y = 0.5; + if (wd->size.spos.x > 1.0) wd->size.spos.x = 1.0; + if (wd->size.spos.y > 1.0) wd->size.spos.y = 1.0; + if (wd->paused) + { + zoom_do(obj, 1.0); + } + else + { + if (!wd->zoom_animator) + { + wd->zoom_animator = ecore_animator_add(_zoom_anim, obj); + wd->nosmooth++; + if (wd->nosmooth == 1) _smooth_update(obj); + started = 1; + } + } + an = wd->zoom_animator; + if (an) + { + if (!_zoom_anim(obj)) + { + ecore_animator_del(an); + an = NULL; + } + } + if (wd->calc_job) ecore_job_del(wd->calc_job); + wd->calc_job = ecore_job_add(_calc_job, wd); + if (!wd->paused) + { + if (started) + evas_object_smart_callback_call(obj, SIG_ZOOM_START, NULL); + if (!an) + evas_object_smart_callback_call(obj, SIG_ZOOM_STOP, NULL); + } + if (zoom_changed) + evas_object_smart_callback_call(obj, SIG_ZOOM_CHANGE, NULL); +} + +EAPI double +elm_photocam_zoom_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 1.0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 1.0; + return wd->zoom; +} + +EAPI void +elm_photocam_zoom_mode_set(Evas_Object *obj, Elm_Photocam_Zoom_Mode mode) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->mode == mode) return; + wd->mode = mode; + { + double tz = wd->zoom; + wd->zoom = 0.0; + elm_photocam_zoom_set(wd->obj, tz); + } +} + +EAPI Elm_Photocam_Zoom_Mode +elm_photocam_zoom_mode_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_PHOTOCAM_ZOOM_MODE_LAST; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return ELM_PHOTOCAM_ZOOM_MODE_LAST; + return wd->mode; +} + +EAPI void +elm_photocam_image_size_get(const Evas_Object *obj, int *w, int *h) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (w) *w = wd->size.imw; + if (h) *h = wd->size.imh; +} + +EAPI void +elm_photocam_image_region_get(const Evas_Object *obj, int *x, int *y, int *w, int *h) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord sx, sy, sw, sh; + if (!wd) return; + elm_smart_scroller_child_pos_get(wd->scr, &sx, &sy); + elm_smart_scroller_child_viewport_size_get(wd->scr, &sw, &sh); + if (wd->size.w > 0) + { + if (x) + { + *x = (wd->size.imw * sx) / wd->size.w; + if (*x > wd->size.imw) *x = wd->size.imw; + } + if (w) + { + *w = (wd->size.imw * sw) / wd->size.w; + if (*w > wd->size.imw) *w = wd->size.imw; + else if (*w < 0) *w = 0; + } + } + else + { + if (x) *x = 0; + if (w) *w = 0; + } + + if (wd->size.h > 0) + { + if (y) + { + *y = (wd->size.imh * sy) / wd->size.h; + if (*y > wd->size.imh) *y = wd->size.imh; + } + if (h) + { + *h = (wd->size.imh * sh) / wd->size.h; + if (*h > wd->size.imh) *h = wd->size.imh; + else if (*h < 0) *h = 0; + } + } + else + { + if (y) *y = 0; + if (h) *h = 0; + } +} + +EAPI void +elm_photocam_image_region_show(Evas_Object *obj, int x, int y, int w, int h __UNUSED__) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + int rx, ry, rw, rh; + if (!wd) return; + if ((wd->size.imw < 1) || (wd->size.imh < 1)) return; + rx = (x * wd->size.w) / wd->size.imw; + ry = (y * wd->size.h) / wd->size.imh; + rw = (w * wd->size.w) / wd->size.imw; + rh = (h * wd->size.h) / wd->size.imh; + if (rw < 1) rw = 1; + if (rh < 1) rh = 1; + if ((rx + rw) > wd->size.w) rx = wd->size.w - rw; + if ((ry + rh) > wd->size.h) ry = wd->size.h - rh; + if (wd->gzoom.bounce.animator) + { + ecore_animator_del(wd->gzoom.bounce.animator); + wd->gzoom.bounce.animator = NULL; + zoom_do(obj, 1.0); + } + if (wd->zoom_animator) + { + wd->nosmooth--; + ecore_animator_del(wd->zoom_animator); + wd->zoom_animator = NULL; + zoom_do(obj, 1.0); + evas_object_smart_callback_call(obj, SIG_ZOOM_STOP, NULL); + } + elm_smart_scroller_child_region_show(wd->scr, rx, ry, rw, rh); +} + +EAPI void +elm_photocam_image_region_bring_in(Evas_Object *obj, int x, int y, int w, int h __UNUSED__) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + int rx, ry, rw, rh; + if (!wd) return; + if ((wd->size.imw < 1) || (wd->size.imh < 1)) return; + rx = (x * wd->size.w) / wd->size.imw; + ry = (y * wd->size.h) / wd->size.imh; + rw = (w * wd->size.w) / wd->size.imw; + rh = (h * wd->size.h) / wd->size.imh; + if (rw < 1) rw = 1; + if (rh < 1) rh = 1; + if ((rx + rw) > wd->size.w) rx = wd->size.w - rw; + if ((ry + rh) > wd->size.h) ry = wd->size.h - rh; + if (wd->gzoom.bounce.animator) + { + ecore_animator_del(wd->gzoom.bounce.animator); + wd->gzoom.bounce.animator = NULL; + zoom_do(obj, 1.0); + } + if (wd->zoom_animator) + { + wd->nosmooth--; + if (!wd->nosmooth) _smooth_update(obj); + ecore_animator_del(wd->zoom_animator); + wd->zoom_animator = NULL; + zoom_do(obj, 1.0); + evas_object_smart_callback_call(obj, SIG_ZOOM_STOP, NULL); + } + elm_smart_scroller_region_bring_in(wd->scr, rx, ry, rw, rh); +} + +EAPI void +elm_photocam_paused_set(Evas_Object *obj, Eina_Bool paused) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->paused == !!paused) return; + wd->paused = paused; + if (wd->paused) + { + if (wd->gzoom.bounce.animator) + { + ecore_animator_del(wd->gzoom.bounce.animator); + wd->gzoom.bounce.animator = NULL; + zoom_do(obj, 1.0); + } + if (wd->zoom_animator) + { + ecore_animator_del(wd->zoom_animator); + wd->zoom_animator = NULL; + zoom_do(obj, 1.0); + evas_object_smart_callback_call(obj, SIG_ZOOM_STOP, NULL); + } + } +} + +EAPI Eina_Bool +elm_photocam_paused_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->paused; +} + +EAPI Evas_Object * +elm_photocam_internal_image_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->img; +} + +EAPI void +elm_photocam_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce); +} + +EAPI void +elm_photocam_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_smart_scroller_bounce_allow_get(wd->scr, h_bounce, v_bounce); +} + +EAPI void +elm_photocam_gesture_enabled_set(Evas_Object *obj, Eina_Bool gesture) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->do_gesture == !!gesture) return; + + if (wd->gest) + { + evas_object_del(wd->gest); + wd->gest = NULL; + } + + if (gesture) + { + wd->gest = elm_gesture_layer_add(wd->obj); + if (!wd->gest) return; + elm_gesture_layer_attach(wd->gest, wd->obj); + elm_gesture_layer_cb_set(wd->gest, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_START, + _gzoom_start, wd); + elm_gesture_layer_cb_set(wd->gest, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_MOVE, + _gzoom_move, wd); + elm_gesture_layer_cb_set(wd->gest, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_END, + _gzoom_end, wd); + elm_gesture_layer_cb_set(wd->gest, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_ABORT, + _gzoom_end, wd); + } + + wd->do_gesture = !!gesture; +} + +EAPI Eina_Bool +elm_photocam_gesture_enabled_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + return wd->do_gesture; +} diff --git a/libraries/elementary/src/lib/elm_photocam.h b/libraries/elementary/src/lib/elm_photocam.h new file mode 100644 index 0000000..2adb1b0 --- /dev/null +++ b/libraries/elementary/src/lib/elm_photocam.h @@ -0,0 +1,318 @@ +/** + * @defgroup Photocam Photocam + * @ingroup Elementary + * + * @image html img/widget/photocam/preview-00.png + * @image latex img/widget/photocam/preview-00.eps + * + * This is a widget specifically for displaying high-resolution digital + * camera photos giving speedy feedback (fast load), low memory footprint + * and zooming and panning as well as fitting logic. It is entirely focused + * on jpeg images, and takes advantage of properties of the jpeg format (via + * evas loader features in the jpeg loader). + * + * Signals that you can add callbacks for are: + * @li "clicked" - This is called when a user has clicked the photo without + * dragging around. + * @li "press" - This is called when a user has pressed down on the photo. + * @li "longpressed" - This is called when a user has pressed down on the + * photo for a long time without dragging around. + * @li "clicked,double" - This is called when a user has double-clicked the + * photo. + * @li "load" - Photo load begins. + * @li "loaded" - This is called when the image file load is complete for the + * first view (low resolution blurry version). + * @li "load,detail" - Photo detailed data load begins. + * @li "loaded,detail" - This is called when the image file load is complete + * for the detailed image data (full resolution needed). + * @li "zoom,start" - Zoom animation started. + * @li "zoom,stop" - Zoom animation stopped. + * @li "zoom,change" - Zoom changed when using an auto zoom mode. + * @li "scroll" - the content has been scrolled (moved) + * @li "scroll,anim,start" - scrolling animation has started + * @li "scroll,anim,stop" - scrolling animation has stopped + * @li "scroll,drag,start" - dragging the contents around has started + * @li "scroll,drag,stop" - dragging the contents around has stopped + * + * @ref tutorial_photocam shows the API in action. + * @{ + */ + +/** + * @brief Types of zoom available. + */ +typedef enum +{ + ELM_PHOTOCAM_ZOOM_MODE_MANUAL = 0, /**< Zoom controlled normally by elm_photocam_zoom_set */ + ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT, /**< Zoom until photo fits in photocam */ + ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL, /**< Zoom until photo fills photocam */ + ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT_IN, /**< Zoom in until photo fits in photocam */ + ELM_PHOTOCAM_ZOOM_MODE_LAST +} Elm_Photocam_Zoom_Mode; + +/** + * @brief Add a new Photocam object + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * @ingroup Photocam + */ +EAPI Evas_Object *elm_photocam_add(Evas_Object *parent); + +/** + * @brief Set the photo file to be shown + * + * @param obj The photocam object + * @param file The photo file + * @return The return error (see EVAS_LOAD_ERROR_NONE, EVAS_LOAD_ERROR_GENERIC etc.) + * + * This sets (and shows) the specified file (with a relative or absolute + * path) and will return a load error (same error that + * evas_object_image_load_error_get() will return). The image will change and + * adjust its size at this point and begin a background load process for this + * photo that at some time in the future will be displayed at the full + * quality needed. + * + * @ingroup Photocam + */ +EAPI Evas_Load_Error elm_photocam_file_set(Evas_Object *obj, const char *file); + +/** + * @brief Returns the path of the current image file + * + * @param obj The photocam object + * @return Returns the path + * + * @see elm_photocam_file_set() + * + * @ingroup Photocam + */ +EAPI const char *elm_photocam_file_get(const Evas_Object *obj); + +/** + * @brief Set the zoom level of the photo + * + * @param obj The photocam object + * @param zoom The zoom level to set + * + * This sets the zoom level. 1 will be 1:1 pixel for pixel. 2 will be 2:1 + * (that is 2x2 photo pixels will display as 1 on-screen pixel). 4:1 will be + * 4x4 photo pixels as 1 screen pixel, and so on. The @p zoom parameter must + * be greater than 0. It is suggested to stick to powers of 2. (1, 2, 4, 8, + * 16, 32, etc.). + * + * @ingroup Photocam + */ +EAPI void elm_photocam_zoom_set(Evas_Object *obj, double zoom); + +/** + * @brief Get the zoom level of the photo + * + * @param obj The photocam object + * @return The current zoom level + * + * This returns the current zoom level of the photocam object. Note that if + * you set the fill mode to other than ELM_PHOTOCAM_ZOOM_MODE_MANUAL + * (which is the default), the zoom level may be changed at any time by the + * photocam object itself to account for photo size and photocam viewport + * size. + * + * @see elm_photocam_zoom_set() + * @see elm_photocam_zoom_mode_set() + * + * @ingroup Photocam + */ +EAPI double elm_photocam_zoom_get(const Evas_Object *obj); + +/** + * @brief Set the zoom mode + * + * @param obj The photocam object + * @param mode The desired mode + * + * This sets the zoom mode to manual or one of several automatic levels. + * Manual (ELM_PHOTOCAM_ZOOM_MODE_MANUAL) means that zoom is set manually by + * elm_photocam_zoom_set() and will stay at that level until changed by code + * or until zoom mode is changed. This is the default mode. The Automatic + * modes will allow the photocam object to automatically adjust zoom mode + * based on properties. ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT) will adjust zoom so + * the photo fits EXACTLY inside the scroll frame with no pixels outside this + * region. ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL will be similar but ensure no + * pixels within the frame are left unfilled. + * + * @ingroup Photocam + */ +EAPI void elm_photocam_zoom_mode_set(Evas_Object *obj, Elm_Photocam_Zoom_Mode mode); + +/** + * @brief Get the zoom mode + * + * @param obj The photocam object + * @return The current zoom mode + * + * This gets the current zoom mode of the photocam object. + * + * @see elm_photocam_zoom_mode_set() + * + * @ingroup Photocam + */ +EAPI Elm_Photocam_Zoom_Mode elm_photocam_zoom_mode_get(const Evas_Object *obj); + +/** + * @brief Get the current image pixel width and height + * + * @param obj The photocam object + * @param w A pointer to the width return + * @param h A pointer to the height return + * + * This gets the current photo pixel width and height (for the original). + * The size will be returned in the integers @p w and @p h that are pointed + * to. + * + * @ingroup Photocam + */ +EAPI void elm_photocam_image_size_get(const Evas_Object *obj, int *w, int *h); + +/** + * @brief Get the region of the image that is currently shown + * + * @param obj + * @param x A pointer to the X-coordinate of region + * @param y A pointer to the Y-coordinate of region + * @param w A pointer to the width + * @param h A pointer to the height + * + * @see elm_photocam_image_region_show() + * @see elm_photocam_image_region_bring_in() + * + * @ingroup Photocam + */ +EAPI void elm_photocam_image_region_get(const Evas_Object *obj, int *x, int *y, int *w, int *h); + +/** + * @brief Set the viewed region of the image + * + * @param obj The photocam object + * @param x X-coordinate of region in image original pixels + * @param y Y-coordinate of region in image original pixels + * @param w Width of region in image original pixels + * @param h Height of region in image original pixels + * + * This shows the region of the image without using animation. + * + * @ingroup Photocam + */ +EAPI void elm_photocam_image_region_show(Evas_Object *obj, int x, int y, int w, int h); + +/** + * @brief Bring in the viewed portion of the image + * + * @param obj The photocam object + * @param x X-coordinate of region in image original pixels + * @param y Y-coordinate of region in image original pixels + * @param w Width of region in image original pixels + * @param h Height of region in image original pixels + * + * This shows the region of the image using animation. + * + * @ingroup Photocam + */ +EAPI void elm_photocam_image_region_bring_in(Evas_Object *obj, int x, int y, int w, int h); + +/** + * @brief Set the paused state for photocam + * + * @param obj The photocam object + * @param paused The pause state to set + * + * This sets the paused state to on(EINA_TRUE) or off (EINA_FALSE) for + * photocam. The default is off. This will stop zooming using animation on + * zoom level changes and change instantly. This will stop any existing + * animations that are running. + * + * @ingroup Photocam + */ +EAPI void elm_photocam_paused_set(Evas_Object *obj, Eina_Bool paused); + +/** + * @brief Get the paused state for photocam + * + * @param obj The photocam object + * @return The current paused state + * + * This gets the current paused state for the photocam object. + * + * @see elm_photocam_paused_set() + * + * @ingroup Photocam + */ +EAPI Eina_Bool elm_photocam_paused_get(const Evas_Object *obj); + +/** + * @brief Get the internal low-res image used for photocam + * + * @param obj The photocam object + * @return The internal image object handle, or NULL if none exists + * + * This gets the internal image object inside photocam. Do not modify it. It + * is for inspection only, and hooking callbacks to. Nothing else. It may be + * deleted at any time as well. + * + * @ingroup Photocam + */ +EAPI Evas_Object *elm_photocam_internal_image_get(const Evas_Object *obj); + +/** + * @brief Set the photocam scrolling bouncing. + * + * @param obj The photocam object + * @param h_bounce set this to @c EINA_TRUE for horizontal bouncing + * @param v_bounce set this to @c EINA_TRUE for vertical bouncing + * + * @ingroup Photocam + */ +EAPI void elm_photocam_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce); + +/** + * @brief Get the photocam scrolling bouncing. + * + * @param obj The photocam object + * @param h_bounce horizontal bouncing + * @param v_bounce vertical bouncing + * + * @see elm_photocam_bounce_set() + * + * @ingroup Photocam + */ +EAPI void elm_photocam_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce); + +/** + * @brief Set the gesture state for photocam. + * + * @param obj The photocam object + * @param gesture The gesture state to set + * + * This sets the gesture state to on(EINA_TRUE) or off (EINA_FALSE) for + * photocam. The default is off. This will start multi touch zooming. + * + * @ingroup Photocam + */ +EAPI void elm_photocam_gesture_enabled_set(Evas_Object *obj, Eina_Bool gesture); + +/** + * @brief Get the gesture state for photocam. + * + * @param obj The photocam object + * @return The current gesture state + * + * This gets the current gesture state for the photocam object. + * + * @see elm_photocam_gesture_enabled_set() + * + * @ingroup Photocam + */ +EAPI Eina_Bool elm_photocam_gesture_enabled_get(const Evas_Object *obj); +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_plug.c b/libraries/elementary/src/lib/elm_plug.c new file mode 100644 index 0000000..bf9db91 --- /dev/null +++ b/libraries/elementary/src/lib/elm_plug.c @@ -0,0 +1,128 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *img; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); + +static const char SIG_CLICKED[] = "clicked"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CLICKED, ""}, + {NULL, NULL} +}; + + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + free(wd); +} + +static void +_del_pre_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + evas_object_del(wd->img); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + _sizing_eval(obj); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; + + if (!wd) return; + //TODO: get socket object size + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, maxw, maxh); +} + +static void +_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_CLICKED, NULL); +} + + +EAPI Evas_Object * +elm_plug_image_object_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (!wd->img) return NULL; + return wd->img; +} + +EAPI Evas_Object * +elm_plug_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + Ecore_Evas *ee; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "plug"); + elm_widget_type_set(obj, "plug"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); + + ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); + if (!ee) return NULL; + wd->img = ecore_evas_extn_plug_new(ee); + if (!wd->img) return NULL; + + evas_object_event_callback_add(wd->img, EVAS_CALLBACK_MOUSE_UP, + _mouse_up, obj); + elm_widget_resize_object_set(obj, wd->img); + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + _sizing_eval(obj); + return obj; +} + +EAPI Eina_Bool +elm_plug_connect(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys) +{ + Evas_Object *plug_img = NULL; + + plug_img = elm_plug_image_object_get(obj); + if (!plug_img) return EINA_FALSE; + + if (ecore_evas_extn_plug_connect(plug_img, svcname, svcnum, svcsys)) + return EINA_TRUE; + else + return EINA_FALSE; +} + diff --git a/libraries/elementary/src/lib/elm_plug.h b/libraries/elementary/src/lib/elm_plug.h new file mode 100644 index 0000000..ed79d85 --- /dev/null +++ b/libraries/elementary/src/lib/elm_plug.h @@ -0,0 +1,57 @@ +/** + * @defgroup Plug Plug + * @ingroup Elementary + * + * An object that allows one to show an image which other process created. + * It can be used anywhere like any other elementary widget. + * + */ + +/** + * @addtogroup Plug + * @{ + */ + +/** + * Add a new plug image to the parent. + * + * @param parent The parent object + * @return The new plug image object or NULL if it cannot be created + * + * @ingroup Plug + */ +EAPI Evas_Object *elm_plug_add(Evas_Object *parent); + +/** + * Connect a plug widget to service provided by socket image. + * + * @param obj The Evas_Object where the new image object will live. + * @param svcname The service name to connect to set up by the socket. + * @param svcnum The service number to connect to (set up by socket). + * @param svcsys Boolean to set if the service is a system one or not (set up by socket). + * @return (@c EINA_TRUE = success, @c EINA_FALSE = error) + * + * @ingroup Plug + */ +EAPI Eina_Bool elm_plug_connect(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys); + +/** + * Get the basic Evas_Image object from this object (widget). + * + * @param obj The image object to get the inlined image from + * @return The inlined image object, or NULL if none exists + * + * This function allows one to get the underlying @c Evas_Object of type + * Image from this elementary widget. It can be useful to do things like get + * the pixel data, save the image to a file, etc. + * + * @note Be careful to not manipulate it, as it is under control of + * elementary. + * + * @ingroup Plug + */ +EAPI Evas_Object *elm_plug_image_object_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_priv.h b/libraries/elementary/src/lib/elm_priv.h new file mode 100644 index 0000000..f931bc0 --- /dev/null +++ b/libraries/elementary/src/lib/elm_priv.h @@ -0,0 +1,315 @@ +#ifndef ELM_PRIV_H +#define ELM_PRIV_H +#ifdef HAVE_CONFIG_H +#include "elementary_config.h" +#endif +#ifdef HAVE_ELEMENTARY_X +#include +#endif +#ifdef HAVE_ELEMENTARY_FB +#include +#endif +#ifdef HAVE_ELEMENTARY_WINCE +#include +#endif + +#include "elm_widget.h" + +#define CRITICAL(...) EINA_LOG_DOM_CRIT(_elm_log_dom, __VA_ARGS__) +#define ERR(...) EINA_LOG_DOM_ERR (_elm_log_dom, __VA_ARGS__) +#define WRN(...) EINA_LOG_DOM_WARN(_elm_log_dom, __VA_ARGS__) +#define INF(...) EINA_LOG_DOM_INFO(_elm_log_dom, __VA_ARGS__) +#define DBG(...) EINA_LOG_DOM_DBG (_elm_log_dom, __VA_ARGS__) + +#ifdef ENABLE_NLS +#include +#define E_(string) _elm_dgettext(string) +#else +#ifndef setlocale +#define setlocale(c, l) +#endif +#ifndef libintl_setlocale +#define libintl_setlocale(c, l) +#endif +#ifndef bindtextdomain +#define bindtextdomain(domain, dir) +#endif +#ifndef libintl_bindtextdomain +#define libintl_bindtextdomain(domain, dir) +#endif +#define E_(string) (string) +#endif +#define N_(string) (string) + +typedef struct _Elm_Config Elm_Config; +typedef struct _Elm_Module Elm_Module; +typedef struct _Elm_Datetime_Module_Data Elm_Datetime_Module_Data; + +struct _Elm_Theme +{ + Eina_List *overlay; + Eina_List *themes; + Eina_List *extension; + Eina_Hash *cache; + Eina_Hash *cache_data; + Elm_Theme *ref_theme; + Eina_List *referrers; + const char *theme; + int ref; +}; + +/* increment this whenever we change config enough that you need new + * defaults for elm to work. + */ +#define ELM_CONFIG_EPOCH 0x0001 +/* increment this whenever a new set of config values are added but the users + * config doesn't need to be wiped - simply new values need to be put in + */ +#define ELM_CONFIG_FILE_GENERATION 0x0003 +#define ELM_CONFIG_VERSION ((ELM_CONFIG_EPOCH << 16) | ELM_CONFIG_FILE_GENERATION) +/* NB: profile configuration files (.src) must have their + * "config_version" entry's value up-to-date with ELM_CONFIG_VERSION + * (in decimal)!! */ + +/* note: always remember to sync it with elm_config.c */ +extern const char *_elm_engines[]; + +#define ELM_SOFTWARE_X11 (_elm_engines[0]) +#define ELM_SOFTWARE_FB (_elm_engines[1]) +#define ELM_SOFTWARE_DIRECTFB (_elm_engines[2]) +#define ELM_SOFTWARE_16_X11 (_elm_engines[3]) +#define ELM_SOFTWARE_8_X11 (_elm_engines[4]) +#define ELM_XRENDER_X11 (_elm_engines[5]) +#define ELM_OPENGL_X11 (_elm_engines[6]) +#define ELM_SOFTWARE_WIN32 (_elm_engines[7]) +#define ELM_SOFTWARE_16_WINCE (_elm_engines[8]) +#define ELM_SOFTWARE_SDL (_elm_engines[9]) +#define ELM_SOFTWARE_16_SDL (_elm_engines[10]) +#define ELM_OPENGL_SDL (_elm_engines[11]) +#define ELM_BUFFER (_elm_engines[12]) +#define ELM_EWS (_elm_engines[13]) +#define ELM_OPENGL_COCOA (_elm_engines[14]) +#define ELM_SOFTWARE_PSL1GHT (_elm_engines[15]) +#define ELM_WAYLAND_SHM (_elm_engines[16]) +#define ELM_WAYLAND_EGL (_elm_engines[17]) + +#define ELM_FONT_TOKEN_STYLE ":style=" + +#define ELM_ACCESS_MODE_OFF 0 +#define ELM_ACCESS_MODE_ON 1 + +#undef MIN +#define MIN(x, y) (((x) < (y)) ? (x) : (y)) +#undef MAX +#define MAX(x, y) (((x) > (y)) ? (x) : (y)) + +struct _Elm_Config +{ + int config_version; + const char *engine; + unsigned char vsync; + unsigned char thumbscroll_enable; + int thumbscroll_threshold; + double thumbscroll_momentum_threshold; + double thumbscroll_friction; + double thumbscroll_bounce_friction; + double page_scroll_friction; + double bring_in_scroll_friction; + double zoom_friction; + unsigned char thumbscroll_bounce_enable; + double thumbscroll_border_friction; + double thumbscroll_sensitivity_friction; + double scroll_smooth_amount; + double scroll_smooth_history_weight; + double scroll_smooth_future_time; + double scroll_smooth_time_window; + double scale; + int bgpixmap; + int compositing; + Eina_List *font_dirs; + Eina_List *font_overlays; + int font_hinting; + int cache_flush_poll_interval; + unsigned char cache_flush_enable; + int image_cache; + int font_cache; + int edje_cache; + int edje_collection_cache; + int finger_size; + double fps; + const char *theme; + const char *modules; + double tooltip_delay; + unsigned char cursor_engine_only; + unsigned char focus_highlight_enable; + unsigned char focus_highlight_animate; + int toolbar_shrink_mode; + unsigned char fileselector_expand_enable; + unsigned char inwin_dialogs_enable; + int icon_size; + double longpress_timeout; + unsigned char effect_enable; + unsigned char desktop_entry; + Eina_Bool password_show_last; + double password_show_last_timeout; + Eina_Bool glayer_zoom_finger_enable; + double glayer_zoom_finger_factor; + double glayer_zoom_wheel_factor; + double glayer_zoom_distance_tolerance; + double glayer_rotate_finger_enable; + double glayer_rotate_angular_tolerance; + double glayer_line_min_length; + double glayer_line_distance_tolerance; + double glayer_line_angular_tolerance; + unsigned int glayer_flick_time_limit_ms; + double glayer_long_tap_start_timeout; + int access_mode; + Eina_Bool glayer_continues_enable; + int week_start; + int weekend_start; + int weekend_len; + int year_min; + int year_max; + Eina_List *color_palette; + + /* Not part of the EET file */ + Eina_Bool is_mirrored : 1; + Eina_Bool translate : 1; +}; + +struct _Elm_Module +{ + int version; + const char *name; + const char *as; + const char *so_path; + const char *data_dir; + const char *bin_dir; + Eina_Module *module; + void *data; + void *api; + int (*init_func)(Elm_Module *m); + int (*shutdown_func)(Elm_Module *m); + int references; +}; + +struct _Elm_Datetime_Module_Data +{ + Evas_Object *base; + void (*field_limit_get)(Evas_Object *obj, Elm_Datetime_Field_Type field_type, int *range_min, int *range_max); + const char *(*field_format_get)(Evas_Object * obj, Elm_Datetime_Field_Type field_type); +}; + +int _elm_ews_wm_init(void); +void _elm_ews_wm_shutdown(void); +void _elm_ews_wm_rescale(Elm_Theme *th, Eina_Bool use_theme); + +void _elm_win_shutdown(void); +void _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme); +void _elm_win_translate(void); + +Eina_Bool _elm_theme_object_set(Evas_Object *parent, Evas_Object *o, const char *clas, const char *group, const char *style); +Eina_Bool _elm_theme_object_icon_set(Evas_Object *parent, Evas_Object *o, const char *group, const char *style); +Eina_Bool _elm_theme_set(Elm_Theme *th, Evas_Object *o, const char *clas, const char *group, const char *style); +Eina_Bool _elm_theme_icon_set(Elm_Theme *th, Evas_Object *o, const char *group, const char *style); +Eina_Bool _elm_theme_parse(Elm_Theme *th, const char *theme); +void _elm_theme_shutdown(void); + +void _elm_module_init(void); +void _elm_module_shutdown(void); +void _elm_module_parse(const char *s); +Elm_Module *_elm_module_find_as(const char *as); +Elm_Module *_elm_module_add(const char *name, const char *as); +void _elm_module_del(Elm_Module *m); +Eina_Bool _elm_module_load(Elm_Module *m); +void _elm_module_unload(Elm_Module *m); +const void *_elm_module_symbol_get(Elm_Module *m, const char *name); + +void _elm_widget_type_clear(void); +void _elm_widget_focus_region_show(const Evas_Object *obj); +void _elm_widget_top_win_focused_set(Evas_Object *obj, Eina_Bool top_win_focused); +Eina_Bool _elm_widget_top_win_focused_get(const Evas_Object *obj); + +void _elm_unneed_ethumb(void); +void _elm_unneed_web(void); + +void _elm_rescale(void); +void _elm_widget_mirrored_reload(Evas_Object *obj); + +void _elm_config_init(void); +void _elm_config_sub_init(void); +void _elm_config_shutdown(void); +void _elm_config_sub_shutdown(void); +Eina_Bool _elm_config_save(void); +void _elm_config_reload(void); + +void _elm_recache(void); + +const char *_elm_config_current_profile_get(void); +const char *_elm_config_profile_dir_get(const char *prof, Eina_Bool is_user); +Eina_List *_elm_config_profiles_list(void); +void _elm_config_all_update(void); +void _elm_config_profile_set(const char *profile); + +void _elm_config_engine_set(const char *engine); + +Eina_List *_elm_config_font_overlays_list(void); +void _elm_config_font_overlay_set(const char *text_class, const char *font, Evas_Font_Size size); +void _elm_config_font_overlay_remove(const char *text_class); +void _elm_config_font_overlay_apply(void); +Eina_List *_elm_config_text_classes_get(void); +void _elm_config_text_classes_free(Eina_List *l); + +Elm_Font_Properties *_elm_font_properties_get(Eina_Hash **font_hash, const char *font); +Eina_Hash *_elm_font_available_hash_add(Eina_Hash *font_hash, const char *full_name); +void _elm_font_available_hash_del(Eina_Hash *hash); + +void elm_tooltip_theme(Elm_Tooltip *tt); +void elm_object_sub_tooltip_content_cb_set(Evas_Object *eventarea, Evas_Object *owner, Elm_Tooltip_Content_Cb func, const void *data, Evas_Smart_Cb del_cb); +void elm_cursor_theme(Elm_Cursor *cur); +void elm_object_sub_cursor_set(Evas_Object *eventarea, Evas_Object *owner, const char *cursor); + +void elm_menu_clone(Evas_Object *from_menu, Evas_Object *to_menu, Elm_Object_Item *parent); + +Eina_Bool _elm_dangerous_call_check(const char *call); + +Evas_Object *_elm_scroller_edje_object_get(Evas_Object *obj); + +char *_elm_util_mkup_to_text(const char *mkup); +char *_elm_util_text_to_mkup(const char *text); + +Eina_Bool _elm_video_check(Evas_Object *video); + +Eina_List *_elm_config_color_list_get(const char *palette_name); +void _elm_config_color_set(const char *palette_name, int r, int g, int b, int a); +void _elm_config_colors_free(const char *palette_name); + +extern char *_elm_appname; +extern Elm_Config *_elm_config; +extern const char *_elm_data_dir; +extern const char *_elm_lib_dir; +extern int _elm_log_dom; +extern Eina_List *_elm_win_list; +extern int _elm_win_deferred_free; +extern const char *_elm_preferred_engine; + +#ifdef ENABLE_NLS +/* Our gettext wrapper, used to disable translation of elm if the app + * is not translated. */ +static inline const char * +_elm_dgettext(const char *string) +{ + if (EINA_UNLIKELY(_elm_config->translate == EINA_FALSE)) + { + return string; + } + + return dgettext(PACKAGE, string); +} + +#endif + +/* Used by the paste handler */ +void _elm_entry_entry_paste(Evas_Object *obj, const char *entry); + +#endif diff --git a/libraries/elementary/src/lib/elm_progressbar.c b/libraries/elementary/src/lib/elm_progressbar.c new file mode 100644 index 0000000..c67c5e6 --- /dev/null +++ b/libraries/elementary/src/lib/elm_progressbar.c @@ -0,0 +1,462 @@ +#include +#include "elm_priv.h" + +#define MIN_RATIO_LVL 0.0 +#define MAX_RATIO_LVL 1.0 + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *progressbar; + Evas_Object *spacer; + Evas_Object *icon; + Evas_Coord size; + Eina_Bool horizontal : 1; + Eina_Bool inverted : 1; + Eina_Bool pulse : 1; + Eina_Bool pulse_state : 1; + const char *units; + const char *label; + double val; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); +static void _theme_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _sub_del(void *data, Evas_Object *obj, void *event_info); +static void _units_set(Evas_Object *obj); +static void _val_set(Evas_Object *obj); + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->label) eina_stringshare_del(wd->label); + if (wd->units) eina_stringshare_del(wd->units); + free(wd); +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->progressbar, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + if (wd->horizontal) + _elm_theme_object_set(obj, wd->progressbar, "progressbar", "horizontal", elm_widget_style_get(obj)); + else + _elm_theme_object_set(obj, wd->progressbar, "progressbar", "vertical", elm_widget_style_get(obj)); + + if (wd->icon) + { + edje_object_part_swallow(wd->progressbar, "elm.swallow.content", wd->icon); + edje_object_signal_emit(wd->progressbar, "elm,state,icon,visible", "elm"); + } + if (wd->label) + { + edje_object_part_text_escaped_set(wd->progressbar, "elm.text", wd->label); + edje_object_signal_emit(wd->progressbar, "elm,state,text,visible", "elm"); + } + if (wd->pulse) + edje_object_signal_emit(wd->progressbar, "elm,state,pulse", "elm"); + else + edje_object_signal_emit(wd->progressbar, "elm,state,fraction", "elm"); + if (wd->pulse_state) + edje_object_signal_emit(wd->progressbar, "elm,state,pulse,start", "elm"); + + if ((wd->units) && (!wd->pulse)) + edje_object_signal_emit(wd->progressbar, "elm,state,units,visible", "elm"); + + if (wd->horizontal) + evas_object_size_hint_min_set(wd->spacer, (double)wd->size * elm_widget_scale_get(obj) * _elm_config->scale, 1); + else + evas_object_size_hint_min_set(wd->spacer, 1, (double)wd->size * elm_widget_scale_get(obj) * _elm_config->scale); + + edje_object_part_swallow(wd->progressbar, "elm.swallow.bar", wd->spacer); + + if (wd->inverted) + edje_object_signal_emit(wd->progressbar, "elm,state,inverted,on", "elm"); + + _units_set(obj); + edje_object_message_signal_process(wd->progressbar); + edje_object_scale_set(wd->progressbar, elm_widget_scale_get(obj) * _elm_config->scale); + _val_set(obj); + _sizing_eval(obj); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1; + if (!wd) return; + edje_object_size_min_restricted_calc(wd->progressbar, &minw, &minh, minw, minh); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, -1, -1); +} + +static void +_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + if (obj != wd->icon) return; + _sizing_eval(data); +} + +static void +_sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *sub = event_info; + if (!wd) return; + if (sub == wd->icon) + { + edje_object_signal_emit(wd->progressbar, "elm,state,icon,hidden", "elm"); + evas_object_event_callback_del_full + (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj); + wd->icon = NULL; + edje_object_message_signal_process(wd->progressbar); + _sizing_eval(obj); + } +} + +static void +_val_set(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Eina_Bool rtl; + double pos; + if (!wd) return; + pos = wd->val; + rtl = elm_widget_mirrored_get(obj); + if ((!rtl && wd->inverted) || (rtl && + ((!wd->horizontal && wd->inverted) || + (wd->horizontal && !wd->inverted)))) pos = MAX_RATIO_LVL - pos; + edje_object_part_drag_value_set(wd->progressbar, "elm.cur.progressbar", pos, pos); +} + +static void +_units_set(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->units) + { + char buf[1024]; + snprintf(buf, sizeof(buf), wd->units, 100 * wd->val); + edje_object_part_text_escaped_set(wd->progressbar, "elm.text.status", buf); + } + else + edje_object_part_text_escaped_set(wd->progressbar, "elm.text.status", NULL); +} + +static void +_elm_progressbar_label_set(Evas_Object *obj, const char *item, const char *label) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (item && strcmp(item, "default")) return; + if (!wd) return; + eina_stringshare_replace(&wd->label, label); + if (label) + { + edje_object_signal_emit(wd->progressbar, "elm,state,text,visible", "elm"); + edje_object_message_signal_process(wd->progressbar); + } + else + { + edje_object_signal_emit(wd->progressbar, "elm,state,text,hidden", "elm"); + edje_object_message_signal_process(wd->progressbar); + } + edje_object_part_text_escaped_set(wd->progressbar, "elm.text", label); + _sizing_eval(obj); +} + +static const char * +_elm_progressbar_label_get(const Evas_Object *obj, const char *item) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (item && strcmp(item, "default")) return NULL; + if (!wd) return NULL; + return wd->label; +} + +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd; + if (part && strcmp(part, "icon")) return; + wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->icon == content) return; + if (wd->icon) evas_object_del(wd->icon); + wd->icon = content; + if (content) + { + elm_widget_sub_object_add(obj, content); + evas_object_event_callback_add(content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + edje_object_part_swallow(wd->progressbar, "elm.swallow.content", content); + edje_object_signal_emit(wd->progressbar, "elm,state,icon,visible", "elm"); + edje_object_message_signal_process(wd->progressbar); + } + _sizing_eval(obj); +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + if (part && strcmp(part, "icon")) return NULL; + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->icon; +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + Evas_Object *icon; + if (part && strcmp(part, "icon")) return NULL; + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (!wd->icon) return NULL; + icon = wd->icon; + elm_widget_sub_object_del(obj, wd->icon); + evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + edje_object_part_unswallow(wd->progressbar, wd->icon); + wd->icon = NULL; + return icon; +} + + +EAPI Evas_Object * +elm_progressbar_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "progressbar"); + elm_widget_type_set(obj, "progressbar"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); + elm_widget_text_set_hook_set(obj, _elm_progressbar_label_set); + elm_widget_text_get_hook_set(obj, _elm_progressbar_label_get); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); + + wd->horizontal = EINA_TRUE; + wd->inverted = EINA_FALSE; + wd->pulse = EINA_FALSE; + wd->pulse_state = EINA_FALSE; + wd->units = eina_stringshare_add("%.0f %%"); + wd->val = MIN_RATIO_LVL; + + wd->progressbar = edje_object_add(e); + _elm_theme_object_set(obj, wd->progressbar, "progressbar", "horizontal", "default"); + elm_widget_resize_object_set(obj, wd->progressbar); + + wd->spacer = evas_object_rectangle_add(e); + evas_object_color_set(wd->spacer, 0, 0, 0, 0); + evas_object_pass_events_set(wd->spacer, EINA_TRUE); + elm_widget_sub_object_add(obj, wd->spacer); + edje_object_part_swallow(wd->progressbar, "elm.swallow.bar", wd->spacer); + + evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + _units_set(obj); + _val_set(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _sizing_eval(obj); + return obj; +} + +EAPI void +elm_progressbar_pulse_set(Evas_Object *obj, Eina_Bool pulse) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + pulse = !!pulse; + if (wd->pulse == pulse) return; + wd->pulse = pulse; + _theme_hook(obj); +} + +EAPI Eina_Bool +elm_progressbar_pulse_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->pulse; +} + +EAPI void +elm_progressbar_pulse(Evas_Object *obj, Eina_Bool state) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + state = !!state; + if ((!wd->pulse) && (wd->pulse_state == state)) return; + wd->pulse_state = state; + if (wd->pulse_state) + edje_object_signal_emit(wd->progressbar, "elm,state,pulse,start", "elm"); + else + edje_object_signal_emit(wd->progressbar, "elm,state,pulse,stop", "elm"); +} + +EAPI void +elm_progressbar_value_set(Evas_Object *obj, double val) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->val == val) return; + wd->val = val; + if (wd->val < MIN_RATIO_LVL) wd->val = MIN_RATIO_LVL; + if (wd->val > MAX_RATIO_LVL) wd->val = MAX_RATIO_LVL; + _val_set(obj); + _units_set(obj); +} + +EAPI double +elm_progressbar_value_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0.0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0.0; + return wd->val; +} + +EAPI void +elm_progressbar_span_size_set(Evas_Object *obj, Evas_Coord size) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->size == size) return; + wd->size = size; + if (wd->horizontal) + evas_object_size_hint_min_set(wd->spacer, (double)wd->size * elm_widget_scale_get(obj) * _elm_config->scale, 1); + else + evas_object_size_hint_min_set(wd->spacer, 1, (double)wd->size * elm_widget_scale_get(obj) * _elm_config->scale); + edje_object_part_swallow(wd->progressbar, "elm.swallow.bar", wd->spacer); + _sizing_eval(obj); +} + +EAPI Evas_Coord +elm_progressbar_span_size_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; + return wd->size; +} + +EAPI void +elm_progressbar_unit_format_set(Evas_Object *obj, const char *units) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + eina_stringshare_replace(&wd->units, units); + if (units) + { + edje_object_signal_emit(wd->progressbar, "elm,state,units,visible", "elm"); + edje_object_message_signal_process(wd->progressbar); + } + else + { + edje_object_signal_emit(wd->progressbar, "elm,state,units,hidden", "elm"); + edje_object_message_signal_process(wd->progressbar); + } + _units_set(obj); + _sizing_eval(obj); +} + +EAPI const char * +elm_progressbar_unit_format_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->units; +} + +EAPI void +elm_progressbar_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + horizontal = !!horizontal; + if (wd->horizontal == horizontal) return; + wd->horizontal = horizontal; + _theme_hook(obj); +} + +EAPI Eina_Bool +elm_progressbar_horizontal_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->horizontal; +} + +EAPI void +elm_progressbar_inverted_set(Evas_Object *obj, Eina_Bool inverted) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + inverted = !!inverted; + if (wd->inverted == inverted) return; + wd->inverted = inverted; + if (wd->inverted) + edje_object_signal_emit(wd->progressbar, "elm,state,inverted,on", "elm"); + else + edje_object_signal_emit(wd->progressbar, "elm,state,inverted,off", "elm"); + edje_object_message_signal_process(wd->progressbar); + _val_set(obj); + _units_set(obj); +} + +EAPI Eina_Bool +elm_progressbar_inverted_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->inverted; +} diff --git a/libraries/elementary/src/lib/elm_progressbar.h b/libraries/elementary/src/lib/elm_progressbar.h new file mode 100644 index 0000000..5b08d72 --- /dev/null +++ b/libraries/elementary/src/lib/elm_progressbar.h @@ -0,0 +1,289 @@ +/** + * @defgroup Progressbar Progress bar + * @ingroup Elementary + * + * The progress bar is a widget for visually representing the + * progress status of a given job/task. + * + * A progress bar may be horizontal or vertical. It may display an + * icon besides it, as well as primary and @b units labels. The + * former is meant to label the widget as a whole, while the + * latter, which is formatted with floating point values (and thus + * accepts a printf-style format string, like "%1.2f + * units"), is meant to label the widget's progress + * value. Label, icon and unit strings/objects are @b optional + * for progress bars. + * + * A progress bar may be @b inverted, in which case it gets its + * values inverted, i.e., high values being on the left or top and + * low values on the right or bottom, for horizontal and vertical modes + * respectively. + * + * The @b span of the progress, as set by + * elm_progressbar_span_size_set(), is its length (horizontally or + * vertically), unless one puts size hints on the widget to expand + * on desired directions, by any container. That length will be + * scaled by the object or applications scaling factor. + * Applications can query the progress bar for its value with + * elm_progressbar_value_get(). + * + * Available widget styles for progress bars: + * - @c "default" + * - @c "wheel" (simple style, no text, no progression, only + * "pulse" effect is available) + * + * Default text parts of the progressbar widget that you can use for are: + * @li "default" - Label of the progressbar + * + * Default content parts of the progressbar widget that you can use for are: + * @li "icon" - An icon of the progressbar + * + * Supported elm_object common APIs. + * @li @ref elm_object_part_text_set + * @li @ref elm_object_part_text_get + * @li @ref elm_object_part_content_set + * @li @ref elm_object_part_content_get + * @li @ref elm_object_part_content_unset + * + * Here is an example on its usage: + * @li @ref progressbar_example + */ + +/** + * Add a new progress bar widget to the given parent Elementary + * (container) object + * + * @param parent The parent object + * @return a new progress bar widget handle or @c NULL, on errors + * + * This function inserts a new progress bar widget on the canvas. + * + * @ingroup Progressbar + */ +EAPI Evas_Object *elm_progressbar_add(Evas_Object *parent); + +/** + * Set whether a given progress bar widget is at "pulsing mode" or + * not. + * + * @param obj The progress bar object + * @param pulse @c EINA_TRUE to put @p obj in pulsing mode, + * @c EINA_FALSE to put it back to its default one + * + * By default, progress bars will display values from the low to + * high value boundaries. There are, though, contexts in which the + * progress of a given task is @b unknown. For such cases, + * one can set a progress bar widget to a "pulsing state", to give + * the user an idea that some computation is being held, but + * without exact progress values. In the default theme, it will + * animate its bar with the contents filling in constantly and back + * to non-filled, in a loop. To start and stop this pulsing + * animation, one has to explicitly call elm_progressbar_pulse(). + * + * @see elm_progressbar_pulse_get() + * @see elm_progressbar_pulse() + * + * @ingroup Progressbar + */ +EAPI void elm_progressbar_pulse_set(Evas_Object *obj, Eina_Bool pulse); + +/** + * Get whether a given progress bar widget is at "pulsing mode" or + * not. + * + * @param obj The progress bar object + * @return @c EINA_TRUE, if @p obj is in pulsing mode, @c EINA_FALSE + * if it's in the default one (and on errors) + * + * @ingroup Progressbar + */ +EAPI Eina_Bool elm_progressbar_pulse_get(const Evas_Object *obj); + +/** + * Start/stop a given progress bar "pulsing" animation, if its + * under that mode + * + * @param obj The progress bar object + * @param state @c EINA_TRUE, to @b start the pulsing animation, + * @c EINA_FALSE to @b stop it + * + * @note This call won't do anything if @p obj is not under "pulsing mode". + * + * @see elm_progressbar_pulse_set() for more details. + * + * @ingroup Progressbar + */ +EAPI void elm_progressbar_pulse(Evas_Object *obj, Eina_Bool state); + +/** + * Set the progress value (in percentage) on a given progress bar + * widget + * + * @param obj The progress bar object + * @param val The progress value (@b must be between @c 0.0 and @c + * 1.0) + * + * Use this call to set progress bar levels. + * + * @note If you passes a value out of the specified range for @p + * val, it will be interpreted as the @b closest of the @b boundary + * values in the range. + * + * @ingroup Progressbar + */ +EAPI void elm_progressbar_value_set(Evas_Object *obj, double val); + +/** + * Get the progress value (in percentage) on a given progress bar + * widget + * + * @param obj The progress bar object + * @return The value of the progressbar + * + * @see elm_progressbar_value_set() for more details + * + * @ingroup Progressbar + */ +EAPI double elm_progressbar_value_get(const Evas_Object *obj); + +/** + * Set the (exact) length of the bar region of a given progress bar + * widget + * + * @param obj The progress bar object + * @param size The length of the progress bar's bar region + * + * This sets the minimum width (when in horizontal mode) or height + * (when in vertical mode) of the actual bar area of the progress + * bar @p obj. This in turn affects the object's minimum size. Use + * this when you're not setting other size hints expanding on the + * given direction (like weight and alignment hints) and you would + * like it to have a specific size. + * + * @note Icon, label and unit text around @p obj will require their + * own space, which will make @p obj to require more the @p size, + * actually. + * + * @see elm_progressbar_span_size_get() + * + * @ingroup Progressbar + */ +EAPI void elm_progressbar_span_size_set(Evas_Object *obj, Evas_Coord size); + +/** + * Get the length set for the bar region of a given progress bar + * widget + * + * @param obj The progress bar object + * @return The length of the progress bar's bar region + * + * If that size was not set previously, with + * elm_progressbar_span_size_set(), this call will return @c 0. + * + * @ingroup Progressbar + */ +EAPI Evas_Coord elm_progressbar_span_size_get(const Evas_Object *obj); + +/** + * Set the format string for a given progress bar widget's units + * label + * + * @param obj The progress bar object + * @param format The format string for @p obj's units label + * + * If @c NULL is passed on @p format, it will make @p obj's units + * area to be hidden completely. If not, it'll set the format + * string for the units label's @b text. The units label is + * provided a floating point value, so the units text is up display + * at most one floating point value. Note that the units label is + * optional. Use a format string such as "%1.2f meters" for + * example. + * + * @note The default format string for a progress bar is an integer + * percentage, as in @c "%.0f %%". + * + * @see elm_progressbar_unit_format_get() + * + * @ingroup Progressbar + */ +EAPI void elm_progressbar_unit_format_set(Evas_Object *obj, const char *format); + +/** + * Retrieve the format string set for a given progress bar widget's + * units label + * + * @param obj The progress bar object + * @return The format set string for @p obj's units label or + * @c NULL, if none was set (and on errors) + * + * @see elm_progressbar_unit_format_set() for more details + * + * @ingroup Progressbar + */ +EAPI const char *elm_progressbar_unit_format_get(const Evas_Object *obj); + +/** + * Set the orientation of a given progress bar widget + * + * @param obj The progress bar object + * @param horizontal Use @c EINA_TRUE to make @p obj to be + * @b horizontal, @c EINA_FALSE to make it @b vertical + * + * Use this function to change how your progress bar is to be + * disposed: vertically or horizontally. + * + * @see elm_progressbar_horizontal_get() + * + * @ingroup Progressbar + */ +EAPI void elm_progressbar_horizontal_set(Evas_Object *obj, Eina_Bool horizontal); + +/** + * Retrieve the orientation of a given progress bar widget + * + * @param obj The progress bar object + * @return @c EINA_TRUE, if @p obj is set to be @b horizontal, + * @c EINA_FALSE if it's @b vertical (and on errors) + * + * @see elm_progressbar_horizontal_set() for more details + * + * @ingroup Progressbar + */ +EAPI Eina_Bool elm_progressbar_horizontal_get(const Evas_Object *obj); + +/** + * Invert a given progress bar widget's displaying values order + * + * @param obj The progress bar object + * @param inverted Use @c EINA_TRUE to make @p obj inverted, + * @c EINA_FALSE to bring it back to default, non-inverted values. + * + * A progress bar may be @b inverted, in which state it gets its + * values inverted, with high values being on the left or top and + * low values on the right or bottom, as opposed to normally have + * the low values on the former and high values on the latter, + * respectively, for horizontal and vertical modes. + * + * @see elm_progressbar_inverted_get() + * + * @ingroup Progressbar + */ +EAPI void elm_progressbar_inverted_set(Evas_Object *obj, Eina_Bool inverted); + +/** + * Get whether a given progress bar widget's displaying values are + * inverted or not + * + * @param obj The progress bar object + * @return @c EINA_TRUE, if @p obj has inverted values, + * @c EINA_FALSE otherwise (and on errors) + * + * @see elm_progressbar_inverted_set() for more details + * + * @ingroup Progressbar + */ +EAPI Eina_Bool elm_progressbar_inverted_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_radio.c b/libraries/elementary/src/lib/elm_radio.c new file mode 100644 index 0000000..0f6c0f6 --- /dev/null +++ b/libraries/elementary/src/lib/elm_radio.c @@ -0,0 +1,520 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; +typedef struct _Group Group; + +struct _Group +{ + int value; + int *valuep; + Eina_List *radios; +}; + +struct _Widget_Data +{ + Evas_Object *radio; + Evas_Object *icon; + int value; + const char *label; + Eina_Bool state; + Group *group; +}; + +static const char *widtype = NULL; +static void _state_set(Evas_Object *obj, Eina_Bool state); +static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); +static void _theme_hook(Evas_Object *obj); +static void _disable_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _sub_del(void *data, Evas_Object *obj, void *event_info); +static void _signal_radio_on(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _on_focus_hook(void *data, Evas_Object *obj); +static void _activate(Evas_Object *obj); +static void _activate_hook(Evas_Object *obj); +static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src, + Evas_Callback_Type type, void *event_info); + +static const char SIG_CHANGED[] = "changed"; +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CHANGED, ""}, + {NULL, NULL} +}; + +static Eina_Bool +_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info) +{ + if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE; + Evas_Event_Key_Down *ev = event_info; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; + if (elm_widget_disabled_get(obj)) return EINA_FALSE; + + if ((strcmp(ev->keyname, "Return")) && + (strcmp(ev->keyname, "KP_Enter")) && + (strcmp(ev->keyname, "space"))) + return EINA_FALSE; + _activate(obj); + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; +} + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->label) eina_stringshare_del(wd->label); + wd->group->radios = eina_list_remove(wd->group->radios, obj); + if (!wd->group->radios) free(wd->group); + wd->group = NULL; + free(wd); +} + +static void +_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (elm_widget_focus_get(obj)) + { + edje_object_signal_emit(wd->radio, "elm,action,focus", "elm"); + evas_object_focus_set(wd->radio, EINA_TRUE); + } + else + { + edje_object_signal_emit(wd->radio, "elm,action,unfocus", "elm"); + evas_object_focus_set(wd->radio, EINA_FALSE); + } +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->radio, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _elm_theme_object_set(obj, wd->radio, "radio", "base", elm_widget_style_get(obj)); + if (wd->icon) + edje_object_signal_emit(wd->radio, "elm,state,icon,visible", "elm"); + else + edje_object_signal_emit(wd->radio, "elm,state,icon,hidden", "elm"); + if (wd->state) + edje_object_signal_emit(wd->radio, "elm,state,radio,on", "elm"); + else + edje_object_signal_emit(wd->radio, "elm,state,radio,off", "elm"); + if (wd->label) + edje_object_signal_emit(wd->radio, "elm,state,text,visible", "elm"); + else + edje_object_signal_emit(wd->radio, "elm,state,text,hidden", "elm"); + edje_object_part_text_escaped_set(wd->radio, "elm.text", wd->label); + if (elm_widget_disabled_get(obj)) + { + edje_object_signal_emit(wd->radio, "elm,state,disabled", "elm"); + if (wd->state) _state_set(obj, 0); + } + edje_object_message_signal_process(wd->radio); + edje_object_scale_set(wd->radio, elm_widget_scale_get(obj) * _elm_config->scale); + _sizing_eval(obj); +} + +static void +_disable_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (elm_widget_disabled_get(obj)) + { + edje_object_signal_emit(wd->radio, "elm,state,disabled", "elm"); + if (wd->state) _state_set(obj, 0); + } + else + edje_object_signal_emit(wd->radio, "elm,state,enabled", "elm"); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1; + if (!wd) return; + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + edje_object_size_min_restricted_calc(wd->radio, &minw, &minh, minw, minh); + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, -1, -1); +} + +static void +_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + if (obj != wd->icon) return; + _sizing_eval(data); +} + +static void +_sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *sub = event_info; + if (!wd) return; + if (sub == wd->icon) + { + edje_object_signal_emit(wd->radio, "elm,state,icon,hidden", "elm"); + evas_object_event_callback_del_full + (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj); + wd->icon = NULL; + _sizing_eval(obj); + } +} + +static void +_state_set(Evas_Object *obj, Eina_Bool state) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if ((state != wd->state) && (!elm_widget_disabled_get(obj))) + { + wd->state = state; + if (wd->state) + edje_object_signal_emit(wd->radio, "elm,state,radio,on", "elm"); + else + edje_object_signal_emit(wd->radio, "elm,state,radio,off", "elm"); + } +} + +static void +_state_set_all(Widget_Data *wd) +{ + const Eina_List *l; + Evas_Object *child, *selected = NULL; + Eina_Bool disabled = EINA_FALSE; + EINA_LIST_FOREACH(wd->group->radios, l, child) + { + Widget_Data *wd2 = elm_widget_data_get(child); + if (wd2->state) selected = child; + if (wd2->value == wd->group->value) + { + _state_set(child, 1); + if (!wd2->state) disabled = EINA_TRUE; + } + else _state_set(child, 0); + } + if ((disabled) && (selected)) _state_set(selected, 1); +} + +static void +_activate(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->group->value == wd->value) return; + if ((_elm_config->access_mode == ELM_ACCESS_MODE_OFF) || + (_elm_access_2nd_click_timeout(obj))) + { + wd->group->value = wd->value; + if (wd->group->valuep) *(wd->group->valuep) = wd->group->value; + _state_set_all(wd); + if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF) + _elm_access_say(E_("State: On")); + evas_object_smart_callback_call(obj, SIG_CHANGED, NULL); + } +} + +static void +_activate_hook(Evas_Object *obj) +{ + _activate(obj); +} + +static void +_signal_radio_on(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + _activate(data); +} + +static void +_elm_radio_label_set(Evas_Object *obj, const char *item, const char *label) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (item && strcmp(item, "default")) return; + if (!wd) return; + eina_stringshare_replace(&wd->label, label); + if (label) + { + edje_object_signal_emit(wd->radio, "elm,state,text,visible", "elm"); + edje_object_message_signal_process(wd->radio); + } + else + { + edje_object_signal_emit(wd->radio, "elm,state,text,hidden", "elm"); + edje_object_message_signal_process(wd->radio); + } + edje_object_part_text_escaped_set(wd->radio, "elm.text", label); + _sizing_eval(obj); +} + +static const char * +_elm_radio_label_get(const Evas_Object *obj, const char *item) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (item && strcmp(item, "default")) return NULL; + if (!wd) return NULL; + return wd->label; +} + +static char * +_access_info_cb(void *data __UNUSED__, Evas_Object *obj, Elm_Widget_Item *item __UNUSED__) +{ + const char *txt = elm_widget_access_info_get(obj); + if (!txt) txt = _elm_radio_label_get(obj, NULL); + if (txt) return strdup(txt); + return NULL; +} + +static char * +_access_state_cb(void *data __UNUSED__, Evas_Object *obj, Elm_Widget_Item *item __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (elm_widget_disabled_get(obj)) + return strdup(E_("State: Disabled")); + if (wd->state) + return strdup(E_("State: On")); + return strdup(E_("State: Off")); +} + +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd; + + if (part && strcmp(part, "icon")) return; + wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->icon == content) return; + if (wd->icon) evas_object_del(wd->icon); + wd->icon = content; + if (content) + { + elm_widget_sub_object_add(obj, content); + evas_object_event_callback_add(content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + edje_object_part_swallow(wd->radio, "elm.swallow.content", content); + edje_object_signal_emit(wd->radio, "elm,state,icon,visible", "elm"); + edje_object_message_signal_process(wd->radio); + } + _sizing_eval(obj); +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + + if (part && strcmp(part, "icon")) return NULL; + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->icon; +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + Evas_Object *icon; + if (part && strcmp(part, "icon")) return NULL; + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (!wd->icon) return NULL; + icon = wd->icon; + elm_widget_sub_object_del(obj, wd->icon); + evas_object_event_callback_del_full(wd->icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + edje_object_part_unswallow(wd->radio, wd->icon); + wd->icon = NULL; + return icon; +} + +EAPI Evas_Object * +elm_radio_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "radio"); + elm_widget_type_set(obj, "radio"); + elm_widget_sub_object_add(parent, obj); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_disable_hook_set(obj, _disable_hook); + elm_widget_can_focus_set(obj, EINA_TRUE); + elm_widget_activate_hook_set(obj, _activate_hook); + elm_widget_event_hook_set(obj, _event_hook); + elm_widget_text_set_hook_set(obj, _elm_radio_label_set); + elm_widget_text_get_hook_set(obj, _elm_radio_label_get); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); + + wd->radio = edje_object_add(e); + _elm_theme_object_set(obj, wd->radio, "radio", "base", "default"); + edje_object_signal_callback_add(wd->radio, "elm,action,radio,on", "", _signal_radio_on, obj); + edje_object_signal_callback_add(wd->radio, "elm,action,radio,toggle", "", _signal_radio_on, obj); + elm_widget_resize_object_set(obj, wd->radio); + + evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + + wd->group = calloc(1, sizeof(Group)); + wd->group->radios = eina_list_append(wd->group->radios, obj); + wd->state = 0; + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _sizing_eval(obj); + + // TODO: convert Elementary to subclassing of Evas_Smart_Class + // TODO: and save some bytes, making descriptions per-class and not instance! + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + _elm_access_object_register(obj, wd->radio); + _elm_access_text_set(_elm_access_object_get(obj), + ELM_ACCESS_TYPE, E_("Radio")); + _elm_access_callback_set(_elm_access_object_get(obj), + ELM_ACCESS_INFO, _access_info_cb, obj); + _elm_access_callback_set(_elm_access_object_get(obj), + ELM_ACCESS_STATE, _access_state_cb, obj); + + return obj; +} + +EAPI void +elm_radio_group_add(Evas_Object *obj, Evas_Object *group) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + Widget_Data *wd2 = elm_widget_data_get(group); + if (!wd) return; + if (!wd2) + { + if (eina_list_count(wd->group->radios) == 1) + return; + wd->group->radios = eina_list_remove(wd->group->radios, obj); + wd->group = calloc(1, sizeof(Group)); + wd->group->radios = eina_list_append(wd->group->radios, obj); + } + else if (wd->group == wd2->group) return; + else + { + wd->group->radios = eina_list_remove(wd->group->radios, obj); + if (!wd->group->radios) free(wd->group); + wd->group = wd2->group; + wd->group->radios = eina_list_append(wd->group->radios, obj); + } + if (wd->value == wd->group->value) _state_set(obj, 1); + else _state_set(obj, 0); +} + +EAPI void +elm_radio_state_value_set(Evas_Object *obj, int value) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->value = value; + if (wd->value == wd->group->value) _state_set(obj, 1); + else _state_set(obj, 0); +} + +EAPI int +elm_radio_state_value_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; + return wd->value; +} + +EAPI void +elm_radio_value_set(Evas_Object *obj, int value) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (value == wd->group->value) return; + wd->group->value = value; + if (wd->group->valuep) *(wd->group->valuep) = wd->group->value; + _state_set_all(wd); +} + +EAPI int +elm_radio_value_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; + return wd->group->value; +} + +EAPI void +elm_radio_value_pointer_set(Evas_Object *obj, int *valuep) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (valuep) + { + wd->group->valuep = valuep; + if (*(wd->group->valuep) != wd->group->value) + { + wd->group->value = *(wd->group->valuep); + _state_set_all(wd); + } + } + else + { + wd->group->valuep = NULL; + } +} + +EAPI Evas_Object * +elm_radio_selected_object_get(Evas_Object *obj) +{ + Eina_List *l; + Evas_Object *child; + Widget_Data *wd2; + + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + EINA_LIST_FOREACH(wd->group->radios, l, child) + { + wd2 = elm_widget_data_get(child); + if (wd2->value == wd->group->value) + return child; + } + return NULL; +} diff --git a/libraries/elementary/src/lib/elm_radio.h b/libraries/elementary/src/lib/elm_radio.h new file mode 100644 index 0000000..388e720 --- /dev/null +++ b/libraries/elementary/src/lib/elm_radio.h @@ -0,0 +1,159 @@ +/** + * @defgroup Radio Radio + * @ingroup Elementary + * + * @image html img/widget/radio/preview-00.png + * @image latex img/widget/radio/preview-00.eps + * + * @brief Radio is a widget that allows for 1 or more options to be displayed + * and have the user choose only 1 of them. + * + * A radio object contains an indicator, an optional Label and an optional + * icon object. While it's possible to have a group of only one radio they, + * are normally used in groups of 2 or more. + * + * elm_radio objects are grouped in a slightly different, compared to other + * UI toolkits. There is no seperate group name/id to remember or manage. + * The members represent the group, there are the group. To make a group, + * use elm_radio_group_add() and pass existing radio object and the new radio + * object. + * + * The radio object(s) will select from one of a set + * of integer values, so any value they are configuring needs to be mapped to + * a set of integers. To configure what value that radio object represents, + * use elm_radio_state_value_set() to set the integer it represents. To set + * the value the whole group(which one is currently selected) is to indicate + * use elm_radio_value_set() on any group member, and to get the groups value + * use elm_radio_value_get(). For convenience the radio objects are also able + * to directly set an integer(int) to the value that is selected. To specify + * the pointer to this integer to modify, use elm_radio_value_pointer_set(). + * The radio objects will modify this directly. That implies the pointer must + * point to valid memory for as long as the radio objects exist. + * + * Signals that you can add callbacks for are: + * @li changed - This is called whenever the user changes the state of one of + * the radio objects within the group of radio objects that work together. + * + * Default text parts of the radio widget that you can use for are: + * @li "default" - Label of the radio + * + * Default content parts of the radio widget that you can use for are: + * @li "icon" - An icon of the radio + * + * Supported elm_object common APIs. + * @li @ref elm_object_part_text_set + * @li @ref elm_object_part_text_get + * @li @ref elm_object_part_content_set + * @li @ref elm_object_part_content_get + * @li @ref elm_object_part_content_unset + * @li @ref elm_object_disabled_set + * @li @ref elm_object_disabled_get + * + * @ref tutorial_radio show most of this API in action. + * @{ + */ + +/** + * @brief Add a new radio to the parent + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * @ingroup Radio + */ +EAPI Evas_Object *elm_radio_add(Evas_Object *parent); + +/** + * @brief Add this radio to a group of other radio objects + * + * @param obj The radio object + * @param group Any object whose group the @p obj is to join. + * + * Radio objects work in groups. Each member should have a different integer + * value assigned. In order to have them work as a group, they need to know + * about each other. This adds the given radio object to the group of which + * the group object indicated is a member. + * + * @ingroup Radio + */ +EAPI void elm_radio_group_add(Evas_Object *obj, Evas_Object *group); + +/** + * @brief Set the integer value that this radio object represents + * + * @param obj The radio object + * @param value The value to use if this radio object is selected + * + * This sets the value of the radio. + * + * @ingroup Radio + */ +EAPI void elm_radio_state_value_set(Evas_Object *obj, int value); + +/** + * @brief Get the integer value that this radio object represents + * + * @param obj The radio object + * @return The value used if this radio object is selected + * + * This gets the value of the radio. + * @see elm_radio_value_set() + * + * @ingroup Radio + */ +EAPI int elm_radio_state_value_get(const Evas_Object *obj); + +/** + * @brief Set the value of the radio group. + * + * @param obj The radio object (any radio object of the group). + * @param value The value to use for the group + * + * This sets the value of the radio group and will also set the value if + * pointed to, to the value supplied, but will not call any callbacks. + * + * @ingroup Radio + */ +EAPI void elm_radio_value_set(Evas_Object *obj, int value); + +/** + * @brief Get the value of the radio group + * + * @param obj The radio object (any radio object of the group). + * @return The integer state + * + * @ingroup Radio + */ +EAPI int elm_radio_value_get(const Evas_Object *obj); + +/** + * @brief Set a convenience pointer to a integer to change when radio group + * value changes. + * + * @param obj The radio object (any object of a group) + * @param valuep Pointer to the integer to modify + * + * This sets a pointer to a integer, that, in addition to the radio objects + * state will also be modified directly. To stop setting the object pointed + * to simply use NULL as the @p valuep argument. If valuep is not NULL, then + * when this is called, the radio objects state will also be modified to + * reflect the value of the integer valuep points to, just like calling + * elm_radio_value_set(). + * + * @ingroup Radio + */ +EAPI void elm_radio_value_pointer_set(Evas_Object *obj, int *valuep); + +/** + * @brief Get the selected radio object. + * + * @param obj Any radio object (any object of a group) + * @return The selected radio object + * + * @ingroup Radio + */ +EAPI Evas_Object *elm_radio_selected_object_get(Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_route.c b/libraries/elementary/src/lib/elm_route.c new file mode 100644 index 0000000..cae5074 --- /dev/null +++ b/libraries/elementary/src/lib/elm_route.c @@ -0,0 +1,286 @@ +#include +#include "elm_priv.h" + +/** + * @defgroup Route MapRoute + * + * For displaying a route on the map widget + * + */ + +typedef struct _Widget_Data Widget_Data; +typedef struct Segment Segment; + +struct _Widget_Data +{ + Evas_Object *obj; +#ifdef ELM_EMAP + EMap_Route *emap; +#endif + + double lon_min, lon_max; + double lat_min, lat_max; + + Eina_List *segments; //list of *Segment + + Eina_Bool must_calc_segments :1; +}; + +struct Segment +{ + Evas_Object *obj; + +#ifdef ELM_EMAP + EMap_Route_Node *node_start; + EMap_Route_Node *node_end; +#endif + + double start_x, start_y; + double end_x, end_y; + + Eina_Bool must_calc :1; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); +static void _theme_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _clear_route(Evas_Object *obj); +#ifdef ELM_EMAP +static void _update_lon_lat_min_max(Evas_Object *obj, double lon, double lat); +#endif + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + _clear_route(obj); + + free(wd); +} + +static void +_resize_cb(void *data __UNUSED__ , Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + _sizing_eval(obj); +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + //TODO + _sizing_eval(obj); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Eina_List *l; + Segment *segment; + Evas_Coord x, y, w, h; + Evas_Coord start_x, start_y, end_x, end_y; + + Widget_Data *wd = elm_widget_data_get(obj); + evas_object_geometry_get(obj, &x, &y, &w, &h); + + EINA_LIST_FOREACH(wd->segments, l, segment) + { + if (wd->must_calc_segments || segment->must_calc) + { + +#ifdef ELM_EMAP + segment->start_x = (emap_route_node_lon_get(segment->node_start)- wd->lon_min) / (float)(wd->lon_max - wd->lon_min); + segment->start_y = 1 - (emap_route_node_lat_get(segment->node_start) - wd->lat_min) / (float)(wd->lat_max - wd->lat_min); + segment->end_x = (emap_route_node_lon_get(segment->node_end) - wd->lon_min) / (float)(wd->lon_max - wd->lon_min); + segment->end_y = 1 - (emap_route_node_lat_get(segment->node_end) - wd->lat_min) / (float)(wd->lat_max - wd->lat_min); +#endif + segment->must_calc = EINA_FALSE; + } + + start_x = x+(int)(segment->start_x*w); + start_y = y+(int)(segment->start_y*h); + end_x = x+(int)(segment->end_x*w); + end_y = y+(int)(segment->end_y*h); + evas_object_line_xy_set(segment->obj, start_x, start_y, end_x, end_y); + } + + wd->must_calc_segments = EINA_FALSE; +} + +static void +_clear_route(Evas_Object *obj) +{ + Segment *segment; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + +#ifdef ELM_EMAP + wd->lon_min = EMAP_LON_MAX; + wd->lon_max = EMAP_LON_MIN; + wd->lat_min = EMAP_LAT_MAX; + wd->lat_max = EMAP_LAT_MIN; +#endif + + EINA_LIST_FREE(wd->segments, segment) + { + evas_object_del(segment->obj); + free(segment); + } +} + +#ifdef ELM_EMAP +static void +_update_lon_lat_min_max(Evas_Object *obj, double lon, double lat) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (wd->lon_min > lon) + { + wd->lon_min = lon; + wd->must_calc_segments = EINA_TRUE; + } + if (wd->lat_min > lat) + { + wd->lat_min = lat; + wd->must_calc_segments = EINA_TRUE; + } + + if (wd->lon_max < lon) + { + wd->lon_max = lon; + wd->must_calc_segments = EINA_TRUE; + } + if (wd->lat_max < lat) + { + wd->lat_max = lat; + wd->must_calc_segments = EINA_TRUE; + } +} +#endif + +/** + * Add a new route to the parent + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * @ingroup Route + */ +EAPI Evas_Object * +elm_route_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "map_route"); + elm_widget_type_set(obj, "map_route"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); + + evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, + _resize_cb, obj); + evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, + _resize_cb, obj); + +#ifdef ELM_EMAP + wd->lon_min = EMAP_LON_MAX; + wd->lon_max = EMAP_LON_MIN; + wd->lat_min = EMAP_LAT_MAX; + wd->lat_max = EMAP_LAT_MIN; +#endif + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _sizing_eval(obj); + return obj; +} + +#ifdef ELM_EMAP +/** + * Set the emap object which describes the route + * + * @param obj The photo object + * @param emap the route + * + * @return (1 = success, 0 = error) + * + * @ingroup Route + */ +EAPI void +elm_route_emap_set(Evas_Object *obj, EMap_Route *emap) +{ + EMap_Route_Node *node, *node_prev = NULL; + Evas_Object *o; + Eina_List *l; + + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + wd->emap = emap; + + _clear_route(obj); + + EINA_LIST_FOREACH(emap_route_nodes_get(wd->emap), l, node) + { + if (node_prev) + { + Segment *segment = calloc(1, sizeof(Segment)); + segment->node_start = node_prev; + segment->node_end = node; + + o = evas_object_line_add(evas_object_evas_get(obj)); + segment->obj = o; + evas_object_smart_member_add(o, obj); + + segment->must_calc = EINA_TRUE; + + _update_lon_lat_min_max(obj, emap_route_node_lon_get(node_prev), emap_route_node_lat_get(node_prev)); + _update_lon_lat_min_max(obj, emap_route_node_lon_get(node), emap_route_node_lat_get(node)); + + wd->segments = eina_list_append(wd->segments, segment); + } + node_prev = node; + } + + _sizing_eval(obj); +} +#endif + +EAPI void +elm_route_longitude_min_max_get(const Evas_Object *obj, double *min, double *max) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (min) *min = wd->lon_min; + if (max) *max = wd->lon_max; +} + +EAPI void +elm_route_latitude_min_max_get(const Evas_Object *obj, double *min, double *max) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (min) *min = wd->lat_min; + if (max) *max = wd->lat_max; +} +/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-3f0^-2{2(0W1st0 :*/ diff --git a/libraries/elementary/src/lib/elm_route.h b/libraries/elementary/src/lib/elm_route.h new file mode 100644 index 0000000..5f5f446 --- /dev/null +++ b/libraries/elementary/src/lib/elm_route.h @@ -0,0 +1,54 @@ +/** + * @defgroup Route Route + * @ingroup Elementary + * + * For displaying a route on the map widget. + * + * @{ + */ + +/** + * Add a new route object to the parent's canvas + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * @ingroup Route + */ +EAPI Evas_Object *elm_route_add(Evas_Object *parent); + +#ifdef ELM_EMAP +EAPI void elm_route_emap_set(Evas_Object *obj, EMap_Route *emap); +#endif + +/** + * Get the minimum and maximum values along the longitude. + * + * @param obj The route object. + * @param min Pointer to store the minimum value. + * @param max Pointer to store the maximum value. + * + * @note If only one value is needed, the other pointer can be passed + * as @c NULL. + * + * @ingroup Route + */ +EAPI void elm_route_longitude_min_max_get(const Evas_Object *obj, double *min, double *max); + +/** + * Get the minimum and maximum values along the latitude. + * + * @param obj The route object. + * @param min Pointer to store the minimum value. + * @param max Pointer to store the maximum value. + * + * @note If only one value is needed, the other pointer can be passed + * as @c NULL. + * + * @ingroup Route + */ +EAPI void elm_route_latitude_min_max_get(const Evas_Object *obj, double *min, double *max); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_scale.h b/libraries/elementary/src/lib/elm_scale.h new file mode 100644 index 0000000..4332e73 --- /dev/null +++ b/libraries/elementary/src/lib/elm_scale.h @@ -0,0 +1,36 @@ +/** + * @defgroup Scaling Widget Scaling + * @ingroup Elementary + * + * Different widgets can be scaled independently. These functions + * allow you to manipulate this scaling on a per-widget basis. The + * object and all its children get their scaling factors multiplied + * by the scale factor set. This is multiplicative, in that if a + * child also has a scale size set it is in turn multiplied by its + * parent's scale size. @c 1.0 means “don't scale”, @c 2.0 is + * double size, @c 0.5 is half, etc. + * + * @ref general_functions_example_page "This" example contemplates + * some of these functions. + */ + +/** + * Set the scaling factor for a given Elementary object + * + * @param obj The Elementary to operate on + * @param scale Scale factor (from @c 0.0 up, with @c 1.0 meaning + * no scaling) + * + * @ingroup Scaling + */ +EAPI void elm_object_scale_set(Evas_Object *obj, double scale); + +/** + * Get the scaling factor for a given Elementary object + * + * @param obj The object + * @return The scaling factor set by elm_object_scale_set() + * + * @ingroup Scaling + */ +EAPI double elm_object_scale_get(const Evas_Object *obj); diff --git a/libraries/elementary/src/lib/elm_scroll.h b/libraries/elementary/src/lib/elm_scroll.h new file mode 100644 index 0000000..51a2d4f --- /dev/null +++ b/libraries/elementary/src/lib/elm_scroll.h @@ -0,0 +1,114 @@ +/** + * @defgroup Scrollhints Scrollhints + * @ingroup Elementary + * + * Objects when inside a scroller can scroll, but this may not always be + * desirable in certain situations. This allows an object to hint to itself + * and parents to "not scroll" in one of 2 ways. If any child object of a + * scroller has pushed a scroll freeze or hold then it affects all parent + * scrollers until all children have released them. + * + * 1. To hold on scrolling. This means just flicking and dragging may no + * longer scroll, but pressing/dragging near an edge of the scroller will + * still scroll. This is automatically used by the entry object when + * selecting text. + * + * 2. To totally freeze scrolling. This means it stops. until + * popped/released. + * + * @{ + */ + +/** + * Push the scroll hold by 1 + * + * This increments the scroll hold count by one. If it is more than 0 it will + * take effect on the parents of the indicated object. + * + * @param obj The object + * @ingroup Scrollhints + */ +EAPI void elm_object_scroll_hold_push(Evas_Object *obj); + +/** + * Pop the scroll hold by 1 + * + * This decrements the scroll hold count by one. If it is more than 0 it will + * take effect on the parents of the indicated object. + * + * @param obj The object + * @ingroup Scrollhints + */ +EAPI void elm_object_scroll_hold_pop(Evas_Object *obj); + +/** + * Push the scroll freeze by 1 + * + * This increments the scroll freeze count by one. If it is more + * than 0 it will take effect on the parents of the indicated + * object. + * + * @param obj The object + * @ingroup Scrollhints + */ +EAPI void elm_object_scroll_freeze_push(Evas_Object *obj); + +/** + * Pop the scroll freeze by 1 + * + * This decrements the scroll freeze count by one. If it is more + * than 0 it will take effect on the parents of the indicated + * object. + * + * @param obj The object + * @ingroup Scrollhints + */ +EAPI void elm_object_scroll_freeze_pop(Evas_Object *obj); + +/** + * Lock the scrolling of the given widget (and thus all parents) + * + * This locks the given object from scrolling in the X axis (and implicitly + * also locks all parent scrollers too from doing the same). + * + * @param obj The object + * @param lock The lock state (1 == locked, 0 == unlocked) + * @ingroup Scrollhints + */ +EAPI void elm_object_scroll_lock_x_set(Evas_Object *obj, Eina_Bool lock); + +/** + * Lock the scrolling of the given widget (and thus all parents) + * + * This locks the given object from scrolling in the Y axis (and implicitly + * also locks all parent scrollers too from doing the same). + * + * @param obj The object + * @param lock The lock state (1 == locked, 0 == unlocked) + * @ingroup Scrollhints + */ +EAPI void elm_object_scroll_lock_y_set(Evas_Object *obj, Eina_Bool lock); + +/** + * Get the scrolling lock of the given widget + * + * This gets the lock for X axis scrolling. + * + * @param obj The object + * @ingroup Scrollhints + */ +EAPI Eina_Bool elm_object_scroll_lock_x_get(const Evas_Object *obj); + +/** + * Get the scrolling lock of the given widget + * + * This gets the lock for Y axis scrolling. + * + * @param obj The object + * @ingroup Scrollhints + */ +EAPI Eina_Bool elm_object_scroll_lock_y_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_scroller.c b/libraries/elementary/src/lib/elm_scroller.c new file mode 100644 index 0000000..49959b2 --- /dev/null +++ b/libraries/elementary/src/lib/elm_scroller.c @@ -0,0 +1,765 @@ +#include +#include "elm_priv.h" +#include "els_scroller.h" + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *scr; + Evas_Object *content; + const char *widget_name, *widget_base; + Eina_Bool min_w : 1; + Eina_Bool min_h : 1; + double pagerel_h, pagerel_v; + Evas_Coord pagesize_h, pagesize_v; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); +static void _show_region_hook(void *data, Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _sub_del(void *data, Evas_Object *obj, void *event_info); +static void _on_focus_hook(void *data, Evas_Object *obj); +static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src, + Evas_Callback_Type type, void *event_info); + + +static const char SIG_SCROLL[] = "scroll"; +static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start"; +static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop"; +static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start"; +static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop"; +static const char SIG_EDGE_LEFT[] = "edge,left"; +static const char SIG_EDGE_RIGHT[] = "edge,right"; +static const char SIG_EDGE_TOP[] = "edge,top"; +static const char SIG_EDGE_BOTTOM[] = "edge,bottom"; +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_SCROLL, ""}, + {SIG_SCROLL_ANIM_START, ""}, + {SIG_SCROLL_ANIM_STOP, ""}, + {SIG_SCROLL_DRAG_START, ""}, + {SIG_SCROLL_DRAG_STOP, ""}, + {SIG_EDGE_LEFT, ""}, + {SIG_EDGE_RIGHT, ""}, + {SIG_EDGE_TOP, ""}, + {SIG_EDGE_BOTTOM, ""}, + {NULL, NULL} +}; + +static Eina_Bool +_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info) +{ + if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE; + Evas_Event_Key_Down *ev = event_info; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; + if (elm_widget_disabled_get(obj)) return EINA_FALSE; + + Evas_Coord x = 0; + Evas_Coord y = 0; + Evas_Coord step_x = 0; + Evas_Coord step_y = 0; + Evas_Coord max_x = 0; + Evas_Coord max_y = 0; + Evas_Coord v_w = 0; + Evas_Coord v_h = 0; + Evas_Coord page_x = 0; + Evas_Coord page_y = 0; + + elm_smart_scroller_child_pos_get(wd->scr, &x, &y); + elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y); + elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y); + elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h); + elm_scroller_child_size_get(obj, &max_x, &max_y); + + if ((!strcmp(ev->keyname, "Left")) || + ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string))) + { + x -= step_x; + } + else if ((!strcmp(ev->keyname, "Right")) || + ((!strcmp(ev->keyname, "KP_Right")) && (!ev->string))) + { + x += step_x; + } + else if ((!strcmp(ev->keyname, "Up")) || + ((!strcmp(ev->keyname, "KP_Up")) && (!ev->string))) + { + y -= step_y; + } + else if ((!strcmp(ev->keyname, "Down")) || + ((!strcmp(ev->keyname, "KP_Down")) && (!ev->string))) + { + y += step_y; + } + else if ((!strcmp(ev->keyname, "Home")) || + ((!strcmp(ev->keyname, "KP_Home")) && (!ev->string))) + { + y = 0; + } + else if ((!strcmp(ev->keyname, "End")) || + ((!strcmp(ev->keyname, "KP_End")) && (!ev->string))) + { + y = max_y - v_h; + } + else if ((!strcmp(ev->keyname, "Prior")) || + ((!strcmp(ev->keyname, "KP_Prior")) && (!ev->string))) + { + if (page_y < 0) + y -= -(page_y * v_h) / 100; + else + y -= page_y; + } + else if ((!strcmp(ev->keyname, "Next")) || + ((!strcmp(ev->keyname, "KP_Next")) && (!ev->string))) + { + if (page_y < 0) + y += -(page_y * v_h) / 100; + else + y += page_y; + } + else return EINA_FALSE; + + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + elm_smart_scroller_child_pos_set(wd->scr, x, y); + return EINA_TRUE; +} + +static void +_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (elm_widget_focus_get(obj)) + { + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), "elm,action,focus", "elm"); + evas_object_focus_set(wd->scr, EINA_TRUE); + } + else + { + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), "elm,action,unfocus", "elm"); + evas_object_focus_set(wd->scr, EINA_FALSE); + } +} + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + free(wd); +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool mirrored) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->scr) + elm_smart_scroller_mirrored_set(wd->scr, mirrored); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_widget_mirrored_reload(obj); + if (wd->scr) + { + Evas_Object *edj; + const char *str; + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + elm_smart_scroller_object_theme_set(obj, wd->scr, + wd->widget_name, wd->widget_base, + elm_widget_style_get(obj)); + // edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale); + edj = elm_smart_scroller_edje_object_get(wd->scr); + str = edje_object_data_get(edj, "focus_highlight"); + if ((str) && (!strcmp(str, "on"))) + elm_widget_highlight_in_theme_set(obj, EINA_TRUE); + else + elm_widget_highlight_in_theme_set(obj, EINA_FALSE); + } + _sizing_eval(obj); +} + +static Eina_Bool +_elm_scroller_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *cur; + + if ((!wd) || (!wd->content)) + return EINA_FALSE; + + cur = wd->content; + + /* Try Focus cycle in subitem */ + if (elm_widget_focus_get(obj)) + { + if ((elm_widget_can_focus_get(cur)) || (elm_widget_child_can_focus_get(cur))) + return elm_widget_focus_next_get(cur, dir, next); + } + + /* Return */ + *next = (Evas_Object *)obj; + return !elm_widget_focus_get(obj); +} + +static void +_signal_emit_hook(Evas_Object *obj, const char *emission, const char *source) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), + emission, source); +} + +static void +_signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_signal_callback_add(elm_smart_scroller_edje_object_get(wd->scr), + emission, source, func_cb, data); +} + +static void +_signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + edje_object_signal_callback_del_full( + elm_smart_scroller_edje_object_get(wd->scr), emission, source, + func_cb, data); +} + +static void +_show_region_hook(void *data, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(data); + Evas_Coord x, y, w, h; + if (!wd) return; + elm_widget_show_region_get(obj, &x, &y, &w, &h); + if (wd->scr) + elm_smart_scroller_child_region_show(wd->scr, x, y, w, h); +} + +static void +_focus_region_hook(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (wd->scr) + elm_smart_scroller_child_region_show(wd->scr, x, y, w, h); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord vw = 0, vh = 0, minw = 0, minh = 0, maxw = 0, maxh = 0, w, h, vmw, vmh; + double xw = 0.0, yw = 0.0; + + if (!wd) return; + if (wd->content) + { + evas_object_size_hint_min_get(wd->content, &minw, &minh); + evas_object_size_hint_max_get(wd->content, &maxw, &maxh); + evas_object_size_hint_weight_get(wd->content, &xw, &yw); + } + if (wd->scr) + { + elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh); + if (xw > 0.0) + { + if ((minw > 0) && (vw < minw)) vw = minw; + else if ((maxw > 0) && (vw > maxw)) vw = maxw; + } + else if (minw > 0) vw = minw; + if (yw > 0.0) + { + if ((minh > 0) && (vh < minh)) vh = minh; + else if ((maxh > 0) && (vh > maxh)) vh = maxh; + } + else if (minh > 0) vh = minh; + if (wd->content) evas_object_resize(wd->content, vw, vh); + w = -1; + h = -1; + edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh); + if (wd->min_w) w = vmw + minw; + if (wd->min_h) h = vmh + minh; + evas_object_size_hint_max_get(obj, &maxw, &maxh); + if ((maxw > 0) && (w > maxw)) w = maxw; + if ((maxh > 0) && (h > maxh)) h = maxh; + evas_object_size_hint_min_set(obj, w, h); + } +} + +static void +_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _sizing_eval(data); +} + +static void +_sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *sub = event_info; + + if (!wd) return; + if (sub == wd->content) + { + elm_widget_on_show_region_hook_set(wd->content, NULL, NULL); + evas_object_event_callback_del_full (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + wd->content = NULL; + _sizing_eval(obj); + } + else if (sub == wd->scr) + wd->scr = NULL; +} + +static void +_hold_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + if (wd->scr) + elm_smart_scroller_hold_set(wd->scr, 1); +} + +static void +_hold_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + if (wd->scr) + elm_smart_scroller_hold_set(wd->scr, 0); +} + +static void +_freeze_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + if (wd->scr) + elm_smart_scroller_freeze_set(wd->scr, 1); +} + +static void +_freeze_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + if (wd->scr) + elm_smart_scroller_freeze_set(wd->scr, 0); +} + +static void +_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _sizing_eval(data); +} + +static void +_edge_left(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_EDGE_LEFT, NULL); +} + +static void +_edge_right(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_EDGE_RIGHT, NULL); +} + +static void +_edge_top(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_EDGE_TOP, NULL); +} + +static void +_edge_bottom(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_EDGE_BOTTOM, NULL); +} + +static void +_scroll(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_SCROLL, NULL); +} + +static void +_scroll_anim_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_START, NULL); +} + +static void +_scroll_anim_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_STOP, NULL); +} + +static void +_scroll_drag_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START, NULL); +} + +static void +_scroll_drag_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP, NULL); +} + +Evas_Object * +_elm_scroller_edje_object_get(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return elm_smart_scroller_edje_object_get(wd->scr); +} + +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd; + if (part && strcmp(part, "default")) return; + wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->content == content) return; + if (wd->content) evas_object_del(wd->content); + wd->content = content; + if (content) + { + elm_widget_on_show_region_hook_set(content, _show_region_hook, obj); + elm_widget_sub_object_add(obj, content); + if (wd->scr) + elm_smart_scroller_child_set(wd->scr, content); + evas_object_event_callback_add(content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + } + _sizing_eval(obj); +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + if (part && strcmp(part, "default")) return NULL; + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->content; +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + Evas_Object *content; + if (part && strcmp(part, "default")) return NULL; + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (!wd->content) return NULL; + content = wd->content; + elm_widget_sub_object_del(obj, wd->content); + evas_object_event_callback_del_full(wd->content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + edje_object_part_unswallow(elm_smart_scroller_edje_object_get(wd->scr), + wd->content); + wd->content = NULL; + return content; +} + +EAPI Evas_Object * +elm_scroller_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + Evas_Coord minw, minh; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "scroller"); + elm_widget_type_set(obj, "scroller"); + elm_widget_sub_object_add(parent, obj); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_signal_emit_hook_set(obj, _signal_emit_hook); + elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook); + elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook); + elm_widget_focus_next_hook_set(obj, _elm_scroller_focus_next_hook); + elm_widget_can_focus_set(obj, EINA_TRUE); + elm_widget_event_hook_set(obj, _event_hook); + elm_widget_focus_region_hook_set(obj, _focus_region_hook); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); + + wd->widget_name = eina_stringshare_add("scroller"); + wd->widget_base = eina_stringshare_add("base"); + + wd->scr = elm_smart_scroller_add(e); + elm_smart_scroller_widget_set(wd->scr, obj); + _theme_hook(obj); + elm_widget_resize_object_set(obj, wd->scr); + evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + + edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), &minw, &minh); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj); + + evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj); + evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj); + evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj); + evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj); + + evas_object_smart_callback_add(wd->scr, "edge,left", _edge_left, obj); + evas_object_smart_callback_add(wd->scr, "edge,right", _edge_right, obj); + evas_object_smart_callback_add(wd->scr, "edge,top", _edge_top, obj); + evas_object_smart_callback_add(wd->scr, "edge,bottom", _edge_bottom, obj); + evas_object_smart_callback_add(wd->scr, "scroll", _scroll, obj); + evas_object_smart_callback_add(wd->scr, "animate,start", _scroll_anim_start, obj); + evas_object_smart_callback_add(wd->scr, "animate,stop", _scroll_anim_stop, obj); + evas_object_smart_callback_add(wd->scr, "drag,start", _scroll_drag_start, obj); + evas_object_smart_callback_add(wd->scr, "drag,stop", _scroll_drag_stop, obj); + + _sizing_eval(obj); + + // TODO: convert Elementary to subclassing of Evas_Smart_Class + // TODO: and save some bytes, making descriptions per-class and not instance! + evas_object_smart_callbacks_descriptions_set(obj, _signals); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + return obj; +} + +EAPI void +elm_scroller_custom_widget_base_theme_set(Evas_Object *obj, const char *widget, const char *base) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + EINA_SAFETY_ON_NULL_RETURN(widget); + EINA_SAFETY_ON_NULL_RETURN(base); + if (eina_stringshare_replace(&wd->widget_name, widget) | + eina_stringshare_replace(&wd->widget_base, base)) + _theme_hook(obj); +} + +EAPI void +elm_scroller_content_min_limit(Evas_Object *obj, Eina_Bool w, Eina_Bool h) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->min_w = w; + wd->min_h = h; + _sizing_eval(obj); +} + +EAPI void +elm_scroller_region_show(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (!wd->scr)) return; + elm_smart_scroller_child_region_show(wd->scr, x, y, w, h); +} + +EAPI void +elm_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (!wd->scr)) return; + if ((policy_h >= ELM_SCROLLER_POLICY_LAST) || + (policy_v >= ELM_SCROLLER_POLICY_LAST)) + return; + elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v); +} + +EAPI void +elm_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (!wd->scr)) return; + elm_smart_scroller_policy_get(wd->scr, + (Elm_Smart_Scroller_Policy *) policy_h, + (Elm_Smart_Scroller_Policy *) policy_v); +} + +EAPI void +elm_scroller_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (!wd->scr)) return; + if ((x) || (y)) elm_smart_scroller_child_pos_get(wd->scr, x, y); + if ((w) || (h)) elm_smart_scroller_child_viewport_size_get(wd->scr, w, h); +} + +EAPI void +elm_scroller_child_size_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_geometry_get(wd->content, NULL, NULL, w, h); +} + +EAPI void +elm_scroller_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (!wd->scr)) return; + elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce); +} + +EAPI void +elm_scroller_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_smart_scroller_bounce_allow_get(wd->scr, h_bounce, v_bounce); +} + +EAPI void +elm_scroller_page_relative_set(Evas_Object *obj, double h_pagerel, double v_pagerel) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->pagerel_h = h_pagerel; + wd->pagerel_v = v_pagerel; + if (wd->scr) + elm_smart_scroller_paging_set(wd->scr, wd->pagerel_h, wd->pagerel_v, + wd->pagesize_h, wd->pagesize_v); +} + +EAPI void +elm_scroller_page_size_set(Evas_Object *obj, Evas_Coord h_pagesize, Evas_Coord v_pagesize) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->pagesize_h = h_pagesize; + wd->pagesize_v = v_pagesize; + if (wd->scr) + elm_smart_scroller_paging_set(wd->scr, wd->pagerel_h, wd->pagerel_v, + wd->pagesize_h, wd->pagesize_v); +} + +EAPI void +elm_scroller_current_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->scr) + elm_smart_scroller_current_page_get(wd->scr, h_pagenumber, v_pagenumber); +} + +EAPI void +elm_scroller_last_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->scr) + elm_smart_scroller_last_page_get(wd->scr, h_pagenumber, v_pagenumber); +} + +EAPI void +elm_scroller_page_show(Evas_Object *obj, int h_pagenumber, int v_pagenumber) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->scr) + elm_smart_scroller_page_show(wd->scr, h_pagenumber, v_pagenumber); +} + +EAPI void +elm_scroller_page_bring_in(Evas_Object *obj, int h_pagenumber, int v_pagenumber) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->scr) + elm_smart_scroller_page_bring_in(wd->scr, h_pagenumber, v_pagenumber); +} + +EAPI void +elm_scroller_region_bring_in(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (!wd->scr)) return; + elm_smart_scroller_region_bring_in(wd->scr, x, y, w, h); +} + +EAPI void +elm_scroller_propagate_events_set(Evas_Object *obj, Eina_Bool propagation) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + evas_object_propagate_events_set(wd->scr, propagation); +} + +EAPI Eina_Bool +elm_scroller_propagate_events_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + return evas_object_propagate_events_get(wd->scr); +} + +EAPI void +elm_scroller_gravity_set(Evas_Object *obj, double x, double y) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + elm_smart_scroller_gravity_set(wd->scr, x, y); +} + +EAPI void +elm_scroller_gravity_get(const Evas_Object *obj, double *x, double *y) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + elm_smart_scroller_gravity_get(wd->scr, x, y); +} diff --git a/libraries/elementary/src/lib/elm_scroller.h b/libraries/elementary/src/lib/elm_scroller.h new file mode 100644 index 0000000..b1ad844 --- /dev/null +++ b/libraries/elementary/src/lib/elm_scroller.h @@ -0,0 +1,423 @@ +/** + * @defgroup Scroller Scroller + * @ingroup Elementary + * + * A scroller holds a single object and "scrolls it around". This means that + * it allows the user to use a scrollbar (or a finger) to drag the viewable + * region around, allowing to move through a much larger object that is + * contained in the scroller. The scroller will always have a small minimum + * size by default as it won't be limited by the contents of the scroller. + * + * Signals that you can add callbacks for are: + * @li "edge,left" - the left edge of the content has been reached + * @li "edge,right" - the right edge of the content has been reached + * @li "edge,top" - the top edge of the content has been reached + * @li "edge,bottom" - the bottom edge of the content has been reached + * @li "scroll" - the content has been scrolled (moved) + * @li "scroll,anim,start" - scrolling animation has started + * @li "scroll,anim,stop" - scrolling animation has stopped + * @li "scroll,drag,start" - dragging the contents around has started + * @li "scroll,drag,stop" - dragging the contents around has stopped + * @note The "scroll,anim,*" and "scroll,drag,*" signals are only emitted by + * user intervention. + * + * @note When Elementary is in embedded mode the scrollbars will not be + * draggable, they appear merely as indicators of how much has been scrolled. + * @note When Elementary is in desktop mode the thumbscroll(a.k.a. + * fingerscroll) won't work. + * + * Default content parts of the scroller widget that you can use for are: + * @li "default" - A content of the scroller + * + * Supported elm_object common APIs. + * @li @ref elm_object_signal_emit + * @li @ref elm_object_signal_callback_add + * @li @ref elm_object_signal_callback_del + * @li @ref elm_object_part_content_set + * @li @ref elm_object_part_content_get + * @li @ref elm_object_part_content_unset + * + * In @ref tutorial_scroller you'll find an example of how to use most of + * this API. + * @{ + */ + +/** + * @brief Type that controls when scrollbars should appear. + * + * @see elm_scroller_policy_set() + */ +typedef enum +{ + ELM_SCROLLER_POLICY_AUTO = 0, /**< Show scrollbars as needed */ + ELM_SCROLLER_POLICY_ON, /**< Always show scrollbars */ + ELM_SCROLLER_POLICY_OFF, /**< Never show scrollbars */ + ELM_SCROLLER_POLICY_LAST +} Elm_Scroller_Policy; + +/** + * @brief Add a new scroller to the parent + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * @ingroup Scroller + */ +EAPI Evas_Object *elm_scroller_add(Evas_Object *parent); + +/** + * @brief Set custom theme elements for the scroller + * + * @param obj The scroller object + * @param widget The widget name to use (default is "scroller") + * @param base The base name to use (default is "base") + * + * @ingroup Scroller + */ +EAPI void elm_scroller_custom_widget_base_theme_set(Evas_Object *obj, const char *widget, const char *base); + +/** + * @brief Make the scroller minimum size limited to the minimum size of the content + * + * @param obj The scroller object + * @param w Enable limiting minimum size horizontally + * @param h Enable limiting minimum size vertically + * + * By default the scroller will be as small as its design allows, + * irrespective of its content. This will make the scroller minimum size the + * right size horizontally and/or vertically to perfectly fit its content in + * that direction. + * + * @ingroup Scroller + */ +EAPI void elm_scroller_content_min_limit(Evas_Object *obj, Eina_Bool w, Eina_Bool h); + +/** + * @brief Show a specific virtual region within the scroller content object + * + * @param obj The scroller object + * @param x X coordinate of the region + * @param y Y coordinate of the region + * @param w Width of the region + * @param h Height of the region + * + * This will ensure all (or part if it does not fit) of the designated + * region in the virtual content object (0, 0 starting at the top-left of the + * virtual content object) is shown within the scroller. + * + * @ingroup Scroller + */ +EAPI void elm_scroller_region_show(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h); + +/** + * @brief Set the scrollbar visibility policy + * + * @param obj The scroller object + * @param policy_h Horizontal scrollbar policy + * @param policy_v Vertical scrollbar policy + * + * This sets the scrollbar visibility policy for the given scroller. + * ELM_SCROLLER_POLICY_AUTO means the scrollbar is made visible if it is + * needed, and otherwise kept hidden. ELM_SCROLLER_POLICY_ON turns it on all + * the time, and ELM_SCROLLER_POLICY_OFF always keeps it off. This applies + * respectively for the horizontal and vertical scrollbars. + * + * @ingroup Scroller + */ +EAPI void elm_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v); + +/** + * @brief Gets scrollbar visibility policy + * + * @param obj The scroller object + * @param policy_h Horizontal scrollbar policy + * @param policy_v Vertical scrollbar policy + * + * @see elm_scroller_policy_set() + * + * @ingroup Scroller + */ +EAPI void elm_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v); + +/** + * @brief Get the currently visible content region + * + * @param obj The scroller object + * @param x X coordinate of the region + * @param y Y coordinate of the region + * @param w Width of the region + * @param h Height of the region + * + * This gets the current region in the content object that is visible through + * the scroller. The region co-ordinates are returned in the @p x, @p y, @p + * w, @p h values pointed to. + * + * @note All coordinates are relative to the content. + * + * @see elm_scroller_region_show() + * + * @ingroup Scroller + */ +EAPI void elm_scroller_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); + +/** + * @brief Get the size of the content object + * + * @param obj The scroller object + * @param w Width of the content object. + * @param h Height of the content object. + * + * This gets the size of the content object of the scroller. + * + * @ingroup Scroller + */ +EAPI void elm_scroller_child_size_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h); + +/** + * @brief Set bouncing behavior + * + * @param obj The scroller object + * @param h_bounce Allow bounce horizontally + * @param v_bounce Allow bounce vertically + * + * When scrolling, the scroller may "bounce" when reaching an edge of the + * content object. This is a visual way to indicate the end has been reached. + * This is enabled by default for both axis. This API will set if it is enabled + * for the given axis with the boolean parameters for each axis. + * + * @ingroup Scroller + */ +EAPI void elm_scroller_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce); + +/** + * @brief Get the bounce behaviour + * + * @param obj The Scroller object + * @param h_bounce Will the scroller bounce horizontally or not + * @param v_bounce Will the scroller bounce vertically or not + * + * @see elm_scroller_bounce_set() + * + * @ingroup Scroller + */ +EAPI void elm_scroller_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce); + +/** + * @brief Set scroll page size relative to viewport size. + * + * @param obj The scroller object + * @param h_pagerel The horizontal page relative size + * @param v_pagerel The vertical page relative size + * + * The scroller is capable of limiting scrolling by the user to "pages". That + * is to jump by and only show a "whole page" at a time as if the continuous + * area of the scroller content is split into page sized pieces. This sets + * the size of a page relative to the viewport of the scroller. 1.0 is "1 + * viewport" is size (horizontally or vertically). 0.0 turns it off in that + * axis. This is mutually exclusive with page size + * (see elm_scroller_page_size_set() for more information). Likewise 0.5 + * is "half a viewport". Sane usable values are normally between 0.0 and 1.0 + * including 1.0. If you only want 1 axis to be page "limited", use 0.0 for + * the other axis. + * + * @ingroup Scroller + */ +EAPI void elm_scroller_page_relative_set(Evas_Object *obj, double h_pagerel, double v_pagerel); + +/** + * @brief Set scroll page size. + * + * @param obj The scroller object + * @param h_pagesize The horizontal page size + * @param v_pagesize The vertical page size + * + * This sets the page size to an absolute fixed value, with 0 turning it off + * for that axis. + * + * @see elm_scroller_page_relative_set() + * + * @ingroup Scroller + */ +EAPI void elm_scroller_page_size_set(Evas_Object *obj, Evas_Coord h_pagesize, Evas_Coord v_pagesize); + +/** + * @brief Get scroll current page number. + * + * @param obj The scroller object + * @param h_pagenumber The horizontal page number + * @param v_pagenumber The vertical page number + * + * The page number starts from 0. 0 is the first page. + * Current page means the page which meets the top-left of the viewport. + * If there are two or more pages in the viewport, it returns the number of the page + * which meets the top-left of the viewport. + * + * @see elm_scroller_last_page_get() + * @see elm_scroller_page_show() + * @see elm_scroller_page_bring_in() + * + * @ingroup Scroller + */ +EAPI void elm_scroller_current_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber); + +/** + * @brief Get scroll last page number. + * + * @param obj The scroller object + * @param h_pagenumber The horizontal page number + * @param v_pagenumber The vertical page number + * + * The page number starts from 0. 0 is the first page. + * This returns the last page number among the pages. + * + * @see elm_scroller_current_page_get() + * @see elm_scroller_page_show() + * @see elm_scroller_page_bring_in() + * + * @ingroup Scroller + */ +EAPI void elm_scroller_last_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber); + +/** + * Show a specific virtual region within the scroller content object by page number. + * + * @param obj The scroller object + * @param h_pagenumber The horizontal page number + * @param v_pagenumber The vertical page number + * + * 0, 0 of the indicated page is located at the top-left of the viewport. + * This will jump to the page directly without animation. + * + * Example of usage: + * + * @code + * sc = elm_scroller_add(win); + * elm_object_content_set(sc, content); + * elm_scroller_page_relative_set(sc, 1, 0); + * elm_scroller_current_page_get(sc, &h_page, &v_page); + * elm_scroller_page_show(sc, h_page + 1, v_page); + * @endcode + * + * @see elm_scroller_page_bring_in() + * + * @ingroup Scroller + */ +EAPI void elm_scroller_page_show(Evas_Object *obj, int h_pagenumber, int v_pagenumber); + +/** + * Show a specific virtual region within the scroller content object by page number. + * + * @param obj The scroller object + * @param h_pagenumber The horizontal page number + * @param v_pagenumber The vertical page number + * + * 0, 0 of the indicated page is located at the top-left of the viewport. + * This will slide to the page with animation. + * + * Example of usage: + * + * @code + * sc = elm_scroller_add(win); + * elm_object_content_set(sc, content); + * elm_scroller_page_relative_set(sc, 1, 0); + * elm_scroller_last_page_get(sc, &h_page, &v_page); + * elm_scroller_page_bring_in(sc, h_page, v_page); + * @endcode + * + * @see elm_scroller_page_show() + * + * @ingroup Scroller + */ +EAPI void elm_scroller_page_bring_in(Evas_Object *obj, int h_pagenumber, int v_pagenumber); + +/** + * @brief Show a specific virtual region within the scroller content object. + * + * @param obj The scroller object + * @param x X coordinate of the region + * @param y Y coordinate of the region + * @param w Width of the region + * @param h Height of the region + * + * This will ensure all (or part if it does not fit) of the designated + * region in the virtual content object (0, 0 starting at the top-left of the + * virtual content object) is shown within the scroller. Unlike + * elm_scroller_region_show(), this allow the scroller to "smoothly slide" + * to this location (if configuration in general calls for transitions). It + * may not jump immediately to the new location and make take a while and + * show other content along the way. + * + * @see elm_scroller_region_show() + * + * @ingroup Scroller + */ +EAPI void elm_scroller_region_bring_in(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h); + +/** + * @brief Set event propagation on a scroller + * + * @param obj The scroller object + * @param propagation If propagation is enabled or not + * + * This enables or disabled event propagation from the scroller content to + * the scroller and its parent. By default event propagation is disabled. + * + * @ingroup Scroller + */ +EAPI void elm_scroller_propagate_events_set(Evas_Object *obj, Eina_Bool propagation); + +/** + * @brief Get event propagation for a scroller + * + * @param obj The scroller object + * @return The propagation state + * + * This gets the event propagation for a scroller. + * + * @see elm_scroller_propagate_events_set() + * + * @ingroup Scroller + */ +EAPI Eina_Bool elm_scroller_propagate_events_get(const Evas_Object *obj); + +/** + * @brief Set scrolling gravity on a scroller + * + * @param obj The scroller object + * @param x The scrolling horizontal gravity + * @param y The scrolling vertical gravity + * + * The gravity, defines how the scroller will adjust its view + * when the size of the scroller contents increase. + * + * The scroller will adjust the view to glue itself as follows. + * + * x=0.0, for showing the left most region of the content. + * x=1.0, for showing the right most region of the content. + * y=0.0, for showing the bottom most region of the content. + * y=1.0, for showing the top most region of the content. + * + * Default values for x and y are 0.0 + * + * @ingroup Scroller + */ +EAPI void elm_scroller_gravity_set(Evas_Object *obj, double x, double y); + +/** + * @brief Get scrolling gravity values for a scroller + * + * @param obj The scroller object + * @param x The scrolling horizontal gravity + * @param y The scrolling vertical gravity + * + * This gets gravity values for a scroller. + * + * @see elm_scroller_gravity_set() + * + * @ingroup Scroller + */ +EAPI void elm_scroller_gravity_get(const Evas_Object *obj, double *x, double *y); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_segment_control.c b/libraries/elementary/src/lib/elm_segment_control.c new file mode 100644 index 0000000..6ff6411 --- /dev/null +++ b/libraries/elementary/src/lib/elm_segment_control.c @@ -0,0 +1,742 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; +typedef struct _Elm_Segment_Item Elm_Segment_Item; + +struct _Widget_Data +{ + Evas_Object *obj; + Evas_Object *base; + Eina_List *seg_items; + int item_count; + Elm_Segment_Item *selected_item; + int item_width; +}; + +struct _Elm_Segment_Item +{ + ELM_WIDGET_ITEM; + Evas_Object *icon; + const char *label; + int seg_index; +}; + +static const char *widtype = NULL; +static void _sizing_eval(Evas_Object *obj); +static void _del_hook(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); +static void _disable_hook(Evas_Object *obj); +static void _item_free(Elm_Segment_Item *it); +static void _segment_off(Elm_Segment_Item *it); +static void _segment_on(Elm_Segment_Item *it); +static void _position_items(Widget_Data *wd); +static void _on_move_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj + __UNUSED__, void *event_info __UNUSED__); +static void _mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj + __UNUSED__, void *event_info __UNUSED__); +static void _mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj + __UNUSED__, void *event_info __UNUSED__); +static void _swallow_item_objects(Elm_Segment_Item *it); +static void _update_list(Widget_Data *wd); +static Elm_Segment_Item * _item_find(const Evas_Object *obj, int index); +static Elm_Segment_Item* _item_new(Evas_Object *obj, Evas_Object *icon, + const char *label); + +static const char SIG_CHANGED[] = "changed"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CHANGED, ""}, + {NULL, NULL} +}; + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd; + Evas_Coord minw = -1, minh = -1; + Evas_Coord w, h; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + elm_coords_finger_size_adjust(wd->item_count, &minw, 1, &minh); + edje_object_size_min_restricted_calc(wd->base, &minw, &minh, minw, minh); + elm_coords_finger_size_adjust(wd->item_count, &minw, 1, &minh); + + evas_object_size_hint_min_get(obj, &w, &h); + if (w > minw) minw = w; + if (h > minh) minh = h; + evas_object_size_hint_min_set(obj, minw, minh); +} + +static void +_del_hook(Evas_Object *obj) +{ + Elm_Segment_Item *it; + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + EINA_LIST_FREE(wd->seg_items, it) + { + _item_free(it); + elm_widget_item_free(it); + } + + free(wd); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Eina_List *l; + Eina_Bool rtl; + Elm_Segment_Item *it; + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + _elm_widget_mirrored_reload(obj); + rtl = elm_widget_mirrored_get(obj); + edje_object_mirrored_set(wd->base, rtl); + + _elm_theme_object_set(obj, wd->base, "segment_control", "base", + elm_widget_style_get(obj)); + edje_object_scale_set(wd->base, elm_widget_scale_get(wd->base) + *_elm_config->scale); + + EINA_LIST_FOREACH(wd->seg_items, l, it) + { + _elm_theme_object_set(obj, VIEW(it), "segment_control", + "item", elm_widget_style_get(obj)); + edje_object_scale_set(VIEW(it), elm_widget_scale_get(VIEW(it)) + *_elm_config->scale); + edje_object_mirrored_set(VIEW(it), rtl); + } + + _update_list(wd); +} + +static void +_disable_hook(Evas_Object *obj) +{ + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return; + _update_list(wd); +} + +// TODO: Elm_widget elm_widget_focus_list_next_get supports only Elm_widget list, +// Not the Elm_Widget_item. Focus switching with in widget not supported until +// it is supported in elm_widget +#if 0 +static void * +_elm_list_data_get(const Eina_List *list) +{ + Elm_Segment_Item *it = eina_list_data_get(list); + + if (it) return NULL; + + edje_object_signal_emit(VIEW(it), "elm,state,segment,selected", "elm"); + return VIEW(it); +} + +static Eina_Bool +_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, + Evas_Object **next) +{ + static int count=0; + Widget_Data *; + const Eina_List *items; + void *(*list_data_get) (const Eina_List *list); + + wd = elm_widget_data_get(obj); + if ((!wd)) return EINA_FALSE; + + /* Focus chain */ + /* TODO: Change this to use other chain */ + if ((items = elm_widget_focus_custom_chain_get(obj))) + list_data_get = eina_list_data_get; + else + { + items = wd->seg_items; + list_data_get = _elm_list_data_get; + if (!items) return EINA_FALSE; + } + return elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next); +} +#endif + +static void +_item_free(Elm_Segment_Item *it) +{ + Widget_Data *wd; + + if (!it) return; + + wd = elm_widget_item_data_get(it); + if (!wd) return; + + if (wd->selected_item == it) wd->selected_item = NULL; + if (wd->seg_items) wd->seg_items = eina_list_remove(wd->seg_items, it); + + if (it->icon) evas_object_del(it->icon); + if (it->label) eina_stringshare_del(it->label); +} + +static void +_segment_off(Elm_Segment_Item *it) +{ + Widget_Data *wd; + + if (!it) return; + + wd = elm_widget_item_data_get(it); + if (!wd) return; + + edje_object_signal_emit(VIEW(it), "elm,state,segment,normal", "elm"); + + if (wd->selected_item == it) wd->selected_item = NULL; +} + +static void +_segment_on(Elm_Segment_Item *it) +{ + Widget_Data *wd; + + if (!it) return; + + wd = elm_widget_item_data_get(it); + if (!wd) return; + if (it == wd->selected_item) return; + + if (wd->selected_item) _segment_off(wd->selected_item); + + edje_object_signal_emit(VIEW(it), "elm,state,segment,selected", "elm"); + + wd->selected_item = it; + evas_object_smart_callback_call(wd->obj, SIG_CHANGED, it); +} + +static void +_position_items(Widget_Data *wd) +{ + Eina_List *l; + Elm_Segment_Item *it; + Eina_Bool rtl; + int bx, by, bw, bh, pos; + + wd->item_count = eina_list_count(wd->seg_items); + if (wd->item_count <= 0) return; + + evas_object_geometry_get(wd->base, &bx, &by, &bw, &bh); + wd->item_width = bw / wd->item_count; + rtl = elm_widget_mirrored_get(wd->obj); + + if (rtl) + pos = bx + bw - wd->item_width; + else + pos = bx; + + EINA_LIST_FOREACH(wd->seg_items, l, it) + { + evas_object_move(VIEW(it), pos, by); + evas_object_resize(VIEW(it), wd->item_width, bh); + if (rtl) + pos -= wd->item_width; + else + pos += wd->item_width; + } + _sizing_eval(wd->obj); +} + +static void +_on_move_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Widget_Data *wd; + + wd = elm_widget_data_get(data); + if (!wd) return; + + _position_items(wd); + +} + +static void +_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, + void *event_info) +{ + Widget_Data *wd; + Elm_Segment_Item *it; + Evas_Event_Mouse_Up *ev; + Evas_Coord x, y, w, h; + + it = data; + if (!it) return; + + wd = elm_widget_item_data_get(it); + if (!wd) return; + + if (elm_widget_disabled_get(wd->obj)) return; + + if (it == wd->selected_item) return; + + ev = event_info; + evas_object_geometry_get(VIEW(it), &x, &y, &w, &h); + + if ((ev->canvas.x >= x) && (ev->output.x <= (x + w)) && (ev->canvas.y >= y) + && (ev->canvas.y <= (y + h))) + _segment_on(it); + else + edje_object_signal_emit(VIEW(it), "elm,state,segment,normal", "elm"); +} + +static void +_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Widget_Data *wd; + Elm_Segment_Item *it; + + it = data; + if (!it) return; + + wd = elm_widget_item_data_get(it); + if (!wd) return; + + if (elm_widget_disabled_get(wd->obj)) return; + + if (it == wd->selected_item) return; + + edje_object_signal_emit(VIEW(it), "elm,state,segment,pressed", "elm"); +} + +static void +_swallow_item_objects(Elm_Segment_Item *it) +{ + if (!it) return; + + if (it->icon) + { + edje_object_part_swallow(VIEW(it), "elm.swallow.icon", it->icon); + edje_object_signal_emit(VIEW(it), "elm,state,icon,visible", "elm"); + } + else + edje_object_signal_emit(VIEW(it), "elm,state,icon,hidden", "elm"); + + if (it->label) + { + edje_object_part_text_escaped_set(VIEW(it), "elm.text", it->label); + edje_object_signal_emit(VIEW(it), "elm,state,text,visible", "elm"); + } + else + edje_object_signal_emit(VIEW(it), "elm,state,text,hidden", "elm"); + edje_object_message_signal_process(VIEW(it)); +} + +static void +_update_list(Widget_Data *wd) +{ + Eina_List *l; + Elm_Segment_Item *it; + Eina_Bool rtl; + int idx = 0; + + _position_items(wd); + + if (wd->item_count == 1) + { + it = eina_list_nth(wd->seg_items, 0); + it->seg_index = 0; + + //Set the segment type + edje_object_signal_emit(VIEW(it), + "elm,type,segment,single", "elm"); + + //Set the segment state + if (wd->selected_item == it) + edje_object_signal_emit(VIEW(it), + "elm,state,segment,selected", "elm"); + else + edje_object_signal_emit(VIEW(it), + "elm,state,segment,normal", "elm"); + + if (elm_widget_disabled_get(wd->obj)) + edje_object_signal_emit(VIEW(it), "elm,state,disabled", "elm"); + else + edje_object_signal_emit(VIEW(it), "elm,state,enabled", "elm"); + + _swallow_item_objects(it); + return; + } + + rtl = elm_widget_mirrored_get(wd->obj); + EINA_LIST_FOREACH(wd->seg_items, l, it) + { + it->seg_index = idx; + + //Set the segment type + if (idx == 0) + { + if (rtl) + edje_object_signal_emit(VIEW(it), + "elm,type,segment,right", "elm"); + else + edje_object_signal_emit(VIEW(it), + "elm,type,segment,left", "elm"); + } + else if (idx == (wd->item_count - 1)) + { + if (rtl) + edje_object_signal_emit(VIEW(it), + "elm,type,segment,left", "elm"); + else + edje_object_signal_emit(VIEW(it), + "elm,type,segment,right", "elm"); + } + else + edje_object_signal_emit(VIEW(it), + "elm,type,segment,middle", "elm"); + + //Set the segment state + if (wd->selected_item == it) + edje_object_signal_emit(VIEW(it), + "elm,state,segment,selected", "elm"); + else + edje_object_signal_emit(VIEW(it), + "elm,state,segment,normal", "elm"); + + if (elm_widget_disabled_get(wd->obj)) + edje_object_signal_emit(VIEW(it), "elm,state,disabled", "elm"); + else + edje_object_signal_emit(VIEW(it), "elm,state,enabled", "elm"); + + _swallow_item_objects(it); + idx++; + } +} + +static Elm_Segment_Item * +_item_find(const Evas_Object *obj, int idx) +{ + Widget_Data *wd; + Elm_Segment_Item *it; + + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + it = eina_list_nth(wd->seg_items, idx); + return it; +} + +static void +_item_text_set_hook(Elm_Object_Item *it, const char *part, const char *label) +{ + Widget_Data *wd; + Elm_Segment_Item *item; + + if (part && strcmp(part, "default")) return; + + item = (Elm_Segment_Item *)it; + wd = elm_widget_item_data_get(item); + if (!wd) return; + + eina_stringshare_replace(&item->label, label); + if (item->label) + edje_object_signal_emit(VIEW(item), "elm,state,text,visible", "elm"); + else + edje_object_signal_emit(VIEW(item), "elm,state,text,hidden", "elm"); + edje_object_message_signal_process(VIEW(item)); + //label can be NULL also. + edje_object_part_text_escaped_set(VIEW(item), "elm.text", item->label); +} + +static const char * +_item_text_get_hook(const Elm_Object_Item *it, const char *part) +{ + if (part && strcmp(part, "default")) return NULL; + return ((Elm_Segment_Item *)it)->label; +} + +static void +_item_content_set_hook(Elm_Object_Item *it, + const char *part, + Evas_Object *content) +{ + Elm_Segment_Item *item; + if (part && strcmp(part, "icon")) return; + + item = (Elm_Segment_Item *)it; + if (content == item->icon) return; + + //Remove the existing icon + if (item->icon) evas_object_del(item->icon); + item->icon = content; + if (item->icon) + { + elm_widget_sub_object_add(VIEW(item), item->icon); + edje_object_part_swallow(VIEW(item), "elm.swallow.icon", item->icon); + edje_object_signal_emit(VIEW(item), "elm,state,icon,visible", "elm"); + } + else + edje_object_signal_emit(VIEW(item), "elm,state,icon,hidden", "elm"); +} + +static Evas_Object * +_item_content_get_hook(const Elm_Object_Item *it, const char *part) +{ + if (part && strcmp(part, "icon")) return NULL; + return ((Elm_Segment_Item *)it)->icon; +} + +static Eina_Bool +_item_del_pre_hook(Elm_Object_Item *it) +{ + Widget_Data *wd; + Elm_Segment_Item *item = (Elm_Segment_Item *)it; + + wd = elm_widget_item_data_get(item); + if (!wd) return EINA_FALSE; + + _item_free(item); + _update_list(wd); + + return EINA_TRUE; +} + +static Elm_Segment_Item* +_item_new(Evas_Object *obj, Evas_Object *icon, const char *label) +{ + Elm_Segment_Item *it; + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + it = elm_widget_item_new(obj, Elm_Segment_Item); + if (!it) return NULL; + elm_widget_item_data_set(it, wd); + elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook); + elm_widget_item_text_set_hook_set(it, _item_text_set_hook); + elm_widget_item_text_get_hook_set(it, _item_text_get_hook); + elm_widget_item_content_set_hook_set(it, _item_content_set_hook); + elm_widget_item_content_get_hook_set(it, _item_content_get_hook); + + VIEW(it) = edje_object_add(evas_object_evas_get(obj)); + edje_object_scale_set(VIEW(it), elm_widget_scale_get(VIEW(it)) + *_elm_config->scale); + evas_object_smart_member_add(VIEW(it), obj); + elm_widget_sub_object_add(obj, VIEW(it)); + _elm_theme_object_set(obj, VIEW(it), "segment_control", "item", + elm_object_style_get(obj)); + edje_object_mirrored_set(VIEW(it), + elm_widget_mirrored_get(WIDGET(it))); + + if (label) + eina_stringshare_replace(&it->label, label); + if (it->label) + edje_object_signal_emit(VIEW(it), "elm,state,text,visible", "elm"); + else + edje_object_signal_emit(VIEW(it), "elm,state,text,hidden", "elm"); + edje_object_message_signal_process(VIEW(it)); + edje_object_part_text_escaped_set(VIEW(it), "elm.text", label); + + it->icon = icon; + if (it->icon) elm_widget_sub_object_add(VIEW(it), it->icon); + evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_DOWN, + _mouse_down, it); + evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_UP, + _mouse_up, it); + evas_object_show(VIEW(it)); + + return it; +} + +EAPI Evas_Object * +elm_segment_control_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "segment_control"); + elm_widget_type_set(obj, "segment_control"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_disable_hook_set(obj, _disable_hook); + + // TODO: Focus switch support to Elm_widget_Item not supported yet. +#if 0 + elm_widget_focus_next_hook_set(obj, _focus_next_hook); +#endif + + wd->obj = obj; + + wd->base = edje_object_add(e); + edje_object_scale_set(wd->base, elm_widget_scale_get(wd->base) + *_elm_config->scale); + _elm_theme_object_set(obj, wd->base, "segment_control", "base", "default"); + elm_widget_resize_object_set(obj, wd->base); + + evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, + _on_move_resize, obj); + evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, + _on_move_resize, obj); + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + return obj; +} + +EAPI Elm_Object_Item * +elm_segment_control_item_add(Evas_Object *obj, Evas_Object *icon, + const char *label) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Elm_Segment_Item *it; + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + it = _item_new(obj, icon, label); + if (!it) return NULL; + + wd->seg_items = eina_list_append(wd->seg_items, it); + _update_list(wd); + + return (Elm_Object_Item *)it; +} + +EAPI Elm_Object_Item * +elm_segment_control_item_insert_at(Evas_Object *obj, Evas_Object *icon, + const char *label, int idx) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Elm_Segment_Item *it, *it_rel; + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (idx < 0) idx = 0; + + it = _item_new(obj, icon, label); + if (!it) return NULL; + + it_rel = _item_find(obj, idx); + if (it_rel) + wd->seg_items = eina_list_prepend_relative(wd->seg_items, it, it_rel); + else + wd->seg_items = eina_list_append(wd->seg_items, it); + + _update_list(wd); + return (Elm_Object_Item *)it; +} + +EAPI void +elm_segment_control_item_del_at(Evas_Object *obj, int idx) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Elm_Segment_Item *it; + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return; + + it = _item_find(obj, idx); + if (!it) return; + elm_object_item_del((Elm_Object_Item *)it); +} + +EAPI const char* +elm_segment_control_item_label_get(const Evas_Object *obj, int idx) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Elm_Segment_Item *it = _item_find(obj, idx); + if (it) return it->label; + return NULL; +} + +EAPI Evas_Object * +elm_segment_control_item_icon_get(const Evas_Object *obj, int idx) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Elm_Segment_Item *it = _item_find(obj, idx); + if (it) return it->icon; + return NULL; +} + +EAPI int +elm_segment_control_item_count_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return 0; + + return eina_list_count(wd->seg_items); +} + +EAPI Evas_Object* +elm_segment_control_item_object_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + return VIEW(it); +} + +EAPI Elm_Object_Item* +elm_segment_control_item_selected_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return (Elm_Object_Item *) wd->selected_item; +} + +EAPI void +elm_segment_control_item_selected_set(Elm_Object_Item *it, Eina_Bool selected) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Widget_Data *wd; + Elm_Segment_Item *item = (Elm_Segment_Item *)it; + + wd = elm_widget_item_data_get(item); + if (!wd) return; + + if (item == wd->selected_item) + { + //already in selected state. + if (selected) return; + + //unselect case + _segment_off(item); + } + else if (selected) + _segment_on(item); + + return; +} + +EAPI Elm_Object_Item * +elm_segment_control_item_get(const Evas_Object *obj, int idx) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + return (Elm_Object_Item *) _item_find(obj, idx); +} + +EAPI int +elm_segment_control_item_index_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, -1); + return ((Elm_Segment_Item *)it)->seg_index; +} diff --git a/libraries/elementary/src/lib/elm_segment_control.h b/libraries/elementary/src/lib/elm_segment_control.h new file mode 100644 index 0000000..02cb7ed --- /dev/null +++ b/libraries/elementary/src/lib/elm_segment_control.h @@ -0,0 +1,290 @@ +/** + * @defgroup SegmentControl SegmentControl + * @ingroup Elementary + * + * @image html img/widget/segment_control/preview-00.png + * @image latex img/widget/segment_control/preview-00.eps width=\textwidth + * + * @image html img/segment_control.png + * @image latex img/segment_control.eps width=\textwidth + * + * Segment control widget is a horizontal control made of multiple segment + * items, each segment item functioning similar to discrete two state button. + * A segment control groups the items together and provides compact + * single button with multiple equal size segments. + * + * Segment item size is determined by base widget + * size and the number of items added. + * Only one segment item can be at selected state. A segment item can display + * combination of Text and any Evas_Object like Images or other widget. + * + * Smart callbacks one can listen to: + * - "changed" - When the user clicks on a segment item which is not + * previously selected and get selected. The event_info parameter is the + * segment item pointer. + * + * Available styles for it: + * - @c "default" + * + * Default content parts of the segment control items that you can use for are: + * @li "icon" - An icon in a segment control item + * + * Default text parts of the segment control items that you can use for are: + * @li "default" - Title label in a segment control item + * + * Supported elm_object common APIs. + * @li elm_object_disabled_set + * @li elm_object_disabled_get + * + * Supported elm_object_item common APIs. + * @li @ref elm_object_item_part_text_set + * @li @ref elm_object_item_part_text_get + * @li @ref elm_object_item_part_content_set + * @li @ref elm_object_item_part_content_get + * + * Here is an example on its usage: + * @li @ref segment_control_example + * + */ + +/** + * @addtogroup SegmentControl + * @{ + */ + +/** + * Add a new segment control widget to the given parent Elementary + * (container) object. + * + * @param parent The parent object. + * @return a new segment control widget handle or @c NULL, on errors. + * + * This function inserts a new segment control widget on the canvas. + * + * @ingroup SegmentControl + */ +EAPI Evas_Object *elm_segment_control_add(Evas_Object *parent); + +/** + * Append a new item to the segment control object. + * + * @param obj The segment control object. + * @param icon The icon object to use for the left side of the item. An + * icon can be any Evas object, but usually it is an icon created + * with elm_icon_add(). + * @param label The label of the item. + * Note that, NULL is different from empty string "". + * @return The created item or @c NULL upon failure. + * + * A new item will be created and appended to the segment control, i.e., will + * be set as @b last item. + * + * If it should be inserted at another position, + * elm_segment_control_item_insert_at() should be used instead. + * + * Items created with this function can be deleted with function + * elm_object_item_del() or elm_object_item_del_at(). + * + * @note @p label set to @c NULL is different from empty string "". + * If an item + * only has icon, it will be displayed bigger and centered. If it has + * icon and label, even that an empty string, icon will be smaller and + * positioned at left. + * + * Simple example: + * @code + * sc = elm_segment_control_add(win); + * ic = elm_icon_add(win); + * elm_icon_file_set(ic, "path/to/image", NULL); + * elm_icon_resizable_set(ic, EINA_TRUE, EINA_TRUE); + * elm_segment_control_item_add(sc, ic, "label"); + * evas_object_show(sc); + * @endcode + * + * @see elm_segment_control_item_insert_at() + * @see elm_object_item_del() + * + * @ingroup SegmentControl + */ +EAPI Elm_Object_Item *elm_segment_control_item_add(Evas_Object *obj, Evas_Object *icon, const char *label); + +/** + * Insert a new item to the segment control object at specified position. + * + * @param obj The segment control object. + * @param icon The icon object to use for the left side of the item. An + * icon can be any Evas object, but usually it is an icon created + * with elm_icon_add(). + * @param label The label of the item. + * @param index Item position. Value should be between 0 and items count. + * @return The created item or @c NULL upon failure. + + * Index values must be between @c 0, when item will be prepended to + * segment control, and items count, that can be get with + * elm_segment_control_item_count_get(), case when item will be appended + * to segment control, just like elm_segment_control_item_add(). + * + * Items created with this function can be deleted with function + * elm_object_item_del() or elm_segment_control_item_del_at(). + * + * @note @p label set to @c NULL is different from empty string "". + * If an item + * only has icon, it will be displayed bigger and centered. If it has + * icon and label, even that an empty string, icon will be smaller and + * positioned at left. + * + * @see elm_segment_control_item_add() + * @see elm_segment_control_item_count_get() + * @see elm_object_item_del() + * + * @ingroup SegmentControl + */ +EAPI Elm_Object_Item *elm_segment_control_item_insert_at(Evas_Object *obj, Evas_Object *icon, const char *label, int index); + +/** + * Remove a segment control item at given index from its parent, + * deleting it. + * + * @param obj The segment control object. + * @param index The position of the segment control item to be deleted. + * + * Items can be added with elm_segment_control_item_add() or + * elm_segment_control_item_insert_at(). + * + * @ingroup SegmentControl + */ +EAPI void elm_segment_control_item_del_at(Evas_Object *obj, int index); + +/** + * Get the Segment items count from segment control. + * + * @param obj The segment control object. + * @return Segment items count. + * + * It will just return the number of items added to segment control @p obj. + * + * @ingroup SegmentControl + */ +EAPI int elm_segment_control_item_count_get(const Evas_Object *obj); + +/** + * Get the item placed at specified index. + * + * @param obj The segment control object. + * @param index The index of the segment item. + * @return The segment control item or @c NULL on failure. + * + * Index is the position of an item in segment control widget. Its + * range is from @c 0 to count - 1 . + * Count is the number of items, that can be get with + * elm_segment_control_item_count_get(). + * + * @ingroup SegmentControl + */ +EAPI Elm_Object_Item *elm_segment_control_item_get(const Evas_Object *obj, int index); + +/** + * Get the label of item. + * + * @param obj The segment control object. + * @param index The index of the segment item. + * @return The label of the item at @p index. + * + * The return value is a pointer to the label associated to the item when + * it was created, with function elm_segment_control_item_add(), or later + * with function elm_object_item_text_set. If no label + * was passed as argument, it will return @c NULL. + * + * @see elm_object_item_text_set() for more details. + * @see elm_segment_control_item_add() + * + * @ingroup SegmentControl + */ +EAPI const char *elm_segment_control_item_label_get(const Evas_Object *obj, int index); + +/** + * Get the icon associated to the item. + * + * @param obj The segment control object. + * @param index The index of the segment item. + * @return The left side icon associated to the item at @p index. + * + * The return value is a pointer to the icon associated to the item when + * it was created, with function elm_segment_control_item_add(), or later + * with function elm_object_item_part_content_set(). If no icon + * was passed as argument, it will return @c NULL. + * + * @see elm_segment_control_item_add() + * @see elm_object_item_part_content_set() + * + * @ingroup SegmentControl + */ +EAPI Evas_Object *elm_segment_control_item_icon_get(const Evas_Object *obj, int index); + +/** + * Get the index of an item. + * + * @param it The segment control item. + * @return The position of item in segment control widget. + * + * Index is the position of an item in segment control widget. Its + * range is from @c 0 to count - 1 . + * Count is the number of items, that can be get with + * elm_segment_control_item_count_get(). + * + * @ingroup SegmentControl + */ +EAPI int elm_segment_control_item_index_get(const Elm_Object_Item *it); + +/** + * Get the base object of the item. + * + * @param it The segment control item. + * @return The base object associated with @p it. + * + * Base object is the @c Evas_Object that represents that item. + * + * @ingroup SegmentControl + */ +EAPI Evas_Object *elm_segment_control_item_object_get(const Elm_Object_Item *it); + +/** + * Get the selected item. + * + * @param obj The segment control object. + * @return The selected item or @c NULL if none of segment items is + * selected. + * + * The selected item can be unselected with function + * elm_segment_control_item_selected_set(). + * + * The selected item always will be highlighted on segment control. + * + * @ingroup SegmentControl + */ +EAPI Elm_Object_Item *elm_segment_control_item_selected_get(const Evas_Object *obj); + +/** + * Set the selected state of an item. + * + * @param it The segment control item + * @param select The selected state + * + * This sets the selected state of the given item @p it. + * @c EINA_TRUE for selected, @c EINA_FALSE for not selected. + * + * If a new item is selected the previously selected will be unselected. + * Selected item can be got with function + * elm_segment_control_item_selected_get(). + * + * The selected item always will be highlighted on segment control. + * + * @see elm_segment_control_item_selected_get() + * + * @ingroup SegmentControl + */ +EAPI void elm_segment_control_item_selected_set(Elm_Object_Item *it, Eina_Bool select); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_separator.c b/libraries/elementary/src/lib/elm_separator.c new file mode 100644 index 0000000..e852d5e --- /dev/null +++ b/libraries/elementary/src/lib/elm_separator.c @@ -0,0 +1,106 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *sep; + Eina_Bool horizontal; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); +static void _theme_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + free(wd); +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->sep, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + if (wd->horizontal) + _elm_theme_object_set(obj, wd->sep, "separator", "horizontal", elm_widget_style_get(obj)); + else + _elm_theme_object_set(obj, wd->sep, "separator", "vertical", elm_widget_style_get(obj)); + edje_object_scale_set(wd->sep, elm_widget_scale_get(obj) * _elm_config->scale); + _sizing_eval(obj); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; + if (!wd) return; + edje_object_size_min_calc(wd->sep, &minw, &minh); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, maxw, maxh); + evas_object_size_hint_align_set(obj, maxw, maxh); +} + +EAPI Evas_Object * +elm_separator_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "separator"); + wd->horizontal = EINA_FALSE; + elm_widget_type_set(obj, "separator"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); + + wd->sep = edje_object_add(e); + _elm_theme_object_set(obj, wd->sep, "separator", "vertical", "default"); + elm_widget_resize_object_set(obj, wd->sep); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _sizing_eval(obj); + return obj; +} + +EAPI void +elm_separator_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + horizontal = !!horizontal; + if (wd->horizontal == horizontal) return; + wd->horizontal = horizontal; + _theme_hook(obj); +} + +EAPI Eina_Bool +elm_separator_horizontal_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->horizontal; +} diff --git a/libraries/elementary/src/lib/elm_separator.h b/libraries/elementary/src/lib/elm_separator.h new file mode 100644 index 0000000..1bc02d9 --- /dev/null +++ b/libraries/elementary/src/lib/elm_separator.h @@ -0,0 +1,44 @@ +/** + * @defgroup Separator Separator + * @ingroup Elementary + * + * @brief Separator is a very thin object used to separate other objects. + * + * A separator can be vertical or horizontal. + * + * @ref tutorial_separator is a good example of how to use a separator. + * @{ + */ +/** + * @brief Add a separator object to @p parent + * + * @param parent The parent object + * + * @return The separator object, or NULL upon failure + * + * @ingroup Separator + */ +EAPI Evas_Object *elm_separator_add(Evas_Object *parent); +/** + * @brief Set the horizontal mode of a separator object + * + * @param obj The separator object + * @param horizontal If true, the separator is horizontal + * + * @ingroup Separator + */ +EAPI void elm_separator_horizontal_set(Evas_Object *obj, Eina_Bool horizontal); +/** + * @brief Get the horizontal mode of a separator object + * + * @param obj The separator object + * @return If true, the separator is horizontal + * + * @see elm_separator_horizontal_set() + * + * @ingroup Separator + */ +EAPI Eina_Bool elm_separator_horizontal_get(const Evas_Object *obj); +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_slider.c b/libraries/elementary/src/lib/elm_slider.c new file mode 100644 index 0000000..7221ea0 --- /dev/null +++ b/libraries/elementary/src/lib/elm_slider.c @@ -0,0 +1,1073 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *slider; + Evas_Object *icon; + Evas_Object *end; + Evas_Object *spacer; + + Ecore_Timer *delay; + + Eina_Hash *labels; + const char *units; + const char *indicator; + + char *(*indicator_format_func)(double val); + void (*indicator_format_free)(char *str); + + char *(*units_format_func)(double val); + void (*units_format_free)(char *str); + + double val, val_min, val_max, val2; + Evas_Coord size; + Evas_Coord downx, downy; + + Eina_Bool horizontal : 1; + Eina_Bool inverted : 1; + Eina_Bool indicator_show : 1; + Eina_Bool spacer_down : 1; + Eina_Bool frozen : 1; +}; + +#define ELM_SLIDER_INVERTED_FACTOR (-1.0) + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); +static void _theme_hook(Evas_Object *obj); +static void _disable_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _sub_del(void *data, Evas_Object *obj, void *event_info); +static void _units_set(Evas_Object *obj); +static void _val_set(Evas_Object *obj); +static void _indicator_set(Evas_Object *obj); +static void _on_focus_hook(void *data, Evas_Object *obj); +static void _drag_up(void *data, Evas_Object *obj, + const char *emission, const char *source); +static void _drag_down(void *data, Evas_Object *obj, + const char *emission, const char *source); +static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src, + Evas_Callback_Type type, void *event_info); +static void _spacer_down_cb(void *data, Evas * e, Evas_Object * obj, void *event_info); +static void _spacer_move_cb(void *data, Evas * e, Evas_Object * obj, void *event_info); +static void _spacer_up_cb(void *data, Evas * e, Evas_Object * obj, void *event_info); + +static const char SIG_CHANGED[] = "changed"; +static const char SIG_DELAY_CHANGED[] = "delay,changed"; +static const char SIG_DRAG_START[] = "slider,drag,start"; +static const char SIG_DRAG_STOP[] = "slider,drag,stop"; +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CHANGED, ""}, + {SIG_DELAY_CHANGED, ""}, + {SIG_DRAG_START, ""}, + {SIG_DRAG_STOP, ""}, + {NULL, NULL} +}; + +static Eina_Bool +_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info) +{ + Evas_Event_Mouse_Wheel *mev; + Evas_Event_Key_Down *ev; + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + if (type == EVAS_CALLBACK_KEY_DOWN) goto key_down; + else if (type != EVAS_CALLBACK_MOUSE_WHEEL) return EINA_FALSE; + + mev = event_info; + if (mev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; + if (elm_widget_disabled_get(obj)) return EINA_FALSE; + + if (mev->z < 0) _drag_up(obj, NULL, NULL, NULL); + else _drag_down(obj, NULL, NULL, NULL); + mev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + + key_down: + ev = event_info; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; + if (elm_widget_disabled_get(obj)) return EINA_FALSE; + if ((!strcmp(ev->keyname, "Left")) || + ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string))) + { + if (!wd->horizontal) return EINA_FALSE; + if (!wd->inverted) _drag_down(obj, NULL, NULL, NULL); + else _drag_up(obj, NULL, NULL, NULL); + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else if ((!strcmp(ev->keyname, "Right")) || + ((!strcmp(ev->keyname, "KP_Right")) && (!ev->string))) + { + if (!wd->horizontal) return EINA_FALSE; + if (!wd->inverted) _drag_up(obj, NULL, NULL, NULL); + else _drag_down(obj, NULL, NULL, NULL); + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else if ((!strcmp(ev->keyname, "Up")) || + ((!strcmp(ev->keyname, "KP_Up")) && (!ev->string))) + { + if (wd->horizontal) return EINA_FALSE; + if (wd->inverted) _drag_up(obj, NULL, NULL, NULL); + else _drag_down(obj, NULL, NULL, NULL); + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else if ((!strcmp(ev->keyname, "Down")) || + ((!strcmp(ev->keyname, "KP_Down")) && (!ev->string))) + { + if (wd->horizontal) return EINA_FALSE; + if (wd->inverted) _drag_down(obj, NULL, NULL, NULL); + else _drag_up(obj, NULL, NULL, NULL); + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else return EINA_FALSE; +} + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->labels) eina_hash_free(wd->labels); + if (wd->indicator) eina_stringshare_del(wd->units); + if (wd->delay) ecore_timer_del(wd->delay); + free(wd); +} + +static void +_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (elm_widget_focus_get(obj)) + { + edje_object_signal_emit(wd->slider, "elm,action,focus", "elm"); + evas_object_focus_set(wd->slider, EINA_TRUE); + } + else + { + edje_object_signal_emit(wd->slider, "elm,action,unfocus", "elm"); + evas_object_focus_set(wd->slider, EINA_FALSE); + } +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->slider, rtl); +} + +static Eina_Bool +_labels_foreach_text_set(const Eina_Hash *hash __UNUSED__, const void *key, void *data, void *fdata) +{ + Widget_Data *wd = fdata; + + edje_object_part_text_escaped_set(wd->slider, key, data); + + return 1; +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + if (wd->horizontal) + _elm_theme_object_set(obj, wd->slider, "slider", "horizontal", elm_widget_style_get(obj)); + else + _elm_theme_object_set(obj, wd->slider, "slider", "vertical", elm_widget_style_get(obj)); + if (wd->icon) + { + edje_object_part_swallow(wd->slider, "elm.swallow.content", wd->icon); + edje_object_signal_emit(wd->slider, "elm,state,icon,visible", "elm"); + } + if (wd->end) + edje_object_signal_emit(wd->slider, "elm,state,end,visible", "elm"); + else + edje_object_signal_emit(wd->slider, "elm,state,end,hidden", "elm"); + if (wd->labels) + { + eina_hash_foreach(wd->labels, _labels_foreach_text_set, wd); + edje_object_signal_emit(wd->slider, "elm,state,text,visible", "elm"); + } + + if (wd->units) + edje_object_signal_emit(wd->slider, "elm,state,units,visible", "elm"); + + if (wd->horizontal) + evas_object_size_hint_min_set(wd->spacer, (double)wd->size * elm_widget_scale_get(obj) * _elm_config->scale, 1); + else + evas_object_size_hint_min_set(wd->spacer, 1, (double)wd->size * elm_widget_scale_get(obj) * _elm_config->scale); + + if (wd->inverted) + edje_object_signal_emit(wd->slider, "elm,state,inverted,on", "elm"); + + edje_object_part_swallow(wd->slider, "elm.swallow.bar", wd->spacer); + _units_set(obj); + _indicator_set(obj); + edje_object_message_signal_process(wd->slider); + edje_object_scale_set(wd->slider, elm_widget_scale_get(obj) * _elm_config->scale); + _val_set(obj); + _sizing_eval(obj); +} + +static void +_disable_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (elm_widget_disabled_get(obj)) + edje_object_signal_emit(wd->slider, "elm,state,disabled", "elm"); + else + edje_object_signal_emit(wd->slider, "elm,state,enabled", "elm"); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; + if (!wd) return; + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + edje_object_size_min_restricted_calc(wd->slider, &minw, &minh, minw, minh); + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, maxw, maxh); +} + +static void +_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + if ((obj != wd->icon) && (obj != wd->end)) return; + _sizing_eval(data); +} + +static void +_sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *sub = event_info; + if (!wd) return; + if (sub == wd->icon) + { + edje_object_signal_emit(wd->slider, "elm,state,icon,hidden", "elm"); + evas_object_event_callback_del_full + (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj); + wd->icon = NULL; + edje_object_message_signal_process(wd->slider); + _sizing_eval(obj); + } + if (sub == wd->end) + { + edje_object_signal_emit(wd->slider, "elm,state,end,hidden", "elm"); + evas_object_event_callback_del_full(sub, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + wd->end = NULL; + edje_object_message_signal_process(wd->slider); + _sizing_eval(obj); + } +} + +static Eina_Bool +_delay_change(void *data) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return ECORE_CALLBACK_CANCEL; + wd->delay = NULL; + evas_object_smart_callback_call(data, SIG_DELAY_CHANGED, NULL); + return ECORE_CALLBACK_CANCEL; +} + +static void +_val_fetch(Evas_Object *obj) +{ + Eina_Bool rtl; + Widget_Data *wd = elm_widget_data_get(obj); + double posx = 0.0, posy = 0.0, pos = 0.0, val; + if (!wd) return; + edje_object_part_drag_value_get(wd->slider, "elm.dragable.slider", + &posx, &posy); + if (wd->horizontal) pos = posx; + else pos = posy; + + rtl = elm_widget_mirrored_get(obj); + if ((!rtl && wd->inverted) || (rtl && + ((!wd->horizontal && wd->inverted) || + (wd->horizontal && !wd->inverted)))) pos = 1.0 - pos; + val = (pos * (wd->val_max - wd->val_min)) + wd->val_min; + if (val != wd->val) + { + wd->val = val; + evas_object_smart_callback_call(obj, SIG_CHANGED, NULL); + if (wd->delay) ecore_timer_del(wd->delay); + wd->delay = ecore_timer_add(0.2, _delay_change, obj); + } +} + +static void +_val_set(Evas_Object *obj) +{ + Eina_Bool rtl; + Widget_Data *wd = elm_widget_data_get(obj); + double pos; + if (!wd) return; + if (wd->val_max > wd->val_min) + pos = (wd->val - wd->val_min) / (wd->val_max - wd->val_min); + else + pos = 0.0; + if (pos < 0.0) pos = 0.0; + else if (pos > 1.0) pos = 1.0; + + rtl = elm_widget_mirrored_get(obj); + if ((!rtl && wd->inverted) || (rtl && + ((!wd->horizontal && wd->inverted) || + (wd->horizontal && !wd->inverted)))) pos = 1.0 - pos; + edje_object_part_drag_value_set(wd->slider, "elm.dragable.slider", pos, pos); +} + +static void +_units_set(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->units_format_func) + { + char *buf; + buf = wd->units_format_func(wd->val); + edje_object_part_text_escaped_set(wd->slider, "elm.units", buf); + if (wd->units_format_free) wd->units_format_free(buf); + } + else if (wd->units) + { + char buf[1024]; + + snprintf(buf, sizeof(buf), wd->units, wd->val); + edje_object_part_text_escaped_set(wd->slider, "elm.units", buf); + } + else + edje_object_part_text_escaped_set(wd->slider, "elm.units", NULL); +} + +static void +_indicator_set(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->indicator_format_func) + { + char *buf; + buf = wd->indicator_format_func(wd->val); + edje_object_part_text_escaped_set(wd->slider, "elm.dragable.slider:elm.indicator", buf); + if (wd->indicator_format_free) wd->indicator_format_free(buf); + } + else if (wd->indicator) + { + char buf[1024]; + snprintf(buf, sizeof(buf), wd->indicator, wd->val); + edje_object_part_text_escaped_set(wd->slider, "elm.dragable.slider:elm.indicator", buf); + } + else + edje_object_part_text_escaped_set(wd->slider, "elm.dragable.slider:elm.indicator", NULL); +} + +static void +_drag(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + _val_fetch(data); + _units_set(data); + _indicator_set(data); +} + +static void +_drag_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + _val_fetch(data); + evas_object_smart_callback_call(data, SIG_DRAG_START, NULL); + _units_set(data); + _indicator_set(data); + elm_widget_scroll_freeze_push(data); +} + +static void +_drag_stop(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + _val_fetch(data); + evas_object_smart_callback_call(data, SIG_DRAG_STOP, NULL); + _units_set(data); + _indicator_set(data); + elm_widget_scroll_freeze_pop(data); +} + +static void +_drag_step(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + _val_fetch(data); + _units_set(data); + _indicator_set(data); +} + +static void +_drag_up(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + double step; + Widget_Data *wd; + + wd = elm_widget_data_get(data); + step = 0.05; + + if (wd->inverted) step *= ELM_SLIDER_INVERTED_FACTOR; + + edje_object_part_drag_step(wd->slider, "elm.dragable.slider", step, step); +} + +static void +_drag_down(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + double step; + Widget_Data *wd; + + wd = elm_widget_data_get(data); + step = -0.05; + + if (wd->inverted) step *= ELM_SLIDER_INVERTED_FACTOR; + + edje_object_part_drag_step(wd->slider, "elm.dragable.slider", step, step); +} + +static void +_spacer_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(data); + Evas_Event_Mouse_Down *ev = event_info; + Evas_Coord x, y, w, h; + double button_x = 0.0, button_y = 0.0; + + wd->spacer_down = EINA_TRUE; + wd->val2 = wd->val; + evas_object_geometry_get(wd->spacer, &x, &y, &w, &h); + wd->downx = ev->canvas.x - x; + wd->downy = ev->canvas.y - y; + if (wd->horizontal) + { + button_x = ((double)ev->canvas.x - (double)x) / (double)w; + if (button_x > 1) button_x = 1; + if (button_x < 0) button_x = 0; + } + else + { + button_y = ((double)ev->canvas.y - (double)y) / (double)h; + if (button_y > 1) button_y = 1; + if (button_y < 0) button_y = 0; + } + edje_object_part_drag_value_set(wd->slider, "elm.dragable.slider", button_x, button_y); + _val_fetch(data); + evas_object_smart_callback_call(data, SIG_DRAG_START, NULL); + _units_set(data); + _indicator_set(data); + edje_object_signal_emit(wd->slider, "elm,state,indicator,show", "elm"); +} + +static void +_spacer_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(data); + Evas_Event_Mouse_Move *ev = event_info; + Evas_Coord x, y, w, h; + double button_x = 0.0, button_y = 0.0; + + if (wd->spacer_down) + { + Evas_Coord d = 0; + + evas_object_geometry_get(wd->spacer, &x, &y, &w, &h); + if (wd->horizontal) d = abs(ev->cur.canvas.x - x - wd->downx); + else d = abs(ev->cur.canvas.y - y - wd->downy); + if (d > (_elm_config->thumbscroll_threshold - 1)) + { + if (!wd->frozen) + { + elm_widget_scroll_freeze_push(data); + wd->frozen = 1; + } + ev->event_flags &= ~EVAS_EVENT_FLAG_ON_HOLD; + } + + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) + { + if (wd->spacer_down) wd->spacer_down = EINA_FALSE; + _val_fetch(data); + evas_object_smart_callback_call(data, SIG_DRAG_STOP, NULL); + _units_set(data); + _indicator_set(data); + if (wd->frozen) + { + elm_widget_scroll_freeze_pop(data); + wd->frozen = 0; + } + edje_object_signal_emit(wd->slider, "elm,state,indicator,hide", "elm"); + elm_slider_value_set(data, wd->val2); + return; + } + if (wd->horizontal) + { + button_x = ((double)ev->cur.canvas.x - (double)x) / (double)w; + if (button_x > 1) button_x = 1; + if (button_x < 0) button_x = 0; + } + else + { + button_y = ((double)ev->cur.canvas.y - (double)y) / (double)h; + if (button_y > 1) button_y = 1; + if (button_y < 0) button_y = 0; + } + edje_object_part_drag_value_set(wd->slider, "elm.dragable.slider", button_x, button_y); + _val_fetch(data); + _units_set(data); + _indicator_set(data); + } +} + +static void +_spacer_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + + if (!wd->spacer_down) return; + if (wd->spacer_down) wd->spacer_down = EINA_FALSE; + _val_fetch(data); + evas_object_smart_callback_call(data, SIG_DRAG_STOP, NULL); + _units_set(data); + _indicator_set(data); + if (wd->frozen) + { + elm_widget_scroll_freeze_pop(data); + wd->frozen = 0; + } + edje_object_signal_emit(wd->slider, "elm,state,indicator,hide", "elm"); +} + +static void +_elm_slider_label_set(Evas_Object *obj, const char *part, const char *label) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + const char* default_part = "elm.text"; + const char* real_part; + + if (!wd) return; + + if (!part) + real_part = default_part; + else + real_part = part; + + if (wd->labels) + { + const char* old_label; + + old_label = eina_hash_find(wd->labels, real_part); + if (!old_label) + eina_hash_add(wd->labels, real_part, eina_stringshare_add(label)); + else + { + eina_stringshare_ref(old_label); + eina_hash_modify(wd->labels, real_part, eina_stringshare_add(label)); + eina_stringshare_del(old_label); + } + } + + if (label) + { + edje_object_signal_emit(wd->slider, "elm,state,text,visible", "elm"); + edje_object_message_signal_process(wd->slider); + } + else + { + edje_object_signal_emit(wd->slider, "elm,state,text,hidden", "elm"); + edje_object_message_signal_process(wd->slider); + } + + edje_object_part_text_escaped_set(wd->slider, real_part, label); + _sizing_eval(obj); +} + +static const char * +_elm_slider_label_get(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (!wd->labels) return NULL; + + if (!part) + return eina_hash_find(wd->labels, "elm.text"); + return eina_hash_find(wd->labels, part); +} + +static void +_icon_set(Evas_Object *obj, Evas_Object *icon) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->icon == icon) return; + if (wd->icon) evas_object_del(wd->icon); + wd->icon = icon; + if (icon) + { + elm_widget_sub_object_add(obj, icon); + evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + edje_object_part_swallow(wd->slider, "elm.swallow.icon", icon); + edje_object_signal_emit(wd->slider, "elm,state,icon,visible", "elm"); + edje_object_message_signal_process(wd->slider); + } + _sizing_eval(obj); +} + +static Evas_Object * +_icon_unset(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *ret = NULL; + if (!wd) return NULL; + if (wd->icon) + { + elm_widget_sub_object_del(obj, wd->icon); + evas_object_event_callback_del_full(wd->icon, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + ret = wd->icon; + edje_object_part_unswallow(wd->slider, wd->icon); + edje_object_signal_emit(wd->slider, "elm,state,icon,hidden", "elm"); + wd->icon = NULL; + _sizing_eval(obj); + } + return ret; +} + +static void +_end_set(Evas_Object *obj, Evas_Object *end) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->end == end) return; + if (wd->end) evas_object_del(wd->end); + wd->end = end; + if (end) + { + elm_widget_sub_object_add(obj, end); + evas_object_event_callback_add(end, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + edje_object_part_swallow(wd->slider, "elm.swallow.end", end); + edje_object_signal_emit(wd->slider, "elm,state,end,visible", "elm"); + edje_object_message_signal_process(wd->slider); + } + _sizing_eval(obj); +} + +static Evas_Object * +_end_unset(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *ret = NULL; + if (!wd) return NULL; + if (wd->end) + { + elm_widget_sub_object_del(obj, wd->end); + evas_object_event_callback_del_full(wd->end, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + ret = wd->end; + edje_object_part_unswallow(wd->slider, wd->end); + edje_object_signal_emit(wd->slider, "elm,state,end,hidden", "elm"); + wd->end = NULL; + _sizing_eval(obj); + } + return ret; +} + +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + if (!part || !strcmp(part, "icon")) + _icon_set(obj, content); + else if (!strcmp(part, "end")) + _end_set(obj, content); +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (!part || !strcmp(part, "icon")) + return wd->icon; + else if (!strcmp(part, "end")) + return wd->end; + return NULL; +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + if (!part || !strcmp(part, "icon")) + return _icon_unset(obj); + else if (!strcmp(part, "end")) + return _end_unset(obj); + return NULL; +} + +static void +_hash_labels_free_cb(void* label) +{ + if (label) + eina_stringshare_del(label); +} + +static void +_min_max_set(Evas_Object *obj) +{ + char *buf_min = NULL; + char *buf_max = NULL; + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->units_format_func) + { + buf_min = wd->units_format_func(wd->val_min); + buf_max = wd->units_format_func(wd->val_max); + } + else if (wd->units) + { + int length = strlen(wd->units); + + buf_min = alloca(length + 128); + buf_max = alloca(length + 128); + + snprintf((char*) buf_min, length + 128, wd->units, wd->val_min); + snprintf((char*) buf_max, length + 128, wd->units, wd->val_max); + } + + edje_object_part_text_escaped_set(wd->slider, "elm.units.min", buf_min); + edje_object_part_text_escaped_set(wd->slider, "elm.units.max", buf_max); + + if (wd->units_format_func && wd->units_format_free) + { + wd->units_format_free(buf_min); + wd->units_format_free(buf_max); + } +} + + +EAPI Evas_Object * +elm_slider_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "slider"); + elm_widget_type_set(obj, "slider"); + elm_widget_sub_object_add(parent, obj); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_disable_hook_set(obj, _disable_hook); + elm_widget_can_focus_set(obj, EINA_TRUE); + elm_widget_event_hook_set(obj, _event_hook); + elm_widget_text_set_hook_set(obj, _elm_slider_label_set); + elm_widget_text_get_hook_set(obj, _elm_slider_label_get); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); + + wd->horizontal = EINA_TRUE; + wd->indicator_show = EINA_TRUE; + wd->val = 0.0; + wd->val_min = 0.0; + wd->val_max = 1.0; + wd->labels = eina_hash_string_superfast_new(_hash_labels_free_cb); + + wd->slider = edje_object_add(e); + _elm_theme_object_set(obj, wd->slider, "slider", "horizontal", "default"); + elm_widget_resize_object_set(obj, wd->slider); + edje_object_signal_callback_add(wd->slider, "drag", "*", _drag, obj); + edje_object_signal_callback_add(wd->slider, "drag,start", "*", _drag_start, obj); + edje_object_signal_callback_add(wd->slider, "drag,stop", "*", _drag_stop, obj); + edje_object_signal_callback_add(wd->slider, "drag,step", "*", _drag_step, obj); + edje_object_signal_callback_add(wd->slider, "drag,page", "*", _drag_stop, obj); + // edje_object_signal_callback_add(wd->slider, "drag,set", "*", _drag_stop, obj); + edje_object_part_drag_value_set(wd->slider, "elm.dragable.slider", 0.0, 0.0); + + wd->spacer = evas_object_rectangle_add(e); + evas_object_color_set(wd->spacer, 0, 0, 0, 0); + evas_object_pass_events_set(wd->spacer, EINA_TRUE); + elm_widget_sub_object_add(obj, wd->spacer); + edje_object_part_swallow(wd->slider, "elm.swallow.bar", wd->spacer); + evas_object_event_callback_add(wd->spacer, EVAS_CALLBACK_MOUSE_DOWN, _spacer_down_cb, obj); + evas_object_event_callback_add(wd->spacer, EVAS_CALLBACK_MOUSE_MOVE, _spacer_move_cb, obj); + evas_object_event_callback_add(wd->spacer, EVAS_CALLBACK_MOUSE_UP, _spacer_up_cb, obj); + evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _sizing_eval(obj); + + // TODO: convert Elementary to subclassing of Evas_Smart_Class + // TODO: and save some bytes, making descriptions per-class and not instance! + evas_object_smart_callbacks_descriptions_set(obj, _signals); + return obj; +} + +EAPI void +elm_slider_span_size_set(Evas_Object *obj, Evas_Coord size) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->size == size) return; + wd->size = size; + if (wd->horizontal) + evas_object_size_hint_min_set(wd->spacer, (double)wd->size * elm_widget_scale_get(obj) * _elm_config->scale, 1); + else + evas_object_size_hint_min_set(wd->spacer, 1, (double)wd->size * elm_widget_scale_get(obj) * _elm_config->scale); + if (wd->indicator_show) + edje_object_signal_emit(wd->slider, "elm,state,val,show", "elm"); + else + edje_object_signal_emit(wd->slider, "elm,state,val,hide", "elm"); + edje_object_part_swallow(wd->slider, "elm.swallow.bar", wd->spacer); + _sizing_eval(obj); +} + +EAPI Evas_Coord +elm_slider_span_size_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; + return wd->size; +} + +EAPI void +elm_slider_unit_format_set(Evas_Object *obj, const char *units) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + eina_stringshare_replace(&wd->units, units); + if (units) + { + edje_object_signal_emit(wd->slider, "elm,state,units,visible", "elm"); + edje_object_message_signal_process(wd->slider); + } + else + { + edje_object_signal_emit(wd->slider, "elm,state,units,hidden", "elm"); + edje_object_message_signal_process(wd->slider); + } + _min_max_set(obj); + _units_set(obj); + _sizing_eval(obj); +} + +EAPI const char * +elm_slider_unit_format_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->units; +} + +EAPI void +elm_slider_indicator_format_set(Evas_Object *obj, const char *indicator) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + eina_stringshare_replace(&wd->indicator, indicator); + _indicator_set(obj); +} + +EAPI const char * +elm_slider_indicator_format_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->indicator; +} + +EAPI void +elm_slider_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + horizontal = !!horizontal; + if (wd->horizontal == horizontal) return; + wd->horizontal = horizontal; + _theme_hook(obj); +} + +EAPI Eina_Bool +elm_slider_horizontal_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->horizontal; +} + +EAPI void +elm_slider_min_max_set(Evas_Object *obj, double min, double max) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if ((wd->val_min == min) && (wd->val_max == max)) return; + wd->val_min = min; + wd->val_max = max; + if (wd->val < wd->val_min) wd->val = wd->val_min; + if (wd->val > wd->val_max) wd->val = wd->val_max; + _min_max_set(obj); + _val_set(obj); + _units_set(obj); + _indicator_set(obj); +} + +EAPI void +elm_slider_min_max_get(const Evas_Object *obj, double *min, double *max) +{ + if (min) *min = 0.0; + if (max) *max = 0.0; + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (min) *min = wd->val_min; + if (max) *max = wd->val_max; +} + +EAPI void +elm_slider_value_set(Evas_Object *obj, double val) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->val == val) return; + wd->val = val; + if (wd->val < wd->val_min) wd->val = wd->val_min; + if (wd->val > wd->val_max) wd->val = wd->val_max; + _val_set(obj); + _units_set(obj); + _indicator_set(obj); +} + +EAPI double +elm_slider_value_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0.0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0.0; + return wd->val; +} + +EAPI void +elm_slider_inverted_set(Evas_Object *obj, Eina_Bool inverted) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + inverted = !!inverted; + if (wd->inverted == inverted) return; + wd->inverted = inverted; + if (wd->inverted) + edje_object_signal_emit(wd->slider, "elm,state,inverted,on", "elm"); + else + edje_object_signal_emit(wd->slider, "elm,state,inverted,off", "elm"); + edje_object_message_signal_process(wd->slider); + _val_set(obj); + _units_set(obj); + _indicator_set(obj); +} + +EAPI Eina_Bool +elm_slider_inverted_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->inverted; +} + +EAPI void +elm_slider_indicator_format_function_set(Evas_Object *obj, char *(*func)(double val), void (*free_func)(char *str)) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->indicator_format_func = func; + wd->indicator_format_free = free_func; + _indicator_set(obj); +} + +EAPI void +elm_slider_units_format_function_set(Evas_Object *obj, char *(*func)(double val), void (*free_func)(char *str)) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->units_format_func = func; + wd->units_format_free = free_func; + _min_max_set(obj); + _units_set(obj); +} + +EAPI void +elm_slider_indicator_show_set(Evas_Object *obj, Eina_Bool show) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (show) { + wd->indicator_show = EINA_TRUE; + edje_object_signal_emit(wd->slider, "elm,state,val,show", "elm"); + } + else { + wd->indicator_show = EINA_FALSE; + edje_object_signal_emit(wd->slider, "elm,state,val,hide", "elm"); + } +} + +EAPI Eina_Bool +elm_slider_indicator_show_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->indicator_show; +} + diff --git a/libraries/elementary/src/lib/elm_slider.h b/libraries/elementary/src/lib/elm_slider.h new file mode 100644 index 0000000..5375aaf --- /dev/null +++ b/libraries/elementary/src/lib/elm_slider.h @@ -0,0 +1,400 @@ +/** + * @defgroup Slider Slider + * @ingroup Elementary + * + * @image html img/widget/slider/preview-00.png + * @image latex img/widget/slider/preview-00.eps width=\textwidth + * + * The slider adds a draggable “slider” widget for selecting the value of + * something within a range. + * + * A slider can be horizontal or vertical. It can contain an Icon and has a + * primary label as well as a units label (that is formatted with floating + * point values and thus accepts a printf-style format string, like + * “%1.2f units”. There is also an indicator string that may be somewhere + * else (like on the slider itself) that also accepts a format string like + * units. Label, Icon Unit and Indicator strings/objects are optional. + * + * A slider may be inverted which means values invert, with high vales being + * on the left or top and low values on the right or bottom (as opposed to + * normally being low on the left or top and high on the bottom and right). + * + * The slider should have its minimum and maximum values set by the + * application with elm_slider_min_max_set() and value should also be set by + * the application before use with elm_slider_value_set(). The span of the + * slider is its length (horizontally or vertically). This will be scaled by + * the object or applications scaling factor. At any point code can query the + * slider for its value with elm_slider_value_get(). + * + * Smart callbacks one can listen to: + * - "changed" - Whenever the slider value is changed by the user. + * - "slider,drag,start" - dragging the slider indicator around has started. + * - "slider,drag,stop" - dragging the slider indicator around has stopped. + * - "delay,changed" - A short time after the value is changed by the user. + * This will be called only when the user stops dragging for + * a very short period or when they release their + * finger/mouse, so it avoids possibly expensive reactions to + * the value change. + * + * Available styles for it: + * - @c "default" + * + * Default content parts of the slider widget that you can use for are: + * @li "icon" - An icon of the slider + * @li "end" - A end part content of the slider + * + * Default text parts of the slider widget that you can use for are: + * @li "default" - Label of the slider + * + * Supported elm_object common APIs. + * @li @ref elm_object_disabled_set + * @li @ref elm_object_disabled_get + * @li @ref elm_object_part_text_set + * @li @ref elm_object_part_text_get + * @li @ref elm_object_part_content_set + * @li @ref elm_object_part_content_get + * @li @ref elm_object_part_content_unset + * + * Here is an example on its usage: + * @li @ref slider_example + */ + +/** + * @addtogroup Slider + * @{ + */ + +/** + * Add a new slider widget to the given parent Elementary + * (container) object. + * + * @param parent The parent object. + * @return a new slider widget handle or @c NULL, on errors. + * + * This function inserts a new slider widget on the canvas. + * + * @ingroup Slider + */ +EAPI Evas_Object *elm_slider_add(Evas_Object *parent); + +/** + * Set the (exact) length of the bar region of a given slider widget. + * + * @param obj The slider object. + * @param size The length of the slider's bar region. + * + * This sets the minimum width (when in horizontal mode) or height + * (when in vertical mode) of the actual bar area of the slider + * @p obj. This in turn affects the object's minimum size. Use + * this when you're not setting other size hints expanding on the + * given direction (like weight and alignment hints) and you would + * like it to have a specific size. + * + * @note Icon, end, label, indicator and unit text around @p obj + * will require their + * own space, which will make @p obj to require more the @p size, + * actually. + * + * @see elm_slider_span_size_get() + * + * @ingroup Slider + */ +EAPI void elm_slider_span_size_set(Evas_Object *obj, Evas_Coord size); + +/** + * Get the length set for the bar region of a given slider widget + * + * @param obj The slider object. + * @return The length of the slider's bar region. + * + * If that size was not set previously, with + * elm_slider_span_size_set(), this call will return @c 0. + * + * @ingroup Slider + */ +EAPI Evas_Coord elm_slider_span_size_get(const Evas_Object *obj); + +/** + * Set the format string for the unit label. + * + * @param obj The slider object. + * @param format The format string for the unit display. + * + * Unit label is displayed all the time, if set, after slider's bar. + * In horizontal mode, at right and in vertical mode, at bottom. + * + * If @c NULL, unit label won't be visible. If not it sets the format + * string for the label text. To the label text is provided a floating point + * value, so the label text can display up to 1 floating point value. + * Note that this is optional. + * + * Use a format string such as "%1.2f meters" for example, and it will + * display values like: "3.14 meters" for a value equal to 3.14159. + * + * Default is unit label disabled. + * + * @see elm_slider_indicator_format_get() + * + * @ingroup Slider + */ +EAPI void elm_slider_unit_format_set(Evas_Object *obj, const char *format); + +/** + * Get the unit label format of the slider. + * + * @param obj The slider object. + * @return The unit label format string in UTF-8. + * + * Unit label is displayed all the time, if set, after slider's bar. + * In horizontal mode, at right and in vertical mode, at bottom. + * + * @see elm_slider_unit_format_set() for more + * information on how this works. + * + * @ingroup Slider + */ +EAPI const char *elm_slider_unit_format_get(const Evas_Object *obj); + +/** + * Set the format string for the indicator label. + * + * @param obj The slider object. + * @param indicator The format string for the indicator display. + * + * The slider may display its value somewhere else then unit label, + * for example, above the slider knob that is dragged around. This function + * sets the format string used for this. + * + * If @c NULL, indicator label won't be visible. If not it sets the format + * string for the label text. To the label text is provided a floating point + * value, so the label text can display up to 1 floating point value. + * Note that this is optional. + * + * Use a format string such as "%1.2f meters" for example, and it will + * display values like: "3.14 meters" for a value equal to 3.14159. + * + * Default is indicator label disabled. + * + * @see elm_slider_indicator_format_get() + * + * @ingroup Slider + */ +EAPI void elm_slider_indicator_format_set(Evas_Object *obj, const char *indicator); + +/** + * Get the indicator label format of the slider. + * + * @param obj The slider object. + * @return The indicator label format string in UTF-8. + * + * The slider may display its value somewhere else then unit label, + * for example, above the slider knob that is dragged around. This function + * gets the format string used for this. + * + * @see elm_slider_indicator_format_set() for more + * information on how this works. + * + * @ingroup Slider + */ +EAPI const char *elm_slider_indicator_format_get(const Evas_Object *obj); + +/** + * Set the format function pointer for the indicator label + * + * @param obj The slider object. + * @param func The indicator format function. + * @param free_func The freeing function for the format string. + * + * Set the callback function to format the indicator string. + * + * @see elm_slider_indicator_format_set() for more info on how this works. + * + * @ingroup Slider + */ +EAPI void elm_slider_indicator_format_function_set(Evas_Object *obj, char *(*func)(double val), void (*free_func)(char *str)); + +/** + * Set the format function pointer for the units label + * + * @param obj The slider object. + * @param func The units format function. + * @param free_func The freeing function for the format string. + * + * Set the callback function to format the indicator string. + * + * @see elm_slider_units_format_set() for more info on how this works. + * + * @ingroup Slider + */ +EAPI void elm_slider_units_format_function_set(Evas_Object *obj, char *(*func)(double val), void (*free_func)(char *str)); + +/** + * Set the orientation of a given slider widget. + * + * @param obj The slider object. + * @param horizontal Use @c EINA_TRUE to make @p obj to be + * @b horizontal, @c EINA_FALSE to make it @b vertical. + * + * Use this function to change how your slider is to be + * disposed: vertically or horizontally. + * + * By default it's displayed horizontally. + * + * @see elm_slider_horizontal_get() + * + * @ingroup Slider + */ +EAPI void elm_slider_horizontal_set(Evas_Object *obj, Eina_Bool horizontal); + +/** + * Retrieve the orientation of a given slider widget + * + * @param obj The slider object. + * @return @c EINA_TRUE, if @p obj is set to be @b horizontal, + * @c EINA_FALSE if it's @b vertical (and on errors). + * + * @see elm_slider_horizontal_set() for more details. + * + * @ingroup Slider + */ +EAPI Eina_Bool elm_slider_horizontal_get(const Evas_Object *obj); + +/** + * Set the minimum and maximum values for the slider. + * + * @param obj The slider object. + * @param min The minimum value. + * @param max The maximum value. + * + * Define the allowed range of values to be selected by the user. + * + * If actual value is less than @p min, it will be updated to @p min. If it + * is bigger then @p max, will be updated to @p max. Actual value can be + * get with elm_slider_value_get(). + * + * By default, min is equal to 0.0, and max is equal to 1.0. + * + * @warning Maximum must be greater than minimum, otherwise behavior + * is undefined. + * + * @see elm_slider_min_max_get() + * + * @ingroup Slider + */ +EAPI void elm_slider_min_max_set(Evas_Object *obj, double min, double max); + +/** + * Get the minimum and maximum values of the slider. + * + * @param obj The slider object. + * @param min Pointer to store the minimum value. + * @param max Pointer to store the maximum value. + * + * @note If only one value is needed, the other pointer can be passed + * as @c NULL. + * + * @see elm_slider_min_max_set() for details. + * + * @ingroup Slider + */ +EAPI void elm_slider_min_max_get(const Evas_Object *obj, double *min, double *max); + +/** + * Set the value the slider displays. + * + * @param obj The slider object. + * @param val The value to be displayed. + * + * Value will be presented on the unit label following format specified with + * elm_slider_unit_format_set() and on indicator with + * elm_slider_indicator_format_set(). + * + * @warning The value must to be between min and max values. This values + * are set by elm_slider_min_max_set(). + * + * @see elm_slider_value_get() + * @see elm_slider_unit_format_set() + * @see elm_slider_indicator_format_set() + * @see elm_slider_min_max_set() + * + * @ingroup Slider + */ +EAPI void elm_slider_value_set(Evas_Object *obj, double val); + +/** + * Get the value displayed by the spinner. + * + * @param obj The spinner object. + * @return The value displayed. + * + * @see elm_spinner_value_set() for details. + * + * @ingroup Slider + */ +EAPI double elm_slider_value_get(const Evas_Object *obj); + +/** + * Invert a given slider widget's displaying values order + * + * @param obj The slider object. + * @param inverted Use @c EINA_TRUE to make @p obj inverted, + * @c EINA_FALSE to bring it back to default, non-inverted values. + * + * A slider may be @b inverted, in which state it gets its + * values inverted, with high vales being on the left or top and + * low values on the right or bottom, as opposed to normally have + * the low values on the former and high values on the latter, + * respectively, for horizontal and vertical modes. + * + * @see elm_slider_inverted_get() + * + * @ingroup Slider + */ +EAPI void elm_slider_inverted_set(Evas_Object *obj, Eina_Bool inverted); + +/** + * Get whether a given slider widget's displaying values are + * inverted or not. + * + * @param obj The slider object. + * @return @c EINA_TRUE, if @p obj has inverted values, + * @c EINA_FALSE otherwise (and on errors). + * + * @see elm_slider_inverted_set() for more details. + * + * @ingroup Slider + */ +EAPI Eina_Bool elm_slider_inverted_get(const Evas_Object *obj); + +/** + * Set whether to enlarge slider indicator (augmented knob) or not. + * + * @param obj The slider object. + * @param show @c EINA_TRUE will make it enlarge, @c EINA_FALSE will + * let the knob always at default size. + * + * By default, indicator will be bigger while dragged by the user. + * + * @warning It won't display values set with + * elm_slider_indicator_format_set() if you disable indicator. + * + * @ingroup Slider + */ +EAPI void elm_slider_indicator_show_set(Evas_Object *obj, Eina_Bool show); + +/** + * Get whether a given slider widget's enlarging indicator or not. + * + * @param obj The slider object. + * @return @c EINA_TRUE, if @p obj is enlarging indicator, or + * @c EINA_FALSE otherwise (and on errors). + * + * @see elm_slider_indicator_show_set() for details. + * + * @ingroup Slider + */ +EAPI Eina_Bool elm_slider_indicator_show_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_slideshow.c b/libraries/elementary/src/lib/elm_slideshow.c new file mode 100644 index 0000000..08aa142 --- /dev/null +++ b/libraries/elementary/src/lib/elm_slideshow.c @@ -0,0 +1,776 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; +typedef struct _Elm_Slideshow_Item Elm_Slideshow_Item; + +struct _Elm_Slideshow_Item +{ + ELM_WIDGET_ITEM; + + Eina_List *l, *l_built; + + const Elm_Slideshow_Item_Class *itc; +}; + +struct _Widget_Data +{ + Evas_Object *slideshow; + + // list of Elm_Slideshow_Item* + Eina_List *items; + Eina_List *items_built; + + Elm_Slideshow_Item *current; + Elm_Slideshow_Item *previous; + + Eina_List *transitions; + const char *transition; + + int count_item_pre_before; + int count_item_pre_after; + Ecore_Timer *timer; + double timeout; + Eina_Bool loop:1; + + struct + { + const char *current; + Eina_List *list; //list of const char * + } layout; +}; + +static const char *widtype = NULL; +static void _del_pre_hook(Evas_Object *obj); +static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); +static void _theme_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); +static Eina_Bool _timer_cb(void *data); +static void _on_focus_hook(void *data, Evas_Object *obj); +static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src, + Evas_Callback_Type type, void *event_info); + +static const char SIG_CHANGED[] = "changed"; +static const char SIG_TRANSITION_END[] = "transition,end"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CHANGED, ""}, + {SIG_TRANSITION_END, ""}, + {NULL, NULL} +}; + +static Eina_Bool +_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info) +{ + if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE; + Evas_Event_Key_Down *ev = event_info; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; + if (elm_widget_disabled_get(obj)) return EINA_FALSE; + if ((!strcmp(ev->keyname, "Left")) || + ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string))) + { + elm_slideshow_previous(obj); + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + if ((!strcmp(ev->keyname, "Right")) || + ((!strcmp(ev->keyname, "KP_Right")) && (!ev->string))) + { + elm_slideshow_next(obj); + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + if ((!strcmp(ev->keyname, "Return")) || + (!strcmp(ev->keyname, "KP_Enter")) || + (!strcmp(ev->keyname, "space"))) + { + if (wd->timeout) + { + if (wd->timer) + { + ecore_timer_del(wd->timer); + wd->timer = NULL; + } + else + elm_slideshow_timeout_set(obj, wd->timeout); + } + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + return EINA_FALSE; +} + +static void +_del_pre_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); +} + +static void +_del_hook(Evas_Object *obj) +{ + const char *layout; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_slideshow_clear(obj); + elm_widget_stringlist_free(wd->transitions); + if (wd->timer) ecore_timer_del(wd->timer); + EINA_LIST_FREE(wd->layout.list, layout) + eina_stringshare_del(layout); + free(wd); +} + +static void +_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (elm_widget_focus_get(obj)) + { + edje_object_signal_emit(wd->slideshow, "elm,action,focus", "elm"); + evas_object_focus_set(wd->slideshow, EINA_TRUE); + } + else + { + edje_object_signal_emit(wd->slideshow, "elm,action,unfocus", "elm"); + evas_object_focus_set(wd->slideshow, EINA_FALSE); + } +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->slideshow, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _elm_theme_object_set(obj, wd->slideshow, "slideshow", "base", elm_widget_style_get(obj)); + edje_object_scale_set(wd->slideshow, elm_widget_scale_get(obj) * + _elm_config->scale); + _sizing_eval(obj); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1; + if (!wd) return; + edje_object_size_min_calc(wd->slideshow, &minw, &minh); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, minw, minh); +} + + +static Elm_Slideshow_Item* _item_prev_get(Elm_Slideshow_Item* item) +{ + Widget_Data *wd = elm_widget_data_get(WIDGET(item)); + Elm_Slideshow_Item* prev = eina_list_data_get(eina_list_prev(item->l)); + if ((!prev) && (wd->loop)) + prev = eina_list_data_get(eina_list_last(item->l)); + return prev; +} + +static Elm_Slideshow_Item* _item_next_get(Elm_Slideshow_Item* item) +{ + Widget_Data *wd = elm_widget_data_get(WIDGET(item)); + Elm_Slideshow_Item* next = eina_list_data_get(eina_list_next(item->l)); + if ((!next) && (wd->loop)) + next = eina_list_data_get(wd->items); + return next; +} + +static void +_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _sizing_eval(data); +} + +static void +_sub_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + ; +} + +static void +_item_realize(Elm_Slideshow_Item *item) +{ + Elm_Slideshow_Item *_item_prev, *_item_next; + Evas_Object *obj = WIDGET(item); + Widget_Data *wd = elm_widget_data_get(obj); + int ac, bc, lc, ic = 0; + + if (!wd) return; + if ((!VIEW(item)) && (item->itc->func.get)) + { + VIEW(item) = item->itc->func.get(elm_widget_item_data_get(item), + obj); + evas_object_smart_member_add(VIEW(item), obj); + item->l_built = eina_list_append(NULL, item); + wd->items_built = eina_list_merge(wd->items_built, item->l_built); + //FIXME: item could be showed by obj + evas_object_hide(VIEW(item)); + } + else if (item->l_built) + wd->items_built = eina_list_demote_list(wd->items_built, item->l_built); + + //pre-create previous and next item + ac = wd->count_item_pre_after; + _item_next = item; + bc = wd->count_item_pre_before; + _item_prev = item; + lc = eina_list_count(wd->items) - 1; + while (lc > 0 && ((ac > 0) || (bc > 0))) + { + if (lc > 0 && ac > 0) + { + --ac; + --lc; + if (_item_next) + { + _item_next = _item_next_get(_item_next); + if ((_item_next) + && (!VIEW(_item_next)) + && (_item_next->itc->func.get)) + { + ic++; + VIEW(_item_next) = + _item_next->itc->func.get( + elm_widget_item_data_get(_item_next), obj); + evas_object_smart_member_add(VIEW(_item_next), obj); + _item_next->l_built = eina_list_append(NULL, _item_next); + wd->items_built = eina_list_merge(wd->items_built, + _item_next->l_built); + //FIXME: _item_next could be showed by obj later + evas_object_hide(VIEW(_item_next)); + } + else if (_item_next && _item_next->l_built) + { + ic++; + wd->items_built = + eina_list_demote_list(wd->items_built, + _item_next->l_built); + } + } + } + + if (lc > 0 && bc > 0) + { + --bc; + --lc; + if (_item_prev) + { + _item_prev = _item_prev_get(_item_prev); + if ((_item_prev) + && (!VIEW(_item_prev)) + && (_item_prev->itc->func.get)) + { + ic++; + VIEW(_item_prev) = + _item_prev->itc->func.get( + elm_widget_item_data_get(_item_prev), obj); + evas_object_smart_member_add(VIEW(_item_prev), obj); + _item_prev->l_built = eina_list_append(NULL, _item_prev); + wd->items_built = eina_list_merge(wd->items_built, + _item_prev->l_built); + //FIXME: _item_prev could be showed by obj later + evas_object_hide(VIEW(_item_prev)); + } + else if (_item_prev && _item_prev->l_built) + { + ic++; + wd->items_built = + eina_list_demote_list(wd->items_built, + _item_prev->l_built); + } + } + } + } + + //delete unused items + lc = ic + 1; + while ((int)eina_list_count(wd->items_built) > lc) + { + item = eina_list_data_get(wd->items_built); + wd->items_built = eina_list_remove_list(wd->items_built, + wd->items_built); + if (item->itc->func.del) + item->itc->func.del(elm_widget_item_data_get(item), VIEW(item)); + evas_object_del(VIEW(item)); + VIEW(item) = NULL; + } +} + +static void +_end(void *data, Evas_Object *obj __UNUSED__, const char *emission, const char *source __UNUSED__) +{ + Elm_Slideshow_Item *item; + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + + item = wd->previous; + if (item) + { + edje_object_part_unswallow(wd->slideshow, VIEW(item)); + evas_object_hide(VIEW(item)); + wd->previous = NULL; + } + + item = wd->current; + if ((!item) || (!VIEW(item))) return; + + _item_realize(item); + edje_object_part_unswallow(wd->slideshow, VIEW(item)); + + edje_object_part_swallow(wd->slideshow, "elm.swallow.1", VIEW(item)); + edje_object_signal_emit(wd->slideshow, "anim,end", "slideshow"); + if (emission != NULL) + evas_object_smart_callback_call(data, SIG_TRANSITION_END, wd->current); +} + +static Eina_Bool +_timer_cb(void *data) +{ + Evas_Object *obj = data; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return ECORE_CALLBACK_CANCEL; + wd->timer = NULL; + elm_slideshow_next(obj); + return ECORE_CALLBACK_CANCEL; +} + +static Eina_Bool +_item_del_pre_hook(Elm_Object_Item *it) +{ + Elm_Slideshow_Item *item = (Elm_Slideshow_Item *)it; + Widget_Data *wd = elm_widget_data_get(WIDGET(item)); + if (!wd) return EINA_FALSE; + + if (wd->previous == item) wd->previous = NULL; + if (wd->current == item) + { + Eina_List *l = eina_list_data_find_list(wd->items, item); + Eina_List *l2 = eina_list_next(l); + wd->current = NULL; + if (!l2) + { + l2 = eina_list_prev(l); + if (l2) + elm_slideshow_item_show(eina_list_data_get(l2)); + + } + else + elm_slideshow_item_show(eina_list_data_get(l2)); + } + + wd->items = eina_list_remove_list(wd->items, item->l); + wd->items_built = eina_list_remove_list(wd->items_built, item->l_built); + + if ((VIEW(item)) && (item->itc->func.del)) + item->itc->func.del(elm_widget_item_data_get(item), VIEW(item)); + + return EINA_TRUE; +} + +EAPI Evas_Object * +elm_slideshow_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "slideshow"); + elm_widget_type_set(obj, "slideshow"); + elm_widget_sub_object_add(parent, obj); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_data_set(obj, wd); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_can_focus_set(obj, EINA_TRUE); + elm_widget_event_hook_set(obj, _event_hook); + + wd->current = NULL; + wd->previous = NULL; + + wd->slideshow = edje_object_add(e); + _elm_theme_object_set(obj, wd->slideshow, "slideshow", "base", "default"); + wd->count_item_pre_before = 2; + wd->count_item_pre_after = 2; + elm_widget_resize_object_set(obj, wd->slideshow); + + wd->transitions = elm_widget_stringlist_get(edje_object_data_get(wd->slideshow, "transitions")); + if (eina_list_count(wd->transitions) > 0) + wd->transition = eina_stringshare_add(eina_list_data_get(wd->transitions)); + + wd->layout.list = elm_widget_stringlist_get(edje_object_data_get(wd->slideshow, "layouts")); + if (eina_list_count(wd->layout.list) > 0) + wd->layout.current = eina_list_data_get(wd->layout.list); + + edje_object_signal_callback_add(wd->slideshow, "end", "slideshow", _end, obj); + + evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + evas_object_event_callback_add(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj); + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _sizing_eval(obj); + return obj; +} + +EAPI Elm_Object_Item* +elm_slideshow_item_add(Evas_Object *obj, const Elm_Slideshow_Item_Class *itc, const void *data) +{ + Elm_Slideshow_Item *item; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return NULL; + item = elm_widget_item_new(obj, Elm_Slideshow_Item); + if (!item) return NULL; + elm_widget_item_del_pre_hook_set(item, _item_del_pre_hook); + item->itc = itc; + item->l = eina_list_append(item->l, item); + elm_widget_item_data_set(item, data); + + wd->items = eina_list_merge(wd->items, item->l); + + if (!wd->current) elm_slideshow_item_show((Elm_Object_Item *)item); + + return (Elm_Object_Item *)item; +} + +EAPI Elm_Object_Item* +elm_slideshow_item_sorted_insert(Evas_Object *obj, const Elm_Slideshow_Item_Class *itc, const void *data, Eina_Compare_Cb func) +{ + Elm_Slideshow_Item *item; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + item = elm_widget_item_new(obj, Elm_Slideshow_Item); + if (!item) return NULL; + elm_widget_item_del_pre_hook_set(item, _item_del_pre_hook); + item->itc = itc; + item->l = eina_list_append(item->l, item); + elm_widget_item_data_set(item, data); + + wd->items = eina_list_sorted_merge(wd->items, item->l, func); + + if (!wd->current) elm_slideshow_item_show((Elm_Object_Item *)item); + + return (Elm_Object_Item *)item; +} + +EAPI void +elm_slideshow_item_show(Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + + char buf[1024]; + Elm_Slideshow_Item *item, *next = NULL; + Widget_Data *wd; + item = (Elm_Slideshow_Item *)it; + wd = elm_widget_data_get(WIDGET(item)); + if (!wd) return; + if (item == wd->current) return; + + next = item; + _end(WIDGET(item), WIDGET(item), NULL, NULL); + + if (wd->timer) ecore_timer_del(wd->timer); + wd->timer = NULL; + if (wd->timeout > 0.0) + wd->timer = ecore_timer_add(wd->timeout, _timer_cb, WIDGET(item)); + _item_realize(next); + edje_object_part_swallow(wd->slideshow, "elm.swallow.2", VIEW(next)); + snprintf(buf, sizeof(buf), "%s,next", wd->transition); + edje_object_signal_emit(wd->slideshow, buf, "slideshow"); + wd->previous = wd->current; + wd->current = next; + evas_object_smart_callback_call(WIDGET(item), SIG_CHANGED, wd->current); +} + +EAPI void +elm_slideshow_next(Evas_Object *obj) +{ + char buf[1024]; + Elm_Slideshow_Item *next = NULL; + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + + if (wd->current) + next = _item_next_get(wd->current); + + if ((!next) || (next == wd->current)) return; + + _end(obj, obj, NULL, NULL); + + if (wd->timer) ecore_timer_del(wd->timer); + wd->timer = NULL; + if (wd->timeout > 0.0) + wd->timer = ecore_timer_add(wd->timeout, _timer_cb, obj); + + _item_realize(next); + + edje_object_part_swallow(wd->slideshow, "elm.swallow.2", VIEW(next)); + + snprintf(buf, sizeof(buf), "%s,next", wd->transition); + edje_object_signal_emit(wd->slideshow, buf, "slideshow"); + + wd->previous = wd->current; + wd->current = next; + evas_object_smart_callback_call(obj, SIG_CHANGED, wd->current); +} + +EAPI void +elm_slideshow_previous(Evas_Object *obj) +{ + char buf[1024]; + Elm_Slideshow_Item *prev = NULL; + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + + if (wd->current) + prev = _item_prev_get(wd->current); + + if ((!prev) || (prev == wd->current)) return; + + _end(obj, obj, NULL, NULL); + + if (wd->timer) ecore_timer_del(wd->timer); + wd->timer = NULL; + if (wd->timeout > 0.0) + wd->timer = ecore_timer_add(wd->timeout, _timer_cb, obj); + + _item_realize(prev); + + edje_object_part_swallow(wd->slideshow, "elm.swallow.2", VIEW(prev)); + + snprintf(buf, 1024, "%s,previous", wd->transition); + edje_object_signal_emit(wd->slideshow, buf, "slideshow"); + + wd->previous = wd->current; + wd->current = prev; + evas_object_smart_callback_call(obj, SIG_CHANGED, wd->current); +} + +EAPI const Eina_List * +elm_slideshow_transitions_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->transitions; +} + +EAPI const Eina_List * +elm_slideshow_layouts_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->layout.list; +} + +EAPI void +elm_slideshow_transition_set(Evas_Object *obj, const char *transition) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + eina_stringshare_replace(&wd->transition, transition); +} + +EAPI const char * +elm_slideshow_transition_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->transition; +} + +EAPI void +elm_slideshow_timeout_set(Evas_Object *obj, double timeout) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->timeout = timeout; + if (wd->timer) ecore_timer_del(wd->timer); + wd->timer = NULL; + if (timeout > 0.0) + wd->timer = ecore_timer_add(timeout, _timer_cb, obj); +} + +EAPI double +elm_slideshow_timeout_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) -1.0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return -1.0; + return wd->timeout; +} + +EAPI void +elm_slideshow_loop_set(Evas_Object *obj, Eina_Bool loop) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->loop = loop; +} + +EAPI const char * +elm_slideshow_layout_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->layout.current; +} + +EAPI void +elm_slideshow_layout_set(Evas_Object *obj, const char *layout) +{ + char buf[PATH_MAX]; + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + wd->layout.current = layout; + snprintf(buf, sizeof(buf), "layout,%s", layout); + edje_object_signal_emit(wd->slideshow, buf, "slideshow"); +} + +EAPI Eina_Bool +elm_slideshow_loop_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->loop; +} + +EAPI void +elm_slideshow_clear(Evas_Object *obj) +{ + Elm_Slideshow_Item *item; + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->previous = NULL; + wd->current = NULL; + EINA_LIST_FREE(wd->items_built, item) + { + if (item->itc->func.del) + item->itc->func.del(elm_widget_item_data_get(item), VIEW(item)); + } + + EINA_LIST_FREE(wd->items, item) + elm_widget_item_free(item); +} + +EAPI const Eina_List * +elm_slideshow_items_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->items; +} + +EAPI Elm_Object_Item * +elm_slideshow_item_current_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return (Elm_Object_Item *) wd->current; +} + +EAPI Evas_Object * +elm_slideshow_item_object_get(const Elm_Object_Item * it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + return VIEW(it); +} + +EAPI int +elm_slideshow_cache_before_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) -1; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return -1; + return wd->count_item_pre_before; +} + +EAPI void +elm_slideshow_cache_before_set(Evas_Object *obj, int count) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (count < 0) count = 0; + wd->count_item_pre_before = count; +} + +EAPI int +elm_slideshow_cache_after_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) -1; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return -1; + return wd->count_item_pre_after; +} + +EAPI void +elm_slideshow_cache_after_set(Evas_Object *obj, int count) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (count < 0) count = 0; + wd->count_item_pre_after = count; +} + +EAPI Elm_Object_Item * +elm_slideshow_item_nth_get(const Evas_Object *obj, unsigned int nth) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return eina_list_nth(wd->items, nth); +} + +EAPI unsigned int +elm_slideshow_count_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; + return eina_list_count(wd->items); +} diff --git a/libraries/elementary/src/lib/elm_slideshow.h b/libraries/elementary/src/lib/elm_slideshow.h new file mode 100644 index 0000000..546b002 --- /dev/null +++ b/libraries/elementary/src/lib/elm_slideshow.h @@ -0,0 +1,546 @@ +/** + * @defgroup Slideshow Slideshow + * @ingroup Elementary + * + * @image html img/widget/slideshow/preview-00.png + * @image latex img/widget/slideshow/preview-00.eps + * + * This widget, as the name indicates, is a pre-made image + * slideshow panel, with API functions acting on (child) image + * items presentation. Between those actions, are: + * - advance to next/previous image + * - select the style of image transition animation + * - set the exhibition time for each image + * - start/stop the slideshow + * + * The transition animations are defined in the widget's theme, + * consequently new animations can be added without having to + * update the widget's code. + * + * @section Slideshow_Items Slideshow items + * + * For slideshow items, just like for @ref Genlist "genlist" ones, + * the user defines a @b classes, specifying functions that will be + * called on the item's creation and deletion times. + * + * The #Elm_Slideshow_Item_Class structure contains the following + * members: + * + * - @c func.get - When an item is displayed, this function is + * called, and it's where one should create the item object, de + * facto. For example, the object can be a pure Evas image object + * or an Elementary @ref Photocam "photocam" widget. See + * #SlideshowItemGetFunc. + * - @c func.del - When an item is no more displayed, this function + * is called, where the user must delete any data associated to + * the item. See #SlideshowItemDelFunc. + * + * @section Slideshow_Caching Slideshow caching + * + * The slideshow provides facilities to have items adjacent to the + * one being displayed already "realized" (i.e. loaded) for + * you, so that the system does not have to decode image data + * anymore at the time it has to actually switch images on its + * viewport. The user is able to set the numbers of items to be + * cached @b before and @b after the current item, in the widget's + * item list. + * + * Smart events one can add callbacks for are: + * + * - @c "changed" - when the slideshow switches its view to a new + * item. event_info parameter in callback contains the current visible item + * - @c "transition,end" - when a slide transition ends. event_info parameter + * in callback contains the current visible item + * + * List of examples for the slideshow widget: + * @li @ref slideshow_example + */ + +/** + * @addtogroup Slideshow + * @{ + */ + +typedef struct _Elm_Slideshow_Item_Class Elm_Slideshow_Item_Class; /**< Slideshow item class definition struct */ +typedef struct _Elm_Slideshow_Item_Class_Func Elm_Slideshow_Item_Class_Func; /**< Class functions for slideshow item classes. */ +typedef Evas_Object *(*SlideshowItemGetFunc)(void *data, Evas_Object *obj); /**< Image fetching class function for slideshow item classes. */ +typedef void (*SlideshowItemDelFunc)(void *data, Evas_Object *obj); /**< Deletion class function for slideshow item classes. */ + +/** + * @struct _Elm_Slideshow_Item_Class + * + * Slideshow item class definition. See @ref Slideshow_Items for + * field details. + */ +struct _Elm_Slideshow_Item_Class +{ + struct _Elm_Slideshow_Item_Class_Func + { + SlideshowItemGetFunc get; + SlideshowItemDelFunc del; + } func; +}; /**< #Elm_Slideshow_Item_Class member definitions */ + +/** + * Add a new slideshow widget to the given parent Elementary + * (container) object + * + * @param parent The parent object + * @return A new slideshow widget handle or @c NULL, on errors + * + * This function inserts a new slideshow widget on the canvas. + * + * @ingroup Slideshow + */ +EAPI Evas_Object *elm_slideshow_add(Evas_Object *parent); + +/** + * Add (append) a new item in a given slideshow widget. + * + * @param obj The slideshow object + * @param itc The item class for the item + * @param data The item's data + * @return A handle to the item added or @c NULL, on errors + * + * Add a new item to @p obj's internal list of items, appending it. + * The item's class must contain the function really fetching the + * image object to show for this item, which could be an Evas image + * object or an Elementary photo, for example. The @p data + * parameter is going to be passed to both class functions of the + * item. + * + * @see #Elm_Slideshow_Item_Class + * @see elm_slideshow_item_sorted_insert() + * @see elm_object_item_data_set() + * + * @ingroup Slideshow + */ +EAPI Elm_Object_Item *elm_slideshow_item_add(Evas_Object *obj, const Elm_Slideshow_Item_Class *itc, const void *data); + +/** + * Insert a new item into the given slideshow widget, using the @p func + * function to sort items (by item handles). + * + * @param obj The slideshow object + * @param itc The item class for the item + * @param data The item's data + * @param func The comparing function to be used to sort slideshow + * items by #Elm_Slideshow_Item item handles + * @return Returns The slideshow item handle, on success, or + * @c NULL, on errors + * + * Add a new item to @p obj's internal list of items, in a position + * determined by the @p func comparing function. The item's class + * must contain the function really fetching the image object to + * show for this item, which could be an Evas image object or an + * Elementary photo, for example. The @p data parameter is going to + * be passed to both class functions of the item. + * + * @see #Elm_Slideshow_Item_Class + * @see elm_slideshow_item_add() + * + * @ingroup Slideshow + */ +EAPI Elm_Object_Item *elm_slideshow_item_sorted_insert(Evas_Object *obj, const Elm_Slideshow_Item_Class *itc, const void *data, Eina_Compare_Cb func); + +/** + * Display a given slideshow widget's item, programmatically. + * + * @param it The item to display on @p obj's viewport + * + * The change between the current item and @p item will use the + * transition @p obj is set to use (@see + * elm_slideshow_transition_set()). + * + * @ingroup Slideshow + */ +EAPI void elm_slideshow_item_show(Elm_Object_Item *it); + +/** + * Slide to the @b next item, in a given slideshow widget + * + * @param obj The slideshow object + * + * The sliding animation @p obj is set to use will be the + * transition effect used, after this call is issued. + * + * @note If the end of the slideshow's internal list of items is + * reached, it'll wrap around to the list's beginning, again. + * + * @ingroup Slideshow + */ +EAPI void elm_slideshow_next(Evas_Object *obj); + +/** + * Slide to the @b previous item, in a given slideshow widget + * + * @param obj The slideshow object + * + * The sliding animation @p obj is set to use will be the + * transition effect used, after this call is issued. + * + * @note If the beginning of the slideshow's internal list of items + * is reached, it'll wrap around to the list's end, again. + * + * @ingroup Slideshow + */ +EAPI void elm_slideshow_previous(Evas_Object *obj); + +/** + * Returns the list of sliding transition/effect names available, for a + * given slideshow widget. + * + * @param obj The slideshow object + * @return The list of transitions (list of @b stringshared strings + * as data) + * + * The transitions, which come from @p obj's theme, must be an EDC + * data item named @c "transitions" on the theme file, with (prefix) + * names of EDC programs actually implementing them. + * + * The available transitions for slideshows on the default theme are: + * - @c "fade" - the current item fades out, while the new one + * fades in to the slideshow's viewport. + * - @c "black_fade" - the current item fades to black, and just + * then, the new item will fade in. + * - @c "horizontal" - the current item slides horizontally, until + * it gets out of the slideshow's viewport, while the new item + * comes from the left to take its place. + * - @c "vertical" - the current item slides vertically, until it + * gets out of the slideshow's viewport, while the new item comes + * from the bottom to take its place. + * - @c "square" - the new item starts to appear from the middle of + * the current one, but with a tiny size, growing until its + * target (full) size and covering the old one. + * + * @warning The stringshared strings get no new references + * exclusive to the user grabbing the list, here, so if you'd like + * to use them out of this call's context, you'd better @c + * eina_stringshare_ref() them. Also the list is an internal list and + * so is only valid for as long as the slideshow object is valid and + * has not internally changed its list for some reason, so make a + * copy if you need it around. + * + * @see elm_slideshow_transition_set() + * + * @ingroup Slideshow + */ +EAPI const Eina_List *elm_slideshow_transitions_get(const Evas_Object *obj); + +/** + * Set the current slide transition/effect in use for a given + * slideshow widget + * + * @param obj The slideshow object + * @param transition The new transition's name string + * + * If @p transition is implemented in @p obj's theme (i.e., is + * contained in the list returned by + * elm_slideshow_transitions_get()), this new sliding effect will + * be used on the widget. + * + * @see elm_slideshow_transitions_get() for more details + * + * @ingroup Slideshow + */ +EAPI void elm_slideshow_transition_set(Evas_Object *obj, const char *transition); + +/** + * Get the current slide transition/effect in use for a given + * slideshow widget + * + * @param obj The slideshow object + * @return The current transition's name + * + * @see elm_slideshow_transition_set() for more details + * + * @ingroup Slideshow + */ +EAPI const char *elm_slideshow_transition_get(const Evas_Object *obj); + +/** + * Set the interval between each image transition on a given + * slideshow widget, and start the slideshow, itself + * + * @param obj The slideshow object + * @param timeout The new displaying timeout for images + * + * After this call, the slideshow widget will start cycling its + * view, sequentially and automatically, with the images of the + * items it has. The time between each new image displayed is going + * to be @p timeout, in @b seconds. If a different timeout was set + * previously and an slideshow was in progress, it will continue + * with the new time between transitions, after this call. + * + * @note A value less than or equal to 0 on @p timeout will disable + * the widget's internal timer, thus halting any slideshow which + * could be happening on @p obj. + * + * @see elm_slideshow_timeout_get() + * + * @ingroup Slideshow + */ +EAPI void elm_slideshow_timeout_set(Evas_Object *obj, double timeout); + +/** + * Get the interval set for image transitions on a given slideshow + * widget. + * + * @param obj The slideshow object + * @return Returns the timeout set on it + * + * @see elm_slideshow_timeout_set() for more details + * + * @ingroup Slideshow + */ +EAPI double elm_slideshow_timeout_get(const Evas_Object *obj); + +/** + * Set if, after a slideshow is started, for a given slideshow + * widget, its items should be displayed cyclically or not. + * + * @param obj The slideshow object + * @param loop Use @c EINA_TRUE to make it cycle through items or + * @c EINA_FALSE for it to stop at the end of @p obj's internal + * list of items + * + * @note elm_slideshow_next() and elm_slideshow_previous() will @b + * ignore what is set by this functions, i.e., they'll @b always + * cycle through items. This affects only the "automatic" + * slideshow, as set by elm_slideshow_timeout_set(). + * + * @see elm_slideshow_loop_get() + * + * @ingroup Slideshow + */ +EAPI void elm_slideshow_loop_set(Evas_Object *obj, Eina_Bool loop); + +/** + * Get if, after a slideshow is started, for a given slideshow + * widget, its items are to be displayed cyclically or not. + * + * @param obj The slideshow object + * @return @c EINA_TRUE, if the items in @p obj will be cycled + * through or @c EINA_FALSE, otherwise + * + * @see elm_slideshow_loop_set() for more details + * + * @ingroup Slideshow + */ +EAPI Eina_Bool elm_slideshow_loop_get(const Evas_Object *obj); + +/** + * Remove all items from a given slideshow widget + * + * @param obj The slideshow object + * + * This removes (and deletes) all items in @p obj, leaving it + * empty. + * + * @see elm_object_item_del(), to remove just one item. + * + * @ingroup Slideshow + */ +EAPI void elm_slideshow_clear(Evas_Object *obj); + +/** + * Get the internal list of items in a given slideshow widget. + * + * @param obj The slideshow object + * @return The list of items (#Elm_Object_Item as data) or + * @c NULL on errors. + * + * This list is @b not to be modified in any way and must not be + * freed. Use the list members with functions like + * elm_object_item_del(), elm_object_item_data_get(). + * + * @warning This list is only valid until @p obj object's internal + * items list is changed. It should be fetched again with another + * call to this function when changes happen. + * + * @ingroup Slideshow + */ +EAPI const Eina_List *elm_slideshow_items_get(const Evas_Object *obj); + +/** + * Returns the currently displayed item, in a given slideshow widget + * + * @param obj The slideshow object + * @return A handle to the item being displayed in @p obj or + * @c NULL, if none is (and on errors) + * + * @ingroup Slideshow + */ +EAPI Elm_Object_Item *elm_slideshow_item_current_get(const Evas_Object *obj); + +/** + * Get the real Evas object created to implement the view of a + * given slideshow item + * + * @param it The slideshow item. + * @return the Evas object implementing this item's view. + * + * This returns the actual Evas object used to implement the + * specified slideshow item's view. This may be @c NULL, as it may + * not have been created or may have been deleted, at any time, by + * the slideshow. Do not modify this object (move, resize, + * show, hide, etc.), as the slideshow is controlling it. This + * function is for querying, emitting custom signals or hooking + * lower level callbacks for events on that object. Do not delete + * this object under any circumstances. + * + * @see elm_object_item_data_get() + * + * @ingroup Slideshow + */ +EAPI Evas_Object *elm_slideshow_item_object_get(const Elm_Object_Item *it); + +/** + * Get the the item, in a given slideshow widget, placed at + * position @p nth, in its internal items list + * + * @param obj The slideshow object + * @param nth The number of the item to grab a handle to (0 being + * the first) + * @return The item stored in @p obj at position @p nth or @c NULL, + * if there's no item with that index (and on errors) + * + * @ingroup Slideshow + */ +EAPI Elm_Object_Item *elm_slideshow_item_nth_get(const Evas_Object *obj, unsigned int nth); + +/** + * Set the current slide layout in use for a given slideshow widget + * + * @param obj The slideshow object + * @param layout The new layout's name string + * + * If @p layout is implemented in @p obj's theme (i.e., is contained + * in the list returned by elm_slideshow_layouts_get()), this new + * images layout will be used on the widget. + * + * @see elm_slideshow_layouts_get() for more details + * + * @ingroup Slideshow + */ +EAPI void elm_slideshow_layout_set(Evas_Object *obj, const char *layout); + +/** + * Get the current slide layout in use for a given slideshow widget + * + * @param obj The slideshow object + * @return The current layout's name + * + * @see elm_slideshow_layout_set() for more details + * + * @ingroup Slideshow + */ +EAPI const char *elm_slideshow_layout_get(const Evas_Object *obj); + +/** + * Returns the list of @b layout names available, for a given + * slideshow widget. + * + * @param obj The slideshow object + * @return The list of layouts (list of @b stringshared strings + * as data) + * + * Slideshow layouts will change how the widget is to dispose each + * image item in its viewport, with regard to cropping, scaling, + * etc. + * + * The layouts, which come from @p obj's theme, must be an EDC + * data item name @c "layouts" on the theme file, with (prefix) + * names of EDC programs actually implementing them. + * + * The available layouts for slideshows on the default theme are: + * - @c "fullscreen" - item images with original aspect, scaled to + * touch top and down slideshow borders or, if the image's height + * is not enough, left and right slideshow borders. + * - @c "not_fullscreen" - the same behavior as the @c "fullscreen" + * one, but always leaving 10% of the slideshow's dimensions of + * distance between the item image's borders and the slideshow + * borders, for each axis. + * + * @warning The stringshared strings get no new references + * exclusive to the user grabbing the list, here, so if you'd like + * to use them out of this call's context, you'd better @c + * eina_stringshare_ref() them. + * + * @see elm_slideshow_layout_set() + * + * @ingroup Slideshow + */ +EAPI const Eina_List *elm_slideshow_layouts_get(const Evas_Object *obj); + +/** + * Set the number of items to cache, on a given slideshow widget, + * before the current item + * + * @param obj The slideshow object + * @param count Number of items to cache before the current one + * + * The default value for this property is @c 2. See + * @ref Slideshow_Caching "slideshow caching" for more details. + * + * @see elm_slideshow_cache_before_get() + * + * @ingroup Slideshow + */ +EAPI void elm_slideshow_cache_before_set(Evas_Object *obj, int count); + +/** + * Retrieve the number of items to cache, on a given slideshow widget, + * before the current item + * + * @param obj The slideshow object + * @return The number of items set to be cached before the current one + * + * @see elm_slideshow_cache_before_set() for more details + * + * @ingroup Slideshow + */ +EAPI int elm_slideshow_cache_before_get(const Evas_Object *obj); + +/** + * Set the number of items to cache, on a given slideshow widget, + * after the current item + * + * @param obj The slideshow object + * @param count Number of items to cache after the current one + * + * The default value for this property is @c 2. See + * @ref Slideshow_Caching "slideshow caching" for more details. + * + * @see elm_slideshow_cache_after_get() + * + * @ingroup Slideshow + */ +EAPI void elm_slideshow_cache_after_set(Evas_Object *obj, int count); + +/** + * Retrieve the number of items to cache, on a given slideshow widget, + * after the current item + * + * @param obj The slideshow object + * @return The number of items set to be cached after the current one + * + * @see elm_slideshow_cache_after_set() for more details + * + * @ingroup Slideshow + */ +EAPI int elm_slideshow_cache_after_get(const Evas_Object *obj); + +/** + * Get the number of items stored in a given slideshow widget + * + * @param obj The slideshow object + * @return The number of items on @p obj, at the moment of this call + * + * @ingroup Slideshow + */ +EAPI unsigned int elm_slideshow_count_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_spinner.c b/libraries/elementary/src/lib/elm_spinner.c new file mode 100644 index 0000000..9ff7de1 --- /dev/null +++ b/libraries/elementary/src/lib/elm_spinner.c @@ -0,0 +1,830 @@ +#include +#include "elm_priv.h" +#include + +typedef struct _Widget_Data Widget_Data; +typedef struct _Elm_Spinner_Special_Value Elm_Spinner_Special_Value; + +struct _Widget_Data +{ + Evas_Object *spinner, *ent; + const char *label; + double val, val_min, val_max, orig_val, step, base; + double drag_start_pos, spin_speed, interval, first_interval; + int round; + Ecore_Timer *delay, *spin; + Eina_List *special_values; + Eina_Bool wrap : 1; + Eina_Bool entry_visible : 1; + Eina_Bool dragging : 1; + Eina_Bool editable : 1; +}; + +struct _Elm_Spinner_Special_Value +{ + double value; + const char *label; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _disable_hook(Evas_Object *obj); +static void _write_label(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +//static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); +static Eina_Bool _value_set(Evas_Object *obj, double delta); +static void _on_focus_hook(void *data, Evas_Object *obj); +static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src, + Evas_Callback_Type type, void *event_info); + +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); + +static const char SIG_CHANGED[] = "changed"; +static const char SIG_DELAY_CHANGED[] = "delay,changed"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CHANGED, ""}, + {SIG_DELAY_CHANGED, ""}, + {NULL, NULL} +}; + +static void +_del_hook(Evas_Object *obj) +{ + Elm_Spinner_Special_Value *sv; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->label) eina_stringshare_del(wd->label); + if (wd->delay) ecore_timer_del(wd->delay); + if (wd->spin) ecore_timer_del(wd->spin); + if (wd->special_values) + { + EINA_LIST_FREE(wd->special_values, sv) + { + eina_stringshare_del(sv->label); + free(sv); + } + } + free(wd); +} + +static void +_disable_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (elm_widget_disabled_get(obj)) + edje_object_signal_emit(wd->spinner, "elm,state,disabled", "elm"); + else + edje_object_signal_emit(wd->spinner, "elm,state,enabled", "elm"); +} + +static void +_signal_emit_hook(Evas_Object *obj, const char *emission, const char *source) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_signal_emit(wd->spinner, emission, source); +} + +static void +_signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_signal_callback_add(wd->spinner, emission, + source, func_cb, data); +} + +static void +_signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + edje_object_signal_callback_del_full(wd->spinner, emission, source, + func_cb, data); +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->spinner, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _elm_theme_object_set(obj, wd->spinner, "spinner", "base", elm_widget_style_get(obj)); + edje_object_part_swallow(wd->spinner, "elm.swallow.entry", wd->ent); + _write_label(obj); + if (elm_widget_focus_get(obj)) + edje_object_signal_emit(wd->spinner, "elm,action,focus", "elm"); + else + edje_object_signal_emit(wd->spinner, "elm,action,unfocus", "elm"); + if (elm_widget_disabled_get(obj)) + edje_object_signal_emit(wd->spinner, "elm,state,disabled", "elm"); + edje_object_message_signal_process(wd->spinner); + edje_object_scale_set(wd->spinner, elm_widget_scale_get(obj) * _elm_config->scale); + _sizing_eval(obj); +} + +static void +_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (elm_widget_focus_get(obj)) + { + edje_object_signal_emit(wd->spinner, "elm,action,focus", "elm"); + evas_object_focus_set(wd->spinner, EINA_TRUE); + } + else + { + edje_object_signal_emit(wd->spinner, "elm,action,unfocus", "elm"); + evas_object_focus_set(wd->spinner, EINA_FALSE); + } +} + +static Eina_Bool +_delay_change(void *data) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return ECORE_CALLBACK_CANCEL; + wd->delay = NULL; + evas_object_smart_callback_call(data, SIG_DELAY_CHANGED, NULL); + return ECORE_CALLBACK_CANCEL; +} + +static void +_entry_show(Widget_Data *wd) +{ + char buf[32], fmt[32] = "%0.f"; + + /* try to construct just the format from given label + * completely ignoring pre/post words + */ + if (wd->label) + { + const char *start = strchr(wd->label, '%'); + while (start) + { + /* handle %% */ + if (start[1] != '%') + break; + else + start = strchr(start + 2, '%'); + } + + if (start) + { + const char *itr, *end = NULL; + for (itr = start + 1; *itr != '\0'; itr++) + { + /* allowing '%d' is quite dangerous, remove it? */ + if ((*itr == 'd') || (*itr == 'f')) + { + end = itr + 1; + break; + } + } + + if ((end) && ((size_t)(end - start + 1) < sizeof(fmt))) + { + memcpy(fmt, start, end - start); + fmt[end - start] = '\0'; + } + } + } + snprintf(buf, sizeof(buf), fmt, wd->val); + elm_object_text_set(wd->ent, buf); +} + +static void +_write_label(Evas_Object *obj) +{ + Eina_List *l; + Elm_Spinner_Special_Value *sv; + Widget_Data *wd = elm_widget_data_get(obj); + char buf[1024]; + + if (!wd) return; + EINA_LIST_FOREACH(wd->special_values, l, sv) + { + if (sv->value == wd->val) + { + snprintf(buf, sizeof(buf), "%s", sv->label); + goto apply; + } + } + if (wd->label) + snprintf(buf, sizeof(buf), wd->label, wd->val); + else + snprintf(buf, sizeof(buf), "%.0f", wd->val); + +apply: + edje_object_part_text_escaped_set(wd->spinner, "elm.text", buf); + if (wd->entry_visible) _entry_show(wd); +} + +static Eina_Bool +_value_set(Evas_Object *obj, double new_val) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return EINA_FALSE; + + if (wd->round > 0) + new_val = wd->base + + (double)((((int)(new_val - wd->base)) / wd->round) * wd->round); + + if (wd->wrap) + { + while (new_val < wd->val_min) + new_val = wd->val_max + new_val + 1 - wd->val_min; + while (new_val > wd->val_max) + new_val = wd->val_min + new_val - wd->val_max - 1; + } + else + { + if (new_val < wd->val_min) + new_val = wd->val_min; + else if (new_val > wd->val_max) + new_val = wd->val_max; + } + + if (new_val == wd->val) return EINA_FALSE; + wd->val = new_val; + + evas_object_smart_callback_call(obj, SIG_CHANGED, NULL); + if (wd->delay) ecore_timer_del(wd->delay); + wd->delay = ecore_timer_add(0.2, _delay_change, obj); + + return EINA_TRUE; +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1; + if (!wd) return; + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + edje_object_size_min_restricted_calc(wd->spinner, &minw, &minh, minw, minh); + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, -1, -1); +} + +/* + static void + _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info) + { + _sizing_eval(data); + } + */ + +static void +_val_set(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + double pos = 0.0; + if (!wd) return; + if (wd->val_max > wd->val_min) + pos = ((wd->val - wd->val_min) / (wd->val_max - wd->val_min)); + if (pos < 0.0) pos = 0.0; + else if (pos > 1.0) pos = 1.0; + edje_object_part_drag_value_set(wd->spinner, "elm.dragable.slider", + pos, pos); +} + +static void +_drag(void *data, Evas_Object *_obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Evas_Object *obj = data; + Widget_Data *wd = elm_widget_data_get(obj); + double pos = 0.0, offset, delta; + if (!wd) return; + if (wd->entry_visible) return; + edje_object_part_drag_value_get(wd->spinner, "elm.dragable.slider", + &pos, NULL); + + offset = wd->step * _elm_config->scale; + delta = (pos - wd->drag_start_pos) * offset; + /* If we are on rtl mode, change the delta to be negative on such changes */ + if (elm_widget_mirrored_get(obj)) delta *= -1; + if (_value_set(data, wd->drag_start_pos + delta)) _write_label(data); + wd->dragging = 1; +} + +static void +_drag_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + double pos; + if (!wd) return; + edje_object_part_drag_value_get(wd->spinner, "elm.dragable.slider", + &pos, NULL); + wd->drag_start_pos = pos; +} + +static void +_drag_stop(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + wd->drag_start_pos = 0; + edje_object_part_drag_value_set(wd->spinner, "elm.dragable.slider", 0.0, 0.0); +} + +static void +_hide_entry(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_signal_emit(wd->spinner, "elm,state,inactive", "elm"); + wd->entry_visible = 0; +} + +static void +_reset_value(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _hide_entry(obj); + elm_spinner_value_set(obj, wd->orig_val); +} + +static void +_apply_entry_value(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + const char *str; + char *end; + double val; + + if (!wd) return; + _hide_entry(obj); + str = elm_object_text_get(wd->ent); + if (!str) return; + val = strtod(str, &end); + if ((*end != '\0') && (!isspace(*end))) return; + elm_spinner_value_set(obj, val); +} + +static void +_toggle_entry(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + if (wd->dragging) + { + wd->dragging = 0; + return; + } + if (elm_widget_disabled_get(data)) return; + if (!wd->editable) return; + if (wd->entry_visible) _apply_entry_value(data); + else + { + wd->orig_val = wd->val; + edje_object_signal_emit(wd->spinner, "elm,state,active", "elm"); + _entry_show(wd); + elm_entry_select_all(wd->ent); + elm_widget_focus_set(wd->ent, 1); + wd->entry_visible = 1; + } +} + +static Eina_Bool +_spin_value(void *data) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return ECORE_CALLBACK_CANCEL; + if (_value_set(data, wd->val + wd->spin_speed)) _write_label(data); + wd->interval = wd->interval / 1.05; + ecore_timer_interval_set(wd->spin, wd->interval); + return ECORE_CALLBACK_RENEW; +} + +static void +_val_inc_start(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->interval = wd->first_interval; + wd->spin_speed = wd->step; + if (wd->spin) ecore_timer_del(wd->spin); + wd->spin = ecore_timer_add(wd->interval, _spin_value, obj); + _spin_value(obj); +} + +static void +_val_inc_stop(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->interval = wd->first_interval; + wd->spin_speed = 0; + if (wd->spin) ecore_timer_del(wd->spin); + wd->spin = NULL; +} + +static void +_val_dec_start(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->interval = wd->first_interval; + wd->spin_speed = -wd->step; + if (wd->spin) ecore_timer_del(wd->spin); + wd->spin = ecore_timer_add(wd->interval, _spin_value, obj); + _spin_value(obj); +} + +static void +_val_dec_stop(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->interval = wd->first_interval; + wd->spin_speed = 0; + if (wd->spin) ecore_timer_del(wd->spin); + wd->spin = NULL; +} + +static void +_button_inc_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + if (wd->entry_visible) + { + _reset_value(data); + return; + } + _val_inc_start(data); +} + +static void +_button_inc_stop(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + _val_inc_stop(data); +} + +static void +_button_dec_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + if (wd->entry_visible) + { + _reset_value(data); + return; + } + _val_dec_start(data); +} + +static void +_button_dec_stop(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + _val_dec_stop(data); +} + +static void +_entry_activated(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + _apply_entry_value(data); + evas_object_smart_callback_call(data, SIG_CHANGED, NULL); + if (wd->delay) ecore_timer_del(wd->delay); + wd->delay = ecore_timer_add(0.2, _delay_change, data); +} + +static Eina_Bool +_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + if (elm_widget_disabled_get(obj)) return EINA_FALSE; + if (type == EVAS_CALLBACK_KEY_DOWN) + { + Evas_Event_Key_Down *ev = event_info; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; + else if (!strcmp(ev->keyname, "Left") || + ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string)) || + !strcmp(ev->keyname, "Down") || + ((!strcmp(ev->keyname, "KP_Down")) && (!ev->string))) + { + _val_dec_start(obj); + edje_object_signal_emit(wd->spinner, "elm,left,anim,activate", "elm"); + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else if (!strcmp(ev->keyname, "Right") || + ((!strcmp(ev->keyname, "KP_Right")) && (!ev->string)) || + !strcmp(ev->keyname, "Up") || + ((!strcmp(ev->keyname, "KP_Up")) && (!ev->string))) + { + _val_inc_start(obj); + edje_object_signal_emit(wd->spinner, "elm,right,anim,activate", "elm"); + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + } + else if (type == EVAS_CALLBACK_KEY_UP) + { + Evas_Event_Key_Down *ev = event_info; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; + if (!strcmp(ev->keyname, "Right") || + ((!strcmp(ev->keyname, "KP_Right")) && (!ev->string)) || + !strcmp(ev->keyname, "Up") || + ((!strcmp(ev->keyname, "KP_Up")) && (!ev->string))) + _val_inc_stop(obj); + else if (!strcmp(ev->keyname, "Left") || + ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string)) || + !strcmp(ev->keyname, "Down") || + ((!strcmp(ev->keyname, "KP_Down")) && (!ev->string))) + _val_dec_stop(obj); + else return EINA_FALSE; + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + return EINA_FALSE; +} + +EAPI Evas_Object * +elm_spinner_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "spinner"); + elm_widget_type_set(obj, "spinner"); + elm_widget_sub_object_add(parent, obj); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_disable_hook_set(obj, _disable_hook); + elm_widget_signal_emit_hook_set(obj, _signal_emit_hook); + elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook); + elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook); + elm_widget_can_focus_set(obj, EINA_TRUE); + elm_widget_event_hook_set(obj, _event_hook); + + wd->val = 0.0; + wd->val_min = 0.0; + wd->val_max = 100.0; + wd->wrap = 0; + wd->step = 1.0; + wd->first_interval = 0.85; + wd->entry_visible = 0; + wd->editable = EINA_TRUE; + + wd->spinner = edje_object_add(e); + _elm_theme_object_set(obj, wd->spinner, "spinner", "base", "default"); + elm_widget_resize_object_set(obj, wd->spinner); + edje_object_signal_callback_add(wd->spinner, "drag", "*", _drag, obj); + edje_object_signal_callback_add(wd->spinner, "drag,start", "*", + _drag_start, obj); + edje_object_signal_callback_add(wd->spinner, "drag,stop", "*", + _drag_stop, obj); + edje_object_signal_callback_add(wd->spinner, "drag,step", "*", + _drag_stop, obj); + edje_object_signal_callback_add(wd->spinner, "drag,page", "*", + _drag_stop, obj); + + edje_object_signal_callback_add(wd->spinner, "elm,action,increment,start", + "*", _button_inc_start, obj); + edje_object_signal_callback_add(wd->spinner, "elm,action,increment,stop", + "*", _button_inc_stop, obj); + edje_object_signal_callback_add(wd->spinner, "elm,action,decrement,start", + "*", _button_dec_start, obj); + edje_object_signal_callback_add(wd->spinner, "elm,action,decrement,stop", + "*", _button_dec_stop, obj); + edje_object_part_drag_value_set(wd->spinner, "elm.dragable.slider", + 0.0, 0.0); + + wd->ent = elm_entry_add(obj); + elm_entry_single_line_set(wd->ent, 1); + evas_object_smart_callback_add(wd->ent, "activated", _entry_activated, obj); + edje_object_part_swallow(wd->spinner, "elm.swallow.entry", wd->ent); + edje_object_signal_callback_add(wd->spinner, "elm,action,entry,toggle", + "*", _toggle_entry, obj); + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _write_label(obj); + _sizing_eval(obj); + return obj; +} + +EAPI void +elm_spinner_label_format_set(Evas_Object *obj, const char *fmt) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + eina_stringshare_replace(&wd->label, fmt); + _write_label(obj); + _sizing_eval(obj); +} + +EAPI const char * +elm_spinner_label_format_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->label; +} + +EAPI void +elm_spinner_min_max_set(Evas_Object *obj, double min, double max) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if ((wd->val_min == min) && (wd->val_max == max)) return; + wd->val_min = min; + wd->val_max = max; + if (wd->val < wd->val_min) wd->val = wd->val_min; + if (wd->val > wd->val_max) wd->val = wd->val_max; + _val_set(obj); + _write_label(obj); +} + +EAPI void +elm_spinner_min_max_get(const Evas_Object *obj, double *min, double *max) +{ + if (min) *min = 0.0; + if (max) *max = 0.0; + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (min) *min = wd->val_min; + if (max) *max = wd->val_max; +} + +EAPI void +elm_spinner_step_set(Evas_Object *obj, double step) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->step = step; +} + +EAPI double +elm_spinner_step_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0.0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0.0; + return wd->step; +} + +EAPI void +elm_spinner_value_set(Evas_Object *obj, double val) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->val == val) return; + wd->val = val; + if (wd->val < wd->val_min) wd->val = wd->val_min; + if (wd->val > wd->val_max) wd->val = wd->val_max; + _val_set(obj); + _write_label(obj); +} + +EAPI double +elm_spinner_value_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0.0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0.0; + return wd->val; +} + +EAPI void +elm_spinner_wrap_set(Evas_Object *obj, Eina_Bool wrap) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->wrap = wrap; +} + +EAPI Eina_Bool +elm_spinner_wrap_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->wrap; +} + +EAPI void +elm_spinner_special_value_add(Evas_Object *obj, double value, const char *label) +{ + Elm_Spinner_Special_Value *sv; + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + sv = calloc(1, sizeof(*sv)); + if (!sv) return; + sv->value = value; + sv->label = eina_stringshare_add(label); + + wd->special_values = eina_list_append(wd->special_values, sv); + _write_label(obj); +} + +EAPI void +elm_spinner_editable_set(Evas_Object *obj, Eina_Bool editable) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->editable = editable; +} + +EAPI Eina_Bool +elm_spinner_editable_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->editable; +} + +EAPI void +elm_spinner_interval_set(Evas_Object *obj, double interval) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->first_interval = interval; +} + +EAPI double +elm_spinner_interval_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0.0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0.0; + return wd->first_interval; +} + +EAPI void +elm_spinner_base_set(Evas_Object *obj, double base) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->base = base; +} + +EAPI double +elm_spinner_base_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0.0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0.0; + return wd->base; +} + +EAPI void +elm_spinner_round_set(Evas_Object *obj, int rnd) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->round = rnd; +} + +EAPI int +elm_spinner_round_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; + return wd->round; +} diff --git a/libraries/elementary/src/lib/elm_spinner.h b/libraries/elementary/src/lib/elm_spinner.h new file mode 100644 index 0000000..114a090 --- /dev/null +++ b/libraries/elementary/src/lib/elm_spinner.h @@ -0,0 +1,426 @@ +/** + * @defgroup Spinner Spinner + * @ingroup Elementary + * + * @image html img/widget/spinner/preview-00.png + * @image latex img/widget/spinner/preview-00.eps + * + * A spinner is a widget which allows the user to increase or decrease + * numeric values using arrow buttons, or edit values directly, clicking + * over it and typing the new value. + * + * By default the spinner will not wrap and has a label + * of "%.0f" (just showing the integer value of the double). + * + * A spinner has a label that is formatted with floating + * point values and thus accepts a printf-style format string, like + * “%1.2f units”. + * + * It also allows specific values to be replaced by pre-defined labels. + * + * Smart callbacks one can register to: + * + * - "changed" - Whenever the spinner value is changed. + * - "delay,changed" - A short time after the value is changed by the user. + * This will be called only when the user stops dragging for a very short + * period or when they release their finger/mouse, so it avoids possibly + * expensive reactions to the value change. + * + * Available styles for it: + * - @c "default"; + * - @c "vertical": up/down buttons at the right side and text left aligned. + * + * Supported elm_object common APIs. + * @li @ref elm_object_signal_emit + * @li @ref elm_object_signal_callback_add + * @li @ref elm_object_signal_callback_del + * @li @ref elm_object_disabled_set + * @li @ref elm_object_disabled_get + * + * Here is an example on its usage: + * @ref spinner_example + */ + +/** + * @addtogroup Spinner + * @{ + */ + +/** + * Add a new spinner widget to the given parent Elementary + * (container) object. + * + * @param parent The parent object. + * @return a new spinner widget handle or @c NULL, on errors. + * + * This function inserts a new spinner widget on the canvas. + * + * @ingroup Spinner + * + */ +EAPI Evas_Object *elm_spinner_add(Evas_Object *parent); + +/** + * Set the format string of the displayed label. + * + * @param obj The spinner object. + * @param fmt The format string for the label display. + * + * If @c NULL, this sets the format to "%.0f". If not it sets the format + * string for the label text. The label text is provided a floating point + * value, so the label text can display up to 1 floating point value. + * Note that this is optional. + * + * Use a format string such as "%1.2f meters" for example, and it will + * display values like: "3.14 meters" for a value equal to 3.14159. + * + * Default is "%0.f". + * + * @see elm_spinner_label_format_get() + * + * @ingroup Spinner + */ +EAPI void elm_spinner_label_format_set(Evas_Object *obj, const char *fmt); + +/** + * Get the label format of the spinner. + * + * @param obj The spinner object. + * @return The text label format string in UTF-8. + * + * @see elm_spinner_label_format_set() for details. + * + * @ingroup Spinner + */ +EAPI const char *elm_spinner_label_format_get(const Evas_Object *obj); + +/** + * Set the minimum and maximum values for the spinner. + * + * @param obj The spinner object. + * @param min The minimum value. + * @param max The maximum value. + * + * Define the allowed range of values to be selected by the user. + * + * If actual value is less than @p min, it will be updated to @p min. If it + * is bigger then @p max, will be updated to @p max. Actual value can be + * get with elm_spinner_value_get(). + * + * By default, min is equal to 0, and max is equal to 100. + * + * @warning Maximum must be greater than minimum. + * + * @see elm_spinner_min_max_get() + * + * @ingroup Spinner + */ +EAPI void elm_spinner_min_max_set(Evas_Object *obj, double min, double max); + +/** + * Get the minimum and maximum values of the spinner. + * + * @param obj The spinner object. + * @param min Pointer to store the minimum value. + * @param max Pointer to store the maximum value. + * + * @note If only one value is needed, the other pointer can be passed + * as @c NULL. + * + * @see elm_spinner_min_max_set() for details. + * + * @ingroup Spinner + */ +EAPI void elm_spinner_min_max_get(const Evas_Object *obj, double *min, double *max); + +/** + * Set the step used to increment or decrement the spinner value. + * + * @param obj The spinner object. + * @param step The step value. + * + * This value will be incremented or decremented to the displayed value. + * It will be incremented while the user keep right or top arrow pressed, + * and will be decremented while the user keep left or bottom arrow pressed. + * + * The interval to increment / decrement can be set with + * elm_spinner_interval_set(). + * + * By default step value is equal to 1. + * + * @see elm_spinner_step_get() + * + * @ingroup Spinner + */ +EAPI void elm_spinner_step_set(Evas_Object *obj, double step); + +/** + * Get the step used to increment or decrement the spinner value. + * + * @param obj The spinner object. + * @return The step value. + * + * @see elm_spinner_step_get() for more details. + * + * @ingroup Spinner + */ +EAPI double elm_spinner_step_get(const Evas_Object *obj); + +/** + * Set the value the spinner displays. + * + * @param obj The spinner object. + * @param val The value to be displayed. + * + * Value will be presented on the label following format specified with + * elm_spinner_format_set(). + * + * @warning The value must to be between min and max values. This values + * are set by elm_spinner_min_max_set(). + * + * @see elm_spinner_value_get(). + * @see elm_spinner_format_set(). + * @see elm_spinner_min_max_set(). + * + * @ingroup Spinner + */ +EAPI void elm_spinner_value_set(Evas_Object *obj, double val); + +/** + * Get the value displayed by the spinner. + * + * @param obj The spinner object. + * @return The value displayed. + * + * @see elm_spinner_value_set() for details. + * + * @ingroup Spinner + */ +EAPI double elm_spinner_value_get(const Evas_Object *obj); + +/** + * Set whether the spinner should wrap when it reaches its + * minimum or maximum value. + * + * @param obj The spinner object. + * @param wrap @c EINA_TRUE to enable wrap or @c EINA_FALSE to + * disable it. + * + * Disabled by default. If disabled, when the user tries to increment the + * value, + * but displayed value plus step value is bigger than maximum value, + * the spinner + * won't allow it. The same happens when the user tries to decrement it, + * but the value less step is less than minimum value. + * + * When wrap is enabled, in such situations it will allow these changes, + * but will get the value that would be less than minimum and subtracts + * from maximum. Or add the value that would be more than maximum to + * the minimum. + * + * E.g.: + * @li min value = 10 + * @li max value = 50 + * @li step value = 20 + * @li displayed value = 20 + * + * When the user decrement value (using left or bottom arrow), it will + * displays @c 40, because max - (min - (displayed - step)) is + * @c 50 - (@c 10 - (@c 20 - @c 20)) = @c 40. + * + * @see elm_spinner_wrap_get(). + * + * @ingroup Spinner + */ +EAPI void elm_spinner_wrap_set(Evas_Object *obj, Eina_Bool wrap); + +/** + * Get whether the spinner should wrap when it reaches its + * minimum or maximum value. + * + * @param obj The spinner object + * @return @c EINA_TRUE means wrap is enabled. @c EINA_FALSE indicates + * it's disabled. If @p obj is @c NULL, @c EINA_FALSE is returned. + * + * @see elm_spinner_wrap_set() for details. + * + * @ingroup Spinner + */ +EAPI Eina_Bool elm_spinner_wrap_get(const Evas_Object *obj); + +/** + * Set whether the spinner can be directly edited by the user or not. + * + * @param obj The spinner object. + * @param editable @c EINA_TRUE to allow users to edit it or @c EINA_FALSE to + * don't allow users to edit it directly. + * + * Spinner objects can have edition @b disabled, in which state they will + * be changed only by arrows. + * Useful for contexts + * where you don't want your users to interact with it writing the value. + * Specially + * when using special values, the user can see real value instead + * of special label on edition. + * + * It's enabled by default. + * + * @see elm_spinner_editable_get() + * + * @ingroup Spinner + */ +EAPI void elm_spinner_editable_set(Evas_Object *obj, Eina_Bool editable); + +/** + * Get whether the spinner can be directly edited by the user or not. + * + * @param obj The spinner object. + * @return @c EINA_TRUE means edition is enabled. @c EINA_FALSE indicates + * it's disabled. If @p obj is @c NULL, @c EINA_FALSE is returned. + * + * @see elm_spinner_editable_set() for details. + * + * @ingroup Spinner + */ +EAPI Eina_Bool elm_spinner_editable_get(const Evas_Object *obj); + +/** + * Set a special string to display in the place of the numerical value. + * + * @param obj The spinner object. + * @param value The value to be replaced. + * @param label The label to be used. + * + * It's useful for cases when a user should select an item that is + * better indicated by a label than a value. For example, weekdays or months. + * + * E.g.: + * @code + * sp = elm_spinner_add(win); + * elm_spinner_min_max_set(sp, 1, 3); + * elm_spinner_special_value_add(sp, 1, "January"); + * elm_spinner_special_value_add(sp, 2, "February"); + * elm_spinner_special_value_add(sp, 3, "March"); + * evas_object_show(sp); + * @endcode + * + * @ingroup Spinner + */ +EAPI void elm_spinner_special_value_add(Evas_Object *obj, double value, const char *label); + +/** + * Set the interval on time updates for an user mouse button hold + * on spinner widgets' arrows. + * + * @param obj The spinner object. + * @param interval The (first) interval value in seconds. + * + * This interval value is @b decreased while the user holds the + * mouse pointer either incrementing or decrementing spinner's value. + * + * This helps the user to get to a given value distant from the + * current one easier/faster, as it will start to change quicker and + * quicker on mouse button holds. + * + * The calculation for the next change interval value, starting from + * the one set with this call, is the previous interval divided by + * @c 1.05, so it decreases a little bit. + * + * The default starting interval value for automatic changes is + * @c 0.85 seconds. + * + * @see elm_spinner_interval_get() + * + * @ingroup Spinner + */ +EAPI void elm_spinner_interval_set(Evas_Object *obj, double interval); + +/** + * Get the interval on time updates for an user mouse button hold + * on spinner widgets' arrows. + * + * @param obj The spinner object. + * @return The (first) interval value, in seconds, set on it. + * + * @see elm_spinner_interval_set() for more details. + * + * @ingroup Spinner + */ +EAPI double elm_spinner_interval_get(const Evas_Object *obj); + +/** + * Set the base for rounding + * + * @param obj The spinner object + * @param base The base value + * + * Rounding works as follows: + * + * rounded_val = base + (double)(((value - base) / round) * round) + * + * Where rounded_val, value and base are doubles, and round is an integer. + * + * This means that things will be rounded to increments (or decrements) of + * "round" starting from value @p base. The default base for rounding is 0. + * + * Example: round = 3, base = 2 + * Values: 3, 6, 9, 12, 15, ... + * + * Example: round = 2, base = 5.5 + * Values: 5.5, 7.5, 9.5, 11.5, ... + * + * @see elm_spinner_round_get() + * @see elm_spinner_base_get() too. + * + * @ingroup Spinner + */ +EAPI void elm_spinner_base_set(Evas_Object *obj, double base); + +/** + * Get the base for rounding + * + * @param obj The spinner object + * @return The base rounding value + * + * This returns the base for rounding. + * + * @see elm_spinner_round_set() too. + * @see elm_spinner_base_set() too. + * + * @ingroup Spinner + */ +EAPI double elm_spinner_base_get(const Evas_Object *obj); + +/** + * Set the round value for rounding + * + * @param obj The spinner object + * @param rnd The rounding value + * + * Sets the rounding value used for value rounding in the spinner. + * + * @see elm_spinner_round_get() + * @see elm_spinner_base_set() + * + * @ingroup Spinner + */ +EAPI void elm_spinner_round_set(Evas_Object *obj, int rnd); + +/** + * Get the round value for rounding + * + * @param obj The spinner object + * @return The rounding value + * + * This returns the round value for rounding. + * + * @see elm_spinner_round_set() too. + * @see elm_spinner_base_set() too. + * + * @ingroup Spinner + */ +EAPI int elm_spinner_round_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_store.c b/libraries/elementary/src/lib/elm_store.c new file mode 100644 index 0000000..a296f36 --- /dev/null +++ b/libraries/elementary/src/lib/elm_store.c @@ -0,0 +1,751 @@ +#include +#include +#include "elm_priv.h" + +typedef struct _Elm_Store_Filesystem Elm_Store_Filesystem; +typedef struct _Elm_Store_Item_Filesystem Elm_Store_Item_Filesystem; + +#define ELM_STORE_MAGIC 0x3f89ea56 +#define ELM_STORE_FILESYSTEM_MAGIC 0x3f89ea57 +#define ELM_STORE_ITEM_MAGIC 0x5afe8c1d + +struct _Elm_Store +{ + EINA_MAGIC; + void (*free)(Elm_Store *store); + struct + { + void (*free)(Elm_Store_Item *item); + } item; + Evas_Object *genlist; + Ecore_Thread *list_th; + Eina_Inlist *items; + Eina_List *realized; + int realized_count; + int cache_max; + struct + { + struct + { + Elm_Store_Item_List_Cb func; + void *data; + } list; + struct + { + Elm_Store_Item_Fetch_Cb func; + void *data; + } fetch; + struct + { + Elm_Store_Item_Unfetch_Cb func; + void *data; + } unfetch; + } cb; + Eina_Bool sorted : 1; + Eina_Bool fetch_thread : 1; +}; + +struct _Elm_Store_Item +{ + EINA_INLIST; + EINA_MAGIC; + Elm_Store *store; + Elm_Object_Item *item; + Ecore_Thread *fetch_th; + Ecore_Job *eval_job; + const Elm_Store_Item_Mapping *mapping; + void *data; + Eina_Lock lock; + Eina_Bool live : 1; + Eina_Bool was_live : 1; + Eina_Bool realized : 1; + Eina_Bool fetched : 1; +}; + +struct _Elm_Store_Filesystem +{ + Elm_Store base; + EINA_MAGIC; + const char *dir; +}; + +struct _Elm_Store_Item_Filesystem +{ + Elm_Store_Item base; + const char *path; +}; + +static Elm_Genlist_Item_Class _store_item_class; + +static void +_store_cache_trim(Elm_Store *st) +{ + while ((st->realized ) && + (((int)eina_list_count(st->realized) - st->realized_count) + > st->cache_max)) + { + Elm_Store_Item *sti = st->realized->data; + if (sti->realized) + { + st->realized = eina_list_remove_list(st->realized, st->realized); + sti->realized = EINA_FALSE; + } + eina_lock_take(&sti->lock); + if (!sti->fetched) + { + eina_lock_release(&sti->lock); + if (sti->fetch_th) + { + ecore_thread_cancel(sti->fetch_th); + sti->fetch_th = NULL; + } + eina_lock_take(&sti->lock); + } + sti->fetched = EINA_FALSE; +//// let fetch/unfetch do the locking +// eina_lock_release(&sti->lock); + if (st->cb.unfetch.func) + st->cb.unfetch.func(st->cb.unfetch.data, sti); +// eina_lock_take(&sti->lock); + sti->data = NULL; + eina_lock_release(&sti->lock); + } +} + +static void +_store_genlist_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Store *st = data; + st->genlist = NULL; + if (st->list_th) + { + ecore_thread_cancel(st->list_th); + st->list_th = NULL; + } + eina_list_free(st->realized); + while (st->items) + { + Elm_Store_Item *sti = (Elm_Store_Item *)st->items; + if (sti->eval_job) ecore_job_del(sti->eval_job); + if (sti->fetch_th) + { + ecore_thread_cancel(sti->fetch_th); + sti->fetch_th = NULL; + } + if (sti->store->item.free) sti->store->item.free(sti); + eina_lock_take(&sti->lock); + if (sti->data) + { + if (st->cb.unfetch.func) + st->cb.unfetch.func(st->cb.unfetch.data, sti); + sti->data = NULL; + } + eina_lock_release(&sti->lock); + eina_lock_free(&sti->lock); + st->items = NULL; + free(sti); + } + // FIXME: kill threads and more +} + +////// **** WARNING *********************************************************** +//// * This function runs inside a thread outside efl mainloop. Be careful! * +// ************************************************************************ +/* TODO: refactor lock part into core? this does not depend on filesystm part */ +static void +_store_filesystem_fetch_do(void *data, Ecore_Thread *th __UNUSED__) +{ + Elm_Store_Item *sti = data; + eina_lock_take(&sti->lock); + if (sti->data) + { + eina_lock_release(&sti->lock); + return; + } + if (!sti->fetched) + { +//// let fetch/unfetch do the locking +// eina_lock_release(&sti->lock); + if (sti->store->cb.fetch.func) + sti->store->cb.fetch.func(sti->store->cb.fetch.data, sti); +// eina_lock_take(&sti->lock); + sti->fetched = EINA_TRUE; + } + eina_lock_release(&sti->lock); +} +// ************************************************************************ +//// * End of separate thread function. * +////// ************************************************************************ +/* TODO: refactor lock part into core? this does not depend on filesystm part */ +static void +_store_filesystem_fetch_end(void *data, Ecore_Thread *th) +{ + Elm_Store_Item *sti = data; + eina_lock_take(&sti->lock); + if (sti->data) elm_genlist_item_update(sti->item); + eina_lock_release(&sti->lock); + if (th == sti->fetch_th) sti->fetch_th = NULL; +} + +/* TODO: refactor lock part into core? this does not depend on filesystm part */ +static void +_store_filesystem_fetch_cancel(void *data, Ecore_Thread *th) +{ + Elm_Store_Item *sti = data; + eina_lock_take(&sti->lock); + if (th == sti->fetch_th) sti->fetch_th = NULL; + if (sti->data) elm_genlist_item_update(sti->item); + eina_lock_release(&sti->lock); +} + +static void +_store_item_eval(void *data) +{ + Elm_Store_Item *sti = data; + sti->eval_job = NULL; + if (sti->live == sti->was_live) return; + sti->was_live = sti->live; + if (sti->live) + { + _store_cache_trim(sti->store); + if (sti->realized) + sti->store->realized = eina_list_remove(sti->store->realized, sti); + sti->store->realized = eina_list_append(sti->store->realized, sti); + sti->realized = EINA_TRUE; + if ((sti->store->fetch_thread) && (!sti->fetch_th)) + sti->fetch_th = ecore_thread_run(_store_filesystem_fetch_do, + _store_filesystem_fetch_end, + _store_filesystem_fetch_cancel, + sti); + else if ((!sti->store->fetch_thread)) + { + _store_filesystem_fetch_do(sti, NULL); + _store_filesystem_fetch_end(sti, NULL); + } + } + else + { + if (sti->fetch_th) + { + ecore_thread_cancel(sti->fetch_th); + sti->fetch_th = NULL; + } + _store_cache_trim(sti->store); + } +} + +static void +_store_genlist_item_realized(void *data, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Store *st = data; + Elm_Object_Item *gli = event_info; + Elm_Store_Item *sti = elm_object_item_data_get(gli); + if (!sti) return; + st->realized_count++; + sti->live = EINA_TRUE; + if (sti->eval_job) ecore_job_del(sti->eval_job); + sti->eval_job = ecore_job_add(_store_item_eval, sti); +} + +static void +_store_genlist_item_unrealized(void *data, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Store *st = data; + Elm_Object_Item *gli = event_info; + Elm_Store_Item *sti = elm_object_item_data_get(gli); + if (!sti) return; + st->realized_count--; + sti->live = EINA_FALSE; + if (sti->eval_job) ecore_job_del(sti->eval_job); + sti->eval_job = ecore_job_add(_store_item_eval, sti); +} + +static const Elm_Store_Item_Mapping * +_store_item_mapping_find(Elm_Store_Item *sti, const char *part) +{ + const Elm_Store_Item_Mapping *m; + + for (m = sti->mapping; m; m ++) + { + if (m->type == ELM_STORE_ITEM_MAPPING_NONE) break; + if (!strcmp(part, m->part)) return m; + } + return NULL; +} + +static char * +_store_item_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part) +{ + Elm_Store_Item *sti = data; + const char *s = ""; + eina_lock_take(&sti->lock); + if (sti->data) + { + const Elm_Store_Item_Mapping *m = _store_item_mapping_find(sti, part); + if (m) + { + switch (m->type) + { + case ELM_STORE_ITEM_MAPPING_LABEL: + s = *(char **)(((unsigned char *)sti->data) + m->offset); + break; + case ELM_STORE_ITEM_MAPPING_CUSTOM: + if (m->details.custom.func) + s = m->details.custom.func(sti->data, sti, part); + break; + default: + break; + } + } + } + eina_lock_release(&sti->lock); + return s ? strdup(s) : NULL; +} + +static Evas_Object * +_store_item_content_get(void *data, Evas_Object *obj, const char *part) +{ + Elm_Store_Item *sti = data; + eina_lock_take(&sti->lock); + if (sti->data) + { + const Elm_Store_Item_Mapping *m = _store_item_mapping_find(sti, part); + if (m) + { + Evas_Object *ic = NULL; + const char *s = NULL; + + switch (m->type) + { + case ELM_STORE_ITEM_MAPPING_ICON: + ic = elm_icon_add(obj); + s = *(char **)(((unsigned char *)sti->data) + m->offset); + elm_icon_order_lookup_set(ic, m->details.icon.lookup_order); + evas_object_size_hint_aspect_set(ic, + EVAS_ASPECT_CONTROL_VERTICAL, + m->details.icon.w, + m->details.icon.h); + elm_icon_smooth_set(ic, m->details.icon.smooth); + elm_icon_no_scale_set(ic, m->details.icon.no_scale); + elm_icon_resizable_set(ic, + m->details.icon.scale_up, + m->details.icon.scale_down); + if (s) + { + if (m->details.icon.standard_name) + elm_icon_standard_set(ic, s); + else + elm_icon_file_set(ic, s, NULL); + } + break; + case ELM_STORE_ITEM_MAPPING_PHOTO: + ic = elm_icon_add(obj); + s = *(char **)(((unsigned char *)sti->data) + m->offset); + elm_photo_size_set(ic, m->details.photo.size); + if (s) + elm_photo_file_set(ic, s); + break; + case ELM_STORE_ITEM_MAPPING_CUSTOM: + if (m->details.custom.func) + ic = m->details.custom.func(sti->data, sti, part); + break; + default: + break; + } + eina_lock_release(&sti->lock); + return ic; + } + } + eina_lock_release(&sti->lock); + return NULL; +} + +static void +_store_item_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__) +{ +} + +////// **** WARNING *********************************************************** +//// * This function runs inside a thread outside efl mainloop. Be careful! * +// ************************************************************************ +static int +_store_filesystem_sort_cb(void *d1, void *d2) +{ + Elm_Store_Item_Info *info1 = d1, *info2 = d2; + if ((!info1->sort_id) || (!info2->sort_id)) return 0; + return strcoll(info1->sort_id, info2->sort_id); +} + +static void +_store_filesystem_list_do(void *data, Ecore_Thread *th __UNUSED__) +{ + Elm_Store_Filesystem *st = data; + Eina_Iterator *it; + const Eina_File_Direct_Info *finf; + Eina_List *sorted = NULL; + Elm_Store_Item_Info_Filesystem *info; + + // FIXME: need a way to abstract the open, list, feed items from list + // and maybe get initial sortable key vals etc. + it = eina_file_stat_ls(st->dir); + if (!it) return; + EINA_ITERATOR_FOREACH(it, finf) + { + Eina_Bool ok; + size_t pathsz = finf->path_length + 1; + + if (finf->path[finf->name_start] == '.') continue ; + + info = calloc(1, sizeof(Elm_Store_Item_Info_Filesystem) + pathsz); + if (!info) continue; + info->path = ((char *)info) + sizeof(Elm_Store_Item_Info_Filesystem); + memcpy(info->path, finf->path, pathsz); + ok = EINA_TRUE; + if (st->base.cb.list.func) + ok = st->base.cb.list.func(st->base.cb.list.data, &info->base); + if (ok) + { + if (!st->base.sorted) ecore_thread_feedback(th, info); + else sorted = eina_list_append(sorted, info); + } + else + { + if (info->base.sort_id) free(info->base.sort_id); + free(info); + } + if (ecore_thread_check(th)) break; + } + eina_iterator_free(it); + if (sorted) + { + sorted = eina_list_sort(sorted, 0, + EINA_COMPARE_CB(_store_filesystem_sort_cb)); + EINA_LIST_FREE(sorted, info) + { + if (!ecore_thread_check(th)) ecore_thread_feedback(th, info); + } + } +} +// ************************************************************************ +//// * End of separate thread function. * +////// ************************************************************************ + +static void +_store_filesystem_list_end(void *data, Ecore_Thread *th) +{ + Elm_Store *st = data; + if (th == st->list_th) st->list_th = NULL; +} + +static void +_store_filesystem_list_cancel(void *data, Ecore_Thread *th) +{ + Elm_Store *st = data; + if (th == st->list_th) st->list_th = NULL; +} + +static void +_store_filesystem_list_update(void *data, Ecore_Thread *th __UNUSED__, void *msg) +{ + Elm_Store *st = data; + Elm_Store_Item_Filesystem *sti; + Elm_Genlist_Item_Class *itc; + Elm_Store_Item_Info_Filesystem *info = msg; + + sti = calloc(1, sizeof(Elm_Store_Item_Filesystem)); + if (!sti) goto done; + eina_lock_new(&sti->base.lock); + EINA_MAGIC_SET(&(sti->base), ELM_STORE_ITEM_MAGIC); + sti->base.store = st; + sti->base.data = info->base.data; + sti->base.mapping = info->base.mapping; + sti->path = eina_stringshare_add(info->path); + + itc = info->base.item_class; + if (!itc) itc = &_store_item_class; + else + { + itc->func.text_get = _store_item_text_get; + itc->func.content_get = _store_item_content_get; + itc->func.state_get = NULL; // FIXME: support state gets later + itc->func.del = _store_item_del; + } + + // FIXME: handle being a parent (tree) + sti->base.item = elm_genlist_item_append(st->genlist, itc, + sti/* item data */, + NULL/* parent */, + ELM_GENLIST_ITEM_NONE, + NULL/* func */, + NULL/* func data */); + st->items = eina_inlist_append(st->items, (Eina_Inlist *)sti); +done: + if (info->base.sort_id) free(info->base.sort_id); + free(info); +} + +// public api calls +static Elm_Store * +_elm_store_new(size_t size) +{ + Elm_Store *st = calloc(1, size); + EINA_SAFETY_ON_NULL_RETURN_VAL(st, NULL); + + // TODO: BEGIN - move to elm_store_init() + eina_magic_string_set(ELM_STORE_MAGIC, "Elm_Store"); + eina_magic_string_set(ELM_STORE_FILESYSTEM_MAGIC, "Elm_Store_Filesystem"); + eina_magic_string_set(ELM_STORE_ITEM_MAGIC, "Elm_Store_Item"); + // setup default item class (always the same) if list cb doesnt provide one + _store_item_class.item_style = "default"; + _store_item_class.func.text_get = _store_item_text_get; + _store_item_class.func.content_get = _store_item_content_get; + _store_item_class.func.state_get = NULL; // FIXME: support state gets later + _store_item_class.func.del = _store_item_del; + // TODO: END - move to elm_store_init() + + EINA_MAGIC_SET(st, ELM_STORE_MAGIC); + st->cache_max = 128; + st->fetch_thread = EINA_TRUE; + return st; +} +#define elm_store_new(type) (type*)_elm_store_new(sizeof(type)) + +static void +_elm_store_filesystem_free(Elm_Store *store) +{ + Elm_Store_Filesystem *st = (Elm_Store_Filesystem *)store; + eina_stringshare_del(st->dir); +} + +static void +_elm_store_filesystem_item_free(Elm_Store_Item *item) +{ + Elm_Store_Item_Filesystem *sti = (Elm_Store_Item_Filesystem *)item; + eina_stringshare_del(sti->path); +} + +EAPI Elm_Store * +elm_store_filesystem_new(void) +{ + Elm_Store_Filesystem *st = elm_store_new(Elm_Store_Filesystem); + EINA_SAFETY_ON_NULL_RETURN_VAL(st, NULL); + + EINA_MAGIC_SET(st, ELM_STORE_FILESYSTEM_MAGIC); + st->base.free = _elm_store_filesystem_free; + st->base.item.free = _elm_store_filesystem_item_free; + + return &st->base; +} + +EAPI void +elm_store_free(Elm_Store *st) +{ + void (*item_free)(Elm_Store_Item *); + if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return; + if (st->list_th) + { + ecore_thread_cancel(st->list_th); + st->list_th = NULL; + } + eina_list_free(st->realized); + item_free = st->item.free; + while (st->items) + { + Elm_Store_Item *sti = (Elm_Store_Item *)st->items; + if (sti->eval_job) ecore_job_del(sti->eval_job); + if (sti->fetch_th) + { + ecore_thread_cancel(sti->fetch_th); + sti->fetch_th = NULL; + } + if (item_free) item_free(sti); + eina_lock_take(&sti->lock); + if (sti->data) + { + if (st->cb.unfetch.func) + st->cb.unfetch.func(st->cb.unfetch.data, sti); + sti->data = NULL; + } + eina_lock_release(&sti->lock); + eina_lock_free(&sti->lock); + free(sti); + } + if (st->genlist) + { + evas_object_event_callback_del_full(st->genlist, EVAS_CALLBACK_DEL, _store_genlist_del, st); + evas_object_smart_callback_del(st->genlist, "realized", _store_genlist_item_realized); + evas_object_smart_callback_del(st->genlist, "unrealized", _store_genlist_item_unrealized); + elm_genlist_clear(st->genlist); + st->genlist = NULL; + } + if (st->free) st->free(st); + free(st); +} + +EAPI void +elm_store_target_genlist_set(Elm_Store *st, Evas_Object *obj) +{ + if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return; + if (st->genlist == obj) return; + if (st->genlist) + { + evas_object_event_callback_del_full(st->genlist, EVAS_CALLBACK_DEL, _store_genlist_del, st); + evas_object_smart_callback_del(st->genlist, "realized", _store_genlist_item_realized); + evas_object_smart_callback_del(st->genlist, "unrealized", _store_genlist_item_unrealized); + elm_genlist_clear(st->genlist); + } + st->genlist = obj; + if (!st->genlist) return; + evas_object_smart_callback_add(st->genlist, "realized", _store_genlist_item_realized, st); + evas_object_smart_callback_add(st->genlist, "unrealized", _store_genlist_item_unrealized, st); + evas_object_event_callback_add(st->genlist, EVAS_CALLBACK_DEL, _store_genlist_del, st); + elm_genlist_clear(st->genlist); +} + +EAPI void +elm_store_filesystem_directory_set(Elm_Store *store, const char *dir) +{ + Elm_Store_Filesystem *st = (Elm_Store_Filesystem *)store; + if (!EINA_MAGIC_CHECK(store, ELM_STORE_MAGIC)) return; + if (!EINA_MAGIC_CHECK(st, ELM_STORE_FILESYSTEM_MAGIC)) return; + if (store->list_th) + { + ecore_thread_cancel(store->list_th); + store->list_th = NULL; + } + if (!eina_stringshare_replace(&st->dir, dir)) return; + store->list_th = ecore_thread_feedback_run(_store_filesystem_list_do, + _store_filesystem_list_update, + _store_filesystem_list_end, + _store_filesystem_list_cancel, + st, EINA_TRUE); +} + +EAPI const char * +elm_store_filesystem_directory_get(const Elm_Store *store) +{ + const Elm_Store_Filesystem *st = (const Elm_Store_Filesystem *)store; + if (!EINA_MAGIC_CHECK(store, ELM_STORE_MAGIC)) return NULL; + if (!EINA_MAGIC_CHECK(st, ELM_STORE_FILESYSTEM_MAGIC)) return NULL; + return st->dir; +} + +EAPI void +elm_store_cache_set(Elm_Store *st, int max) +{ + if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return; + if (max < 0) max = 0; + st->cache_max = max; + _store_cache_trim(st); +} + +EAPI int +elm_store_cache_get(const Elm_Store *st) +{ + if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return 0; + return st->cache_max; +} + +EAPI void +elm_store_list_func_set(Elm_Store *st, Elm_Store_Item_List_Cb func, const void *data) +{ + if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return; + st->cb.list.func = func; + st->cb.list.data = (void *)data; +} + +EAPI void +elm_store_fetch_func_set(Elm_Store *st, Elm_Store_Item_Fetch_Cb func, const void *data) +{ + if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return; + st->cb.fetch.func = func; + st->cb.fetch.data = (void *)data; +} + +EAPI void +elm_store_fetch_thread_set(Elm_Store *st, Eina_Bool use_thread) +{ + if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return; + st->fetch_thread = !!use_thread; +} + +EAPI Eina_Bool +elm_store_fetch_thread_get(const Elm_Store *st) +{ + if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return EINA_FALSE; + return st->fetch_thread; +} + +EAPI void +elm_store_unfetch_func_set(Elm_Store *st, Elm_Store_Item_Unfetch_Cb func, const void *data) +{ + if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return; + st->cb.unfetch.func = func; + st->cb.unfetch.data = (void *)data; +} + +EAPI void +elm_store_sorted_set(Elm_Store *st, Eina_Bool sorted) +{ + if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return; + st->sorted = sorted; +} + +EAPI Eina_Bool +elm_store_sorted_get(const Elm_Store *st) +{ + if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return EINA_FALSE; + return st->sorted; +} + +EAPI void +elm_store_item_data_set(Elm_Store_Item *sti, void *data) +{ + if (!EINA_MAGIC_CHECK(sti, ELM_STORE_ITEM_MAGIC)) return; +//// let fetch/unfetch do the locking +// eina_lock_take(&sti->lock); + sti->data = data; +// eina_lock_release(&sti->lock); +} + +EAPI void * +elm_store_item_data_get(Elm_Store_Item *sti) +{ + if (!EINA_MAGIC_CHECK(sti, ELM_STORE_ITEM_MAGIC)) return NULL; + void *d; +//// let fetch/unfetch do the locking +// eina_lock_take(&sti->lock); + d = sti->data; +// eina_lock_release(&sti->lock); + return d; +} + +EAPI const Elm_Store * +elm_store_item_store_get(const Elm_Store_Item *sti) +{ + if (!EINA_MAGIC_CHECK(sti, ELM_STORE_ITEM_MAGIC)) return NULL; + // dont need lock + return sti->store; +} + +EAPI const Elm_Object_Item * +elm_store_item_genlist_item_get(const Elm_Store_Item *sti) +{ + if (!EINA_MAGIC_CHECK(sti, ELM_STORE_ITEM_MAGIC)) return NULL; + // dont need lock + return sti->item; +} + +EAPI const char * +elm_store_item_filesystem_path_get(const Elm_Store_Item *item) +{ + Elm_Store_Item_Filesystem *sti = (Elm_Store_Item_Filesystem *)item; + Elm_Store_Filesystem *st; + if (!EINA_MAGIC_CHECK(item, ELM_STORE_ITEM_MAGIC)) return NULL; + if (!EINA_MAGIC_CHECK(item->store, ELM_STORE_MAGIC)) return NULL; + /* ensure we're dealing with filesystem item */ + st = (Elm_Store_Filesystem *)item->store; + if (!EINA_MAGIC_CHECK(st, ELM_STORE_FILESYSTEM_MAGIC)) return NULL; + // dont need lock + return sti->path; +} diff --git a/libraries/elementary/src/lib/elm_store.h b/libraries/elementary/src/lib/elm_store.h new file mode 100644 index 0000000..8b28e91 --- /dev/null +++ b/libraries/elementary/src/lib/elm_store.h @@ -0,0 +1,402 @@ +/** + * @defgroup Store Elementary Store + * @ingroup Elementary + * + * Store is an abstracting API that is intended to farm off fetching of data + * to threads running asynchronously from the mainloop that actually fetch + * data needed for a genlist (or possibly future other widgets) so scrolling + * never blocks waiting on IO (though normally this should be the users + * job - if using genlist, to ensure all data genlist needs is in memory at + * the time it needs it, and if it isn't to queue and defer a fetch and let + * genlist know later when its ready. Store actually does this and implements + * the infrastructure of this, leaving the actual fetch and convert up to + * functions provided by the user). + * + * It is possible for store to run inline without a thread, but this is + * highly inadvisable. you can disable this with: + * + * elm_store_fetch_thread_set(store, EINA_FALSE); + * + * Store works first by creating a store, setting up functions to list items + * and fetch items. Currently the only store type supported is the + * filesystem store, which will list the files inside a directory (not + * recursively) and then hand each file it finds (the file path) to the + * list function for evaluation. + * + * The list function may look at filename, may open the file or do + * anything it likes to determine something about the file. Either it + * filters it out (returns EINA_FALSE) and it is discarded or it + * returns EINA_TRUE and also provides a "sort id" which is a string + * store uses to figure out sorting. This string could be the filename, or + * some data based on its contents. The strings are sorted alphabetically + * like any normal ASCII strings, with case being important. As this listing + * function runs in a thread, it can do blocking IO and parsing without + * hurting the fluidity of the main loop and GUI. The list function also + * returns information on how to map fields in the source file to elements + * of the genlist item. For example, how the fetcher reads the private + * data struct of the user (what memory offset in the struct the data is at) + * and what type is there (it's a label of some sort, an icon, or with a + * custom mapping function that figures it out itself and creates the + * content needed for the genlist item). + * + * Store then uses this sort id to build (over time) a sorted list of items + * that then map 1:1 to genlist items. When these items are visible and + * need content, Store calls the fetch function per item, which is responsible + * for fetching the data from the given item and returning data to store + * so it can map this to some item content. This function also runs in a + * thread, and thus can do blocking IO work to later return the data. Sorting + * is optional and can be enabled or disabled too. + * + * When items are no longer needed, store will cal the unfetch function to + * free data in memory about that item that is no longer needed. This function + * is called in the mainloop and is expected to take minimal or almost no time + * to simply free up memory resources. + * + * @{ + */ + +typedef struct _Elm_Store Elm_Store; /**< A store object */ +typedef struct _Elm_Store_Item Elm_Store_Item; /**< A handle of a store item passed to store fetch/unfetch functions */ +typedef struct _Elm_Store_Item_Info Elm_Store_Item_Info; /**< Basic information about a store item - always cast into a specific type like Elm_Store_Item_Info_Filesystem */ +typedef struct _Elm_Store_Item_Info_Filesystem Elm_Store_Item_Info_Filesystem; /**< Filesystem specific information about a store item */ +typedef struct _Elm_Store_Item_Mapping Elm_Store_Item_Mapping; /**< A basic way of telling Store how to take your return data (string, or something else from your struct) and convert it into something genlist can use */ +typedef struct _Elm_Store_Item_Mapping_Empty Elm_Store_Item_Mapping_Empty; /**< An empty piece of mapping information. Useful for String labels as they get used directly */ +typedef struct _Elm_Store_Item_Mapping_Icon Elm_Store_Item_Mapping_Icon; /***< The data being mapped at the given address is an icon, so use these properties for finding it */ +typedef struct _Elm_Store_Item_Mapping_Photo Elm_Store_Item_Mapping_Photo; /**< The data is a photo, so use these parameters to find it */ +typedef struct _Elm_Store_Item_Mapping_Custom Elm_Store_Item_Mapping_Custom; /**> The item needs a custom mapping which means calling a function and returning a string from it, as opposed to a static lookup. It should not be allocated, and should live in a buffer in memory that survives the return of this function if its a label, or an allocated icon object if its an icon needed etc. */ + +typedef Eina_Bool (*Elm_Store_Item_List_Cb)(void *data, Elm_Store_Item_Info *info); /**< Function to call for listing an item */ +typedef void (*Elm_Store_Item_Fetch_Cb)(void *data, Elm_Store_Item *sti); /**< Function to call to fetch item data */ +typedef void (*Elm_Store_Item_Unfetch_Cb)(void *data, Elm_Store_Item *sti); /**< Function to cal lto un-fetch (free) an item */ +typedef void *(*Elm_Store_Item_Mapping_Cb)(void *data, Elm_Store_Item *sti, const char *part); /**< Custom mapping function to call */ + +typedef enum +{ + ELM_STORE_ITEM_MAPPING_NONE = 0, + ELM_STORE_ITEM_MAPPING_LABEL, /**< const char * -> label */ + ELM_STORE_ITEM_MAPPING_STATE, /**< Eina_Bool -> state */ + ELM_STORE_ITEM_MAPPING_ICON, /**< char * -> icon path */ + ELM_STORE_ITEM_MAPPING_PHOTO, /**< char * -> photo path */ + ELM_STORE_ITEM_MAPPING_CUSTOM, /**< item->custom(it->data, it, part) -> void * (-> any) */ + ELM_STORE_ITEM_MAPPING_LAST +} Elm_Store_Item_Mapping_Type; + +struct _Elm_Store_Item_Mapping_Icon +{ + int w, h; /**< The desired icon size in addition to the file path returned from the mapping */ + Elm_Icon_Lookup_Order lookup_order; /**< The order in which to find the icon */ + Eina_Bool standard_name : 1; /**< Use a standard name to find it (EINA_TRUE) or not */ + Eina_Bool no_scale : 1; /**< EINA_TRUE is you don't want the icon scaled */ + Eina_Bool smooth : 1; /**< EINA_TRUE if icon is to be smooth scaled */ + Eina_Bool scale_up : 1; /**< EINA_TRUE if scaling up is allowed */ + Eina_Bool scale_down : 1; /**< EINA_TRUE if scaling down is allowed */ +}; + +struct _Elm_Store_Item_Mapping_Empty +{ + Eina_Bool dummy; /**< dummy entry - set to anything you like */ +}; + +struct _Elm_Store_Item_Mapping_Photo +{ + int size; /**< Photo size to use (see elm_photo_add()) with the given photo path */ +}; + +struct _Elm_Store_Item_Mapping_Custom +{ + Elm_Store_Item_Mapping_Cb func; /**< The function called to do the custom mapping and return it */ +}; + +struct _Elm_Store_Item_Mapping +{ + Elm_Store_Item_Mapping_Type type; /**< what kind of mapping is this */ + const char *part; /**< what part name in the genlist item is this filling in */ + int offset; /**< offset in memory (in bytes) relative to base of structure for item data where the data for the mapping lives */ + union + { + Elm_Store_Item_Mapping_Empty empty; + Elm_Store_Item_Mapping_Icon icon; + Elm_Store_Item_Mapping_Photo photo; + Elm_Store_Item_Mapping_Custom custom; + // add more types here + } details; /**< Allowed to be one of these possible mapping types */ +}; + +struct _Elm_Store_Item_Info +{ + Elm_Genlist_Item_Class *item_class; /**< The genlist item class that should be used for the item that has been listed */ + const Elm_Store_Item_Mapping *mapping; /**< What kind of mappings do we use for the fields of this item to fill in the genlist item. Terminate array pointed to here with ELM_STORE_ITEM_MAPPING_END */ + void *data; /**< Pointer to pass to struct data in memory if its already there, of not, NULL */ + char *sort_id; /**< Sort ID string (strduped()) to know how to wort items, or NULL, if you don't care */ +}; + +struct _Elm_Store_Item_Info_Filesystem +{ + Elm_Store_Item_Info base; /**< Base information about an item */ + char *path; /**< Extra information specific to the filesystem store */ +}; + +#define ELM_STORE_ITEM_MAPPING_END { ELM_STORE_ITEM_MAPPING_NONE, NULL, 0, { .empty = { EINA_TRUE } } } /**< Use this to end a list of mappings */ +#define ELM_STORE_ITEM_MAPPING_OFFSET(st, it) offsetof(st, it) /**< Use this to get the offset in bytes in memory for where the data for the mapping lives relative to the item data (a private struct pointed to owned by the user */ + +/** + * Create a new store object + * + * This creates a new store object to then configure so it works. + * + * @return A new store object, or NULL if creation fails + * + * @ingroup Store + */ +EAPI Elm_Store *elm_store_filesystem_new(void); +/** + * Free the store object and all items it manages + * + * This frees the given @p st store and all the items it manages. It will + * clear the List that it populated, but otherwise leave it alone. It will + * cancel background threads (and may have to wait for them to complete a + * pending operation to do this). + * + * @param st The store to free + * + * @ingroup Store + */ +EAPI void elm_store_free(Elm_Store *st); + +/** + * Set the path to the directory to scan for a filesystem store + * + * This sets the directory (@p dir) to scan and begins scanning in the + * the background in threads (or not if threading is disabled with + * elm_store_fetch_thread_set()). Note that Listing is always done in a thread + * but fetching may not be if disabled here. This should be the last thing + * called after fetch, list and unfetch functions are set, as well as target + * genlist etc. You also should not change the directory once set. If you + * need a new directory scanned, create a new store. + * + * @param st The store to modify + * @param dir A string giving the path to the directory to scan + * + * @ingroup Store + */ +EAPI void elm_store_filesystem_directory_set(Elm_Store *st, const char *dir); + +/** + * Get the directory set on a filesystem store + * + * This gets the directory set by elm_store_filesystem_directory_set(). This + * string returned will be valid until elm_store_filesystem_directory_set() + * changes it or until the store is freed with elm_store_free(). + * + * @return A string with the path set, or NULL if none set. + * + * @ingroup Store + */ +EAPI const char *elm_store_filesystem_directory_get(const Elm_Store *st); + +/** + * Get the path of a specific store item + * + * This returns the full path of a store item. This string is valid only + * during the list function set by elm_store_list_func_set() or during the + * fetch function set by elm_store_fetch_func_set() or during the unfetch + * function set by elm_store_unfetch_func_set(). + * + * @param sti The store item to get the path from + * @return A full path in a string or NULL if none available + * + * @ingroup Store + */ +EAPI const char *elm_store_item_filesystem_path_get(const Elm_Store_Item *sti); + +/** + * Set the target genlist to fill in from the store + * + * This tells the store the target genlist to use to fill in content from + * the store. Once a store starts "going" via elm_store_filesystem_directory_set() + * The target should never be changed again. + * + * @param st The store to do the filling. + * @param obj The genlist object to fill in and control the content of from the store. + * + * @ingroup Store + */ +EAPI void elm_store_target_genlist_set(Elm_Store *st, Evas_Object *obj); + +/** + * Set the maximum number of items that are not visible to keep cached + * + * Store may keep some items around for caching purposes that cannot be seen, + * so this controls the maximum number. The default is 128, but may change + * at any point in time in the future. + * + * @param st The store to modify + * @param max The number of items to keep (should be greater than or equal to 0) + * + * @ingroup Store + */ +EAPI void elm_store_cache_set(Elm_Store *st, int max); + +/** + * Get the maximum number if items to cache + * + * This returns the number of items at most to cache. + * + * @param st The store to query + * @return The maximum number of items to cache (>= 0) + * @see elm_store_cache_set() + * + * @ingroup Store + */ +EAPI int elm_store_cache_get(const Elm_Store *st); + +/** + * Set the function used to deal with listing of items + * + * This function is called per item that is found so it can examine the item + * and discard it (return EINA_FALSE to discard, or EINA_TRUE to accept), and + * work out some sorting ID (that may be filename or anything else based on + * content). This function is always called from a thread. + * + * @param st The store to set the function of + * @param func The function to be called + * @param data the data pointer to be passed to the @p func function when called + * + * @ingroup Store + */ +EAPI void elm_store_list_func_set(Elm_Store *st, Elm_Store_Item_List_Cb func, const void *data); + +/** + * Set the function used to deal with fetching of items + * + * This function is called per item that needs data to be fetched when it + * becomes visible and such data is needed. This function is normally run + * from a thread (unless elm_store_fetch_thread_set() disables this). The + * fetch function is to read data from the source and fill a structure + * allocated for this item with fields and then rely on the mapping setup + * to tell Store how to take a field in the structure and apply it to a + * genlist item. + * + * @param st The store to set the function of + * @param func The function to be called + * @param data the data pointer to be passed to the @p func function when called + * + * @ingroup Store + */ +EAPI void elm_store_fetch_func_set(Elm_Store *st, Elm_Store_Item_Fetch_Cb func, const void *data); + +/** + * Set the function used to free the structure allocated for the item + * + * This function is called per item when it is not needed in memory anymore + * and should free the structure allocated in and filled in the function set + * by elm_store_fetch_func_set(). + * + * @param st The store to set the function of + * @param func The function to be called + * @param data the data pointer to be passed to the @p func function when called + * + * @ingroup Store + */ +EAPI void elm_store_unfetch_func_set(Elm_Store *st, Elm_Store_Item_Unfetch_Cb func, const void *data); + +/** + * Enable or disable fetching in a thread for Store + * + * @param st The store to modify + * @param use_thread EINA_TRUE to use a thread to fetch, EINA_FALSE don't use a thread. + * + * @ingroup Store + */ +EAPI void elm_store_fetch_thread_set(Elm_Store *st, Eina_Bool use_thread); + +/** + * Get the thread enabled fetching option for Store + * + * @return The state set currently for the store. + * @see elm_store_fetch_thread_set() + * + * @ingroup Store + */ +EAPI Eina_Bool elm_store_fetch_thread_get(const Elm_Store *st); + +/** + * Set if items are to be sorted or not. + * + * By default items are not sorted, but read "in order" as they are found. If + * you want to sort, your list function set by elm_store_list_func_set() must + * provide a sort ID to sort by, and then Store will take care of sorting when + * it inserts items. You should set this up before you begin listing items + * in the store and then never change it again. + * + * @param st The store to modify + * @param sorted EINA_TRUE if we are to sort, EINA_FALSE if not. + * + * @ingroup Store + */ +EAPI void elm_store_sorted_set(Elm_Store *st, Eina_Bool sorted); + +/** + * Get the sorting flag + * + * Get the sorted flag as set by elm_store_sorted_set(). + * + * @param st The store to query + * @return EINA_TRUE if sorted, EINA_FALSE if not. + * + * @ingroup Store + */ +EAPI Eina_Bool elm_store_sorted_get(const Elm_Store *st); + +/** + * Set the item data holding item fields to map to item values in genlist + * + * Once you decode an item, allocate a structure for it and fill the structure, + * you should set the item data with this function (eg in the fetch function). + * This item pointer is the base offset to use when mapping fields to item + * values. Once you unfetch, store will handle NULLing the data pointer for you. + * + * @param sti The store item to set the data pointer of + * @param data The data pointer to set. + * + * @ingroup Store + */ +EAPI void elm_store_item_data_set(Elm_Store_Item *sti, void *data); + +/** + * Get the item data + * + * This gets the data pointer set by elm_store_item_data_set(). + * + * @param sti The store item to query + * @return The data pointer set on the item + * + * @ingroup Store + */ +EAPI void *elm_store_item_data_get(Elm_Store_Item *sti); + +/** + * Fetch the store than a store item belongs to + * + * This fetches the store object that owns the store item. + * + * @param sti The store item to query + * @return The store the item belongs to + * + * @ingroup Store + */ +EAPI const Elm_Store *elm_store_item_store_get(const Elm_Store_Item *sti); + +/** + * Fetch the genlist item that this store item controls + * + * @param sti The store item to query + * @return The genlist object item handle controlled by this store item + * + * @ingroup Store + */ +EAPI const Elm_Object_Item *elm_store_item_genlist_item_get(const Elm_Store_Item *sti); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_table.c b/libraries/elementary/src/lib/elm_table.c new file mode 100644 index 0000000..532ccf4 --- /dev/null +++ b/libraries/elementary/src/lib/elm_table.c @@ -0,0 +1,243 @@ +#include +#include "elm_priv.h" + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *tbl; +}; + +static const char *widtype = NULL; +static void _del_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _sub_del(void *data, Evas_Object *obj, void *event_info); +static void _theme_hook(Evas_Object *obj); + +static void +_del_pre_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_event_callback_del_full + (wd->tbl, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj); + evas_object_del(wd->tbl); +} + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + free(wd); +} + +static Eina_Bool +_elm_table_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next) +{ + Widget_Data *wd = elm_widget_data_get(obj); + const Eina_List *items; + void *(*list_data_get) (const Eina_List *list); + Eina_List *(*list_free) (Eina_List *list); + + if ((!wd) || (!wd->tbl)) + return EINA_FALSE; + + /* Focus chain */ + /* TODO: Change this to use other chain */ + if ((items = elm_widget_focus_custom_chain_get(obj))) + { + list_data_get = eina_list_data_get; + list_free = NULL; + } + else + { + items = evas_object_table_children_get(wd->tbl); + list_data_get = eina_list_data_get; + list_free = eina_list_free; + + if (!items) return EINA_FALSE; + } + + Eina_Bool ret = elm_widget_focus_list_next_get(obj, items, list_data_get, + dir, next); + + if (list_free) + list_free((Eina_List *)items); + + return ret; +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if ((!wd) || (!wd->tbl)) + return; + + evas_object_table_mirrored_set(wd->tbl, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; + Evas_Coord w, h; + if (!wd) return; + evas_object_size_hint_min_get(wd->tbl, &minw, &minh); + evas_object_size_hint_max_get(wd->tbl, &maxw, &maxh); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, maxw, maxh); + evas_object_geometry_get(obj, NULL, NULL, &w, &h); + if (w < minw) w = minw; + if (h < minh) h = minh; + if ((maxw >= 0) && (w > maxw)) w = maxw; + if ((maxh >= 0) && (h > maxh)) h = maxh; + evas_object_resize(obj, w, h); +} + +static void +_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _sizing_eval(data); +} + +static void +_sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + _sizing_eval(obj); +} + +EAPI Evas_Object * +elm_table_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "table"); + elm_widget_type_set(obj, "table"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); + elm_widget_focus_next_hook_set(obj, _elm_table_focus_next_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); + elm_widget_highlight_ignore_set(obj, EINA_FALSE); + elm_widget_theme_hook_set(obj, _theme_hook); + + wd->tbl = evas_object_table_add(e); + evas_object_event_callback_add(wd->tbl, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + elm_widget_resize_object_set(obj, wd->tbl); + + evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + return obj; +} + +EAPI void +elm_table_homogeneous_set(Evas_Object *obj, Eina_Bool homogeneous) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_table_homogeneous_set(wd->tbl, homogeneous); +} + +EAPI Eina_Bool +elm_table_homogeneous_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return evas_object_table_homogeneous_get(wd->tbl); +} + +EAPI void +elm_table_padding_set(Evas_Object *obj, Evas_Coord horizontal, Evas_Coord vertical) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_table_padding_set(wd->tbl, horizontal, vertical); +} + +EAPI void +elm_table_padding_get(const Evas_Object *obj, Evas_Coord *horizontal, Evas_Coord *vertical) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_table_padding_get(wd->tbl, horizontal, vertical); +} + +EAPI void +elm_table_pack(Evas_Object *obj, Evas_Object *subobj, int x, int y, int w, int h) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_widget_sub_object_add(obj, subobj); + evas_object_table_pack(wd->tbl, subobj, x, y, w, h); +} + +EAPI void +elm_table_unpack(Evas_Object *obj, Evas_Object *subobj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_widget_sub_object_del(obj, subobj); + evas_object_table_unpack(wd->tbl, subobj); +} + +EAPI void +elm_table_pack_set(Evas_Object *subobj, int x, int y, int w, int h) +{ + Evas_Object *obj = elm_widget_parent_widget_get(subobj); + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_table_pack(wd->tbl, subobj, x, y, w, h); +} + +EAPI void +elm_table_pack_get(Evas_Object *subobj, int *x, int *y, int *w, int *h) +{ + Evas_Object *obj = elm_widget_parent_widget_get(subobj); + unsigned short ix, iy, iw, ih; + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_table_pack_get(wd->tbl, subobj, &ix, &iy, &iw, &ih); + if (x) *x = ix; + if (y) *y = iy; + if (w) *w = iw; + if (h) *h = ih; +} + +EAPI void +elm_table_clear(Evas_Object *obj, Eina_Bool clear) +{ + Eina_List *chld; + Evas_Object *o; + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + chld = evas_object_table_children_get(wd->tbl); + EINA_LIST_FREE(chld, o) elm_widget_sub_object_del(obj, o); + evas_object_table_clear(wd->tbl, clear); +} diff --git a/libraries/elementary/src/lib/elm_table.h b/libraries/elementary/src/lib/elm_table.h new file mode 100644 index 0000000..ceffc86 --- /dev/null +++ b/libraries/elementary/src/lib/elm_table.h @@ -0,0 +1,159 @@ +/** + * @defgroup Table Table + * @ingroup Elementary + * + * A container widget to arrange other widgets in a table where items can + * span multiple columns or rows - even overlap (and then be raised or + * lowered accordingly to adjust stacking if they do overlap). + * + * The row and column count is not fixed. The table widget adjusts itself when + * subobjects are added to it dynamically. + * + * The most common way to use a table is: + * @code + * table = elm_table_add(win); + * evas_object_show(table); + * elm_table_padding_set(table, space_between_columns, space_between_rows); + * elm_table_pack(table, table_content_object, x_coord, y_coord, colspan, rowspan); + * elm_table_pack(table, table_content_object, next_x_coord, next_y_coord, colspan, rowspan); + * elm_table_pack(table, table_content_object, other_x_coord, other_y_coord, colspan, rowspan); + * @endcode + * + * The following are examples of how to use a table: + * @li @ref tutorial_table_01 + * @li @ref tutorial_table_02 + * + * @{ + */ + +/** + * @brief Add a new table to the parent + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * @ingroup Table + */ +EAPI Evas_Object *elm_table_add(Evas_Object *parent); + +/** + * @brief Set the homogeneous layout in the table + * + * @param obj The layout object + * @param homogeneous A boolean to set if the layout is homogeneous in the + * table (EINA_TRUE = homogeneous, EINA_FALSE = no homogeneous) + * + * @ingroup Table + */ +EAPI void elm_table_homogeneous_set(Evas_Object *obj, Eina_Bool homogeneous); + +/** + * @brief Get the current table homogeneous mode. + * + * @param obj The table object + * @return A boolean to indicating if the layout is homogeneous in the table + * (EINA_TRUE = homogeneous, EINA_FALSE = no homogeneous) + * + * @ingroup Table + */ +EAPI Eina_Bool elm_table_homogeneous_get(const Evas_Object *obj); + +/** + * @brief Set padding between cells. + * + * @param obj The layout object. + * @param horizontal set the horizontal padding. + * @param vertical set the vertical padding. + * + * Default value is 0. + * + * @ingroup Table + */ +EAPI void elm_table_padding_set(Evas_Object *obj, Evas_Coord horizontal, Evas_Coord vertical); + +/** + * @brief Get padding between cells. + * + * @param obj The layout object. + * @param horizontal set the horizontal padding. + * @param vertical set the vertical padding. + * + * @ingroup Table + */ +EAPI void elm_table_padding_get(const Evas_Object *obj, Evas_Coord *horizontal, Evas_Coord *vertical); + +/** + * @brief Add a subobject on the table with the coordinates passed + * + * @param obj The table object + * @param subobj The subobject to be added to the table + * @param x Row number + * @param y Column number + * @param w colspan + * @param h rowspan + * + * @note All positioning inside the table is relative to rows and columns, so + * a value of 0 for x and y, means the top left cell of the table, and a + * value of 1 for w and h means @p subobj only takes that 1 cell. + * + * @ingroup Table + */ +EAPI void elm_table_pack(Evas_Object *obj, Evas_Object *subobj, int x, int y, int w, int h); + +/** + * @brief Remove child from table. + * + * @param obj The table object + * @param subobj The subobject + * + * @ingroup Table + */ +EAPI void elm_table_unpack(Evas_Object *obj, Evas_Object *subobj); + +/** + * @brief Faster way to remove all child objects from a table object. + * + * @param obj The table object + * @param clear If true, will delete children, else just remove from table. + * + * @ingroup Table + */ +EAPI void elm_table_clear(Evas_Object *obj, Eina_Bool clear); + +/** + * @brief Set the packing location of an existing child of the table + * + * @param subobj The subobject to be modified in the table + * @param x Row number + * @param y Column number + * @param w rowspan + * @param h colspan + * + * Modifies the position of an object already in the table. + * + * @note All positioning inside the table is relative to rows and columns, so + * a value of 0 for x and y, means the top left cell of the table, and a + * value of 1 for w and h means @p subobj only takes that 1 cell. + * + * @ingroup Table + */ +EAPI void elm_table_pack_set(Evas_Object *subobj, int x, int y, int w, int h); + +/** + * @brief Get the packing location of an existing child of the table + * + * @param subobj The subobject to be modified in the table + * @param x Row number + * @param y Column number + * @param w rowspan + * @param h colspan + * + * @see elm_table_pack_set() + * + * @ingroup Table + */ +EAPI void elm_table_pack_get(Evas_Object *subobj, int *x, int *y, int *w, int *h); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_theme.c b/libraries/elementary/src/lib/elm_theme.c new file mode 100644 index 0000000..a0caea2 --- /dev/null +++ b/libraries/elementary/src/lib/elm_theme.c @@ -0,0 +1,706 @@ +#include +#include "elm_priv.h" +#include "els_icon.h" + +static Elm_Theme theme_default = +{ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1 +}; + +static Eina_List *themes = NULL; + +static void +_elm_theme_clear(Elm_Theme *th) +{ + const char *p; + EINA_LIST_FREE(th->themes, p) + eina_stringshare_del(p); + EINA_LIST_FREE(th->overlay, p) + eina_stringshare_del(p); + EINA_LIST_FREE(th->extension, p) + eina_stringshare_del(p); + if (th->cache) + { + eina_hash_free(th->cache); + th->cache = NULL; + } + if (th->cache_data) + { + eina_hash_free(th->cache_data); + th->cache_data = NULL; + } + if (th->theme) + { + eina_stringshare_del(th->theme); + th->theme = NULL; + } + if (th->ref_theme) + { + th->ref_theme->referrers = + eina_list_remove(th->ref_theme->referrers, th); + elm_theme_free(th->ref_theme); + th->ref_theme = NULL; + } +} + +static const char * +_elm_theme_find_try(Elm_Theme *th, const char *f, const char *group) +{ + const char *file; + + if (edje_file_group_exists(f, group)) + { + file = eina_stringshare_add(f); + if (file) + { + eina_hash_add(th->cache, group, file); + return file; + } + } + return NULL; +} + +static const char * +_elm_theme_theme_element_try(Elm_Theme *th, const char *home, const char *f, const char *group) +{ + char buf[PATH_MAX]; + const char *file = NULL; + + if ((f[0] == '/') || ((f[0] == '.') && (f[1] == '/')) || + ((f[0] == '.') && (f[1] == '.') && (f[2] == '/')) || + ((isalpha(f[0])) && (f[1] == ':'))) + return _elm_theme_find_try(th, f, group); + else if (((f[0] == '~') && (f[1] == '/'))) + { + snprintf(buf, sizeof(buf), "%s/%s", home, f + 2); + return _elm_theme_find_try(th, buf, group); + } + snprintf(buf, sizeof(buf), "%s/"ELEMENTARY_BASE_DIR"/themes/%s.edj", home, f); + file = _elm_theme_find_try(th, buf, group); + if (file) return file; + snprintf(buf, sizeof(buf), "%s/themes/%s.edj", _elm_data_dir, f); + file = _elm_theme_find_try(th, buf, group); + return file; +} + +static const char * +_elm_theme_group_file_find(Elm_Theme *th, const char *group) +{ + const Eina_List *l; + const char *f; + static const char *home = NULL; + const char *file = eina_hash_find(th->cache, group); + + if (file) return file; + if (!home) + { + home = getenv("HOME"); + if (!home) home = ""; + } + EINA_LIST_FOREACH(th->overlay, l, f) + { + file = _elm_theme_theme_element_try(th, home, f, group); + if (file) return file; + } + EINA_LIST_FOREACH(th->themes, l, f) + { + file = _elm_theme_theme_element_try(th, home, f, group); + if (file) return file; + } + EINA_LIST_FOREACH(th->extension, l, f) + { + file = _elm_theme_theme_element_try(th, home, f, group); + if (file) return file; + } + if (th->ref_theme) return _elm_theme_group_file_find(th->ref_theme, group); + return NULL; +} + +static const char * +_elm_theme_find_data_try(Elm_Theme *th, const char *f, const char *key) +{ + char *data; + const char *t; + + data = edje_file_data_get(f, key); + t = eina_stringshare_add(data); + free(data); + if (t) + { + eina_hash_add(th->cache, key, t); + return t; + } + return NULL; +} + +static const char * +_elm_theme_theme_data_try(Elm_Theme *th, const char *home, const char *f, const char *key) +{ + char buf[PATH_MAX]; + const char *data = NULL; + + if ((f[0] == '/') || ((f[0] == '.') && (f[1] == '/')) || + ((f[0] == '.') && (f[1] == '.') && (f[2] == '/')) || + ((isalpha(f[0])) && (f[1] == ':'))) + return _elm_theme_find_data_try(th, f, key); + else if (((f[0] == '~') && (f[1] == '/'))) + { + snprintf(buf, sizeof(buf), "%s/%s", home, f + 2); + return _elm_theme_find_try(th, buf, key); + } + snprintf(buf, sizeof(buf), "%s/"ELEMENTARY_BASE_DIR"/themes/%s.edj", home, f); + data = _elm_theme_find_data_try(th, buf, key); + if (data) return data; + snprintf(buf, sizeof(buf), "%s/themes/%s.edj", _elm_data_dir, f); + data = _elm_theme_find_data_try(th, buf, key); + return data; +} + +static const char * +_elm_theme_data_find(Elm_Theme *th, const char *key) +{ + const Eina_List *l; + const char *f; + static const char *home = NULL; + const char *data = eina_hash_find(th->cache_data, key); + + if (data) return data; + if (!home) + { + home = getenv("HOME"); + if (!home) home = ""; + } + EINA_LIST_FOREACH(th->overlay, l, f) + { + data = _elm_theme_theme_data_try(th, home, f, key); + if (data) return data; + } + EINA_LIST_FOREACH(th->themes, l, f) + { + data = _elm_theme_theme_data_try(th, home, f, key); + if (data) return data; + } + EINA_LIST_FOREACH(th->extension, l, f) + { + data = _elm_theme_theme_data_try(th, home, f, key); + if (data) return data; + } + if (th->ref_theme) return _elm_theme_data_find(th->ref_theme, key); + return NULL; +} + +Eina_Bool +_elm_theme_object_set(Evas_Object *parent, Evas_Object *o, const char *clas, const char *group, const char *style) +{ + Elm_Theme *th = NULL; + if (parent) th = elm_widget_theme_get(parent); + return _elm_theme_set(th, o, clas, group, style); +} + +Eina_Bool +_elm_theme_object_icon_set(Evas_Object *parent, Evas_Object *o, const char *group, const char *style) +{ + Elm_Theme *th = NULL; + if (parent) th = elm_widget_theme_get(parent); + return _elm_theme_icon_set(th, o, group, style); +} + +Eina_Bool +_elm_theme_set(Elm_Theme *th, Evas_Object *o, const char *clas, const char *group, const char *style) +{ + const char *file; + char buf2[1024]; + Eina_Bool ok; + + if ((!clas) || (!group) || (!style)) return EINA_FALSE; + if (!th) th = &(theme_default); + snprintf(buf2, sizeof(buf2), "elm/%s/%s/%s", clas, group, style); + file = _elm_theme_group_file_find(th, buf2); + if (file) + { + ok = edje_object_file_set(o, file, buf2); + if (ok) return EINA_TRUE; + else + DBG("could not set theme group '%s' from file '%s': %s", + buf2, file, edje_load_error_str(edje_object_load_error_get(o))); + } + snprintf(buf2, sizeof(buf2), "elm/%s/%s/default", clas, group); + file = _elm_theme_group_file_find(th, buf2); + if (!file) return EINA_FALSE; + ok = edje_object_file_set(o, file, buf2); + if (!ok) + DBG("could not set theme group '%s' from file '%s': %s", + buf2, file, edje_load_error_str(edje_object_load_error_get(o))); + return ok; +} + +Eina_Bool +_elm_theme_icon_set(Elm_Theme *th, Evas_Object *o, const char *group, const char *style) +{ + const char *file; + char buf2[1024]; + int w, h; + + if (!th) th = &(theme_default); + snprintf(buf2, sizeof(buf2), "elm/icon/%s/%s", group, style); + file = _elm_theme_group_file_find(th, buf2); + if (file) + { + _els_smart_icon_file_edje_set(o, file, buf2); + _els_smart_icon_size_get(o, &w, &h); + if (w > 0) return EINA_TRUE; + } + snprintf(buf2, sizeof(buf2), "elm/icon/%s/default", group); + file = _elm_theme_group_file_find(th, buf2); + if (!file) return EINA_FALSE; + _els_smart_icon_file_edje_set(o, file, buf2); + _els_smart_icon_size_get(o, &w, &h); + return (w > 0); +} + +Eina_Bool +_elm_theme_parse(Elm_Theme *th, const char *theme) +{ + Eina_List *names = NULL; + const char *p, *pe; + + if (!th) th = &(theme_default); + if (theme) + { + p = theme; + pe = p; + for (;;) + { + if ((*pe == ':') || (!*pe)) + { // p -> pe == 'name:' + if (pe > p) + { + char *n = malloc(pe - p + 1); + if (n) + { + const char *nn; + + strncpy(n, p, pe - p); + n[pe - p] = 0; + nn = eina_stringshare_add(n); + if (nn) names = eina_list_append(names, nn); + free(n); + } + } + if (!*pe) break; + p = pe + 1; + pe = p; + } + else + pe++; + } + } + p = eina_list_data_get(eina_list_last(names)); + if ((!p) || ((p) && (strcmp(p, "default")))) + { + p = eina_stringshare_add("default"); + if (p) names = eina_list_append(names, p); + } + if (th->cache) eina_hash_free(th->cache); + th->cache = eina_hash_string_superfast_new(EINA_FREE_CB(eina_stringshare_del)); + if (th->cache_data) eina_hash_free(th->cache_data); + th->cache_data = eina_hash_string_superfast_new(EINA_FREE_CB(eina_stringshare_del)); + + EINA_LIST_FREE(th->themes, p) eina_stringshare_del(p); + + th->themes = names; + return EINA_TRUE; +} + +void +_elm_theme_shutdown(void) +{ + _elm_theme_clear(&(theme_default)); +} + +EAPI Elm_Theme * +elm_theme_new(void) +{ + Elm_Theme *th = calloc(1, sizeof(Elm_Theme)); + if (!th) return NULL; + th->ref = 1; + th->themes = eina_list_append(th->themes, eina_stringshare_add("default")); + themes = eina_list_append(themes, th); + return th; +} + +EAPI void +elm_theme_free(Elm_Theme *th) +{ + EINA_SAFETY_ON_NULL_RETURN(th); + th->ref--; + if (th->ref < 1) + { + _elm_theme_clear(th); + themes = eina_list_remove(themes, th); + free(th); + } +} + +EAPI void +elm_theme_copy(Elm_Theme *th, Elm_Theme *thdst) +{ + const Eina_List *l; + const char *f; + + if (!th) th = &(theme_default); + if (!thdst) thdst = &(theme_default); + _elm_theme_clear(thdst); + if (th->ref_theme) + { + thdst->ref_theme = th->ref_theme; + thdst->ref_theme->referrers = + eina_list_append(thdst->ref_theme->referrers, thdst); + thdst->ref_theme->ref++; + } + EINA_LIST_FOREACH(th->overlay, l, f) + { + const char *s = eina_stringshare_add(f); + if (s) thdst->overlay = eina_list_append(thdst->overlay, s); + } + EINA_LIST_FOREACH(th->themes, l, f) + { + const char *s = eina_stringshare_add(f); + if (s) thdst->themes = eina_list_append(thdst->themes, s); + } + EINA_LIST_FOREACH(th->extension, l, f) + { + const char *s = eina_stringshare_add(f); + if (s) thdst->extension = eina_list_append(thdst->extension, s); + } + if (th->theme) thdst->theme = eina_stringshare_add(th->theme); + elm_theme_flush(thdst); +} + +EAPI void +elm_theme_ref_set(Elm_Theme *th, Elm_Theme *thref) +{ + if (!th) th = &(theme_default); + if (!thref) thref = &(theme_default); + if (th->ref_theme == thref) return; + _elm_theme_clear(th); + if (thref) + { + thref->referrers = eina_list_append(thref->referrers, th); + thref->ref++; + } + th->ref_theme = thref; + elm_theme_flush(th); +} + +EAPI Elm_Theme * +elm_theme_ref_get(Elm_Theme *th) +{ + if (!th) th = &(theme_default); + return th->ref_theme; +} + +EAPI Elm_Theme * +elm_theme_default_get(void) +{ + return &theme_default; +} + +EAPI void +elm_theme_overlay_add(Elm_Theme *th, const char *item) +{ + const char *f = eina_stringshare_add(item); + + if (!th) th = &(theme_default); + if (f) th->overlay = eina_list_prepend(th->overlay, f); + elm_theme_flush(th); +} + +EAPI void +elm_theme_overlay_del(Elm_Theme *th, const char *item) +{ + const Eina_List *l; + const char *f, *s; + + if (!th) th = &(theme_default); + s = eina_stringshare_add(item); + EINA_LIST_FOREACH(th->overlay, l, f) + if (f == s) + { + eina_stringshare_del(f); + th->overlay = eina_list_remove_list(th->overlay, (Eina_List *)l); + break; + } + eina_stringshare_del(s); + elm_theme_flush(th); +} + +EAPI const Eina_List * +elm_theme_overlay_list_get(const Elm_Theme *th) +{ + if (!th) th = &(theme_default); + return th->overlay; +} + +EAPI void +elm_theme_extension_add(Elm_Theme *th, const char *item) +{ + const char *f = eina_stringshare_add(item); + + if (!th) th = &(theme_default); + if (f) th->extension = eina_list_append(th->extension, f); + elm_theme_flush(th); +} + +EAPI void +elm_theme_extension_del(Elm_Theme *th, const char *item) +{ + const Eina_List *l; + const char *f, *s; + + if (!th) th = &(theme_default); + s = eina_stringshare_add(item); + EINA_LIST_FOREACH(th->extension, l, f) + if (f == s) + { + eina_stringshare_del(f); + th->extension = eina_list_remove_list(th->extension, (Eina_List *)l); + break; + } + eina_stringshare_del(s); + elm_theme_flush(th); +} + +EAPI const Eina_List * +elm_theme_extension_list_get(const Elm_Theme *th) +{ + if (!th) th = &(theme_default); + return th->extension; +} + +EAPI void +elm_theme_set(Elm_Theme *th, const char *theme) +{ + if (!th) th = &(theme_default); + _elm_theme_parse(th, theme); + if (th->theme) + { + eina_stringshare_del(th->theme); + th->theme = NULL; + } + elm_theme_flush(th); + if (th == &(theme_default)) + eina_stringshare_replace(&_elm_config->theme, theme); +} + +EAPI const char * +elm_theme_get(Elm_Theme *th) +{ + if (!th) th = &(theme_default); + if (!th->theme) + { + Eina_List *l; + const char *f; + char *tmp; + int len; + + len = 0; + EINA_LIST_FOREACH(th->themes, l, f) + { + len += strlen(f); + if (l->next) len += 1; + } + tmp = alloca(len + 1); + tmp[0] = 0; + EINA_LIST_FOREACH(th->themes, l, f) + { + strcat(tmp, f); + if (l->next) strcat(tmp, ":"); + } + th->theme = eina_stringshare_add(tmp); + } + return th->theme; +} + +EAPI const Eina_List * +elm_theme_list_get(const Elm_Theme *th) +{ + if (!th) th = &(theme_default); + return th->themes; +} + +EAPI char * +elm_theme_list_item_path_get(const char *f, Eina_Bool *in_search_path) +{ + static const char *home = NULL; + char buf[PATH_MAX]; + + if (!f) + { + if (in_search_path) *in_search_path = EINA_FALSE; + return NULL; + } + + if (!home) + { + home = getenv("HOME"); + if (!home) home = ""; + } + + if ((f[0] == '/') || ((f[0] == '.') && (f[1] == '/')) || + ((f[0] == '.') && (f[1] == '.') && (f[2] == '/')) || + ((isalpha(f[0])) && (f[1] == ':'))) + { + if (in_search_path) *in_search_path = EINA_FALSE; + return strdup(f); + } + else if (((f[0] == '~') && (f[1] == '/'))) + { + if (in_search_path) *in_search_path = EINA_FALSE; + snprintf(buf, sizeof(buf), "%s/%s", home, f + 2); + return strdup(buf); + } + snprintf(buf, sizeof(buf), "%s/"ELEMENTARY_BASE_DIR"/themes/%s.edj", home, f); + if (ecore_file_exists(buf)) + { + if (in_search_path) *in_search_path = EINA_TRUE; + return strdup(buf); + } + + snprintf(buf, sizeof(buf), "%s/themes/%s.edj", _elm_data_dir, f); + if (ecore_file_exists(buf)) + { + if (in_search_path) *in_search_path = EINA_TRUE; + return strdup(buf); + } + + if (in_search_path) *in_search_path = EINA_FALSE; + return NULL; +} + +EAPI void +elm_theme_flush(Elm_Theme *th) +{ + if (!th) th = &(theme_default); + if (th->cache) eina_hash_free(th->cache); + th->cache = eina_hash_string_superfast_new(EINA_FREE_CB(eina_stringshare_del)); + if (th->cache_data) eina_hash_free(th->cache_data); + th->cache_data = eina_hash_string_superfast_new(EINA_FREE_CB(eina_stringshare_del)); + _elm_win_rescale(th, EINA_TRUE); + _elm_ews_wm_rescale(th, EINA_TRUE); + if (th->referrers) + { + Eina_List *l; + Elm_Theme *th2; + + EINA_LIST_FOREACH(th->referrers, l, th2) elm_theme_flush(th2); + } +} + +EAPI void +elm_theme_full_flush(void) +{ + Eina_List *l; + Elm_Theme *th; + + EINA_LIST_FOREACH(themes, l, th) + { + elm_theme_flush(th); + } + elm_theme_flush(&(theme_default)); +} + +EAPI Eina_List * +elm_theme_name_available_list_new(void) +{ + Eina_List *list = NULL; + Eina_List *dir, *l; + char buf[PATH_MAX], *file, *s, *th; + static const char *home = NULL; + + if (!home) + { + home = getenv("HOME"); + if (!home) home = ""; + } + + snprintf(buf, sizeof(buf), "%s/"ELEMENTARY_BASE_DIR"/themes", home); + dir = ecore_file_ls(buf); + EINA_LIST_FREE(dir, file) + { + snprintf(buf, sizeof(buf), "%s/"ELEMENTARY_BASE_DIR"/themes/%s", home, file); + if ((!ecore_file_is_dir(buf)) && (ecore_file_size(buf) > 0)) + { + s = strchr(file, '.'); + if ((s) && (!strcasecmp(s, ".edj"))) + { + th = strdup(file); + s = strchr(th, '.'); + *s = 0; + list = eina_list_append(list, th); + } + } + free(file); + } + + snprintf(buf, sizeof(buf), "%s/themes", _elm_data_dir); + dir = ecore_file_ls(buf); + EINA_LIST_FREE(dir, file) + { + snprintf(buf, sizeof(buf), "%s/themes/%s", _elm_data_dir, file); + if ((!ecore_file_is_dir(buf)) && (ecore_file_size(buf) > 0)) + { + s = strchr(file, '.'); + if ((s) && (!strcasecmp(s, ".edj"))) + { + int dupp; + + th = strdup(file); + s = strchr(th, '.'); + *s = 0; + dupp = 0; + EINA_LIST_FOREACH(list, l, s) + { + if (!strcmp(s, th)) + { + dupp = 1; + break; + } + } + if (dupp) free(th); + else list = eina_list_append(list, th); + } + } + free(file); + } + list = eina_list_sort(list, 0, EINA_COMPARE_CB(strcasecmp)); + return list; +} + +EAPI void +elm_theme_name_available_list_free(Eina_List *list) +{ + char *s; + EINA_LIST_FREE(list, s) free(s); +} + +EAPI void +elm_object_theme_set(Evas_Object *obj, Elm_Theme *th) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + elm_widget_theme_set(obj, th); +} + +EAPI Elm_Theme * +elm_object_theme_get(const Evas_Object *obj) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); + return elm_widget_theme_get(obj); +} + +EAPI const char * +elm_theme_data_get(Elm_Theme *th, const char *key) +{ + if (!th) th = &(theme_default); + return _elm_theme_data_find(th, key); +} diff --git a/libraries/elementary/src/lib/elm_theme.h b/libraries/elementary/src/lib/elm_theme.h new file mode 100644 index 0000000..10c5f6a --- /dev/null +++ b/libraries/elementary/src/lib/elm_theme.h @@ -0,0 +1,436 @@ +/** + * @defgroup Theme Theme + * @ingroup Elementary + * + * Elementary uses Edje to theme its widgets, naturally. But for the most + * part this is hidden behind a simpler interface that lets the user set + * extensions and choose the style of widgets in a much easier way. + * + * Instead of thinking in terms of paths to Edje files and their groups + * each time you want to change the appearance of a widget, Elementary + * works so you can add any theme file with extensions or replace the + * main theme at one point in the application, and then just set the style + * of widgets with elm_object_style_set() and related functions. Elementary + * will then look in its list of themes for a matching group and apply it, + * and when the theme changes midway through the application, all widgets + * will be updated accordingly. + * + * There are three concepts you need to know to understand how Elementary + * theming works: default theme, extensions and overlays. + * + * Default theme, obviously enough, is the one that provides the default + * look of all widgets. End users can change the theme used by Elementary + * by setting the @c ELM_THEME environment variable before running an + * application, or globally for all programs using the @c elementary_config + * utility. Applications can change the default theme using elm_theme_set(), + * but this can go against the user wishes, so it's not an advised practice. + * + * Ideally, applications should find everything they need in the already + * provided theme, but there may be occasions when that's not enough and + * custom styles are required to correctly express the idea. For this + * cases, Elementary has extensions. + * + * Extensions allow the application developer to write styles of its own + * to apply to some widgets. This requires knowledge of how each widget + * is themed, as extensions will always replace the entire group used by + * the widget, so important signals and parts need to be there for the + * object to behave properly (see documentation of Edje for details). + * Once the theme for the extension is done, the application needs to add + * it to the list of themes Elementary will look into, using + * elm_theme_extension_add(), and set the style of the desired widgets as + * he would normally with elm_object_style_set(). + * + * Overlays, on the other hand, can replace the look of all widgets by + * overriding the default style. Like extensions, it's up to the application + * developer to write the theme for the widgets it wants, the difference + * being that when looking for the theme, Elementary will check first the + * list of overlays, then the set theme and lastly the list of extensions, + * so with overlays it's possible to replace the default view and every + * widget will be affected. This is very much alike to setting the whole + * theme for the application and will probably clash with the end user + * options, not to mention the risk of ending up with not matching styles + * across the program. Unless there's a very special reason to use them, + * overlays should be avoided for the reasons exposed before. + * + * All these theme lists are handled by ::Elm_Theme instances. Elementary + * keeps one default internally and every function that receives one of + * these can be called with NULL to refer to this default (except for + * elm_theme_free()). It's possible to create a new instance of a + * ::Elm_Theme to set other theme for a specific widget (and all of its + * children), but this is as discouraged, if not even more so, than using + * overlays. Don't use this unless you really know what you are doing. + * + * But to be less negative about things, you can look at the following + * examples: + * @li @ref theme_example_01 "Using extensions" + * @li @ref theme_example_02 "Using overlays" + * + * @{ + */ +/** + * @typedef Elm_Theme + * + * Opaque handler for the list of themes Elementary looks for when + * rendering widgets. + * + * Stay out of this unless you really know what you are doing. For most + * cases, sticking to the default is all a developer needs. + */ +typedef struct _Elm_Theme Elm_Theme; + +/** + * Create a new specific theme + * + * This creates an empty specific theme that only uses the default theme. A + * specific theme has its own private set of extensions and overlays too + * (which are empty by default). Specific themes do not fall back to themes + * of parent objects. They are not intended for this use. Use styles, overlays + * and extensions when needed, but avoid specific themes unless there is no + * other way (example: you want to have a preview of a new theme you are + * selecting in a "theme selector" window. The preview is inside a scroller + * and should display what the theme you selected will look like, but not + * actually apply it yet. The child of the scroller will have a specific + * theme set to show this preview before the user decides to apply it to all + * applications). + * + * @ingroup Theme + */ +EAPI Elm_Theme *elm_theme_new(void); + +/** + * Free a specific theme + * + * @param th The theme to free + * + * This frees a theme created with elm_theme_new(). + * + * @ingroup Theme + */ +EAPI void elm_theme_free(Elm_Theme *th); + +/** + * Copy the theme from the source to the destination theme + * + * @param th The source theme to copy from + * @param thdst The destination theme to copy data to + * + * This makes a one-time static copy of all the theme config, extensions + * and overlays from @p th to @p thdst. If @p th references a theme, then + * @p thdst is also set to reference it, with all the theme settings, + * overlays and extensions that @p th had. + * + * @ingroup Theme + */ +EAPI void elm_theme_copy(Elm_Theme *th, Elm_Theme *thdst); + +/** + * Tell the source theme to reference the ref theme + * + * @param th The theme that will do the referencing + * @param thref The theme that is the reference source + * + * This clears @p th to be empty and then sets it to refer to @p thref + * so @p th acts as an override to @p thref, but where its overrides + * don't apply, it will fall through to @p thref for configuration. + * + * @ingroup Theme + */ +EAPI void elm_theme_ref_set(Elm_Theme *th, Elm_Theme *thref); + +/** + * Return the theme referred to + * + * @param th The theme to get the reference from + * @return The referenced theme handle + * + * This gets the theme set as the reference theme by elm_theme_ref_set(). + * If no theme is set as a reference, NULL is returned. + * + * @ingroup Theme + */ +EAPI Elm_Theme *elm_theme_ref_get(Elm_Theme *th); + +/** + * Return the default theme + * + * @return The default theme handle + * + * This returns the internal default theme setup handle that all widgets + * use implicitly unless a specific theme is set. This is also often use + * as a shorthand of NULL. + * + * @ingroup Theme + */ +EAPI Elm_Theme *elm_theme_default_get(void); + +/** + * Prepends a theme overlay to the list of overlays + * + * @param th The theme to add to, or if NULL, the default theme + * @param item The Edje file path to be used + * + * Use this if your application needs to provide some custom overlay theme + * (An Edje file that replaces some default styles of widgets) where adding + * new styles, or changing system theme configuration is not possible. Do + * NOT use this instead of a proper system theme configuration. Use proper + * configuration files, profiles, environment variables etc. to set a theme + * so that the theme can be altered by simple configuration by a user. Using + * this call to achieve that effect is abusing the API and will create lots + * of trouble. + * + * @see elm_theme_extension_add() + * + * @ingroup Theme + */ +EAPI void elm_theme_overlay_add(Elm_Theme *th, const char *item); + +/** + * Delete a theme overlay from the list of overlays + * + * @param th The theme to delete from, or if NULL, the default theme + * @param item The name of the theme overlay + * + * @see elm_theme_overlay_add() + * + * @ingroup Theme + */ +EAPI void elm_theme_overlay_del(Elm_Theme *th, const char *item); + +/** + * Get the list of registered overlays for the given theme + * + * @param th The theme from which to get the overlays + * @return List of theme overlays. Do not free it. + * + * @see elm_theme_overlay_add() + * + * @ingroup Theme + */ +EAPI const Eina_List *elm_theme_overlay_list_get(const Elm_Theme *th); + +/** + * Appends a theme extension to the list of extensions. + * + * @param th The theme to add to, or if NULL, the default theme + * @param item The Edje file path to be used + * + * This is intended when an application needs more styles of widgets or new + * widget themes that the default does not provide (or may not provide). The + * application has "extended" usage by coming up with new custom style names + * for widgets for specific uses, but as these are not "standard", they are + * not guaranteed to be provided by a default theme. This means the + * application is required to provide these extra elements itself in specific + * Edje files. This call adds one of those Edje files to the theme search + * path to be search after the default theme. The use of this call is + * encouraged when default styles do not meet the needs of the application. + * Use this call instead of elm_theme_overlay_add() for almost all cases. + * + * @see elm_object_style_set() + * + * @ingroup Theme + */ +EAPI void elm_theme_extension_add(Elm_Theme *th, const char *item); + +/** + * Deletes a theme extension from the list of extensions. + * + * @param th The theme to delete from, or if NULL, the default theme + * @param item The name of the theme extension + * + * @see elm_theme_extension_add() + * + * @ingroup Theme + */ +EAPI void elm_theme_extension_del(Elm_Theme *th, const char *item); + +/** + * Get the list of registered extensions for the given theme + * + * @param th The theme from which to get the extensions + * @return List of theme extensions. Do not free it. + * + * @see elm_theme_extension_add() + * + * @ingroup Theme + */ +EAPI const Eina_List *elm_theme_extension_list_get(const Elm_Theme *th); + +/** + * Set the theme search order for the given theme + * + * @param th The theme to set the search order, or if NULL, the default theme + * @param theme Theme search string + * + * This sets the search string for the theme in path-notation from first + * theme to search, to last, delimited by the : character. Example: + * + * "shiny:/path/to/file.edj:default" + * + * See the ELM_THEME environment variable for more information. + * + * @see elm_theme_get() + * @see elm_theme_list_get() + * + * @ingroup Theme + */ +EAPI void elm_theme_set(Elm_Theme *th, const char *theme); + +/** + * Return the theme search order + * + * @param th The theme to get the search order, or if NULL, the default theme + * @return The internal search order path + * + * This function returns a colon separated string of theme elements as + * returned by elm_theme_list_get(). + * + * @see elm_theme_set() + * @see elm_theme_list_get() + * + * @ingroup Theme + */ +EAPI const char *elm_theme_get(Elm_Theme *th); + +/** + * Return a list of theme elements to be used in a theme. + * + * @param th Theme to get the list of theme elements from. + * @return The internal list of theme elements + * + * This returns the internal list of theme elements (will only be valid as + * long as the theme is not modified by elm_theme_set() or theme is not + * freed by elm_theme_free(). This is a list of strings which must not be + * altered as they are also internal. If @p th is NULL, then the default + * theme element list is returned. + * + * A theme element can consist of a full or relative path to a .edj file, + * or a name, without extension, for a theme to be searched in the known + * theme paths for Elementary. + * + * @see elm_theme_set() + * @see elm_theme_get() + * + * @ingroup Theme + */ +EAPI const Eina_List *elm_theme_list_get(const Elm_Theme *th); + +/** + * Return the full path for a theme element + * + * @param f The theme element name + * @param in_search_path Pointer to a boolean to indicate if item is in the search path or not + * @return The full path to the file found. + * + * This returns a string you should free with free() on success, NULL on + * failure. This will search for the given theme element, and if it is a + * full or relative path element or a simple search-able name. The returned + * path is the full path to the file, if searched, and the file exists, or it + * is simply the full path given in the element or a resolved path if + * relative to home. The @p in_search_path boolean pointed to is set to + * EINA_TRUE if the file was a search-able file and is in the search path, + * and EINA_FALSE otherwise. + * + * @ingroup Theme + */ +EAPI char *elm_theme_list_item_path_get(const char *f, Eina_Bool *in_search_path); + +/** + * Flush the current theme. + * + * @param th Theme to flush + * + * This flushes caches that let elementary know where to find theme elements + * in the given theme. If @p th is NULL, then the default theme is flushed. + * Call this function if source theme data has changed in such a way as to + * make any caches Elementary kept invalid. + * + * @ingroup Theme + */ +EAPI void elm_theme_flush(Elm_Theme *th); + +/** + * This flushes all themes (default and specific ones). + * + * This will flush all themes in the current application context, by calling + * elm_theme_flush() on each of them. + * + * @ingroup Theme + */ +EAPI void elm_theme_full_flush(void); + +/** + * Return a list of theme elements in the theme search path + * + * @return A list of strings that are the theme element names. + * + * This lists all available theme files in the standard Elementary search path + * for theme elements, and returns them in alphabetical order as theme + * element names in a list of strings. Free this with + * elm_theme_name_available_list_free() when you are done with the list. + * + * @ingroup Theme + */ +EAPI Eina_List *elm_theme_name_available_list_new(void); + +/** + * Free the list returned by elm_theme_name_available_list_new() + * + * This frees the list of themes returned by + * elm_theme_name_available_list_new(). Once freed the list should no longer + * be used. a new list mys be created. + * + * @ingroup Theme + */ +EAPI void elm_theme_name_available_list_free(Eina_List *list); + +/** + * Set a specific theme to be used for this object and its children + * + * @param obj The object to set the theme on + * @param th The theme to set + * + * This sets a specific theme that will be used for the given object and any + * child objects it has. If @p th is NULL then the theme to be used is + * cleared and the object will inherit its theme from its parent (which + * ultimately will use the default theme if no specific themes are set). + * + * Use special themes with great care as this will annoy users and make + * configuration difficult. Avoid any custom themes at all if it can be + * helped. + * + * @ingroup Theme + */ +EAPI void elm_object_theme_set(Evas_Object *obj, Elm_Theme *th); + +/** + * Get the specific theme to be used + * + * @param obj The object to get the specific theme from + * @return The specific theme set. + * + * This will return a specific theme set, or NULL if no specific theme is + * set on that object. It will not return inherited themes from parents, only + * the specific theme set for that specific object. See elm_object_theme_set() + * for more information. + * + * @ingroup Theme + */ +EAPI Elm_Theme *elm_object_theme_get(const Evas_Object *obj); + +/** + * Get a data item from a theme + * + * @param th The theme, or NULL for default theme + * @param key The data key to search with + * @return The data value, or NULL on failure + * + * This function is used to return data items from edc in @p th, an overlay, or an extension. + * It works the same way as edje_file_data_get() except that the return is stringshared. + * + * @ingroup Theme + */ +EAPI const char *elm_theme_data_get(Elm_Theme *th, const char *key); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_thumb.c b/libraries/elementary/src/lib/elm_thumb.c new file mode 100644 index 0000000..fee178d --- /dev/null +++ b/libraries/elementary/src/lib/elm_thumb.c @@ -0,0 +1,728 @@ +#include +#include "elm_priv.h" +#include + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *self; + Evas_Object *frame; + Evas_Object *view; + const char *file; + const char *key; + struct + { + const char *file; + const char *key; +#ifdef HAVE_ELEMENTARY_ETHUMB + const char *thumb_path; + const char *thumb_key; + Ethumb_Client_Async *request; + + Ethumb_Thumb_Format format; + + Eina_Bool retry : 1; +#endif + } thumb; + Ecore_Event_Handler *eeh; + Elm_Thumb_Animation_Setting anim_setting; + Eina_Bool on_hold : 1; + Eina_Bool is_video : 1; + Eina_Bool was_video : 1; + Eina_Bool edit : 1; +}; + +static const char *widtype = NULL; + +static const char SIG_CLICKED[] = "clicked"; +static const char SIG_CLICKED_DOUBLE[] = "clicked,double"; +static const char SIG_GENERATE_ERROR[] = "generate,error"; +static const char SIG_GENERATE_START[] = "generate,start"; +static const char SIG_GENERATE_STOP[] = "generate,stop"; +static const char SIG_LOAD_ERROR[] = "load,error"; +static const char SIG_PRESS[] = "press"; + +static const Evas_Smart_Cb_Description _signals[] = +{ + {SIG_CLICKED, ""}, + {SIG_CLICKED_DOUBLE, ""}, + {SIG_GENERATE_ERROR, ""}, + {SIG_GENERATE_START, ""}, + {SIG_GENERATE_STOP, ""}, + {SIG_LOAD_ERROR, ""}, + {SIG_PRESS, ""}, + {NULL, NULL} +}; + +#define EDJE_SIGNAL_GENERATE_START "elm,thumb,generate,start" +#define EDJE_SIGNAL_GENERATE_STOP "elm,thumb,generate,stop" +#define EDJE_SIGNAL_GENERATE_ERROR "elm,thumb,generate,error" +#define EDJE_SIGNAL_LOAD_ERROR "elm,thumb,load,error" +#define EDJE_SIGNAL_PULSE_START "elm,state,pulse,start" +#define EDJE_SIGNAL_PULSE_STOP "elm,state,pulse,stop" + +struct _Ethumb_Client *_elm_ethumb_client = NULL; +Eina_Bool _elm_ethumb_connected = EINA_FALSE; +#ifdef HAVE_ELEMENTARY_ETHUMB +static Eina_List *retry = NULL; +static int pending_request = 0; +#endif + +EAPI int ELM_ECORE_EVENT_ETHUMB_CONNECT = 0; + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + +#ifdef HAVE_ELEMENTARY_ETHUMB + if (wd->thumb.request) + { + ethumb_client_thumb_async_cancel(_elm_ethumb_client, wd->thumb.request); + wd->thumb.request = NULL; + } + if (wd->thumb.retry) + { + retry = eina_list_remove(retry, wd); + wd->thumb.retry = EINA_FALSE; + } + + eina_stringshare_del(wd->thumb.thumb_path); + eina_stringshare_del(wd->thumb.thumb_key); +#endif + + eina_stringshare_del(wd->file); + eina_stringshare_del(wd->key); + if (wd->eeh) ecore_event_handler_del(wd->eeh); + free(wd); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + _elm_theme_object_set(obj, wd->frame, "thumb", "base", + elm_widget_style_get(obj)); +} + +#ifdef HAVE_ELEMENTARY_ETHUMB +static void +_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Widget_Data *wd = data; + Evas_Event_Mouse_Down *ev = event_info; + + if (ev->button != 1) + return; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) + wd->on_hold = EINA_TRUE; + else + wd->on_hold = EINA_FALSE; + if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) + evas_object_smart_callback_call(wd->self, SIG_CLICKED_DOUBLE, NULL); + else + evas_object_smart_callback_call(wd->self, SIG_PRESS, NULL); +} + +static void +_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Widget_Data *wd = data; + Evas_Event_Mouse_Up *ev = event_info; + + if (ev->button != 1) + return; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) + wd->on_hold = EINA_TRUE; + else + wd->on_hold = EINA_FALSE; + if (!wd->on_hold) + evas_object_smart_callback_call(wd->self, SIG_CLICKED, NULL); + wd->on_hold = EINA_FALSE; +} + +static void +_thumb_ready(Widget_Data *wd, const char *thumb_path, const char *thumb_key) +{ + Evas_Coord mw, mh; + Evas_Coord aw, ah; + + evas_object_image_size_get(wd->view, &aw, &ah); + evas_object_size_hint_aspect_set(wd->view, + EVAS_ASPECT_CONTROL_BOTH, + aw, ah); + edje_object_part_swallow(wd->frame, "elm.swallow.content", wd->view); + edje_object_size_min_get(wd->frame, &mw, &mh); + edje_object_size_min_restricted_calc(wd->frame, &mw, &mh, mw, mh); + evas_object_size_hint_min_set(wd->self, mw, mh); + eina_stringshare_replace(&(wd->thumb.file), thumb_path); + eina_stringshare_replace(&(wd->thumb.key), thumb_key); + edje_object_signal_emit(wd->frame, EDJE_SIGNAL_PULSE_STOP, "elm"); + edje_object_signal_emit(wd->frame, EDJE_SIGNAL_GENERATE_STOP, "elm"); + evas_object_smart_callback_call(wd->self, SIG_GENERATE_STOP, NULL); +} + +static void +_thumb_loaded(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = data; + const char *thumb_path; + const char *thumb_key; + + evas_object_image_file_get(wd->view, &thumb_path, &thumb_key); + + _thumb_ready(wd, thumb_path, thumb_key); +} + +/* As we do use stat to check if a thumbnail is available, it's possible + that we end up accessing before the file is completly written on disk. + By retrying each time a thumbnail is finished we should be fine or not. +*/ +static Eina_Bool +_retry_thumb(Widget_Data *wd) +{ + int r; + + if ((wd->is_video) && (wd->thumb.format == ETHUMB_THUMB_EET)) + { + edje_object_file_set(wd->view, NULL, NULL); + if (!edje_object_file_set(wd->view, + wd->thumb.thumb_path, + "movie/thumb")) + { + if (pending_request == 0) + ERR("could not set file=%s key=%s for %s", + wd->thumb.thumb_path, + wd->thumb.thumb_key, + wd->file); + goto view_err; + } + } + else + { + evas_object_image_file_set(wd->view, NULL, NULL); + evas_object_image_file_set(wd->view, + wd->thumb.thumb_path, + wd->thumb.thumb_key); + r = evas_object_image_load_error_get(wd->view); + if (r != EVAS_LOAD_ERROR_NONE) + { + if (pending_request == 0) + ERR("%s: %s", wd->thumb.thumb_path, evas_load_error_str(r)); + goto view_err; + } + + evas_object_event_callback_add(wd->view, + EVAS_CALLBACK_IMAGE_PRELOADED, + _thumb_loaded, wd); + evas_object_image_preload(wd->view, EINA_TRUE); + return EINA_TRUE; + } + + _thumb_ready(wd, wd->thumb.thumb_path, wd->thumb.thumb_key); + + eina_stringshare_del(wd->thumb.thumb_path); + wd->thumb.thumb_path = NULL; + + eina_stringshare_del(wd->thumb.thumb_key); + wd->thumb.thumb_key = NULL; + + return EINA_TRUE; + + view_err: + return EINA_FALSE; +} + +static void +_finished_thumb(Widget_Data *wd, + const char *thumb_path, + const char *thumb_key) +{ + Eina_List *l, *ll; + Evas *evas; + int r; + + evas = evas_object_evas_get(wd->self); + if ((wd->view) && (wd->is_video ^ wd->was_video)) + { + evas_object_del(wd->view); + wd->view = NULL; + } + wd->was_video = wd->is_video; + + if ((wd->is_video) && + (ethumb_client_format_get(_elm_ethumb_client) == ETHUMB_THUMB_EET)) + { + if (!wd->view) + { + wd->view = edje_object_add(evas); + if (!wd->view) + { + ERR("could not create edje object"); + goto err; + } + elm_widget_sub_object_add(wd->self, wd->view); + } + + if (!edje_object_file_set(wd->view, thumb_path, thumb_key)) + { + wd->thumb.thumb_path = eina_stringshare_ref(thumb_path); + wd->thumb.thumb_key = eina_stringshare_ref(thumb_key); + wd->thumb.format = ethumb_client_format_get(_elm_ethumb_client); + wd->thumb.retry = EINA_TRUE; + + retry = eina_list_append(retry, wd); + return ; + } + } + else + { + if (!wd->view) + { + wd->view = evas_object_image_filled_add(evas); + if (!wd->view) + { + ERR("could not create image object"); + goto err; + } + evas_object_event_callback_add(wd->view, + EVAS_CALLBACK_IMAGE_PRELOADED, + _thumb_loaded, wd); + elm_widget_sub_object_add(wd->self, wd->view); + evas_object_hide(wd->view); + } + + evas_object_image_file_set(wd->view, thumb_path, thumb_key); + r = evas_object_image_load_error_get(wd->view); + if (r != EVAS_LOAD_ERROR_NONE) + { + WRN("%s: %s", thumb_path, evas_load_error_str(r)); + wd->thumb.thumb_path = eina_stringshare_ref(thumb_path); + wd->thumb.thumb_key = eina_stringshare_ref(thumb_key); + wd->thumb.format = ethumb_client_format_get(_elm_ethumb_client); + wd->thumb.retry = EINA_TRUE; + + retry = eina_list_append(retry, wd); + return ; + } + + evas_object_image_preload(wd->view, 0); + return ; + } + + _thumb_ready(wd, thumb_path, thumb_key); + + EINA_LIST_FOREACH_SAFE(retry, l, ll, wd) + if (_retry_thumb(wd)) + retry = eina_list_remove_list(retry, l); + + if (pending_request == 0) + EINA_LIST_FREE(retry, wd) + { + eina_stringshare_del(wd->thumb.thumb_path); + wd->thumb.thumb_path = NULL; + + eina_stringshare_del(wd->thumb.thumb_key); + wd->thumb.thumb_key = NULL; + + evas_object_del(wd->view); + wd->view = NULL; + + edje_object_signal_emit(wd->frame, EDJE_SIGNAL_LOAD_ERROR, "elm"); + evas_object_smart_callback_call(wd->self, SIG_LOAD_ERROR, NULL); + } + + return; + +err: + edje_object_signal_emit(wd->frame, EDJE_SIGNAL_LOAD_ERROR, "elm"); + evas_object_smart_callback_call(wd->self, SIG_LOAD_ERROR, NULL); +} + +static void +_elm_thumb_done(Ethumb_Client *client __UNUSED__, const char *thumb_path, const char *thumb_key, void *data) +{ + Widget_Data *wd = data; + + assert(wd->thumb.request); + + pending_request--; + wd->thumb.request = NULL; + + _finished_thumb(wd, thumb_path, thumb_key); +} + +static void +_elm_thumb_error(Ethumb_Client *client __UNUSED__, void *data) +{ + Widget_Data *wd = data; + + assert(wd->thumb.request); + + pending_request--; + wd->thumb.request = NULL; + + ERR("could not generate thumbnail for %s (key: %s)", wd->thumb.file, wd->thumb.key ? wd->thumb.key : ""); + + edje_object_signal_emit(wd->frame, EDJE_SIGNAL_GENERATE_ERROR, "elm"); + evas_object_smart_callback_call(wd->self, SIG_GENERATE_ERROR, NULL); +} + +static void +_thumb_apply(Widget_Data *wd) +{ + if (wd->thumb.request) + { + ethumb_client_thumb_async_cancel(_elm_ethumb_client, wd->thumb.request); + wd->thumb.request = NULL; + } + if (wd->thumb.retry) + { + retry = eina_list_remove(retry, wd); + wd->thumb.retry = EINA_FALSE; + } + + if (!wd->file) return; + + edje_object_signal_emit(wd->frame, EDJE_SIGNAL_PULSE_START, "elm"); + edje_object_signal_emit(wd->frame, EDJE_SIGNAL_GENERATE_START, "elm"); + evas_object_smart_callback_call(wd->self, SIG_GENERATE_START, NULL); + + pending_request++; + ethumb_client_file_set(_elm_ethumb_client, wd->file, wd->key); + wd->thumb.request = ethumb_client_thumb_async_get(_elm_ethumb_client, + _elm_thumb_done, + _elm_thumb_error, + wd); +} + +static Eina_Bool +_thumb_apply_cb(void *data, int type __UNUSED__, void *ev __UNUSED__) +{ + _thumb_apply(data); + return ECORE_CALLBACK_RENEW; +} + +static void +_thumb_show(Widget_Data *wd) +{ + evas_object_show(wd->frame); + + if (elm_thumb_ethumb_client_connected_get()) + { + _thumb_apply(wd); + return; + } + + if (!wd->eeh) + wd->eeh = ecore_event_handler_add(ELM_ECORE_EVENT_ETHUMB_CONNECT, + _thumb_apply_cb, wd); +} + +static void +_thumb_show_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _thumb_show(data); +} + +static void +_thumb_hide_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = data; + + evas_object_hide(wd->frame); + + if (wd->thumb.request) + { + ethumb_client_thumb_async_cancel(_elm_ethumb_client, wd->thumb.request); + wd->thumb.request = NULL; + + edje_object_signal_emit(wd->frame, EDJE_SIGNAL_GENERATE_STOP, "elm"); + evas_object_smart_callback_call(wd->self, SIG_GENERATE_STOP, NULL); + } + + if (wd->thumb.retry) + { + retry = eina_list_remove(retry, wd); + wd->thumb.retry = EINA_FALSE; + } + + if (wd->eeh) + { + ecore_event_handler_del(wd->eeh); + wd->eeh = NULL; + } +} + +#endif + +#ifdef ELM_ETHUMB +static int _elm_need_ethumb = 0; + +static void _on_die_cb(void *, Ethumb_Client *); + +static void +_connect_cb(void *data __UNUSED__, Ethumb_Client *c, Eina_Bool success) +{ + if (success) + { + ethumb_client_on_server_die_callback_set(c, _on_die_cb, NULL, NULL); + _elm_ethumb_connected = EINA_TRUE; + ecore_event_add(ELM_ECORE_EVENT_ETHUMB_CONNECT, NULL, NULL, NULL); + } + else + _elm_ethumb_client = NULL; +} + +static void +_on_die_cb(void *data __UNUSED__, Ethumb_Client *c __UNUSED__) +{ + ethumb_client_disconnect(_elm_ethumb_client); + _elm_ethumb_client = NULL; + _elm_ethumb_connected = EINA_FALSE; + _elm_ethumb_client = ethumb_client_connect(_connect_cb, NULL, NULL); +} +#endif + +void +_elm_unneed_ethumb(void) +{ +#ifdef ELM_ETHUMB + if (--_elm_need_ethumb) return; + + ethumb_client_disconnect(_elm_ethumb_client); + _elm_ethumb_client = NULL; + ethumb_client_shutdown(); + ELM_ECORE_EVENT_ETHUMB_CONNECT = 0; +#endif +} + +static Eina_Bool +_elm_thumb_dropcb(void *data __UNUSED__, Evas_Object *o, Elm_Selection_Data *drop) +{ + if ((!o) || (!drop) || (!drop->data)) return EINA_FALSE; + elm_thumb_file_set(o, drop->data, NULL); + return EINA_TRUE; +} + +EAPI Eina_Bool +elm_need_ethumb(void) +{ +#ifdef ELM_ETHUMB + if (_elm_need_ethumb++) return EINA_TRUE; + ELM_ECORE_EVENT_ETHUMB_CONNECT = ecore_event_type_new(); + ethumb_client_init(); + _elm_ethumb_client = ethumb_client_connect(_connect_cb, NULL, NULL); + return EINA_TRUE; +#else + return EINA_FALSE; +#endif +} + +EAPI Evas_Object * +elm_thumb_add(Evas_Object *parent) +{ + Evas *e; + Widget_Data *wd; + Evas_Object *obj; + Evas_Coord minw, minh; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "thumb"); + elm_widget_type_set(obj, "thumb"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); + + wd->frame = edje_object_add(e); + _elm_theme_object_set(obj, wd->frame, "thumb", "base", "default"); + elm_widget_resize_object_set(obj, wd->frame); + + edje_object_size_min_calc(obj, &minw, &minh); + evas_object_size_hint_min_set(obj, minw, minh); + + wd->self = obj; + wd->view = NULL; + wd->file = NULL; + wd->key = NULL; + wd->eeh = NULL; + wd->on_hold = EINA_FALSE; + wd->is_video = EINA_FALSE; + wd->was_video = EINA_FALSE; + +#ifdef HAVE_ELEMENTARY_ETHUMB + wd->thumb.thumb_path = NULL; + wd->thumb.thumb_key = NULL; + wd->thumb.request = NULL; + evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_DOWN, + _mouse_down_cb, wd); + evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_UP, + _mouse_up_cb, wd); + evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, + _thumb_show_cb, wd); + evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, + _thumb_hide_cb, wd); +#endif + + // TODO: convert Elementary to subclassing of Evas_Smart_Class + // TODO: and save some bytes, making descriptions per-class and not instance! + evas_object_smart_callbacks_descriptions_set(obj, _signals); + return obj; +} + +EAPI void +elm_thumb_reload(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + eina_stringshare_replace(&(wd->thumb.file), NULL); + eina_stringshare_replace(&(wd->thumb.key), NULL); + +#ifdef HAVE_ELEMENTARY_ETHUMB + if (evas_object_visible_get(obj)) + _thumb_show(wd); +#endif +} + +EAPI void +elm_thumb_file_set(Evas_Object *obj, const char *file, const char *key) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Eina_Bool file_replaced, key_replaced; + Widget_Data *wd = elm_widget_data_get(obj); + + file_replaced = eina_stringshare_replace(&(wd->file), file); + key_replaced = eina_stringshare_replace(&(wd->key), key); + + if (file_replaced) + { + int prefix_size; + const char **ext, *ptr; + static const char *extensions[] = + { + ".avi", ".mp4", ".ogv", ".mov", ".mpg", ".wmv", NULL + }; + + prefix_size = eina_stringshare_strlen(wd->file) - 4; + if (prefix_size >= 0) + { + ptr = wd->file + prefix_size; + wd->is_video = EINA_FALSE; + for (ext = extensions; *ext; ext++) + if (!strcasecmp(ptr, *ext)) + { + wd->is_video = EINA_TRUE; + break; + } + } + } + + eina_stringshare_replace(&(wd->thumb.file), NULL); + eina_stringshare_replace(&(wd->thumb.key), NULL); + +#ifdef HAVE_ELEMENTARY_ETHUMB + if (((file_replaced) || (key_replaced)) && (evas_object_visible_get(obj))) + _thumb_show(wd); +#else + (void)key_replaced; +#endif +} + +EAPI void +elm_thumb_file_get(const Evas_Object *obj, const char **file, const char **key) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (file) + *file = wd->file; + if (key) + *key = wd->key; +} + +EAPI void +elm_thumb_path_get(const Evas_Object *obj, const char **file, const char **key) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (file) + *file = wd->thumb.file; + if (key) + *key = wd->thumb.key; +} + +EAPI void +elm_thumb_animate_set(Evas_Object *obj, Elm_Thumb_Animation_Setting setting) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + EINA_SAFETY_ON_TRUE_RETURN(setting >= ELM_THUMB_ANIMATION_LAST); + + wd->anim_setting = setting; + if (setting == ELM_THUMB_ANIMATION_LOOP) + edje_object_signal_emit(wd->view, "animate_loop", ""); + else if (setting == ELM_THUMB_ANIMATION_START) + edje_object_signal_emit(wd->view, "animate", ""); + else if (setting == ELM_THUMB_ANIMATION_STOP) + edje_object_signal_emit(wd->view, "animate_stop", ""); +} + +EAPI Elm_Thumb_Animation_Setting +elm_thumb_animate_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_THUMB_ANIMATION_LAST; + Widget_Data *wd = elm_widget_data_get(obj); + + return wd->anim_setting; +} + +EAPI void * +elm_thumb_ethumb_client_get(void) +{ + return _elm_ethumb_client; +} + +EAPI Eina_Bool +elm_thumb_ethumb_client_connected_get(void) +{ + return _elm_ethumb_connected; +} + +EAPI Eina_Bool +elm_thumb_editable_set(Evas_Object *obj, Eina_Bool edit) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return EINA_FALSE; + edit = !!edit; + if (wd->edit == edit) return EINA_TRUE; + + wd->edit = edit; + if (wd->edit) + elm_drop_target_add(obj, ELM_SEL_FORMAT_IMAGE, + _elm_thumb_dropcb, obj); + else + elm_drop_target_del(obj); + + return EINA_TRUE; +} + +EAPI Eina_Bool +elm_thumb_editable_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return EINA_FALSE; + return wd->edit; +} + +/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-3f0^-2{2(0W1st0 :*/ diff --git a/libraries/elementary/src/lib/elm_thumb.h b/libraries/elementary/src/lib/elm_thumb.h new file mode 100644 index 0000000..8aa0593 --- /dev/null +++ b/libraries/elementary/src/lib/elm_thumb.h @@ -0,0 +1,263 @@ +/** + * @defgroup Thumb Thumb + * @ingroup Elementary + * + * @image html img/widget/thumb/preview-00.png + * @image latex img/widget/thumb/preview-00.eps + * + * A thumb object is used for displaying the thumbnail of an image or video. + * You must have compiled Elementary with Ethumb_Client support and the DBus + * service must be present and auto-activated in order to have thumbnails to + * be generated. You must also have a Session bus, not System bus. + * + * Once the thumbnail object becomes visible, it will check if there is a + * previously generated thumbnail image for the file set on it. If not, it + * will start generating this thumbnail. + * + * Different config settings will cause different thumbnails to be generated + * even on the same file. + * + * Generated thumbnails are stored under @c $HOME/.thumbnails/. Check the + * Ethumb documentation to change this path, and to see other configuration + * options. + * + * Signals that you can add callbacks for are: + * + * - "clicked" - This is called when a user has clicked the thumb without dragging + * around. + * - "clicked,double" - This is called when a user has double-clicked the thumb. + * - "press" - This is called when a user has pressed down the thumb. + * - "generate,start" - The thumbnail generation started. + * - "generate,stop" - The generation process stopped. + * - "generate,error" - The generation failed. + * - "load,error" - The thumbnail image loading failed. + * + * available styles: + * - default + * - noframe + * + * An example of use of thumbnail: + * + * - @ref thumb_example_01 + */ + +/** + * @addtogroup Thumb + * @{ + */ + +/** + * @enum _Elm_Thumb_Animation_Setting + * @typedef Elm_Thumb_Animation_Setting + * + * Used to set if a video thumbnail is animating or not. + * + * @ingroup Thumb + */ +typedef enum +{ + ELM_THUMB_ANIMATION_START = 0, /**< Play animation once */ + ELM_THUMB_ANIMATION_LOOP, /**< Keep playing animation until stop is requested */ + ELM_THUMB_ANIMATION_STOP, /**< Stop playing the animation */ + ELM_THUMB_ANIMATION_LAST +} Elm_Thumb_Animation_Setting; + +/** + * Add a new thumb object to the parent. + * + * @param parent The parent object. + * @return The new object or NULL if it cannot be created. + * + * @see elm_thumb_file_set() + * @see elm_thumb_ethumb_client_get() + * + * @ingroup Thumb + */ +EAPI Evas_Object *elm_thumb_add(Evas_Object *parent); + +/** + * Reload thumbnail if it was generated before. + * + * @param obj The thumb object to reload + * + * This is useful if the ethumb client configuration changed, like its + * size, aspect or any other property one set in the handle returned + * by elm_thumb_ethumb_client_get(). + * + * If the options didn't change, the thumbnail won't be generated again, but + * the old one will still be used. + * + * @see elm_thumb_file_set() + * + * @ingroup Thumb + */ +EAPI void elm_thumb_reload(Evas_Object *obj); + +/** + * Set the file that will be used as thumbnail. + * + * @param obj The thumb object. + * @param file The path to file that will be used as thumb. + * @param key The key used in case of an EET file. + * + * The file can be an image or a video (in that case, acceptable extensions are: + * avi, mp4, ogv, mov, mpg and wmv). To start the video animation, use the + * function elm_thumb_animate(). + * + * @see elm_thumb_file_get() + * @see elm_thumb_reload() + * @see elm_thumb_animate() + * + * @ingroup Thumb + */ +EAPI void elm_thumb_file_set(Evas_Object *obj, const char *file, const char *key); + +/** + * Get the image or video path and key used to generate the thumbnail. + * + * @param obj The thumb object. + * @param file Pointer to filename. + * @param key Pointer to key. + * + * @see elm_thumb_file_set() + * @see elm_thumb_path_get() + * + * @ingroup Thumb + */ +EAPI void elm_thumb_file_get(const Evas_Object *obj, const char **file, const char **key); + +/** + * Get the path and key to the image or video thumbnail generated by ethumb. + * + * One just needs to make sure that the thumbnail was generated before getting + * its path; otherwise, the path will be NULL. One way to do that is by asking + * for the path when/after the "generate,stop" smart callback is called. + * + * @param obj The thumb object. + * @param file Pointer to thumb path. + * @param key Pointer to thumb key. + * + * @see elm_thumb_file_get() + * + * @ingroup Thumb + */ +EAPI void elm_thumb_path_get(const Evas_Object *obj, const char **file, const char **key); + +/** + * Set the animation state for the thumb object. If its content is an animated + * video, you may start/stop the animation or tell it to play continuously and + * looping. + * + * @param obj The thumb object. + * @param s The animation setting. + * + * @see elm_thumb_file_set() + * + * @ingroup Thumb + */ +EAPI void elm_thumb_animate_set(Evas_Object *obj, Elm_Thumb_Animation_Setting s); + +/** + * Get the animation state for the thumb object. + * + * @param obj The thumb object. + * @return getting The animation setting or @c ELM_THUMB_ANIMATION_LAST, + * on errors. + * + * @see elm_thumb_animate_set() + * + * @ingroup Thumb + */ +EAPI Elm_Thumb_Animation_Setting elm_thumb_animate_get(const Evas_Object *obj); + +/** + * Get the ethumb_client handle so custom configuration can be made. + * + * @return Ethumb_Client instance or NULL. + * + * This must be called before the objects are created to be sure no object is + * visible and no generation started. + * + * Example of usage: + * + * @code + * #include + * #ifndef ELM_LIB_QUICKLAUNCH + * EAPI_MAIN int + * elm_main(int argc, char **argv) + * { + * Ethumb_Client *client; + * + * elm_need_ethumb(); + * + * // ... your code + * + * client = elm_thumb_ethumb_client_get(); + * if (!client) + * { + * ERR("could not get ethumb_client"); + * return 1; + * } + * ethumb_client_size_set(client, 100, 100); + * ethumb_client_crop_align_set(client, 0.5, 0.5); + * // ... your code + * + * // Create elm_thumb objects here + * + * elm_run(); + * elm_shutdown(); + * return 0; + * } + * #endif + * ELM_MAIN() + * @endcode + * + * @note There's only one client handle for Ethumb, so once a configuration + * change is done to it, any other request for thumbnails (for any thumbnail + * object) will use that configuration. Thus, this configuration is global. + * + * @ingroup Thumb + */ +EAPI void *elm_thumb_ethumb_client_get(void); + +/** + * Get the ethumb_client connection state. + * + * @return EINA_TRUE if the client is connected to the server or EINA_FALSE + * otherwise. + */ +EAPI Eina_Bool elm_thumb_ethumb_client_connected_get(void); + +/** + * Make the thumbnail 'editable'. + * + * @param obj Thumb object. + * @param edit Turn on or off editability. Default is @c EINA_FALSE. + * + * This means the thumbnail is a valid drag target for drag and drop, and can be + * cut or pasted too. + * + * @see elm_thumb_editable_get() + * + * @ingroup Thumb + */ +EAPI Eina_Bool elm_thumb_editable_set(Evas_Object *obj, Eina_Bool edit); + +/** + * Make the thumbnail 'editable'. + * + * @param obj Thumb object. + * @return Editability. + * + * This means the thumbnail is a valid drag target for drag and drop, and can be + * cut or pasted too. + * + * @see elm_thumb_editable_set() + * + * @ingroup Thumb + */ +EAPI Eina_Bool elm_thumb_editable_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_toolbar.c b/libraries/elementary/src/lib/elm_toolbar.c new file mode 100644 index 0000000..2a883c1 --- /dev/null +++ b/libraries/elementary/src/lib/elm_toolbar.c @@ -0,0 +1,2061 @@ +#include +#include "elm_priv.h" +#include "els_scroller.h" +#include "els_box.h" +#include "els_icon.h" + +typedef struct _Widget_Data Widget_Data; +typedef struct _Elm_Toolbar_Item Elm_Toolbar_Item; + +struct _Widget_Data +{ + Evas_Object *scr, *bx; + Evas_Object *menu_parent; + Eina_Inlist *items; + Elm_Toolbar_Item *more_item, *selected_item; + Elm_Toolbar_Shrink_Mode shrink_mode; + Elm_Icon_Lookup_Order lookup_order; + int icon_size; + unsigned int item_count; + double align; + Elm_Object_Select_Mode select_mode; + Eina_Bool homogeneous : 1; + Eina_Bool vertical : 1; + Eina_Bool long_press : 1; + Ecore_Timer *long_timer; + Ecore_Job *resize_job; +}; + +struct _Elm_Toolbar_Item +{ + ELM_WIDGET_ITEM; + EINA_INLIST; + const char *label; + const char *icon_str; + Evas_Object *icon; + Evas_Object *object; + Evas_Object *o_menu; + Evas_Smart_Cb func; + struct + { + int priority; + Eina_Bool visible : 1; + } prio; + Eina_Bool selected : 1; + Eina_Bool separator : 1; + Eina_Bool menu : 1; + Eina_List *states; + Eina_List *current_state; +}; + +#define ELM_TOOLBAR_ITEM_FROM_INLIST(item) \ + ((item) ? EINA_INLIST_CONTAINER_GET(item, Elm_Toolbar_Item) : NULL) + +struct _Elm_Toolbar_Item_State +{ + const char *label; + const char *icon_str; + Evas_Object *icon; + Evas_Smart_Cb func; + const void *data; +}; + +static const char *widtype = NULL; +static void _item_show(Elm_Toolbar_Item *it); +static void _item_select(Elm_Toolbar_Item *it); +static void _item_unselect(Elm_Toolbar_Item *it); +static void _del_pre_hook(Evas_Object *obj); +static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool mirrored); +static void _mirrored_set_item(Evas_Object *obj, Elm_Toolbar_Item *it, Eina_Bool mirrored); +static void _theme_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _resize(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _menu_move_resize(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _menu_hide(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _layout(Evas_Object *o, Evas_Object_Box_Data *priv, void *data); +static void _elm_toolbar_item_icon_obj_set(Evas_Object *obj, Elm_Toolbar_Item *item, Evas_Object *icon_obj, const char *icon_str, double icon_size, const char *sig); +static void _item_label_set(Elm_Toolbar_Item *item, const char *label, const char *sig); + +static const char SIG_CLICKED[] = "clicked"; +static const char SIG_LONGPRESSED[] = "longpressed"; +static const char SIG_CLICKED_DOUBLE[] = "clicked,double"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_CLICKED, ""}, + {SIG_LONGPRESSED, ""}, + {SIG_CLICKED_DOUBLE, ""}, + {NULL, NULL} +}; + +static void +_item_disable_hook(Elm_Object_Item *it) +{ + Widget_Data *wd; + Elm_Toolbar_Item *toolbar_it = (Elm_Toolbar_Item *)it; + + wd = elm_widget_data_get(WIDGET(toolbar_it)); + if (!wd) return; + + if (elm_widget_item_disabled_get(toolbar_it)) + { + edje_object_signal_emit(VIEW(toolbar_it), "elm,state,disabled", "elm"); + elm_widget_signal_emit(toolbar_it->icon, "elm,state,disabled", "elm"); + } + else + { + edje_object_signal_emit(VIEW(toolbar_it), "elm,state,enabled", "elm"); + elm_widget_signal_emit(toolbar_it->icon, "elm,state,enabled", "elm"); + } + _resize(WIDGET(toolbar_it), NULL, NULL, NULL); +} + +static Eina_Bool +_item_icon_set(Evas_Object *icon_obj, const char *type, const char *icon) +{ + char icon_str[512]; + + if ((!type) || (!*type)) goto end; + if ((!icon) || (!*icon)) return EINA_FALSE; + if ((snprintf(icon_str, sizeof(icon_str), "%s%s", type, icon) > 0) + && (elm_icon_standard_set(icon_obj, icon_str))) + return EINA_TRUE; +end: + if (elm_icon_standard_set(icon_obj, icon)) + return EINA_TRUE; + WRN("couldn't find icon definition for '%s'", icon); + return EINA_FALSE; +} + +static int +_elm_toolbar_icon_size_get(Widget_Data *wd) +{ + const char *icon_size = edje_object_data_get( + elm_smart_scroller_edje_object_get(wd->scr), "icon_size"); + if (icon_size) + return atoi(icon_size); + return _elm_config->icon_size; +} + +static void +_item_show(Elm_Toolbar_Item *it) +{ + Widget_Data *wd = elm_widget_data_get(WIDGET(it)); + Evas_Coord x, y, w, h, bx, by; + + if (!wd) return; + evas_object_geometry_get(wd->bx, &bx, &by, NULL, NULL); + evas_object_geometry_get(VIEW(it), &x, &y, &w, &h); + elm_smart_scroller_child_region_show(wd->scr, x - bx, y - by, w, h); +} + +static void +_item_unselect(Elm_Toolbar_Item *item) +{ + Widget_Data *wd; + if ((!item) || (!item->selected)) return; + wd = elm_widget_data_get(WIDGET(item)); + if (!wd) return; + item->selected = EINA_FALSE; + wd->selected_item = NULL; + edje_object_signal_emit(VIEW(item), "elm,state,unselected", "elm"); + elm_widget_signal_emit(item->icon, "elm,state,unselected", "elm"); +} + +static void +_item_select(Elm_Toolbar_Item *it) +{ + Elm_Toolbar_Item *it2; + Widget_Data *wd = elm_widget_data_get(WIDGET(it)); + Evas_Object *obj2; + Eina_Bool sel; + + if (!wd) return; + if (elm_widget_item_disabled_get(it) || (it->separator) || (it->object)) return; + sel = it->selected; + + if (wd->select_mode != ELM_OBJECT_SELECT_MODE_NONE) + { + if (sel) + { + if (wd->select_mode == ELM_OBJECT_SELECT_MODE_ALWAYS) return; + _item_unselect(it); + } + else + { + it2 = (Elm_Toolbar_Item *) + elm_toolbar_selected_item_get(WIDGET(it)); + _item_unselect(it2); + + it->selected = EINA_TRUE; + wd->selected_item = it; + edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm"); + elm_widget_signal_emit(it->icon, "elm,state,selected", "elm"); + _item_show(it); + } + } + obj2 = WIDGET(it); + if (it->menu && (!sel)) + { + evas_object_show(it->o_menu); + evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_RESIZE, + _menu_move_resize, it); + evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOVE, + _menu_move_resize, it); + + _menu_move_resize(it, NULL, NULL, NULL); + } + if (it->func) it->func((void *)(it->base.data), WIDGET(it), it); + evas_object_smart_callback_call(obj2, SIG_CLICKED, it); +} + +static void +_menu_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Toolbar_Item *selected; + Elm_Toolbar_Item *it = data; + selected = (Elm_Toolbar_Item *) elm_toolbar_selected_item_get(WIDGET(it)); + _item_unselect(selected); +} + +static void +_menu_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + // avoid hide being emitted during object deletion + evas_object_event_callback_del_full + (obj, EVAS_CALLBACK_HIDE, _menu_hide, data); +} + +static void +_menu_move_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Toolbar_Item *it = data; + Evas_Coord x,y,w,h; + Widget_Data *wd = elm_widget_data_get(WIDGET(it)); + + if ((!wd) || (!wd->menu_parent)) return; + evas_object_geometry_get(VIEW(it), &x, &y, &w, &h); + elm_menu_move(it->o_menu, x, y+h); +} + +static void +_item_del(Elm_Toolbar_Item *it) +{ + Elm_Toolbar_Item_State *it_state; + _item_unselect(it); + EINA_LIST_FREE(it->states, it_state) + { + if (it->icon == it_state->icon) + it->icon = NULL; + eina_stringshare_del(it_state->label); + eina_stringshare_del(it_state->icon_str); + if (it_state->icon) evas_object_del(it_state->icon); + free(it_state); + } + eina_stringshare_del(it->label); + eina_stringshare_del(it->icon_str); + if (it->icon) evas_object_del(it->icon); + if (it->object) evas_object_del(it->object); + //TODO: See if checking for wd->menu_parent is necessary before deleting menu + if (it->o_menu) evas_object_del(it->o_menu); +} + +static void +_del_pre_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Toolbar_Item *it, *next; + + if (!wd) return; + it = ELM_TOOLBAR_ITEM_FROM_INLIST(wd->items); + while (it) + { + next = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next); + _item_del(it); + elm_widget_item_free(it); + it = next; + } + if (wd->more_item) + { + _item_del(wd->more_item); + elm_widget_item_free(wd->more_item); + } + if (wd->long_timer) + { + ecore_timer_del(wd->long_timer); + wd->long_timer = NULL; + } +} + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + free(wd); +} + + +static void +_mirrored_set_item(Evas_Object *obj __UNUSED__, Elm_Toolbar_Item *it, Eina_Bool mirrored) +{ + edje_object_mirrored_set(VIEW(it), mirrored); + elm_widget_mirrored_set(it->o_menu, mirrored); +} + +static void +_theme_hook_item(Evas_Object *obj, Elm_Toolbar_Item *it, double scale, int icon_size) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *view = VIEW(it); + Evas_Coord mw, mh; + const char *style = elm_widget_style_get(obj); + + _mirrored_set_item(obj, it, elm_widget_mirrored_get(obj)); + edje_object_scale_set(view, scale); + if (!it->separator && !it->object) + { + _elm_theme_object_set(obj, view, "toolbar", "item", style); + if (it->selected) + { + edje_object_signal_emit(view, "elm,state,selected", "elm"); + elm_widget_signal_emit(it->icon, "elm,state,selected", "elm"); + } + if (elm_widget_item_disabled_get(it)) + { + edje_object_signal_emit(view, "elm,state,disabled", "elm"); + elm_widget_signal_emit(it->icon, "elm,state,disabled", "elm"); + } + if (it->icon) + { + int ms = 0; + + ms = ((double)icon_size * scale); + evas_object_size_hint_min_set(it->icon, ms, ms); + evas_object_size_hint_max_set(it->icon, ms, ms); + edje_object_part_swallow(view, "elm.swallow.icon", it->icon); + } + edje_object_part_text_escaped_set(view, "elm.text", it->label); + } + else + { + if (!it->object) + { + _elm_theme_object_set(obj, view, "toolbar", "separator", style); + if (wd->vertical) + { + evas_object_size_hint_weight_set(view, EVAS_HINT_EXPAND, -1.0); + evas_object_size_hint_align_set(view, EVAS_HINT_FILL, 0.5); + } + else + { + evas_object_size_hint_weight_set(view, -1.0, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(view, 0.5, EVAS_HINT_FILL); + } + } + else + { + _elm_theme_object_set(obj, view, "toolbar", "object", style); + edje_object_part_swallow(view, "elm.swallow.object", it->object); + } + } + + mw = mh = -1; + if (!it->separator && !it->object) + elm_coords_finger_size_adjust(1, &mw, 1, &mh); + edje_object_size_min_restricted_calc(view, &mw, &mh, mw, mh); + if (!it->separator && !it->object) + elm_coords_finger_size_adjust(1, &mw, 1, &mh); + evas_object_size_hint_min_set(view, mw, mh); +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool mirrored) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Toolbar_Item *it; + + EINA_INLIST_FOREACH(wd->items, it) + _mirrored_set_item(obj, it, mirrored); + if (wd->more_item) + _mirrored_set_item(obj, wd->more_item, mirrored); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Elm_Toolbar_Item *it; + double scale = 0; + + if (!wd) return; + _elm_widget_mirrored_reload(obj); + elm_smart_scroller_object_theme_set(obj, wd->scr, "toolbar", "base", elm_widget_style_get(obj)); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + scale = (elm_widget_scale_get(obj) * _elm_config->scale); + edje_object_scale_set(wd->scr, scale); + wd->icon_size = _elm_toolbar_icon_size_get(wd); + EINA_INLIST_FOREACH(wd->items, it) + _theme_hook_item(obj, it, scale, wd->icon_size); + if (wd->more_item) + _theme_hook_item(obj, wd->more_item, scale, wd->icon_size); + _sizing_eval(obj); +} + +static void +_item_text_set_hook(Elm_Object_Item *it, + const char *part, + const char *label) +{ + if (part && strcmp(part, "default")) return; + _item_label_set(((Elm_Toolbar_Item *)it), label, "elm,state,label_set"); +} + +static const char * +_item_text_get_hook(const Elm_Object_Item *it, const char *part) +{ + if (part && strcmp(part, "default")) return NULL; + return ((Elm_Toolbar_Item *)it)->label; +} + +static void +_item_content_set_hook(Elm_Object_Item *it, + const char *part, + Evas_Object *content) +{ + double scale; + if (part && strcmp(part, "object")) return; + Elm_Toolbar_Item *item = (Elm_Toolbar_Item *) it; + Evas_Object *obj = WIDGET(item); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd || !obj) return; + if (item->object == content) return; + + if (item->object) evas_object_del(item->object); + + item->object = content; + if (item->object) + elm_widget_sub_object_add(obj, item->object); + scale = (elm_widget_scale_get(obj) * _elm_config->scale); + _theme_hook_item(obj, item, scale, wd->icon_size); +} + +static Evas_Object * +_item_content_get_hook(const Elm_Object_Item *it, const char *part) +{ + if (part && strcmp(part, "object")) return NULL; + return ((Elm_Toolbar_Item *) it)->object; +} + +static Evas_Object * +_item_content_unset_hook(Elm_Object_Item *it, const char *part) +{ + Evas_Object *o; + double scale; + + if (part && strcmp(part, "object")) return NULL; + Elm_Toolbar_Item *item = (Elm_Toolbar_Item *) it; + Evas_Object *obj = WIDGET(item); + Widget_Data *wd = elm_widget_data_get(obj); + + edje_object_part_unswallow(VIEW(it), item->object); + elm_widget_sub_object_del(obj, item->object); + o = item->object; + item->object = NULL; + scale = (elm_widget_scale_get(obj) * _elm_config->scale); + _theme_hook_item(obj, item, scale, wd->icon_size); + return o; +} + +static void +_translate_hook(Evas_Object *obj) +{ + evas_object_smart_callback_call(obj, "language,changed", NULL); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1, minw_bx = -1, minh_bx = -1; + Evas_Coord vw = 0, vh = 0; + Evas_Coord w, h; + + if (!wd) return; + evas_object_smart_need_recalculate_set(wd->bx, EINA_TRUE); + evas_object_smart_calculate(wd->bx); + edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), + &minw, &minh); + evas_object_geometry_get(obj, NULL, NULL, &w, &h); + if (w < minw) w = minw; + if (h < minh) h = minh; + evas_object_resize(wd->scr, w, h); + + evas_object_size_hint_min_get(wd->bx, &minw_bx, &minh_bx); +// if (wd->vertical && (h > minh)) minh = h; +// if ((!wd->vertical) && (w > minw)) minw = w; + elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh); + if (wd->shrink_mode == ELM_TOOLBAR_SHRINK_NONE) + { + if (wd->vertical) + { + minw = minw_bx + (w - vw); + minh = minh_bx + (h - vh); + } + else + { + minw = minw_bx + (w - vw); + minh = minh_bx + (h - vh); + } + } + else if (wd->shrink_mode == ELM_TOOLBAR_SHRINK_EXPAND) + { + minw = minw_bx + (w - vw); + minh = minh_bx + (h - vh); + if (minw_bx < vw) minw_bx = vw; + if (minh_bx < vh) minh_bx = vh; + } + else + { + if (wd->vertical) + { + minw = minw_bx + (w - vw); + minh = h - vh; + } + else + { + minw = w - vw; + minh = minh_bx + (h - vh); + } +// if (wd->vertical) minh = h - vh; +// else minw = w - vw; +// minh = minh + (h - vh); + } + evas_object_resize(wd->bx, minw_bx, minh_bx); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, -1, -1); +} + +static void +_item_menu_create(Widget_Data *wd, Elm_Toolbar_Item *item) +{ + item->o_menu = elm_menu_add(VIEW(item)); + item->menu = EINA_TRUE; + if (wd->menu_parent) + elm_menu_parent_set(item->o_menu, wd->menu_parent); + evas_object_event_callback_add(item->o_menu, EVAS_CALLBACK_HIDE, + _menu_hide, item); + evas_object_event_callback_add(item->o_menu, EVAS_CALLBACK_DEL, + _menu_del, item); +} + +static void +_item_menu_destroy(Elm_Toolbar_Item *item) +{ + if (item->o_menu) + { + evas_object_del(item->o_menu); + item->o_menu = NULL; + } + item->menu = EINA_FALSE; +} + +static int +_toolbar_item_prio_compare_cb(const void *i1, const void *i2) +{ + const Elm_Toolbar_Item *eti1 = i1; + const Elm_Toolbar_Item *eti2 = i2; + + if (!eti2) return 1; + if (!eti1) return -1; + + return eti2->prio.priority - eti1->prio.priority; +} + +static void +_fix_items_visibility(Widget_Data *wd, Evas_Coord *iw, Evas_Coord vw) +{ + Elm_Toolbar_Item *it; + Eina_List *sorted = NULL; + Evas_Coord ciw = 0, cih = 0; + + EINA_INLIST_FOREACH(wd->items, it) + { + sorted = eina_list_sorted_insert(sorted, + _toolbar_item_prio_compare_cb, it); + } + + if (wd->more_item) + { + evas_object_geometry_get(wd->VIEW(more_item), NULL, NULL, &ciw, &cih); + if (wd->vertical) *iw += cih; + else *iw += ciw; + } + EINA_LIST_FREE(sorted, it) + { + evas_object_geometry_get(VIEW(it), NULL, NULL, &ciw, &cih); + if (wd->vertical) *iw += cih; + else *iw += ciw; + it->prio.visible = (*iw <= vw); + } +} + +static void +_elm_toolbar_item_menu_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Toolbar_Item *it = data; + if (it->func) it->func((void *)(it->base.data), WIDGET(it), it); +} + +static void +_resize_job(void *data) +{ + Evas_Object *obj = (Evas_Object *)data; + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord mw, mh, vw = 0, vh = 0, w = 0, h = 0; + Elm_Toolbar_Item *it; + + if (!wd) return; + wd->resize_job = NULL; + elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh); + evas_object_size_hint_min_get(wd->bx, &mw, &mh); + evas_object_geometry_get(wd->bx, NULL, NULL, &w, &h); + if (wd->shrink_mode == ELM_TOOLBAR_SHRINK_MENU) + { + Evas_Coord iw = 0, ih = 0, more_w = 0, more_h = 0; + + if (wd->vertical) + { + evas_object_resize(wd->bx, w, vh); + _fix_items_visibility(wd, &ih, vh); + } + else + { + evas_object_resize(wd->bx, vw, h); + _fix_items_visibility(wd, &iw, vw); + } + evas_object_geometry_get(wd->VIEW(more_item), NULL, NULL, + &more_w, &more_h); + if (wd->vertical) + { + if ((ih - more_h) <= vh) ih -= more_h; + } + else + { + if ((iw - more_w) <= vw) iw -= more_w; + } + + /* All items are removed from the box object, since removing individual + * items won't trigger a resize. Items are be readded below. */ + evas_object_box_remove_all(wd->bx, EINA_FALSE); + if (((wd->vertical) && (ih > vh)) || + ((!wd->vertical) && (iw > vw))) + { + Evas_Object *menu; + + _item_menu_destroy(wd->more_item); + _item_menu_create(wd, wd->more_item); + menu = elm_toolbar_item_menu_get((Elm_Object_Item *)wd->more_item); + EINA_INLIST_FOREACH(wd->items, it) + { + if (!it->prio.visible) + { + if (it->separator) + elm_menu_item_separator_add(menu, NULL); + else + { + Elm_Object_Item *menu_it; + menu_it = elm_menu_item_add + (menu, NULL, it->icon_str, it->label, + _elm_toolbar_item_menu_cb, it); + elm_object_item_disabled_set + (menu_it, elm_widget_item_disabled_get(it)); + if (it->o_menu) + elm_menu_clone(it->o_menu, menu, menu_it); + } + evas_object_hide(VIEW(it)); + } + else + { + evas_object_box_append(wd->bx, VIEW(it)); + evas_object_show(VIEW(it)); + } + } + evas_object_box_append(wd->bx, wd->VIEW(more_item)); + evas_object_show(wd->VIEW(more_item)); + } + else + { + /* All items are visible, show them all (except for the "More" + * button, of course). */ + EINA_INLIST_FOREACH(wd->items, it) + { + evas_object_show(VIEW(it)); + evas_object_box_append(wd->bx, VIEW(it)); + } + evas_object_hide(wd->VIEW(more_item)); + } + } + else if (wd->shrink_mode == ELM_TOOLBAR_SHRINK_HIDE) + { + Evas_Coord iw = 0, ih = 0; + + if (wd->vertical) + { + evas_object_resize(wd->bx, w, vh); + _fix_items_visibility(wd, &ih, vh); + } + else + { + evas_object_resize(wd->bx, vw, h); + _fix_items_visibility(wd, &iw, vw); + } + evas_object_box_remove_all(wd->bx, EINA_FALSE); + if (((wd->vertical) && (ih > vh)) || + ((!wd->vertical) && (iw > vw))) + { + EINA_INLIST_FOREACH(wd->items, it) + { + if (!it->prio.visible) + evas_object_hide(VIEW(it)); + else + { + evas_object_box_append(wd->bx, VIEW(it)); + evas_object_show(VIEW(it)); + } + } + } + else + { + /* All items are visible, show them all */ + EINA_INLIST_FOREACH(wd->items, it) + { + evas_object_show(VIEW(it)); + evas_object_box_append(wd->bx, VIEW(it)); + } + } + } + else if (wd->shrink_mode == ELM_TOOLBAR_SHRINK_EXPAND) + { + if ((vw >= mw) && (vh >= mh)) + evas_object_resize(wd->bx, vw, vh); + else if (vw < mw) + evas_object_resize(wd->bx, mw, vh); + else if (vh < mh) + evas_object_resize(wd->bx, vw, mh); + } + else + { + if (wd->vertical) + { + if ((vh >= mh) && (h != vh)) evas_object_resize(wd->bx, w, vh); + } + else + { + if ((vw >= mw) && (w != vw)) evas_object_resize(wd->bx, vw, h); + } + EINA_INLIST_FOREACH(wd->items, it) + { + if (it->selected) + { + _item_show(it); + break; + } + } + } + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); +} + +static void +_resize_item(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _sizing_eval(data); + _resize(data, NULL, NULL, NULL); +} + +static void +_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd->resize_job) + wd->resize_job = ecore_job_add(_resize_job, data); +} + +static void +_select_filter(Elm_Toolbar_Item *it, Evas_Object *obj __UNUSED__, const char *emission, const char *source __UNUSED__) +{ + int button; + char buf[sizeof("elm,action,click,") + 1]; + + button = atoi(emission + sizeof("mouse,clicked,") - 1); + if (button == 1) return; /* regular left click event */ + snprintf(buf, sizeof(buf), "elm,action,click,%d", button); + edje_object_signal_emit(VIEW(it), buf, "elm"); +} + +static void +_select(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Elm_Toolbar_Item *it = data; + + if ((_elm_config->access_mode == ELM_ACCESS_MODE_OFF) || + (_elm_access_2nd_click_timeout(VIEW(it)))) + { + if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF) + _elm_access_say(E_("Selected")); + _item_select(it); + } +} + +static Eina_Bool +_long_press(Elm_Toolbar_Item *it) +{ + Widget_Data *wd = elm_widget_data_get(WIDGET(it)); + wd->long_timer = NULL; + wd->long_press = EINA_TRUE; + evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, it); + return ECORE_CALLBACK_CANCEL; +} + +static void +_mouse_down(Elm_Toolbar_Item *it, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Event_Mouse_Down *ev) +{ + Widget_Data *wd = elm_widget_data_get(WIDGET(it)); + if (!wd) return; + if (ev->button != 1) return; + if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) + evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it); + wd->long_press = EINA_FALSE; + if (wd->long_timer) ecore_timer_interval_set(wd->long_timer, _elm_config->longpress_timeout); + else wd->long_timer = ecore_timer_add(_elm_config->longpress_timeout, (Ecore_Task_Cb)_long_press, it); +} + +static void +_mouse_up(Elm_Toolbar_Item *it, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Event_Mouse_Up *ev) +{ + Widget_Data *wd = elm_widget_data_get(WIDGET(it)); + if (!wd) return; + if (ev->button != 1) return; + if (wd->long_timer) + { + ecore_timer_del(wd->long_timer); + wd->long_timer = NULL; + } +} + +static void +_mouse_in(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Elm_Toolbar_Item *it = data; + edje_object_signal_emit(VIEW(it), "elm,state,highlighted", "elm"); + elm_widget_signal_emit(it->icon, "elm,state,highlighted", "elm"); +} + +static void +_mouse_out(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Elm_Toolbar_Item *it = data; + edje_object_signal_emit(VIEW(it), "elm,state,unhighlighted", "elm"); + elm_widget_signal_emit(it->icon, "elm,state,unhighlighted", "elm"); +} + +static void +_layout(Evas_Object *o, Evas_Object_Box_Data *priv, void *data) +{ + Evas_Object *obj = (Evas_Object *) data; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _els_box_layout(o, priv, !wd->vertical, wd->homogeneous, + elm_widget_mirrored_get(obj)); +} + +static char * +_access_info_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, Elm_Widget_Item *item) +{ + Elm_Toolbar_Item *it = (Elm_Toolbar_Item *)item; + const char *txt = item->access_info; + if (!txt) txt = it->label; + if (txt) return strdup(txt); + return NULL; +} + +static char * +_access_state_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, Elm_Widget_Item *item __UNUSED__) +{ + Elm_Toolbar_Item *it = (Elm_Toolbar_Item *)item; + if (it->separator) + return strdup(E_("Separator")); + else if (elm_widget_item_disabled_get(it)) + return strdup(E_("State: Disabled")); + else if (it->selected) + return strdup(E_("State: Selected")); + else if (it->menu) + return strdup(E_("Has menu")); + return NULL; +} + +static Eina_Bool +_item_del_pre_hook(Elm_Object_Item *it) +{ + Widget_Data *wd; + Evas_Object *obj2; + Elm_Toolbar_Item *item, *next; + item = (Elm_Toolbar_Item *)it; + + wd = elm_widget_data_get(WIDGET(item)); + if (!wd) return EINA_FALSE; + + obj2 = WIDGET(item); + next = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(item)->next); + wd->items = eina_inlist_remove(wd->items, EINA_INLIST_GET(item)); + wd->item_count--; + if (!next) next = ELM_TOOLBAR_ITEM_FROM_INLIST(wd->items); + if ((wd->select_mode == ELM_OBJECT_SELECT_MODE_ALWAYS) && + item->selected && next) _item_select(next); + _item_del(item); + _theme_hook(obj2); + + return EINA_TRUE; +} + +static Elm_Toolbar_Item * +_item_new(Evas_Object *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *icon_obj; + Evas_Coord mw, mh; + Elm_Toolbar_Item *it; + + icon_obj = elm_icon_add(obj); + elm_icon_order_lookup_set(icon_obj, wd->lookup_order); + if (!icon_obj) return NULL; + it = elm_widget_item_new(obj, Elm_Toolbar_Item); + if (!it) + { + evas_object_del(icon_obj); + return NULL; + } + + elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook); + elm_widget_item_disable_hook_set(it, _item_disable_hook); + elm_widget_item_text_set_hook_set(it, _item_text_set_hook); + elm_widget_item_text_get_hook_set(it, _item_text_get_hook); + elm_widget_item_content_set_hook_set(it, _item_content_set_hook); + elm_widget_item_content_get_hook_set(it, _item_content_get_hook); + elm_widget_item_content_unset_hook_set(it, _item_content_unset_hook); + + it->label = eina_stringshare_add(label); + it->prio.visible = 1; + it->prio.priority = 0; + it->func = func; + it->separator = EINA_FALSE; + it->object = NULL; + it->base.data = data; + VIEW(it) = edje_object_add(evas_object_evas_get(obj)); + _elm_access_item_register(&it->base, VIEW(it)); + _elm_access_text_set(_elm_access_item_get(&it->base), + ELM_ACCESS_TYPE, E_("Tool Item")); + _elm_access_callback_set(_elm_access_item_get(&it->base), + ELM_ACCESS_INFO, _access_info_cb, it); + _elm_access_callback_set(_elm_access_item_get(&it->base), + ELM_ACCESS_STATE, _access_state_cb, it); + + if (_item_icon_set(icon_obj, "toolbar/", icon)) + { + it->icon = icon_obj; + it->icon_str = eina_stringshare_add(icon); + } + else + { + it->icon = NULL; + it->icon_str = NULL; + evas_object_del(icon_obj); + } + + _elm_theme_object_set(obj, VIEW(it), "toolbar", "item", + elm_widget_style_get(obj)); + edje_object_signal_callback_add(VIEW(it), "elm,action,click", "elm", + _select, it); + edje_object_signal_callback_add(VIEW(it), "mouse,clicked,*", "*", + (Edje_Signal_Cb)_select_filter, it); + edje_object_signal_callback_add(VIEW(it), "elm,mouse,in", "elm", + _mouse_in, it); + edje_object_signal_callback_add(VIEW(it), "elm,mouse,out", "elm", + _mouse_out, it); + evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_DOWN, + (Evas_Object_Event_Cb)_mouse_down, it); + evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_UP, + (Evas_Object_Event_Cb)_mouse_up, it); + elm_widget_sub_object_add(obj, VIEW(it)); + if (it->icon) + { + int ms = 0; + + ms = ((double)wd->icon_size * _elm_config->scale); + evas_object_size_hint_min_set(it->icon, ms, ms); + evas_object_size_hint_max_set(it->icon, ms, ms); + edje_object_part_swallow(VIEW(it), "elm.swallow.icon", it->icon); + evas_object_show(it->icon); + elm_widget_sub_object_add(obj, it->icon); + } + edje_object_part_text_escaped_set(VIEW(it), "elm.text", it->label); + mw = mh = -1; + elm_coords_finger_size_adjust(1, &mw, 1, &mh); + edje_object_size_min_restricted_calc(VIEW(it), &mw, &mh, mw, mh); + elm_coords_finger_size_adjust(1, &mw, 1, &mh); + if (wd->shrink_mode != ELM_TOOLBAR_SHRINK_EXPAND) + { + if (wd->vertical) + { + evas_object_size_hint_weight_set(VIEW(it), EVAS_HINT_EXPAND, -1.0); + evas_object_size_hint_align_set(VIEW(it), EVAS_HINT_FILL, 0.5); + } + else + { + evas_object_size_hint_weight_set(VIEW(it), -1.0, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(VIEW(it), 0.5, EVAS_HINT_FILL); + } + } + else + { + evas_object_size_hint_weight_set(VIEW(it), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(VIEW(it), EVAS_HINT_FILL, EVAS_HINT_FILL); + } + evas_object_size_hint_min_set(VIEW(it), mw, mh); + evas_object_size_hint_max_set(VIEW(it), -1, -1); + evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_RESIZE, + _resize_item, obj); + if ((!wd->items) && (wd->select_mode == ELM_OBJECT_SELECT_MODE_ALWAYS)) + _item_select(it); + wd->item_count++; + return it; +} + +static void +_elm_toolbar_item_label_update(Elm_Toolbar_Item *item) +{ + Evas_Coord mw = -1, mh = -1; + Widget_Data *wd = elm_widget_data_get(WIDGET(item)); + edje_object_part_text_escaped_set(VIEW(item), "elm.text", item->label); + + elm_coords_finger_size_adjust(1, &mw, 1, &mh); + edje_object_size_min_restricted_calc(VIEW(item), &mw, &mh, mw, mh); + elm_coords_finger_size_adjust(1, &mw, 1, &mh); + if (wd->shrink_mode != ELM_TOOLBAR_SHRINK_EXPAND) + { + if (wd->vertical) + { + evas_object_size_hint_weight_set(VIEW(item), EVAS_HINT_EXPAND, -1.0); + evas_object_size_hint_align_set(VIEW(item), EVAS_HINT_FILL, 0.5); + } + else + { + evas_object_size_hint_weight_set(VIEW(item), -1.0, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(VIEW(item), 0.5, EVAS_HINT_FILL); + } + } + else + { + evas_object_size_hint_weight_set(VIEW(item), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(VIEW(item), EVAS_HINT_FILL, EVAS_HINT_FILL); + } + evas_object_size_hint_min_set(VIEW(item), mw, mh); +} + +static void +_elm_toolbar_item_label_set_cb (void *data, Evas_Object *obj, const char *emission, const char *source) +{ + Elm_Toolbar_Item *item = data; + _elm_toolbar_item_label_update(item); + edje_object_signal_callback_del(obj, emission, source, + _elm_toolbar_item_label_set_cb); + edje_object_signal_emit (VIEW(item), "elm,state,label,reset", "elm"); +} + +static void +_item_label_set(Elm_Toolbar_Item *item, const char *label, const char *sig) +{ + const char *s; + + if ((label) && (item->label) && (!strcmp(label, item->label))) return; + + eina_stringshare_replace(&item->label, label); + s = edje_object_data_get(VIEW(item), "transition_animation_on"); + if ((s) && (atoi(s))) + { + edje_object_part_text_escaped_set(VIEW(item), "elm.text_new", item->label); + edje_object_signal_emit (VIEW(item), sig, "elm"); + edje_object_signal_callback_add(VIEW(item), + "elm,state,label_set,done", "elm", + _elm_toolbar_item_label_set_cb, item); + } + else + _elm_toolbar_item_label_update(item); + _resize(WIDGET(item), NULL, NULL, NULL); +} + +static void +_elm_toolbar_item_icon_update(Elm_Toolbar_Item *item) +{ + Elm_Toolbar_Item_State *it_state; + Eina_List *l; + Evas_Coord mw = -1, mh = -1; + Widget_Data *wd = elm_widget_data_get(WIDGET(item)); + Evas_Object *old_icon = edje_object_part_swallow_get(VIEW(item), + "elm.swallow.icon"); + elm_widget_sub_object_del(VIEW(item), old_icon); + evas_object_hide(old_icon); + edje_object_part_swallow(VIEW(item), "elm.swallow.icon", item->icon); + elm_coords_finger_size_adjust(1, &mw, 1, &mh); + edje_object_size_min_restricted_calc(VIEW(item), &mw, &mh, mw, mh); + elm_coords_finger_size_adjust(1, &mw, 1, &mh); + if (wd->shrink_mode != ELM_TOOLBAR_SHRINK_EXPAND) + { + if (wd->vertical) + { + evas_object_size_hint_weight_set(VIEW(item), EVAS_HINT_EXPAND, -1.0); + evas_object_size_hint_align_set(VIEW(item), EVAS_HINT_FILL, 0.5); + } + else + { + evas_object_size_hint_weight_set(VIEW(item), -1.0, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(VIEW(item), 0.5, EVAS_HINT_FILL); + } + } + else + { + evas_object_size_hint_weight_set(VIEW(item), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(VIEW(item), EVAS_HINT_FILL, EVAS_HINT_FILL); + } + evas_object_size_hint_min_set(VIEW(item), mw, mh); + + EINA_LIST_FOREACH(item->states, l, it_state) + { + if (it_state->icon == old_icon) return; + } + evas_object_del(old_icon); +} + +static void +_elm_toolbar_item_icon_set_cb (void *data, Evas_Object *obj, const char *emission, const char *source) +{ + Elm_Toolbar_Item *item = data; + edje_object_part_unswallow(VIEW(item), item->icon); + _elm_toolbar_item_icon_update(item); + edje_object_signal_callback_del(obj, emission, source, + _elm_toolbar_item_icon_set_cb); + edje_object_signal_emit (VIEW(item), "elm,state,icon,reset", "elm"); +} + +static void +_elm_toolbar_item_icon_obj_set(Evas_Object *obj, Elm_Toolbar_Item *item, Evas_Object *icon_obj, const char *icon_str, double icon_size, const char *sig) +{ + Evas_Object *old_icon; + int ms = 0; + const char *s; + + if (icon_str) + eina_stringshare_replace(&item->icon_str, icon_str); + else + { + eina_stringshare_del(item->icon_str); + item->icon_str = NULL; + } + item->icon = icon_obj; + if (icon_obj) + { + ms = (icon_size * _elm_config->scale); + evas_object_size_hint_min_set(item->icon, ms, ms); + evas_object_size_hint_max_set(item->icon, ms, ms); + evas_object_show(item->icon); + elm_widget_sub_object_add(obj, item->icon); + } + s = edje_object_data_get(VIEW(item), "transition_animation_on"); + if ((s) && (atoi(s))) + { + old_icon = edje_object_part_swallow_get(VIEW(item), + "elm.swallow.icon_new"); + if (old_icon) + { + elm_widget_sub_object_del(VIEW(item), old_icon); + evas_object_hide(old_icon); + } + edje_object_part_swallow(VIEW(item), "elm.swallow.icon_new", + item->icon); + edje_object_signal_emit (VIEW(item), sig, "elm"); + edje_object_signal_callback_add(VIEW(item), + "elm,state,icon_set,done", "elm", + _elm_toolbar_item_icon_set_cb, item); + } + else + _elm_toolbar_item_icon_update(item); + _resize(obj, NULL, NULL, NULL); +} + +static void +_elm_toolbar_item_state_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Toolbar_Item *it = event_info; + Elm_Toolbar_Item_State *it_state; + + it_state = eina_list_data_get(it->current_state); + if (it_state->func) + it_state->func((void *)it_state->data, obj, event_info); +} + +static Elm_Toolbar_Item_State * +_item_state_new(const char *label, const char *icon_str, Evas_Object *icon, Evas_Smart_Cb func, const void *data) +{ + Elm_Toolbar_Item_State *it_state; + it_state = ELM_NEW(Elm_Toolbar_Item_State); + it_state->label = eina_stringshare_add(label); + it_state->icon_str = eina_stringshare_add(icon_str); + it_state->icon = icon; + it_state->func = func; + it_state->data = data; + return it_state; +} + +EAPI Evas_Object * +elm_toolbar_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + + ELM_SET_WIDTYPE(widtype, "toolbar"); + elm_widget_type_set(obj, "toolbar"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_translate_hook_set(obj, _translate_hook); + elm_widget_can_focus_set(obj, EINA_TRUE); + + wd->more_item = NULL; + wd->selected_item = NULL; + wd->scr = elm_smart_scroller_add(e); + elm_smart_scroller_widget_set(wd->scr, obj); + elm_smart_scroller_object_theme_set(obj, wd->scr, "toolbar", "base", "default"); + elm_smart_scroller_bounce_allow_set(wd->scr, + _elm_config->thumbscroll_bounce_enable, + EINA_FALSE); + elm_widget_resize_object_set(obj, wd->scr); + elm_smart_scroller_policy_set(wd->scr, + ELM_SMART_SCROLLER_POLICY_AUTO, + ELM_SMART_SCROLLER_POLICY_OFF); + + + wd->icon_size = _elm_toolbar_icon_size_get(wd); + + + wd->homogeneous = EINA_TRUE; + wd->align = 0.5; + + wd->bx = evas_object_box_add(e); + evas_object_size_hint_align_set(wd->bx, wd->align, 0.5); + evas_object_box_layout_set(wd->bx, _layout, obj, NULL); + elm_widget_sub_object_add(obj, wd->bx); + elm_smart_scroller_child_set(wd->scr, wd->bx); + evas_object_show(wd->bx); + + elm_toolbar_shrink_mode_set(obj, _elm_config->toolbar_shrink_mode); + evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_RESIZE, _resize, obj); + evas_object_event_callback_add(wd->bx, EVAS_CALLBACK_RESIZE, _resize, obj); + elm_toolbar_icon_order_lookup_set(obj, ELM_ICON_LOOKUP_THEME_FDO); + + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + _sizing_eval(obj); + return obj; +} + +EAPI void +elm_toolbar_icon_size_set(Evas_Object *obj, int icon_size) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->icon_size == icon_size) return; + wd->icon_size = icon_size; + _theme_hook(obj); +} + +EAPI int +elm_toolbar_icon_size_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; + return wd->icon_size; +} + +EAPI Elm_Object_Item * +elm_toolbar_item_append(Evas_Object *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + Elm_Toolbar_Item *it = _item_new(obj, icon, label, func, data); + if (!it) return NULL; + double scale = (elm_widget_scale_get(obj) * _elm_config->scale); + + wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it)); + evas_object_box_append(wd->bx, VIEW(it)); + evas_object_show(VIEW(it)); + + _theme_hook_item(obj, it, scale, wd->icon_size); + _sizing_eval(obj); + + return (Elm_Object_Item *)it; +} + +EAPI Elm_Object_Item * +elm_toolbar_item_prepend(Evas_Object *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + Elm_Toolbar_Item *it = _item_new(obj, icon, label, func, data); + if (!it) return NULL; + double scale = (elm_widget_scale_get(obj) * _elm_config->scale); + + wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it)); + evas_object_box_prepend(wd->bx, VIEW(it)); + evas_object_show(VIEW(it)); + _theme_hook_item(obj, it, scale, wd->icon_size); + _sizing_eval(obj); + + return (Elm_Object_Item *)it; +} + +EAPI Elm_Object_Item * +elm_toolbar_item_insert_before(Evas_Object *obj, Elm_Object_Item *before, const char *icon, const char *label, Evas_Smart_Cb func, const void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + ELM_OBJ_ITEM_CHECK_OR_RETURN(before, NULL); + Widget_Data *wd; + Elm_Toolbar_Item *it, *_before; + + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + _before = (Elm_Toolbar_Item *) before; + it = _item_new(obj, icon, label, func, data); + if (!it) return NULL; + double scale = (elm_widget_scale_get(obj) * _elm_config->scale); + + wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it), + EINA_INLIST_GET(_before)); + evas_object_box_insert_before(wd->bx, VIEW(it), VIEW(_before)); + evas_object_show(VIEW(it)); + _theme_hook_item(obj, it, scale, wd->icon_size); + _sizing_eval(obj); + + return (Elm_Object_Item *)it; +} + +EAPI Elm_Object_Item * +elm_toolbar_item_insert_after(Evas_Object *obj, Elm_Object_Item *after, const char *icon, const char *label, Evas_Smart_Cb func, const void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + ELM_OBJ_ITEM_CHECK_OR_RETURN(after, NULL); + Widget_Data *wd; + Elm_Toolbar_Item *it, *_after; + + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + _after = (Elm_Toolbar_Item *) after; + it = _item_new(obj, icon, label, func, data); + if (!it) return NULL; + double scale = (elm_widget_scale_get(obj) * _elm_config->scale); + + wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it), + EINA_INLIST_GET(_after)); + evas_object_box_insert_after(wd->bx, VIEW(it), VIEW(_after)); + evas_object_show(VIEW(it)); + _theme_hook_item(obj, it, scale, wd->icon_size); + _sizing_eval(obj); + + return (Elm_Object_Item *)it; +} + +EAPI Elm_Object_Item * +elm_toolbar_first_item_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd || !wd->items) return NULL; + return (Elm_Object_Item *) ELM_TOOLBAR_ITEM_FROM_INLIST(wd->items); +} + +EAPI Elm_Object_Item * +elm_toolbar_last_item_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd || !wd->items) return NULL; + return (Elm_Object_Item *) ELM_TOOLBAR_ITEM_FROM_INLIST(wd->items->last); +} + +EAPI Elm_Object_Item * +elm_toolbar_item_next_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + return (Elm_Object_Item *) ELM_TOOLBAR_ITEM_FROM_INLIST( + EINA_INLIST_GET(((Elm_Toolbar_Item *)it))->next); +} + +EAPI Elm_Object_Item * +elm_toolbar_item_prev_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + return (Elm_Object_Item *) ELM_TOOLBAR_ITEM_FROM_INLIST( + EINA_INLIST_GET(((Elm_Toolbar_Item *)it))->prev); +} + +EAPI void +elm_toolbar_item_priority_set(Elm_Object_Item *it, int priority) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it; + if (item->prio.priority == priority) return; + item->prio.priority = priority; + _resize(WIDGET(item), NULL, NULL, NULL); +} + +EAPI int +elm_toolbar_item_priority_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, 0); + return ((Elm_Toolbar_Item *)it)->prio.priority; +} + +EAPI Elm_Object_Item * +elm_toolbar_item_find_by_label(const Evas_Object *obj, const char *label) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Elm_Toolbar_Item *it; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + EINA_INLIST_FOREACH(wd->items, it) + { + if (!strcmp(it->label, label)) + return (Elm_Object_Item *)it; + } + return NULL; +} + +EAPI void +elm_toolbar_item_selected_set(Elm_Object_Item *it, Eina_Bool selected) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it; + Widget_Data *wd = elm_widget_data_get(WIDGET(item)); + if (!wd) return; + + if (item->selected == selected) return; + if (selected) _item_select(item); + else _item_unselect(item); +} + +EAPI Eina_Bool +elm_toolbar_item_selected_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE); + return ((Elm_Toolbar_Item *)it)->selected; +} + +EAPI Elm_Object_Item * +elm_toolbar_selected_item_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return (Elm_Object_Item *) wd->selected_item; +} + +EAPI void +elm_toolbar_item_icon_set(Elm_Object_Item *it, const char *icon) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + + Evas_Object *icon_obj; + Widget_Data *wd; + Evas_Object *obj; + Elm_Toolbar_Item * item = (Elm_Toolbar_Item *)it; + + obj = WIDGET(item); + wd = elm_widget_data_get(obj); + if (!wd) return; + if ((icon) && (item->icon_str) && (!strcmp(icon, item->icon_str))) return; + + icon_obj = elm_icon_add(obj); + if (!icon_obj) return; + if (_item_icon_set(icon_obj, "toolbar/", icon)) + _elm_toolbar_item_icon_obj_set(obj, item, icon_obj, icon, wd->icon_size, + "elm,state,icon_set"); + else + { + _elm_toolbar_item_icon_obj_set(obj, item, NULL, NULL, 0, + "elm,state,icon_set"); + evas_object_del(icon_obj); + } +} + +EAPI const char * +elm_toolbar_item_icon_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + return ((Elm_Toolbar_Item *)it)->icon_str; +} + +EAPI Evas_Object * +elm_toolbar_item_object_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + + Widget_Data *wd; + Evas_Object *obj; + Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it; + + obj = WIDGET(item); + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + return VIEW(item); +} + +EAPI Evas_Object * +elm_toolbar_item_icon_object_get(Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + return ((Elm_Toolbar_Item *)it)->icon; +} + +EAPI Eina_Bool +elm_toolbar_item_icon_memfile_set(Elm_Object_Item *it, const void *img, size_t size, const char *format, const char *key) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE); + + Evas_Object *icon_obj; + Widget_Data *wd; + Evas_Object *obj; + Eina_Bool ret; + Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it; + + obj = WIDGET(item); + wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + if (img && size) + { + icon_obj = _els_smart_icon_add(evas_object_evas_get(obj)); + evas_object_repeat_events_set(icon_obj, EINA_TRUE); + ret = _els_smart_icon_memfile_set(icon_obj, img, size, format, key); + if (!ret) + { + evas_object_del(icon_obj); + return EINA_FALSE; + } + _elm_toolbar_item_icon_obj_set(obj, item, icon_obj, NULL, wd->icon_size, + "elm,state,icon_set"); + } + else + _elm_toolbar_item_icon_obj_set(obj, item, NULL, NULL, 0, "elm,state,icon_set"); + return EINA_TRUE; +} + +EAPI Eina_Bool +elm_toolbar_item_icon_file_set(Elm_Object_Item *it, const char *file, const char *key) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE); + + Evas_Object *icon_obj; + Widget_Data *wd; + Evas_Object *obj; + Eina_Bool ret; + Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it; + + obj = WIDGET(item); + wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + if (file) + { + icon_obj = _els_smart_icon_add(evas_object_evas_get(obj)); + evas_object_repeat_events_set(icon_obj, EINA_TRUE); + ret = _els_smart_icon_file_key_set(icon_obj, file, key); + if (!ret) + { + evas_object_del(icon_obj); + return EINA_FALSE; + } + _elm_toolbar_item_icon_obj_set(obj, item, icon_obj, NULL, wd->icon_size, + "elm,state,icon_set"); + } + else + _elm_toolbar_item_icon_obj_set(obj, item, NULL, NULL, 0, "elm,state,icon_set"); + return EINA_TRUE; +} + +EAPI void +elm_toolbar_item_separator_set(Elm_Object_Item *it, Eina_Bool separator) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it; + Evas_Object *obj = WIDGET(item); + Widget_Data *wd = elm_widget_data_get(obj); + double scale; + if (item->separator == separator) return; + item->separator = separator; + scale = (elm_widget_scale_get(obj) * _elm_config->scale); + _theme_hook_item(obj, item, scale, wd->icon_size); +} + +EAPI Eina_Bool +elm_toolbar_item_separator_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE); + return ((Elm_Toolbar_Item *)it)->separator; +} + +EAPI void +elm_toolbar_shrink_mode_set(Evas_Object *obj, Elm_Toolbar_Shrink_Mode shrink_mode) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + Eina_Bool bounce; + + if (!wd) return; + wd->shrink_mode = shrink_mode; + bounce = (_elm_config->thumbscroll_bounce_enable) && + (shrink_mode == ELM_TOOLBAR_SHRINK_SCROLL); + elm_smart_scroller_bounce_allow_set(wd->scr, bounce, EINA_FALSE); + + if (wd->more_item) + { + _item_del(wd->more_item); + elm_widget_item_free(wd->more_item); + wd->more_item = NULL; + } + + if (shrink_mode == ELM_TOOLBAR_SHRINK_MENU) + { + elm_smart_scroller_policy_set(wd->scr, ELM_SMART_SCROLLER_POLICY_OFF, + ELM_SMART_SCROLLER_POLICY_OFF); + wd->more_item = _item_new(obj, "more_menu", "More", NULL, NULL); + } + else if (shrink_mode == ELM_TOOLBAR_SHRINK_HIDE) + elm_smart_scroller_policy_set(wd->scr, ELM_SMART_SCROLLER_POLICY_OFF, + ELM_SMART_SCROLLER_POLICY_OFF); + else + elm_smart_scroller_policy_set(wd->scr, ELM_SMART_SCROLLER_POLICY_AUTO, + ELM_SMART_SCROLLER_POLICY_OFF); + _sizing_eval(obj); +} + +EAPI Elm_Toolbar_Shrink_Mode +elm_toolbar_shrink_mode_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_TOOLBAR_SHRINK_NONE; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return ELM_TOOLBAR_SHRINK_NONE; + return wd->shrink_mode; +} + +EAPI void +elm_toolbar_homogeneous_set(Evas_Object *obj, Eina_Bool homogeneous) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + wd->homogeneous = !!homogeneous; + evas_object_smart_calculate(wd->bx); +} + +EAPI Eina_Bool +elm_toolbar_homogeneous_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return EINA_FALSE; + return wd->homogeneous; +} + +EAPI void +elm_toolbar_menu_parent_set(Evas_Object *obj, Evas_Object *parent) +{ + Elm_Toolbar_Item *it; + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + EINA_SAFETY_ON_NULL_RETURN(parent); + wd->menu_parent = parent; + EINA_INLIST_FOREACH(wd->items, it) + { + if (it->o_menu) + elm_menu_parent_set(it->o_menu, wd->menu_parent); + } + if ((wd->more_item) && (wd->more_item->o_menu)) + elm_menu_parent_set(wd->more_item->o_menu, wd->menu_parent); +} + +EAPI Evas_Object * +elm_toolbar_menu_parent_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return NULL; + return wd->menu_parent; +} + +EAPI void +elm_toolbar_align_set(Evas_Object *obj, double align) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + if (wd->vertical) + { + if (wd->align != align) + evas_object_size_hint_align_set(wd->bx, 0.5, align); + } + else + { + if (wd->align != align) + evas_object_size_hint_align_set(wd->bx, align, 0.5); + } + wd->align = align; +} + +EAPI double +elm_toolbar_align_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0.0; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return 0.0; + return wd->align; +} + +EAPI void +elm_toolbar_item_menu_set(Elm_Object_Item *it, Eina_Bool menu) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it; + Widget_Data *wd = elm_widget_data_get(WIDGET(item)); + if (!wd) return; + + if (item->menu == menu) return; + if (menu) _item_menu_create(wd, item); + else _item_menu_destroy(item); +} + +EAPI Evas_Object * +elm_toolbar_item_menu_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it; + if (!item->menu) return NULL; + Widget_Data *wd = elm_widget_data_get(WIDGET(item)); + if (!wd) return NULL; + return item->o_menu; +} + +EAPI Elm_Toolbar_Item_State * +elm_toolbar_item_state_add(Elm_Object_Item *it, const char *icon, const char *label, Evas_Smart_Cb func, const void *data) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + + Elm_Toolbar_Item_State *it_state; + Evas_Object *icon_obj; + Evas_Object *obj; + Widget_Data *wd; + Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it; + obj = WIDGET(item); + wd = elm_widget_data_get(WIDGET(item)); + if (!wd) return NULL; + + if (!item->states) + { + it_state = _item_state_new(item->label, item->icon_str, item->icon, + item->func, item->base.data); + item->states = eina_list_append(item->states, it_state); + item->current_state = item->states; + } + + icon_obj = elm_icon_add(obj); + elm_icon_order_lookup_set(icon_obj, wd->lookup_order); + if (!icon_obj) goto error_state_add; + + if (!_item_icon_set(icon_obj, "toolbar/", icon)) + { + evas_object_del(icon_obj); + icon_obj = NULL; + icon = NULL; + } + + it_state = _item_state_new(label, icon, icon_obj, func, data); + item->states = eina_list_append(item->states, it_state); + item->func = _elm_toolbar_item_state_cb; + item->base.data = NULL; + + return it_state; + +error_state_add: + if (item->states && !eina_list_next(item->states)) + { + eina_stringshare_del(item->label); + eina_stringshare_del(item->icon_str); + free(eina_list_data_get(item->states)); + eina_list_free(item->states); + item->states = NULL; + } + return NULL; +} + +EAPI Eina_Bool +elm_toolbar_item_state_del(Elm_Object_Item *it, Elm_Toolbar_Item_State *state) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE); + + Eina_List *del_state; + Elm_Toolbar_Item_State *it_state; + Elm_Toolbar_Item *item; + + if (!state) return EINA_FALSE; + + item = (Elm_Toolbar_Item *)it; + if (!item->states) return EINA_FALSE; + + del_state = eina_list_data_find_list(item->states, state); + if (del_state == item->states) return EINA_FALSE; + if (del_state == item->current_state) + elm_toolbar_item_state_unset(it); + + eina_stringshare_del(state->label); + eina_stringshare_del(state->icon_str); + if (state->icon) evas_object_del(state->icon); + free(state); + item->states = eina_list_remove_list(item->states, del_state); + if (item->states && !eina_list_next(item->states)) + { + it_state = eina_list_data_get(item->states); + item->base.data = it_state->data; + item->func = it_state->func; + eina_stringshare_del(it_state->label); + eina_stringshare_del(it_state->icon_str); + free(eina_list_data_get(item->states)); + eina_list_free(item->states); + item->states = NULL; + } + return EINA_TRUE; +} + +EAPI Eina_Bool +elm_toolbar_item_state_set(Elm_Object_Item *it, Elm_Toolbar_Item_State *state) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE); + + Widget_Data *wd; + Eina_List *next_state; + Elm_Toolbar_Item_State *it_state; + Evas_Object *obj; + Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it; + + obj = WIDGET(item); + wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + if (!item->states) return EINA_FALSE; + + if (state) + { + next_state = eina_list_data_find_list(item->states, state); + if (!next_state) return EINA_FALSE; + } + else + next_state = item->states; + + if (next_state == item->current_state) return EINA_TRUE; + + it_state = eina_list_data_get(next_state); + if (eina_list_data_find(item->current_state, state)) + { + _item_label_set(item, it_state->label, "elm,state,label_set,forward"); + _elm_toolbar_item_icon_obj_set(obj, item, it_state->icon, it_state->icon_str, + wd->icon_size, "elm,state,icon_set,forward"); + } + else + { + _item_label_set(item, it_state->label, "elm,state,label_set,backward"); + _elm_toolbar_item_icon_obj_set(obj, + item, + it_state->icon, + it_state->icon_str, + wd->icon_size, + "elm,state,icon_set,backward"); + } + if (elm_widget_item_disabled_get(item)) + elm_widget_signal_emit(item->icon, "elm,state,disabled", "elm"); + else + elm_widget_signal_emit(item->icon, "elm,state,enabled", "elm"); + + item->current_state = next_state; + return EINA_TRUE; +} + +EAPI void +elm_toolbar_item_state_unset(Elm_Object_Item *it) +{ + elm_toolbar_item_state_set(it, NULL); +} + +EAPI Elm_Toolbar_Item_State * +elm_toolbar_item_state_get(const Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it; + + if ((!item->states) || (!item->current_state)) return NULL; + if (item->current_state == item->states) return NULL; + + return eina_list_data_get(item->current_state); +} + +EAPI Elm_Toolbar_Item_State * +elm_toolbar_item_state_next(Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + + Widget_Data *wd; + Evas_Object *obj; + Eina_List *next_state; + Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it; + + obj = WIDGET(item); + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (!item->states) return NULL; + + next_state = eina_list_next(item->current_state); + if (!next_state) + next_state = eina_list_next(item->states); + return eina_list_data_get(next_state); +} + +EAPI Elm_Toolbar_Item_State * +elm_toolbar_item_state_prev(Elm_Object_Item *it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + + Widget_Data *wd; + Evas_Object *obj; + Eina_List *prev_state; + Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it; + + obj = WIDGET(item); + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (!item->states) return NULL; + + prev_state = eina_list_prev(item->current_state); + if ((!prev_state) || (prev_state == item->states)) + prev_state = eina_list_last(item->states); + return eina_list_data_get(prev_state); +} + +EAPI void +elm_toolbar_icon_order_lookup_set(Evas_Object *obj, Elm_Icon_Lookup_Order order) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Elm_Toolbar_Item *it; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + wd->lookup_order = order; + EINA_INLIST_FOREACH(wd->items, it) + elm_icon_order_lookup_set(it->icon, order); + if (wd->more_item) + elm_icon_order_lookup_set(wd->more_item->icon, order); +} + +EAPI Elm_Icon_Lookup_Order +elm_toolbar_icon_order_lookup_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_ICON_LOOKUP_THEME_FDO; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return ELM_ICON_LOOKUP_THEME_FDO; + return wd->lookup_order; +} + +EAPI void +elm_toolbar_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->vertical = !horizontal; + if (wd->vertical) + evas_object_size_hint_align_set(wd->bx, 0.5, wd->align); + else + evas_object_size_hint_align_set(wd->bx, wd->align, 0.5); + _sizing_eval(obj); +} + +EAPI Eina_Bool +elm_toolbar_horizontal_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return !wd->vertical; +} + +EAPI unsigned int +elm_toolbar_items_count(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; + return wd->item_count; +} + +EAPI void +elm_toolbar_select_mode_set(Evas_Object *obj, Elm_Object_Select_Mode mode) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (mode >= ELM_OBJECT_SELECT_MODE_MAX) + return; + if ((mode == ELM_OBJECT_SELECT_MODE_ALWAYS) && + (wd->select_mode != ELM_OBJECT_SELECT_MODE_ALWAYS) && + wd->items) + _item_select(ELM_TOOLBAR_ITEM_FROM_INLIST(wd->items)); + if (wd->select_mode != mode) + wd->select_mode = mode; +} + +EAPI Elm_Object_Select_Mode +elm_toolbar_select_mode_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_OBJECT_SELECT_MODE_MAX; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return ELM_OBJECT_SELECT_MODE_MAX; + return wd->select_mode; +} + diff --git a/libraries/elementary/src/lib/elm_toolbar.h b/libraries/elementary/src/lib/elm_toolbar.h new file mode 100644 index 0000000..6b01030 --- /dev/null +++ b/libraries/elementary/src/lib/elm_toolbar.h @@ -0,0 +1,900 @@ +/** + * @defgroup Toolbar Toolbar + * @ingroup Elementary + * + * @image html img/widget/toolbar/preview-00.png + * @image latex img/widget/toolbar/preview-00.eps width=\textwidth + * + * @image html img/toolbar.png + * @image latex img/toolbar.eps width=\textwidth + * + * A toolbar is a widget that displays a list of items inside + * a box. It can be scrollable, show a menu with items that don't fit + * to toolbar size or even crop them. + * + * Only one item can be selected at a time. + * + * Items can have multiple states, or show menus when selected by the user. + * + * Smart callbacks one can listen to: + * - "clicked" - when the user clicks on a toolbar item and becomes selected. + * - "longpressed" - when the toolbar is pressed for a certain amount of time. + * - "language,changed" - when the program language changes. + * + * Available styles for it: + * - @c "default" + * - @c "transparent" - no background or shadow, just show the content + * + * Default text parts of the toolbar items that you can use for are: + * @li "default" - label of the toolbar item + * + * Supported elm_object_item common APIs. + * @li @ref elm_object_item_disabled_set + * @li @ref elm_object_item_disabled_get + * @li @ref elm_object_item_part_text_set + * @li @ref elm_object_item_part_text_get + * + * List of examples: + * @li @ref toolbar_example_01 + * @li @ref toolbar_example_02 + * @li @ref toolbar_example_03 + */ + +/** + * @addtogroup Toolbar + * @{ + */ + +/** + * @enum _Elm_Toolbar_Shrink_Mode + * @typedef Elm_Toolbar_Shrink_Mode + * + * Set toolbar's items display behavior, it can be scrollable, + * show a menu with exceeding items, or simply hide them. + * + * @note Default value is #ELM_TOOLBAR_SHRINK_MENU. It reads value + * from elm config. + * + * Values don't work as bitmask, only one can be chosen. + * + * @see elm_toolbar_shrink_mode_set() + * @see elm_toolbar_shrink_mode_get() + * + * @ingroup Toolbar + */ +typedef enum +{ + ELM_TOOLBAR_SHRINK_NONE, /**< Set toolbar minimum size to fit all the items. */ + ELM_TOOLBAR_SHRINK_HIDE, /**< Hide exceeding items. */ + ELM_TOOLBAR_SHRINK_SCROLL, /**< Allow accessing exceeding items through a scroller. */ + ELM_TOOLBAR_SHRINK_MENU, /**< Inserts a button to pop up a menu with exceeding items. */ + ELM_TOOLBAR_SHRINK_EXPAND, /**< Expand all items according the size of the toolbar. */ + ELM_TOOLBAR_SHRINK_LAST /**< Indicates error if returned by elm_toolbar_shrink_mode_get() */ +} Elm_Toolbar_Shrink_Mode; + +typedef struct _Elm_Toolbar_Item_State Elm_Toolbar_Item_State; /**< State of a Elm_Toolbar_Item. Can be created with elm_toolbar_item_state_add() and removed with elm_toolbar_item_state_del(). */ + +/** + * Add a new toolbar widget to the given parent Elementary + * (container) object. + * + * @param parent The parent object. + * @return a new toolbar widget handle or @c NULL, on errors. + * + * This function inserts a new toolbar widget on the canvas. + * + * @ingroup Toolbar + */ +EAPI Evas_Object *elm_toolbar_add(Evas_Object *parent); + +/** + * Set the icon size, in pixels, to be used by toolbar items. + * + * @param obj The toolbar object + * @param icon_size The icon size in pixels + * + * @note Default value is @c 32. It reads value from elm config. + * + * @see elm_toolbar_icon_size_get() + * + * @ingroup Toolbar + */ +EAPI void elm_toolbar_icon_size_set(Evas_Object *obj, int icon_size); + +/** + * Get the icon size, in pixels, to be used by toolbar items. + * + * @param obj The toolbar object. + * @return The icon size in pixels. + * + * @see elm_toolbar_icon_size_set() for details. + * + * @ingroup Toolbar + */ +EAPI int elm_toolbar_icon_size_get(const Evas_Object *obj); + +/** + * Sets icon lookup order, for toolbar items' icons. + * + * @param obj The toolbar object. + * @param order The icon lookup order. + * + * Icons added before calling this function will not be affected. + * The default lookup order is #ELM_ICON_LOOKUP_THEME_FDO. + * + * @see elm_toolbar_icon_order_lookup_get() + * + * @ingroup Toolbar + */ +EAPI void elm_toolbar_icon_order_lookup_set(Evas_Object *obj, Elm_Icon_Lookup_Order order); + +/** + * Gets the icon lookup order. + * + * @param obj The toolbar object. + * @return The icon lookup order. + * + * @see elm_toolbar_icon_order_lookup_set() for details. + * + * @ingroup Toolbar + */ +EAPI Elm_Icon_Lookup_Order elm_toolbar_icon_order_lookup_get(const Evas_Object *obj); + +/** + * Append item to the toolbar. + * + * @param obj The toolbar object. + * @param icon A string with icon name or the absolute path of an image file. + * @param label The label of the item. + * @param func The function to call when the item is clicked. + * @param data The data to associate with the item for related callbacks. + * @return The created item or @c NULL upon failure. + * + * A new item will be created and appended to the toolbar, i.e., will + * be set as @b last item. + * + * Items created with this method can be deleted with + * elm_object_item_del(). + * + * Associated @p data can be properly freed when item is deleted if a + * callback function is set with elm_object_item_del_cb_set(). + * + * If a function is passed as argument, it will be called every time this item + * is selected, i.e., the user clicks over an unselected item. + * If such function isn't needed, just passing + * @c NULL as @p func is enough. The same should be done for @p data. + * + * Toolbar will load icon image from fdo or current theme. + * This behavior can be set by elm_toolbar_icon_order_lookup_set() function. + * If an absolute path is provided it will load it direct from a file. + * + * @see elm_toolbar_item_icon_set() + * @see elm_object_item_del() + * + * @ingroup Toolbar + */ +EAPI Elm_Object_Item *elm_toolbar_item_append(Evas_Object *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); + +/** + * Prepend item to the toolbar. + * + * @param obj The toolbar object. + * @param icon A string with icon name or the absolute path of an image file. + * @param label The label of the item. + * @param func The function to call when the item is clicked. + * @param data The data to associate with the item for related callbacks. + * @return The created item or @c NULL upon failure. + * + * A new item will be created and prepended to the toolbar, i.e., will + * be set as @b first item. + * + * Items created with this method can be deleted with + * elm_object_item_del(). + * + * Associated @p data can be properly freed when item is deleted if a + * callback function is set with elm_object_item_del_cb_set(). + * + * If a function is passed as argument, it will be called every time this item + * is selected, i.e., the user clicks over an unselected item. + * If such function isn't needed, just passing + * @c NULL as @p func is enough. The same should be done for @p data. + * + * Toolbar will load icon image from fdo or current theme. + * This behavior can be set by elm_toolbar_icon_order_lookup_set() function. + * If an absolute path is provided it will load it direct from a file. + * + * @see elm_toolbar_item_icon_set() + * @see elm_object_item_del() + * + * @ingroup Toolbar + */ +EAPI Elm_Object_Item *elm_toolbar_item_prepend(Evas_Object *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); + +/** + * Insert a new item into the toolbar object before item @p before. + * + * @param obj The toolbar object. + * @param before The toolbar item to insert before. + * @param icon A string with icon name or the absolute path of an image file. + * @param label The label of the item. + * @param func The function to call when the item is clicked. + * @param data The data to associate with the item for related callbacks. + * @return The created item or @c NULL upon failure. + * + * A new item will be created and added to the toolbar. Its position in + * this toolbar will be just before item @p before. + * + * Items created with this method can be deleted with + * elm_object_item_del(). + * + * Associated @p data can be properly freed when item is deleted if a + * callback function is set with elm_object_item_del_cb_set(). + * + * If a function is passed as argument, it will be called every time this item + * is selected, i.e., the user clicks over an unselected item. + * If such function isn't needed, just passing + * @c NULL as @p func is enough. The same should be done for @p data. + * + * Toolbar will load icon image from fdo or current theme. + * This behavior can be set by elm_toolbar_icon_order_lookup_set() function. + * If an absolute path is provided it will load it direct from a file. + * + * @see elm_toolbar_item_icon_set() + * @see elm_object_item_del() + * + * @ingroup Toolbar + */ +EAPI Elm_Object_Item *elm_toolbar_item_insert_before(Evas_Object *obj, Elm_Object_Item *before, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); + +/** + * Insert a new item into the toolbar object after item @p after. + * + * @param obj The toolbar object. + * @param after The toolbar item to insert after. + * @param icon A string with icon name or the absolute path of an image file. + * @param label The label of the item. + * @param func The function to call when the item is clicked. + * @param data The data to associate with the item for related callbacks. + * @return The created item or @c NULL upon failure. + * + * A new item will be created and added to the toolbar. Its position in + * this toolbar will be just after item @p after. + * + * Items created with this method can be deleted with + * elm_object_item_del(). + * + * Associated @p data can be properly freed when item is deleted if a + * callback function is set with elm_object_item_del_cb_set(). + * + * If a function is passed as argument, it will be called every time this item + * is selected, i.e., the user clicks over an unselected item. + * If such function isn't needed, just passing + * @c NULL as @p func is enough. The same should be done for @p data. + * + * Toolbar will load icon image from fdo or current theme. + * This behavior can be set by elm_toolbar_icon_order_lookup_set() function. + * If an absolute path is provided it will load it direct from a file. + * + * @see elm_toolbar_item_icon_set() + * @see elm_object_item_del() + * + * @ingroup Toolbar + */ +EAPI Elm_Object_Item *elm_toolbar_item_insert_after(Evas_Object *obj, Elm_Object_Item *after, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); + +/** + * Get the first item in the given toolbar widget's list of + * items. + * + * @param obj The toolbar object + * @return The first item or @c NULL, if it has no items (and on + * errors) + * + * @see elm_toolbar_item_append() + * @see elm_toolbar_last_item_get() + * + * @ingroup Toolbar + */ +EAPI Elm_Object_Item *elm_toolbar_first_item_get(const Evas_Object *obj); + +/** + * Get the last item in the given toolbar widget's list of + * items. + * + * @param obj The toolbar object + * @return The last item or @c NULL, if it has no items (and on + * errors) + * + * @see elm_toolbar_item_prepend() + * @see elm_toolbar_first_item_get() + * + * @ingroup Toolbar + */ +EAPI Elm_Object_Item *elm_toolbar_last_item_get(const Evas_Object *obj); + +/** + * Get the item after @p item in toolbar. + * + * @param it The toolbar item. + * @return The item after @p item, or @c NULL if none or on failure. + * + * @note If it is the last item, @c NULL will be returned. + * + * @see elm_toolbar_item_append() + * + * @ingroup Toolbar + */ +EAPI Elm_Object_Item *elm_toolbar_item_next_get(const Elm_Object_Item *it); + +/** + * Get the item before @p item in toolbar. + * + * @param it The toolbar item. + * @return The item before @p item, or @c NULL if none or on failure. + * + * @note If it is the first item, @c NULL will be returned. + * + * @see elm_toolbar_item_prepend() + * + * @ingroup Toolbar + */ +EAPI Elm_Object_Item *elm_toolbar_item_prev_get(const Elm_Object_Item *it); + +/** + * Set the priority of a toolbar item. + * + * @param it The toolbar item. + * @param priority The item priority. The default is zero. + * + * This is used only when the toolbar shrink mode is set to + * #ELM_TOOLBAR_SHRINK_MENU or #ELM_TOOLBAR_SHRINK_HIDE. + * When space is less than required, items with low priority + * will be removed from the toolbar and added to a dynamically-created menu, + * while items with higher priority will remain on the toolbar, + * with the same order they were added. + * + * @see elm_toolbar_item_priority_get() + * + * @ingroup Toolbar + */ +EAPI void elm_toolbar_item_priority_set(Elm_Object_Item *it, int priority); + +/** + * Get the priority of a toolbar item. + * + * @param it The toolbar item. + * @return The @p item priority, or @c 0 on failure. + * + * @see elm_toolbar_item_priority_set() for details. + * + * @ingroup Toolbar + */ +EAPI int elm_toolbar_item_priority_get(const Elm_Object_Item *it); + +/** + * Returns a pointer to a toolbar item by its label. + * + * @param obj The toolbar object. + * @param label The label of the item to find. + * + * @return The pointer to the toolbar item matching @p label or @c NULL + * on failure. + * + * @ingroup Toolbar + */ +EAPI Elm_Object_Item *elm_toolbar_item_find_by_label(const Evas_Object *obj, const char *label); + +/* + * Get whether the @p item is selected or not. + * + * @param it The toolbar item. + * @return @c EINA_TRUE means item is selected. @c EINA_FALSE indicates + * it's not. If @p obj is @c NULL, @c EINA_FALSE is returned. + * + * @see elm_toolbar_selected_item_set() for details. + * @see elm_toolbar_item_selected_get() + * + * @ingroup Toolbar + */ +EAPI Eina_Bool elm_toolbar_item_selected_get(const Elm_Object_Item *it); + +/** + * Set the selected state of an item. + * + * @param it The toolbar item + * @param selected The selected state + * + * This sets the selected state of the given item @p it. + * @c EINA_TRUE for selected, @c EINA_FALSE for not selected. + * + * If a new item is selected the previously selected will be unselected. + * Previously selected item can be get with function + * elm_toolbar_selected_item_get(). + * + * Selected items will be highlighted. + * + * @see elm_toolbar_item_selected_get() + * @see elm_toolbar_selected_item_get() + * + * @ingroup Toolbar + */ +EAPI void elm_toolbar_item_selected_set(Elm_Object_Item *it, Eina_Bool selected); + +/** + * Get the selected item. + * + * @param obj The toolbar object. + * @return The selected toolbar item. + * + * The selected item can be unselected with function + * elm_toolbar_item_selected_set(). + * + * The selected item always will be highlighted on toolbar. + * + * @see elm_toolbar_selected_items_get() + * + * @ingroup Toolbar + */ +EAPI Elm_Object_Item *elm_toolbar_selected_item_get(const Evas_Object *obj); + +/** + * Set the icon associated with @p item. + * + * @param it The toolbar item. + * @param icon A string with icon name or the absolute path of an image file. + * + * Toolbar will load icon image from fdo or current theme. + * This behavior can be set by elm_toolbar_icon_order_lookup_set() function. + * If an absolute path is provided it will load it direct from a file. + * + * @see elm_toolbar_icon_order_lookup_set() + * @see elm_toolbar_icon_order_lookup_get() + * + * @ingroup Toolbar + */ +EAPI void elm_toolbar_item_icon_set(Elm_Object_Item *it, const char *icon); + +/** + * Get the string used to set the icon of @p item. + * + * @param it The toolbar item. + * @return The string associated with the icon object. + * + * @see elm_toolbar_item_icon_set() for details. + * + * @ingroup Toolbar + */ +EAPI const char *elm_toolbar_item_icon_get(const Elm_Object_Item *it); + +/** + * Get the object of @p item. + * + * @param it The toolbar item. + * @return The object + * + * @ingroup Toolbar + */ +EAPI Evas_Object *elm_toolbar_item_object_get(const Elm_Object_Item *it); + +/** + * Get the icon object of @p item. + * + * @param it The toolbar item. + * @return The icon object + * + * @see elm_toolbar_item_icon_set(), elm_toolbar_item_icon_file_set(), + * or elm_toolbar_item_icon_memfile_set() for details. + * + * @ingroup Toolbar + */ +EAPI Evas_Object *elm_toolbar_item_icon_object_get(Elm_Object_Item *it); + +/** + * Set the icon associated with @p item to an image in a binary buffer. + * + * @param it The toolbar item. + * @param img The binary data that will be used as an image + * @param size The size of binary data @p img + * @param format Optional format of @p img to pass to the image loader + * @param key Optional key of @p img to pass to the image loader (eg. if @p img is an edje file) + * + * @return (@c EINA_TRUE = success, @c EINA_FALSE = error) + * + * @note The icon image set by this function can be changed by + * elm_toolbar_item_icon_set(). + * + * @ingroup Toolbar + */ +EAPI Eina_Bool elm_toolbar_item_icon_memfile_set(Elm_Object_Item *it, const void *img, size_t size, const char *format, const char *key); + +/** + * Set the icon associated with @p item to an image in a binary buffer. + * + * @param it The toolbar item. + * @param file The file that contains the image + * @param key Optional key of @p img to pass to the image loader (eg. if @p img is an edje file) + * + * @return (@c EINA_TRUE = success, @c EINA_FALSE = error) + * + * @note The icon image set by this function can be changed by + * elm_toolbar_item_icon_set(). + * + * @ingroup Toolbar + */ +EAPI Eina_Bool elm_toolbar_item_icon_file_set(Elm_Object_Item *it, const char *file, const char *key); + +/** + * Set or unset item as a separator. + * + * @param it The toolbar item. + * @param separator @c EINA_TRUE to set item @p item as separator or + * @c EINA_FALSE to unset, i.e., item will be used as a regular item. + * + * Items aren't set as separator by default. + * + * If set as separator it will display separator theme, so won't display + * icons or label. + * + * @see elm_toolbar_item_separator_get() + * + * @ingroup Toolbar + */ +EAPI void elm_toolbar_item_separator_set(Elm_Object_Item *it, Eina_Bool separator); + +/** + * Get a value whether item is a separator or not. + * + * @param it The toolbar item. + * @return @c EINA_TRUE means item @p it is a separator. @c EINA_FALSE + * indicates it's not. If @p it is @c NULL, @c EINA_FALSE is returned. + * + * @see elm_toolbar_item_separator_set() for details. + * + * @ingroup Toolbar + */ +EAPI Eina_Bool elm_toolbar_item_separator_get(const Elm_Object_Item *it); + +/** + * Set the shrink state of toolbar @p obj. + * + * @param obj The toolbar object. + * @param shrink_mode Toolbar's items display behavior. + * + * The toolbar won't scroll if #ELM_TOOLBAR_SHRINK_NONE, + * but will enforce a minimum size so all the items will fit, won't scroll + * and won't show the items that don't fit if #ELM_TOOLBAR_SHRINK_HIDE, + * will scroll if #ELM_TOOLBAR_SHRINK_SCROLL, and will create a button to + * pop up excess elements with #ELM_TOOLBAR_SHRINK_MENU. + * + * @ingroup Toolbar + */ +EAPI void elm_toolbar_shrink_mode_set(Evas_Object *obj, Elm_Toolbar_Shrink_Mode shrink_mode); + +/** + * Get the shrink mode of toolbar @p obj. + * + * @param obj The toolbar object. + * @return Toolbar's items display behavior. + * + * @see elm_toolbar_shrink_mode_set() for details. + * + * @ingroup Toolbar + */ +EAPI Elm_Toolbar_Shrink_Mode elm_toolbar_shrink_mode_get(const Evas_Object *obj); + +/** + * Enable/disable homogeneous mode. + * + * @param obj The toolbar object + * @param homogeneous Assume the items within the toolbar are of the + * same size (EINA_TRUE = on, EINA_FALSE = off). Default is @c EINA_FALSE. + * + * This will enable the homogeneous mode where items are of the same size. + * @see elm_toolbar_homogeneous_get() + * + * @ingroup Toolbar + */ +EAPI void elm_toolbar_homogeneous_set(Evas_Object *obj, Eina_Bool homogeneous); + +/** + * Get whether the homogeneous mode is enabled. + * + * @param obj The toolbar object. + * @return Assume the items within the toolbar are of the same height + * and width (EINA_TRUE = on, EINA_FALSE = off). + * + * @see elm_toolbar_homogeneous_set() + * + * @ingroup Toolbar + */ +EAPI Eina_Bool elm_toolbar_homogeneous_get(const Evas_Object *obj); + +/** + * Set the parent object of the toolbar items' menus. + * + * @param obj The toolbar object. + * @param parent The parent of the menu objects. + * + * Each item can be set as item menu, with elm_toolbar_item_menu_set(). + * + * For more details about setting the parent for toolbar menus, see + * elm_menu_parent_set(). + * + * @see elm_menu_parent_set() for details. + * @see elm_toolbar_item_menu_set() for details. + * + * @ingroup Toolbar + */ +EAPI void elm_toolbar_menu_parent_set(Evas_Object *obj, Evas_Object *parent); + +/** + * Get the parent object of the toolbar items' menus. + * + * @param obj The toolbar object. + * @return The parent of the menu objects. + * + * @see elm_toolbar_menu_parent_set() for details. + * + * @ingroup Toolbar + */ +EAPI Evas_Object *elm_toolbar_menu_parent_get(const Evas_Object *obj); + +/** + * Set the alignment of the items. + * + * @param obj The toolbar object. + * @param align The new alignment, a float between 0.0 + * and 1.0 . + * + * Alignment of toolbar items, from 0.0 to indicates to align + * left, to 1.0 , to align to right. 0.5 centralize + * items. + * + * Centered items by default. + * + * @see elm_toolbar_align_get() + * + * @ingroup Toolbar + */ +EAPI void elm_toolbar_align_set(Evas_Object *obj, double align); + +/** + * Get the alignment of the items. + * + * @param obj The toolbar object. + * @return toolbar items alignment, a float between 0.0 and + * 1.0 . + * + * @see elm_toolbar_align_set() for details. + * + * @ingroup Toolbar + */ +EAPI double elm_toolbar_align_get(const Evas_Object *obj); + +/** + * Set whether the toolbar item opens a menu. + * + * @param it The toolbar item. + * @param menu If @c EINA_TRUE, @p item will opens a menu when selected. + * + * A toolbar item can be set to be a menu, using this function. + * + * Once it is set to be a menu, it can be manipulated through the + * menu-like function elm_toolbar_menu_parent_set() and the other + * elm_menu functions, using the Evas_Object @c menu returned by + * elm_toolbar_item_menu_get(). + * + * So, items to be displayed in this item's menu should be added with + * elm_menu_item_add(). + * + * The following code exemplifies the most basic usage: + * @code + * tb = elm_toolbar_add(win) + * item = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL); + * elm_toolbar_item_menu_set(item, EINA_TRUE); + * elm_toolbar_menu_parent_set(tb, win); + * menu = elm_toolbar_item_menu_get(item); + * elm_menu_item_add(menu, NULL, "edit-cut", "Cut", NULL, NULL); + * menu_item = elm_menu_item_add(menu, NULL, "edit-copy", "Copy", NULL, + * NULL); + * @endcode + * + * @see elm_toolbar_item_menu_get() + * + * @ingroup Toolbar + */ +EAPI void elm_toolbar_item_menu_set(Elm_Object_Item *it, Eina_Bool menu); + +/** + * Get toolbar item's menu. + * + * @param it The toolbar item. + * @return Item's menu object or @c NULL on failure. + * + * If @p item wasn't set as menu item with elm_toolbar_item_menu_set(), + * this function will set it. + * + * @see elm_toolbar_item_menu_set() for details. + * + * @ingroup Toolbar + */ +EAPI Evas_Object *elm_toolbar_item_menu_get(const Elm_Object_Item *it); + +/** + * Add a new state to @p item. + * + * @param it The toolbar item. + * @param icon A string with icon name or the absolute path of an image file. + * @param label The label of the new state. + * @param func The function to call when the item is clicked when this + * state is selected. + * @param data The data to associate with the state. + * @return The toolbar item state, or @c NULL upon failure. + * + * Toolbar will load icon image from fdo or current theme. + * This behavior can be set by elm_toolbar_icon_order_lookup_set() function. + * If an absolute path is provided it will load it direct from a file. + * + * States created with this function can be removed with + * elm_toolbar_item_state_del(). + * + * @see elm_toolbar_item_state_del() + * @see elm_toolbar_item_state_sel() + * @see elm_toolbar_item_state_get() + * + * @ingroup Toolbar + */ +EAPI Elm_Toolbar_Item_State *elm_toolbar_item_state_add(Elm_Object_Item *it, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); + +/** + * Delete a previously added state to @p item. + * + * @param it The toolbar item. + * @param state The state to be deleted. + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure. + * + * @see elm_toolbar_item_state_add() + */ +EAPI Eina_Bool elm_toolbar_item_state_del(Elm_Object_Item *it, Elm_Toolbar_Item_State *state); + +/** + * Set @p state as the current state of @p it. + * + * @param it The toolbar item. + * @param state The state to use. + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure. + * + * If @p state is @c NULL, it won't select any state and the default item's + * icon and label will be used. It's the same behaviour than + * elm_toolbar_item_state_unset(). + * + * @see elm_toolbar_item_state_unset() + * + * @ingroup Toolbar + */ +EAPI Eina_Bool elm_toolbar_item_state_set(Elm_Object_Item *it, Elm_Toolbar_Item_State *state); + +/** + * Unset the state of @p it. + * + * @param it The toolbar item. + * + * The default icon and label from this item will be displayed. + * + * @see elm_toolbar_item_state_set() for more details. + * + * @ingroup Toolbar + */ +EAPI void elm_toolbar_item_state_unset(Elm_Object_Item *it); + +/** + * Get the current state of @p it. + * + * @param it The toolbar item. + * @return The selected state or @c NULL if none is selected or on failure. + * + * @see elm_toolbar_item_state_set() for details. + * @see elm_toolbar_item_state_unset() + * @see elm_toolbar_item_state_add() + * + * @ingroup Toolbar + */ +EAPI Elm_Toolbar_Item_State *elm_toolbar_item_state_get(const Elm_Object_Item *it); + +/** + * Get the state after selected state in toolbar's @p item. + * + * @param it The toolbar item to change state. + * @return The state after current state, or @c NULL on failure. + * + * If last state is selected, this function will return first state. + * + * @see elm_toolbar_item_state_set() + * @see elm_toolbar_item_state_add() + * + * @ingroup Toolbar + */ +EAPI Elm_Toolbar_Item_State *elm_toolbar_item_state_next(Elm_Object_Item *it); + +/** + * Get the state before selected state in toolbar's @p item. + * + * @param it The toolbar item to change state. + * @return The state before current state, or @c NULL on failure. + * + * If first state is selected, this function will return last state. + * + * @see elm_toolbar_item_state_set() + * @see elm_toolbar_item_state_add() + * + * @ingroup Toolbar + */ +EAPI Elm_Toolbar_Item_State *elm_toolbar_item_state_prev(Elm_Object_Item *it); + + +/** + * Change a toolbar's orientation + * @param obj The toolbar object + * @param horizontal If @c EINA_TRUE, the toolbar is horizontal + * By default, a toolbar will be horizontal. Use this function to create a vertical toolbar. + * @ingroup Toolbar + */ +EAPI void elm_toolbar_horizontal_set(Evas_Object *obj, Eina_Bool horizontal); + +/** + * Get a toolbar's orientation + * @param obj The toolbar object + * @return If @c EINA_TRUE, the toolbar is horizontal + * By default, a toolbar will be horizontal. Use this function to determine whether a toolbar is vertical. + * @ingroup Toolbar + */ +EAPI Eina_Bool elm_toolbar_horizontal_get(const Evas_Object *obj); + +/** + * Get the number of items in a toolbar + * @param obj The toolbar object + * @return The number of items in @p obj toolbar + * @ingroup Toolbar + */ +EAPI unsigned int elm_toolbar_items_count(const Evas_Object *obj); + +/** + * Set the toolbar select mode. + * + * @param obj The toolbar object + * @param mode The select mode + * + * elm_toolbar_select_mode_set() changes item select mode in the toolbar widget. + * - ELM_OBJECT_SELECT_MODE_DEFAULT : Items will only call their selection func and + * callback when first becoming selected. Any further clicks will + * do nothing, unless you set always select mode. + * - ELM_OBJECT_SELECT_MODE_ALWAYS : This means that, even if selected, + * every click will make the selected callbacks be called. + * - ELM_OBJECT_SELECT_MODE_NONE : This will turn off the ability to select items + * entirely and they will neither appear selected nor call selected + * callback functions. + * + * @see elm_toolbar_select_mode_get() + * + * @ingroup Toolbar + */ +EAPI void +elm_toolbar_select_mode_set(Evas_Object *obj, Elm_Object_Select_Mode mode); + +/** + * Get the toolbar select mode. + * + * @param obj The toolbar object + * @return The select mode + * (If getting mode is failed, it returns ELM_OBJECT_SELECT_MODE_MAX) + * + * @see elm_toolbar_select_mode_set() + * + * @ingroup Toolbar + */ +EAPI Elm_Object_Select_Mode +elm_toolbar_select_mode_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_tooltip.h b/libraries/elementary/src/lib/elm_tooltip.h new file mode 100644 index 0000000..3daf1c7 --- /dev/null +++ b/libraries/elementary/src/lib/elm_tooltip.h @@ -0,0 +1,100 @@ +/** + * @defgroup Tooltips Tooltips + * @ingroup Elementary + * + * The Tooltip is an (internal, for now) smart object used to show a + * content in a frame on mouse hover of objects(or widgets), with + * tips/information about them. + * + * @{ + */ + +/** + * Called back when a widget's tooltip is activated and needs content. + * @param data user-data given to elm_object_tooltip_content_cb_set() + * @param obj owner widget. + * @param tooltip The tooltip object (affix content to this!) + */ +typedef Evas_Object *(*Elm_Tooltip_Content_Cb)(void *data, Evas_Object *obj, Evas_Object *tooltip); + +/** + * Called back when a widget's item tooltip is activated and needs content. + * @param data user-data given to elm_object_tooltip_content_cb_set() + * @param obj owner widget. + * @param tooltip The tooltip object (affix content to this!) + * @param item context dependent item. As an example, if tooltip was + * set on elm_list item, then it is of this type. + */ +typedef Evas_Object *(*Elm_Tooltip_Item_Content_Cb)(void *data, Evas_Object *obj, Evas_Object *tooltip, void *item); + +EAPI void elm_object_tooltip_show(Evas_Object *obj); +EAPI void elm_object_tooltip_hide(Evas_Object *obj); + +/** + * Set the text to be displayed inside the tooltip. + * + * @param obj The tooltip object. + * @param text The text to be displayed. + * + * @ingroup Tooltips + */ +EAPI void elm_object_tooltip_text_set(Evas_Object *obj, const char *text); +EAPI void elm_object_tooltip_domain_translatable_text_set(Evas_Object *obj, const char *domain, const char *text); +#define elm_object_tooltip_translatable_text_set(obj, text) elm_object_tooltip_domain_translatable_text_set((obj), NULL, (text)) +EAPI void elm_object_tooltip_content_cb_set(Evas_Object *obj, Elm_Tooltip_Content_Cb func, const void *data, Evas_Smart_Cb del_cb); +EAPI void elm_object_tooltip_unset(Evas_Object *obj); + +/** + * Sets a different style for this object tooltip. + * + * @note before you set a style you should define a tooltip with + * elm_object_tooltip_content_cb_set() or + * elm_object_tooltip_text_set(). + * + * @param obj an object with tooltip already set. + * @param style the theme style to use (default, transparent, ...) + * + * @ingroup Tooltips + */ +EAPI void elm_object_tooltip_style_set(Evas_Object *obj, const char *style); + +/** + * Get the style for this object tooltip. + * + * @param obj an object with tooltip already set. + * @return style the theme style in use, defaults to "default". If the + * object does not have a tooltip set, then NULL is returned. + * + * @ingroup Tooltips + */ +EAPI const char *elm_object_tooltip_style_get(const Evas_Object *obj); + +/** + * @brief Disable size restrictions on an object's tooltip + * @param obj The tooltip's anchor object + * @param disable If EINA_TRUE, size restrictions are disabled + * @return EINA_FALSE on failure, EINA_TRUE on success + * + * This function allows a tooltip to expand beyond its parent window's canvas. + * It will instead be limited only by the size of the display. + * + * @ingroup Tooltips + */ +EAPI Eina_Bool elm_object_tooltip_window_mode_set(Evas_Object *obj, Eina_Bool disable); + +/** + * @brief Retrieve size restriction state of an object's tooltip + * @param obj The tooltip's anchor object + * @return If EINA_TRUE, size restrictions are disabled + * + * This function returns whether a tooltip is allowed to expand beyond + * its parent window's canvas. + * It will instead be limited only by the size of the display. + * + * @ingroup Tooltips + */ +EAPI Eina_Bool elm_object_tooltip_window_mode_get(const Evas_Object *obj); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_transit.c b/libraries/elementary/src/lib/elm_transit.c new file mode 100644 index 0000000..70c7d83 --- /dev/null +++ b/libraries/elementary/src/lib/elm_transit.c @@ -0,0 +1,2357 @@ +#include +#include "elm_priv.h" + +#define ELM_TRANSIT_CHECK_OR_RETURN(transit, ...) \ + do { \ + if (!transit) { \ + CRITICAL("Elm_Transit " # transit " is NULL!"); \ + return __VA_ARGS__; \ + } \ + if (!EINA_MAGIC_CHECK(transit, ELM_TRANSIT_MAGIC)) { \ + EINA_MAGIC_FAIL(transit, ELM_TRANSIT_MAGIC); \ + return __VA_ARGS__; \ + } \ + if (transit->deleted){ \ + ERR("Elm_Transit " # transit " has already been deleted!"); \ + return __VA_ARGS__; \ + } \ + } while (0) + + +#define _TRANSIT_FOCAL 2000 + +struct _Elm_Transit +{ +#define ELM_TRANSIT_MAGIC 0xd27f190a + EINA_MAGIC; + + Ecore_Animator *animator; + Eina_Inlist *effect_list; + Eina_List *objs; + Elm_Transit *prev_chain_transit; + Eina_List *next_chain_transits; + Elm_Transit_Tween_Mode tween_mode; + struct + { + Elm_Transit_Del_Cb func; + void *arg; + } del_data; + struct + { + double delayed; + double paused; + double duration; + double begin; + double current; + } time; + struct + { + int count; + int current; + Eina_Bool reverse; + } repeat; + double progress; + unsigned int effects_pending_del; + int walking; + Eina_Bool auto_reverse : 1; + Eina_Bool event_enabled : 1; + Eina_Bool deleted : 1; + Eina_Bool state_keep : 1; + Eina_Bool finished : 1; +}; + +struct _Elm_Transit_Effect_Module +{ + EINA_INLIST; + Elm_Transit_Effect_Transition_Cb transition_cb; + Elm_Transit_Effect_End_Cb end_cb; + Elm_Transit_Effect *effect; + Eina_Bool deleted : 1; +}; + +struct _Elm_Transit_Obj_State +{ + Evas_Coord x, y, w, h; + int r,g,b,a; + Evas_Map *map; + Eina_Bool map_enabled : 1; + Eina_Bool visible : 1; +}; + +struct _Elm_Transit_Obj_Data +{ + struct _Elm_Transit_Obj_State *state; + Eina_Bool freeze_events : 1; +}; + +typedef struct _Elm_Transit_Effect_Module Elm_Transit_Effect_Module; +typedef struct _Elm_Transit_Obj_Data Elm_Transit_Obj_Data; +typedef struct _Elm_Transit_Obj_State Elm_Transit_Obj_State; + +static void _transit_obj_data_update(Elm_Transit *transit, Evas_Object *obj); +static void _transit_obj_data_recover(Elm_Transit *transit, Evas_Object *obj); +static void _transit_obj_states_save(Evas_Object *obj, Elm_Transit_Obj_Data *obj_data); +static void _transit_obj_remove_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__); +static void _transit_obj_remove(Elm_Transit *transit, Evas_Object *obj); +static void _transit_effect_del(Elm_Transit *transit, Elm_Transit_Effect_Module *effect_module); +static void _transit_remove_dead_effects(Elm_Transit *transit); +static void _transit_chain_go(Elm_Transit *transit); +static void _transit_del(Elm_Transit *transit); +static Eina_Bool _transit_animate_op(Elm_Transit *transit, double progress); +static Eina_Bool _transit_animate_cb(void *data); + +static char *_transit_key= "_elm_transit_key"; + +static void +_transit_obj_data_update(Elm_Transit *transit, Evas_Object *obj) +{ + Elm_Transit_Obj_Data *obj_data = evas_object_data_get(obj, _transit_key); + + if (!obj_data) + obj_data = ELM_NEW(Elm_Transit_Obj_Data); + + obj_data->freeze_events = evas_object_freeze_events_get(obj); + + if ((!transit->state_keep) && (obj_data->state)) + { + free(obj_data->state); + obj_data->state = NULL; + } + else + { + _transit_obj_states_save(obj, obj_data); + } + + evas_object_data_set(obj, _transit_key, obj_data); +} + +static void +_transit_obj_states_save(Evas_Object *obj, Elm_Transit_Obj_Data *obj_data) +{ + Elm_Transit_Obj_State *state = obj_data->state; + + if (!state) + state = calloc(1, sizeof(Elm_Transit_Obj_State)); + if (!state) return; + + evas_object_geometry_get(obj, &state->x, &state->y, &state->w, &state->h); + evas_object_color_get(obj, &state->r, &state->g, &state->b, &state->a); + state->visible = evas_object_visible_get(obj); + state->map_enabled = evas_object_map_enable_get(obj); + if (evas_object_map_get(obj)) + state->map = evas_map_dup(evas_object_map_get(obj)); + obj_data->state = state; +} + +static void +_remove_obj_from_list(Elm_Transit *transit, Evas_Object *obj) +{ + //Remove duplicated objects + //TODO: Need to consider about optimizing here + while (1) + { + if (!eina_list_data_find_list(transit->objs, obj)) + break; + transit->objs = eina_list_remove(transit->objs, obj); + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL, + _transit_obj_remove_cb, + transit); + } +} + +static void +_transit_obj_remove_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Elm_Transit *transit = data; + Elm_Transit_Obj_Data *obj_data = evas_object_data_get(obj, _transit_key); + if (obj_data) + { + if (obj_data->state) + free(obj_data->state); + free(obj_data); + } + _remove_obj_from_list(transit, obj); + if (!transit->objs) elm_transit_del(transit); +} + +static void +_transit_obj_data_recover(Elm_Transit *transit, Evas_Object *obj) +{ + Elm_Transit_Obj_Data *obj_data; + Elm_Transit_Obj_State *state; + + obj_data = evas_object_data_get(obj, _transit_key); + if (!obj_data) return; + evas_object_data_del(obj, _transit_key); + evas_object_freeze_events_set(obj, obj_data->freeze_events); + state = obj_data->state; + if (state) + { + //recover the states of the object. + if (!transit->state_keep) + { + evas_object_move(obj, state->x, state->y); + evas_object_resize(obj, state->w, state->h); + evas_object_color_set(obj, state->r, state->g, state->b, state->a); + if (state->visible) evas_object_show(obj); + else evas_object_hide(obj); + evas_object_map_enable_set(obj, state->map_enabled); + evas_object_map_set(obj, state->map); + } + free(state); + } + free(obj_data); +} + +static void +_transit_obj_remove(Elm_Transit *transit, Evas_Object *obj) +{ + _remove_obj_from_list(transit, obj); + _transit_obj_data_recover(transit, obj); +} + +static void +_transit_effect_del(Elm_Transit *transit, Elm_Transit_Effect_Module *effect_module) +{ + if (effect_module->end_cb) + effect_module->end_cb(effect_module->effect, transit); + free(effect_module); +} + +static void +_transit_remove_dead_effects(Elm_Transit *transit) +{ + Elm_Transit_Effect_Module *effect_module; + + EINA_INLIST_FOREACH(transit->effect_list, effect_module) + { + if (effect_module->deleted) + { + _transit_effect_del(transit, effect_module); + transit->effects_pending_del--; + if (!transit->effects_pending_del) return; + } + } +} + +static void +_transit_chain_go(Elm_Transit *transit) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit); + elm_transit_go(transit); + _transit_animate_cb(transit); +} + +static void +_transit_del(Elm_Transit *transit) +{ + Elm_Transit_Effect_Module *effect_module; + Elm_Transit *chain_transit; + Eina_List *elist, *elist_next; + + if (transit->animator) + ecore_animator_del(transit->animator); + + //remove effects + while (transit->effect_list) + { + effect_module = EINA_INLIST_CONTAINER_GET(transit->effect_list, Elm_Transit_Effect_Module); + transit->effect_list = eina_inlist_remove(transit->effect_list, transit->effect_list); + _transit_effect_del(transit, effect_module); + } + + //remove objects. + while (transit->objs) + _transit_obj_remove(transit, eina_list_data_get(transit->objs)); + + transit->deleted = EINA_TRUE; + + if (transit->del_data.func) + transit->del_data.func(transit->del_data.arg, transit); + + //cut off the chain transit relationship + EINA_LIST_FOREACH_SAFE(transit->next_chain_transits, elist, elist_next, chain_transit) + chain_transit->prev_chain_transit = NULL; + + if (transit->prev_chain_transit) + transit->prev_chain_transit->next_chain_transits = + eina_list_remove(transit->prev_chain_transit->next_chain_transits, transit); + + // run chain transits + if (transit->finished && transit->next_chain_transits) + { + EINA_LIST_FOREACH_SAFE(transit->next_chain_transits, elist, elist_next, chain_transit) + _transit_chain_go(chain_transit); + + } + + eina_list_free(transit->next_chain_transits); + + EINA_MAGIC_SET(transit, EINA_MAGIC_NONE); + free(transit); +} + +//If the transit is deleted then EINA_FALSE is retruned. +static Eina_Bool +_transit_animate_op(Elm_Transit *transit, double progress) +{ + Elm_Transit_Effect_Module *effect_module; + + transit->walking++; + EINA_INLIST_FOREACH(transit->effect_list, effect_module) + { + if (transit->deleted) break; + if (!effect_module->deleted) + effect_module->transition_cb(effect_module->effect, transit, progress); + } + transit->walking--; + + if (transit->walking) return EINA_TRUE; + + if (transit->deleted) + { + _transit_del(transit); + return EINA_FALSE; + } + + else if (transit->effects_pending_del) _transit_remove_dead_effects(transit); + + return EINA_TRUE; +} + +static Eina_Bool +_transit_animate_cb(void *data) +{ + Elm_Transit *transit = data; + double elapsed_time, duration; + + transit->time.current = ecore_loop_time_get(); + elapsed_time = transit->time.current - transit->time.begin; + duration = transit->time.duration + transit->time.delayed; + + if (elapsed_time > duration) + elapsed_time = duration; + + transit->progress = elapsed_time / duration; + switch (transit->tween_mode) + { + case ELM_TRANSIT_TWEEN_MODE_LINEAR: + transit->progress = ecore_animator_pos_map(transit->progress, + ECORE_POS_MAP_LINEAR, + 0, 0); + case ELM_TRANSIT_TWEEN_MODE_ACCELERATE: + transit->progress = ecore_animator_pos_map(transit->progress, + ECORE_POS_MAP_ACCELERATE, + 0, 0); + break; + case ELM_TRANSIT_TWEEN_MODE_DECELERATE: + transit->progress = ecore_animator_pos_map(transit->progress, + ECORE_POS_MAP_DECELERATE, + 0, 0); + break; + case ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL: + transit->progress = ecore_animator_pos_map(transit->progress, + ECORE_POS_MAP_SINUSOIDAL, + 0, 0); + break; + default: + break; + } + + /* Reverse? */ + if (transit->repeat.reverse) transit->progress = 1 - transit->progress; + + if (transit->time.duration > 0) + { + if (!_transit_animate_op(transit, transit->progress)) + return ECORE_CALLBACK_CANCEL; + } + + /* Not end. Keep going. */ + if (elapsed_time < duration) return ECORE_CALLBACK_RENEW; + + /* Repeat and reverse and time done! */ + if ((transit->repeat.count >= 0) && + (transit->repeat.current == transit->repeat.count) && + ((!transit->auto_reverse) || transit->repeat.reverse)) + { + transit->finished = EINA_TRUE; + elm_transit_del(transit); + return ECORE_CALLBACK_CANCEL; + } + + /* Repeat Case */ + if (!transit->auto_reverse || transit->repeat.reverse) + { + transit->repeat.current++; + transit->repeat.reverse = EINA_FALSE; + } + else transit->repeat.reverse = EINA_TRUE; + + transit->time.begin = ecore_loop_time_get(); + + return ECORE_CALLBACK_RENEW; +} + +static void +_recover_image_uv_by_y(Evas_Map *map, int iw, int ih) +{ + evas_map_point_image_uv_set(map, 0, iw, 0); + evas_map_point_image_uv_set(map, 1, 0, 0); + evas_map_point_image_uv_set(map, 2, 0, ih); + evas_map_point_image_uv_set(map, 3, iw, ih); +} + +static void +_recover_image_uv_by_x(Evas_Map *map, int iw, int ih) +{ + evas_map_point_image_uv_set(map, 0, 0, ih); + evas_map_point_image_uv_set(map, 1, iw, ih); + evas_map_point_image_uv_set(map, 2, iw, 0); + evas_map_point_image_uv_set(map, 3, 0, 0); +} + +static Eina_Bool +_recover_image_uv(Evas_Object *obj, Evas_Map *map, Eina_Bool revert, Eina_Bool by_x) +{ + //Since the map is not proper for all types of objects, + //Need to handle uvs only for image objects + int iw, ih; + const char *type = evas_object_type_get(obj); + if ((!type) || (strcmp(type, "image"))) return EINA_FALSE; + + evas_object_image_size_get(obj, &iw, &ih); + + if (revert) + { + if (by_x) + _recover_image_uv_by_x(map, iw, ih); + else + _recover_image_uv_by_y(map, iw, ih); + } + else + { + evas_map_point_image_uv_set(map, 0, 0, 0); + evas_map_point_image_uv_set(map, 1, iw, 0); + evas_map_point_image_uv_set(map, 2, iw, ih); + evas_map_point_image_uv_set(map, 3, 0, ih); + } + return EINA_TRUE; +} + +EAPI Elm_Transit * +elm_transit_add(void) +{ + Elm_Transit *transit = ELM_NEW(Elm_Transit); + if (!transit) + { + ERR("Failed to allocate a elm_transit object!"); + return NULL; + } + + EINA_MAGIC_SET(transit, ELM_TRANSIT_MAGIC); + + elm_transit_tween_mode_set(transit, ELM_TRANSIT_TWEEN_MODE_LINEAR); + + return transit; +} + +EAPI void +elm_transit_del(Elm_Transit *transit) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit); + + if (transit->walking) transit->deleted = EINA_TRUE; + else _transit_del(transit); +} + +EAPI void +elm_transit_effect_add(Elm_Transit *transit, Elm_Transit_Effect_Transition_Cb transition_cb, Elm_Transit_Effect *effect, Elm_Transit_Effect_End_Cb end_cb) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit); + EINA_SAFETY_ON_NULL_RETURN(transition_cb); + Elm_Transit_Effect_Module *effect_module; + + EINA_INLIST_FOREACH(transit->effect_list, effect_module) + if ((effect_module->transition_cb == transition_cb) && (effect_module->effect == effect)) + { + WRN("elm_transit does not allow to add the duplicated effect! : transit=%p", transit); + return; + } + + effect_module = ELM_NEW(Elm_Transit_Effect_Module); + if (!effect_module) + { + ERR("Failed to allocate a new effect!: transit=%p", transit); + return; + } + + effect_module->end_cb = end_cb; + effect_module->transition_cb = transition_cb; + effect_module->effect = effect; + + transit->effect_list = eina_inlist_append(transit->effect_list, (Eina_Inlist*) effect_module); +} + +EAPI void +elm_transit_effect_del(Elm_Transit *transit, Elm_Transit_Effect_Transition_Cb transition_cb, Elm_Transit_Effect *effect) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit); + EINA_SAFETY_ON_NULL_RETURN(transition_cb); + Elm_Transit_Effect_Module *effect_module; + + EINA_INLIST_FOREACH(transit->effect_list, effect_module) + { + if ((effect_module->transition_cb == transition_cb) && (effect_module->effect == effect)) + { + if (transit->walking) + { + effect_module->deleted = EINA_TRUE; + transit->effects_pending_del++; + } + else + { + _transit_effect_del(transit, effect_module); + if (!transit->effect_list) elm_transit_del(transit); + } + return; + } + } +} + +EAPI void +elm_transit_object_add(Elm_Transit *transit, Evas_Object *obj) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit); + EINA_SAFETY_ON_NULL_RETURN(obj); + + if (transit->animator) + { + if (!evas_object_data_get(obj, _transit_key)) + { + _transit_obj_data_update(transit, obj); + evas_object_freeze_events_set(obj, EINA_TRUE); + } + } + + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, + _transit_obj_remove_cb, + transit); + + transit->objs = eina_list_append(transit->objs, obj); +} + +EAPI void +elm_transit_object_remove(Elm_Transit *transit, Evas_Object *obj) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit); + EINA_SAFETY_ON_NULL_RETURN(obj); + + _transit_obj_remove(transit, obj); + if (!transit->objs) elm_transit_del(transit); +} + +EAPI const Eina_List * +elm_transit_objects_get(const Elm_Transit *transit) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL); + return transit->objs; +} + +EAPI void +elm_transit_event_enabled_set(Elm_Transit *transit, Eina_Bool enabled) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit); + + Eina_List *list; + Evas_Object *obj; + + if (transit->event_enabled == enabled) return; + transit->event_enabled = !!enabled; + if (!transit->animator) return; + + EINA_LIST_FOREACH(transit->objs, list, obj) + evas_object_freeze_events_set(obj, enabled); +} + +EAPI Eina_Bool +elm_transit_event_enabled_get(const Elm_Transit *transit) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit, EINA_FALSE); + return transit->event_enabled; +} + +EAPI void +elm_transit_del_cb_set(Elm_Transit *transit, void (*cb) (void *data, Elm_Transit *transit), void *data) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit); + transit->del_data.func = cb; + transit->del_data.arg = data; +} + +EAPI void +elm_transit_auto_reverse_set(Elm_Transit *transit, Eina_Bool reverse) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit); + transit->auto_reverse = reverse; +} + +EAPI Eina_Bool +elm_transit_auto_reverse_get(const Elm_Transit *transit) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit, EINA_FALSE); + return transit->auto_reverse; +} + +EAPI void +elm_transit_repeat_times_set(Elm_Transit *transit, int repeat) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit); + transit->repeat.count = repeat; + transit->repeat.current = 0; +} + +EAPI int +elm_transit_repeat_times_get(const Elm_Transit *transit) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit, 0); + return transit->repeat.count; +} + +EAPI void +elm_transit_tween_mode_set(Elm_Transit *transit, Elm_Transit_Tween_Mode tween_mode) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit); + transit->tween_mode = tween_mode; +} + +EAPI Elm_Transit_Tween_Mode +elm_transit_tween_mode_get(const Elm_Transit *transit) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit, ELM_TRANSIT_TWEEN_MODE_LINEAR); + return transit->tween_mode; +} + +EAPI void +elm_transit_duration_set(Elm_Transit *transit, double duration) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit); + if (transit->animator) + { + WRN("elm_transit does not allow to set the duration time in operating! : transit=%p", transit); + return; + } + transit->time.duration = duration; +} + +EAPI double +elm_transit_duration_get(const Elm_Transit *transit) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit, 0.0); + return transit->time.duration; +} + +EAPI void +elm_transit_go(Elm_Transit *transit) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit); + + Eina_List *elist; + Evas_Object *obj; + + if (transit->animator) + ecore_animator_del(transit->animator); + + EINA_LIST_FOREACH(transit->objs, elist, obj) + _transit_obj_data_update(transit, obj); + + if (!transit->event_enabled) + { + EINA_LIST_FOREACH(transit->objs, elist, obj) + evas_object_freeze_events_set(obj, EINA_TRUE); + } + + transit->time.paused = 0; + transit->time.delayed = 0; + transit->time.begin = ecore_loop_time_get(); + transit->animator = ecore_animator_add(_transit_animate_cb, transit); +} + +EAPI void +elm_transit_paused_set(Elm_Transit *transit, Eina_Bool paused) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit); + + if (!transit->animator) return; + + if (paused) + { + if (transit->time.paused > 0) + return; + ecore_animator_freeze(transit->animator); + transit->time.paused = ecore_loop_time_get(); + } + else + { + if (transit->time.paused == 0) + return; + ecore_animator_thaw(transit->animator); + transit->time.delayed += (ecore_loop_time_get() - transit->time.paused); + transit->time.paused = 0; + } +} + +EAPI Eina_Bool +elm_transit_paused_get(const Elm_Transit *transit) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit, EINA_FALSE); + + if (transit->time.paused == 0) + return EINA_FALSE; + + return EINA_TRUE; +} + +EAPI double +elm_transit_progress_value_get(const Elm_Transit *transit) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit, 0); + + return transit->progress; +} + +EAPI void +elm_transit_objects_final_state_keep_set(Elm_Transit *transit, Eina_Bool state_keep) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit); + + if (transit->state_keep == state_keep) return; + if (transit->animator) + { + WRN("elm_transit does not allow to change final state keep mode in operating! : transit=%p", transit); + return; + } + transit->state_keep = !!state_keep; +} + +EAPI Eina_Bool +elm_transit_objects_final_state_keep_get(const Elm_Transit *transit) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit, EINA_FALSE); + return transit->state_keep; +} + +EAPI void +elm_transit_chain_transit_add(Elm_Transit *transit, Elm_Transit *chain_transit) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit); + ELM_TRANSIT_CHECK_OR_RETURN(chain_transit); + + if (transit == chain_transit) + { + WRN("You add a same transit as a chain transit! : transit=%p, chain_transit=%p", transit, chain_transit); + return; + } + if (transit == chain_transit->prev_chain_transit) + return; + + if (chain_transit->prev_chain_transit) + chain_transit->prev_chain_transit->next_chain_transits = eina_list_remove(chain_transit->prev_chain_transit->next_chain_transits, chain_transit); + + chain_transit->prev_chain_transit = transit; + transit->next_chain_transits = eina_list_append(transit->next_chain_transits, chain_transit); +} + +EAPI void +elm_transit_chain_transit_del(Elm_Transit *transit, Elm_Transit *chain_transit) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit); + ELM_TRANSIT_CHECK_OR_RETURN(chain_transit); + + if (chain_transit->prev_chain_transit != transit) + { + WRN("A pair of transits does not have the chain relationship! : transit=%p, chain_transit=%p", transit, chain_transit); + return; + } + + chain_transit->prev_chain_transit = NULL; + transit->next_chain_transits = eina_list_remove(transit->next_chain_transits, chain_transit); +} + +EAPI Eina_List * +elm_transit_chain_transits_get(const Elm_Transit * transit) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL); + return transit->next_chain_transits; +} + +/////////////////////////////////////////////////////////////////////////// +//Resizing Effect +/////////////////////////////////////////////////////////////////////////// +typedef struct _Elm_Transit_Effect_Resizing Elm_Transit_Effect_Resizing; + +struct _Elm_Transit_Effect_Resizing +{ + struct _size { + Evas_Coord w, h; + } from, to; +}; + +static void +_transit_effect_resizing_context_free(Elm_Transit_Effect *effect, Elm_Transit *transit __UNUSED__) +{ + Elm_Transit_Effect_Resizing *resizing = effect; + free(resizing); +} + +static void +_transit_effect_resizing_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress) +{ + EINA_SAFETY_ON_NULL_RETURN(effect); + EINA_SAFETY_ON_NULL_RETURN(transit); + Evas_Coord w, h; + Evas_Object *obj; + Eina_List *elist; + Elm_Transit_Effect_Resizing *resizing = effect; + + w = resizing->from.w + (resizing->to.w * progress); + h = resizing->from.h + (resizing->to.h * progress); + + EINA_LIST_FOREACH(transit->objs, elist, obj) + evas_object_resize(obj, w, h); +} + +static Elm_Transit_Effect * +_transit_effect_resizing_context_new(Evas_Coord from_w, Evas_Coord from_h, Evas_Coord to_w, Evas_Coord to_h) +{ + Elm_Transit_Effect_Resizing *resizing; + + resizing = ELM_NEW(Elm_Transit_Effect_Resizing); + if (!resizing) return NULL; + + resizing->from.w = from_w; + resizing->from.h = from_h; + resizing->to.w = to_w - from_w; + resizing->to.h = to_h - from_h; + + return resizing; +} + +EAPI Elm_Transit_Effect * +elm_transit_effect_resizing_add(Elm_Transit *transit, Evas_Coord from_w, Evas_Coord from_h, Evas_Coord to_w, Evas_Coord to_h) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL); + Elm_Transit_Effect *effect = _transit_effect_resizing_context_new(from_w, from_h, to_w, to_h); + + if (!effect) + { + ERR("Failed to allocate resizing effect! : transit=%p", transit); + return NULL; + } + elm_transit_effect_add(transit, + _transit_effect_resizing_op, effect, + _transit_effect_resizing_context_free); + return effect; +} + +/////////////////////////////////////////////////////////////////////////// +//Translation Effect +/////////////////////////////////////////////////////////////////////////// +typedef struct _Elm_Transit_Effect_Translation Elm_Transit_Effect_Translation; +typedef struct _Elm_Transit_Effect_Translation_Node Elm_Transit_Effect_Translation_Node; + +struct _Elm_Transit_Effect_Translation_Node +{ + Evas_Object *obj; + Evas_Coord x, y; +}; + +struct _Elm_Transit_Effect_Translation +{ + struct _position_variation { + Evas_Coord dx, dy; + } from, to; + Eina_List *nodes; +}; + +static void +_translation_object_del_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Elm_Transit_Effect_Translation *translation = data; + Eina_List *elist; + Elm_Transit_Effect_Translation_Node *translation_node; + + EINA_LIST_FOREACH(translation->nodes, elist, translation_node) + { + if (translation_node->obj != obj) continue; + translation->nodes = eina_list_remove_list(translation->nodes, elist); + free(translation_node); + break; + } +} + +static Eina_List * +_translation_nodes_build(Elm_Transit *transit, Elm_Transit_Effect_Translation *translation) +{ + Elm_Transit_Effect_Translation_Node *translation_node; + const Eina_List *elist; + Evas_Object *obj; + Eina_List *data_list = NULL; + const Eina_List *objs = elm_transit_objects_get(transit); + + EINA_LIST_FOREACH(objs, elist, obj) + { + translation_node = ELM_NEW(Elm_Transit_Effect_Translation_Node); + if (!translation_node) + { + eina_list_free(data_list); + return NULL; + } + translation_node->obj = obj; + evas_object_geometry_get(obj, &(translation_node->x), + &(translation_node->y), NULL, NULL); + data_list = eina_list_append(data_list, translation_node); + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, + _translation_object_del_cb, translation); + } + return data_list; +} + +void +_transit_effect_translation_context_free(Elm_Transit_Effect *effect, Elm_Transit *transit __UNUSED__) +{ + EINA_SAFETY_ON_NULL_RETURN(effect); + Elm_Transit_Effect_Translation *translation = effect; + Eina_List *elist, *elist_next; + Elm_Transit_Effect_Translation_Node *translation_node; + + EINA_LIST_FOREACH_SAFE(translation->nodes, + elist, elist_next, translation_node) + { + evas_object_event_callback_del(translation_node->obj, + EVAS_CALLBACK_DEL, _translation_object_del_cb); + translation->nodes = eina_list_remove_list(translation->nodes, elist); + free(translation_node); + } + free(translation); +} + +void +_transit_effect_translation_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress __UNUSED__) +{ + EINA_SAFETY_ON_NULL_RETURN(effect); + EINA_SAFETY_ON_NULL_RETURN(transit); + Evas_Coord x, y; + Elm_Transit_Effect_Translation *translation = effect; + Elm_Transit_Effect_Translation_Node *translation_node; + Eina_List *elist; + + if (!translation->nodes) + translation->nodes = _translation_nodes_build(transit, translation); + + EINA_LIST_FOREACH(translation->nodes, elist, translation_node) + { + x = translation_node->x + translation->from.dx + + (translation->to.dx * progress); + y = translation_node->y + translation->from.dy + + (translation->to.dy * progress); + evas_object_move(translation_node->obj, x, y); + } +} + +static Elm_Transit_Effect * +_transit_effect_translation_context_new(Evas_Coord from_dx, Evas_Coord from_dy, Evas_Coord to_dx, Evas_Coord to_dy) +{ + Elm_Transit_Effect_Translation *translation; + + translation = ELM_NEW(Elm_Transit_Effect_Translation); + if (!translation) return NULL; + + translation->from.dx = from_dx; + translation->from.dy = from_dy; + translation->to.dx = to_dx - from_dx; + translation->to.dy = to_dy - from_dy; + + return translation; +} + +EAPI Elm_Transit_Effect * +elm_transit_effect_translation_add(Elm_Transit *transit, Evas_Coord from_dx, Evas_Coord from_dy, Evas_Coord to_dx, Evas_Coord to_dy) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL); + Elm_Transit_Effect *effect = _transit_effect_translation_context_new(from_dx, from_dy, to_dx, to_dy); + + if (!effect) + { + ERR("Failed to allocate translation effect! : transit=%p", transit); + return NULL; + } + elm_transit_effect_add(transit, + _transit_effect_translation_op, effect, + _transit_effect_translation_context_free); + return effect; +} + +/////////////////////////////////////////////////////////////////////////// +//Zoom Effect +/////////////////////////////////////////////////////////////////////////// +typedef struct _Elm_Transit_Effect_Zoom Elm_Transit_Effect_Zoom; + +struct _Elm_Transit_Effect_Zoom +{ + float from, to; +}; + +void +_transit_effect_zoom_context_free(Elm_Transit_Effect *effect, Elm_Transit *transit __UNUSED__) +{ + Elm_Transit_Effect_Zoom *zoom = effect; + free(zoom); +} + +static void +_transit_effect_zoom_op(Elm_Transit_Effect *effect, Elm_Transit *transit , double progress) +{ + EINA_SAFETY_ON_NULL_RETURN(effect); + EINA_SAFETY_ON_NULL_RETURN(transit); + Evas_Object *obj; + Eina_List *elist; + Elm_Transit_Effect_Zoom *zoom = effect; + Evas_Map *map; + Evas_Coord x, y, w, h; + + map = evas_map_new(4); + if (!map) return; + + EINA_LIST_FOREACH(transit->objs, elist, obj) + { + evas_object_geometry_get(obj, &x, &y, &w, &h); + evas_map_util_points_populate_from_object_full(map, obj, zoom->from + + (progress * zoom->to)); + _recover_image_uv(obj, map, EINA_FALSE, EINA_FALSE); + evas_map_util_3d_perspective(map, x + (w / 2), y + (h / 2), 0, + _TRANSIT_FOCAL); + evas_object_map_set(obj, map); + evas_object_map_enable_set(obj, EINA_TRUE); + } + evas_map_free(map); +} + +static Elm_Transit_Effect * +_transit_effect_zoom_context_new(float from_rate, float to_rate) +{ + Elm_Transit_Effect_Zoom *zoom; + + zoom = ELM_NEW(Elm_Transit_Effect_Zoom); + if (!zoom) return NULL; + + zoom->from = (_TRANSIT_FOCAL - (from_rate * _TRANSIT_FOCAL)) * (1 / from_rate); + zoom->to = ((_TRANSIT_FOCAL - (to_rate * _TRANSIT_FOCAL)) * (1 / to_rate)) - zoom->from; + + return zoom; +} + +EAPI Elm_Transit_Effect * +elm_transit_effect_zoom_add(Elm_Transit *transit, float from_rate, float to_rate) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL); + Elm_Transit_Effect *effect = _transit_effect_zoom_context_new(from_rate, to_rate); + + if (!effect) + { + ERR("Failed to allocate zoom effect! : transit=%p", transit); + return NULL; + } + elm_transit_effect_add(transit, + _transit_effect_zoom_op, effect, + _transit_effect_zoom_context_free); + return effect; +} + +/////////////////////////////////////////////////////////////////////////// +//Flip Effect +/////////////////////////////////////////////////////////////////////////// +typedef struct _Elm_Transit_Effect_Flip Elm_Transit_Effect_Flip; + +struct _Elm_Transit_Effect_Flip +{ + Elm_Transit_Effect_Flip_Axis axis; + Eina_Bool cw : 1; +}; + +static void +_transit_effect_flip_context_free(Elm_Transit_Effect *effect, Elm_Transit *transit) +{ + EINA_SAFETY_ON_NULL_RETURN(effect); + EINA_SAFETY_ON_NULL_RETURN(transit); + Elm_Transit_Effect_Flip *flip = effect; + Evas_Object *front, *back; + int i; + int count = eina_list_count(transit->objs); + + for (i = 0; i < (count - 1); i += 2) + { + front = eina_list_nth(transit->objs, i); + back = eina_list_nth(transit->objs, i+1); + evas_object_map_enable_set(front, EINA_FALSE); + evas_object_map_enable_set(back, EINA_FALSE); + } + free(flip); +} + +static void +_transit_effect_flip_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress) +{ + EINA_SAFETY_ON_NULL_RETURN(effect); + EINA_SAFETY_ON_NULL_RETURN(transit); + Evas_Object *obj, *front, *back; + int count, i; + Elm_Transit_Effect_Flip *flip = effect; + Evas_Map *map; + float degree; + Evas_Coord x, y, w, h; + + map = evas_map_new(4); + if (!map) return; + + if (flip->cw) degree = (float)(progress * 180); + else degree = (float)(progress * -180); + + count = eina_list_count(transit->objs); + + for (i = 0; i < (count - 1); i += 2) + { + Evas_Coord half_w, half_h; + + front = eina_list_nth(transit->objs, i); + back = eina_list_nth(transit->objs, i+1); + + if ((degree < 90) && (degree > -90)) + { + obj = front; + if (front != back) + { + evas_object_hide(back); + evas_object_show(front); + } + } + else + { + obj = back; + if (front != back) + { + evas_object_hide(front); + evas_object_show(back); + } + } + + evas_map_util_points_populate_from_object_full(map, obj, 0); + evas_object_geometry_get(obj, &x, &y, &w, &h); + half_w = (w / 2); + half_h = (h / 2); + + if (flip->axis == ELM_TRANSIT_EFFECT_FLIP_AXIS_Y) + { + if ((degree >= 90) || (degree <= -90)) + { + if (!_recover_image_uv(obj, map, EINA_TRUE, EINA_FALSE)) + { + evas_map_point_image_uv_set(map, 0, w, 0); + evas_map_point_image_uv_set(map, 1, 0, 0); + evas_map_point_image_uv_set(map, 2, 0, h); + evas_map_point_image_uv_set(map, 3, w, h); + } + } + else + _recover_image_uv(obj, map, EINA_FALSE, EINA_FALSE); + evas_map_util_3d_rotate(map, 0, degree, + 0, x + half_w, y + half_h, 0); + } + else + { + if ((degree >= 90) || (degree <= -90)) + { + if (!_recover_image_uv(obj, map, EINA_TRUE, EINA_TRUE)) + { + evas_map_point_image_uv_set(map, 0, 0, h); + evas_map_point_image_uv_set(map, 1, w, h); + evas_map_point_image_uv_set(map, 2, w, 0); + evas_map_point_image_uv_set(map, 3, 0, 0); + } + } + else + _recover_image_uv(obj, map, EINA_FALSE, EINA_FALSE); + evas_map_util_3d_rotate(map, degree, + 0, 0, x + half_w, y + half_h, 0); + } + evas_map_util_3d_perspective(map, x + half_w, y + half_h, 0, _TRANSIT_FOCAL); + evas_object_map_enable_set(front, EINA_TRUE); + evas_object_map_enable_set(back, EINA_TRUE); + evas_object_map_set(obj, map); + } + evas_map_free(map); +} + +static Elm_Transit_Effect * +_transit_effect_flip_context_new(Elm_Transit_Effect_Flip_Axis axis, Eina_Bool cw) +{ + Elm_Transit_Effect_Flip *flip; + + flip = ELM_NEW(Elm_Transit_Effect_Flip); + if (!flip) return NULL; + + flip->cw = cw; + flip->axis = axis; + + return flip; +} + +EAPI Elm_Transit_Effect * +elm_transit_effect_flip_add(Elm_Transit *transit, Elm_Transit_Effect_Flip_Axis axis, Eina_Bool cw) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL); + Elm_Transit_Effect *effect = _transit_effect_flip_context_new(axis, cw); + + if (!effect) + { + ERR("Failed to allocate flip effect! : transit=%p", transit); + return NULL; + } + elm_transit_effect_add(transit, + _transit_effect_flip_op, effect, + _transit_effect_flip_context_free); + return effect; +} + +/////////////////////////////////////////////////////////////////////////// +//ResizableFlip Effect +/////////////////////////////////////////////////////////////////////////// +typedef struct _Elm_Transit_Effect_Resizable_Flip Elm_Transit_Effect_ResizableFlip; +typedef struct _Elm_Transit_Effect_Resizable_Flip_Node Elm_Transit_Effect_ResizableFlip_Node; + +struct _Elm_Transit_Effect_Resizable_Flip_Node +{ + Evas_Object *front; + Evas_Object *back; + struct _vector2d { + float x, y; + } from_pos, from_size, to_pos, to_size; +}; + +struct _Elm_Transit_Effect_Resizable_Flip +{ + Eina_List *nodes; + Eina_Bool cw : 1; + Elm_Transit_Effect_Flip_Axis axis; +}; + +static void +_resizable_flip_object_del_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Elm_Transit_Effect_ResizableFlip *resizable_flip = data; + Eina_List *elist; + Elm_Transit_Effect_ResizableFlip_Node *resizable_flip_node; + + EINA_LIST_FOREACH(resizable_flip->nodes, elist, resizable_flip_node) + { + if (resizable_flip_node->front == obj) + evas_object_event_callback_del(resizable_flip_node->back, + EVAS_CALLBACK_DEL, _resizable_flip_object_del_cb); + else if (resizable_flip_node->back == obj) + evas_object_event_callback_del(resizable_flip_node->front, + EVAS_CALLBACK_DEL, _resizable_flip_object_del_cb); + else continue; + + resizable_flip->nodes = eina_list_remove_list(resizable_flip->nodes, + elist); + free(resizable_flip_node); + break; + } +} + +static Eina_List * +_resizable_flip_nodes_build(Elm_Transit *transit, Elm_Transit_Effect_ResizableFlip *resizable_flip) +{ + Elm_Transit_Effect_ResizableFlip_Node *resizable_flip_node; + Eina_List *data_list = NULL; + Evas_Coord front_x, front_y, front_w, front_h; + Evas_Coord back_x, back_y, back_w, back_h; + int i, count; + + count = eina_list_count(transit->objs); + for (i = 0; i < (count - 1); i += 2) + { + resizable_flip_node = ELM_NEW(Elm_Transit_Effect_ResizableFlip_Node); + if (!resizable_flip_node) + { + eina_list_free(data_list); + return NULL; + } + + resizable_flip_node->front = eina_list_nth(transit->objs, i); + resizable_flip_node->back = eina_list_nth(transit->objs, i+1); + + evas_object_geometry_get(resizable_flip_node->front, + &front_x, &front_y, &front_w, &front_h); + evas_object_geometry_get(resizable_flip_node->back, + &back_x, &back_y, &back_w, &back_h); + + resizable_flip_node->from_pos.x = front_x; + resizable_flip_node->from_pos.y = front_y; + resizable_flip_node->to_pos.x = back_x - front_x; + resizable_flip_node->to_pos.y = back_y - front_y; + + resizable_flip_node->from_size.x = front_w; + resizable_flip_node->from_size.y = front_h; + resizable_flip_node->to_size.x = back_w - front_w; + resizable_flip_node->to_size.y = back_h - front_h; + + data_list = eina_list_append(data_list, resizable_flip_node); + + evas_object_event_callback_add(resizable_flip_node->back, + EVAS_CALLBACK_DEL, _resizable_flip_object_del_cb, resizable_flip); + evas_object_event_callback_add(resizable_flip_node->front, + EVAS_CALLBACK_DEL, _resizable_flip_object_del_cb, resizable_flip); + } + + return data_list; +} + +static void +_set_image_uv_by_axis_y(Evas_Map *map, Elm_Transit_Effect_ResizableFlip_Node *flip, Eina_Bool revert) +{ + if (revert) + { + evas_map_point_image_uv_set(map, 0, + (flip->from_size.x * 2) + flip->to_size.x, + 0); + evas_map_point_image_uv_set(map, 1, 0, 0); + evas_map_point_image_uv_set(map, 2, 0, + (flip->from_size.y * 2) + flip->to_size.y); + evas_map_point_image_uv_set(map, 3, + (flip->from_size.x * 2) + flip->to_size.x, + (flip->from_size.y * 2) + flip->to_size.y); + } + else + { + evas_map_point_image_uv_set(map, 0, 0, 0); + evas_map_point_image_uv_set(map, 1, flip->from_size.x, 0); + evas_map_point_image_uv_set(map, 2, flip->from_size.x, + flip->from_size.y); + evas_map_point_image_uv_set(map, 3, 0, flip->from_size.y); + } +} + +static void +_set_image_uv_by_axis_x(Evas_Map *map, Elm_Transit_Effect_ResizableFlip_Node *flip, Eina_Bool revert) +{ + if (revert) + { + evas_map_point_image_uv_set(map, 0, 0, + (flip->from_size.y * 2) + flip->to_size.y); + evas_map_point_image_uv_set(map, 1, + (flip->from_size.x * 2) + flip->to_size.x, + (flip->from_size.y * 2) + flip->to_size.y); + evas_map_point_image_uv_set(map, 2, + (flip->from_size.x * 2) + flip->to_size.x, + 0); + evas_map_point_image_uv_set(map, 3, 0, 0); + } + else + { + evas_map_point_image_uv_set(map, 0, 0, 0); + evas_map_point_image_uv_set(map, 1, flip->from_size.x, 0); + evas_map_point_image_uv_set(map, 2, flip->from_size.x, + flip->from_size.y); + evas_map_point_image_uv_set(map, 3, 0, flip->from_size.y); + } +} + +void +_transit_effect_resizable_flip_context_free(Elm_Transit_Effect *effect, Elm_Transit *transit __UNUSED__) +{ + EINA_SAFETY_ON_NULL_RETURN(effect); + + Elm_Transit_Effect_ResizableFlip *resizable_flip = effect; + Eina_List *elist, *elist_next; + Elm_Transit_Effect_ResizableFlip_Node *resizable_flip_node; + + EINA_LIST_FOREACH_SAFE(resizable_flip->nodes, + elist, elist_next, resizable_flip_node) + { + evas_object_map_enable_set(resizable_flip_node->front, EINA_FALSE); + evas_object_map_enable_set(resizable_flip_node->back, EINA_FALSE); + + resizable_flip->nodes = eina_list_remove_list(resizable_flip->nodes, + elist); + + evas_object_event_callback_del(resizable_flip_node->back, + EVAS_CALLBACK_DEL, _resizable_flip_object_del_cb); + evas_object_event_callback_del(resizable_flip_node->front, + EVAS_CALLBACK_DEL, _resizable_flip_object_del_cb); + free(resizable_flip_node); + } + free(resizable_flip); +} + +void +_transit_effect_resizable_flip_op(Elm_Transit_Effect *effect, Elm_Transit *transit __UNUSED__, double progress) +{ + EINA_SAFETY_ON_NULL_RETURN(effect); + Evas_Map *map; + Evas_Object *obj; + float x, y, w, h; + float degree; + Evas_Coord half_w, half_h; + Elm_Transit_Effect_ResizableFlip *resizable_flip = effect; + Elm_Transit_Effect_ResizableFlip_Node *resizable_flip_node; + Eina_List *elist; + + map = evas_map_new(4); + if (!map) return; + + if (resizable_flip->cw) degree = (float)(progress * 180); + else degree = (float)(progress * -180); + + if (!resizable_flip->nodes) + resizable_flip->nodes = _resizable_flip_nodes_build(transit, + resizable_flip); + + EINA_LIST_FOREACH(resizable_flip->nodes, elist, resizable_flip_node) + { + if ((degree < 90) && (degree > -90)) + { + obj = resizable_flip_node->front; + if (resizable_flip_node->front != resizable_flip_node->back) + { + evas_object_hide(resizable_flip_node->back); + evas_object_show(resizable_flip_node->front); + } + } + else + { + obj = resizable_flip_node->back; + if (resizable_flip_node->front != resizable_flip_node->back) + { + evas_object_hide(resizable_flip_node->front); + evas_object_show(resizable_flip_node->back); + } + } + + x = resizable_flip_node->from_pos.x + + (resizable_flip_node->to_pos.x * progress); + y = resizable_flip_node->from_pos.y + + (resizable_flip_node->to_pos.y * progress); + w = resizable_flip_node->from_size.x + + (resizable_flip_node->to_size.x * progress); + h = resizable_flip_node->from_size.y + + (resizable_flip_node->to_size.y * progress); + evas_map_point_coord_set(map, 0, x, y, 0); + evas_map_point_coord_set(map, 1, x + w, y, 0); + evas_map_point_coord_set(map, 2, x + w, y + h, 0); + evas_map_point_coord_set(map, 3, x, y + h, 0); + + half_w = (Evas_Coord)(w / 2); + half_h = (Evas_Coord)(h / 2); + + if (resizable_flip->axis == ELM_TRANSIT_EFFECT_FLIP_AXIS_Y) + { + if ((degree >= 90) || (degree <= -90)) + { + if (!_recover_image_uv(obj, map, EINA_TRUE, EINA_FALSE)) + _set_image_uv_by_axis_y(map, resizable_flip_node, + EINA_TRUE); + } + else + { + if (!_recover_image_uv(obj, map, EINA_FALSE, EINA_FALSE)) + _set_image_uv_by_axis_y(map, resizable_flip_node, + EINA_FALSE); + } + evas_map_util_3d_rotate(map, 0, degree, + 0, x + half_w, y + half_h, 0); + } + else + { + if ((degree >= 90) || (degree <= -90)) + { + if (!_recover_image_uv(obj, map, EINA_TRUE, EINA_TRUE)) + _set_image_uv_by_axis_x(map, resizable_flip_node, + EINA_TRUE); + } + else + { + if (!_recover_image_uv(obj, map, EINA_FALSE, EINA_TRUE)) + _set_image_uv_by_axis_x(map, resizable_flip_node, + EINA_FALSE); + } + evas_map_util_3d_rotate(map, degree, 0, + 0, x + half_w, y + half_h, 0); + } + + evas_map_util_3d_perspective(map, x + half_w, y + half_h, 0, + _TRANSIT_FOCAL); + evas_object_map_enable_set(resizable_flip_node->front, EINA_TRUE); + evas_object_map_enable_set(resizable_flip_node->back, EINA_TRUE); + evas_object_map_set(obj, map); + } + evas_map_free(map); +} + +static Elm_Transit_Effect * +_transit_effect_resizable_flip_context_new(Elm_Transit_Effect_Flip_Axis axis, Eina_Bool cw) +{ + Elm_Transit_Effect_ResizableFlip *resizable_flip; + + resizable_flip = ELM_NEW(Elm_Transit_Effect_ResizableFlip); + if (!resizable_flip) return NULL; + + resizable_flip->cw = cw; + resizable_flip->axis = axis; + + return resizable_flip; +} + +EAPI Elm_Transit_Effect * +elm_transit_effect_resizable_flip_add(Elm_Transit *transit, Elm_Transit_Effect_Flip_Axis axis, Eina_Bool cw) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL); + Elm_Transit_Effect *effect = _transit_effect_resizable_flip_context_new(axis, cw); + + if (!effect) + { + ERR("Failed to allocate resizable_flip effect! : transit=%p", transit); + return NULL; + } + elm_transit_effect_add(transit, + _transit_effect_resizable_flip_op, effect, + _transit_effect_resizable_flip_context_free); + return effect; +} + +/////////////////////////////////////////////////////////////////////////// +//Wipe Effect +/////////////////////////////////////////////////////////////////////////// +typedef struct _Elm_Transit_Effect_Wipe Elm_Transit_Effect_Wipe; + +struct _Elm_Transit_Effect_Wipe +{ + Elm_Transit_Effect_Wipe_Type type; + Elm_Transit_Effect_Wipe_Dir dir; +}; + +static void +_elm_fx_wipe_hide(Evas_Map * map, Elm_Transit_Effect_Wipe_Dir dir, float x, float y, float w, float h, float progress) +{ + float w2, h2; + + switch (dir) + { + case ELM_TRANSIT_EFFECT_WIPE_DIR_LEFT: + w2 = w - (w * progress); + h2 = (y + h); + evas_map_point_image_uv_set(map, 0, 0, 0); + evas_map_point_image_uv_set(map, 1, w2, 0); + evas_map_point_image_uv_set(map, 2, w2, h); + evas_map_point_image_uv_set(map, 3, 0, h); + evas_map_point_coord_set(map, 0, x, y, 0); + evas_map_point_coord_set(map, 1, x + w2, y, 0); + evas_map_point_coord_set(map, 2, x + w2, h2, 0); + evas_map_point_coord_set(map, 3, x, h2, 0); + break; + case ELM_TRANSIT_EFFECT_WIPE_DIR_RIGHT: + w2 = (w * progress); + h2 = (y + h); + evas_map_point_image_uv_set(map, 0, w2, 0); + evas_map_point_image_uv_set(map, 1, w, 0); + evas_map_point_image_uv_set(map, 2, w, h); + evas_map_point_image_uv_set(map, 3, w2, h); + evas_map_point_coord_set(map, 0, x + w2, y, 0); + evas_map_point_coord_set(map, 1, x + w, y, 0); + evas_map_point_coord_set(map, 2, x + w, h2, 0); + evas_map_point_coord_set(map, 3, x + w2, h2, 0); + break; + case ELM_TRANSIT_EFFECT_WIPE_DIR_UP: + w2 = (x + w); + h2 = h - (h * progress); + evas_map_point_image_uv_set(map, 0, 0, 0); + evas_map_point_image_uv_set(map, 1, w, 0); + evas_map_point_image_uv_set(map, 2, w, h2); + evas_map_point_image_uv_set(map, 3, 0, h2); + evas_map_point_coord_set(map, 0, x, y, 0); + evas_map_point_coord_set(map, 1, w2, y, 0); + evas_map_point_coord_set(map, 2, w2, y+h2, 0); + evas_map_point_coord_set(map, 3, x, y+h2, 0); + break; + case ELM_TRANSIT_EFFECT_WIPE_DIR_DOWN: + w2 = (x + w); + h2 = (h * progress); + evas_map_point_image_uv_set(map, 0, 0, h2); + evas_map_point_image_uv_set(map, 1, w, h2); + evas_map_point_image_uv_set(map, 2, w, h); + evas_map_point_image_uv_set(map, 3, 0, h); + evas_map_point_coord_set(map, 0, x, y + h2, 0); + evas_map_point_coord_set(map, 1, w2, y + h2, 0); + evas_map_point_coord_set(map, 2, w2, y + h, 0); + evas_map_point_coord_set(map, 3, x, y + h, 0); + break; + default: + break; + } + evas_map_util_3d_perspective(map, x + (w / 2), y + (h / 2), 0, _TRANSIT_FOCAL); +} + +static void +_elm_fx_wipe_show(Evas_Map *map, Elm_Transit_Effect_Wipe_Dir dir, float x, float y, float w, float h, float progress) +{ + float w2, h2; + + switch (dir) + { + case ELM_TRANSIT_EFFECT_WIPE_DIR_LEFT: + w2 = (w - (w * progress)); + h2 = (y + h); + evas_map_point_image_uv_set(map, 0, w2, 0); + evas_map_point_image_uv_set(map, 1, w, 0); + evas_map_point_image_uv_set(map, 2, w, h); + evas_map_point_image_uv_set(map, 3, w2, h); + evas_map_point_coord_set(map, 0, x + w2, y, 0); + evas_map_point_coord_set(map, 1, w, y, 0); + evas_map_point_coord_set(map, 2, w, h2, 0); + evas_map_point_coord_set(map, 3, x + w2, h2, 0); + break; + case ELM_TRANSIT_EFFECT_WIPE_DIR_RIGHT: + w2 = (w * progress); + h2 = (y + h); + evas_map_point_image_uv_set(map, 0, 0, 0); + evas_map_point_image_uv_set(map, 1, w2, 0); + evas_map_point_image_uv_set(map, 2, w2, h); + evas_map_point_image_uv_set(map, 3, 0, h); + evas_map_point_coord_set(map, 0, x, y, 0); + evas_map_point_coord_set(map, 1, x + w2, y, 0); + evas_map_point_coord_set(map, 2, x + w2, h2, 0); + evas_map_point_coord_set(map, 3, x, h2, 0); + break; + case ELM_TRANSIT_EFFECT_WIPE_DIR_UP: + w2 = (x + w); + h2 = (h - (h * progress)); + evas_map_point_image_uv_set(map, 0, 0, h2); + evas_map_point_image_uv_set(map, 1, w, h2); + evas_map_point_image_uv_set(map, 2, w, h); + evas_map_point_image_uv_set(map, 3, 0, h); + evas_map_point_coord_set(map, 0, x, y + h2, 0); + evas_map_point_coord_set(map, 1, w2, y + h2, 0); + evas_map_point_coord_set(map, 2, w2, y + h, 0); + evas_map_point_coord_set(map, 3, x, y + h, 0); + break; + case ELM_TRANSIT_EFFECT_WIPE_DIR_DOWN: + w2 = (x + w); + h2 = (h * progress); + evas_map_point_image_uv_set(map, 0, 0, 0); + evas_map_point_image_uv_set(map, 1, w, 0); + evas_map_point_image_uv_set(map, 2, w, h2); + evas_map_point_image_uv_set(map, 3, 0, h2); + evas_map_point_coord_set(map, 0, x, y, 0); + evas_map_point_coord_set(map, 1, w2, y, 0); + evas_map_point_coord_set(map, 2, w2, y + h2, 0); + evas_map_point_coord_set(map, 3, x, y + h2, 0); + break; + default: + break; + } + evas_map_util_3d_perspective(map, x + (w / 2), y + (h / 2), 0, _TRANSIT_FOCAL); +} + +static void +_transit_effect_wipe_context_free(Elm_Transit_Effect *effect, Elm_Transit *transit) +{ + EINA_SAFETY_ON_NULL_RETURN(effect); + EINA_SAFETY_ON_NULL_RETURN(transit); + Eina_List *elist; + Evas_Object *obj; + Elm_Transit_Effect_Wipe *wipe = effect; + Eina_Bool reverse = elm_transit_auto_reverse_get(transit); + + EINA_LIST_FOREACH(transit->objs, elist, obj) + { + if ((wipe->type == ELM_TRANSIT_EFFECT_WIPE_TYPE_SHOW && !reverse) + || (wipe->type == ELM_TRANSIT_EFFECT_WIPE_TYPE_HIDE && reverse)) + evas_object_show(obj); + else evas_object_hide(obj); + evas_object_map_enable_set(obj, EINA_FALSE); + } + + free(wipe); +} + +static void +_transit_effect_wipe_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress) +{ + EINA_SAFETY_ON_NULL_RETURN(effect); + EINA_SAFETY_ON_NULL_RETURN(transit); + Elm_Transit_Effect_Wipe *wipe = effect; + Evas_Map *map; + Evas_Coord _x, _y, _w, _h; + Eina_List *elist; + Evas_Object *obj; + const char *type; + + map = evas_map_new(4); + if (!map) return; + + EINA_LIST_FOREACH(transit->objs, elist, obj) + { + type = evas_object_type_get(obj); + if ((!type) || (strcmp(type, "image"))) + evas_object_geometry_get(obj, &_x, &_y, &_w, &_h); + else + { + evas_object_image_size_get(obj, &_w, &_h); + _x = 0; + _y = 0; + } + if (wipe->type == ELM_TRANSIT_EFFECT_WIPE_TYPE_SHOW) + _elm_fx_wipe_show(map, wipe->dir, _x, _y, _w, _h, (float)progress); + else + _elm_fx_wipe_hide(map, wipe->dir, _x, _y, _w, _h, (float)progress); + + evas_object_map_enable_set(obj, EINA_TRUE); + evas_object_map_set(obj, map); + } + evas_map_free(map); +} + +static Elm_Transit_Effect * +_transit_effect_wipe_context_new(Elm_Transit_Effect_Wipe_Type type, Elm_Transit_Effect_Wipe_Dir dir) +{ + Elm_Transit_Effect_Wipe *wipe; + + wipe = ELM_NEW(Elm_Transit_Effect_Wipe); + if (!wipe) return NULL; + + wipe->type = type; + wipe->dir = dir; + + return wipe; +} + +EAPI void * +elm_transit_effect_wipe_add(Elm_Transit *transit, Elm_Transit_Effect_Wipe_Type type, Elm_Transit_Effect_Wipe_Dir dir) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL); + void *effect = _transit_effect_wipe_context_new(type, dir); + + if (!effect) + { + ERR("Failed to allocate wipe effect! : transit=%p", transit); + return NULL; + } + elm_transit_effect_add(transit, + _transit_effect_wipe_op, effect, + _transit_effect_wipe_context_free); + return effect; +} + +/////////////////////////////////////////////////////////////////////////// +//Color Effect +/////////////////////////////////////////////////////////////////////////// +typedef struct _Elm_Transit_Effect_Color Elm_Transit_Effect_Color; + +struct _Elm_Transit_Effect_Color +{ + struct _unsigned_color { + unsigned int r, g, b, a; + } from; + struct _signed_color { + int r, g, b, a; + } to; +}; + +static void +_transit_effect_color_context_free(Elm_Transit_Effect *effect, Elm_Transit *transit __UNUSED__) +{ + Elm_Transit_Effect_Color *color = effect; + free(color); +} + +static void +_transit_effect_color_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress) +{ + EINA_SAFETY_ON_NULL_RETURN(effect); + EINA_SAFETY_ON_NULL_RETURN(transit); + Elm_Transit_Effect_Color *color = effect; + Evas_Object *obj; + Eina_List *elist; + unsigned int r, g, b, a; + + r = (color->from.r + (int)((float)color->to.r * progress)); + g = (color->from.g + (int)((float)color->to.g * progress)); + b = (color->from.b + (int)((float)color->to.b * progress)); + a = (color->from.a + (int)((float)color->to.a * progress)); + + EINA_LIST_FOREACH(transit->objs, elist, obj) + evas_object_color_set(obj, r, g, b, a); +} + +static Elm_Transit_Effect * +_transit_effect_color_context_new(unsigned int from_r, unsigned int from_g, unsigned int from_b, unsigned int from_a, unsigned int to_r, unsigned int to_g, unsigned int to_b, unsigned int to_a) +{ + Elm_Transit_Effect_Color *color; + + color = ELM_NEW(Elm_Transit_Effect_Color); + if (!color) return NULL; + + color->from.r = from_r; + color->from.g = from_g; + color->from.b = from_b; + color->from.a = from_a; + color->to.r = to_r - from_r; + color->to.g = to_g - from_g; + color->to.b = to_b - from_b; + color->to.a = to_a - from_a; + + return color; +} + +EAPI Elm_Transit_Effect * +elm_transit_effect_color_add(Elm_Transit *transit, unsigned int from_r, unsigned int from_g, unsigned int from_b, unsigned int from_a, unsigned int to_r, unsigned int to_g, unsigned int to_b, unsigned int to_a) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL); + Elm_Transit_Effect *effect = _transit_effect_color_context_new(from_r, from_g, from_b, from_a, to_r, to_g, to_b, to_a); + + if (!effect) + { + ERR("Failed to allocate color effect! : transit=%p", transit); + return NULL; + } + elm_transit_effect_add(transit, + _transit_effect_color_op, effect, + _transit_effect_color_context_free); + return effect; +} + +/////////////////////////////////////////////////////////////////////////// +//Fade Effect +/////////////////////////////////////////////////////////////////////////// +typedef struct _Elm_Transit_Effect_Fade Elm_Transit_Effect_Fade; +typedef struct _Elm_Transit_Effect_Fade_Node Elm_Transit_Effect_Fade_Node; + +struct _Elm_Transit_Effect_Fade_Node +{ + Evas_Object *before; + Evas_Object *after; + struct _signed_color before_color, after_color; + int before_alpha; + int after_alpha; + Eina_Bool inversed : 1; +}; + +struct _Elm_Transit_Effect_Fade +{ + Eina_List *nodes; +}; + +static void +_fade_object_del_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Elm_Transit_Effect_Fade *fade = data; + Eina_List *elist; + Elm_Transit_Effect_Fade_Node *fade_node; + + EINA_LIST_FOREACH(fade->nodes, elist, fade_node) + { + if (fade_node->before == obj) + evas_object_event_callback_del(fade_node->after, + EVAS_CALLBACK_DEL, _fade_object_del_cb); + else if (fade_node->after == obj) + evas_object_event_callback_del(fade_node->before, + EVAS_CALLBACK_DEL, _fade_object_del_cb); + else continue; + + fade->nodes = eina_list_remove_list(fade->nodes, elist); + free(fade_node); + break; + } +} + +static Eina_List * +_fade_nodes_build(Elm_Transit *transit, Elm_Transit_Effect_Fade *fade_data) +{ + Elm_Transit_Effect_Fade_Node *fade; + Eina_List *data_list = NULL; + int i, count; + + count = eina_list_count(transit->objs); + for (i = 0; i < count; i += 2) + { + fade = ELM_NEW(Elm_Transit_Effect_Fade_Node); + if (!fade) + { + eina_list_free(data_list); + return NULL; + } + + fade->before = eina_list_nth(transit->objs, i); + fade->after = eina_list_nth(transit->objs, i+1); + + evas_object_color_get(fade->before, + &fade->before_color.r, &fade->before_color.g, + &fade->before_color.b, &fade->before_color.a); + evas_object_color_get(fade->after, + &fade->after_color.r, &fade->after_color.g, + &fade->after_color.b, &fade->after_color.a); + + fade->before_alpha = (255 - fade->before_color.a); + fade->after_alpha = (255 - fade->after_color.a); + + data_list = eina_list_append(data_list, fade); + + evas_object_event_callback_add(fade->before, + EVAS_CALLBACK_DEL, _fade_object_del_cb, fade_data); + evas_object_event_callback_add(fade->after, + EVAS_CALLBACK_DEL, _fade_object_del_cb, fade_data); + } + return data_list; +} + +static void +_transit_effect_fade_context_free(Elm_Transit_Effect *effect, Elm_Transit *transit __UNUSED__) +{ + EINA_SAFETY_ON_NULL_RETURN(effect); + Elm_Transit_Effect_Fade *fade = effect; + Elm_Transit_Effect_Fade_Node *fade_node; + Eina_List *elist, *elist_next; + + EINA_LIST_FOREACH_SAFE(fade->nodes, elist, elist_next, fade_node) + { + evas_object_color_set(fade_node->before, fade_node->before_color.r, + fade_node->before_color.g, + fade_node->before_color.b, + fade_node->before_color.a); + evas_object_color_set(fade_node->after, fade_node->after_color.r, + fade_node->after_color.g, + fade_node->after_color.b, + fade_node->after_color.a); + + fade->nodes = eina_list_remove_list(fade->nodes, elist); + evas_object_event_callback_del(fade_node->before, + EVAS_CALLBACK_DEL, _fade_object_del_cb); + evas_object_event_callback_del(fade_node->after, + EVAS_CALLBACK_DEL, _fade_object_del_cb); + free(fade_node); + } + + free(fade); +} + +static void +_transit_effect_fade_op(Elm_Transit_Effect *effect, Elm_Transit *transit __UNUSED__, double progress) +{ + EINA_SAFETY_ON_NULL_RETURN(effect); + Elm_Transit_Effect_Fade *fade = effect; + Eina_List *elist; + Elm_Transit_Effect_Fade_Node *fade_node; + float _progress; + + if (!fade->nodes) + fade->nodes = _fade_nodes_build(transit, fade); + + EINA_LIST_FOREACH(fade->nodes, elist, fade_node) + { + if (progress < 0.5) + { + if (!fade_node->inversed) + { + evas_object_hide(fade_node->after); + evas_object_show(fade_node->before); + fade_node->inversed = EINA_TRUE; + } + + _progress = (1 - (progress * 2)); + + evas_object_color_set(fade_node->before, + fade_node->before_color.r * _progress, + fade_node->before_color.g * _progress, + fade_node->before_color.b * _progress, + fade_node->before_color.a + + fade_node->before_alpha * (1 - _progress)); + } + else + { + if (fade_node->inversed) + { + evas_object_hide(fade_node->before); + evas_object_show(fade_node->after); + fade_node->inversed = EINA_FALSE; + } + + _progress = ((progress - 0.5) * 2); + + evas_object_color_set(fade_node->after, + fade_node->after_color.r * _progress, + fade_node->after_color.g * _progress, + fade_node->after_color.b * _progress, + fade_node->after_color.a + + fade_node->after_alpha * (1 - _progress)); + } + } +} + +static Elm_Transit_Effect * +_transit_effect_fade_context_new(void) +{ + Elm_Transit_Effect_Fade *fade; + fade = ELM_NEW(Elm_Transit_Effect_Fade); + if (!fade) return NULL; + return fade; +} + +EAPI Elm_Transit_Effect * +elm_transit_effect_fade_add(Elm_Transit *transit) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL); + + Elm_Transit_Effect *effect = _transit_effect_fade_context_new(); + + if (!effect) + { + ERR("Failed to allocate fade effect! : transit=%p", transit); + return NULL; + } + elm_transit_effect_add(transit, + _transit_effect_fade_op, effect, + _transit_effect_fade_context_free); + return effect; +} + +/////////////////////////////////////////////////////////////////////////// +//Blend Effect +/////////////////////////////////////////////////////////////////////////// +typedef struct _Elm_Transit_Effect_Blend Elm_Transit_Effect_Blend; +typedef struct _Elm_Transit_Effect_Blend_Node Elm_Transit_Effect_Blend_Node; + +struct _Elm_Transit_Effect_Blend_Node +{ + Evas_Object *before; + Evas_Object *after; + struct _signed_color from, to; +}; + +struct _Elm_Transit_Effect_Blend +{ + Eina_List *nodes; +}; + +static void +_blend_object_del_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Elm_Transit_Effect_Blend *blend = data; + Eina_List *elist; + Elm_Transit_Effect_Blend_Node *blend_node; + + EINA_LIST_FOREACH(blend->nodes, elist, blend_node) + { + if (blend_node->after == obj) + evas_object_event_callback_del(blend_node->before, + EVAS_CALLBACK_DEL, _blend_object_del_cb); + else if (blend_node->before == obj) + evas_object_event_callback_del(blend_node->after, + EVAS_CALLBACK_DEL, _blend_object_del_cb); + else continue; + + blend->nodes = eina_list_remove_list(blend->nodes, elist); + free(blend_node); + break; + } +} + +static Eina_List * +_blend_nodes_build(Elm_Transit *transit, Elm_Transit_Effect_Blend *blend) +{ + Elm_Transit_Effect_Blend_Node *blend_node; + Eina_List *data_list = NULL; + int i, count; + + count = eina_list_count(transit->objs); + for (i = 0; i < (count - 1); i += 2) + { + blend_node = ELM_NEW(Elm_Transit_Effect_Blend_Node); + if (!blend_node) + { + eina_list_free(data_list); + return NULL; + } + + blend_node->before = eina_list_nth(transit->objs, i); + blend_node->after = eina_list_nth(transit->objs, i + 1); + evas_object_show(blend_node->before); + evas_object_show(blend_node->after); + + evas_object_color_get(blend_node->before, &blend_node->from.r, + &blend_node->from.g, &blend_node->from.b, + &blend_node->from.a); + evas_object_color_get(blend_node->after, &blend_node->to.r, + &blend_node->to.g, &blend_node->to.b, + &blend_node->to.a); + + data_list = eina_list_append(data_list, blend_node); + + evas_object_event_callback_add(blend_node->before, + EVAS_CALLBACK_DEL, _blend_object_del_cb, blend); + evas_object_event_callback_add(blend_node->after, + EVAS_CALLBACK_DEL, _blend_object_del_cb, blend); + } + return data_list; +} + +void +_transit_effect_blend_context_free(Elm_Transit_Effect *effect, Elm_Transit *transit __UNUSED__) +{ + EINA_SAFETY_ON_NULL_RETURN(effect); + Elm_Transit_Effect_Blend *blend = effect; + Elm_Transit_Effect_Blend_Node *blend_node; + Eina_List *elist, *elist_next; + + EINA_LIST_FOREACH_SAFE(blend->nodes, elist, elist_next, blend_node) + { + evas_object_color_set(blend_node->before, + blend_node->from.r, blend_node->from.g, + blend_node->from.b, blend_node->from.a); + evas_object_color_set(blend_node->after, blend_node->to.r, + blend_node->to.g, blend_node->to.b, + blend_node->to.a); + + if (elm_transit_auto_reverse_get(transit)) + evas_object_hide(blend_node->after); + else + evas_object_hide(blend_node->before); + + blend->nodes = eina_list_remove_list(blend->nodes, elist); + + evas_object_event_callback_del(blend_node->before, + EVAS_CALLBACK_DEL, _blend_object_del_cb); + evas_object_event_callback_del(blend_node->after, + EVAS_CALLBACK_DEL, _blend_object_del_cb); + free(blend_node); + } + free(blend); +} + +void +_transit_effect_blend_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress) +{ + EINA_SAFETY_ON_NULL_RETURN(effect); + EINA_SAFETY_ON_NULL_RETURN(transit); + Elm_Transit_Effect_Blend *blend = effect; + Elm_Transit_Effect_Blend_Node *blend_node; + Eina_List *elist; + + if (!blend->nodes) blend->nodes = _blend_nodes_build(transit, blend); + + EINA_LIST_FOREACH(blend->nodes, elist, blend_node) + { + evas_object_color_set(blend_node->before, + (int)(blend_node->from.r * (1 - progress)), + (int)(blend_node->from.g * (1 - progress)), + (int)(blend_node->from.b * (1 - progress)), + (int)(blend_node->from.a * (1 - progress))); + evas_object_color_set(blend_node->after, + (int)(blend_node->to.r * progress), + (int)(blend_node->to.g * progress), + (int)(blend_node->to.b * progress), + (int)(blend_node->to.a * progress)); + } +} + +static Elm_Transit_Effect * +_transit_effect_blend_context_new(void) +{ + Elm_Transit_Effect_Blend *blend; + + blend = ELM_NEW(Elm_Transit_Effect_Blend); + if (!blend) return NULL; + return blend; +} + +EAPI Elm_Transit_Effect * +elm_transit_effect_blend_add(Elm_Transit *transit) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL); + Elm_Transit_Effect *effect = _transit_effect_blend_context_new(); + + if (!effect) + { + ERR("Failed to allocate blend effect! : transit=%p", transit); + return NULL; + } + elm_transit_effect_add(transit, + _transit_effect_blend_op, effect, + _transit_effect_blend_context_free); + return effect; +} + +/////////////////////////////////////////////////////////////////////////// +//Rotation Effect +/////////////////////////////////////////////////////////////////////////// +typedef struct _Elm_Transit_Effect_Rotation Elm_Transit_Effect_Rotation; + +struct _Elm_Transit_Effect_Rotation +{ + float from, to; +}; + +static void +_transit_effect_rotation_context_free(Elm_Transit_Effect *effect, Elm_Transit *transit __UNUSED__) +{ + Elm_Transit_Effect_Rotation *rotation = effect; + free(rotation); +} + +static void +_transit_effect_rotation_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress) +{ + EINA_SAFETY_ON_NULL_RETURN(effect); + EINA_SAFETY_ON_NULL_RETURN(transit); + Elm_Transit_Effect_Rotation *rotation = effect; + Evas_Map *map; + Evas_Coord x, y, w, h; + float degree; + float half_w, half_h; + Eina_List *elist; + Evas_Object *obj; + + map = evas_map_new(4); + if (!map) return; + + EINA_LIST_FOREACH(transit->objs, elist, obj) + { + evas_map_util_points_populate_from_object_full(map, obj, 0); + degree = rotation->from + (float)(progress * rotation->to); + + evas_object_geometry_get(obj, &x, &y, &w, &h); + + half_w = (float)w * 0.5; + half_h = (float)h * 0.5; + + evas_map_util_rotate(map, degree, x + half_w, y + half_h); + evas_map_util_3d_perspective(map, x + half_w, y + half_h, 0, _TRANSIT_FOCAL); + evas_object_map_enable_set(obj, EINA_TRUE); + evas_object_map_set(obj, map); + } + evas_map_free(map); +} + +static Elm_Transit_Effect * +_transit_effect_rotation_context_new(float from_degree, float to_degree) +{ + Elm_Transit_Effect_Rotation *rotation; + + rotation = ELM_NEW(Elm_Transit_Effect_Rotation); + if (!rotation) return NULL; + + rotation->from = from_degree; + rotation->to = to_degree - from_degree; + + return rotation; +} + +EAPI Elm_Transit_Effect * +elm_transit_effect_rotation_add(Elm_Transit *transit, float from_degree, float to_degree) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL); + Elm_Transit_Effect *effect = _transit_effect_rotation_context_new(from_degree, to_degree); + + if (!effect) + { + ERR("Failed to allocate rotation effect! : transit=%p", transit); + return NULL; + } + elm_transit_effect_add(transit, + _transit_effect_rotation_op, effect, + _transit_effect_rotation_context_free); + return effect; +} + +/////////////////////////////////////////////////////////////////////////// +//ImageAnimation Effect +/////////////////////////////////////////////////////////////////////////// +typedef struct _Elm_Transit_Effect_Image_Animation Elm_Transit_Effect_Image_Animation; + +struct _Elm_Transit_Effect_Image_Animation +{ + Eina_List *images; +}; + +static void +_transit_effect_image_animation_context_free(Elm_Transit_Effect *effect, Elm_Transit *transit __UNUSED__) +{ + EINA_SAFETY_ON_NULL_RETURN(effect); + Elm_Transit_Effect_Image_Animation *image_animation = effect; + const char *image; + Eina_List *elist, *elist_next; + + EINA_LIST_FOREACH_SAFE(image_animation->images, elist, elist_next, image) + { + image_animation->images = + eina_list_remove_list(image_animation->images, elist); + eina_stringshare_del(image); + } + + free(image_animation); +} + +static void +_transit_effect_image_animation_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress) +{ + EINA_SAFETY_ON_NULL_RETURN(effect); + EINA_SAFETY_ON_NULL_RETURN(transit); + Eina_List *elist; + Evas_Object *obj; + const char *type; + Elm_Transit_Effect_Image_Animation *image_animation = effect; + unsigned int count = 0; + int len; + + type = eina_stringshare_add("icon"); + len = eina_list_count(image_animation->images); + + if (!len) count = floor(progress * len); + else count = floor(progress * (len - 1)); + + EINA_LIST_FOREACH(transit->objs, elist, obj) + { + if (elm_widget_type_check(obj, type, __func__)) + elm_icon_file_set(obj, + eina_list_nth(image_animation->images, count), NULL); + } + + eina_stringshare_del(type); +} + +static Elm_Transit_Effect * +_transit_effect_image_animation_context_new(Eina_List *images) +{ + Elm_Transit_Effect_Image_Animation *image_animation; + image_animation = ELM_NEW(Elm_Transit_Effect_Image_Animation); + + if (!image_animation) return NULL; + image_animation->images = images; + return image_animation; +} + +EAPI Elm_Transit_Effect * +elm_transit_effect_image_animation_add(Elm_Transit *transit, Eina_List *images) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL); + Elm_Transit_Effect *effect = _transit_effect_image_animation_context_new(images); + + if (!effect) + { + ERR("Failed to allocate image_animation effect! : transit=%p", transit); + return NULL; + } + elm_transit_effect_add(transit, + _transit_effect_image_animation_op, effect, + _transit_effect_image_animation_context_free); + return effect; +} diff --git a/libraries/elementary/src/lib/elm_transit.h b/libraries/elementary/src/lib/elm_transit.h new file mode 100644 index 0000000..a167e9d --- /dev/null +++ b/libraries/elementary/src/lib/elm_transit.h @@ -0,0 +1,824 @@ +/** + * @defgroup Transit Transit + * @ingroup Elementary + * + * Transit is designed to apply various animated transition effects to @c + * Evas_Object, such like translation, rotation, etc. For using these + * effects, create an @ref Elm_Transit and add the desired transition effects. + * + * Once the effects are added into transit, they will be automatically + * managed (their callback will be called for the set duration and + * they will be deleted upon completion). + * + * Example: + * @code + * Elm_Transit *trans = elm_transit_add(); + * elm_transit_object_add(trans, obj); + * elm_transit_effect_translation_add(trans, 0, 0, 280, 280 + * elm_transit_duration_set(transit, 1); + * elm_transit_auto_reverse_set(transit, EINA_TRUE); + * elm_transit_tween_mode_set(transit, ELM_TRANSIT_TWEEN_MODE_DECELERATE); + * elm_transit_repeat_times_set(transit, 3); + * @endcode + * + * Some transition effects are used to change the properties of objects. They + * are: + * @li @ref elm_transit_effect_translation_add + * @li @ref elm_transit_effect_color_add + * @li @ref elm_transit_effect_rotation_add + * @li @ref elm_transit_effect_wipe_add + * @li @ref elm_transit_effect_zoom_add + * @li @ref elm_transit_effect_resizing_add + * + * Other transition effects are used to make one object disappear and another + * object appear on its place. These effects are: + * + * @li @ref elm_transit_effect_flip_add + * @li @ref elm_transit_effect_resizable_flip_add + * @li @ref elm_transit_effect_fade_add + * @li @ref elm_transit_effect_blend_add + * + * It's also possible to make a transition chain with @ref + * elm_transit_chain_transit_add. + * + * @warning We strongly recommend to use elm_transit just when edje can not do + * the trick. Edje is better at handling transitions than Elm_Transit. + * Edje has more flexibility and animations can be manipulated inside the theme. + * + * List of examples: + * @li @ref transit_example_01_explained + * @li @ref transit_example_02_explained + * @li @ref transit_example_03_c + * @li @ref transit_example_04_c + * + * @{ + */ + +/** + * @enum Elm_Transit_Tween_Mode + * + * The type of acceleration used in the transition. + */ +typedef enum +{ + ELM_TRANSIT_TWEEN_MODE_LINEAR, /**< Constant speed */ + ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL, /**< Starts slow, increase speed + over time, then decrease again + and stop slowly */ + ELM_TRANSIT_TWEEN_MODE_DECELERATE, /**< Starts fast and decrease + speed over time */ + ELM_TRANSIT_TWEEN_MODE_ACCELERATE /**< Starts slow and increase speed + over time */ +} Elm_Transit_Tween_Mode; + +/** + * @enum Elm_Transit_Effect_Flip_Axis + * + * The axis along which flip effect should be applied. + */ +typedef enum +{ + ELM_TRANSIT_EFFECT_FLIP_AXIS_X, /**< Flip on X axis */ + ELM_TRANSIT_EFFECT_FLIP_AXIS_Y /**< Flip on Y axis */ +} Elm_Transit_Effect_Flip_Axis; + +/** + * @enum Elm_Transit_Effect_Wipe_Dir + * + * The direction in which the wipe effect should occur. + */ +typedef enum +{ + ELM_TRANSIT_EFFECT_WIPE_DIR_LEFT, /**< Wipe to the left */ + ELM_TRANSIT_EFFECT_WIPE_DIR_RIGHT, /**< Wipe to the right */ + ELM_TRANSIT_EFFECT_WIPE_DIR_UP, /**< Wipe up */ + ELM_TRANSIT_EFFECT_WIPE_DIR_DOWN /**< Wipe down */ +} Elm_Transit_Effect_Wipe_Dir; + +/** @enum Elm_Transit_Effect_Wipe_Type + * + * Whether the wipe effect should show or hide the object. + */ +typedef enum +{ + ELM_TRANSIT_EFFECT_WIPE_TYPE_HIDE, /**< Hide the object during the + animation */ + ELM_TRANSIT_EFFECT_WIPE_TYPE_SHOW /**< Show the object during the + animation */ +} Elm_Transit_Effect_Wipe_Type; + +/** + * @typedef Elm_Transit + * + * The Transit created with elm_transit_add(). This type has the information + * about the objects which the transition will be applied, and the + * transition effects that will be used. It also contains info about + * duration, number of repetitions, auto-reverse, etc. + */ +typedef struct _Elm_Transit Elm_Transit; +typedef void Elm_Transit_Effect; + +/** + * @typedef Elm_Transit_Effect_Transition_Cb + * + * Transition callback called for this effect on each transition iteration. + */ +typedef void (*Elm_Transit_Effect_Transition_Cb)(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress); + +/** + * Elm_Transit_Effect_End_Cb + * + * Transition callback called for this effect when the transition is over. + */ +typedef void (*Elm_Transit_Effect_End_Cb)(Elm_Transit_Effect *effect, Elm_Transit *transit); + +/** + * Elm_Transit_Del_Cb + * + * A callback called when the transit is deleted. + */ +typedef void (*Elm_Transit_Del_Cb)(void *data, Elm_Transit *transit); + +/** + * Create new transit. + * + * @note It is not necessary to delete the transit object, it will be deleted at + * the end of its operation. + * @note The transit will start playing when the program enters the main loop. + * + * @return The transit object. + * + * @ingroup Transit + */ +EAPI Elm_Transit *elm_transit_add(void); + +/** + * Stops the animation and delete the @p transit object. + * + * Call this function if you want to stop the animation before the + * transit time. Make sure the @p transit object is still alive with + * elm_transit_del_cb_set() function. + * All added effects will be deleted, calling its respective data_free_cb + * functions. The function set by elm_transit_del_cb_set() will be called. + * + * @see elm_transit_del_cb_set() + * + * @param transit The transit object to be deleted. + * + * @ingroup Transit + */ +EAPI void elm_transit_del(Elm_Transit *transit); + +/** + * Add a new effect to the transit. + * + * @note The cb function and the data are the key to the effect. + * If you try to add an existing effect, nothing is done. + * @note After the first addition of an effect to @p transit, if its + * effect list become empty again, the @p transit will be killed by + * elm_transit_del(transit) function. + * + * Example: + * @code + * Elm_Transit *transit = elm_transit_add(); + * elm_transit_effect_add(transit, + * elm_transit_effect_blend_op, + * elm_transit_effect_blend_context_new(), + * elm_transit_effect_blend_context_free); + * @endcode + * + * @param transit The transit object. + * @param transition_cb The operation function. It is called when the + * animation begins, it is the function that actually performs the animation. + * It is called with the @p data, @p transit and the time progression of the + * animation (a double value between 0.0 and 1.0). + * @param effect The context data of the effect. + * @param end_cb The function to free the context data, it will be called + * at the end of the effect, it must finalize the animation and free the + * @p data. + * + * @ingroup Transit + * @warning The transit will free the context data at the and of the + * transition with the data_free_cb function. + * Do not share the context data in between different transit objects. + */ +EAPI void elm_transit_effect_add(Elm_Transit *transit, Elm_Transit_Effect_Transition_Cb transition_cb, Elm_Transit_Effect *effect, Elm_Transit_Effect_End_Cb end_cb); + +/** + * Delete an added effect. + * + * This function will remove the effect from the @p transit, calling the + * data_free_cb to free the @p data. + * + * @see elm_transit_effect_add() + * + * @note If the effect is not found, nothing is done. + * @note If the effect list become empty, this function will call + * elm_transit_del(transit), i.e., it will kill the @p transit. + * + * @param transit The transit object. + * @param transition_cb The operation function. + * @param effect The context data of the effect. + * + * @ingroup Transit + */ +EAPI void elm_transit_effect_del(Elm_Transit *transit, Elm_Transit_Effect_Transition_Cb transition_cb, Elm_Transit_Effect *effect); + +/** + * Add new object to apply the effects. + * + * @note After the first addition of an object to @p transit, if its + * object list become empty again, the @p transit will be killed by + * elm_transit_del(transit) function. + * @note If the @p obj belongs to another transit, the @p obj will be + * removed from it and it will only belong to the other @p transit. + * If the old transit stays without objects, it will die. + * @note When you add an object into the @p transit, its state from + * evas_object_pass_events_get(obj) is saved, and it is applied when the + * transit ends, if you change this state with evas_object_pass_events_set() + * after add the object, this state will change again when @p transit stops. + * + * @param transit The transit object. + * @param obj Object to be animated. + * + * @ingroup Transit + * @warning It is not allowed to add a new object after transit begins. + */ +EAPI void elm_transit_object_add(Elm_Transit *transit, Evas_Object *obj); + +/** + * Removes an added object from the transit. + * + * @note If the @p obj is not in the @p transit, nothing is done. + * @note If the list become empty, this function will call + * elm_transit_del(transit), i.e., it will kill the @p transit. + * + * @param transit The transit object. + * @param obj Object to be removed from @p transit. + * + * @ingroup Transit + * @warning It is not allowed to remove objects after transit begins. + */ +EAPI void elm_transit_object_remove(Elm_Transit *transit, Evas_Object *obj); + +/** + * Get the objects of the transit. + * + * @param transit The transit object. + * @return a Eina_List with the objects from the transit. + * + * @ingroup Transit + */ +EAPI const Eina_List *elm_transit_objects_get(const Elm_Transit *transit); + +/** + * Enable/disable keeping up the objects states. + * If it is not kept, the objects states will be reset when transition ends. + * + * @note @p transit can not be NULL. + * @note One state includes geometry, color, map data. + * + * @param transit The transit object. + * @param state_keep retain the state or not. + * + * @ingroup Transit + */ +EAPI void elm_transit_objects_final_state_keep_set(Elm_Transit *transit, Eina_Bool state_keep); + +/** + * Get a value whether the objects states will be reset or not. + * + * @note @p transit can not be NULL + * + * @see elm_transit_objects_final_state_keep_set() + * + * @param transit The transit object. + * @return EINA_TRUE means the states of the objects will be reset. + * If @p transit is NULL, EINA_FALSE is returned + * + * @ingroup Transit + */ +EAPI Eina_Bool elm_transit_objects_final_state_keep_get(const Elm_Transit *transit); + +/** + * Set the event enabled when transit is operating. + * + * If @p enabled is EINA_TRUE, the objects of the transit will receive + * events from mouse and keyboard during the animation. + * @note When you add an object with elm_transit_object_add(), its state from + * evas_object_freeze_events_get(obj) is saved, and it is applied when the + * transit ends. If you change this state with evas_object_freeze_events_set() + * after adding the object, this state will change again when @p transit stops + * to run. + * + * @param transit The transit object. + * @param enabled Events are received when enabled is @c EINA_TRUE, and + * ignored otherwise. + * + * @ingroup Transit + */ +EAPI void elm_transit_event_enabled_set(Elm_Transit *transit, Eina_Bool enabled); + +/** + * Get the value of event enabled status. + * + * @see elm_transit_event_enabled_set() + * + * @param transit The Transit object + * @return EINA_TRUE, when event is enabled. If @p transit is NULL + * EINA_FALSE is returned + * + * @ingroup Transit + */ +EAPI Eina_Bool elm_transit_event_enabled_get(const Elm_Transit *transit); + +/** + * Set the user-callback function when the transit is deleted. + * + * @note Using this function twice will overwrite the first function set. + * @note the @p transit object will be deleted after call @p cb function. + * + * @param transit The transit object. + * @param cb Callback function pointer. This function will be called before + * the deletion of the transit. + * @param data Callback function user data. It is the @p op parameter. + * + * @ingroup Transit + */ +EAPI void elm_transit_del_cb_set(Elm_Transit *transit, Elm_Transit_Del_Cb cb, void *data); + +/** + * Set reverse effect automatically. + * + * If auto reverse is set, after running the effects with the progress + * parameter from 0 to 1, it will call the effects again with the progress + * from 1 to 0. The transit will last for a time equal to (2 * duration * repeat), + * where the duration was set with the function elm_transit_add and + * the repeat with the function elm_transit_repeat_times_set(). + * + * @param transit The transit object. + * @param reverse EINA_TRUE means the auto_reverse is on. + * + * @ingroup Transit + */ +EAPI void elm_transit_auto_reverse_set(Elm_Transit *transit, Eina_Bool reverse); + +/** + * Get if the auto reverse is on. + * + * @see elm_transit_auto_reverse_set() + * + * @param transit The transit object. + * @return EINA_TRUE means auto reverse is on. If @p transit is NULL + * EINA_FALSE is returned + * + * @ingroup Transit + */ +EAPI Eina_Bool elm_transit_auto_reverse_get(const Elm_Transit *transit); + +/** + * Set the transit repeat count. Effect will be repeated by repeat count. + * + * This function sets the number of repetition the transit will run after + * the first one, i.e., if @p repeat is 1, the transit will run 2 times. + * If the @p repeat is a negative number, it will repeat infinite times. + * + * @note If this function is called during the transit execution, the transit + * will run @p repeat times, ignoring the times it already performed. + * + * @param transit The transit object + * @param repeat Repeat count + * + * @ingroup Transit + */ +EAPI void elm_transit_repeat_times_set(Elm_Transit *transit, int repeat); + +/** + * Get the transit repeat count. + * + * @see elm_transit_repeat_times_set() + * + * @param transit The Transit object. + * @return The repeat count. If @p transit is NULL + * 0 is returned + * + * @ingroup Transit + */ +EAPI int elm_transit_repeat_times_get(const Elm_Transit *transit); + +/** + * Set the transit animation acceleration type. + * + * This function sets the tween mode of the transit that can be: + * ELM_TRANSIT_TWEEN_MODE_LINEAR - The default mode. + * ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL - Starts in accelerate mode and ends decelerating. + * ELM_TRANSIT_TWEEN_MODE_DECELERATE - The animation will be slowed over time. + * ELM_TRANSIT_TWEEN_MODE_ACCELERATE - The animation will accelerate over time. + * + * @param transit The transit object. + * @param tween_mode The tween type. + * + * @ingroup Transit + */ +EAPI void elm_transit_tween_mode_set(Elm_Transit *transit, Elm_Transit_Tween_Mode tween_mode); + +/** + * Get the transit animation acceleration type. + * + * @note @p transit can not be NULL + * + * @param transit The transit object. + * @return The tween type. If @p transit is NULL + * ELM_TRANSIT_TWEEN_MODE_LINEAR is returned. + * + * @ingroup Transit + */ +EAPI Elm_Transit_Tween_Mode elm_transit_tween_mode_get(const Elm_Transit *transit); + +/** + * Set the transit animation time + * + * @note @p transit can not be NULL + * + * @param transit The transit object. + * @param duration The animation time. + * + * @ingroup Transit + */ +EAPI void elm_transit_duration_set(Elm_Transit *transit, double duration); + +/** + * Get the transit animation time + * + * @note @p transit can not be NULL + * + * @param transit The transit object. + * + * @return The transit animation time. + * + * @ingroup Transit + */ +EAPI double elm_transit_duration_get(const Elm_Transit *transit); + +/** + * Starts the transition. + * Once this API is called, the transit begins to measure the time. + * + * @note @p transit can not be NULL + * + * @param transit The transit object. + * + * @ingroup Transit + */ +EAPI void elm_transit_go(Elm_Transit *transit); + +/** + * Pause/Resume the transition. + * + * If you call elm_transit_go again, the transit will be started from the + * beginning, and will be played. + * + * @note @p transit can not be NULL + * + * @param transit The transit object. + * @param paused Whether the transition should be paused or not. + * + * @ingroup Transit + */ +EAPI void elm_transit_paused_set(Elm_Transit *transit, Eina_Bool paused); + +/** + * Get the value of paused status. + * + * @see elm_transit_paused_set() + * + * @note @p transit can not be NULL + * + * @param transit The transit object. + * @return EINA_TRUE means transition is paused. If @p transit is NULL + * EINA_FALSE is returned + * + * @ingroup Transit + */ +EAPI Eina_Bool elm_transit_paused_get(const Elm_Transit *transit); + +/** + * Get the time progression of the animation (a double value between 0.0 and 1.0). + * + * The value returned is a fraction (current time / total time). It + * represents the progression position relative to the total. + * + * @note @p transit can not be NULL + * + * @param transit The transit object. + * + * @return The time progression value. If @p transit is NULL + * 0 is returned + * + * @ingroup Transit + */ +EAPI double elm_transit_progress_value_get(const Elm_Transit *transit); + +/** + * Makes the chain relationship between two transits. + * + * @note @p transit can not be NULL. Transit would have multiple chain transits. + * @note @p chain_transit can not be NULL. Chain transits could be chained to the only one transit. + * + * @param transit The transit object. + * @param chain_transit The chain transit object. This transit will be operated + * after transit is done. + * + * This function adds @p chain_transit transition to a chain after the @p + * transit, and will be started as soon as @p transit ends. See @ref + * transit_example_02_explained for a full example. + * + * @ingroup Transit + */ +EAPI void elm_transit_chain_transit_add(Elm_Transit *transit, Elm_Transit *chain_transit); + +/** + * Cut off the chain relationship between two transits. + * + * @note @p transit can not be NULL. Transit would have the chain relationship with @p chain transit. + * @note @p chain_transit can not be NULL. Chain transits should be chained to the @p transit. + * + * @param transit The transit object. + * @param chain_transit The chain transit object. + * + * This function remove the @p chain_transit transition from the @p transit. + * + * @ingroup Transit + */ +EAPI void elm_transit_chain_transit_del(Elm_Transit *transit, Elm_Transit *chain_transit); + +/** + * Get the current chain transit list. + * + * @note @p transit can not be NULL. + * + * @param transit The transit object. + * @return chain transit list. + * + * @ingroup Transit + */ +EAPI Eina_List *elm_transit_chain_transits_get(const Elm_Transit *transit); + +/** + * Add the Resizing Effect to Elm_Transit. + * + * @note This API is one of the facades. It creates resizing effect context + * and add it's required APIs to elm_transit_effect_add. + * + * @see elm_transit_effect_add() + * + * @param transit Transit object. + * @param from_w Object width size when effect begins. + * @param from_h Object height size when effect begins. + * @param to_w Object width size when effect ends. + * @param to_h Object height size when effect ends. + * @return Resizing effect context data. + * + * @ingroup Transit + */ +EAPI Elm_Transit_Effect *elm_transit_effect_resizing_add(Elm_Transit *transit, Evas_Coord from_w, Evas_Coord from_h, Evas_Coord to_w, Evas_Coord to_h); + +/** + * Add the Translation Effect to Elm_Transit. + * + * @note This API is one of the facades. It creates translation effect context + * and add it's required APIs to elm_transit_effect_add. + * + * @see elm_transit_effect_add() + * + * @param transit Transit object. + * @param from_dx X Position variation when effect begins. + * @param from_dy Y Position variation when effect begins. + * @param to_dx X Position variation when effect ends. + * @param to_dy Y Position variation when effect ends. + * @return Translation effect context data. + * + * @ingroup Transit + * @warning It is highly recommended just create a transit with this effect when + * the window that the objects of the transit belongs has already been created. + * This is because this effect needs the geometry information about the objects, + * and if the window was not created yet, it can get a wrong information. + */ +EAPI Elm_Transit_Effect *elm_transit_effect_translation_add(Elm_Transit *transit, Evas_Coord from_dx, Evas_Coord from_dy, Evas_Coord to_dx, Evas_Coord to_dy); + +/** + * Add the Zoom Effect to Elm_Transit. + * + * @note This API is one of the facades. It creates zoom effect context + * and add it's required APIs to elm_transit_effect_add. + * + * @see elm_transit_effect_add() + * + * @param transit Transit object. + * @param from_rate Scale rate when effect begins (1 is current rate). + * @param to_rate Scale rate when effect ends. + * @return Zoom effect context data. + * + * @ingroup Transit + * @warning It is highly recommended just create a transit with this effect when + * the window that the objects of the transit belongs has already been created. + * This is because this effect needs the geometry information about the objects, + * and if the window was not created yet, it can get a wrong information. + */ +EAPI Elm_Transit_Effect *elm_transit_effect_zoom_add(Elm_Transit *transit, float from_rate, float to_rate); + +/** + * Add the Flip Effect to Elm_Transit. + * + * @note This API is one of the facades. It creates flip effect context + * and add it's required APIs to elm_transit_effect_add. + * @note This effect is applied to each pair of objects in the order they are listed + * in the transit list of objects. The first object in the pair will be the + * "front" object and the second will be the "back" object. + * + * @see elm_transit_effect_add() + * + * @param transit Transit object. + * @param axis Flipping Axis(X or Y). + * @param cw Flipping Direction. EINA_TRUE is clock-wise. + * @return Flip effect context data. + * + * @ingroup Transit + * @warning It is highly recommended just create a transit with this effect when + * the window that the objects of the transit belongs has already been created. + * This is because this effect needs the geometry information about the objects, + * and if the window was not created yet, it can get a wrong information. + */ +EAPI Elm_Transit_Effect *elm_transit_effect_flip_add(Elm_Transit *transit, Elm_Transit_Effect_Flip_Axis axis, Eina_Bool cw); + +/** + * Add the Resizeable Flip Effect to Elm_Transit. + * + * @note This API is one of the facades. It creates resizable flip effect context + * and add it's required APIs to elm_transit_effect_add. + * @note This effect is applied to each pair of objects in the order they are listed + * in the transit list of objects. The first object in the pair will be the + * "front" object and the second will be the "back" object. + * + * @see elm_transit_effect_add() + * + * @param transit Transit object. + * @param axis Flipping Axis(X or Y). + * @param cw Flipping Direction. EINA_TRUE is clock-wise. + * @return Resizeable flip effect context data. + * + * @ingroup Transit + * @warning It is highly recommended just create a transit with this effect when + * the window that the objects of the transit belongs has already been created. + * This is because this effect needs the geometry information about the objects, + * and if the window was not created yet, it can get a wrong information. + */ +EAPI Elm_Transit_Effect *elm_transit_effect_resizable_flip_add(Elm_Transit *transit, Elm_Transit_Effect_Flip_Axis axis, Eina_Bool cw); + +/** + * Add the Wipe Effect to Elm_Transit. + * + * @note This API is one of the facades. It creates wipe effect context + * and add it's required APIs to elm_transit_effect_add. + * + * @see elm_transit_effect_add() + * + * @param transit Transit object. + * @param type Wipe type. Hide or show. + * @param dir Wipe Direction. + * @return Wipe effect context data. + * + * @ingroup Transit + * @warning It is highly recommended just create a transit with this effect when + * the window that the objects of the transit belongs has already been created. + * This is because this effect needs the geometry information about the objects, + * and if the window was not created yet, it can get a wrong information. + */ +EAPI Elm_Transit_Effect *elm_transit_effect_wipe_add(Elm_Transit *transit, Elm_Transit_Effect_Wipe_Type type, Elm_Transit_Effect_Wipe_Dir dir); + +/** + * Add the Color Effect to Elm_Transit. + * + * @note This API is one of the facades. It creates color effect context + * and add it's required APIs to elm_transit_effect_add. + * + * @see elm_transit_effect_add() + * + * @param transit Transit object. + * @param from_r RGB R when effect begins. + * @param from_g RGB G when effect begins. + * @param from_b RGB B when effect begins. + * @param from_a RGB A when effect begins. + * @param to_r RGB R when effect ends. + * @param to_g RGB G when effect ends. + * @param to_b RGB B when effect ends. + * @param to_a RGB A when effect ends. + * @return Color effect context data. + * + * @ingroup Transit + */ +EAPI Elm_Transit_Effect *elm_transit_effect_color_add(Elm_Transit *transit, unsigned int from_r, unsigned int from_g, unsigned int from_b, unsigned int from_a, unsigned int to_r, unsigned int to_g, unsigned int to_b, unsigned int to_a); + +/** + * Add the Fade Effect to Elm_Transit. + * + * @note This API is one of the facades. It creates fade effect context + * and add it's required APIs to elm_transit_effect_add. + * @note This effect is applied to each pair of objects in the order they are listed + * in the transit list of objects. The first object in the pair will be the + * "before" object and the second will be the "after" object. + * + * @see elm_transit_effect_add() + * + * @param transit Transit object. + * @return Fade effect context data. + * + * @ingroup Transit + * @warning It is highly recommended just create a transit with this effect when + * the window that the objects of the transit belongs has already been created. + * This is because this effect needs the color information about the objects, + * and if the window was not created yet, it can get a wrong information. + */ +EAPI Elm_Transit_Effect *elm_transit_effect_fade_add(Elm_Transit *transit); + +/** + * Add the Blend Effect to Elm_Transit. + * + * @note This API is one of the facades. It creates blend effect context + * and add it's required APIs to elm_transit_effect_add. + * @note This effect is applied to each pair of objects in the order they are listed + * in the transit list of objects. The first object in the pair will be the + * "before" object and the second will be the "after" object. + * + * @see elm_transit_effect_add() + * + * @param transit Transit object. + * @return Blend effect context data. + * + * @ingroup Transit + * @warning It is highly recommended just create a transit with this effect when + * the window that the objects of the transit belongs has already been created. + * This is because this effect needs the color information about the objects, + * and if the window was not created yet, it can get a wrong information. + */ +EAPI Elm_Transit_Effect *elm_transit_effect_blend_add(Elm_Transit *transit); + +/** + * Add the Rotation Effect to Elm_Transit. + * + * @note This API is one of the facades. It creates rotation effect context + * and add it's required APIs to elm_transit_effect_add. + * + * @see elm_transit_effect_add() + * + * @param transit Transit object. + * @param from_degree Degree when effect begins. + * @param to_degree Degree when effect is ends. + * @return Rotation effect context data. + * + * @ingroup Transit + * @warning It is highly recommended just create a transit with this effect when + * the window that the objects of the transit belongs has already been created. + * This is because this effect needs the geometry information about the objects, + * and if the window was not created yet, it can get a wrong information. + */ +EAPI Elm_Transit_Effect *elm_transit_effect_rotation_add(Elm_Transit *transit, float from_degree, float to_degree); + +/** + * Add the ImageAnimation Effect to Elm_Transit. + * + * @note This API is one of the facades. It creates image animation effect context + * and add it's required APIs to elm_transit_effect_add. + * The @p images parameter is a list images paths. This list and + * its contents will be deleted at the end of the effect by + * elm_transit_effect_image_animation_context_free() function. + * + * Example: + * @code + * char buf[PATH_MAX]; + * Eina_List *images = NULL; + * Elm_Transit *transi = elm_transit_add(); + * + * snprintf(buf, sizeof(buf), "%s/images/icon_11.png", PACKAGE_DATA_DIR); + * images = eina_list_append(images, eina_stringshare_add(buf)); + * + * snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR); + * images = eina_list_append(images, eina_stringshare_add(buf)); + * elm_transit_effect_image_animation_add(transi, images); + * + * @endcode + * + * @see elm_transit_effect_add() + * + * @param transit Transit object. + * @param images Eina_List of images file paths. This list and + * its contents will be deleted at the end of the effect by + * elm_transit_effect_image_animation_context_free() function. + * @return Image Animation effect context data. + * + * @ingroup Transit + */ +EAPI Elm_Transit_Effect *elm_transit_effect_image_animation_add(Elm_Transit *transit, Eina_List *images); +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_util.c b/libraries/elementary/src/lib/elm_util.c new file mode 100644 index 0000000..935acd3 --- /dev/null +++ b/libraries/elementary/src/lib/elm_util.c @@ -0,0 +1,46 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include +#include "elm_priv.h" + +char * +_str_ncpy(char *dest, const char *src, size_t count) +{ + if ((!dest) || (!src)) return NULL; + return strncpy(dest, src, count); +} + +char * +_str_append(char *str, const char *txt, int *len, int *alloc) +{ + int txt_len = strlen(txt); + + if (txt_len <= 0) return str; + if ((*len + txt_len) >= *alloc) + { + char *str2; + int alloc2; + + alloc2 = *alloc + txt_len + 128; + str2 = realloc(str, alloc2); + if (!str2) return str; + *alloc = alloc2; + str = str2; + } + strcpy(str + *len, txt); + *len += txt_len; + return str; +} + +char * +_elm_util_mkup_to_text(const char *mkup) +{ + return evas_textblock_text_markup_to_utf8(NULL, mkup); +} + +char * +_elm_util_text_to_mkup(const char *text) +{ + return evas_textblock_text_utf8_to_markup(NULL, text); +} diff --git a/libraries/elementary/src/lib/elm_video.c b/libraries/elementary/src/lib/elm_video.c new file mode 100644 index 0000000..173f9ed --- /dev/null +++ b/libraries/elementary/src/lib/elm_video.c @@ -0,0 +1,581 @@ +#include +#include "elm_priv.h" + +#ifdef HAVE_EMOTION +# include +#endif + +/* TODO: add buffering support to Emotion and display buffering progression in the theme when needed */ + +typedef struct _Widget_Data Widget_Data; +struct _Widget_Data +{ + Evas_Object *layout; + Evas_Object *emotion; + + Ecore_Timer *timer; + + Eina_Bool stop : 1; + Eina_Bool remember : 1; +}; + +#ifdef HAVE_EMOTION +static const char *widtype = NULL; + +static const Evas_Smart_Cb_Description _signals[] = { + { NULL, NULL } +}; + +static void _del_hook(Evas_Object *obj); +static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); +static void _theme_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _on_focus_hook(void *data, Evas_Object *obj); +static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src, + Evas_Callback_Type type, void *event_info); + +static Eina_Bool +_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info) +{ + if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE; + Evas_Event_Key_Down *ev = event_info; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; + if (elm_widget_disabled_get(obj)) return EINA_FALSE; + if ((!strcmp(ev->keyname, "Left")) || + ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string))) + { + double current, last; + + current = elm_video_play_position_get(obj); + last = elm_video_play_length_get(obj); + + if (current < last) + { + current += last / 100; + elm_video_play_position_set(obj, current); + } + + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + if ((!strcmp(ev->keyname, "Right")) || + ((!strcmp(ev->keyname, "KP_Right")) && (!ev->string))) + { + double current, last; + + current = elm_video_play_position_get(obj); + last = elm_video_play_length_get(obj); + + if (current > 0) + { + current -= last / 100; + if (current < 0) current = 0; + elm_video_play_position_set(obj, current); + } + + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + if (!strcmp(ev->keyname, "space")) + { + if (elm_video_is_playing_get(obj)) + elm_video_pause(obj); + else + elm_video_play(obj); + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + fprintf(stderr, "keyname: '%s' not handle\n", ev->keyname); + return EINA_FALSE; +} + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + if (wd->timer) ecore_timer_del(wd->timer); + free(wd); +} + +static void +_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (elm_widget_focus_get(obj)) + { + edje_object_signal_emit(wd->layout, "elm,action,focus", "elm"); + evas_object_focus_set(wd->layout, EINA_TRUE); + } + else + { + edje_object_signal_emit(wd->layout, "elm,action,unfocus", "elm"); + evas_object_focus_set(wd->layout, EINA_FALSE); + } +} + +static void +_mirrored_set(Evas_Object *obj, Eina_Bool rtl) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + edje_object_mirrored_set(wd->layout, rtl); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _elm_widget_mirrored_reload(obj); + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _elm_theme_object_set(obj, wd->layout, "video", "base", elm_widget_style_get(obj)); + edje_object_scale_set(wd->layout, elm_widget_scale_get(obj) * + _elm_config->scale); + _sizing_eval(obj); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1; + Evas_Coord w, h; + + if (!wd) return; + evas_object_size_hint_request_get(wd->emotion, &minw, &minh); + evas_object_size_hint_aspect_set(wd->emotion, EVAS_ASPECT_CONTROL_BOTH, minw, minh); + edje_object_size_min_calc(wd->layout, &w, &h); + + if (w != 0 && h != 0) + { + minw = w; + minh = h; + } + evas_object_size_hint_aspect_set(obj, EVAS_ASPECT_CONTROL_BOTH, minw, minh); +} + +static void +_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _sizing_eval(data); +} + +static void +_sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (wd->remember) emotion_object_last_position_save(wd->emotion); +} + +static void +_open_done(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + + edje_object_signal_emit(wd->layout, "elm,video,open", "elm"); +} + +static void +_playback_started(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + + edje_object_signal_emit(wd->layout, "elm,video,play", "elm"); +} + +static void +_playback_finished(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + + edje_object_signal_emit(wd->layout, "elm,video,end", "elm"); +} + +static void +_update_aspect_ratio(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _sizing_eval(data); +} + +static void +_title_change(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + const char *title; + + title = emotion_object_title_get(wd->emotion); + edje_object_part_text_escaped_set(wd->layout, "elm,title", title); + edje_object_signal_emit(wd->layout, "elm,video,title", "elm"); +} + +static void +_audio_level_change(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + (void) data; +} + +static Eina_Bool +_suspend_cb(void *data) +{ + Widget_Data *wd = elm_widget_data_get(data); + double interval; + + interval = ecore_timer_interval_get(wd->timer); + if (interval <= 20) + emotion_object_suspend_set(wd->emotion, EMOTION_SLEEP); + else if (interval <= 30) + emotion_object_suspend_set(wd->emotion, EMOTION_DEEP_SLEEP); + else + { + emotion_object_suspend_set(wd->emotion, EMOTION_HIBERNATE); + wd->timer = NULL; + return ECORE_CALLBACK_CANCEL; + } + + ecore_timer_interval_set(wd->timer, interval + 10); + return ECORE_CALLBACK_RENEW; +} +#endif + +Eina_Bool +_elm_video_check(Evas_Object *video) +{ +#ifdef HAVE_EMOTION + ELM_CHECK_WIDTYPE(video, widtype) EINA_FALSE; + return EINA_TRUE; +#else + (void) video; + return EINA_FALSE; +#endif +} + +EAPI Evas_Object * +elm_video_add(Evas_Object *parent) +{ +#ifdef HAVE_EMOTION + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + ELM_SET_WIDTYPE(widtype, "video"); + elm_widget_type_set(obj, "video"); + elm_widget_sub_object_add(parent, obj); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_can_focus_set(obj, EINA_TRUE); + elm_widget_event_hook_set(obj, _event_hook); + + wd->stop = EINA_FALSE; + wd->remember = EINA_FALSE; + + wd->layout = edje_object_add(e); + _elm_theme_object_set(obj, wd->layout, "video", "base", "default"); + elm_widget_resize_object_set(obj, wd->layout); + evas_object_show(wd->layout); + evas_object_size_hint_weight_set(wd->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + wd->emotion = emotion_object_add(e); + emotion_object_init(wd->emotion, NULL); + elm_widget_sub_object_add(obj, wd->emotion); + edje_object_part_swallow(wd->layout, "elm.swallow.video", wd->emotion); + + evas_object_smart_callback_add(wd->emotion, "open_done", _open_done, obj); + evas_object_smart_callback_add(wd->emotion, "playback_started", _playback_started, obj); + evas_object_smart_callback_add(wd->emotion, "playback_finished", _playback_finished, obj); + evas_object_smart_callback_add(wd->emotion, "frame_resize", _update_aspect_ratio, obj); + evas_object_smart_callback_add(wd->emotion, "title_change", _title_change, obj); + evas_object_smart_callback_add(wd->emotion, "audio_level_change", _audio_level_change, obj); + + evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + evas_object_event_callback_add(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, NULL); + evas_object_smart_callbacks_descriptions_set(obj, _signals); + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + _sizing_eval(obj); + + wd->timer = ecore_timer_add(20.0, _suspend_cb, obj); + + return obj; +#else + (void) parent; + return NULL; +#endif +} + +EAPI Eina_Bool +elm_video_file_set(Evas_Object *video, const char *filename) +{ +#ifdef HAVE_EMOTION + ELM_CHECK_WIDTYPE(video, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(video); + + if (wd->remember) emotion_object_last_position_save(wd->emotion); + wd->stop = EINA_FALSE; + if (!emotion_object_file_set(wd->emotion, filename)) return EINA_FALSE; + + if ((!strncmp(filename, "file://", 7)) || (!strstr(filename, "://"))) + emotion_object_last_position_load(wd->emotion); + + edje_object_signal_emit(wd->layout, "elm,video,load", "elm"); + + return EINA_TRUE; +#else + (void) video; + (void) filename; + + return EINA_FALSE; +#endif +} + +EAPI Evas_Object * +elm_video_emotion_get(const Evas_Object *video) +{ +#ifdef HAVE_EMOTION + ELM_CHECK_WIDTYPE(video, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(video); + + return wd->emotion; +#else + (void) video; + return NULL; +#endif +} + +EAPI void +elm_video_play(Evas_Object *video) +{ +#ifdef HAVE_EMOTION + ELM_CHECK_WIDTYPE(video, widtype); + Widget_Data *wd = elm_widget_data_get(video); + + if (emotion_object_play_get(wd->emotion)) return ; + + if (wd->timer) ecore_timer_del(wd->timer); + wd->timer = NULL; + wd->stop = EINA_FALSE; + emotion_object_play_set(wd->emotion, EINA_TRUE); +#else + (void) video; +#endif +} + +/* FIXME: pause will setup timer and go into sleep or + * hibernate after a while without activity. + */ + +EAPI void +elm_video_pause(Evas_Object *video) +{ +#ifdef HAVE_EMOTION + ELM_CHECK_WIDTYPE(video, widtype); + Widget_Data *wd = elm_widget_data_get(video); + + if (!emotion_object_play_get(wd->emotion)) return ; + + if (!wd->timer) wd->timer = ecore_timer_add(20.0, _suspend_cb, video); + emotion_object_play_set(wd->emotion, EINA_FALSE); + edje_object_signal_emit(wd->layout, "elm,video,pause", "elm"); +#else + (void) video; +#endif +} + +/* FIXME: stop should go into hibernate state directly. + */ +EAPI void +elm_video_stop(Evas_Object *video) +{ +#ifdef HAVE_EMOTION + ELM_CHECK_WIDTYPE(video, widtype); + Widget_Data *wd = elm_widget_data_get(video); + + if (!emotion_object_play_get(wd->emotion) && wd->stop) return ; + + if (wd->timer) ecore_timer_del(wd->timer); + wd->timer = NULL; + wd->stop = EINA_TRUE; + emotion_object_play_set(wd->emotion, EINA_FALSE); + edje_object_signal_emit(wd->layout, "elm,video,stop", "elm"); + emotion_object_suspend_set(wd->emotion, EMOTION_HIBERNATE); +#else + (void) video; +#endif +} + +EAPI Eina_Bool +elm_video_is_playing_get(const Evas_Object *video) +{ +#ifdef HAVE_EMOTION + ELM_CHECK_WIDTYPE(video, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(video); + + return emotion_object_play_get(wd->emotion); +#else + (void) video; + return EINA_FALSE; +#endif +} + +EAPI Eina_Bool +elm_video_is_seekable_get(const Evas_Object *video) +{ +#ifdef HAVE_EMOTION + ELM_CHECK_WIDTYPE(video, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(video); + + return emotion_object_seekable_get(wd->emotion); +#else + (void) video; + return EINA_FALSE; +#endif +} + +EAPI Eina_Bool +elm_video_audio_mute_get(const Evas_Object *video) +{ +#ifdef HAVE_EMOTION + ELM_CHECK_WIDTYPE(video, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(video); + + return emotion_object_audio_mute_get(wd->emotion); +#else + (void) video; + return EINA_FALSE; +#endif +} + +EAPI void +elm_video_audio_mute_set(Evas_Object *video, Eina_Bool mute) +{ +#ifdef HAVE_EMOTION + ELM_CHECK_WIDTYPE(video, widtype); + Widget_Data *wd = elm_widget_data_get(video); + + emotion_object_audio_mute_set(wd->emotion, mute); +#else + (void) video; + (void) mute; +#endif +} + +EAPI double +elm_video_audio_level_get(const Evas_Object *video) +{ +#ifdef HAVE_EMOTION + ELM_CHECK_WIDTYPE(video, widtype) 0.0; + Widget_Data *wd = elm_widget_data_get(video); + + return emotion_object_audio_volume_get(wd->emotion); +#else + (void) video; + return 0.0; +#endif +} + +EAPI void +elm_video_audio_level_set(Evas_Object *video, double volume) +{ +#ifdef HAVE_EMOTION + ELM_CHECK_WIDTYPE(video, widtype); + Widget_Data *wd = elm_widget_data_get(video); + + emotion_object_audio_volume_set(wd->emotion, volume); +#else + (void) video; + (void) volume; +#endif +} + +EAPI double +elm_video_play_position_get(const Evas_Object *video) +{ +#ifdef HAVE_EMOTION + ELM_CHECK_WIDTYPE(video, widtype) 0.0; + Widget_Data *wd = elm_widget_data_get(video); + + return emotion_object_position_get(wd->emotion); +#else + (void) video; + return 0.0; +#endif +} + +EAPI void +elm_video_play_position_set(Evas_Object *video, double position) +{ +#ifdef HAVE_EMOTION + ELM_CHECK_WIDTYPE(video, widtype); + Widget_Data *wd = elm_widget_data_get(video); + + emotion_object_position_set(wd->emotion, position); +#else + (void) video; + (void) position; +#endif +} + +EAPI double +elm_video_play_length_get(const Evas_Object *video) +{ +#ifdef HAVE_EMOTION + ELM_CHECK_WIDTYPE(video, widtype) 0.0; + Widget_Data *wd = elm_widget_data_get(video); + + return emotion_object_play_length_get(wd->emotion); +#else + (void) video; + return 0.0; +#endif +} + +EAPI const char * +elm_video_title_get(const Evas_Object *video) +{ +#ifdef HAVE_EMOTION + ELM_CHECK_WIDTYPE(video, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(video); + + return emotion_object_title_get(wd->emotion); +#else + (void) video; + return NULL; +#endif +} + +EAPI void +elm_video_remember_position_set(Evas_Object *video, Eina_Bool remember) +{ +#ifdef HAVE_EMOTION + ELM_CHECK_WIDTYPE(video, widtype); + Widget_Data *wd = elm_widget_data_get(video); + + wd->remember = remember; +#else + (void) video; + (void) remember; +#endif +} + +EAPI Eina_Bool +elm_video_remember_position_get(const Evas_Object *video) +{ +#ifdef HAVE_EMOTION + ELM_CHECK_WIDTYPE(video, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(video); + + return wd->remember; +#else + (void) video; + return EINA_FALSE; +#endif +} diff --git a/libraries/elementary/src/lib/elm_video.h b/libraries/elementary/src/lib/elm_video.h new file mode 100644 index 0000000..018f632 --- /dev/null +++ b/libraries/elementary/src/lib/elm_video.h @@ -0,0 +1,268 @@ +/** + * @defgroup Video Video + * @ingroup Elementary + * + * @addtogroup Video + * @{ + * + * Elementary comes with two object that help design application that need + * to display video. + * + * The first one, Elm_Video, display a video by using Emotion. + * It embeds the video inside an Edje object, so you can do some + * animation depending on the video state change. It also implements a + * resource management policy to remove this burden from the application. + * + * The second one, + * Elm_Player is a video player that need to be linked with an Elm_Video. + * It take care of updating its content according to Emotion event and provide a + * way to theme itself. It also automatically raises the priority of the + * linked Elm_Video so it will use the video decoder, if available. It also + * activates the "remember" function on the linked Elm_Video object. + * + * Signals that you can add callback for are : + * + * "forward,clicked" - the user clicked the forward button. + * "info,clicked" - the user clicked the info button. + * "next,clicked" - the user clicked the next button. + * "pause,clicked" - the user clicked the pause button. + * "play,clicked" - the user clicked the play button. + * "prev,clicked" - the user clicked the prev button. + * "rewind,clicked" - the user clicked the rewind button. + * "stop,clicked" - the user clicked the stop button. + * + * Default content parts of the player widget that you can use for are: + * @li "video" - A video of the player + * + */ + +/** + * @brief Add a new Elm_Player object to the given parent Elementary (container) object. + * + * @param parent The parent object + * @return a new player widget handle or @c NULL, on errors. + * + * This function inserts a new player widget on the canvas. + * + * @see elm_object_part_content_set() + * + * @ingroup Video + */ +EAPI Evas_Object *elm_player_add(Evas_Object *parent); + +/** + * @brief Add a new Elm_Video object to the given parent Elementary (container) object. + * + * @param parent The parent object + * @return a new video widget handle or @c NULL, on errors. + * + * This function inserts a new video widget on the canvas. + * + * @see elm_video_file_set() + * + * @ingroup Video + */ +EAPI Evas_Object *elm_video_add(Evas_Object *parent); + +/** + * @brief Define the file or URI that will be the video source. + * + * @param video The video object to define the file or URI for the video + * of the Elm_Video object. + * + * @param filename The file or URI to target. + * Local files can be specified using file:// or by using full file paths. + * URI could be remote source of video, like http:// or local source like + * WebCam (v4l2://). (You can use Emotion API to request and list + * the available Webcam on your system). + * + * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise + * + * This function will explicitly define a file or URI as a source + * for the video of the Elm_Video object. + * + * @see elm_video_add() + * @see elm_player_add() + * + * @ingroup Video + */ +EAPI Eina_Bool elm_video_file_set(Evas_Object *video, const char *filename); + +/** + * @brief Get the underlying Emotion object. + * + * @param video The video object to proceed the request on. + * @return the underlying Emotion object. + * + * @ingroup Video + */ +EAPI Evas_Object *elm_video_emotion_get(const Evas_Object *video); + +/** + * @brief Start to play the video + * + * @param video The video object to proceed the request on. + * + * Start to play the video and cancel all suspend state. + * + * @ingroup Video + */ +EAPI void elm_video_play(Evas_Object *video); + +/** + * @brief Pause the video + * + * @param video The video object to proceed the request on. + * + * Pause the video and start a timer to trigger suspend mode. + * + * @ingroup Video + */ +EAPI void elm_video_pause(Evas_Object *video); + +/** + * @brief Stop the video + * + * @param video The video object to proceed the request on. + * + * Stop the video and put the emotion in deep sleep mode. + * + * @ingroup Video + */ +EAPI void elm_video_stop(Evas_Object *video); + +/** + * @brief Is the video actually playing. + * + * @param video The video object to proceed the request on. + * @return EINA_TRUE if the video is actually playing. + * + * You should consider watching event on the object instead of polling + * the object state. + * + * @ingroup Video + */ +EAPI Eina_Bool elm_video_is_playing_get(const Evas_Object *video); + +/** + * @brief Is it possible to seek inside the video. + * + * @param video The video object to proceed the request on. + * @return EINA_TRUE if is possible to seek inside the video. + * + * @ingroup Video + */ +EAPI Eina_Bool elm_video_is_seekable_get(const Evas_Object *video); + +/** + * @brief Is the audio muted. + * + * @param video The video object to proceed the request on. + * @return EINA_TRUE if the audio is muted. + * + * @ingroup Video + */ +EAPI Eina_Bool elm_video_audio_mute_get(const Evas_Object *video); + +/** + * @brief Change the mute state of the Elm_Video object. + * + * @param video The video object to proceed the request on. + * @param mute The new mute state. + * + * @ingroup Video + */ +EAPI void elm_video_audio_mute_set(Evas_Object *video, Eina_Bool mute); + +/** + * @brief Get the audio level of the current video. + * + * @param video The video object to proceed the request on. + * @return the current audio level. + * + * @ingroup Video + */ +EAPI double elm_video_audio_level_get(const Evas_Object *video); + +/** + * @brief Set the audio level of an Elm_Video object. + * + * @param video The video object to proceed the request on. + * @param volume The new audio volume. + * + * @ingroup Video + */ +EAPI void elm_video_audio_level_set(Evas_Object *video, double volume); + +/** + * @brief Get the current position (in seconds) being played in the + * Elm_Video object. + * + * @param video The video object. + * @return the time(in seconds) since the beginning of the media file. + * + * @ingroup Video + */ +EAPI double elm_video_play_position_get(const Evas_Object *video); + +/** + * @brief Set the current position (in seconds) to be played in the + * Elm_Video object. + * + * @param video The video object. + * @param position the time(in seconds) since the beginning of the media file. + * + * @ingroup Video + */ +EAPI void elm_video_play_position_set(Evas_Object *video, double position); +/** + * @brief Get the total playing time (in seconds) of the Elm_Video object. + * + * @param video The video object. + * @return the total duration(in seconds) of the media file. + * + * @ingroup Video + */ +EAPI double elm_video_play_length_get(const Evas_Object *video); + +/** + * @brief Set whether the object can remember the last played position. + * + * @param video The video object. + * @param remember the last played position of the Elm_Video object. + * + * @note This API only serves as indication. System support is required. + * + * @ingroup Video + */ +EAPI void elm_video_remember_position_set(Evas_Object *video, Eina_Bool remember); + +/** + * @brief Set whether the object can remember the last played position. + * + * @param video The video object. + * @return whether the object remembers the last played position (EINA_TRUE) + * or not. + * + * @note This API only serves as indication. System support is required. + * + * @ingroup Video + */ +EAPI Eina_Bool elm_video_remember_position_get(const Evas_Object *video); + +/** + * @brief Get the title (for ex. DVD title) from this emotion object. + * + * @param video The Elm_Video object. + * @return A string containing the title. + * + * This function is only useful when playing a DVD. + * + * @note Don't change or free the string returned by this function. + * + * @ingroup Video + */ +EAPI const char *elm_video_title_get(const Evas_Object *video); +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_web.c b/libraries/elementary/src/lib/elm_web.c new file mode 100644 index 0000000..72e970f --- /dev/null +++ b/libraries/elementary/src/lib/elm_web.c @@ -0,0 +1,1944 @@ +#include +#include "elm_priv.h" + +// TODO: +// 1 - easy to use zoom like elm_photocam API +// 2 - review scrolling to match elm_scroller. Maybe in future use elm_scroller + +#ifdef HAVE_ELEMENTARY_WEB +#include + +/* Similar to iPhone */ +// TODO: switch between iPhone, iPad or Chrome/Safari based on some elm setting? +#define ELM_WEB_USER_AGENT "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3 " PACKAGE_NAME "/" PACKAGE_VERSION + +static Ewk_View_Smart_Class _parent_sc = EWK_VIEW_SMART_CLASS_INIT_NULL; + +typedef struct _View_Smart_Data View_Smart_Data; +struct _View_Smart_Data +{ + Ewk_View_Smart_Data base; + struct + { + Evas_Event_Mouse_Down event; + Evas_Coord x, y; + unsigned int move_count; + Ecore_Timer *longpress_timer; + Ecore_Animator *pan_anim; + } mouse; +}; +#endif + +typedef struct _Widget_Data Widget_Data; +struct _Widget_Data +{ + Evas_Object *self; +#ifdef HAVE_ELEMENTARY_WEB + Evas_Object *ewk_view; + struct + { + Elm_Web_Window_Open window_create; + void *window_create_data; + Elm_Web_Dialog_Alert alert; + void *alert_data; + Elm_Web_Dialog_Confirm confirm; + void *confirm_data; + Elm_Web_Dialog_Prompt prompt; + void *prompt_data; + Elm_Web_Dialog_File_Selector file_selector; + void *file_selector_data; + Elm_Web_Console_Message console_message; + void *console_message_data; + } hook; + Elm_Win_Keyboard_Mode input_method; + struct + { + Elm_Web_Zoom_Mode mode; + float current; + float min, max; + Eina_Bool no_anim; + Ecore_Timer *timer; + } zoom; + struct + { + struct + { + int x, y; + } start, end; + Ecore_Animator *animator; + } bring_in; + Eina_Bool tab_propagate : 1; + Eina_Bool inwin_mode : 1; +#else + Evas_Object *label; +#endif +}; + +enum Dialog_Type +{ + DIALOG_ALERT, + DIALOG_CONFIRM, + DIALOG_PROMPT, + DIALOG_FILE_SELECTOR +}; + +typedef struct _Dialog_Data Dialog_Data; +struct _Dialog_Data +{ + enum Dialog_Type type; + Evas_Object *dialog; + Evas_Object *box; + Evas_Object *bt_ok, *bt_cancel; + Evas_Object *entry; + Evas_Object *file_sel; + + Eina_Bool *response; + char **entry_value; + Eina_List **selected_files; +}; + +struct _Elm_Web_Callback_Proxy_Context +{ + const char *name; + Evas_Object *obj; +}; +typedef struct _Elm_Web_Callback_Proxy_Context Elm_Web_Callback_Proxy_Context; + +static const char *widtype = NULL; +static const Evas_Smart_Cb_Description _elm_web_callback_names[] = { + { "download,request", "p" }, + { "editorclient,contents,changed", "" }, + { "editorclient,selection,changed", "" }, + { "frame,created", "p" }, + { "icon,received", "" }, + { "inputmethod,changed", "b" }, + { "js,windowobject,clear", "" }, + { "link,hover,in", "p" }, + { "link,hover,out", "" }, + { "load,document,finished", "p" }, + { "load,error", "p" }, + { "load,finished", "p" }, + { "load,newwindow,show", "" }, + { "load,progress", "d" }, + { "load,provisional", "" }, + { "load,started", "" }, + { "menubar,visible,get", "b" }, + { "menubar,visible,set", "b" }, + { "popup,created", "p" }, + { "popup,willdelete", "p" }, + { "ready", "" }, + { "scrollbars,visible,get", "b" }, + { "scrollbars,visible,set", "b" }, + { "statusbar,text,set", "s" }, + { "statusbar,visible,get", "b" }, + { "statusbar,visible,set", "b" }, + { "title,changed", "s" }, + { "toolbars,visible,get", "b" }, + { "toolbars,visible,set", "b" }, + { "tooltip,text,set", "s" }, + { "uri,changed", "s" }, + { "view,resized", "" }, + { "windows,close,request", ""}, + { "zoom,animated,end", "" }, + { NULL, NULL } +}; + +#ifdef HAVE_ELEMENTARY_WEB +static char * +_webkit_theme_find(const Eina_List *list) +{ + const Eina_List *l; + const char *th; + + EINA_LIST_FOREACH(list, l, th) + { + char *path = elm_theme_list_item_path_get(th, NULL); + if (!path) continue; + if (edje_file_group_exists(path, "webkit/base")) + return path; + free(path); + } + + return NULL; +} +#endif + +static void +_theme_hook(Evas_Object *obj) +{ +#ifdef HAVE_ELEMENTARY_WEB + Elm_Theme *theme = elm_object_theme_get(obj); + Widget_Data *wd = elm_widget_data_get(obj); + const Eina_List *themes; + char *view_theme = NULL; + + themes = elm_theme_overlay_list_get(theme); + view_theme = _webkit_theme_find(themes); + if (view_theme) goto set; + + themes = elm_theme_list_get(theme); + view_theme = _webkit_theme_find(themes); + if (view_theme) goto set; + + themes = elm_theme_extension_list_get(theme); + view_theme = _webkit_theme_find(themes); + +set: + if (view_theme) + { + ewk_view_theme_set(wd->ewk_view, view_theme); + free(view_theme); + } + else + ewk_view_theme_set(wd->ewk_view, WEBKIT_DATADIR"/themes/default.edj"); +#else + (void)obj; +#endif +} + +static void +_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *top = elm_widget_top_get(obj); + + if (!wd) return; + + if (elm_object_focus_get(obj)) + { + evas_object_focus_set(wd->ewk_view, EINA_TRUE); + if (top) elm_win_keyboard_mode_set(top, wd->input_method); + } + else + { + evas_object_focus_set(wd->ewk_view, EINA_FALSE); + if (top) elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_OFF); + } +#else + (void)obj; +#endif +} + +static Eina_Bool +_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info) +{ +#ifdef HAVE_ELEMENTARY_WEB + Evas_Event_Key_Down *ev = event_info; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return EINA_FALSE; + if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; + if (elm_widget_disabled_get(obj)) return EINA_FALSE; + + if ((!strcmp(ev->keyname, "Tab")) && (!wd->tab_propagate)) + { + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else + return EINA_FALSE; +#else + return EINA_FALSE; + (void)obj; + (void)type; + (void)event_info; +#endif +} + +#ifdef HAVE_ELEMENTARY_WEB +static Eina_Bool +_view_pan_animator(void *data) +{ + View_Smart_Data *sd = data; + Evas_Coord x, y, dx, dy; + + evas_pointer_canvas_xy_get(sd->base.base.evas, &x, &y); + + dx = sd->mouse.x - x; + dy = sd->mouse.y - y; + + if ((dx == 0) && (dy == 0)) + goto end; + + ewk_frame_scroll_add(sd->base.main_frame, dx, dy); + + sd->mouse.x = x; + sd->mouse.y = y; + + end: + return EINA_TRUE; +} + +static void +_view_smart_add(Evas_Object *obj) +{ + View_Smart_Data *sd; + + sd = calloc(1, sizeof(View_Smart_Data)); + evas_object_smart_data_set(obj, sd); + + _parent_sc.sc.add(obj); + + ewk_view_history_enable_set(obj, EINA_TRUE); + ewk_history_limit_set(ewk_view_history_get(obj), 100); + // TODO: auto toggle between smooth/nearest during bring-in animations + //ewk_view_zoom_weak_smooth_scale_set(obj, EINA_TRUE); +} + +static void +_view_smart_del(Evas_Object *obj) +{ + View_Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + + if (sd->mouse.pan_anim) + ecore_animator_del(sd->mouse.pan_anim); + + _parent_sc.sc.del(obj); +} + +static Eina_Bool +_view_longpress_timer(void *data) +{ + View_Smart_Data *sd = data; + + sd->mouse.move_count = 0; + sd->mouse.longpress_timer = NULL; + return ECORE_CALLBACK_CANCEL; +} + +static Eina_Bool +_view_smart_mouse_down(Ewk_View_Smart_Data *esd, const Evas_Event_Mouse_Down *event) +{ + // TODO: mimic elm_scroller and like + // TODO-minor: offer hook? + View_Smart_Data *sd = (View_Smart_Data *)esd; + + if (event->button != 1) + return _parent_sc.mouse_down(esd, event); + + sd->mouse.pan_anim = ecore_animator_add(_view_pan_animator, sd); + sd->mouse.longpress_timer = ecore_timer_add(_elm_config->longpress_timeout, _view_longpress_timer, sd); + sd->mouse.move_count = 1; + sd->mouse.x = event->canvas.x; + sd->mouse.y = event->canvas.y; + sd->mouse.event = *event; + + return EINA_TRUE; +} + +static Eina_Bool +_view_smart_mouse_up(Ewk_View_Smart_Data *esd, const Evas_Event_Mouse_Up *event) +{ + // TODO: mimic elm_scroller and like + // TODO-minor: offer hook? + View_Smart_Data *sd = (View_Smart_Data *)esd; + + if (sd->mouse.pan_anim) + { + ecore_animator_del(sd->mouse.pan_anim); + sd->mouse.pan_anim = NULL; + + if (sd->mouse.longpress_timer) + _parent_sc.mouse_down(esd, &sd->mouse.event); + else + return EINA_TRUE; + } + + if (sd->mouse.longpress_timer) + { + ecore_timer_del(sd->mouse.longpress_timer); + sd->mouse.longpress_timer = NULL; + } + + sd->mouse.move_count = 0; + return _parent_sc.mouse_up(esd, event); +} + +static Eina_Bool +_view_smart_mouse_move(Ewk_View_Smart_Data *esd, const Evas_Event_Mouse_Move *event) +{ + // TODO: mimic elm_scroller and like + // TODO-minor: offer hook? + View_Smart_Data *sd = (View_Smart_Data *)esd; + sd->mouse.move_count++; + + if (sd->mouse.longpress_timer && + (((sd->mouse.x ^ sd->mouse.event.canvas.x) | + (sd->mouse.y ^ sd->mouse.event.canvas.y)) & (~0x07))) + { + ecore_timer_del(sd->mouse.longpress_timer); + sd->mouse.longpress_timer = NULL; + } + + if (sd->mouse.pan_anim) + { + return EINA_FALSE; + } + + return _parent_sc.mouse_move(esd, event); +} + +static Evas_Object * +_view_smart_window_create(Ewk_View_Smart_Data *sd, Eina_Bool javascript, const Ewk_Window_Features *window_features) +{ + Evas_Object *new; + Evas_Object *obj = evas_object_smart_parent_get(sd->self); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd->hook.window_create) return NULL; + new = wd->hook.window_create(wd->hook.window_create_data, obj, javascript, + (const Elm_Web_Window_Features *)window_features); + if (new) return elm_web_webkit_view_get(new); + + return NULL; +} + +static void +_view_smart_window_close(Ewk_View_Smart_Data *sd) +{ + Evas_Object *obj = evas_object_smart_parent_get(sd->self); + evas_object_smart_callback_call(obj, "windows,close,request", NULL); +} + +static void +_bt_close(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Dialog_Data *d = data; + + *d->response = (obj == d->bt_ok); + if ((d->type == DIALOG_PROMPT) && (*d->response == EINA_TRUE)) + *d->entry_value = strdup(elm_entry_entry_get(d->entry)); + evas_object_del(d->dialog); +} + +static void +_file_sel_done(void *data, Evas_Object *obj __UNUSED__, void *event_info) +{ + Dialog_Data *d = data; + if (event_info) + { + *d->selected_files = eina_list_append(NULL, strdup(event_info)); + *d->response = EINA_TRUE; + } + else + *d->response = EINA_FALSE; + evas_object_del(d->dialog); + free(d); +} + +static Dialog_Data * +_dialog_new(Evas_Object *parent) +{ + Dialog_Data *d; + Widget_Data *wd = elm_widget_data_get(parent); + + d = calloc(1, sizeof(Dialog_Data)); + if (!d) return NULL; + + if (!parent || wd->inwin_mode) + { + Evas_Object *bg; + + d->dialog = elm_win_add(NULL, "elm-web-popup", ELM_WIN_DIALOG_BASIC); + evas_object_smart_callback_add(d->dialog, "delete,request", + _bt_close, d); + + bg = elm_bg_add(d->dialog); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_win_resize_object_add(d->dialog, bg); + evas_object_show(bg); + + d->box = elm_box_add(d->dialog); + evas_object_size_hint_weight_set(d->box, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_win_resize_object_add(d->dialog, d->box); + evas_object_show(d->box); + } + else + { + Evas_Object *win = elm_widget_top_get(parent); + d->dialog = elm_win_inwin_add(win); + elm_object_style_set(d->dialog, "minimal"); + evas_object_size_hint_weight_set(d->dialog, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + + d->box = elm_box_add(win); + evas_object_size_hint_weight_set(d->box, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_win_inwin_content_set(d->dialog, d->box); + evas_object_show(d->box); + } + + return d; +} + +static Evas_Object * +_run_dialog(Evas_Object *parent, enum Dialog_Type type, const char *message, const char *default_entry_value, char **entry_value, Eina_Bool allows_multiple_files __UNUSED__, Eina_List *accept_types __UNUSED__, Eina_List **selected_filenames, Eina_Bool *response) +{ + EINA_SAFETY_ON_TRUE_RETURN_VAL((type != DIALOG_PROMPT) && (!!default_entry_value), EINA_FALSE); + EINA_SAFETY_ON_TRUE_RETURN_VAL((type != DIALOG_PROMPT) && (!!entry_value), EINA_FALSE); + + Dialog_Data *dialog_data = _dialog_new(evas_object_smart_parent_get(parent)); + Evas_Object *lb; + + if (type != DIALOG_FILE_SELECTOR) + { + lb = elm_label_add(dialog_data->box); + elm_object_text_set(lb, message); + elm_box_pack_end(dialog_data->box, lb); + evas_object_show(lb); + } + + dialog_data->type = type; + dialog_data->response = response; + dialog_data->entry_value = entry_value; + dialog_data->selected_files = selected_filenames; + + if (type == DIALOG_ALERT) + { + dialog_data->bt_ok = elm_button_add(dialog_data->box); + elm_object_text_set(dialog_data->bt_ok, "Close"); + elm_box_pack_end(dialog_data->box, dialog_data->bt_ok); + evas_object_size_hint_align_set(dialog_data->bt_ok, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_smart_callback_add(dialog_data->bt_ok, "clicked", _bt_close, dialog_data); + evas_object_show(dialog_data->bt_ok); + } + else if (type == DIALOG_FILE_SELECTOR) + { + dialog_data->file_sel = elm_fileselector_add(dialog_data->dialog); + evas_object_size_hint_weight_set(dialog_data->file_sel, + EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(dialog_data->file_sel, EVAS_HINT_FILL, + EVAS_HINT_FILL); + elm_box_pack_end(dialog_data->box, dialog_data->file_sel); + evas_object_show(dialog_data->file_sel); + + elm_fileselector_path_set(dialog_data->file_sel, "."); + elm_fileselector_is_save_set(dialog_data->file_sel, EINA_FALSE); + elm_fileselector_folder_only_set(dialog_data->file_sel, EINA_FALSE); + elm_fileselector_buttons_ok_cancel_set(dialog_data->file_sel, + EINA_TRUE); + elm_fileselector_expandable_set(dialog_data->file_sel, EINA_FALSE); + evas_object_smart_callback_add(dialog_data->file_sel, "done", + _file_sel_done, dialog_data); + // fileselector can't set it's minimum size correctly + evas_object_size_hint_min_set(dialog_data->file_sel, 300, 400); + } + else + { + if (type == DIALOG_PROMPT) + { + dialog_data->entry = elm_entry_add(dialog_data->box); + elm_entry_single_line_set(dialog_data->entry, EINA_TRUE); + elm_entry_scrollable_set(dialog_data->entry, EINA_TRUE); + elm_entry_entry_set(dialog_data->entry, default_entry_value); + evas_object_size_hint_align_set(dialog_data->entry, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(dialog_data->entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(dialog_data->box, dialog_data->entry); + evas_object_show(dialog_data->entry); + } + + if (type == DIALOG_PROMPT || type == DIALOG_CONFIRM) + { + Evas_Object *bx_h = elm_box_add(dialog_data->box); + elm_box_horizontal_set(bx_h, 1); + elm_box_pack_end(dialog_data->box, bx_h); + evas_object_size_hint_weight_set(bx_h, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bx_h, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bx_h); + + dialog_data->bt_cancel = elm_button_add(bx_h); + elm_object_text_set(dialog_data->bt_cancel, "Cancel"); + elm_box_pack_end(bx_h, dialog_data->bt_cancel); + evas_object_size_hint_weight_set(dialog_data->bt_cancel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(dialog_data->bt_cancel, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_smart_callback_add(dialog_data->bt_cancel, "clicked", _bt_close, dialog_data); + evas_object_show(dialog_data->bt_cancel); + + dialog_data->bt_ok = elm_button_add(bx_h); + elm_object_text_set(dialog_data->bt_ok, "Ok"); + elm_box_pack_end(bx_h, dialog_data->bt_ok); + evas_object_size_hint_weight_set(dialog_data->bt_ok, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(dialog_data->bt_ok, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_smart_callback_add(dialog_data->bt_ok, "clicked", _bt_close, dialog_data); + evas_object_show(dialog_data->bt_ok); + } + else + return EINA_FALSE; + } + + evas_object_show(dialog_data->dialog); + + return dialog_data->dialog; +} + +static void +_dialog_del_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + ecore_main_loop_quit(); +} + +static void +_exec_dialog(Evas_Object *dialog) +{ + evas_object_event_callback_add(dialog, EVAS_CALLBACK_DEL, _dialog_del_cb, + NULL); + ecore_main_loop_begin(); +} + +/* called by ewk_view when javascript called alert() + * + */ +static void +_view_smart_run_javascript_alert(Ewk_View_Smart_Data *esd, Evas_Object *frame __UNUSED__, const char *message) +{ + View_Smart_Data *sd = (View_Smart_Data *)esd; + Evas_Object *view = sd->base.self; + Evas_Object *obj = evas_object_smart_parent_get(view); + Evas_Object *diag = NULL; + Widget_Data *wd = elm_widget_data_get(obj); + Eina_Bool response = EINA_FALSE; + + if (wd->hook.alert) + diag = wd->hook.alert(wd->hook.alert_data, obj, message); + else + diag = _run_dialog(view, DIALOG_ALERT, message, NULL, NULL, EINA_FALSE, + NULL, NULL, &response); + if (diag) _exec_dialog(diag); +} + +/* called by ewk_view when javascript called confirm() + * + */ +static Eina_Bool +_view_smart_run_javascript_confirm(Ewk_View_Smart_Data *esd, Evas_Object *frame __UNUSED__, const char *message) +{ + View_Smart_Data *sd = (View_Smart_Data *)esd; + Evas_Object *view = sd->base.self; + Evas_Object *obj = evas_object_smart_parent_get(view); + Evas_Object *diag = NULL; + Widget_Data *wd = elm_widget_data_get(obj); + Eina_Bool response = EINA_FALSE; + + if (wd->hook.confirm) + diag = wd->hook.confirm(wd->hook.confirm_data, obj, message, &response); + else + diag = _run_dialog(view, DIALOG_CONFIRM, message, NULL, NULL, EINA_FALSE, + NULL, NULL, &response); + if (diag) _exec_dialog(diag); + return response; +} + +/* called by ewk_view when javascript called confirm() + * + */ +static Eina_Bool +_view_smart_run_javascript_prompt(Ewk_View_Smart_Data *esd, Evas_Object *frame __UNUSED__, const char *message, const char *default_value, char **value) +{ + View_Smart_Data *sd = (View_Smart_Data *)esd; + Evas_Object *view = sd->base.self; + Evas_Object *obj = evas_object_smart_parent_get(view); + Evas_Object *diag = NULL; + Widget_Data *wd = elm_widget_data_get(obj); + Eina_Bool response = EINA_FALSE; + + if (wd->hook.prompt) + diag = wd->hook.prompt(wd->hook.prompt_data, obj, message, default_value, + value, &response); + else + diag = _run_dialog(view, DIALOG_PROMPT, message, default_value, value, + EINA_FALSE, NULL, NULL, &response); + if (diag) _exec_dialog(diag); + if (!response) + *value = NULL; + + return EINA_TRUE; +} + +static Eina_Bool +_view_smart_run_open_panel(Ewk_View_Smart_Data *esd, Evas_Object *frame __UNUSED__, Eina_Bool allows_multiple_files, Eina_List *accept_types, Eina_List **selected_filenames) +{ + View_Smart_Data *sd = (View_Smart_Data *)esd; + Evas_Object *view = sd->base.self; + Evas_Object *obj = evas_object_smart_parent_get(view); + Evas_Object *diag = NULL; + Widget_Data *wd = elm_widget_data_get(obj); + Eina_Bool response = EINA_FALSE; + + if (wd->hook.file_selector) + diag = wd->hook.file_selector(wd->hook.file_selector_data, obj, + allows_multiple_files, accept_types, + selected_filenames, &response); + else + diag = _run_dialog(view, DIALOG_FILE_SELECTOR, NULL, NULL, NULL, + allows_multiple_files, accept_types, selected_filenames, + &response); + if (diag) _exec_dialog(diag); + + return response; +} + +static void +_view_smart_add_console_message(Ewk_View_Smart_Data *esd, const char *message, unsigned int line_number, const char *source_id) +{ + Evas_Object *obj = evas_object_smart_parent_get(esd->self); + Widget_Data *wd = elm_widget_data_get(obj); + + if (wd->hook.console_message) + wd->hook.console_message(wd->hook.console_message_data, obj, message, + line_number, source_id); +} + +static Eina_Bool +_view_smart_focus_can_cycle(Ewk_View_Smart_Data *sd, Ewk_Focus_Direction direction) +{ + Evas_Object *obj = evas_object_smart_parent_get(sd->self); + Elm_Focus_Direction dir; + + switch (direction) + { + case EWK_FOCUS_DIRECTION_FORWARD: + dir = ELM_FOCUS_NEXT; + break; + case EWK_FOCUS_DIRECTION_BACKWARD: + dir = ELM_FOCUS_PREVIOUS; + break; + default: + return EINA_FALSE; + } + + elm_widget_focus_cycle(elm_widget_parent_get(obj), dir); + + return EINA_TRUE; +} + +/** + * Creates a new view object given the parent. + * + * @param parent object to use as parent. + * + * @return newly added Evas_Object or @c NULL on errors. + */ +Evas_Object * +_view_add(Evas_Object *parent) +{ + static Evas_Smart *smart = NULL; + Evas *canvas = evas_object_evas_get(parent); + Evas_Object *view; + + if (!smart) + { + static Ewk_View_Smart_Class api = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("EWK_View_Elementary"); + +#ifndef TILED_BACKING_STORE + ewk_view_single_smart_set(&api); +#else + ewk_view_tiled_smart_set(&api); +#endif + + _parent_sc = api; + + // TODO: check every api method and provide overrides with hooks! + // TODO: hooks should provide extension points + // TODO: extension should have some kind of "default implementation", + // TODO: that can be replaced or controlled by hooks. + // TODO: ie: run_javascript_alert() should present an elm_win + // TODO: by default, but user could override it to show as inwin. + api.sc.add = _view_smart_add; + api.sc.del = _view_smart_del; + //api.sc.calculate = _view_smart_calculate; + api.mouse_down = _view_smart_mouse_down; + api.mouse_up = _view_smart_mouse_up; + api.mouse_move = _view_smart_mouse_move; + api.add_console_message = _view_smart_add_console_message; + api.window_create = _view_smart_window_create; + api.window_close = _view_smart_window_close; + api.run_javascript_alert = _view_smart_run_javascript_alert; + api.run_javascript_confirm = _view_smart_run_javascript_confirm; + api.run_javascript_prompt = _view_smart_run_javascript_prompt; + api.run_open_panel = _view_smart_run_open_panel; + api.focus_can_cycle = _view_smart_focus_can_cycle; + + smart = evas_smart_class_new(&api.sc); + if (!smart) + { + CRITICAL("Could not create smart class"); + return NULL; + } + } + + view = evas_object_smart_add(canvas, smart); + if (!view) + { + ERR("Could not create smart object object for view"); + return NULL; + } + + return view; +} + +static void +_ewk_view_inputmethod_change_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info) +{ + Widget_Data *wd = data; + Evas_Object *top = elm_widget_top_get(wd->self); + if (!top) return; + + if (event_info) + wd->input_method = ELM_WIN_KEYBOARD_ON; + else + wd->input_method = ELM_WIN_KEYBOARD_OFF; + elm_win_keyboard_mode_set(top, wd->input_method); +} + +static void +_ewk_view_load_started_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + _ewk_view_inputmethod_change_cb(data, obj, (void *)(long)EINA_FALSE); +} + +static void +_ewk_view_load_finished_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info) +{ + Widget_Data *wd = data; + + if (event_info) + return; + + if (wd->zoom.mode != ELM_WEB_ZOOM_MODE_MANUAL) + { + float tz = wd->zoom.current; + wd->zoom.current = 0.0; + elm_web_zoom_set(wd->self, tz); + } +} + +static void +_ewk_view_viewport_changed_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Widget_Data *wd = data; + + if (wd->zoom.mode != ELM_WEB_ZOOM_MODE_MANUAL) + { + ewk_view_zoom_set(obj, 1.0, 0, 0); + wd->zoom.no_anim = EINA_TRUE; + } +} + +static Eina_Bool +_restore_zoom_mode_timer_cb(void *data) +{ + Widget_Data *wd = data; + float tz = wd->zoom.current; + wd->zoom.timer = NULL; + wd->zoom.current = 0.0; + wd->zoom.no_anim = EINA_TRUE; + elm_web_zoom_set(wd->self, tz); + return EINA_FALSE; +} + +static Eina_Bool +_reset_zoom_timer_cb(void *data) +{ + Widget_Data *wd = data; + wd->zoom.timer = ecore_timer_add(0.0, _restore_zoom_mode_timer_cb, wd); + ewk_view_zoom_set(wd->ewk_view, 1.0, 0, 0); + return EINA_FALSE; +} + +static void +_ewk_view_resized_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Widget_Data *wd = data; + if (!(wd->zoom.mode != ELM_WEB_ZOOM_MODE_MANUAL)) + return; + if (wd->zoom.timer) + ecore_timer_del(wd->zoom.timer); + wd->zoom.timer = ecore_timer_add(0.5, _reset_zoom_timer_cb, wd); +} + +static void +_popup_del_job(void *data) +{ + evas_object_del(data); +} + +static void +_popup_will_delete(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + ecore_job_add(_popup_del_job, data); + evas_object_smart_callback_del(obj, "popup,willdelete", _popup_will_delete); +} + +static void +_popup_item_selected(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Evas_Object *view = data; + Elm_Object_Item *list_it = elm_list_selected_item_get(obj); + const Eina_List *itr, *list = elm_list_items_get(obj); + void *d; + int i = 0; + + EINA_LIST_FOREACH(list, itr, d) + { + if (d == list_it) + break; + + i++; + } + + ewk_view_popup_selected_set(view, i); + ewk_view_popup_destroy(view); +} + +static void +_popup_dismiss_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + ewk_view_popup_destroy(data); +} + +static void +_ewk_view_popup_create_cb(void *data, Evas_Object *obj, void *event_info) +{ + Widget_Data *wd = data; + Ewk_Menu *m = event_info; + Elm_Web_Menu m2; + Ewk_Menu_Item *it; + Eina_List *itr; + Evas_Object *notify, *list; + + m2.items = m->items; + m2.x = m->x; + m2.y = m->y; + m2.width = m->width; + m2.height = m->height; + m2.handled = EINA_FALSE; + evas_object_smart_callback_call(wd->self, "popup,create", &m2); + if (m2.handled) + return; + + notify = elm_notify_add(obj); + elm_notify_allow_events_set(notify, EINA_FALSE); + elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM); + + list = elm_list_add(obj); + elm_list_select_mode_set(data, ELM_OBJECT_SELECT_MODE_ALWAYS); + elm_list_bounce_set(list, EINA_FALSE, EINA_FALSE); + elm_list_mode_set(list, ELM_LIST_EXPAND); + evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_content_set(notify, list); + evas_object_show(list); + + EINA_LIST_FOREACH(m->items, itr, it) + elm_list_item_append(list, it->text, NULL, NULL, _popup_item_selected, + obj); + elm_list_go(list); + + evas_object_show(notify); + + evas_object_smart_callback_add(obj, "popup,willdelete", _popup_will_delete, + notify); + evas_object_smart_callback_add(notify, "block,clicked", _popup_dismiss_cb, + obj); +} + +static void +_view_smart_callback_proxy_free_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + free(data); +} + +static void +_view_smart_callback_proxy_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info) +{ + Elm_Web_Callback_Proxy_Context *ctxt = data; + + evas_object_smart_callback_call(ctxt->obj, ctxt->name, event_info); +} + +static void +_view_smart_callback_proxy(Evas_Object *view, Evas_Object *parent) +{ + const Evas_Smart_Cb_Description **cls_descs, **inst_descs; + unsigned int cls_count, inst_count, total; + Elm_Web_Callback_Proxy_Context *ctxt; + + evas_object_smart_callbacks_descriptions_get(view, &cls_descs, &cls_count, + &inst_descs, &inst_count); + total = cls_count + inst_count; + if (!total) return; + ctxt = malloc(sizeof(Elm_Web_Callback_Proxy_Context) * total); + if (!ctxt) return; + evas_object_event_callback_add(view, EVAS_CALLBACK_FREE, + _view_smart_callback_proxy_free_cb, ctxt); + + for (; cls_count > 0; cls_count--, cls_descs++, ctxt++) + { + const Evas_Smart_Cb_Description *d = *cls_descs; + if (!strcmp(d->name, "popup,create")) + continue; + ctxt->name = d->name; + ctxt->obj = parent; + evas_object_smart_callback_add(view, d->name, + _view_smart_callback_proxy_cb, ctxt); + } + + for (; inst_count > 0; inst_count--, inst_descs++, ctxt++) + { + const Evas_Smart_Cb_Description *d = *inst_descs; + ctxt->name = d->name; + ctxt->obj = parent; + evas_object_smart_callback_add(view, d->name, + _view_smart_callback_proxy_cb, ctxt); + } +} + +static Eina_Bool +_bring_in_anim_cb(void *data, double pos) +{ + Widget_Data *wd = data; + Evas_Object *frame = ewk_view_frame_main_get(wd->ewk_view); + int sx, sy, rx, ry; + + sx = wd->bring_in.start.x; + sy = wd->bring_in.start.y; + rx = (wd->bring_in.end.x - sx) * pos; + ry = (wd->bring_in.end.y - sy) * pos; + + ewk_frame_scroll_set(frame, rx + sx, ry + sy); + + if (pos == 1.0) + { + wd->bring_in.end.x = wd->bring_in.end.y = wd->bring_in.start.x = + wd->bring_in.start.y = 0; + wd->bring_in.animator = NULL; + } + + return EINA_TRUE; +} +#endif + +#ifdef HAVE_ELEMENTARY_WEB +static int _elm_need_web = 0; +#endif + +void +_elm_unneed_web(void) +{ +#ifdef HAVE_ELEMENTARY_WEB + if (--_elm_need_web) return; + + _elm_need_web = 0; + ewk_shutdown(); +#endif +} + +EAPI Eina_Bool +elm_need_web(void) +{ +#ifdef HAVE_ELEMENTARY_WEB + if (_elm_need_web++) return EINA_TRUE; + ewk_init(); + return EINA_TRUE; +#else + return EINA_FALSE; +#endif +} + +EAPI Evas_Object * +elm_web_add(Evas_Object *parent) +{ + Evas_Object *obj; + Widget_Data *wd; + Evas *e; + + EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); + + wd = calloc(1, sizeof(Widget_Data)); + e = evas_object_evas_get(parent); + if (!e) + return NULL; + obj = elm_widget_add(e); + wd->self = obj; + + if (!widtype) + { + widtype = eina_stringshare_add("web"); + elm_widget_type_register(&widtype); + } + + elm_widget_type_set(obj, widtype); + elm_widget_sub_object_add(parent, obj); + elm_widget_theme_hook_set(obj, _theme_hook); + elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + elm_widget_event_hook_set(obj, _event_hook); + elm_widget_data_set(obj, wd); + elm_widget_can_focus_set(obj, EINA_TRUE); + +#ifdef HAVE_ELEMENTARY_WEB + wd->ewk_view = _view_add(obj); + ewk_view_setting_user_agent_set(wd->ewk_view, ELM_WEB_USER_AGENT); + + wd->input_method = ELM_WIN_KEYBOARD_OFF; + evas_object_smart_callback_add(wd->ewk_view, "inputmethod,changed", + _ewk_view_inputmethod_change_cb, wd); + evas_object_smart_callback_add(wd->ewk_view, "load,started", + _ewk_view_load_started_cb, wd); + evas_object_smart_callback_add(wd->ewk_view, "popup,create", + _ewk_view_popup_create_cb, wd); + evas_object_smart_callback_add(wd->ewk_view, "load,finished", + _ewk_view_load_finished_cb, wd); + evas_object_smart_callback_add(wd->ewk_view, "viewport,changed", + _ewk_view_viewport_changed_cb, wd); + evas_object_smart_callback_add(wd->ewk_view, "view,resized", + _ewk_view_resized_cb, wd); + + elm_widget_resize_object_set(obj, wd->ewk_view); + + wd->tab_propagate = EINA_FALSE; + wd->inwin_mode = _elm_config->inwin_dialogs_enable; + wd->zoom.min = ewk_view_zoom_range_min_get(wd->ewk_view); + wd->zoom.max = ewk_view_zoom_range_max_get(wd->ewk_view); + wd->zoom.current = 1.0; + + _view_smart_callback_proxy(wd->ewk_view, wd->self); + evas_object_smart_callbacks_descriptions_set(obj, _elm_web_callback_names); + + _theme_hook(obj); + +#else + wd->label = elm_label_add(obj); + elm_object_text_set(wd->label, "WebKit not supported!"); + evas_object_show(wd->label); + elm_widget_resize_object_set(obj, wd->label); +#endif + + return obj; +} + +EAPI Evas_Object * +elm_web_webkit_view_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->ewk_view; +#else + ERR("Elementary not compiled with EWebKit support."); + return NULL; +#endif +} + +EAPI void +elm_web_window_create_hook_set(Evas_Object *obj, Elm_Web_Window_Open func, void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype); +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->hook.window_create = func; + wd->hook.window_create_data = data; +#else + (void)func; + (void)data; +#endif +} + +EAPI void +elm_web_dialog_alert_hook_set(Evas_Object *obj, Elm_Web_Dialog_Alert func, void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype); +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->hook.alert = func; + wd->hook.alert_data = data; +#else + (void)func; + (void)data; +#endif +} + +EAPI void +elm_web_dialog_confirm_hook_set(Evas_Object *obj, Elm_Web_Dialog_Confirm func, void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype); +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->hook.confirm = func; + wd->hook.confirm_data = data; +#else + (void)func; + (void)data; +#endif +} + +EAPI void +elm_web_dialog_prompt_hook_set(Evas_Object *obj, Elm_Web_Dialog_Prompt func, void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype); +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->hook.prompt = func; + wd->hook.prompt_data = data; +#else + (void)func; + (void)data; +#endif +} + +EAPI void +elm_web_dialog_file_selector_hook_set(Evas_Object *obj, Elm_Web_Dialog_File_Selector func, void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype); +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->hook.file_selector = func; + wd->hook.file_selector_data = data; +#else + (void)func; + (void)data; +#endif +} + +EAPI void +elm_web_console_message_hook_set(Evas_Object *obj, Elm_Web_Console_Message func, void *data) +{ + ELM_CHECK_WIDTYPE(obj, widtype); +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->hook.console_message = func; + wd->hook.console_message_data = data; +#else + (void)func; + (void)data; +#endif +} + +EAPI void +elm_web_useragent_set(Evas_Object *obj, const char *user_agent) +{ + ELM_CHECK_WIDTYPE(obj, widtype); +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + ewk_view_setting_user_agent_set(wd->ewk_view, user_agent); +#else + (void)user_agent; +#endif +} + +EAPI const char* +elm_web_useragent_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return ewk_view_setting_user_agent_get(wd->ewk_view); +#else + return NULL; +#endif +} + +EAPI Eina_Bool +elm_web_tab_propagate_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->tab_propagate; +#else + return EINA_FALSE; +#endif +} + +EAPI void +elm_web_tab_propagate_set(Evas_Object *obj, Eina_Bool propagate) +{ + ELM_CHECK_WIDTYPE(obj, widtype); +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + wd->tab_propagate = propagate; +#else + (void)propagate; +#endif +} + +EAPI Eina_Bool +elm_web_uri_set(Evas_Object *obj, const char *uri) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return ewk_view_uri_set(wd->ewk_view, uri); +#else + (void)uri; + return EINA_FALSE; +#endif +} + +EAPI const char * +elm_web_uri_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return ewk_view_uri_get(wd->ewk_view); +#else + return NULL; +#endif +} + +EAPI const char * +elm_web_title_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return ewk_view_title_get(wd->ewk_view); +#else + return NULL; +#endif +} + +EAPI void +elm_web_bg_color_set(Evas_Object *obj, int r, int g, int b, int a) +{ + ELM_CHECK_WIDTYPE(obj, widtype); +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + ewk_view_bg_color_set(wd->ewk_view, r, g, b, a); +#else + (void)r; + (void)g; + (void)b; + (void)a; +#endif +} + +EAPI void +elm_web_bg_color_get(const Evas_Object *obj, int *r, int *g, int *b, int *a) +{ + if (r) *r = 0; + if (g) *g = 0; + if (b) *b = 0; + if (a) *a = 0; + ELM_CHECK_WIDTYPE(obj, widtype); +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + return ewk_view_bg_color_get(wd->ewk_view, r, g, b, a); +#endif +} + +EAPI char * +elm_web_selection_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return ewk_view_selection_get(wd->ewk_view); +#else + return NULL; +#endif +} + +EAPI void +elm_web_popup_selected_set(Evas_Object *obj, int idx) +{ + ELM_CHECK_WIDTYPE(obj, widtype); +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + ewk_view_popup_selected_set(wd->ewk_view, idx); +#else + (void)idx; +#endif +} + +EAPI Eina_Bool +elm_web_popup_destroy(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + return ewk_view_popup_destroy(wd->ewk_view); +#else + return EINA_FALSE; +#endif +} + +EAPI Eina_Bool +elm_web_text_search(const Evas_Object *obj, const char *string, Eina_Bool case_sensitive, Eina_Bool forward, Eina_Bool wrap) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return ewk_view_text_search + (wd->ewk_view, string, case_sensitive, forward, wrap); +#else + (void)string; + (void)case_sensitive; + (void)forward; + (void)wrap; + return EINA_FALSE; +#endif +} + +EAPI unsigned int +elm_web_text_matches_mark(Evas_Object *obj, const char *string, Eina_Bool case_sensitive, Eina_Bool highlight, unsigned int limit) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; + return ewk_view_text_matches_mark + (wd->ewk_view, string, case_sensitive, highlight, limit); +#else + (void)string; + (void)case_sensitive; + (void)highlight; + (void)limit; + return 0; +#endif +} + +EAPI Eina_Bool +elm_web_text_matches_unmark_all(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return ewk_view_text_matches_unmark_all(wd->ewk_view); +#else + return EINA_FALSE; +#endif +} + +EAPI Eina_Bool +elm_web_text_matches_highlight_set(Evas_Object *obj, Eina_Bool highlight) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return ewk_view_text_matches_highlight_set(wd->ewk_view, highlight); +#else + (void)highlight; + return EINA_FALSE; +#endif +} + +EAPI Eina_Bool +elm_web_text_matches_highlight_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return ewk_view_text_matches_highlight_get(wd->ewk_view); +#else + return EINA_FALSE; +#endif +} + +EAPI double +elm_web_load_progress_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) -1.0; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return -1.0; + return ewk_view_load_progress_get(wd->ewk_view); +#else + return EINA_FALSE; +#endif +} + +EAPI Eina_Bool +elm_web_stop(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return ewk_view_stop(wd->ewk_view); +#else + return EINA_FALSE; +#endif +} + +EAPI Eina_Bool +elm_web_reload(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return ewk_view_reload(wd->ewk_view); +#else + return EINA_FALSE; +#endif +} + +EAPI Eina_Bool +elm_web_reload_full(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return ewk_view_reload_full(wd->ewk_view); +#else + return EINA_FALSE; +#endif +} + + +EAPI Eina_Bool +elm_web_back(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return ewk_view_back(wd->ewk_view); +#else + return EINA_FALSE; +#endif +} + +EAPI Eina_Bool +elm_web_forward(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return ewk_view_forward(wd->ewk_view); +#else + return EINA_FALSE; +#endif +} + +EAPI Eina_Bool +elm_web_navigate(Evas_Object *obj, int steps) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return ewk_view_navigate(wd->ewk_view, steps); +#else + return EINA_FALSE; + (void)steps; +#endif +} + +EINA_DEPRECATED EAPI Eina_Bool +elm_web_back_possible(Evas_Object *obj) +{ + return elm_web_back_possible_get(obj); +} + +EAPI Eina_Bool +elm_web_back_possible_get(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return ewk_view_back_possible(wd->ewk_view); +#else + return EINA_FALSE; +#endif +} + +EAPI Eina_Bool +elm_web_forward_possible_get(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return ewk_view_forward_possible(wd->ewk_view); +#else + return EINA_FALSE; +#endif +} + +EAPI Eina_Bool +elm_web_navigate_possible_get(Evas_Object *obj, int steps) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return ewk_view_navigate_possible(wd->ewk_view, steps); +#else + return EINA_FALSE; + (void)steps; +#endif +} + +EAPI Eina_Bool +elm_web_history_enabled_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return ewk_view_history_enable_get(wd->ewk_view); +#else + return EINA_FALSE; +#endif +} + +EAPI void +elm_web_history_enabled_set(Evas_Object *obj, Eina_Bool enable) +{ + ELM_CHECK_WIDTYPE(obj, widtype); +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + ewk_view_history_enable_set(wd->ewk_view, enable); +#else + (void)enable; +#endif +} + +//EAPI Ewk_History *ewk_view_history_get(const Evas_Object *obj); // TODO: + +EAPI void +elm_web_zoom_set(Evas_Object *obj, double zoom) +{ + ELM_CHECK_WIDTYPE(obj, widtype); +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + int vw, vh, cx, cy; + float z = 1.0; + evas_object_geometry_get(wd->ewk_view, NULL, NULL, &vw, &vh); + cx = vw / 2; + cy = vh / 2; + if (zoom > wd->zoom.max) + zoom = wd->zoom.max; + else if (zoom < wd->zoom.min) + zoom = wd->zoom.min; + if (zoom == wd->zoom.current) return; + wd->zoom.current = zoom; + if (wd->zoom.mode == ELM_WEB_ZOOM_MODE_MANUAL) + z = zoom; + else if (wd->zoom.mode == ELM_WEB_ZOOM_MODE_AUTO_FIT) + { + Evas_Object *frame = ewk_view_frame_main_get(wd->ewk_view); + Evas_Coord fw, fh, pw, ph; + if (!ewk_frame_contents_size_get(frame, &fw, &fh)) + return; + z = ewk_frame_page_zoom_get(frame); + fw /= z; + fh /= z; + if ((fw > 0) && (fh > 0)) + { + ph = (fh * vw) / fw; + if (ph > vh) + { + pw = (fw * vh) / fh; + ph = vh; + } + else + pw = vw; + if (fw > fh) + z = (float)pw / fw; + else + z = (float)ph / fh; + } + } + else if (wd->zoom.mode == ELM_WEB_ZOOM_MODE_AUTO_FILL) + { + Evas_Object *frame = ewk_view_frame_main_get(wd->ewk_view); + Evas_Coord fw, fh, pw, ph; + if (!ewk_frame_contents_size_get(frame, &fw, &fh)) + return; + z = ewk_frame_page_zoom_get(frame); + fw /= z; + fh /= z; + if ((fw > 0) && (fh > 0)) + { + ph = (fh * vw) / fw; + if (ph < vh) + { + pw = (fw * vh) / fh; + ph = vh; + } + else + pw = vw; + if (fw > fh) + z = (float)pw / fw; + else + z = (float)ph / fh; + } + } + if (wd->zoom.no_anim) + ewk_view_zoom_set(wd->ewk_view, z, cx, cy); + else + ewk_view_zoom_animated_set(wd->ewk_view, z, _elm_config->zoom_friction, + cx, cy); + wd->zoom.no_anim = EINA_FALSE; +#else + (void)zoom; +#endif +} + +EAPI double +elm_web_zoom_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) -1.0; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + return wd->zoom.current; +#else + return -1.0; +#endif +} + +EAPI void +elm_web_zoom_mode_set(Evas_Object *obj, Elm_Web_Zoom_Mode mode) +{ + ELM_CHECK_WIDTYPE(obj, widtype); +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + float tz; + if (mode >= ELM_WEB_ZOOM_MODE_LAST) + return; + if (mode == wd->zoom.mode) + return; + wd->zoom.mode = mode; + tz = wd->zoom.current; + wd->zoom.current = 0.0; + elm_web_zoom_set(obj, tz); +#else + (void)mode; +#endif +} + +EAPI Elm_Web_Zoom_Mode +elm_web_zoom_mode_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_WEB_ZOOM_MODE_LAST; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + return wd->zoom.mode; +#else + return ELM_WEB_ZOOM_MODE_LAST; +#endif +} + +EAPI void +elm_web_region_show(Evas_Object *obj, int x, int y, int w __UNUSED__, int h __UNUSED__) +{ + ELM_CHECK_WIDTYPE(obj, widtype); +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *frame = ewk_view_frame_main_get(wd->ewk_view); + int fw, fh, zw, zh, rx, ry; + float zoom; + ewk_frame_contents_size_get(frame, &fw, &fh); + zoom = ewk_frame_page_zoom_get(frame); + zw = fw / zoom; + zh = fh / zoom; + rx = (x * fw) / zw; + ry = (y * fh) / zh; + if (wd->bring_in.animator) + { + ecore_animator_del(wd->bring_in.animator); + wd->bring_in.animator = NULL; + } + ewk_frame_scroll_set(frame, rx, ry); +#else + (void)x; + (void)y; +#endif +} + +EAPI void +elm_web_region_bring_in(Evas_Object *obj, int x, int y, int w __UNUSED__, int h __UNUSED__) +{ + ELM_CHECK_WIDTYPE(obj, widtype); +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *frame = ewk_view_frame_main_get(wd->ewk_view); + int fw, fh, zw, zh, rx, ry, sx, sy; + float zoom; + ewk_frame_contents_size_get(frame, &fw, &fh); + ewk_frame_scroll_pos_get(frame, &sx, &sy); + zoom = ewk_frame_page_zoom_get(frame); + zw = fw / zoom; + zh = fh / zoom; + rx = (x * fw) / zw; + ry = (y * fh) / zh; + if ((wd->bring_in.end.x == rx) && (wd->bring_in.end.y == ry)) + return; + wd->bring_in.start.x = sx; + wd->bring_in.start.y = sy; + wd->bring_in.end.x = rx; + wd->bring_in.end.y = ry; + if (wd->bring_in.animator) + ecore_animator_del(wd->bring_in.animator); + wd->bring_in.animator = ecore_animator_timeline_add( + _elm_config->bring_in_scroll_friction, _bring_in_anim_cb, wd); +#else + (void)x; + (void)y; +#endif +} + +EAPI void +elm_web_inwin_mode_set(Evas_Object *obj, Eina_Bool value) +{ + ELM_CHECK_WIDTYPE(obj, widtype); +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + + wd->inwin_mode = value; +#else + (void)value; +#endif +} + +EAPI Eina_Bool +elm_web_inwin_mode_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; +#ifdef HAVE_ELEMENTARY_WEB + Widget_Data *wd = elm_widget_data_get(obj); + + return wd->inwin_mode; +#else + return EINA_FALSE; +#endif +} + +EAPI void +elm_web_window_features_ref(Elm_Web_Window_Features *wf) +{ +#ifdef HAVE_ELEMENTARY_WEB + ewk_window_features_ref((Ewk_Window_Features *)wf); +#else + (void)wf; +#endif +} + +EAPI void +elm_web_window_features_unref(Elm_Web_Window_Features *wf) +{ +#ifdef HAVE_ELEMENTARY_WEB + ewk_window_features_unref((Ewk_Window_Features *)wf); +#else + (void)wf; +#endif +} + +EAPI Eina_Bool +elm_web_window_features_property_get(const Elm_Web_Window_Features *wf, Elm_Web_Window_Feature_Flag flag) +{ +#ifdef HAVE_ELEMENTARY_WEB + Eina_Bool toolbar_visible, statusbar_visible; + Eina_Bool scrollbars_visible, menubar_visible; + Eina_Bool locationbar_visible, fullscreen; + + ewk_window_features_bool_property_get((const Ewk_Window_Features *)wf, + &toolbar_visible, &statusbar_visible, + &scrollbars_visible, &menubar_visible, + &locationbar_visible, &fullscreen); + + //TODO : Improve ewk API usage to get one value. + // + switch(flag) + { + case ELM_WEB_WINDOW_FEATURE_TOOLBAR: + return toolbar_visible; + break; + case ELM_WEB_WINDOW_FEATURE_STATUSBAR: + return statusbar_visible; + break; + case ELM_WEB_WINDOW_FEATURE_SCROLLBARS: + return scrollbars_visible; + break; + case ELM_WEB_WINDOW_FEATURE_MENUBAR: + return menubar_visible; + break; + case ELM_WEB_WINDOW_FEATURE_LOCATIONBAR: + return locationbar_visible; + break; + case ELM_WEB_WINDOW_FEATURE_FULLSCREEN: + return fullscreen; + break; + } +#else + + if (!wf) return EINA_FALSE; + if (flag==ELM_WEB_WINDOW_FEATURE_TOOLBAR) + { + //TODO Handle unused variable warnings when + //ewk is not installed. + } + + /* What to do with these ? + + (void)wf; + (void)toolbar_visible; + (void)statusbar_visible; + (void)scrollbars_visible; + (void)menubar_visible; + (void)locationbar_visible; + (void)fullscreen; + + */ + +#endif + return EINA_FALSE; +} + +EAPI void +elm_web_window_features_region_get(const Elm_Web_Window_Features *wf, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) +{ +#ifdef HAVE_ELEMENTARY_WEB + ewk_window_features_int_property_get((const Ewk_Window_Features *)wf, + x, y, w, h); +#else + + if (!wf || !x || !y || !w || !h) return; + /* What to do with these ? + + (void)wf; + (void)x; + (void)y; + (void)w; + (void)h; + + */ + +#endif +} + +// TODO: use all ewk_view_zoom stuff to implement bring-in and animated zoom like elm_photocam. Should be simple to use, must not expose every single bit to users! diff --git a/libraries/elementary/src/lib/elm_web.h b/libraries/elementary/src/lib/elm_web.h new file mode 100644 index 0000000..b465906 --- /dev/null +++ b/libraries/elementary/src/lib/elm_web.h @@ -0,0 +1,1060 @@ +/** + * @defgroup Web Web + * @ingroup Elementary + * + * @image html img/widget/web/preview-00.png + * @image latex img/widget/web/preview-00.eps + * + * A web widget is used for displaying web pages (HTML/CSS/JS) + * using WebKit-EFL. You must have compiled Elementary with + * ewebkit support. + * + * Signals that you can add callbacks for are: + * @li "download,request": A file download has been requested. Event info is + * a pointer to a Elm_Web_Download + * @li "editorclient,contents,changed": Editor client's contents changed + * @li "editorclient,selection,changed": Editor client's selection changed + * @li "frame,created": A new frame was created. Event info is an + * Evas_Object which can be handled with WebKit's ewk_frame API + * @li "icon,received": An icon was received by the main frame + * @li "inputmethod,changed": Input method changed. Event info is an + * Eina_Bool indicating whether it's enabled or not + * @li "js,windowobject,clear": JS window object has been cleared + * @li "link,hover,in": Mouse cursor is hovering over a link. Event info + * is a char *link[2], where the first string contains the URL the link + * points to, and the second one the title of the link + * @li "link,hover,out": Mouse cursor left the link + * @li "load,document,finished": Loading of a document finished. Event info + * is the frame that finished loading + * @li "load,error": Load failed. Event info is a pointer to + * Elm_Web_Frame_Load_Error + * @li "load,finished": Load finished. Event info is NULL on success, on + * error it's a pointer to Elm_Web_Frame_Load_Error + * @li "load,newwindow,show": A new window was created and is ready to be + * shown + * @li "load,progress": Overall load progress. Event info is a pointer to + * a double containing a value between 0.0 and 1.0 + * @li "load,provisional": Started provisional load + * @li "load,started": Loading of a document started + * @li "menubar,visible,get": Queries if the menubar is visible. Event info + * is a pointer to Eina_Bool where the callback should set EINA_TRUE if + * the menubar is visible, or EINA_FALSE in case it's not + * @li "menubar,visible,set": Informs menubar visibility. Event info is + * an Eina_Bool indicating the visibility + * @li "popup,created": A dropdown widget was activated, requesting its + * popup menu to be created. Event info is a pointer to Elm_Web_Menu + * @li "popup,willdelete": The web object is ready to destroy the popup + * object created. Event info is a pointer to Elm_Web_Menu + * @li "ready": Page is fully loaded + * @li "scrollbars,visible,get": Queries visibility of scrollbars. Event + * info is a pointer to Eina_Bool where the visibility state should be set + * @li "scrollbars,visible,set": Informs scrollbars visibility. Event info + * is an Eina_Bool with the visibility state set + * @li "statusbar,text,set": Text of the statusbar changed. Even info is + * a string with the new text + * @li "statusbar,visible,get": Queries visibility of the status bar. + * Event info is a pointer to Eina_Bool where the visibility state should be + * set. + * @li "statusbar,visible,set": Informs statusbar visibility. Event info is + * an Eina_Bool with the visibility value + * @li "title,changed": Title of the main frame changed. Event info is a + * string with the new title + * @li "toolbars,visible,get": Queries visibility of toolbars. Event info + * is a pointer to Eina_Bool where the visibility state should be set + * @li "toolbars,visible,set": Informs the visibility of toolbars. Event + * info is an Eina_Bool with the visibility state + * @li "tooltip,text,set": Show and set text of a tooltip. Event info is + * a string with the text to show + * @li "uri,changed": URI of the main frame changed. Event info is a string + * with the new URI + * @li "view,resized": The web object internal's view changed sized + * @li "windows,close,request": A JavaScript request to close the current + * window was requested + * @li "zoom,animated,end": Animated zoom finished + * + * available styles: + * - default + * + * An example of use of web: + * + * - @ref web_example_01 TBD + */ + +/** + * @addtogroup Web + * @{ + */ + +/** + * Structure used to report load errors. + * + * Load errors are reported as signal by elm_web. All the strings are + * temporary references and should @b not be used after the signal + * callback returns. If it's required, make copies with strdup() or + * eina_stringshare_add() (they are not even guaranteed to be + * stringshared, so must use eina_stringshare_add() and not + * eina_stringshare_ref()). + */ +typedef struct _Elm_Web_Frame_Load_Error Elm_Web_Frame_Load_Error; + +/** + * Structure used to report load errors. + * + * Load errors are reported as signal by elm_web. All the strings are + * temporary references and should @b not be used after the signal + * callback returns. If it's required, make copies with strdup() or + * eina_stringshare_add() (they are not even guaranteed to be + * stringshared, so must use eina_stringshare_add() and not + * eina_stringshare_ref()). + */ +struct _Elm_Web_Frame_Load_Error +{ + int code; /**< Numeric error code */ + Eina_Bool is_cancellation; /**< Error produced by canceling a request */ + const char *domain; /**< Error domain name */ + const char *description; /**< Error description (already localized) */ + const char *failing_url; /**< The URL that failed to load */ + Evas_Object *frame; /**< Frame object that produced the error */ +}; + +/** + * The possibles types that the items in a menu can be + */ +typedef enum +{ + ELM_WEB_MENU_SEPARATOR, + ELM_WEB_MENU_GROUP, + ELM_WEB_MENU_OPTION +} Elm_Web_Menu_Item_Type; + +/** + * Structure describing the items in a menu + */ +typedef struct _Elm_Web_Menu_Item Elm_Web_Menu_Item; + +/** + * Structure describing the items in a menu + */ +struct _Elm_Web_Menu_Item +{ + const char *text; /**< The text for the item */ + Elm_Web_Menu_Item_Type type; /**< The type of the item */ +}; + +/** + * Structure describing the menu of a popup + * + * This structure will be passed as the @c event_info for the "popup,create" + * signal, which is emitted when a dropdown menu is opened. Users wanting + * to handle these popups by themselves should listen to this signal and + * set the @c handled property of the struct to @c EINA_TRUE. Leaving this + * property as @c EINA_FALSE means that the user will not handle the popup + * and the default implementation will be used. + * + * When the popup is ready to be dismissed, a "popup,willdelete" signal + * will be emitted to notify the user that it can destroy any objects and + * free all data related to it. + * + * @see elm_web_popup_selected_set() + * @see elm_web_popup_destroy() + * + * @ingroup Web + */ +typedef struct _Elm_Web_Menu Elm_Web_Menu; + +/** + * Structure describing the menu of a popup + * + * This structure will be passed as the @c event_info for the "popup,create" + * signal, which is emitted when a dropdown menu is opened. Users wanting + * to handle these popups by themselves should listen to this signal and + * set the @c handled property of the struct to @c EINA_TRUE. Leaving this + * property as @c EINA_FALSE means that the user will not handle the popup + * and the default implementation will be used. + * + * When the popup is ready to be dismissed, a "popup,willdelete" signal + * will be emitted to notify the user that it can destroy any objects and + * free all data related to it. + * + * @see elm_web_popup_selected_set() + * @see elm_web_popup_destroy() + * + * @ingroup Web + */ +struct _Elm_Web_Menu +{ + Eina_List *items; /**< List of #Elm_Web_Menu_Item */ + int x; /**< The X position of the popup, relative to the elm_web object */ + int y; /**< The Y position of the popup, relative to the elm_web object */ + int width; /**< Width of the popup menu */ + int height; /**< Height of the popup menu */ + + Eina_Bool handled : 1; /**< Set to @c EINA_TRUE by the user to indicate that the popup has been handled and the default implementation should be ignored. Leave as @c EINA_FALSE otherwise. */ +}; + +typedef struct _Elm_Web_Download Elm_Web_Download; +struct _Elm_Web_Download +{ + const char *url; +}; + +/** + * Types of zoom available. + */ +typedef enum +{ + ELM_WEB_ZOOM_MODE_MANUAL = 0, /**< Zoom controlled normally by elm_web_zoom_set */ + ELM_WEB_ZOOM_MODE_AUTO_FIT, /**< Zoom until content fits in web object */ + ELM_WEB_ZOOM_MODE_AUTO_FILL, /**< Zoom until content fills web object */ + ELM_WEB_ZOOM_MODE_LAST +} Elm_Web_Zoom_Mode; + +/** + * Opaque handler containing the features (such as statusbar, menubar, etc) + * that are to be set on a newly requested window. + */ +typedef struct _Elm_Web_Window_Features Elm_Web_Window_Features; + + +/** + * Definitions of web window features. + * + */ +typedef enum +{ + ELM_WEB_WINDOW_FEATURE_TOOLBAR, + ELM_WEB_WINDOW_FEATURE_STATUSBAR, + ELM_WEB_WINDOW_FEATURE_SCROLLBARS, + ELM_WEB_WINDOW_FEATURE_MENUBAR, + ELM_WEB_WINDOW_FEATURE_LOCATIONBAR, + ELM_WEB_WINDOW_FEATURE_FULLSCREEN +} Elm_Web_Window_Feature_Flag; + +/** + * Callback type for the create_window hook. + * + * The function parameters are: + * @li @p data User data pointer set when setting the hook function + * @li @p obj The elm_web object requesting the new window + * @li @p js Set to @c EINA_TRUE if the request was originated from + * JavaScript. @c EINA_FALSE otherwise. + * @li @p window_features A pointer of #Elm_Web_Window_Features indicating + * the features requested for the new window. + * + * The returned value of the function should be the @c elm_web widget where + * the request will be loaded. That is, if a new window or tab is created, + * the elm_web widget in it should be returned, and @b NOT the window + * object. + * Returning @c NULL should cancel the request. + * + * @see elm_web_window_create_hook_set() + * + * @ingroup Web + */ +typedef Evas_Object *(*Elm_Web_Window_Open)(void *data, Evas_Object *obj, Eina_Bool js, const Elm_Web_Window_Features *window_features); + +/** + * Callback type for the JS alert hook. + * + * The function parameters are: + * @li @p data User data pointer set when setting the hook function + * @li @p obj The elm_web object requesting the new window + * @li @p message The message to show in the alert dialog + * + * The function should return the object representing the alert dialog. + * Elm_Web will run a second main loop to handle the dialog and normal + * flow of the application will be restored when the object is deleted, so + * the user should handle the popup properly in order to delete the object + * when the action is finished. + * If the function returns @c NULL the popup will be ignored. + * + * @see elm_web_dialog_alert_hook_set() + * + * @ingroup Web + */ +typedef Evas_Object *(*Elm_Web_Dialog_Alert)(void *data, Evas_Object *obj, const char *message); + +/** + * Callback type for the JS confirm hook. + * + * The function parameters are: + * @li @p data User data pointer set when setting the hook function + * @li @p obj The elm_web object requesting the new window + * @li @p message The message to show in the confirm dialog + * @li @p ret Pointer to store the user selection. @c EINA_TRUE if + * the user selected @c Ok, @c EINA_FALSE otherwise. + * + * The function should return the object representing the confirm dialog. + * Elm_Web will run a second main loop to handle the dialog and normal + * flow of the application will be restored when the object is deleted, so + * the user should handle the popup properly in order to delete the object + * when the action is finished. + * If the function returns @c NULL the popup will be ignored. + * + * @see elm_web_dialog_confirm_hook_set() + * + * @ingroup Web + */ +typedef Evas_Object *(*Elm_Web_Dialog_Confirm)(void *data, Evas_Object *obj, const char *message, Eina_Bool *ret); + +/** + * Callback type for the JS prompt hook. + * + * The function parameters are: + * @li @p data User data pointer set when setting the hook function + * @li @p obj The elm_web object requesting the new window + * @li @p message The message to show in the prompt dialog + * @li @p def_value The default value to present the user in the entry + * @li @p value Pointer to store the value given by the user. Must + * be a malloc'ed string or @c NULL if the user canceled the popup. + * @li @p ret Pointer to store the user selection. @c EINA_TRUE if + * the user selected @c Ok, @c EINA_FALSE otherwise. + * + * The function should return the object representing the prompt dialog. + * Elm_Web will run a second main loop to handle the dialog and normal + * flow of the application will be restored when the object is deleted, so + * the user should handle the popup properly in order to delete the object + * when the action is finished. + * If the function returns @c NULL the popup will be ignored. + * + * @see elm_web_dialog_prompt_hook_set() + * + * @ingroup Web + */ +typedef Evas_Object *(*Elm_Web_Dialog_Prompt)(void *data, Evas_Object *obj, const char *message, const char *def_value, char **value, Eina_Bool *ret); + +/** + * Callback type for the JS file selector hook. + * + * The function parameters are: + * @li @p data User data pointer set when setting the hook function + * @li @p obj The elm_web object requesting the new window + * @li @p allows_multiple @c EINA_TRUE if multiple files can be selected. + * @li @p accept_types Mime types accepted + * @li @p selected Pointer to store the list of malloc'ed strings + * containing the path to each file selected. Must be @c NULL if the file + * dialog is canceled + * @li @p ret Pointer to store the user selection. @c EINA_TRUE if + * the user selected @c Ok, @c EINA_FALSE otherwise. + * + * The function should return the object representing the file selector + * dialog. + * Elm_Web will run a second main loop to handle the dialog and normal + * flow of the application will be restored when the object is deleted, so + * the user should handle the popup properly in order to delete the object + * when the action is finished. + * If the function returns @c NULL the popup will be ignored. + * + * @see elm_web_dialog_file selector_hook_set() + * + * @ingroup Web + */ +typedef Evas_Object *(*Elm_Web_Dialog_File_Selector)(void *data, Evas_Object *obj, Eina_Bool allows_multiple, Eina_List *accept_types, Eina_List **selected, Eina_Bool *ret); + +/** + * Callback type for the JS console message hook. + * + * When a console message is added from JavaScript, any set function to the + * console message hook will be called for the user to handle. There is no + * default implementation of this hook. + * + * The function parameters are: + * @li @p data User data pointer set when setting the hook function + * @li @p obj The elm_web object that originated the message + * @li @p message The message sent + * @li @p line_number The line number + * @li @p source_id Source id + * + * @see elm_web_console_message_hook_set() + * + * @ingroup Web + */ +typedef void (*Elm_Web_Console_Message)(void *data, Evas_Object *obj, const char *message, unsigned int line_number, const char *source_id); + +/** + * Add a new web object to the parent. + * + * @param parent The parent object. + * @return The new object or NULL if it cannot be created. + * + * @see elm_web_uri_set() + * @see elm_web_webkit_view_get() + * + * @ingroup Web + */ +EAPI Evas_Object *elm_web_add(Evas_Object *parent); + +/** + * Change useragent of a elm_web object + * + * @param obj The object + * @param user_agent String for useragent + * + * @ingroup Web + */ +EAPI void elm_web_useragent_set(Evas_Object *obj, const char *user_agent); + +/** + * Return current useragent of elm_web object + * + * @param obj The object + * @return Useragent string + * + * @ingroup Web + */ +EAPI const char* elm_web_useragent_get(const Evas_Object *obj); + +/** + * Get internal ewk_view object from web object. + * + * Elementary may not provide some low level features of EWebKit, + * instead of cluttering the API with proxy methods we opted to + * return the internal reference. Be careful using it as it may + * interfere with elm_web behavior. + * + * @param obj The web object. + * @return The internal ewk_view object or NULL if it does not + * exist. (Failure to create or Elementary compiled without + * ewebkit) + * + * @see elm_web_add() + * + * @ingroup Web + */ +EAPI Evas_Object *elm_web_webkit_view_get(const Evas_Object *obj); + +/** + * Sets the function to call when a new window is requested + * + * This hook will be called when a request to create a new window is + * issued from the web page loaded. + * There is no default implementation for this feature, so leaving this + * unset or passing @c NULL in @p func will prevent new windows from + * opening. + * + * @param obj The web object where to set the hook function + * @param func The hook function to be called when a window is requested + * @param data User data + * + * @ingroup Web + */ +EAPI void elm_web_window_create_hook_set(Evas_Object *obj, Elm_Web_Window_Open func, void *data); + +/** + * Sets the function to call when an alert dialog + * + * This hook will be called when a JavaScript alert dialog is requested. + * If no function is set or @c NULL is passed in @p func, the default + * implementation will take place. + * + * @param obj The web object where to set the hook function + * @param func The callback function to be used + * @param data User data + * + * @see elm_web_inwin_mode_set() + * + * @ingroup Web + */ +EAPI void elm_web_dialog_alert_hook_set(Evas_Object *obj, Elm_Web_Dialog_Alert func, void *data); + +/** + * Sets the function to call when an confirm dialog + * + * This hook will be called when a JavaScript confirm dialog is requested. + * If no function is set or @c NULL is passed in @p func, the default + * implementation will take place. + * + * @param obj The web object where to set the hook function + * @param func The callback function to be used + * @param data User data + * + * @see elm_web_inwin_mode_set() + * + * @ingroup Web + */ +EAPI void elm_web_dialog_confirm_hook_set(Evas_Object *obj, Elm_Web_Dialog_Confirm func, void *data); + +/** + * Sets the function to call when an prompt dialog + * + * This hook will be called when a JavaScript prompt dialog is requested. + * If no function is set or @c NULL is passed in @p func, the default + * implementation will take place. + * + * @param obj The web object where to set the hook function + * @param func The callback function to be used + * @param data User data + * + * @see elm_web_inwin_mode_set() + * + * @ingroup Web + */ +EAPI void elm_web_dialog_prompt_hook_set(Evas_Object *obj, Elm_Web_Dialog_Prompt func, void *data); + +/** + * Sets the function to call when an file selector dialog + * + * This hook will be called when a JavaScript file selector dialog is + * requested. + * If no function is set or @c NULL is passed in @p func, the default + * implementation will take place. + * + * @param obj The web object where to set the hook function + * @param func The callback function to be used + * @param data User data + * + * @see elm_web_inwin_mode_set() + * + * @ingroup Web + */ +EAPI void elm_web_dialog_file_selector_hook_set(Evas_Object *obj, Elm_Web_Dialog_File_Selector func, void *data); + +/** + * Sets the function to call when a console message is emitted from JS + * + * This hook will be called when a console message is emitted from + * JavaScript. There is no default implementation for this feature. + * + * @param obj The web object where to set the hook function + * @param func The callback function to be used + * @param data User data + * + * @ingroup Web + */ +EAPI void elm_web_console_message_hook_set(Evas_Object *obj, Elm_Web_Console_Message func, void *data); + +/** + * Gets the status of the tab propagation + * + * @param obj The web object to query + * @return EINA_TRUE if tab propagation is enabled, EINA_FALSE otherwise + * + * @see elm_web_tab_propagate_set() + * + * @ingroup Web + */ +EAPI Eina_Bool elm_web_tab_propagate_get(const Evas_Object *obj); + +/** + * Sets whether to use tab propagation + * + * If tab propagation is enabled, whenever the user presses the Tab key, + * Elementary will handle it and switch focus to the next widget. + * The default value is disabled, where WebKit will handle the Tab key to + * cycle focus though its internal objects, jumping to the next widget + * only when that cycle ends. + * + * @param obj The web object + * @param propagate Whether to propagate Tab keys to Elementary or not + * + * @ingroup Web + */ +EAPI void elm_web_tab_propagate_set(Evas_Object *obj, Eina_Bool propagate); + +/** + * Sets the URI for the web object + * + * It must be a full URI, with resource included, in the form + * http://www.enlightenment.org or file:///tmp/something.html + * + * @param obj The web object + * @param uri The URI to set + * @return EINA_TRUE if the URI could be set, EINA_FALSE if an error occurred + * + * @ingroup Web + */ +EAPI Eina_Bool elm_web_uri_set(Evas_Object *obj, const char *uri); + +/** + * Gets the current URI for the object + * + * The returned string must not be freed and is guaranteed to be + * stringshared. + * + * @param obj The web object + * @return A stringshared internal string with the current URI, or NULL on + * failure + * + * @ingroup Web + */ +EAPI const char *elm_web_uri_get(const Evas_Object *obj); + +/** + * Gets the current title + * + * The returned string must not be freed and is guaranteed to be + * stringshared. + * + * @param obj The web object + * @return A stringshared internal string with the current title, or NULL on + * failure + * + * @ingroup Web + */ +EAPI const char *elm_web_title_get(const Evas_Object *obj); + +/** + * Sets the background color to be used by the web object + * + * This is the color that will be used by default when the loaded page + * does not set it's own. Color values are pre-multiplied. + * + * @param obj The web object + * @param r Red component + * @param g Green component + * @param b Blue component + * @param a Alpha component + * + * @ingroup Web + */ +EAPI void elm_web_bg_color_set(Evas_Object *obj, int r, int g, int b, int a); + +/** + * Gets the background color to be used by the web object + * + * This is the color that will be used by default when the loaded page + * does not set it's own. Color values are pre-multiplied. + * + * @param obj The web object + * @param r Red component + * @param g Green component + * @param b Blue component + * @param a Alpha component + * + * @ingroup Web + */ +EAPI void elm_web_bg_color_get(const Evas_Object *obj, int *r, int *g, int *b, int *a); + +/** + * Gets a copy of the currently selected text + * + * The string returned must be freed by the user when it's done with it. + * + * @param obj The web object + * @return A newly allocated string, or NULL if nothing is selected or an + * error occurred + * + * @ingroup Web + */ +EAPI char *elm_web_selection_get(const Evas_Object *obj); + +/** + * Tells the web object which index in the currently open popup was selected + * + * When the user handles the popup creation from the "popup,created" signal, + * it needs to tell the web object which item was selected by calling this + * function with the index corresponding to the item. + * + * @param obj The web object + * @param index The index selected + * + * @see elm_web_popup_destroy() + * + * @ingroup Web + */ +EAPI void elm_web_popup_selected_set(Evas_Object *obj, int index); + +/** + * Dismisses an open dropdown popup + * + * When the popup from a dropdown widget is to be dismissed, either after + * selecting an option or to cancel it, this function must be called, which + * will later emit an "popup,willdelete" signal to notify the user that + * any memory and objects related to this popup can be freed. + * + * @param obj The web object + * @return EINA_TRUE if the menu was successfully destroyed, or EINA_FALSE + * if there was no menu to destroy + * + * @ingroup Web + */ +EAPI Eina_Bool elm_web_popup_destroy(Evas_Object *obj); + +/** + * Searches the given string in a document. + * + * @param obj The web object where to search the text + * @param string String to search + * @param case_sensitive If search should be case sensitive or not + * @param forward If search is from cursor and on or backwards + * @param wrap If search should wrap at the end + * + * @return @c EINA_TRUE if the given string was found, @c EINA_FALSE if not + * or failure + * + * @ingroup Web + */ +EAPI Eina_Bool elm_web_text_search(const Evas_Object *obj, const char *string, Eina_Bool case_sensitive, Eina_Bool forward, Eina_Bool wrap); + +/** + * Marks matches of the given string in a document. + * + * @param obj The web object where to search text + * @param string String to match + * @param case_sensitive If match should be case sensitive or not + * @param highlight If matches should be highlighted + * @param limit Maximum amount of matches, or zero to unlimited + * + * @return number of matched @a string + * + * @ingroup Web + */ +EAPI unsigned int elm_web_text_matches_mark(Evas_Object *obj, const char *string, Eina_Bool case_sensitive, Eina_Bool highlight, unsigned int limit); + +/** + * Clears all marked matches in the document + * + * @param obj The web object + * + * @return EINA_TRUE on success, EINA_FALSE otherwise + * + * @ingroup Web + */ +EAPI Eina_Bool elm_web_text_matches_unmark_all(Evas_Object *obj); + +/** + * Sets whether to highlight the matched marks + * + * If enabled, marks set with elm_web_text_matches_mark() will be + * highlighted. + * + * @param obj The web object + * @param highlight Whether to highlight the marks or not + * + * @return EINA_TRUE on success, EINA_FALSE otherwise + * + * @ingroup Web + */ +EAPI Eina_Bool elm_web_text_matches_highlight_set(Evas_Object *obj, Eina_Bool highlight); + +/** + * Gets whether highlighting marks is enabled + * + * @param obj The web object + * + * @return EINA_TRUE is marks are set to be highlighted, EINA_FALSE + * otherwise + * + * @ingroup Web + */ +EAPI Eina_Bool elm_web_text_matches_highlight_get(const Evas_Object *obj); + +/** + * Gets the overall loading progress of the page + * + * Returns the estimated loading progress of the page, with a value between + * 0.0 and 1.0. This is an estimated progress accounting for all the frames + * included in the page. + * + * @param obj The web object + * + * @return A value between 0.0 and 1.0 indicating the progress, or -1.0 on + * failure + * + * @ingroup Web + */ +EAPI double elm_web_load_progress_get(const Evas_Object *obj); + +/** + * Stops loading the current page + * + * Cancels the loading of the current page in the web object. This will + * cause a "load,error" signal to be emitted, with the is_cancellation + * flag set to EINA_TRUE. + * + * @param obj The web object + * + * @return EINA_TRUE if the cancel was successful, EINA_FALSE otherwise + * + * @ingroup Web + */ +EAPI Eina_Bool elm_web_stop(Evas_Object *obj); + +/** + * Requests a reload of the current document in the object + * + * @param obj The web object + * + * @return EINA_TRUE on success, EINA_FALSE otherwise + * + * @ingroup Web + */ +EAPI Eina_Bool elm_web_reload(Evas_Object *obj); + +/** + * Requests a reload of the current document, avoiding any existing caches + * + * @param obj The web object + * + * @return EINA_TRUE on success, EINA_FALSE otherwise + * + * @ingroup Web + */ +EAPI Eina_Bool elm_web_reload_full(Evas_Object *obj); + +/** + * Goes back one step in the browsing history + * + * This is equivalent to calling elm_web_object_navigate(obj, -1); + * + * @param obj The web object + * + * @return EINA_TRUE on success, EINA_FALSE otherwise + * + * @see elm_web_history_enabled_set() + * @see elm_web_back_possible() + * @see elm_web_forward() + * @see elm_web_navigate() + * + * @ingroup Web + */ +EAPI Eina_Bool elm_web_back(Evas_Object *obj); + +/** + * Goes forward one step in the browsing history + * + * This is equivalent to calling elm_web_object_navigate(obj, 1); + * + * @param obj The web object + * + * @return EINA_TRUE on success, EINA_FALSE otherwise + * + * @see elm_web_history_enabled_set() + * @see elm_web_forward_possible_get() + * @see elm_web_back() + * @see elm_web_navigate() + * + * @ingroup Web + */ +EAPI Eina_Bool elm_web_forward(Evas_Object *obj); + +/** + * Jumps the given number of steps in the browsing history + * + * The @p steps value can be a negative integer to back in history, or a + * positive to move forward. + * + * @param obj The web object + * @param steps The number of steps to jump + * + * @return EINA_TRUE on success, EINA_FALSE on error or if not enough + * history exists to jump the given number of steps + * + * @see elm_web_history_enabled_set() + * @see elm_web_back() + * @see elm_web_forward() + * + * @ingroup Web + */ +EAPI Eina_Bool elm_web_navigate(Evas_Object *obj, int steps); + +/** + * Queries whether it's possible to go back in history + * + * @param obj The web object + * + * @return EINA_TRUE if it's possible to back in history, EINA_FALSE + * otherwise + * + * @ingroup Web + */ +EAPI Eina_Bool elm_web_back_possible_get(Evas_Object *obj); + +/** + * Queries whether it's possible to go forward in history + * + * @param obj The web object + * + * @return EINA_TRUE if it's possible to forward in history, EINA_FALSE + * otherwise + * + * @ingroup Web + */ +EAPI Eina_Bool elm_web_forward_possible_get(Evas_Object *obj); + +/** + * Queries whether it's possible to jump the given number of steps + * + * The @p steps value can be a negative integer to back in history, or a + * positive to move forward. + * + * @param obj The web object + * @param steps The number of steps to check for + * + * @return EINA_TRUE if enough history exists to perform the given jump, + * EINA_FALSE otherwise + * + * @ingroup Web + */ +EAPI Eina_Bool elm_web_navigate_possible_get(Evas_Object *obj, int steps); + +/** + * Gets whether browsing history is enabled for the given object + * + * @param obj The web object + * + * @return EINA_TRUE if history is enabled, EINA_FALSE otherwise + * + * @ingroup Web + */ +EAPI Eina_Bool elm_web_history_enabled_get(const Evas_Object *obj); + +/** + * Enables or disables the browsing history + * + * @param obj The web object + * @param enabled Whether to enable or disable the browsing history + * + * @ingroup Web + */ +EAPI void elm_web_history_enabled_set(Evas_Object *obj, Eina_Bool enabled); + +/** + * Sets the zoom level of the web object + * + * Zoom level matches the Webkit API, so 1.0 means normal zoom, with higher + * values meaning zoom in and lower meaning zoom out. This function will + * only affect the zoom level if the mode set with elm_web_zoom_mode_set() + * is ::ELM_WEB_ZOOM_MODE_MANUAL. + * + * @param obj The web object + * @param zoom The zoom level to set + * + * @ingroup Web + */ +EAPI void elm_web_zoom_set(Evas_Object *obj, double zoom); + +/** + * Gets the current zoom level set on the web object + * + * Note that this is the zoom level set on the web object and not that + * of the underlying Webkit one. In the ::ELM_WEB_ZOOM_MODE_MANUAL mode, + * the two zoom levels should match, but for the other two modes the + * Webkit zoom is calculated internally to match the chosen mode without + * changing the zoom level set for the web object. + * + * @param obj The web object + * + * @return The zoom level set on the object + * + * @ingroup Web + */ +EAPI double elm_web_zoom_get(const Evas_Object *obj); + +/** + * Sets the zoom mode to use + * + * The modes can be any of those defined in ::Elm_Web_Zoom_Mode, except + * ::ELM_WEB_ZOOM_MODE_LAST. The default is ::ELM_WEB_ZOOM_MODE_MANUAL. + * + * ::ELM_WEB_ZOOM_MODE_MANUAL means the zoom level will be controlled + * with the elm_web_zoom_set() function. + * ::ELM_WEB_ZOOM_MODE_AUTO_FIT will calculate the needed zoom level to + * make sure the entirety of the web object's contents are shown. + * ::ELM_WEB_ZOOM_MODE_AUTO_FILL will calculate the needed zoom level to + * fit the contents in the web object's size, without leaving any space + * unused. + * + * @param obj The web object + * @param mode The mode to set + * + * @ingroup Web + */ +EAPI void elm_web_zoom_mode_set(Evas_Object *obj, Elm_Web_Zoom_Mode mode); + +/** + * Gets the currently set zoom mode + * + * @param obj The web object + * + * @return The current zoom mode set for the object, or + * ::ELM_WEB_ZOOM_MODE_LAST on error + * + * @ingroup Web + */ +EAPI Elm_Web_Zoom_Mode elm_web_zoom_mode_get(const Evas_Object *obj); + +/** + * Shows the given region in the web object + * + * @param obj The web object + * @param x The x coordinate of the region to show + * @param y The y coordinate of the region to show + * @param w The width of the region to show + * @param h The height of the region to show + * + * @ingroup Web + */ +EAPI void elm_web_region_show(Evas_Object *obj, int x, int y, int w, int h); + +/** + * Brings in the region to the visible area + * + * Like elm_web_region_show(), but it animates the scrolling of the object + * to show the area + * + * @param obj The web object + * @param x The x coordinate of the region to show + * @param y The y coordinate of the region to show + * @param w The width of the region to show + * @param h The height of the region to show + * + * @ingroup Web + */ +EAPI void elm_web_region_bring_in(Evas_Object *obj, int x, int y, int w, int h); + +/** + * Sets the default dialogs to use an Inwin instead of a normal window + * + * If set, then the default implementation for the JavaScript dialogs and + * file selector will be opened in an Inwin. Otherwise they will use a + * normal separated window. + * + * @param obj The web object + * @param value EINA_TRUE to use Inwin, EINA_FALSE to use a normal window + * + * @ingroup Web + */ +EAPI void elm_web_inwin_mode_set(Evas_Object *obj, Eina_Bool value); + +/** + * Gets whether Inwin mode is set for the current object + * + * @param obj The web object + * + * @return EINA_TRUE if Inwin mode is set, EINA_FALSE otherwise + * + * @ingroup Web + */ +EAPI Eina_Bool elm_web_inwin_mode_get(const Evas_Object *obj); + +EAPI void elm_web_window_features_ref(Elm_Web_Window_Features *wf); +EAPI void elm_web_window_features_unref(Elm_Web_Window_Features *wf); + +/** + * Gets boolean properties from Elm_Web_Window_Features + * (such as statusbar, menubar, etc) that are on a window. + * + * @param wf The web window features object + * @param flag The web window feature flag whose value is required. + * + * @return EINA_TRUE if the flag is set, EINA_FALSE otherwise + * + * @ingroup Web + */ +EAPI Eina_Bool elm_web_window_features_property_get(const Elm_Web_Window_Features *wf, Elm_Web_Window_Feature_Flag flag); + +/** + * + * TODO : Add documentation. + * + * @param wf The web window features object + * @param x, y, w, h - the co-ordinates of the web view window. + * + * @ingroup Web + */ +EAPI void elm_web_window_features_region_get(const Elm_Web_Window_Features *wf, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); + +/** + * @} + */ diff --git a/libraries/elementary/src/lib/elm_widget.c b/libraries/elementary/src/lib/elm_widget.c new file mode 100644 index 0000000..4b62b63 --- /dev/null +++ b/libraries/elementary/src/lib/elm_widget.c @@ -0,0 +1,3949 @@ +#include +#include "elm_priv.h" + +static const char SMART_NAME[] = "elm_widget"; + +#define API_ENTRY \ + Smart_Data * sd = evas_object_smart_data_get(obj); \ + if ((!sd) || (!_elm_widget_is(obj))) +#define INTERNAL_ENTRY \ + Smart_Data * sd = evas_object_smart_data_get(obj); \ + if (!sd) return + +#undef elm_widget_text_set_hook_set +#undef elm_widget_text_get_hook_set +#undef elm_widget_content_set_hook_set +#undef elm_widget_content_get_hook_set +#undef elm_widget_content_unset_hook_set + +typedef struct _Smart_Data Smart_Data; +typedef struct _Edje_Signal_Data Edje_Signal_Data; +typedef struct _Elm_Event_Cb_Data Elm_Event_Cb_Data; +typedef struct _Elm_Translate_String_Data Elm_Translate_String_Data; + +struct _Smart_Data +{ + Evas_Object *obj; + const char *type; + Evas_Object *parent_obj; + Evas_Object *parent2; + Evas_Coord x, y, w, h; + Eina_List *subobjs; + Evas_Object *resize_obj; + Evas_Object *hover_obj; + Eina_List *tooltips, *cursors; + void (*del_func)(Evas_Object *obj); + void (*del_pre_func)(Evas_Object *obj); + void (*focus_func)(Evas_Object *obj); + void (*activate_func)(Evas_Object *obj); + void (*disable_func)(Evas_Object *obj); + void (*theme_func)(Evas_Object *obj); + void (*translate_func)(Evas_Object *obj); + Eina_Bool (*event_func)(Evas_Object *obj, + Evas_Object *source, + Evas_Callback_Type type, + void *event_info); + void (*signal_func)(Evas_Object *obj, + const char *emission, + const char *source); + void (*callback_add_func)(Evas_Object *obj, + const char *emission, + const char *source, + Edje_Signal_Cb func, + void *data); + void (*callback_del_func)(Evas_Object *obj, + const char *emission, + const char *source, + Edje_Signal_Cb func, + void *data); + void (*changed_func)(Evas_Object *obj); + Eina_Bool (*focus_next_func)(const Evas_Object *obj, + Elm_Focus_Direction dir, + Evas_Object **next); + void (*on_focus_func)(void *data, + Evas_Object *obj); + void *on_focus_data; + void (*on_change_func)(void *data, + Evas_Object *obj); + void *on_change_data; + void (*on_show_region_func)(void *data, + Evas_Object *obj); + void *on_show_region_data; + void (*focus_region_func)(Evas_Object *obj, + Evas_Coord x, + Evas_Coord y, + Evas_Coord w, + Evas_Coord h); + void (*on_focus_region_func)(const Evas_Object *obj, + Evas_Coord *x, + Evas_Coord *y, + Evas_Coord *w, + Evas_Coord *h); + Elm_Widget_Text_Set_Cb text_set_func; + Elm_Widget_Text_Get_Cb text_get_func; + Elm_Widget_Content_Set_Cb content_set_func; + Elm_Widget_Content_Get_Cb content_get_func; + Elm_Widget_Content_Unset_Cb content_unset_func; + void *data; + Evas_Coord rx, ry, rw, rh; + int scroll_hold; + int scroll_freeze; + double scale; + Elm_Theme *theme; + const char *style; + const char *access_info; + unsigned int focus_order; + Eina_Bool focus_order_on_calc; + + int child_drag_x_locked; + int child_drag_y_locked; + + Eina_List *edje_signals; + Eina_List *translate_strings; + + Eina_Bool drag_x_locked : 1; + Eina_Bool drag_y_locked : 1; + + Eina_Bool can_focus : 1; + Eina_Bool child_can_focus : 1; + Eina_Bool focused : 1; + Eina_Bool top_win_focused : 1; + Eina_Bool tree_unfocusable : 1; + Eina_Bool highlight_ignore : 1; + Eina_Bool highlight_in_theme : 1; + Eina_Bool disabled : 1; + Eina_Bool is_mirrored : 1; + Eina_Bool mirrored_auto_mode : 1; /* This is TRUE by default */ + Eina_Bool still_in : 1; + + Eina_List *focus_chain; + Eina_List *event_cb; +}; + +struct _Edje_Signal_Data +{ + Evas_Object *obj; + Edje_Signal_Cb func; + const char *emission; + const char *source; + void *data; +}; + +struct _Elm_Event_Cb_Data +{ + Elm_Event_Cb func; + const void *data; +}; + +struct _Elm_Translate_String_Data +{ + const char *id; + const char *domain; + const char *string; +}; + +/* local subsystem functions */ +static void _smart_reconfigure(Smart_Data *sd); +static void _smart_add(Evas_Object *obj); +static void _smart_del(Evas_Object *obj); +static void _smart_move(Evas_Object *obj, + Evas_Coord x, + Evas_Coord y); +static void _smart_resize(Evas_Object *obj, + Evas_Coord w, + Evas_Coord h); +static void _smart_show(Evas_Object *obj); +static void _smart_hide(Evas_Object *obj); +static void _smart_color_set(Evas_Object *obj, + int r, + int g, + int b, + int a); +static void _smart_clip_set(Evas_Object *obj, + Evas_Object *clip); +static void _smart_clip_unset(Evas_Object *obj); +static void _smart_calculate(Evas_Object *obj); +static void _smart_member_add(Evas_Object *obj, Evas_Object *child); +static void _smart_member_del(Evas_Object *obj, Evas_Object *child); +static void _smart_init(void); + +static void _if_focused_revert(Evas_Object *obj, + Eina_Bool can_focus_only); +static Evas_Object *_newest_focus_order_get(Evas_Object *obj, + unsigned int *newest_focus_order, + Eina_Bool can_focus_only); + +/* local subsystem globals */ +static Evas_Smart *_e_smart = NULL; +static Eina_List *widtypes = NULL; + +static unsigned int focus_order = 0; + +// internal funcs +static inline Eina_Bool +_elm_widget_is(const Evas_Object *obj) +{ + const char *type = evas_object_type_get(obj); + return type == SMART_NAME; +} + +static inline Eina_Bool +_is_focusable(Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + return sd->can_focus || (sd->child_can_focus); +} + +static void +_unfocus_parents(Evas_Object *obj) +{ + for (; obj; obj = elm_widget_parent_get(obj)) + { + INTERNAL_ENTRY; + if (!sd->focused) return; + sd->focused = 0; + } +} + +static void +_focus_parents(Evas_Object *obj) +{ + for (; obj; obj = elm_widget_parent_get(obj)) + { + INTERNAL_ENTRY; + if (sd->focused) return; + sd->focused = 1; + } +} + +static void +_sub_obj_del(void *data, + Evas *e __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Smart_Data *sd = data; + + if (_elm_widget_is(obj)) + { + if (elm_widget_focus_get(obj)) _unfocus_parents(sd->obj); + } + if (obj == sd->resize_obj) + sd->resize_obj = NULL; + else if (obj == sd->hover_obj) + sd->hover_obj = NULL; + else + sd->subobjs = eina_list_remove(sd->subobjs, obj); + evas_object_smart_callback_call(sd->obj, "sub-object-del", obj); +} + +static void +_sub_obj_hide(void *data __UNUSED__, + Evas *e __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + elm_widget_focus_hide_handle(obj); +} + +static void +_sub_obj_mouse_down(void *data, + Evas *e __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + Smart_Data *sd = data; + Evas_Event_Mouse_Down *ev = event_info; + if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)) + sd->still_in = EINA_TRUE; +} + +static void +_sub_obj_mouse_move(void *data, + Evas *e __UNUSED__, + Evas_Object *obj, + void *event_info) +{ + Smart_Data *sd = data; + Evas_Event_Mouse_Move *ev = event_info; + if (sd->still_in) + { + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) + sd->still_in = EINA_FALSE; + else + { + Evas_Coord x, y, w, h; + evas_object_geometry_get(obj, &x, &y, &w, &h); + if ((ev->cur.canvas.x < x) || (ev->cur.canvas.y < y) || + (ev->cur.canvas.x >= (x + w)) || (ev->cur.canvas.y >= (y + h))) + sd->still_in = EINA_FALSE; + } + } +} + +static void +_sub_obj_mouse_up(void *data, + Evas *e __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Smart_Data *sd = data; + if (sd->still_in) + elm_widget_focus_mouse_up_handle(obj); + sd->still_in = EINA_FALSE; +} + +static void +_propagate_x_drag_lock(Evas_Object *obj, + int dir) +{ + INTERNAL_ENTRY; + if (sd->parent_obj) + { + Smart_Data *sd2 = evas_object_smart_data_get(sd->parent_obj); + if (sd2) + { + sd2->child_drag_x_locked += dir; + _propagate_x_drag_lock(sd->parent_obj, dir); + } + } +} + +static void +_propagate_y_drag_lock(Evas_Object *obj, + int dir) +{ + INTERNAL_ENTRY; + if (sd->parent_obj) + { + Smart_Data *sd2 = evas_object_smart_data_get(sd->parent_obj); + if (sd2) + { + sd2->child_drag_y_locked += dir; + _propagate_y_drag_lock(sd->parent_obj, dir); + } + } +} + +static void +_propagate_event(void *data, + Evas *e __UNUSED__, + Evas_Object *obj, + void *event_info) +{ + INTERNAL_ENTRY; + Evas_Callback_Type type = (Evas_Callback_Type)(long)data; + Evas_Event_Flags *event_flags = NULL; + + switch (type) + { + case EVAS_CALLBACK_KEY_DOWN: + { + Evas_Event_Key_Down *ev = event_info; + event_flags = &(ev->event_flags); + } + break; + + case EVAS_CALLBACK_KEY_UP: + { + Evas_Event_Key_Up *ev = event_info; + event_flags = &(ev->event_flags); + } + break; + + case EVAS_CALLBACK_MOUSE_WHEEL: + { + Evas_Event_Mouse_Wheel *ev = event_info; + event_flags = &(ev->event_flags); + } + break; + + default: + break; + } + + elm_widget_event_propagate(obj, type, event_info, event_flags); +} + +static void +_parent_focus(Evas_Object *obj) +{ + API_ENTRY return; + if (sd->focused) return; + + Evas_Object *o = elm_widget_parent_get(obj); + sd->focus_order_on_calc = EINA_TRUE; + + if (o) _parent_focus(o); + + if (!sd->focus_order_on_calc) + return; /* we don't want to override it if by means of any of the + callbacks below one gets to calculate our order + first. */ + + focus_order++; + sd->focus_order = focus_order; + if (sd->top_win_focused) + { + sd->focused = EINA_TRUE; + if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj); + if (sd->focus_func) sd->focus_func(obj); + _elm_widget_focus_region_show(obj); + } + sd->focus_order_on_calc = EINA_FALSE; +} + +static void +_elm_object_focus_chain_del_cb(void *data, + Evas *e __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Smart_Data *sd = data; + + sd->focus_chain = eina_list_remove(sd->focus_chain, obj); +} + +// exposed util funcs to elm +void +_elm_widget_type_clear(void) +{ + const char **ptr; + + EINA_LIST_FREE(widtypes, ptr) + { + eina_stringshare_del(*ptr); + *ptr = NULL; + } +} + +void +_elm_widget_focus_region_show(const Evas_Object *obj) +{ + Evas_Coord x, y, w, h, ox, oy; + Smart_Data *sd2; + Evas_Object *o; + + API_ENTRY return; + + o = elm_widget_parent_get(obj); + if (!o) return; + + elm_widget_focus_region_get(obj, &x, &y, &w, &h); + evas_object_geometry_get(obj, &ox, &oy, NULL, NULL); + while (o) + { + Evas_Coord px, py; + sd2 = evas_object_smart_data_get(o); + if (sd2->focus_region_func) + { + sd2->focus_region_func(o, x, y, w, h); + elm_widget_focus_region_get(o, &x, &y, &w, &h); + } + else + { + evas_object_geometry_get(o, &px, &py, NULL, NULL); + x += ox - px; + y += oy - py; + ox = px; + oy = py; + } + o = elm_widget_parent_get(o); + } +} + +/** + * @defgroup Widget Widget + * + * @internal + * Exposed api for making widgets + */ +EAPI void +elm_widget_type_register(const char **ptr) +{ + widtypes = eina_list_append(widtypes, (void *)ptr); +} + +/** + * @defgroup Widget Widget + * + * @internal + * Disposed api for making widgets + */ +EAPI void +elm_widget_type_unregister(const char **ptr) +{ + widtypes = eina_list_remove(widtypes, (void *)ptr); +} + +EAPI Eina_Bool +elm_widget_api_check(int ver) +{ + if (ver != ELM_INTERNAL_API_VERSION) + { + CRITICAL("Elementary widget api versions do not match"); + return EINA_FALSE; + } + return EINA_TRUE; +} + +EAPI Evas_Object * +elm_widget_add(Evas *evas) +{ + Evas_Object *obj; + _smart_init(); + obj = evas_object_smart_add(evas, _e_smart); + elm_widget_mirrored_set(obj, elm_config_mirrored_get()); + return obj; +} + +EAPI void +elm_widget_del_hook_set(Evas_Object *obj, + void (*func)(Evas_Object *obj)) +{ + API_ENTRY return; + sd->del_func = func; +} + +EAPI void +elm_widget_del_pre_hook_set(Evas_Object *obj, + void (*func)(Evas_Object *obj)) +{ + API_ENTRY return; + sd->del_pre_func = func; +} + +EAPI void +elm_widget_focus_hook_set(Evas_Object *obj, + void (*func)(Evas_Object *obj)) +{ + API_ENTRY return; + sd->focus_func = func; +} + +EAPI void +elm_widget_activate_hook_set(Evas_Object *obj, + void (*func)(Evas_Object *obj)) +{ + API_ENTRY return; + sd->activate_func = func; +} + +EAPI void +elm_widget_disable_hook_set(Evas_Object *obj, + void (*func)(Evas_Object *obj)) +{ + API_ENTRY return; + sd->disable_func = func; +} + +EAPI void +elm_widget_theme_hook_set(Evas_Object *obj, + void (*func)(Evas_Object *obj)) +{ + API_ENTRY return; + sd->theme_func = func; +} + +EAPI void +elm_widget_translate_hook_set(Evas_Object *obj, + void (*func)(Evas_Object *obj)) +{ + API_ENTRY return; + sd->translate_func = func; +} + +EAPI void +elm_widget_event_hook_set(Evas_Object *obj, + Eina_Bool (*func)(Evas_Object *obj, + Evas_Object *source, + Evas_Callback_Type type, + void *event_info)) +{ + API_ENTRY return; + sd->event_func = func; +} + +EAPI void +elm_widget_text_set_hook_set(Evas_Object *obj, + Elm_Widget_Text_Set_Cb func) +{ + API_ENTRY return; + sd->text_set_func = func; +} + +EAPI void +elm_widget_text_get_hook_set(Evas_Object *obj, + Elm_Widget_Text_Get_Cb func) +{ + API_ENTRY return; + sd->text_get_func = func; +} + +EAPI void +elm_widget_content_set_hook_set(Evas_Object *obj, + Elm_Widget_Content_Set_Cb func) +{ + API_ENTRY return; + sd->content_set_func = func; +} + +EAPI void +elm_widget_content_get_hook_set(Evas_Object *obj, + Elm_Widget_Content_Get_Cb func) +{ + API_ENTRY return; + sd->content_get_func = func; +} + +EAPI void +elm_widget_content_unset_hook_set(Evas_Object *obj, + Elm_Widget_Content_Unset_Cb func) +{ + API_ENTRY return; + sd->content_unset_func = func; +} + +EAPI void +elm_widget_changed_hook_set(Evas_Object *obj, + void (*func)(Evas_Object *obj)) +{ + API_ENTRY return; + sd->changed_func = func; +} + +EAPI void +elm_widget_signal_emit_hook_set(Evas_Object *obj, + void (*func)(Evas_Object *obj, + const char *emission, + const char *source)) +{ + API_ENTRY return; + sd->signal_func = func; +} + +EAPI void +elm_widget_signal_callback_add_hook_set(Evas_Object *obj, + void (*func)(Evas_Object *obj, + const char *emission, + const char *source, + Edje_Signal_Cb func_cb, + void *data)) +{ + API_ENTRY return; + sd->callback_add_func = func; +} + +EAPI void +elm_widget_signal_callback_del_hook_set(Evas_Object *obj, + void (*func)(Evas_Object *obj, + const char *emission, + const char *source, + Edje_Signal_Cb func_cb, + void *data)) +{ + API_ENTRY return; + sd->callback_del_func = func; +} + +EAPI Eina_Bool +elm_widget_theme(Evas_Object *obj) +{ + const Eina_List *l; + Evas_Object *child; + Elm_Tooltip *tt; + Elm_Cursor *cur; + Eina_Bool ret = EINA_TRUE; + + API_ENTRY return EINA_FALSE; + EINA_LIST_FOREACH(sd->subobjs, l, child) ret &= elm_widget_theme(child); + if (sd->resize_obj && _elm_widget_is(sd->resize_obj)) + ret &= elm_widget_theme(sd->resize_obj); + if (sd->hover_obj) ret &= elm_widget_theme(sd->hover_obj); + EINA_LIST_FOREACH(sd->tooltips, l, tt) elm_tooltip_theme(tt); + EINA_LIST_FOREACH(sd->cursors, l, cur) elm_cursor_theme(cur); + if (sd->theme_func) sd->theme_func(obj); + + return ret; +} + +EAPI void +elm_widget_theme_specific(Evas_Object *obj, + Elm_Theme *th, + Eina_Bool force) +{ + const Eina_List *l; + Evas_Object *child; + Elm_Tooltip *tt; + Elm_Cursor *cur; + Elm_Theme *th2, *thdef; + + API_ENTRY return; + thdef = elm_theme_default_get(); + if (!th) th = thdef; + if (!force) + { + th2 = sd->theme; + if (!th2) th2 = thdef; + while (th2) + { + if (th2 == th) + { + force = EINA_TRUE; + break; + } + if (th2 == thdef) break; + th2 = th2->ref_theme; + if (!th2) th2 = thdef; + } + } + if (!force) return; + EINA_LIST_FOREACH(sd->subobjs, l, child) + elm_widget_theme_specific(child, th, force); + if (sd->resize_obj) elm_widget_theme(sd->resize_obj); + if (sd->hover_obj) elm_widget_theme(sd->hover_obj); + EINA_LIST_FOREACH(sd->tooltips, l, tt) elm_tooltip_theme(tt); + EINA_LIST_FOREACH(sd->cursors, l, cur) elm_cursor_theme(cur); + if (sd->theme_func) sd->theme_func(obj); +} + +/** + * @internal + * + * Set hook to get next object in object focus chain. + * + * @param obj The widget object. + * @param func The hook to be used with this widget. + * + * @ingroup Widget + */ +EAPI void +elm_widget_focus_next_hook_set(Evas_Object *obj, + Eina_Bool (*func)(const Evas_Object *obj, + Elm_Focus_Direction dir, + Evas_Object **next)) +{ + API_ENTRY return; + sd->focus_next_func = func; +} + +/** + * Returns the widget's mirrored mode. + * + * @param obj The widget. + * @return mirrored mode of the object. + * + **/ +EAPI Eina_Bool +elm_widget_mirrored_get(const Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + return sd->is_mirrored; +} + +/** + * Sets the widget's mirrored mode. + * + * @param obj The widget. + * @param mirrored EINA_TRUE to set mirrored mode. EINA_FALSE to unset. + */ +EAPI void +elm_widget_mirrored_set(Evas_Object *obj, + Eina_Bool mirrored) +{ + API_ENTRY return; + if (sd->is_mirrored != mirrored) + { + sd->is_mirrored = mirrored; + elm_widget_theme(obj); + } +} + +/** + * @internal + * Resets the mirrored mode from the system mirror mode for widgets that are in + * automatic mirroring mode. This function does not call elm_widget_theme. + * + * @param obj The widget. + * @param mirrored EINA_TRUE to set mirrored mode. EINA_FALSE to unset. + */ +void +_elm_widget_mirrored_reload(Evas_Object *obj) +{ + API_ENTRY return; + Eina_Bool mirrored = elm_config_mirrored_get(); + if (elm_widget_mirrored_automatic_get(obj) && (sd->is_mirrored != mirrored)) + { + sd->is_mirrored = mirrored; + } +} + +/** + * Returns the widget's mirrored mode setting. + * + * @param obj The widget. + * @return mirrored mode setting of the object. + * + **/ +EAPI Eina_Bool +elm_widget_mirrored_automatic_get(const Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + return sd->mirrored_auto_mode; +} + +/** + * Sets the widget's mirrored mode setting. + * When widget in automatic mode, it follows the system mirrored mode set by + * elm_mirrored_set(). + * @param obj The widget. + * @param automatic EINA_TRUE for auto mirrored mode. EINA_FALSE for manual. + */ +EAPI void +elm_widget_mirrored_automatic_set(Evas_Object *obj, + Eina_Bool automatic) +{ + API_ENTRY return; + if (sd->mirrored_auto_mode != automatic) + { + sd->mirrored_auto_mode = automatic; + + if (automatic) + { + elm_widget_mirrored_set(obj, elm_config_mirrored_get()); + } + } +} + +EAPI void +elm_widget_on_focus_hook_set(Evas_Object *obj, + void (*func)(void *data, + Evas_Object *obj), + void *data) +{ + API_ENTRY return; + sd->on_focus_func = func; + sd->on_focus_data = data; +} + +EAPI void +elm_widget_on_change_hook_set(Evas_Object *obj, + void (*func)(void *data, + Evas_Object *obj), + void *data) +{ + API_ENTRY return; + sd->on_change_func = func; + sd->on_change_data = data; +} + +EAPI void +elm_widget_on_show_region_hook_set(Evas_Object *obj, + void (*func)(void *data, + Evas_Object *obj), + void *data) +{ + API_ENTRY return; + sd->on_show_region_func = func; + sd->on_show_region_data = data; +} + +/** + * @internal + * + * Set the hook to use to show the focused region. + * + * Whenever a new widget gets focused or it's needed to show the focused + * area of the current one, this hook will be called on objects that may + * want to move their children into their visible area. + * The area given in the hook function is relative to the @p obj widget. + * + * @param obj The widget object + * @param func The function to call to show the specified area. + * + * @ingroup Widget + */ +EAPI void +elm_widget_focus_region_hook_set(Evas_Object *obj, + void (*func)(Evas_Object *obj, + Evas_Coord x, + Evas_Coord y, + Evas_Coord w, + Evas_Coord h)) +{ + API_ENTRY return; + sd->focus_region_func = func; +} + +/** + * @internal + * + * Set the hook to retrieve the focused region of a widget. + * + * This hook will be called by elm_widget_focus_region_get() whenever + * it's needed to get the focused area of a widget. The area must be relative + * to the widget itself and if no hook is set, it will default to the entire + * object. + * + * @param obj The widget object + * @param func The function used to retrieve the focus region. + * + * @ingroup Widget + */ +EAPI void +elm_widget_on_focus_region_hook_set(Evas_Object *obj, + void (*func)(const Evas_Object *obj, + Evas_Coord *x, + Evas_Coord *y, + Evas_Coord *w, + Evas_Coord *h)) +{ + API_ENTRY return; + sd->on_focus_region_func = func; +} + +EAPI void +elm_widget_data_set(Evas_Object *obj, + void *data) +{ + API_ENTRY return; + sd->data = data; +} + +EAPI void * +elm_widget_data_get(const Evas_Object *obj) +{ + API_ENTRY return NULL; + return sd->data; +} + +EAPI void +elm_widget_sub_object_add(Evas_Object *obj, + Evas_Object *sobj) +{ + API_ENTRY return; + EINA_SAFETY_ON_TRUE_RETURN(obj == sobj); + double scale, pscale = elm_widget_scale_get(sobj); + Elm_Theme *th, *pth = elm_widget_theme_get(sobj); + Eina_Bool mirrored, pmirrored = elm_widget_mirrored_get(obj); + + if (sobj == sd->parent_obj) + { + elm_widget_sub_object_del(sobj, obj); + WRN("You passed a parent object of obj = %p as the sub object = %p!", obj, sobj); + } + + if (_elm_widget_is(sobj)) + { + Smart_Data *sd2 = evas_object_smart_data_get(sobj); + if (sd2) + { + if (sd2->parent_obj == obj) + return; + if (sd2->parent_obj) + elm_widget_sub_object_del(sd2->parent_obj, sobj); + sd2->parent_obj = obj; + _elm_widget_top_win_focused_set(sobj, sd->top_win_focused); + if (!sd->child_can_focus && (_is_focusable(sobj))) + sd->child_can_focus = EINA_TRUE; + } + } + else + { + void *data = evas_object_data_get(sobj, "elm-parent"); + if (data) + { + if (data == obj) return; + evas_object_event_callback_del(sobj, EVAS_CALLBACK_DEL, + _sub_obj_del); + } + } + sd->subobjs = eina_list_append(sd->subobjs, sobj); + evas_object_data_set(sobj, "elm-parent", obj); + evas_object_event_callback_add(sobj, EVAS_CALLBACK_DEL, _sub_obj_del, sd); + if (_elm_widget_is(sobj)) + evas_object_event_callback_add(sobj, EVAS_CALLBACK_HIDE, _sub_obj_hide, sd); + evas_object_smart_callback_call(obj, "sub-object-add", sobj); + scale = elm_widget_scale_get(sobj); + th = elm_widget_theme_get(sobj); + mirrored = elm_widget_mirrored_get(sobj); + if ((scale != pscale) || (th != pth) || (pmirrored != mirrored)) elm_widget_theme(sobj); + if (elm_widget_focus_get(sobj)) _focus_parents(obj); +} + +EAPI void +elm_widget_sub_object_del(Evas_Object *obj, + Evas_Object *sobj) +{ + Evas_Object *sobj_parent; + API_ENTRY return; + if (!sobj) return; + + sobj_parent = evas_object_data_del(sobj, "elm-parent"); + if (sobj_parent != obj) + { + static int abort_on_warn = -1; + ERR("removing sub object %p (%s) from parent %p (%s), " + "but elm-parent is different %p (%s)!", + sobj, elm_widget_type_get(sobj), obj, elm_widget_type_get(obj), + sobj_parent, elm_widget_type_get(sobj_parent)); + if (EINA_UNLIKELY(abort_on_warn == -1)) + { + if (getenv("ELM_ERROR_ABORT")) abort_on_warn = 1; + else abort_on_warn = 0; + } + if (abort_on_warn == 1) abort(); + } + if (_elm_widget_is(sobj)) + { + if (elm_widget_focus_get(sobj)) + { + elm_widget_tree_unfocusable_set(sobj, EINA_TRUE); + elm_widget_tree_unfocusable_set(sobj, EINA_FALSE); + } + if ((sd->child_can_focus) && (_is_focusable(sobj))) + { + Evas_Object *subobj; + const Eina_List *l; + sd->child_can_focus = EINA_FALSE; + EINA_LIST_FOREACH(sd->subobjs, l, subobj) + { + if (_is_focusable(subobj)) + { + sd->child_can_focus = EINA_TRUE; + break; + } + } + } + Smart_Data *sd2 = evas_object_smart_data_get(sobj); + if (sd2) + { + sd2->parent_obj = NULL; + if (sd2->resize_obj == sobj) + sd2->resize_obj = NULL; + else + sd->subobjs = eina_list_remove(sd->subobjs, sobj); + } + else + sd->subobjs = eina_list_remove(sd->subobjs, sobj); + } + else + sd->subobjs = eina_list_remove(sd->subobjs, sobj); + evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_DEL, + _sub_obj_del, sd); + if (_elm_widget_is(sobj)) + evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_HIDE, + _sub_obj_hide, sd); + evas_object_smart_callback_call(obj, "sub-object-del", sobj); +} + +EAPI const Eina_List * +elm_widget_sub_object_list_get(const Evas_Object *obj) +{ + API_ENTRY return NULL; + return (const Eina_List *)sd->subobjs; +} + +EAPI void +elm_widget_resize_object_set(Evas_Object *obj, + Evas_Object *sobj) +{ + API_ENTRY return; + // orphan previous resize obj + if (sd->resize_obj) + { + evas_object_clip_unset(sd->resize_obj); + evas_object_data_del(sd->resize_obj, "elm-parent"); + if (_elm_widget_is(sd->resize_obj)) + { + Smart_Data *sd2 = evas_object_smart_data_get(sd->resize_obj); + if (sd2) sd2->parent_obj = NULL; + evas_object_event_callback_del_full(sd->resize_obj, + EVAS_CALLBACK_HIDE, + _sub_obj_hide, sd); + } + evas_object_event_callback_del_full(sd->resize_obj, EVAS_CALLBACK_DEL, + _sub_obj_del, sd); + evas_object_event_callback_del_full(sd->resize_obj, + EVAS_CALLBACK_MOUSE_DOWN, + _sub_obj_mouse_down, sd); + evas_object_event_callback_del_full(sd->resize_obj, + EVAS_CALLBACK_MOUSE_MOVE, + _sub_obj_mouse_move, sd); + evas_object_event_callback_del_full(sd->resize_obj, + EVAS_CALLBACK_MOUSE_UP, + _sub_obj_mouse_up, sd); + evas_object_smart_member_del(sd->resize_obj); + + if (_elm_widget_is(sd->resize_obj)) + { + if (elm_widget_focus_get(sd->resize_obj)) _unfocus_parents(obj); + } + } + + sd->resize_obj = sobj; + if (!sobj) return; + + // orphan new resize obj + evas_object_data_del(sobj, "elm-parent"); + if (_elm_widget_is(sobj)) + { + Smart_Data *sd2 = evas_object_smart_data_get(sobj); + if (sd2) sd2->parent_obj = NULL; + evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_HIDE, + _sub_obj_hide, sd); + } + evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_DEL, + _sub_obj_del, sd); + evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_MOUSE_DOWN, + _sub_obj_mouse_down, sd); + evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_MOUSE_MOVE, + _sub_obj_mouse_move, sd); + evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_MOUSE_UP, + _sub_obj_mouse_up, sd); + evas_object_smart_member_del(sobj); + if (_elm_widget_is(sobj)) + { + if (elm_widget_focus_get(sobj)) _unfocus_parents(obj); + } + + // set the resize obj up + if (_elm_widget_is(sobj)) + { + Smart_Data *sd2 = evas_object_smart_data_get(sobj); + if (sd2) + { + sd2->parent_obj = obj; + sd2->top_win_focused = sd->top_win_focused; + } + evas_object_event_callback_add(sobj, EVAS_CALLBACK_HIDE, + _sub_obj_hide, sd); + } + evas_object_smart_member_add(sobj, obj); + evas_object_event_callback_add(sobj, EVAS_CALLBACK_DEL, + _sub_obj_del, sd); + evas_object_event_callback_add(sobj, EVAS_CALLBACK_MOUSE_DOWN, + _sub_obj_mouse_down, sd); + evas_object_event_callback_add(sobj, EVAS_CALLBACK_MOUSE_MOVE, + _sub_obj_mouse_move, sd); + evas_object_event_callback_add(sobj, EVAS_CALLBACK_MOUSE_UP, + _sub_obj_mouse_up, sd); + _smart_reconfigure(sd); + evas_object_data_set(sobj, "elm-parent", obj); + evas_object_smart_callback_call(obj, "sub-object-add", sobj); + if (_elm_widget_is(sobj)) + { + if (elm_widget_focus_get(sobj)) _focus_parents(obj); + } +} + +EAPI void +elm_widget_hover_object_set(Evas_Object *obj, + Evas_Object *sobj) +{ + API_ENTRY return; + if (sd->hover_obj) + { + evas_object_event_callback_del_full(sd->hover_obj, EVAS_CALLBACK_DEL, + _sub_obj_del, sd); + } + sd->hover_obj = sobj; + if (sd->hover_obj) + { + evas_object_event_callback_add(sobj, EVAS_CALLBACK_DEL, + _sub_obj_del, sd); + _smart_reconfigure(sd); + } +} + +EAPI void +elm_widget_can_focus_set(Evas_Object *obj, + Eina_Bool can_focus) +{ + API_ENTRY return; + + can_focus = !!can_focus; + + if (sd->can_focus == can_focus) return; + sd->can_focus = can_focus; + if (sd->can_focus) + { + evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, + _propagate_event, + (void *)(long)EVAS_CALLBACK_KEY_DOWN); + evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_UP, + _propagate_event, + (void *)(long)EVAS_CALLBACK_KEY_UP); + evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_WHEEL, + _propagate_event, + (void *)(long)EVAS_CALLBACK_MOUSE_WHEEL); + } + else + { + evas_object_event_callback_del(obj, EVAS_CALLBACK_KEY_DOWN, + _propagate_event); + evas_object_event_callback_del(obj, EVAS_CALLBACK_KEY_UP, + _propagate_event); + evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_WHEEL, + _propagate_event); + } +} + +EAPI Eina_Bool +elm_widget_can_focus_get(const Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + return sd->can_focus; +} + +EAPI Eina_Bool +elm_widget_child_can_focus_get(const Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + return sd->child_can_focus; +} + +/** + * @internal + * + * This API makes the widget object and its children to be unfocusable. + * + * This API can be helpful for an object to be deleted. + * When an object will be deleted soon, it and its children may not + * want to get focus (by focus reverting or by other focus controls). + * Then, just use this API before deleting. + * + * @param obj The widget root of sub-tree + * @param tree_unfocusable If true, set the object sub-tree as unfocusable + * + * @ingroup Widget + */ +EAPI void +elm_widget_tree_unfocusable_set(Evas_Object *obj, + Eina_Bool tree_unfocusable) +{ + API_ENTRY return; + + tree_unfocusable = !!tree_unfocusable; + if (sd->tree_unfocusable == tree_unfocusable) return; + sd->tree_unfocusable = tree_unfocusable; + elm_widget_focus_tree_unfocusable_handle(obj); +} + +/** + * @internal + * + * This returns true, if the object sub-tree is unfocusable. + * + * @param obj The widget root of sub-tree + * @return EINA_TRUE if the object sub-tree is unfocusable + * + * @ingroup Widget + */ +EAPI Eina_Bool +elm_widget_tree_unfocusable_get(const Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + return sd->tree_unfocusable; +} + +/** + * @internal + * + * Get the list of focusable child objects. + * + * This function retruns list of child objects which can get focus. + * + * @param obj The parent widget + * @retrun list of focusable child objects. + * + * @ingroup Widget + */ +EAPI Eina_List * +elm_widget_can_focus_child_list_get(const Evas_Object *obj) +{ + API_ENTRY return NULL; + + const Eina_List *l; + Eina_List *child_list = NULL; + Evas_Object *child; + + if (sd->subobjs) + { + EINA_LIST_FOREACH(sd->subobjs, l, child) + { + if ((elm_widget_can_focus_get(child)) && + (evas_object_visible_get(child)) && + (!elm_widget_disabled_get(child))) + child_list = eina_list_append(child_list, child); + else if (elm_widget_is(child)) + { + Eina_List *can_focus_list; + can_focus_list = elm_widget_can_focus_child_list_get(child); + if (can_focus_list) + child_list = eina_list_merge(child_list, can_focus_list); + } + } + } + return child_list; +} + +EAPI void +elm_widget_highlight_ignore_set(Evas_Object *obj, + Eina_Bool ignore) +{ + API_ENTRY return; + sd->highlight_ignore = !!ignore; +} + +EAPI Eina_Bool +elm_widget_highlight_ignore_get(const Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + return sd->highlight_ignore; +} + +EAPI void +elm_widget_highlight_in_theme_set(Evas_Object *obj, + Eina_Bool highlight) +{ + API_ENTRY return; + sd->highlight_in_theme = !!highlight; + /* FIXME: if focused, it should switch from one mode to the other */ +} + +EAPI Eina_Bool +elm_widget_highlight_in_theme_get(const Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + return sd->highlight_in_theme; +} + +EAPI Eina_Bool +elm_widget_focus_get(const Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + return sd->focused; +} + +EAPI Evas_Object * +elm_widget_focused_object_get(const Evas_Object *obj) +{ + const Evas_Object *subobj; + const Eina_List *l; + API_ENTRY return NULL; + + if (!sd->focused) return NULL; + EINA_LIST_FOREACH(sd->subobjs, l, subobj) + { + Evas_Object *fobj = elm_widget_focused_object_get(subobj); + if (fobj) return fobj; + } + return (Evas_Object *)obj; +} + +EAPI Evas_Object * +elm_widget_top_get(const Evas_Object *obj) +{ + API_ENTRY return NULL; + if (sd->parent_obj) return elm_widget_top_get(sd->parent_obj); + return (Evas_Object *)obj; +} + +EAPI Eina_Bool +elm_widget_is(const Evas_Object *obj) +{ + return _elm_widget_is(obj); +} + +EAPI Evas_Object * +elm_widget_parent_widget_get(const Evas_Object *obj) +{ + Evas_Object *parent; + + if (_elm_widget_is(obj)) + { + Smart_Data *sd = evas_object_smart_data_get(obj); + if (!sd) return NULL; + parent = sd->parent_obj; + } + else + { + parent = evas_object_data_get(obj, "elm-parent"); + if (!parent) parent = evas_object_smart_parent_get(obj); + } + + while (parent) + { + Evas_Object *elm_parent; + if (_elm_widget_is(parent)) break; + elm_parent = evas_object_data_get(parent, "elm-parent"); + if (elm_parent) parent = elm_parent; + else parent = evas_object_smart_parent_get(parent); + } + return parent; +} + +EAPI Evas_Object * +elm_widget_parent2_get(const Evas_Object *obj) +{ + if (_elm_widget_is(obj)) + { + Smart_Data *sd = evas_object_smart_data_get(obj); + if (sd) return sd->parent2; + } + return NULL; +} + +EAPI void +elm_widget_parent2_set(Evas_Object *obj, Evas_Object *parent) +{ + API_ENTRY return; + sd->parent2 = parent; +} + +EAPI void +elm_widget_event_callback_add(Evas_Object *obj, + Elm_Event_Cb func, + const void *data) +{ + API_ENTRY return; + EINA_SAFETY_ON_NULL_RETURN(func); + Elm_Event_Cb_Data *ecb = ELM_NEW(Elm_Event_Cb_Data); + ecb->func = func; + ecb->data = data; + sd->event_cb = eina_list_append(sd->event_cb, ecb); +} + +EAPI void * +elm_widget_event_callback_del(Evas_Object *obj, + Elm_Event_Cb func, + const void *data) +{ + API_ENTRY return NULL; + EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL); + Eina_List *l; + Elm_Event_Cb_Data *ecd; + EINA_LIST_FOREACH(sd->event_cb, l, ecd) + if ((ecd->func == func) && (ecd->data == data)) + { + free(ecd); + sd->event_cb = eina_list_remove_list(sd->event_cb, l); + return (void *)data; + } + return NULL; +} + +EAPI Eina_Bool +elm_widget_event_propagate(Evas_Object *obj, + Evas_Callback_Type type, + void *event_info, + Evas_Event_Flags *event_flags) +{ + API_ENTRY return EINA_FALSE; //TODO reduce. + if (!_elm_widget_is(obj)) return EINA_FALSE; + Evas_Object *parent = obj; + Elm_Event_Cb_Data *ecd; + Eina_List *l, *l_prev; + + while (parent && + (!(event_flags && ((*event_flags) & EVAS_EVENT_FLAG_ON_HOLD)))) + { + sd = evas_object_smart_data_get(parent); + if ((!sd) || (!_elm_widget_is(obj))) + return EINA_FALSE; //Not Elm Widget + + if (sd->event_func && (sd->event_func(parent, obj, type, event_info))) + return EINA_TRUE; + + EINA_LIST_FOREACH_SAFE(sd->event_cb, l, l_prev, ecd) + { + if (ecd->func((void *)ecd->data, parent, obj, type, event_info) || + (event_flags && ((*event_flags) & EVAS_EVENT_FLAG_ON_HOLD))) + return EINA_TRUE; + } + parent = sd->parent_obj; + } + + return EINA_FALSE; +} + +/** + * @internal + * + * Set custom focus chain. + * + * This function i set one new and overwrite any previous custom focus chain + * with the list of objects. The previous list will be deleted and this list + * will be managed. After setted, don't modity it. + * + * @note On focus cycle, only will be evaluated children of this container. + * + * @param obj The container widget + * @param objs Chain of objects to pass focus + * @ingroup Widget + */ +EAPI void +elm_widget_focus_custom_chain_set(Evas_Object *obj, + Eina_List *objs) +{ + API_ENTRY return; + if (!sd->focus_next_func) + return; + + elm_widget_focus_custom_chain_unset(obj); + + Eina_List *l; + Evas_Object *o; + + EINA_LIST_FOREACH(objs, l, o) + { + evas_object_event_callback_add(o, EVAS_CALLBACK_DEL, + _elm_object_focus_chain_del_cb, sd); + } + + sd->focus_chain = objs; +} + +/** + * @internal + * + * Get custom focus chain + * + * @param obj The container widget + * @ingroup Widget + */ +EAPI const Eina_List * +elm_widget_focus_custom_chain_get(const Evas_Object *obj) +{ + API_ENTRY return NULL; + return (const Eina_List *)sd->focus_chain; +} + +/** + * @internal + * + * Unset custom focus chain + * + * @param obj The container widget + * @ingroup Widget + */ +EAPI void +elm_widget_focus_custom_chain_unset(Evas_Object *obj) +{ + API_ENTRY return; + Eina_List *l, *l_next; + Evas_Object *o; + + EINA_LIST_FOREACH_SAFE(sd->focus_chain, l, l_next, o) + { + evas_object_event_callback_del_full(o, EVAS_CALLBACK_DEL, + _elm_object_focus_chain_del_cb, sd); + sd->focus_chain = eina_list_remove_list(sd->focus_chain, l); + } +} + +/** + * @internal + * + * Append object to custom focus chain. + * + * @note If relative_child equal to NULL or not in custom chain, the object + * will be added in end. + * + * @note On focus cycle, only will be evaluated children of this container. + * + * @param obj The container widget + * @param child The child to be added in custom chain + * @param relative_child The relative object to position the child + * @ingroup Widget + */ +EAPI void +elm_widget_focus_custom_chain_append(Evas_Object *obj, + Evas_Object *child, + Evas_Object *relative_child) +{ + API_ENTRY return; + EINA_SAFETY_ON_NULL_RETURN(child); + if (!sd->focus_next_func) return; + + evas_object_event_callback_del_full(child, EVAS_CALLBACK_DEL, + _elm_object_focus_chain_del_cb, sd); + + if (!relative_child) + sd->focus_chain = eina_list_append(sd->focus_chain, child); + else + sd->focus_chain = eina_list_append_relative(sd->focus_chain, + child, relative_child); +} + +/** + * @internal + * + * Prepend object to custom focus chain. + * + * @note If relative_child equal to NULL or not in custom chain, the object + * will be added in begin. + * + * @note On focus cycle, only will be evaluated children of this container. + * + * @param obj The container widget + * @param child The child to be added in custom chain + * @param relative_child The relative object to position the child + * @ingroup Widget + */ +EAPI void +elm_widget_focus_custom_chain_prepend(Evas_Object *obj, + Evas_Object *child, + Evas_Object *relative_child) +{ + API_ENTRY return; + EINA_SAFETY_ON_NULL_RETURN(child); + + if (!sd->focus_next_func) return; + + evas_object_event_callback_del_full(child, EVAS_CALLBACK_DEL, + _elm_object_focus_chain_del_cb, sd); + + if (!relative_child) + sd->focus_chain = eina_list_prepend(sd->focus_chain, child); + else + sd->focus_chain = eina_list_prepend_relative(sd->focus_chain, + child, relative_child); +} + +/** + * @internal + * + * Give focus to next object in object tree. + * + * Give focus to next object in focus chain of one object sub-tree. + * If the last object of chain already have focus, the focus will go to the + * first object of chain. + * + * @param obj The widget root of sub-tree + * @param dir Direction to cycle the focus + * + * @ingroup Widget + */ +EAPI void +elm_widget_focus_cycle(Evas_Object *obj, + Elm_Focus_Direction dir) +{ + Evas_Object *target = NULL; + if (!_elm_widget_is(obj)) + return; + elm_widget_focus_next_get(obj, dir, &target); + if (target) + elm_widget_focus_steal(target); +} + +/** + * @internal + * + * Give focus to near object in one direction. + * + * Give focus to near object in direction of one object. + * If none focusable object in given direction, the focus will not change. + * + * @param obj The reference widget + * @param x Horizontal component of direction to focus + * @param y Vertical component of direction to focus + * + * @ingroup Widget + */ +//FIXME: If x, y indicates the elements of the directional vector, +//It would be better if these values are the normalized value(float x, float y) +//or degree. +EINA_DEPRECATED EAPI void +elm_widget_focus_direction_go(Evas_Object *obj __UNUSED__, + int x __UNUSED__, + int y __UNUSED__) +{ + return; /* TODO */ +} + +/** + * @internal + * + * Get next object in focus chain of object tree. + * + * Get next object in focus chain of one object sub-tree. + * Return the next object by reference. If don't have any candidate to receive + * focus before chain end, the first candidate will be returned. + * + * @param obj The widget root of sub-tree + * @param dir Direction os focus chain + * @param next The next object in focus chain + * @return EINA_TRUE if don't need focus chain restart/loop back + * to use 'next' obj. + * + * @ingroup Widget + */ +EAPI Eina_Bool +elm_widget_focus_next_get(const Evas_Object *obj, + Elm_Focus_Direction dir, + Evas_Object **next) +{ + if (!next) + return EINA_FALSE; + *next = NULL; + + API_ENTRY return EINA_FALSE; + + /* Ignore if disabled */ + if ((!evas_object_visible_get(obj)) + || (elm_widget_disabled_get(obj)) + || (elm_widget_tree_unfocusable_get(obj))) + return EINA_FALSE; + + /* Try use hook */ + if (sd->focus_next_func) + return sd->focus_next_func(obj, dir, next); + + if (!elm_widget_can_focus_get(obj)) + return EINA_FALSE; + + /* Return */ + *next = (Evas_Object *)obj; + return !elm_widget_focus_get(obj); +} + +/** + * @internal + * + * Get next object in focus chain of object tree in list. + * + * Get next object in focus chain of one object sub-tree ordered by one list. + * Return the next object by reference. If don't have any candidate to receive + * focus before list end, the first candidate will be returned. + * + * @param obj The widget root of sub-tree + * @param dir Direction os focus chain + * @param items list with ordered objects + * @param list_data_get function to get the object from one item of list + * @param next The next object in focus chain + * @return EINA_TRUE if don't need focus chain restart/loop back + * to use 'next' obj. + * + * @ingroup Widget + */ +EAPI Eina_Bool +elm_widget_focus_list_next_get(const Evas_Object *obj, + const Eina_List *items, + void *(*list_data_get)(const Eina_List * list), + Elm_Focus_Direction dir, + Evas_Object **next) +{ + Eina_List *(*list_next)(const Eina_List * list) = NULL; + + if (!next) + return EINA_FALSE; + *next = NULL; + + if (!_elm_widget_is(obj)) + return EINA_FALSE; + + if (!items) + return EINA_FALSE; + + /* Direction */ + if (dir == ELM_FOCUS_PREVIOUS) + { + items = eina_list_last(items); + list_next = eina_list_prev; + } + else if (dir == ELM_FOCUS_NEXT) + list_next = eina_list_next; + else + return EINA_FALSE; + + const Eina_List *l = items; + + /* Recovery last focused sub item */ + if (elm_widget_focus_get(obj)) + for (; l; l = list_next(l)) + { + Evas_Object *cur = list_data_get(l); + if (elm_widget_focus_get(cur)) break; + } + + const Eina_List *start = l; + Evas_Object *to_focus = NULL; + + /* Interate sub items */ + /* Go to end of list */ + for (; l; l = list_next(l)) + { + Evas_Object *tmp = NULL; + Evas_Object *cur = list_data_get(l); + + if (elm_widget_parent_get(cur) != obj) + continue; + + /* Try Focus cycle in subitem */ + if (elm_widget_focus_next_get(cur, dir, &tmp)) + { + *next = tmp; + return EINA_TRUE; + } + else if ((tmp) && (!to_focus)) + to_focus = tmp; + } + + l = items; + + /* Get First possible */ + for (; l != start; l = list_next(l)) + { + Evas_Object *tmp = NULL; + Evas_Object *cur = list_data_get(l); + + if (elm_widget_parent_get(cur) != obj) + continue; + + /* Try Focus cycle in subitem */ + elm_widget_focus_next_get(cur, dir, &tmp); + if (tmp) + { + *next = tmp; + return EINA_FALSE; + } + } + + *next = to_focus; + return EINA_FALSE; +} + +EAPI void +elm_widget_signal_emit(Evas_Object *obj, + const char *emission, + const char *source) +{ + API_ENTRY return; + if (!sd->signal_func) return; + sd->signal_func(obj, emission, source); +} + +static void +_edje_signal_callback(void *data, + Evas_Object *obj __UNUSED__, + const char *emission, + const char *source) +{ + Edje_Signal_Data *esd = data; + esd->func(esd->data, esd->obj, emission, source); +} + +EAPI void +elm_widget_signal_callback_add(Evas_Object *obj, + const char *emission, + const char *source, + Edje_Signal_Cb func, + void *data) +{ + Edje_Signal_Data *esd; + API_ENTRY return; + if (!sd->callback_add_func) return; + EINA_SAFETY_ON_NULL_RETURN(func); + + esd = ELM_NEW(Edje_Signal_Data); + if (!esd) return; + + esd->obj = obj; + esd->func = func; + esd->emission = eina_stringshare_add(emission); + esd->source = eina_stringshare_add(source); + esd->data = data; + sd->edje_signals = eina_list_append(sd->edje_signals, esd); + sd->callback_add_func(obj, emission, source, _edje_signal_callback, esd); +} + +EAPI void * +elm_widget_signal_callback_del(Evas_Object *obj, + const char *emission, + const char *source, + Edje_Signal_Cb func) +{ + Edje_Signal_Data *esd; + Eina_List *l; + void *data = NULL; + API_ENTRY return NULL; + if (!sd->callback_del_func) return NULL; + + EINA_LIST_FOREACH(sd->edje_signals, l, esd) + { + if ((esd->func == func) && (!strcmp(esd->emission, emission)) && + (!strcmp(esd->source, source))) + { + sd->edje_signals = eina_list_remove_list(sd->edje_signals, l); + eina_stringshare_del(esd->emission); + eina_stringshare_del(esd->source); + data = esd->data; + free(esd); + + sd->callback_del_func + (obj, emission, source, _edje_signal_callback, esd); + return data; + } + } + + return data; +} + +EAPI void +elm_widget_focus_set(Evas_Object *obj, + int first) +{ + API_ENTRY return; + if (!sd->focused) + { + focus_order++; + sd->focus_order = focus_order; + sd->focused = EINA_TRUE; + if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj); + } + if (sd->focus_func) + { + sd->focus_func(obj); + return; + } + else + { + if (first) + { + if ((_is_focusable(sd->resize_obj)) && + (!elm_widget_disabled_get(sd->resize_obj))) + { + elm_widget_focus_set(sd->resize_obj, first); + } + else + { + const Eina_List *l; + Evas_Object *child; + EINA_LIST_FOREACH(sd->subobjs, l, child) + { + if ((_is_focusable(child)) && + (!elm_widget_disabled_get(child))) + { + elm_widget_focus_set(child, first); + break; + } + } + } + } + else + { + const Eina_List *l; + Evas_Object *child; + EINA_LIST_REVERSE_FOREACH(sd->subobjs, l, child) + { + if ((_is_focusable(child)) && + (!elm_widget_disabled_get(child))) + { + elm_widget_focus_set(child, first); + break; + } + } + if (!l) + { + if ((_is_focusable(sd->resize_obj)) && + (!elm_widget_disabled_get(sd->resize_obj))) + { + elm_widget_focus_set(sd->resize_obj, first); + } + } + } + } +} + +EAPI Evas_Object * +elm_widget_parent_get(const Evas_Object *obj) +{ + API_ENTRY return NULL; + return sd->parent_obj; +} + +EAPI void +elm_widget_focused_object_clear(Evas_Object *obj) +{ + API_ENTRY return; + if (!sd->focused) return; + if (sd->resize_obj && elm_widget_focus_get(sd->resize_obj)) + elm_widget_focused_object_clear(sd->resize_obj); + else + { + const Eina_List *l; + Evas_Object *child; + EINA_LIST_FOREACH(sd->subobjs, l, child) + { + if (elm_widget_focus_get(child)) + { + elm_widget_focused_object_clear(child); + break; + } + } + } + sd->focused = EINA_FALSE; + if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj); + if (sd->focus_func) sd->focus_func(obj); +} + +EAPI void +elm_widget_focus_steal(Evas_Object *obj) +{ + Evas_Object *parent, *parent2, *o; + API_ENTRY return; + + if (sd->focused) return; + if (sd->disabled) return; + if (!sd->can_focus) return; + if (sd->tree_unfocusable) return; + parent = obj; + for (;;) + { + o = elm_widget_parent_get(parent); + if (!o) break; + sd = evas_object_smart_data_get(o); + if (sd->disabled || sd->tree_unfocusable) return; + if (sd->focused) break; + parent = o; + } + if ((!elm_widget_parent_get(parent)) && + (!elm_widget_parent2_get(parent))) + elm_widget_focused_object_clear(parent); + else + { + parent2 = elm_widget_parent_get(parent); + if (!parent2) parent2 = elm_widget_parent2_get(parent); + parent = parent2; + sd = evas_object_smart_data_get(parent); + if (sd) + { + if ((sd->resize_obj) && (elm_widget_focus_get(sd->resize_obj))) + elm_widget_focused_object_clear(sd->resize_obj); + else + { + const Eina_List *l; + Evas_Object *child; + EINA_LIST_FOREACH(sd->subobjs, l, child) + { + if (elm_widget_focus_get(child)) + { + elm_widget_focused_object_clear(child); + break; + } + } + } + } + } + _parent_focus(obj); + return; +} + +EAPI void +elm_widget_focus_restore(Evas_Object *obj) +{ + Evas_Object *newest = NULL; + unsigned int newest_focus_order = 0; + API_ENTRY return; + + newest = _newest_focus_order_get(obj, &newest_focus_order, EINA_TRUE); + if (newest) + { + elm_object_focus_set(newest, EINA_FALSE); + elm_object_focus_set(newest, EINA_TRUE); + } +} + +void +_elm_widget_top_win_focused_set(Evas_Object *obj, Eina_Bool top_win_focused) +{ + const Eina_List *l; + Evas_Object *child; + API_ENTRY return; + + if (sd->top_win_focused == top_win_focused) return; + if (sd->resize_obj) + _elm_widget_top_win_focused_set(sd->resize_obj, top_win_focused); + EINA_LIST_FOREACH(sd->subobjs, l, child) + { + _elm_widget_top_win_focused_set(child, top_win_focused); + } + sd->top_win_focused = top_win_focused; +} + +Eina_Bool +_elm_widget_top_win_focused_get(const Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + return sd->top_win_focused; +} + +EAPI void +elm_widget_activate(Evas_Object *obj) +{ + API_ENTRY return; + elm_widget_change(obj); + if (sd->activate_func) sd->activate_func(obj); +} + +EAPI void +elm_widget_change(Evas_Object *obj) +{ + API_ENTRY return; + elm_widget_change(elm_widget_parent_get(obj)); + if (sd->on_change_func) sd->on_change_func(sd->on_change_data, obj); +} + +EAPI void +elm_widget_disabled_set(Evas_Object *obj, + Eina_Bool disabled) +{ + API_ENTRY return; + + if (sd->disabled == disabled) return; + sd->disabled = !!disabled; + elm_widget_focus_disabled_handle(obj); + if (sd->disable_func) sd->disable_func(obj); +} + +EAPI Eina_Bool +elm_widget_disabled_get(const Evas_Object *obj) +{ + API_ENTRY return 0; + return sd->disabled; +} + +EAPI void +elm_widget_show_region_set(Evas_Object *obj, + Evas_Coord x, + Evas_Coord y, + Evas_Coord w, + Evas_Coord h, + Eina_Bool forceshow) +{ + Evas_Object *parent_obj, *child_obj; + Evas_Coord px, py, cx, cy; + + API_ENTRY return; + + evas_smart_objects_calculate(evas_object_evas_get(obj)); + + if (!forceshow && (x == sd->rx) && (y == sd->ry) && + (w == sd->rw) && (h == sd->rh)) return; + sd->rx = x; + sd->ry = y; + sd->rw = w; + sd->rh = h; + if (sd->on_show_region_func) + sd->on_show_region_func(sd->on_show_region_data, obj); + + do + { + parent_obj = sd->parent_obj; + child_obj = sd->obj; + if ((!parent_obj) || (!_elm_widget_is(parent_obj))) break; + sd = evas_object_smart_data_get(parent_obj); + if (!sd) break; + + evas_object_geometry_get(parent_obj, &px, &py, NULL, NULL); + evas_object_geometry_get(child_obj, &cx, &cy, NULL, NULL); + + x += (cx - px); + y += (cy - py); + sd->rx = x; + sd->ry = y; + sd->rw = w; + sd->rh = h; + + if (sd->on_show_region_func) + { + sd->on_show_region_func(sd->on_show_region_data, parent_obj); + } + } + while (parent_obj); +} + +EAPI void +elm_widget_show_region_get(const Evas_Object *obj, + Evas_Coord *x, + Evas_Coord *y, + Evas_Coord *w, + Evas_Coord *h) +{ + API_ENTRY return; + if (x) *x = sd->rx; + if (y) *y = sd->ry; + if (w) *w = sd->rw; + if (h) *h = sd->rh; +} + +/** + * @internal + * + * Get the focus region of the given widget. + * + * The focus region is the area of a widget that should brought into the + * visible area when the widget is focused. Mostly used to show the part of + * an entry where the cursor is, for example. The area returned is relative + * to the object @p obj. + * If the @p obj doesn't have the proper on_focus_region_hook set, this + * function will return the full size of the object. + * + * @param obj The widget object + * @param x Where to store the x coordinate of the area + * @param y Where to store the y coordinate of the area + * @param w Where to store the width of the area + * @param h Where to store the height of the area + * + * @ingroup Widget + */ +EAPI void +elm_widget_focus_region_get(const Evas_Object *obj, + Evas_Coord *x, + Evas_Coord *y, + Evas_Coord *w, + Evas_Coord *h) +{ + Smart_Data *sd; + + if (!obj) return; + + sd = evas_object_smart_data_get(obj); + if (!sd || !_elm_widget_is(obj) || !sd->on_focus_region_func) + { + evas_object_geometry_get(obj, NULL, NULL, w, h); + if (x) *x = 0; + if (y) *y = 0; + return; + } + sd->on_focus_region_func(obj, x, y, w, h); +} + +EAPI void +elm_widget_scroll_hold_push(Evas_Object *obj) +{ + API_ENTRY return; + sd->scroll_hold++; + if (sd->scroll_hold == 1) + evas_object_smart_callback_call(obj, "scroll-hold-on", obj); + if (sd->parent_obj) elm_widget_scroll_hold_push(sd->parent_obj); + // FIXME: on delete/reparent hold pop +} + +EAPI void +elm_widget_scroll_hold_pop(Evas_Object *obj) +{ + API_ENTRY return; + sd->scroll_hold--; + if (!sd->scroll_hold) + evas_object_smart_callback_call(obj, "scroll-hold-off", obj); + if (sd->parent_obj) elm_widget_scroll_hold_pop(sd->parent_obj); + if (sd->scroll_hold < 0) sd->scroll_hold = 0; +} + +EAPI int +elm_widget_scroll_hold_get(const Evas_Object *obj) +{ + API_ENTRY return 0; + return sd->scroll_hold; +} + +EAPI void +elm_widget_scroll_freeze_push(Evas_Object *obj) +{ + API_ENTRY return; + sd->scroll_freeze++; + if (sd->scroll_freeze == 1) + evas_object_smart_callback_call(obj, "scroll-freeze-on", obj); + if (sd->parent_obj) elm_widget_scroll_freeze_push(sd->parent_obj); + // FIXME: on delete/reparent freeze pop +} + +EAPI void +elm_widget_scroll_freeze_pop(Evas_Object *obj) +{ + API_ENTRY return; + sd->scroll_freeze--; + if (!sd->scroll_freeze) + evas_object_smart_callback_call(obj, "scroll-freeze-off", obj); + if (sd->parent_obj) elm_widget_scroll_freeze_pop(sd->parent_obj); + if (sd->scroll_freeze < 0) sd->scroll_freeze = 0; +} + +EAPI int +elm_widget_scroll_freeze_get(const Evas_Object *obj) +{ + API_ENTRY return 0; + return sd->scroll_freeze; +} + +EAPI void +elm_widget_scale_set(Evas_Object *obj, + double scale) +{ + API_ENTRY return; + if (scale <= 0.0) scale = 0.0; + if (sd->scale != scale) + { + sd->scale = scale; + elm_widget_theme(obj); + } +} + +EAPI double +elm_widget_scale_get(const Evas_Object *obj) +{ + API_ENTRY return 1.0; + // FIXME: save walking up the tree by storing/caching parent scale + if (sd->scale == 0.0) + { + if (sd->parent_obj) + return elm_widget_scale_get(sd->parent_obj); + else + return 1.0; + } + return sd->scale; +} + +EAPI void +elm_widget_theme_set(Evas_Object *obj, + Elm_Theme *th) +{ + API_ENTRY return; + if (sd->theme != th) + { + if (sd->theme) elm_theme_free(sd->theme); + sd->theme = th; + if (th) th->ref++; + elm_widget_theme(obj); + } +} + +EAPI void +elm_widget_text_part_set(Evas_Object *obj, const char *part, const char *label) +{ + API_ENTRY return; + + if (!sd->text_set_func) + return; + + sd->text_set_func(obj, part, label); +} + +EAPI const char * +elm_widget_text_part_get(const Evas_Object *obj, const char *part) +{ + API_ENTRY return NULL; + + if (!sd->text_get_func) + return NULL; + + return sd->text_get_func(obj, part); +} + +EAPI void +elm_widget_domain_translatable_text_part_set(Evas_Object *obj, const char *part, const char *domain, const char *label) +{ + const char *str; + Eina_List *l; + Elm_Translate_String_Data *ts = NULL; + API_ENTRY return; + + str = eina_stringshare_add(part); + EINA_LIST_FOREACH(sd->translate_strings, l, ts) + if (ts->id == str) + break; + else + ts = NULL; + + if (!ts && !label) + eina_stringshare_del(str); + else if (!ts) + { + ts = malloc(sizeof(Elm_Translate_String_Data)); + if (!ts) return; + + ts->id = str; + ts->domain = eina_stringshare_add(domain); + ts->string = eina_stringshare_add(label); + sd->translate_strings = eina_list_append(sd->translate_strings, ts); + } + else + { + if (label) + { + eina_stringshare_replace(&ts->domain, domain); + eina_stringshare_replace(&ts->string, label); + } + else + { + sd->translate_strings = eina_list_remove_list( + sd->translate_strings, l); + eina_stringshare_del(ts->id); + eina_stringshare_del(ts->domain); + eina_stringshare_del(ts->string); + free(ts); + } + eina_stringshare_del(str); + } + +#ifdef HAVE_GETTEXT + if (label && label[0]) + label = dgettext(domain, label); +#endif + elm_widget_text_part_set(obj, part, label); +} + +EAPI const char * +elm_widget_translatable_text_part_get(const Evas_Object *obj, const char *part) +{ + const char *str, *ret = NULL; + Eina_List *l; + Elm_Translate_String_Data *ts; + API_ENTRY return NULL; + + str = eina_stringshare_add(part); + EINA_LIST_FOREACH(sd->translate_strings, l, ts) + if (ts->id == str) + { + ret = ts->string; + break; + } + eina_stringshare_del(str); + return ret; +} + +EAPI void +elm_widget_translate(Evas_Object *obj) +{ + const Eina_List *l; + Evas_Object *child; +#ifdef HAVE_GETTEXT + Elm_Translate_String_Data *ts; +#endif + + API_ENTRY return; + EINA_LIST_FOREACH(sd->subobjs, l, child) elm_widget_translate(child); + if (sd->resize_obj) elm_widget_translate(sd->resize_obj); + if (sd->hover_obj) elm_widget_translate(sd->hover_obj); + if (sd->translate_func) sd->translate_func(obj); + +#ifdef HAVE_GETTEXT + EINA_LIST_FOREACH(sd->translate_strings, l, ts) + { + const char *s = dgettext(ts->domain, ts->string); + elm_widget_text_part_set(obj, ts->id, s); + } +#endif +} + +EAPI void +elm_widget_content_part_set(Evas_Object *obj, const char *part, Evas_Object *content) +{ + API_ENTRY return; + + if (!sd->content_set_func) return; + sd->content_set_func(obj, part, content); +} + +EAPI Evas_Object * +elm_widget_content_part_get(const Evas_Object *obj, const char *part) +{ + API_ENTRY return NULL; + + if (!sd->content_get_func) return NULL; + return sd->content_get_func(obj, part); +} + +EAPI Evas_Object * +elm_widget_content_part_unset(Evas_Object *obj, const char *part) +{ + API_ENTRY return NULL; + + if (!sd->content_unset_func) return NULL; + return sd->content_unset_func(obj, part); +} + +EAPI void +elm_widget_access_info_set(Evas_Object *obj, const char *txt) +{ + API_ENTRY return; + if (sd->access_info) eina_stringshare_del(sd->access_info); + if (!txt) sd->access_info = NULL; + else sd->access_info = eina_stringshare_add(txt); +} + +EAPI const char * +elm_widget_access_info_get(const Evas_Object *obj) +{ + API_ENTRY return NULL; + return sd->access_info; +} + +EAPI Elm_Theme * +elm_widget_theme_get(const Evas_Object *obj) +{ + API_ENTRY return NULL; + if (!sd->theme) + { + if (sd->parent_obj) + return elm_widget_theme_get(sd->parent_obj); + else + return NULL; + } + return sd->theme; +} + +EAPI Eina_Bool +elm_widget_style_set(Evas_Object *obj, + const char *style) +{ + API_ENTRY return EINA_FALSE; + + if (eina_stringshare_replace(&sd->style, style)) + return elm_widget_theme(obj); + + return EINA_TRUE; +} + +EAPI const char * +elm_widget_style_get(const Evas_Object *obj) +{ + API_ENTRY return NULL; + if (sd->style) return sd->style; + return "default"; +} + +EAPI void +elm_widget_type_set(Evas_Object *obj, + const char *type) +{ + API_ENTRY return; + eina_stringshare_replace(&sd->type, type); +} + +EAPI const char * +elm_widget_type_get(const Evas_Object *obj) +{ + API_ENTRY return NULL; + if (sd->type) return sd->type; + return ""; +} + +EAPI void +elm_widget_tooltip_add(Evas_Object *obj, + Elm_Tooltip *tt) +{ + API_ENTRY return; + sd->tooltips = eina_list_append(sd->tooltips, tt); +} + +EAPI void +elm_widget_tooltip_del(Evas_Object *obj, + Elm_Tooltip *tt) +{ + API_ENTRY return; + sd->tooltips = eina_list_remove(sd->tooltips, tt); +} + +EAPI void +elm_widget_cursor_add(Evas_Object *obj, + Elm_Cursor *cur) +{ + API_ENTRY return; + sd->cursors = eina_list_append(sd->cursors, cur); +} + +EAPI void +elm_widget_cursor_del(Evas_Object *obj, + Elm_Cursor *cur) +{ + API_ENTRY return; + sd->cursors = eina_list_remove(sd->cursors, cur); +} + +EAPI void +elm_widget_drag_lock_x_set(Evas_Object *obj, + Eina_Bool lock) +{ + API_ENTRY return; + if (sd->drag_x_locked == lock) return; + sd->drag_x_locked = lock; + if (sd->drag_x_locked) _propagate_x_drag_lock(obj, 1); + else _propagate_x_drag_lock(obj, -1); +} + +EAPI void +elm_widget_drag_lock_y_set(Evas_Object *obj, + Eina_Bool lock) +{ + API_ENTRY return; + if (sd->drag_y_locked == lock) return; + sd->drag_y_locked = lock; + if (sd->drag_y_locked) _propagate_y_drag_lock(obj, 1); + else _propagate_y_drag_lock(obj, -1); +} + +EAPI Eina_Bool +elm_widget_drag_lock_x_get(const Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + return sd->drag_x_locked; +} + +EAPI Eina_Bool +elm_widget_drag_lock_y_get(const Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + return sd->drag_y_locked; +} + +EAPI int +elm_widget_drag_child_locked_x_get(const Evas_Object *obj) +{ + API_ENTRY return 0; + return sd->child_drag_x_locked; +} + +EAPI int +elm_widget_drag_child_locked_y_get(const Evas_Object *obj) +{ + API_ENTRY return 0; + return sd->child_drag_y_locked; +} + +EAPI Eina_Bool +elm_widget_theme_object_set(Evas_Object *obj, + Evas_Object *edj, + const char *wname, + const char *welement, + const char *wstyle) +{ + API_ENTRY return EINA_FALSE; + return _elm_theme_object_set(obj, edj, wname, welement, wstyle); +} + +EAPI Eina_Bool +elm_widget_is_check(const Evas_Object *obj) +{ + static int abort_on_warn = -1; + if (elm_widget_is(obj)) + return EINA_TRUE; + + ERR("Passing Object: %p.", obj); + if (abort_on_warn == -1) + { + if (getenv("ELM_ERROR_ABORT")) abort_on_warn = 1; + else abort_on_warn = 0; + } + if (abort_on_warn == 1) abort(); + return EINA_FALSE; +} + +EAPI Eina_Bool +elm_widget_type_check(const Evas_Object *obj, + const char *type, + const char *func) +{ + const char *provided, *expected = "(unknown)"; + static int abort_on_warn = -1; + provided = elm_widget_type_get(obj); + if (EINA_LIKELY(provided == type)) return EINA_TRUE; + if (type) expected = type; + if ((!provided) || (!provided[0])) + { + provided = evas_object_type_get(obj); + if ((!provided) || (!provided[0])) + provided = "(unknown)"; + } + ERR("Passing Object: %p in function: %s, of type: '%s' when expecting type: '%s'", obj, func, provided, expected); + if (abort_on_warn == -1) + { + if (getenv("ELM_ERROR_ABORT")) abort_on_warn = 1; + else abort_on_warn = 0; + } + if (abort_on_warn == 1) abort(); + return EINA_FALSE; +} + +static Evas_Object * +_widget_name_find(const Evas_Object *obj, const char *name, int recurse) +{ + Eina_List *l; + Evas_Object *child; + const char *s; + INTERNAL_ENTRY NULL; + + if (!_elm_widget_is(obj)) return NULL; + if (sd->resize_obj) + { + s = evas_object_name_get(sd->resize_obj); + if ((s) && (!strcmp(s, name))) return sd->resize_obj; + if ((recurse != 0) && + ((child = _widget_name_find(sd->resize_obj, name, recurse - 1)))) + return child; + } + EINA_LIST_FOREACH(sd->subobjs, l, child) + { + s = evas_object_name_get(child); + if ((s) && (!strcmp(s, name))) return child; + if ((recurse != 0) && + ((child = _widget_name_find(child, name, recurse - 1)))) + return child; + } + if (sd->hover_obj) + { + s = evas_object_name_get(sd->hover_obj); + if ((s) && (!strcmp(s, name))) return sd->hover_obj; + if ((recurse != 0) && + ((child = _widget_name_find(sd->hover_obj, name, recurse - 1)))) + return child; + } + return NULL; +} + +EAPI Evas_Object * +elm_widget_name_find(const Evas_Object *obj, const char *name, int recurse) +{ + API_ENTRY return NULL; + if (!name) return NULL; + return _widget_name_find(obj, name, recurse); +} + +/** + * @internal + * + * Split string in words + * + * @param str Source string + * @return List of const words + * + * @see elm_widget_stringlist_free() + * @ingroup Widget + */ +EAPI Eina_List * +elm_widget_stringlist_get(const char *str) +{ + Eina_List *list = NULL; + const char *s, *b; + if (!str) return NULL; + for (b = s = str; 1; s++) + { + if ((*s == ' ') || (!*s)) + { + char *t = malloc(s - b + 1); + if (t) + { + strncpy(t, b, s - b); + t[s - b] = 0; + list = eina_list_append(list, eina_stringshare_add(t)); + free(t); + } + b = s + 1; + } + if (!*s) break; + } + return list; +} + +EAPI void +elm_widget_stringlist_free(Eina_List *list) +{ + const char *s; + EINA_LIST_FREE(list, s) eina_stringshare_del(s); +} + +EAPI void +elm_widget_focus_hide_handle(Evas_Object *obj) +{ + if (!_elm_widget_is(obj)) + return; + _if_focused_revert(obj, EINA_TRUE); +} + +EAPI void +elm_widget_focus_mouse_up_handle(Evas_Object *obj) +{ + Evas_Object *o = obj; + do + { + if (_elm_widget_is(o)) break; + o = evas_object_smart_parent_get(o); + } + while (o); + if (!o) return; + if (!_is_focusable(o)) return; + elm_widget_focus_steal(o); +} + +EAPI void +elm_widget_focus_tree_unfocusable_handle(Evas_Object *obj) +{ + API_ENTRY return; + + //FIXME: Need to check whether the object is unfocusable or not. + + if (!elm_widget_parent_get(obj)) + elm_widget_focused_object_clear(obj); + else + _if_focused_revert(obj, EINA_TRUE); +} + +EAPI void +elm_widget_focus_disabled_handle(Evas_Object *obj) +{ + API_ENTRY return; + + elm_widget_focus_tree_unfocusable_handle(obj); +} + +EAPI unsigned int +elm_widget_focus_order_get(const Evas_Object *obj) +{ + API_ENTRY return 0; + return sd->focus_order; +} + +/** + * @internal + * + * Allocate a new Elm_Widget_Item-derived structure. + * + * The goal of this structure is to provide common ground for actions + * that a widget item have, such as the owner widget, callback to + * notify deletion, data pointer and maybe more. + * + * @param widget the owner widget that holds this item, must be an elm_widget! + * @param alloc_size any number greater than sizeof(Elm_Widget_Item) that will + * be used to allocate memory. + * + * @return allocated memory that is already zeroed out, or NULL on errors. + * + * @see elm_widget_item_new() convenience macro. + * @see elm_widget_item_del() to release memory. + * @ingroup Widget + */ +EAPI Elm_Widget_Item * +_elm_widget_item_new(Evas_Object *widget, + size_t alloc_size) +{ + if (!_elm_widget_is(widget)) + return NULL; + + Elm_Widget_Item *item; + + EINA_SAFETY_ON_TRUE_RETURN_VAL(alloc_size < sizeof(Elm_Widget_Item), NULL); + EINA_SAFETY_ON_TRUE_RETURN_VAL(!_elm_widget_is(widget), NULL); + + item = calloc(1, alloc_size); + EINA_SAFETY_ON_NULL_RETURN_VAL(item, NULL); + + EINA_MAGIC_SET(item, ELM_WIDGET_ITEM_MAGIC); + item->widget = widget; + return item; +} + +EAPI void +_elm_widget_item_free(Elm_Widget_Item *item) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + + _elm_access_item_unregister(item); + + if (item->del_func) + item->del_func((void *)item->data, item->widget, item); + + if (item->view) + evas_object_del(item->view); + + if (item->access) + { + _elm_access_clear(item->access); + free(item->access); + } + + if (item->access_info) + eina_stringshare_del(item->access_info); + + EINA_MAGIC_SET(item, EINA_MAGIC_NONE); + free(item); +} + +/** + * @internal + * + * Releases widget item memory, calling back del_cb() if it exists. + * + * If there is a Elm_Widget_Item::del_cb, then it will be called prior + * to memory release. Note that elm_widget_item_pre_notify_del() calls + * this function and then unset it, thus being useful for 2 step + * cleanup whenever the del_cb may use any of the data that must be + * deleted from item. + * + * The Elm_Widget_Item::view will be deleted (evas_object_del()) if it + * is presented! + * + * @param item a valid #Elm_Widget_Item to be deleted. + * @see elm_widget_item_del() convenience macro. + * @ingroup Widget + */ +EAPI void +_elm_widget_item_del(Elm_Widget_Item *item) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + + //Widget item delete callback + if (item->del_pre_func) + { + if (item->del_pre_func((Elm_Object_Item *)item)) + _elm_widget_item_free(item); + } + else + _elm_widget_item_free(item); +} + +/** + * @internal + * + * Set the function to notify to widgets when item is being deleted by user. + * + * @param item a valid #Elm_Widget_Item to be notified + * @see elm_widget_item_del_pre_hook_set() convenience macro. + * @ingroup Widget + */ +EAPI void +_elm_widget_item_del_pre_hook_set(Elm_Widget_Item *item, Elm_Widget_Del_Pre_Cb func) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + item->del_pre_func = func; +} + +/** + * @internal + * + * Notify object will be deleted without actually deleting it. + * + * This function will callback Elm_Widget_Item::del_cb if it is set + * and then unset it so it is not called twice (ie: from + * elm_widget_item_del()). + * + * @param item a valid #Elm_Widget_Item to be notified + * @see elm_widget_item_pre_notify_del() convenience macro. + * @ingroup Widget + */ +EAPI void +_elm_widget_item_pre_notify_del(Elm_Widget_Item *item) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + if (!item->del_func) return; + item->del_func((void *)item->data, item->widget, item); + item->del_func = NULL; +} + +/** + * @internal + * + * Set the function to notify when item is being deleted. + * + * This function will complain if there was a callback set already, + * however it will set the new one. + * + * The callback will be called from elm_widget_item_pre_notify_del() + * or elm_widget_item_del() will be called with: + * - data: the Elm_Widget_Item::data value. + * - obj: the Elm_Widget_Item::widget evas object. + * - event_info: the item being deleted. + * + * @param item a valid #Elm_Widget_Item to be notified + * @see elm_widget_item_del_cb_set() convenience macro. + * @ingroup Widget + */ +EAPI void +_elm_widget_item_del_cb_set(Elm_Widget_Item *item, + Evas_Smart_Cb func) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + + if ((item->del_func) && (item->del_func != func)) + WRN("You're replacing a previously set del_cb %p of item %p with %p", + item->del_func, item, func); + + item->del_func = func; +} + +/** + * @internal + * + * Set user-data in this item. + * + * User data may be used to identify this item or just store any + * application data. It is automatically given as the first parameter + * of the deletion notify callback. + * + * @param item a valid #Elm_Widget_Item to store data in. + * @param data user data to store. + * @see elm_widget_item_del_cb_set() convenience macro. + * @ingroup Widget + */ +EAPI void +_elm_widget_item_data_set(Elm_Widget_Item *item, + const void *data) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + if ((item->data) && (item->data != data)) + DBG("Replacing item %p data %p with %p", item, item->data, data); + item->data = data; +} + +/** + * @internal + * + * Retrieves user-data of this item. + * + * @param item a valid #Elm_Widget_Item to get data from. + * @see elm_widget_item_data_set() + * @ingroup Widget + */ +EAPI void * +_elm_widget_item_data_get(const Elm_Widget_Item *item) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL); + return (void *)item->data; +} + +EAPI void +_elm_widget_item_disabled_set(Elm_Widget_Item *item, Eina_Bool disabled) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + + if (item->disabled == disabled) return; + item->disabled = !!disabled; + if (item->disable_func) item->disable_func(item); +} + +EAPI Eina_Bool +_elm_widget_item_disabled_get(const Elm_Widget_Item *item) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, EINA_FALSE); + return item->disabled; +} + +EAPI void +_elm_widget_item_disable_hook_set(Elm_Widget_Item *item, + Elm_Widget_Disable_Cb func) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + item->disable_func = func; +} + +typedef struct _Elm_Widget_Item_Tooltip Elm_Widget_Item_Tooltip; + +struct _Elm_Widget_Item_Tooltip +{ + Elm_Widget_Item *item; + Elm_Tooltip_Item_Content_Cb func; + Evas_Smart_Cb del_cb; + const void *data; +}; + +static Evas_Object * +_elm_widget_item_tooltip_label_create(void *data, + Evas_Object *obj __UNUSED__, + Evas_Object *tooltip, + void *item __UNUSED__) +{ + Evas_Object *label = elm_label_add(tooltip); + if (!label) + return NULL; + elm_object_style_set(label, "tooltip"); + elm_object_text_set(label, data); + return label; +} + +static Evas_Object * +_elm_widget_item_tooltip_trans_label_create(void *data, + Evas_Object *obj __UNUSED__, + Evas_Object *tooltip, + void *item __UNUSED__) +{ + Evas_Object *label = elm_label_add(tooltip); + if (!label) + return NULL; + elm_object_style_set(label, "tooltip"); + elm_object_translatable_text_set(label, data); + return label; +} + +static void +_elm_widget_item_tooltip_label_del_cb(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + eina_stringshare_del(data); +} + +/** + * @internal + * + * Set the text to be shown in the widget item. + * + * @param item Target item + * @param text The text to set in the content + * + * Setup the text as tooltip to object. The item can have only one tooltip, + * so any previous tooltip data is removed. + * + * @ingroup Widget + */ +EAPI void +_elm_widget_item_tooltip_text_set(Elm_Widget_Item *item, + const char *text) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + EINA_SAFETY_ON_NULL_RETURN(text); + + text = eina_stringshare_add(text); + _elm_widget_item_tooltip_content_cb_set + (item, _elm_widget_item_tooltip_label_create, text, + _elm_widget_item_tooltip_label_del_cb); +} + +EAPI void +_elm_widget_item_tooltip_translatable_text_set(Elm_Widget_Item *item, + const char *text) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + EINA_SAFETY_ON_NULL_RETURN(text); + + text = eina_stringshare_add(text); + _elm_widget_item_tooltip_content_cb_set + (item, _elm_widget_item_tooltip_trans_label_create, text, + _elm_widget_item_tooltip_label_del_cb); +} + +static Evas_Object * +_elm_widget_item_tooltip_create(void *data, + Evas_Object *obj, + Evas_Object *tooltip) +{ + Elm_Widget_Item_Tooltip *wit = data; + return wit->func((void *)wit->data, obj, tooltip, wit->item); +} + +static void +_elm_widget_item_tooltip_del_cb(void *data, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Elm_Widget_Item_Tooltip *wit = data; + if (wit->del_cb) wit->del_cb((void *)wit->data, obj, wit->item); + free(wit); +} + +/** + * @internal + * + * Set the content to be shown in the tooltip item + * + * Setup the tooltip to item. The item can have only one tooltip, + * so any previous tooltip data is removed. @p func(with @p data) will + * be called every time that need show the tooltip and it should + * return a valid Evas_Object. This object is then managed fully by + * tooltip system and is deleted when the tooltip is gone. + * + * @param item the widget item being attached a tooltip. + * @param func the function used to create the tooltip contents. + * @param data what to provide to @a func as callback data/context. + * @param del_cb called when data is not needed anymore, either when + * another callback replaces @func, the tooltip is unset with + * elm_widget_item_tooltip_unset() or the owner @a item + * dies. This callback receives as the first parameter the + * given @a data, and @c event_info is the item. + * + * @ingroup Widget + */ +EAPI void +_elm_widget_item_tooltip_content_cb_set(Elm_Widget_Item *item, + Elm_Tooltip_Item_Content_Cb func, + const void *data, + Evas_Smart_Cb del_cb) +{ + Elm_Widget_Item_Tooltip *wit; + + ELM_WIDGET_ITEM_CHECK_OR_GOTO(item, error_noitem); + + if (!func) + { + _elm_widget_item_tooltip_unset(item); + return; + } + + wit = ELM_NEW(Elm_Widget_Item_Tooltip); + if (!wit) goto error; + wit->item = item; + wit->func = func; + wit->data = data; + wit->del_cb = del_cb; + + elm_object_sub_tooltip_content_cb_set + (item->view, item->widget, _elm_widget_item_tooltip_create, wit, + _elm_widget_item_tooltip_del_cb); + + return; + +error_noitem: + if (del_cb) del_cb((void *)data, NULL, item); + return; +error: + if (del_cb) del_cb((void *)data, item->widget, item); +} + +/** + * @internal + * + * Unset tooltip from item + * + * @param item widget item to remove previously set tooltip. + * + * Remove tooltip from item. The callback provided as del_cb to + * elm_widget_item_tooltip_content_cb_set() will be called to notify + * it is not used anymore. + * + * @see elm_widget_item_tooltip_content_cb_set() + * + * @ingroup Widget + */ +EAPI void +_elm_widget_item_tooltip_unset(Elm_Widget_Item *item) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + elm_object_tooltip_unset(item->view); +} + +/** + * @internal + * + * Sets a different style for this item tooltip. + * + * @note before you set a style you should define a tooltip with + * elm_widget_item_tooltip_content_cb_set() or + * elm_widget_item_tooltip_text_set() + * + * @param item widget item with tooltip already set. + * @param style the theme style to use (default, transparent, ...) + * + * @ingroup Widget + */ +EAPI void +_elm_widget_item_tooltip_style_set(Elm_Widget_Item *item, + const char *style) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + elm_object_tooltip_style_set(item->view, style); +} + +EAPI Eina_Bool +_elm_widget_item_tooltip_window_mode_set(Elm_Widget_Item *item, Eina_Bool disable) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, EINA_FALSE); + return elm_object_tooltip_window_mode_set(item->view, disable); +} + +EAPI Eina_Bool +_elm_widget_item_tooltip_window_mode_get(const Elm_Widget_Item *item) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, EINA_FALSE); + return elm_object_tooltip_window_mode_get(item->view); +} + +/** + * @internal + * + * Get the style for this item tooltip. + * + * @param item widget item with tooltip already set. + * @return style the theme style in use, defaults to "default". If the + * object does not have a tooltip set, then NULL is returned. + * + * @ingroup Widget + */ +EAPI const char * +_elm_widget_item_tooltip_style_get(const Elm_Widget_Item *item) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL); + return elm_object_tooltip_style_get(item->view); +} + +EAPI void +_elm_widget_item_cursor_set(Elm_Widget_Item *item, + const char *cursor) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + elm_object_sub_cursor_set(item->view, item->widget, cursor); +} + +EAPI const char * +_elm_widget_item_cursor_get(const Elm_Widget_Item *item) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL); + return elm_object_cursor_get(item->view); +} + +EAPI void +_elm_widget_item_cursor_unset(Elm_Widget_Item *item) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + elm_object_cursor_unset(item->view); +} + +/** + * @internal + * + * Sets a different style for this item cursor. + * + * @note before you set a style you should define a cursor with + * elm_widget_item_cursor_set() + * + * @param item widget item with cursor already set. + * @param style the theme style to use (default, transparent, ...) + * + * @ingroup Widget + */ +EAPI void +_elm_widget_item_cursor_style_set(Elm_Widget_Item *item, + const char *style) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + elm_object_cursor_style_set(item->view, style); +} + +/** + * @internal + * + * Get the style for this item cursor. + * + * @param item widget item with cursor already set. + * @return style the theme style in use, defaults to "default". If the + * object does not have a cursor set, then NULL is returned. + * + * @ingroup Widget + */ +EAPI const char * +_elm_widget_item_cursor_style_get(const Elm_Widget_Item *item) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL); + return elm_object_cursor_style_get(item->view); +} + +/** + * @internal + * + * Set if the cursor set should be searched on the theme or should use + * the provided by the engine, only. + * + * @note before you set if should look on theme you should define a cursor + * with elm_object_cursor_set(). By default it will only look for cursors + * provided by the engine. + * + * @param item widget item with cursor already set. + * @param engine_only boolean to define it cursors should be looked only + * between the provided by the engine or searched on widget's theme as well. + * + * @ingroup Widget + */ +EAPI void +_elm_widget_item_cursor_engine_only_set(Elm_Widget_Item *item, + Eina_Bool engine_only) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + elm_object_cursor_theme_search_enabled_set(item->view, engine_only); +} + +/** + * @internal + * + * Get the cursor engine only usage for this item cursor. + * + * @param item widget item with cursor already set. + * @return engine_only boolean to define it cursors should be looked only + * between the provided by the engine or searched on widget's theme as well. If + * the object does not have a cursor set, then EINA_FALSE is returned. + * + * @ingroup Widget + */ +EAPI Eina_Bool +_elm_widget_item_cursor_engine_only_get(const Elm_Widget_Item *item) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, EINA_FALSE); + return elm_object_cursor_theme_search_enabled_get(item->view); +} + +// smart object funcs +static void +_smart_reconfigure(Smart_Data *sd) +{ + if (sd->resize_obj) + { + evas_object_move(sd->resize_obj, sd->x, sd->y); + evas_object_resize(sd->resize_obj, sd->w, sd->h); + } + if (sd->hover_obj) + { + evas_object_move(sd->hover_obj, sd->x, sd->y); + evas_object_resize(sd->hover_obj, sd->w, sd->h); + } +} + +EAPI void +_elm_widget_item_part_content_set(Elm_Widget_Item *item, + const char *part, + Evas_Object *content) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + if (!item->content_set_func) + { + ERR("%s does not support elm_object_item_part_content_set() API.", + elm_widget_type_get(item->widget)); + return; + } + item->content_set_func((Elm_Object_Item *)item, part, content); +} + +EAPI Evas_Object * +_elm_widget_item_part_content_get(const Elm_Widget_Item *item, + const char *part) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL); + if (!item->content_get_func) + { + ERR("%s does not support elm_object_item_part_content_get() API.", + elm_widget_type_get(item->widget)); + return NULL; + } + return item->content_get_func((Elm_Object_Item *)item, part); +} + +EAPI Evas_Object * +_elm_widget_item_part_content_unset(Elm_Widget_Item *item, + const char *part) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL); + if (!item->content_unset_func) + { + ERR("%s does not support elm_object_item_part_content_unset() API.", + elm_widget_type_get(item->widget)); + return NULL; + } + return item->content_unset_func((Elm_Object_Item *)item, part); +} + +EAPI void +_elm_widget_item_part_text_set(Elm_Widget_Item *item, + const char *part, + const char *label) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + if (!item->text_set_func) + { + ERR("%s does not support elm_object_item_part_text_set() API.", + elm_widget_type_get(item->widget)); + return; + } + item->text_set_func((Elm_Object_Item *)item, part, label); +} + +EAPI const char * +_elm_widget_item_part_text_get(const Elm_Widget_Item *item, + const char *part) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL); + if (!item->text_get_func) + { + ERR("%s does not support elm_object_item_part_text_get() API.", + elm_widget_type_get(item->widget)); + return NULL; + } + return item->text_get_func((Elm_Object_Item *)item, part); +} + +EAPI void +_elm_widget_item_content_set_hook_set(Elm_Widget_Item *item, + Elm_Widget_Content_Set_Cb func) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + item->content_set_func = func; +} + +EAPI void +_elm_widget_item_content_get_hook_set(Elm_Widget_Item *item, + Elm_Widget_Content_Get_Cb func) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + item->content_get_func = func; +} + +EAPI void +_elm_widget_item_content_unset_hook_set(Elm_Widget_Item *item, + Elm_Widget_Content_Unset_Cb func) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + item->content_unset_func = func; +} + +EAPI void +_elm_widget_item_text_set_hook_set(Elm_Widget_Item *item, + Elm_Widget_Text_Set_Cb func) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + item->text_set_func = func; +} + +EAPI void +_elm_widget_item_text_get_hook_set(Elm_Widget_Item *item, + Elm_Widget_Text_Get_Cb func) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + item->text_get_func = func; +} + +EAPI void +_elm_widget_item_signal_emit(Elm_Widget_Item *item, + const char *emission, + const char *source) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + if (item->signal_emit_func) + item->signal_emit_func((Elm_Object_Item *)item, emission, source); +} + +EAPI void +_elm_widget_item_signal_emit_hook_set(Elm_Widget_Item *item, + Elm_Widget_Signal_Emit_Cb func) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + item->signal_emit_func = func; +} + +EAPI void +_elm_widget_item_access_info_set(Elm_Widget_Item *item, const char *txt) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + if (item->access_info) eina_stringshare_del(item->access_info); + if (!txt) item->access_info = NULL; + else item->access_info = eina_stringshare_add(txt); +} + +static void +_smart_add(Evas_Object *obj) +{ + Smart_Data *sd; + + sd = calloc(1, sizeof(Smart_Data)); + if (!sd) return; + sd->obj = obj; + sd->x = sd->y = sd->w = sd->h = 0; + sd->mirrored_auto_mode = EINA_TRUE; /* will follow system locale settings */ + evas_object_smart_data_set(obj, sd); + elm_widget_can_focus_set(obj, EINA_TRUE); +} + +static Evas_Object * +_newest_focus_order_get(Evas_Object *obj, + unsigned int *newest_focus_order, + Eina_Bool can_focus_only) +{ + const Eina_List *l; + Evas_Object *child, *ret, *best; + + API_ENTRY return NULL; + + if (!evas_object_visible_get(obj) + || (elm_widget_disabled_get(obj)) + || (elm_widget_tree_unfocusable_get(obj))) + return NULL; + + best = NULL; + if (*newest_focus_order < sd->focus_order) + { + *newest_focus_order = sd->focus_order; + best = obj; + } + EINA_LIST_FOREACH(sd->subobjs, l, child) + { + ret = _newest_focus_order_get(child, newest_focus_order, can_focus_only); + if (!ret) continue; + best = ret; + } + if (can_focus_only) + { + if ((!best) || (!elm_widget_can_focus_get(best))) + return NULL; + } + return best; +} + +static void +_if_focused_revert(Evas_Object *obj, + Eina_Bool can_focus_only) +{ + Evas_Object *top; + Evas_Object *newest = NULL; + unsigned int newest_focus_order = 0; + + INTERNAL_ENTRY; + + if (!sd->focused) return; + if (!sd->parent_obj) return; + + top = elm_widget_top_get(sd->parent_obj); + if (top) + { + newest = _newest_focus_order_get(top, &newest_focus_order, can_focus_only); + if (newest) + { + elm_object_focus_set(newest, EINA_FALSE); + elm_object_focus_set(newest, EINA_TRUE); + } + } +} + +static void +_smart_del(Evas_Object *obj) +{ + Evas_Object *sobj; + Edje_Signal_Data *esd; + Elm_Translate_String_Data *ts; + + INTERNAL_ENTRY; + + if (sd->del_pre_func) sd->del_pre_func(obj); + if (sd->resize_obj) + { + sobj = sd->resize_obj; + sd->resize_obj = NULL; + evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_DEL, _sub_obj_del, sd); + evas_object_smart_callback_call(sd->obj, "sub-object-del", sobj); + evas_object_del(sobj); + sd->resize_obj = NULL; + } + if (sd->hover_obj) + { + sobj = sd->hover_obj; + sd->hover_obj = NULL; + evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_DEL, _sub_obj_del, sd); + evas_object_smart_callback_call(sd->obj, "sub-object-del", sobj); + evas_object_del(sobj); + sd->hover_obj = NULL; + } + EINA_LIST_FREE(sd->subobjs, sobj) + { + evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_DEL, _sub_obj_del, sd); + evas_object_smart_callback_call(sd->obj, "sub-object-del", sobj); + evas_object_del(sobj); + } + sd->tooltips = eina_list_free(sd->tooltips); /* should be empty anyway */ + sd->cursors = eina_list_free(sd->cursors); /* should be empty anyway */ + EINA_LIST_FREE(sd->edje_signals, esd) + { + eina_stringshare_del(esd->emission); + eina_stringshare_del(esd->source); + free(esd); + } + EINA_LIST_FREE(sd->translate_strings, ts) + { + eina_stringshare_del(ts->id); + eina_stringshare_del(ts->domain); + eina_stringshare_del(ts->string); + free(ts); + } + sd->event_cb = eina_list_free(sd->event_cb); /* should be empty anyway */ + if (sd->del_func) sd->del_func(obj); + if (sd->style) eina_stringshare_del(sd->style); + if (sd->type) eina_stringshare_del(sd->type); + if (sd->theme) elm_theme_free(sd->theme); + sd->data = NULL; + _if_focused_revert(obj, EINA_TRUE); + if (sd->access_info) eina_stringshare_del(sd->access_info); + free(sd); + evas_object_smart_data_set(obj, NULL); +} + +static void +_smart_move(Evas_Object *obj, + Evas_Coord x, + Evas_Coord y) +{ + INTERNAL_ENTRY; + sd->x = x; + sd->y = y; + _smart_reconfigure(sd); +} + +static void +_smart_resize(Evas_Object *obj, + Evas_Coord w, + Evas_Coord h) +{ + INTERNAL_ENTRY; + sd->w = w; + sd->h = h; + _smart_reconfigure(sd); +} + +static void +_smart_show(Evas_Object *obj) +{ + Eina_List *list; + Evas_Object *o; + INTERNAL_ENTRY; + if ((list = evas_object_smart_members_get(obj))) + { + EINA_LIST_FREE(list, o) + { + if (evas_object_data_get(o, "_elm_leaveme")) continue; + evas_object_show(o); + } + } +} + +static void +_smart_hide(Evas_Object *obj) +{ + Eina_List *list; + Evas_Object *o; + INTERNAL_ENTRY; + + list = evas_object_smart_members_get(obj); + EINA_LIST_FREE(list, o) + { + if (evas_object_data_get(o, "_elm_leaveme")) continue; + evas_object_hide(o); + } +} + +static void +_smart_color_set(Evas_Object *obj, + int r, + int g, + int b, + int a) +{ + Eina_List *list; + Evas_Object *o; + INTERNAL_ENTRY; + if ((list = evas_object_smart_members_get(obj))) + { + EINA_LIST_FREE(list, o) + { + if (evas_object_data_get(o, "_elm_leaveme")) continue; + evas_object_color_set(o, r, g, b, a); + } + } +} + +static void +_smart_clip_set(Evas_Object *obj, + Evas_Object *clip) +{ + Eina_List *list; + Evas_Object *o; + INTERNAL_ENTRY; + if ((list = evas_object_smart_members_get(obj))) + { + EINA_LIST_FREE(list, o) + { + if (evas_object_data_get(o, "_elm_leaveme")) continue; + evas_object_clip_set(o, clip); + } + } +} + +static void +_smart_clip_unset(Evas_Object *obj) +{ + Eina_List *list; + Evas_Object *o; + INTERNAL_ENTRY; + if ((list = evas_object_smart_members_get(obj))) + { + EINA_LIST_FREE(list, o) + { + if (evas_object_data_get(o, "_elm_leaveme")) continue; + evas_object_clip_unset(o); + } + } +} + +static void +_smart_calculate(Evas_Object *obj) +{ + INTERNAL_ENTRY; + if (sd->changed_func) sd->changed_func(obj); +} + +static void +_smart_member_add(Evas_Object *obj, Evas_Object *child) +{ + int r, g, b, a; + + if (evas_object_data_get(child, "_elm_leaveme")) return; + + evas_object_color_get(obj, &r, &g, &b, &a); + evas_object_color_set(child, r, g, b, a); + + evas_object_clip_set(child, evas_object_clip_get(obj)); + + if (evas_object_visible_get(obj)) + evas_object_show(child); + else + evas_object_hide(child); +} + +static void +_smart_member_del(Evas_Object *obj __UNUSED__, Evas_Object *child) +{ + if (evas_object_data_get(child, "_elm_leaveme")) return; + evas_object_clip_unset(child); +} + +/* never need to touch this */ +static void +_smart_init(void) +{ + if (_e_smart) return; + { + static const Evas_Smart_Class sc = + { + SMART_NAME, + EVAS_SMART_CLASS_VERSION, + _smart_add, + _smart_del, + _smart_move, + _smart_resize, + _smart_show, + _smart_hide, + _smart_color_set, + _smart_clip_set, + _smart_clip_unset, + _smart_calculate, + _smart_member_add, + _smart_member_del, + NULL, + NULL, + NULL, + NULL + }; + _e_smart = evas_smart_class_new(&sc); + } +} + +/* happy debug functions */ +#ifdef ELM_DEBUG +static void +_sub_obj_tree_dump(const Evas_Object *obj, + int lvl) +{ + int i; + + for (i = 0; i < lvl * 3; i++) + putchar(' '); + + if (_elm_widget_is(obj)) + { + Eina_List *l; + INTERNAL_ENTRY; + printf("+ %s(%p)\n", + sd->type, + obj); + if (sd->resize_obj) + _sub_obj_tree_dump(sd->resize_obj, lvl + 1); + EINA_LIST_FOREACH(sd->subobjs, l, obj) + { + if (obj != sd->resize_obj) + _sub_obj_tree_dump(obj, lvl + 1); + } + } + else + printf("+ %s(%p)\n", evas_object_type_get(obj), obj); +} + +static void +_sub_obj_tree_dot_dump(const Evas_Object *obj, + FILE *output) +{ + if (!_elm_widget_is(obj)) + return; + INTERNAL_ENTRY; + + Eina_Bool visible = evas_object_visible_get(obj); + Eina_Bool disabled = elm_widget_disabled_get(obj); + Eina_Bool focused = elm_widget_focus_get(obj); + Eina_Bool can_focus = elm_widget_can_focus_get(obj); + + if (sd->parent_obj) + { + fprintf(output, "\"%p\" -- \"%p\" [ color=black", sd->parent_obj, obj); + + if (focused) + fprintf(output, ", style=bold"); + + if (!visible) + fprintf(output, ", color=gray28"); + + fprintf(output, " ];\n"); + } + + fprintf(output, "\"%p\" [ label = \"{%p|%s|%s|visible: %d|" + "disabled: %d|focused: %d/%d|focus order:%d}\"", obj, obj, sd->type, + evas_object_name_get(obj), visible, disabled, focused, can_focus, + sd->focus_order); + + if (focused) + fprintf(output, ", style=bold"); + + if (!visible) + fprintf(output, ", fontcolor=gray28"); + + if ((disabled) || (!visible)) + fprintf(output, ", color=gray"); + + fprintf(output, " ];\n"); + + Eina_List *l; + Evas_Object *o; + EINA_LIST_FOREACH(sd->subobjs, l, o) + _sub_obj_tree_dot_dump(o, output); +} +#endif + +EAPI void +elm_widget_tree_dump(const Evas_Object *top) +{ +#ifdef ELM_DEBUG + if (!_elm_widget_is(top)) + return; + _sub_obj_tree_dump(top, 0); +#else + return; + (void)top; +#endif +} + +EAPI void +elm_widget_tree_dot_dump(const Evas_Object *top, + FILE *output) +{ +#ifdef ELM_DEBUG + if (!_elm_widget_is(top)) + return; + fprintf(output, "graph " " { node [shape=record];\n"); + _sub_obj_tree_dot_dump(top, output); + fprintf(output, "}\n"); +#else + return; + (void)top; + (void)output; +#endif +} diff --git a/libraries/elementary/src/lib/elm_widget.h b/libraries/elementary/src/lib/elm_widget.h new file mode 100644 index 0000000..2f00121 --- /dev/null +++ b/libraries/elementary/src/lib/elm_widget.h @@ -0,0 +1,751 @@ +#ifndef ELM_WIDGET_H +#define ELM_WIDGET_H + +/* DO NOT USE THIS HEADER UNLESS YOU ARE PREPARED FOR BREAKING OF YOUR + * CODE. THIS IS ELEMENTARY'S INTERNAL WIDGET API (for now) AND IS NOT + * FINAL. CALL elm_widget_api_check(ELM_INTERNAL_API_VERSION) TO CHECK IT + * AT RUNTIME + * + * How to make your own widget? like this: + * + * #include + * #include "elm_priv.h" + * + * typedef struct _Widget_Data Widget_Data; + * + * struct _Widget_Data + * { + * Evas_Object *sub; + * // add any other widget data here too + * }; + * + * static const char *widtype = NULL; + * static void _del_hook(Evas_Object *obj); + * static void _theme_hook(Evas_Object *obj); + * static void _disable_hook(Evas_Object *obj); + * static void _sizing_eval(Evas_Object *obj); + * static void _on_focus_hook(void *data, Evas_Object *obj); + * + * static const char SIG_CLICKED[] = "clicked"; + * static const Evas_Smart_Cb_Description _signals[] = { + * {SIG_CLICKED, ""}, + * {NULL, NULL} + * }; + * + * static void + * _del_hook(Evas_Object *obj) + * { + * Widget_Data *wd = elm_widget_data_get(obj); + * if (!wd) return; + * // delete hook - on delete of object delete object struct etc. + * free(wd); + * } + * + * static void + * _on_focus_hook(void *data __UNUSED__, Evas_Object *obj) + * { + * Widget_Data *wd = elm_widget_data_get(obj); + * if (!wd) return; + * // handle focus going in and out - optional, but if you want to, set + * // this hook and handle it (eg emit a signal to an edje obj) + * if (elm_widget_focus_get(obj)) + * { + * edje_object_signal_emit(wd->sub, "elm,action,focus", "elm"); + * evas_object_focus_set(wd->sub, EINA_TRUE); + * } + * else + * { + * edje_object_signal_emit(wd->sub, "elm,action,unfocus", "elm"); + * evas_object_focus_set(wd->sub, EINA_FALSE); + * } + * } + * + * static void + * _theme_hook(Evas_Object *obj) + * { + * Widget_Data *wd = elm_widget_data_get(obj); + * if (!wd) return; + * // handle change in theme/scale etc. + * elm_widget_theme_object_set(obj, wd->sub, "mywidget", "base", + * elm_widget_style_get(obj)); + * } + * + * static void + * _disable_hook(Evas_Object *obj) + * { + * Widget_Data *wd = elm_widget_data_get(obj); + * if (!wd) return; + * // optional, but handle if the widget gets disabled or not + * if (elm_widget_disabled_get(obj)) + * edje_object_signal_emit(wd->sub, "elm,state,disabled", "elm"); + * else + * edje_object_signal_emit(wd->sub, "elm,state,enabled", "elm"); + * } + * + * static void + * _sizing_eval(Evas_Object *obj) + * { + * Widget_Data *wd = elm_widget_data_get(obj); + * Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; + * if (!wd) return; + * elm_coords_finger_size_adjust(1, &minw, 1, &minh); + * edje_object_size_min_restricted_calc(wd->sub, &minw, &minh, minw, minh); + * elm_coords_finger_size_adjust(1, &minw, 1, &minh); + * evas_object_size_hint_min_set(obj, minw, minh); + * evas_object_size_hint_max_set(obj, maxw, maxh); + * } + * + * // actual api to create your widget. add more to manipulate it as needed + * // mark your calls with EAPI to make them "external api" calls. + * EAPI Evas_Object * + * elm_mywidget_add(Evas_Object *parent) + * { + * Evas_Object *obj; + * Evas *e; + * Widget_Data *wd; + * + * // ALWAYS call this - this checks that your widget matches that of + * // elementary and that the api hasn't broken. if it has this returns + * // false and you need to handle this error gracefully + * if (!elm_widget_api_check(ELM_INTERNAL_API_VERSION)) return NULL; + * + * // standard widget setup and allocate wd, create obj given parent etc. + * ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); + * + * // give it a type name and set up a mywidget type string if needed + * ELM_SET_WIDTYPE(widtype, "mywidget"); + * elm_widget_type_set(obj, "mywidget"); + * // tell the parent widget that we are a sub object + * elm_widget_sub_object_add(parent, obj); + * // setup hooks we need (some are optional) + * elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); + * elm_widget_data_set(obj, wd); + * elm_widget_del_hook_set(obj, _del_hook); + * elm_widget_theme_hook_set(obj, _theme_hook); + * elm_widget_disable_hook_set(obj, _disable_hook); + * // this widget can focus (true means yes it can, false means it can't) + * elm_widget_can_focus_set(obj, EINA_TRUE); + * + * // for this widget we will add 1 sub object that is an edje object + * wd->sub = edje_object_add(e); + * // set the theme. this follows a scheme for group name like this: + * // "elm/WIDGETNAME/ELEMENT/STYLE" + * // so here it will be: + * // "elm/mywidget/base/default" + * // changing style changes style name from default (all widgets start + * // with the default style) and element is for your widget internal + * // structure as you see fit + * elm_widget_theme_object_set(obj, wd->sub, "mywidget", "base", "default"); + * // listen to a signal from the edje object to produce widget smart + * // callback (like click) + * edje_object_signal_callback_add(wd->sub, "elm,action,click", "", + * _signal_clicked, obj); + * // set this sub object as the "resize object". widgets get 1 resize + * // object that is resized along with the object wrapper. + * elm_widget_resize_object_set(obj, wd->sub); + * + * // evaluate sizing of the widget (minimum size calc etc.). optional but + * // not a bad idea to do here. it will get queued for later anyway + * _sizing_eval(obj); + * + * // register the smart callback descriptions so we can have some runtime + * // info as to what the smart callback strings mean + * evas_object_smart_callbacks_descriptions_set(obj, _signals); + * return obj; + * } + * + * // example - do "whatever" to the widget (here just emit a signal) + * EAPI void + * elm_mywidget_whatever(Evas_Object *obj) + * { + * // check if type is correct - check will return if it fails + * ELM_CHECK_WIDTYPE(obj, widtype); + * // get widget data - type is correct and sane by this point, so this + * // should never fail + * Widget_Data *wd = elm_widget_data_get(obj); + * // do whatever you like + * edje_object_signal_emit(wd->sub, "elm,state,action,whatever", "elm"); + * } + * + * // you can add more - you need to see elementary's code to know how to + * // handle all cases. remember this api is not stable and may change. it's + * // internal + * + */ + +#ifndef ELM_INTERNAL_API_ARGESFSDFEFC +#warning "You are using an internal elementary API. This API is not stable" +#warning "and is subject to change. You use this at your own risk." +#warning "Remember to call elm_widget_api_check(ELM_INTERNAL_API_VERSION);" +#warning "in your widgets before you call any other elm_widget calls to do" +#warning "a correct runtime version check. Also remember - you don't NEED" +#warning "to make an Elementary widget is almost ALL cases. You can easily" +#warning "make a smart object with Evas's API and do everything you need" +#warning "there. You only need a widget if you want to seamlessly be part" +#warning "of the focus tree and want to transparently become a container" +#warning "for any number of child Elementary widgets" +#error "ERROR. Compile aborted." +#endif +#define ELM_INTERNAL_API_VERSION 7000 + +typedef struct _Elm_Tooltip Elm_Tooltip; +typedef struct _Elm_Cursor Elm_Cursor; + +/**< base structure for all widget items that are not Elm_Widget themselves */ +typedef struct _Elm_Widget_Item Elm_Widget_Item; + +/**< accessibility information to be able to set and get from the access API */ +typedef struct _Elm_Access_Info Elm_Access_Info; + +/**< accessibility info item */ +typedef struct _Elm_Access_Item Elm_Access_Item; + +typedef void (*Elm_Widget_Text_Set_Cb)(void *data, const char *part, const char *text); +typedef void (*Elm_Widget_Content_Set_Cb)(void *data, const char *part, Evas_Object *content); +typedef const char *(*Elm_Widget_Text_Get_Cb)(const void *data, const char *part); +typedef Evas_Object *(*Elm_Widget_Content_Get_Cb)(const void *data, const char *part); +typedef Evas_Object *(*Elm_Widget_Content_Unset_Cb)(const void *data, const char *part); +typedef void (*Elm_Widget_Signal_Emit_Cb)(void *data, const char *emission, const char *source); +typedef void (*Elm_Widget_Disable_Cb)(void *data); +typedef Eina_Bool (*Elm_Widget_Del_Pre_Cb)(void *data); + +#define ELM_ACCESS_TYPE 0 // when reading out widget or item this is read first +#define ELM_ACCESS_INFO 1 // next read is info - this is normally label +#define ELM_ACCESS_STATE 2 // if there is a state (eg checkbox) then read state out +#define ELM_ACCESS_CONTENT 3 // read ful content - eg all of the label, not a shortened version + +#define ELM_ACCESS_DONE -1 // sentence done - send done event here +#define ELM_ACCESS_CANCEL -2 // stop reading immediately + +typedef char *(*Elm_Access_Content_Cb)(void *data, Evas_Object *obj, Elm_Widget_Item *item); + +struct _Elm_Access_Item +{ + int type; + const void *data; + Elm_Access_Content_Cb func; +}; + +struct _Elm_Access_Info +{ + Evas_Object *hoverobj; + Eina_List *items; + Ecore_Timer *delay_timer; +}; + +EAPI void _elm_access_clear(Elm_Access_Info *ac); +EAPI void _elm_access_text_set(Elm_Access_Info *ac, int type, const char *text); +EAPI void _elm_access_callback_set(Elm_Access_Info *ac, int type, Elm_Access_Content_Cb func, const void *data); +EAPI char *_elm_access_text_get(const Elm_Access_Info *ac, int type, Evas_Object *obj, Elm_Widget_Item *item); /* this is ok it actually returns a strduped string - it's meant to! */ +EAPI void _elm_access_read(Elm_Access_Info *ac, int type, Evas_Object *obj, Elm_Widget_Item *item); +EAPI void _elm_access_say(const char *txt); +EAPI Elm_Access_Info *_elm_access_object_get(const Evas_Object *obj); +EAPI Elm_Access_Info *_elm_access_item_get(const Elm_Widget_Item *it); +EAPI void _elm_access_object_hilight(Evas_Object *obj); +EAPI void _elm_access_object_unhilight(Evas_Object *obj); +EAPI void _elm_access_object_hilight_disable(Evas *e); +EAPI void _elm_access_object_register(Evas_Object *obj, Evas_Object *hoverobj); +EAPI void _elm_access_item_unregister(Elm_Widget_Item *item); +EAPI void _elm_access_item_register(Elm_Widget_Item *item, Evas_Object *hoverobj); +EAPI Eina_Bool _elm_access_2nd_click_timeout(Evas_Object *obj); + +/**< put this as the first member in your widget item struct */ +#define ELM_WIDGET_ITEM Elm_Widget_Item base + +struct _Elm_Widget_Item +{ +/* ef1 ~~ efl, el3 ~~ elm */ +#define ELM_WIDGET_ITEM_MAGIC 0xef1e1301 + EINA_MAGIC; +/* simple accessor macros */ +#define VIEW(X) X->base.view +#define WIDGET(X) X->base.widget + /**< the owner widget that owns this item */ + Evas_Object *widget; + /**< the base view object */ + Evas_Object *view; + /**< item specific data. used for del callback */ + const void *data; + /**< user delete callback function */ + Evas_Smart_Cb del_func; + /**< widget delete callback function. don't expose this callback call */ + Elm_Widget_Del_Pre_Cb del_pre_func; + + Elm_Widget_Content_Set_Cb content_set_func; + Elm_Widget_Content_Get_Cb content_get_func; + Elm_Widget_Content_Unset_Cb content_unset_func; + Elm_Widget_Text_Set_Cb text_set_func; + Elm_Widget_Text_Get_Cb text_get_func; + Elm_Widget_Signal_Emit_Cb signal_emit_func; + Elm_Widget_Disable_Cb disable_func; + Elm_Access_Info *access; + const char *access_info; + + Eina_Bool disabled : 1; +}; + +struct _Elm_Object_Item +{ + ELM_WIDGET_ITEM; +}; + +#define ELM_NEW(t) calloc(1, sizeof(t)) + +EAPI Eina_Bool elm_widget_api_check(int ver); +EAPI Evas_Object *elm_widget_add(Evas *evas); +EAPI void elm_widget_del_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj)); +EAPI void elm_widget_del_pre_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj)); +EAPI void elm_widget_focus_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj)); +EAPI void elm_widget_activate_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj)); +EAPI void elm_widget_disable_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj)); +EAPI void elm_widget_theme_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj)); +EAPI void elm_widget_translate_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj)); +EAPI void elm_widget_event_hook_set(Evas_Object *obj, Eina_Bool (*func)(Evas_Object *obj, Evas_Object *source, Evas_Callback_Type type, void *event_info)); +EAPI void elm_widget_changed_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj)); +EAPI void elm_widget_signal_emit_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj, const char *emission, const char *source)); +EAPI void elm_widget_signal_callback_add_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)); +EAPI void elm_widget_signal_callback_del_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)); +EAPI Eina_Bool elm_widget_theme(Evas_Object *obj); +EAPI void elm_widget_theme_specific(Evas_Object *obj, Elm_Theme *th, Eina_Bool force); +EAPI void elm_widget_translate(Evas_Object *obj); +EAPI void elm_widget_focus_next_hook_set(Evas_Object *obj, Eina_Bool (*func)(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)); +EAPI void elm_widget_on_focus_hook_set(Evas_Object *obj, void (*func)(void *data, Evas_Object *obj), void *data); +EAPI void elm_widget_on_change_hook_set(Evas_Object *obj, void (*func)(void *data, Evas_Object *obj), void *data); +EAPI void elm_widget_on_show_region_hook_set(Evas_Object *obj, void (*func)(void *data, Evas_Object *obj), void *data); +EAPI void elm_widget_focus_region_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)); +EAPI void elm_widget_text_set_hook_set(Evas_Object *obj, Elm_Widget_Text_Set_Cb func); +#define elm_widget_text_set_hook_set(obj, func) elm_widget_text_set_hook_set(obj, (Elm_Widget_Text_Set_Cb)(func)) +EAPI void elm_widget_text_get_hook_set(Evas_Object *obj, Elm_Widget_Text_Get_Cb func); +#define elm_widget_text_get_hook_set(obj, func) elm_widget_text_get_hook_set(obj, (Elm_Widget_Text_Get_Cb)(func)) +EAPI void elm_widget_content_set_hook_set(Evas_Object *obj, Elm_Widget_Content_Set_Cb func); +#define elm_widget_content_set_hook_set(obj, func) elm_widget_content_set_hook_set(obj, (Elm_Widget_Content_Set_Cb)(func)) +EAPI void elm_widget_content_get_hook_set(Evas_Object *obj, Elm_Widget_Content_Get_Cb func); +#define elm_widget_content_get_hook_set(obj, func) elm_widget_content_get_hook_set(obj, (Elm_Widget_Content_Get_Cb)(func)) +EAPI void elm_widget_content_unset_hook_set(Evas_Object *obj, Elm_Widget_Content_Unset_Cb func); +#define elm_widget_content_unset_hook_set(obj, func) elm_widget_content_unset_hook_set(obj, (Elm_Widget_Content_Unset_Cb)(func)) +EAPI void elm_widget_on_focus_region_hook_set(Evas_Object *obj, void (*func)(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)); +EAPI void elm_widget_data_set(Evas_Object *obj, void *data); +EAPI void *elm_widget_data_get(const Evas_Object *obj); +EAPI void elm_widget_sub_object_add(Evas_Object *obj, Evas_Object *sobj); +EAPI void elm_widget_sub_object_del(Evas_Object *obj, Evas_Object *sobj); +EAPI const Eina_List *elm_widget_sub_object_list_get(const Evas_Object *obj); +EAPI void elm_widget_resize_object_set(Evas_Object *obj, Evas_Object *sobj); +EAPI void elm_widget_hover_object_set(Evas_Object *obj, Evas_Object *sobj); +EAPI void elm_widget_signal_emit(Evas_Object *obj, const char *emission, const char *source); +EAPI void elm_widget_signal_callback_add(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data); +EAPI void *elm_widget_signal_callback_del(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func); +EAPI void elm_widget_can_focus_set(Evas_Object *obj, Eina_Bool can_focus); +EAPI Eina_Bool elm_widget_can_focus_get(const Evas_Object *obj); +EAPI Eina_Bool elm_widget_child_can_focus_get(const Evas_Object *obj); +EAPI Eina_List *elm_widget_can_focus_child_list_get(const Evas_Object *obj); +EAPI void elm_widget_tree_unfocusable_set(Evas_Object *obj, Eina_Bool tree_unfocusable); +EAPI Eina_Bool elm_widget_tree_unfocusable_get(const Evas_Object *obj); +EAPI void elm_widget_highlight_ignore_set(Evas_Object *obj, Eina_Bool ignore); +EAPI Eina_Bool elm_widget_highlight_ignore_get(const Evas_Object *obj); +EAPI void elm_widget_highlight_in_theme_set(Evas_Object *obj, Eina_Bool highlight); +EAPI Eina_Bool elm_widget_highlight_in_theme_get(const Evas_Object *obj); +EAPI Eina_Bool elm_widget_focus_get(const Evas_Object *obj); +EAPI Evas_Object *elm_widget_focused_object_get(const Evas_Object *obj); +EAPI Evas_Object *elm_widget_top_get(const Evas_Object *obj); +EAPI Eina_Bool elm_widget_is(const Evas_Object *obj); +EAPI Evas_Object *elm_widget_parent_widget_get(const Evas_Object *obj); +EAPI void elm_widget_event_callback_add(Evas_Object *obj, Elm_Event_Cb func, const void *data); +EAPI void *elm_widget_event_callback_del(Evas_Object *obj, Elm_Event_Cb func, const void *data); +EAPI Eina_Bool elm_widget_event_propagate(Evas_Object *obj, Evas_Callback_Type type, void *event_info, Evas_Event_Flags *event_flags); +EAPI void elm_widget_focus_custom_chain_set(Evas_Object *obj, Eina_List *objs); +EAPI void elm_widget_focus_custom_chain_unset(Evas_Object *obj); +EAPI const Eina_List *elm_widget_focus_custom_chain_get(const Evas_Object *obj); +EAPI void elm_widget_focus_custom_chain_append(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child); +EAPI void elm_widget_focus_custom_chain_prepend(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child); +EAPI void elm_widget_focus_cycle(Evas_Object *obj, Elm_Focus_Direction dir); +EAPI void elm_widget_focus_direction_go(Evas_Object *obj, int x, int y); +EAPI Eina_Bool elm_widget_focus_next_get(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next); +EAPI Eina_Bool elm_widget_focus_list_next_get(const Evas_Object *obj, const Eina_List *items, void *(*list_data_get)(const Eina_List *list), Elm_Focus_Direction dir, Evas_Object **next); +EAPI void elm_widget_focus_set(Evas_Object *obj, int first); +EAPI void elm_widget_focused_object_clear(Evas_Object *obj); +EAPI Evas_Object *elm_widget_parent_get(const Evas_Object *obj); +EAPI Evas_Object *elm_widget_parent2_get(const Evas_Object *obj); +EAPI void elm_widget_parent2_set(Evas_Object *obj, Evas_Object *parent); +EAPI void elm_widget_focus_steal(Evas_Object *obj); + +/** + * @internal + * + * Restore the focus state of the sub-tree. + * + * This API will restore the focus state of the sub-tree to the latest + * state. If a sub-tree is unfocused and wants to get back to the latest + * focus state, this API will be helpful. + * + * @param obj The widget root of sub-tree + * + * @ingroup Widget + */ +EAPI void elm_widget_focus_restore(Evas_Object *obj); + +EAPI void elm_widget_activate(Evas_Object *obj); +EAPI void elm_widget_change(Evas_Object *obj); +EAPI void elm_widget_disabled_set(Evas_Object *obj, Eina_Bool disabled); +EAPI Eina_Bool elm_widget_disabled_get(const Evas_Object *obj); +EAPI void elm_widget_show_region_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, Eina_Bool forceshow); +EAPI void elm_widget_show_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); +EAPI void elm_widget_focus_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); +EAPI void elm_widget_scroll_hold_push(Evas_Object *obj); +EAPI void elm_widget_scroll_hold_pop(Evas_Object *obj); +EAPI int elm_widget_scroll_hold_get(const Evas_Object *obj); +EAPI void elm_widget_scroll_freeze_push(Evas_Object *obj); +EAPI void elm_widget_scroll_freeze_pop(Evas_Object *obj); +EAPI int elm_widget_scroll_freeze_get(const Evas_Object *obj); +EAPI void elm_widget_scale_set(Evas_Object *obj, double scale); +EAPI double elm_widget_scale_get(const Evas_Object *obj); +EAPI Eina_Bool elm_widget_mirrored_get(const Evas_Object *obj); +EAPI void elm_widget_mirrored_set(Evas_Object *obj, Eina_Bool mirrored); +EAPI Eina_Bool elm_widget_mirrored_automatic_get(const Evas_Object *obj); +EAPI void elm_widget_mirrored_automatic_set(Evas_Object *obj, Eina_Bool automatic); +EAPI void elm_widget_theme_set(Evas_Object *obj, Elm_Theme *th); +EAPI Elm_Theme *elm_widget_theme_get(const Evas_Object *obj); +EAPI Eina_Bool elm_widget_style_set(Evas_Object *obj, const char *style); +EAPI const char *elm_widget_style_get(const Evas_Object *obj); +EAPI void elm_widget_type_set(Evas_Object *obj, const char *type); +EAPI const char *elm_widget_type_get(const Evas_Object *obj); +EAPI void elm_widget_tooltip_add(Evas_Object *obj, Elm_Tooltip *tt); +EAPI void elm_widget_tooltip_del(Evas_Object *obj, Elm_Tooltip *tt); +EAPI void elm_widget_cursor_add(Evas_Object *obj, Elm_Cursor *cur); +EAPI void elm_widget_cursor_del(Evas_Object *obj, Elm_Cursor *cur); +EAPI void elm_widget_drag_lock_x_set(Evas_Object *obj, Eina_Bool lock); +EAPI void elm_widget_drag_lock_y_set(Evas_Object *obj, Eina_Bool lock); +EAPI Eina_Bool elm_widget_drag_lock_x_get(const Evas_Object *obj); +EAPI Eina_Bool elm_widget_drag_lock_y_get(const Evas_Object *obj); +EAPI int elm_widget_drag_child_locked_x_get(const Evas_Object *obj); +EAPI int elm_widget_drag_child_locked_y_get(const Evas_Object *obj); +EAPI Eina_Bool elm_widget_theme_object_set(Evas_Object *obj, Evas_Object *edj, const char *wname, const char *welement, const char *wstyle); +EAPI void elm_widget_type_register(const char **ptr); +EAPI void elm_widget_type_unregister(const char **ptr); +EAPI Eina_Bool elm_widget_is_check(const Evas_Object *obj); +EAPI Eina_Bool elm_widget_type_check(const Evas_Object *obj, const char *type, const char *func); +EAPI Evas_Object *elm_widget_name_find(const Evas_Object *obj, const char *name, int recurse); +EAPI Eina_List *elm_widget_stringlist_get(const char *str); +EAPI void elm_widget_stringlist_free(Eina_List *list); +EAPI void elm_widget_focus_hide_handle(Evas_Object *obj); +EAPI void elm_widget_focus_mouse_up_handle(Evas_Object *obj); +EAPI void elm_widget_focus_tree_unfocusable_handle(Evas_Object *obj); +EAPI void elm_widget_focus_disabled_handle(Evas_Object *obj); +EAPI unsigned int elm_widget_focus_order_get(const Evas_Object *obj); +EAPI void elm_widget_text_part_set(Evas_Object *obj, const char *part, const char *label); +EAPI const char *elm_widget_text_part_get(const Evas_Object *obj, const char *part); +EAPI void elm_widget_domain_translatable_text_part_set(Evas_Object *obj, const char *part, const char *domain, const char *text); +EAPI const char *elm_widget_translatable_text_part_get(const Evas_Object *obj, const char *part); +EAPI void elm_widget_content_part_set(Evas_Object *obj, const char *part, Evas_Object *content); +EAPI Evas_Object *elm_widget_content_part_get(const Evas_Object *obj, const char *part); +EAPI Evas_Object *elm_widget_content_part_unset(Evas_Object *obj, const char *part); +EAPI void elm_widget_access_info_set(Evas_Object *obj, const char *txt); +EAPI const char *elm_widget_access_info_get(const Evas_Object *obj); +EAPI Elm_Widget_Item *_elm_widget_item_new(Evas_Object *parent, size_t alloc_size); +EAPI void _elm_widget_item_free(Elm_Widget_Item *item); +EAPI void _elm_widget_item_del(Elm_Widget_Item *item); +EAPI void _elm_widget_item_pre_notify_del(Elm_Widget_Item *item); +EAPI void _elm_widget_item_del_cb_set(Elm_Widget_Item *item, Evas_Smart_Cb del_cb); +EAPI void _elm_widget_item_data_set(Elm_Widget_Item *item, const void *data); +EAPI void *_elm_widget_item_data_get(const Elm_Widget_Item *item); +EAPI void _elm_widget_item_tooltip_text_set(Elm_Widget_Item *item, const char *text); +EAPI void _elm_widget_item_tooltip_translatable_text_set(Elm_Widget_Item *item, const char *text); +EAPI void _elm_widget_item_tooltip_content_cb_set(Elm_Widget_Item *item, Elm_Tooltip_Item_Content_Cb func, const void *data, Evas_Smart_Cb del_cb); +EAPI void _elm_widget_item_tooltip_unset(Elm_Widget_Item *item); +EAPI void _elm_widget_item_tooltip_style_set(Elm_Widget_Item *item, const char *style); +EAPI Eina_Bool _elm_widget_item_tooltip_window_mode_set(Elm_Widget_Item *item, Eina_Bool disable); +EAPI Eina_Bool _elm_widget_item_tooltip_window_mode_get(const Elm_Widget_Item *item); +EAPI const char *_elm_widget_item_tooltip_style_get(const Elm_Widget_Item *item); +EAPI void _elm_widget_item_cursor_set(Elm_Widget_Item *item, const char *cursor); +EAPI const char *_elm_widget_item_cursor_get(const Elm_Widget_Item *item); +EAPI void _elm_widget_item_cursor_unset(Elm_Widget_Item *item); +EAPI void _elm_widget_item_cursor_style_set(Elm_Widget_Item *item, const char *style); +EAPI const char *_elm_widget_item_cursor_style_get(const Elm_Widget_Item *item); +EAPI void _elm_widget_item_cursor_engine_only_set(Elm_Widget_Item *item, Eina_Bool engine_only); +EAPI Eina_Bool _elm_widget_item_cursor_engine_only_get(const Elm_Widget_Item *item); +EAPI void _elm_widget_item_part_content_set(Elm_Widget_Item *item, const char *part, Evas_Object *content); +EAPI Evas_Object *_elm_widget_item_part_content_get(const Elm_Widget_Item *item, const char *part); +EAPI Evas_Object *_elm_widget_item_part_content_unset(Elm_Widget_Item *item, const char *part); +EAPI void _elm_widget_item_part_text_set(Elm_Widget_Item *item, const char *part, const char *label); +EAPI const char *_elm_widget_item_part_text_get(const Elm_Widget_Item *item, const char *part); +EAPI void _elm_widget_item_signal_emit(Elm_Widget_Item *item, const char *emission, const char *source); +EAPI void _elm_widget_item_content_set_hook_set(Elm_Widget_Item *item, Elm_Widget_Content_Set_Cb func); +EAPI void _elm_widget_item_content_get_hook_set(Elm_Widget_Item *item, Elm_Widget_Content_Get_Cb func); +EAPI void _elm_widget_item_content_unset_hook_set(Elm_Widget_Item *item, Elm_Widget_Content_Unset_Cb func); +EAPI void _elm_widget_item_text_set_hook_set(Elm_Widget_Item *item, Elm_Widget_Text_Set_Cb func); +EAPI void _elm_widget_item_text_get_hook_set(Elm_Widget_Item *item, Elm_Widget_Text_Get_Cb func); +EAPI void _elm_widget_item_signal_emit_hook_set(Elm_Widget_Item *it, Elm_Widget_Signal_Emit_Cb func); +EAPI void _elm_widget_item_access_info_set(Elm_Widget_Item *item, const char *txt); +EAPI void _elm_widget_item_disabled_set(Elm_Widget_Item *item, Eina_Bool disabled); +EAPI Eina_Bool _elm_widget_item_disabled_get(const Elm_Widget_Item *item); +EAPI void _elm_widget_item_disable_hook_set(Elm_Widget_Item *item, Elm_Widget_Disable_Cb func); +EAPI void _elm_widget_item_del_pre_hook_set(Elm_Widget_Item *item, Elm_Widget_Del_Pre_Cb func); + +/* debug function. don't use it unless you are tracking parenting issues */ +EAPI void elm_widget_tree_dump(const Evas_Object *top); +EAPI void elm_widget_tree_dot_dump(const Evas_Object *top, FILE *output); + +/** + * Convenience macro to create new widget item, doing casts for you. + * @see _elm_widget_item_new() + * @param parent a valid elm_widget variant. + * @param type the C type that extends Elm_Widget_Item + */ +#define elm_widget_item_new(parent, type) \ + (type *)_elm_widget_item_new((parent), sizeof(type)) +/** + * Convenience macro to free widget item, doing casts for you. + * @see _elm_widget_item_free() + * @param item a valid item. + */ +#define elm_widget_item_free(item) \ + _elm_widget_item_free((Elm_Widget_Item *)item) + +/** + * Convenience macro to delete widget item, doing casts for you. + * @see _elm_widget_item_del() + * @param item a valid item. + */ +#define elm_widget_item_del(item) \ + _elm_widget_item_del((Elm_Widget_Item *)item) +/** + * Convenience macro to notify deletion of widget item, doing casts for you. + * @see _elm_widget_item_pre_notify_del() + */ +#define elm_widget_item_pre_notify_del(item) \ + _elm_widget_item_pre_notify_del((Elm_Widget_Item *)item) +/** + * Convenience macro to set deletion callback of widget item, doing casts for you. + * @see _elm_widget_item_del_cb_set() + */ +#define elm_widget_item_del_cb_set(item, del_cb) \ + _elm_widget_item_del_cb_set((Elm_Widget_Item *)item, del_cb) + +/** + * Set item's data + * @see _elm_widget_item_data_set() + */ +#define elm_widget_item_data_set(item, data) \ + _elm_widget_item_data_set((Elm_Widget_Item *)item, data) +/** + * Get item's data + * @see _elm_widget_item_data_get() + */ +#define elm_widget_item_data_get(item) \ + _elm_widget_item_data_get((const Elm_Widget_Item *)item) + +/** + * Convenience function to set widget item tooltip as a text string. + * @see _elm_widget_item_tooltip_text_set() + */ +#define elm_widget_item_tooltip_text_set(item, text) \ + _elm_widget_item_tooltip_text_set((Elm_Widget_Item *)item, text) +/** + * Convenience function to set widget item tooltip as a text string. + * @see _elm_widget_item_tooltip_text_set() + */ +#define elm_widget_item_tooltip_translatable_text_set(item, text) \ + _elm_widget_item_tooltip_translatable_text_set((Elm_Widget_Item *)item, text) +/** + * Convenience function to set widget item tooltip. + * @see _elm_widget_item_tooltip_content_cb_set() + */ +#define elm_widget_item_tooltip_content_cb_set(item, func, data, del_cb) \ + _elm_widget_item_tooltip_content_cb_set((Elm_Widget_Item *)item, \ + func, data, del_cb) +/** + * Convenience function to unset widget item tooltip. + * @see _elm_widget_item_tooltip_unset() + */ +#define elm_widget_item_tooltip_unset(item) \ + _elm_widget_item_tooltip_unset((Elm_Widget_Item *)item) +/** + * Convenience function to change item's tooltip style. + * @see _elm_widget_item_tooltip_style_set() + */ +#define elm_widget_item_tooltip_style_set(item, style) \ + _elm_widget_item_tooltip_style_set((Elm_Widget_Item *)item, style) + +#define elm_widget_item_tooltip_window_mode_set(item, disable) \ + _elm_widget_item_tooltip_window_mode_set((Elm_Widget_Item *)item, disable) + +#define elm_widget_item_tooltip_window_mode_get(item) \ + _elm_widget_item_tooltip_window_mode_get((Elm_Widget_Item *)item) +/** + * Convenience function to query item's tooltip style. + * @see _elm_widget_item_tooltip_style_get() + */ +#define elm_widget_item_tooltip_style_get(item) \ + _elm_widget_item_tooltip_style_get((const Elm_Widget_Item *)item) +/** + * Convenience function to set widget item cursor. + * @see _elm_widget_item_cursor_set() + */ +#define elm_widget_item_cursor_set(item, cursor) \ + _elm_widget_item_cursor_set((Elm_Widget_Item *)item, cursor) +/** + * Convenience function to get widget item cursor. + * @see _elm_widget_item_cursor_get() + */ +#define elm_widget_item_cursor_get(item) \ + _elm_widget_item_cursor_get((const Elm_Widget_Item *)item) +/** + * Convenience function to unset widget item cursor. + * @see _elm_widget_item_cursor_unset() + */ +#define elm_widget_item_cursor_unset(item) \ + _elm_widget_item_cursor_unset((Elm_Widget_Item *)item) +/** + * Convenience function to change item's cursor style. + * @see _elm_widget_item_cursor_style_set() + */ +#define elm_widget_item_cursor_style_set(item, style) \ + _elm_widget_item_cursor_style_set((Elm_Widget_Item *)item, style) +/** + * Convenience function to query item's cursor style. + * @see _elm_widget_item_cursor_style_get() + */ +#define elm_widget_item_cursor_style_get(item) \ + _elm_widget_item_cursor_style_get((const Elm_Widget_Item *)item) +/** + * Convenience function to change item's cursor engine_only. + * @see _elm_widget_item_cursor_engine_only_set() + */ +#define elm_widget_item_cursor_engine_only_set(item, engine_only) \ + _elm_widget_item_cursor_engine_only_set((Elm_Widget_Item *)item, engine_only) +/** + * Convenience function to query item's cursor engine_only. + * @see _elm_widget_item_cursor_engine_only_get() + */ +#define elm_widget_item_cursor_engine_only_get(item) \ + _elm_widget_item_cursor_engine_only_get((const Elm_Widget_Item *)item) +/** + * Convenience function to query item's content set hook. + * @see _elm_widget_item_content_set_hook_set() + */ +#define elm_widget_item_content_set_hook_set(item, func) \ + _elm_widget_item_content_set_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Content_Set_Cb)func) +/** + * Convenience function to query item's content get hook. + * @see _elm_widget_item_content_get_hook_set() + */ +#define elm_widget_item_content_get_hook_set(item, func) \ + _elm_widget_item_content_get_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Content_Get_Cb)func) +/** + * Convenience function to query item's content unset hook. + * @see _elm_widget_item_content_unset_hook_set() + */ +#define elm_widget_item_content_unset_hook_set(item, func) \ + _elm_widget_item_content_unset_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Content_Unset_Cb)func) +/** + * Convenience function to query item's text set hook. + * @see _elm_widget_item_text_set_hook_set() + */ +#define elm_widget_item_text_set_hook_set(item, func) \ + _elm_widget_item_text_set_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Text_Set_Cb)func) +/** + * Convenience function to query item's text get hook. + * @see _elm_widget_item_text_get_hook_set() + */ +#define elm_widget_item_text_get_hook_set(item, func) \ + _elm_widget_item_text_get_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Text_Get_Cb)func) +/** + * Convenience function to query item's signal emit hook. + * @see _elm_widget_item_signal_emit_hook_set() + */ +#define elm_widget_item_signal_emit_hook_set(item, func) \ + _elm_widget_item_signal_emit_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Signal_Emit_Cb)func) +/** + * Convenience function to query disable get hook. + * @see _elm_widget_item_disabled_get() + */ +#define elm_widget_item_disabled_get(item) \ + _elm_widget_item_disabled_get((Elm_Widget_Item *)item) +/** + * Convenience function to query disable set hook. + * @see _elm_widget_item_disable_hook_set() + */ +#define elm_widget_item_disable_hook_set(item, func) \ + _elm_widget_item_disable_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Disable_Cb)func) +/** + * Convenience function to query del pre hook. + * @see _elm_widget_item_del_pre_hook_set() + */ +#define elm_widget_item_del_pre_hook_set(item, func) \ + _elm_widget_item_del_pre_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Del_Pre_Cb)func) + +#define ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, ...) \ + do { \ + if (!item) { \ + CRITICAL("Elm_Widget_Item " # item " is NULL"); \ + return __VA_ARGS__; \ + } \ + if (!EINA_MAGIC_CHECK(item, ELM_WIDGET_ITEM_MAGIC)) { \ + EINA_MAGIC_FAIL(item, ELM_WIDGET_ITEM_MAGIC); \ + return __VA_ARGS__; \ + } \ + } while (0) + +#define ELM_WIDGET_ITEM_CHECK_OR_GOTO(item, label) \ + do { \ + if (!item) { \ + CRITICAL("Elm_Widget_Item " # item " is NULL"); \ + goto label; \ + } \ + if (!EINA_MAGIC_CHECK(item, ELM_WIDGET_ITEM_MAGIC)) { \ + EINA_MAGIC_FAIL(item, ELM_WIDGET_ITEM_MAGIC); \ + goto label; \ + } \ + } while (0) + +#define ELM_SET_WIDTYPE(widtype, type) \ + do { \ + if (!widtype) { \ + widtype = eina_stringshare_add(type); \ + elm_widget_type_register(&widtype); \ + } \ + } while (0) + +#define ELM_CHECK_WID_IS(obj) \ + if (!elm_widget_is_check(obj)) return + +#define ELM_CHECK_WIDTYPE(obj, widtype) \ + if (!obj || !elm_widget_type_check((obj), (widtype), __func__)) return + +#define ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, ...) \ + ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, __VA_ARGS__); \ + ELM_CHECK_WIDTYPE(it->base.widget, widtype) __VA_ARGS__; + +#define ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(it, label) \ + ELM_WIDGET_ITEM_CHECK_OR_GOTO((Elm_Widget_Item *)it, label); \ + if (!elm_widget_type_check((it->base.widget), (widtype), __func__)) goto label; + +#define ELM_WIDGET_STANDARD_SETUP(wdat, wdtype, par, evas, ob, ret) \ + do { \ + EINA_SAFETY_ON_NULL_RETURN_VAL((par), (ret)); \ + evas = evas_object_evas_get(par); if (!(evas)) return (ret); \ + wdat = ELM_NEW(wdtype); if (!(wdat)) return (ret); \ + ob = elm_widget_add(evas); if (!(ob)) { free(wdat); return (ret); } \ + } while (0) + +#define ELM_OBJ_ITEM_CHECK_OR_RETURN(it, ...) \ + ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, __VA_ARGS__); + +#define ELM_OBJ_ITEM_CHECK_OR_GOTO(it, label) \ + ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(it, label); + +/** + * The drag and drop API. + * Currently experimental, and will change when it does dynamic type + * addition RSN. + * + * Here so applications can start to use it, if they ask elm nicely. + * + * And yes, elm_widget, should probably be elm_experimental... + * Complaints about this code should go to /dev/null, or failing that nash. + */ +Eina_Bool elm_selection_selection_has_owner(void); +Eina_Bool elm_drop_target_add(Evas_Object *widget, Elm_Sel_Type, Elm_Drop_Cb, void *); +Eina_Bool elm_drop_target_del(Evas_Object *widget); +Eina_Bool elm_drag_start(Evas_Object *, Elm_Sel_Format, const char *, void (*)(void *, Evas_Object *), void *); + +#endif diff --git a/libraries/elementary/src/lib/elm_win.c b/libraries/elementary/src/lib/elm_win.c new file mode 100644 index 0000000..54127c0 --- /dev/null +++ b/libraries/elementary/src/lib/elm_win.c @@ -0,0 +1,3428 @@ +#include +#include "elm_priv.h" + +typedef struct _Elm_Win Elm_Win; + +struct _Elm_Win +{ + Ecore_Evas *ee; + Evas *evas; + Evas_Object *parent, *win_obj, *img_obj, *frame_obj; + Eina_List *subobjs; +#ifdef HAVE_ELEMENTARY_X + Ecore_X_Window xwin; + Ecore_Event_Handler *client_message_handler; +#endif + Ecore_Job *deferred_resize_job; + Ecore_Job *deferred_child_eval_job; + + Elm_Win_Type type; + Elm_Win_Keyboard_Mode kbdmode; + Elm_Win_Indicator_Mode indmode; + Elm_Win_Indicator_Opacity_Mode ind_o_mode; + struct + { + const char *info; + Ecore_Timer *timer; + int repeat_count; + int shot_counter; + } shot; + int resize_location; + int *autodel_clear, rot; + int show_count; + struct + { + int x, y; + } screen; + struct + { + Ecore_Evas *ee; + Evas *evas; + Evas_Object *obj, *hot_obj; + int hot_x, hot_y; + } pointer; + struct + { + Evas_Object *top; + + struct + { + Evas_Object *target; + Eina_Bool visible : 1; + Eina_Bool handled : 1; + } cur, prev; + + const char *style; + Ecore_Job *reconf_job; + + Eina_Bool enabled : 1; + Eina_Bool changed_theme : 1; + Eina_Bool top_animate : 1; + Eina_Bool geometry_changed : 1; + } focus_highlight; + + Evas_Object *icon; + const char *title; + const char *icon_name; + const char *role; + + double aspect; + Eina_Bool urgent : 1; + Eina_Bool modal : 1; + Eina_Bool demand_attention : 1; + Eina_Bool autodel : 1; + Eina_Bool constrain : 1; + Eina_Bool resizing : 1; + Eina_Bool iconified : 1; + Eina_Bool withdrawn : 1; + Eina_Bool sticky : 1; + Eina_Bool fullscreen : 1; + Eina_Bool maximized : 1; + Eina_Bool skip_focus : 1; +}; + +static const char *widtype = NULL; +static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _elm_win_obj_callback_img_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y); +static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj); +static void _elm_win_move(Ecore_Evas *ee); +static void _elm_win_resize(Ecore_Evas *ee); +static void _elm_win_delete_request(Ecore_Evas *ee); +static void _elm_win_resize_job(void *data); +#ifdef HAVE_ELEMENTARY_X +static void _elm_win_xwin_update(Elm_Win *win); +#endif +static void _elm_win_eval_subobjs(Evas_Object *obj); +static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _elm_win_focus_highlight_init(Elm_Win *win); +static void _elm_win_focus_highlight_shutdown(Elm_Win *win); +static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible); +static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win); +static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win); +static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _elm_win_focus_highlight_reconfigure(Elm_Win *win); + +static void _elm_win_frame_add(Elm_Win *win, const char *style); +static void _elm_win_frame_cb_move_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__); +static void _elm_win_frame_cb_resize_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source); +static void _elm_win_frame_cb_minimize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__); +static void _elm_win_frame_cb_maximize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__); +static void _elm_win_frame_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__); + +//static void _elm_win_pointer_add(Elm_Win *win, const char *style); + +static const char SIG_DELETE_REQUEST[] = "delete,request"; +static const char SIG_FOCUS_OUT[] = "focus,out"; +static const char SIG_FOCUS_IN[] = "focus,in"; +static const char SIG_MOVED[] = "moved"; +static const char SIG_THEME_CHANGED[] = "theme,changed"; +static const char SIG_WITHDRAWN[] = "withdrawn"; +static const char SIG_ICONIFIED[] = "iconified"; +static const char SIG_NORMAL[] = "normal"; +static const char SIG_STICK[] = "stick"; +static const char SIG_UNSTICK[] = "unstick"; +static const char SIG_FULLSCREEN[] = "fullscreen"; +static const char SIG_UNFULLSCREEN[] = "unfullscreen"; +static const char SIG_MAXIMIZED[] = "maximized"; +static const char SIG_UNMAXIMIZED[] = "unmaximized"; + +static const Evas_Smart_Cb_Description _signals[] = { + {SIG_DELETE_REQUEST, ""}, + {SIG_FOCUS_OUT, ""}, + {SIG_FOCUS_IN, ""}, + {SIG_MOVED, ""}, + {SIG_WITHDRAWN, ""}, + {SIG_ICONIFIED, ""}, + {SIG_NORMAL, ""}, + {SIG_STICK, ""}, + {SIG_UNSTICK, ""}, + {SIG_FULLSCREEN, ""}, + {SIG_UNFULLSCREEN, ""}, + {SIG_MAXIMIZED, ""}, + {SIG_UNMAXIMIZED, ""}, + {NULL, NULL} +}; + + + +Eina_List *_elm_win_list = NULL; +int _elm_win_deferred_free = 0; + +// exmaple shot spec (wait 0.1 sec then save as my-window.png): +// ELM_ENGINE="shot:delay=0.1:file=my-window.png" + +static double +_shot_delay_get(Elm_Win *win) +{ + char *p, *pd; + char *d = strdup(win->shot.info); + + if (!d) return 0.5; + for (p = (char *)win->shot.info; *p; p++) + { + if (!strncmp(p, "delay=", 6)) + { + double v; + + for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++) + { + *pd = *p; + } + *pd = 0; + v = atof(d); + free(d); + return v; + } + } + free(d); + return 0.5; +} + +static char * +_shot_file_get(Elm_Win *win) +{ + char *p; + char *tmp = strdup(win->shot.info); + char *repname = NULL; + + if (!tmp) return NULL; + + for (p = (char *)win->shot.info; *p; p++) + { + if (!strncmp(p, "file=", 5)) + { + strcpy(tmp, p + 5); + if (!win->shot.repeat_count) return tmp; + else + { + char *dotptr = strrchr(tmp, '.'); + if (dotptr) + { + size_t size = sizeof(char)*(strlen(tmp) + 16); + repname = malloc(size); + strncpy(repname, tmp, dotptr - tmp); + snprintf(repname + (dotptr - tmp), size - (dotptr - tmp), "%03i", + win->shot.shot_counter + 1); + strcat(repname, dotptr); + free(tmp); + return repname; + } + } + } + } + free(tmp); + if (!win->shot.repeat_count) return strdup("out.png"); + + repname = malloc(sizeof(char) * 24); + snprintf(repname, sizeof(char) * 24, "out%03i.png", win->shot.shot_counter + 1); + return repname; +} + +static int +_shot_repeat_count_get(Elm_Win *win) +{ + char *p, *pd; + char *d = strdup(win->shot.info); + + if (!d) return 0; + for (p = (char *)win->shot.info; *p; p++) + { + if (!strncmp(p, "repeat=", 7)) + { + int v; + + for (pd = d, p += 7; (*p) && (*p != ':'); p++, pd++) + { + *pd = *p; + } + *pd = 0; + v = atoi(d); + if (v < 0) v = 0; + if (v > 1000) v = 999; + free(d); + return v; + } + } + free(d); + return 0; +} + +static char * +_shot_key_get(Elm_Win *win __UNUSED__) +{ + return NULL; +} + +static char * +_shot_flags_get(Elm_Win *win __UNUSED__) +{ + return NULL; +} + +static void +_shot_do(Elm_Win *win) +{ + Ecore_Evas *ee; + Evas_Object *o; + unsigned int *pixels; + int w, h; + char *file, *key, *flags; + + ecore_evas_manual_render(win->ee); + pixels = (void *)ecore_evas_buffer_pixels_get(win->ee); + if (!pixels) return; + ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h); + if ((w < 1) || (h < 1)) return; + file = _shot_file_get(win); + if (!file) return; + key = _shot_key_get(win); + flags = _shot_flags_get(win); + ee = ecore_evas_buffer_new(1, 1); + o = evas_object_image_add(ecore_evas_get(ee)); + evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee)); + evas_object_image_size_set(o, w, h); + evas_object_image_data_set(o, pixels); + if (!evas_object_image_save(o, file, key, flags)) + { + ERR("Cannot save window to '%s' (key '%s', flags '%s')", + file, key, flags); + } + free(file); + if (key) free(key); + if (flags) free(flags); + ecore_evas_free(ee); + if (win->shot.repeat_count) win->shot.shot_counter++; +} + +static Eina_Bool +_shot_delay(void *data) +{ + Elm_Win *win = data; + _shot_do(win); + if (win->shot.repeat_count) + { + int remainshot = (win->shot.repeat_count - win->shot.shot_counter); + if (remainshot > 0) return EINA_TRUE; + } + win->shot.timer = NULL; + elm_exit(); + return EINA_FALSE; +} + +static void +_shot_init(Elm_Win *win) +{ + if (!win->shot.info) return; + win->shot.repeat_count = _shot_repeat_count_get(win); + win->shot.shot_counter = 0; +} + +static void +_shot_handle(Elm_Win *win) +{ + if (!win->shot.info) return; + win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win); +} + +static void +_elm_win_move(Ecore_Evas *ee) +{ + Evas_Object *obj = ecore_evas_object_associate_get(ee); + Elm_Win *win; + int x, y; + + if (!obj) return; + win = elm_widget_data_get(obj); + if (!win) return; + ecore_evas_geometry_get(ee, &x, &y, NULL, NULL); + win->screen.x = x; + win->screen.y = y; + evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL); +} + +static void +_elm_win_resize(Ecore_Evas *ee) +{ + Evas_Object *obj = ecore_evas_object_associate_get(ee); + Elm_Win *win; + + if (!obj) return; + win = elm_widget_data_get(obj); + if (!win) return; + if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job); + win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win); +} + +static void +_elm_win_mouse_in(Ecore_Evas *ee) +{ + Evas_Object *obj; + Elm_Win *win; + + if (!(obj = ecore_evas_object_associate_get(ee))) return; + if (!(win = elm_widget_data_get(obj))) return; + if (win->resizing) win->resizing = EINA_FALSE; +} + +static void +_elm_win_focus_in(Ecore_Evas *ee) +{ + Evas_Object *obj = ecore_evas_object_associate_get(ee); + Elm_Win *win; + + if (!obj) return; + win = elm_widget_data_get(obj); + if (!win) return; + _elm_widget_top_win_focused_set(win->win_obj, EINA_TRUE); + if (!elm_widget_focus_order_get(obj)) + { + elm_widget_focus_steal(win->win_obj); + win->show_count++; + } + else + elm_widget_focus_restore(win->win_obj); + evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL); + win->focus_highlight.cur.visible = EINA_TRUE; + _elm_win_focus_highlight_reconfigure_job_start(win); + if (win->frame_obj) + { + edje_object_signal_emit(win->frame_obj, "elm,action,focus", "elm"); + } + else if (win->img_obj) + { + /* do nothing */ + } +} + +static void +_elm_win_focus_out(Ecore_Evas *ee) +{ + Evas_Object *obj = ecore_evas_object_associate_get(ee); + Elm_Win *win; + + if (!obj) return; + win = elm_widget_data_get(obj); + if (!win) return; + elm_object_focus_set(win->win_obj, EINA_FALSE); + _elm_widget_top_win_focused_set(win->win_obj, EINA_FALSE); + evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL); + win->focus_highlight.cur.visible = EINA_FALSE; + _elm_win_focus_highlight_reconfigure_job_start(win); + if (win->frame_obj) + { + edje_object_signal_emit(win->frame_obj, "elm,action,unfocus", "elm"); + } + else if (win->img_obj) + { + /* do nothing */ + } +} + +static void +_elm_win_state_change(Ecore_Evas *ee) +{ + Evas_Object *obj; + Elm_Win *win; + Eina_Bool ch_withdrawn = EINA_FALSE; + Eina_Bool ch_sticky = EINA_FALSE; + Eina_Bool ch_iconified = EINA_FALSE; + Eina_Bool ch_fullscreen = EINA_FALSE; + Eina_Bool ch_maximized = EINA_FALSE; + + if (!(obj = ecore_evas_object_associate_get(ee))) return; + + if (!(win = elm_widget_data_get(obj))) return; + + if (win->withdrawn != ecore_evas_withdrawn_get(win->ee)) + { + win->withdrawn = ecore_evas_withdrawn_get(win->ee); + ch_withdrawn = EINA_TRUE; + } + if (win->sticky != ecore_evas_sticky_get(win->ee)) + { + win->sticky = ecore_evas_sticky_get(win->ee); + ch_sticky = EINA_TRUE; + } + if (win->iconified != ecore_evas_iconified_get(win->ee)) + { + win->iconified = ecore_evas_iconified_get(win->ee); + ch_iconified = EINA_TRUE; + } + if (win->fullscreen != ecore_evas_fullscreen_get(win->ee)) + { + win->fullscreen = ecore_evas_fullscreen_get(win->ee); + ch_fullscreen = EINA_TRUE; + } + if (win->maximized != ecore_evas_maximized_get(win->ee)) + { + win->maximized = ecore_evas_maximized_get(win->ee); + ch_maximized = EINA_TRUE; + } + if ((ch_withdrawn) || (ch_iconified)) + { + if (win->withdrawn) + evas_object_smart_callback_call(win->win_obj, SIG_WITHDRAWN, NULL); + else if (win->iconified) + evas_object_smart_callback_call(win->win_obj, SIG_ICONIFIED, NULL); + else + evas_object_smart_callback_call(win->win_obj, SIG_NORMAL, NULL); + } + if (ch_sticky) + { + if (win->sticky) + evas_object_smart_callback_call(win->win_obj, SIG_STICK, NULL); + else + evas_object_smart_callback_call(win->win_obj, SIG_UNSTICK, NULL); + } + if (ch_fullscreen) + { + if (win->fullscreen) + evas_object_smart_callback_call(win->win_obj, SIG_FULLSCREEN, NULL); + else + evas_object_smart_callback_call(win->win_obj, SIG_UNFULLSCREEN, NULL); + } + if (ch_maximized) + { + if (win->maximized) + evas_object_smart_callback_call(win->win_obj, SIG_MAXIMIZED, NULL); + else + evas_object_smart_callback_call(win->win_obj, SIG_UNMAXIMIZED, NULL); + } +} + +static Eina_Bool +_elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next) +{ + Elm_Win *wd = elm_widget_data_get(obj); + const Eina_List *items; + const Eina_List *list; + void *(*list_data_get) (const Eina_List *list); + + if (!wd) + return EINA_FALSE; + list = elm_widget_sub_object_list_get(obj); + + /* Focus chain */ + if (list) + { + if (!(items = elm_widget_focus_custom_chain_get(obj))) + items = list; + + list_data_get = eina_list_data_get; + + elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next); + + if (*next) + return EINA_TRUE; + } + *next = (Evas_Object *)obj; + return EINA_FALSE; +} + +static void +_elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) +{ + Elm_Win *win = elm_widget_data_get(obj); + if (!win) return; + + if (win->img_obj) + evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj)); + else + evas_object_focus_set(obj, elm_widget_focus_get(obj)); +} + +static Eina_Bool +_elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info) +{ + if (type == EVAS_CALLBACK_KEY_DOWN) + { + Evas_Event_Key_Down *ev = event_info; + if (!strcmp(ev->keyname, "Tab")) + { + if (evas_key_modifier_is_set(ev->modifiers, "Shift")) + elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS); + else + elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT); + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else if ((!strcmp(ev->keyname, "Left")) || + ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string))) + { + //TODO : woohyun jung + } + else if ((!strcmp(ev->keyname, "Right")) || + ((!strcmp(ev->keyname, "KP_Right")) && (!ev->string))) + { + //TODO : woohyun jung + } + else if ((!strcmp(ev->keyname, "Up")) || + ((!strcmp(ev->keyname, "KP_Up")) && (!ev->string))) + { + //TODO : woohyun jung + } + else if ((!strcmp(ev->keyname, "Down")) || + ((!strcmp(ev->keyname, "KP_Down")) && (!ev->string))) + { + //TODO : woohyun jung + } + } + + return EINA_FALSE; +} + +static void +_deferred_ecore_evas_free(void *data) +{ + ecore_evas_free(data); + _elm_win_deferred_free--; +} + +static void +_elm_win_obj_callback_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Win *win = data; + + if (!win->show_count) win->show_count++; + if (win->shot.info) _shot_handle(win); +} + +static void +_elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Win *win = data; + + if (win->frame_obj) + { + evas_object_hide(win->frame_obj); + } + else if (win->img_obj) + { + evas_object_hide(win->img_obj); + } + if (win->pointer.obj) + { + evas_object_hide(win->pointer.obj); + ecore_evas_hide(win->pointer.ee); + } +} + +static void +_elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__) +{ + Elm_Win *win = data; + Evas_Object *child, *child2 = NULL; + + if (win->parent) + { + evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL, + _elm_win_obj_callback_parent_del, win); + win->parent = NULL; + } + if (win->autodel_clear) *(win->autodel_clear) = -1; + _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj); + while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data); + if (win->ee) + { + ecore_evas_callback_delete_request_set(win->ee, NULL); + ecore_evas_callback_resize_set(win->ee, NULL); + } + if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job); + if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job); + if (win->shot.info) eina_stringshare_del(win->shot.info); + if (win->shot.timer) ecore_timer_del(win->shot.timer); + evas_object_event_callback_del_full(win->win_obj, EVAS_CALLBACK_DEL, + _elm_win_obj_callback_del, win); + child = evas_object_bottom_get(win->evas); + while (child) + { + /* if the object we see *IS* the window object (because we are + * faking a parent object inside the canvas), then skip it and + * go to the next one */ + if (child == obj) + { + child = evas_object_above_get(child); + if (!child) break; + } + /* if we are using the next object above from the previous loop */ + if (child == child2) + { + /* this object has refcounts from the previous loop */ + child2 = evas_object_above_get(child); + if (child2) evas_object_ref(child2); + evas_object_del(child); + /* so unref from previous loop */ + evas_object_unref(child); + child = child2; + } + else + { + /* just delete as normal (probably only first object */ + child2 = evas_object_above_get(child); + if (child2) evas_object_ref(child2); + evas_object_del(child); + child = child2; + } + } +#ifdef HAVE_ELEMENTARY_X + if (win->client_message_handler) + ecore_event_handler_del(win->client_message_handler); +#endif + // FIXME: Why are we flushing edje on every window destroy ?? + // edje_file_cache_flush(); + // edje_collection_cache_flush(); + // evas_image_cache_flush(win->evas); + // evas_font_cache_flush(win->evas); + // FIXME: we are in the del handler for the object and delete the canvas + // that lives under it from the handler... nasty. deferring doesn't help either + + if (win->img_obj) + { + win->img_obj = NULL; + } + else + { + if (win->ee) + { + ecore_job_add(_deferred_ecore_evas_free, win->ee); + _elm_win_deferred_free++; + } + } + + _elm_win_focus_highlight_shutdown(win); + eina_stringshare_del(win->focus_highlight.style); + + if (win->title) eina_stringshare_del(win->title); + if (win->icon_name) eina_stringshare_del(win->icon_name); + if (win->role) eina_stringshare_del(win->role); + if (win->icon) evas_object_del(win->icon); + + free(win); + + if ((!_elm_win_list) && + (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED)) + { + edje_file_cache_flush(); + edje_collection_cache_flush(); + evas_image_cache_flush(e); + evas_font_cache_flush(e); + elm_exit(); + } +} + +static void +_elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Win *win = data; + if (!win->img_obj) return; + evas_object_event_callback_del_full + (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win); + evas_object_del(win->img_obj); +} + +static void +_elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Elm_Win *win = data; + if (obj == win->parent) win->parent = NULL; +} + +static void +_elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y) +{ + Elm_Win *win = data; + + if (win->img_obj) + { + if ((x != win->screen.x) || (y != win->screen.y)) + { + win->screen.x = x; + win->screen.y = y; + evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL); + } + } + else + { + evas_object_move(obj, x, y); + } +} + +static void +_elm_win_obj_intercept_show(void *data, Evas_Object *obj) +{ + Elm_Win *win = data; + // this is called to make sure all smart containers have calculated their + // sizes BEFORE we show the window to make sure it initially appears at + // our desired size (ie min size is known first) + evas_smart_objects_calculate(evas_object_evas_get(obj)); + if (win->frame_obj) + { + evas_object_show(win->frame_obj); + } + else if (win->img_obj) + { + evas_object_show(win->img_obj); + } + if (win->pointer.obj) + { + ecore_evas_show(win->pointer.ee); + evas_object_show(win->pointer.obj); + /* ecore_evas_wayland_pointer_set(win->pointer.ee, 10, 10); */ + } + evas_object_show(obj); +} + +static void +_elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Elm_Win *win = data; + + if (ecore_evas_override_get(win->ee)) + { + Evas_Coord x, y; + + evas_object_geometry_get(obj, &x, &y, NULL, NULL); + win->screen.x = x; + win->screen.y = y; + evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL); + } + if (win->frame_obj) + { + Evas_Coord x, y; + + evas_object_geometry_get(obj, &x, &y, NULL, NULL); + win->screen.x = x; + win->screen.y = y; + } + else if (win->img_obj) + { + Evas_Coord x, y; + + evas_object_geometry_get(obj, &x, &y, NULL, NULL); + win->screen.x = x; + win->screen.y = y; +// evas_object_move(win->img_obj, x, y); + } +} + +static void +_elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Elm_Win *win = data; + + if (win->frame_obj) + { + } + else if (win->img_obj) + { + Evas_Coord w = 1, h = 1; + + evas_object_geometry_get(obj, NULL, NULL, &w, &h); + if (win->constrain) + { + int sw, sh; + ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh); + w = MIN(w, sw); + h = MIN(h, sh); + } + if (w < 1) w = 1; + if (h < 1) h = 1; + evas_object_image_size_set(win->img_obj, w, h); + } +} + +static void +_elm_win_delete_request(Ecore_Evas *ee) +{ + Evas_Object *obj = ecore_evas_object_associate_get(ee); + Elm_Win *win; + if (strcmp(elm_widget_type_get(obj), "win")) return; + + win = elm_widget_data_get(obj); + if (!win) return; + int autodel = win->autodel; + win->autodel_clear = &autodel; + evas_object_ref(win->win_obj); + evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL); + // FIXME: if above callback deletes - then the below will be invalid + if (autodel) evas_object_del(win->win_obj); + else win->autodel_clear = NULL; + evas_object_unref(win->win_obj); +} + +static void +_elm_win_resize_job(void *data) +{ + Elm_Win *win = data; + const Eina_List *l; + Evas_Object *obj; + int w, h; + + win->deferred_resize_job = NULL; + ecore_evas_request_geometry_get(win->ee, NULL, NULL, &w, &h); + if (win->constrain) + { + int sw, sh; + ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh); + w = MIN(w, sw); + h = MIN(h, sh); + } + if (win->frame_obj) + { + evas_object_resize(win->frame_obj, w, h); + } + else if (win->img_obj) + { + } + evas_object_resize(win->win_obj, w, h); + EINA_LIST_FOREACH(win->subobjs, l, obj) + { + evas_object_move(obj, 0, 0); + evas_object_resize(obj, w, h); + } +} + +#ifdef HAVE_ELEMENTARY_X +static void +_elm_win_xwindow_get(Elm_Win *win) +{ + win->xwin = 0; + +#define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name)) + if (ENGINE_COMPARE(ELM_SOFTWARE_X11)) + { + if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee); + } + else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) || + ENGINE_COMPARE(ELM_SOFTWARE_FB) || + ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) || + ENGINE_COMPARE(ELM_SOFTWARE_SDL) || + ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) || + ENGINE_COMPARE(ELM_OPENGL_SDL) || + ENGINE_COMPARE(ELM_OPENGL_COCOA)) + { + } + else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11)) + { + if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee); + } + else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11)) + { + if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee); + } +/* killed + else if (ENGINE_COMPARE(ELM_XRENDER_X11)) + { + if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee); + } + */ + else if (ENGINE_COMPARE(ELM_OPENGL_X11)) + { + if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee); + } + else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32)) + { + if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee); + } +#undef ENGINE_COMPARE +} +#endif + +#ifdef HAVE_ELEMENTARY_X +static void +_elm_win_xwin_update(Elm_Win *win) +{ + const char *s; + + _elm_win_xwindow_get(win); + if (win->parent) + { + Elm_Win *win2; + + win2 = elm_widget_data_get(win->parent); + if (win2) + { + if (win->xwin) + ecore_x_icccm_transient_for_set(win->xwin, win2->xwin); + } + } + + if (!win->xwin) return; /* nothing more to do */ + + s = win->title; + if (!s) s = _elm_appname; + if (!s) s = ""; + if (win->icon_name) s = win->icon_name; + ecore_x_icccm_icon_name_set(win->xwin, s); + ecore_x_netwm_icon_name_set(win->xwin, s); + + s = win->role; + if (s) ecore_x_icccm_window_role_set(win->xwin, s); + + // set window icon + if (win->icon) + { + void *data; + + data = evas_object_image_data_get(win->icon, EINA_FALSE); + if (data) + { + Ecore_X_Icon ic; + int w = 0, h = 0, stride, x, y; + unsigned char *p; + unsigned int *p2; + + evas_object_image_size_get(win->icon, &w, &h); + stride = evas_object_image_stride_get(win->icon); + if ((w > 0) && (h > 0) && + (stride >= (int)(w * sizeof(unsigned int)))) + { + ic.width = w; + ic.height = h; + ic.data = malloc(w * h * sizeof(unsigned int)); + + if (ic.data) + { + p = (unsigned char *)data; + p2 = (unsigned int *)ic.data; + for (y = 0; y < h; y++) + { + for (x = 0; x < w; x++) + { + *p2 = *((unsigned int *)p); + p += sizeof(unsigned int); + p2++; + } + p += (stride - (w * sizeof(unsigned int))); + } + ecore_x_netwm_icons_set(win->xwin, &ic, 1); + free(ic.data); + } + } + evas_object_image_data_set(win->icon, data); + } + } + + switch (win->type) + { + case ELM_WIN_BASIC: + ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL); + break; + case ELM_WIN_DIALOG_BASIC: + ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG); + break; + case ELM_WIN_DESKTOP: + ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP); + break; + case ELM_WIN_DOCK: + ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK); + break; + case ELM_WIN_TOOLBAR: + ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR); + break; + case ELM_WIN_MENU: + ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU); + break; + case ELM_WIN_UTILITY: + ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY); + break; + case ELM_WIN_SPLASH: + ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH); + break; + case ELM_WIN_DROPDOWN_MENU: + ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU); + break; + case ELM_WIN_POPUP_MENU: + ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU); + break; + case ELM_WIN_TOOLTIP: + ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP); + break; + case ELM_WIN_NOTIFICATION: + ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION); + break; + case ELM_WIN_COMBO: + ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO); + break; + case ELM_WIN_DND: + ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND); + break; + default: + break; + } + ecore_x_e_virtual_keyboard_state_set + (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode); + if (win->indmode == ELM_WIN_INDICATOR_SHOW) + ecore_x_e_illume_indicator_state_set + (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON); + else if (win->indmode == ELM_WIN_INDICATOR_HIDE) + ecore_x_e_illume_indicator_state_set + (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF); +} +#endif + +static void +_elm_win_eval_subobjs(Evas_Object *obj) +{ + const Eina_List *l; + const Evas_Object *child; + + Elm_Win *win = elm_widget_data_get(obj); + Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1; + int xx = 1, xy = 1; + double wx, wy; + + EINA_LIST_FOREACH(win->subobjs, l, child) + { + evas_object_size_hint_weight_get(child, &wx, &wy); + if (wx == 0.0) xx = 0; + if (wy == 0.0) xy = 0; + + evas_object_size_hint_min_get(child, &w, &h); + if (w < 1) w = 1; + if (h < 1) h = 1; + if (w > minw) minw = w; + if (h > minh) minh = h; + + evas_object_size_hint_max_get(child, &w, &h); + if (w < 1) w = -1; + if (h < 1) h = -1; + if (maxw == -1) maxw = w; + else if ((w > 0) && (w < maxw)) maxw = w; + if (maxh == -1) maxh = h; + else if ((h > 0) && (h < maxh)) maxh = h; + } + if (!xx) maxw = minw; + else maxw = 32767; + if (!xy) maxh = minh; + else maxh = 32767; + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, maxw, maxh); + evas_object_geometry_get(obj, NULL, NULL, &w, &h); + if (w < minw) w = minw; + if (h < minh) h = minh; + if ((maxw >= 0) && (w > maxw)) w = maxw; + if ((maxh >= 0) && (h > maxh)) h = maxh; + evas_object_resize(obj, w, h); +} + +static void +_elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Elm_Win *win = elm_widget_data_get(data); + win->subobjs = eina_list_remove(win->subobjs, obj); + _elm_win_eval_subobjs(win->win_obj); +} + +static void +_elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _elm_win_eval_subobjs(data); +} + +void +_elm_win_shutdown(void) +{ + while (_elm_win_list) + evas_object_del(_elm_win_list->data); +} + +void +_elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme) +{ + const Eina_List *l; + Evas_Object *obj; + + if (!use_theme) + { + EINA_LIST_FOREACH(_elm_win_list, l, obj) + elm_widget_theme(obj); + } + else + { + EINA_LIST_FOREACH(_elm_win_list, l, obj) + elm_widget_theme_specific(obj, th, EINA_FALSE); + } +} + +void +_elm_win_translate(void) +{ + const Eina_List *l; + Evas_Object *obj; + + EINA_LIST_FOREACH(_elm_win_list, l, obj) + elm_widget_translate(obj); +} + +#ifdef HAVE_ELEMENTARY_X +static Eina_Bool +_elm_win_client_message(void *data, int type __UNUSED__, void *event) +{ + Elm_Win *win = data; + Ecore_X_Event_Client_Message *e = event; + + if (e->format != 32) return ECORE_CALLBACK_PASS_ON; + if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH) + { + if ((unsigned)e->data.l[0] == win->xwin) + { + Evas *evas = evas_object_evas_get(win->win_obj); + if (evas) + { + edje_file_cache_flush(); + edje_collection_cache_flush(); + evas_image_cache_flush(evas); + evas_font_cache_flush(evas); + } + } + } + else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP) + { + if ((unsigned)e->data.l[0] == win->xwin) + { + Evas *evas = evas_object_evas_get(win->win_obj); + if (evas) + { + edje_file_cache_flush(); + edje_collection_cache_flush(); + evas_image_cache_flush(evas); + evas_font_cache_flush(evas); + evas_render_dump(evas); + } + } + } + return ECORE_CALLBACK_PASS_ON; +} +#endif + +static void +_elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Win *win = data; + + win->focus_highlight.geometry_changed = EINA_TRUE; + _elm_win_focus_highlight_reconfigure_job_start(win); +} + +static void +_elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Win *win = data; + + win->focus_highlight.geometry_changed = EINA_TRUE; + _elm_win_focus_highlight_reconfigure_job_start(win); +} + +static void +_elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Win *win = data; + + win->focus_highlight.cur.target = NULL; + + _elm_win_focus_highlight_reconfigure_job_start(win); +} + +static void +_elm_win_focus_target_callbacks_add(Elm_Win *win) +{ + Evas_Object *obj = win->focus_highlight.cur.target; + + evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, + _elm_win_focus_target_move, win); + evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, + _elm_win_focus_target_resize, win); + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, + _elm_win_focus_target_del, win); +} + +static void +_elm_win_focus_target_callbacks_del(Elm_Win *win) +{ + Evas_Object *obj = win->focus_highlight.cur.target; + + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE, + _elm_win_focus_target_move, win); + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE, + _elm_win_focus_target_resize, win); + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL, + _elm_win_focus_target_del, win); +} + +static Evas_Object * +_elm_win_focus_target_get(Evas_Object *obj) +{ + Evas_Object *o = obj; + + do + { + if (elm_widget_is(o)) + { + if (!elm_widget_highlight_ignore_get(o)) + break; + o = elm_widget_parent_get(o); + if (!o) + o = evas_object_smart_parent_get(o); + } + else + { + o = elm_widget_parent_widget_get(o); + if (!o) + o = evas_object_smart_parent_get(o); + } + } + while (o); + + return o; +} + +static void +_elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info) +{ + Evas_Object *obj = event_info, *target; + Elm_Win *win = data; + + if (win->focus_highlight.cur.target == obj) + return; + + target = _elm_win_focus_target_get(obj); + win->focus_highlight.cur.target = target; + if (elm_widget_highlight_in_theme_get(target)) + win->focus_highlight.cur.handled = EINA_TRUE; + else + _elm_win_focus_target_callbacks_add(win); + + _elm_win_focus_highlight_reconfigure_job_start(win); +} + +static void +_elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Win *win = data; + + if (!win->focus_highlight.cur.target) + return; + + if (!win->focus_highlight.cur.handled) + _elm_win_focus_target_callbacks_del(win); + win->focus_highlight.cur.target = NULL; + win->focus_highlight.cur.handled = EINA_FALSE; + + _elm_win_focus_highlight_reconfigure_job_start(win); +} + +static void +_elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + evas_object_hide(obj); +} + +static void +_elm_win_focus_highlight_init(Elm_Win *win) +{ + evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN, + _elm_win_object_focus_in, win); + evas_event_callback_add(win->evas, + EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT, + _elm_win_object_focus_out, win); + + win->focus_highlight.cur.target = evas_focus_get(win->evas); + + win->focus_highlight.top = edje_object_add(win->evas); + win->focus_highlight.changed_theme = EINA_TRUE; + edje_object_signal_callback_add(win->focus_highlight.top, + "elm,action,focus,hide,end", "", + _elm_win_focus_highlight_hide, NULL); + edje_object_signal_callback_add(win->focus_highlight.top, + "elm,action,focus,anim,end", "", + _elm_win_focus_highlight_anim_end, win); + _elm_win_focus_highlight_reconfigure_job_start(win); +} + +static void +_elm_win_focus_highlight_shutdown(Elm_Win *win) +{ + _elm_win_focus_highlight_reconfigure_job_stop(win); + if (win->focus_highlight.cur.target) + { + _elm_win_focus_target_callbacks_del(win); + win->focus_highlight.cur.target = NULL; + } + if (win->focus_highlight.top) + { + evas_object_del(win->focus_highlight.top); + win->focus_highlight.top = NULL; + } + + evas_event_callback_del_full(win->evas, + EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN, + _elm_win_object_focus_in, win); + evas_event_callback_del_full(win->evas, + EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT, + _elm_win_object_focus_out, win); +} + +static void +_elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible) +{ + Evas_Object *top; + + top = win->focus_highlight.top; + if (visible) + { + if (top) + { + evas_object_show(top); + edje_object_signal_emit(top, "elm,action,focus,show", "elm"); + } + } + else + { + if (top) + edje_object_signal_emit(top, "elm,action,focus,hide", "elm"); + } +} + +static void +_elm_win_focus_highlight_reconfigure_job(void *data) +{ + _elm_win_focus_highlight_reconfigure((Elm_Win *)data); +} + +static void +_elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win) +{ + if (win->focus_highlight.reconf_job) + ecore_job_del(win->focus_highlight.reconf_job); + win->focus_highlight.reconf_job = ecore_job_add( + _elm_win_focus_highlight_reconfigure_job, win); +} + +static void +_elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win) +{ + if (win->focus_highlight.reconf_job) + ecore_job_del(win->focus_highlight.reconf_job); + win->focus_highlight.reconf_job = NULL; +} + +static void +_elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj) +{ + Evas_Object *clip, *target = win->focus_highlight.cur.target; + Evas_Coord x, y, w, h; + + clip = evas_object_clip_get(target); + evas_object_geometry_get(target, &x, &y, &w, &h); + + evas_object_move(obj, x, y); + evas_object_resize(obj, w, h); + evas_object_clip_set(obj, clip); +} + +static void +_elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj) +{ + Evas_Coord tx, ty, tw, th; + Evas_Coord w, h, px, py, pw, ph; + Edje_Message_Int_Set *m; + Evas_Object *previous = win->focus_highlight.prev.target; + Evas_Object *target = win->focus_highlight.cur.target; + + evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h); + evas_object_geometry_get(target, &tx, &ty, &tw, &th); + evas_object_geometry_get(previous, &px, &py, &pw, &ph); + evas_object_move(obj, 0, 0); + evas_object_resize(obj, tw, th); + evas_object_clip_unset(obj); + + m = alloca(sizeof(*m) + (sizeof(int) * 8)); + m->count = 8; + m->val[0] = px; + m->val[1] = py; + m->val[2] = pw; + m->val[3] = ph; + m->val[4] = tx; + m->val[5] = ty; + m->val[6] = tw; + m->val[7] = th; + edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m); +} + +static void +_elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Elm_Win *win = data; + _elm_win_focus_highlight_simple_setup(win, obj); +} + +static void +_elm_win_focus_highlight_reconfigure(Elm_Win *win) +{ + Evas_Object *target = win->focus_highlight.cur.target; + Evas_Object *previous = win->focus_highlight.prev.target; + Evas_Object *top = win->focus_highlight.top; + Eina_Bool visible_changed; + Eina_Bool common_visible; + const char *sig = NULL; + + _elm_win_focus_highlight_reconfigure_job_stop(win); + + visible_changed = (win->focus_highlight.cur.visible != + win->focus_highlight.prev.visible); + + if ((target == previous) && (!visible_changed) && + (!win->focus_highlight.geometry_changed)) + return; + + if ((previous) && (win->focus_highlight.prev.handled)) + elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm"); + + if (!target) + common_visible = EINA_FALSE; + else if (win->focus_highlight.cur.handled) + { + common_visible = EINA_FALSE; + if (win->focus_highlight.cur.visible) + sig = "elm,action,focus_highlight,show"; + else + sig = "elm,action,focus_highlight,hide"; + } + else + common_visible = win->focus_highlight.cur.visible; + + _elm_win_focus_highlight_visible_set(win, common_visible); + if (sig) + elm_widget_signal_emit(target, sig, "elm"); + + if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled)) + goto the_end; + + if (win->focus_highlight.changed_theme) + { + const char *str; + if (win->focus_highlight.style) + str = win->focus_highlight.style; + else + str = "default"; + _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top", + str); + win->focus_highlight.changed_theme = EINA_FALSE; + + if (_elm_config->focus_highlight_animate) + { + str = edje_object_data_get(win->focus_highlight.top, "animate"); + win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on"))); + } + } + + if ((win->focus_highlight.top_animate) && (previous) && + (!win->focus_highlight.prev.handled)) + _elm_win_focus_highlight_anim_setup(win, top); + else + _elm_win_focus_highlight_simple_setup(win, top); + evas_object_raise(top); + +the_end: + win->focus_highlight.geometry_changed = EINA_FALSE; + win->focus_highlight.prev = win->focus_highlight.cur; +} + +static void +_elm_win_frame_add(Elm_Win *win, const char *style) +{ + evas_output_framespace_set(win->evas, 0, 22, 0, 26); + + win->frame_obj = edje_object_add(win->evas); + _elm_theme_set(NULL, win->frame_obj, "border", "base", style); + evas_object_is_frame_object_set(win->frame_obj, EINA_TRUE); + evas_object_move(win->frame_obj, 0, 0); + evas_object_resize(win->frame_obj, 1, 1); + + edje_object_signal_callback_add(win->frame_obj, "elm,action,move,start", + "elm", _elm_win_frame_cb_move_start, win); + edje_object_signal_callback_add(win->frame_obj, "elm,action,resize,start", + "*", _elm_win_frame_cb_resize_start, win); + edje_object_signal_callback_add(win->frame_obj, "elm,action,minimize", + "elm", _elm_win_frame_cb_minimize, win); + edje_object_signal_callback_add(win->frame_obj, "elm,action,maximize", + "elm", _elm_win_frame_cb_maximize, win); + edje_object_signal_callback_add(win->frame_obj, "elm,action,close", + "elm", _elm_win_frame_cb_close, win); +} + +static void +_elm_win_frame_cb_move_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__) +{ + Elm_Win *win; + + if (!(win = data)) return; + /* FIXME: Change mouse pointer */ + + /* NB: 0,0 are dummy values. Wayland handles the move by itself */ + ecore_evas_move(win->ee, 0, 0); +} + +static void +_elm_win_frame_cb_resize_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source) +{ + Elm_Win *win; + + if (!(win = data)) return; + if (win->resizing) return; + win->resizing = EINA_TRUE; + + /* FIXME: Change mouse pointer */ + + if (!strcmp(source, "elm.event.resize.t")) + win->resize_location = 1; + else if (!strcmp(source, "elm.event.resize.b")) + win->resize_location = 2; + else if (!strcmp(source, "elm.event.resize.l")) + win->resize_location = 4; + else if (!strcmp(source, "elm.event.resize.r")) + win->resize_location = 8; + else if (!strcmp(source, "elm.event.resize.tl")) + win->resize_location = 5; + else if (!strcmp(source, "elm.event.resize.tr")) + win->resize_location = 9; + else if (!strcmp(source, "elm.event.resize.bl")) + win->resize_location = 6; + else if (!strcmp(source, "elm.event.resize.br")) + win->resize_location = 10; + else + win->resize_location = 0; + + if (win->resize_location > 0) + ecore_evas_wayland_resize(win->ee, win->resize_location); +} + +static void +_elm_win_frame_cb_minimize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__) +{ + Elm_Win *win; + + if (!(win = data)) return; + win->iconified = EINA_TRUE; + ecore_evas_iconified_set(win->ee, EINA_TRUE); +} + +static void +_elm_win_frame_cb_maximize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__) +{ + Elm_Win *win; + + if (!(win = data)) return; + if (win->maximized) win->maximized = EINA_FALSE; + else win->maximized = EINA_TRUE; + ecore_evas_maximized_set(win->ee, win->maximized); +} + +static void +_elm_win_frame_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__) +{ + Elm_Win *win; + + if (!(win = data)) return; + evas_object_del(win->win_obj); +} + +/* +static void +_elm_win_pointer_add(Elm_Win *win, const char *style) +{ + int mw, mh; + + return; + + win->pointer.ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 0, 32, 32, 0); + ecore_evas_resize(win->pointer.ee, 32, 32); + + win->pointer.evas = ecore_evas_get(win->ee); + + win->pointer.obj = edje_object_add(win->pointer.evas); + _elm_theme_set(NULL, win->pointer.obj, "pointer", "base", style); + edje_object_size_min_calc(win->pointer.obj, &mw, &mh); + evas_object_move(win->pointer.obj, 0, 0); + evas_object_resize(win->pointer.obj, 32, 32); + evas_object_show(win->pointer.obj); +} +*/ + +#ifdef ELM_DEBUG +static void +_debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info) +{ + Evas_Event_Key_Down *ev = event_info; + + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) + return; + + if ((strcmp(ev->keyname, "F12")) || + (!evas_key_modifier_is_set(ev->modifiers, "Control"))) + return; + + printf("Tree graph generated.\n"); + elm_object_tree_dot_dump(obj, "./dump.dot"); +} +#endif + +static void +_win_img_hide(void *data, + Evas *e __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Elm_Win *win = data; + + elm_widget_focus_hide_handle(win->win_obj); +} + +static void +_win_img_mouse_up(void *data, + Evas *e __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + Elm_Win *win = data; + Evas_Event_Mouse_Up *ev = event_info; + if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)) + elm_widget_focus_mouse_up_handle(win->win_obj); +} + +static void +_win_img_focus_in(void *data, + Evas *e __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Elm_Win *win = data; + elm_widget_focus_steal(win->win_obj); +} + +static void +_win_img_focus_out(void *data, + Evas *e __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Elm_Win *win = data; + elm_widget_focused_object_clear(win->win_obj); +} + +static void +_win_inlined_image_set(Elm_Win *win) +{ + evas_object_image_alpha_set(win->img_obj, EINA_FALSE); + evas_object_image_filled_set(win->img_obj, EINA_TRUE); + evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL, + _elm_win_obj_callback_img_obj_del, win); + + evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE, + _win_img_hide, win); + evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP, + _win_img_mouse_up, win); + evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN, + _win_img_focus_in, win); + evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT, + _win_img_focus_out, win); +} + +static void +_subobj_del(Elm_Win *win, Evas_Object *obj, Evas_Object *subobj) +{ + evas_object_event_callback_del_full(subobj, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _elm_win_subobj_callback_changed_size_hints, + obj); + evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL, + _elm_win_subobj_callback_del, obj); + win->subobjs = eina_list_remove(win->subobjs, subobj); + _elm_win_eval_subobjs(obj); +} + +static void +_elm_win_obj_icon_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Elm_Win *win = data; + if (win->icon == obj) win->icon = NULL; +} + +EAPI Evas_Object * +elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type) +{ + Elm_Win *win; + const Eina_List *l; + const char *fontpath; + + win = ELM_NEW(Elm_Win); + +#define FALLBACK_TRY(engine) \ + if (!win->ee) \ + do { \ + CRITICAL(engine " engine creation failed. Trying default."); \ + win->ee = ecore_evas_new(NULL, 0, 0, 1, 1, NULL); \ + if (win->ee) \ + elm_config_preferred_engine_set(ecore_evas_engine_name_get(win->ee)); \ + } while (0) +#define ENGINE_COMPARE(name) (_elm_preferred_engine && !strcmp(_elm_preferred_engine, name)) + + win->kbdmode = ELM_WIN_KEYBOARD_UNKNOWN; + win->indmode = ELM_WIN_INDICATOR_UNKNOWN; + + switch (type) + { + case ELM_WIN_INLINED_IMAGE: + if (!parent) break; + { + Evas *e = evas_object_evas_get(parent); + Ecore_Evas *ee; + if (!e) break; + ee = ecore_evas_ecore_evas_get(e); + if (!ee) break; + win->img_obj = ecore_evas_object_image_new(ee); + if (!win->img_obj) break; + win->ee = ecore_evas_object_ecore_evas_get(win->img_obj); + if (win->ee) + { + _win_inlined_image_set(win); + break; + } + evas_object_del(win->img_obj); + win->img_obj = NULL; + } + break; + + case ELM_WIN_SOCKET_IMAGE: + win->ee = ecore_evas_extn_socket_new(1, 1); + break; + + default: + if (ENGINE_COMPARE(ELM_SOFTWARE_X11)) + { + win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1); +#ifdef HAVE_ELEMENTARY_X + win->client_message_handler = ecore_event_handler_add + (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win); +#endif + FALLBACK_TRY("Sofware X11"); + } + else if (ENGINE_COMPARE(ELM_SOFTWARE_FB)) + { + win->ee = ecore_evas_fb_new(NULL, 0, 1, 1); + FALLBACK_TRY("Sofware FB"); + } + else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB)) + { + win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1); + FALLBACK_TRY("Sofware DirectFB"); + } + else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11)) + { + win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1); + FALLBACK_TRY("Sofware-16"); +#ifdef HAVE_ELEMENTARY_X + win->client_message_handler = ecore_event_handler_add + (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win); +#endif + } + else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11)) + { + win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1); + FALLBACK_TRY("Sofware-8"); +#ifdef HAVE_ELEMENTARY_X + win->client_message_handler = ecore_event_handler_add + (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win); +#endif + } +/* killed + else if (ENGINE_COMPARE(ELM_XRENDER_X11)) + { + win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1); + FALLBACK_TRY("XRender"); +#ifdef HAVE_ELEMENTARY_X + win->client_message_handler = ecore_event_handler_add + (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win); +#endif + } + */ + else if (ENGINE_COMPARE(ELM_OPENGL_X11)) + { + int opt[10]; + int opt_i = 0; + + if (_elm_config->vsync) + { + opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC; + opt_i++; + opt[opt_i] = 1; + opt_i++; + } + if (opt_i > 0) + win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt); + else + win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1); + FALLBACK_TRY("OpenGL"); +#ifdef HAVE_ELEMENTARY_X + win->client_message_handler = ecore_event_handler_add + (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win); +#endif + } + else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32)) + { + win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1); + FALLBACK_TRY("Sofware Win32"); + } + else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE)) + { + win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1); + FALLBACK_TRY("Sofware-16-WinCE"); + } + else if (ENGINE_COMPARE(ELM_SOFTWARE_PSL1GHT)) + { + win->ee = ecore_evas_psl1ght_new(NULL, 1, 1); + FALLBACK_TRY("PSL1GHT"); + } + else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL)) + { + win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1); + FALLBACK_TRY("Sofware SDL"); + } + else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL)) + { + win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1); + FALLBACK_TRY("Sofware-16-SDL"); + } + else if (ENGINE_COMPARE(ELM_OPENGL_SDL)) + { + win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0); + FALLBACK_TRY("OpenGL SDL"); + } + else if (ENGINE_COMPARE(ELM_OPENGL_COCOA)) + { + win->ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0); + FALLBACK_TRY("OpenGL Cocoa"); + } + else if (ENGINE_COMPARE(ELM_BUFFER)) + { + win->ee = ecore_evas_buffer_new(1, 1); + } + else if (ENGINE_COMPARE(ELM_EWS)) + { + win->ee = ecore_evas_ews_new(0, 0, 1, 1); + } + else if (ENGINE_COMPARE(ELM_WAYLAND_SHM)) + { + win->ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 0, 1, 1, 0); + win->evas = ecore_evas_get(win->ee); + + _elm_win_frame_add(win, "default"); +// _elm_win_pointer_add(win, "default"); + } + else if (ENGINE_COMPARE(ELM_WAYLAND_EGL)) + { + win->ee = ecore_evas_wayland_egl_new(NULL, 0, 0, 0, 1, 1, 0); + win->evas = ecore_evas_get(win->ee); + + _elm_win_frame_add(win, "default"); +// _elm_win_pointer_add(win, "default"); + } + else if (!strncmp(_elm_preferred_engine, "shot:", 5)) + { + win->ee = ecore_evas_buffer_new(1, 1); + ecore_evas_manual_render_set(win->ee, EINA_TRUE); + win->shot.info = eina_stringshare_add(_elm_preferred_engine + 5); + _shot_init(win); + } +#undef FALLBACK_TRY + break; + } + + if (!win->ee) + { + ERR("Cannot create window."); + free(win); + return NULL; + } +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwindow_get(win); +#endif + if ((_elm_config->bgpixmap) && (!_elm_config->compositing)) + ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE); + // bg pixmap done by x - has other issues like can be redrawn by x before it + // is filled/ready by app + // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN); + + win->type = type; + win->parent = parent; + if (win->parent) + evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL, + _elm_win_obj_callback_parent_del, win); + + win->evas = ecore_evas_get(win->ee); + win->win_obj = elm_widget_add(win->evas); + elm_widget_type_set(win->win_obj, "win"); + ELM_SET_WIDTYPE(widtype, "win"); + elm_widget_data_set(win->win_obj, win); + elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb); + elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL); + elm_widget_can_focus_set(win->win_obj, EINA_TRUE); + elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE); + elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook); + evas_object_color_set(win->win_obj, 0, 0, 0, 0); + evas_object_move(win->win_obj, 0, 0); + evas_object_resize(win->win_obj, 1, 1); + evas_object_layer_set(win->win_obj, 50); + evas_object_pass_events_set(win->win_obj, EINA_TRUE); + + if (win->frame_obj) + { + evas_object_clip_set(win->win_obj, win->frame_obj); + evas_object_stack_below(win->frame_obj, win->win_obj); + } + + if (type == ELM_WIN_INLINED_IMAGE) + elm_widget_parent2_set(win->win_obj, parent); + ecore_evas_object_associate(win->ee, win->win_obj, + ECORE_EVAS_OBJECT_ASSOCIATE_BASE | + ECORE_EVAS_OBJECT_ASSOCIATE_STACK | + ECORE_EVAS_OBJECT_ASSOCIATE_LAYER); + evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW, + _elm_win_obj_callback_show, win); + evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE, + _elm_win_obj_callback_hide, win); + evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL, + _elm_win_obj_callback_del, win); + evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE, + _elm_win_obj_callback_move, win); + evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE, + _elm_win_obj_callback_resize, win); + if (win->img_obj) + evas_object_intercept_move_callback_add(win->win_obj, + _elm_win_obj_intercept_move, win); + evas_object_intercept_show_callback_add(win->win_obj, + _elm_win_obj_intercept_show, win); + + evas_object_smart_callback_add(win->win_obj, "sub-object-del", (Evas_Smart_Cb)_subobj_del, win); + ecore_evas_name_class_set(win->ee, name, _elm_appname); + ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request); + ecore_evas_callback_resize_set(win->ee, _elm_win_resize); + ecore_evas_callback_mouse_in_set(win->ee, _elm_win_mouse_in); + ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in); + ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out); + ecore_evas_callback_move_set(win->ee, _elm_win_move); + ecore_evas_callback_state_change_set(win->ee, _elm_win_state_change); + evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024)); + evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024)); + EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath) + evas_font_path_append(win->evas, fontpath); + if (!_elm_config->font_hinting) + evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE); + else if (_elm_config->font_hinting == 1) + evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO); + else if (_elm_config->font_hinting == 2) + evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE); + +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwin_update(win); +#endif + + _elm_win_list = eina_list_append(_elm_win_list, win->win_obj); + + if (ENGINE_COMPARE(ELM_SOFTWARE_FB)) + { + ecore_evas_fullscreen_set(win->ee, 1); + } +#undef ENGINE_COMPARE + + if (_elm_config->focus_highlight_enable) + elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE); + +#ifdef ELM_DEBUG + Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control"); + evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN, + _debug_key_down, win); + + Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0, + EINA_TRUE); + printf("Ctrl+F12 key combination exclusive for dot tree generation\n"); +#endif + + evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals); + + return win->win_obj; +} + +EAPI Evas_Object * +elm_win_util_standard_add(const char *name, const char *title) +{ + Evas_Object *win, *bg; + + win = elm_win_add(NULL, name, ELM_WIN_BASIC); + if (!win) return NULL; + elm_win_title_set(win, title); + bg = elm_bg_add(win); + if (!bg) + { + evas_object_del(win); + return NULL; + } + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + return win; +} + +EAPI void +elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj) +{ + Evas_Coord w, h; + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + if (eina_list_data_find(win->subobjs, subobj)) return; + win->subobjs = eina_list_append(win->subobjs, subobj); + elm_widget_sub_object_add(obj, subobj); + evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL, + _elm_win_subobj_callback_del, obj); + evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _elm_win_subobj_callback_changed_size_hints, + obj); + evas_object_geometry_get(obj, NULL, NULL, &w, &h); + evas_object_move(subobj, 0, 0); + evas_object_resize(subobj, w, h); + _elm_win_eval_subobjs(obj); +} + +EAPI void +elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + evas_object_event_callback_del_full(subobj, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _elm_win_subobj_callback_changed_size_hints, + obj); + evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL, + _elm_win_subobj_callback_del, obj); + win->subobjs = eina_list_remove(win->subobjs, subobj); + elm_widget_sub_object_del(obj, subobj); + _elm_win_eval_subobjs(obj); +} + +EAPI void +elm_win_title_set(Evas_Object *obj, const char *title) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win || !title) return; + eina_stringshare_replace(&(win->title), title); + ecore_evas_title_set(win->ee, win->title); + if (win->frame_obj) + edje_object_part_text_escaped_set(win->frame_obj, "elm.text.title", win->title); +} + +EAPI const char * +elm_win_title_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + win = elm_widget_data_get(obj); + if (!win) return NULL; + return win->title; +} + +EAPI void +elm_win_icon_name_set(Evas_Object *obj, const char *icon_name) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win || !icon_name) return; + eina_stringshare_replace(&(win->icon_name), icon_name); +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwin_update(win); +#endif +} + +EAPI const char * +elm_win_icon_name_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + win = elm_widget_data_get(obj); + if (!win) return NULL; + return win->icon_name; +} + +EAPI void +elm_win_role_set(Evas_Object *obj, const char *role) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win || !role) return; + eina_stringshare_replace(&(win->role), role); +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwin_update(win); +#endif +} + +EAPI const char * +elm_win_role_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + win = elm_widget_data_get(obj); + if (!win) return NULL; + return win->role; +} + +EAPI void +elm_win_icon_object_set(Evas_Object *obj, Evas_Object *icon) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + if (win->icon) + evas_object_event_callback_del_full(win->icon, EVAS_CALLBACK_DEL, + _elm_win_obj_icon_callback_del, win); + win->icon = icon; + if (win->icon) + evas_object_event_callback_add(win->icon, EVAS_CALLBACK_DEL, + _elm_win_obj_icon_callback_del, win); +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwin_update(win); +#endif +} + +EAPI const Evas_Object * +elm_win_icon_object_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + win = elm_widget_data_get(obj); + if (!win) return NULL; + return win->icon; +} + +EAPI void +elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + win->autodel = autodel; +} + +EAPI Eina_Bool +elm_win_autodel_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + win = elm_widget_data_get(obj); + if (!win) return EINA_FALSE; + return win->autodel; +} + +EAPI void +elm_win_activate(Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + ecore_evas_activate(win->ee); +} + +EAPI void +elm_win_lower(Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + ecore_evas_lower(win->ee); +} + +EAPI void +elm_win_raise(Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + ecore_evas_raise(win->ee); +} + +EAPI void +elm_win_center(Evas_Object *obj, Eina_Bool h, Eina_Bool v) +{ + Elm_Win *win; + int win_w, win_h, screen_w, screen_h, nx, ny; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &screen_w, &screen_h); + if ((!screen_w) || (!screen_h)) return; + evas_object_geometry_get(obj, NULL, NULL, &win_w, &win_h); + if ((!win_w) || (!win_h)) return; + if (h) nx = win_w >= screen_w ? 0 : (screen_w / 2) - (win_w / 2); + else nx = win->screen.x; + if (v) ny = win_h >= screen_h ? 0 : (screen_h / 2) - (win_h / 2); + else ny = win->screen.y; + if (nx < 0) nx = 0; + if (ny < 0) ny = 0; + evas_object_move(obj, nx, ny); +} + +EAPI void +elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + ecore_evas_borderless_set(win->ee, borderless); +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwin_update(win); +#endif +} + +EAPI Eina_Bool +elm_win_borderless_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + win = elm_widget_data_get(obj); + if (!win) return EINA_FALSE; + return ecore_evas_borderless_get(win->ee); +} + +EAPI void +elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + ecore_evas_shaped_set(win->ee, shaped); +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwin_update(win); +#endif +} + +EAPI Eina_Bool +elm_win_shaped_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + win = elm_widget_data_get(obj); + if (!win) return EINA_FALSE; + return ecore_evas_shaped_get(win->ee); +} + +EAPI void +elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + if (win->frame_obj) + { + } + else if (win->img_obj) + { + evas_object_image_alpha_set(win->img_obj, alpha); + ecore_evas_alpha_set(win->ee, alpha); + } + else + { +#ifdef HAVE_ELEMENTARY_X + if (win->xwin) + { + if (alpha) + { + if (!_elm_config->compositing) + elm_win_shaped_set(obj, alpha); + else + ecore_evas_alpha_set(win->ee, alpha); + } + else + ecore_evas_alpha_set(win->ee, alpha); + _elm_win_xwin_update(win); + } + else +#endif + ecore_evas_alpha_set(win->ee, alpha); + } +} + +EAPI Eina_Bool +elm_win_alpha_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + win = elm_widget_data_get(obj); + if (!win) return EINA_FALSE; + if (win->frame_obj) + { + } + else if (win->img_obj) + { + return evas_object_image_alpha_get(win->img_obj); + } + return ecore_evas_alpha_get(win->ee); +} + +EAPI void +elm_win_override_set(Evas_Object *obj, Eina_Bool override) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + ecore_evas_override_set(win->ee, override); +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwin_update(win); +#endif +} + +EAPI Eina_Bool +elm_win_override_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + win = elm_widget_data_get(obj); + if (!win) return EINA_FALSE; + return ecore_evas_override_get(win->ee); +} + +EAPI void +elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + // YYY: handle if win->img_obj +#define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name)) + if (ENGINE_COMPARE(ELM_SOFTWARE_FB) || + ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE)) + { + // these engines... can ONLY be fullscreen + return; + } + else + { + win->fullscreen = fullscreen; + ecore_evas_fullscreen_set(win->ee, fullscreen); +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwin_update(win); +#endif + } +#undef ENGINE_COMPARE +} + +EAPI Eina_Bool +elm_win_fullscreen_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + win = elm_widget_data_get(obj); + if (!win) return EINA_FALSE; +#define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name)) + if (ENGINE_COMPARE(ELM_SOFTWARE_FB) || + ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE)) + { + // these engines... can ONLY be fullscreen + return EINA_TRUE; + } + else + { + return win->fullscreen; + } +#undef ENGINE_COMPARE +} + +EAPI void +elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + win->maximized = maximized; + // YYY: handle if win->img_obj + ecore_evas_maximized_set(win->ee, maximized); +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwin_update(win); +#endif +} + +EAPI Eina_Bool +elm_win_maximized_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + win = elm_widget_data_get(obj); + if (!win) return EINA_FALSE; + return win->maximized; +} + +EAPI void +elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + win->iconified = iconified; + ecore_evas_iconified_set(win->ee, iconified); +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwin_update(win); +#endif +} + +EAPI Eina_Bool +elm_win_iconified_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + win = elm_widget_data_get(obj); + if (!win) return EINA_FALSE; + return win->iconified; +} + +EAPI void +elm_win_withdrawn_set(Evas_Object *obj, Eina_Bool withdrawn) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + win->withdrawn = withdrawn; + ecore_evas_withdrawn_set(win->ee, withdrawn); +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwin_update(win); +#endif +} + +EAPI Eina_Bool +elm_win_withdrawn_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + win = elm_widget_data_get(obj); + if (!win) return EINA_FALSE; + return win->withdrawn; +} + +EAPI void +elm_win_urgent_set(Evas_Object *obj, Eina_Bool urgent) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + win->urgent = urgent; + ecore_evas_urgent_set(win->ee, urgent); +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwin_update(win); +#endif +} + +EAPI Eina_Bool +elm_win_urgent_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + win = elm_widget_data_get(obj); + if (!win) return EINA_FALSE; + return win->urgent; +} + +EAPI void +elm_win_demand_attention_set(Evas_Object *obj, Eina_Bool demand_attention) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + win->demand_attention = demand_attention; + ecore_evas_demand_attention_set(win->ee, demand_attention); +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwin_update(win); +#endif +} + +EAPI Eina_Bool +elm_win_demand_attention_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + win = elm_widget_data_get(obj); + if (!win) return EINA_FALSE; + return win->demand_attention; +} + +EAPI void +elm_win_modal_set(Evas_Object *obj, Eina_Bool modal) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + win->modal = modal; + ecore_evas_modal_set(win->ee, modal); +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwin_update(win); +#endif +} + +EAPI Eina_Bool +elm_win_modal_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + win = elm_widget_data_get(obj); + if (!win) return EINA_FALSE; + return win->modal; +} + +EAPI void +elm_win_aspect_set(Evas_Object *obj, double aspect) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + win->aspect = aspect; + ecore_evas_aspect_set(win->ee, aspect); +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwin_update(win); +#endif +} + +EAPI double +elm_win_aspect_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + win = elm_widget_data_get(obj); + if (!win) return EINA_FALSE; + return win->aspect; +} + +EAPI void +elm_win_layer_set(Evas_Object *obj, int layer) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + ecore_evas_layer_set(win->ee, layer); +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwin_update(win); +#endif +} + +EAPI int +elm_win_layer_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) -1; + win = elm_widget_data_get(obj); + if (!win) return -1; + return ecore_evas_layer_get(win->ee); +} + +EAPI void +elm_win_rotation_set(Evas_Object *obj, int rotation) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + if (win->rot == rotation) return; + win->rot = rotation; + ecore_evas_rotation_set(win->ee, rotation); + evas_object_size_hint_min_set(obj, -1, -1); + evas_object_size_hint_max_set(obj, -1, -1); + _elm_win_eval_subobjs(obj); +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwin_update(win); +#endif +} + +EAPI void +elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + if (win->rot == rotation) return; + win->rot = rotation; + ecore_evas_rotation_with_resize_set(win->ee, rotation); + evas_object_size_hint_min_set(obj, -1, -1); + evas_object_size_hint_max_set(obj, -1, -1); + _elm_win_eval_subobjs(obj); +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwin_update(win); +#endif +} + +EAPI int +elm_win_rotation_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) -1; + win = elm_widget_data_get(obj); + if (!win) return -1; + return win->rot; +} + +EAPI void +elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + win->sticky = sticky; + ecore_evas_sticky_set(win->ee, sticky); +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwin_update(win); +#endif +} + +EAPI Eina_Bool +elm_win_sticky_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + win = elm_widget_data_get(obj); + if (!win) return EINA_FALSE; + return win->sticky; +} + +EAPI void +elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + if (mode == win->kbdmode) return; +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwindow_get(win); +#endif + win->kbdmode = mode; +#ifdef HAVE_ELEMENTARY_X + if (win->xwin) + ecore_x_e_virtual_keyboard_state_set + (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode); +#endif +} + +EAPI Elm_Win_Keyboard_Mode +elm_win_keyboard_mode_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN; + win = elm_widget_data_get(obj); + if (!win) return ELM_WIN_KEYBOARD_UNKNOWN; + return win->kbdmode; +} + +EAPI void +elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwindow_get(win); + if (win->xwin) + ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard); +#else + (void) is_keyboard; +#endif +} + +EAPI Eina_Bool +elm_win_keyboard_win_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + win = elm_widget_data_get(obj); + if (!win) return EINA_FALSE; +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwindow_get(win); + if (win->xwin) + return ecore_x_e_virtual_keyboard_get(win->xwin); +#endif + return EINA_FALSE; +} + +EAPI void +elm_win_indicator_mode_set(Evas_Object *obj, Elm_Win_Indicator_Mode mode) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + if (mode == win->indmode) return; +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwindow_get(win); +#endif + win->indmode = mode; +#ifdef HAVE_ELEMENTARY_X + if (win->xwin) + { + if (win->indmode == ELM_WIN_INDICATOR_SHOW) + ecore_x_e_illume_indicator_state_set + (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON); + else if (win->indmode == ELM_WIN_INDICATOR_HIDE) + ecore_x_e_illume_indicator_state_set + (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF); + } +#endif +} + +EAPI Elm_Win_Indicator_Mode +elm_win_indicator_mode_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_INDICATOR_UNKNOWN; + win = elm_widget_data_get(obj); + if (!win) return ELM_WIN_INDICATOR_UNKNOWN; + return win->indmode; +} + +EAPI void +elm_win_indicator_opacity_set(Evas_Object *obj, Elm_Win_Indicator_Opacity_Mode mode) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + if (mode == win->ind_o_mode) return; + win->ind_o_mode = mode; +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwindow_get(win); + if (win->xwin) + { + if (win->ind_o_mode == ELM_WIN_INDICATOR_OPAQUE) + ecore_x_e_illume_indicator_opacity_set + (win->xwin, ECORE_X_ILLUME_INDICATOR_OPAQUE); + else if (win->ind_o_mode == ELM_WIN_INDICATOR_TRANSLUCENT) + ecore_x_e_illume_indicator_opacity_set + (win->xwin, ECORE_X_ILLUME_INDICATOR_TRANSLUCENT); + else if (win->ind_o_mode == ELM_WIN_INDICATOR_TRANSPARENT) + ecore_x_e_illume_indicator_opacity_set + (win->xwin, ECORE_X_ILLUME_INDICATOR_TRANSPARENT); + + } +#endif +} + +EAPI Elm_Win_Indicator_Opacity_Mode +elm_win_indicator_opacity_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_INDICATOR_OPACITY_UNKNOWN; + win = elm_widget_data_get(obj); + if (!win) return ELM_WIN_INDICATOR_OPACITY_UNKNOWN; + return win->ind_o_mode; +} + +EAPI void +elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + if (x) *x = win->screen.x; + if (y) *y = win->screen.y; +} + +EAPI Eina_Bool +elm_win_focus_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + win = elm_widget_data_get(obj); + if (!win) return EINA_FALSE; + return ecore_evas_focus_get(win->ee); +} + +EAPI void +elm_win_screen_constrain_set(Evas_Object *obj, Eina_Bool constrain) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + win->constrain = !!constrain; +} + +EAPI Eina_Bool +elm_win_screen_constrain_get(Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + win = elm_widget_data_get(obj); + if (!win) return EINA_FALSE; + return win->constrain; +} + +EAPI void +elm_win_screen_size_get(const Evas_Object *obj, int *x, int *y, int *w, int *h) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + ecore_evas_screen_geometry_get(win->ee, x, y, w, h); +} + +EAPI void +elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwindow_get(win); + if (win->xwin) + ecore_x_e_illume_conformant_set(win->xwin, conformant); +#else + (void) conformant; +#endif +} + +EAPI Eina_Bool +elm_win_conformant_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + win = elm_widget_data_get(obj); + if (!win) return EINA_FALSE; +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwindow_get(win); + if (win->xwin) + return ecore_x_e_illume_conformant_get(win->xwin); +#endif + return EINA_FALSE; +} + +EAPI void +elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwindow_get(win); + if (win->xwin) + { + ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel); + if (quickpanel) + { + Ecore_X_Window_State states[2]; + + states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR; + states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER; + ecore_x_netwm_window_state_set(win->xwin, states, 2); + ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0); + } + } +#else + (void) quickpanel; +#endif +} + +EAPI Eina_Bool +elm_win_quickpanel_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + win = elm_widget_data_get(obj); + if (!win) return EINA_FALSE; +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwindow_get(win); + if (win->xwin) + return ecore_x_e_illume_quickpanel_get(win->xwin); +#endif + return EINA_FALSE; +} + +EAPI void +elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwindow_get(win); + if (win->xwin) + ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority); +#else + (void) priority; +#endif +} + +EAPI int +elm_win_quickpanel_priority_major_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) -1; + win = elm_widget_data_get(obj); + if (!win) return -1; +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwindow_get(win); + if (win->xwin) + return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin); +#endif + return -1; +} + +EAPI void +elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwindow_get(win); + if (win->xwin) + ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority); +#else + (void) priority; +#endif +} + +EAPI int +elm_win_quickpanel_priority_minor_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) -1; + win = elm_widget_data_get(obj); + if (!win) return -1; +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwindow_get(win); + if (win->xwin) + return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin); +#endif + return -1; +} + +EAPI void +elm_win_quickpanel_zone_set(Evas_Object *obj, int zone) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwindow_get(win); + if (win->xwin) + ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone); +#else + (void) zone; +#endif +} + +EAPI int +elm_win_quickpanel_zone_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) 0; + win = elm_widget_data_get(obj); + if (!win) return 0; +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwindow_get(win); + if (win->xwin) + return ecore_x_e_illume_quickpanel_zone_get(win->xwin); +#endif + return 0; +} + +EAPI void +elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + win->skip_focus = skip; + ecore_evas_focus_skip_set(win->ee, skip); +} + +EAPI void +elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwindow_get(win); + if (win->xwin) + { + switch (command) + { + case ELM_ILLUME_COMMAND_FOCUS_BACK: + ecore_x_e_illume_focus_back_send(win->xwin); + break; + case ELM_ILLUME_COMMAND_FOCUS_FORWARD: + ecore_x_e_illume_focus_forward_send(win->xwin); + break; + case ELM_ILLUME_COMMAND_FOCUS_HOME: + ecore_x_e_illume_focus_home_send(win->xwin); + break; + case ELM_ILLUME_COMMAND_CLOSE: + ecore_x_e_illume_close_send(win->xwin); + break; + default: + break; + } + } +#else + (void) command; +#endif +} + +EAPI Evas_Object * +elm_win_inlined_image_object_get(Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + win = elm_widget_data_get(obj); + if (!win) return NULL; + return win->img_obj; +} + +EAPI void +elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled) +{ + Elm_Win *win; + + ELM_CHECK_WIDTYPE(obj, widtype); + + win = elm_widget_data_get(obj); + enabled = !!enabled; + if (win->focus_highlight.enabled == enabled) + return; + + win->focus_highlight.enabled = enabled; + + if (win->focus_highlight.enabled) + _elm_win_focus_highlight_init(win); + else + _elm_win_focus_highlight_shutdown(win); +} + +EAPI Eina_Bool +elm_win_focus_highlight_enabled_get(const Evas_Object *obj) +{ + Elm_Win *win; + + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + + win = elm_widget_data_get(obj); + return win->focus_highlight.enabled; +} + +EAPI void +elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style) +{ + Elm_Win *win; + + ELM_CHECK_WIDTYPE(obj, widtype); + + win = elm_widget_data_get(obj); + eina_stringshare_replace(&win->focus_highlight.style, style); + win->focus_highlight.changed_theme = EINA_TRUE; + _elm_win_focus_highlight_reconfigure_job_start(win); +} + +EAPI const char * +elm_win_focus_highlight_style_get(const Evas_Object *obj) +{ + Elm_Win *win; + + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + + win = elm_widget_data_get(obj); + return win->focus_highlight.style; +} + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *frm; + Evas_Object *content; +}; + +static void _del_hook(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _sub_del(void *data, Evas_Object *obj, void *event_info); + +static const char *widtype2 = NULL; + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + free(wd); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj)); + if (wd->content) + edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content); + _sizing_eval(obj); + + evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL); +} + +static Eina_Bool +_elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) + return EINA_FALSE; + + /* Try Focus cycle in subitem */ + if (wd->content) + { + elm_widget_focus_next_get(wd->content, dir, next); + if (*next) + return EINA_TRUE; + } + + *next = (Evas_Object *)obj; + return EINA_FALSE; +} + +static void +_elm_inwin_text_set_hook(Evas_Object *obj, const char *item, const char *text) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd || !item) return; + edje_object_part_text_escaped_set(wd->frm, item, text); + _sizing_eval(obj); +} + +static const char * +_elm_inwin_text_get_hook(const Evas_Object *obj, const char *item) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (!item || !wd || !wd->frm) return NULL; + return edje_object_part_text_get(wd->frm, item); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1; + + evas_object_size_hint_min_get(wd->content, &minw, &minh); + edje_object_size_min_calc(wd->frm, &minw, &minh); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, -1, -1); +} + +static void +_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _sizing_eval(data); +} + +static void +_sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *sub = event_info; + if (sub == wd->content) + { + evas_object_event_callback_del_full + (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj); + wd->content = NULL; + _sizing_eval(obj); + } +} + +EAPI Evas_Object * +elm_win_inwin_add(Evas_Object *obj) +{ + Evas_Object *obj2; + Widget_Data *wd; + Elm_Win *win; + + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + win = elm_widget_data_get(obj); + if (!win) return NULL; + wd = ELM_NEW(Widget_Data); + obj2 = elm_widget_add(win->evas); + elm_widget_type_set(obj2, "inwin"); + ELM_SET_WIDTYPE(widtype2, "inwin"); + elm_widget_sub_object_add(obj, obj2); + evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(obj, obj2); + + elm_widget_data_set(obj2, wd); + elm_widget_del_hook_set(obj2, _del_hook); + elm_widget_theme_hook_set(obj2, _theme_hook); + elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook); + elm_widget_text_set_hook_set(obj2, _elm_inwin_text_set_hook); + elm_widget_text_get_hook_set(obj2, _elm_inwin_text_get_hook); + elm_widget_can_focus_set(obj2, EINA_TRUE); + elm_widget_highlight_ignore_set(obj2, EINA_TRUE); + + wd->frm = edje_object_add(win->evas); + _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default"); + elm_widget_resize_object_set(obj2, wd->frm); + + evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2); + + _sizing_eval(obj2); + return obj2; +} + +EAPI void +elm_win_inwin_activate(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype2); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_raise(obj); + evas_object_show(obj); + edje_object_signal_emit(wd->frm, "elm,action,show", "elm"); + elm_object_focus_set(obj, EINA_TRUE); +} + +EAPI void +elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype2); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->content == content) return; + if (wd->content) evas_object_del(wd->content); + wd->content = content; + if (content) + { + elm_widget_sub_object_add(obj, content); + evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + edje_object_part_swallow(wd->frm, "elm.swallow.content", content); + } + _sizing_eval(obj); +} + +EAPI Evas_Object * +elm_win_inwin_content_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype2) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->content; +} + +EAPI Evas_Object * +elm_win_inwin_content_unset(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype2) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (!wd->content) return NULL; + Evas_Object *content = wd->content; + elm_widget_sub_object_del(obj, wd->content); + evas_object_event_callback_del_full(wd->content, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + edje_object_part_unswallow(wd->frm, wd->content); + wd->content = NULL; + return content; +} + +EAPI Eina_Bool +elm_win_socket_listen(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys) +{ + + Elm_Win *win; + + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + win = elm_widget_data_get(obj); + if (!win) return EINA_FALSE; + if (!win->ee) return EINA_FALSE; + + if (!ecore_evas_extn_socket_listen(win->ee, svcname, svcnum, svcsys)) + return EINA_FALSE; + + return EINA_TRUE; +} + +/* windowing specific calls - shall we do this differently? */ + +static Ecore_X_Window +_elm_ee_win_get(const Evas_Object *obj) +{ + if (!obj) return 0; +#ifdef HAVE_ELEMENTARY_X + Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); + if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee); +#endif + return 0; +} + +EAPI Ecore_X_Window +elm_win_xwindow_get(const Evas_Object *obj) +{ + Elm_Win *win; + const char *type; + + if (!obj) return 0; + type = elm_widget_type_get(obj); + if ((!type) || (type != widtype)) return _elm_ee_win_get(obj); + win = elm_widget_data_get(obj); + if (!win) return 0; +#ifdef HAVE_ELEMENTARY_X + if (win->xwin) return win->xwin; + if (win->parent) return elm_win_xwindow_get(win->parent); +#endif + return 0; +} diff --git a/libraries/elementary/src/lib/elm_win.h b/libraries/elementary/src/lib/elm_win.h new file mode 100644 index 0000000..0cf2810 --- /dev/null +++ b/libraries/elementary/src/lib/elm_win.h @@ -0,0 +1,1371 @@ +/** + * @defgroup Win Win + * @ingroup Elementary + * + * @image html img/widget/win/preview-00.png + * @image latex img/widget/win/preview-00.eps + * + * The window class of Elementary. Contains functions to manipulate + * windows. The Evas engine used to render the window contents is specified + * in the system or user elementary config files (whichever is found last), + * and can be overridden with the ELM_ENGINE environment variable for + * testing. Engines that may be supported (depending on Evas and Ecore-Evas + * compilation setup and modules actually installed at runtime) are (listed + * in order of best supported and most likely to be complete and work to + * lowest quality). + * + * @li "x11", "x", "software-x11", "software_x11" (Software rendering in X11) + * @li "gl", "opengl", "opengl-x11", "opengl_x11" (OpenGL or OpenGL-ES2 + * rendering in X11) + * @li "shot:..." (Virtual screenshot renderer - renders to output file and + * exits) + * @li "fb", "software-fb", "software_fb" (Linux framebuffer direct software + * rendering) + * @li "sdl", "software-sdl", "software_sdl" (SDL software rendering to SDL + * buffer) + * @li "gl-sdl", "gl_sdl", "opengl-sdl", "opengl_sdl" (OpenGL or OpenGL-ES2 + * rendering using SDL as the buffer) + * @li "gdi", "software-gdi", "software_gdi" (Windows WIN32 rendering via + * GDI with software) + * @li "dfb", "directfb" (Rendering to a DirectFB window) + * @li "x11-8", "x8", "software-8-x11", "software_8_x11" (Rendering in + * grayscale using dedicated 8bit software engine in X11) + * @li "x11-16", "x16", "software-16-x11", "software_16_x11" (Rendering in + * X11 using 16bit software engine) + * @li "wince-gdi", "software-16-wince-gdi", "software_16_wince_gdi" + * (Windows CE rendering via GDI with 16bit software renderer) + * @li "sdl-16", "software-16-sdl", "software_16_sdl" (Rendering to SDL + * buffer with 16bit software renderer) + * @li "ews" (rendering to EWS - Ecore + Evas Single Process Windowing System) + * @li "gl-cocoa", "gl_cocoa", "opengl-cocoa", "opengl_cocoa" (OpenGL rendering in Cocoa) + * @li "psl1ght" (PS3 rendering using PSL1GHT) + * + * All engines use a simple string to select the engine to render, EXCEPT + * the "shot" engine. This actually encodes the output of the virtual + * screenshot and how long to delay in the engine string. The engine string + * is encoded in the following way: + * + * "shot:[delay=XX][:][repeat=DDD][:][file=XX]" + * + * Where options are separated by a ":" char if more than one option is + * given, with delay, if provided being the first option and file the last + * (order is important). The delay specifies how long to wait after the + * window is shown before doing the virtual "in memory" rendering and then + * save the output to the file specified by the file option (and then exit). + * If no delay is given, the default is 0.5 seconds. If no file is given the + * default output file is "out.png". Repeat option is for continuous + * capturing screenshots. Repeat range is from 1 to 999 and filename is + * fixed to "out001.png" Some examples of using the shot engine: + * + * ELM_ENGINE="shot:delay=1.0:repeat=5:file=elm_test.png" elementary_test + * ELM_ENGINE="shot:delay=1.0:file=elm_test.png" elementary_test + * ELM_ENGINE="shot:file=elm_test2.png" elementary_test + * ELM_ENGINE="shot:delay=2.0" elementary_test + * ELM_ENGINE="shot:" elementary_test + * + * Signals that you can add callbacks for are: + * + * @li "delete,request": the user requested to close the window. See + * elm_win_autodel_set(). + * @li "focus,in": window got focus + * @li "focus,out": window lost focus + * @li "moved": window that holds the canvas was moved + * @li "withdrawn": window is still managed normally but removed from view + * @li "iconified": window is minimized (perhaps into an icon or taskbar) + * @li "normal": window is in a normal state (not withdrawn or iconified) + * @li "stick": window has become sticky (shows on all desktops) + * @li "unstick": window has stopped being sticky + * @li "fullscreen": window has become fullscreen + * @li "unfullscreen": window has stopped being fullscreen + * @li "maximized": window has been maximized + * @li "unmaximized": window has stopped being maximized + * + * Examples: + * @li @ref win_example_01 + * + * @{ + */ +/** + * Defines the types of window that can be created + * + * These are hints set on the window so that a running Window Manager knows + * how the window should be handled and/or what kind of decorations it + * should have. + * + * Currently, only the X11 backed engines use them. + */ +typedef enum +{ + ELM_WIN_BASIC, /**< A normal window. Indicates a normal, top-level + window. Almost every window will be created with this + type. */ + ELM_WIN_DIALOG_BASIC, /**< Used for simple dialog windows/ */ + ELM_WIN_DESKTOP, /**< For special desktop windows, like a background + window holding desktop icons. */ + ELM_WIN_DOCK, /**< The window is used as a dock or panel. Usually would + be kept on top of any other window by the Window + Manager. */ + ELM_WIN_TOOLBAR, /**< The window is used to hold a floating toolbar, or + similar. */ + ELM_WIN_MENU, /**< Similar to #ELM_WIN_TOOLBAR. */ + ELM_WIN_UTILITY, /**< A persistent utility window, like a toolbox or + palette. */ + ELM_WIN_SPLASH, /**< Splash window for a starting up application. */ + ELM_WIN_DROPDOWN_MENU, /**< The window is a dropdown menu, as when an + entry in a menubar is clicked. Typically used + with elm_win_override_set(). This hint exists + for completion only, as the EFL way of + implementing a menu would not normally use a + separate window for its contents. */ + ELM_WIN_POPUP_MENU, /**< Like #ELM_WIN_DROPDOWN_MENU, but for the menu + triggered by right-clicking an object. */ + ELM_WIN_TOOLTIP, /**< The window is a tooltip. A short piece of + explanatory text that typically appear after the + mouse cursor hovers over an object for a while. + Typically used with elm_win_override_set() and also + not very commonly used in the EFL. */ + ELM_WIN_NOTIFICATION, /**< A notification window, like a warning about + battery life or a new E-Mail received. */ + ELM_WIN_COMBO, /**< A window holding the contents of a combo box. Not + usually used in the EFL. */ + ELM_WIN_DND, /**< Used to indicate the window is a representation of an + object being dragged across different windows, or even + applications. Typically used with + elm_win_override_set(). */ + ELM_WIN_INLINED_IMAGE, /**< The window is rendered onto an image + buffer. No actual window is created for this + type, instead the window and all of its + contents will be rendered to an image buffer. + This allows to have children window inside a + parent one just like any other object would + be, and do other things like applying @c + Evas_Map effects to it. This is the only type + of window that requires the @c parent + parameter of elm_win_add() to be a valid @c + Evas_Object. */ + ELM_WIN_SOCKET_IMAGE,/**< The window is rendered onto an image buffer + and can be shown other process's plug image object. + No actual window is created for this type, + instead the window and all of its contents will be + rendered to an image buffer and can be shown + other process's plug image object*/ +} Elm_Win_Type; + +/** + * The different layouts that can be requested for the virtual keyboard. + * + * When the application window is being managed by Illume, it may request + * any of the following layouts for the virtual keyboard. + */ +typedef enum +{ + ELM_WIN_KEYBOARD_UNKNOWN, /**< Unknown keyboard state */ + ELM_WIN_KEYBOARD_OFF, /**< Request to deactivate the keyboard */ + ELM_WIN_KEYBOARD_ON, /**< Enable keyboard with default layout */ + ELM_WIN_KEYBOARD_ALPHA, /**< Alpha (a-z) keyboard layout */ + ELM_WIN_KEYBOARD_NUMERIC, /**< Numeric keyboard layout */ + ELM_WIN_KEYBOARD_PIN, /**< PIN keyboard layout */ + ELM_WIN_KEYBOARD_PHONE_NUMBER, /**< Phone keyboard layout */ + ELM_WIN_KEYBOARD_HEX, /**< Hexadecimal numeric keyboard layout */ + ELM_WIN_KEYBOARD_TERMINAL, /**< Full (QWERTY) keyboard layout */ + ELM_WIN_KEYBOARD_PASSWORD, /**< Password keyboard layout */ + ELM_WIN_KEYBOARD_IP, /**< IP keyboard layout */ + ELM_WIN_KEYBOARD_HOST, /**< Host keyboard layout */ + ELM_WIN_KEYBOARD_FILE, /**< File keyboard layout */ + ELM_WIN_KEYBOARD_URL, /**< URL keyboard layout */ + ELM_WIN_KEYBOARD_KEYPAD, /**< Keypad layout */ + ELM_WIN_KEYBOARD_J2ME /**< J2ME keyboard layout */ +} Elm_Win_Keyboard_Mode; + +/** + * In some environments, like phones, you may have an indicator that + * shows battery status, reception, time etc. This is the indicator. + * + * Sometimes you don't want it because you provide the same functionality + * inside your app, so this will request that the indicator is hidden in + * this circumstance if you use ELM_ILLUME_INDICATOR_HIDE. The default + * is to have the indicator shown. + */ +typedef enum +{ + ELM_WIN_INDICATOR_UNKNOWN, /**< Unknown indicator state */ + ELM_WIN_INDICATOR_HIDE, /**< Hides the indicator */ + ELM_WIN_INDICATOR_SHOW /**< Shows the indicator */ +} Elm_Win_Indicator_Mode; + +/** + * Defines the opacity modes of indicator that can be shown + */ + +typedef enum +{ + ELM_WIN_INDICATOR_OPACITY_UNKNOWN, /**< Unknown indicator opacity mode */ + ELM_WIN_INDICATOR_OPAQUE, /**< Opacifies the indicator */ + ELM_WIN_INDICATOR_TRANSLUCENT, /**< Be translucent the indicator */ + ELM_WIN_INDICATOR_TRANSPARENT /**< Transparentizes the indicator */ +} Elm_Win_Indicator_Opacity_Mode; + +/** + * Available commands that can be sent to the Illume manager. + * + * When running under an Illume session, a window may send commands to the + * Illume manager to perform different actions. + */ +typedef enum +{ + ELM_ILLUME_COMMAND_FOCUS_BACK, /**< Reverts focus to the previous window */ + ELM_ILLUME_COMMAND_FOCUS_FORWARD, /**< Sends focus to the next window in the list */ + ELM_ILLUME_COMMAND_FOCUS_HOME, /**< Hides all windows to show the Home screen */ + ELM_ILLUME_COMMAND_CLOSE, /**< Closes the currently active window */ +} Elm_Illume_Command; + +/** + * Adds a window object. If this is the first window created, pass NULL as + * @p parent. + * + * @param parent Parent object to add the window to, or NULL + * @param name The name of the window + * @param type The window type, one of #Elm_Win_Type. + * + * The @p parent parameter can be @c NULL for every window @p type except + * #ELM_WIN_INLINED_IMAGE, which needs a parent to retrieve the canvas on + * which the image object will be created. + * + * @return The created object, or NULL on failure + * + * @ingroup Win + */ +EAPI Evas_Object *elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type); + +/** + * Adds a window object with standard setup + * + * @param name The name of the window + * @param title The title for the window + * + * This creates a window like elm_win_add() but also puts in a standard + * background with elm_bg_add(), as well as setting the window title to + * @p title. The window type created is of type ELM_WIN_BASIC, with NULL + * as the parent widget. + * + * @return The created object, or NULL on failure + * + * @see elm_win_add() + * + * @ingroup Win + */ +EAPI Evas_Object *elm_win_util_standard_add(const char *name, const char *title); + +/** + * Add @p subobj as a resize object of window @p obj. + * + * + * Setting an object as a resize object of the window means that the + * @p subobj child's size and position will be controlled by the window + * directly. That is, the object will be resized to match the window size + * and should never be moved or resized manually by the developer. + * + * In addition, resize objects of the window control what the minimum size + * of it will be, as well as whether it can or not be resized by the user. + * + * For the end user to be able to resize a window by dragging the handles + * or borders provided by the Window Manager, or using any other similar + * mechanism, all of the resize objects in the window should have their + * evas_object_size_hint_weight_set() set to EVAS_HINT_EXPAND. + * + * Also notice that the window can get resized to the current size of the + * object if the EVAS_HINT_EXPAND is set @b after the call to + * elm_win_resize_object_add(). So if the object should get resized to the + * size of the window, set this hint @b before adding it as a resize object + * (this happens because the size of the window and the object are evaluated + * as soon as the object is added to the window). + * + * @param obj The window object + * @param subobj The resize object to add + * + * @ingroup Win + */ +EAPI void elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj); + +/** + * Delete @p subobj as a resize object of window @p obj. + * + * This function removes the object @p subobj from the resize objects of + * the window @p obj. It will not delete the object itself, which will be + * left unmanaged and should be deleted by the developer, manually handled + * or set as child of some other container. + * + * @param obj The window object + * @param subobj The resize object to add + * + * @ingroup Win + */ +EAPI void elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj); + +/** + * Set the title of the window + * + * @param obj The window object + * @param title The title to set + * + * @ingroup Win + */ +EAPI void elm_win_title_set(Evas_Object *obj, const char *title); + +/** + * Get the title of the window + * + * The returned string is an internal one and should not be freed or + * modified. It will also be rendered invalid if a new title is set or if + * the window is destroyed. + * + * @param obj The window object + * @return The title + * + * @ingroup Win + */ +EAPI const char *elm_win_title_get(const Evas_Object *obj); + +/** + * Set the icon name of the window + * + * @param obj The window object + * @param icon_name The icon name to set + * + * @ingroup Win + */ +EAPI void elm_win_icon_name_set(Evas_Object *obj, const char *icon_name); + +/** + * Get the icon name of the window + * + * The returned string is an internal one and should not be freed or + * modified. It will also be rendered invalid if a new icon name is set or if + * the window is destroyed. + * + * @param obj The window object + * @return The icon name + * + * @ingroup Win + */ +EAPI const char *elm_win_icon_name_get(const Evas_Object *obj); + +/** + * Set the role of the window + * + * @param obj The window object + * @param role The role to set + * + * @ingroup Win + */ +EAPI void elm_win_role_set(Evas_Object *obj, const char *role); + +/** + * Get the role of the window + * + * The returned string is an internal one and should not be freed or + * modified. It will also be rendered invalid if a new role is set or if + * the window is destroyed. + * + * @param obj The window object + * @return The role + * + * @ingroup Win + */ +EAPI const char *elm_win_role_get(const Evas_Object *obj); + +/** + * Set the object to represent the window icon + * + * This sets an object that will be used as the icon for the window. The exact + * pixel dimensions of the object (not object size) will be used, and the + * image pixels will be used as-is when this function is called. If the + * image object has been updated, then call this function again to source + * the image pixels and put them on the window's icon. This has limitations + * as only image objects allowed at this stage. This may be lifted in future. + * + * @param obj The window object + * @param icon The object to use for an icon + * + * @ingroup Win + */ +EAPI void elm_win_icon_object_set(Evas_Object *obj, Evas_Object *icon); + +/** + * Get the icon object used for the window + * + * The object returns is the one marked by elm_win_icon_object_set() as the + * object to use for the window icon. + * + * @param obj The window object + * @return The icon object set + * + * @ingroup Win + */ +EAPI const Evas_Object *elm_win_icon_object_get(const Evas_Object *obj); + +/** + * Set the window's autodel state. + * + * When closing the window in any way outside of the program control, like + * pressing the X button in the titlebar or using a command from the + * Window Manager, a "delete,request" signal is emitted to indicate that + * this event occurred and the developer can take any action, which may + * include, or not, destroying the window object. + * + * When the @p autodel parameter is set, the window will be automatically + * destroyed when this event occurs, after the signal is emitted. + * If @p autodel is @c EINA_FALSE, then the window will not be destroyed + * and is up to the program to do so when it's required. + * + * @param obj The window object + * @param autodel If true, the window will automatically delete itself when + * closed + * + * @ingroup Win + */ +EAPI void elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel); + +/** + * Get the window's autodel state. + * + * @param obj The window object + * @return If the window will automatically delete itself when closed + * + * @see elm_win_autodel_set() + * + * @ingroup Win + */ +EAPI Eina_Bool elm_win_autodel_get(const Evas_Object *obj); + +/** + * Activate a window object. + * + * This function sends a request to the Window Manager to activate the + * window pointed by @p obj. If honored by the WM, the window will receive + * the keyboard focus. + * + * @note This is just a request that a Window Manager may ignore, so calling + * this function does not ensure in any way that the window will be the + * active one after it. + * + * @param obj The window object + * + * @ingroup Win + */ +EAPI void elm_win_activate(Evas_Object *obj); + +/** + * Lower a window object. + * + * Places the window pointed by @p obj at the bottom of the stack, so that + * no other window is covered by it. + * + * If elm_win_override_set() is not set, the Window Manager may ignore this + * request. + * + * @param obj The window object + * + * @ingroup Win + */ +EAPI void elm_win_lower(Evas_Object *obj); + +/** + * Raise a window object. + * + * Places the window pointed by @p obj at the top of the stack, so that it's + * not covered by any other window. + * + * If elm_win_override_set() is not set, the Window Manager may ignore this + * request. + * + * @param obj The window object + * + * @ingroup Win + */ +EAPI void elm_win_raise(Evas_Object *obj); + +/** + * Center a window on its screen + * + * This function centers window @p obj horizontally and/or vertically based on the values + * of @p h and @p v. + * @param obj The window object + * @param h If true, center horizontally. If false, do not change horizontal location. + * @param v If true, center vertically. If false, do not change vertical location. + * + * @ingroup Win + */ +EAPI void elm_win_center(Evas_Object *obj, Eina_Bool h, Eina_Bool v); + +/** + * Set the borderless state of a window. + * + * This function requests the Window Manager to not draw any decoration + * around the window. + * + * @param obj The window object + * @param borderless If true, the window is borderless + * + * @ingroup Win + */ +EAPI void elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless); + +/** + * Get the borderless state of a window. + * + * @param obj The window object + * @return If true, the window is borderless + * + * @ingroup Win + */ +EAPI Eina_Bool elm_win_borderless_get(const Evas_Object *obj); + +/** + * Set the shaped state of a window. + * + * Shaped windows, when supported, will render the parts of the window that + * has no content, transparent. + * + * If @p shaped is EINA_FALSE, then it is strongly advised to have some + * background object or cover the entire window in any other way, or the + * parts of the canvas that have no data will show framebuffer artifacts. + * + * @param obj The window object + * @param shaped If true, the window is shaped + * + * @see elm_win_alpha_set() + * + * @ingroup Win + */ +EAPI void elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped); + +/** + * Get the shaped state of a window. + * + * @param obj The window object + * @return If true, the window is shaped + * + * @see elm_win_shaped_set() + * + * @ingroup Win + */ +EAPI Eina_Bool elm_win_shaped_get(const Evas_Object *obj); + +/** + * Set the alpha channel state of a window. + * + * If @p alpha is EINA_TRUE, the alpha channel of the canvas will be enabled + * possibly making parts of the window completely or partially transparent. + * This is also subject to the underlying system supporting it, like for + * example, running under a compositing manager. If no compositing is + * available, enabling this option will instead fallback to using shaped + * windows, with elm_win_shaped_set(). + * + * @param obj The window object + * @param alpha If true, the window has an alpha channel + * + * @see elm_win_alpha_set() + * + * @ingroup Win + */ +EAPI void elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha); + +/** + * Get the alpha channel state of a window. + * + * @param obj The window object + * @return If true, the window has an alpha channel + * + * @ingroup Win + */ +EAPI Eina_Bool elm_win_alpha_get(const Evas_Object *obj); + +/** + * Set the override state of a window. + * + * A window with @p override set to EINA_TRUE will not be managed by the + * Window Manager. This means that no decorations of any kind will be shown + * for it, moving and resizing must be handled by the application, as well + * as the window visibility. + * + * This should not be used for normal windows, and even for not so normal + * ones, it should only be used when there's a good reason and with a lot + * of care. Mishandling override windows may result situations that + * disrupt the normal workflow of the end user. + * + * @param obj The window object + * @param override If true, the window is overridden + * + * @ingroup Win + */ +EAPI void elm_win_override_set(Evas_Object *obj, Eina_Bool override); + +/** + * Get the override state of a window. + * + * @param obj The window object + * @return If true, the window is overridden + * + * @see elm_win_override_set() + * + * @ingroup Win + */ +EAPI Eina_Bool elm_win_override_get(const Evas_Object *obj); + +/** + * Set the fullscreen state of a window. + * + * @param obj The window object + * @param fullscreen If true, the window is fullscreen + * + * @ingroup Win + */ +EAPI void elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen); + +/** + * Get the fullscreen state of a window. + * + * @param obj The window object + * @return If true, the window is fullscreen + * + * @ingroup Win + */ +EAPI Eina_Bool elm_win_fullscreen_get(const Evas_Object *obj); + +/** + * Set the maximized state of a window. + * + * @param obj The window object + * @param maximized If true, the window is maximized + * + * @ingroup Win + */ +EAPI void elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized); + +/** + * Get the maximized state of a window. + * + * @param obj The window object + * @return If true, the window is maximized + * + * @ingroup Win + */ +EAPI Eina_Bool elm_win_maximized_get(const Evas_Object *obj); + +/** + * Set the iconified state of a window. + * + * @param obj The window object + * @param iconified If true, the window is iconified + * + * @ingroup Win + */ +EAPI void elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified); + +/** + * Get the iconified state of a window. + * + * @param obj The window object + * @return If true, the window is iconified + * + * @ingroup Win + */ +EAPI Eina_Bool elm_win_iconified_get(const Evas_Object *obj); + +/** + * Set the withdrawn state of a window. + * + * @param obj The window object + * @param withdrawn If true, the window is withdrawn + * + * @ingroup Win + */ +EAPI void elm_win_withdrawn_set(Evas_Object *obj, Eina_Bool withdrawn); + +/** + * Get the withdrawn state of a window. + * + * @param obj The window object + * @return If true, the window is withdrawn + * + * @ingroup Win + */ +EAPI Eina_Bool elm_win_withdrawn_get(const Evas_Object *obj); + +/** + * Set the urgent state of a window. + * + * @param obj The window object + * @param urgent If true, the window is urgent + * + * @ingroup Win + */ +EAPI void elm_win_urgent_set(Evas_Object *obj, Eina_Bool urgent); + +/** + * Get the urgent state of a window. + * + * @param obj The window object + * @return If true, the window is urgent + * + * @ingroup Win + */ +EAPI Eina_Bool elm_win_urgent_get(const Evas_Object *obj); + +/** + * Set the demand_attention state of a window. + * + * @param obj The window object + * @param demand_attention If true, the window is demand_attention + * + * @ingroup Win + */ +EAPI void elm_win_demand_attention_set(Evas_Object *obj, Eina_Bool demand_attention); + +/** + * Get the demand_attention state of a window. + * + * @param obj The window object + * @return If true, the window is demand_attention + * + * @ingroup Win + */ +EAPI Eina_Bool elm_win_demand_attention_get(const Evas_Object *obj); + +/** + * Set the modal state of a window. + * + * @param obj The window object + * @param modal If true, the window is modal + * + * @ingroup Win + */ +EAPI void elm_win_modal_set(Evas_Object *obj, Eina_Bool modal); + +/** + * Get the modal state of a window. + * + * @param obj The window object + * @return If true, the window is modal + * + * @ingroup Win + */ +EAPI Eina_Bool elm_win_modal_get(const Evas_Object *obj); + +/** + * Set the aspect ratio of a window. + * + * @param obj The window object + * @param aspect If 0, the window has no aspect limits, otherwise it is + * width divided by height + * + * @ingroup Win + */ +EAPI void elm_win_aspect_set(Evas_Object *obj, double aspect); + +/** + * Get the aspect ratio of a window. + * + * @param obj The window object + * @return The aspect ratio set (0 by default) + * + * @ingroup Win + */ +EAPI double elm_win_aspect_get(const Evas_Object *obj); + +/** + * Set the layer of the window. + * + * What this means exactly will depend on the underlying engine used. + * + * In the case of X11 backed engines, the value in @p layer has the + * following meanings: + * @li < 3: The window will be placed below all others. + * @li > 5: The window will be placed above all others. + * @li other: The window will be placed in the default layer. + * + * @param obj The window object + * @param layer The layer of the window + * + * @ingroup Win + */ +EAPI void elm_win_layer_set(Evas_Object *obj, int layer); + +/** + * Get the layer of the window. + * + * @param obj The window object + * @return The layer of the window + * + * @see elm_win_layer_set() + * + * @ingroup Win + */ +EAPI int elm_win_layer_get(const Evas_Object *obj); + +/** + * Set the rotation of the window. + * + * Most engines only work with multiples of 90. + * + * This function is used to set the orientation of the window @p obj to + * match that of the screen. The window itself will be resized to adjust + * to the new geometry of its contents. If you want to keep the window size, + * see elm_win_rotation_with_resize_set(). + * + * @param obj The window object + * @param rotation The rotation of the window, in degrees (0-360), + * counter-clockwise. + * + * @ingroup Win + */ +EAPI void elm_win_rotation_set(Evas_Object *obj, int rotation); + +/** + * Rotates the window and resizes it. + * + * Like elm_win_rotation_set(), but it also resizes the window's contents so + * that they fit inside the current window geometry. + * + * @param obj The window object + * @param rotation The rotation of the window in degrees (0-360), + * counter-clockwise. + * + * @ingroup Win + */ +EAPI void elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation); + +/** + * Get the rotation of the window. + * + * @param obj The window object + * @return The rotation of the window in degrees (0-360) + * + * @see elm_win_rotation_set() + * @see elm_win_rotation_with_resize_set() + * + * @ingroup Win + */ +EAPI int elm_win_rotation_get(const Evas_Object *obj); + +/** + * Set the sticky state of the window. + * + * Hints the Window Manager that the window in @p obj should be left fixed + * at its position even when the virtual desktop it's on moves or changes. + * + * @param obj The window object + * @param sticky If true, the window's sticky state is enabled + * + * @ingroup Win + */ +EAPI void elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky); + +/** + * Get the sticky state of the window. + * + * @param obj The window object + * @return If true, the window's sticky state is enabled + * + * @see elm_win_sticky_set() + * + * @ingroup Win + */ +EAPI Eina_Bool elm_win_sticky_get(const Evas_Object *obj); + +/** + * Set if this window is an illume conformant window + * + * @param obj The window object + * @param conformant The conformant flag (1 = conformant, 0 = non-conformant) + * + * @ingroup Win + */ +EAPI void elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant); + +/** + * Get if this window is an illume conformant window + * + * @param obj The window object + * @return A boolean if this window is illume conformant or not + * + * @ingroup Win + */ +EAPI Eina_Bool elm_win_conformant_get(const Evas_Object *obj); + +/** + * Set a window to be an illume quickpanel window + * + * By default window objects are not quickpanel windows. + * + * @param obj The window object + * @param quickpanel The quickpanel flag (1 = quickpanel, 0 = normal window) + * + * @ingroup Win + */ +EAPI void elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel); + +/** + * Get if this window is a quickpanel or not + * + * @param obj The window object + * @return A boolean if this window is a quickpanel or not + * + * @ingroup Win + */ +EAPI Eina_Bool elm_win_quickpanel_get(const Evas_Object *obj); + +/** + * Set the major priority of a quickpanel window + * + * @param obj The window object + * @param priority The major priority for this quickpanel + * + * @ingroup Win + */ +EAPI void elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority); + +/** + * Get the major priority of a quickpanel window + * + * @param obj The window object + * @return The major priority of this quickpanel + * + * @ingroup Win + */ +EAPI int elm_win_quickpanel_priority_major_get(const Evas_Object *obj); + +/** + * Set the minor priority of a quickpanel window + * + * @param obj The window object + * @param priority The minor priority for this quickpanel + * + * @ingroup Win + */ +EAPI void elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority); + +/** + * Get the minor priority of a quickpanel window + * + * @param obj The window object + * @return The minor priority of this quickpanel + * + * @ingroup Win + */ +EAPI int elm_win_quickpanel_priority_minor_get(const Evas_Object *obj); + +/** + * Set which zone this quickpanel should appear in + * + * @param obj The window object + * @param zone The requested zone for this quickpanel + * + * @ingroup Win + */ +EAPI void elm_win_quickpanel_zone_set(Evas_Object *obj, int zone); + +/** + * Get which zone this quickpanel should appear in + * + * @param obj The window object + * @return The requested zone for this quickpanel + * + * @ingroup Win + */ +EAPI int elm_win_quickpanel_zone_get(const Evas_Object *obj); + +/** + * Set the window to be skipped by keyboard focus + * + * This sets the window to be skipped by normal keyboard input. This means + * a window manager will be asked to not focus this window as well as omit + * it from things like the taskbar, pager, "alt-tab" list etc. etc. + * + * Call this and enable it on a window BEFORE you show it for the first time, + * otherwise it may have no effect. + * + * Use this for windows that have only output information or might only be + * interacted with by the mouse or fingers, and never for typing input. + * Be careful that this may have side-effects like making the window + * non-accessible in some cases unless the window is specially handled. Use + * this with care. + * + * @param obj The window object + * @param skip The skip flag state (EINA_TRUE if it is to be skipped) + * + * @ingroup Win + */ +EAPI void elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip); + +/** + * Send a command to the windowing environment + * + * This is intended to work in touchscreen or small screen device + * environments where there is a more simplistic window management policy in + * place. This uses the window object indicated to select which part of the + * environment to control (the part that this window lives in), and provides + * a command and an optional parameter structure (use NULL for this if not + * needed). + * + * @param obj The window object that lives in the environment to control + * @param command The command to send + * @param params Optional parameters for the command + * + * @ingroup Win + */ +EAPI void elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params); + +/** + * Get the inlined image object handle + * + * When you create a window with elm_win_add() of type ELM_WIN_INLINED_IMAGE, + * then the window is in fact an evas image object inlined in the parent + * canvas. You can get this object (be careful to not manipulate it as it + * is under control of elementary), and use it to do things like get pixel + * data, save the image to a file, etc. + * + * @param obj The window object to get the inlined image from + * @return The inlined image object, or NULL if none exists + * + * @ingroup Win + */ +EAPI Evas_Object *elm_win_inlined_image_object_get(Evas_Object *obj); + +/** + * Determine whether a window has focus + * @param obj The window to query + * @return EINA_TRUE if the window exists and has focus, else EINA_FALSE + * + * @ingroup Win + */ +EAPI Eina_Bool elm_win_focus_get(const Evas_Object *obj); + +/** + * Constrain the maximum width and height of a window to the width and height of its screen + * + * When @p constrain is true, @p obj will never resize larger than the screen. + * @param obj The window object + * @param constrain EINA_TRUE to restrict the window's maximum size, EINA_FALSE to disable restriction + * + * @ingroup Win + */ +EAPI void elm_win_screen_constrain_set(Evas_Object *obj, Eina_Bool constrain); + +/** + * Retrieve the constraints on the maximum width and height of a window relative to the width and height of its screen + * + * When this function returns true, @p obj will never resize larger than the screen. + * @param obj The window object + * @return EINA_TRUE to restrict the window's maximum size, EINA_FALSE to disable restriction + * + * @ingroup Win + */ +EAPI Eina_Bool elm_win_screen_constrain_get(Evas_Object *obj); + +/** + * Get screen geometry details for the screen that a window is on + * @param obj The window to query + * @param x where to return the horizontal offset value. May be NULL. + * @param y where to return the vertical offset value. May be NULL. + * @param w where to return the width value. May be NULL. + * @param h where to return the height value. May be NULL. + * + * @ingroup Win + */ +EAPI void elm_win_screen_size_get(const Evas_Object *obj, int *x, int *y, int *w, int *h); + +/** + * Set the enabled status for the focus highlight in a window + * + * This function will enable or disable the focus highlight only for the + * given window, regardless of the global setting for it + * + * @param obj The window where to enable the highlight + * @param enabled The enabled value for the highlight + * + * @ingroup Win + */ +EAPI void elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled); + +/** + * Get the enabled value of the focus highlight for this window + * + * @param obj The window in which to check if the focus highlight is enabled + * + * @return EINA_TRUE if enabled, EINA_FALSE otherwise + * + * @ingroup Win + */ +EAPI Eina_Bool elm_win_focus_highlight_enabled_get(const Evas_Object *obj); + +/** + * Set the style for the focus highlight on this window + * + * Sets the style to use for theming the highlight of focused objects on + * the given window. If @p style is NULL, the default will be used. + * + * @param obj The window where to set the style + * @param style The style to set + * + * @ingroup Win + */ +EAPI void elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style); + +/** + * Get the style set for the focus highlight object + * + * Gets the style set for this windows highlight object, or NULL if none + * is set. + * + * @param obj The window to retrieve the highlights style from + * + * @return The style set or NULL if none was. Default is used in that case. + * + * @ingroup Win + */ +EAPI const char *elm_win_focus_highlight_style_get(const Evas_Object *obj); + +/** + * Sets the keyboard mode of the window. + * + * @param obj The window object + * @param mode The mode to set, one of #Elm_Win_Keyboard_Mode + * + * @ingroup Win + */ +EAPI void elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode); + +/** + * Gets the keyboard mode of the window. + * + * @param obj The window object + * @return The mode, one of #Elm_Win_Keyboard_Mode + * + * @ingroup Win + */ +EAPI Elm_Win_Keyboard_Mode elm_win_keyboard_mode_get(const Evas_Object *obj); + +/** + * Sets whether the window is a keyboard. + * + * @param obj The window object + * @param is_keyboard If true, the window is a virtual keyboard + * + * @ingroup Win + */ +EAPI void elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard); + +/** + * Gets whether the window is a keyboard. + * + * @param obj The window object + * @return If the window is a virtual keyboard + * + * @ingroup Win + */ +EAPI Eina_Bool elm_win_keyboard_win_get(const Evas_Object *obj); + +/** + * Sets the indicator mode of the window. + * + * @param obj The window object + * @param mode The mode to set, one of #Elm_Win_Indicator_Mode + * + * @ingroup Win + */ +EAPI void elm_win_indicator_mode_set(Evas_Object *obj, Elm_Win_Indicator_Mode mode); + +/** + * Gets the indicator mode of the window. + * + * @param obj The window object + * @return The mode, one of #Elm_Win_Indicator_Mode + * + * @ingroup Win + */ +EAPI Elm_Win_Indicator_Mode elm_win_indicator_mode_get(const Evas_Object *obj); + +/** + * Sets the indicator opacity mode of the window. + * + * @param obj The window object + * @param mode The mode to set, one of #Elm_Win_Indicator_Opacity_Mode + * + * @ingroup Win + */ +EAPI void elm_win_indicator_opacity_set(Evas_Object *obj, Elm_Win_Indicator_Opacity_Mode mode); + +/** + * Gets the indicator opacity mode of the window. + * + * @param obj The window object + * @return The mode, one of #Elm_Win_Indicator_Opacity_Mode + * + * @ingroup Win + */ +EAPI Elm_Win_Indicator_Opacity_Mode elm_win_indicator_opacity_get(const Evas_Object *obj); + +/** + * Get the screen position of a window. + * + * @param obj The window object + * @param x The int to store the x coordinate to + * @param y The int to store the y coordinate to + * + * @ingroup Win + */ +EAPI void elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y); + +/** + * Create a socket to provide the service for Plug widget + * + * @param obj The window object + * @param svcname The name of the service to be advertised. ensure that it is unique (when combined with @p svcnum) otherwise creation may fail. + * @param svcnum A number (any value, 0 being the common default) to differentiate multiple instances of services with the same name. + * @param svcsys A boolean that if true, specifies to create a system-wide service all users can connect to, otherwise the service is private to the user id that created the service. + * @return If socket creation is successful + * + * @ingroup Win + */ +EAPI Eina_Bool elm_win_socket_listen(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys); + +/* X specific calls - won't work on non-x engines (return 0) */ +/** + * Get the Ecore_X_Window of an Evas_Object + * + * @param obj The object + * + * @return The Ecore_X_Window of @p obj + * + * @ingroup Win + */ +EAPI Ecore_X_Window elm_win_xwindow_get(const Evas_Object *obj); + +/** + * @} + */ + +/** + * @defgroup Inwin Inwin + * @ingroup Win + * + * @image html img/widget/inwin/preview-00.png + * @image latex img/widget/inwin/preview-00.eps + * @image html img/widget/inwin/preview-01.png + * @image latex img/widget/inwin/preview-01.eps + * @image html img/widget/inwin/preview-02.png + * @image latex img/widget/inwin/preview-02.eps + * + * An inwin is a window inside a window that is useful for a quick popup. + * It does not hover. + * + * It works by creating an object that will occupy the entire window, so it + * must be created using an @ref Win "elm_win" as parent only. The inwin + * object can be hidden or restacked below every other object if it's + * needed to show what's behind it without destroying it. If this is done, + * the elm_win_inwin_activate() function can be used to bring it back to + * full visibility again. + * + * There are three styles available in the default theme. These are: + * @li default: The inwin is sized to take over most of the window it's + * placed in. + * @li minimal: The size of the inwin will be the minimum necessary to show + * its contents. + * @li minimal_vertical: Horizontally, the inwin takes as much space as + * possible, but it's sized vertically the most it needs to fit its\ + * contents. + * + * Some examples of Inwin can be found in the following: + * @li @ref inwin_example_01 + * + * @{ + */ + +/** + * Adds an inwin to the current window + * + * The @p obj used as parent @b MUST be an @ref Win "Elementary Window". + * Never call this function with anything other than the top-most window + * as its parameter, unless you are fond of undefined behavior. + * + * After creating the object, the widget will set itself as resize object + * for the window with elm_win_resize_object_add(), so when shown it will + * appear to cover almost the entire window (how much of it depends on its + * content and the style used). It must not be added into other container + * objects and it needs not be moved or resized manually. + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * @ingroup Inwin + */ +EAPI Evas_Object *elm_win_inwin_add(Evas_Object *parent); + +/** + * Activates an inwin object, ensuring its visibility + * + * This function will make sure that the inwin @p obj is completely visible + * by calling evas_object_show() and evas_object_raise() on it, to bring it + * to the front. It also sets the keyboard focus to it, which will be passed + * onto its content. + * + * The object's theme will also receive the signal "elm,action,show" with + * source "elm". + * + * @param obj The inwin to activate + * + * @ingroup Inwin + */ +EAPI void elm_win_inwin_activate(Evas_Object *obj); + +/** + * Set the content of an inwin object. + * + * Once the content object is set, a previously set one will be deleted. + * If you want to keep that old content object, use the + * elm_win_inwin_content_unset() function. + * + * @param obj The inwin object + * @param content The object to set as content + * + * @ingroup Inwin + */ +EAPI void elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content); + +/** + * Get the content of an inwin object. + * + * Return the content object for this widget. + * + * The returned object is valid as long as the inwin is still alive and no + * other content is set on it. Deleting the object will notify the inwin + * about it and this one will be left empty. + * + * If you need to remove an inwin's content to be reused somewhere else, + * see elm_win_inwin_content_unset(). + * + * @param obj The inwin object + * @return The content that is being used + * + * @ingroup Inwin + */ +EAPI Evas_Object *elm_win_inwin_content_get(const Evas_Object *obj); + +/** + * Unset the content of an inwin object. + * + * Unparent and return the content object which was set for this widget. + * + * @param obj The inwin object + * @return The content that was being used + * + * @ingroup Inwin + */ +EAPI Evas_Object *elm_win_inwin_content_unset(Evas_Object *obj); + +/** + * @} + */ + diff --git a/libraries/elementary/src/lib/els_box.c b/libraries/elementary/src/lib/els_box.c new file mode 100644 index 0000000..50810a6 --- /dev/null +++ b/libraries/elementary/src/lib/els_box.c @@ -0,0 +1,256 @@ +#include +#include "elm_priv.h" +#include "els_box.h" + +static void +_smart_extents_calculate(Evas_Object *box, Evas_Object_Box_Data *priv, int horizontal, int homogeneous) +{ + Evas_Coord minw, minh, mnw, mnh, maxw, maxh; + const Eina_List *l; + Evas_Object_Box_Option *opt; + int c; + + minw = 0; + minh = 0; + maxw = -1; + maxh = -1; + if (homogeneous) + { + EINA_LIST_FOREACH(priv->children, l, opt) + { + evas_object_size_hint_min_get(opt->obj, &mnw, &mnh); + if (minh < mnh) minh = mnh; + if (minw < mnw) minw = mnw; + + evas_object_size_hint_max_get(opt->obj, &mnw, &mnh); + if (mnh >= 0) + { + if (maxw == -1) maxh = mnh; + else if (maxh > mnh) maxh = mnh; + } + if (mnw >= 0) + { + if (maxw == -1) maxw = mnw; + else if (maxw > mnw) maxw = mnw; + } + } + if (horizontal) + { + minw *= eina_list_count(priv->children); + if (maxw != -1) + maxw *= eina_list_count(priv->children); + else maxw = -1; + } + else + { + minh *= eina_list_count(priv->children); + if (maxh != -1) + maxh *= eina_list_count(priv->children); + else maxh = -1; + } + } + else + { + EINA_LIST_FOREACH(priv->children, l, opt) + { + evas_object_size_hint_min_get(opt->obj, &mnw, &mnh); + if (horizontal) + { + if (minh < mnh) minh = mnh; + minw += mnw; + } + else + { + if (minw < mnw) minw = mnw; + minh += mnh; + } + evas_object_size_hint_max_get(opt->obj, &mnw, &mnh); + if (horizontal) + { + if (mnw < 0) maxw = -1; + if (maxw != -1) + { + if (maxw > mnw) maxw = mnw; + maxw += mnw; + } + } + else + { + if (mnh < 0) maxh = -1; + if (maxh != -1) + { + if (maxh > mnh) maxh = mnh; + maxh += mnh; + } + } + } + } + c = eina_list_count(priv->children) - 1; + if (c > 0) + { + if (horizontal) + { + minw += priv->pad.h * c; + if (maxw != -1) maxw += priv->pad.h * c; + } + else + { + minh += priv->pad.v * c; + if (maxh != -1) maxh += priv->pad.v * c; + } + } + evas_object_size_hint_min_set(box, minw, minh); + evas_object_size_hint_max_set(box, maxw, maxh); +} + +void +_els_box_layout(Evas_Object *o, Evas_Object_Box_Data *priv, int horizontal, int homogeneous, int rtl) +{ + Evas_Coord x, y, w, h, xx, yy; + const Eina_List *l; + Evas_Object *obj; + Evas_Coord minw, minh, wdif, hdif; + int count = 0; + double expand = 0.0; + double ax, ay; + Evas_Object_Box_Option *opt; + + _smart_extents_calculate(o, priv, horizontal, homogeneous); + + evas_object_geometry_get(o, &x, &y, &w, &h); + + evas_object_size_hint_min_get(o, &minw, &minh); + evas_object_size_hint_align_get(o, &ax, &ay); + if ((w < minw) || (h < minh)) return; + count = eina_list_count(priv->children); + if (rtl) ax = 1.0 - ax; + + if (w < minw) + { + x = x + ((w - minw) * (1.0 - ax)); + w = minw; + } + if (h < minh) + { + y = y + ((h - minh) * (1.0 - ay)); + h = minh; + } + EINA_LIST_FOREACH(priv->children, l, opt) + { + double wx, wy; + + evas_object_size_hint_weight_get(opt->obj, &wx, &wy); + if (horizontal) + { + if (wx > 0.0) expand += wx; + } + else + { + if (wy > 0.0) expand += wy; + } + } + if (!expand) + { + evas_object_size_hint_align_get(o, &ax, &ay); + if (rtl) ax = 1.0 - ax; + if (horizontal) + { + x += (double)(w - minw) * ax; + w = minw; + } + else + { + y += (double)(h - minh) * ay; + h = minh; + } + } + wdif = w - minw; + hdif = h - minh; + xx = x; + yy = y; + EINA_LIST_FOREACH(priv->children, l, opt) + { + Evas_Coord mnw, mnh, mxw, mxh; + double wx, wy; + int fw, fh, xw, xh; + + obj = opt->obj; + evas_object_size_hint_align_get(obj, &ax, &ay); + evas_object_size_hint_weight_get(obj, &wx, &wy); + evas_object_size_hint_min_get(obj, &mnw, &mnh); + evas_object_size_hint_max_get(obj, &mxw, &mxh); + fw = fh = 0; + xw = xh = 0; + if (ax == -1.0) {fw = 1; ax = 0.5;} + if (ay == -1.0) {fh = 1; ay = 0.5;} + if (rtl) ax = 1.0 - ax; + if (wx > 0.0) xw = 1; + if (wy > 0.0) xh = 1; + if (horizontal) + { + Evas_Coord ww, hh, ow, oh; + + if (homogeneous) + { + ww = (w / (Evas_Coord)count); + } + else + { + ww = mnw; + if ((expand > 0) && (xw)) + { + ow = ((w - minw) * wx) / expand; + wdif -= ow; + ww += ow; + } + } + hh = h; + ow = mnw; + if (fw) ow = ww; + if ((mxw >= 0) && (mxw < ow)) ow = mxw; + oh = mnh; + if (fh) oh = hh; + if ((mxh >= 0) && (mxh < oh)) oh = mxh; + evas_object_move(obj, + ((!rtl) ? (xx) : (x + (w - (xx - x) - ww))) + + (Evas_Coord)(((double)(ww - ow)) * ax), + yy + (Evas_Coord)(((double)(hh - oh)) * ay)); + evas_object_resize(obj, ow, oh); + xx += ww; + xx += priv->pad.h; + } + else + { + Evas_Coord ww, hh, ow, oh; + + if (homogeneous) + { + hh = (h / (Evas_Coord)count); + } + else + { + hh = mnh; + if ((expand > 0) && (xh)) + { + oh = ((h - minh) * wy) / expand; + hdif -= oh; + hh += oh; + } + } + ww = w; + ow = mnw; + if (fw) ow = ww; + if ((mxw >= 0) && (mxw < ow)) ow = mxw; + oh = mnh; + if (fh) oh = hh; + if ((mxh >= 0) && (mxh < oh)) oh = mxh; + evas_object_move(obj, + xx + (Evas_Coord)(((double)(ww - ow)) * ax), + yy + (Evas_Coord)(((double)(hh - oh)) * ay)); + evas_object_resize(obj, ow, oh); + yy += hh; + yy += priv->pad.v; + } + } +} + diff --git a/libraries/elementary/src/lib/els_box.h b/libraries/elementary/src/lib/els_box.h new file mode 100644 index 0000000..026f3af --- /dev/null +++ b/libraries/elementary/src/lib/els_box.h @@ -0,0 +1 @@ +void _els_box_layout(Evas_Object *o, Evas_Object_Box_Data *priv, int horizontal, int homogeneous, int rtl); diff --git a/libraries/elementary/src/lib/els_cursor.c b/libraries/elementary/src/lib/els_cursor.c new file mode 100644 index 0000000..7e8a625 --- /dev/null +++ b/libraries/elementary/src/lib/els_cursor.c @@ -0,0 +1,506 @@ +#include +#include +#include "elm_priv.h" + +#ifdef HAVE_ELEMENTARY_X +#include +#include +#endif + +#define _cursor_key "_elm_cursor" + +struct _Cursor_Id +{ + const char *name; +#ifdef HAVE_ELEMENTARY_X + int id; +#endif +}; + +#ifdef HAVE_ELEMENTARY_X +#define CURSOR(_name, _xid) \ + {_name , _xid} +# else +#define CURSOR(_name, _xid) \ + {_name} +#endif + +/* Please keep order in sync with Ecore_X_Cursor.h values! */ +struct _Cursor_Id _cursors[] = +{ + CURSOR(ELM_CURSOR_X , ECORE_X_CURSOR_X ), + CURSOR(ELM_CURSOR_ARROW , ECORE_X_CURSOR_ARROW ), + CURSOR(ELM_CURSOR_BASED_ARROW_DOWN , ECORE_X_CURSOR_BASED_ARROW_DOWN ), + CURSOR(ELM_CURSOR_BASED_ARROW_UP , ECORE_X_CURSOR_UP ), + CURSOR(ELM_CURSOR_BOAT , ECORE_X_CURSOR_BOAT ), + CURSOR(ELM_CURSOR_BOGOSITY , ECORE_X_CURSOR_BOGOSITY ), + CURSOR(ELM_CURSOR_BOTTOM_LEFT_CORNER , ECORE_X_CURSOR_BOTTOM_LEFT_CORNER ), + CURSOR(ELM_CURSOR_BOTTOM_RIGHT_CORNER, ECORE_X_CURSOR_BOTTOM_RIGHT_CORNER), + CURSOR(ELM_CURSOR_BOTTOM_SIDE , ECORE_X_CURSOR_BOTTOM_SIDE ), + CURSOR(ELM_CURSOR_BOTTOM_TEE , ECORE_X_CURSOR_BOTTOM_TEE ), + CURSOR(ELM_CURSOR_BOX_SPIRAL , ECORE_X_CURSOR_BOX_SPIRAL ), + CURSOR(ELM_CURSOR_CENTER_PTR , ECORE_X_CURSOR_CENTER_PTR ), + CURSOR(ELM_CURSOR_CIRCLE , ECORE_X_CURSOR_CIRCLE ), + CURSOR(ELM_CURSOR_CLOCK , ECORE_X_CURSOR_CLOCK ), + CURSOR(ELM_CURSOR_COFFEE_MUG , ECORE_X_CURSOR_COFFEE_MUG ), + CURSOR(ELM_CURSOR_CROSS , ECORE_X_CURSOR_CROSS ), + CURSOR(ELM_CURSOR_CROSS_REVERSE , ECORE_X_CURSOR_CROSS_REVERSE ), + CURSOR(ELM_CURSOR_CROSSHAIR , ECORE_X_CURSOR_CROSSHAIR ), + CURSOR(ELM_CURSOR_DIAMOND_CROSS , ECORE_X_CURSOR_DIAMOND_CROSS ), + CURSOR(ELM_CURSOR_DOT , ECORE_X_CURSOR_DOT ), + CURSOR(ELM_CURSOR_DOT_BOX_MASK , ECORE_X_CURSOR_DOT_BOX_MASK ), + CURSOR(ELM_CURSOR_DOUBLE_ARROW , ECORE_X_CURSOR_DOUBLE_ARROW ), + CURSOR(ELM_CURSOR_DRAFT_LARGE , ECORE_X_CURSOR_DRAFT_LARGE ), + CURSOR(ELM_CURSOR_DRAFT_SMALL , ECORE_X_CURSOR_DRAFT_SMALL ), + CURSOR(ELM_CURSOR_DRAPED_BOX , ECORE_X_CURSOR_DRAPED_BOX ), + CURSOR(ELM_CURSOR_EXCHANGE , ECORE_X_CURSOR_EXCHANGE ), + CURSOR(ELM_CURSOR_FLEUR , ECORE_X_CURSOR_FLEUR ), + CURSOR(ELM_CURSOR_GOBBLER , ECORE_X_CURSOR_GOBBLER ), + CURSOR(ELM_CURSOR_GUMBY , ECORE_X_CURSOR_GUMBY ), + CURSOR(ELM_CURSOR_HAND1 , ECORE_X_CURSOR_HAND1 ), + CURSOR(ELM_CURSOR_HAND2 , ECORE_X_CURSOR_HAND2 ), + CURSOR(ELM_CURSOR_HEART , ECORE_X_CURSOR_HEART ), + CURSOR(ELM_CURSOR_ICON , ECORE_X_CURSOR_ICON ), + CURSOR(ELM_CURSOR_IRON_CROSS , ECORE_X_CURSOR_IRON_CROSS ), + CURSOR(ELM_CURSOR_LEFT_PTR , ECORE_X_CURSOR_LEFT_PTR ), + CURSOR(ELM_CURSOR_LEFT_SIDE , ECORE_X_CURSOR_LEFT_SIDE ), + CURSOR(ELM_CURSOR_LEFT_TEE , ECORE_X_CURSOR_LEFT_TEE ), + CURSOR(ELM_CURSOR_LEFTBUTTON , ECORE_X_CURSOR_LEFTBUTTON ), + CURSOR(ELM_CURSOR_LL_ANGLE , ECORE_X_CURSOR_LL_ANGLE ), + CURSOR(ELM_CURSOR_LR_ANGLE , ECORE_X_CURSOR_LR_ANGLE ), + CURSOR(ELM_CURSOR_MAN , ECORE_X_CURSOR_MAN ), + CURSOR(ELM_CURSOR_MIDDLEBUTTON , ECORE_X_CURSOR_MIDDLEBUTTON ), + CURSOR(ELM_CURSOR_MOUSE , ECORE_X_CURSOR_MOUSE ), + CURSOR(ELM_CURSOR_PENCIL , ECORE_X_CURSOR_PENCIL ), + CURSOR(ELM_CURSOR_PIRATE , ECORE_X_CURSOR_PIRATE ), + CURSOR(ELM_CURSOR_PLUS , ECORE_X_CURSOR_PLUS ), + CURSOR(ELM_CURSOR_QUESTION_ARROW , ECORE_X_CURSOR_QUESTION_ARROW ), + CURSOR(ELM_CURSOR_RIGHT_PTR , ECORE_X_CURSOR_RIGHT_PTR ), + CURSOR(ELM_CURSOR_RIGHT_SIDE , ECORE_X_CURSOR_RIGHT_SIDE ), + CURSOR(ELM_CURSOR_RIGHT_TEE , ECORE_X_CURSOR_RIGHT_TEE ), + CURSOR(ELM_CURSOR_RIGHTBUTTON , ECORE_X_CURSOR_RIGHTBUTTON ), + CURSOR(ELM_CURSOR_RTL_LOGO , ECORE_X_CURSOR_RTL_LOGO ), + CURSOR(ELM_CURSOR_SAILBOAT , ECORE_X_CURSOR_SAILBOAT ), + CURSOR(ELM_CURSOR_SB_DOWN_ARROW , ECORE_X_CURSOR_SB_DOWN_ARROW ), + CURSOR(ELM_CURSOR_SB_H_DOUBLE_ARROW , ECORE_X_CURSOR_SB_H_DOUBLE_ARROW ), + CURSOR(ELM_CURSOR_SB_LEFT_ARROW , ECORE_X_CURSOR_SB_LEFT_ARROW ), + CURSOR(ELM_CURSOR_SB_RIGHT_ARROW , ECORE_X_CURSOR_SB_RIGHT_ARROW ), + CURSOR(ELM_CURSOR_SB_UP_ARROW , ECORE_X_CURSOR_SB_UP_ARROW ), + CURSOR(ELM_CURSOR_SB_V_DOUBLE_ARROW , ECORE_X_CURSOR_SB_V_DOUBLE_ARROW ), + CURSOR(ELM_CURSOR_SHUTTLE , ECORE_X_CURSOR_SHUTTLE ), + CURSOR(ELM_CURSOR_SIZING , ECORE_X_CURSOR_SIZING ), + CURSOR(ELM_CURSOR_SPIDER , ECORE_X_CURSOR_SPIDER ), + CURSOR(ELM_CURSOR_SPRAYCAN , ECORE_X_CURSOR_SPRAYCAN ), + CURSOR(ELM_CURSOR_STAR , ECORE_X_CURSOR_STAR ), + CURSOR(ELM_CURSOR_TARGET , ECORE_X_CURSOR_TARGET ), + CURSOR(ELM_CURSOR_TCROSS , ECORE_X_CURSOR_TCROSS ), + CURSOR(ELM_CURSOR_TOP_LEFT_ARROW , ECORE_X_CURSOR_TOP_LEFT_ARROW ), + CURSOR(ELM_CURSOR_TOP_LEFT_CORNER , ECORE_X_CURSOR_TOP_LEFT_CORNER ), + CURSOR(ELM_CURSOR_TOP_RIGHT_CORNER , ECORE_X_CURSOR_TOP_RIGHT_CORNER ), + CURSOR(ELM_CURSOR_TOP_SIDE , ECORE_X_CURSOR_TOP_SIDE ), + CURSOR(ELM_CURSOR_TOP_TEE , ECORE_X_CURSOR_TOP_TEE ), + CURSOR(ELM_CURSOR_TREK , ECORE_X_CURSOR_TREK ), + CURSOR(ELM_CURSOR_UL_ANGLE , ECORE_X_CURSOR_UL_ANGLE ), + CURSOR(ELM_CURSOR_UMBRELLA , ECORE_X_CURSOR_UMBRELLA ), + CURSOR(ELM_CURSOR_UR_ANGLE , ECORE_X_CURSOR_UR_ANGLE ), + CURSOR(ELM_CURSOR_WATCH , ECORE_X_CURSOR_WATCH ), + CURSOR(ELM_CURSOR_XTERM , ECORE_X_CURSOR_XTERM ) +}; +static const int _cursors_count = sizeof(_cursors)/sizeof(struct _Cursor_Id); + +#define ELM_CURSOR_GET_OR_RETURN(cur, obj, ...) \ + Elm_Cursor *cur; \ + do \ + { \ + if (!(obj)) \ + { \ + CRITICAL("Null pointer: " #obj); \ + return __VA_ARGS__; \ + } \ + cur = evas_object_data_get((obj), _cursor_key); \ + if (!cur) \ + { \ + ERR("Object does not have cursor: " #obj); \ + return __VA_ARGS__; \ + } \ + } \ + while (0) + +struct _Elm_Cursor +{ + Evas_Object *obj; + Evas_Object *eventarea, *owner; + const char *style, *cursor_name; + int hot_x, hot_y; + Ecore_Evas *ee; + Evas *evas; +#ifdef HAVE_ELEMENTARY_X + Ecore_X_Cursor cursor; + Ecore_X_Window win; +#endif + Eina_Bool visible:1; + Eina_Bool use_engine:1; + Eina_Bool engine_only:1; +}; + +static void +_elm_cursor_obj_del(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Cursor *cur = data; + + if (cur) cur->obj = NULL; +} + +static Eina_Bool +_elm_cursor_obj_add(Evas_Object *obj, Elm_Cursor *cur) +{ + int x, y; + + cur->obj = edje_object_add(cur->evas); + + if (!cur->obj) + return EINA_FALSE; + + if (!_elm_theme_object_set(obj, cur->obj, "cursor", cur->cursor_name, + cur->style ? cur->style : "default")) + { + evas_object_del(cur->obj); + cur->obj = NULL; + return EINA_FALSE; + } + + evas_object_event_callback_add(cur->obj, EVAS_CALLBACK_DEL, + _elm_cursor_obj_del, cur); + + edje_object_size_min_get(cur->obj, &x, &y); + evas_object_resize(cur->obj, x, y); + return EINA_TRUE; +} + +static void +_elm_cursor_set_hot_spots(Elm_Cursor *cur) +{ + const char *str; + + str = edje_object_data_get(cur->obj, "hot_x"); + if (str) cur->hot_x = atoi(str); + else cur->hot_x = 0; + + str = edje_object_data_get(cur->obj, "hot_y"); + if (str) cur->hot_y = atoi(str); + else cur->hot_y = 0; +} + +static void +_elm_cursor_mouse_in(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Cursor *cur = data; + + if (cur->visible) return; + evas_event_freeze(cur->evas); + cur->visible = EINA_TRUE; + if ((!cur->engine_only) && (!cur->use_engine)) + { + if (!cur->obj) + _elm_cursor_obj_add(cur->eventarea, cur); + ecore_evas_object_cursor_set(cur->ee, cur->obj, + ELM_OBJECT_LAYER_CURSOR, cur->hot_x, + cur->hot_y); + } + else + { +#ifdef HAVE_ELEMENTARY_X + if (cur->win) + { + ecore_x_window_cursor_set(cur->win, cur->cursor); + } +#endif + } + evas_event_thaw(cur->evas); +} + +static void +_elm_cursor_mouse_out(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Object *sobj_parent; + Elm_Cursor *pcur = NULL; + Elm_Cursor *cur = data; + + if (!cur->visible) return; + evas_event_freeze(cur->evas); + cur->visible = EINA_FALSE; + + sobj_parent = evas_object_data_get(cur->eventarea, "elm-parent"); + while (sobj_parent) + { + pcur = evas_object_data_get((sobj_parent), _cursor_key); + if ((pcur) && (pcur->visible)) break; + sobj_parent = evas_object_data_get(sobj_parent, "elm-parent"); + } + + if (pcur) + { + pcur->visible = EINA_FALSE; + evas_event_thaw(cur->evas); + _elm_cursor_mouse_in(pcur, NULL, NULL, NULL); + return; + } + + if ((!cur->engine_only) || (!cur->use_engine)) + { + ecore_evas_object_cursor_set(cur->ee, NULL, ELM_OBJECT_LAYER_CURSOR, + cur->hot_x, cur->hot_y); + } + else + { +#ifdef HAVE_ELEMENTARY_X + if (cur->win) + { + ecore_x_window_cursor_set(cur->win, ECORE_X_CURSOR_X); + } +#endif + } + evas_event_thaw(cur->evas); +} + +static void +_elm_cursor_del(void *data __UNUSED__, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + elm_object_cursor_unset(obj); +} + +#ifdef HAVE_ELEMENTARY_X +static int +_elm_cursor_strcmp(const void *data1, const void *data2) +{ + const struct _Cursor_Id *c1 = data1; + const struct _Cursor_Id *c2 = data2; + return strcmp (c1->name, c2->name); +} +#endif + +static void +_elm_cursor_cur_set(Elm_Cursor *cur) +{ + if (cur->engine_only) + { + INF("Using only engine cursors"); + cur->use_engine = EINA_TRUE; + } + else if (_elm_cursor_obj_add(cur->eventarea, cur)) + { + _elm_cursor_set_hot_spots(cur); + cur->use_engine = EINA_FALSE; + elm_widget_cursor_add(cur->owner, cur); + } + else + { + INF("Cursor couldn't be found on theme: %s", cur->cursor_name); + cur->use_engine = EINA_TRUE; + } + + if (cur->use_engine) + { +#ifdef HAVE_ELEMENTARY_X + struct _Cursor_Id *cur_id; + + cur_id = bsearch(&(cur->cursor_name), _cursors, _cursors_count, + sizeof(struct _Cursor_Id), _elm_cursor_strcmp); + + cur->win = elm_win_xwindow_get(cur->eventarea); + if (cur->win) + { + if (!cur_id) + { + INF("X cursor couldn't be found: %s. Using default.", + cur->cursor_name); + cur->cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_X); + } + else + cur->cursor = ecore_x_cursor_shape_get(cur_id->id); + } +#endif + } +} + +/** + * Set the cursor to be shown when mouse is over the object + * + * Set the cursor that will be displayed when mouse is over the + * object. The object can have only one cursor set to it, so if + * this function is called twice for an object, the previous set + * will be unset. + * If using X cursors, a definition of all the valid cursor names + * is listed on Elementary_Cursors.h. If an invalid name is set + * the default cursor will be used. + * + * This is an internal function that is used by objects with sub-items + * that want to provide different cursors for each of them. The @a + * owner object should be an elm_widget and will be used to track + * theme changes and to feed @a func and @a del_cb. The @a eventarea + * may be any object and is the one that should be used later on with + * elm_object_cursor apis, such as elm_object_cursor_unset(). + * + * @param eventarea the object being attached a cursor. + * @param owner the elm_widget that owns this object, will be used to + * track theme changes and to be used in @a func or @a del_cb. + * @param cursor the cursor name to be used. + * + * @internal + * @ingroup Cursors + */ +void +elm_object_sub_cursor_set(Evas_Object *eventarea, Evas_Object *owner, const char *cursor) +{ + Elm_Cursor *cur = NULL; + + cur = evas_object_data_get(eventarea, _cursor_key); + if (cur) + elm_object_cursor_unset(eventarea); + + if (!cursor) return; + + cur = ELM_NEW(Elm_Cursor); + if (!cur) return; + + cur->owner = owner; + cur->eventarea = eventarea; + cur->engine_only = _elm_config->cursor_engine_only; + cur->visible = EINA_FALSE; + + cur->cursor_name = eina_stringshare_add(cursor); + if (!cur->cursor_name) + ERR("Could not store cursor name %s", cursor); + + cur->evas = evas_object_evas_get(eventarea); + cur->ee = ecore_evas_ecore_evas_get(cur->evas); + + _elm_cursor_cur_set(cur); + + evas_object_data_set(eventarea, _cursor_key, cur); + + evas_object_event_callback_add(eventarea, EVAS_CALLBACK_MOUSE_IN, + _elm_cursor_mouse_in, cur); + evas_object_event_callback_add(eventarea, EVAS_CALLBACK_MOUSE_OUT, + _elm_cursor_mouse_out, cur); + evas_object_event_callback_add(eventarea, EVAS_CALLBACK_DEL, + _elm_cursor_del, cur); +} + +EAPI void +elm_object_cursor_set(Evas_Object *obj, const char *cursor) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + elm_object_sub_cursor_set(obj, obj, cursor); +} + +EAPI const char * +elm_object_cursor_get(const Evas_Object *obj) +{ + ELM_CURSOR_GET_OR_RETURN(cur, obj, NULL); + return cur->cursor_name; +} + +EAPI void +elm_object_cursor_unset(Evas_Object *obj) +{ + ELM_CURSOR_GET_OR_RETURN(cur, obj); + + eina_stringshare_del(cur->cursor_name); + eina_stringshare_del(cur->style); + + if (cur->owner) + elm_widget_cursor_del(cur->owner, cur); + + if (cur->obj) + evas_object_del(cur->obj); + + if (cur->visible) + { + if (!cur->use_engine) + ecore_evas_object_cursor_set(cur->ee, NULL, ELM_OBJECT_LAYER_CURSOR, + cur->hot_x, cur->hot_y); +#ifdef HAVE_ELEMENTARY_X + else if (cur->win) + ecore_x_window_cursor_set(cur->win, ECORE_X_CURSOR_X); +#endif + } + + evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_IN, + _elm_cursor_mouse_in); + evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_OUT, + _elm_cursor_mouse_out); + evas_object_event_callback_del(obj, EVAS_CALLBACK_DEL, _elm_cursor_del); + + evas_object_data_del(obj, _cursor_key); + free(cur); +} + +EAPI void +elm_object_cursor_style_set(Evas_Object *obj, const char *style) +{ + ELM_CURSOR_GET_OR_RETURN(cur, obj); + + if (!eina_stringshare_replace(&cur->style, style)) + ERR("Could not set current style=%s", style); + + if (cur->use_engine) return; + + if (!cur->obj) + { + if (!_elm_cursor_obj_add(obj, cur)) + ERR("Could not create cursor object"); + else + _elm_cursor_set_hot_spots(cur); + } + else + { + if (!_elm_theme_object_set(obj, cur->obj, "cursor", cur->cursor_name, + style)) + ERR("Could not apply the theme to the cursor style=%s", style); + else + _elm_cursor_set_hot_spots(cur); + } +} + +EAPI const char * +elm_object_cursor_style_get(const Evas_Object *obj) +{ + ELM_CURSOR_GET_OR_RETURN(cur, obj, NULL); + return cur->style ? cur->style : "default"; +} + +/** + * Notify cursor should recalculate its theme. + * @internal + */ +void +elm_cursor_theme(Elm_Cursor *cur) +{ + if ((!cur) || (!cur->obj)) return; + if (!_elm_theme_object_set(cur->eventarea, cur->obj, "cursor", + cur->cursor_name, cur->style)) + ERR("Could not apply the theme to the cursor style=%s", cur->style); + else + _elm_cursor_set_hot_spots(cur); +} + +EAPI void elm_object_cursor_theme_search_enabled_set(Evas_Object *obj, Eina_Bool theme_search) +{ + ELM_CURSOR_GET_OR_RETURN(cur, obj); + cur->engine_only = theme_search; + if (cur->obj) + { + evas_object_del(cur->obj); + cur->obj = NULL; + } + _elm_cursor_cur_set(cur); +} + + +EAPI Eina_Bool +elm_object_cursor_theme_search_enabled_get(const Evas_Object *obj) +{ + ELM_CURSOR_GET_OR_RETURN(cur, obj, EINA_FALSE); + return cur->engine_only; +} diff --git a/libraries/elementary/src/lib/els_icon.c b/libraries/elementary/src/lib/els_icon.c new file mode 100644 index 0000000..9cd74bb --- /dev/null +++ b/libraries/elementary/src/lib/els_icon.c @@ -0,0 +1,842 @@ +#include +#include "elm_priv.h" +#include "els_icon.h" + +#ifdef _WIN32 +# define FMT_SIZE_T "%Iu" +#else +# define FMT_SIZE_T "%zu" +#endif + +typedef struct _Smart_Data Smart_Data; + +struct _Smart_Data +{ + Evas_Coord x, y, w, h; + Evas_Object *obj; + Evas_Object *prev; + int size; + double scale; + Eina_Bool fill_inside : 1; + Eina_Bool scale_up : 1; + Eina_Bool scale_down : 1; + Eina_Bool preloading : 1; + Eina_Bool show : 1; + Eina_Bool edit : 1; + Eina_Bool edje : 1; + Eina_Bool aspect_fixed: 1; + Elm_Image_Orient orient; +}; + +/* local subsystem functions */ +static void _smart_reconfigure(Smart_Data *sd); +static void _smart_init(void); +static void _smart_add(Evas_Object *obj); +static void _smart_del(Evas_Object *obj); +static void _smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y); +static void _smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h); +static void _smart_show(Evas_Object *obj); +static void _smart_hide(Evas_Object *obj); +static void _smart_color_set(Evas_Object *obj, int r, int g, int b, int a); +static void _smart_clip_set(Evas_Object *obj, Evas_Object * clip); +static void _smart_clip_unset(Evas_Object *obj); + +static void _els_smart_icon_flip_horizontal(Smart_Data *sd); +static void _els_smart_icon_flip_vertical(Smart_Data *sd); +static void _els_smart_icon_rotate_180(Smart_Data *sd); +static Eina_Bool _els_smart_icon_dropcb(void *,Evas_Object *, Elm_Selection_Data *); + +/* local subsystem globals */ +static Evas_Smart *_e_smart = NULL; + +/* externally accessible functions */ +Evas_Object * +_els_smart_icon_add(Evas *evas) +{ + _smart_init(); + return evas_object_smart_add(evas, _e_smart); +} + +static void +_preloaded(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event __UNUSED__) +{ + Smart_Data *sd = data; + + sd->preloading = EINA_FALSE; + if (obj == sd->obj) + { + if (sd->show) + evas_object_show(sd->obj); + } + if (sd->prev) evas_object_del(sd->prev); + sd->prev = NULL; +} + +static void +_els_smart_icon_file_helper(Evas_Object *obj) +{ + Smart_Data *sd; + Evas_Object *pclip; + + sd = evas_object_smart_data_get(obj); + /* smart code here */ + if (sd->prev) evas_object_del(sd->prev); + pclip = evas_object_clip_get(sd->obj); + if (sd->obj) sd->prev = sd->obj; + sd->obj = evas_object_image_add(evas_object_evas_get(obj)); + evas_object_image_load_orientation_set(sd->obj, EINA_TRUE); + evas_object_event_callback_add(sd->obj, EVAS_CALLBACK_IMAGE_PRELOADED, + _preloaded, sd); + evas_object_smart_member_add(sd->obj, obj); + if (sd->prev) evas_object_smart_member_add(sd->prev, obj); + evas_object_image_scale_hint_set(sd->obj, EVAS_IMAGE_SCALE_HINT_STATIC); + evas_object_clip_set(sd->obj, pclip); + + sd->edje = EINA_FALSE; + + if (!sd->size) + evas_object_image_load_size_set(sd->obj, sd->size, sd->size); +} + +Eina_Bool +_els_smart_icon_memfile_set(Evas_Object *obj, const void *img, size_t size, const char *format, const char *key) +{ + Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + if (!sd) return EINA_FALSE; + _els_smart_icon_file_helper(obj); + + evas_object_image_memfile_set(sd->obj, (void*)img, size, (char*)format, (char*)key); + sd->preloading = EINA_TRUE; + sd->show = EINA_TRUE; + evas_object_hide(sd->obj); + evas_object_image_preload(sd->obj, EINA_FALSE); + if (evas_object_image_load_error_get(sd->obj) != EVAS_LOAD_ERROR_NONE) + { + ERR("Things are going bad for some random " FMT_SIZE_T " byte chunk of memory (%p)", size, sd->obj); + return EINA_FALSE; + } + _smart_reconfigure(sd); + return EINA_TRUE; +} + +Eina_Bool +_els_smart_icon_file_key_set(Evas_Object *obj, const char *file, const char *key) +{ + Smart_Data *sd; + Evas_Coord w, h; + + sd = evas_object_smart_data_get(obj); + if (!sd) return EINA_FALSE; + _els_smart_icon_file_helper(obj); + + evas_object_image_file_set(sd->obj, file, key); + sd->preloading = EINA_TRUE; + sd->show = EINA_TRUE; + evas_object_hide(sd->obj); + _els_smart_icon_size_get(obj, &w, &h); + evas_object_image_load_size_set(sd->obj, w, h); + evas_object_image_preload(sd->obj, EINA_FALSE); + if (evas_object_image_load_error_get(sd->obj) != EVAS_LOAD_ERROR_NONE) + { + ERR("Things are going bad for '%s' (%p)", file, sd->obj); + return EINA_FALSE; + } + _smart_reconfigure(sd); + return EINA_TRUE; +} + +void +_els_smart_icon_preload_set(Evas_Object *obj, Eina_Bool disable) +{ + Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + if ((!sd) || sd->edje) return; + evas_object_image_preload(sd->obj, disable); + sd->preloading = !disable; +} + +Eina_Bool +_els_smart_icon_file_edje_set(Evas_Object *obj, const char *file, const char *part) +{ + Smart_Data *sd; + Evas_Object *pclip; + + sd = evas_object_smart_data_get(obj); + if (!sd) return EINA_FALSE; + /* smart code here */ + if (sd->prev) evas_object_del(sd->prev); + sd->prev = NULL; + + if (!sd->edje) + { + pclip = evas_object_clip_get(sd->obj); + if (sd->obj) evas_object_del(sd->obj); + sd->obj = edje_object_add(evas_object_evas_get(obj)); + evas_object_smart_member_add(sd->obj, obj); + if (sd->show) evas_object_show(sd->obj); + evas_object_clip_set(sd->obj, pclip); + } + sd->edje = EINA_TRUE; + if (!edje_object_file_set(sd->obj, file, part)) + return EINA_FALSE; + _smart_reconfigure(sd); + return EINA_TRUE; +} + +void +_els_smart_icon_file_get(const Evas_Object *obj, const char **file, const char **key) +{ + Smart_Data *sd = evas_object_smart_data_get(obj); + if (!sd) return; + if (sd->edje) + edje_object_file_get(sd->obj, file, key); + else + evas_object_image_file_get(sd->obj, file, key); +} + +void +_els_smart_icon_smooth_scale_set(Evas_Object *obj, Eina_Bool smooth) +{ + Smart_Data *sd = evas_object_smart_data_get(obj); + if (!sd) return; + if (sd->edje) + return; + evas_object_image_smooth_scale_set(sd->obj, smooth); +} + +Eina_Bool +_els_smart_icon_smooth_scale_get(const Evas_Object *obj) +{ + Smart_Data *sd = evas_object_smart_data_get(obj); + if (!sd) return EINA_FALSE; + if (sd->edje) + return EINA_FALSE; + return evas_object_image_smooth_scale_get(sd->obj); +} + +Evas_Object * +_els_smart_icon_object_get(const Evas_Object *obj) +{ + Smart_Data *sd = evas_object_smart_data_get(obj); + if (!sd) return NULL; + return sd->obj; +} + +void +_els_smart_icon_size_get(const Evas_Object *obj, int *w, int *h) +{ + Smart_Data *sd; + int tw, th; + int cw, ch; + const char *type; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + type = evas_object_type_get(sd->obj); + if (!type) return; + if (!strcmp(type, "edje")) + edje_object_size_min_get(sd->obj, &tw, &th); + else + evas_object_image_size_get(sd->obj, &tw, &th); + evas_object_geometry_get(sd->obj, NULL, NULL, &cw, &ch); + tw = tw > cw ? tw : cw; + th = th > ch ? th : ch; + tw = ((double)tw) * sd->scale; + th = ((double)th) * sd->scale; + if (w) *w = tw; + if (h) *h = th; +} + +void +_els_smart_icon_fill_inside_set(Evas_Object *obj, Eina_Bool fill_inside) +{ + Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + if (((sd->fill_inside) && (fill_inside)) || + ((!sd->fill_inside) && (!fill_inside))) return; + sd->fill_inside = fill_inside; + _smart_reconfigure(sd); +} + +Eina_Bool +_els_smart_icon_fill_inside_get(const Evas_Object *obj) +{ + Smart_Data *sd = evas_object_smart_data_get(obj); + if (!sd) return EINA_FALSE; + return sd->fill_inside; +} + +void +_els_smart_icon_scale_up_set(Evas_Object *obj, Eina_Bool scale_up) +{ + Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + if (((sd->scale_up) && (scale_up)) || + ((!sd->scale_up) && (!scale_up))) return; + sd->scale_up = scale_up; + _smart_reconfigure(sd); +} + +Eina_Bool +_els_smart_icon_scale_up_get(const Evas_Object *obj) +{ + Smart_Data *sd; sd = evas_object_smart_data_get(obj); + if (!sd) return EINA_FALSE; + return sd->scale_up; +} + +void +_els_smart_icon_scale_down_set(Evas_Object *obj, Eina_Bool scale_down) +{ + Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + if (((sd->scale_down) && (scale_down)) || + ((!sd->scale_down) && (!scale_down))) return; + sd->scale_down = scale_down; + _smart_reconfigure(sd); +} + +Eina_Bool +_els_smart_icon_scale_down_get(const Evas_Object *obj) +{ + Smart_Data *sd; sd = evas_object_smart_data_get(obj); + if (!sd) return EINA_FALSE; + return sd->scale_up; +} + +void +_els_smart_icon_scale_size_set(Evas_Object *obj, int size) +{ + Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + sd->size = size; + if (!sd->obj) return; + if (sd->edje) + return; + evas_object_image_load_size_set(sd->obj, sd->size, sd->size); +} + +int +_els_smart_icon_scale_size_get(const Evas_Object *obj) +{ + Smart_Data *sd; sd = evas_object_smart_data_get(obj); + if (!sd) return 0; + return sd->size; +} + +void +_els_smart_icon_scale_set(Evas_Object *obj, double scale) +{ + Smart_Data *sd = evas_object_smart_data_get(obj); + if (!sd) return; + sd->scale = scale; + _smart_reconfigure(sd); +} + +double +_els_smart_icon_scale_get(const Evas_Object *obj) +{ + Smart_Data *sd; sd = evas_object_smart_data_get(obj); + if (!sd) return 0.0; + return sd->scale; +} + +void +_els_smart_icon_orient_set(Evas_Object *obj, Elm_Image_Orient orient) +{ + Smart_Data *sd; + unsigned int *data, *data2 = NULL, *to, *from; + int x, y, w, hw, iw, ih; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + if (sd->edje) + return; + + switch (orient) + { + case ELM_IMAGE_FLIP_HORIZONTAL: + _els_smart_icon_flip_horizontal(sd); + return; + case ELM_IMAGE_FLIP_VERTICAL: + _els_smart_icon_flip_vertical(sd); + return; + case ELM_IMAGE_ROTATE_180: + _els_smart_icon_rotate_180(sd); + return; + default: + break; + } + + evas_object_image_size_get(sd->obj, &iw, &ih); + /* we need separate destination memory if we want to rotate 90 or 270 degree */ + evas_object_image_data_copy_set(sd->obj, data2); + if (!data2) return; + + w = ih; + ih = iw; + iw = w; + hw = w * ih; + + evas_object_image_size_set(sd->obj, iw, ih); + data = evas_object_image_data_get(sd->obj, EINA_TRUE); + + switch (orient) + { + case ELM_IMAGE_FLIP_TRANSPOSE: + to = data; + hw = -hw + 1; + break; + case ELM_IMAGE_FLIP_TRANSVERSE: + to = data + hw - 1; + w = -w; + hw = hw - 1; + break; + case ELM_IMAGE_ROTATE_90: + to = data + w - 1; + hw = -hw - 1; + break; + case ELM_IMAGE_ROTATE_270: + to = data + hw - w; + w = -w; + hw = hw + 1; + break; + default: + ERR("unknown orient %d", orient); + evas_object_image_data_set(sd->obj, data); // give it back + if (data2) free(data2); + return; + } + from = data2; + for (x = iw; --x >= 0;) + { + for (y = ih; --y >= 0;) + { + *to = *from; + from++; + to += w; + } + to += hw; + } + sd->orient = orient; + if (data2) free(data2); + evas_object_image_data_set(sd->obj, data); + evas_object_image_data_update_add(sd->obj, 0, 0, iw, ih); + _smart_reconfigure(sd); +} + +Elm_Image_Orient +_els_smart_icon_orient_get(const Evas_Object *obj) +{ + Smart_Data *sd; sd = evas_object_smart_data_get(obj); + if (!sd) return 0; + return sd->orient; +} + +/** + * Turns on editing through drag and drop and copy and paste. + */ +void +_els_smart_icon_edit_set(Evas_Object *obj, Eina_Bool edit, Evas_Object *parent) +{ + Smart_Data *sd = evas_object_smart_data_get(obj); + if (!sd) return; + + if (sd->edje) + { + printf("No editing edje objects yet (ever)\n"); + return; + } + + /* Unfortunately eina bool is not a bool, but a char */ + if (edit == sd->edit) return; + + sd->edit = edit; + + if (sd->edit) + elm_drop_target_add(obj, ELM_SEL_FORMAT_IMAGE, _els_smart_icon_dropcb, + parent); + else + elm_drop_target_del(obj); +} + +Eina_Bool +_els_smart_icon_edit_get(const Evas_Object *obj) +{ + Smart_Data *sd; sd = evas_object_smart_data_get(obj); + if (!sd) return EINA_FALSE; + return sd->edit; +} + +Evas_Object * +_els_smart_icon_edje_get(Evas_Object *obj) +{ + Smart_Data *sd = evas_object_smart_data_get(obj); + if (!sd) return NULL; + if (!sd->edje) return NULL; + return sd->obj; +} + +void +_els_smart_icon_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed) +{ + Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + + fixed = !!fixed; + if (sd->aspect_fixed == fixed) return; + sd->aspect_fixed = fixed; + _smart_reconfigure(sd); +} + +Eina_Bool +_els_smart_icon_aspect_fixed_get(const Evas_Object *obj) +{ + Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + if (!sd) return EINA_FALSE; + return sd->aspect_fixed; +} + +/* local subsystem globals */ +static void +_smart_reconfigure(Smart_Data *sd) +{ + Evas_Coord x, y, w, h; + const char *type; + + if (!sd->obj) return; + + w = sd->w; + h = sd->h; + + type = evas_object_type_get(sd->obj); + if (!type) return; + if (!strcmp(type, "edje")) + { + x = sd->x; + y = sd->y; + evas_object_move(sd->obj, x, y); + evas_object_resize(sd->obj, w, h); + } + else + { + int iw = 0, ih = 0; + double alignh = 0.5, alignv = 0.5; + Evas_Object *parent; + + evas_object_image_size_get(sd->obj, &iw, &ih); + + iw = ((double)iw) * sd->scale; + ih = ((double)ih) * sd->scale; + + if (iw < 1) iw = 1; + if (ih < 1) ih = 1; + + if (sd->aspect_fixed) + { + h = ((double)ih * w) / (double)iw; + if (sd->fill_inside) + { + if (h > sd->h) + { + h = sd->h; + w = ((double)iw * h) / (double)ih; + } + } + else + { + if (h < sd->h) + { + h = sd->h; + w = ((double)iw * h) / (double)ih; + } + } + } + if (!sd->scale_up) + { + if (w > iw) w = iw; + if (h > ih) h = ih; + } + if (!sd->scale_down) + { + if (w < iw) w = iw; + if (h < ih) h = ih; + } + parent = elm_widget_parent_widget_get(sd->obj); + if (parent) + evas_object_size_hint_align_get(parent, &alignh, &alignv); + if (alignh == EVAS_HINT_FILL) alignh = 0.5; + if (alignv == EVAS_HINT_FILL) alignv = 0.5; + x = sd->x + ((sd->w - w) * alignh); + y = sd->y + ((sd->h - h) * alignv); + evas_object_move(sd->obj, x, y); + evas_object_image_fill_set(sd->obj, 0, 0, w, h); + evas_object_resize(sd->obj, w, h); + } +} + +static void +_smart_init(void) +{ + if (_e_smart) return; + { + static const Evas_Smart_Class sc = + { + "e_icon", + EVAS_SMART_CLASS_VERSION, + _smart_add, + _smart_del, + _smart_move, + _smart_resize, + _smart_show, + _smart_hide, + _smart_color_set, + _smart_clip_set, + _smart_clip_unset, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + }; + _e_smart = evas_smart_class_new(&sc); + } +} + +static void +_smart_add(Evas_Object *obj) +{ + Smart_Data *sd; + + sd = calloc(1, sizeof(Smart_Data)); + if (!sd) return; + sd->obj = evas_object_image_add(evas_object_evas_get(obj)); + sd->prev = NULL; + evas_object_image_scale_hint_set(sd->obj, EVAS_IMAGE_SCALE_HINT_STATIC); + sd->x = 0; + sd->y = 0; + sd->w = 0; + sd->h = 0; + sd->fill_inside = EINA_TRUE; + sd->scale_up = EINA_TRUE; + sd->scale_down = EINA_TRUE; + sd->aspect_fixed = EINA_TRUE; + sd->size = 64; + sd->scale = 1.0; + evas_object_smart_member_add(sd->obj, obj); + evas_object_smart_data_set(obj, sd); + evas_object_event_callback_add(sd->obj, EVAS_CALLBACK_IMAGE_PRELOADED, + _preloaded, sd); +} + +static void +_smart_del(Evas_Object *obj) +{ + Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + evas_object_del(sd->obj); + if (sd->prev) evas_object_del(sd->prev); + free(sd); +} + +static void +_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y) +{ + Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + if ((sd->x == x) && (sd->y == y)) return; + sd->x = x; + sd->y = y; + _smart_reconfigure(sd); +} + +static void +_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) +{ + Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + if ((sd->w == w) && (sd->h == h)) return; + sd->w = w; + sd->h = h; + _smart_reconfigure(sd); +} + +static void +_smart_show(Evas_Object *obj) +{ + Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + sd->show = EINA_TRUE; + if (!sd->preloading) + { + evas_object_show(sd->obj); + if (sd->prev) evas_object_del(sd->prev); + sd->prev = NULL; + } +} + +static void +_smart_hide(Evas_Object *obj) +{ + Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + sd->show = EINA_FALSE; + evas_object_hide(sd->obj); + if (sd->prev) evas_object_del(sd->prev); + sd->prev = NULL; +} + +static void +_smart_color_set(Evas_Object *obj, int r, int g, int b, int a) +{ + Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + evas_object_color_set(sd->obj, r, g, b, a); + if (sd->prev) evas_object_color_set(sd->prev, r, g, b, a); +} + +static void +_smart_clip_set(Evas_Object *obj, Evas_Object * clip) +{ + Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + evas_object_clip_set(sd->obj, clip); + if (sd->prev) evas_object_clip_set(sd->prev, clip); +} + +static void +_smart_clip_unset(Evas_Object *obj) +{ + Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + evas_object_clip_unset(sd->obj); + if (sd->prev) evas_object_clip_unset(sd->prev); +} + +static void +_els_smart_icon_flip_horizontal(Smart_Data *sd) +{ + unsigned int *data; + unsigned int *p1, *p2, tmp; + int x, y, iw, ih; + + evas_object_image_size_get(sd->obj, &iw, &ih); + data = evas_object_image_data_get(sd->obj, EINA_TRUE); + + for (y = 0; y < ih; y++) + { + p1 = data + (y * iw); + p2 = data + ((y + 1) * iw) - 1; + for (x = 0; x < (iw >> 1); x++) + { + tmp = *p1; + *p1 = *p2; + *p2 = tmp; + p1++; + p2--; + } + } + + evas_object_image_data_set(sd->obj, data); + evas_object_image_data_update_add(sd->obj, 0, 0, iw, ih); + _smart_reconfigure(sd); +} + +static void +_els_smart_icon_flip_vertical(Smart_Data *sd) +{ + unsigned int *data; + unsigned int *p1, *p2, tmp; + int x, y, iw, ih; + + evas_object_image_size_get(sd->obj, &iw, &ih); + data = evas_object_image_data_get(sd->obj, EINA_TRUE); + + for (y = 0; y < (ih >> 1); y++) + { + p1 = data + (y * iw); + p2 = data + ((ih - 1 - y) * iw); + for (x = 0; x < iw; x++) + { + tmp = *p1; + *p1 = *p2; + *p2 = tmp; + p1++; + p2++; + } + } + + evas_object_image_data_set(sd->obj, data); + evas_object_image_data_update_add(sd->obj, 0, 0, iw, ih); + _smart_reconfigure(sd); +} + +static void +_els_smart_icon_rotate_180(Smart_Data *sd) +{ + unsigned int *data; + unsigned int *p1, *p2, tmp; + int x, hw, iw, ih; + + evas_object_image_size_get(sd->obj, &iw, &ih); + data = evas_object_image_data_get(sd->obj, 1); + + hw = iw * ih; + x = (hw / 2); + p1 = data; + p2 = data + hw - 1; + for (; --x > 0;) + { + tmp = *p1; + *p1 = *p2; + *p2 = tmp; + p1++; + p2--; + } + evas_object_image_data_set(sd->obj, data); + evas_object_image_data_update_add(sd->obj, 0, 0, iw, ih); + _smart_reconfigure(sd); +} + +static Eina_Bool +_els_smart_icon_dropcb(void *elmobj,Evas_Object *obj, Elm_Selection_Data *drop) +{ + _els_smart_icon_file_key_set(obj, drop->data, NULL); + evas_object_smart_callback_call(elmobj, "drop", drop->data); + + return EINA_TRUE; +} +/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-3f0^-2{2(0W1st0 :*/ diff --git a/libraries/elementary/src/lib/els_icon.h b/libraries/elementary/src/lib/els_icon.h new file mode 100644 index 0000000..787c5bf --- /dev/null +++ b/libraries/elementary/src/lib/els_icon.h @@ -0,0 +1,27 @@ +Evas_Object *_els_smart_icon_add(Evas *evas); +Eina_Bool _els_smart_icon_memfile_set(Evas_Object *obj, const void *file, size_t size, const char *format, const char *key); +Eina_Bool _els_smart_icon_file_key_set(Evas_Object *obj, const char *file, const char *key); +Eina_Bool _els_smart_icon_file_edje_set(Evas_Object *obj, const char *file, const char *part); +void _els_smart_icon_file_get(const Evas_Object *obj, const char **file, const char **key); +void _els_smart_icon_smooth_scale_set(Evas_Object *obj, Eina_Bool smooth); +Eina_Bool _els_smart_icon_smooth_scale_get(const Evas_Object *obj); +Evas_Object *_els_smart_icon_object_get(const Evas_Object *obj); +void _els_smart_icon_size_get(const Evas_Object *obj, int *w, int *h); +void _els_smart_icon_fill_inside_set(Evas_Object *obj, Eina_Bool fill_inside); +Eina_Bool _els_smart_icon_fill_inside_get(const Evas_Object *obj); +void _els_smart_icon_scale_up_set(Evas_Object *obj, Eina_Bool scale_up); +Eina_Bool _els_smart_icon_scale_up_get(const Evas_Object *obj); +void _els_smart_icon_scale_down_set(Evas_Object *obj, Eina_Bool scale_down); +Eina_Bool _els_smart_icon_scale_down_get(const Evas_Object *obj); +void _els_smart_icon_scale_size_set(Evas_Object *obj, int size); +int _els_smart_icon_scale_size_get(const Evas_Object *obj); +void _els_smart_icon_scale_set(Evas_Object *obj, double scale); +double _els_smart_icon_scale_get(const Evas_Object *obj); +void _els_smart_icon_orient_set(Evas_Object *obj, Elm_Image_Orient orient); +Elm_Image_Orient _els_smart_icon_orient_get(const Evas_Object *obj); +void _els_smart_icon_edit_set(Evas_Object *obj, Eina_Bool, Evas_Object *parent); +Eina_Bool _els_smart_icon_edit_get(const Evas_Object *obj); +Evas_Object *_els_smart_icon_edje_get(Evas_Object *obj); +void _els_smart_icon_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed); +Eina_Bool _els_smart_icon_aspect_fixed_get(const Evas_Object *obj); +void _els_smart_icon_preload_set(Evas_Object *obj, Eina_Bool disable); diff --git a/libraries/elementary/src/lib/els_pan.c b/libraries/elementary/src/lib/els_pan.c new file mode 100644 index 0000000..4e02b3d --- /dev/null +++ b/libraries/elementary/src/lib/els_pan.c @@ -0,0 +1,332 @@ +#include +#include "elm_priv.h" + +#define SMART_NAME "elm_pan" +#define API_ENTRY Smart_Data *sd; sd = evas_object_smart_data_get(obj); if ((!obj) || (!sd) || (evas_object_type_get(obj) && strcmp(evas_object_type_get(obj), SMART_NAME))) +#define INTERNAL_ENTRY Smart_Data *sd; sd = evas_object_smart_data_get(obj); if (!sd) return; +typedef struct _Smart_Data Smart_Data; + +struct _Smart_Data +{ + Evas_Object *smart_obj; + Evas_Object *child_obj; + Evas_Coord x, y, w, h; + Evas_Coord child_w, child_h, px, py; + double gravity_x, gravity_y; + Evas_Coord prev_cw, prev_ch, delta_posx, delta_posy; +}; + +/* local subsystem functions */ +static void _smart_child_del_hook(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _smart_child_resize_hook(void *data, Evas *e, Evas_Object *obj, void *event_info); + +static void _smart_reconfigure(Smart_Data *sd); +static void _smart_add(Evas_Object *obj); +static void _smart_del(Evas_Object *obj); +static void _smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y); +static void _smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h); +static void _smart_show(Evas_Object *obj); +static void _smart_hide(Evas_Object *obj); +static void _smart_color_set(Evas_Object *obj, int r, int g, int b, int a); +static void _smart_clip_set(Evas_Object *obj, Evas_Object * clip); +static void _smart_clip_unset(Evas_Object *obj); +static void _smart_init(void); + +/* local subsystem globals */ +static Evas_Smart *_smart = NULL; + +/* externally accessible functions */ +Evas_Object * +_elm_smart_pan_add(Evas *evas) +{ + _smart_init(); + return evas_object_smart_add(evas, _smart); +} + +void +_elm_smart_pan_child_set(Evas_Object *obj, Evas_Object *child) +{ + API_ENTRY return; + if (child == sd->child_obj) return; + if (sd->child_obj) + { + evas_object_clip_unset(sd->child_obj); + evas_object_smart_member_del(sd->child_obj); + evas_object_event_callback_del_full(sd->child_obj, EVAS_CALLBACK_FREE, _smart_child_del_hook, sd); + evas_object_event_callback_del_full(sd->child_obj, EVAS_CALLBACK_RESIZE, _smart_child_resize_hook, sd); + sd->child_obj = NULL; + } + if (child) + { + Evas_Coord w, h; + int r, g, b, a; + + sd->child_obj = child; + evas_object_smart_member_add(sd->child_obj, sd->smart_obj); + evas_object_geometry_get(sd->child_obj, NULL, NULL, &w, &h); + sd->child_w = w; + sd->child_h = h; + evas_object_event_callback_add(child, EVAS_CALLBACK_FREE, _smart_child_del_hook, sd); + evas_object_event_callback_add(child, EVAS_CALLBACK_RESIZE, _smart_child_resize_hook, sd); + evas_object_color_get(sd->smart_obj, &r, &g, &b, &a); + evas_object_color_set(sd->child_obj, r, g, b, a); + evas_object_clip_set(sd->child_obj, evas_object_clip_get(sd->smart_obj)); + if (evas_object_visible_get(sd->smart_obj)) evas_object_show(sd->child_obj); + else evas_object_hide(sd->child_obj); + _smart_reconfigure(sd); + } + evas_object_smart_callback_call(sd->smart_obj, "changed", NULL); +} + +Evas_Object * +_elm_smart_pan_child_get(Evas_Object *obj) +{ + API_ENTRY return NULL; + return sd->child_obj; +} + +void +_elm_smart_pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y) +{ + API_ENTRY return; + // if (x > (sd->child_w - sd->w)) x = sd->child_w - sd->w; + // if (y > (sd->child_h - sd->h)) y = sd->child_h - sd->h; + // if (x < 0) x = 0; + // if (y < 0) y = 0; + if ((x == sd->px) && (y == sd->py)) return; + sd->px = x; + sd->py = y; + _smart_reconfigure(sd); + evas_object_smart_callback_call(sd->smart_obj, "changed", NULL); +} + +void +_elm_smart_pan_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y) +{ + API_ENTRY return; + if (x) *x = sd->px; + if (y) *y = sd->py; +} + +void +_elm_smart_pan_max_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y) +{ + API_ENTRY return; + if (x) + { + if (sd->w < sd->child_w) *x = sd->child_w - sd->w; + else *x = 0; + } + if (y) + { + if (sd->h < sd->child_h) *y = sd->child_h - sd->h; + else *y = 0; + } +} + +void +_elm_smart_pan_min_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y) +{ + API_ENTRY return; + if (x) + *x = 0; + if (y) + *y = 0; +} + +void +_elm_smart_pan_child_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) +{ + API_ENTRY return; + if (w) *w = sd->child_w; + if (h) *h = sd->child_h; +} + +void +_elm_smart_pan_gravity_set(Evas_Object *obj, double x, double y) +{ + API_ENTRY return; + sd->gravity_x = x; + sd->gravity_y = y; + sd->prev_cw = sd->child_w; + sd->prev_ch = sd->child_h; + sd->delta_posx = 0; + sd->delta_posy = 0; +} + +void +_elm_smart_pan_gravity_get(Evas_Object *obj, double *x, double *y) +{ + API_ENTRY return; + if (x) *x = sd->gravity_x; + if (y) *y = sd->gravity_y; +} + +/* local subsystem functions */ +static void +_smart_child_del_hook(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Smart_Data *sd; + + sd = data; + sd->child_obj = NULL; + evas_object_smart_callback_call(sd->smart_obj, "changed", NULL); +} + +static void +_smart_child_resize_hook(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Smart_Data *sd; + Evas_Coord w, h; + + sd = data; + evas_object_geometry_get(sd->child_obj, NULL, NULL, &w, &h); + if ((w != sd->child_w) || (h != sd->child_h)) + { + sd->child_w = w; + sd->child_h = h; + _smart_reconfigure(sd); + } + evas_object_smart_callback_call(sd->smart_obj, "changed", NULL); +} + +static void +_smart_reconfigure(Smart_Data *sd) +{ + if (sd->gravity_x || sd->gravity_y) + { + if ((!sd->px) && (!sd->py)) + { + sd->px = sd->delta_posx*sd->gravity_x; + sd->py = sd->delta_posy*sd->gravity_y; + } + sd->delta_posx += sd->child_w - sd->prev_cw; + sd->prev_cw = sd->child_w; + sd->delta_posy += sd->child_h - sd->prev_ch; + sd->prev_ch = sd->child_h; + + evas_object_move(sd->child_obj, sd->x - sd->px, sd->y - sd->py); + sd->px = sd->delta_posx*sd->gravity_x; + sd->py = sd->delta_posy*sd->gravity_y; + + } + else + evas_object_move(sd->child_obj, sd->x - sd->px, sd->y - sd->py); +} + +static void +_smart_add(Evas_Object *obj) +{ + Smart_Data *sd; + + sd = calloc(1, sizeof(Smart_Data)); + if (!sd) return; + sd->smart_obj = obj; + sd->x = 0; + sd->y = 0; + sd->w = 0; + sd->h = 0; + sd->gravity_x = 0.0; + sd->gravity_y = 0.0; + evas_object_smart_data_set(obj, sd); +} + +static void +_smart_del(Evas_Object *obj) +{ + INTERNAL_ENTRY; + _elm_smart_pan_child_set(obj, NULL); + free(sd); +} + +static void +_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y) +{ + INTERNAL_ENTRY; + sd->x = x; + sd->y = y; + _smart_reconfigure(sd); +} + +static void +_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) +{ + INTERNAL_ENTRY; + sd->w = w; + sd->h = h; + _smart_reconfigure(sd); + evas_object_smart_callback_call(sd->smart_obj, "changed", NULL); +} + +static void +_smart_show(Evas_Object *obj) +{ + INTERNAL_ENTRY; + if (sd->child_obj) + evas_object_show(sd->child_obj); +} + +static void +_smart_hide(Evas_Object *obj) +{ + INTERNAL_ENTRY; + if (sd->child_obj) + evas_object_hide(sd->child_obj); +} + +static void +_smart_color_set(Evas_Object *obj, int r, int g, int b, int a) +{ + INTERNAL_ENTRY; + if (sd->child_obj) + evas_object_color_set(sd->child_obj, r, g, b, a); +} + +static void +_smart_clip_set(Evas_Object *obj, Evas_Object *clip) +{ + INTERNAL_ENTRY; + if (sd->child_obj) + evas_object_clip_set(sd->child_obj, clip); +} + +static void +_smart_clip_unset(Evas_Object *obj) +{ + INTERNAL_ENTRY; + if (sd->child_obj) + evas_object_clip_unset(sd->child_obj); +} + +/* never need to touch this */ + +static void +_smart_init(void) +{ + if (_smart) return; + { + static const Evas_Smart_Class sc = + { + SMART_NAME, + EVAS_SMART_CLASS_VERSION, + _smart_add, + _smart_del, + _smart_move, + _smart_resize, + _smart_show, + _smart_hide, + _smart_color_set, + _smart_clip_set, + _smart_clip_unset, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + }; + _smart = evas_smart_class_new(&sc); + } +} + diff --git a/libraries/elementary/src/lib/els_pan.h b/libraries/elementary/src/lib/els_pan.h new file mode 100644 index 0000000..568e74f --- /dev/null +++ b/libraries/elementary/src/lib/els_pan.h @@ -0,0 +1,10 @@ +Evas_Object *_elm_smart_pan_add(Evas *evas); +void _elm_smart_pan_child_set(Evas_Object *obj, Evas_Object *child); +Evas_Object *_elm_smart_pan_child_get(Evas_Object *obj); +void _elm_smart_pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y); +void _elm_smart_pan_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y); +void _elm_smart_pan_max_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y); +void _elm_smart_pan_min_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y); +void _elm_smart_pan_child_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h); +void _elm_smart_pan_gravity_set(Evas_Object *obj, double x, double y); +void _elm_smart_pan_gravity_get(Evas_Object *obj, double *x, double *y); diff --git a/libraries/elementary/src/lib/els_scroller.c b/libraries/elementary/src/lib/els_scroller.c new file mode 100644 index 0000000..82b2b8e --- /dev/null +++ b/libraries/elementary/src/lib/els_scroller.c @@ -0,0 +1,3000 @@ +#include +#include "elm_priv.h" +#include "els_scroller.h" +#include "els_pan.h" + +#define SMART_NAME "els_scroller" +#define API_ENTRY Smart_Data *sd; sd = evas_object_smart_data_get(obj); if ((!obj) || (!sd) || (evas_object_type_get(obj) && strcmp(evas_object_type_get(obj), SMART_NAME))) +#define INTERNAL_ENTRY Smart_Data *sd; sd = evas_object_smart_data_get(obj); if (!sd) return; +typedef struct _Smart_Data Smart_Data; + +#define EVTIME 1 +//#define SCROLLDBG 1 + +struct _Smart_Data +{ + Evas_Coord x, y, w, h; + Evas_Coord wx, wy, ww, wh; /* Last "wanted" geometry */ + + Evas_Object *smart_obj; + Evas_Object *child_obj; + Evas_Object *pan_obj; + Evas_Object *edje_obj; + Evas_Object *event_obj; + + Evas_Object *widget; + + Elm_Smart_Scroller_Policy hbar_flags, vbar_flags; + + struct + { + Evas_Coord x, y; + Evas_Coord sx, sy; + Evas_Coord dx, dy; + Evas_Coord pdx, pdy; + Evas_Coord bx, by; + Evas_Coord ax, ay; + Evas_Coord bx0, by0; + Evas_Coord b0x, b0y; + Evas_Coord b2x, b2y; + struct + { + Evas_Coord x, y; + double timestamp, localtimestamp; + } history[60]; + struct + { + double tadd, dxsum, dysum; + double est_timestamp_diff; + } hist; + double anim_start; + double anim_start2; + double anim_start3; + double onhold_vx, onhold_vy, onhold_tlast, onhold_vxe, onhold_vye; + double extra_time; + Evas_Coord hold_x, hold_y; + Ecore_Animator *hold_animator; + Ecore_Animator *onhold_animator; + Ecore_Animator *momentum_animator; + Ecore_Animator *bounce_x_animator; + Ecore_Animator *bounce_y_animator; + Evas_Coord locked_x, locked_y; + int hdir, vdir; + Eina_Bool now : 1; + Eina_Bool cancelled : 1; + Eina_Bool hold : 1; + Eina_Bool hold_parent : 1; + Eina_Bool want_dragged : 1; + Eina_Bool dragged : 1; + Eina_Bool dragged_began : 1; + Eina_Bool dir_x : 1; + Eina_Bool dir_y : 1; + Eina_Bool locked : 1; + Eina_Bool bounce_x_hold : 1; + Eina_Bool bounce_y_hold : 1; + Eina_Bool scroll : 1; + Eina_Bool want_reset : 1; + } down; + + struct + { + Evas_Coord w, h; + Eina_Bool resized : 1; + } child; + struct + { + Evas_Coord x, y; + } step, page; + + struct + { + void (*set) (Evas_Object *obj, Evas_Coord x, Evas_Coord y); + void (*get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y); + void (*max_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y); + void (*min_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y); + void (*child_size_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y); + void (*gravity_set) (Evas_Object *obj, double x, double y); + void (*gravity_get) (Evas_Object *obj, double *x, double *y); + } pan_func; + + struct + { + struct + { + Evas_Coord start, end; + double t_start, t_end; + Ecore_Animator *animator; + } x, y; + } scrollto; + + double pagerel_h, pagerel_v; + Evas_Coord pagesize_h, pagesize_v; + + Eina_Bool hbar_visible : 1; + Eina_Bool vbar_visible : 1; + Eina_Bool extern_pan : 1; + Eina_Bool one_dir_at_a_time : 1; + Eina_Bool hold : 1; + Eina_Bool freeze : 1; + Eina_Bool bouncemex : 1; + Eina_Bool bouncemey : 1; + Eina_Bool bounce_horiz : 1; + Eina_Bool bounce_vert : 1; + Eina_Bool momentum_animator_disabled :1; + Eina_Bool bounce_animator_disabled :1; + Eina_Bool is_mirrored : 1; + Eina_Bool wheel_disabled : 1; +}; + +/* local subsystem functions */ +static void _smart_child_del_hook(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _smart_pan_changed_hook(void *data, Evas_Object *obj, void *event_info); +static void _smart_event_wheel(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _smart_event_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); +static Eina_Bool _smart_hold_animator(void *data); +static Eina_Bool _smart_momentum_animator(void *data); +static void _smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); +static Eina_Bool _smart_onhold_animator(void *data); +static void _smart_event_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _smart_edje_drag_v_start(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _smart_edje_drag_v_stop(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _smart_edje_drag_v(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _smart_edje_drag_h_start(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _smart_edje_drag_h_stop(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _smart_edje_drag_h(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _smart_scrollbar_read(Smart_Data *sd); +static void _smart_scrollbar_reset(Smart_Data *sd); +static int _smart_scrollbar_bar_h_visibility_adjust(Smart_Data *sd); +static int _smart_scrollbar_bar_v_visibility_adjust(Smart_Data *sd); +static void _smart_scrollbar_bar_visibility_adjust(Smart_Data *sd); +static void _smart_scrollbar_size_adjust(Smart_Data *sd); +static void _smart_reconfigure(Smart_Data *sd); +static void _smart_add(Evas_Object *obj); +static void _smart_del(Evas_Object *obj); +static void _smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y); +static void _smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h); +static void _smart_show(Evas_Object *obj); +static void _smart_hide(Evas_Object *obj); +static void _smart_color_set(Evas_Object *obj, int r, int g, int b, int a); +static void _smart_clip_set(Evas_Object *obj, Evas_Object *clip); +static void _smart_clip_unset(Evas_Object *obj); +static void _smart_init(void); + +static void _elm_smart_scroller_wanted_region_set(Evas_Object *obj); + +/* local subsystem globals */ +static Evas_Smart *_smart = NULL; + +/* externally accessible functions */ +Evas_Object * +elm_smart_scroller_add(Evas *evas) +{ + _smart_init(); + return evas_object_smart_add(evas, _smart); +} + +static Evas_Coord +_elm_smart_scroller_x_mirrored_get(Evas_Object *obj, Evas_Coord x) +{ + API_ENTRY return x; + + Evas_Coord cw, ch, w, ret; + elm_smart_scroller_child_viewport_size_get(obj, &w, NULL); + sd->pan_func.child_size_get(sd->pan_obj, &cw, &ch); + ret = (cw - (x + w)); + return (ret >= 0) ? ret : 0; +} + +void +elm_smart_scroller_mirrored_set(Evas_Object *obj, Eina_Bool mirrored) +{ + API_ENTRY return; + Evas_Coord wx; + if (sd->is_mirrored == mirrored) + return; + + sd->is_mirrored = mirrored; + edje_object_mirrored_set(sd->edje_obj, mirrored); + + if (sd->is_mirrored) + wx = _elm_smart_scroller_x_mirrored_get(sd->smart_obj, sd->wx); + else + wx = sd->wx; + + elm_smart_scroller_child_pos_set(sd->smart_obj, wx, sd->wy); +} + +void +elm_smart_scroller_child_set(Evas_Object *obj, Evas_Object *child) +{ + Evas_Coord w, h; + Evas_Object *o; + + API_ENTRY return; + if (sd->child_obj) + { + _elm_smart_pan_child_set(sd->pan_obj, NULL); + evas_object_event_callback_del_full(sd->child_obj, EVAS_CALLBACK_DEL, _smart_child_del_hook, sd); + } + + sd->child_obj = child; + sd->wx = sd->wy = 0; + /* (-1) means want viewports size */ + sd->ww = sd->wh = -1; + if (!child) return; + + if (!sd->pan_obj) + { + o = _elm_smart_pan_add(evas_object_evas_get(obj)); + sd->pan_obj = o; + evas_object_smart_callback_add(o, "changed", _smart_pan_changed_hook, sd); + edje_object_part_swallow(sd->edje_obj, "elm.swallow.content", o); + } + + sd->pan_func.set = _elm_smart_pan_set; + sd->pan_func.get = _elm_smart_pan_get; + sd->pan_func.max_get = _elm_smart_pan_max_get; + sd->pan_func.min_get = _elm_smart_pan_min_get; + sd->pan_func.child_size_get = _elm_smart_pan_child_size_get; + sd->pan_func.gravity_set = _elm_smart_pan_gravity_set; + sd->pan_func.gravity_get = _elm_smart_pan_gravity_get; + + evas_object_event_callback_add(child, EVAS_CALLBACK_DEL, _smart_child_del_hook, sd); + _elm_smart_pan_child_set(sd->pan_obj, child); + sd->pan_func.child_size_get(sd->pan_obj, &w, &h); + sd->child.w = w; + sd->child.h = h; + _smart_scrollbar_size_adjust(sd); + _smart_scrollbar_reset(sd); +} + +void +elm_smart_scroller_extern_pan_set(Evas_Object *obj, Evas_Object *pan, + void (*pan_set) (Evas_Object *obj, Evas_Coord x, Evas_Coord y), + void (*pan_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y), + void (*pan_max_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y), + void (*pan_min_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y), + void (*pan_child_size_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)) +{ + API_ENTRY return; + + elm_smart_scroller_child_set(obj, NULL); + + if (sd->pan_obj) + { + evas_object_smart_callback_del(sd->pan_obj, "changed", _smart_pan_changed_hook); + } + + if (sd->extern_pan) + { + if (sd->pan_obj) + { + edje_object_part_unswallow(sd->edje_obj, sd->pan_obj); + sd->pan_obj = NULL; + } + } + else + { + if (sd->pan_obj) + { + evas_object_del(sd->pan_obj); + sd->pan_obj = NULL; + } + } + if (!pan) + { + sd->extern_pan = EINA_FALSE; + return; + } + + sd->pan_obj = pan; + sd->pan_func.set = pan_set; + sd->pan_func.get = pan_get; + sd->pan_func.max_get = pan_max_get; + sd->pan_func.min_get = pan_min_get; + sd->pan_func.child_size_get = pan_child_size_get; + sd->pan_func.gravity_set = _elm_smart_pan_gravity_set; + sd->pan_func.gravity_get = _elm_smart_pan_gravity_get; + sd->extern_pan = EINA_TRUE; + evas_object_smart_callback_add(sd->pan_obj, "changed", _smart_pan_changed_hook, sd); + edje_object_part_swallow(sd->edje_obj, "elm.swallow.content", sd->pan_obj); + evas_object_show(sd->pan_obj); +} + +void +elm_smart_scroller_custom_edje_file_set(Evas_Object *obj, char *file, char *group) +{ + API_ENTRY return; + + edje_object_file_set(sd->edje_obj, file, group); + if (sd->pan_obj) + edje_object_part_swallow(sd->edje_obj, "elm.swallow.content", sd->pan_obj); + sd->vbar_visible = !sd->vbar_visible; + sd->hbar_visible = !sd->hbar_visible; + _smart_scrollbar_bar_visibility_adjust(sd); + if (sd->hbar_flags == ELM_SMART_SCROLLER_POLICY_ON) + edje_object_signal_emit(sd->edje_obj, "elm,action,show_always,hbar", "elm"); + else if (sd->hbar_flags == ELM_SMART_SCROLLER_POLICY_OFF) + edje_object_signal_emit(sd->edje_obj, "elm,action,hide,hbar", "elm"); + else + edje_object_signal_emit(sd->edje_obj, "elm,action,show_notalways,hbar", "elm"); + if (sd->vbar_flags == ELM_SMART_SCROLLER_POLICY_ON) + edje_object_signal_emit(sd->edje_obj, "elm,action,show_always,vbar", "elm"); + else if (sd->vbar_flags == ELM_SMART_SCROLLER_POLICY_OFF) + edje_object_signal_emit(sd->edje_obj, "elm,action,hide,vbar", "elm"); + else + edje_object_signal_emit(sd->edje_obj, "elm,action,show_notalways,vbar", "elm"); +} + +Eina_Bool +elm_smart_scroller_momentum_animator_disabled_get(Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + return sd->momentum_animator_disabled; +} + +void +elm_smart_scroller_momentum_animator_disabled_set(Evas_Object *obj, Eina_Bool disabled) +{ + API_ENTRY return; + sd->momentum_animator_disabled = disabled; + if (sd->momentum_animator_disabled) + { + if (sd->down.momentum_animator) + { + ecore_animator_del(sd->down.momentum_animator); + sd->down.momentum_animator = NULL; + if (sd->child.resized) + _elm_smart_scroller_wanted_region_set(sd->smart_obj); + } + } +} + +Eina_Bool +elm_smart_scroller_bounce_animator_disabled_get(Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + return sd->bounce_animator_disabled; +} + +void +elm_smart_scroller_bounce_animator_disabled_set(Evas_Object *obj, Eina_Bool disabled) +{ + API_ENTRY return; + sd->bounce_animator_disabled = disabled; + if (sd->bounce_animator_disabled) + { + if (sd->scrollto.x.animator) + { + ecore_animator_del(sd->scrollto.x.animator); + sd->scrollto.x.animator = NULL; + } + + if (sd->scrollto.y.animator) + { + ecore_animator_del(sd->scrollto.y.animator); + sd->scrollto.y.animator = NULL; + } + } +} + +Eina_Bool +elm_smart_scroller_wheel_disabled_get(Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + return sd->wheel_disabled; +} + +void +elm_smart_scroller_wheel_disabled_set(Evas_Object *obj, Eina_Bool disabled) +{ + API_ENTRY return; + if ((!sd->wheel_disabled) && (disabled)) + evas_object_event_callback_del_full(sd->event_obj, EVAS_CALLBACK_MOUSE_WHEEL, _smart_event_wheel, sd); + else if ((sd->wheel_disabled) && (!disabled)) + evas_object_event_callback_add(sd->event_obj, EVAS_CALLBACK_MOUSE_WHEEL, _smart_event_wheel, sd); + sd->wheel_disabled = disabled; +} + +/* Update the wanted coordinates according to the x, y passed + * widget directionality, child size and etc. */ +static void +_update_wanted_coordinates(Smart_Data *sd, Evas_Coord x, Evas_Coord y) +{ + Evas_Coord cw, ch; + + sd->pan_func.child_size_get(sd->pan_obj, &cw, &ch); + + /* Update wx/y/w/h - and if the requested positions aren't legal + * adjust a bit. */ + elm_smart_scroller_child_viewport_size_get(sd->smart_obj, &sd->ww, &sd->wh); + if (x < 0) + sd->wx = 0; + else if ((x + sd->ww) > cw) + sd->wx = cw - sd->ww; + else if (sd->is_mirrored) + sd->wx = _elm_smart_scroller_x_mirrored_get(sd->smart_obj, x); + else + sd->wx = x; + if (y < 0) sd->wy = 0; + else if ((y + sd->wh) > ch) sd->wy = ch - sd->wh; + else sd->wy = y; +} + +static void +_smart_anim_start(Evas_Object *obj) +{ + evas_object_smart_callback_call(obj, "animate,start", NULL); +} + +static void +_smart_anim_stop(Evas_Object *obj) +{ + evas_object_smart_callback_call(obj, "animate,stop", NULL); +} + +static void +_smart_drag_start(Evas_Object *obj) +{ + evas_object_smart_callback_call(obj, "drag,start", NULL); +} + +static void +_smart_drag_stop(Evas_Object *obj) +{ + evas_object_smart_callback_call(obj, "drag,stop", NULL); +} + +static Eina_Bool +_smart_scrollto_x_animator(void *data) +{ + Smart_Data *sd = data; + Evas_Coord px, py; + double t, tt; + + t = ecore_loop_time_get(); + tt = (t - sd->scrollto.x.t_start) / (sd->scrollto.x.t_end - sd->scrollto.x.t_start); + tt = 1.0 - tt; + tt = 1.0 - (tt * tt); + sd->pan_func.get(sd->pan_obj, &px, &py); + px = (sd->scrollto.x.start * (1.0 - tt)) + + (sd->scrollto.x.end * tt); + if (t >= sd->scrollto.x.t_end) + { + px = sd->scrollto.x.end; + elm_smart_scroller_child_pos_set(sd->smart_obj, px, py); + sd->down.sx = px; + sd->down.x = sd->down.history[0].x; + _update_wanted_coordinates(sd, px, py); + sd->scrollto.x.animator = NULL; + if ((!sd->scrollto.y.animator) && (!sd->down.bounce_y_animator)) + _smart_anim_stop(sd->smart_obj); + return ECORE_CALLBACK_CANCEL; + } + elm_smart_scroller_child_pos_set(sd->smart_obj, px, py); + _update_wanted_coordinates(sd, px, py); + return ECORE_CALLBACK_RENEW; +} + +static void +_smart_momentum_end(Smart_Data *sd) +{ + if ((sd->down.bounce_x_animator) || (sd->down.bounce_y_animator)) return; + if (sd->down.momentum_animator) + { + Evas_Coord px, py; + elm_smart_scroller_child_pos_get(sd->smart_obj, &px, &py); + _update_wanted_coordinates(sd, px, py); + + ecore_animator_del(sd->down.momentum_animator); + sd->down.momentum_animator = NULL; + sd->down.bounce_x_hold = EINA_FALSE; + sd->down.bounce_y_hold = EINA_FALSE; + sd->down.ax = 0; + sd->down.ay = 0; + sd->down.dx = 0; + sd->down.dy = 0; + sd->down.pdx = 0; + sd->down.pdy = 0; + if (sd->child.resized) + _elm_smart_scroller_wanted_region_set(sd->smart_obj); + } +} + +static void +_smart_scrollto_x(Smart_Data *sd, double t_in, Evas_Coord pos_x) +{ + Evas_Coord px, py, x, y, w, h; + double t; + + if (sd->freeze) return; + if (t_in <= 0.0) + { + elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y); + elm_smart_scroller_child_viewport_size_get(sd->smart_obj, &w, &h); + x = pos_x; + elm_smart_scroller_child_region_set(sd->smart_obj, x, y, w, h); + return; + } + t = ecore_loop_time_get(); + sd->pan_func.get(sd->pan_obj, &px, &py); + sd->scrollto.x.start = px; + sd->scrollto.x.end = pos_x; + sd->scrollto.x.t_start = t; + sd->scrollto.x.t_end = t + t_in; + if (!sd->scrollto.x.animator) + { + sd->scrollto.x.animator = ecore_animator_add(_smart_scrollto_x_animator, sd); + if (!sd->scrollto.y.animator) + _smart_anim_start(sd->smart_obj); + } + if (sd->down.bounce_x_animator) + { + ecore_animator_del(sd->down.bounce_x_animator); + sd->down.bounce_x_animator = NULL; + _smart_momentum_end(sd); + if (sd->child.resized) + _elm_smart_scroller_wanted_region_set(sd->smart_obj); + } + sd->bouncemex = EINA_FALSE; +} + +static Eina_Bool +_smart_scrollto_y_animator(void *data) +{ + Smart_Data *sd = data; + Evas_Coord px, py; + double t, tt; + + t = ecore_loop_time_get(); + tt = (t - sd->scrollto.y.t_start) / (sd->scrollto.y.t_end - sd->scrollto.y.t_start); + tt = 1.0 - tt; + tt = 1.0 - (tt * tt); + sd->pan_func.get(sd->pan_obj, &px, &py); + py = (sd->scrollto.y.start * (1.0 - tt)) + + (sd->scrollto.y.end * tt); + if (t >= sd->scrollto.y.t_end) + { + py = sd->scrollto.y.end; + elm_smart_scroller_child_pos_set(sd->smart_obj, px, py); + sd->down.sy = py; + sd->down.y = sd->down.history[0].y; + _update_wanted_coordinates(sd, px, py); + sd->scrollto.y.animator = NULL; + if ((!sd->scrollto.x.animator) && (!sd->down.bounce_x_animator)) + _smart_anim_stop(sd->smart_obj); + return ECORE_CALLBACK_CANCEL; + } + elm_smart_scroller_child_pos_set(sd->smart_obj, px, py); + _update_wanted_coordinates(sd, px, py); + + return ECORE_CALLBACK_RENEW; +} + +static void +_smart_scrollto_y(Smart_Data *sd, double t_in, Evas_Coord pos_y) +{ + Evas_Coord px, py, x, y, w, h; + double t; + + if (sd->freeze) return; + if (t_in <= 0.0) + { + elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y); + elm_smart_scroller_child_viewport_size_get(sd->smart_obj, &w, &h); + y = pos_y; + elm_smart_scroller_child_region_set(sd->smart_obj, x, y, w, h); + return; + } + t = ecore_loop_time_get(); + sd->pan_func.get(sd->pan_obj, &px, &py); + sd->scrollto.y.start = py; + sd->scrollto.y.end = pos_y; + sd->scrollto.y.t_start = t; + sd->scrollto.y.t_end = t + t_in; + if (!sd->scrollto.y.animator) + { + sd->scrollto.y.animator = ecore_animator_add(_smart_scrollto_y_animator, sd); + if (!sd->scrollto.x.animator) + _smart_anim_start(sd->smart_obj); + } + if (sd->down.bounce_y_animator) + { + ecore_animator_del(sd->down.bounce_y_animator); + sd->down.bounce_y_animator = NULL; + _smart_momentum_end(sd); + if (sd->child.resized) + _elm_smart_scroller_wanted_region_set(sd->smart_obj); + } + sd->bouncemey = EINA_FALSE; +} + +static Eina_Bool +_smart_do_page(Smart_Data *sd) +{ + if ((sd->pagerel_h == 0.0) && (!sd->pagesize_h) && + (sd->pagerel_v == 0.0) && (!sd->pagesize_v)) + return EINA_FALSE; + return EINA_TRUE; +} + +static Evas_Coord +_smart_page_x_get(Smart_Data *sd, int offset) +{ + Evas_Coord x, y, w, h, cw, ch, minx = 0; + + elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y); + elm_smart_scroller_child_viewport_size_get(sd->smart_obj, &w, &h); + sd->pan_func.child_size_get(sd->pan_obj, &cw, &ch); + sd->pan_func.min_get(sd->pan_obj, &minx, NULL); + + x += offset; + + if (sd->pagerel_h > 0.0) + sd->pagesize_h = w * sd->pagerel_h; + if (sd->pagesize_h > 0) + { + x = x + (sd->pagesize_h * 0.5); + x = x / (sd->pagesize_h); + x = x * (sd->pagesize_h); + } + if ((x + w) > cw) x = cw - w; + if (x < minx) x = minx; + return x; +} + +static Evas_Coord +_smart_page_y_get(Smart_Data *sd, int offset) +{ + Evas_Coord x, y, w, h, cw, ch, miny = 0; + + elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y); + elm_smart_scroller_child_viewport_size_get(sd->smart_obj, &w, &h); + sd->pan_func.child_size_get(sd->pan_obj, &cw, &ch); + sd->pan_func.min_get(sd->pan_obj, NULL, &miny); + + y += offset; + + if (sd->pagerel_v > 0.0) + sd->pagesize_v = h * sd->pagerel_v; + if (sd->pagesize_v > 0) + { + y = y + (sd->pagesize_v * 0.5); + y = y / (sd->pagesize_v); + y = y * (sd->pagesize_v); + } + if ((y + h) > ch) y = ch - h; + if (y < miny) y = miny; + return y; +} + +static void +_smart_page_adjust(Smart_Data *sd) +{ + Evas_Coord x, y, w, h; + + if (!_smart_do_page(sd)) return; + + elm_smart_scroller_child_viewport_size_get(sd->smart_obj, &w, &h); + + x = _smart_page_x_get(sd, 0); + y = _smart_page_y_get(sd, 0); + + elm_smart_scroller_child_region_set(sd->smart_obj, x, y, w, h); +} + +static Eina_Bool +_smart_bounce_x_animator(void *data) +{ + Smart_Data *sd; + Evas_Coord x, y, dx, w, odx, ed, md; + double t, p, dt, pd, r; + + sd = data; + t = ecore_loop_time_get(); + dt = t - sd->down.anim_start2; + if (dt >= 0.0) + { + dt = dt / _elm_config->thumbscroll_bounce_friction; + odx = sd->down.b2x - sd->down.bx; + elm_smart_scroller_child_viewport_size_get(sd->smart_obj, &w, NULL); + if (!sd->down.momentum_animator && (w > abs(odx))) + { + pd = (double)odx / (double)w; + pd = (pd > 0) ? pd : -pd; + pd = 1.0 - ((1.0 - pd) * (1.0 - pd)); + dt = dt / pd; + } + if (dt > 1.0) dt = 1.0; + p = 1.0 - ((1.0 - dt) * (1.0 - dt)); + elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y); + dx = (odx * p); + r = 1.0; + if (sd->down.momentum_animator) + { + ed = abs(sd->down.dx * (_elm_config->thumbscroll_friction + sd->down.extra_time) - sd->down.b0x); + md = abs(_elm_config->thumbscroll_friction * 5 * w); + if (ed > md) r = (double)(md)/(double)ed; + } + x = sd->down.b2x + (int)((double)(dx - odx) * r); + if (!sd->down.cancelled) + elm_smart_scroller_child_pos_set(sd->smart_obj, x, y); + if (dt >= 1.0) + { + if (sd->down.momentum_animator) + sd->down.bounce_x_hold = EINA_TRUE; + if ((!sd->down.bounce_y_animator) && + (!sd->scrollto.y.animator)) + _smart_anim_stop(sd->smart_obj); + sd->down.bounce_x_animator = NULL; + sd->down.pdx = 0; + sd->bouncemex = EINA_FALSE; + _smart_momentum_end(sd); + if (sd->child.resized) + _elm_smart_scroller_wanted_region_set(sd->smart_obj); + return ECORE_CALLBACK_CANCEL; + } + } + return ECORE_CALLBACK_RENEW; +} + +static Eina_Bool +_smart_bounce_y_animator(void *data) +{ + Smart_Data *sd; + Evas_Coord x, y, dy, h, ody, ed, md; + double t, p, dt, pd, r; + + sd = data; + t = ecore_loop_time_get(); + dt = t - sd->down.anim_start3; + if (dt >= 0.0) + { + dt = dt / _elm_config->thumbscroll_bounce_friction; + ody = sd->down.b2y - sd->down.by; + elm_smart_scroller_child_viewport_size_get(sd->smart_obj, NULL, &h); + if (!sd->down.momentum_animator && (h > abs(ody))) + { + pd = (double)ody / (double)h; + pd = (pd > 0) ? pd : -pd; + pd = 1.0 - ((1.0 - pd) * (1.0 - pd)); + dt = dt / pd; + } + if (dt > 1.0) dt = 1.0; + p = 1.0 - ((1.0 - dt) * (1.0 - dt)); + elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y); + dy = (ody * p); + r = 1.0; + if (sd->down.momentum_animator) + { + ed = abs(sd->down.dy * (_elm_config->thumbscroll_friction + sd->down.extra_time) - sd->down.b0y); + md = abs(_elm_config->thumbscroll_friction * 5 * h); + if (ed > md) r = (double)(md)/(double)ed; + } + y = sd->down.b2y + (int)((double)(dy - ody) * r); + if (!sd->down.cancelled) + elm_smart_scroller_child_pos_set(sd->smart_obj, x, y); + if (dt >= 1.0) + { + if (sd->down.momentum_animator) + sd->down.bounce_y_hold = EINA_TRUE; + if ((!sd->down.bounce_x_animator) && + (!sd->scrollto.y.animator)) + _smart_anim_stop(sd->smart_obj); + sd->down.bounce_y_animator = NULL; + sd->down.pdy = 0; + sd->bouncemey = EINA_FALSE; + _smart_momentum_end(sd); + if (sd->child.resized) + _elm_smart_scroller_wanted_region_set(sd->smart_obj); + return ECORE_CALLBACK_CANCEL; + } + } + return ECORE_CALLBACK_RENEW; +} + +#define LEFT 0 +#define RIGHT 1 +#define UP 2 +#define DOWN 3 +static Eina_Bool +can_scroll(Smart_Data *sd, int dir) +{ + Evas_Coord mx = 0, my = 0, px = 0, py = 0, minx = 0, miny = 0; + + sd->pan_func.max_get(sd->pan_obj, &mx, &my); + sd->pan_func.min_get(sd->pan_obj, &minx, &miny); + sd->pan_func.get(sd->pan_obj, &px, &py); + switch (dir) + { + case LEFT: + if (px > minx) return EINA_TRUE; + break; + case RIGHT: + if ((px - minx) < mx) return EINA_TRUE; + break; + case UP: + if (py > miny) return EINA_TRUE; + break; + case DOWN: + if ((py - miny) < my) return EINA_TRUE; + break; + default: + break; + } + return EINA_FALSE; +} + +static Eina_Bool +_smart_momentum_animator(void *data) +{ + Smart_Data *sd; + double t, dt, p; + Evas_Coord x, y, dx, dy, px, py, maxx, maxy, minx, miny; + Eina_Bool no_bounce_x_end = EINA_FALSE, no_bounce_y_end = EINA_FALSE; + + sd = data; + t = ecore_loop_time_get(); + dt = t - sd->down.anim_start; + if (dt >= 0.0) + { + /* + if (sd->down.hold_parent) + { + if ((sd->down.dir_x) && !can_scroll(sd, sd->down.hdir)) + { + sd->down.dir_x = 0; + } + if ((sd->down.dir_y) && !can_scroll(sd, sd->down.vdir)) + { + sd->down.dir_y = 0; + } + } + if ((!sd->down.dir_x) && (!sd->down.dir_y)) + { + sd->down.cancelled = 1; + } + */ + dt = dt / (_elm_config->thumbscroll_friction + sd->down.extra_time); + if (dt > 1.0) dt = 1.0; + p = 1.0 - ((1.0 - dt) * (1.0 - dt)); + dx = (sd->down.dx * (_elm_config->thumbscroll_friction + sd->down.extra_time) * p); + dy = (sd->down.dy * (_elm_config->thumbscroll_friction + sd->down.extra_time) * p); + sd->down.ax = dx; + sd->down.ay = dy; + x = sd->down.sx - dx; + y = sd->down.sy - dy; + elm_smart_scroller_child_pos_get(sd->smart_obj, &px, &py); + if ((sd->down.bounce_x_animator) || + (sd->down.bounce_x_hold)) + { + sd->down.bx = sd->down.bx0 - dx + sd->down.b0x; + x = px; + } + if ((sd->down.bounce_y_animator) || + (sd->down.bounce_y_hold)) + { + sd->down.by = sd->down.by0 - dy + sd->down.b0y; + y = py; + } + elm_smart_scroller_child_pos_set(sd->smart_obj, x, y); + _update_wanted_coordinates(sd, x, y); + sd->pan_func.max_get(sd->pan_obj, &maxx, &maxy); + sd->pan_func.min_get(sd->pan_obj, &minx, &miny); + if (!sd->bounce_horiz) + { + if (x <= minx) no_bounce_x_end = EINA_TRUE; + if ((x - minx) >= maxx) no_bounce_x_end = EINA_TRUE; + } + if (!sd->bounce_vert) + { + if (y <= miny) no_bounce_y_end = EINA_TRUE; + if ((y - miny) >= maxy) no_bounce_y_end = EINA_TRUE; + } + if ((dt >= 1.0) || + ((sd->down.bounce_x_hold) && (sd->down.bounce_y_hold)) || + (no_bounce_x_end && no_bounce_y_end)) + { + _smart_anim_stop(sd->smart_obj); + + sd->down.momentum_animator = NULL; + sd->down.bounce_x_hold = EINA_FALSE; + sd->down.bounce_y_hold = EINA_FALSE; + sd->down.ax = 0; + sd->down.ay = 0; + sd->down.pdx = 0; + sd->down.pdy = 0; + if (sd->child.resized) + _elm_smart_scroller_wanted_region_set(sd->smart_obj); + return ECORE_CALLBACK_CANCEL; + } + } + return ECORE_CALLBACK_RENEW; +} + +static void +bounce_eval(Smart_Data *sd) +{ + Evas_Coord mx, my, px, py, bx, by, b2x, b2y, minx = 0, miny = 0; + + if (sd->freeze) return; + if ((!sd->bouncemex) && (!sd->bouncemey)) return; + if (sd->down.now) return; // down bounce while still held down + if (sd->down.onhold_animator) + { + ecore_animator_del(sd->down.onhold_animator); + sd->down.onhold_animator = NULL; + if (sd->child.resized) + _elm_smart_scroller_wanted_region_set(sd->smart_obj); + } + if (sd->down.hold_animator) + { + ecore_animator_del(sd->down.hold_animator); + sd->down.hold_animator = NULL; + if (sd->child.resized) + _elm_smart_scroller_wanted_region_set(sd->smart_obj); + } + sd->pan_func.max_get(sd->pan_obj, &mx, &my); + sd->pan_func.min_get(sd->pan_obj, &minx, &miny); + sd->pan_func.get(sd->pan_obj, &px, &py); + bx = px; + by = py; + if (px < minx) px = minx; + if ((px - minx) > mx) px = mx + minx; + if (py < miny) py = miny; + if ((py - miny) > my) py = my + miny; + b2x = px; + b2y = py; + if ((!sd->widget) || + (!elm_widget_drag_child_locked_x_get(sd->widget))) + { + if ((!sd->down.bounce_x_animator) && (!sd->bounce_animator_disabled)) + { + if (sd->bouncemex) + { + if (sd->scrollto.x.animator) + { + ecore_animator_del(sd->scrollto.x.animator); + sd->scrollto.x.animator = NULL; + } + sd->down.bounce_x_animator = ecore_animator_add(_smart_bounce_x_animator, sd); + sd->down.anim_start2 = ecore_loop_time_get(); + sd->down.bx = bx; + sd->down.bx0 = bx; + sd->down.b2x = b2x; + if (sd->down.momentum_animator) sd->down.b0x = sd->down.ax; + else sd->down.b0x = 0; + } + } + } + if ((!sd->widget) || + (!elm_widget_drag_child_locked_y_get(sd->widget))) + { + if ((!sd->down.bounce_y_animator) && (!sd->bounce_animator_disabled)) + { + if (sd->bouncemey) + { + if (sd->scrollto.y.animator) + { + ecore_animator_del(sd->scrollto.y.animator); + sd->scrollto.y.animator = NULL; + } + sd->down.bounce_y_animator = ecore_animator_add(_smart_bounce_y_animator, sd); + sd->down.anim_start3 = ecore_loop_time_get(); + sd->down.by = by; + sd->down.by0 = by; + sd->down.b2y = b2y; + if (sd->down.momentum_animator) sd->down.b0y = sd->down.ay; + else sd->down.b0y = 0; + } + } + } +} + +void +elm_smart_scroller_child_pos_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y) +{ + Evas_Coord mx = 0, my = 0, px = 0, py = 0, minx = 0, miny = 0; + double vx, vy; + + API_ENTRY return; + // FIXME: allow for bounce outside of range + sd->pan_func.max_get(sd->pan_obj, &mx, &my); + sd->pan_func.min_get(sd->pan_obj, &minx, &miny); + if (mx > 0) vx = (double)(x - minx) / (double)mx; + else vx = 0.0; + if (vx < 0.0) vx = 0.0; + else if (vx > 1.0) vx = 1.0; + if (my > 0) vy = (double)(y - miny) / (double)my; + else vy = 0.0; + if (vy < 0.0) vy = 0.0; + else if (vy > 1.0) vy = 1.0; + edje_object_part_drag_value_set(sd->edje_obj, "elm.dragable.vbar", 0.0, vy); + edje_object_part_drag_value_set(sd->edje_obj, "elm.dragable.hbar", vx, 0.0); + sd->pan_func.get(sd->pan_obj, &px, &py); + if (!_elm_config->thumbscroll_bounce_enable) + { + if (x < minx) x = minx; + if ((x - minx) > mx) x = mx + minx; + if (y < miny) y = miny; + if ((y - miny) > my) y = my + miny; + } + + if (!sd->bounce_horiz) + { + if (x < minx) x = minx; + if ((x - minx) > mx) x = mx + minx; + } + if (!sd->bounce_vert) + { + if (y < miny) y = miny; + if (y - miny > my) y = my + miny; + } + + sd->pan_func.set(sd->pan_obj, x, y); + if ((px != x) || (py != y)) + edje_object_signal_emit(sd->edje_obj, "elm,action,scroll", "elm"); + if (!sd->down.bounce_x_animator) + { + if (((x < minx) && (0 <= sd->down.dx)) || + ((x > (mx + minx)) && (0 >= sd->down.dx))) + { + sd->bouncemex = EINA_TRUE; + bounce_eval(sd); + } + else + sd->bouncemex = EINA_FALSE; + } + if (!sd->down.bounce_y_animator) + { + if (((y < miny) && (0 <= sd->down.dy)) || + ((y > (my + miny)) && (0 >= sd->down.dy))) + { + sd->bouncemey = EINA_TRUE; + bounce_eval(sd); + } + else + sd->bouncemey = EINA_FALSE; + } + if ((x != px) || (y != py)) + { + evas_object_smart_callback_call(obj, "scroll", NULL); + } + if ((x != px)/* && (!sd->bouncemex)*/) + { + if (x == minx) + evas_object_smart_callback_call(obj, "edge,left", NULL); + if (x == (mx + minx)) + evas_object_smart_callback_call(obj, "edge,right", NULL); + } + if ((y != py)/* && (!sd->bouncemey)*/) + { + if (y == miny) + evas_object_smart_callback_call(obj, "edge,top", NULL); + if (y == my + miny) + evas_object_smart_callback_call(obj, "edge,bottom", NULL); + } +} + +void +elm_smart_scroller_child_pos_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y) +{ + API_ENTRY return; + sd->pan_func.get(sd->pan_obj, x, y); +} + +/* returns TRUE when we need to move the scroller, FALSE otherwise. + * Updates w and h either way, so save them if you need them. */ +static Eina_Bool +_elm_smart_scroller_child_region_show_internal(Evas_Object *obj, Evas_Coord *_x, Evas_Coord *_y, Evas_Coord w, Evas_Coord h) +{ + Evas_Coord mx = 0, my = 0, cw = 0, ch = 0, px = 0, py = 0, nx, ny, minx = 0, miny = 0, pw = 0, ph = 0, x = *_x, y = *_y; + + API_ENTRY return EINA_FALSE; + sd->pan_func.max_get(sd->pan_obj, &mx, &my); + sd->pan_func.min_get(sd->pan_obj, &minx, &miny); + sd->pan_func.child_size_get(sd->pan_obj, &cw, &ch); + sd->pan_func.get(sd->pan_obj, &px, &py); + evas_object_geometry_get(sd->pan_obj, NULL, NULL, &pw, &ph); + + nx = px; + if ((x < px) && ((x + w) < (px + (cw - mx)))) nx = x; + else if ((x > px) && ((x + w) > (px + (cw - mx)))) nx = x + w - (cw - mx); + ny = py; + if ((y < py) && ((y + h) < (py + (ch - my)))) ny = y; + else if ((y > py) && ((y + h) > (py + (ch - my)))) ny = y + h - (ch - my); + + if ((sd->down.bounce_x_animator) || (sd->down.bounce_y_animator) || + (sd->scrollto.x.animator) || (sd->scrollto.y.animator)) + { + _smart_anim_stop(sd->smart_obj); + } + if (sd->scrollto.x.animator) + { + ecore_animator_del(sd->scrollto.x.animator); + sd->scrollto.x.animator = NULL; + } + if (sd->scrollto.y.animator) + { + ecore_animator_del(sd->scrollto.y.animator); + sd->scrollto.y.animator = NULL; + } + if (sd->down.bounce_x_animator) + { + ecore_animator_del(sd->down.bounce_x_animator); + sd->down.bounce_x_animator = NULL; + sd->bouncemex = EINA_FALSE; + if (sd->child.resized) + _elm_smart_scroller_wanted_region_set(sd->smart_obj); + } + if (sd->down.bounce_y_animator) + { + ecore_animator_del(sd->down.bounce_y_animator); + sd->down.bounce_y_animator = NULL; + sd->bouncemey = EINA_FALSE; + if (sd->child.resized) + _elm_smart_scroller_wanted_region_set(sd->smart_obj); + } + if (sd->down.hold_animator) + { + ecore_animator_del(sd->down.hold_animator); + sd->down.hold_animator = NULL; + _smart_drag_stop(sd->smart_obj); + if (sd->child.resized) + _elm_smart_scroller_wanted_region_set(sd->smart_obj); + } + if (sd->down.momentum_animator) + { + ecore_animator_del(sd->down.momentum_animator); + sd->down.momentum_animator = NULL; + sd->down.bounce_x_hold = EINA_FALSE; + sd->down.bounce_y_hold = EINA_FALSE; + sd->down.ax = 0; + sd->down.ay = 0; + sd->down.pdx = 0; + sd->down.pdy = 0; + if (sd->child.resized) + _elm_smart_scroller_wanted_region_set(sd->smart_obj); + } + + x = nx; + if ((x + pw) > cw) x = cw - pw; + if (x < minx) x = minx; + y = ny; + if ((y + ph) > ch) y = ch - ph; + if (y < miny) y = miny; + + if ((x == px) && (y == py)) return EINA_FALSE; + *_x = x; + *_y = y; + return EINA_TRUE; +} + +/* Set should be used for calculated positions, for example, when we move + * because of an animation or because this is the correct position after + * constraints. */ +void +elm_smart_scroller_child_region_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) +{ + API_ENTRY return; + if (_elm_smart_scroller_child_region_show_internal(obj, &x, &y, w, h)) + { + elm_smart_scroller_child_pos_set(obj, x, y); + sd->down.sx = x; + sd->down.sy = y; + sd->down.x = sd->down.history[0].x; + sd->down.y = sd->down.history[0].y; + } +} + +/* Set should be used for setting the wanted position, for example a user scroll + * or moving the cursor in an entry. */ +void +elm_smart_scroller_child_region_show(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) +{ + API_ENTRY return; + sd->wx = x; + sd->wy = y; + sd->ww = w; + sd->wh = h; + if (_elm_smart_scroller_child_region_show_internal(obj, &x, &y, w, h)) + { + elm_smart_scroller_child_pos_set(obj, x, y); + sd->down.sx = x; + sd->down.sy = y; + sd->down.x = sd->down.history[0].x; + sd->down.y = sd->down.history[0].y; + } +} + +void +elm_smart_scroller_child_viewport_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) +{ + API_ENTRY return; + if (!sd->pan_obj) return; + edje_object_calc_force(sd->edje_obj); + evas_object_geometry_get(sd->pan_obj, NULL, NULL, w, h); +} + +void +elm_smart_scroller_step_size_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y) +{ + API_ENTRY return; + if (x < 1) x = 1; + if (y < 1) y = 1; + sd->step.x = x; + sd->step.y = y; + _smart_scrollbar_size_adjust(sd); +} + +void +elm_smart_scroller_step_size_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y) +{ + API_ENTRY return; + if (x) *x = sd->step.x; + if (y) *y = sd->step.y; +} + +void +elm_smart_scroller_page_size_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y) +{ + API_ENTRY return; + sd->page.x = x; + sd->page.y = y; + _smart_scrollbar_size_adjust(sd); +} + +void +elm_smart_scroller_page_size_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y) +{ + API_ENTRY return; + if (x) *x = sd->page.x; + if (y) *y = sd->page.y; +} + +void +elm_smart_scroller_policy_set(Evas_Object *obj, Elm_Smart_Scroller_Policy hbar, Elm_Smart_Scroller_Policy vbar) +{ + API_ENTRY return; + if ((sd->hbar_flags == hbar) && (sd->vbar_flags == vbar)) return; + sd->hbar_flags = hbar; + sd->vbar_flags = vbar; + if (sd->hbar_flags == ELM_SMART_SCROLLER_POLICY_ON) + edje_object_signal_emit(sd->edje_obj, "elm,action,show_always,hbar", "elm"); + else if (sd->hbar_flags == ELM_SMART_SCROLLER_POLICY_OFF) + edje_object_signal_emit(sd->edje_obj, "elm,action,hide,hbar", "elm"); + else + edje_object_signal_emit(sd->edje_obj, "elm,action,show_notalways,hbar", "elm"); + if (sd->vbar_flags == ELM_SMART_SCROLLER_POLICY_ON) + edje_object_signal_emit(sd->edje_obj, "elm,action,show_always,vbar", "elm"); + else if (sd->vbar_flags == ELM_SMART_SCROLLER_POLICY_OFF) + edje_object_signal_emit(sd->edje_obj, "elm,action,hide,vbar", "elm"); + else + edje_object_signal_emit(sd->edje_obj, "elm,action,show_notalways,vbar", "elm"); + _smart_scrollbar_size_adjust(sd); +} + +void +elm_smart_scroller_policy_get(Evas_Object *obj, Elm_Smart_Scroller_Policy *hbar, Elm_Smart_Scroller_Policy *vbar) +{ + API_ENTRY return; + if (hbar) *hbar = sd->hbar_flags; + if (vbar) *vbar = sd->vbar_flags; +} + +Evas_Object * +elm_smart_scroller_edje_object_get(Evas_Object *obj) +{ + API_ENTRY return NULL; + return sd->edje_obj; +} + +void +elm_smart_scroller_single_dir_set(Evas_Object *obj, Eina_Bool single_dir) +{ + API_ENTRY return; + sd->one_dir_at_a_time = single_dir; +} + +Eina_Bool +elm_smart_scroller_single_dir_get(Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + return sd->one_dir_at_a_time; +} + +void +elm_smart_scroller_object_theme_set(Evas_Object *parent, Evas_Object *obj, const char *clas, const char *group, const char *style) +{ + API_ENTRY return; + Evas_Coord mw, mh; + //Does this API require parent object absolutely? if then remove this exception. + double parent_scale = parent ? elm_widget_scale_get(parent) : 1; + _elm_theme_object_set(parent, sd->edje_obj, clas, group, style); + edje_object_scale_set(sd->edje_obj, parent_scale * _elm_config->scale); + if (sd->pan_obj) + edje_object_part_swallow(sd->edje_obj, "elm.swallow.content", sd->pan_obj); + mw = mh = -1; + elm_coords_finger_size_adjust(1, &mw, 1, &mh); + if (edje_object_part_exists(sd->edje_obj, "elm.scrollbar.base")) + { + Evas_Object *base; + base = edje_object_part_swallow_get(sd->edje_obj, "elm.scrollbar.base"); + if (!base) + { + base = evas_object_rectangle_add(evas_object_evas_get(sd->edje_obj)); + evas_object_color_set(base, 0, 0, 0, 0); + edje_object_part_swallow(sd->edje_obj, "elm.scrollbar.base", base); + } + if (!_elm_config->thumbscroll_enable) + evas_object_size_hint_min_set(base, mw, mh); + } + sd->vbar_visible = !sd->vbar_visible; + sd->hbar_visible = !sd->hbar_visible; + _smart_scrollbar_bar_visibility_adjust(sd); +} + +void +elm_smart_scroller_hold_set(Evas_Object *obj, Eina_Bool hold) +{ + API_ENTRY return; + sd->hold = hold; +} + +void +elm_smart_scroller_freeze_set(Evas_Object *obj, Eina_Bool freeze) +{ + API_ENTRY return; + sd->freeze = freeze; + if (sd->freeze) + { + if (sd->down.onhold_animator) + { + ecore_animator_del(sd->down.onhold_animator); + sd->down.onhold_animator = NULL; + if (sd->child.resized) + _elm_smart_scroller_wanted_region_set(sd->smart_obj); + } + } + else + bounce_eval(sd); +} + +void +elm_smart_scroller_bounce_allow_set(Evas_Object *obj, Eina_Bool horiz, Eina_Bool vert) +{ + API_ENTRY return; + sd->bounce_horiz = !!horiz; + sd->bounce_vert = !!vert; +} + +void +elm_smart_scroller_bounce_allow_get(const Evas_Object *obj, Eina_Bool *horiz, Eina_Bool *vert) +{ + API_ENTRY return; + if (horiz) *horiz = sd->bounce_horiz; + if (vert) *vert = sd->bounce_vert; +} + +void +elm_smart_scroller_paging_set(Evas_Object *obj, double pagerel_h, double pagerel_v, Evas_Coord pagesize_h, Evas_Coord pagesize_v) +{ + API_ENTRY return; + sd->pagerel_h = pagerel_h; + sd->pagerel_v = pagerel_v; + sd->pagesize_h = pagesize_h; + sd->pagesize_v = pagesize_v; + _smart_page_adjust(sd); +} + +void +elm_smart_scroller_paging_get(Evas_Object *obj, double *pagerel_h, double *pagerel_v, Evas_Coord *pagesize_h, Evas_Coord *pagesize_v) +{ + API_ENTRY return; + if (pagerel_h) *pagerel_h = sd->pagerel_h; + if (pagerel_v) *pagerel_v = sd->pagerel_v; + if (pagesize_h) *pagesize_h = sd->pagesize_h; + if (pagesize_v) *pagesize_v = sd->pagesize_v; +} + +void +elm_smart_scroller_current_page_get(Evas_Object *obj, int *pagenumber_h, int *pagenumber_v) +{ + API_ENTRY return; + Evas_Coord x, y; + elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y); + if (pagenumber_h) + { + if (sd->pagesize_h > 0) + *pagenumber_h = (x + sd->pagesize_h - 1) / sd->pagesize_h; + else + *pagenumber_h = 0; + } + if (pagenumber_v) + { + if (sd->pagesize_v > 0) + *pagenumber_v = (y + sd->pagesize_v - 1) / sd->pagesize_v; + else + *pagenumber_v = 0; + } +} + +void +elm_smart_scroller_last_page_get(Evas_Object *obj, int *pagenumber_h, int *pagenumber_v) +{ + API_ENTRY return; + Evas_Coord cw, ch; + sd->pan_func.child_size_get(sd->pan_obj, &cw, &ch); + if (pagenumber_h) + { + if (sd->pagesize_h > 0) + *pagenumber_h = cw / sd->pagesize_h + 1; + else + *pagenumber_h = 0; + } + if (pagenumber_v) + { + if (sd->pagesize_v > 0) + *pagenumber_v = ch / sd->pagesize_v + 1; + else + *pagenumber_v = 0; + } +} + +void +elm_smart_scroller_page_show(Evas_Object *obj, int pagenumber_h, int pagenumber_v) +{ + API_ENTRY return; + Evas_Coord x, y, w, h; + elm_smart_scroller_child_viewport_size_get(sd->smart_obj, &w, &h); + if (pagenumber_h >= 0) x = sd->pagesize_h * pagenumber_h; + if (pagenumber_v >= 0) y = sd->pagesize_v * pagenumber_v; + if (_elm_smart_scroller_child_region_show_internal(obj, &x, &y, w, h)) + elm_smart_scroller_child_pos_set(obj, x, y); +} + +void +elm_smart_scroller_page_bring_in(Evas_Object *obj, int pagenumber_h, int pagenumber_v) +{ + API_ENTRY return; + Evas_Coord x, y, w, h; + elm_smart_scroller_child_viewport_size_get(sd->smart_obj, &w, &h); + if (pagenumber_h >= 0) x = sd->pagesize_h * pagenumber_h; + if (pagenumber_v >= 0) y = sd->pagesize_v * pagenumber_v; + if (_elm_smart_scroller_child_region_show_internal(obj, &x, &y, w, h)) + { + _smart_scrollto_x(sd, _elm_config->bring_in_scroll_friction, x); + _smart_scrollto_y(sd, _elm_config->bring_in_scroll_friction, y); + } +} + +void +elm_smart_scroller_region_bring_in(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) +{ + API_ENTRY return; + if (_elm_smart_scroller_child_region_show_internal(obj, &x, &y, w, h)) + { + _smart_scrollto_x(sd, _elm_config->bring_in_scroll_friction, x); + _smart_scrollto_y(sd, _elm_config->bring_in_scroll_friction, y); + } +} + +void +elm_smart_scroller_widget_set(Evas_Object *obj, Evas_Object *wid) +{ + API_ENTRY return; + sd->widget = wid; +} + +static void +_elm_smart_scroller_wanted_region_set(Evas_Object *obj) +{ + INTERNAL_ENTRY; + Evas_Coord ww, wh, wx = sd->wx; + + if (sd->down.now || sd->down.momentum_animator || + sd->down.bounce_x_animator || sd->down.bounce_y_animator || + sd->down.hold_animator || sd->down.onhold_animator || + sd->scrollto.x.animator || sd->scrollto.y.animator) return; + + sd->child.resized = EINA_FALSE; + + /* Flip to RTL cords only if init in RTL mode */ + if (sd->is_mirrored) + wx = _elm_smart_scroller_x_mirrored_get(obj, sd->wx); + + if (sd->ww == -1) + { + elm_smart_scroller_child_viewport_size_get(obj, &ww, &wh); + } + else + { + ww = sd->ww; + wh = sd->wh; + } + + elm_smart_scroller_child_region_set(obj, wx, sd->wy, ww, wh); +} + +/* local subsystem functions */ +static void +_smart_edje_drag_v_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Smart_Data *sd; + + sd = data; + _smart_scrollbar_read(sd); + _smart_drag_start(sd->smart_obj); + sd->freeze = EINA_TRUE; +} + +static void +_smart_edje_drag_v_stop(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Smart_Data *sd; + + sd = data; + _smart_scrollbar_read(sd); + _smart_drag_stop(sd->smart_obj); + sd->freeze = EINA_FALSE; +} + +static void +_smart_edje_drag_v(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Smart_Data *sd; + + sd = data; + _smart_scrollbar_read(sd); +} + +static void +_smart_edje_drag_h_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Smart_Data *sd; + + sd = data; + _smart_scrollbar_read(sd); + _smart_drag_start(sd->smart_obj); + sd->freeze = EINA_TRUE; +} + +static void +_smart_edje_drag_h_stop(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Smart_Data *sd; + + sd = data; + _smart_scrollbar_read(sd); + _smart_drag_stop(sd->smart_obj); + sd->freeze = EINA_FALSE; +} + +static void +_smart_edje_drag_h(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +{ + Smart_Data *sd; + + sd = data; + _smart_scrollbar_read(sd); +} + +static void +_smart_child_del_hook(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Smart_Data *sd; + + sd = data; + sd->child_obj = NULL; + _smart_scrollbar_size_adjust(sd); + _smart_scrollbar_reset(sd); +} + +static void +_smart_pan_changed_hook(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Evas_Coord w, h; + Smart_Data *sd; + + sd = data; + sd->pan_func.child_size_get(sd->pan_obj, &w, &h); + if ((w != sd->child.w) || (h != sd->child.h)) + { + sd->child.w = w; + sd->child.h = h; + _smart_scrollbar_size_adjust(sd); + evas_object_size_hint_min_set(sd->smart_obj, sd->child.w, sd->child.h); + sd->child.resized = EINA_TRUE; + _elm_smart_scroller_wanted_region_set(sd->smart_obj); + } +} + +void +elm_smart_scroller_gravity_set(Evas_Object *obj, double x, double y) +{ + API_ENTRY return; + + sd->pan_func.gravity_set(sd->pan_obj, x, y); +} + +void +elm_smart_scroller_gravity_get(Evas_Object *obj, double *x, double *y) +{ + API_ENTRY return; + + sd->pan_func.gravity_get(sd->pan_obj, x, y); +} + +static void +_smart_event_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Evas_Event_Mouse_Wheel *ev; + Smart_Data *sd; + Evas_Coord x = 0, y = 0; + int direction = 0; + + sd = data; + ev = event_info; + direction = ev->direction; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return ; + if ((evas_key_modifier_is_set(ev->modifiers, "Control")) || + (evas_key_modifier_is_set(ev->modifiers, "Alt")) || + (evas_key_modifier_is_set(ev->modifiers, "Meta")) || + (evas_key_modifier_is_set(ev->modifiers, "Hyper")) || + (evas_key_modifier_is_set(ev->modifiers, "Super"))) + return; + else if (evas_key_modifier_is_set(ev->modifiers, "Shift")) + direction = 1; + elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y); + if ((sd->down.bounce_x_animator) || (sd->down.bounce_y_animator) || + (sd->scrollto.x.animator) || (sd->scrollto.y.animator)) + { + _smart_anim_stop(sd->smart_obj); + } + if (sd->scrollto.x.animator) + { + ecore_animator_del(sd->scrollto.x.animator); + sd->scrollto.x.animator = NULL; + } + if (sd->scrollto.y.animator) + { + ecore_animator_del(sd->scrollto.y.animator); + sd->scrollto.y.animator = NULL; + } + if (sd->down.bounce_x_animator) + { + ecore_animator_del(sd->down.bounce_x_animator); + sd->down.bounce_x_animator = NULL; + sd->bouncemex = EINA_FALSE; + if (sd->child.resized) + _elm_smart_scroller_wanted_region_set(sd->smart_obj); + } + if (sd->down.bounce_y_animator) + { + ecore_animator_del(sd->down.bounce_y_animator); + sd->down.bounce_y_animator = NULL; + sd->bouncemey = EINA_FALSE; + if (sd->child.resized) + _elm_smart_scroller_wanted_region_set(sd->smart_obj); + } + if (!direction) + y += ev->z * sd->step.y; + else if (direction == 1) + x += ev->z * sd->step.x; + + if ((!sd->hold) && (!sd->freeze)) + { + _update_wanted_coordinates(sd, x, y); + elm_smart_scroller_child_pos_set(sd->smart_obj, x, y); + } +} + +static void +_smart_event_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Evas_Event_Mouse_Down *ev; + Smart_Data *sd; + Evas_Coord x = 0, y = 0; + + sd = data; + ev = event_info; + // if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return ; + if (_elm_config->thumbscroll_enable) + { + sd->down.hold = EINA_FALSE; + if ((sd->down.bounce_x_animator) || (sd->down.bounce_y_animator) || + (sd->down.momentum_animator) || (sd->scrollto.x.animator) || + (sd->scrollto.y.animator)) + { + ev->event_flags |= EVAS_EVENT_FLAG_ON_SCROLL | EVAS_EVENT_FLAG_ON_HOLD; + sd->down.scroll = EINA_TRUE; + sd->down.hold = EINA_TRUE; + _smart_anim_stop(sd->smart_obj); + } + if (sd->scrollto.x.animator) + { + ecore_animator_del(sd->scrollto.x.animator); + sd->scrollto.x.animator = NULL; + } + if (sd->scrollto.y.animator) + { + ecore_animator_del(sd->scrollto.y.animator); + sd->scrollto.y.animator = NULL; + } + if (sd->down.bounce_x_animator) + { + ecore_animator_del(sd->down.bounce_x_animator); + sd->down.bounce_x_animator = NULL; + sd->bouncemex = EINA_FALSE; + if (sd->child.resized) + _elm_smart_scroller_wanted_region_set(sd->smart_obj); + } + if (sd->down.bounce_y_animator) + { + ecore_animator_del(sd->down.bounce_y_animator); + sd->down.bounce_y_animator = NULL; + sd->bouncemey = EINA_FALSE; + if (sd->child.resized) + _elm_smart_scroller_wanted_region_set(sd->smart_obj); + } + if (sd->down.hold_animator) + { + ecore_animator_del(sd->down.hold_animator); + sd->down.hold_animator = NULL; + _smart_drag_stop(sd->smart_obj); + if (sd->child.resized) + _elm_smart_scroller_wanted_region_set(sd->smart_obj); + } + if (sd->down.momentum_animator) + { + ecore_animator_del(sd->down.momentum_animator); + sd->down.momentum_animator = NULL; + sd->down.bounce_x_hold = EINA_FALSE; + sd->down.bounce_y_hold = EINA_FALSE; + sd->down.ax = 0; + sd->down.ay = 0; + if (sd->child.resized) + _elm_smart_scroller_wanted_region_set(sd->smart_obj); + } + if (ev->button == 1) + { + sd->down.hist.est_timestamp_diff = + ecore_loop_time_get() - ((double)ev->timestamp / 1000.0); + sd->down.hist.tadd = 0.0; + sd->down.hist.dxsum = 0.0; + sd->down.hist.dysum = 0.0; + sd->down.now = EINA_TRUE; + sd->down.dragged = EINA_FALSE; + sd->down.dir_x = EINA_FALSE; + sd->down.dir_y = EINA_FALSE; + sd->down.x = ev->canvas.x; + sd->down.y = ev->canvas.y; + elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y); + sd->down.sx = x; + sd->down.sy = y; + sd->down.locked = EINA_FALSE; + memset(&(sd->down.history[0]), 0, sizeof(sd->down.history[0]) * 60); +#ifdef EVTIME + sd->down.history[0].timestamp = ev->timestamp / 1000.0; + sd->down.history[0].localtimestamp = ecore_loop_time_get(); +#else + sd->down.history[0].timestamp = ecore_loop_time_get(); +#endif + sd->down.history[0].x = ev->canvas.x; + sd->down.history[0].y = ev->canvas.y; + } + sd->down.dragged_began = EINA_FALSE; + sd->down.hold_parent = EINA_FALSE; + sd->down.cancelled = EINA_FALSE; + if (sd->hold || sd->freeze) + sd->down.want_reset = EINA_TRUE; + else + sd->down.want_reset = EINA_FALSE; + } +} + +static void +_down_coord_eval(Smart_Data *sd, Evas_Coord *x, Evas_Coord *y) +{ + Evas_Coord minx, miny; + + if (sd->down.dir_x) *x = sd->down.sx - (*x - sd->down.x); + else *x = sd->down.sx; + if (sd->down.dir_y) *y = sd->down.sy - (*y - sd->down.y); + else *y = sd->down.sy; + + if ((sd->down.dir_x) || (sd->down.dir_y)) + { + if (!((sd->down.dir_x) && (sd->down.dir_y))) + { + if (sd->down.dir_x) *y = sd->down.locked_y; + else *x = sd->down.locked_x; + } + } + + sd->pan_func.min_get(sd->pan_obj, &minx, &miny); + + if (*x < minx) + *x += (minx - *x) * _elm_config->thumbscroll_border_friction; + else if (sd->child.w <= sd->w) + *x += (sd->down.sx - *x) * _elm_config->thumbscroll_border_friction; + else if ((sd->child.w - sd->w + minx) < *x) + *x += (sd->child.w - sd->w + minx - *x) * + _elm_config->thumbscroll_border_friction; + + if (*y < miny) + *y += (miny - *y) * _elm_config->thumbscroll_border_friction; + else if (sd->child.h <= sd->h) + *y += (sd->down.sy - *y) * _elm_config->thumbscroll_border_friction; + else if ((sd->child.h - sd->h + miny) < *y) + *y += (sd->child.h - sd->h + miny - *y) * + _elm_config->thumbscroll_border_friction; +} + +static Eina_Bool +_smart_hold_animator(void *data) +{ + Smart_Data *sd = data; + Evas_Coord ox = 0, oy = 0, fx = 0, fy= 0; + + fx = sd->down.hold_x; + fy = sd->down.hold_y; + if (_elm_config->scroll_smooth_amount > 0.0) + { + int i, count = 0; + Evas_Coord basex = 0, basey = 0, x, y; + double dt, t, tdiff, tnow, twin; + struct + { + Evas_Coord x, y, dx, dy; + double t, dt; + } pos[60]; + + tdiff = sd->down.hist.est_timestamp_diff; + tnow = ecore_time_get() - tdiff; + t = tnow; + twin = _elm_config->scroll_smooth_time_window; + for (i = 0; i < 60; i++) + { + // oldest point is sd->down.history[i] + // newset is sd->down.history[0] + dt = t - sd->down.history[i].timestamp; + if (dt > twin) + { + i--; + break; + } + x = sd->down.history[i].x; + y = sd->down.history[i].y; + _down_coord_eval(sd, &x, &y); + if (i == 0) + { + basex = x; + basey = y; + } + pos[i].x = x - basex; + pos[i].y = y - basey; + pos[i].t = + sd->down.history[i].timestamp - sd->down.history[0].timestamp; + count++; + } + count = i; + if (count >= 2) + { + double dtsum = 0.0, tadd, maxdt; + double dxsum = 0.0, dysum = 0.0, xsum = 0.0, ysum = 0.0; + + for (i = 0; i < (count - 1); i++) + { + pos[i].dx = pos[i].x - pos[i + 1].x; + pos[i].dy = pos[i].y - pos[i + 1].y; + pos[i].dt = pos[i].t - pos[i + 1].t; + dxsum += pos[i].dx; + dysum += pos[i].dy; + dtsum += pos[i].dt; + xsum += pos[i].x; + ysum += pos[i].y; + } + maxdt = pos[i].t; + dxsum /= (double)i; + dysum /= (double)i; + dtsum /= (double)i; + xsum /= (double)i; + ysum /= (double)i; + tadd = tnow - sd->down.history[0].timestamp + _elm_config->scroll_smooth_future_time; + tadd = tadd - (maxdt / 2); +#define WEIGHT(n, o, v) n = (((double)o * (1.0 - v)) + ((double)n * v)) + WEIGHT(tadd, sd->down.hist.tadd, _elm_config->scroll_smooth_history_weight); + WEIGHT(dxsum, sd->down.hist.dxsum, _elm_config->scroll_smooth_history_weight); + WEIGHT(dysum, sd->down.hist.dysum, _elm_config->scroll_smooth_history_weight); + fx = basex + xsum + ((dxsum * tadd) / dtsum); + fy = basey + ysum + ((dysum * tadd) / dtsum); + sd->down.hist.tadd = tadd; + sd->down.hist.dxsum = dxsum; + sd->down.hist.dysum = dysum; + WEIGHT(fx, sd->down.hold_x, _elm_config->scroll_smooth_amount); + WEIGHT(fy, sd->down.hold_y, _elm_config->scroll_smooth_amount); + } + // printf("%3.5f %i %i\n", ecore_time_get(), sd->down.hold_y, fy); + } + + elm_smart_scroller_child_pos_get(sd->smart_obj, &ox, &oy); + if (sd->down.dir_x) + { + if ((!sd->widget) || + (!elm_widget_drag_child_locked_x_get(sd->widget))) + ox = fx; + } + if (sd->down.dir_y) + { + if ((!sd->widget) || + (!elm_widget_drag_child_locked_y_get(sd->widget))) + oy = fy; + } + + elm_smart_scroller_child_pos_set(sd->smart_obj, ox, oy); + return ECORE_CALLBACK_RENEW; +} + +static Eina_Bool +_smart_event_post_up(void *data, Evas *e __UNUSED__) +{ + Smart_Data *sd = data; + if (sd->widget) + { + if (sd->down.dragged) + { + elm_widget_drag_lock_x_set(sd->widget, 0); + elm_widget_drag_lock_y_set(sd->widget, 0); + } + } + return EINA_TRUE; +} + +static void +_smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) +{ + Evas_Event_Mouse_Down *ev; + Smart_Data *sd; + Evas_Coord x = 0, y = 0, ox = 0, oy = 0; + + sd = data; + ev = event_info; + sd->down.hold_parent = EINA_FALSE; + sd->down.dx = 0; + sd->down.dy = 0; + // if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return ; + evas_post_event_callback_push(e, _smart_event_post_up, sd); + // FIXME: respect elm_widget_scroll_hold_get of parent container + if (_elm_config->thumbscroll_enable) + { + if (ev->button == 1) + { + if (sd->down.onhold_animator) + { + ecore_animator_del(sd->down.onhold_animator); + sd->down.onhold_animator = NULL; + if (sd->child.resized) + _elm_smart_scroller_wanted_region_set(sd->smart_obj); + } + x = ev->canvas.x - sd->down.x; + y = ev->canvas.y - sd->down.y; + if (sd->down.dragged) + { + _smart_drag_stop(sd->smart_obj); + if ((!sd->hold) && (!sd->freeze)) + { + double t, at, dt; + int i; + Evas_Coord ax, ay, dx, dy, vel; + +#ifdef EVTIME + t = ev->timestamp / 1000.0; +#else + t = ecore_loop_time_get(); +#endif + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + ax = ev->canvas.x; + ay = ev->canvas.y; + at = 0.0; +#ifdef SCROLLDBG + printf("------ %i %i\n", ev->canvas.x, ev->canvas.y); +#endif + for (i = 0; i < 60; i++) + { + dt = t - sd->down.history[i].timestamp; + if (dt > 0.2) break; +#ifdef SCROLLDBG + printf("H: %i %i @ %1.3f\n", + sd->down.history[i].x, + sd->down.history[i].y, dt); +#endif + at += dt; + ax += sd->down.history[i].x; + ay += sd->down.history[i].y; + } + ax /= (i + 1); + ay /= (i + 1); + at /= (i + 1); + at /= _elm_config->thumbscroll_sensitivity_friction; + dx = ev->canvas.x - ax; + dy = ev->canvas.y - ay; + if (at > 0) + { + vel = sqrt((dx * dx) + (dy * dy)) / at; + if ((_elm_config->thumbscroll_friction > 0.0) && + (vel > _elm_config->thumbscroll_momentum_threshold)) + { + int minx, miny, mx, my, px, py; + sd->pan_func.min_get(sd->pan_obj, &minx, &miny); + sd->pan_func.max_get(sd->pan_obj, &mx, &my); + sd->pan_func.get(sd->pan_obj, &px, &py); + sd->down.dx = ((double)dx / at); + sd->down.dy = ((double)dy / at); + if (((sd->down.dx > 0) && (sd->down.pdx > 0)) || + ((sd->down.dx < 0) && (sd->down.pdx < 0))) + if (px > minx && px < mx) + sd->down.dx += (double)sd->down.pdx * 1.5; // FIXME: * 1.5 - probably should be config + if (((sd->down.dy > 0) && (sd->down.pdy > 0)) || + ((sd->down.dy < 0) && (sd->down.pdy < 0))) + if (py > miny && py < my) + sd->down.dy += (double)sd->down.pdy * 1.5; // FIXME: * 1.5 - probably should be config + if (((sd->down.dx > 0) && (sd->down.pdx > 0)) || + ((sd->down.dx < 0) && (sd->down.pdx < 0)) || + ((sd->down.dy > 0) && (sd->down.pdy > 0)) || + ((sd->down.dy < 0) && (sd->down.pdy < 0))) + { + double tt = ecore_loop_time_get(); + double dtt = tt - sd->down.anim_start; + + if (dtt < 0.0) dtt = 0.0; + else if (dtt > _elm_config->thumbscroll_friction) + dtt = _elm_config->thumbscroll_friction; + sd->down.extra_time = _elm_config->thumbscroll_friction - dtt; + } + else + sd->down.extra_time = 0.0; + sd->down.pdx = sd->down.dx; + sd->down.pdy = sd->down.dy; + ox = -sd->down.dx; + oy = -sd->down.dy; + if (!_smart_do_page(sd)) + { + if ((!sd->down.momentum_animator) && (!sd->momentum_animator_disabled)) + { + sd->down.momentum_animator = ecore_animator_add(_smart_momentum_animator, sd); + ev->event_flags |= EVAS_EVENT_FLAG_ON_SCROLL; + _smart_anim_start(sd->smart_obj); + } + sd->down.anim_start = ecore_loop_time_get(); + elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y); + sd->down.sx = x; + sd->down.sy = y; + sd->down.b0x = 0; + sd->down.b0y = 0; + } + } + } + } + else + { + sd->down.pdx = 0; + sd->down.pdy = 0; + } + evas_event_feed_hold(e, 0, ev->timestamp, ev->data); + if (_smart_do_page(sd)) + { + Evas_Coord pgx, pgy; + + elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y); + if ((!sd->widget) || + (!elm_widget_drag_child_locked_x_get(sd->widget))) + { + pgx = _smart_page_x_get(sd, ox); + if (pgx != x) + { + ev->event_flags |= EVAS_EVENT_FLAG_ON_SCROLL; + _smart_scrollto_x(sd, _elm_config->page_scroll_friction, pgx); + } + } + if ((!sd->widget) || + (!elm_widget_drag_child_locked_y_get(sd->widget))) + { + pgy = _smart_page_y_get(sd, oy); + if (pgy != y) + { + ev->event_flags |= EVAS_EVENT_FLAG_ON_SCROLL; + _smart_scrollto_y(sd, _elm_config->page_scroll_friction, pgy); + } + } + } + } + else + { + sd->down.pdx = 0; + sd->down.pdy = 0; + if (_smart_do_page(sd)) + { + Evas_Coord pgx, pgy; + + elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y); + if ((!sd->widget) || + (!elm_widget_drag_child_locked_x_get(sd->widget))) + { + pgx = _smart_page_x_get(sd, ox); + if (pgx != x) _smart_scrollto_x(sd, _elm_config->page_scroll_friction, pgx); + } + if ((!sd->widget) || + (!elm_widget_drag_child_locked_y_get(sd->widget))) + { + pgy = _smart_page_y_get(sd, oy); + if (pgy != y) _smart_scrollto_y(sd, _elm_config->page_scroll_friction, pgy); + } + } + } + if (sd->down.hold_animator) + { + ecore_animator_del(sd->down.hold_animator); + sd->down.hold_animator = NULL; + if (sd->child.resized) + _elm_smart_scroller_wanted_region_set(sd->smart_obj); + } + if (sd->down.scroll) + { + ev->event_flags |= EVAS_EVENT_FLAG_ON_SCROLL; + sd->down.scroll = EINA_FALSE; + } + if (sd->down.hold) + { + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + sd->down.hold = EINA_FALSE; + } + sd->down.dragged_began = EINA_FALSE; + sd->down.dir_x = EINA_FALSE; + sd->down.dir_y = EINA_FALSE; + sd->down.want_dragged = EINA_FALSE; + sd->down.dragged = EINA_FALSE; + sd->down.now = EINA_FALSE; + elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y); + elm_smart_scroller_child_pos_set(sd->smart_obj, x, y); + _update_wanted_coordinates(sd, x, y); + + if (sd->child.resized) + _elm_smart_scroller_wanted_region_set(sd->smart_obj); + + if (!_smart_do_page(sd)) + bounce_eval(sd); + } + } +} + +static Eina_Bool +_smart_onhold_animator(void *data) +{ + Smart_Data *sd; + double t, td; + double vx, vy; + Evas_Coord x, y, ox, oy; + + sd = data; + t = ecore_loop_time_get(); + if (sd->down.onhold_tlast > 0.0) + { + td = t - sd->down.onhold_tlast; + vx = sd->down.onhold_vx * td * (double)_elm_config->thumbscroll_threshold * 2.0; + vy = sd->down.onhold_vy * td * (double)_elm_config->thumbscroll_threshold * 2.0; + elm_smart_scroller_child_pos_get(sd->smart_obj, &ox, &oy); + x = ox; + y = oy; + + if (sd->down.dir_x) + { + if ((!sd->widget) || + (!elm_widget_drag_child_locked_x_get(sd->widget))) + { + sd->down.onhold_vxe += vx; + x = ox + (int)sd->down.onhold_vxe; + sd->down.onhold_vxe -= (int)sd->down.onhold_vxe; + } + } + + if (sd->down.dir_y) + { + if ((!sd->widget) || + (!elm_widget_drag_child_locked_y_get(sd->widget))) + { + sd->down.onhold_vye += vy; + y = oy + (int)sd->down.onhold_vye; + sd->down.onhold_vye -= (int)sd->down.onhold_vye; + } + } + + elm_smart_scroller_child_pos_set(sd->smart_obj, x, y); + } + sd->down.onhold_tlast = t; + return ECORE_CALLBACK_RENEW; +} + +static Eina_Bool +_smart_event_post_move(void *data, Evas *e __UNUSED__) +{ + Smart_Data *sd = data; + + if (sd->down.want_dragged) + { + int start = 0; + + if (sd->down.hold_parent) + { + if ((sd->down.dir_x) && !can_scroll(sd, sd->down.hdir)) + { + sd->down.dir_x = EINA_FALSE; + } + if ((sd->down.dir_y) && !can_scroll(sd, sd->down.vdir)) + { + sd->down.dir_y = EINA_FALSE; + } + } + if (sd->down.dir_x) + { + if ((!sd->widget) || + (!elm_widget_drag_child_locked_x_get(sd->widget))) + { + sd->down.want_dragged = EINA_FALSE; + sd->down.dragged = EINA_TRUE; + if (sd->widget) + { + elm_widget_drag_lock_x_set(sd->widget, 1); + } + start = 1; + } + else + sd->down.dir_x = EINA_FALSE; + } + if (sd->down.dir_y) + { + if ((!sd->widget) || + (!elm_widget_drag_child_locked_y_get(sd->widget))) + { + sd->down.want_dragged = EINA_FALSE; + sd->down.dragged = EINA_TRUE; + if (sd->widget) + { + elm_widget_drag_lock_y_set(sd->widget, 1); + } + start = 1; + } + else + sd->down.dir_y = EINA_FALSE; + } + if ((!sd->down.dir_x) && (!sd->down.dir_y)) + { + sd->down.cancelled = EINA_TRUE; + } + if (start) _smart_drag_start(sd->smart_obj); + } + return EINA_TRUE; +} + +static void +_smart_event_mouse_move(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) +{ + Evas_Event_Mouse_Move *ev; + Smart_Data *sd; + Evas_Coord x = 0, y = 0; + + sd = data; + ev = event_info; + // if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return ; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) + sd->down.hold_parent = EINA_TRUE; + evas_post_event_callback_push(e, _smart_event_post_move, sd); + + // FIXME: respect elm_widget_scroll_hold_get of parent container + if (_elm_config->thumbscroll_enable) + { + if (sd->down.now) + { + int dodir = 0; + + if ((sd->scrollto.x.animator) && (!sd->hold) && (!sd->freeze)) + { + Evas_Coord px; + ecore_animator_del(sd->scrollto.x.animator); + sd->scrollto.x.animator = NULL; + sd->pan_func.get(sd->pan_obj, &px, NULL); + sd->down.sx = px; + sd->down.x = sd->down.history[0].x; + } + + if ((sd->scrollto.y.animator) && (!sd->hold) && (!sd->freeze)) + { + Evas_Coord py; + ecore_animator_del(sd->scrollto.y.animator); + sd->scrollto.y.animator = NULL; + sd->pan_func.get(sd->pan_obj, NULL, &py); + sd->down.sy = py; + sd->down.y = sd->down.history[0].y; + } + +#ifdef SCROLLDBG + printf("::: %i %i\n", ev->cur.canvas.x, ev->cur.canvas.y); +#endif + memmove(&(sd->down.history[1]), &(sd->down.history[0]), + sizeof(sd->down.history[0]) * (60 - 1)); +#ifdef EVTIME + sd->down.history[0].timestamp = ev->timestamp / 1000.0; + sd->down.history[0].localtimestamp = ecore_loop_time_get(); +#else + sd->down.history[0].timestamp = ecore_loop_time_get(); +#endif + sd->down.history[0].x = ev->cur.canvas.x; + sd->down.history[0].y = ev->cur.canvas.y; + + if (!sd->down.dragged_began) + { + x = ev->cur.canvas.x - sd->down.x; + y = ev->cur.canvas.y - sd->down.y; + + sd->down.hdir = -1; + sd->down.vdir = -1; + + if (x > 0) sd->down.hdir = LEFT; + else if (x < 0) sd->down.hdir = RIGHT; + if (y > 0) sd->down.vdir = UP; + else if (y < 0) sd->down.vdir = DOWN; + + if (x < 0) x = -x; + if (y < 0) y = -y; + + if ((sd->one_dir_at_a_time) && + (!((sd->down.dir_x) || (sd->down.dir_y)))) + { + if (x > _elm_config->thumbscroll_threshold) + { + if (x > (y * 2)) + { + sd->down.dir_x = EINA_TRUE; + sd->down.dir_y = EINA_FALSE; + dodir++; + } + } + if (y > _elm_config->thumbscroll_threshold) + { + if (y > (x * 2)) + { + sd->down.dir_x = EINA_FALSE; + sd->down.dir_y = EINA_TRUE; + dodir++; + } + } + if (!dodir) + { + sd->down.dir_x = EINA_TRUE; + sd->down.dir_y = EINA_TRUE; + } + } + else + { + sd->down.dir_x = EINA_TRUE; + sd->down.dir_y = EINA_TRUE; + } + } + if ((!sd->hold) && (!sd->freeze)) + { + if ((sd->down.dragged) || + (((x * x) + (y * y)) > + (_elm_config->thumbscroll_threshold * + _elm_config->thumbscroll_threshold))) + { + sd->down.dragged_began = EINA_TRUE; + if (!sd->down.dragged) + { + sd->down.want_dragged = EINA_TRUE; + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + // evas_event_feed_hold(e, 1, ev->timestamp, ev->data); + // _smart_drag_start(sd->smart_obj); + } + if (sd->down.dragged) + { + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + } + // ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + // sd->down.dragged = 1; + if (sd->down.dir_x) + x = sd->down.sx - (ev->cur.canvas.x - sd->down.x); + else + x = sd->down.sx; + if (sd->down.dir_y) + y = sd->down.sy - (ev->cur.canvas.y - sd->down.y); + else + y = sd->down.sy; + if (sd->down.want_reset) + { + sd->down.x = ev->cur.canvas.x; + sd->down.y = ev->cur.canvas.y; + sd->down.want_reset = EINA_FALSE; + } + if ((sd->down.dir_x) || (sd->down.dir_y)) + { + if (!sd->down.locked) + { + sd->down.locked_x = x; + sd->down.locked_y = y; + sd->down.locked = EINA_TRUE; + } + if (!((sd->down.dir_x) && (sd->down.dir_y))) + { + if (sd->down.dir_x) y = sd->down.locked_y; + else x = sd->down.locked_x; + } + } + { + Evas_Coord minx, miny; + sd->pan_func.min_get(sd->pan_obj, &minx, &miny); + if (y < miny) + y += (miny - y) * + _elm_config->thumbscroll_border_friction; + else if (sd->child.h <= sd->h) + y += (sd->down.sy - y) * + _elm_config->thumbscroll_border_friction; + else if ((sd->child.h - sd->h + miny) < y) + y += (sd->child.h - sd->h + miny - y) * + _elm_config->thumbscroll_border_friction; + if (x < minx) + x += (minx - x) * + _elm_config->thumbscroll_border_friction; + else if (sd->child.w <= sd->w) + x += (sd->down.sx - x) * + _elm_config->thumbscroll_border_friction; + else if ((sd->child.w - sd->w + minx) < x) + x += (sd->child.w - sd->w + minx - x) * + _elm_config->thumbscroll_border_friction; + } + + sd->down.hold_x = x; + sd->down.hold_y = y; + if (!sd->down.hold_animator) + sd->down.hold_animator = + ecore_animator_add(_smart_hold_animator, sd); + // printf("a %i %i\n", sd->down.hold_x, sd->down.hold_y); + // _smart_onhold_animator(sd); + // elm_smart_scroller_child_pos_set(sd->smart_obj, x, y); + } + else + { + if (sd->down.dragged_began) + { + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + if (!sd->down.hold) + { + sd->down.hold = EINA_TRUE; + evas_event_feed_hold(e, 1, ev->timestamp, ev->data); + } + } + } + } + else if (!sd->freeze) + { + Evas_Coord ex, ey, ew, eh; + double vx = 0.0, vy = 0.0; + + evas_object_geometry_get(sd->event_obj, &ex, &ey, &ew, &eh); + x = ev->cur.canvas.x - ex; + y = ev->cur.canvas.y - ey; + if (x < _elm_config->thumbscroll_threshold) + { + if (_elm_config->thumbscroll_threshold > 0.0) + vx = -(double)(_elm_config->thumbscroll_threshold - x) / + _elm_config->thumbscroll_threshold; + else + vx = -1.0; + } + else if (x > (ew - _elm_config->thumbscroll_threshold)) + { + if (_elm_config->thumbscroll_threshold > 0.0) + vx = (double)(_elm_config->thumbscroll_threshold - (ew - x)) / + _elm_config->thumbscroll_threshold; + else + vx = 1.0; + } + if (y < _elm_config->thumbscroll_threshold) + { + if (_elm_config->thumbscroll_threshold > 0.0) + vy = -(double)(_elm_config->thumbscroll_threshold - y) / + _elm_config->thumbscroll_threshold; + else + vy = -1.0; + } + else if (y > (eh - _elm_config->thumbscroll_threshold)) + { + if (_elm_config->thumbscroll_threshold > 0.0) + vy = (double)(_elm_config->thumbscroll_threshold - (eh - y)) / + _elm_config->thumbscroll_threshold; + else + vy = 1.0; + } + if ((vx != 0.0) || (vy != 0.0)) + { + sd->down.onhold_vx = vx; + sd->down.onhold_vy = vy; + if (!sd->down.onhold_animator) + { + sd->down.onhold_vxe = 0.0; + sd->down.onhold_vye = 0.0; + sd->down.onhold_tlast = 0.0; + sd->down.onhold_animator = ecore_animator_add(_smart_onhold_animator, sd); + } + // printf("b %i %i\n", sd->down.hold_x, sd->down.hold_y); + } + else + { + if (sd->down.onhold_animator) + { + ecore_animator_del(sd->down.onhold_animator); + sd->down.onhold_animator = NULL; + if (sd->child.resized) + _elm_smart_scroller_wanted_region_set(sd->smart_obj); + } + } + } + } + } +} + +static void +_smart_scrollbar_read(Smart_Data *sd) +{ + Evas_Coord x, y, mx = 0, my = 0, px, py, minx = 0, miny = 0; + double vx, vy; + + if ((sd->down.dragged) || (sd->down.bounce_x_animator) + || (sd->down.bounce_y_animator) || (sd->down.momentum_animator) + || (sd->scrollto.x.animator) || (sd->scrollto.y.animator)) + return; + edje_object_part_drag_value_get(sd->edje_obj, "elm.dragable.vbar", NULL, &vy); + edje_object_part_drag_value_get(sd->edje_obj, "elm.dragable.hbar", &vx, NULL); + sd->pan_func.max_get(sd->pan_obj, &mx, &my); + sd->pan_func.min_get(sd->pan_obj, &minx, &miny); + x = vx * (double)mx + minx; + y = vy * (double)my + miny; + sd->pan_func.get(sd->pan_obj, &px, &py); + sd->pan_func.set(sd->pan_obj, x, y); + if ((px != x) || (py != y)) + edje_object_signal_emit(sd->edje_obj, "elm,action,scroll", "elm"); +} + +static void +_smart_scrollbar_reset(Smart_Data *sd) +{ + Evas_Coord px = 0, py = 0, minx = 0, miny = 0; + + edje_object_part_drag_value_set(sd->edje_obj, "elm.dragable.vbar", 0.0, 0.0); + edje_object_part_drag_value_set(sd->edje_obj, "elm.dragable.hbar", 0.0, 0.0); + if ((!sd->child_obj) && (!sd->extern_pan)) + { + edje_object_part_drag_size_set(sd->edje_obj, "elm.dragable.vbar", 1.0, 1.0); + edje_object_part_drag_size_set(sd->edje_obj, "elm.dragable.hbar", 1.0, 1.0); + } + if (sd->pan_obj) + { + sd->pan_func.min_get(sd->pan_obj, &minx, &miny); + sd->pan_func.get(sd->pan_obj, &px, &py); + sd->pan_func.set(sd->pan_obj, minx, miny); + } + if ((px != minx) || (py != miny)) + edje_object_signal_emit(sd->edje_obj, "elm,action,scroll", "elm"); +} + +static int +_smart_scrollbar_bar_v_visibility_adjust(Smart_Data *sd) +{ + int scroll_v_vis_change = 0; + Evas_Coord h, vw = 0, vh = 0; + + h = sd->child.h; + if (sd->pan_obj) + evas_object_geometry_get(sd->pan_obj, NULL, NULL, &vw, &vh); + if (sd->vbar_visible) + { + if (sd->vbar_flags == ELM_SMART_SCROLLER_POLICY_AUTO) + { + if ((sd->child_obj) || (sd->extern_pan)) + { + if (h <= vh) + { + scroll_v_vis_change = 1; + sd->vbar_visible = EINA_FALSE; + } + } + else + { + scroll_v_vis_change = 1; + sd->vbar_visible = EINA_FALSE; + } + } + else if (sd->vbar_flags == ELM_SMART_SCROLLER_POLICY_OFF) + { + scroll_v_vis_change = 1; + sd->vbar_visible = EINA_FALSE; + } + } + else + { + if (sd->vbar_flags == ELM_SMART_SCROLLER_POLICY_AUTO) + { + if ((sd->child_obj) || (sd->extern_pan)) + { + if (h > vh) + { + scroll_v_vis_change = 1; + sd->vbar_visible = EINA_TRUE; + } + } + } + else if (sd->vbar_flags == ELM_SMART_SCROLLER_POLICY_ON) + { + scroll_v_vis_change = 1; + sd->vbar_visible = EINA_TRUE; + } + } + if (scroll_v_vis_change) + { + if (sd->vbar_flags != ELM_SMART_SCROLLER_POLICY_OFF) + { + if (sd->vbar_visible) + edje_object_signal_emit(sd->edje_obj, "elm,action,show,vbar", "elm"); + else + edje_object_signal_emit(sd->edje_obj, "elm,action,hide,vbar", "elm"); + edje_object_message_signal_process(sd->edje_obj); + _smart_scrollbar_size_adjust(sd); + } + else + edje_object_signal_emit(sd->edje_obj, "elm,action,hide,vbar", "elm"); + } + return scroll_v_vis_change; +} + +static int +_smart_scrollbar_bar_h_visibility_adjust(Smart_Data *sd) +{ + int scroll_h_vis_change = 0; + Evas_Coord w, vw = 0, vh = 0; + + w = sd->child.w; + if (sd->pan_obj) + evas_object_geometry_get(sd->pan_obj, NULL, NULL, &vw, &vh); + if (sd->hbar_visible) + { + if (sd->hbar_flags == ELM_SMART_SCROLLER_POLICY_AUTO) + { + if ((sd->child_obj) || (sd->extern_pan)) + { + if (w <= vw) + { + scroll_h_vis_change = 1; + sd->hbar_visible = EINA_FALSE; + } + } + else + { + scroll_h_vis_change = 1; + sd->hbar_visible = EINA_FALSE; + } + } + else if (sd->hbar_flags == ELM_SMART_SCROLLER_POLICY_OFF) + { + scroll_h_vis_change = 1; + sd->hbar_visible = EINA_FALSE; + } + } + else + { + if (sd->hbar_flags == ELM_SMART_SCROLLER_POLICY_AUTO) + { + if ((sd->child_obj) || (sd->extern_pan)) + { + if (w > vw) + { + scroll_h_vis_change = 1; + sd->hbar_visible = EINA_TRUE; + } + } + } + else if (sd->hbar_flags == ELM_SMART_SCROLLER_POLICY_ON) + { + scroll_h_vis_change = 1; + sd->hbar_visible = EINA_TRUE; + } + } + if (scroll_h_vis_change) + { + if (sd->hbar_flags != ELM_SMART_SCROLLER_POLICY_OFF) + { + if (sd->hbar_visible) + edje_object_signal_emit(sd->edje_obj, "elm,action,show,hbar", "elm"); + else + edje_object_signal_emit(sd->edje_obj, "elm,action,hide,hbar", "elm"); + edje_object_message_signal_process(sd->edje_obj); + _smart_scrollbar_size_adjust(sd); + } + else + edje_object_signal_emit(sd->edje_obj, "elm,action,hide,hbar", "elm"); + _smart_scrollbar_size_adjust(sd); + } + return scroll_h_vis_change; +} + +static void +_smart_scrollbar_bar_visibility_adjust(Smart_Data *sd) +{ + int changed = 0; + + changed |= _smart_scrollbar_bar_h_visibility_adjust(sd); + changed |= _smart_scrollbar_bar_v_visibility_adjust(sd); + if (changed) + { + _smart_scrollbar_bar_h_visibility_adjust(sd); + _smart_scrollbar_bar_v_visibility_adjust(sd); + } +} + +static void +_smart_scrollbar_size_adjust(Smart_Data *sd) +{ + if ((sd->child_obj) || (sd->extern_pan)) + { + Evas_Coord x, y, w, h, mx = 0, my = 0, vw = 0, vh = 0, px, py, minx = 0, miny = 0; + double vx, vy, size; + + edje_object_part_geometry_get(sd->edje_obj, "elm.swallow.content", + NULL, NULL, &vw, &vh); + w = sd->child.w; + if (w < 1) w = 1; + size = (double)vw / (double)w; + if (size > 1.0) + { + size = 1.0; + edje_object_part_drag_value_set(sd->edje_obj, "elm.dragable.hbar", 0.0, 0.0); + } + edje_object_part_drag_size_set(sd->edje_obj, "elm.dragable.hbar", size, 1.0); + + h = sd->child.h; + if (h < 1) h = 1; + size = (double)vh / (double)h; + if (size > 1.0) + { + size = 1.0; + edje_object_part_drag_value_set(sd->edje_obj, "elm.dragable.vbar", 0.0, 0.0); + } + edje_object_part_drag_size_set(sd->edje_obj, "elm.dragable.vbar", 1.0, size); + + edje_object_part_drag_value_get(sd->edje_obj, "elm.dragable.hbar", &vx, NULL); + edje_object_part_drag_value_get(sd->edje_obj, "elm.dragable.vbar", NULL, &vy); + sd->pan_func.max_get(sd->pan_obj, &mx, &my); + sd->pan_func.min_get(sd->pan_obj, &minx, &miny); + x = vx * mx + minx; + y = vy * my + miny; + + edje_object_part_drag_step_set(sd->edje_obj, "elm.dragable.hbar", (double)sd->step.x / (double)w, 0.0); + edje_object_part_drag_step_set(sd->edje_obj, "elm.dragable.vbar", 0.0, (double)sd->step.y / (double)h); + if (sd->page.x > 0) + edje_object_part_drag_page_set(sd->edje_obj, "elm.dragable.hbar", (double)sd->page.x / (double)w, 0.0); + else + edje_object_part_drag_page_set(sd->edje_obj, "elm.dragable.hbar", -((double)sd->page.x * ((double)vw / (double)w)) / 100.0, 0.0); + if (sd->page.y > 0) + edje_object_part_drag_page_set(sd->edje_obj, "elm.dragable.vbar", 0.0, (double)sd->page.y / (double)h); + else + edje_object_part_drag_page_set(sd->edje_obj, "elm.dragable.vbar", 0.0, -((double)sd->page.y * ((double)vh / (double)h)) / 100.0); + + sd->pan_func.get(sd->pan_obj, &px, &py); + if (vx != mx) x = px; + if (vy != my) y = py; + sd->pan_func.set(sd->pan_obj, x, y); + // if ((px != 0) || (py != 0)) + // edje_object_signal_emit(sd->edje_obj, "elm,action,scroll", "elm"); + } + else + { + Evas_Coord px = 0, py = 0, minx = 0, miny = 0; + + edje_object_part_drag_size_set(sd->edje_obj, "elm.dragable.vbar", 1.0, 1.0); + edje_object_part_drag_size_set(sd->edje_obj, "elm.dragable.hbar", 1.0, 1.0); + sd->pan_func.min_get(sd->pan_obj, &minx, &miny); + sd->pan_func.get(sd->pan_obj, &px, &py); + sd->pan_func.set(sd->pan_obj, minx, miny); + if ((px != minx) || (py != miny)) + edje_object_signal_emit(sd->edje_obj, "elm,action,scroll", "elm"); + } + _smart_scrollbar_bar_visibility_adjust(sd); +} + +static void +_smart_reconfigure(Smart_Data *sd) +{ + evas_object_move(sd->edje_obj, sd->x, sd->y); + evas_object_resize(sd->edje_obj, sd->w, sd->h); + evas_object_move(sd->event_obj, sd->x, sd->y); + evas_object_resize(sd->event_obj, sd->w, sd->h); + _smart_scrollbar_size_adjust(sd); + _smart_page_adjust(sd); +} + +static void +_smart_add(Evas_Object *obj) +{ + Smart_Data *sd; + Evas_Object *o; + + sd = calloc(1, sizeof(Smart_Data)); + if (!sd) return; + evas_object_smart_data_set(obj, sd); + + sd->smart_obj = obj; + sd->x = 0; + sd->y = 0; + sd->w = 0; + sd->h = 0; + sd->step.x = 32; + sd->step.y = 32; + sd->page.x = -50; + sd->page.y = -50; + sd->hbar_flags = ELM_SMART_SCROLLER_POLICY_AUTO; + sd->vbar_flags = ELM_SMART_SCROLLER_POLICY_AUTO; + sd->hbar_visible = EINA_TRUE; + sd->vbar_visible = EINA_TRUE; + + sd->bounce_horiz = EINA_TRUE; + sd->bounce_vert = EINA_TRUE; + + sd->one_dir_at_a_time = EINA_TRUE; + sd->momentum_animator_disabled = EINA_FALSE; + sd->bounce_animator_disabled = EINA_FALSE; + + o = edje_object_add(evas_object_evas_get(obj)); + evas_object_propagate_events_set(o, 0); + sd->edje_obj = o; + elm_smart_scroller_object_theme_set(NULL, obj, "scroller", "base", "default"); + edje_object_signal_callback_add(o, "drag", "elm.dragable.vbar", _smart_edje_drag_v, sd); + edje_object_signal_callback_add(o, "drag,set", "elm.dragable.vbar", _smart_edje_drag_v, sd); + edje_object_signal_callback_add(o, "drag,start", "elm.dragable.vbar", _smart_edje_drag_v_start, sd); + edje_object_signal_callback_add(o, "drag,stop", "elm.dragable.vbar", _smart_edje_drag_v_stop, sd); + edje_object_signal_callback_add(o, "drag,step", "elm.dragable.vbar", _smart_edje_drag_v, sd); + edje_object_signal_callback_add(o, "drag,page", "elm.dragable.vbar", _smart_edje_drag_v, sd); + edje_object_signal_callback_add(o, "drag", "elm.dragable.hbar", _smart_edje_drag_h, sd); + edje_object_signal_callback_add(o, "drag,set", "elm.dragable.hbar", _smart_edje_drag_h, sd); + edje_object_signal_callback_add(o, "drag,start", "elm.dragable.hbar", _smart_edje_drag_h_start, sd); + edje_object_signal_callback_add(o, "drag,stop", "elm.dragable.hbar", _smart_edje_drag_h_stop, sd); + edje_object_signal_callback_add(o, "drag,step", "elm.dragable.hbar", _smart_edje_drag_h, sd); + edje_object_signal_callback_add(o, "drag,page", "elm.dragable.hbar", _smart_edje_drag_h, sd); + evas_object_smart_member_add(o, obj); + + o = evas_object_rectangle_add(evas_object_evas_get(obj)); + sd->event_obj = o; + evas_object_color_set(o, 0, 0, 0, 0); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_WHEEL, _smart_event_wheel, sd); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _smart_event_mouse_down, sd); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _smart_event_mouse_up, sd); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, _smart_event_mouse_move, sd); + evas_object_smart_member_add(o, obj); + evas_object_repeat_events_set(o, 1); + + sd->pan_func.set = _elm_smart_pan_set; + sd->pan_func.get = _elm_smart_pan_get; + sd->pan_func.max_get = _elm_smart_pan_max_get; + sd->pan_func.min_get = _elm_smart_pan_min_get; + sd->pan_func.child_size_get = _elm_smart_pan_child_size_get; + sd->pan_func.gravity_set = _elm_smart_pan_gravity_set; + sd->pan_func.gravity_get = _elm_smart_pan_gravity_get; + + _smart_scrollbar_reset(sd); +} + +static void +_smart_del(Evas_Object *obj) +{ + INTERNAL_ENTRY; + elm_smart_scroller_child_set(obj, NULL); + if (!sd->extern_pan) evas_object_del(sd->pan_obj); + evas_object_del(sd->edje_obj); + evas_object_del(sd->event_obj); + if (sd->down.hold_animator) ecore_animator_del(sd->down.hold_animator); + if (sd->down.onhold_animator) ecore_animator_del(sd->down.onhold_animator); + if (sd->down.momentum_animator) ecore_animator_del(sd->down.momentum_animator); + if (sd->down.bounce_x_animator) ecore_animator_del(sd->down.bounce_x_animator); + if (sd->down.bounce_y_animator) ecore_animator_del(sd->down.bounce_y_animator); + if (sd->scrollto.x.animator) ecore_animator_del(sd->scrollto.x.animator); + if (sd->scrollto.y.animator) ecore_animator_del(sd->scrollto.y.animator); + free(sd); + evas_object_smart_data_set(obj, NULL); +} + +static void +_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y) +{ + INTERNAL_ENTRY; + sd->x = x; + sd->y = y; + _smart_reconfigure(sd); +} + +static void +_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) +{ + INTERNAL_ENTRY; + sd->w = w; + sd->h = h; + _smart_reconfigure(sd); + _elm_smart_scroller_wanted_region_set(obj); +} + +static void +_smart_show(Evas_Object *obj) +{ + INTERNAL_ENTRY; + evas_object_show(sd->edje_obj); + evas_object_show(sd->event_obj); +} + +static void +_smart_hide(Evas_Object *obj) +{ + INTERNAL_ENTRY; + evas_object_hide(sd->edje_obj); + evas_object_hide(sd->event_obj); +} + +static void +_smart_color_set(Evas_Object *obj, int r, int g, int b, int a) +{ + INTERNAL_ENTRY; + evas_object_color_set(sd->edje_obj, r, g, b, a); +} + +static void +_smart_clip_set(Evas_Object *obj, Evas_Object *clip) +{ + INTERNAL_ENTRY; + evas_object_clip_set(sd->edje_obj, clip); + evas_object_clip_set(sd->event_obj, clip); +} + +static void +_smart_clip_unset(Evas_Object *obj) +{ + INTERNAL_ENTRY; + evas_object_clip_unset(sd->edje_obj); + evas_object_clip_unset(sd->event_obj); +} + +/* never need to touch this */ + +static void +_smart_init(void) +{ + if (_smart) return; + { + static const Evas_Smart_Class sc = + { + SMART_NAME, + EVAS_SMART_CLASS_VERSION, + _smart_add, + _smart_del, + _smart_move, + _smart_resize, + _smart_show, + _smart_hide, + _smart_color_set, + _smart_clip_set, + _smart_clip_unset, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + }; + _smart = evas_smart_class_new(&sc); + } +} diff --git a/libraries/elementary/src/lib/els_scroller.h b/libraries/elementary/src/lib/els_scroller.h new file mode 100644 index 0000000..5566f4e --- /dev/null +++ b/libraries/elementary/src/lib/els_scroller.h @@ -0,0 +1,48 @@ +typedef enum +{ + ELM_SMART_SCROLLER_POLICY_AUTO, + ELM_SMART_SCROLLER_POLICY_ON, + ELM_SMART_SCROLLER_POLICY_OFF +} +Elm_Smart_Scroller_Policy; + +Evas_Object *elm_smart_scroller_add(Evas *evas); +void elm_smart_scroller_child_set(Evas_Object *obj, Evas_Object *child); +void elm_smart_scroller_extern_pan_set(Evas_Object *obj, Evas_Object *pan, void (*pan_set)(Evas_Object *obj, Evas_Coord x, Evas_Coord y), void (*pan_get)(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y), void (*pan_max_get)(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y), void (*pan_min_get)(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y), void (*pan_child_size_get)(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)); +void elm_smart_scroller_custom_edje_file_set(Evas_Object *obj, char *file, char *group); +void elm_smart_scroller_child_pos_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y); +void elm_smart_scroller_child_pos_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y); +void elm_smart_scroller_child_region_show(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h); +void elm_smart_scroller_child_region_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h); +void elm_smart_scroller_child_viewport_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h); +void elm_smart_scroller_step_size_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y); +void elm_smart_scroller_step_size_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y); +void elm_smart_scroller_page_size_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y); +void elm_smart_scroller_page_size_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y); +void elm_smart_scroller_policy_set(Evas_Object *obj, Elm_Smart_Scroller_Policy hbar, Elm_Smart_Scroller_Policy vbar); +void elm_smart_scroller_policy_get(Evas_Object *obj, Elm_Smart_Scroller_Policy *hbar, Elm_Smart_Scroller_Policy *vbar); +Evas_Object *elm_smart_scroller_edje_object_get(Evas_Object *obj); +void elm_smart_scroller_single_dir_set(Evas_Object *obj, Eina_Bool single_dir); +Eina_Bool elm_smart_scroller_single_dir_get(Evas_Object *obj); +void elm_smart_scroller_object_theme_set(Evas_Object *parent, Evas_Object *obj, const char *clas, const char *group, const char *style); +void elm_smart_scroller_mirrored_set(Evas_Object *obj, Eina_Bool mirrored); +void elm_smart_scroller_hold_set(Evas_Object *obj, Eina_Bool hold); +void elm_smart_scroller_freeze_set(Evas_Object *obj, Eina_Bool freeze); +void elm_smart_scroller_bounce_allow_set(Evas_Object *obj, Eina_Bool horiz, Eina_Bool vert); +void elm_smart_scroller_bounce_allow_get(const Evas_Object *obj, Eina_Bool *horiz, Eina_Bool *vert); +void elm_smart_scroller_paging_set(Evas_Object *obj, double pagerel_h, double pagerel_v, Evas_Coord pagesize_h, Evas_Coord pagesize_v); +void elm_smart_scroller_paging_get(Evas_Object *obj, double *pagerel_h, double *pagerel_v, Evas_Coord *pagesize_h, Evas_Coord *pagesize_v); +void elm_smart_scroller_current_page_get(Evas_Object *obj, int *pagenumber_h, int *pagenumber_v); +void elm_smart_scroller_last_page_get(Evas_Object *obj, int *pagenumber_h, int *pagenumber_v); +void elm_smart_scroller_page_show(Evas_Object *obj, int pagenumber_h, int pagenumber_v); +void elm_smart_scroller_page_bring_in(Evas_Object *obj, int pagenumber_h, int pagenumber_v); +void elm_smart_scroller_region_bring_in(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h); +void elm_smart_scroller_widget_set(Evas_Object *obj, Evas_Object *wid); +void elm_smart_scroller_gravity_set(Evas_Object *obj, double x, double y); +void elm_smart_scroller_gravity_get(Evas_Object *obj, double *x, double *y); +Eina_Bool elm_smart_scroller_momentum_animator_disabled_get(Evas_Object *obj); +void elm_smart_scroller_momentum_animator_disabled_set(Evas_Object *obj, Eina_Bool disabled); +void elm_smart_scroller_bounce_animator_disabled_set(Evas_Object *obj, Eina_Bool disabled); +Eina_Bool elm_smart_scroller_bounce_animator_disabled_get(Evas_Object *obj); +Eina_Bool elm_smart_scroller_wheel_disabled_get(Evas_Object *obj); +void elm_smart_scroller_wheel_disabled_set(Evas_Object *obj, Eina_Bool disabled); diff --git a/libraries/elementary/src/lib/els_tooltip.c b/libraries/elementary/src/lib/els_tooltip.c new file mode 100644 index 0000000..f1a451f --- /dev/null +++ b/libraries/elementary/src/lib/els_tooltip.c @@ -0,0 +1,951 @@ +#include +#include "elm_priv.h" + +#ifdef ISCOMFITOR +# define STR(X) #X +# define STUPID(X) STR(X) +# define TTDBG(x...) fprintf(stderr, STUPID(__LINE__)": " x) +#else +# define TTDBG(X...) +#endif + +static const char _tooltip_key[] = "_elm_tooltip"; + +#define ELM_TOOLTIP_GET_OR_RETURN(tt, obj, ...) \ + Elm_Tooltip *tt; \ + do \ + { \ + if (!(obj)) \ + { \ + CRITICAL("Null pointer: " #obj); \ + return __VA_ARGS__; \ + } \ + tt = evas_object_data_get((obj), _tooltip_key); \ + if (!tt) \ + { \ + ERR("Object does not have tooltip: " #obj); \ + return __VA_ARGS__; \ + } \ + } \ + while (0) + +struct _Elm_Tooltip +{ + Elm_Tooltip_Content_Cb func; + Evas_Smart_Cb del_cb; + const void *data; + const char *style; + Evas *evas, *tt_evas; + Evas_Object *eventarea, *owner; + Evas_Object *tooltip, *content; + Evas_Object *tt_win; + Ecore_Timer *show_timer; + Ecore_Timer *hide_timer; + Ecore_Job *reconfigure_job; + Evas_Coord mouse_x, mouse_y; + struct + { + Evas_Coord x, y, bx, by; + } pad; + struct + { + double x, y; + } rel_pos; + double hide_timeout; /* from theme */ + Eina_Bool visible_lock:1; + Eina_Bool changed_style:1; + Eina_Bool free_size : 1; +}; + +static void _elm_tooltip_reconfigure(Elm_Tooltip *tt); +static void _elm_tooltip_reconfigure_job_start(Elm_Tooltip *tt); +static void _elm_tooltip_reconfigure_job_stop(Elm_Tooltip *tt); +static void _elm_tooltip_hide_anim_start(Elm_Tooltip *tt); +static void _elm_tooltip_hide_anim_stop(Elm_Tooltip *tt); +static void _elm_tooltip_show_timer_stop(Elm_Tooltip *tt); +static void _elm_tooltip_hide(Elm_Tooltip *tt); +static void _elm_tooltip_data_clean(Elm_Tooltip *tt); + +static void +_elm_tooltip_content_changed_hints_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + _elm_tooltip_reconfigure_job_start(data); + TTDBG("HINTS CHANGED\n"); +} + +static void +_elm_tooltip_content_del_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Tooltip *tt = data; + tt->content = NULL; + tt->visible_lock = EINA_FALSE; + if (tt->tooltip) _elm_tooltip_hide(tt); +} + +static void +_elm_tooltip_obj_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Tooltip *tt = data; + _elm_tooltip_reconfigure_job_start(tt); + TTDBG("TT MOVED\n"); +} + +static void +_elm_tooltip_obj_resize_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Tooltip *tt = data; + _elm_tooltip_reconfigure_job_start(tt); + TTDBG("TT RESIZE\n"); +} + +static void +_elm_tooltip_obj_mouse_move_cb(Elm_Tooltip *tt, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Event_Mouse_Move *ev) +{ + if (tt->mouse_x || tt->mouse_y) + { + if ((abs(ev->cur.output.x - tt->mouse_x) < 3) && + (abs(ev->cur.output.y - tt->mouse_y) < 3)) + { + TTDBG("MOUSE MOVE REJECTED!\n"); + return; + } + } + tt->mouse_x = ev->cur.output.x; + tt->mouse_y = ev->cur.output.y; + TTDBG("MOUSE MOVED\n"); + _elm_tooltip_reconfigure_job_start(tt); +} + +static void +_elm_tooltip_show(Elm_Tooltip *tt) +{ + _elm_tooltip_show_timer_stop(tt); + _elm_tooltip_hide_anim_stop(tt); + + TTDBG("TT SHOW\n"); + if (tt->tooltip) + { + _elm_tooltip_reconfigure_job_start(tt); + TTDBG("RECURSIVE JOB\n"); + return; + } + if (tt->free_size) + { + tt->tt_win = elm_win_add(NULL, "tooltip", ELM_WIN_BASIC); + elm_win_borderless_set(tt->tt_win, EINA_TRUE); + elm_win_override_set(tt->tt_win, EINA_TRUE); + tt->tt_evas = evas_object_evas_get(tt->tt_win); + tt->tooltip = edje_object_add(tt->tt_evas); + evas_object_move(tt->tooltip, 0, 0); + elm_win_resize_object_add(tt->tt_win, tt->tooltip); +#ifdef HAVE_ELEMENTARY_X + ecore_x_window_shape_input_rectangle_set(elm_win_xwindow_get(tt->tt_win), 0, 0, 0, 0); +#endif + evas_object_show(tt->tt_win); + } + else + tt->tooltip = edje_object_add(tt->evas); + if (!tt->tooltip) return; + + evas_object_layer_set(tt->tt_win ?: tt->tooltip, ELM_OBJECT_LAYER_TOOLTIP); + + evas_object_event_callback_add + (tt->eventarea, EVAS_CALLBACK_MOVE, _elm_tooltip_obj_move_cb, tt); + evas_object_event_callback_add + (tt->eventarea, EVAS_CALLBACK_RESIZE, _elm_tooltip_obj_resize_cb, tt); + evas_object_event_callback_add + (tt->eventarea, EVAS_CALLBACK_MOUSE_MOVE, (Evas_Object_Event_Cb)_elm_tooltip_obj_mouse_move_cb, tt); + + tt->changed_style = EINA_TRUE; + _elm_tooltip_reconfigure_job_start(tt); +} + +static void +_elm_tooltip_content_del(Elm_Tooltip *tt) +{ + if (!tt->content) return; + + TTDBG("CONTENT DEL\n"); + evas_object_event_callback_del_full + (tt->content, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _elm_tooltip_content_changed_hints_cb, tt); + evas_object_event_callback_del_full + (tt->content, EVAS_CALLBACK_DEL, + _elm_tooltip_content_del_cb, tt); + evas_object_hide(tt->content); + evas_object_del(tt->content); + tt->content = NULL; +} + + +static void +_elm_tooltip_hide(Elm_Tooltip *tt) +{ + Evas_Object *del; + TTDBG("TT HIDE\n"); + _elm_tooltip_show_timer_stop(tt); + _elm_tooltip_hide_anim_stop(tt); + _elm_tooltip_reconfigure_job_stop(tt); + + if (!tt->tooltip) return; + if (tt->visible_lock) return; + + _elm_tooltip_content_del(tt); + + evas_object_event_callback_del_full + (tt->eventarea, EVAS_CALLBACK_MOVE, _elm_tooltip_obj_move_cb, tt); + evas_object_event_callback_del_full + (tt->eventarea, EVAS_CALLBACK_RESIZE, _elm_tooltip_obj_resize_cb, tt); + evas_object_event_callback_del_full + (tt->eventarea, EVAS_CALLBACK_MOUSE_MOVE, (Evas_Object_Event_Cb)_elm_tooltip_obj_mouse_move_cb, tt); + + del = tt->tt_win ?: tt->tooltip; + + tt->tt_win = NULL; + tt->tt_evas = NULL; + tt->tooltip = NULL; + evas_object_del(del); +} + +static void +_elm_tooltip_reconfigure_job(void *data) +{ + Elm_Tooltip *tt = data; + tt->reconfigure_job = NULL; + _elm_tooltip_reconfigure(data); +} + +static void +_elm_tooltip_reconfigure_job_stop(Elm_Tooltip *tt) +{ + if (!tt->reconfigure_job) return; + ecore_job_del(tt->reconfigure_job); + tt->reconfigure_job = NULL; +} + +static void +_elm_tooltip_reconfigure_job_start(Elm_Tooltip *tt) +{ + if (tt->reconfigure_job) ecore_job_del(tt->reconfigure_job); + tt->reconfigure_job = ecore_job_add(_elm_tooltip_reconfigure_job, tt); +} + +static Eina_Bool +_elm_tooltip_hide_anim_cb(void *data) +{ + Elm_Tooltip *tt = data; + tt->hide_timer = NULL; + _elm_tooltip_hide(tt); + return EINA_FALSE; +} + +static void +_elm_tooltip_hide_anim_start(Elm_Tooltip *tt) +{ + double extra = 0; + if (tt->hide_timer) return; + TTDBG("HIDE START\n"); + /* hide slightly faster when in window mode to look less stupid */ + if ((tt->hide_timeout > 0) && tt->tt_win) extra = 0.1; + edje_object_signal_emit(tt->tooltip, "elm,action,hide", "elm"); + tt->hide_timer = ecore_timer_add + (tt->hide_timeout - extra, _elm_tooltip_hide_anim_cb, tt); +} + +static void +_elm_tooltip_hide_anim_stop(Elm_Tooltip *tt) +{ + if (!tt->hide_timer) return; + if (tt->tooltip) + edje_object_signal_emit(tt->tooltip, "elm,action,show", "elm"); + ecore_timer_del(tt->hide_timer); + tt->hide_timer = NULL; +} + +static void +_elm_tooltip_reconfigure(Elm_Tooltip *tt) +{ + Evas_Coord ox, oy, ow, oh, px, py, tx, ty, tw, th, cw = 0, ch = 0; + Evas_Coord eminw, eminh, ominw, ominh; + double rel_x, rel_y; + Eina_Bool inside_eventarea; + + _elm_tooltip_reconfigure_job_stop(tt); + + if (tt->hide_timer) return; + if (!tt->tooltip) return; + if (tt->changed_style) + { + const char *style = tt->style ? tt->style : "default"; + const char *str; + if (!_elm_theme_object_set(tt->tt_win ? NULL : tt->owner, tt->tooltip, "tooltip", "base", style)) + { + ERR("Could not apply the theme to the tooltip! style=%s", style); + if (tt->tt_win) evas_object_del(tt->tt_win); + else evas_object_del(tt->tooltip); + tt->tt_win = NULL; + tt->tt_evas = NULL; + tt->tooltip = NULL; + return; + } + + tt->rel_pos.x = 0; + tt->rel_pos.y = 0; + + tt->pad.x = 0; + tt->pad.y = 0; + tt->pad.bx = 0; + tt->pad.by = 0; + tt->hide_timeout = 0.0; + + str = edje_object_data_get(tt->tooltip, "transparent"); + if (tt->tt_win) + { /* FIXME: hardcoded here is bad */ + if (str && (!strcmp(str, "enabled"))) + { + elm_win_alpha_set(tt->tt_win, EINA_TRUE); + } + else + { + elm_win_alpha_set(tt->tt_win, EINA_FALSE); + } + } + + str = edje_object_data_get(tt->tooltip, "pad_x"); + if (str) tt->pad.x = atoi(str); + str = edje_object_data_get(tt->tooltip, "pad_y"); + if (str) tt->pad.y = atoi(str); + + str = edje_object_data_get(tt->tooltip, "pad_border_x"); + if (str) tt->pad.bx = atoi(str); + str = edje_object_data_get(tt->tooltip, "pad_border_y"); + if (str) tt->pad.by = atoi(str); + + str = edje_object_data_get(tt->tooltip, "hide_timeout"); + if (str) + { + tt->hide_timeout = atof(str); + if (tt->hide_timeout < 0.0) tt->hide_timeout = 0.0; + } + + evas_object_pass_events_set(tt->tooltip, EINA_TRUE); + tt->changed_style = EINA_FALSE; + if (tt->tooltip) + edje_object_part_swallow(tt->tooltip, "elm.swallow.content", + tt->content); + + edje_object_signal_emit(tt->tooltip, "elm,action,show", "elm"); + } + + if (!tt->content) + { + tt->content = tt->func((void *)tt->data, tt->owner, tt->tt_win ? : tt->owner); + if (!tt->content) + { + WRN("could not create tooltip content!"); + if (tt->tt_win) evas_object_del(tt->tt_win); + else evas_object_del(tt->tooltip); + + tt->tt_win = NULL; + tt->tt_evas = NULL; + tt->tooltip = NULL; + return; + } + evas_object_show(tt->content); + evas_object_layer_set(tt->content, ELM_OBJECT_LAYER_TOOLTIP); + evas_object_pass_events_set(tt->content, EINA_TRUE); + edje_object_part_swallow + (tt->tooltip, "elm.swallow.content", tt->content); + evas_object_event_callback_add(tt->content, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _elm_tooltip_content_changed_hints_cb, tt); + evas_object_event_callback_add(tt->content, EVAS_CALLBACK_DEL, + _elm_tooltip_content_del_cb, tt); + + } + TTDBG("*******RECALC\n"); + evas_object_size_hint_min_get(tt->content, &ominw, &ominh); + edje_object_size_min_get(tt->tooltip, &eminw, &eminh); + + if (eminw && (ominw < eminw)) ominw = eminw; + if (eminw && (ominh < eminh)) ominh = eminh; + + if (ominw < 1) ominw = 10; /* at least it is noticeable */ + if (ominh < 1) ominh = 10; /* at least it is noticeable */ + + edje_object_size_min_restricted_calc(tt->tooltip, &tw, &th, ominw, ominh); + TTDBG("TTSIZE: tw=%d,th=%d,ominw=%d,ominh=%d\n", tw, th, ominw, ominh); + + if (tt->tt_win) + elm_win_screen_size_get(elm_object_top_widget_get(tt->owner), NULL, NULL, &cw, &ch); + if (!cw) + evas_output_size_get(tt->tt_evas ?: tt->evas, &cw, &ch); + TTDBG("SCREEN: cw=%d,ch=%d\n", cw, ch); + + evas_object_geometry_get(tt->eventarea, &ox, &oy, &ow, &oh); + TTDBG("EVENTAREA: ox=%d,oy=%d,ow=%d,oh=%d\n", ox, oy, ow, oh); + + if (tt->tt_win) + { + int x, y; + Evas_Object *win = elm_object_top_widget_get(tt->owner); +#ifdef HAVE_ELEMENTARY_X + Ecore_X_Window xwin = elm_win_xwindow_get(win); + ecore_x_pointer_xy_get(xwin, &px, &py); +#endif + elm_win_screen_position_get(win, &x, &y); + ox += x; + if (px) px += x; + oy += y; + if (py) py += y; + } + else + evas_pointer_canvas_xy_get(tt->evas, &px, &py); + TTDBG("POINTER: px=%d,py=%d\n", px, py); + inside_eventarea = ((px >= ox) && (py >= oy) && + (px <= ox + ow) && (py <= oy + oh)); + if (inside_eventarea) + { + /* try to position bottom right corner at pointer */ + tx = px - tw; + ty = py - th; + TTDBG("INIT (EVENTAREA)\n"); + } + else + { + /* try centered on middle of eventarea */ + tx = ox + (ow / 2) - (tw / 2); + if (0 > (th - oy - oh)) ty = oy + th; + else ty = oy - oh; + TTDBG("INIT (INTERPRETED)\n"); + } + TTDBG("ADJUST (POINTER): tx=%d,ty=%d\n", tx, ty); + if (tx < 0) + { + /* if we're offscreen, try to flip over the Y axis */ + if (abs((tx + 2 * tw) - cw) < abs(tx)) + tx += tw; + } + else if ((tx > px) && (px > tw)) + { + if (tx + tw < cw) + tx += tw; + } + if (ty < 0) + { + /* if we're offscreen, try to flip over the X axis */ + if (abs((ty + 2 * th) - ch) < abs(ty)) + ty += th; + } + else if ((ty > py) && (py > th)) + { + if (ty + th < ch) + ty += th; + } + TTDBG("ADJUST (FLIP): tx=%d,ty=%d\n", tx, ty); + if (inside_eventarea) + { + if ((tx == px) && ((tx + tw + tt->pad.x < cw) || (tx + tw > cw))) tx += tt->pad.x; + else if ((tx - tt->pad.x > 0) || (tx < 0)) tx -= tt->pad.x; + if ((ty == py) && ((ty + th + tt->pad.y < ch) || (ty + th > ch))) ty += tt->pad.y; + else if ((ty - tt->pad.y > 0) || (ty < 0)) ty -= tt->pad.y; + } + TTDBG("PAD: tx=%d,ty=%d\n", tx, ty); + if (tt->pad.bx * 2 + tw < cw) + { + if (tx < tt->pad.bx) tx = tt->pad.bx; + else if ((tx >= tw) && (tx + tt->pad.bx <= cw)) tx += tt->pad.bx; + else if (tx - tt->pad.bx >= 0) tx -= tt->pad.bx; + } + else if (tx < 0) tx -= tt->pad.bx; + else if (tx > cw) tx += tt->pad.bx; + if (tt->pad.by * 2 + th < ch) + { + if (ty < tt->pad.by) ty = tt->pad.by; + else if ((ty >= th) && (ty + tt->pad.by <= ch)) ty += tt->pad.by; + else if (ty - tt->pad.by >= 0) ty -= tt->pad.by; + } + else if (ty < 0) ty -= tt->pad.by; + else if (ty > ch) ty += tt->pad.by; + TTDBG("PAD (BORDER): tx=%d,ty=%d\n", tx, ty); + if (((tx < 0) && (tw < cw)) || ((ty < 0) && (th < ch))) + { + TTDBG("POSITIONING FAILED! THIS IS A BUG SOMEWHERE!\n"); + abort(); + return; + } + evas_object_move(tt->tt_win ? : tt->tooltip, tx, ty); + evas_object_resize(tt->tt_win ? : tt->tooltip, tw, th); + TTDBG("FINAL: tx=%d,ty=%d,tw=%d,th=%d\n", tx, ty, tw, th); + evas_object_show(tt->tooltip); + + if (inside_eventarea) + { + rel_x = (px - tx) / (double)tw; + rel_y = (py - ty) / (double)th; + } + else + { + rel_x = (ox + (ow / 2) - tx) / (double)tw; + rel_y = (oy + (oh / 2) - ty) / (double)th; + } + +#define FDIF(a, b) (fabs((a) - (b)) > 0.0001) + if ((FDIF(rel_x, tt->rel_pos.x)) || (FDIF(rel_y, tt->rel_pos.y))) + { + Edje_Message_Float_Set *msg; + + msg = alloca(sizeof(Edje_Message_Float_Set) + sizeof(double)); + msg->count = 2; + msg->val[0] = rel_x; + msg->val[1] = rel_y; + tt->rel_pos.x = rel_x; + tt->rel_pos.y = rel_y; + + edje_object_message_send(tt->tooltip, EDJE_MESSAGE_FLOAT_SET, 1, msg); + } +#undef FDIF +} + +static void +_elm_tooltip_show_timer_stop(Elm_Tooltip *tt) +{ + if (!tt->show_timer) return; + ecore_timer_del(tt->show_timer); + tt->show_timer = NULL; +} + +static Eina_Bool +_elm_tooltip_timer_show_cb(void *data) +{ + Elm_Tooltip *tt = data; + tt->show_timer = NULL; + _elm_tooltip_show(tt); + return ECORE_CALLBACK_CANCEL; +} + +static void +_elm_tooltip_obj_mouse_in_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Elm_Tooltip *tt = data; + + _elm_tooltip_hide_anim_stop(tt); + + if ((tt->show_timer) || (tt->tooltip)) return; + + tt->show_timer = ecore_timer_add(_elm_config->tooltip_delay, _elm_tooltip_timer_show_cb, tt); + TTDBG("MOUSE IN\n"); +} + +static void +_elm_tooltip_obj_mouse_out_cb(Elm_Tooltip *tt, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Event_Mouse_Out *event __UNUSED__) +{ + if (tt->visible_lock) return; + + if (!tt->tooltip) + { + _elm_tooltip_show_timer_stop(tt); + return; + } + _elm_tooltip_hide_anim_start(tt); + TTDBG("MOUSE OUT\n"); +} + +static void _elm_tooltip_obj_free_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__); + +static void +_elm_tooltip_unset(Elm_Tooltip *tt) +{ + tt->visible_lock = EINA_FALSE; + _elm_tooltip_hide(tt); + _elm_tooltip_data_clean(tt); + + if (tt->eventarea) + { + evas_object_event_callback_del_full + (tt->eventarea, EVAS_CALLBACK_MOUSE_IN, + _elm_tooltip_obj_mouse_in_cb, tt); + evas_object_event_callback_del_full + (tt->eventarea, EVAS_CALLBACK_MOUSE_OUT, + (Evas_Object_Event_Cb)_elm_tooltip_obj_mouse_out_cb, tt); + evas_object_event_callback_del_full + (tt->eventarea, EVAS_CALLBACK_FREE, _elm_tooltip_obj_free_cb, tt); + + evas_object_data_del(tt->eventarea, _tooltip_key); + } + if (tt->owner) + { + evas_object_event_callback_del_full + (tt->owner, EVAS_CALLBACK_FREE, _elm_tooltip_obj_free_cb, tt); + elm_widget_tooltip_del(tt->owner, tt); + } + + eina_stringshare_del(tt->style); + free(tt); +} + +static void +_elm_tooltip_obj_free_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Elm_Tooltip *tt = data; + if (tt->eventarea == obj) tt->eventarea = NULL; + if (tt->owner == obj) tt->owner = NULL; + _elm_tooltip_unset(tt); +} + +static Evas_Object * +_elm_tooltip_label_create(void *data, Evas_Object *obj __UNUSED__, Evas_Object *tooltip) +{ + Evas_Object *label = elm_label_add(tooltip); + if (!label) + return NULL; + elm_object_style_set(label, "tooltip"); + elm_object_text_set(label, data); + return label; +} + +static Evas_Object * +_elm_tooltip_trans_label_create(void *data, Evas_Object *obj __UNUSED__, Evas_Object *tooltip) +{ + Evas_Object *label = elm_label_add(tooltip); + const char **text = data; + if (!label) + return NULL; + elm_object_style_set(label, "tooltip"); + elm_object_domain_translatable_text_set(label, text[0], text[1]); + return label; +} + +static void +_elm_tooltip_label_del_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + eina_stringshare_del(data); +} + +static void +_elm_tooltip_trans_label_del_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + const char **text = data; + eina_stringshare_del(text[0]); + eina_stringshare_del(text[1]); + free(text); +} + +static void +_elm_tooltip_data_clean(Elm_Tooltip *tt) +{ + if (tt->del_cb) tt->del_cb((void *)tt->data, tt->owner, NULL); + + _elm_tooltip_content_del(tt); + + tt->data = NULL; + tt->del_cb = NULL; +} + +/** + * Notify tooltip should recalculate its theme. + * @internal + */ +void +elm_tooltip_theme(Elm_Tooltip *tt) +{ + if (!tt->tooltip) return; + tt->changed_style = EINA_TRUE; + _elm_tooltip_reconfigure_job_start(tt); +} + + +/** + * Set the content to be shown in the tooltip object for specific event area. + * + * Setup the tooltip to object. The object @a eventarea can have only + * one tooltip, so any previous tooltip data is removed. @p func(with + * @p data) will be called every time that need show the tooltip and + * it should return a valid Evas_Object. This object is then managed + * fully by tooltip system and is deleted when the tooltip is gone. + * + * This is an internal function that is used by objects with sub-items + * that want to provide different tooltips for each of them. The @a + * owner object should be an elm_widget and will be used to track + * theme changes and to feed @a func and @a del_cb. The @a eventarea + * may be any object and is the one that should be used later on with + * elm_object_tooltip apis, such as elm_object_tooltip_hide(), + * elm_object_tooltip_show() or elm_object_tooltip_unset(). + * + * @param eventarea the object being attached a tooltip. + * @param owner the elm_widget that owns this object, will be used to + * track theme changes and to be used in @a func or @a del_cb. + * @param func the function used to create the tooltip contents. The + * @a Evas_Object parameters will receive @a owner as value. + * @param data what to provide to @a func as callback data/context. + * @param del_cb called when data is not needed anymore, either when + * another callback replaces @p func, the tooltip is unset with + * elm_object_tooltip_unset() or the owner object @a obj + * dies. This callback receives as the first parameter the + * given @a data, and @c event_info is NULL. + * + * @internal + * @ingroup Tooltips + */ +void +elm_object_sub_tooltip_content_cb_set(Evas_Object *eventarea, Evas_Object *owner, Elm_Tooltip_Content_Cb func, const void *data, Evas_Smart_Cb del_cb) +{ + Elm_Tooltip *tt = NULL; + Eina_Bool just_created; + + EINA_SAFETY_ON_NULL_GOTO(owner, error); + EINA_SAFETY_ON_NULL_GOTO(eventarea, error); + + if (!func) + { + elm_object_tooltip_unset(eventarea); + return; + } + + tt = evas_object_data_get(eventarea, _tooltip_key); + if (tt) + { + if (tt->owner != owner) + { + if (tt->owner != eventarea) + evas_object_event_callback_del_full + (tt->owner, EVAS_CALLBACK_FREE, _elm_tooltip_obj_free_cb, tt); + + elm_widget_tooltip_del(tt->owner, tt); + + if (owner != eventarea) + evas_object_event_callback_add + (owner, EVAS_CALLBACK_FREE, _elm_tooltip_obj_free_cb, tt); + + elm_widget_tooltip_add(tt->owner, tt); + } + + if ((tt->func == func) && (tt->data == data) && + (tt->del_cb == del_cb)) + return; + _elm_tooltip_data_clean(tt); + just_created = EINA_FALSE; + } + else + { + tt = ELM_NEW(Elm_Tooltip); + if (!tt) goto error; + + tt->owner = owner; + tt->eventarea = eventarea; + tt->evas = evas_object_evas_get(eventarea); + evas_object_data_set(eventarea, _tooltip_key, tt); + + just_created = EINA_TRUE; + + evas_object_event_callback_add(eventarea, EVAS_CALLBACK_MOUSE_IN, + _elm_tooltip_obj_mouse_in_cb, tt); + evas_object_event_callback_add(eventarea, EVAS_CALLBACK_MOUSE_OUT, + (Evas_Object_Event_Cb)_elm_tooltip_obj_mouse_out_cb, tt); + evas_object_event_callback_add(eventarea, EVAS_CALLBACK_FREE, + _elm_tooltip_obj_free_cb, tt); + + if (owner != eventarea) + evas_object_event_callback_add + (owner, EVAS_CALLBACK_FREE, _elm_tooltip_obj_free_cb, tt); + + elm_widget_tooltip_add(tt->owner, tt); + } + + tt->func = func; + tt->data = data; + tt->del_cb = del_cb; + + if (!just_created) _elm_tooltip_reconfigure_job_start(tt); + return; + + error: + if (del_cb) del_cb((void *)data, owner, NULL); +} + +/** + * Force show tooltip of object + * + * @param obj Target object + * + * Force show the tooltip and disable hide on mouse_out. + * If another content is set as tooltip, the visible tooltip will hididen and + * showed again with new content. + * This can force show more than one tooltip at a time. + * + * @ingroup Tooltips + */ +EAPI void +elm_object_tooltip_show(Evas_Object *obj) +{ + ELM_TOOLTIP_GET_OR_RETURN(tt, obj); + tt->visible_lock = EINA_TRUE; + _elm_tooltip_show(tt); +} + +/** + * Force hide tooltip of object + * + * @param obj Target object + * + * Force hide the tooltip and (re)enable future mouse interations. + * + * @ingroup Tooltips + */ +EAPI void +elm_object_tooltip_hide(Evas_Object *obj) +{ + ELM_TOOLTIP_GET_OR_RETURN(tt, obj); + tt->visible_lock = EINA_FALSE; + _elm_tooltip_hide_anim_start(tt); +} + +/** + * Set the text to be shown in the tooltip object + * + * @param obj Target object + * @param text The text to set in the content + * + * Setup the text as tooltip to object. The object can have only one tooltip, + * so any previous tooltip data is removed. + * This method call internaly the elm_tooltip_content_cb_set(). + * + * @ingroup Tooltips + */ +EAPI void +elm_object_tooltip_text_set(Evas_Object *obj, const char *text) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + EINA_SAFETY_ON_NULL_RETURN(text); + + text = eina_stringshare_add(text); + elm_object_tooltip_content_cb_set + (obj, _elm_tooltip_label_create, text, _elm_tooltip_label_del_cb); +} + +/** + */ +EAPI void +elm_object_tooltip_domain_translatable_text_set(Evas_Object *obj, const char *domain, const char *text) +{ + const char **data; + EINA_SAFETY_ON_NULL_RETURN(obj); + EINA_SAFETY_ON_NULL_RETURN(text); + + data = malloc(2 * sizeof(char *)); + if (!data) return; + data[0] = eina_stringshare_add(domain); + data[1] = eina_stringshare_add(text); + elm_object_tooltip_content_cb_set + (obj, _elm_tooltip_trans_label_create, data, + _elm_tooltip_trans_label_del_cb); +} + +/** + * Set the content to be shown in the tooltip object + * + * Setup the tooltip to object. The object can have only one tooltip, + * so any previous tooltip data is removed. @p func(with @p data) will + * be called every time that need show the tooltip and it should + * return a valid Evas_Object. This object is then managed fully by + * tooltip system and is deleted when the tooltip is gone. + * + * @param obj the object being attached a tooltip. + * @param func the function used to create the tooltip contents. + * @param data what to provide to @a func as callback data/context. + * @param del_cb called when data is not needed anymore, either when + * another callback replaces @p func, the tooltip is unset with + * elm_object_tooltip_unset() or the owner object @a obj + * dies. This callback receives as the first parameter the + * given @a data, and @c event_info is NULL. + * + * @ingroup Tooltips + */ +EAPI void +elm_object_tooltip_content_cb_set(Evas_Object *obj, Elm_Tooltip_Content_Cb func, const void *data, Evas_Smart_Cb del_cb) +{ + elm_object_sub_tooltip_content_cb_set(obj, obj, func, data, del_cb); +} + +/** + * Unset tooltip from object + * + * @param obj Target object + * + * Remove tooltip from object. The callback provided as del_cb to + * elm_object_tooltip_content_cb_set() will be called to notify it is + * not used anymore. + * + * @see elm_object_tooltip_content_cb_set() + * + * @ingroup Tooltips + */ +EAPI void +elm_object_tooltip_unset(Evas_Object *obj) +{ + ELM_TOOLTIP_GET_OR_RETURN(tt, obj); + _elm_tooltip_unset(tt); +} + +/** + * Sets a different style for this object tooltip. + * + * @note before you set a style you should define a tooltip with + * elm_object_tooltip_content_cb_set() or + * elm_object_tooltip_text_set(). + * + * @param obj an object with tooltip already set. + * @param style the theme style to use (default, transparent, ...) + */ +EAPI void +elm_object_tooltip_style_set(Evas_Object *obj, const char *style) +{ + ELM_TOOLTIP_GET_OR_RETURN(tt, obj); + if (!eina_stringshare_replace(&tt->style, style)) return; + elm_tooltip_theme(tt); +} + +/** + * Get the style for this object tooltip. + * + * @param obj an object with tooltip already set. + * @return style the theme style in use, defaults to "default". If the + * object does not have a tooltip set, then NULL is returned. + */ +EAPI const char * +elm_object_tooltip_style_get(const Evas_Object *obj) +{ + ELM_TOOLTIP_GET_OR_RETURN(tt, obj, NULL); + return tt->style ? tt->style : "default"; +} + +/** + * @brief Disable size restrictions on an object's tooltip + * @param obj The tooltip's anchor object + * @param disable If EINA_TRUE, size restrictions are disabled + * @return EINA_FALSE on failure, EINA_TRUE on success + * + * This function allows a tooltip to expand beyond its parent window's canvas. + * It will instead be limited only by the size of the display. + */ +EAPI Eina_Bool +elm_object_tooltip_window_mode_set(Evas_Object *obj, Eina_Bool disable) +{ + ELM_TOOLTIP_GET_OR_RETURN(tt, obj, EINA_FALSE); + return tt->free_size = disable; +} + +/** + * @brief Retrieve size restriction state of an object's tooltip + * @param obj The tooltip's anchor object + * @return If EINA_TRUE, size restrictions are disabled + * + * This function returns whether a tooltip is allowed to expand beyond + * its parent window's canvas. + * It will instead be limited only by the size of the display. + */ +EAPI Eina_Bool +elm_object_tooltip_window_mode_get(const Evas_Object *obj) +{ + ELM_TOOLTIP_GET_OR_RETURN(tt, obj, EINA_FALSE); + return tt->free_size; +} diff --git a/libraries/elementary/src/lib/elu_ews_wm.c b/libraries/elementary/src/lib/elu_ews_wm.c new file mode 100644 index 0000000..15fdb65 --- /dev/null +++ b/libraries/elementary/src/lib/elu_ews_wm.c @@ -0,0 +1,545 @@ +#include +#include "elm_priv.h" + +static Eina_Bool _ews_used = EINA_FALSE; +static Eina_List *_ews_ev_handlers = NULL; +static Eina_Hash *_ews_borders = NULL; +static Eina_Hash *_ews_borders_geo = NULL; +static Evas_Object *_ews_bg = NULL; +static Ecore_Animator *_ews_border_mover = NULL; +static Evas_Object *_ews_border_mover_obj = NULL; +static Evas_Point _ews_border_mover_off = {0, 0}; + +static void +_elm_ews_border_usable_screen_geometry_get(int *x, int *y, int *w, int *h) +{ + Ecore_Evas *ee = ecore_evas_ews_ecore_evas_get(); + ecore_evas_geometry_get(ee, NULL, NULL, w, h); + if (x) *x = 0; + if (y) *y = 0; + // TODO: when add a shelf for iconified, subtract its area here. +} + +static void +_elm_ews_wm_border_del(void *data) +{ + Evas_Object *deco = data; + evas_object_del(deco); + + if (_ews_border_mover_obj == deco) + { + if (_ews_border_mover) + { + ecore_animator_del(_ews_border_mover); + _ews_border_mover = NULL; + } + _ews_border_mover_obj = NULL; + } +} + +static Evas_Object * +_elm_ews_wm_border_find(const Ecore_Evas *ee) +{ + return eina_hash_find(_ews_borders, &ee); +} + +static Eina_Rectangle * +_elm_ews_wm_border_geo_find(const Ecore_Evas *ee) +{ + return eina_hash_find(_ews_borders_geo, &ee); +} + +static void +_elm_ews_border_geo_apply(Ecore_Evas *ee, Evas_Object *o) +{ + int x, y, w, h; + ecore_evas_geometry_get(ee, &x, &y, &w, &h); + evas_object_move(o, x, y); + evas_object_resize(o, w, h); +} + +static void +_elm_ews_border_focus_apply(Ecore_Evas *ee, Evas_Object *o) +{ + const char *sig; + if (ecore_evas_focus_get(ee)) + sig = "elm,state,focus,on"; + else + sig = "elm,state,focus,off"; + edje_object_signal_emit(o, sig, "elm"); +} + +static void +_elm_ews_border_stack_apply(Ecore_Evas *ee, Evas_Object *o) +{ + Evas_Object *bs_o = ecore_evas_ews_backing_store_get(ee); + evas_object_stack_below(o, bs_o); +} + +static void +_elm_ews_border_iconified_apply(Ecore_Evas *ee, Evas_Object *o) +{ + const char *sig; + if (ecore_evas_iconified_get(ee)) + sig = "elm,state,iconified,on"; + else + sig = "elm,state,iconified,off"; + edje_object_signal_emit(o, sig, "elm"); + + // TODO: add to some taskbar? and actually hide it? + DBG("EWS does not implement iconified yet"); +} + +static void +_elm_ews_border_maximized_apply(Ecore_Evas *ee, Evas_Object *o) +{ + int x, y, w, h; + if (ecore_evas_maximized_get(ee)) + { + Eina_Rectangle *r; + int ex, ey, ew, eh; + + edje_object_signal_emit(o, "elm,state,maximized,on", "elm"); + edje_object_message_signal_process(o); + ecore_evas_geometry_get(ee, &x, &y, &w, &h); + + r = _elm_ews_wm_border_geo_find(ee); + if (!r) + { + r = malloc(sizeof(Eina_Rectangle)); + eina_hash_add(_ews_borders_geo, &ee, r); + } + + r->x = x; + r->y = y; + r->w = w; + r->h = h; + _elm_ews_border_usable_screen_geometry_get(&x, &y, &w, &h); + edje_object_parts_extends_calc(o, &ex, &ey, &ew, &eh); + x -= ex; + y -= ey; + w -= ew - r->w; + h -= eh - r->h; + } + else + { + Eina_Rectangle *r = _elm_ews_wm_border_geo_find(ee); + edje_object_signal_emit(o, "elm,state,maximized,off", "elm"); + + if (!r) ecore_evas_geometry_get(ee, &x, &y, &w, &h); + else + { + x = r->x; + y = r->y; + w = r->w; + h = r->h; + } + } + + ecore_evas_move_resize(ee, x, y, w, h); + _elm_ews_border_geo_apply(ee, o); +} + +static void +_elm_ews_border_layer_apply(Ecore_Evas *ee, Evas_Object *o) +{ + Evas_Object *bs_o = ecore_evas_ews_backing_store_get(ee); + evas_object_layer_set(o, evas_object_layer_get(bs_o)); + _elm_ews_border_stack_apply(ee, o); +} + +static void +_elm_ews_border_fullscreen_apply(Ecore_Evas *ee, Evas_Object *o) +{ + const char *sig; + if (ecore_evas_fullscreen_get(ee)) + sig = "elm,state,fullscreen,on"; + else + sig = "elm,state,fullscreen,off"; + edje_object_signal_emit(o, sig, "elm"); + _elm_ews_border_geo_apply(ee, o); +} + +static void +_elm_ews_border_config_apply(Ecore_Evas *ee, Evas_Object *o, Elm_Theme *th) +{ + const char *title, *name = NULL, *class = NULL, *style = NULL; + const char *sig; + + if (ecore_evas_borderless_get(ee)) + style = "borderless"; + + _elm_theme_set(th, o, "ews", "decoration", style ? style : "default"); + + if (ecore_evas_shaped_get(ee) || ecore_evas_alpha_get(ee) || + ecore_evas_transparent_get(ee)) + sig = "elm,state,alpha,on"; + else + sig = "elm,state,alpha,off"; + edje_object_signal_emit(o, sig, "elm"); + + title = ecore_evas_title_get(ee); + ecore_evas_name_class_get(ee, &name, &class); + edje_object_part_text_escaped_set(o, "elm.text.title", title); + edje_object_part_text_escaped_set(o, "elm.text.name", name); + edje_object_part_text_escaped_set(o, "elm.text.class", class); + + _elm_ews_border_geo_apply(ee, o); + _elm_ews_border_focus_apply(ee, o); + _elm_ews_border_stack_apply(ee, o); + _elm_ews_border_iconified_apply(ee, o); + _elm_ews_border_maximized_apply(ee, o); + _elm_ews_border_layer_apply(ee, o); + _elm_ews_border_fullscreen_apply(ee, o); +} + +static Eina_Bool +_elm_ews_wm_border_theme_set(Ecore_Evas *ee, Evas_Object *o, Elm_Theme *th) +{ + _elm_ews_border_config_apply(ee, o, th); + return EINA_TRUE; +} + +static void +_elm_ews_border_sig_focus(void *data, Evas_Object *o __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__) +{ + Ecore_Evas *ee = data; + ecore_evas_focus_set(ee, EINA_TRUE); +} + +static void +_elm_ews_border_sig_iconify(void *data, Evas_Object *o __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__) +{ + Ecore_Evas *ee = data; + ecore_evas_iconified_set(ee, EINA_TRUE); +} + +static void +_elm_ews_border_sig_maximize(void *data, Evas_Object *o __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__) +{ + Ecore_Evas *ee = data; + ecore_evas_maximized_set(ee, EINA_TRUE); +} + +static void +_elm_ews_border_sig_fullscreen(void *data, Evas_Object *o __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__) +{ + Ecore_Evas *ee = data; + ecore_evas_fullscreen_set(ee, EINA_TRUE); +} + +static void +_elm_ews_border_sig_restore(void *data, Evas_Object *o __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__) +{ + Ecore_Evas *ee = data; + ecore_evas_iconified_set(ee, EINA_FALSE); + ecore_evas_maximized_set(ee, EINA_FALSE); + ecore_evas_fullscreen_set(ee, EINA_FALSE); +} + +static void +_elm_ews_border_sig_close(void *data, Evas_Object *o __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__) +{ + Ecore_Evas *ee = data; + ecore_evas_ews_delete_request(ee); +} + +static void +_elm_ews_border_sig_menu(void *data, Evas_Object *o __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__) +{ + // TODO: show some menu? + ERR("EWS does not implement menu yet"); + (void)data; +} + +static Eina_Bool +_elm_ews_border_mover(void *data) +{ + Ecore_Evas *ee = data; + Evas_Object *o = _elm_ews_wm_border_find(ee); + int x, y; + + evas_pointer_output_xy_get(ecore_evas_ews_evas_get(), &x, &y); + x -= _ews_border_mover_off.x; + y -= _ews_border_mover_off.y; + ecore_evas_move(ee, x, y); + evas_object_move(o, x, y); + + return EINA_TRUE; +} + +static void +_elm_ews_border_sig_move_start(void *data, Evas_Object *o __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__) +{ + Ecore_Evas *ee = data; + Evas_Object *bs_o = ecore_evas_ews_backing_store_get(ee); + int x, y, ox, oy; + + if (_ews_border_mover) ecore_animator_del(_ews_border_mover); + + evas_pointer_output_xy_get(evas_object_evas_get(bs_o), &x, &y); + evas_object_geometry_get(bs_o, &ox, &oy, NULL, NULL); + _ews_border_mover_off.x = x - ox; + _ews_border_mover_off.y = y - oy; + _ews_border_mover_obj = bs_o; + _ews_border_mover = ecore_animator_add(_elm_ews_border_mover, ee); +} + +static void +_elm_ews_border_sig_move_stop(void *data __UNUSED__, Evas_Object *o __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__) +{ + if (!_ews_border_mover) return; + ecore_animator_del(_ews_border_mover); + _ews_border_mover = NULL; + _ews_border_mover_obj = NULL; +} + +static Eina_Bool +_elm_ews_wm_add_cb(void *data __UNUSED__, int type __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = event_info; + Evas_Object *o = edje_object_add(ecore_evas_ews_evas_get()); + Evas_Coord x, y, w, h, sw, sh; + + edje_object_signal_callback_add + (o, "elm,action,focus", "elm", _elm_ews_border_sig_focus, ee); + edje_object_signal_callback_add + (o, "elm,action,iconify", "elm", _elm_ews_border_sig_iconify, ee); + edje_object_signal_callback_add + (o, "elm,action,maximize", "elm", _elm_ews_border_sig_maximize, ee); + edje_object_signal_callback_add + (o, "elm,action,fullscreen", "elm", _elm_ews_border_sig_fullscreen, ee); + edje_object_signal_callback_add + (o, "elm,action,restore", "elm", _elm_ews_border_sig_restore, ee); + edje_object_signal_callback_add + (o, "elm,action,close", "elm", _elm_ews_border_sig_close, ee); + edje_object_signal_callback_add + (o, "elm,action,menu", "elm", _elm_ews_border_sig_menu, ee); + edje_object_signal_callback_add + (o, "elm,action,move,start", "elm", _elm_ews_border_sig_move_start, ee); + edje_object_signal_callback_add + (o, "elm,action,move,stop", "elm", _elm_ews_border_sig_move_stop, ee); + + eina_hash_add(_ews_borders, &ee, o); + _elm_ews_wm_border_theme_set(ee, o, NULL); + + ecore_evas_screen_geometry_get(ee, NULL, NULL, &sw, &sh); + ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); + x = (sw - w) / 2; + y = (sh - h) / 2; + ecore_evas_move(ee, x, y); + ecore_evas_focus_set(ee, EINA_TRUE); + + return EINA_TRUE; +} + +static Eina_Bool +_elm_ews_wm_del_cb(void *data __UNUSED__, int type __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = event_info; + eina_hash_del(_ews_borders, &ee, NULL); + eina_hash_del(_ews_borders_geo, &ee, NULL); + return EINA_TRUE; +} + +static Eina_Bool +_elm_ews_wm_geo_cb(void *data __UNUSED__, int type __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = event_info; + Evas_Object *o = _elm_ews_wm_border_find(ee); + _elm_ews_border_geo_apply(ee, o); + return EINA_TRUE; +} + +static Eina_Bool +_elm_ews_wm_show_cb(void *data __UNUSED__, int type __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = event_info; + Evas_Object *o = _elm_ews_wm_border_find(ee); + evas_object_show(o); + return EINA_TRUE; +} + +static Eina_Bool +_elm_ews_wm_hide_cb(void *data __UNUSED__, int type __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = event_info; + Evas_Object *o = _elm_ews_wm_border_find(ee); + evas_object_hide(o); + return EINA_TRUE; +} + +static Eina_Bool +_elm_ews_wm_focus_cb(void *data __UNUSED__, int type __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = event_info; + Evas_Object *o = _elm_ews_wm_border_find(ee); + _elm_ews_border_focus_apply(ee, o); + return EINA_TRUE; +} + +static Eina_Bool +_elm_ews_wm_stack_cb(void *data __UNUSED__, int type __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = event_info; + Evas_Object *o = _elm_ews_wm_border_find(ee); + _elm_ews_border_stack_apply(ee, o); + return EINA_TRUE; +} + +static Eina_Bool +_elm_ews_wm_iconified_change_cb(void *data __UNUSED__, int type __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = event_info; + Evas_Object *o = _elm_ews_wm_border_find(ee); + _elm_ews_border_iconified_apply(ee, o); + return EINA_TRUE; +} + +static Eina_Bool +_elm_ews_wm_maximized_change_cb(void *data __UNUSED__, int type __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = event_info; + Evas_Object *o = _elm_ews_wm_border_find(ee); + _elm_ews_border_maximized_apply(ee, o); + return EINA_TRUE; +} + +static Eina_Bool +_elm_ews_wm_layer_change_cb(void *data __UNUSED__, int type __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = event_info; + Evas_Object *o = _elm_ews_wm_border_find(ee); + _elm_ews_border_layer_apply(ee, o); + return EINA_TRUE; +} + +static Eina_Bool +_elm_ews_wm_fullscreen_change_cb(void *data __UNUSED__, int type __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = event_info; + Evas_Object *o = _elm_ews_wm_border_find(ee); + _elm_ews_border_fullscreen_apply(ee, o); + return EINA_TRUE; +} + +static Eina_Bool +_elm_ews_wm_config_change_cb(void *data __UNUSED__, int type __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = event_info; + Evas_Object *o = _elm_ews_wm_border_find(ee); + _elm_ews_border_config_apply(ee, o, NULL); + return EINA_TRUE; +} + +void +_elm_ews_wm_rescale(Elm_Theme *th, Eina_Bool use_theme) +{ + Eina_Iterator *it; + Eina_Hash_Tuple *tp = NULL; + + if (!_ews_borders) return; + it = eina_hash_iterator_tuple_new(_ews_borders); + if (!use_theme) + { + EINA_ITERATOR_FOREACH(it, tp) + _elm_ews_wm_border_theme_set(*(void**)tp->key, tp->data, NULL); + + if (_ews_bg) + _elm_theme_set(NULL, _ews_bg, "ews", "background", "default"); + } + else + { + EINA_ITERATOR_FOREACH(it, tp) + _elm_ews_wm_border_theme_set(*(void**)tp->key, tp->data, th); + + if (_ews_bg) + _elm_theme_set(th, _ews_bg, "ews", "background", "default"); + } + + eina_iterator_free(it); +} + +int +_elm_ews_wm_init(void) +{ + Evas *e; + Evas_Object *o; + + if (strcmp(_elm_config->engine, ELM_EWS) != 0) + { + _ews_used = EINA_FALSE; + return EINA_TRUE; + } + + e = ecore_evas_ews_evas_get(); + if (!e) return EINA_FALSE; + o = edje_object_add(e); + if (!o) return EINA_FALSE; + + if (!_elm_theme_set(NULL, o, "ews", "background", "default")) + { + ERR("Could not set background theme, fallback to rectangle"); + evas_object_del(o); + _ews_bg = o = NULL; + } + else + _ews_bg = o; + ecore_evas_ews_background_set(o); + + +#define ADD_EH(ev, cb) \ + _ews_ev_handlers = eina_list_append \ + (_ews_ev_handlers, ecore_event_handler_add(ev, cb, NULL)) + ADD_EH(ECORE_EVAS_EWS_EVENT_ADD, _elm_ews_wm_add_cb); + ADD_EH(ECORE_EVAS_EWS_EVENT_DEL, _elm_ews_wm_del_cb); + ADD_EH(ECORE_EVAS_EWS_EVENT_RESIZE, _elm_ews_wm_geo_cb); + ADD_EH(ECORE_EVAS_EWS_EVENT_MOVE, _elm_ews_wm_geo_cb); + ADD_EH(ECORE_EVAS_EWS_EVENT_SHOW, _elm_ews_wm_show_cb); + ADD_EH(ECORE_EVAS_EWS_EVENT_HIDE, _elm_ews_wm_hide_cb); + ADD_EH(ECORE_EVAS_EWS_EVENT_FOCUS, _elm_ews_wm_focus_cb); + ADD_EH(ECORE_EVAS_EWS_EVENT_UNFOCUS, _elm_ews_wm_focus_cb); + ADD_EH(ECORE_EVAS_EWS_EVENT_RAISE, _elm_ews_wm_stack_cb); + ADD_EH(ECORE_EVAS_EWS_EVENT_LOWER, _elm_ews_wm_stack_cb); + ADD_EH(ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE, _elm_ews_wm_iconified_change_cb); + ADD_EH(ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE, _elm_ews_wm_maximized_change_cb); + ADD_EH(ECORE_EVAS_EWS_EVENT_LAYER_CHANGE, _elm_ews_wm_layer_change_cb); + ADD_EH(ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE, _elm_ews_wm_fullscreen_change_cb); + ADD_EH(ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE, _elm_ews_wm_config_change_cb); +#undef ADD_EH + + if (!_ews_borders) + _ews_borders = eina_hash_pointer_new(_elm_ews_wm_border_del); + + if (!_ews_borders_geo) + _ews_borders_geo = eina_hash_pointer_new(free); + + _ews_used = EINA_TRUE; + return EINA_TRUE; +} + +void +_elm_ews_wm_shutdown(void) +{ + Ecore_Event_Handler *eh; + + if (_ews_border_mover) + { + ecore_animator_del(_ews_border_mover); + _ews_border_mover = NULL; + } + _ews_border_mover_obj = NULL; + + EINA_LIST_FREE(_ews_ev_handlers, eh) ecore_event_handler_del(eh); + if (_ews_borders) + { + eina_hash_free(_ews_borders); + _ews_borders = NULL; + } + if (_ews_borders_geo) + { + eina_hash_free(_ews_borders_geo); + _ews_borders_geo = NULL; + } + _ews_bg = NULL; +} diff --git a/libraries/elementary/src/modules/Makefile.am b/libraries/elementary/src/modules/Makefile.am new file mode 100644 index 0000000..e435e37 --- /dev/null +++ b/libraries/elementary/src/modules/Makefile.am @@ -0,0 +1,8 @@ +AUTOMAKE_OPTIONS = 1.4 foreign +MAINTAINERCLEANFILES = Makefile.in + +SUBDIRS = \ +test_entry \ +test_map \ +access_output \ +datetime_input_ctxpopup diff --git a/libraries/elementary/src/modules/Makefile.in b/libraries/elementary/src/modules/Makefile.in new file mode 100644 index 0000000..5bd57e1 --- /dev/null +++ b/libraries/elementary/src/modules/Makefile.in @@ -0,0 +1,671 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/modules +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/efl_binary.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/elementary_config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EIO_CFLAGS = @EIO_CFLAGS@ +EIO_LIBS = @EIO_LIBS@ +ELEMENTARY_CFLAGS = @ELEMENTARY_CFLAGS@ +ELEMENTARY_COCOA_CFLAGS = @ELEMENTARY_COCOA_CFLAGS@ +ELEMENTARY_COCOA_LIBS = @ELEMENTARY_COCOA_LIBS@ +ELEMENTARY_CONFIG_PRG = @ELEMENTARY_CONFIG_PRG@ +ELEMENTARY_ECORE_CON_CFLAGS = @ELEMENTARY_ECORE_CON_CFLAGS@ +ELEMENTARY_ECORE_CON_INC = @ELEMENTARY_ECORE_CON_INC@ +ELEMENTARY_ECORE_CON_LIBS = @ELEMENTARY_ECORE_CON_LIBS@ +ELEMENTARY_ECORE_IMF_CFLAGS = @ELEMENTARY_ECORE_IMF_CFLAGS@ +ELEMENTARY_ECORE_IMF_INC = @ELEMENTARY_ECORE_IMF_INC@ +ELEMENTARY_ECORE_IMF_LIBS = @ELEMENTARY_ECORE_IMF_LIBS@ +ELEMENTARY_EDBUS_CFLAGS = @ELEMENTARY_EDBUS_CFLAGS@ +ELEMENTARY_EDBUS_LIBS = @ELEMENTARY_EDBUS_LIBS@ +ELEMENTARY_EFREET_CFLAGS = @ELEMENTARY_EFREET_CFLAGS@ +ELEMENTARY_EFREET_LIBS = @ELEMENTARY_EFREET_LIBS@ +ELEMENTARY_EMAP_CFLAGS = @ELEMENTARY_EMAP_CFLAGS@ +ELEMENTARY_EMAP_LIBS = @ELEMENTARY_EMAP_LIBS@ +ELEMENTARY_ETHUMB_CFLAGS = @ELEMENTARY_ETHUMB_CFLAGS@ +ELEMENTARY_ETHUMB_LIBS = @ELEMENTARY_ETHUMB_LIBS@ +ELEMENTARY_EWEATHER_CFLAGS = @ELEMENTARY_EWEATHER_CFLAGS@ +ELEMENTARY_EWEATHER_LIBS = @ELEMENTARY_EWEATHER_LIBS@ +ELEMENTARY_FB_CFLAGS = @ELEMENTARY_FB_CFLAGS@ +ELEMENTARY_FB_LIBS = @ELEMENTARY_FB_LIBS@ +ELEMENTARY_LIBS = @ELEMENTARY_LIBS@ +ELEMENTARY_PSL1GHT_CFLAGS = @ELEMENTARY_PSL1GHT_CFLAGS@ +ELEMENTARY_PSL1GHT_LIBS = @ELEMENTARY_PSL1GHT_LIBS@ +ELEMENTARY_SDL_CFLAGS = @ELEMENTARY_SDL_CFLAGS@ +ELEMENTARY_SDL_LIBS = @ELEMENTARY_SDL_LIBS@ +ELEMENTARY_TEST_PRG = @ELEMENTARY_TEST_PRG@ +ELEMENTARY_WEB_CFLAGS = @ELEMENTARY_WEB_CFLAGS@ +ELEMENTARY_WEB_LIBS = @ELEMENTARY_WEB_LIBS@ +ELEMENTARY_WIN32_CFLAGS = @ELEMENTARY_WIN32_CFLAGS@ +ELEMENTARY_WIN32_LIBS = @ELEMENTARY_WIN32_LIBS@ +ELEMENTARY_WINCE_CFLAGS = @ELEMENTARY_WINCE_CFLAGS@ +ELEMENTARY_WINCE_LIBS = @ELEMENTARY_WINCE_LIBS@ +ELEMENTARY_X_CFLAGS = @ELEMENTARY_X_CFLAGS@ +ELEMENTARY_X_LIBS = @ELEMENTARY_X_LIBS@ +ELM_ALLOCA_H_DEF = @ELM_ALLOCA_H_DEF@ +ELM_DEBUG_DEF = @ELM_DEBUG_DEF@ +ELM_DIRENT_H_DEF = @ELM_DIRENT_H_DEF@ +ELM_EDBUS_DEF = @ELM_EDBUS_DEF@ +ELM_EFREET_DEF = @ELM_EFREET_DEF@ +ELM_EMAP_DEF = @ELM_EMAP_DEF@ +ELM_ETHUMB_DEF = @ELM_ETHUMB_DEF@ +ELM_EWEATHER_DEF = @ELM_EWEATHER_DEF@ +ELM_LIBINTL_H_DEF = @ELM_LIBINTL_H_DEF@ +ELM_UNIX_DEF = @ELM_UNIX_DEF@ +ELM_WEB_DEF = @ELM_WEB_DEF@ +ELM_WIN32_DEF = @ELM_WIN32_DEF@ +ELM_WINCE_DEF = @ELM_WINCE_DEF@ +EMOTION_CFLAGS = @EMOTION_CFLAGS@ +EMOTION_LIBS = @EMOTION_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALE_DIR = @LOCALE_DIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MODULE_ARCH = @MODULE_ARCH@ +MODULE_EDJE = @MODULE_EDJE@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +VMIN = @VMIN@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +edje_cc = @edje_cc@ +eet_eet = @eet_eet@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +my_libs = @my_libs@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirement_elm = @requirement_elm@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +AUTOMAKE_OPTIONS = 1.4 foreign +MAINTAINERCLEANFILES = Makefile.in +SUBDIRS = \ +test_entry \ +test_map \ +access_output \ +datetime_input_ctxpopup + +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/modules/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/modules/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ + install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + ctags ctags-recursive distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/elementary/src/modules/access_output/Makefile.am b/libraries/elementary/src/modules/access_output/Makefile.am new file mode 100644 index 0000000..f23dc01 --- /dev/null +++ b/libraries/elementary/src/modules/access_output/Makefile.am @@ -0,0 +1,33 @@ + +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I. \ +-I$(top_builddir) \ +-I$(top_srcdir) \ +-I$(top_srcdir)/src/lib \ +-I$(top_builddir)/src/lib \ +-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ +-DPACKAGE_LIB_DIR=\"$(libdir)\" \ +@ELEMENTARY_CFLAGS@ \ +@ELEMENTARY_X_CFLAGS@ \ +@ELEMENTARY_FB_CFLAGS@ \ +@ELEMENTARY_WIN32_CFLAGS@ \ +@ELEMENTARY_WINCE_CFLAGS@ \ +@ELEMENTARY_EDBUS_CFLAGS@ \ +@ELEMENTARY_EFREET_CFLAGS@ \ +@ELEMENTARY_ETHUMB_CFLAGS@ \ +@ELEMENTARY_EMAP_CFLAGS@ + +if ELEMENTARY_WINDOWS_BUILD +AM_CPPFLAGS += -DELEMENTARY_BUILD +endif + +pkgdir = $(libdir)/elementary/modules/access_output/$(MODULE_ARCH) +pkg_LTLIBRARIES = module.la + +module_la_SOURCES = mod.c + +module_la_LIBADD = @ELEMENTARY_LIBS@ $(top_builddir)/src/lib/libelementary.la +module_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version +module_la_LIBTOOLFLAGS = --tag=disable-static diff --git a/libraries/elementary/src/modules/access_output/Makefile.in b/libraries/elementary/src/modules/access_output/Makefile.in new file mode 100644 index 0000000..febe2c1 --- /dev/null +++ b/libraries/elementary/src/modules/access_output/Makefile.in @@ -0,0 +1,664 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@ELEMENTARY_WINDOWS_BUILD_TRUE@am__append_1 = -DELEMENTARY_BUILD +subdir = src/modules/access_output +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/efl_binary.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/elementary_config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(pkgdir)" +LTLIBRARIES = $(pkg_LTLIBRARIES) +module_la_DEPENDENCIES = $(top_builddir)/src/lib/libelementary.la +am_module_la_OBJECTS = module_la-mod.lo +module_la_OBJECTS = $(am_module_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +module_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(module_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(module_la_SOURCES) +DIST_SOURCES = $(module_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EIO_CFLAGS = @EIO_CFLAGS@ +EIO_LIBS = @EIO_LIBS@ +ELEMENTARY_CFLAGS = @ELEMENTARY_CFLAGS@ +ELEMENTARY_COCOA_CFLAGS = @ELEMENTARY_COCOA_CFLAGS@ +ELEMENTARY_COCOA_LIBS = @ELEMENTARY_COCOA_LIBS@ +ELEMENTARY_CONFIG_PRG = @ELEMENTARY_CONFIG_PRG@ +ELEMENTARY_ECORE_CON_CFLAGS = @ELEMENTARY_ECORE_CON_CFLAGS@ +ELEMENTARY_ECORE_CON_INC = @ELEMENTARY_ECORE_CON_INC@ +ELEMENTARY_ECORE_CON_LIBS = @ELEMENTARY_ECORE_CON_LIBS@ +ELEMENTARY_ECORE_IMF_CFLAGS = @ELEMENTARY_ECORE_IMF_CFLAGS@ +ELEMENTARY_ECORE_IMF_INC = @ELEMENTARY_ECORE_IMF_INC@ +ELEMENTARY_ECORE_IMF_LIBS = @ELEMENTARY_ECORE_IMF_LIBS@ +ELEMENTARY_EDBUS_CFLAGS = @ELEMENTARY_EDBUS_CFLAGS@ +ELEMENTARY_EDBUS_LIBS = @ELEMENTARY_EDBUS_LIBS@ +ELEMENTARY_EFREET_CFLAGS = @ELEMENTARY_EFREET_CFLAGS@ +ELEMENTARY_EFREET_LIBS = @ELEMENTARY_EFREET_LIBS@ +ELEMENTARY_EMAP_CFLAGS = @ELEMENTARY_EMAP_CFLAGS@ +ELEMENTARY_EMAP_LIBS = @ELEMENTARY_EMAP_LIBS@ +ELEMENTARY_ETHUMB_CFLAGS = @ELEMENTARY_ETHUMB_CFLAGS@ +ELEMENTARY_ETHUMB_LIBS = @ELEMENTARY_ETHUMB_LIBS@ +ELEMENTARY_EWEATHER_CFLAGS = @ELEMENTARY_EWEATHER_CFLAGS@ +ELEMENTARY_EWEATHER_LIBS = @ELEMENTARY_EWEATHER_LIBS@ +ELEMENTARY_FB_CFLAGS = @ELEMENTARY_FB_CFLAGS@ +ELEMENTARY_FB_LIBS = @ELEMENTARY_FB_LIBS@ +ELEMENTARY_LIBS = @ELEMENTARY_LIBS@ +ELEMENTARY_PSL1GHT_CFLAGS = @ELEMENTARY_PSL1GHT_CFLAGS@ +ELEMENTARY_PSL1GHT_LIBS = @ELEMENTARY_PSL1GHT_LIBS@ +ELEMENTARY_SDL_CFLAGS = @ELEMENTARY_SDL_CFLAGS@ +ELEMENTARY_SDL_LIBS = @ELEMENTARY_SDL_LIBS@ +ELEMENTARY_TEST_PRG = @ELEMENTARY_TEST_PRG@ +ELEMENTARY_WEB_CFLAGS = @ELEMENTARY_WEB_CFLAGS@ +ELEMENTARY_WEB_LIBS = @ELEMENTARY_WEB_LIBS@ +ELEMENTARY_WIN32_CFLAGS = @ELEMENTARY_WIN32_CFLAGS@ +ELEMENTARY_WIN32_LIBS = @ELEMENTARY_WIN32_LIBS@ +ELEMENTARY_WINCE_CFLAGS = @ELEMENTARY_WINCE_CFLAGS@ +ELEMENTARY_WINCE_LIBS = @ELEMENTARY_WINCE_LIBS@ +ELEMENTARY_X_CFLAGS = @ELEMENTARY_X_CFLAGS@ +ELEMENTARY_X_LIBS = @ELEMENTARY_X_LIBS@ +ELM_ALLOCA_H_DEF = @ELM_ALLOCA_H_DEF@ +ELM_DEBUG_DEF = @ELM_DEBUG_DEF@ +ELM_DIRENT_H_DEF = @ELM_DIRENT_H_DEF@ +ELM_EDBUS_DEF = @ELM_EDBUS_DEF@ +ELM_EFREET_DEF = @ELM_EFREET_DEF@ +ELM_EMAP_DEF = @ELM_EMAP_DEF@ +ELM_ETHUMB_DEF = @ELM_ETHUMB_DEF@ +ELM_EWEATHER_DEF = @ELM_EWEATHER_DEF@ +ELM_LIBINTL_H_DEF = @ELM_LIBINTL_H_DEF@ +ELM_UNIX_DEF = @ELM_UNIX_DEF@ +ELM_WEB_DEF = @ELM_WEB_DEF@ +ELM_WIN32_DEF = @ELM_WIN32_DEF@ +ELM_WINCE_DEF = @ELM_WINCE_DEF@ +EMOTION_CFLAGS = @EMOTION_CFLAGS@ +EMOTION_LIBS = @EMOTION_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALE_DIR = @LOCALE_DIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MODULE_ARCH = @MODULE_ARCH@ +MODULE_EDJE = @MODULE_EDJE@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +VMIN = @VMIN@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +edje_cc = @edje_cc@ +eet_eet = @eet_eet@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +my_libs = @my_libs@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirement_elm = @requirement_elm@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = -I. -I$(top_builddir) -I$(top_srcdir) \ + -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib \ + -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ + -DPACKAGE_LIB_DIR=\"$(libdir)\" @ELEMENTARY_CFLAGS@ \ + @ELEMENTARY_X_CFLAGS@ @ELEMENTARY_FB_CFLAGS@ \ + @ELEMENTARY_WIN32_CFLAGS@ @ELEMENTARY_WINCE_CFLAGS@ \ + @ELEMENTARY_EDBUS_CFLAGS@ @ELEMENTARY_EFREET_CFLAGS@ \ + @ELEMENTARY_ETHUMB_CFLAGS@ @ELEMENTARY_EMAP_CFLAGS@ \ + $(am__append_1) +pkgdir = $(libdir)/elementary/modules/access_output/$(MODULE_ARCH) +pkg_LTLIBRARIES = module.la +module_la_SOURCES = mod.c +module_la_LIBADD = @ELEMENTARY_LIBS@ $(top_builddir)/src/lib/libelementary.la +module_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version +module_la_LIBTOOLFLAGS = --tag=disable-static +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/modules/access_output/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/modules/access_output/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(pkgdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdir)" + @list='$(pkg_LTLIBRARIES)'; test -n "$(pkgdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkgdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkgdir)"; \ + } + +uninstall-pkgLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(pkg_LTLIBRARIES)'; test -n "$(pkgdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$f"; \ + done + +clean-pkgLTLIBRARIES: + -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) + @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +module.la: $(module_la_OBJECTS) $(module_la_DEPENDENCIES) + $(AM_V_CCLD)$(module_la_LINK) -rpath $(pkgdir) $(module_la_OBJECTS) $(module_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/module_la-mod.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +module_la-mod.lo: mod.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT module_la-mod.lo -MD -MP -MF $(DEPDIR)/module_la-mod.Tpo -c -o module_la-mod.lo `test -f 'mod.c' || echo '$(srcdir)/'`mod.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/module_la-mod.Tpo $(DEPDIR)/module_la-mod.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mod.c' object='module_la-mod.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o module_la-mod.lo `test -f 'mod.c' || echo '$(srcdir)/'`mod.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(pkgdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-pkgLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pkgLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-pkgLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-pkgLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-pkgLTLIBRARIES install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-pkgLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/elementary/src/modules/access_output/mod.c b/libraries/elementary/src/modules/access_output/mod.c new file mode 100644 index 0000000..3956a40 --- /dev/null +++ b/libraries/elementary/src/modules/access_output/mod.c @@ -0,0 +1,119 @@ +#include +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +/* to enable this module +export ELM_MODULES="access_output>access/api" +export ELM_ACCESS_MODE=1 + */ + +static void (*cb_func) (void *data); +static void *cb_data; +static Ecore_Exe *espeak = NULL; +static Ecore_Event_Handler *exe_exit_handler = NULL; +static char *tmpf = NULL; +static int tmpfd = -1; + +static Eina_Bool +_exe_del(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Exe_Event_Del *ev = event; + + if ((espeak) && (ev->exe == espeak)) + { + if (tmpf) + { + unlink(tmpf); + free(tmpf); + tmpf = NULL; + close(tmpfd); + } + espeak = NULL; + if (cb_func) cb_func(cb_data); + } + return ECORE_CALLBACK_RENEW; +} + +// module api funcs needed +EAPI int +elm_modapi_init(void *m __UNUSED__) +{ + exe_exit_handler = + ecore_event_handler_add(ECORE_EXE_EVENT_DEL, + _exe_del, NULL); + return 1; // succeed always +} + +EAPI int +elm_modapi_shutdown(void *m __UNUSED__) +{ + if (exe_exit_handler) + { + ecore_event_handler_del(exe_exit_handler); + exe_exit_handler = NULL; + } + return 1; // succeed always +} + +// module fucns for the specific module type +EAPI void +out_read(const char *txt) +{ + if (!tmpf) + { + char buf[PATH_MAX]; + + snprintf(buf, sizeof(buf), "/tmp/.elm-speak-XXXXXX"); + tmpfd = mkstemp(buf); + if (tmpfd >= 0) tmpf = strdup(buf); + else return; + } + if (write(tmpfd, txt, strlen(txt)) < 0) perror("write to tmpfile (espeak)"); +} + +EAPI void +out_read_done(void) +{ + char buf[PATH_MAX]; + + if (espeak) + { + ecore_exe_interrupt(espeak); + espeak = NULL; + } + if (tmpf) + { + // FIXME: espeak supporets -v XX for voice locale. should provide this + // based on actual lang/locale + close(tmpfd); + snprintf(buf, sizeof(buf), "espeak -p 2 -s 120 -k 10 -m -f %s", tmpf); + espeak = ecore_exe_pipe_run(buf, + ECORE_EXE_NOT_LEADER, + NULL); + } +} + +EAPI void +out_cancel(void) +{ + if (espeak) + { + ecore_exe_interrupt(espeak); + espeak = NULL; + } + if (tmpf) + { + unlink(tmpf); + free(tmpf); + tmpf = NULL; + close(tmpfd); + } +} + +EAPI void +out_done_callback_set(void (*func) (void *data), const void *data) +{ + cb_func = func; + cb_data = (void *)data; +} diff --git a/libraries/elementary/src/modules/datetime_input_ctxpopup/Makefile.am b/libraries/elementary/src/modules/datetime_input_ctxpopup/Makefile.am new file mode 100644 index 0000000..73be6a7 --- /dev/null +++ b/libraries/elementary/src/modules/datetime_input_ctxpopup/Makefile.am @@ -0,0 +1,33 @@ + +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-DELM_INTERNAL_API_ARGESFSDFEFC=1 \ +-I. \ +-I$(top_builddir) \ +-I$(top_srcdir) \ +-I$(top_srcdir)/src/lib \ +-I$(top_builddir)/src/lib \ +-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ +-DPACKAGE_LIB_DIR=\"$(libdir)\" \ +@ELEMENTARY_CFLAGS@ \ +@ELEMENTARY_X_CFLAGS@ \ +@ELEMENTARY_FB_CFLAGS@ \ +@ELEMENTARY_WIN32_CFLAGS@ \ +@ELEMENTARY_WINCE_CFLAGS@ \ +@ELEMENTARY_EDBUS_CFLAGS@ \ +@ELEMENTARY_EFREET_CFLAGS@ \ +@ELEMENTARY_ETHUMB_CFLAGS@ + +if ELEMENTARY_WINDOWS_BUILD +AM_CPPFLAGS += -DELEMENTARY_BUILD +endif + +pkgdir = $(libdir)/elementary/modules/datetime_input_ctxpopup/$(MODULE_ARCH) +pkg_LTLIBRARIES = module.la + +module_la_SOURCES = datetime_input_ctxpopup.c + +module_la_LIBADD = @ELEMENTARY_LIBS@ $(top_builddir)/src/lib/libelementary.la +module_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version +module_la_LIBTOOLFLAGS = --tag=disable-static diff --git a/libraries/elementary/src/modules/datetime_input_ctxpopup/Makefile.in b/libraries/elementary/src/modules/datetime_input_ctxpopup/Makefile.in new file mode 100644 index 0000000..ada08f3 --- /dev/null +++ b/libraries/elementary/src/modules/datetime_input_ctxpopup/Makefile.in @@ -0,0 +1,664 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@ELEMENTARY_WINDOWS_BUILD_TRUE@am__append_1 = -DELEMENTARY_BUILD +subdir = src/modules/datetime_input_ctxpopup +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/efl_binary.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/elementary_config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(pkgdir)" +LTLIBRARIES = $(pkg_LTLIBRARIES) +module_la_DEPENDENCIES = $(top_builddir)/src/lib/libelementary.la +am_module_la_OBJECTS = module_la-datetime_input_ctxpopup.lo +module_la_OBJECTS = $(am_module_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +module_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(module_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(module_la_SOURCES) +DIST_SOURCES = $(module_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EIO_CFLAGS = @EIO_CFLAGS@ +EIO_LIBS = @EIO_LIBS@ +ELEMENTARY_CFLAGS = @ELEMENTARY_CFLAGS@ +ELEMENTARY_COCOA_CFLAGS = @ELEMENTARY_COCOA_CFLAGS@ +ELEMENTARY_COCOA_LIBS = @ELEMENTARY_COCOA_LIBS@ +ELEMENTARY_CONFIG_PRG = @ELEMENTARY_CONFIG_PRG@ +ELEMENTARY_ECORE_CON_CFLAGS = @ELEMENTARY_ECORE_CON_CFLAGS@ +ELEMENTARY_ECORE_CON_INC = @ELEMENTARY_ECORE_CON_INC@ +ELEMENTARY_ECORE_CON_LIBS = @ELEMENTARY_ECORE_CON_LIBS@ +ELEMENTARY_ECORE_IMF_CFLAGS = @ELEMENTARY_ECORE_IMF_CFLAGS@ +ELEMENTARY_ECORE_IMF_INC = @ELEMENTARY_ECORE_IMF_INC@ +ELEMENTARY_ECORE_IMF_LIBS = @ELEMENTARY_ECORE_IMF_LIBS@ +ELEMENTARY_EDBUS_CFLAGS = @ELEMENTARY_EDBUS_CFLAGS@ +ELEMENTARY_EDBUS_LIBS = @ELEMENTARY_EDBUS_LIBS@ +ELEMENTARY_EFREET_CFLAGS = @ELEMENTARY_EFREET_CFLAGS@ +ELEMENTARY_EFREET_LIBS = @ELEMENTARY_EFREET_LIBS@ +ELEMENTARY_EMAP_CFLAGS = @ELEMENTARY_EMAP_CFLAGS@ +ELEMENTARY_EMAP_LIBS = @ELEMENTARY_EMAP_LIBS@ +ELEMENTARY_ETHUMB_CFLAGS = @ELEMENTARY_ETHUMB_CFLAGS@ +ELEMENTARY_ETHUMB_LIBS = @ELEMENTARY_ETHUMB_LIBS@ +ELEMENTARY_EWEATHER_CFLAGS = @ELEMENTARY_EWEATHER_CFLAGS@ +ELEMENTARY_EWEATHER_LIBS = @ELEMENTARY_EWEATHER_LIBS@ +ELEMENTARY_FB_CFLAGS = @ELEMENTARY_FB_CFLAGS@ +ELEMENTARY_FB_LIBS = @ELEMENTARY_FB_LIBS@ +ELEMENTARY_LIBS = @ELEMENTARY_LIBS@ +ELEMENTARY_PSL1GHT_CFLAGS = @ELEMENTARY_PSL1GHT_CFLAGS@ +ELEMENTARY_PSL1GHT_LIBS = @ELEMENTARY_PSL1GHT_LIBS@ +ELEMENTARY_SDL_CFLAGS = @ELEMENTARY_SDL_CFLAGS@ +ELEMENTARY_SDL_LIBS = @ELEMENTARY_SDL_LIBS@ +ELEMENTARY_TEST_PRG = @ELEMENTARY_TEST_PRG@ +ELEMENTARY_WEB_CFLAGS = @ELEMENTARY_WEB_CFLAGS@ +ELEMENTARY_WEB_LIBS = @ELEMENTARY_WEB_LIBS@ +ELEMENTARY_WIN32_CFLAGS = @ELEMENTARY_WIN32_CFLAGS@ +ELEMENTARY_WIN32_LIBS = @ELEMENTARY_WIN32_LIBS@ +ELEMENTARY_WINCE_CFLAGS = @ELEMENTARY_WINCE_CFLAGS@ +ELEMENTARY_WINCE_LIBS = @ELEMENTARY_WINCE_LIBS@ +ELEMENTARY_X_CFLAGS = @ELEMENTARY_X_CFLAGS@ +ELEMENTARY_X_LIBS = @ELEMENTARY_X_LIBS@ +ELM_ALLOCA_H_DEF = @ELM_ALLOCA_H_DEF@ +ELM_DEBUG_DEF = @ELM_DEBUG_DEF@ +ELM_DIRENT_H_DEF = @ELM_DIRENT_H_DEF@ +ELM_EDBUS_DEF = @ELM_EDBUS_DEF@ +ELM_EFREET_DEF = @ELM_EFREET_DEF@ +ELM_EMAP_DEF = @ELM_EMAP_DEF@ +ELM_ETHUMB_DEF = @ELM_ETHUMB_DEF@ +ELM_EWEATHER_DEF = @ELM_EWEATHER_DEF@ +ELM_LIBINTL_H_DEF = @ELM_LIBINTL_H_DEF@ +ELM_UNIX_DEF = @ELM_UNIX_DEF@ +ELM_WEB_DEF = @ELM_WEB_DEF@ +ELM_WIN32_DEF = @ELM_WIN32_DEF@ +ELM_WINCE_DEF = @ELM_WINCE_DEF@ +EMOTION_CFLAGS = @EMOTION_CFLAGS@ +EMOTION_LIBS = @EMOTION_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALE_DIR = @LOCALE_DIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MODULE_ARCH = @MODULE_ARCH@ +MODULE_EDJE = @MODULE_EDJE@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +VMIN = @VMIN@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +edje_cc = @edje_cc@ +eet_eet = @eet_eet@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +my_libs = @my_libs@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirement_elm = @requirement_elm@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = -DELM_INTERNAL_API_ARGESFSDFEFC=1 -I. -I$(top_builddir) \ + -I$(top_srcdir) -I$(top_srcdir)/src/lib \ + -I$(top_builddir)/src/lib \ + -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ + -DPACKAGE_LIB_DIR=\"$(libdir)\" @ELEMENTARY_CFLAGS@ \ + @ELEMENTARY_X_CFLAGS@ @ELEMENTARY_FB_CFLAGS@ \ + @ELEMENTARY_WIN32_CFLAGS@ @ELEMENTARY_WINCE_CFLAGS@ \ + @ELEMENTARY_EDBUS_CFLAGS@ @ELEMENTARY_EFREET_CFLAGS@ \ + @ELEMENTARY_ETHUMB_CFLAGS@ $(am__append_1) +pkgdir = $(libdir)/elementary/modules/datetime_input_ctxpopup/$(MODULE_ARCH) +pkg_LTLIBRARIES = module.la +module_la_SOURCES = datetime_input_ctxpopup.c +module_la_LIBADD = @ELEMENTARY_LIBS@ $(top_builddir)/src/lib/libelementary.la +module_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version +module_la_LIBTOOLFLAGS = --tag=disable-static +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/modules/datetime_input_ctxpopup/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/modules/datetime_input_ctxpopup/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(pkgdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdir)" + @list='$(pkg_LTLIBRARIES)'; test -n "$(pkgdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkgdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkgdir)"; \ + } + +uninstall-pkgLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(pkg_LTLIBRARIES)'; test -n "$(pkgdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$f"; \ + done + +clean-pkgLTLIBRARIES: + -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) + @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +module.la: $(module_la_OBJECTS) $(module_la_DEPENDENCIES) + $(AM_V_CCLD)$(module_la_LINK) -rpath $(pkgdir) $(module_la_OBJECTS) $(module_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/module_la-datetime_input_ctxpopup.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +module_la-datetime_input_ctxpopup.lo: datetime_input_ctxpopup.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT module_la-datetime_input_ctxpopup.lo -MD -MP -MF $(DEPDIR)/module_la-datetime_input_ctxpopup.Tpo -c -o module_la-datetime_input_ctxpopup.lo `test -f 'datetime_input_ctxpopup.c' || echo '$(srcdir)/'`datetime_input_ctxpopup.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/module_la-datetime_input_ctxpopup.Tpo $(DEPDIR)/module_la-datetime_input_ctxpopup.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='datetime_input_ctxpopup.c' object='module_la-datetime_input_ctxpopup.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o module_la-datetime_input_ctxpopup.lo `test -f 'datetime_input_ctxpopup.c' || echo '$(srcdir)/'`datetime_input_ctxpopup.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(pkgdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-pkgLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pkgLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-pkgLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-pkgLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-pkgLTLIBRARIES install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-pkgLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/elementary/src/modules/datetime_input_ctxpopup/datetime_input_ctxpopup.c b/libraries/elementary/src/modules/datetime_input_ctxpopup/datetime_input_ctxpopup.c new file mode 100644 index 0000000..c297eab --- /dev/null +++ b/libraries/elementary/src/modules/datetime_input_ctxpopup/datetime_input_ctxpopup.c @@ -0,0 +1,325 @@ +#include +#include "elm_priv.h" +#ifdef HAVE_CONFIG_H +#include "elementary_config.h" +#endif + +#define DATETIME_FIELD_COUNT 6 +#define FIELD_FORMAT_LEN 3 +#define DISKSELECTOR_MIN_ITEMS 4 +#define BUFF_SIZE 1024 + +typedef struct _Ctxpopup_Module_Data Ctxpopup_Module_Data; +typedef struct _DiskItem_Data DiskItem_Data; + +struct _Ctxpopup_Module_Data +{ + Elm_Datetime_Module_Data mod_data; + Evas_Object *ctxpopup; +}; + +struct _DiskItem_Data +{ + Ctxpopup_Module_Data *ctx_mod; + Elm_Datetime_Field_Type sel_field_type; + unsigned int sel_field_value; +}; + +static void +_diskselector_item_free_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + if (data) free(data); +} + +static void +_ctxpopup_dismissed_cb(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__ ) +{ + Evas_Object *diskselector; + + diskselector = elm_object_content_unset(obj); + if (diskselector) evas_object_del(diskselector); +} + +static void +_datetime_resize_cb(void *data, Evas *e __UNUSED__,Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Ctxpopup_Module_Data *ctx_mod; + + ctx_mod = (Ctxpopup_Module_Data *)data; + if (!ctx_mod) return; + + evas_object_hide(ctx_mod->ctxpopup); +} + +static void +_ctxpopup_parent_resize_cb(void *data, Evas *e __UNUSED__,Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Ctxpopup_Module_Data *ctx_mod; + + ctx_mod = (Ctxpopup_Module_Data *)data; + if (!ctx_mod) return; + elm_ctxpopup_hover_parent_set(ctx_mod->ctxpopup, elm_widget_top_get(ctx_mod->mod_data.base)); +} + +static void +_datetime_move_cb(void *data, Evas *e __UNUSED__,Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Ctxpopup_Module_Data *ctx_mod; + + ctx_mod = (Ctxpopup_Module_Data *)data; + if (!ctx_mod) return; + + evas_object_hide(ctx_mod->ctxpopup); +} + +static void +_field_value_set(struct tm *tim, Elm_Datetime_Field_Type field_type, int val) +{ + if (field_type >= DATETIME_FIELD_COUNT - 1) return; + + int *timearr[]= { &tim->tm_year, &tim->tm_mon, &tim->tm_mday, &tim->tm_hour, &tim->tm_min }; + *timearr[field_type] = val; +} + +static int +_field_value_get(struct tm *tim, Elm_Datetime_Field_Type field_type) +{ + if (field_type >= DATETIME_FIELD_COUNT - 1) return -1; + + int *timearr[]= { &tim->tm_year, &tim->tm_mon, &tim->tm_mday, &tim->tm_hour, &tim->tm_min }; + return (*timearr[field_type]); +} + +static void +_diskselector_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + DiskItem_Data *disk_data; + struct tm curr_time; + const char *fmt; + + disk_data = (DiskItem_Data *)data; + if (!disk_data || !(disk_data->ctx_mod)) return; + + elm_datetime_value_get(disk_data->ctx_mod->mod_data.base, &curr_time); + fmt = disk_data->ctx_mod->mod_data.field_format_get(disk_data->ctx_mod->mod_data.base, disk_data->sel_field_type); + if ((disk_data->sel_field_type == ELM_DATETIME_HOUR) && ((!strncmp(fmt, "%I", FIELD_FORMAT_LEN)) || + (!strncmp(fmt, "%l", FIELD_FORMAT_LEN))) && (curr_time.tm_hour >= 12)) + disk_data->sel_field_value += 12; + _field_value_set(&curr_time, disk_data->sel_field_type, disk_data->sel_field_value); + elm_datetime_value_set(disk_data->ctx_mod->mod_data.base, &curr_time); + evas_object_hide(disk_data->ctx_mod->ctxpopup); +} + +static void +_ampm_clicked_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ctxpopup_Module_Data *ctx_mod; + struct tm curr_time; + + ctx_mod = (Ctxpopup_Module_Data *)data; + if (!ctx_mod) return; + + elm_datetime_value_get(ctx_mod->mod_data.base, &curr_time); + if (curr_time.tm_hour >= 12) curr_time.tm_hour -= 12; + else curr_time.tm_hour += 12; + elm_datetime_value_set(ctx_mod->mod_data.base, &curr_time); +} + +static void +_field_clicked_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) +{ + Ctxpopup_Module_Data *ctx_mod; + Evas_Object *diskselector; + Elm_Object_Item *item; + DiskItem_Data *disk_data; + Elm_Datetime_Field_Type field_type; + time_t t; + struct tm time1; + char buf[BUFF_SIZE], label[BUFF_SIZE]; + const char *fmt; + int idx, min, max, val; + unsigned int display_item_num, text_len = 0; + Evas_Coord x = 0, y = 0, w = 0, h = 0, width; + + ctx_mod = (Ctxpopup_Module_Data *)data; + if (!ctx_mod || !ctx_mod->ctxpopup) return; + + // because of the diskselector behaviour, it is being recreated + diskselector = elm_diskselector_add(elm_widget_top_get(ctx_mod->mod_data.base)); + snprintf(buf, sizeof(buf), "datetime/%s", elm_object_style_get(obj)); + elm_object_style_set(diskselector, buf); + elm_object_content_set(ctx_mod->ctxpopup, diskselector); + + t = time(NULL); + localtime_r(&t, &time1); + + field_type = (Elm_Datetime_Field_Type )evas_object_data_get(obj, "_field_type"); + fmt = ctx_mod->mod_data.field_format_get(ctx_mod->mod_data.base, field_type); + elm_datetime_value_get(ctx_mod->mod_data.base, &time1); + val = _field_value_get(&time1, field_type); + ctx_mod->mod_data.field_limit_get(ctx_mod->mod_data.base, field_type, &min, &max); + + time1.tm_mday = 1; // To avoid month wrapping, set the first day of the month to start with. + + if ((field_type == ELM_DATETIME_HOUR) && ((!strncmp(fmt, "%I", FIELD_FORMAT_LEN)) || + (!strncmp(fmt, "%l", FIELD_FORMAT_LEN)))) + { + if (max >= 12) max -= 12; + if (val >= 12) val -= 12; + if (min >= 12) min -= 12; + } + for (idx = min; idx <= max; idx++) + { + _field_value_set(&time1, field_type, idx); + strftime(label, BUFF_SIZE, fmt, &time1); + if (strlen(label) > text_len) text_len = strlen(label); + if (idx == val) + { + item = elm_diskselector_item_append(diskselector, label, NULL, NULL, NULL); + elm_diskselector_item_selected_set(item, EINA_TRUE); + } + else + { + disk_data = (DiskItem_Data *) malloc (sizeof(DiskItem_Data)); + disk_data->ctx_mod = ctx_mod; + disk_data->sel_field_type = field_type; + disk_data->sel_field_value = idx; + item = elm_diskselector_item_append(diskselector, label, NULL, _diskselector_cb, disk_data); + elm_object_item_del_cb_set(item, _diskselector_item_free_cb); + } + } + elm_diskselector_side_text_max_length_set(diskselector, text_len); + + evas_object_geometry_get(obj, &x, &y, &w, &h); + evas_object_geometry_get(elm_widget_top_get(ctx_mod->mod_data.base), NULL, NULL, &width, NULL); + evas_object_size_hint_min_set(ctx_mod->ctxpopup, width, -1); + display_item_num = width / (w + elm_config_finger_size_get()); + // always display even number of items to avoid autoselection + if (display_item_num % 2) display_item_num -= 1; + if (display_item_num < DISKSELECTOR_MIN_ITEMS) + display_item_num = DISKSELECTOR_MIN_ITEMS; + elm_diskselector_display_item_num_set(diskselector, display_item_num); + elm_diskselector_round_enabled_set(diskselector, EINA_TRUE); + + elm_ctxpopup_direction_priority_set(ctx_mod->ctxpopup, ELM_CTXPOPUP_DIRECTION_DOWN, + ELM_CTXPOPUP_DIRECTION_UP, -1, -1); + evas_object_move(ctx_mod->ctxpopup, (x+w/2), (y+h)); + + // if the direction of Ctxpopup is upwards, move it to the top of datetime + if (elm_ctxpopup_direction_get (ctx_mod->ctxpopup) == ELM_CTXPOPUP_DIRECTION_UP) + { + elm_ctxpopup_direction_priority_set(ctx_mod->ctxpopup, ELM_CTXPOPUP_DIRECTION_UP, + ELM_CTXPOPUP_DIRECTION_DOWN, -1, -1); + evas_object_move(ctx_mod->ctxpopup, (x+w/2), y); + } + evas_object_show(ctx_mod->ctxpopup); +} + +// module fucns for the specific module type +EAPI void +field_value_display(Elm_Datetime_Module_Data *module_data, Evas_Object *obj) +{ + Ctxpopup_Module_Data *ctx_mod; + Elm_Datetime_Field_Type field_type; + struct tm tim; + char buf[BUFF_SIZE]; + const char *fmt; + + ctx_mod = (Ctxpopup_Module_Data *)module_data; + if (!ctx_mod || !obj) return; + + elm_datetime_value_get(ctx_mod->mod_data.base, &tim); + field_type = (Elm_Datetime_Field_Type )evas_object_data_get(obj, "_field_type"); + fmt = ctx_mod->mod_data.field_format_get(ctx_mod->mod_data.base, field_type); + strftime(buf, sizeof(buf), fmt, &tim); + elm_object_text_set(obj, buf); +} + +EAPI Evas_Object * +field_create(Elm_Datetime_Module_Data *module_data, Elm_Datetime_Field_Type field_type) +{ + Ctxpopup_Module_Data *ctx_mod; + Evas_Object *field_obj; + + ctx_mod = (Ctxpopup_Module_Data *)module_data; + if (!ctx_mod) return NULL; + + if (field_type == ELM_DATETIME_AMPM) + { + field_obj = elm_button_add(ctx_mod->mod_data.base); + evas_object_smart_callback_add(field_obj, "clicked", _ampm_clicked_cb, ctx_mod); + } + else + { + field_obj = elm_entry_add(ctx_mod->mod_data.base); + elm_entry_single_line_set(field_obj, EINA_TRUE); + elm_entry_editable_set(field_obj, EINA_FALSE); + elm_entry_input_panel_enabled_set(field_obj, EINA_FALSE); + elm_entry_context_menu_disabled_set(field_obj, EINA_TRUE); + evas_object_smart_callback_add(field_obj, "clicked", _field_clicked_cb, ctx_mod); + } + evas_object_data_set(field_obj, "_field_type", (void *)field_type); + return field_obj; +} + +EAPI Elm_Datetime_Module_Data * +obj_hook(Evas_Object *obj) +{ + Ctxpopup_Module_Data *ctx_mod; + char buf[BUFF_SIZE]; + + ctx_mod = ELM_NEW(Ctxpopup_Module_Data); + if (!ctx_mod) return NULL; + + ctx_mod->ctxpopup = elm_ctxpopup_add(elm_widget_top_get(obj)); + snprintf(buf, sizeof(buf), "datetime/%s", elm_object_style_get(obj)); + elm_object_style_set(ctx_mod->ctxpopup, buf); + elm_ctxpopup_horizontal_set(ctx_mod->ctxpopup, EINA_TRUE); + evas_object_size_hint_weight_set(ctx_mod->ctxpopup, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ctx_mod->ctxpopup, EVAS_HINT_FILL, 0.5); + evas_object_smart_callback_add(ctx_mod->ctxpopup, "dismissed", + _ctxpopup_dismissed_cb, ctx_mod); + evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, + _datetime_resize_cb, ctx_mod); + evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, + _datetime_move_cb, ctx_mod); + evas_object_event_callback_add(elm_widget_top_get(obj), EVAS_CALLBACK_RESIZE, + _ctxpopup_parent_resize_cb, ctx_mod); + + return ((Elm_Datetime_Module_Data*)ctx_mod); +} + +EAPI void +obj_unhook(Elm_Datetime_Module_Data *module_data) +{ + Ctxpopup_Module_Data *ctx_mod; + + ctx_mod = (Ctxpopup_Module_Data *)module_data; + if (!ctx_mod) return; + + if (ctx_mod->ctxpopup) + evas_object_del(ctx_mod->ctxpopup); + + if (ctx_mod) + { + free(ctx_mod); + ctx_mod = NULL; + } +} + +// module api funcs needed +EAPI int +elm_modapi_init(void *m __UNUSED__) +{ + return 1; // succeed always +} + +EAPI int +elm_modapi_shutdown(void *m __UNUSED__) +{ + return 1; // succeed always +} diff --git a/libraries/elementary/src/modules/test_entry/Makefile.am b/libraries/elementary/src/modules/test_entry/Makefile.am new file mode 100644 index 0000000..ebeb949 --- /dev/null +++ b/libraries/elementary/src/modules/test_entry/Makefile.am @@ -0,0 +1,33 @@ + +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I. \ +-I$(top_builddir) \ +-I$(top_srcdir) \ +-I$(top_srcdir)/src/lib \ +-I$(top_builddir)/src/lib \ +-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ +-DPACKAGE_LIB_DIR=\"$(libdir)\" \ +@ELEMENTARY_CFLAGS@ \ +@ELEMENTARY_X_CFLAGS@ \ +@ELEMENTARY_FB_CFLAGS@ \ +@ELEMENTARY_WIN32_CFLAGS@ \ +@ELEMENTARY_WINCE_CFLAGS@ \ +@ELEMENTARY_EDBUS_CFLAGS@ \ +@ELEMENTARY_EFREET_CFLAGS@ \ +@ELEMENTARY_ETHUMB_CFLAGS@ \ +@ELEMENTARY_EMAP_CFLAGS@ + +if ELEMENTARY_WINDOWS_BUILD +AM_CPPFLAGS += -DELEMENTARY_BUILD +endif + +pkgdir = $(libdir)/elementary/modules/test_entry/$(MODULE_ARCH) +pkg_LTLIBRARIES = module.la + +module_la_SOURCES = mod.c + +module_la_LIBADD = $(top_builddir)/src/lib/libelementary.la +module_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version +module_la_LIBTOOLFLAGS = --tag=disable-static diff --git a/libraries/elementary/src/modules/test_entry/Makefile.in b/libraries/elementary/src/modules/test_entry/Makefile.in new file mode 100644 index 0000000..9cd901f --- /dev/null +++ b/libraries/elementary/src/modules/test_entry/Makefile.in @@ -0,0 +1,664 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@ELEMENTARY_WINDOWS_BUILD_TRUE@am__append_1 = -DELEMENTARY_BUILD +subdir = src/modules/test_entry +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/efl_binary.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/elementary_config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(pkgdir)" +LTLIBRARIES = $(pkg_LTLIBRARIES) +module_la_DEPENDENCIES = $(top_builddir)/src/lib/libelementary.la +am_module_la_OBJECTS = module_la-mod.lo +module_la_OBJECTS = $(am_module_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +module_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(module_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(module_la_SOURCES) +DIST_SOURCES = $(module_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EIO_CFLAGS = @EIO_CFLAGS@ +EIO_LIBS = @EIO_LIBS@ +ELEMENTARY_CFLAGS = @ELEMENTARY_CFLAGS@ +ELEMENTARY_COCOA_CFLAGS = @ELEMENTARY_COCOA_CFLAGS@ +ELEMENTARY_COCOA_LIBS = @ELEMENTARY_COCOA_LIBS@ +ELEMENTARY_CONFIG_PRG = @ELEMENTARY_CONFIG_PRG@ +ELEMENTARY_ECORE_CON_CFLAGS = @ELEMENTARY_ECORE_CON_CFLAGS@ +ELEMENTARY_ECORE_CON_INC = @ELEMENTARY_ECORE_CON_INC@ +ELEMENTARY_ECORE_CON_LIBS = @ELEMENTARY_ECORE_CON_LIBS@ +ELEMENTARY_ECORE_IMF_CFLAGS = @ELEMENTARY_ECORE_IMF_CFLAGS@ +ELEMENTARY_ECORE_IMF_INC = @ELEMENTARY_ECORE_IMF_INC@ +ELEMENTARY_ECORE_IMF_LIBS = @ELEMENTARY_ECORE_IMF_LIBS@ +ELEMENTARY_EDBUS_CFLAGS = @ELEMENTARY_EDBUS_CFLAGS@ +ELEMENTARY_EDBUS_LIBS = @ELEMENTARY_EDBUS_LIBS@ +ELEMENTARY_EFREET_CFLAGS = @ELEMENTARY_EFREET_CFLAGS@ +ELEMENTARY_EFREET_LIBS = @ELEMENTARY_EFREET_LIBS@ +ELEMENTARY_EMAP_CFLAGS = @ELEMENTARY_EMAP_CFLAGS@ +ELEMENTARY_EMAP_LIBS = @ELEMENTARY_EMAP_LIBS@ +ELEMENTARY_ETHUMB_CFLAGS = @ELEMENTARY_ETHUMB_CFLAGS@ +ELEMENTARY_ETHUMB_LIBS = @ELEMENTARY_ETHUMB_LIBS@ +ELEMENTARY_EWEATHER_CFLAGS = @ELEMENTARY_EWEATHER_CFLAGS@ +ELEMENTARY_EWEATHER_LIBS = @ELEMENTARY_EWEATHER_LIBS@ +ELEMENTARY_FB_CFLAGS = @ELEMENTARY_FB_CFLAGS@ +ELEMENTARY_FB_LIBS = @ELEMENTARY_FB_LIBS@ +ELEMENTARY_LIBS = @ELEMENTARY_LIBS@ +ELEMENTARY_PSL1GHT_CFLAGS = @ELEMENTARY_PSL1GHT_CFLAGS@ +ELEMENTARY_PSL1GHT_LIBS = @ELEMENTARY_PSL1GHT_LIBS@ +ELEMENTARY_SDL_CFLAGS = @ELEMENTARY_SDL_CFLAGS@ +ELEMENTARY_SDL_LIBS = @ELEMENTARY_SDL_LIBS@ +ELEMENTARY_TEST_PRG = @ELEMENTARY_TEST_PRG@ +ELEMENTARY_WEB_CFLAGS = @ELEMENTARY_WEB_CFLAGS@ +ELEMENTARY_WEB_LIBS = @ELEMENTARY_WEB_LIBS@ +ELEMENTARY_WIN32_CFLAGS = @ELEMENTARY_WIN32_CFLAGS@ +ELEMENTARY_WIN32_LIBS = @ELEMENTARY_WIN32_LIBS@ +ELEMENTARY_WINCE_CFLAGS = @ELEMENTARY_WINCE_CFLAGS@ +ELEMENTARY_WINCE_LIBS = @ELEMENTARY_WINCE_LIBS@ +ELEMENTARY_X_CFLAGS = @ELEMENTARY_X_CFLAGS@ +ELEMENTARY_X_LIBS = @ELEMENTARY_X_LIBS@ +ELM_ALLOCA_H_DEF = @ELM_ALLOCA_H_DEF@ +ELM_DEBUG_DEF = @ELM_DEBUG_DEF@ +ELM_DIRENT_H_DEF = @ELM_DIRENT_H_DEF@ +ELM_EDBUS_DEF = @ELM_EDBUS_DEF@ +ELM_EFREET_DEF = @ELM_EFREET_DEF@ +ELM_EMAP_DEF = @ELM_EMAP_DEF@ +ELM_ETHUMB_DEF = @ELM_ETHUMB_DEF@ +ELM_EWEATHER_DEF = @ELM_EWEATHER_DEF@ +ELM_LIBINTL_H_DEF = @ELM_LIBINTL_H_DEF@ +ELM_UNIX_DEF = @ELM_UNIX_DEF@ +ELM_WEB_DEF = @ELM_WEB_DEF@ +ELM_WIN32_DEF = @ELM_WIN32_DEF@ +ELM_WINCE_DEF = @ELM_WINCE_DEF@ +EMOTION_CFLAGS = @EMOTION_CFLAGS@ +EMOTION_LIBS = @EMOTION_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALE_DIR = @LOCALE_DIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MODULE_ARCH = @MODULE_ARCH@ +MODULE_EDJE = @MODULE_EDJE@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +VMIN = @VMIN@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +edje_cc = @edje_cc@ +eet_eet = @eet_eet@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +my_libs = @my_libs@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirement_elm = @requirement_elm@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = -I. -I$(top_builddir) -I$(top_srcdir) \ + -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib \ + -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ + -DPACKAGE_LIB_DIR=\"$(libdir)\" @ELEMENTARY_CFLAGS@ \ + @ELEMENTARY_X_CFLAGS@ @ELEMENTARY_FB_CFLAGS@ \ + @ELEMENTARY_WIN32_CFLAGS@ @ELEMENTARY_WINCE_CFLAGS@ \ + @ELEMENTARY_EDBUS_CFLAGS@ @ELEMENTARY_EFREET_CFLAGS@ \ + @ELEMENTARY_ETHUMB_CFLAGS@ @ELEMENTARY_EMAP_CFLAGS@ \ + $(am__append_1) +pkgdir = $(libdir)/elementary/modules/test_entry/$(MODULE_ARCH) +pkg_LTLIBRARIES = module.la +module_la_SOURCES = mod.c +module_la_LIBADD = $(top_builddir)/src/lib/libelementary.la +module_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version +module_la_LIBTOOLFLAGS = --tag=disable-static +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/modules/test_entry/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/modules/test_entry/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(pkgdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdir)" + @list='$(pkg_LTLIBRARIES)'; test -n "$(pkgdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkgdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkgdir)"; \ + } + +uninstall-pkgLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(pkg_LTLIBRARIES)'; test -n "$(pkgdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$f"; \ + done + +clean-pkgLTLIBRARIES: + -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) + @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +module.la: $(module_la_OBJECTS) $(module_la_DEPENDENCIES) + $(AM_V_CCLD)$(module_la_LINK) -rpath $(pkgdir) $(module_la_OBJECTS) $(module_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/module_la-mod.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +module_la-mod.lo: mod.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT module_la-mod.lo -MD -MP -MF $(DEPDIR)/module_la-mod.Tpo -c -o module_la-mod.lo `test -f 'mod.c' || echo '$(srcdir)/'`mod.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/module_la-mod.Tpo $(DEPDIR)/module_la-mod.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mod.c' object='module_la-mod.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o module_la-mod.lo `test -f 'mod.c' || echo '$(srcdir)/'`mod.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(pkgdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-pkgLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pkgLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-pkgLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-pkgLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-pkgLTLIBRARIES install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-pkgLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/elementary/src/modules/test_entry/mod.c b/libraries/elementary/src/modules/test_entry/mod.c new file mode 100644 index 0000000..0b978e6 --- /dev/null +++ b/libraries/elementary/src/modules/test_entry/mod.c @@ -0,0 +1,36 @@ +#include +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +// module api funcs needed +EAPI int +elm_modapi_init(void *m __UNUSED__) +{ + return 1; // succeed always +} + +EAPI int +elm_modapi_shutdown(void *m __UNUSED__) +{ + return 1; // succeed always +} + +// module fucns for the specific module type +EAPI void +obj_hook(Evas_Object *obj) +{ + printf("hook: %p\n", obj); +} + +EAPI void +obj_unhook(Evas_Object *obj) +{ + printf("unhook: %p\n", obj); +} + +EAPI void +obj_longpress(Evas_Object *obj) +{ + printf("longpress: %p\n", obj); +} diff --git a/libraries/elementary/src/modules/test_map/Makefile.am b/libraries/elementary/src/modules/test_map/Makefile.am new file mode 100644 index 0000000..6c2dc6e --- /dev/null +++ b/libraries/elementary/src/modules/test_map/Makefile.am @@ -0,0 +1,33 @@ + +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I. \ +-I$(top_builddir) \ +-I$(top_srcdir) \ +-I$(top_srcdir)/src/lib \ +-I$(top_builddir)/src/lib \ +-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ +-DPACKAGE_LIB_DIR=\"$(libdir)\" \ +@ELEMENTARY_CFLAGS@ \ +@ELEMENTARY_X_CFLAGS@ \ +@ELEMENTARY_FB_CFLAGS@ \ +@ELEMENTARY_WIN32_CFLAGS@ \ +@ELEMENTARY_WINCE_CFLAGS@ \ +@ELEMENTARY_EDBUS_CFLAGS@ \ +@ELEMENTARY_EFREET_CFLAGS@ \ +@ELEMENTARY_ETHUMB_CFLAGS@ \ +@ELEMENTARY_EMAP_CFLAGS@ + +if ELEMENTARY_WINDOWS_BUILD +AM_CPPFLAGS += -DELEMENTARY_BUILD +endif + +pkgdir = $(libdir)/elementary/modules/test_map/$(MODULE_ARCH) +pkg_LTLIBRARIES = module.la + +module_la_SOURCES = mod.c + +module_la_LIBADD = $(top_builddir)/src/lib/libelementary.la +module_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version +module_la_LIBTOOLFLAGS = --tag=disable-static diff --git a/libraries/elementary/src/modules/test_map/Makefile.in b/libraries/elementary/src/modules/test_map/Makefile.in new file mode 100644 index 0000000..68e1fc5 --- /dev/null +++ b/libraries/elementary/src/modules/test_map/Makefile.in @@ -0,0 +1,664 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@ELEMENTARY_WINDOWS_BUILD_TRUE@am__append_1 = -DELEMENTARY_BUILD +subdir = src/modules/test_map +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/efl_binary.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/elementary_config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(pkgdir)" +LTLIBRARIES = $(pkg_LTLIBRARIES) +module_la_DEPENDENCIES = $(top_builddir)/src/lib/libelementary.la +am_module_la_OBJECTS = module_la-mod.lo +module_la_OBJECTS = $(am_module_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +module_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(module_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(module_la_SOURCES) +DIST_SOURCES = $(module_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EIO_CFLAGS = @EIO_CFLAGS@ +EIO_LIBS = @EIO_LIBS@ +ELEMENTARY_CFLAGS = @ELEMENTARY_CFLAGS@ +ELEMENTARY_COCOA_CFLAGS = @ELEMENTARY_COCOA_CFLAGS@ +ELEMENTARY_COCOA_LIBS = @ELEMENTARY_COCOA_LIBS@ +ELEMENTARY_CONFIG_PRG = @ELEMENTARY_CONFIG_PRG@ +ELEMENTARY_ECORE_CON_CFLAGS = @ELEMENTARY_ECORE_CON_CFLAGS@ +ELEMENTARY_ECORE_CON_INC = @ELEMENTARY_ECORE_CON_INC@ +ELEMENTARY_ECORE_CON_LIBS = @ELEMENTARY_ECORE_CON_LIBS@ +ELEMENTARY_ECORE_IMF_CFLAGS = @ELEMENTARY_ECORE_IMF_CFLAGS@ +ELEMENTARY_ECORE_IMF_INC = @ELEMENTARY_ECORE_IMF_INC@ +ELEMENTARY_ECORE_IMF_LIBS = @ELEMENTARY_ECORE_IMF_LIBS@ +ELEMENTARY_EDBUS_CFLAGS = @ELEMENTARY_EDBUS_CFLAGS@ +ELEMENTARY_EDBUS_LIBS = @ELEMENTARY_EDBUS_LIBS@ +ELEMENTARY_EFREET_CFLAGS = @ELEMENTARY_EFREET_CFLAGS@ +ELEMENTARY_EFREET_LIBS = @ELEMENTARY_EFREET_LIBS@ +ELEMENTARY_EMAP_CFLAGS = @ELEMENTARY_EMAP_CFLAGS@ +ELEMENTARY_EMAP_LIBS = @ELEMENTARY_EMAP_LIBS@ +ELEMENTARY_ETHUMB_CFLAGS = @ELEMENTARY_ETHUMB_CFLAGS@ +ELEMENTARY_ETHUMB_LIBS = @ELEMENTARY_ETHUMB_LIBS@ +ELEMENTARY_EWEATHER_CFLAGS = @ELEMENTARY_EWEATHER_CFLAGS@ +ELEMENTARY_EWEATHER_LIBS = @ELEMENTARY_EWEATHER_LIBS@ +ELEMENTARY_FB_CFLAGS = @ELEMENTARY_FB_CFLAGS@ +ELEMENTARY_FB_LIBS = @ELEMENTARY_FB_LIBS@ +ELEMENTARY_LIBS = @ELEMENTARY_LIBS@ +ELEMENTARY_PSL1GHT_CFLAGS = @ELEMENTARY_PSL1GHT_CFLAGS@ +ELEMENTARY_PSL1GHT_LIBS = @ELEMENTARY_PSL1GHT_LIBS@ +ELEMENTARY_SDL_CFLAGS = @ELEMENTARY_SDL_CFLAGS@ +ELEMENTARY_SDL_LIBS = @ELEMENTARY_SDL_LIBS@ +ELEMENTARY_TEST_PRG = @ELEMENTARY_TEST_PRG@ +ELEMENTARY_WEB_CFLAGS = @ELEMENTARY_WEB_CFLAGS@ +ELEMENTARY_WEB_LIBS = @ELEMENTARY_WEB_LIBS@ +ELEMENTARY_WIN32_CFLAGS = @ELEMENTARY_WIN32_CFLAGS@ +ELEMENTARY_WIN32_LIBS = @ELEMENTARY_WIN32_LIBS@ +ELEMENTARY_WINCE_CFLAGS = @ELEMENTARY_WINCE_CFLAGS@ +ELEMENTARY_WINCE_LIBS = @ELEMENTARY_WINCE_LIBS@ +ELEMENTARY_X_CFLAGS = @ELEMENTARY_X_CFLAGS@ +ELEMENTARY_X_LIBS = @ELEMENTARY_X_LIBS@ +ELM_ALLOCA_H_DEF = @ELM_ALLOCA_H_DEF@ +ELM_DEBUG_DEF = @ELM_DEBUG_DEF@ +ELM_DIRENT_H_DEF = @ELM_DIRENT_H_DEF@ +ELM_EDBUS_DEF = @ELM_EDBUS_DEF@ +ELM_EFREET_DEF = @ELM_EFREET_DEF@ +ELM_EMAP_DEF = @ELM_EMAP_DEF@ +ELM_ETHUMB_DEF = @ELM_ETHUMB_DEF@ +ELM_EWEATHER_DEF = @ELM_EWEATHER_DEF@ +ELM_LIBINTL_H_DEF = @ELM_LIBINTL_H_DEF@ +ELM_UNIX_DEF = @ELM_UNIX_DEF@ +ELM_WEB_DEF = @ELM_WEB_DEF@ +ELM_WIN32_DEF = @ELM_WIN32_DEF@ +ELM_WINCE_DEF = @ELM_WINCE_DEF@ +EMOTION_CFLAGS = @EMOTION_CFLAGS@ +EMOTION_LIBS = @EMOTION_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALE_DIR = @LOCALE_DIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MODULE_ARCH = @MODULE_ARCH@ +MODULE_EDJE = @MODULE_EDJE@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +VMIN = @VMIN@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +edje_cc = @edje_cc@ +eet_eet = @eet_eet@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +my_libs = @my_libs@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirement_elm = @requirement_elm@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = -I. -I$(top_builddir) -I$(top_srcdir) \ + -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib \ + -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ + -DPACKAGE_LIB_DIR=\"$(libdir)\" @ELEMENTARY_CFLAGS@ \ + @ELEMENTARY_X_CFLAGS@ @ELEMENTARY_FB_CFLAGS@ \ + @ELEMENTARY_WIN32_CFLAGS@ @ELEMENTARY_WINCE_CFLAGS@ \ + @ELEMENTARY_EDBUS_CFLAGS@ @ELEMENTARY_EFREET_CFLAGS@ \ + @ELEMENTARY_ETHUMB_CFLAGS@ @ELEMENTARY_EMAP_CFLAGS@ \ + $(am__append_1) +pkgdir = $(libdir)/elementary/modules/test_map/$(MODULE_ARCH) +pkg_LTLIBRARIES = module.la +module_la_SOURCES = mod.c +module_la_LIBADD = $(top_builddir)/src/lib/libelementary.la +module_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version +module_la_LIBTOOLFLAGS = --tag=disable-static +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/modules/test_map/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/modules/test_map/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(pkgdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdir)" + @list='$(pkg_LTLIBRARIES)'; test -n "$(pkgdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkgdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkgdir)"; \ + } + +uninstall-pkgLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(pkg_LTLIBRARIES)'; test -n "$(pkgdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$f"; \ + done + +clean-pkgLTLIBRARIES: + -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) + @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +module.la: $(module_la_OBJECTS) $(module_la_DEPENDENCIES) + $(AM_V_CCLD)$(module_la_LINK) -rpath $(pkgdir) $(module_la_OBJECTS) $(module_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/module_la-mod.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +module_la-mod.lo: mod.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT module_la-mod.lo -MD -MP -MF $(DEPDIR)/module_la-mod.Tpo -c -o module_la-mod.lo `test -f 'mod.c' || echo '$(srcdir)/'`mod.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/module_la-mod.Tpo $(DEPDIR)/module_la-mod.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mod.c' object='module_la-mod.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o module_la-mod.lo `test -f 'mod.c' || echo '$(srcdir)/'`mod.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(pkgdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-pkgLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pkgLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-pkgLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-pkgLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-pkgLTLIBRARIES install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-pkgLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/elementary/src/modules/test_map/mod.c b/libraries/elementary/src/modules/test_map/mod.c new file mode 100644 index 0000000..a075cdd --- /dev/null +++ b/libraries/elementary/src/modules/test_map/mod.c @@ -0,0 +1,77 @@ +#include "Elementary.h" +#include +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +EAPI char * +map_module_source_name_get(void) +{ + return strdup("test_map"); +} + +EAPI int +map_module_tile_zoom_min_get(void) +{ + return 0; +} + +EAPI int +map_module_tile_zoom_max_get(void) +{ + return 18; +} + +EAPI char * +map_module_tile_url_get(Evas_Object *obj __UNUSED__, int x, int y, int zoom) +{ + char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), "http://tile.openstreetmap.org/%d/%d/%d.png", + zoom, x, y); + return strdup(buf); +} + +EAPI char * +map_module_route_source_get(void) +{ + return NULL; +} + +EAPI char * +map_module_route_url_get(Evas_Object *obj __UNUSED__, const char *type_name __UNUSED__, int method __UNUSED__, double flon __UNUSED__, double flat __UNUSED__, double tlon __UNUSED__, double tlat __UNUSED__) +{ + return strdup(""); +} + +EAPI char * +map_module_name_url_get(Evas_Object *obj __UNUSED__, int method __UNUSED__, const char *name __UNUSED__, double lon __UNUSED__, double lat __UNUSED__) +{ + return strdup(""); +} + +EAPI Eina_Bool +map_module_tile_geo_to_coord(const Evas_Object *obj __UNUSED__, int zoom __UNUSED__, double lon __UNUSED__, double lat __UNUSED__, int size __UNUSED__, int *x __UNUSED__, int *y __UNUSED__) +{ + return EINA_FALSE; +} + +EAPI Eina_Bool +map_module_tile_coord_to_geo(const Evas_Object *obj __UNUSED__, int zoom __UNUSED__, int x __UNUSED__, int y __UNUSED__, int size __UNUSED__, double *lon __UNUSED__, double *lat __UNUSED__) +{ + return EINA_FALSE; +} + +static Eina_Bool +_module_init(void) +{ + return EINA_TRUE; +} + +static void +_module_shutdown(void) +{ +} + +EINA_MODULE_INIT(_module_init); +EINA_MODULE_SHUTDOWN(_module_shutdown); + -- cgit v1.1