fltk-sys 1.3.28

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
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
#include "cfl_text.h"
#include "cfl_lock.h"
#include "cfl_widget.hpp"

#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) {                                                   \
        LOCK(auto ret = self->textfont());                                                         \
        return ret;                                                                                \
    }                                                                                              \
    void widget##_set_text_font(widget *self, int s) {                                             \
        LOCK(self->textfont(s));                                                                   \
    }                                                                                              \
    int widget##_text_size(const widget *self) {                                                   \
        LOCK(auto ret = self->textsize());                                                         \
        return ret;                                                                                \
    }                                                                                              \
    void widget##_set_text_size(widget *self, int s) {                                             \
        LOCK(self->textsize(s));                                                                   \
    }                                                                                              \
    unsigned int widget##_text_color(const widget *self) {                                         \
        LOCK(auto ret = self->textcolor());                                                        \
        return ret;                                                                                \
    }                                                                                              \
    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) {                                             \
        LOCK(auto ret = self->insert_position());                                                  \
        return ret;                                                                                \
    }                                                                                              \
    int widget##_position_to_xy(const widget *self, int pos, int *x, int *y) {                     \
        LOCK(auto ret = self->position_to_xy(pos, x, y));                                          \
        return ret;                                                                                \
    }                                                                                              \
    int widget##_count_lines(const widget *self, int start, int end,                               \
                             int start_pos_is_line_start) {                                        \
        LOCK(auto ret = self->count_lines(start, end, start_pos_is_line_start));                   \
        return ret;                                                                                \
    }                                                                                              \
    int widget##_move_right(widget *self) {                                                        \
        LOCK(auto ret = self->move_right());                                                       \
        return ret;                                                                                \
    }                                                                                              \
    int widget##_move_left(widget *self) {                                                         \
        LOCK(auto ret = self->move_left());                                                        \
        return ret;                                                                                \
    }                                                                                              \
    int widget##_move_up(widget *self) {                                                           \
        LOCK(auto ret = self->move_up());                                                          \
        return ret;                                                                                \
    }                                                                                              \
    int widget##_move_down(widget *self) {                                                         \
        LOCK(auto 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, unsigned *attr, unsigned int *bgcolor, 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], attr[i], bgcolor[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_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) {                                                      \
        LOCK(auto ret = self->cursor_style());                                                     \
        return ret;                                                                                \
    }                                                                                              \
    unsigned int widget##_cursor_color(widget *self) {                                             \
        LOCK(auto ret = self->cursor_color());                                                     \
        return ret;                                                                                \
    }                                                                                              \
    int widget##_scrollbar_size(widget *self) {                                                    \
        LOCK(auto ret = self->scrollbar_size());                                                   \
        return ret;                                                                                \
    }                                                                                              \
    int widget##_scrollbar_align(widget *self) {                                                   \
        LOCK(auto ret = self->scrollbar_align());                                                  \
        return ret;                                                                                \
    }                                                                                              \
    int widget##_line_start(const widget *self, int pos) {                                         \
        LOCK(auto ret = self->line_start(pos));                                                    \
        return ret;                                                                                \
    }                                                                                              \
    int widget##_line_end(const widget *self, int startPos, int startPosIsLineStart) {             \
        LOCK(auto ret = self->line_end(startPos, startPosIsLineStart));                            \
        return ret;                                                                                \
    }                                                                                              \
    int widget##_skip_lines(widget *self, int startPos, int nLines, int startPosIsLineStart) {     \
        LOCK(auto ret = self->skip_lines(startPos, nLines, startPosIsLineStart));                  \
        return ret;                                                                                \
    }                                                                                              \
    int widget##_rewind_lines(widget *self, int startPos, int nLines) {                            \
        LOCK(auto 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) {                                         \
        LOCK(auto ret = self->word_start(pos));                                                    \
        return ret;                                                                                \
    }                                                                                              \
    int widget##_word_end(const widget *self, int pos) {                                           \
        LOCK(auto ret = self->word_end(pos));                                                      \
        return ret;                                                                                \
    }                                                                                              \
    double widget##_x_to_col(const widget *self, double x) {                                       \
        LOCK(auto ret = self->x_to_col(x));                                                        \
        return ret;                                                                                \
    }                                                                                              \
    double widget##_col_to_x(const widget *self, double col) {                                     \
        LOCK(auto ret = self->col_to_x(col));                                                      \
        return ret;                                                                                \
    }                                                                                              \
    void widget##_set_linenumber_width(widget *self, int width) {                                  \
        LOCK(self->linenumber_width(width));                                                       \
    }                                                                                              \
    int widget##_linenumber_width(const widget *self) {                                            \
        LOCK(auto ret = self->linenumber_width());                                                 \
        return ret;                                                                                \
    }                                                                                              \
    void widget##_set_linenumber_font(widget *self, int val) {                                     \
        LOCK(self->linenumber_font(val));                                                          \
    }                                                                                              \
    int widget##_linenumber_font(const widget *self) {                                             \
        LOCK(auto ret = self->linenumber_font());                                                  \
        return ret;                                                                                \
    }                                                                                              \
    void widget##_set_linenumber_size(widget *self, int val) {                                     \
        LOCK(self->linenumber_size(val));                                                          \
    }                                                                                              \
    int widget##_linenumber_size(const widget *self) {                                             \
        LOCK(auto ret = self->linenumber_size());                                                  \
        return ret;                                                                                \
    }                                                                                              \
    void widget##_set_linenumber_fgcolor(widget *self, unsigned int val) {                         \
        LOCK(self->linenumber_fgcolor(val));                                                       \
    }                                                                                              \
    unsigned int widget##_linenumber_fgcolor(const widget *self) {                                 \
        LOCK(auto ret = self->linenumber_fgcolor());                                               \
        return ret;                                                                                \
    }                                                                                              \
    void widget##_set_linenumber_bgcolor(widget *self, unsigned int val) {                         \
        LOCK(self->linenumber_bgcolor(val));                                                       \
    }                                                                                              \
    unsigned int widget##_linenumber_bgcolor(const widget *self) {                                 \
        LOCK(auto ret = self->linenumber_bgcolor());                                               \
        return ret;                                                                                \
    }                                                                                              \
    void widget##_set_linenumber_align(widget *self, int val) {                                    \
        LOCK(self->linenumber_align(val));                                                         \
    }                                                                                              \
    int widget##_linenumber_align(const widget *self) {                                            \
        LOCK(auto ret = self->linenumber_align());                                                 \
        return ret;                                                                                \
    }                                                                                              \
    int widget##_in_selection(const widget *self, int x, int y) {                                  \
        LOCK(auto ret = self->in_selection(x, y));                                                 \
        return ret;                                                                                \
    }                                                                                              \
    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) {                         \
        LOCK(auto ret = self->wrapped_column(row, column));                                        \
        return ret;                                                                                \
    }                                                                                              \
    int widget##_wrapped_row(const widget *self, int row) {                                        \
        LOCK(auto ret = self->wrapped_row(row));                                                   \
        return ret;                                                                                \
    }                                                                                              \
    void widget##_set_grammar_underline_color(widget *self, unsigned int color) {                  \
        LOCK(self->grammar_underline_color((Fl_Color)color));                                      \
    }                                                                                              \
    unsigned int widget##_grammar_underline_color(const widget *self) {                            \
        LOCK(auto ret = self->grammar_underline_color());                                          \
        return ret;                                                                                \
    }                                                                                              \
    void widget##_set_spelling_underline_color(widget *self, unsigned int color) {                 \
        LOCK(self->spelling_underline_color((Fl_Color)color));                                     \
    }                                                                                              \
    unsigned int widget##_spelling_underline_color(const widget *self) {                           \
        LOCK(auto ret = self->spelling_underline_color());                                         \
        return ret;                                                                                \
    }                                                                                              \
    void widget##_set_secondary_selection_color(widget *self, unsigned int color) {                \
        LOCK(self->secondary_selection_color((Fl_Color)color));                                    \
    }                                                                                              \
    unsigned int widget##_secondary_selection_color(const widget *self) {                          \
        LOCK(auto ret = self->secondary_selection_color());                                        \
        return ret;                                                                                \
    }                                                                                              \
    void widget##_show_insert_position(widget *self) {                                             \
        LOCK(self->show_insert_position());                                                        \
    }                                                                                              \
    void widget##_overstrike(widget *self, const char *text) {                                     \
        LOCK(self->overstrike(text));                                                              \
    }

Fl_Text_Buffer *Fl_Text_Buffer_new(void) {
    LOCK(auto ret = new Fl_Text_Buffer);
    return ret;
}

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

const char *Fl_Text_Buffer_text(Fl_Text_Buffer *self) {
    LOCK(auto ret = self->text());
    return ret;
}

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) {
    LOCK(auto ret = self->length());
    return ret;
}

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

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) {
    (void)cp;
    LOCK(auto ret = self->undo(NULL));
    return ret;
}

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

int Fl_Text_Buffer_load_file(Fl_Text_Buffer *self, const char *file) {
    LOCK(auto ret = self->loadfile(file));
    return ret;
}

int Fl_Text_Buffer_save_file(Fl_Text_Buffer *self, const char *file) {
    LOCK(auto ret = self->savefile(file));
    return ret;
}

int Fl_Text_Buffer_tab_distance(const Fl_Text_Buffer *self) {
    LOCK(auto ret = self->tab_distance());
    return ret;
}

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) {
    LOCK(auto ret = self->selected());
    return ret;
}

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

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

char *Fl_Text_Buffer_selection_text(Fl_Text_Buffer *self) {
    LOCK(auto ret = self->selection_text());
    return ret;
}

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_secondary_select(Fl_Text_Buffer *self, int start, int end) {
    LOCK(self->secondary_select(start, end));
}

int Fl_Text_Buffer_secondary_selected(Fl_Text_Buffer *self) {
    LOCK(auto ret = self->secondary_selected());
    return ret;
}

void Fl_Text_Buffer_secondary_unselect(Fl_Text_Buffer *self) {
    LOCK(self->secondary_unselect());
}

int Fl_Text_Buffer_secondary_selection_position(Fl_Text_Buffer *self, int *start, int *end) {
    LOCK(auto ret = self->secondary_selection_position(start, end));
    return ret;
}

char *Fl_Text_Buffer_secondary_selection_text(Fl_Text_Buffer *self) {
    LOCK(auto ret = self->secondary_selection_text());
    return ret;
}

void Fl_Text_Buffer_remove_secondary_selection(Fl_Text_Buffer *self) {
    LOCK(self->remove_secondary_selection());
}

void Fl_Text_Buffer_replace_secondary_selection(Fl_Text_Buffer *self, const char *text) {
    LOCK(self->replace_secondary_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) {
    LOCK(auto ret = self->highlight());
    return ret;
}

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) {
    LOCK(auto ret = self->highlight_position(start, end));
    return ret;
}

char *Fl_Text_Buffer_highlight_text(Fl_Text_Buffer *self) {
    LOCK(auto ret = self->highlight_text());
    return ret;
}

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

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

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

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

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

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());
}

int Fl_Text_Buffer_search_forward(const Fl_Text_Buffer *self, int start_pos,
                                  const char *search_string, int *found_pos, int match_case) {
    LOCK(int ret = self->search_forward(start_pos, search_string, found_pos, match_case));
    return ret;
}

int Fl_Text_Buffer_search_backward(const Fl_Text_Buffer *self, int start_pos,
                                   const char *search_string, int *found_pos, int match_case) {
    LOCK(int ret = self->search_backward(start_pos, search_string, found_pos, match_case));
    return ret;
}

int Fl_Text_Buffer_findchar_forward(const Fl_Text_Buffer *self, int start_pos,
                                    unsigned int search_char, int *found_pos) {
    LOCK(int ret = self->findchar_forward(start_pos, search_char, found_pos));
    return ret;
}

int Fl_Text_Buffer_findchar_backward(const Fl_Text_Buffer *self, int start_pos,
                                     unsigned int search_char, int *found_pos) {
    LOCK(int ret = self->findchar_backward(start_pos, search_char, found_pos));
    return ret;
}

WIDGET_CLASS(Fl_Text_Display)

WIDGET_DEFINE(Fl_Text_Display)

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

Fl_Text_Buffer *Fl_Text_Display_get_buffer(Fl_Text_Display *self) {
    LOCK(auto ret = self->buffer());
    return ret;
}

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) {
    LOCK(auto ret = self->style_buffer());
    return ret;
}

DISPLAY_DEFINE(Fl_Text_Display)

WIDGET_CLASS(Fl_Text_Editor)

WIDGET_DEFINE(Fl_Text_Editor)

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

Fl_Text_Buffer *Fl_Text_Editor_get_buffer(Fl_Text_Editor *self) {
    LOCK(auto ret = self->buffer());
    return ret;
}

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) {
    LOCK(auto ret = self->style_buffer());
    return ret;
}

DISPLAY_DEFINE(Fl_Text_Editor)

int Fl_Text_Editor_kf_copy(Fl_Text_Editor *e) {

    LOCK(auto ret = Fl_Text_Editor::kf_copy(1, e));
    return ret;
}

int Fl_Text_Editor_kf_cut(Fl_Text_Editor *e) {

    LOCK(auto ret = Fl_Text_Editor::kf_cut(1, e));
    return ret;
}

int Fl_Text_Editor_kf_paste(Fl_Text_Editor *e) {

    LOCK(auto ret = Fl_Text_Editor::kf_paste(1, e));
    return ret;
}

int Fl_Text_Editor_kf_undo(Fl_Text_Editor *e) {

    LOCK(auto ret = Fl_Text_Editor::kf_undo(1, e));
    return ret;
}

int Fl_Text_Editor_kf_default(int c, Fl_Text_Editor *e) {

    LOCK(auto ret = Fl_Text_Editor::kf_default(c, e));
    return ret;
}

int Fl_Text_Editor_kf_ignore(int c, Fl_Text_Editor *e) {

    LOCK(auto ret = Fl_Text_Editor::kf_ignore(c, e));
    return ret;
}

int Fl_Text_Editor_kf_backspace(Fl_Text_Editor *e) {

    LOCK(auto ret = Fl_Text_Editor::kf_backspace(0, e));
    return ret;
}

int Fl_Text_Editor_kf_enter(Fl_Text_Editor *e) {

    LOCK(auto ret = Fl_Text_Editor::kf_enter(0, e));
    return ret;
}

int Fl_Text_Editor_kf_move(int c, Fl_Text_Editor *e) {

    LOCK(auto ret = Fl_Text_Editor::kf_move(c, e));
    return ret;
}

int Fl_Text_Editor_kf_shift_move(int c, Fl_Text_Editor *e) {

    LOCK(auto ret = Fl_Text_Editor::kf_shift_move(c, e));
    return ret;
}

int Fl_Text_Editor_kf_ctrl_move(int c, Fl_Text_Editor *e) {

    LOCK(auto 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) {

    LOCK(auto 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) {

    LOCK(auto 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) {

    LOCK(auto ret = Fl_Text_Editor::kf_m_s_move(c, e));
    return ret;
}

int Fl_Text_Editor_kf_home(Fl_Text_Editor *e) {

    LOCK(auto ret = Fl_Text_Editor::kf_home(0, e));
    return ret;
}

int Fl_Text_Editor_kf_end(Fl_Text_Editor *e) {

    LOCK(auto ret = Fl_Text_Editor::kf_end(0, e));
    return ret;
}

int Fl_Text_Editor_kf_left(Fl_Text_Editor *e) {

    LOCK(auto ret = Fl_Text_Editor::kf_left(0, e));
    return ret;
}

int Fl_Text_Editor_kf_up(Fl_Text_Editor *e) {

    LOCK(auto ret = Fl_Text_Editor::kf_up(0, e));
    return ret;
}

int Fl_Text_Editor_kf_right(Fl_Text_Editor *e) {

    LOCK(auto ret = Fl_Text_Editor::kf_right(0, e));
    return ret;
}

int Fl_Text_Editor_kf_down(Fl_Text_Editor *e) {

    LOCK(auto ret = Fl_Text_Editor::kf_down(0, e));
    return ret;
}

int Fl_Text_Editor_kf_page_up(Fl_Text_Editor *e) {

    LOCK(auto ret = Fl_Text_Editor::kf_page_up(0, e));
    return ret;
}

int Fl_Text_Editor_kf_page_down(Fl_Text_Editor *e) {

    LOCK(auto ret = Fl_Text_Editor::kf_page_down(0, e));
    return ret;
}

int Fl_Text_Editor_kf_insert(Fl_Text_Editor *e) {

    LOCK(auto ret = Fl_Text_Editor::kf_insert(0, e));
    return ret;
}

int Fl_Text_Editor_kf_delete(Fl_Text_Editor *e) {

    LOCK(auto ret = Fl_Text_Editor::kf_delete(0, e));
    return ret;
}

int Fl_Text_Editor_kf_select_all(Fl_Text_Editor *e) {

    LOCK(auto 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) {

    LOCK(auto 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) {
    LOCK(auto ret = self->tab_nav());
    return ret;
}

void Fl_Text_Editor_add_key_binding(Fl_Text_Editor *self, int key, int state,
                                    int (*kf)(int, Fl_Text_Editor *)) {
    LOCK(self->add_key_binding(key, state, kf));
}

void Fl_Text_Editor_remove_key_binding(Fl_Text_Editor *self, int key, int state) {
    LOCK(self->remove_key_binding(key, state));
}

WIDGET_CLASS(Fl_Simple_Terminal)

WIDGET_DEFINE(Fl_Simple_Terminal)

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

Fl_Text_Buffer *Fl_Simple_Terminal_get_buffer(Fl_Simple_Terminal *self) {
    LOCK(auto ret = self->buffer());
    return ret;
}

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) {
    LOCK(auto ret = self->style_buffer());
    return ret;
}

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) {
    LOCK(auto ret = self->stay_at_bottom());
    return ret;
}

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) {
    LOCK(auto ret = self->history_lines());
    return ret;
}

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) {
    LOCK(auto ret = self->ansi());
    return ret;
}

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

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

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) {
    LOCK(auto ret = self->text());
    return ret;
}

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;
}