Advertisement
Guest User

Untitled

a guest
Jul 11th, 2018
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.28 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_gfx_entity_size_set(win_1, (Eina_Size2D) { 320, 300 });
  32.    efl_gfx_entity_visible_set(win_1, EINA_TRUE);
  33.    efl_name_set(win_1, "win_1");
  34.  
  35.    Eo *_box_1 = elm_box_add(win_1);
  36.    efl_gfx_size_hint_weight_set(_box_1, 1, 1);
  37.    efl_gfx_entity_visible_set(_box_1, EINA_TRUE);
  38.    for (int i = 0; i < 2; i++) {
  39.       Eo *_label_4 = elm_label_add(_box_1);
  40.       efl_text_set(efl_part(_label_4, "elm.text"), _label_var_1[i]);
  41.       efl_gfx_size_hint_weight_set(_label_4, 0, 0);
  42.       efl_gfx_size_hint_align_set(_label_4, -1, -1);
  43.       efl_gfx_entity_visible_set(_label_4, EINA_TRUE);
  44.       elm_box_pack_end(_box_1, _label_4);
  45.    }
  46.  
  47.    Eo *_label_5 = elm_label_add(_box_1);
  48.    elm_label_line_wrap_set(_label_5, ELM_WRAP_CHAR);
  49.    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>");
  50.    efl_gfx_size_hint_weight_set(_label_5, 1, 0);
  51.    efl_gfx_size_hint_align_set(_label_5, -1, -1);
  52.    efl_gfx_entity_visible_set(_label_5, EINA_TRUE);
  53.    elm_box_pack_end(_box_1, _label_5);
  54.  
  55.    Eo *_label_6 = elm_label_add(_box_1);
  56.    efl_text_set(efl_part(_label_6, "elm.text"), "This small label set to wrap");
  57.    efl_gfx_size_hint_weight_set(_label_6, 1, 0);
  58.    efl_gfx_size_hint_align_set(_label_6, -1, -1);
  59.    efl_gfx_entity_visible_set(_label_6, EINA_TRUE);
  60.    elm_box_pack_end(_box_1, _label_6);
  61.  
  62.    Eo *_label_7 = elm_label_add(_box_1);
  63.    efl_text_set(efl_part(_label_7, "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...");
  64.    elm_label_line_wrap_set(_label_7, ELM_WRAP_WORD);
  65.    efl_gfx_size_hint_weight_set(_label_7, 1, 0);
  66.    efl_gfx_size_hint_align_set(_label_7, -1, -1);
  67.    efl_gfx_entity_visible_set(_label_7, EINA_TRUE);
  68.    elm_box_pack_end(_box_1, _label_7);
  69.    efl_content_set(win_1, _box_1);
  70. }
  71.  
  72. EAPI_MAIN int
  73. elm_main (int argc, char *argv[])
  74. {
  75.    const char *test = (argc == 2 ? argv[1] : "");
  76.  
  77.    if (argc == 1 || !strcmp(test, "label")) label_win_1_create();
  78.    else return 1;
  79.    elm_run();
  80.    return 0;
  81. }
  82. ELM_MAIN()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement