label_example_01.c
//Compile with:
//gcc -o label_example_01 label_example_01.c -g `pkg-config --cflags --libs elementary`
#include <Elementary.h>
EAPI_MAIN int
elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
{
Evas_Object *win, *label, *label2, *label3, *label4, *label5, *label6;
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
win = elm_win_util_standard_add("label", "Label");
elm_win_autodel_set(win, EINA_TRUE);
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_mode_set(label, ELM_LABEL_SLIDE_MODE_ALWAYS);
elm_object_style_set(label, "slide_bounce");
evas_object_move(label, 0, 10);
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, 30);
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, 50);
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, 80);
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, 40);
evas_object_move(label5, 0, 110);
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, 140);
evas_object_show(label6);
evas_object_resize(win, 200, 170);
evas_object_show(win);
elm_run();
return 0;
}
ELM_MAIN()
EINA_TRUE
#define EINA_TRUE
boolean value TRUE (numerical value 1)
Definition: eina_types.h:539
EINA_UNUSED
#define EINA_UNUSED
Used to indicate that a function parameter is purposely unused.
Definition: eina_types.h:339
ELM_MAIN
#define ELM_MAIN()
macro to be used after the elm_main() function
Definition: elm_general.h:556
elm_policy_set
Eina_Bool elm_policy_set(unsigned int policy, int value)
Set a new policy's value (for a given policy group/identifier).
Definition: elm_main.c:1380
elm_run
void elm_run(void)
Run Elementary's main loop.
Definition: elm_main.c:1357
ELM_POLICY_QUIT_LAST_WINDOW_CLOSED
@ ELM_POLICY_QUIT_LAST_WINDOW_CLOSED
quit when the application's last window is closed
Definition: elm_general.h:248
ELM_POLICY_QUIT
@ ELM_POLICY_QUIT
under which circumstances the application should quit automatically.
Definition: elm_general.h:227
ELM_WRAP_WORD
@ ELM_WRAP_WORD
Word wrap - wrap in allowed wrapping points (as defined in the unicode standard).
Definition: elm_general.h:314
ELM_WRAP_CHAR
@ ELM_WRAP_CHAR
Char wrap - wrap between characters.
Definition: elm_general.h:313
elm_label_add
Evas_Object * elm_label_add(Evas_Object *parent)
Add a new label to the parent.
Definition: elm_label.c:421
elm_label_line_wrap_set
void elm_label_line_wrap_set(Elm_Label *obj, Elm_Wrap_Type wrap)
Control the wrapping behavior of the label.
Definition: elm_label_eo.legacy.c:51
elm_label_slide_duration_set
void elm_label_slide_duration_set(Elm_Label *obj, double duration)
Control the slide duration of the label.
Definition: elm_label_eo.legacy.c:39
elm_label_slide_mode_set
void elm_label_slide_mode_set(Elm_Label *obj, Elm_Label_Slide_Mode mode)
Control the slide mode of the label widget.
Definition: elm_label_eo.legacy.c:27
elm_label_ellipsis_set
void elm_label_ellipsis_set(Elm_Label *obj, Eina_Bool ellipsis)
Control the ellipsis behavior of the label.
Definition: elm_label_eo.legacy.c:63
ELM_LABEL_SLIDE_MODE_ALWAYS
@ ELM_LABEL_SLIDE_MODE_ALWAYS
Slide always.
Definition: elm_label_eo.h:23
elm_object_style_set
Eina_Bool elm_object_style_set(Evas_Object *obj, const char *style)
Set the style to used by a given widget.
Definition: elm_main.c:1583
elm_win_autodel_set
void elm_win_autodel_set(Eo *obj, Eina_Bool autodel)
Set the window's autodel state.
Definition: efl_ui_win.c:6189
elm_win_util_standard_add
Evas_Object * elm_win_util_standard_add(const char *name, const char *title)
Adds a window object with standard setup.
Definition: efl_ui_win.c:9576
evas_object_show
EVAS_API void evas_object_show(Evas_Object *eo_obj)
Makes the given Evas object visible.
Definition: evas_object_main.c:1814
evas_object_color_set
EVAS_API void evas_object_color_set(Evas_Object *obj, int r, int g, int b, int a)
Sets the general/main color of the given Evas object to the given one.
Definition: evas_object_main.c:2024
evas_object_move
EVAS_API void evas_object_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
Move the given Evas object to the given location inside its canvas' viewport.
Definition: evas_object_main.c:1171
Evas_Object
Efl_Canvas_Object Evas_Object
An Evas Object handle.
Definition: Evas_Common.h:185
evas_object_resize
EVAS_API void evas_object_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
Changes the size of the given Evas object.
Definition: evas_object_main.c:1236