Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.14 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. static const char * _label_var_1 [2] = { "<b>This is a small label</b>", "This is a larger label with newlines<br/>to make it bigger, bit it won't expand or wrap<br/>just be a block of text that can't change its<br/>formatting as it's fixed based on text<br/>" };
  20.  
  21.  
  22. void
  23. label_win_1_create()
  24. {
  25.    Eo *win_1 = efl_add(EFL_UI_WIN_CLASS, NULL,
  26.          efl_gfx_size_hint_weight_set(efl_added, 0, 0),
  27.          efl_gfx_size_hint_align_set(efl_added, 0.5, 0.5),
  28.          efl_text_set(efl_added, "Label"),
  29.          efl_ui_win_name_set(efl_added, "label"),
  30.          efl_ui_win_type_set(efl_added, EFL_UI_WIN_BASIC));
  31.    efl_ui_win_autodel_set(win_1, EINA_TRUE);
  32.    efl_gfx_size_set(win_1, (Eina_Size2D) { 320, 300 });
  33.  
  34.    Eo *_box_1 = elm_box_add(win_1);
  35.    efl_gfx_size_hint_weight_set(_box_1, 1, 1);
  36.    efl_gfx_visible_set(_box_1, EINA_TRUE);
  37.    for (int i = 0; i < 2; i++) {
  38.       Eo *_label_4 = efl_add(ELM_LABEL_CLASS, _box_1,
  39.          efl_text_set(efl_part(efl_added, "elm.text"), _label_var_1[i]));
  40.       efl_gfx_size_hint_weight_set(_label_4, 0, 0);
  41.       efl_gfx_size_hint_align_set(_label_4, -1, -1);
  42.       elm_box_pack_end(_box_1, _label_4);
  43.    }
  44.  
  45.    Eo *_label_5 = efl_add(ELM_LABEL_CLASS, _box_1,
  46.          elm_obj_label_line_wrap_set(efl_added, ELM_WRAP_CHAR));
  47.    efl_text_set(efl_part(_label_5, "elm.text"), "<b>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.</b>");
  48.    efl_gfx_size_hint_weight_set(_label_5, 1, 0);
  49.    efl_gfx_size_hint_align_set(_label_5, -1, -1);
  50.    elm_box_pack_end(_box_1, _label_5);
  51.  
  52.    Eo *_label_6 = efl_add(ELM_LABEL_CLASS, _box_1,
  53.          efl_text_set(efl_part(efl_added, "elm.text"), "This small label set to wrap"));
  54.    efl_gfx_size_hint_weight_set(_label_6, 1, 0);
  55.    efl_gfx_size_hint_align_set(_label_6, -1, -1);
  56.    elm_box_pack_end(_box_1, _label_6);
  57.  
  58.    Eo *_label_7 = efl_add(ELM_LABEL_CLASS, _box_1,
  59.          efl_text_set(efl_part(efl_added, "elm.text"), "You can also use all the default entry style tags, like <hilight>hilight</hilight>, <success>success</success>, <bigger>bigger</bigger>, <smaller>smaller</smaller>, etc..."));
  60.    elm_obj_label_line_wrap_set(_label_7, ELM_WRAP_WORD);
  61.    efl_gfx_size_hint_weight_set(_label_7, 1, 0);
  62.    efl_gfx_size_hint_align_set(_label_7, -1, -1);
  63.    elm_box_pack_end(_box_1, _label_7);
  64.  
  65.    efl_gfx_visible_set(win_1, EINA_TRUE);
  66.    efl_content_set(win_1, _box_1);
  67. }
  68.  
  69. EAPI_MAIN int
  70. elm_main (int argc, char *argv[])
  71. {
  72.    const char *test = (argc == 2 ? argv[1] : "");
  73.  
  74.    if (argc == 1 || !strcmp(test, "label")) label_win_1_create();
  75.    else return 1;
  76.    elm_run();
  77.    return 0;
  78. }
  79. ELM_MAIN()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement