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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
pub use crate::enums::*;
pub use crate::prelude::*;
use fltk_sys::text::*;
use std::{ffi::{CStr, CString}, mem, os::raw};
#[derive(WidgetTrait, DisplayTrait, Debug, Clone)]
pub struct TextDisplay {
_inner: *mut Fl_Text_Display,
}
#[derive(WidgetTrait, DisplayTrait, Debug, Clone)]
pub struct TextEditor {
_inner: *mut Fl_Text_Editor,
}
impl TextEditor {
fn init(&mut self) {
unsafe { Fl_Text_Editor_init(self._inner) }
}
pub fn new(x: i32, y: i32, w: i32, h: i32) -> TextEditor {
let temp = CString::new("").unwrap();
unsafe {
let mut x = TextEditor {
_inner: Fl_Text_Editor_new(x, y, w, h, temp.into_raw() as *const raw::c_char),
};
x.init();
x
}
}
pub fn copy(&self) {
unsafe {
kf_copy(self._inner);
}
}
pub fn cut(&self) {
unsafe {
kf_cut(self._inner);
}
}
pub fn paste(&self) {
unsafe {
kf_paste(self._inner);
}
}
pub fn undo(&self) {
unsafe {
kf_undo(self._inner);
}
}
}
impl TextDisplay {
fn init(&mut self) {
unsafe { Fl_Text_Display_init(self._inner) }
}
pub fn new(x: i32, y: i32, w: i32, h: i32) -> TextDisplay {
let temp = CString::new("").unwrap();
unsafe {
let mut x = TextDisplay {
_inner: Fl_Text_Display_new(x, y, w, h, temp.into_raw() as *const raw::c_char),
};
x.init();
x
}
}
}