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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
#include <cfltk/cfl_browser.h>
#include <cfltk/cfl_lock.h>
#include <cfltk/cfl_widget.hpp>
#include <FL/Fl.H>
#include <FL/Fl_Browser.H>
#include <FL/Fl_Check_Browser.H>
#include <FL/Fl_File_Browser.H>
#include <FL/Fl_Hold_Browser.H>
#include <FL/Fl_Image.H>
#include <FL/Fl_Multi_Browser.H>
#include <FL/Fl_Select_Browser.H>
#define BROWSER_DEFINE(widget) \
int widget##_value(widget *self) { \
LOCK(int ret = self->value()); \
return ret; \
} \
void widget##_remove(widget *self, int line) { \
LOCK(auto icon = self->icon(line); if (icon) delete icon; \
self->remove(line)); \
} \
void widget##_add(widget *self, const char *newtext) { \
LOCK(self->add(newtext)); \
} \
void widget##_insert(widget *self, int line, const char *newtext) { \
LOCK(self->insert(line, newtext)); \
} \
void widget##_move(widget *self, int to, int from) { \
LOCK(self->move(to, from)); \
} \
void widget##_swap(widget *self, int a, int b) { \
LOCK(self->swap(a, b)); \
} \
void widget##_clear(widget *self) { \
LOCK(for (int i = 0; i < self->size(); i++) { \
auto icon = self->icon(i + 1); \
if (icon) \
delete icon; \
} self->clear()); \
} \
int widget##_size(const widget *self) { \
LOCK(auto ret = self->size()); \
return ret; \
} \
int widget##_select(widget *self, int line) { \
LOCK(auto ret = self->select(line)); \
return ret; \
} \
int widget##_select_ext(widget *self, int line, int val) { \
LOCK(auto ret = self->select(line, val)); \
return ret; \
} \
int widget##_selected(const widget *self, int line) { \
LOCK(auto ret = self->selected(line)); \
return ret; \
} \
const char *widget##_text(const widget *self, int line) { \
LOCK(auto ret = self->text(line)); \
return ret; \
} \
void widget##_set_text(widget *self, int line, const char *newtext) { \
LOCK(self->text(line, newtext)); \
} \
void widget##_load_file(widget *self, const char *file) { \
LOCK(self->load(file)); \
} \
int widget##_text_size(widget *self) { \
LOCK(auto ret = self->textsize()); \
return ret; \
} \
void widget##_set_text_size(widget *self, int s) { \
LOCK(self->textsize(s)); \
} \
void widget##_set_icon(widget *self, int line, void *icon) { \
LOCK(auto old = self->icon(line); \
if (!icon) self->icon(line, nullptr); \
else { \
self->icon(line, ((Fl_Image *)icon)->copy()); \
delete old; \
}) \
} \
void *widget##_icon(const widget *self, int line) { \
LOCK(auto temp = self->icon(line)); \
if (!temp) \
return nullptr; \
LOCK(auto ret = ((Fl_Image *)temp)->copy()); \
return ret; \
} \
void widget##_remove_icon(widget *self, int l) { \
LOCK(self->remove_icon(l)); \
} \
void widget##_topline(widget *self, int line) { \
LOCK(self->topline(line)); \
} \
int widget##_is_topline(widget *self) { \
LOCK(auto ret = self->topline()); \
return ret; \
} \
void widget##_bottomline(widget *self, int line) { \
LOCK(self->bottomline(line)); \
} \
void widget##_middleline(widget *self, int line) { \
LOCK(self->middleline(line)); \
} \
char widget##_format_char(const widget *self) { \
LOCK(auto ret = self->format_char()); \
return ret; \
} \
void widget##_set_format_char(widget *self, char c) { \
LOCK(self->format_char(c)); \
} \
char widget##_column_char(const widget *self) { \
LOCK(auto ret = self->column_char()); \
return ret; \
} \
void widget##_set_column_char(widget *self, char c) { \
LOCK(self->column_char(c)); \
} \
const int *widget##_column_widths(const widget *self) { \
LOCK(auto ret = self->column_widths()); \
return ret; \
} \
void widget##_set_column_widths(widget *self, const int *arr) { \
LOCK(self->column_widths(arr)); \
} \
int widget##_displayed(const widget *self, int line) { \
LOCK(auto ret = self->displayed(line)); \
return ret; \
} \
void widget##_make_visible(widget *self, int line) { \
LOCK(self->make_visible(line)); \
} \
int widget##_position(const widget *self) { \
LOCK(auto ret = self->vposition()); \
return ret; \
} \
void widget##_set_position(widget *self, int pos) { \
LOCK(self->vposition(pos)); \
} \
int widget##_hposition(const widget *self) { \
LOCK(auto ret = self->hposition()); \
return ret; \
} \
void widget##_set_hposition(widget *self, int pos) { \
LOCK(self->hposition(pos)); \
} \
unsigned char widget##_has_scrollbar(const widget *self) { \
LOCK(auto ret = self->has_scrollbar()); \
return ret; \
} \
void widget##_set_has_scrollbar(widget *self, unsigned char mode) { \
LOCK(self->has_scrollbar(mode)); \
} \
int widget##_scrollbar_size(const widget *self) { \
LOCK(auto ret = self->scrollbar_size()); \
return ret; \
} \
void widget##_set_scrollbar_size(widget *self, int newSize) { \
LOCK(self->scrollbar_size(newSize)); \
} \
void widget##_sort(widget *self) { \
LOCK(self->sort()); \
} \
void *widget##_scrollbar(widget *self) { \
LOCK(auto ret = &self->scrollbar); \
return ret; \
} \
void *widget##_hscrollbar(widget *self) { \
LOCK(auto ret = &self->hscrollbar); \
return ret; \
} \
void *widget##_data(const widget *self, int line) { \
LOCK(auto ret = self->data(line)); \
return ret; \
} \
void widget##_set_data(widget *self, int line, void *data) { \
LOCK(self->data(line, data)); \
} \
void widget##_hide_line(widget *self, int line) { \
LOCK(self->hide(line)); \
}
WIDGET_CLASS(Fl_Browser)
WIDGET_DEFINE(Fl_Browser)
BROWSER_DEFINE(Fl_Browser)
WIDGET_CLASS(Fl_Hold_Browser)
WIDGET_DEFINE(Fl_Hold_Browser)
BROWSER_DEFINE(Fl_Hold_Browser)
WIDGET_CLASS(Fl_Select_Browser)
WIDGET_DEFINE(Fl_Select_Browser)
BROWSER_DEFINE(Fl_Select_Browser)
WIDGET_CLASS(Fl_Multi_Browser)
WIDGET_DEFINE(Fl_Multi_Browser)
BROWSER_DEFINE(Fl_Multi_Browser)
WIDGET_CLASS(Fl_File_Browser)
WIDGET_DEFINE(Fl_File_Browser)
unsigned Fl_File_Browser_iconsize(const Fl_File_Browser *self) {
LOCK(auto ret = self->iconsize());
return ret;
}
void Fl_File_Browser_set_iconsize(Fl_File_Browser *self, unsigned s) {
LOCK(self->iconsize(s));
}
void Fl_File_Browser_set_filter(Fl_File_Browser *self, const char *pattern) {
LOCK(self->filter(pattern));
}
const char *Fl_File_Browser_filter(const Fl_File_Browser *self) {
LOCK(auto ret = self->filter());
return ret;
}
int Fl_File_Browser_filetype(const Fl_File_Browser *self) {
LOCK(auto ret = self->filetype());
return ret;
}
void Fl_File_Browser_set_filetype(Fl_File_Browser *self, int t) {
LOCK(self->filetype(t));
}
BROWSER_DEFINE(Fl_File_Browser)
WIDGET_CLASS(Fl_Check_Browser)
WIDGET_DEFINE(Fl_Check_Browser)
int Fl_Check_Browser_add(Fl_Check_Browser *self, const char *s, int b) {
LOCK(auto ret = self->add(s, b));
return ret;
}
int Fl_Check_Browser_remove(Fl_Check_Browser *self, int item) {
LOCK(auto ret = self->remove(item));
return ret;
}
void Fl_Check_Browser_clear(Fl_Check_Browser *self) {
LOCK(self->clear());
}
int Fl_Check_Browser_nitems(const Fl_Check_Browser *self) {
LOCK(auto ret = self->nitems());
return ret;
}
int Fl_Check_Browser_nchecked(const Fl_Check_Browser *self) {
LOCK(auto ret = self->nchecked());
return ret;
}
int Fl_Check_Browser_checked(const Fl_Check_Browser *self, int item) {
LOCK(auto ret = self->checked(item));
return ret;
}
void Fl_Check_Browser_set_checked(Fl_Check_Browser *self, int item) {
LOCK(self->set_checked(item));
}
void Fl_Check_Browser_check_all(Fl_Check_Browser *self) {
LOCK(self->check_all());
}
void Fl_Check_Browser_check_none(Fl_Check_Browser *self) {
LOCK(self->check_none());
}
int Fl_Check_Browser_value(const Fl_Check_Browser *self) {
LOCK(auto ret = self->value());
return ret;
}
const char *Fl_Check_Browser_text(const Fl_Check_Browser *self, int item) {
LOCK(auto ret = self->text(item));
return ret;
}
void Fl_Check_Browser_set_text_color(Fl_Check_Browser *self, unsigned int c) {
LOCK(self->textcolor(c));
}
unsigned int Fl_Check_Browser_text_color(Fl_Check_Browser *self) {
LOCK(auto ret = self->textcolor());
return ret;
}
void Fl_Check_Browser_set_text_font(Fl_Check_Browser *self, int f) {
LOCK(self->textfont(f));
}
int Fl_Check_Browser_text_font(Fl_Check_Browser *self) {
LOCK(auto ret = self->textfont());
return ret;
}
void Fl_Check_Browser_set_text_size(Fl_Check_Browser *self, int s) {
LOCK(self->textsize(s));
}
int Fl_Check_Browser_text_size(Fl_Check_Browser *self) {
LOCK(auto ret = self->textsize());
return ret;
}
int Fl_Check_Browser_position(const Fl_Check_Browser *self) {
LOCK(auto ret = self->vposition());
return ret;
}
void Fl_Check_Browser_set_position(Fl_Check_Browser *self, int pos) {
LOCK(self->vposition(pos));
}
int Fl_Check_Browser_hposition(const Fl_Check_Browser *self) {
LOCK(auto ret = self->hposition());
return ret;
}
void Fl_Check_Browser_set_hposition(Fl_Check_Browser *self, int pos) {
LOCK(self->hposition(pos));
}
unsigned char Fl_Check_Browser_has_scrollbar(const Fl_Check_Browser *self) {
LOCK(auto ret = self->has_scrollbar());
return ret;
}
void Fl_Check_Browser_set_has_scrollbar(
Fl_Check_Browser *self, unsigned char mode
) {
LOCK(self->has_scrollbar(mode));
}
int Fl_Check_Browser_scrollbar_size(const Fl_Check_Browser *self) {
LOCK(auto ret = self->scrollbar_size());
return ret;
}
void Fl_Check_Browser_set_scrollbar_size(Fl_Check_Browser *self, int newSize) {
LOCK(self->scrollbar_size(newSize));
}
void Fl_Check_Browser_sort(Fl_Check_Browser *self) {
LOCK(self->sort());
}
const void *Fl_Check_Browser_scrollbar(const Fl_Check_Browser *self) {
LOCK(auto ret = &self->scrollbar);
return ret;
}
const void *Fl_Check_Browser_hscrollbar(const Fl_Check_Browser *self) {
LOCK(auto ret = &self->hscrollbar);
return ret;
}