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
use super::{NcMenuItem, NcMenuSection};
use crate::{cstring_mut, NcInput};
use core::ptr::null_mut;
#[allow(unused_imports)]
use crate::widgets::NcMenu;
mod menu;
mod options;
pub use menu::*;
pub use options::*;
impl NcMenuItem {
pub fn new(desc: &str, shortcut: NcInput) -> Self {
Self {
desc: cstring_mut![desc],
shortcut,
}
}
pub fn new_empty() -> Self {
Self {
desc: null_mut(),
shortcut: NcInput::new_empty(),
}
}
}
impl NcMenuSection {
pub fn new(name: &str, items: &mut [NcMenuItem], shortcut: NcInput) -> Self {
Self {
name: cstring_mut![name],
items: items.as_mut_ptr(),
itemcount: items.len() as i32,
shortcut,
}
}
pub fn new_separator() -> Self {
Self {
name: null_mut(),
items: null_mut(),
itemcount: 0,
shortcut: NcInput::new_empty(),
}
}
}