1. ----------------------------------------------------------------------- 
  2. --               GtkAda - Ada95 binding for Gtk+/Gnome               -- 
  3. --                                                                   -- 
  4. --      Copyright (C) 2000 E. Briot, J. Brobecker and A. Charlet     -- 
  5. --                Copyright (C) 2000-2006 AdaCore                    -- 
  6. --                                                                   -- 
  7. -- This library is free software; you can redistribute it and/or     -- 
  8. -- modify it under the terms of the GNU General Public               -- 
  9. -- License as published by the Free Software Foundation; either      -- 
  10. -- version 2 of the License, or (at your option) any later version.  -- 
  11. --                                                                   -- 
  12. -- This library is distributed in the hope that it will be useful,   -- 
  13. -- but WITHOUT ANY WARRANTY; without even the implied warranty of    -- 
  14. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -- 
  15. -- General Public License for more details.                          -- 
  16. --                                                                   -- 
  17. -- You should have received a copy of the GNU General Public         -- 
  18. -- License along with this library; if not, write to the             -- 
  19. -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      -- 
  20. -- Boston, MA 02111-1307, USA.                                       -- 
  21. --                                                                   -- 
  22. -- -- -- -- -- -- -- -- -- -- -- --
  23. ----------------------------------------------------------------------- 
  24.  
  25. --  <description> 
  26. --  A Gtk_Sheet is a table like the one you can find in most spreadsheets. 
  27. --  Each cell can contain some text or any kind of widgets. 
  28. --  </description> 
  29. --  <c_version>gtkextra 2.1.1</c_version> 
  30. --  <group>GtkExtra, additional widgets</group> 
  31. --  <testgtk>create_sheet.adb</testgtk> 
  32. --  <screenshot>gtk-sheet</screenshot> 
  33.  
  34. with Gtk.Adjustment;  use Gtk.Adjustment; 
  35. with Gtk.Container; 
  36. with Gtk.Enums;       use Gtk.Enums; 
  37. with Gtk.GEntry; 
  38. with Gdk.Rectangle; 
  39. with Gdk.Color; 
  40. with Gdk.GC; 
  41. with Pango.Font; 
  42. with Gtk.Widget; 
  43.  
  44. package Gtk.Extra.Sheet is 
  45.  
  46.    type Gtk_Sheet_Record is new Gtk.Container.Gtk_Container_Record 
  47.      with private; 
  48.    type Gtk_Sheet is access all Gtk_Sheet_Record'Class; 
  49.  
  50.    type Gtk_Sheet_Range_Record is record 
  51.       Row0, Col0 : Gint;  --  Upper-left cell 
  52.       Rowi, Coli : Gint;  --  Lower-Right cell 
  53.    end record; 
  54.  
  55.    type Gtk_Sheet_Range is access all Gtk_Sheet_Range_Record; 
  56.    --  A range in the sheet. 
  57.    --  This is a part of the sheet represented by its upper-left cell and 
  58.    --  its lower-right cell. 
  59.    --  Most operations below apply to such ranges. 
  60.  
  61.    type Gtk_Sheet_Child_Record is 
  62.      new Gtk.Widget.Gtk_Widget_Record with private; 
  63.    type Gtk_Sheet_Child is access all Gtk_Sheet_Child_Record'Class; 
  64.    --  A widget insert in the sheet. 
  65.    --  This structure includes both a widget pointer and the position in the 
  66.    --  table in which it is put. 
  67.  
  68.    ---------------- 
  69.    -- Enum types -- 
  70.    ---------------- 
  71.  
  72.    --  <doc_ignore> 
  73.    type Sheet_Attr_Type is 
  74.      (Sheet_Foreground, 
  75.       Sheet_Background, 
  76.       Sheet_Font, 
  77.       Sheet_Justification, 
  78.       Sheet_Border, 
  79.       Sheet_Border_Color, 
  80.       Sheet_Is_Editable, 
  81.       Sheet_Is_Visible); 
  82.    --  Attributes that can be set for the sheet. 
  83.    --  No function is provided at the Ada level to modify these attributes 
  84.    --  directly. 
  85.    pragma Convention (C, Sheet_Attr_Type); 
  86.    --  </doc_ignore> 
  87.  
  88.    type Sheet_State is 
  89.      (Sheet_Normal, 
  90.       Sheet_Row_Selected, 
  91.       Sheet_Column_Selected, 
  92.       Sheet_Range_Selected); 
  93.    --  The state of the selection. 
  94.    pragma Convention (C, Sheet_State); 
  95.  
  96.    type Gtk_Sheet_Border is new Integer; 
  97.    --  Mask that indicates which borders should be visible in a cell. 
  98.  
  99.    No_Border     : constant Gtk_Sheet_Border; 
  100.    Left_Border   : constant Gtk_Sheet_Border; 
  101.    Right_Border  : constant Gtk_Sheet_Border; 
  102.    Top_Border    : constant Gtk_Sheet_Border; 
  103.    Bottom_Border : constant Gtk_Sheet_Border; 
  104.    All_Borders   : constant Gtk_Sheet_Border; 
  105.  
  106.    ------------------------------- 
  107.    -- Creation and modification -- 
  108.    ------------------------------- 
  109.  
  110.    procedure Gtk_New 
  111.      (Sheet      : out Gtk_Sheet; 
  112.       Rows       : Guint; 
  113.       Columns    : Guint; 
  114.       Title      : UTF8_String := ""; 
  115.       Entry_Type : Gtk_Type := GType_Invalid); 
  116.    --  Create a new sheet with a specific number of rows and columns. 
  117.    --  You can fully specify which type the entry used to modify the value of 
  118.    --  cells should have. The value of Entry_Type can be found by using one 
  119.    --  of the Get_Type subprograms in the GtkAda packages. 
  120.    --  The Title is internal, and does not appear on the screen. 
  121.  
  122.    procedure Initialize 
  123.      (Sheet      : access Gtk_Sheet_Record'Class; 
  124.       Rows       : Guint; 
  125.       Columns    : Guint; 
  126.       Title      : UTF8_String := ""; 
  127.       Entry_Type : Gtk_Type := GType_Invalid); 
  128.    --  Internal initialization function. 
  129.    --  See the section "Creating your own widgets" in the documentation. 
  130.  
  131.    procedure Gtk_New_Browser 
  132.      (Sheet   : out Gtk_Sheet; 
  133.       Rows    : Guint; 
  134.       Columns : Guint; 
  135.       Title   : UTF8_String := ""); 
  136.    --  Create a new sheet browser with a specific number of rows and columns. 
  137.    --  This is a standard Gtk_Sheet, except that it is read-only and that its 
  138.    --  cells will automatically resize themselves depending on their contents. 
  139.  
  140.    procedure Initialize_Browser (Sheet   : access Gtk_Sheet_Record'Class; 
  141.                                  Rows    : in Guint; 
  142.                                  Columns : in Guint; 
  143.                                  Title   : in UTF8_String := ""); 
  144.    --  Internal initialization function. 
  145.    --  See the section "Creating your own widgets" in the documentation. 
  146.  
  147.    function Get_Type return Gtk.Gtk_Type; 
  148.    --  Return the internal value associated with a Gtk_Sheet. 
  149.  
  150.    procedure Set_Hadjustment 
  151.      (Sheet      : access Gtk_Sheet_Record; 
  152.       Adjustment : access Gtk_Adjustment_Record'Class); 
  153.    --  Change the horizontal adjustment. 
  154.    --  It indicates what range of columns is visible. 
  155.  
  156.    procedure Set_Vadjustment 
  157.       (Sheet      : access Gtk_Sheet_Record; 
  158.        Adjustment : access Gtk_Adjustment_Record'Class); 
  159.    --  Change the vertical adjustment. 
  160.    --  It indicates what range of rows is visible. 
  161.  
  162.    function Get_Vadjustment 
  163.      (Sheet  : access Gtk_Sheet_Record) 
  164.       return      Gtk.Adjustment.Gtk_Adjustment; 
  165.    --  Return the adjustment used to indicate the range of visible rows. 
  166.  
  167.    function Get_Hadjustment 
  168.      (Sheet  : access Gtk_Sheet_Record) 
  169.       return      Gtk.Adjustment.Gtk_Adjustment; 
  170.    --  Return the adjustment used to indicate the range of visible columns. 
  171.  
  172.    procedure Change_Entry 
  173.      (Sheet      : access Gtk_Sheet_Record; 
  174.       Entry_Type : Gtk_Type); 
  175.    --  Change the type of widget used to interactively modify the value of 
  176.    --  the cells. 
  177.  
  178.    function Get_Entry 
  179.      (Sheet : access Gtk_Sheet_Record) return Gtk.GEntry.Gtk_Entry; 
  180.    --  Return the entry used to modify the content of the cells. 
  181.    --  This can be the same widget as Get_Entry_Widget, if set, or some default 
  182.    --  widget associated with the specific child otherwise 
  183.  
  184.    function Get_Entry_Widget 
  185.      (Sheet : access Gtk_Sheet_Record) return Gtk.Widget.Gtk_Widget; 
  186.    --  Return the entry used to modify the content of the cells. 
  187.  
  188.    procedure Set_Title 
  189.      (Sheet : access Gtk_Sheet_Record; 
  190.       Title : UTF8_String); 
  191.    --  Change the title of the sheet. 
  192.  
  193.    procedure Freeze (Sheet : access Gtk_Sheet_Record); 
  194.    --  Freeze all visual updates of the sheet, until you thaw it. 
  195.    --  The update will occur in a more efficient way. 
  196.  
  197.    procedure Thaw (Sheet : access Gtk_Sheet_Record); 
  198.    --  Thaw the sheet, so that visual updates occur again. 
  199.    --  Note that you have to call Thaw as many times as you have called 
  200.    --  Freeze to actually thaw the widget. 
  201.  
  202.    procedure Moveto 
  203.      (Sheet     : access Gtk_Sheet_Record; 
  204.       Row       : Gint; 
  205.       Column    : Gint; 
  206.       Row_Align : Gfloat; 
  207.       Col_Align : Gfloat); 
  208.    --  Scroll the viewing area to (Row, Column). 
  209.    --  (Row_Align, Col_Align) represent the location on the screen that the 
  210.    --  cell should appear at. (0.0, 0.0) is at the top-left of the screen, 
  211.    --  whereas (1.0, 1.0) is at the bottom-right corner. 
  212.    --  If Row or Column is negative, there is no change. 
  213.  
  214.    procedure Set_Background 
  215.      (Sheet : access Gtk_Sheet_Record; Color : Gdk.Color.Gdk_Color); 
  216.    --  Change the background color of the cells. 
  217.  
  218.    procedure Set_Grid 
  219.      (Sheet : access Gtk_Sheet_Record; Color : Gdk.Color.Gdk_Color); 
  220.    --  Set the color to use for the grid. 
  221.  
  222.    procedure Show_Grid 
  223.      (Sheet : access Gtk_Sheet_Record; Show : Boolean); 
  224.    --  Whether the grid should be made visible 
  225.  
  226.    function Grid_Visible (Sheet : access Gtk_Sheet_Record) return Boolean; 
  227.    --  Whether the grid is currently visible 
  228.  
  229.    ---------------------------- 
  230.    -- Selection and Clipping -- 
  231.    ---------------------------- 
  232.  
  233.    function Get_State (Sheet : access Gtk_Sheet_Record) return Sheet_State; 
  234.    --  Return the status of the selection in the sheet. 
  235.  
  236.    function Get_Range (Sheet : access Gtk_Sheet_Record) return Gtk_Sheet_Range; 
  237.    --  Return the selected range. 
  238.  
  239.    procedure Get_Visible_Range 
  240.      (Sheet     : access Gtk_Sheet_Record; 
  241.       The_Range : out Gtk_Sheet_Range); 
  242.    --  Return the range visible on the screen. 
  243.  
  244.    procedure Set_Selection_Mode 
  245.      (Sheet : access Gtk_Sheet_Record; 
  246.       Mode  : Gtk.Enums.Gtk_Selection_Mode); 
  247.    --  Change the selection mode. 
  248.  
  249.    procedure Select_Column 
  250.      (Sheet  : access Gtk_Sheet_Record; 
  251.       Column : Gint); 
  252.    --  Replace the current selection with a specific column. 
  253.    --  The range is highlighted. 
  254.  
  255.    procedure Select_Row 
  256.      (Sheet : access Gtk_Sheet_Record; 
  257.       Row   : Gint); 
  258.    --  Replace the current selection with a specific row. 
  259.    --  The range is highlighted. 
  260.  
  261.    procedure Set_Autoresize 
  262.      (Sheet : access Gtk_Sheet_Record; Autoresize : Boolean); 
  263.    --  Whether cells should automatically resize to fit their contents 
  264.  
  265.    function Autoresize (Sheet : access Gtk_Sheet_Record) return Boolean; 
  266.    --  Whether cells automatically resize to fit their contents 
  267.  
  268.    procedure Set_Autoscroll 
  269.      (Sheet : access Gtk_Sheet_Record; Autoscroll : Boolean); 
  270.    --  Whether the sheet should automatically scroll to show the active cell at 
  271.    --  all times. 
  272.  
  273.    function Autoscroll (Sheet : access Gtk_Sheet_Record) return Boolean; 
  274.    --  Whether the sheet automatically scrolls to show the active cell at all 
  275.    --  times. 
  276.  
  277.    procedure Set_Clip_Text 
  278.      (Sheet : access Gtk_Sheet_Record; Clip : Boolean); 
  279.    --  Set when the text contained in the cells is automatically clipped to 
  280.    --  their width. 
  281.  
  282.    function Clip_Text (Sheet : access Gtk_Sheet_Record) return Boolean; 
  283.    --  Whether the text contained in the cells is automatically clipped to 
  284.    --  their width. 
  285.  
  286.    procedure Set_Justify_Entry 
  287.      (Sheet : access Gtk_Sheet_Record; Justify_Entry : Boolean); 
  288.    --  Set when the justification attribute for entries should be taken into 
  289.    --  account 
  290.  
  291.    function Justify_Entry (Sheet : access Gtk_Sheet_Record) return Boolean; 
  292.    --  Whether the justification attribute is used for entries 
  293.  
  294.    procedure Set_Locked 
  295.      (Sheet : access Gtk_Sheet_Record; Locked : Boolean); 
  296.    --  If Locked is true, the cells are no longer editable 
  297.  
  298.    function Locked (Sheet : access Gtk_Sheet_Record) return Boolean; 
  299.    --  Whether cells are currently read-only 
  300.  
  301.    procedure Select_Range 
  302.      (Sheet     : access Gtk_Sheet_Record; 
  303.       The_Range : Gtk_Sheet_Range); 
  304.    --  Select a new range of cells. 
  305.  
  306.    procedure Unselect_Range (Sheet : access Gtk_Sheet_Record); 
  307.    --  Unselect a specific range of cells. 
  308.    --  If null is passed, the current selected range is used. 
  309.  
  310.    procedure Clip_Range (Sheet     : access Gtk_Sheet_Record; 
  311.                          The_Range : in Gtk_Sheet_Range); 
  312.    --  Create a new clip range, which is copied to the clipboard 
  313.    --  That range is flashed on the screen. 
  314.  
  315.    procedure Unclip_Range (Sheet : access Gtk_Sheet_Record); 
  316.    --  Destroy the clip area. 
  317.  
  318.    function In_Clip (Sheet : access Gtk_Sheet_Record) return Boolean; 
  319.    --  Whether a range was copied to the clipboard 
  320.  
  321.    function Set_Active_Cell 
  322.      (Sheet  : access Gtk_Sheet_Record; 
  323.       Row    : Gint; 
  324.       Column : Gint) 
  325.       return Boolean; 
  326.    --  Set active cell where the entry will be displayed. 
  327.    --  Returns FALSE if the current cell can not be deactivated or if the 
  328.    --  requested cell can't be activated. 
  329.    --  Depending on the value passed to Set_Autoscroll, the sheet might be 
  330.    --  scrolled. 
  331.  
  332.    procedure Get_Active_Cell 
  333.      (Sheet  : access Gtk_Sheet_Record; 
  334.       Row    : out Gint; 
  335.       Column : out Gint); 
  336.    --  Return the coordinates of the active cell. 
  337.    --  This is the cell that the user is currently editing. 
  338.  
  339.    ------------- 
  340.    -- Columns -- 
  341.    ------------- 
  342.  
  343.    procedure Set_Column_Title 
  344.      (Sheet  : access Gtk_Sheet_Record; 
  345.       Column : Gint; 
  346.       Title  : UTF8_String); 
  347.    --  Modify the title of a column. 
  348.    --  The first column on the left has the number 0. 
  349.    --  Note that this title does not appear on the screen, and can only be 
  350.    --  used internally to find a specific column. 
  351.  
  352.    function Get_Column_Title 
  353.      (Sheet  : access Gtk_Sheet_Record; 
  354.       Column : Gint) return UTF8_String; 
  355.    --  Return the title of a specific column. 
  356.  
  357.    procedure Set_Column_Titles_Height 
  358.      (Sheet  : access Gtk_Sheet_Record; Height : Guint); 
  359.    --  Modify the height of the row in which the column titles appear. 
  360.  
  361.    procedure Column_Button_Add_Label 
  362.      (Sheet  : access Gtk_Sheet_Record; 
  363.       Column : Gint; 
  364.       Label  : UTF8_String); 
  365.    --  Modify the label of the button that appears at the top of each column. 
  366.  
  367.    function Column_Button_Get_Label 
  368.      (Sheet : access Gtk_Sheet_Record; Column : Gint) return UTF8_String; 
  369.    --  Return the label for the button that appears at the top of each column 
  370.  
  371.    procedure Column_Button_Justify 
  372.       (Sheet         : access Gtk_Sheet_Record; 
  373.        Column        : Gint; 
  374.        Justification : Gtk.Enums.Gtk_Justification); 
  375.    --  Modify the justification for the label in the column button. 
  376.  
  377.    procedure Show_Column_Titles (Sheet : access Gtk_Sheet_Record); 
  378.    --  Show the row in which the column titles appear. 
  379.  
  380.    procedure Hide_Column_Titles (Sheet : access Gtk_Sheet_Record); 
  381.    --  Hide the row in which the column titles appear. 
  382.  
  383.    function Column_Titles_Visible 
  384.      (Sheet : access Gtk_Sheet_Record) return Boolean; 
  385.    --  Whether a special row is added at the top to show the title of the 
  386.    --  columns. 
  387.  
  388.    procedure Columns_Set_Sensitivity 
  389.      (Sheet     : access Gtk_Sheet_Record; 
  390.       Sensitive : Boolean); 
  391.    --  Modify the sensitivity of all the columns. 
  392.    --  If Sensitive is False, the columns can not be resized dynamically. 
  393.    --  This also modifies the sensitivity of the button at the top of the 
  394.    --  columns. 
  395.  
  396.    procedure Column_Set_Sensitivity 
  397.      (Sheet     : access Gtk_Sheet_Record; 
  398.       Column    : Gint; 
  399.       Sensitive : Boolean); 
  400.    --  Modify the sensitivity of a specific column and its title button. 
  401.    --  If Sensitive if False, the column can not be dynamically resized. 
  402.  
  403.    procedure Column_Set_Visibility 
  404.      (Sheet   : access Gtk_Sheet_Record; 
  405.       Column  : Gint; 
  406.       Visible : Boolean); 
  407.    --  Change the visibility of a column. 
  408.  
  409.    procedure Columns_Set_Resizable 
  410.      (Sheet : access Gtk_Sheet_Record; Resizable : Boolean); 
  411.    --  Whether columns are resizable 
  412.  
  413.    function Columns_Resizable (Sheet : access Gtk_Sheet_Record) return Boolean; 
  414.    --  Whether columns are resizable 
  415.  
  416.    procedure Column_Label_Set_Visibility 
  417.      (Sheet   : access Gtk_Sheet_Record; 
  418.       Column  : Gint; 
  419.       Visible : Boolean := True); 
  420.    --  Change the visibility of the label in a given column. 
  421.  
  422.    procedure Columns_Labels_Set_Visibility 
  423.      (Sheet   : access Gtk_Sheet_Record; 
  424.       Visible : Boolean := True); 
  425.    --  Change the visibility for all the column labels. 
  426.  
  427.    procedure Set_Column_Width 
  428.      (Sheet  : access Gtk_Sheet_Record; 
  429.       Column : Gint; 
  430.       Width  : Guint); 
  431.    --  Modify the width in pixels of a specific column. 
  432.  
  433.    function Get_Column_Width (Sheet  : access Gtk_Sheet_Record; 
  434.                               Column : in Gint) 
  435.                              return Gint; 
  436.    --  Return the width in pixels of the Column-nth in Sheet. 
  437.  
  438.    procedure Add_Column 
  439.      (Sheet : access Gtk_Sheet_Record; 
  440.       Ncols : Guint); 
  441.    --  Add some empty columns at the end of the sheet. 
  442.  
  443.    procedure Insert_Columns 
  444.      (Sheet : access Gtk_Sheet_Record; 
  445.       Col   : Guint; 
  446.       Ncols : Guint); 
  447.    --  Add Ncols empty columns just before the columns number Col. 
  448.  
  449.    procedure Delete_Columns 
  450.      (Sheet : access Gtk_Sheet_Record; 
  451.       Col   : Guint; 
  452.       Ncols : Guint); 
  453.    --  Delete Ncols columns starting from Col. 
  454.  
  455.    procedure Column_Set_Justification 
  456.      (Sheet         : access Gtk_Sheet_Record; 
  457.       Column        : Gint; 
  458.       Justification : Gtk.Enums.Gtk_Justification); 
  459.    --  Set the default justification for the cells in the specific column. 
  460.  
  461.    function Get_Columns_Count (Sheet : access Gtk_Sheet_Record) return Guint; 
  462.    --  Return the maximum column number of the displayed cells. 
  463.  
  464.    ---------- 
  465.    -- Rows -- 
  466.    ---------- 
  467.  
  468.    procedure Set_Row_Title 
  469.      (Sheet : access Gtk_Sheet_Record; 
  470.       Row   : Gint; 
  471.       Title : UTF8_String); 
  472.    --  Modify the title of a row. 
  473.    --  The first row at the top has the number 0. 
  474.    --  Note that this title does not appear on the screen, and can only be 
  475.    --  used internally to find a specific row. 
  476.  
  477.    function Get_Row_Title 
  478.      (Sheet  : access Gtk_Sheet_Record; Row : Gint) return UTF8_String; 
  479.    --  Return the title of a specific row. 
  480.  
  481.    procedure Set_Row_Titles_Width 
  482.      (Sheet : access Gtk_Sheet_Record; Width : Guint); 
  483.    --  Modify the width of the column that has the row titles. 
  484.  
  485.    procedure Row_Button_Add_Label 
  486.      (Sheet : access Gtk_Sheet_Record; 
  487.       Row   : Gint; 
  488.       Label : UTF8_String); 
  489.    --  Modify the label of the button that appears on the left of each row. 
  490.  
  491.    function Row_Button_Get_Label 
  492.      (Sheet : access Gtk_Sheet_Record; Row : Gint) return UTF8_String; 
  493.    --  Return the label for the button that appears on the left of each row. 
  494.  
  495.    procedure Row_Button_Justify 
  496.       (Sheet         : access Gtk_Sheet_Record; 
  497.        Row           : Gint; 
  498.        Justification : Gtk.Enums.Gtk_Justification); 
  499.    --  Modify the justification for the label of the row button. 
  500.  
  501.    procedure Show_Row_Titles (Sheet : access Gtk_Sheet_Record); 
  502.    --  Show the column in which the row titles appear. 
  503.  
  504.    procedure Hide_Row_Titles (Sheet : access Gtk_Sheet_Record); 
  505.    --  Hide the column in which the row titles appear. 
  506.  
  507.    function Row_Titles_Visible 
  508.      (Sheet : access Gtk_Sheet_Record) return Boolean; 
  509.    --  Whether a special column is added to the left to show the title of the 
  510.    --  rows. 
  511.  
  512.    procedure Rows_Set_Sensitivity (Sheet     : access Gtk_Sheet_Record; 
  513.                                    Sensitive : in Boolean); 
  514.    --  Modify the sensitivity of all the rows. 
  515.    --  If Sensitive is False, the rows can not be resized dynamically. 
  516.    --  This also modifies the sensitivity of the button at the left of the 
  517.    --  row. 
  518.  
  519.    procedure Row_Set_Sensitivity (Sheet     : access Gtk_Sheet_Record; 
  520.                                   Row       : in Gint; 
  521.                                   Sensitive : in Boolean); 
  522.    --  Modify the sensitivity of a specific row and its title button. 
  523.    --  If Sensitive if False, the row can not be dynamically resized. 
  524.  
  525.    procedure Row_Set_Visibility (Sheet   : access Gtk_Sheet_Record; 
  526.                                  Row     : in Gint; 
  527.                                  Visible : in Boolean); 
  528.    --  Modify the visibility of a specific row 
  529.  
  530.    procedure Row_Label_Set_Visibility 
  531.      (Sheet   : access Gtk_Sheet_Record; 
  532.       Row    : in Gint; 
  533.       Visible : in Boolean := True); 
  534.    --  Change the visibility of the label in a given Row. 
  535.  
  536.    procedure Rows_Labels_Set_Visibility 
  537.      (Sheet   : access Gtk_Sheet_Record; 
  538.       Visible : Boolean := True); 
  539.    --  Change the visibility for all the row labels. 
  540.  
  541.    procedure Rows_Set_Resizable 
  542.      (Sheet : access Gtk_Sheet_Record; Resizable : Boolean); 
  543.    --  Whether rows are resizable 
  544.  
  545.    function Rows_Resizable (Sheet : access Gtk_Sheet_Record) return Boolean; 
  546.    --  Whether rows are resizable 
  547.  
  548.    procedure Set_Row_Height 
  549.      (Sheet  : access Gtk_Sheet_Record; 
  550.       Row    : Gint; 
  551.       Height : Guint); 
  552.    --  Set the height in pixels of a specific row. 
  553.  
  554.    function Get_Row_Height (Sheet   : access Gtk_Sheet_Record; 
  555.                             Row     : in Gint) 
  556.                            return Gint; 
  557.    --  Return the height in pixels of the Row-th row in Sheet. 
  558.  
  559.    procedure Add_Row 
  560.      (Sheet : access Gtk_Sheet_Record; 
  561.       Nrows : Guint); 
  562.    --  Append Nrows row at the end of the sheet. 
  563.  
  564.    procedure Insert_Rows 
  565.      (Sheet : access Gtk_Sheet_Record; 
  566.       Row   : Guint; 
  567.       Nrows : Guint); 
  568.    --  Add Nrows empty rows just before the row number Row. 
  569.  
  570.    procedure Delete_Rows 
  571.      (Sheet : access Gtk_Sheet_Record; 
  572.       Row   : Guint; 
  573.       Nrows : Guint); 
  574.    --  Delete Nrows rows starting from Row. 
  575.  
  576.    function Get_Rows_Count (Sheet : access Gtk_Sheet_Record) return Guint; 
  577.    --  Return the maximum row number of displayed cells. 
  578.  
  579.    ----------- 
  580.    -- Range -- 
  581.    ----------- 
  582.  
  583.    function Range_Get_Type return Gtk.Gtk_Type; 
  584.    --  Return the internal value associate with a Gtk_Sheet_Range 
  585.  
  586.    procedure Range_Clear 
  587.      (Sheet     : access Gtk_Sheet_Record; 
  588.       The_Range : Gtk_Sheet_Range); 
  589.    --  Clear the content of the range. 
  590.  
  591.    procedure Range_Delete 
  592.      (Sheet     : access Gtk_Sheet_Record; 
  593.       The_Range : Gtk_Sheet_Range); 
  594.    --  Clear the content of the range and delete all the links (user_data) 
  595.  
  596.    procedure Range_Set_Background 
  597.      (Sheet     : access Gtk_Sheet_Record; 
  598.       The_Range : Gtk_Sheet_Range; 
  599.       Color     : Gdk.Color.Gdk_Color); 
  600.    --  Set the background color for the cells in a specific range. 
  601.  
  602.    procedure Range_Set_Foreground 
  603.      (Sheet     : access Gtk_Sheet_Record; 
  604.       The_Range : Gtk_Sheet_Range; 
  605.       Color     : Gdk.Color.Gdk_Color); 
  606.    --  Set the foreground color for the cells in a specific range. 
  607.  
  608.    procedure Range_Set_Justification 
  609.      (Sheet         : access Gtk_Sheet_Record; 
  610.       The_Range     : Gtk_Sheet_Range; 
  611.       Justification : Gtk.Enums.Gtk_Justification); 
  612.    --  Set the text justification for the cells in the range. 
  613.  
  614.    procedure Range_Set_Editable 
  615.      (Sheet     : access Gtk_Sheet_Record; 
  616.       The_Range : Gtk_Sheet_Range; 
  617.       Editable  : Boolean); 
  618.    --  Set whether the cells in the range are editable. 
  619.  
  620.    procedure Range_Set_Visible (Sheet     : access Gtk_Sheet_Record; 
  621.                                 The_Range : in Gtk_Sheet_Range; 
  622.                                 Visible   : in Boolean); 
  623.    --  Set whether the cells in the range are visible. 
  624.  
  625.    procedure Range_Set_Border 
  626.      (Sheet      : access Gtk_Sheet_Record; 
  627.       The_Range  : Gtk_Sheet_Range; 
  628.       Mask       : Gtk_Sheet_Border; 
  629.       Width      : Guint; 
  630.       Line_Style : Gdk.GC.Gdk_Line_Style); 
  631.    --  Set the style of the border for the cells in the range. 
  632.  
  633.    procedure Range_Set_Border_Color 
  634.      (Sheet     : access Gtk_Sheet_Record; 
  635.       The_Range : Gtk_Sheet_Range; 
  636.       Color     : Gdk.Color.Gdk_Color); 
  637.    --  Change the color for the borders of the cells in the range. 
  638.  
  639.    procedure Range_Set_Font 
  640.      (Sheet     : access Gtk_Sheet_Record; 
  641.       The_Range : Gtk_Sheet_Range; 
  642.       Font      : Pango.Font.Pango_Font_Description); 
  643.    --  Change the font of the cells in the range. 
  644.  
  645.    ----------- 
  646.    -- Cells -- 
  647.    ----------- 
  648.  
  649.    procedure Set_Cell 
  650.      (Sheet         : access Gtk_Sheet_Record; 
  651.       Row           : Gint; 
  652.       Col           : Gint; 
  653.       Justification : Gtk.Enums.Gtk_Justification; 
  654.       Text          : UTF8_String); 
  655.    --  Set the cell contents. 
  656.    --  Set Text to the empty string to delete the content of the cell. 
  657.  
  658.    procedure Set_Cell_Text 
  659.      (Sheet : access Gtk_Sheet_Record; 
  660.       Row   : Gint; 
  661.       Col   : Gint; 
  662.       Text  : UTF8_String); 
  663.    --  Set the cell contents. 
  664.    --  The justification used is the previous one used in that cell. 
  665.  
  666.    function Cell_Get_Text 
  667.      (Sheet  : access Gtk_Sheet_Record; 
  668.       Row    : Gint; 
  669.       Col    : Gint) 
  670.       return UTF8_String; 
  671.    --  Return the text put in a specific cell. 
  672.    --  The empty string is returned if there is no text in that cell. 
  673.  
  674.    procedure Cell_Clear 
  675.      (Sheet : access Gtk_Sheet_Record; 
  676.       Row   : Gint; 
  677.       Col   : Gint); 
  678.    --  Clear the contents of the cell. 
  679.  
  680.    procedure Cell_Delete 
  681.      (Sheet : access Gtk_Sheet_Record; 
  682.       Row   : Gint; 
  683.       Col   : Gint); 
  684.    --  Clear the contents of the cell and remove the user data associated 
  685.    --  with it. 
  686.  
  687.    function Cell_Get_State (Sheet  : access Gtk_Sheet_Record; 
  688.                             Row    : in Gint; 
  689.                             Col    : in Gint) 
  690.                            return  Gtk.Enums.Gtk_State_Type; 
  691.    --  Return the state of the cell (normal or selected). 
  692.  
  693.    procedure Get_Pixel_Info 
  694.      (Sheet  : access Gtk_Sheet_Record; 
  695.       X      : Gint; 
  696.       Y      : Gint; 
  697.       Row    : out Gint; 
  698.       Column : out Gint); 
  699.    --  Return the row and column matching a given pixel on the screen. 
  700.    --  Constraint_Error is raised if no such cell exists. 
  701.  
  702.    procedure Get_Cell_Area 
  703.      (Sheet  : access Gtk_Sheet_Record; 
  704.       Row    : Gint; 
  705.       Column : Gint; 
  706.       Area   : out Gdk.Rectangle.Gdk_Rectangle); 
  707.    --  Get the area of the screen that a cell is mapped to. 
  708.    --  Constraint_Error is raised if no such cell exists; 
  709.  
  710.    -------------- 
  711.    -- Children -- 
  712.    -------------- 
  713.    --  A Gtk_Sheet can contain some children, attached to some specific 
  714.    --  cells. 
  715.  
  716.    procedure Put 
  717.      (Sheet  : access Gtk_Sheet_Record; 
  718.       Widget : access Gtk.Widget.Gtk_Widget_Record'Class; 
  719.       X      : Gint; 
  720.       Y      : Gint); 
  721.    --  Put a new child at a specific location (in pixels) in the sheet. 
  722.  
  723.    procedure Attach 
  724.       (Sheet    : access Gtk_Sheet_Record; 
  725.        Widget   : access Gtk.Widget.Gtk_Widget_Record'Class; 
  726.        Row      : Gint; 
  727.        Col      : Gint; 
  728.        Xoptions : Gtk.Enums.Gtk_Attach_Options := Expand or Fill; 
  729.        Yoptions : Gtk.Enums.Gtk_Attach_Options := Expand or Fill; 
  730.        Xpadding : Gint := 0; 
  731.        Ypadding : Gint := 0); 
  732.    --  Attach a child to a specific Cell in the sheet. 
  733.    --  X_Align and Y_Align should be between 0.0 and 1.0, indicating that 
  734.    --  the child should be aligned from the Left (resp. Top) to the Right 
  735.    --  (resp. Bottom) of the cell. 
  736.    --  If Row or Col is negative, the widget is attached to the row buttons or 
  737.    --  column buttons. 
  738.    --  Widget will not be moved if the cell is moved. 
  739.  
  740.    procedure Attach_Floating 
  741.       (Sheet    : access Gtk_Sheet_Record; 
  742.        Widget   : access Gtk.Widget.Gtk_Widget_Record'Class; 
  743.        Row      : Gint; 
  744.        Col      : Gint); 
  745.    --  Attach a child at the current location or (Row, Col). 
  746.    --  If the cell is moved because of resizing or other reasons, Widget will 
  747.    --  be moved as well. 
  748.  
  749.    procedure Move_Child 
  750.       (Sheet  : access Gtk_Sheet_Record; 
  751.        Widget : access Gtk.Widget.Gtk_Widget_Record'Class; 
  752.        X      : Gint; 
  753.        Y      : Gint); 
  754.    --  Move a child of the table to a specific location in pixels. 
  755.    --  A warning is printed if Widget is not already a child of Sheet. 
  756.  
  757.    function Get_Child_At 
  758.      (Sheet  : access Gtk_Sheet_Record; 
  759.       Row    : Gint; 
  760.       Col    : Gint) 
  761.       return Gtk_Sheet_Child; 
  762.    --  Return the widget associated with the cell. 
  763.  
  764.    function Get_Widget (Child : Gtk_Sheet_Child) return Gtk.Widget.Gtk_Widget; 
  765.    --  Return the widget in the child. 
  766.  
  767.    procedure Button_Attach 
  768.      (Sheet   : access Gtk_Sheet_Record; 
  769.       Widget  : access Gtk.Widget.Gtk_Widget_Record'Class; 
  770.       Row     : Gint; 
  771.       Col     : Gint); 
  772.    --  Attach a new button in the row or column title. 
  773.    --  One of Row or Col must be negative (but only one). 
  774.    --  This can be used to modify the standard buttons that appear at the top 
  775.    --  of each column, or on the left of each row. 
  776.  
  777.    ----------------------- 
  778.    -- Links / User_Data -- 
  779.    ----------------------- 
  780.    --  You can associate any kind of data with a cell, just like you 
  781.    --  can associate user_data with all the widgets. 
  782.    --  Note that this uses a generic package, which must be instantiated at 
  783.    --  library level since it has internal clean up functions. 
  784.  
  785.    generic 
  786.       --  <doc_ignore> 
  787.       type Data_Type (<>) is private; 
  788.    package Links is 
  789.       type Data_Type_Access is access all Data_Type; 
  790.       --  </doc_ignore> 
  791.  
  792.       procedure Link_Cell 
  793.         (Sheet : access Gtk_Sheet_Record'Class; 
  794.          Row   : Gint; 
  795.          Col   : Gint; 
  796.          Link  : Data_Type); 
  797.       --  Associate some user specific data with a given cell. 
  798.  
  799.       function Get_Link 
  800.         (Sheet  : access Gtk_Sheet_Record'Class; 
  801.          Row    : Gint; 
  802.          Col    : Gint) 
  803.          return  Data_Type_Access; 
  804.       --  Return the user data associated with the cell. 
  805.       --  null is returned if the cell has no user data. 
  806.  
  807.    end Links; 
  808.  
  809.    procedure Remove_Link 
  810.      (Sheet : access Gtk_Sheet_Record; 
  811.       Row   : Gint; 
  812.       Col   : Gint); 
  813.    --  Delete the user data associated with the cell. 
  814.  
  815.    ------------- 
  816.    -- Signals -- 
  817.    ------------- 
  818.  
  819.    --  <signals> 
  820.    --  The following new signals are defined for this widget: 
  821.    -- 
  822.    --  - "set_scroll_adjustments" 
  823.    --    procedure Handler (Sheet : access Gtk_Sheet_Record'Class; 
  824.    --                       Hadj  : Gtk_Adjustement; 
  825.    --                       Vadj  : Gtk_Adjustment); 
  826.    -- 
  827.    --    Emitted when the adjustments used to indicate which area of the sheet 
  828.    --    is visible are set or changed. This is not called when their value is 
  829.    --    changed, only when a new one is set. 
  830.    -- 
  831.    --  - "select_row" 
  832.    --    procedure Handler (Sheet : access Gtk_Sheet_Record'Class; 
  833.    --                       Row   : Gint); 
  834.    -- 
  835.    --    Emitted when a new row is selected. 
  836.    -- 
  837.    --  - "select_column" 
  838.    --    procedure Handler (Sheet  : access Gtk_Sheet_Record'Class; 
  839.    --                       Column : Gint); 
  840.    -- 
  841.    --    Emitted when a new column is selected. 
  842.    -- 
  843.    --  - "select_range" 
  844.    --    procedure Handler (Sheet     : access Gtk_Sheet_Record'Class; 
  845.    --                       The_Range : Gtk_Sheet_Range); 
  846.    -- 
  847.    --    Emitted when a new range of cells is selected. 
  848.    -- 
  849.    --  - "clip_range" 
  850.    --    procedure Handler (Sheet      : access Gtk_Sheet_Record'Class; 
  851.    --                       Clip_Range : Gtk_Sheet_Range); 
  852.    -- 
  853.    --    Emitted when the clip area is set to a new value. 
  854.    -- 
  855.    --  - "resize_range" 
  856.    --    procedure Handler (Sheet     : access Gtk_Sheet_Record'Class; 
  857.    --                       Old_Range : Gtk_Sheet_Range; 
  858.    --                       New_Range : Gtk_Sheet_Range); 
  859.    -- 
  860.    --    Emitted when the current range of selected cell is resized (ie new 
  861.    --    cells are added to it or removed from it). 
  862.    -- 
  863.    --  - "move_range" 
  864.    --    procedure Handler (Sheet     : access Gtk_Sheet_Record'Class; 
  865.    --                       Old_Range : Gtk_Sheet_Range; 
  866.    --                       New_Range : Gtk_Sheet_Range); 
  867.    -- 
  868.    --    Emitted when the current range of selected cell is moved (ie the 
  869.    --    top-left cell is changed, but the size is not modified). 
  870.    -- 
  871.    --  - "traverse" 
  872.    --    function Handler (Sheet      : access Gtk_Sheet_Record'Class; 
  873.    --                      Row        : Gint; 
  874.    --                      Column     : Gint; 
  875.    --                      New_Row    : Gint_Access; 
  876.    --                      New_Column : Gint_Access) 
  877.    --                     return Boolean; 
  878.    -- 
  879.    --    Emitted when the user wants to make a new cell active. The coordinates 
  880.    --    of the currently active cell are passed in (Row, Column), the 
  881.    --    coordinates of the cell that the user would like to select are 
  882.    --    passed in (New_Row, New_Column). The callback can modify the new 
  883.    --    values, and should return True if the new coordinates are accepted, 
  884.    --    False if the selection should be refused. 
  885.    -- 
  886.    --  - "deactivate" 
  887.    --    function Handler (Sheet  : access Gtk_Sheet_Record'Class; 
  888.    --                      Row    : Gint; 
  889.    --                      Column : Gint) 
  890.    --                     return Boolean; 
  891.    -- 
  892.    --    Emitted when the user wants to deactivate a specific cell. The 
  893.    --    callback should return True if the cell can be deactivated, False 
  894.    --    otherwise. See the subprogram Deactivate_Cell. 
  895.    -- 
  896.    --  - "activate" 
  897.    --    function Handler (Sheet  : access Gtk_Sheet_Record'Class; 
  898.    --                      Row    : Gint; 
  899.    --                      Column : Gint) 
  900.    --                     return Boolean; 
  901.    -- 
  902.    --    Emitted when the user wants to activate a specific cell. The 
  903.    --    callback should return True if the cell can be activated, False 
  904.    --    otherwise. See the subprogram Activate_Cell. 
  905.    -- 
  906.    --  - "set_cell" 
  907.    --    procedure Handler (Sheet  : access Gtk_Sheet_Record'Class; 
  908.    --                       Row    : Gint; 
  909.    --                       Column : Gint); 
  910.    -- 
  911.    --    Emitted from Hide_Active_Cell, when the cell is non-empty. ??? 
  912.    -- 
  913.    --  - "clear_cell" 
  914.    --    procedure Handler (Sheet  : access Gtk_Sheet_Record'Class; 
  915.    --                       Row    : Gint; 
  916.    --                       Column : Gint); 
  917.    -- 
  918.    --    Emitted when the content of the cell has been deleted (the text is 
  919.    --    now the empty string). 
  920.    -- 
  921.    --  - "changed" 
  922.    --    procedure Handler (Sheet  : access Gtk_Sheet_Record'Class; 
  923.    --                       Row    : Gint; 
  924.    --                       Column : Gint); 
  925.    -- 
  926.    --    Emitted when the content of the cell is modified (either the text 
  927.    --    itself, or its properties, alignment,...) 
  928.    --    A value of -1 for Row or Column means the row title, the column 
  929.    --    title, or their intersection. 
  930.    -- 
  931.    --  - "new_column_width" 
  932.    --    procedure Handler (Sheet  : access Gtk_Sheet_Record'Class; 
  933.    --                       Column : Gint; 
  934.    --                       Width  : Guint); 
  935.    -- 
  936.    --    Emitted whenever the width of the column is changed, either by the 
  937.    --    user or automatically if the cells should automatically resize 
  938.    --    themselves depending on their contents). 
  939.    -- 
  940.    --  - "new_row_height" 
  941.    --    procedure Handler (Sheet  : access Gtk_Sheet_Record'Class; 
  942.    --                       Row    : Gint; 
  943.    --                       Height : Guint); 
  944.    -- 
  945.    --    Emitted whenever the height of the row is changed. 
  946.    --  </signals> 
  947.  
  948. private 
  949.    type Gtk_Sheet_Record is new Gtk.Container.Gtk_Container_Record 
  950.      with null record; 
  951.    type Gtk_Sheet_Child_Record is 
  952.      new Gtk.Widget.Gtk_Widget_Record with null record; 
  953.  
  954.    pragma Import (C, Get_Type, "gtk_sheet_get_type"); 
  955.    pragma Import (C, Range_Get_Type, "gtk_sheet_range_get_type"); 
  956.  
  957.    No_Border     : constant Gtk_Sheet_Border := 0; 
  958.    Left_Border   : constant Gtk_Sheet_Border := 1; 
  959.    Right_Border  : constant Gtk_Sheet_Border := 2; 
  960.    Top_Border    : constant Gtk_Sheet_Border := 4; 
  961.    Bottom_Border : constant Gtk_Sheet_Border := 8; 
  962.    All_Borders   : constant Gtk_Sheet_Border := 15; 
  963.    pragma Convention (C, Gtk_Sheet_Range); 
  964. end Gtk.Extra.Sheet; 
  965.  
  966. --  Unbound: 
  967. --    gtk_sheet_get_entry_widget 
  968. --    gtk_sheet_get_attributes