// examples/label.rs
use efl::elementary::{
init, label_add, label_slide_duration_set, label_slide_go, label_slide_mode_set,
object_style_set, object_text_set, policy_set, run, shutdown, win_autodel_set,
win_util_standard_add, LABEL_SLIDE_MODE_ALWAYS, POLICY_QUIT, POLICY_QUIT_LAST_WINDOW_CLOSED,
};
use efl::evas::{object_color_set, object_move, object_resize, object_show, Evas_Object};
fn main() {
init();
let win: *mut Evas_Object;
policy_set(POLICY_QUIT, POLICY_QUIT_LAST_WINDOW_CLOSED);
win = win_util_standard_add("Main", "Label Example");
win_autodel_set(win, true);
object_resize(win, 800, 800);
// Setup a simple label
let label: *mut Evas_Object = label_add(win);
object_text_set(label, "Simple label");
object_resize(label, 180, 30);
// Setup a sliding label
let label_slide: *mut Evas_Object = label_add(win);
object_text_set(
label_slide,
"Some text may be too long for a label to hold. This text can be set to slide.",
);
label_slide_duration_set(label_slide, 0.1);
label_slide_mode_set(label_slide, LABEL_SLIDE_MODE_ALWAYS);
label_slide_go(label_slide);
object_resize(label_slide, 800, 30);
object_move(label_slide, 10, 40);
// Setup marker text
let label_marker: *mut Evas_Object = label_add(win);
object_text_set(label_marker, "You can even color some text!");
object_style_set(label_marker, "marker");
object_color_set(label_marker, 0, 0, 255, 255);
object_resize(label_marker, 500, 30);
object_move(label_marker, 0, 80);
// Setup formatted text
let label_formatted: *mut Evas_Object = label_add(win);
object_text_set(
label_formatted,
"Don\'t forget about bold, italics, and more!",
);
object_resize(label_formatted, 600, 30);
object_move(label_formatted, 10, 120);
// Show widgets
object_show(win);
object_show(label);
object_show(label_slide);
object_show(label_marker);
object_show(label_formatted);
run();
shutdown();
}