summaryrefslogtreecommitdiff
path: root/src/fltk-widgets-groups-text_displays.adb
blob: 4548708609cb4577bc6bb5086164610c842228e1 (plain)
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
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926


with

    Interfaces.C,
    System,
    FLTK.Text_Buffers;

use type

    Interfaces.C.int,
    System.Address;


package body FLTK.Widgets.Groups.Text_Displays is


    procedure text_display_set_draw_hook
           (W, D : in System.Address);
    pragma Import (C, text_display_set_draw_hook, "text_display_set_draw_hook");

    procedure text_display_set_handle_hook
           (W, H : in System.Address);
    pragma Import (C, text_display_set_handle_hook, "text_display_set_handle_hook");




    function new_fl_text_display
           (X, Y, W, H : in Interfaces.C.int;
            Label      : in Interfaces.C.char_array)
        return System.Address;
    pragma Import (C, new_fl_text_display, "new_fl_text_display");

    procedure free_fl_text_display
           (TD : in System.Address);
    pragma Import (C, free_fl_text_display, "free_fl_text_display");




    function fl_text_display_get_buffer
           (TD : in System.Address)
        return System.Address;
    pragma Import (C, fl_text_display_get_buffer, "fl_text_display_get_buffer");

    procedure fl_text_display_set_buffer
           (TD, TB : in System.Address);
    pragma Import (C, fl_text_display_set_buffer, "fl_text_display_set_buffer");




    function fl_text_display_col_to_x
           (TD : in System.Address;
            C  : in Interfaces.C.double)
        return Interfaces.C.double;
    pragma Import (C, fl_text_display_col_to_x, "fl_text_display_col_to_x");

    function fl_text_display_x_to_col
           (TD : in System.Address;
            X  : in Interfaces.C.double)
        return Interfaces.C.double;
    pragma Import (C, fl_text_display_x_to_col, "fl_text_display_x_to_col");

    function fl_text_display_in_selection
           (TD   : in System.Address;
            X, Y : in Interfaces.C.int)
        return Interfaces.C.int;
    pragma Import (C, fl_text_display_in_selection, "fl_text_display_in_selection");

    function fl_text_display_position_to_xy
           (TD   : in     System.Address;
            P    : in     Interfaces.C.int;
            X, Y :    out Interfaces.C.int)
        return Interfaces.C.int;
    pragma Import (C, fl_text_display_position_to_xy, "fl_text_display_position_to_xy");




    function fl_text_display_get_cursor_color
           (TD : in System.Address)
        return Interfaces.C.unsigned;
    pragma Import (C, fl_text_display_get_cursor_color, "fl_text_display_get_cursor_color");

    procedure fl_text_display_set_cursor_color
           (TD : in System.Address;
            C  : in Interfaces.C.unsigned);
    pragma Import (C, fl_text_display_set_cursor_color, "fl_text_display_set_cursor_color");

    procedure fl_text_display_set_cursor_style
           (TD : in System.Address;
            S  : in Interfaces.C.int);
    pragma Import (C, fl_text_display_set_cursor_style, "fl_text_display_set_cursor_style");

    procedure fl_text_display_hide_cursor
           (TD : in System.Address);
    pragma Import (C, fl_text_display_hide_cursor, "fl_text_display_hide_cursor");

    procedure fl_text_display_show_cursor
           (TD : in System.Address);
    pragma Import (C, fl_text_display_show_cursor, "fl_text_display_show_cursor");




    function fl_text_display_get_text_color
           (TD : in System.Address)
        return Interfaces.C.unsigned;
    pragma Import (C, fl_text_display_get_text_color, "fl_text_display_get_text_color");

    procedure fl_text_display_set_text_color
           (TD : in System.Address;
            C  : in Interfaces.C.unsigned);
    pragma Import (C, fl_text_display_set_text_color, "fl_text_display_set_text_color");

    function fl_text_display_get_text_font
           (TD : in System.Address)
        return Interfaces.C.int;
    pragma Import (C, fl_text_display_get_text_font, "fl_text_display_get_text_font");

    procedure fl_text_display_set_text_font
           (TD : in System.Address;
            F  : in Interfaces.C.int);
    pragma Import (C, fl_text_display_set_text_font, "fl_text_display_set_text_font");

    function fl_text_display_get_text_size
           (TD : in System.Address)
        return Interfaces.C.int;
    pragma Import (C, fl_text_display_get_text_size, "fl_text_display_get_text_size");

    procedure fl_text_display_set_text_size
           (TD : in System.Address;
            S  : in Interfaces.C.int);
    pragma Import (C, fl_text_display_set_text_size, "fl_text_display_set_text_size");




    procedure fl_text_display_insert
           (TD : in System.Address;
            I  : in Interfaces.C.char_array);
    pragma Import (C, fl_text_display_insert, "fl_text_display_insert");

    function fl_text_display_get_insert_pos
           (TD : in System.Address)
        return Interfaces.C.int;
    pragma Import (C, fl_text_display_get_insert_pos, "fl_text_display_get_insert_pos");

    procedure fl_text_display_set_insert_pos
           (TD : in System.Address;
            P  : in Interfaces.C.int);
    pragma Import (C, fl_text_display_set_insert_pos, "fl_text_display_set_insert_pos");

    procedure fl_text_display_show_insert_pos
           (TD : in System.Address);
    pragma Import (C, fl_text_display_show_insert_pos, "fl_text_display_show_insert_pos");




    function fl_text_display_word_start
           (TD : in System.Address;
            P  : in Interfaces.C.int)
        return Interfaces.C.int;
    pragma Import (C, fl_text_display_word_start, "fl_text_display_word_start");

    function fl_text_display_word_end
           (TD : in System.Address;
            P  : in Interfaces.C.int)
        return Interfaces.C.int;
    pragma Import (C, fl_text_display_word_end, "fl_text_display_word_end");

    procedure fl_text_display_next_word
           (TD : in System.Address);
    pragma Import (C, fl_text_display_next_word, "fl_text_display_next_word");

    procedure fl_text_display_previous_word
           (TD : in System.Address);
    pragma Import (C, fl_text_display_previous_word, "fl_text_display_previous_word");

    procedure fl_text_display_wrap_mode
           (TD    : in System.Address;
            W, M  : in Interfaces.C.int);
    pragma Import (C, fl_text_display_wrap_mode, "fl_text_display_wrap_mode");




    function fl_text_display_line_start
           (TD : in System.Address;
            S  : in Interfaces.C.int)
        return Interfaces.C.int;
    pragma Import (C, fl_text_display_line_start, "fl_text_display_line_start");

    function fl_text_display_line_end
           (TD   : in System.Address;
            S, P : in Interfaces.C.int)
        return Interfaces.C.int;
    pragma Import (C, fl_text_display_line_end, "fl_text_display_line_end");

    function fl_text_display_count_lines
           (TD      : in System.Address;
            S, F, P : in Interfaces.C.int)
        return Interfaces.C.int;
    pragma Import (C, fl_text_display_count_lines, "fl_text_display_count_lines");

    function fl_text_display_skip_lines
           (TD      : in System.Address;
            S, L, P : in Interfaces.C.int)
        return Interfaces.C.int;
    pragma Import (C, fl_text_display_skip_lines, "fl_text_display_skip_lines");

    function fl_text_display_rewind_lines
           (TD   : in System.Address;
            S, L : in Interfaces.C.int)
        return Interfaces.C.int;
    pragma Import (C, fl_text_display_rewind_lines, "fl_text_display_rewind_lines");




    function fl_text_display_get_linenumber_align
           (TD : in System.Address)
        return Interfaces.C.unsigned;
    pragma Import (C, fl_text_display_get_linenumber_align,
        "fl_text_display_get_linenumber_align");

    procedure fl_text_display_set_linenumber_align
           (TD : in System.Address;
            A  : in Interfaces.C.unsigned);
    pragma Import (C, fl_text_display_set_linenumber_align,
        "fl_text_display_set_linenumber_align");

    function fl_text_display_get_linenumber_bgcolor
           (TD : in System.Address)
        return Interfaces.C.unsigned;
    pragma Import (C, fl_text_display_get_linenumber_bgcolor,
        "fl_text_display_get_linenumber_bgcolor");

    procedure fl_text_display_set_linenumber_bgcolor
           (TD : in System.Address;
            C  : in Interfaces.C.unsigned);
    pragma Import (C, fl_text_display_set_linenumber_bgcolor,
        "fl_text_display_set_linenumber_bgcolor");

    function fl_text_display_get_linenumber_fgcolor
           (TD : in System.Address)
        return Interfaces.C.unsigned;
    pragma Import (C, fl_text_display_get_linenumber_fgcolor,
        "fl_text_display_get_linenumber_fgcolor");

    procedure fl_text_display_set_linenumber_fgcolor
           (TD : in System.Address;
            C  : in Interfaces.C.unsigned);
    pragma Import (C, fl_text_display_set_linenumber_fgcolor,
        "fl_text_display_set_linenumber_fgcolor");

    function fl_text_display_get_linenumber_font
           (TD : in System.Address)
        return Interfaces.C.int;
    pragma Import (C, fl_text_display_get_linenumber_font,
        "fl_text_display_get_linenumber_font");

    procedure fl_text_display_set_linenumber_font
           (TD : in System.Address;
            F  : in Interfaces.C.int);
    pragma Import (C, fl_text_display_set_linenumber_font,
        "fl_text_display_set_linenumber_font");

    function fl_text_display_get_linenumber_size
           (TD : in System.Address)
        return Interfaces.C.int;
    pragma Import (C, fl_text_display_get_linenumber_size,
        "fl_text_display_get_linenumber_size");

    procedure fl_text_display_set_linenumber_size
           (TD : in System.Address;
            S  : in Interfaces.C.int);
    pragma Import (C, fl_text_display_set_linenumber_size,
        "fl_text_display_set_linenumber_size");

    function fl_text_display_get_linenumber_width
           (TD : in System.Address)
        return Interfaces.C.int;
    pragma Import (C, fl_text_display_get_linenumber_width,
        "fl_text_display_get_linenumber_width");

    procedure fl_text_display_set_linenumber_width
           (TD : in System.Address;
            W  : in Interfaces.C.int);
    pragma Import (C, fl_text_display_set_linenumber_width,
        "fl_text_display_set_linenumber_width");




    function fl_text_display_move_down
           (TD : in System.Address)
        return Interfaces.C.int;
    pragma Import (C, fl_text_display_move_down, "fl_text_display_move_down");

    function fl_text_display_move_left
           (TD : in System.Address)
        return Interfaces.C.int;
    pragma Import (C, fl_text_display_move_left, "fl_text_display_move_left");

    function fl_text_display_move_right
           (TD : in System.Address)
        return Interfaces.C.int;
    pragma Import (C, fl_text_display_move_right, "fl_text_display_move_right");

    function fl_text_display_move_up
           (TD : in System.Address)
        return Interfaces.C.int;
    pragma Import (C, fl_text_display_move_up, "fl_text_display_move_up");




    procedure fl_text_display_scroll
           (TD : in System.Address;
            L  : in Interfaces.C.int);
    pragma Import (C, fl_text_display_scroll, "fl_text_display_scroll");

    function fl_text_display_get_scrollbar_align
           (TD : in System.Address)
        return Interfaces.C.unsigned;
    pragma Import (C, fl_text_display_get_scrollbar_align, "fl_text_display_get_scrollbar_align");

    procedure fl_text_display_set_scrollbar_align
           (TD : in System.Address;
            A  : in Interfaces.C.unsigned);
    pragma Import (C, fl_text_display_set_scrollbar_align, "fl_text_display_set_scrollbar_align");

    function fl_text_display_get_scrollbar_width
           (TD : in System.Address)
        return Interfaces.C.int;
    pragma Import (C, fl_text_display_get_scrollbar_width, "fl_text_display_get_scrollbar_width");

    procedure fl_text_display_set_scrollbar_width
           (TD : in System.Address;
            W  : in Interfaces.C.int);
    pragma Import (C, fl_text_display_set_scrollbar_width, "fl_text_display_set_scrollbar_width");




    procedure fl_text_display_draw
           (W : in System.Address);
    pragma Import (C, fl_text_display_draw, "fl_text_display_draw");

    function fl_text_display_handle
           (W : in System.Address;
            E : in Interfaces.C.int)
        return Interfaces.C.int;
    pragma Import (C, fl_text_display_handle, "fl_text_display_handle");




    procedure Finalize
           (This : in out Text_Display) is
    begin
        if  This.Void_Ptr /= System.Null_Address and then
            This in Text_Display'Class
        then
            This.Clear;
            free_fl_text_display (This.Void_Ptr);
            This.Void_Ptr := System.Null_Address;
        end if;
        Finalize (Group (This));
    end Finalize;




    package body Forge is

        function Create
               (X, Y, W, H : in Integer;
                Text       : in String)
            return Text_Display is
        begin
            return This : Text_Display do
                This.Void_Ptr := new_fl_text_display
                       (Interfaces.C.int (X),
                        Interfaces.C.int (Y),
                        Interfaces.C.int (W),
                        Interfaces.C.int (H),
                        Interfaces.C.To_C (Text));
                fl_group_end (This.Void_Ptr);
                fl_widget_set_user_data
                       (This.Void_Ptr,
                        Widget_Convert.To_Address (This'Unchecked_Access));
                text_display_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
                text_display_set_handle_hook (This.Void_Ptr, Handle_Hook'Address);
            end return;
        end Create;

    end Forge;




    function Get_Buffer
           (This : in Text_Display)
        return FLTK.Text_Buffers.Text_Buffer_Cursor is
    begin
        return Ref : FLTK.Text_Buffers.Text_Buffer_Cursor (This.Buffer);
    end Get_Buffer;


    procedure Set_Buffer
           (This : in out Text_Display;
            Buff : in out FLTK.Text_Buffers.Text_Buffer) is
    begin
        This.Buffer := Buff'Unchecked_Access;
        fl_text_display_set_buffer (This.Void_Ptr, Wrapper (Buff).Void_Ptr);
    end Set_Buffer;




    function Col_To_X
           (This    : in Text_Display;
            Col_Num : in Integer)
        return Integer is
    begin
        return Integer (Interfaces.C.double'Rounding
               (fl_text_display_col_to_x (This.Void_Ptr, Interfaces.C.double (Col_Num))));
    end Col_To_X;


    function X_To_Col
           (This  : in Text_Display;
            X_Pos : in Integer)
        return Integer is
    begin
        return Integer (Interfaces.C.double'Rounding
               (fl_text_display_x_to_col (This.Void_Ptr, Interfaces.C.double (X_Pos))));
    end X_To_Col;


    function In_Selection
           (This : in Text_Display;
            X, Y : in Integer)
        return Boolean is
    begin
        return fl_text_display_in_selection
               (This.Void_Ptr, Interfaces.C.int (X), Interfaces.C.int (Y)) /= 0;
    end In_Selection;


    procedure Position_To_XY
           (This     : in     Text_Display;
            Pos      : in     Integer;
            X, Y     :    out Integer;
            Vert_Out :    out Boolean)
    is
        Raw_X, Raw_Y : Interfaces.C.int;
    begin
        Vert_Out := fl_text_display_position_to_xy
               (This.Void_Ptr,
                Interfaces.C.int (Pos),
                Raw_X, Raw_Y) /= 0;
        X := Integer (Raw_X);
        Y := Integer (Raw_Y);
    end Position_To_XY;




    function Get_Cursor_Color
           (This : in Text_Display)
        return Color is
    begin
        return Color (fl_text_display_get_cursor_color (This.Void_Ptr));
    end Get_Cursor_Color;


    procedure Set_Cursor_Color
           (This : in out Text_Display;
            Col  : in     Color) is
    begin
        fl_text_display_set_cursor_color (This.Void_Ptr, Interfaces.C.unsigned (Col));
    end Set_Cursor_Color;


    procedure Set_Cursor_Style
           (This  : in out Text_Display;
            Style : in     Cursor_Style) is
    begin
        fl_text_display_set_cursor_style (This.Void_Ptr, Cursor_Style'Pos (Style));
    end Set_Cursor_Style;


    procedure Hide_Cursor
           (This : in out Text_Display) is
    begin
        fl_text_display_hide_cursor (This.Void_Ptr);
    end Hide_Cursor;


    procedure Show_Cursor
           (This : in out Text_Display) is
    begin
        fl_text_display_show_cursor (This.Void_Ptr);
    end Show_Cursor;




    function Get_Text_Color
           (This : in Text_Display)
        return Color is
    begin
        return Color (fl_text_display_get_text_color (This.Void_Ptr));
    end Get_Text_Color;


    procedure Set_Text_Color
           (This : in out Text_Display;
            Col  : in     Color) is
    begin
        fl_text_display_set_text_color (This.Void_Ptr, Interfaces.C.unsigned (Col));
    end Set_Text_Color;


    function Get_Text_Font
           (This : in Text_Display)
        return Font_Kind is
    begin
        return Font_Kind'Val (fl_text_display_get_text_font (This.Void_Ptr));
    end Get_Text_Font;


    procedure Set_Text_Font
           (This : in out Text_Display;
            Font : in     Font_Kind) is
    begin
        fl_text_display_set_text_font (This.Void_Ptr, Font_Kind'Pos (Font));
    end Set_Text_Font;


    function Get_Text_Size
           (This : in Text_Display)
        return Font_Size is
    begin
        return Font_Size (fl_text_display_get_text_size (This.Void_Ptr));
    end Get_Text_Size;


    procedure Set_Text_Size
           (This : in out Text_Display;
            Size : in     Font_Size) is
    begin
        fl_text_display_set_text_size (This.Void_Ptr, Interfaces.C.int (Size));
    end Set_Text_Size;




    procedure Insert_Text
           (This : in out Text_Display;
            Item : in     String) is
    begin
        fl_text_display_insert (This.Void_Ptr, Interfaces.C.To_C (Item));
    end Insert_Text;


    function Get_Insert_Position
           (This : in Text_Display)
        return Natural is
    begin
        return Natural (fl_text_display_get_insert_pos (This.Void_Ptr));
    end Get_Insert_Position;


    procedure Set_Insert_Position
           (This : in out Text_Display;
            Pos  : in     Natural) is
    begin
        fl_text_display_set_insert_pos (This.Void_Ptr, Interfaces.C.int (Pos));
    end Set_Insert_Position;


    procedure Show_Insert_Position
           (This : in out Text_Display) is
    begin
        fl_text_display_show_insert_pos (This.Void_Ptr);
    end Show_Insert_Position;




    function Word_Start
           (This : in out Text_Display;
            Pos  : in     Natural)
        return Natural is
    begin
        return Natural (fl_text_display_word_start
               (This.Void_Ptr,
                Interfaces.C.int (Pos)));
    end Word_Start;


    function Word_End
           (This : in out Text_Display;
            Pos  : in     Natural)
        return Natural is
    begin
        return Natural (fl_text_display_word_end
               (This.Void_Ptr,
                Interfaces.C.int (Pos)));
    end Word_End;


    procedure Next_Word
           (This : in out Text_Display) is
    begin
        fl_text_display_next_word (This.Void_Ptr);
    end Next_Word;


    procedure Previous_Word
           (This : in out Text_Display) is
    begin
        fl_text_display_previous_word (This.Void_Ptr);
    end Previous_Word;


    procedure Set_Wrap_Mode
           (This   : in out Text_Display;
            Mode   : in     Wrap_Mode;
            Margin : in     Natural := 0) is
    begin
        fl_text_display_wrap_mode
               (This.Void_Ptr,
                Wrap_Mode'Pos (Mode),
                Interfaces.C.int (Margin));
    end Set_Wrap_Mode;




    function Line_Start
           (This : in Text_Display;
            Pos  : in Natural)
        return Natural is
    begin
        return Natural (fl_text_display_line_start
               (This.Void_Ptr,
                Interfaces.C.int (Pos)));
    end Line_Start;


    function Line_End
           (This                    : in Text_Display;
            Pos                     : in Natural;
            Start_Pos_Is_Line_Start : in Boolean := False)
        return Natural is
    begin
        return Natural (fl_text_display_line_end
               (This.Void_Ptr,
                Interfaces.C.int (Pos),
                Boolean'Pos (Start_Pos_Is_Line_Start)));
    end Line_End;


    function Count_Lines
           (This                    : in Text_Display;
            Start, Finish           : in Natural;
            Start_Pos_Is_Line_Start : in Boolean := False)
        return Natural is
    begin
        return Natural (fl_text_display_count_lines
               (This.Void_Ptr,
                Interfaces.C.int (Start),
                Interfaces.C.int (Finish),
                Boolean'Pos (Start_Pos_Is_Line_Start)));
    end Count_Lines;


    function Skip_Lines
           (This                    : in Text_Display;
            Start, Lines            : in Natural;
            Start_Pos_Is_Line_Start : in Boolean := False)
        return Natural is
    begin
        return Natural (fl_text_display_skip_lines
               (This.Void_Ptr,
                Interfaces.C.int (Start),
                Interfaces.C.int (Lines),
                Boolean'Pos (Start_Pos_Is_Line_Start)));
    end Skip_Lines;


    function Rewind_Lines
           (This         : in Text_Display;
            Start, Lines : in Natural)
        return Natural is
    begin
        return Natural (fl_text_display_rewind_lines
               (This.Void_Ptr,
                Interfaces.C.int (Start),
                Interfaces.C.int (Lines)));
    end Rewind_Lines;




    function Get_Linenumber_Alignment
           (This : in Text_Display)
        return Alignment is
    begin
        return Alignment (fl_text_display_get_linenumber_align (This.Void_Ptr));
    end Get_Linenumber_Alignment;


    procedure Set_Linenumber_Alignment
           (This : in out Text_Display;
            To   : in     Alignment) is
    begin
        fl_text_display_set_linenumber_align
               (This.Void_Ptr,
                Interfaces.C.unsigned (To));
    end Set_Linenumber_Alignment;


    function Get_Linenumber_Back_Color
           (This : in Text_Display)
        return Color is
    begin
        return Color (fl_text_display_get_linenumber_bgcolor (This.Void_Ptr));
    end Get_Linenumber_Back_Color;


    procedure Set_Linenumber_Back_Color
           (This : in out Text_Display;
            To   : in     Color) is
    begin
        fl_text_display_set_linenumber_bgcolor
               (This.Void_Ptr,
                Interfaces.C.unsigned (To));
    end Set_Linenumber_Back_Color;


    function Get_Linenumber_Fore_Color
           (This : in Text_Display)
        return Color is
    begin
        return Color (fl_text_display_get_linenumber_fgcolor (This.Void_Ptr));
    end Get_Linenumber_Fore_Color;


    procedure Set_Linenumber_Fore_Color
           (This : in out Text_Display;
            To   : in     Color) is
    begin
        fl_text_display_set_linenumber_fgcolor
               (This.Void_Ptr,
                Interfaces.C.unsigned (To));
    end Set_Linenumber_Fore_Color;


    function Get_Linenumber_Font
           (This : in Text_Display)
        return Font_Kind is
    begin
        return Font_Kind'Val (fl_text_display_get_linenumber_font (This.Void_Ptr));
    end Get_Linenumber_Font;


    procedure Set_Linenumber_Font
           (This : in out Text_Display;
            To   : in     Font_Kind) is
    begin
        fl_text_display_set_linenumber_font
               (This.Void_Ptr,
                Font_Kind'Pos (To));
    end Set_Linenumber_Font;


    function Get_Linenumber_Size
           (This : in Text_Display)
        return Font_Size is
    begin
        return Font_Size (fl_text_display_get_linenumber_size (This.Void_Ptr));
    end Get_Linenumber_Size;


    procedure Set_Linenumber_Size
           (This : in out Text_Display;
            To   : in     Font_Size) is
    begin
        fl_text_display_set_linenumber_size
               (This.Void_Ptr,
                Interfaces.C.int (To));
    end Set_Linenumber_Size;


    function Get_Linenumber_Width
           (This : in Text_Display)
        return Natural is
    begin
        return Natural (fl_text_display_get_linenumber_width (This.Void_Ptr));
    end Get_Linenumber_Width;


    procedure Set_Linenumber_Width
           (This  : in out Text_Display;
            Width : in     Natural) is
    begin
        fl_text_display_set_linenumber_width
               (This.Void_Ptr,
                Interfaces.C.int (Width));
    end Set_Linenumber_Width;




    procedure Move_Down
           (This : in out Text_Display) is
    begin
        if fl_text_display_move_down (This.Void_Ptr) = 0 then
            raise Bounds_Error;
        end if;
    end Move_Down;


    procedure Move_Left
           (This : in out Text_Display) is
    begin
        if fl_text_display_move_left (This.Void_Ptr) = 0 then
            raise Bounds_Error;
        end if;
    end Move_Left;


    procedure Move_Right
           (This : in out Text_Display) is
    begin
        if fl_text_display_move_right (This.Void_Ptr) = 0 then
            raise Bounds_Error;
        end if;
    end Move_Right;


    procedure Move_Up
           (This : in out Text_Display) is
    begin
        if fl_text_display_move_up (This.Void_Ptr) = 0 then
            raise Bounds_Error;
        end if;
    end Move_Up;




    procedure Scroll_To
           (This : in out Text_Display;
            Line : in     Natural) is
    begin
        fl_text_display_scroll (This.Void_Ptr, Interfaces.C.int (Line));
    end Scroll_To;


    function Get_Scrollbar_Alignment
           (This : in Text_Display)
        return Alignment is
    begin
        return Alignment (fl_text_display_get_scrollbar_align (This.Void_Ptr));
    end Get_Scrollbar_Alignment;


    procedure Set_Scrollbar_Alignment
           (This  : in out Text_Display;
            Align : in     Alignment) is
    begin
        fl_text_display_set_scrollbar_align
               (This.Void_Ptr,
                Interfaces.C.unsigned (Align));
    end Set_Scrollbar_Alignment;


    function Get_Scrollbar_Width
           (This : in Text_Display)
        return Natural is
    begin
        return Natural (fl_text_display_get_scrollbar_width (This.Void_Ptr));
    end Get_Scrollbar_Width;


    procedure Set_Scrollbar_Width
           (This  : in out Text_Display;
            Width : in     Natural) is
    begin
        fl_text_display_set_scrollbar_width
               (This.Void_Ptr,
                Interfaces.C.int (Width));
    end Set_Scrollbar_Width;




    procedure Draw
           (This : in out Text_Display) is
    begin
        fl_text_display_draw (This.Void_Ptr);
    end Draw;


    function Handle
           (This  : in out Text_Display;
            Event : in     Event_Kind)
        return Event_Outcome is
    begin
        return Event_Outcome'Val
               (fl_text_display_handle (This.Void_Ptr, Event_Kind'Pos (Event)));
    end Handle;


end FLTK.Widgets.Groups.Text_Displays;