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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// SPDX-License-Identifier: MPL-2.0
//! [`Table`].
mod model;
pub use model::Model;
use crate::prelude::*;
#[derive(Clone, Copy, Debug)]
pub enum RowBackgroundColor {
Default,
SameAsColumn { index: NonNegativeInt },
}
impl RowBackgroundColor {
fn into_param(self) -> c_int {
match self {
Self::Default => -1,
Self::SameAsColumn { index } => index.to_libui(),
}
}
}
impl Ui {
// pub fn create_table<'ui>(
// &'ui self,
// model: Model,
// row_bg: RowBackgroundColor,
// ) -> Result<&'ui mut Table, crate::Error> {
// let mut params = uiTableParams {
// // TODO: `model` is dropped at the end of scope, so this will always be a
// // use-after-free.
// Model: model.as_ptr(),
// RowBackgroundColorModelColumn: row_bg.into_param(),
// };
// call_libui_new_fn!(
// ui: self,
// fn: uiNewTable(std::ptr::addr_of_mut!(params)) -> Table,
// )
// }
}
#[subcontrol(handle = "uiTable")]
pub struct Table;
impl Table<'_> {
bind_bool_fn!(
docs: "
Determines if the header of this table is visible.
# Examples
```no_run
// TODO
```
",
self: { fn: is_header_visible() -> bool },
libui: { fn: uiTableHeaderVisible(...) },
);
bind_fn!(
docs: "
Sets whether or not the header of this table should be visible.
# Examples
```no_run
// TODO
```
",
self: { fn: set_header_visible(value: bool) },
libui: { fn: uiTableHeaderSetVisible(...) },
);
bind_fn!(
docs: "
The width of the column at the given index.
# Examples
```no_run
// TODO
```
",
self: { fn: column_width(index: uint) -> c_int },
libui: { fn: uiTableColumnWidth(...) },
);
bind_fn!(
docs: "
Sets the width of the column at the given index.
# Examples
```no_run
// TODO
```
",
self: { fn: set_column_width(index: uint, width: uint) },
libui: { fn: uiTableColumnSetWidth(...) },
);
}