1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use iup_sys;
use std::ptr;
use std::ffi::CString;
use Element;
use Orientation;
pub struct Label(*mut iup_sys::Ihandle);
impl Label {
pub fn new() -> Label {
unsafe { Label::from_raw(iup_sys::IupLabel(ptr::null_mut())) }
}
pub fn new_separator(orient: Orientation) -> Label {
Label::new().set_attrib_data("SEPARATOR", orient.as_cstr() as *const _)
}
pub fn with_title<S: Into<String>>(label: S) -> Label {
let clabel = CString::new(label.into()).unwrap();
unsafe { Label::from_raw(iup_sys::IupLabel(clabel.as_ptr())) }
}
}
impl_widget!(Label, "label");
impl ::callback::MapCb for Label {}
impl ::callback::UnmapCb for Label {}
impl ::callback::EnterWindowCb for Label {}
impl ::callback::LeaveWindowCb for Label {}
impl ::callback::button::ButtonCb for Label {}
impl ::callback::DropFilesCb for Label {}