fltk-sys 0.11.4

Rust bindings for the FLTK GUI library
Documentation
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
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
#include "cfl_text.h"

#include <FL/Fl.H>
#include <FL/Fl_Image.H>
#include <FL/Fl_Simple_Terminal.H>
#include <FL/Fl_Text_Buffer.H>
#include <FL/Fl_Text_Display.H>
#include <FL/Fl_Text_Editor.H>
#include <FL/Fl_Widget.H>

#define DISPLAY_DEFINE(widget)                                                                     \
    int widget##_text_font(const widget *self) {                                                   \
        return self->textfont();                                                                   \
    }                                                                                              \
    void widget##_set_text_font(widget *self, int s) {                                             \
        LOCK(self->textfont(s);)                                                                   \
    }                                                                                              \
    int widget##_text_size(const widget *self) {                                                   \
        return self->textsize();                                                                   \
    }                                                                                              \
    void widget##_set_text_size(widget *self, int s) {                                             \
        LOCK(self->textsize(s);)                                                                   \
    }                                                                                              \
    unsigned int widget##_text_color(const widget *self) {                                         \
        return self->textcolor();                                                                  \
    }                                                                                              \
    void widget##_set_text_color(widget *self, unsigned int n) {                                   \
        LOCK(self->textcolor(n);)                                                                  \
    }                                                                                              \
    void widget##_scroll(widget *self, int topLineNum, int horizOffset) {                          \
        LOCK(self->scroll(topLineNum, horizOffset);)                                               \
    }                                                                                              \
    void widget##_insert(widget *self, const char *text) {                                         \
        LOCK(((Fl_Text_Display *)self)->insert(text);)                                             \
    }                                                                                              \
    void widget##_set_insert_position(widget *self, int newPos) {                                  \
        LOCK(self->insert_position(newPos);)                                                       \
    }                                                                                              \
    int widget##_insert_position(const widget *self) {                                             \
        return self->insert_position();                                                            \
    }                                                                                              \
    int widget##_position_to_xy(const widget *self, int pos, int *x, int *y) {                     \
        return self->position_to_xy(pos, x, y);                                                    \
    }                                                                                              \
    int widget##_count_lines(const widget *self, int start, int end,                               \
                             int start_pos_is_line_start) {                                        \
        return self->count_lines(start, end, start_pos_is_line_start);                             \
    }                                                                                              \
    int widget##_move_right(widget *self) {                                                        \
        int ret = 0;                                                                               \
        LOCK(ret = self->move_right());                                                            \
        return ret;                                                                                \
    }                                                                                              \
    int widget##_move_left(widget *self) {                                                         \
        int ret = 0;                                                                               \
        LOCK(ret = self->move_left());                                                             \
        return ret;                                                                                \
    }                                                                                              \
    int widget##_move_up(widget *self) {                                                           \
        int ret = 0;                                                                               \
        LOCK(ret = self->move_up());                                                               \
        return ret;                                                                                \
    }                                                                                              \
    int widget##_move_down(widget *self) {                                                         \
        int ret = 0;                                                                               \
        LOCK(ret = self->move_down());                                                             \
        return ret;                                                                                \
    }                                                                                              \
    void widget##_show_cursor(widget *self, int boolean) {                                         \
        LOCK(if (boolean) self->show_cursor(); else self->hide_cursor();)                          \
    }                                                                                              \
    void widget##_set_highlight_data(widget *self, void *sbuff, unsigned int *color, int *font,    \
                                     int *fontsz, int sz) {                                        \
        Fl_Text_Display::Style_Table_Entry *stable = new Fl_Text_Display::Style_Table_Entry[sz];   \
        if (!stable)                                                                               \
            return;                                                                                \
        for (int i = 0; i < sz; ++i) {                                                             \
            stable[i] = {color[i], font[i], fontsz[i]};                                            \
        }                                                                                          \
        LOCK(self->highlight_data((Fl_Text_Buffer *)sbuff, stable, sz, 'A', 0, 0);)                \
    }                                                                                              \
    void widget##_set_cursor_style(widget *self, int style) {                                      \
        LOCK(self->cursor_style(style);)                                                           \
    }                                                                                              \
    void widget##_set_cursor_color(widget *self, unsigned int color) {                             \
        LOCK(self->cursor_color(color);)                                                           \
    }                                                                                              \
    void widget##_set_scrollbar_width(widget *self, int width) {                                   \
        LOCK(self->scrollbar_width(width);)                                                        \
    }                                                                                              \
    void widget##_set_scrollbar_size(widget *self, int newSize) {                                  \
        LOCK(self->scrollbar_size(newSize);)                                                       \
    }                                                                                              \
    void widget##_set_scrollbar_align(widget *self, int align) {                                   \
        LOCK(self->scrollbar_align(align);)                                                        \
    }                                                                                              \
    int widget##_cursor_style(widget *self) {                                                      \
        return self->cursor_style();                                                               \
    }                                                                                              \
    unsigned int widget##_cursor_color(widget *self) {                                             \
        return self->cursor_color();                                                               \
    }                                                                                              \
    int widget##_scrollbar_width(widget *self) {                                                   \
        return self->scrollbar_width();                                                            \
    }                                                                                              \
    int widget##_scrollbar_size(widget *self) {                                                    \
        return self->scrollbar_size();                                                             \
    }                                                                                              \
    int widget##_scrollbar_align(widget *self) {                                                   \
        return self->scrollbar_align();                                                            \
    }                                                                                              \
    int widget##_line_start(const widget *self, int pos) {                                         \
        return self->line_start(pos);                                                              \
    }                                                                                              \
    int widget##_line_end(const widget *self, int startPos, int startPosIsLineStart) {             \
        return self->line_end(startPos, startPosIsLineStart);                                      \
    }                                                                                              \
    int widget##_skip_lines(widget *self, int startPos, int nLines, int startPosIsLineStart) {     \
        int ret = 0;                                                                               \
        LOCK(ret = self->skip_lines(startPos, nLines, startPosIsLineStart);)                       \
        return ret;                                                                                \
    }                                                                                              \
    int widget##_rewind_lines(widget *self, int startPos, int nLines) {                            \
        int ret = 0;                                                                               \
        LOCK(ret = self->rewind_lines(startPos, nLines);)                                          \
        return ret;                                                                                \
    }                                                                                              \
    void widget##_next_word(widget *self) {                                                        \
        LOCK(self->next_word();)                                                                   \
    }                                                                                              \
    void widget##_previous_word(widget *self) {                                                    \
        LOCK(self->previous_word();)                                                               \
    }                                                                                              \
    int widget##_word_start(const widget *self, int pos) {                                         \
        return self->word_start(pos);                                                              \
    }                                                                                              \
    int widget##_word_end(const widget *self, int pos) {                                           \
        return self->word_end(pos);                                                                \
    }                                                                                              \
    double widget##_x_to_col(const widget *self, double x) {                                       \
        return self->x_to_col(x);                                                                  \
    }                                                                                              \
    double widget##_col_to_x(const widget *self, double col) {                                     \
        return self->col_to_x(col);                                                                \
    }                                                                                              \
    void widget##_set_linenumber_width(widget *self, int width) {                                  \
        LOCK(self->linenumber_width(width);)                                                       \
    }                                                                                              \
    int widget##_linenumber_width(const widget *self) {                                            \
        return self->linenumber_width();                                                           \
    }                                                                                              \
    void widget##_set_linenumber_font(widget *self, int val) {                                     \
        LOCK(self->linenumber_font(val);)                                                          \
    }                                                                                              \
    int widget##_linenumber_font(const widget *self) {                                             \
        return self->linenumber_font();                                                            \
    }                                                                                              \
    void widget##_set_linenumber_size(widget *self, int val) {                                     \
        LOCK(self->linenumber_size(val);)                                                          \
    }                                                                                              \
    int widget##_linenumber_size(const widget *self) {                                             \
        return self->linenumber_size();                                                            \
    }                                                                                              \
    void widget##_set_linenumber_fgcolor(widget *self, unsigned int val) {                         \
        LOCK(self->linenumber_fgcolor(val);)                                                       \
    }                                                                                              \
    unsigned int widget##_linenumber_fgcolor(const widget *self) {                                 \
        return self->linenumber_fgcolor();                                                         \
    }                                                                                              \
    void widget##_set_linenumber_bgcolor(widget *self, unsigned int val) {                         \
        LOCK(self->linenumber_bgcolor(val);)                                                       \
    }                                                                                              \
    unsigned int widget##_linenumber_bgcolor(const widget *self) {                                 \
        return self->linenumber_bgcolor();                                                         \
    }                                                                                              \
    void widget##_set_linenumber_align(widget *self, int val) {                                    \
        LOCK(self->linenumber_align(val);)                                                         \
    }                                                                                              \
    int widget##_linenumber_align(const widget *self) {                                            \
        return self->linenumber_align();                                                           \
    }                                                                                              \
    int widget##_in_selection(const widget *self, int x, int y) {                                  \
        return self->in_selection(x, y);                                                           \
    }                                                                                              \
    void widget##_wrap_mode(widget *self, int wrap, int wrap_margin) {                             \
        LOCK(self->wrap_mode(wrap, wrap_margin))                                                   \
    }                                                                                              \
    int widget##_wrapped_column(const widget *self, int row, int column) {                         \
        return self->wrapped_column(row, column);                                                  \
    }                                                                                              \
    int widget##_wrapped_row(const widget *self, int row) {                                        \
        return self->wrapped_row(row);                                                             \
    }

Fl_Text_Buffer *Fl_Text_Buffer_new(void) {
    return new Fl_Text_Buffer;
}

void Fl_Text_Buffer_delete(Fl_Text_Buffer *self) {
    delete self;
}

const char *Fl_Text_Buffer_text(Fl_Text_Buffer *self) {
    return self->text();
}

void Fl_Text_Buffer_set_text(Fl_Text_Buffer *self, const char *txt) {
    LOCK(self->text(txt);)
}

void Fl_Text_Buffer_append(Fl_Text_Buffer *self, const char *txt) {
    LOCK(self->append(txt);)
}

void Fl_Text_Buffer_remove(Fl_Text_Buffer *self, int start, int end) {
    LOCK(self->remove(start, end);)
}

int Fl_Text_Buffer_length(const Fl_Text_Buffer *self) {
    return self->length();
}

char *Fl_Text_Buffer_text_range(const Fl_Text_Buffer *self, int start, int end) {
    return self->text_range(start, end);
}

void Fl_Text_Buffer_insert(Fl_Text_Buffer *self, int pos, const char *text) {
    LOCK(self->insert(pos, text);)
}

void Fl_Text_Buffer_replace(Fl_Text_Buffer *self, int start, int end, const char *text) {
    LOCK(self->replace(start, end, text);)
}

void Fl_Text_Buffer_copy(Fl_Text_Buffer *self, Fl_Text_Buffer *fromBuf, int fromStart, int fromEnd,
                         int toPos) {
    LOCK(self->copy(fromBuf, fromStart, fromEnd, toPos);)
}

int Fl_Text_Buffer_undo(Fl_Text_Buffer *self, int *cp) {
    return self->undo(NULL);
}

void Fl_Text_Buffer_canUndo(Fl_Text_Buffer *self, char flag) {
    LOCK(self->canUndo(flag);)
}

int Fl_Text_Buffer_loadfile(Fl_Text_Buffer *self, const char *file) {
    return self->loadfile(file);
}

int Fl_Text_Buffer_savefile(Fl_Text_Buffer *self, const char *file) {
    return self->savefile(file);
}

int Fl_Text_Buffer_tab_distance(const Fl_Text_Buffer *self) {
    return self->tab_distance();
}

void Fl_Text_Buffer_set_tab_distance(Fl_Text_Buffer *self, int tabDist) {
    LOCK(self->tab_distance(tabDist);)
}

void Fl_Text_Buffer_select(Fl_Text_Buffer *self, int start, int end) {
    LOCK(self->select(start, end);)
}

int Fl_Text_Buffer_selected(const Fl_Text_Buffer *self) {
    return self->selected();
}

void Fl_Text_Buffer_unselect(Fl_Text_Buffer *self) {
    self->unselect();
}

int Fl_Text_Buffer_selection_position(Fl_Text_Buffer *self, int *start, int *end) {
    return self->selection_position(start, end);
}

char *Fl_Text_Buffer_selection_text(Fl_Text_Buffer *self) {
    return self->selection_text();
}

void Fl_Text_Buffer_remove_selection(Fl_Text_Buffer *self) {
    LOCK(self->remove_selection();)
}

void Fl_Text_Buffer_replace_selection(Fl_Text_Buffer *self, const char *text) {
    LOCK(self->replace_selection(text);)
}

void Fl_Text_Buffer_highlight(Fl_Text_Buffer *self, int start, int end) {
    LOCK(self->highlight(start, end);)
}

int Fl_Text_Buffer_is_highlighted(Fl_Text_Buffer *self) {
    return self->highlight();
}

void Fl_Text_Buffer_unhighlight(Fl_Text_Buffer *self) {
    LOCK(self->unhighlight();)
}

int Fl_Text_Buffer_highlight_position(Fl_Text_Buffer *self, int *start, int *end) {
    return self->highlight_position(start, end);
}

char *Fl_Text_Buffer_highlight_text(Fl_Text_Buffer *self) {
    return self->highlight_text();
}

char *Fl_Text_Buffer_line_text(const Fl_Text_Buffer *self, int pos) {
    return self->line_text(pos);
}

int Fl_Text_Buffer_line_start(const Fl_Text_Buffer *self, int pos) {
    return self->line_start(pos);
}

int Fl_Text_Buffer_word_start(const Fl_Text_Buffer *self, int pos) {
    return self->word_start(pos);
}

int Fl_Text_Buffer_word_end(const Fl_Text_Buffer *self, int pos) {
    return self->word_end(pos);
}

int Fl_Text_Buffer_count_lines(const Fl_Text_Buffer *self, int startPos, int endPos) {
    return self->count_lines(startPos, endPos);
}

void Fl_Text_Buffer_add_modify_callback(Fl_Text_Buffer *self, Fl_Text_Modify_Cb bufModifiedCB,
                                        void *cbArg) {
    LOCK(self->add_modify_callback(bufModifiedCB, cbArg);)
}

void Fl_Text_Buffer_remove_modify_callback(Fl_Text_Buffer *self, Fl_Text_Modify_Cb bufModifiedCB,
                                           void *cbArg) {
    LOCK(self->remove_modify_callback(bufModifiedCB, cbArg);)
}

void Fl_Text_Buffer_call_modify_callbacks(Fl_Text_Buffer *self) {
    LOCK(self->call_modify_callbacks();)
}

WIDGET_CLASS(Fl_Text_Display)

WIDGET_DEFINE(Fl_Text_Display)

void Fl_Text_Display_init(Fl_Text_Display *self) {
    Fl_Text_Buffer *buff = new Fl_Text_Buffer();
    self->buffer(buff);
}

Fl_Text_Buffer *Fl_Text_Display_get_buffer(Fl_Text_Display *self) {
    return self->buffer();
}

void Fl_Text_Display_set_buffer(Fl_Text_Display *self, Fl_Text_Buffer *buf) {
    LOCK(self->buffer(buf);)
}

Fl_Text_Buffer *Fl_Text_Display_get_style_buffer(Fl_Text_Display *self) {
    return self->style_buffer();
}

DISPLAY_DEFINE(Fl_Text_Display)

WIDGET_CLASS(Fl_Text_Editor)

WIDGET_DEFINE(Fl_Text_Editor)

void Fl_Text_Editor_init(Fl_Text_Editor *self) {
    Fl_Text_Buffer *buff = new Fl_Text_Buffer();
    self->buffer(buff);
}

Fl_Text_Buffer *Fl_Text_Editor_get_buffer(Fl_Text_Editor *self) {
    return self->buffer();
}

void Fl_Text_Editor_set_buffer(Fl_Text_Editor *self, Fl_Text_Buffer *buf) {
    LOCK(self->buffer(buf);)
}

Fl_Text_Buffer *Fl_Text_Editor_get_style_buffer(Fl_Text_Editor *self) {
    return self->style_buffer();
}

DISPLAY_DEFINE(Fl_Text_Editor)

int Fl_Text_Editor_kf_copy(Fl_Text_Editor *e) {
    int ret = 0;
    LOCK(ret = Fl_Text_Editor::kf_copy(1, e));
    return ret;
}

int Fl_Text_Editor_kf_cut(Fl_Text_Editor *e) {
    int ret = 0;
    LOCK(ret = Fl_Text_Editor::kf_cut(1, e));
    return ret;
}

int Fl_Text_Editor_kf_paste(Fl_Text_Editor *e) {
    int ret = 0;
    LOCK(ret = Fl_Text_Editor::kf_paste(1, e));
    return ret;
}

int Fl_Text_Editor_kf_undo(Fl_Text_Editor *e) {
    int ret = 0;
    LOCK(ret = Fl_Text_Editor::kf_undo(1, e));
    return ret;
}

int Fl_Text_Editor_kf_default(int c, Fl_Text_Editor *e) {
    int ret = 0;
    LOCK(ret = Fl_Text_Editor::kf_default(c, e));
    return ret;
}

int Fl_Text_Editor_kf_ignore(int c, Fl_Text_Editor *e) {
    int ret = 0;
    LOCK(ret = Fl_Text_Editor::kf_ignore(c, e));
    return ret;
}

int Fl_Text_Editor_kf_backspace(Fl_Text_Editor *e) {
    int ret = 0;
    LOCK(ret = Fl_Text_Editor::kf_backspace(0, e));
    return ret;
}

int Fl_Text_Editor_kf_enter(Fl_Text_Editor *e) {
    int ret = 0;
    LOCK(ret = Fl_Text_Editor::kf_enter(0, e));
    return ret;
}

int Fl_Text_Editor_kf_move(int c, Fl_Text_Editor *e) {
    int ret = 0;
    LOCK(ret = Fl_Text_Editor::kf_move(c, e));
    return ret;
}

int Fl_Text_Editor_kf_shift_move(int c, Fl_Text_Editor *e) {
    int ret = 0;
    LOCK(ret = Fl_Text_Editor::kf_shift_move(c, e));
    return ret;
}

int Fl_Text_Editor_kf_ctrl_move(int c, Fl_Text_Editor *e) {
    int ret = 0;
    LOCK(ret = Fl_Text_Editor::kf_ctrl_move(c, e));
    return ret;
}

int Fl_Text_Editor_kf_c_s_move(int c, Fl_Text_Editor *e) {
    int ret = 0;
    LOCK(ret = Fl_Text_Editor::kf_c_s_move(c, e));
    return ret;
}

int Fl_Text_Editor_kf_meta_move(int c, Fl_Text_Editor *e) {
    int ret = 0;
    LOCK(ret = Fl_Text_Editor::kf_meta_move(c, e));
    return ret;
}

int Fl_Text_Editor_kf_m_s_move(int c, Fl_Text_Editor *e) {
    int ret = 0;
    LOCK(ret = Fl_Text_Editor::kf_m_s_move(c, e));
    return ret;
}

int Fl_Text_Editor_kf_home(Fl_Text_Editor *e) {
    int ret = 0;
    LOCK(ret = Fl_Text_Editor::kf_home(0, e));
    return ret;
}

int Fl_Text_Editor_kf_end(Fl_Text_Editor *e) {
    int ret = 0;
    LOCK(ret = Fl_Text_Editor::kf_end(0, e));
    return ret;
}

int Fl_Text_Editor_kf_left(Fl_Text_Editor *e) {
    int ret = 0;
    LOCK(ret = Fl_Text_Editor::kf_left(0, e));
    return ret;
}

int Fl_Text_Editor_kf_up(Fl_Text_Editor *e) {
    int ret = 0;
    LOCK(ret = Fl_Text_Editor::kf_up(0, e));
    return ret;
}

int Fl_Text_Editor_kf_right(Fl_Text_Editor *e) {
    int ret = 0;
    LOCK(ret = Fl_Text_Editor::kf_right(0, e));
    return ret;
}

int Fl_Text_Editor_kf_down(Fl_Text_Editor *e) {
    int ret = 0;
    LOCK(ret = Fl_Text_Editor::kf_down(0, e));
    return ret;
}

int Fl_Text_Editor_kf_page_up(Fl_Text_Editor *e) {
    int ret = 0;
    LOCK(ret = Fl_Text_Editor::kf_page_up(0, e));
    return ret;
}

int Fl_Text_Editor_kf_page_down(Fl_Text_Editor *e) {
    int ret = 0;
    LOCK(ret = Fl_Text_Editor::kf_page_down(0, e));
    return ret;
}

int Fl_Text_Editor_kf_insert(Fl_Text_Editor *e) {
    int ret = 0;
    LOCK(ret = Fl_Text_Editor::kf_insert(0, e));
    return ret;
}

int Fl_Text_Editor_kf_delete(Fl_Text_Editor *e) {
    int ret = 0;
    LOCK(ret = Fl_Text_Editor::kf_delete(0, e));
    return ret;
}

int Fl_Text_Editor_kf_select_all(Fl_Text_Editor *e) {
    int ret = 0;
    LOCK(ret = Fl_Text_Editor::kf_select_all(0, e));
    return ret;
}

void Fl_Text_Editor_set_insert_mode(Fl_Text_Editor *self, int b) {
    LOCK(self->insert_mode(b);)
}

int Fl_Text_Editor_insert_mode(Fl_Text_Editor *self) {
    int ret = 0;
    LOCK(ret = self->insert_mode());
    return ret;
}

void Fl_Text_Editor_set_tab_nav(Fl_Text_Editor *self, int val) {
    LOCK(self->tab_nav(val);)
}

int Fl_Text_Editor_tab_nav(const Fl_Text_Editor *self) {
    return self->tab_nav();
}

WIDGET_CLASS(Fl_Simple_Terminal)

WIDGET_DEFINE(Fl_Simple_Terminal)

void Fl_Simple_Terminal_init(Fl_Simple_Terminal *self) {
    Fl_Text_Buffer *buff = new Fl_Text_Buffer();
    self->buffer(buff);
}

Fl_Text_Buffer *Fl_Simple_Terminal_get_buffer(Fl_Simple_Terminal *self) {
    return self->buffer();
}

void Fl_Simple_Terminal_set_buffer(Fl_Simple_Terminal *self, Fl_Text_Buffer *buf) {
    LOCK(self->buffer(buf);)
}

Fl_Text_Buffer *Fl_Simple_Terminal_get_style_buffer(Fl_Simple_Terminal *self) {
    return self->style_buffer();
}

void Fl_Simple_Terminal_set_stay_at_bottom(Fl_Simple_Terminal *self, int flag) {
    LOCK(self->stay_at_bottom(flag);)
}

int Fl_Simple_Terminal_stay_at_bottom(const Fl_Simple_Terminal *self) {
    return self->stay_at_bottom();
}

void Fl_Simple_Terminal_set_history_lines(Fl_Simple_Terminal *self, int cnt) {
    LOCK(self->history_lines(cnt);)
}

int Fl_Simple_Terminal_history_lines(const Fl_Simple_Terminal *self) {
    return self->history_lines();
}

void Fl_Simple_Terminal_set_ansi(Fl_Simple_Terminal *self, int val) {
    LOCK(self->ansi(val);)
}

int Fl_Simple_Terminal_ansi(const Fl_Simple_Terminal *self) {
    return self->ansi();
}

void Fl_Simple_Terminal_append(Fl_Simple_Terminal *self, const char *s) {
    LOCK(self->append(s);)
}

void Fl_Simple_Terminal_set_text(Fl_Simple_Terminal *self, const char *s) {
    LOCK(self->text(s);)
}

const char *Fl_Simple_Terminal_text(const Fl_Simple_Terminal *self) {
    return self->text();
}

void Fl_Simple_Terminal_clear(Fl_Simple_Terminal *self) {
    LOCK(self->clear();)
}

void Fl_Simple_Terminal_remove_lines(Fl_Simple_Terminal *self, int start, int count) {
    LOCK(self->remove_lines(start, count);)
}

DISPLAY_DEFINE(Fl_Simple_Terminal)

void Fl_delete_stable(void *stable) {
    delete[](Fl_Text_Display::Style_Table_Entry *) stable;
}