File: gtk-extra-sheet.ads

package info (click to toggle)
libgtkada2 2.8.1-6lenny3
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 13,496 kB
  • ctags: 3,886
  • sloc: ada: 103,189; ansic: 45,411; perl: 5,500; sh: 2,812; makefile: 1,169; xml: 19
file content (967 lines) | stat: -rw-r--r-- 35,628 bytes parent folder | download | duplicates (2)
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
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
-----------------------------------------------------------------------
--               GtkAda - Ada95 binding for Gtk+/Gnome               --
--                                                                   --
--      Copyright (C) 2000 E. Briot, J. Brobecker and A. Charlet     --
--                Copyright (C) 2000-2006 AdaCore                    --
--                                                                   --
-- This library is free software; you can redistribute it and/or     --
-- modify it under the terms of the GNU General Public               --
-- License as published by the Free Software Foundation; either      --
-- version 2 of the License, or (at your option) any later version.  --
--                                                                   --
-- This library is distributed in the hope that it will be useful,   --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of    --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU --
-- General Public License for more details.                          --
--                                                                   --
-- You should have received a copy of the GNU General Public         --
-- License along with this library; if not, write to the             --
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      --
-- Boston, MA 02111-1307, USA.                                       --
--                                                                   --
-----------------------------------------------------------------------

--  <description>
--  A Gtk_Sheet is a table like the one you can find in most spreadsheets.
--  Each cell can contain some text or any kind of widgets.
--  </description>
--  <c_version>gtkextra 2.1.1</c_version>
--  <group>GtkExtra, additional widgets</group>
--  <testgtk>create_sheet.adb</testgtk>
--  <screenshot>gtk-sheet</screenshot>

with Gtk.Adjustment;  use Gtk.Adjustment;
with Gtk.Container;
with Gtk.Enums;       use Gtk.Enums;
with Gtk.GEntry;
with Gdk.Rectangle;
with Gdk.Color;
with Gdk.GC;
with Pango.Font;
with Gtk.Widget;

package Gtk.Extra.Sheet is

   type Gtk_Sheet_Record is new Gtk.Container.Gtk_Container_Record
     with private;
   type Gtk_Sheet is access all Gtk_Sheet_Record'Class;

   type Gtk_Sheet_Range_Record is record
      Row0, Col0 : Gint;  --  Upper-left cell
      Rowi, Coli : Gint;  --  Lower-Right cell
   end record;

   type Gtk_Sheet_Range is access all Gtk_Sheet_Range_Record;
   --  A range in the sheet.
   --  This is a part of the sheet represented by its upper-left cell and
   --  its lower-right cell.
   --  Most operations below apply to such ranges.

   type Gtk_Sheet_Child_Record is
     new Gtk.Widget.Gtk_Widget_Record with private;
   type Gtk_Sheet_Child is access all Gtk_Sheet_Child_Record'Class;
   --  A widget insert in the sheet.
   --  This structure includes both a widget pointer and the position in the
   --  table in which it is put.

   ----------------
   -- Enum types --
   ----------------

   --  <doc_ignore>
   type Sheet_Attr_Type is
     (Sheet_Foreground,
      Sheet_Background,
      Sheet_Font,
      Sheet_Justification,
      Sheet_Border,
      Sheet_Border_Color,
      Sheet_Is_Editable,
      Sheet_Is_Visible);
   --  Attributes that can be set for the sheet.
   --  No function is provided at the Ada level to modify these attributes
   --  directly.
   pragma Convention (C, Sheet_Attr_Type);
   --  </doc_ignore>

   type Sheet_State is
     (Sheet_Normal,
      Sheet_Row_Selected,
      Sheet_Column_Selected,
      Sheet_Range_Selected);
   --  The state of the selection.
   pragma Convention (C, Sheet_State);

   type Gtk_Sheet_Border is new Integer;
   --  Mask that indicates which borders should be visible in a cell.

   No_Border     : constant Gtk_Sheet_Border;
   Left_Border   : constant Gtk_Sheet_Border;
   Right_Border  : constant Gtk_Sheet_Border;
   Top_Border    : constant Gtk_Sheet_Border;
   Bottom_Border : constant Gtk_Sheet_Border;
   All_Borders   : constant Gtk_Sheet_Border;

   -------------------------------
   -- Creation and modification --
   -------------------------------

   procedure Gtk_New
     (Sheet      : out Gtk_Sheet;
      Rows       : Guint;
      Columns    : Guint;
      Title      : UTF8_String := "";
      Entry_Type : Gtk_Type := GType_Invalid);
   --  Create a new sheet with a specific number of rows and columns.
   --  You can fully specify which type the entry used to modify the value of
   --  cells should have. The value of Entry_Type can be found by using one
   --  of the Get_Type subprograms in the GtkAda packages.
   --  The Title is internal, and does not appear on the screen.

   procedure Initialize
     (Sheet      : access Gtk_Sheet_Record'Class;
      Rows       : Guint;
      Columns    : Guint;
      Title      : UTF8_String := "";
      Entry_Type : Gtk_Type := GType_Invalid);
   --  Internal initialization function.
   --  See the section "Creating your own widgets" in the documentation.

   procedure Gtk_New_Browser
     (Sheet   : out Gtk_Sheet;
      Rows    : Guint;
      Columns : Guint;
      Title   : UTF8_String := "");
   --  Create a new sheet browser with a specific number of rows and columns.
   --  This is a standard Gtk_Sheet, except that it is read-only and that its
   --  cells will automatically resize themselves depending on their contents.

   procedure Initialize_Browser (Sheet   : access Gtk_Sheet_Record'Class;
                                 Rows    : in Guint;
                                 Columns : in Guint;
                                 Title   : in UTF8_String := "");
   --  Internal initialization function.
   --  See the section "Creating your own widgets" in the documentation.

   function Get_Type return Gtk.Gtk_Type;
   --  Return the internal value associated with a Gtk_Sheet.

   procedure Set_Hadjustment
     (Sheet      : access Gtk_Sheet_Record;
      Adjustment : access Gtk_Adjustment_Record'Class);
   --  Change the horizontal adjustment.
   --  It indicates what range of columns is visible.

   procedure Set_Vadjustment
      (Sheet      : access Gtk_Sheet_Record;
       Adjustment : access Gtk_Adjustment_Record'Class);
   --  Change the vertical adjustment.
   --  It indicates what range of rows is visible.

   function Get_Vadjustment
     (Sheet  : access Gtk_Sheet_Record)
      return      Gtk.Adjustment.Gtk_Adjustment;
   --  Return the adjustment used to indicate the range of visible rows.

   function Get_Hadjustment
     (Sheet  : access Gtk_Sheet_Record)
      return      Gtk.Adjustment.Gtk_Adjustment;
   --  Return the adjustment used to indicate the range of visible columns.

   procedure Change_Entry
     (Sheet      : access Gtk_Sheet_Record;
      Entry_Type : Gtk_Type);
   --  Change the type of widget used to interactively modify the value of
   --  the cells.

   function Get_Entry
     (Sheet : access Gtk_Sheet_Record) return Gtk.GEntry.Gtk_Entry;
   --  Return the entry used to modify the content of the cells.
   --  This can be the same widget as Get_Entry_Widget, if set, or some default
   --  widget associated with the specific child otherwise

   function Get_Entry_Widget
     (Sheet : access Gtk_Sheet_Record) return Gtk.Widget.Gtk_Widget;
   --  Return the entry used to modify the content of the cells.

   procedure Set_Title
     (Sheet : access Gtk_Sheet_Record;
      Title : UTF8_String);
   --  Change the title of the sheet.

   procedure Freeze (Sheet : access Gtk_Sheet_Record);
   --  Freeze all visual updates of the sheet, until you thaw it.
   --  The update will occur in a more efficient way.

   procedure Thaw (Sheet : access Gtk_Sheet_Record);
   --  Thaw the sheet, so that visual updates occur again.
   --  Note that you have to call Thaw as many times as you have called
   --  Freeze to actually thaw the widget.

   procedure Moveto
     (Sheet     : access Gtk_Sheet_Record;
      Row       : Gint;
      Column    : Gint;
      Row_Align : Gfloat;
      Col_Align : Gfloat);
   --  Scroll the viewing area to (Row, Column).
   --  (Row_Align, Col_Align) represent the location on the screen that the
   --  cell should appear at. (0.0, 0.0) is at the top-left of the screen,
   --  whereas (1.0, 1.0) is at the bottom-right corner.
   --  If Row or Column is negative, there is no change.

   procedure Set_Background
     (Sheet : access Gtk_Sheet_Record; Color : Gdk.Color.Gdk_Color);
   --  Change the background color of the cells.

   procedure Set_Grid
     (Sheet : access Gtk_Sheet_Record; Color : Gdk.Color.Gdk_Color);
   --  Set the color to use for the grid.

   procedure Show_Grid
     (Sheet : access Gtk_Sheet_Record; Show : Boolean);
   --  Whether the grid should be made visible

   function Grid_Visible (Sheet : access Gtk_Sheet_Record) return Boolean;
   --  Whether the grid is currently visible

   ----------------------------
   -- Selection and Clipping --
   ----------------------------

   function Get_State (Sheet : access Gtk_Sheet_Record) return Sheet_State;
   --  Return the status of the selection in the sheet.

   function Get_Range (Sheet : access Gtk_Sheet_Record) return Gtk_Sheet_Range;
   --  Return the selected range.

   procedure Get_Visible_Range
     (Sheet     : access Gtk_Sheet_Record;
      The_Range : out Gtk_Sheet_Range);
   --  Return the range visible on the screen.

   procedure Set_Selection_Mode
     (Sheet : access Gtk_Sheet_Record;
      Mode  : Gtk.Enums.Gtk_Selection_Mode);
   --  Change the selection mode.

   procedure Select_Column
     (Sheet  : access Gtk_Sheet_Record;
      Column : Gint);
   --  Replace the current selection with a specific column.
   --  The range is highlighted.

   procedure Select_Row
     (Sheet : access Gtk_Sheet_Record;
      Row   : Gint);
   --  Replace the current selection with a specific row.
   --  The range is highlighted.

   procedure Set_Autoresize
     (Sheet : access Gtk_Sheet_Record; Autoresize : Boolean);
   --  Whether cells should automatically resize to fit their contents

   function Autoresize (Sheet : access Gtk_Sheet_Record) return Boolean;
   --  Whether cells automatically resize to fit their contents

   procedure Set_Autoscroll
     (Sheet : access Gtk_Sheet_Record; Autoscroll : Boolean);
   --  Whether the sheet should automatically scroll to show the active cell at
   --  all times.

   function Autoscroll (Sheet : access Gtk_Sheet_Record) return Boolean;
   --  Whether the sheet automatically scrolls to show the active cell at all
   --  times.

   procedure Set_Clip_Text
     (Sheet : access Gtk_Sheet_Record; Clip : Boolean);
   --  Set when the text contained in the cells is automatically clipped to
   --  their width.

   function Clip_Text (Sheet : access Gtk_Sheet_Record) return Boolean;
   --  Whether the text contained in the cells is automatically clipped to
   --  their width.

   procedure Set_Justify_Entry
     (Sheet : access Gtk_Sheet_Record; Justify_Entry : Boolean);
   --  Set when the justification attribute for entries should be taken into
   --  account

   function Justify_Entry (Sheet : access Gtk_Sheet_Record) return Boolean;
   --  Whether the justification attribute is used for entries

   procedure Set_Locked
     (Sheet : access Gtk_Sheet_Record; Locked : Boolean);
   --  If Locked is true, the cells are no longer editable

   function Locked (Sheet : access Gtk_Sheet_Record) return Boolean;
   --  Whether cells are currently read-only

   procedure Select_Range
     (Sheet     : access Gtk_Sheet_Record;
      The_Range : Gtk_Sheet_Range);
   --  Select a new range of cells.

   procedure Unselect_Range (Sheet : access Gtk_Sheet_Record);
   --  Unselect a specific range of cells.
   --  If null is passed, the current selected range is used.

   procedure Clip_Range (Sheet     : access Gtk_Sheet_Record;
                         The_Range : in Gtk_Sheet_Range);
   --  Create a new clip range, which is copied to the clipboard
   --  That range is flashed on the screen.

   procedure Unclip_Range (Sheet : access Gtk_Sheet_Record);
   --  Destroy the clip area.

   function In_Clip (Sheet : access Gtk_Sheet_Record) return Boolean;
   --  Whether a range was copied to the clipboard

   function Set_Active_Cell
     (Sheet  : access Gtk_Sheet_Record;
      Row    : Gint;
      Column : Gint)
      return Boolean;
   --  Set active cell where the entry will be displayed.
   --  Returns FALSE if the current cell can not be deactivated or if the
   --  requested cell can't be activated.
   --  Depending on the value passed to Set_Autoscroll, the sheet might be
   --  scrolled.

   procedure Get_Active_Cell
     (Sheet  : access Gtk_Sheet_Record;
      Row    : out Gint;
      Column : out Gint);
   --  Return the coordinates of the active cell.
   --  This is the cell that the user is currently editing.

   -------------
   -- Columns --
   -------------

   procedure Set_Column_Title
     (Sheet  : access Gtk_Sheet_Record;
      Column : Gint;
      Title  : UTF8_String);
   --  Modify the title of a column.
   --  The first column on the left has the number 0.
   --  Note that this title does not appear on the screen, and can only be
   --  used internally to find a specific column.

   function Get_Column_Title
     (Sheet  : access Gtk_Sheet_Record;
      Column : Gint) return UTF8_String;
   --  Return the title of a specific column.

   procedure Set_Column_Titles_Height
     (Sheet  : access Gtk_Sheet_Record; Height : Guint);
   --  Modify the height of the row in which the column titles appear.

   procedure Column_Button_Add_Label
     (Sheet  : access Gtk_Sheet_Record;
      Column : Gint;
      Label  : UTF8_String);
   --  Modify the label of the button that appears at the top of each column.

   function Column_Button_Get_Label
     (Sheet : access Gtk_Sheet_Record; Column : Gint) return UTF8_String;
   --  Return the label for the button that appears at the top of each column

   procedure Column_Button_Justify
      (Sheet         : access Gtk_Sheet_Record;
       Column        : Gint;
       Justification : Gtk.Enums.Gtk_Justification);
   --  Modify the justification for the label in the column button.

   procedure Show_Column_Titles (Sheet : access Gtk_Sheet_Record);
   --  Show the row in which the column titles appear.

   procedure Hide_Column_Titles (Sheet : access Gtk_Sheet_Record);
   --  Hide the row in which the column titles appear.

   function Column_Titles_Visible
     (Sheet : access Gtk_Sheet_Record) return Boolean;
   --  Whether a special row is added at the top to show the title of the
   --  columns.

   procedure Columns_Set_Sensitivity
     (Sheet     : access Gtk_Sheet_Record;
      Sensitive : Boolean);
   --  Modify the sensitivity of all the columns.
   --  If Sensitive is False, the columns can not be resized dynamically.
   --  This also modifies the sensitivity of the button at the top of the
   --  columns.

   procedure Column_Set_Sensitivity
     (Sheet     : access Gtk_Sheet_Record;
      Column    : Gint;
      Sensitive : Boolean);
   --  Modify the sensitivity of a specific column and its title button.
   --  If Sensitive if False, the column can not be dynamically resized.

   procedure Column_Set_Visibility
     (Sheet   : access Gtk_Sheet_Record;
      Column  : Gint;
      Visible : Boolean);
   --  Change the visibility of a column.

   procedure Columns_Set_Resizable
     (Sheet : access Gtk_Sheet_Record; Resizable : Boolean);
   --  Whether columns are resizable

   function Columns_Resizable (Sheet : access Gtk_Sheet_Record) return Boolean;
   --  Whether columns are resizable

   procedure Column_Label_Set_Visibility
     (Sheet   : access Gtk_Sheet_Record;
      Column  : Gint;
      Visible : Boolean := True);
   --  Change the visibility of the label in a given column.

   procedure Columns_Labels_Set_Visibility
     (Sheet   : access Gtk_Sheet_Record;
      Visible : Boolean := True);
   --  Change the visibility for all the column labels.

   procedure Set_Column_Width
     (Sheet  : access Gtk_Sheet_Record;
      Column : Gint;
      Width  : Guint);
   --  Modify the width in pixels of a specific column.

   function Get_Column_Width (Sheet  : access Gtk_Sheet_Record;
                              Column : in Gint)
                             return Gint;
   --  Return the width in pixels of the Column-nth in Sheet.

   procedure Add_Column
     (Sheet : access Gtk_Sheet_Record;
      Ncols : Guint);
   --  Add some empty columns at the end of the sheet.

   procedure Insert_Columns
     (Sheet : access Gtk_Sheet_Record;
      Col   : Guint;
      Ncols : Guint);
   --  Add Ncols empty columns just before the columns number Col.

   procedure Delete_Columns
     (Sheet : access Gtk_Sheet_Record;
      Col   : Guint;
      Ncols : Guint);
   --  Delete Ncols columns starting from Col.

   procedure Column_Set_Justification
     (Sheet         : access Gtk_Sheet_Record;
      Column        : Gint;
      Justification : Gtk.Enums.Gtk_Justification);
   --  Set the default justification for the cells in the specific column.

   function Get_Columns_Count (Sheet : access Gtk_Sheet_Record) return Guint;
   --  Return the maximum column number of the displayed cells.

   ----------
   -- Rows --
   ----------

   procedure Set_Row_Title
     (Sheet : access Gtk_Sheet_Record;
      Row   : Gint;
      Title : UTF8_String);
   --  Modify the title of a row.
   --  The first row at the top has the number 0.
   --  Note that this title does not appear on the screen, and can only be
   --  used internally to find a specific row.

   function Get_Row_Title
     (Sheet  : access Gtk_Sheet_Record; Row : Gint) return UTF8_String;
   --  Return the title of a specific row.

   procedure Set_Row_Titles_Width
     (Sheet : access Gtk_Sheet_Record; Width : Guint);
   --  Modify the width of the column that has the row titles.

   procedure Row_Button_Add_Label
     (Sheet : access Gtk_Sheet_Record;
      Row   : Gint;
      Label : UTF8_String);
   --  Modify the label of the button that appears on the left of each row.

   function Row_Button_Get_Label
     (Sheet : access Gtk_Sheet_Record; Row : Gint) return UTF8_String;
   --  Return the label for the button that appears on the left of each row.

   procedure Row_Button_Justify
      (Sheet         : access Gtk_Sheet_Record;
       Row           : Gint;
       Justification : Gtk.Enums.Gtk_Justification);
   --  Modify the justification for the label of the row button.

   procedure Show_Row_Titles (Sheet : access Gtk_Sheet_Record);
   --  Show the column in which the row titles appear.

   procedure Hide_Row_Titles (Sheet : access Gtk_Sheet_Record);
   --  Hide the column in which the row titles appear.

   function Row_Titles_Visible
     (Sheet : access Gtk_Sheet_Record) return Boolean;
   --  Whether a special column is added to the left to show the title of the
   --  rows.

   procedure Rows_Set_Sensitivity (Sheet     : access Gtk_Sheet_Record;
                                   Sensitive : in Boolean);
   --  Modify the sensitivity of all the rows.
   --  If Sensitive is False, the rows can not be resized dynamically.
   --  This also modifies the sensitivity of the button at the left of the
   --  row.

   procedure Row_Set_Sensitivity (Sheet     : access Gtk_Sheet_Record;
                                  Row       : in Gint;
                                  Sensitive : in Boolean);
   --  Modify the sensitivity of a specific row and its title button.
   --  If Sensitive if False, the row can not be dynamically resized.

   procedure Row_Set_Visibility (Sheet   : access Gtk_Sheet_Record;
                                 Row     : in Gint;
                                 Visible : in Boolean);
   --  Modify the visibility of a specific row

   procedure Row_Label_Set_Visibility
     (Sheet   : access Gtk_Sheet_Record;
      Row    : in Gint;
      Visible : in Boolean := True);
   --  Change the visibility of the label in a given Row.

   procedure Rows_Labels_Set_Visibility
     (Sheet   : access Gtk_Sheet_Record;
      Visible : Boolean := True);
   --  Change the visibility for all the row labels.

   procedure Rows_Set_Resizable
     (Sheet : access Gtk_Sheet_Record; Resizable : Boolean);
   --  Whether rows are resizable

   function Rows_Resizable (Sheet : access Gtk_Sheet_Record) return Boolean;
   --  Whether rows are resizable

   procedure Set_Row_Height
     (Sheet  : access Gtk_Sheet_Record;
      Row    : Gint;
      Height : Guint);
   --  Set the height in pixels of a specific row.

   function Get_Row_Height (Sheet   : access Gtk_Sheet_Record;
                            Row     : in Gint)
                           return Gint;
   --  Return the height in pixels of the Row-th row in Sheet.

   procedure Add_Row
     (Sheet : access Gtk_Sheet_Record;
      Nrows : Guint);
   --  Append Nrows row at the end of the sheet.

   procedure Insert_Rows
     (Sheet : access Gtk_Sheet_Record;
      Row   : Guint;
      Nrows : Guint);
   --  Add Nrows empty rows just before the row number Row.

   procedure Delete_Rows
     (Sheet : access Gtk_Sheet_Record;
      Row   : Guint;
      Nrows : Guint);
   --  Delete Nrows rows starting from Row.

   function Get_Rows_Count (Sheet : access Gtk_Sheet_Record) return Guint;
   --  Return the maximum row number of displayed cells.

   -----------
   -- Range --
   -----------

   function Range_Get_Type return Gtk.Gtk_Type;
   --  Return the internal value associate with a Gtk_Sheet_Range

   procedure Range_Clear
     (Sheet     : access Gtk_Sheet_Record;
      The_Range : Gtk_Sheet_Range);
   --  Clear the content of the range.

   procedure Range_Delete
     (Sheet     : access Gtk_Sheet_Record;
      The_Range : Gtk_Sheet_Range);
   --  Clear the content of the range and delete all the links (user_data)

   procedure Range_Set_Background
     (Sheet     : access Gtk_Sheet_Record;
      The_Range : Gtk_Sheet_Range;
      Color     : Gdk.Color.Gdk_Color);
   --  Set the background color for the cells in a specific range.

   procedure Range_Set_Foreground
     (Sheet     : access Gtk_Sheet_Record;
      The_Range : Gtk_Sheet_Range;
      Color     : Gdk.Color.Gdk_Color);
   --  Set the foreground color for the cells in a specific range.

   procedure Range_Set_Justification
     (Sheet         : access Gtk_Sheet_Record;
      The_Range     : Gtk_Sheet_Range;
      Justification : Gtk.Enums.Gtk_Justification);
   --  Set the text justification for the cells in the range.

   procedure Range_Set_Editable
     (Sheet     : access Gtk_Sheet_Record;
      The_Range : Gtk_Sheet_Range;
      Editable  : Boolean);
   --  Set whether the cells in the range are editable.

   procedure Range_Set_Visible (Sheet     : access Gtk_Sheet_Record;
                                The_Range : in Gtk_Sheet_Range;
                                Visible   : in Boolean);
   --  Set whether the cells in the range are visible.

   procedure Range_Set_Border
     (Sheet      : access Gtk_Sheet_Record;
      The_Range  : Gtk_Sheet_Range;
      Mask       : Gtk_Sheet_Border;
      Width      : Guint;
      Line_Style : Gdk.GC.Gdk_Line_Style);
   --  Set the style of the border for the cells in the range.

   procedure Range_Set_Border_Color
     (Sheet     : access Gtk_Sheet_Record;
      The_Range : Gtk_Sheet_Range;
      Color     : Gdk.Color.Gdk_Color);
   --  Change the color for the borders of the cells in the range.

   procedure Range_Set_Font
     (Sheet     : access Gtk_Sheet_Record;
      The_Range : Gtk_Sheet_Range;
      Font      : Pango.Font.Pango_Font_Description);
   --  Change the font of the cells in the range.

   -----------
   -- Cells --
   -----------

   procedure Set_Cell
     (Sheet         : access Gtk_Sheet_Record;
      Row           : Gint;
      Col           : Gint;
      Justification : Gtk.Enums.Gtk_Justification;
      Text          : UTF8_String);
   --  Set the cell contents.
   --  Set Text to the empty string to delete the content of the cell.

   procedure Set_Cell_Text
     (Sheet : access Gtk_Sheet_Record;
      Row   : Gint;
      Col   : Gint;
      Text  : UTF8_String);
   --  Set the cell contents.
   --  The justification used is the previous one used in that cell.

   function Cell_Get_Text
     (Sheet  : access Gtk_Sheet_Record;
      Row    : Gint;
      Col    : Gint)
      return UTF8_String;
   --  Return the text put in a specific cell.
   --  The empty string is returned if there is no text in that cell.

   procedure Cell_Clear
     (Sheet : access Gtk_Sheet_Record;
      Row   : Gint;
      Col   : Gint);
   --  Clear the contents of the cell.

   procedure Cell_Delete
     (Sheet : access Gtk_Sheet_Record;
      Row   : Gint;
      Col   : Gint);
   --  Clear the contents of the cell and remove the user data associated
   --  with it.

   function Cell_Get_State (Sheet  : access Gtk_Sheet_Record;
                            Row    : in Gint;
                            Col    : in Gint)
                           return  Gtk.Enums.Gtk_State_Type;
   --  Return the state of the cell (normal or selected).

   procedure Get_Pixel_Info
     (Sheet  : access Gtk_Sheet_Record;
      X      : Gint;
      Y      : Gint;
      Row    : out Gint;
      Column : out Gint);
   --  Return the row and column matching a given pixel on the screen.
   --  Constraint_Error is raised if no such cell exists.

   procedure Get_Cell_Area
     (Sheet  : access Gtk_Sheet_Record;
      Row    : Gint;
      Column : Gint;
      Area   : out Gdk.Rectangle.Gdk_Rectangle);
   --  Get the area of the screen that a cell is mapped to.
   --  Constraint_Error is raised if no such cell exists;

   --------------
   -- Children --
   --------------
   --  A Gtk_Sheet can contain some children, attached to some specific
   --  cells.

   procedure Put
     (Sheet  : access Gtk_Sheet_Record;
      Widget : access Gtk.Widget.Gtk_Widget_Record'Class;
      X      : Gint;
      Y      : Gint);
   --  Put a new child at a specific location (in pixels) in the sheet.

   procedure Attach
      (Sheet    : access Gtk_Sheet_Record;
       Widget   : access Gtk.Widget.Gtk_Widget_Record'Class;
       Row      : Gint;
       Col      : Gint;
       Xoptions : Gtk.Enums.Gtk_Attach_Options := Expand or Fill;
       Yoptions : Gtk.Enums.Gtk_Attach_Options := Expand or Fill;
       Xpadding : Gint := 0;
       Ypadding : Gint := 0);
   --  Attach a child to a specific Cell in the sheet.
   --  X_Align and Y_Align should be between 0.0 and 1.0, indicating that
   --  the child should be aligned from the Left (resp. Top) to the Right
   --  (resp. Bottom) of the cell.
   --  If Row or Col is negative, the widget is attached to the row buttons or
   --  column buttons.
   --  Widget will not be moved if the cell is moved.

   procedure Attach_Floating
      (Sheet    : access Gtk_Sheet_Record;
       Widget   : access Gtk.Widget.Gtk_Widget_Record'Class;
       Row      : Gint;
       Col      : Gint);
   --  Attach a child at the current location or (Row, Col).
   --  If the cell is moved because of resizing or other reasons, Widget will
   --  be moved as well.

   procedure Move_Child
      (Sheet  : access Gtk_Sheet_Record;
       Widget : access Gtk.Widget.Gtk_Widget_Record'Class;
       X      : Gint;
       Y      : Gint);
   --  Move a child of the table to a specific location in pixels.
   --  A warning is printed if Widget is not already a child of Sheet.

   function Get_Child_At
     (Sheet  : access Gtk_Sheet_Record;
      Row    : Gint;
      Col    : Gint)
      return Gtk_Sheet_Child;
   --  Return the widget associated with the cell.

   function Get_Widget (Child : Gtk_Sheet_Child) return Gtk.Widget.Gtk_Widget;
   --  Return the widget in the child.

   procedure Button_Attach
     (Sheet   : access Gtk_Sheet_Record;
      Widget  : access Gtk.Widget.Gtk_Widget_Record'Class;
      Row     : Gint;
      Col     : Gint);
   --  Attach a new button in the row or column title.
   --  One of Row or Col must be negative (but only one).
   --  This can be used to modify the standard buttons that appear at the top
   --  of each column, or on the left of each row.

   -----------------------
   -- Links / User_Data --
   -----------------------
   --  You can associate any kind of data with a cell, just like you
   --  can associate user_data with all the widgets.
   --  Note that this uses a generic package, which must be instantiated at
   --  library level since it has internal clean up functions.

   generic
      --  <doc_ignore>
      type Data_Type (<>) is private;
   package Links is
      type Data_Type_Access is access all Data_Type;
      --  </doc_ignore>

      procedure Link_Cell
        (Sheet : access Gtk_Sheet_Record'Class;
         Row   : Gint;
         Col   : Gint;
         Link  : Data_Type);
      --  Associate some user specific data with a given cell.

      function Get_Link
        (Sheet  : access Gtk_Sheet_Record'Class;
         Row    : Gint;
         Col    : Gint)
         return  Data_Type_Access;
      --  Return the user data associated with the cell.
      --  null is returned if the cell has no user data.

   end Links;

   procedure Remove_Link
     (Sheet : access Gtk_Sheet_Record;
      Row   : Gint;
      Col   : Gint);
   --  Delete the user data associated with the cell.

   -------------
   -- Signals --
   -------------

   --  <signals>
   --  The following new signals are defined for this widget:
   --
   --  - "set_scroll_adjustments"
   --    procedure Handler (Sheet : access Gtk_Sheet_Record'Class;
   --                       Hadj  : Gtk_Adjustement;
   --                       Vadj  : Gtk_Adjustment);
   --
   --    Emitted when the adjustments used to indicate which area of the sheet
   --    is visible are set or changed. This is not called when their value is
   --    changed, only when a new one is set.
   --
   --  - "select_row"
   --    procedure Handler (Sheet : access Gtk_Sheet_Record'Class;
   --                       Row   : Gint);
   --
   --    Emitted when a new row is selected.
   --
   --  - "select_column"
   --    procedure Handler (Sheet  : access Gtk_Sheet_Record'Class;
   --                       Column : Gint);
   --
   --    Emitted when a new column is selected.
   --
   --  - "select_range"
   --    procedure Handler (Sheet     : access Gtk_Sheet_Record'Class;
   --                       The_Range : Gtk_Sheet_Range);
   --
   --    Emitted when a new range of cells is selected.
   --
   --  - "clip_range"
   --    procedure Handler (Sheet      : access Gtk_Sheet_Record'Class;
   --                       Clip_Range : Gtk_Sheet_Range);
   --
   --    Emitted when the clip area is set to a new value.
   --
   --  - "resize_range"
   --    procedure Handler (Sheet     : access Gtk_Sheet_Record'Class;
   --                       Old_Range : Gtk_Sheet_Range;
   --                       New_Range : Gtk_Sheet_Range);
   --
   --    Emitted when the current range of selected cell is resized (ie new
   --    cells are added to it or removed from it).
   --
   --  - "move_range"
   --    procedure Handler (Sheet     : access Gtk_Sheet_Record'Class;
   --                       Old_Range : Gtk_Sheet_Range;
   --                       New_Range : Gtk_Sheet_Range);
   --
   --    Emitted when the current range of selected cell is moved (ie the
   --    top-left cell is changed, but the size is not modified).
   --
   --  - "traverse"
   --    function Handler (Sheet      : access Gtk_Sheet_Record'Class;
   --                      Row        : Gint;
   --                      Column     : Gint;
   --                      New_Row    : Gint_Access;
   --                      New_Column : Gint_Access)
   --                     return Boolean;
   --
   --    Emitted when the user wants to make a new cell active. The coordinates
   --    of the currently active cell are passed in (Row, Column), the
   --    coordinates of the cell that the user would like to select are
   --    passed in (New_Row, New_Column). The callback can modify the new
   --    values, and should return True if the new coordinates are accepted,
   --    False if the selection should be refused.
   --
   --  - "deactivate"
   --    function Handler (Sheet  : access Gtk_Sheet_Record'Class;
   --                      Row    : Gint;
   --                      Column : Gint)
   --                     return Boolean;
   --
   --    Emitted when the user wants to deactivate a specific cell. The
   --    callback should return True if the cell can be deactivated, False
   --    otherwise. See the subprogram Deactivate_Cell.
   --
   --  - "activate"
   --    function Handler (Sheet  : access Gtk_Sheet_Record'Class;
   --                      Row    : Gint;
   --                      Column : Gint)
   --                     return Boolean;
   --
   --    Emitted when the user wants to activate a specific cell. The
   --    callback should return True if the cell can be activated, False
   --    otherwise. See the subprogram Activate_Cell.
   --
   --  - "set_cell"
   --    procedure Handler (Sheet  : access Gtk_Sheet_Record'Class;
   --                       Row    : Gint;
   --                       Column : Gint);
   --
   --    Emitted from Hide_Active_Cell, when the cell is non-empty. ???
   --
   --  - "clear_cell"
   --    procedure Handler (Sheet  : access Gtk_Sheet_Record'Class;
   --                       Row    : Gint;
   --                       Column : Gint);
   --
   --    Emitted when the content of the cell has been deleted (the text is
   --    now the empty string).
   --
   --  - "changed"
   --    procedure Handler (Sheet  : access Gtk_Sheet_Record'Class;
   --                       Row    : Gint;
   --                       Column : Gint);
   --
   --    Emitted when the content of the cell is modified (either the text
   --    itself, or its properties, alignment,...)
   --    A value of -1 for Row or Column means the row title, the column
   --    title, or their intersection.
   --
   --  - "new_column_width"
   --    procedure Handler (Sheet  : access Gtk_Sheet_Record'Class;
   --                       Column : Gint;
   --                       Width  : Guint);
   --
   --    Emitted whenever the width of the column is changed, either by the
   --    user or automatically if the cells should automatically resize
   --    themselves depending on their contents).
   --
   --  - "new_row_height"
   --    procedure Handler (Sheet  : access Gtk_Sheet_Record'Class;
   --                       Row    : Gint;
   --                       Height : Guint);
   --
   --    Emitted whenever the height of the row is changed.
   --  </signals>

private
   type Gtk_Sheet_Record is new Gtk.Container.Gtk_Container_Record
     with null record;
   type Gtk_Sheet_Child_Record is
     new Gtk.Widget.Gtk_Widget_Record with null record;

   pragma Import (C, Get_Type, "gtk_sheet_get_type");
   pragma Import (C, Range_Get_Type, "gtk_sheet_range_get_type");

   No_Border     : constant Gtk_Sheet_Border := 0;
   Left_Border   : constant Gtk_Sheet_Border := 1;
   Right_Border  : constant Gtk_Sheet_Border := 2;
   Top_Border    : constant Gtk_Sheet_Border := 4;
   Bottom_Border : constant Gtk_Sheet_Border := 8;
   All_Borders   : constant Gtk_Sheet_Border := 15;
   pragma Convention (C, Gtk_Sheet_Range);
end Gtk.Extra.Sheet;

--  Unbound:
--    gtk_sheet_get_entry_widget
--    gtk_sheet_get_attributes