Advertisement
Guest User

Untitled

a guest
Aug 14th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.45 KB | None | 0 0
  1. #ifndef EFL_BETA_API_SUPPORT
  2. #define EFL_BETA_API_SUPPORT
  3. #endif
  4. #ifndef EFL_EO_API_SUPPORT
  5. #define EFL_EO_API_SUPPORT
  6. #endif
  7. #ifndef ELM_INTERNAL_API_ARGESFSDFEFC
  8. #define ELM_INTERNAL_API_ARGESFSDFEFC
  9. #endif
  10.  
  11. #include <Elementary.h>
  12. #include <Eo.h>
  13.  
  14. #define ELM_WIDGET_PROTECTED
  15. #include "elm_widget.h"
  16. #include "elm_widget_container.h"
  17. #include "elm_interface_scrollable.h"
  18.  
  19. typedef struct
  20. {
  21.    Eo *bg_2;
  22. } _radio_1_changed_info;
  23.  
  24. typedef struct
  25. {
  26.    Eo *bg_2;
  27. } _radio_2_changed_info;
  28.  
  29.  
  30. static void
  31. _radio_1_changed_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
  32. {
  33.    _radio_1_changed_info *ext_wdgs = data;
  34.    elm_obj_bg_load_size_set(ext_wdgs->bg_2, 50, 50);
  35. }
  36.  
  37. static void
  38. _radio_2_changed_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
  39. {
  40.    _radio_2_changed_info *ext_wdgs = data;
  41.    elm_obj_bg_load_size_set(ext_wdgs->bg_2, 100, 100);
  42. }
  43.  
  44. void
  45. win_1_create()
  46. {
  47.    Eo *win_1 = efl_add(EFL_UI_WIN_CLASS, NULL,
  48.          efl_ui_win_name_set(efl_added, "bg-image"),
  49.          efl_ui_win_type_set(efl_added, EFL_UI_WIN_BASIC));
  50.    efl_text_set(win_1, "Bg Image");
  51.    efl_ui_win_autodel_set(win_1, EINA_TRUE);
  52.    efl_gfx_size_set(win_1, 320, 320);
  53.  
  54.    Eo *bg_1 = efl_add(ELM_BG_CLASS, win_1);
  55.    efl_gfx_size_hint_weight_set(bg_1, 1, 1);
  56.    efl_content_set(win_1, bg_1);
  57.  
  58.    Eo *box_1 = elm_box_add(win_1);
  59.    efl_gfx_size_hint_weight_set(box_1, 1, 1);
  60.    efl_gfx_visible_set(box_1, EINA_TRUE);
  61.  
  62.    Eo *bg_2 = efl_add(ELM_BG_CLASS, box_1);
  63.    efl_file_set(bg_2, "/opt/e/share/elementary/images/plant_01.jpg", NULL);
  64.    efl_gfx_size_hint_weight_set(bg_2, 1, 1);
  65.    efl_gfx_size_hint_align_set(bg_2, -1, -1);
  66.    elm_box_pack_end(box_1, bg_2);
  67.  
  68.    Eo *box_2 = elm_box_add(box_1);
  69.    elm_box_horizontal_set(box_2, EINA_TRUE);
  70.    efl_gfx_size_hint_weight_set(box_2, 1, -1);
  71.    efl_gfx_size_hint_align_set(box_2, -1, -1);
  72.    efl_gfx_visible_set(box_2, EINA_TRUE);
  73.  
  74.    Eo *radio_1 = efl_add(EFL_UI_RADIO_CLASS, box_2);
  75.    efl_ui_radio_state_value_set(radio_1, 50);
  76.    elm_obj_widget_part_text_set(radio_1, NULL, "50 x 50");
  77.    efl_gfx_size_hint_weight_set(radio_1, 1, -1);
  78.    efl_ui_radio_value_set(radio_1, 200);
  79.    elm_box_pack_end(box_2, radio_1);
  80.  
  81.    Eo *radio_2 = efl_add(EFL_UI_RADIO_CLASS, box_2);
  82.    efl_ui_radio_state_value_set(radio_2, 100);
  83.    efl_ui_radio_group_add(radio_2, radio_1);
  84.    elm_obj_widget_part_text_set(radio_2, NULL, "100 x 100");
  85.    efl_gfx_size_hint_weight_set(radio_2, 1, -1);
  86.    elm_box_pack_end(box_2, radio_2);
  87.  
  88.    Eo *radio_3 = efl_add(EFL_UI_RADIO_CLASS, box_2);
  89.    efl_ui_radio_state_value_set(radio_3, 200);
  90.    efl_ui_radio_group_add(radio_3, radio_1);
  91.    elm_obj_widget_part_text_set(radio_3, NULL, "200 x 200");
  92.    efl_gfx_size_hint_weight_set(radio_3, 1, -1);
  93.    elm_box_pack_end(box_2, radio_3);
  94.    elm_box_pack_end(box_1, box_2);
  95.    efl_content_set(win_1, box_1);
  96.  
  97.    _radio_1_changed_info *radio_1_changed_info = calloc(1, sizeof(*radio_1_changed_info));
  98.    radio_1_changed_info->bg_2 = bg_2;
  99.    efl_event_callback_add(radio_1, EFL_UI_RADIO_EVENT_CHANGED, _radio_1_changed_cb, radio_1_changed_info);
  100.  
  101.    _radio_2_changed_info *radio_2_changed_info = calloc(1, sizeof(*radio_2_changed_info));
  102.    radio_2_changed_info->bg_2 = bg_2;
  103.    efl_event_callback_add(radio_2, EFL_UI_RADIO_EVENT_CHANGED, _radio_2_changed_cb, radio_2_changed_info);
  104. }
  105.  
  106. EAPI_MAIN void efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
  107. { win_1_create(NULL); }
  108. EFL_MAIN()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement