dear_imgui_rs/widget/table/
tokens.rs1use crate::sys;
2use crate::ui::Ui;
3
4#[must_use]
6pub struct TableToken<'ui> {
7 _ui: &'ui Ui,
8}
9
10impl<'ui> TableToken<'ui> {
11 pub(crate) fn new(ui: &'ui Ui) -> Self {
13 TableToken { _ui: ui }
14 }
15
16 pub fn end(self) {
18 }
20}
21
22impl<'ui> Drop for TableToken<'ui> {
23 fn drop(&mut self) {
24 self._ui
25 .run_with_bound_context(|| unsafe { sys::igEndTable() });
26 }
27}
28
29#[must_use = "dropping the token pops the table background draw channel immediately"]
31pub struct TableBackgroundChannelToken<'ui> {
32 _ui: &'ui Ui,
33}
34
35impl<'ui> TableBackgroundChannelToken<'ui> {
36 pub(crate) fn new(ui: &'ui Ui) -> Self {
37 Self { _ui: ui }
38 }
39
40 pub fn pop(self) {}
42
43 pub fn end(self) {}
45}
46
47impl Drop for TableBackgroundChannelToken<'_> {
48 fn drop(&mut self) {
49 self._ui
50 .run_with_bound_context(|| unsafe { sys::igTablePopBackgroundChannel() });
51 }
52}
53
54#[must_use = "dropping the token pops the table column draw channel immediately"]
56pub struct TableColumnChannelToken<'ui> {
57 _ui: &'ui Ui,
58}
59
60impl<'ui> TableColumnChannelToken<'ui> {
61 pub(crate) fn new(ui: &'ui Ui) -> Self {
62 Self { _ui: ui }
63 }
64
65 pub fn pop(self) {}
67
68 pub fn end(self) {}
70}
71
72impl Drop for TableColumnChannelToken<'_> {
73 fn drop(&mut self) {
74 self._ui
75 .run_with_bound_context(|| unsafe { sys::igTablePopColumnChannel() });
76 }
77}