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
|
// Programmed by Jedidiah Barber
// Released into the public domain
#include <FL/Fl_Window.H>
#include <FL/Fl_RGB_Image.H>
#include "c_fl_window.h"
// Exports from Ada
extern "C" void widget_draw_hook(void * ud);
extern "C" int widget_handle_hook(void * ud, int e);
// Non-friend protected access
class Friend_Window : Fl_Window {
public:
using Fl_Window::flush;
using Fl_Window::force_position;
};
// Attaching all relevant hooks and friends
class My_Window : public Fl_Window {
public:
using Fl_Window::Fl_Window;
friend void fl_window_draw(WINDOW n);
friend int fl_window_handle(WINDOW n, int e);
void draw();
int handle(int e);
};
void My_Window::draw() {
widget_draw_hook(this->user_data());
}
int My_Window::handle(int e) {
return widget_handle_hook(this->user_data(), e);
}
// Flattened C API
WINDOW new_fl_window(int x, int y, int w, int h, char* label) {
My_Window *n = new My_Window(x, y, w, h, label);
return n;
}
WINDOW new_fl_window2(int w, int h, char* label) {
My_Window *n = new My_Window(w, h, label);
return n;
}
void free_fl_window(WINDOW n) {
delete static_cast<My_Window*>(n);
}
void fl_window_show(WINDOW n) {
// virtual, so disable dispatch
static_cast<Fl_Window*>(n)->Fl_Window::show();
}
void fl_window_show2(WINDOW n, int c, void * v) {
static_cast<Fl_Window*>(n)->show(c, static_cast<char**>(v));
}
void fl_window_hide(WINDOW n) {
// virtual, so disable dispatch
static_cast<Fl_Window*>(n)->Fl_Window::hide();
}
int fl_window_shown(WINDOW n) {
return static_cast<Fl_Window*>(n)->shown();
}
void fl_window_wait_for_expose(WINDOW n) {
static_cast<Fl_Window*>(n)->wait_for_expose();
}
void fl_window_iconize(WINDOW n) {
static_cast<Fl_Window*>(n)->iconize();
}
void fl_window_make_current(WINDOW n) {
static_cast<Fl_Window*>(n)->make_current();
}
unsigned int fl_window_fullscreen_active(WINDOW n) {
return static_cast<Fl_Window*>(n)->fullscreen_active();
}
void fl_window_fullscreen(WINDOW n) {
static_cast<Fl_Window*>(n)->fullscreen();
}
void fl_window_fullscreen_off(WINDOW n) {
static_cast<Fl_Window*>(n)->fullscreen_off();
}
void fl_window_fullscreen_off2(WINDOW n, int x, int y, int w, int h) {
static_cast<Fl_Window*>(n)->fullscreen_off(x,y,w,h);
}
void fl_window_fullscreen_screens(WINDOW n, int t, int b, int l, int r) {
static_cast<Fl_Window*>(n)->fullscreen_screens(t,b,l,r);
}
void fl_window_set_icon(WINDOW n, void * img) {
static_cast<Fl_Window*>(n)->icon(static_cast<Fl_RGB_Image*>(img));
}
void fl_window_icons(WINDOW n, void * imgs, int count) {
static_cast<Fl_Window*>(n)->icons(static_cast<const Fl_RGB_Image**>(imgs), count);
}
void fl_window_default_icon(void * img) {
Fl_Window::default_icon(static_cast<Fl_RGB_Image*>(img));
}
void fl_window_default_icons(void * imgs, int count) {
Fl_Window::default_icons(static_cast<const Fl_RGB_Image**>(imgs), count);
}
const char * fl_window_get_iconlabel(WINDOW n) {
return static_cast<Fl_Window*>(n)->iconlabel();
}
void fl_window_set_iconlabel(WINDOW n, const char * s) {
static_cast<Fl_Window*>(n)->iconlabel(s);
}
void fl_window_set_cursor(WINDOW n, int c) {
static_cast<Fl_Window*>(n)->cursor(static_cast<Fl_Cursor>(c));
}
void fl_window_set_cursor2(WINDOW n, void * img, int x, int y) {
static_cast<Fl_Window*>(n)->cursor(static_cast<Fl_RGB_Image*>(img),x,y);
}
void fl_window_set_default_cursor(WINDOW n, int c) {
static_cast<Fl_Window*>(n)->default_cursor(static_cast<Fl_Cursor>(c));
}
unsigned int fl_window_get_border(WINDOW n) {
return static_cast<Fl_Window*>(n)->border();
}
void fl_window_set_border(WINDOW n, int b) {
static_cast<Fl_Window*>(n)->border(b);
}
void fl_window_clear_border(WINDOW n) {
static_cast<Fl_Window*>(n)->clear_border();
}
unsigned int fl_window_get_override(WINDOW n) {
return static_cast<Fl_Window*>(n)->override();
}
void fl_window_set_override(WINDOW n) {
static_cast<Fl_Window*>(n)->set_override();
}
unsigned int fl_window_modal(WINDOW n) {
return static_cast<Fl_Window*>(n)->modal();
}
unsigned int fl_window_non_modal(WINDOW n) {
return static_cast<Fl_Window*>(n)->non_modal();
}
void fl_window_clear_modal_states(WINDOW n) {
static_cast<Fl_Window*>(n)->clear_modal_states();
}
void fl_window_set_modal(WINDOW n) {
static_cast<Fl_Window*>(n)->set_modal();
}
void fl_window_set_non_modal(WINDOW n) {
static_cast<Fl_Window*>(n)->set_non_modal();
}
const char * fl_window_get_label(WINDOW n) {
return static_cast<Fl_Window*>(n)->label();
}
void fl_window_copy_label(WINDOW n, char* text) {
static_cast<Fl_Window*>(n)->copy_label(text);
}
void fl_window_hotspot(WINDOW n, int x, int y, int s) {
static_cast<Fl_Window*>(n)->hotspot(x,y,s);
}
void fl_window_hotspot2(WINDOW n, void * i, int s) {
static_cast<Fl_Window*>(n)->hotspot(static_cast<Fl_Widget*>(i),s);
}
void fl_window_shape(WINDOW n, void * p) {
static_cast<Fl_Window*>(n)->shape(static_cast<Fl_Image*>(p));
}
void fl_window_size_range(WINDOW n, int lw, int lh, int hw, int hh, int dw, int dh, int a) {
static_cast<Fl_Window*>(n)->size_range(lw, lh, hw, hh, dw, dh, a);
}
void fl_window_resize(WINDOW n, int x, int y, int w, int h) {
static_cast<Fl_Window*>(n)->resize(x, y, w, h);
}
int fl_window_get_force_position(WINDOW n) {
int (Fl_Window::*myforce)() const = &Friend_Window::force_position;
return (static_cast<Fl_Window*>(n)->*myforce)();
}
void fl_window_set_force_position(WINDOW n, int s) {
void (Fl_Window::*myforce)(int) = &Friend_Window::force_position;
(static_cast<Fl_Window*>(n)->*myforce)(s);
}
int fl_window_get_x_root(WINDOW n) {
return static_cast<Fl_Window*>(n)->x_root();
}
int fl_window_get_y_root(WINDOW n) {
return static_cast<Fl_Window*>(n)->y_root();
}
int fl_window_get_decorated_w(WINDOW n) {
return static_cast<Fl_Window*>(n)->decorated_w();
}
int fl_window_get_decorated_h(WINDOW n) {
return static_cast<Fl_Window*>(n)->decorated_h();
}
const char * fl_window_get_xclass(WINDOW n) {
return static_cast<Fl_Window*>(n)->xclass();
}
void fl_window_set_xclass(WINDOW n, const char * c) {
static_cast<Fl_Window*>(n)->xclass(c);
}
const char * fl_window_get_default_xclass() {
return Fl_Window::default_xclass();
}
void fl_window_set_default_xclass(const char * c) {
Fl_Window::default_xclass(c);
}
unsigned int fl_window_menu_window(WINDOW n) {
return static_cast<Fl_Window*>(n)->menu_window();
}
unsigned int fl_window_tooltip_window(WINDOW n) {
return static_cast<Fl_Window*>(n)->tooltip_window();
}
void fl_window_draw(WINDOW n) {
static_cast<My_Window*>(n)->Fl_Window::draw();
}
void fl_window_flush(WINDOW n) {
(static_cast<Fl_Window*>(n)->*(&Friend_Window::flush))();
}
int fl_window_handle(WINDOW n, int e) {
return static_cast<My_Window*>(n)->Fl_Window::handle(e);
}
|