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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
use crate::enums::{Align, CallbackTrigger, Color, Damage, Event, Font, FrameType, LabelType};
use crate::image::Image;
use crate::prelude::*;
use crate::utils::FlString;
use fltk_sys::input::*;
use std::{
ffi::{CStr, CString},
mem,
os::raw,
};
#[derive(WidgetBase, WidgetExt, InputExt, Debug)]
pub struct Input {
inner: *mut Fl_Input,
tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
}
#[repr(i32)]
#[derive(WidgetType, Debug, Copy, Clone, PartialEq)]
pub enum InputType {
Normal = 0,
Float = 1,
Int = 2,
Multiline = 4,
Secret = 5,
Input = 7,
Readonly = 8,
Wrap = 16,
}
#[derive(WidgetBase, WidgetExt, InputExt, Debug)]
pub struct IntInput {
inner: *mut Fl_Int_Input,
tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
}
#[derive(WidgetBase, WidgetExt, InputExt, Debug)]
pub struct FloatInput {
inner: *mut Fl_Float_Input,
tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
}
#[derive(WidgetBase, WidgetExt, InputExt, Debug)]
pub struct MultilineInput {
inner: *mut Fl_Multiline_Input,
tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
}
#[derive(WidgetBase, WidgetExt, InputExt, Debug)]
pub struct FileInput {
inner: *mut Fl_File_Input,
tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
}
impl FileInput {
pub fn set_down_frame(&mut self, f: FrameType) {
assert!(!self.was_deleted());
unsafe { Fl_File_Input_set_down_box(self.inner, f as i32) }
}
pub fn down_frame(&self) -> FrameType {
assert!(!self.was_deleted());
unsafe { mem::transmute(Fl_File_Input_down_box(self.inner)) }
}
}
#[derive(WidgetBase, WidgetExt, InputExt, Debug)]
pub struct SecretInput {
inner: *mut Fl_Secret_Input,
tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
}