fltk_builder/extensions/builder/
table.rs1use fltk::{
2 enums::{Color, FrameType},
3 prelude::TableExt,
4};
5pub trait TableBuilderExt {
7 fn with_table_frame(self, frame: FrameType) -> Self;
9 fn with_rows(self, val: i32) -> Self;
11 fn with_cols(self, val: i32) -> Self;
13 fn with_row_resize(self, flag: bool) -> Self;
15 fn with_col_resize(self, flag: bool) -> Self;
17 fn with_col_resize_min(self, val: i32) -> Self;
19 fn with_row_resize_min(self, val: i32) -> Self;
21 fn with_row_header(self, flag: bool) -> Self;
23 fn with_col_header(self, flag: bool) -> Self;
25 fn with_col_header_height(self, height: i32) -> Self;
27 fn with_row_header_width(self, width: i32) -> Self;
29 fn with_row_header_color(self, val: Color) -> Self;
31 fn with_col_header_color(self, val: Color) -> Self;
33 fn with_row_height(self, row: i32, height: i32) -> Self;
35 fn with_col_width(self, col: i32, width: i32) -> Self;
37 fn with_row_height_all(self, height: i32) -> Self;
39 fn with_col_width_all(self, width: i32) -> Self;
41 fn with_row_position(self, row: i32) -> Self;
43 fn with_col_position(self, col: i32) -> Self;
45 fn with_top_row(self, row: i32) -> Self;
47 fn with_scrollbar_size(self, new_size: i32) -> Self;
49 fn with_tab_cell_nav(self, val: bool) -> Self;
51}
52
53impl<T> TableBuilderExt for T
54where
55 T: TableExt,
56{
57 fn with_table_frame(mut self, frame: FrameType) -> Self {
58 self.set_table_frame(frame);
59 self
60 }
61
62 fn with_rows(mut self, val: i32) -> Self {
63 self.set_rows(val);
64 self
65 }
66
67 fn with_cols(mut self, val: i32) -> Self {
68 self.set_cols(val);
69 self
70 }
71
72 fn with_row_resize(mut self, flag: bool) -> Self {
73 self.set_row_resize(flag);
74 self
75 }
76
77 fn with_col_resize(mut self, flag: bool) -> Self {
78 self.set_col_resize(flag);
79 self
80 }
81
82 fn with_col_resize_min(mut self, val: i32) -> Self {
83 self.set_col_resize_min(val);
84 self
85 }
86
87 fn with_row_resize_min(mut self, val: i32) -> Self {
88 self.set_row_resize_min(val);
89 self
90 }
91
92 fn with_row_header(mut self, flag: bool) -> Self {
93 self.set_row_header(flag);
94 self
95 }
96
97 fn with_col_header(mut self, flag: bool) -> Self {
98 self.set_col_header(flag);
99 self
100 }
101
102 fn with_col_header_height(mut self, height: i32) -> Self {
103 self.set_col_header_height(height);
104 self
105 }
106
107 fn with_row_header_width(mut self, width: i32) -> Self {
108 self.set_row_header_width(width);
109 self
110 }
111
112 fn with_row_header_color(mut self, val: Color) -> Self {
113 self.set_row_header_color(val);
114 self
115 }
116
117 fn with_col_header_color(mut self, val: Color) -> Self {
118 self.set_col_header_color(val);
119 self
120 }
121
122 fn with_row_height(mut self, row: i32, height: i32) -> Self {
123 self.set_row_height(row, height);
124 self
125 }
126
127 fn with_col_width(mut self, col: i32, width: i32) -> Self {
128 self.set_col_width(col, width);
129 self
130 }
131
132 fn with_row_height_all(mut self, height: i32) -> Self {
133 self.set_row_height_all(height);
134 self
135 }
136
137 fn with_col_width_all(mut self, width: i32) -> Self {
138 self.set_col_width_all(width);
139 self
140 }
141
142 fn with_row_position(mut self, row: i32) -> Self {
143 self.set_row_position(row);
144 self
145 }
146
147 fn with_col_position(mut self, col: i32) -> Self {
148 self.set_col_position(col);
149 self
150 }
151
152 fn with_top_row(mut self, row: i32) -> Self {
153 self.set_top_row(row);
154 self
155 }
156
157 fn with_scrollbar_size(mut self, new_size: i32) -> Self {
158 self.set_scrollbar_size(new_size);
159 self
160 }
161
162 fn with_tab_cell_nav(mut self, val: bool) -> Self {
163 self.set_tab_cell_nav(val);
164 self
165 }
166}