1. ----------------------------------------------------------------------- 
  2. --               GtkAda - Ada95 binding for Gtk+/Gnome               -- 
  3. --                                                                   -- 
  4. --   Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet   -- 
  5. --                Copyright (C) 2000-2007 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. --  This widget is deprecated. Use Gtk.Tree_View instead. 
  27. -- 
  28. --  This widget displays a multi-column list. Each line is made of 
  29. --  a number of column, each being able to display any kind of widget. 
  30. -- 
  31. --  The intersection of a line and a column is called a Cell. Each cell can 
  32. --  have a different type (Cell_Text, Cell_Pixmap, Cell_Pixtext), and display 
  33. --  its contents depending on this type. For instance, the text is not 
  34. --  displayed in the type is Cell_Pixmap. 
  35. --  Note that this type is changed dynamically by some of the subprograms 
  36. --  below, like Set_Pixmap, Set_Text, ... and Set_Cell_Contents 
  37. -- 
  38. --  This is one of the most powerful widgets in GtkAda, that can be used to 
  39. --  display an kind of information. Look also into using Gtk_Ctree, which is 
  40. --  a similar widget. 
  41. -- 
  42. --  You can add scrolling in a Gtk_Clist by adding it in a Gtk_Scrolled_Window. 
  43. --  </description> 
  44. --  <c_version>2.8.17</c_version> 
  45. --  <group>Obsolescent widgets</group> 
  46. --  <testgtk>create_clist.adb</testgtk> 
  47.  
  48. with Gdk.Bitmap; 
  49. with Gdk.Color; 
  50. with Gdk.Pixmap; 
  51. with Gdk.Window; 
  52. with Glib.Glist; 
  53. pragma Elaborate_All (Glib.Glist); 
  54. with Gtk.Adjustment; 
  55. with Gtk.Container; 
  56. with Gtk.Enums; 
  57. with Gtk.Style; 
  58. with Gtk.Widget; 
  59. with Gtkada.Types; 
  60. with Unchecked_Conversion; 
  61.  
  62. package Gtk.Clist is 
  63.    pragma Obsolescent ("Use Gtk.Tree_View instead"); 
  64.  
  65.    type Gtk_Clist_Record is new Gtk.Container.Gtk_Container_Record 
  66.      with private; 
  67.    type Gtk_Clist is access all Gtk_Clist_Record'Class; 
  68.  
  69.    type Gtk_Clist_Row is new Gdk.C_Proxy; 
  70.    --  A row of the clist. 
  71.    --  Application-specific data can be associated with each row. 
  72.    --  In the following subprograms, rows can also be accessed via their 
  73.    --  number, starting from 0. 
  74.  
  75.    type Gtk_Button_Action is new Guint; 
  76.    Button_Ignored : constant Gtk_Button_Action := 0; 
  77.    Button_Selects : constant Gtk_Button_Action := 1 ** 0; 
  78.    Button_Drags   : constant Gtk_Button_Action := 1 ** 1; 
  79.    Button_Expands : constant Gtk_Button_Action := 1 ** 2; 
  80.  
  81.    type Gtk_Cell_Type is 
  82.      (Cell_Empty, 
  83.       Cell_Text, 
  84.       Cell_Pixmap, 
  85.       Cell_Pixtext, 
  86.       Cell_Widget); 
  87.    pragma Convention (C, Gtk_Cell_Type); 
  88.  
  89.    type Gtk_Sort_Type is (Ascending, Descending); 
  90.    pragma Convention (C, Gtk_Sort_Type); 
  91.    --  The order in which the rows should be sorted. 
  92.  
  93.    --  <doc_ignore> 
  94.    function Convert is new Unchecked_Conversion 
  95.      (Gtk_Clist_Row, System.Address); 
  96.    function Convert is new Unchecked_Conversion 
  97.      (System.Address, Gtk_Clist_Row); 
  98.    package Row_List is new Glib.Glist.Generic_List (Gtk_Clist_Row); 
  99.  
  100.    --  </doc_ignore> 
  101.  
  102.    type Gtk_Clist_Compare_Func is access 
  103.      function 
  104.        (Clist : access Gtk_Clist_Record'Class; 
  105.         Row1  : Gtk_Clist_Row; 
  106.         Row2  : Gtk_Clist_Row) return Gint; 
  107.    --  Function used when sorting a clist. This function takes two 
  108.    --  rows as its arguments, and should return a Gint indicating in which 
  109.    --  order the rows are found (-1 if Row1 comes first, 0 if they are equal, 
  110.    --  1 if Row2 comes first). 
  111.  
  112.    ------------------------------------------------ 
  113.    -- Creating a list and setting the attributes -- 
  114.    ------------------------------------------------ 
  115.  
  116.    procedure Gtk_New (Widget : out Gtk_Clist; Columns : in Gint); 
  117.    --  Create a list with Columns columns. 
  118.    --  Each line will have this exact number of column 
  119.    --  The number of columns can not be changed once the widget has been 
  120.    --  created. 
  121.  
  122.    procedure Initialize 
  123.      (Widget : access Gtk_Clist_Record'Class; Columns : in Gint); 
  124.    --  Internal initialization function. 
  125.    --  See the section "Creating your own widgets" in the documentation. 
  126.  
  127.    procedure Gtk_New 
  128.      (Widget  : out Gtk_Clist; 
  129.       Columns : in  Gint; 
  130.       Titles  : in  Gtkada.Types.Chars_Ptr_Array); 
  131.    --  Create a new list with Columns columns. 
  132.    --  The title of the columns is specified in Titles. 
  133.    --  The results are undefined (and can raise an exception) if Titles does 
  134.    --  not have at least Columns items. 
  135.  
  136.    procedure Initialize 
  137.      (Widget  : access Gtk_Clist_Record'Class; 
  138.       Columns : in Gint; 
  139.       Titles  : in Gtkada.Types.Chars_Ptr_Array); 
  140.    --  Internal initialization function. 
  141.    --  See the section "Creating your own widgets" in the documentation. 
  142.  
  143.    function Get_Type return Gtk.Gtk_Type; 
  144.    --  Return the internal value associated with a Gtk_Clist. 
  145.  
  146.    procedure Set_Hadjustment 
  147.      (Clist      : access Gtk_Clist_Record; 
  148.       Adjustment : Gtk.Adjustment.Gtk_Adjustment); 
  149.    --  Set the horizontal adjustment used for the clist. 
  150.    --  Note that such an adjustment is automatically created when the clist 
  151.    --  is added to a Gtk_Scrolled_Window. You should rather use 
  152.    --  Gtk.Scrolled_Window.Set_Hadjustment if you want to modify the 
  153.    --  adjustment. 
  154.    --  If there was already such an adjustment, it is unref-ed, and might 
  155.    --  be deleted. 
  156.  
  157.    procedure Set_Vadjustment 
  158.      (Clist      : access Gtk_Clist_Record; 
  159.       Adjustment : Gtk.Adjustment.Gtk_Adjustment); 
  160.    --  Set the vertical adjustment used for the clist. 
  161.    --  Note that such an adjustment is automatically created when the clist 
  162.    --  is added to a Gtk_Scrolled_Window. You should rather use 
  163.    --  Gtk.Scrolled_Window.Set_Hadjustment if you want to modify the 
  164.    --  adjustment. 
  165.    --  If there was already such an adjustment, it is unref-ed, and might 
  166.    --  be deleted. 
  167.  
  168.    function Get_Hadjustment 
  169.      (Clist  : access  Gtk_Clist_Record) return Gtk.Adjustment.Gtk_Adjustment; 
  170.    --  Return the horizontal adjustment used for the clist. 
  171.    --  This indicates what position the clist is presently displaying, and 
  172.    --  by changing its value, the clist is automatically scrolled horizontally. 
  173.    --  This is done automatically when the clist's parent is a 
  174.    --  Gtk_Scrolled_Window. 
  175.  
  176.    function Get_Vadjustment 
  177.      (Clist  : access Gtk_Clist_Record) return Gtk.Adjustment.Gtk_Adjustment; 
  178.    --  Return the vertical adjustment used for the clist. 
  179.    --  This indicates what position the clist is presently displaying, and 
  180.    --  by changing its value, the clist is automatically scrolled vertically. 
  181.    --  This is done automatically when the clist's parent is a 
  182.    --  Gtk_Scrolled_Window. 
  183.  
  184.    procedure Set_Selection_Mode 
  185.      (Clist : access Gtk_Clist_Record; 
  186.       Mode  : in Gtk.Enums.Gtk_Selection_Mode); 
  187.    --  Modify the selection mode for the clist. 
  188.    --  This indicates whether one or more lines can be selected at the 
  189.    --  same time in the clist, and how this selection can done by the 
  190.    --  user (does he have to click explicitly on an item, or can he 
  191.    --  browse through the clist and select the last item he was on, etc.) 
  192.    -- 
  193.    --  Note that changing the selection mode to Selection_Single or 
  194.    --  Selection_Browse will deselect all the items in the clist. 
  195.  
  196.    function Get_Selection_Mode 
  197.      (Clist : access Gtk_Clist_Record) return Gtk.Enums.Gtk_Selection_Mode; 
  198.    --  Return the selection mode for the clist. 
  199.  
  200.    --  <doc_ignore> 
  201.    function Get_Clist_Window 
  202.      (Clist : access Gtk_Clist_Record) return Gdk.Window.Gdk_Window; 
  203.    --  Returns the scrolling window used in the clist. This function is 
  204.    --  kept for backward compatibility reasons, and you probably won't have 
  205.    --  to use it. 
  206.    --  </doc_ignore> 
  207.  
  208.    -------------------- 
  209.    -- Visual aspects -- 
  210.    -------------------- 
  211.  
  212.    procedure Freeze (Clist : access Gtk_Clist_Record); 
  213.    --  Freeze all visual updates on the list, while you make big changes. 
  214.    --  This is more efficient than working on an unfrozen list. 
  215.  
  216.    procedure Thaw (Clist : access Gtk_Clist_Record); 
  217.    --  Thaw the list, ie reactivate all the visual updates. 
  218.    --  This also forces an immediate refresh of the list. 
  219.    --  Note that each Freeze must be followed by a Thaw. The visual updates 
  220.    --  are not reactivated until the last Thaw has been emitted, but there is 
  221.    --  an immediate refresh every time anyway. 
  222.  
  223.    procedure Set_Shadow_Type 
  224.      (Clist    : access Gtk_Clist_Record; 
  225.       The_Type : in Gtk.Enums.Gtk_Shadow_Type); 
  226.    --  Set the border style of the clist. 
  227.  
  228.    ---------------------------- 
  229.    -- Modifying the contents -- 
  230.    ---------------------------- 
  231.  
  232.    function Append 
  233.      (Clist : access Gtk_Clist_Record; 
  234.       Text  : in     Gtkada.Types.Chars_Ptr_Array) return Gint; 
  235.    --  Append a new row to the clist, and return the index of the row created. 
  236.    --  The row is added at the end of the Clist. 
  237.    --  The behavior is undefined if Text does not have at least as many items 
  238.    --  as there are columns in the Clist. 
  239.  
  240.    function Prepend 
  241.      (Clist : access Gtk_Clist_Record; 
  242.       Text  : in     Gtkada.Types.Chars_Ptr_Array) return Gint; 
  243.    --  Add a new row at the beginning of the clist, and return its index. 
  244.    --  The behavior is undefined if Text does not have at least as many items 
  245.    --  as there are columns in the Clist. 
  246.  
  247.    procedure Insert 
  248.      (Clist : access Gtk_Clist_Record; 
  249.       Row   : in     Gint; 
  250.       Text  : in     Gtkada.Types.Chars_Ptr_Array); 
  251.    --  Add a new row in the clist. 
  252.    --  The row 0 is the first in the clist. If Row is not in the range for 
  253.    --  clist, the new row is added at the end. The behavior is undefined if 
  254.    --  Text does not have enough items. 
  255.  
  256.    procedure Remove (Clist : access Gtk_Clist_Record; Row : in Gint); 
  257.    --  Remove a row from the clist (0 is the first one). 
  258.  
  259.    procedure Clear (Clist : access Gtk_Clist_Record); 
  260.    --  Clears the entire list. This is much faster than doing a Remove on each 
  261.    --  line. 
  262.  
  263.    procedure Swap_Rows 
  264.      (Clist : access Gtk_Clist_Record; 
  265.       Row1  : in     Gint; 
  266.       Row2  : in     Gint); 
  267.    --  Exchange the position of two rows in the clist. 
  268.  
  269.    procedure Row_Move 
  270.      (Clist      : access Gtk_Clist_Record; 
  271.       Source_Row : in     Gint; 
  272.       Dest_Row   : in     Gint); 
  273.    --  Move the row at Source_Row to Dest_Row (0 indicates the first row in 
  274.    --  the clist) 
  275.  
  276.    procedure Set_Sort_Column 
  277.      (Clist  : access Gtk_Clist_Record; 
  278.       Column : Gint); 
  279.    --  Indicate the column on which to sort the clist. 
  280.    --  This column is relevant when you use Sort or Set_Auto_Sort below. 
  281.    --  The first column is number 0. 
  282.  
  283.    function Get_Sort_Column (Clist : access Gtk_Clist_Record) return Gint; 
  284.    --  Return the column on which the clist is sorted. 
  285.  
  286.    procedure Set_Sort_Type 
  287.      (Clist     : access Gtk_Clist_Record; 
  288.       Sort_Type : Gtk_Sort_Type); 
  289.    --  Indicate in which order the sort should be done on the clist 
  290.    --  (ascending or descending). 
  291.  
  292.    function Get_Sort_Type 
  293.      (Clist : access Gtk_Clist_Record) return Gtk_Sort_Type; 
  294.    --  Return the sort type currently used for the list 
  295.  
  296.    procedure Sort (Clist : access Gtk_Clist_Record); 
  297.    --  Sort the lines of the clist, based on the column set by Set_Sort_Column, 
  298.    --  and in the order set by Set_Sort_Type. 
  299.  
  300.    procedure Set_Auto_Sort 
  301.      (Clist     : access Gtk_Clist_Record; 
  302.       Auto_Sort : Boolean); 
  303.    --  If Auto_Sort is true, then the clist will be automatically sorted every 
  304.    --  time a new line is inserted into the clist. 
  305.  
  306.    procedure Set_Compare_Func 
  307.      (Clist : access Gtk_Clist_Record; 
  308.       Func  : Gtk_Clist_Compare_Func); 
  309.    --  Set the function used when sorting the list. This function takes two 
  310.    --  rows as its arguments, and should return a Gint indicating in which 
  311.    --  order the rows are found (-1 if Row1 comes first, 0 if they are equal, 
  312.    --  1 if Row2 comes last). 
  313.    --  Func should be null to restore the default sorting functions. 
  314.  
  315.    ------------- 
  316.    -- Columns -- 
  317.    ------------- 
  318.  
  319.    function Get_Columns (Clist : access Gtk_Clist_Record) return Gint; 
  320.    --  Return the number of columns in the clist. 
  321.  
  322.    procedure Column_Titles_Hide (Clist : access Gtk_Clist_Record); 
  323.    --  Hide the column titles for the list. 
  324.    --  This is the default behavior if no column titles were given when the 
  325.    --  list was created. 
  326.  
  327.    procedure Column_Titles_Show (Clist : access Gtk_Clist_Record); 
  328.    --  Show the column titles for the list. 
  329.    --  This is the default behavior if some column titles were given when the 
  330.    --  list was created. 
  331.  
  332.    procedure Column_Title_Active 
  333.      (Clist : access Gtk_Clist_Record; 
  334.       Column : in Gint); 
  335.    --  Set the column title to be an activate title. 
  336.    --  In other words, answer all button presses, highlights when the mouse is 
  337.    --  over it, ... 
  338.  
  339.    procedure Column_Title_Passive 
  340.      (Clist : access Gtk_Clist_Record; 
  341.       Column : in Gint); 
  342.    --  Set the column title to be passive. 
  343.    --  Act just as a title, and do not react to mouse events. 
  344.  
  345.    procedure Column_Titles_Active (Clist : access Gtk_Clist_Record); 
  346.    --  Set all column titles to be active. 
  347.  
  348.    procedure Column_Titles_Passive (Clist : access Gtk_Clist_Record); 
  349.    --  Set all column titles to be passive. 
  350.  
  351.    procedure Set_Column_Title 
  352.      (Clist  : access Gtk_Clist_Record; 
  353.       Column : in Gint; 
  354.       Title  : in UTF8_String); 
  355.    --  Set the text for the button of the column's title. 
  356.    --  See Set_Column_Widget if you want to put a pixmap inside the button. 
  357.  
  358.    function Get_Column_Title 
  359.      (Clist  : access Gtk_Clist_Record; 
  360.       Column : in Gint) return UTF8_String; 
  361.    --  Return the text used for the title's column. 
  362.    --  This is a copy of the title, so you can't modify it to automatically 
  363.    --  change the column's title. 
  364.  
  365.    procedure Set_Column_Widget 
  366.      (Clist  : access Gtk_Clist_Record; 
  367.       Column : in     Gint; 
  368.       Widget : access Gtk.Widget.Gtk_Widget_Record'Class); 
  369.    --  Modify the widget used in the Gtk_Button that is the column's title. 
  370.    --  By default, this button contains a simple Gtk_Label, which is replaced 
  371.    --  by Widget. This is the function to use if you want to put a pixmap 
  372.    --  (or a Gtk_Box that contains both a pixmap and some text) in a column's 
  373.    --  title. 
  374.  
  375.    function Get_Column_Widget 
  376.      (Clist  : access Gtk_Clist_Record; 
  377.       Column : in Gint) return Gtk.Widget.Gtk_Widget; 
  378.    --  Return the child of the button that makes the column's title. 
  379.    --  Unless you changed it with Set_Column_Widget, this will return a 
  380.    --  Gtk_Label. Note also that if this widget was not created in Ada, but 
  381.    --  transparently by gtk+, you have to 'with' Gtk.Type_Conversion so that 
  382.    --  the correct type of the widget is created (See the user's guide for 
  383.    --  more information on type conversion). 
  384.  
  385.    procedure Set_Column_Justification 
  386.      (Clist         : access Gtk_Clist_Record; 
  387.       Column        : in Gint; 
  388.       Justification : in Gtk.Enums.Gtk_Justification); 
  389.    --  Change the way the text in the whole column is justified. 
  390.    --  This function has no effect on the title if you used Set_Column_Widget 
  391.    --  before. 
  392.  
  393.    procedure Set_Column_Visibility 
  394.      (Clist   : access Gtk_Clist_Record; 
  395.       Column  : in Gint; 
  396.       Visible : in Boolean); 
  397.    --  Modify the visibility of a column. 
  398.    --  Note that GtkAda prevents the last remaining visible column to be 
  399.    --  hidden. Nothing will be done if you try to hide that last column. 
  400.    --  See the example below for an example how to hide all the columns but 
  401.    --  one. 
  402.  
  403.    procedure Set_Column_Resizeable 
  404.      (Clist    : access Gtk_Clist_Record; 
  405.       Column   : in Gint; 
  406.       Resizeable : in Boolean); 
  407.    --  Set whether the column can be dynamically resized with the mouse. 
  408.    --  If Resizeable is true, then the column can be resized by clicking 
  409.    --  and dragging the lines that separates the column from the next one. 
  410.  
  411.    procedure Set_Column_Auto_Resize 
  412.      (Clist       : access Gtk_Clist_Record; 
  413.       Column      : in Gint; 
  414.       Auto_Resize : in Boolean); 
  415.    --  Set whether the column should automatically be resized to the optimal 
  416.    --  size (based on its contents). Note that this operation could slow things 
  417.    --  down a lot if you have a lot of items in your list. 
  418.  
  419.    function Columns_Autosize (Clist  : access Gtk_Clist_Record) return Gint; 
  420.    --  Set all the columns' width to their optimal size. 
  421.    --  Return the total width of the clist after this operation. 
  422.  
  423.    function Optimal_Column_Width 
  424.      (Clist : access Gtk_Clist_Record; 
  425.       Column : Gint) return Gint; 
  426.    --  Return the optimal width for Column, based on its contents. 
  427.    --  This is the maximal cell width in the column. 
  428.  
  429.    procedure Set_Column_Width 
  430.      (Clist  : access Gtk_Clist_Record; 
  431.       Column : in Gint; 
  432.       Width  : in Gint); 
  433.    --  Set the column width in pixels. 
  434.    --  By default, the column's width is chosen from the column's title. 
  435.  
  436.    procedure Set_Column_Min_Width 
  437.      (Clist     : access Gtk_Clist_Record; 
  438.       Column    : Gint; 
  439.       Min_Width : Gint); 
  440.    --  Set the minimal width for the column, in pixels. 
  441.    --  if Min_Width is negative, there is no limit on the minimal width for 
  442.    --  the column. 
  443.  
  444.    procedure Set_Column_Max_Width 
  445.      (Clist     : access Gtk_Clist_Record; 
  446.       Column    : Gint; 
  447.       Max_Width : Gint); 
  448.    --  Set the maximal width for the column, in pixels. 
  449.    --  If Max_Width is negative, there is no limit on the maximal width for 
  450.    --  the column. 
  451.  
  452.    ---------- 
  453.    -- Rows -- 
  454.    ---------- 
  455.  
  456.    function Get_Rows (Clist : access Gtk_Clist_Record) return Gint; 
  457.    --  Return the number of rows in the clist. 
  458.  
  459.    procedure Set_Row_Height 
  460.      (Clist  : access Gtk_Clist_Record; 
  461.       Height : Gint); 
  462.    --  Set the height of the rows, in pixels. 
  463.    --  if Height is 0, the chosen height will be the current's font height. 
  464.  
  465.    function Row_Is_Visible 
  466.      (Clist : access Gtk_Clist_Record; 
  467.       Row   : in Gint) return Gtk.Enums.Gtk_Visibility; 
  468.    --  Return the visibility status of the row. 
  469.  
  470.    procedure Set_Foreground 
  471.      (Clist : access Gtk_Clist_Record; 
  472.       Row   : in Gint; 
  473.       Color : in Gdk.Color.Gdk_Color); 
  474.    --  Set the foreground color for the row. 
  475.    --  The color must already be allocated. 
  476.    --  If no such row exists in the list, nothing is done. 
  477.  
  478.    procedure Set_Background 
  479.      (Clist : access Gtk_Clist_Record; 
  480.       Row   : in Gint; 
  481.       Color : in Gdk.Color.Gdk_Color); 
  482.    --  Set the background color for the row. 
  483.    --  The color must already be allocated. 
  484.    --  If no such row exists in the list, nothing is done. 
  485.  
  486.    procedure Set_Row_Style 
  487.      (Clist : access Gtk_Clist_Record; Row : Gint; 
  488.       Style : in Gtk.Style.Gtk_Style); 
  489.    --  Set the default style for the cells in the row. This can be 
  490.    --  overridden for each cell with Set_Cell_Style. 
  491.  
  492.    function Get_Row_Style 
  493.      (Clist  : access Gtk_Clist_Record; 
  494.       Row    : in     Gint) return Gtk.Style.Gtk_Style; 
  495.    --  Return the default style used for the row. 
  496.  
  497.    procedure Set_Selectable 
  498.      (Clist      : access Gtk_Clist_Record; 
  499.       Row        : Gint; 
  500.       Selectable : Boolean); 
  501.    --  Indicate whether the row can be selected or not. 
  502.    --  The default value is True. 
  503.  
  504.    function Get_Selectable 
  505.      (Clist : access Gtk_Clist_Record; 
  506.       Row   : Gint) return Boolean; 
  507.    --  Return the selectable status of the row. 
  508.  
  509.    procedure Select_Row 
  510.      (Clist  : access Gtk_Clist_Record; 
  511.       Row    : in Gint; 
  512.       Column : in Gint); 
  513.    --  Emit the signal "select_row". This simulates the user pressing 
  514.    --  the mouse on Row, Column on the clist. 
  515.  
  516.    procedure Unselect_Row 
  517.      (Clist  : access Gtk_Clist_Record; 
  518.       Row    : in Gint; 
  519.       Column : in Gint); 
  520.    --  Emit the signal "unselect_row", as if the user had clicked on 
  521.    --  Row, Column on the clist. 
  522.  
  523.    procedure Undo_Selection (Clist  : access Gtk_Clist_Record); 
  524.    --  Undo the last select/unselect operation. 
  525.  
  526.    procedure Get_Selection_Info 
  527.      (Clist    : access Gtk_Clist_Record; 
  528.       X        : in Gint; 
  529.       Y        : in Gint; 
  530.       Row      : out Gint; 
  531.       Column   : out Gint; 
  532.       Is_Valid : out Boolean); 
  533.    --  Return the Row/Column corresponding to the coordinates X,Y in the 
  534.    --  Row column. The coordinates X,Y are relative to the clist window 
  535.    --  (ie 0,0 is the top left corner of the clist). 
  536.    --  The result is valid only if Is_Valid is true 
  537.  
  538.    procedure Select_All (Clist : access Gtk_Clist_Record); 
  539.    --  Select all the rows in the clist. This only works if the selection 
  540.    --  mode allows for multiple rows selected at the same time (extended or 
  541.    --  multiple). 
  542.  
  543.    procedure Unselect_All (Clist : access Gtk_Clist_Record); 
  544.    --  Deselect all the rows in the clist. If the selection mode is 
  545.    --  Browse, then only the current line is deselected. 
  546.  
  547.    function Get_Focus_Row (Clist : access Gtk_Clist_Record) return Gint; 
  548.    --  Return the number of the line that currently has the focus. 
  549.  
  550.    function Get_Row_List 
  551.      (Clist : access Gtk_Clist_Record) return Row_List.Glist; 
  552.    --  Return the list of all the rows in the clist. This might speed up 
  553.    --  the access to the rows a little. 
  554.    --  You can then use the function Set_Cell_Contents to modify the cells 
  555.    --  in the row, and Get_Text or Get_Pixmap to get its contents. 
  556.  
  557.    function Get_Selection 
  558.      (Widget : access Gtk_Clist_Record) return Gtk.Enums.Gint_List.Glist; 
  559.    --  Return the list of selected rows, by number. 
  560.  
  561.    ----------- 
  562.    -- Cells -- 
  563.    ----------- 
  564.  
  565.    function Get_Cell_Type 
  566.      (Clist  : access Gtk_Clist_Record; 
  567.       Row    : in Gint; 
  568.       Column : in Gint) return Gtk_Cell_Type; 
  569.    --  Return the type of the cell at Row/Column. 
  570.    --  This indicates which of the functions Get_Text. Get_Pixmap, etc. 
  571.    --  below you can use. 
  572.  
  573.    procedure Set_Text 
  574.      (Clist  : access Gtk_Clist_Record; 
  575.       Row    : in Gint; 
  576.       Column : in Gint; 
  577.       Text   : in UTF8_String); 
  578.    --  Set the cell's text, replacing its current contents. 
  579.    --  This changes the type of the cell to Cell_Text. The pixmap (if any) 
  580.    --  will no longer be displayed. 
  581.  
  582.    function Get_Text 
  583.      (Clist    : access Gtk_Clist_Record; 
  584.       Row      : in Gint; 
  585.       Column   : in Gint) return UTF8_String; 
  586.    --  Return the text contained in cell. The type of the cell should be 
  587.    --  either Cell_Text or Cell_Pixtext. 
  588.    --  If there was a problem, a null-length string is returned. 
  589.    --  The problem might appear in case the row or the column are 
  590.    --  invalid, or if the cell does not contain any text. 
  591.  
  592.    function Get_Text 
  593.      (Clist    : access Gtk_Clist_Record; 
  594.       Row      : Gtk_Clist_Row; 
  595.       Column   : in Gint) return UTF8_String; 
  596.    --  Return the text contained in cell. The Row can be obtained from 
  597.    --  Get_Row_List, this function speeds up the access a little compared 
  598.    --  to the other Get_Text above. 
  599.  
  600.    procedure Set_Pixmap 
  601.      (Clist  : access Gtk_Clist_Record; 
  602.       Row    : in Gint; 
  603.       Column : in Gint; 
  604.       Pixmap : in Gdk.Pixmap.Gdk_Pixmap; 
  605.       Mask   : in Gdk.Bitmap.Gdk_Bitmap); 
  606.    --  Set the cell's pixmap, replacing its current contents. 
  607.    --  The type of the cell becomes Cell_Pixmap, and the text is no longer 
  608.    --  displayed. 
  609.  
  610.    procedure Get_Pixmap 
  611.      (Clist    : access Gtk_Clist_Record; 
  612.       Row      : in Gint; 
  613.       Column   : in Gint; 
  614.       Pixmap   : out Gdk.Pixmap.Gdk_Pixmap; 
  615.       Mask     : out Gdk.Bitmap.Gdk_Bitmap; 
  616.       Is_Valid : out Boolean); 
  617.    --  Return the pixmap contained in a cell. The type of the cell should 
  618.    --  be Cell_Pixmap. 
  619.    --  The result is meaningful only if Is_Valid is True. If the Cell did not 
  620.    --  contain a pixmap, Is_Valid is set to False 
  621.  
  622.    procedure Get_Pixmap 
  623.      (Clist    : access Gtk_Clist_Record; 
  624.       Row      : in Gtk_Clist_Row; 
  625.       Column   : in Gint; 
  626.       Pixmap   : out Gdk.Pixmap.Gdk_Pixmap; 
  627.       Mask     : out Gdk.Bitmap.Gdk_Bitmap; 
  628.       Is_Valid : out Boolean); 
  629.    --  Return the pixmap contained in a cell. Row can be obtained directly with 
  630.    --  Get_Row_List, and speeds up the access a little compared to the previous 
  631.    --  Get_Pixmap function. 
  632.  
  633.    procedure Set_Pixtext 
  634.      (Clist   : access Gtk_Clist_Record; 
  635.       Row     : in Gint; 
  636.       Column  : in Gint; 
  637.       Text    : in UTF8_String; 
  638.       Spacing : in Guint8; 
  639.       Pixmap  : in Gdk.Pixmap.Gdk_Pixmap; 
  640.       Mask    : in Gdk.Bitmap.Gdk_Bitmap); 
  641.    --  Set both the text and the pixmap for the cell. 
  642.    --  Replace its current contents. The type of the cell becomes Cell_Pixtext, 
  643.    --  and both the text and the pixmap are displayed. 
  644.  
  645.    procedure Get_Pixtext 
  646.      (Clist    : access Gtk_Clist_Record; 
  647.       Row      : in Gint; 
  648.       Column   : in Gint; 
  649.       Spacing  : out Guint8; 
  650.       Pixmap   : out Gdk.Pixmap.Gdk_Pixmap; 
  651.       Mask     : out Gdk.Bitmap.Gdk_Bitmap; 
  652.       Is_Valid : out Boolean); 
  653.    --  The result is not meaningful if Is_Valid is False. 
  654.    --  The only way to get the string is to use Get_Text, since a String is 
  655.    --  an unconstrained type in Ada and is not really convenient to use as an 
  656.    --  out parameter. 
  657.  
  658.    procedure Set_Cell_Style 
  659.      (Clist  : access Gtk_Clist_Record; 
  660.       Row    : in Gint; 
  661.       Column : in Gint; 
  662.       Style  : in Gtk.Style.Gtk_Style); 
  663.    --  Set the style (font, color, ...) used for the cell. 
  664.    --  This overrides the row's style. 
  665.  
  666.    function Get_Cell_Style 
  667.      (Clist  : access Gtk_Clist_Record; 
  668.       Row    : in     Gint; 
  669.       Column : in     Gint) return Gtk.Style.Gtk_Style; 
  670.    --  Return the style of the cell. 
  671.  
  672.    procedure Set_Shift 
  673.      (Clist      : access Gtk_Clist_Record; 
  674.       Row        : in Gint; 
  675.       Column     : in Gint; 
  676.       Vertical   : in Gint; 
  677.       Horizontal : in Gint); 
  678.    --  Set a horizontal and vertical shift for drawing the content of the cell. 
  679.    --  Both shifts can be either positive or negative. 
  680.    --  This is particularly useful for indenting items in a columns. 
  681.  
  682.    procedure Set_Cell_Contents 
  683.      (Clist     : access Gtk_Clist_Record; 
  684.       Row       : Gtk_Clist_Row; 
  685.       Column    : Gint; 
  686.       Cell_Type : Gtk_Cell_Type; 
  687.       Text      : UTF8_String; 
  688.       Spacing   : Guint8; 
  689.       Pixmap    : Gdk.Pixmap.Gdk_Pixmap; 
  690.       Mask      : Gdk.Bitmap.Gdk_Bitmap); 
  691.    --  Modify the contents and type of a cell. 
  692.    --  Cell_Type indicates what should be displayed in the cell. Note that 
  693.    --  if you do not want any string, you should pass an empty string "". 
  694.    --  You get Row from Get_Row_List. 
  695.  
  696.    ------------------------- 
  697.    -- Reordering the list -- 
  698.    ------------------------- 
  699.  
  700.    procedure Set_Reorderable 
  701.      (Clist : access Gtk_Clist_Record; Reorderable : Boolean); 
  702.    --  Set whether the list can be dynamically reordered by the user. 
  703.    --  (using a simple drag-n-drop protocol). 
  704.  
  705.    procedure Set_Use_Drag_Icons 
  706.      (Clist : access Gtk_Clist_Record; Use_Icons : Boolean); 
  707.    --  Set whether drag icons are shown while the user is reordering the list. 
  708.    --  The default value is True. 
  709.  
  710.    procedure Set_Button_Actions 
  711.      (Clist         : access Gtk_Clist_Record; 
  712.       Button        : Guint; 
  713.       Button_Action : Gtk_Button_Action); 
  714.    --  Set the action for a specific button on the list. 
  715.    --  The default if for the left mouse button to select or drag and item, 
  716.    --  the other buttons are ignored. 
  717.    --  The Button_Expands action has no effect on a clist. 
  718.  
  719.    procedure Moveto 
  720.      (Clist     : access Gtk_Clist_Record; 
  721.       Row       : in Gint; 
  722.       Column    : in Gint; 
  723.       Row_Align : in Gfloat; 
  724.       Col_Align : in Gfloat); 
  725.    --  Scroll the list so that Row/Column is visible. 
  726.    --  If Row is -1, the clist is not scrolled vertically. 
  727.    --  If Column is -1, the clist is not scrolled horizontally. 
  728.    --  The new location of Row/Column depends on the value of Row_Align and 
  729.    --  Col_Align (from 0.0x0.0 (top-left) to 1.0x1.0 (bottom-right), all 
  730.    --  intermediate values are possible). 
  731.  
  732.    --------------- 
  733.    -- Row_Data -- 
  734.    --------------- 
  735.    --  You can associate one private data with each row in the clist. If you 
  736.    --  want to store multiple values, you should create a record type that 
  737.    --  contains all the values, and associate with value with the relevant 
  738.    --  line in the clist. 
  739.    --  This package is the equivalent of Gtk.Widget.User_Data for the Clists. 
  740.    -- 
  741.    --  This is your responsibility to use the Get and Set functions from the 
  742.    --  same generic package. However, you can use different packages for 
  743.    --  different lines (although this will definitely make things harder to 
  744.    --  use!) 
  745.    -- 
  746.    --  Note also that an internal copy of the Data is done, therefore the 
  747.    --  "find" functions found in gtk+ have no equivalent in GtkAda, although it 
  748.    --  would be enough to write one by iterating over the Row numbers. 
  749.  
  750.    generic 
  751.       --  <doc_ignore> 
  752.       type Data_Type (<>) is private; 
  753.       --  </doc_ignore> 
  754.    package Row_Data is 
  755.       function Get 
  756.         (Object : access Gtk_Clist_Record'Class; 
  757.          Row    : in     Gint) return Data_Type; 
  758.       --  Get the data associated to a specific row. 
  759.  
  760.       function Get 
  761.         (Object : access Gtk_Clist_Record'Class; 
  762.          Row    : in     Gtk_Clist_Row) return Data_Type; 
  763.       --  Same as above, but acts directly on a row obtained through 
  764.       --  Get_Row_List. This is faster for big lists. 
  765.  
  766.       procedure Set 
  767.         (Object : access Gtk_Clist_Record'Class; 
  768.          Row    : in Gint; 
  769.          Data   : in Data_Type); 
  770.       --  Modify the data associated with a row 
  771.  
  772.       procedure Set 
  773.         (Object : access Gtk_Clist_Record'Class; 
  774.          Row    : in Gtk_Clist_Row; 
  775.          Data   : in Data_Type); 
  776.       --  Same as above but acts directly on a row obtained through 
  777.       --  Get_Row_List. This is faster for big lists. 
  778.  
  779.    private 
  780.       --  <doc_ignore> 
  781.       procedure Free_Data (Data : System.Address); 
  782.       --  Free memory associated with Data 
  783.       pragma Convention (C, Free_Data); 
  784.       --  </doc_ignore> 
  785.    end Row_Data; 
  786.  
  787.    --  <doc_ignore> 
  788.    procedure Set_Show_Titles (Clist : access Gtk_Clist_Record; Show : Boolean); 
  789.    --  If show is true, call Column_Titles_Show. Do nothing otherwise. 
  790.    --  This procedure is primarily used by Gate generated code. 
  791.    --  </doc_ignore> 
  792.  
  793.    ---------------- 
  794.    -- Properties -- 
  795.    ---------------- 
  796.  
  797.    --  <properties> 
  798.    --  The following properties are defined for this widget. See 
  799.    --  Glib.Properties for more information on properties. 
  800.    -- 
  801.    --  </properties> 
  802.  
  803.    ------------- 
  804.    -- Signals -- 
  805.    ------------- 
  806.  
  807.    --  <signals> 
  808.    --  The following new signals are defined for this widget: 
  809.    -- 
  810.    --  - "select_row" 
  811.    --    procedure Handler (Clist  : access Gtk_Clist_Record'Class; 
  812.    --                       Row    : Gint; 
  813.    --                       Column : Gint; 
  814.    --                       Event  : Gdk.Event.Gdk_Event); 
  815.    -- 
  816.    --    Emitted when a row is selected. Column contains the column number in 
  817.    --    which the user has clicked, or -1 if the selection was done internally 
  818.    --    by GtkAda. 
  819.    --    Event will be null if the selection was not triggered by an event, eg 
  820.    --    if the row was selected through a call to Select_Row. 
  821.    -- 
  822.    --  - "unselect_row" 
  823.    --    procedure Handler (Clist  : access Gtk_Clist_Record'Class; 
  824.    --                       Row    : Gint; 
  825.    --                       Column : Gint; 
  826.    --                       Event  : Gdk.Event.Gdk_Event); 
  827.    -- 
  828.    --    Emitted to request the unselection of a row. Event will be null most 
  829.    --    of the time when the event is emitted directly by GtkAda. You should 
  830.    --    use Unselect_Row instead. 
  831.    -- 
  832.    --  - "row_move" 
  833.    --    procedure Handler (Clist      : access Gtk_Clist_Record'Class; 
  834.    --                       Source_Row : Gint; 
  835.    --                       Dest_Row   : Gint); 
  836.    -- 
  837.    --    Emitted to request the change of a Source_Row to Dest_Row. You should 
  838.    --    use Row_Move instead. 
  839.    -- 
  840.    --  - "click_column" 
  841.    --    procedure Handler (Clist  : access Gtk_Clist_Record'Class; 
  842.    --                       Column : Gint); 
  843.    -- 
  844.    --    Emitted when the user has clicked on one of the buttons at the top 
  845.    --    of a column. The first column has number 0. 
  846.    -- 
  847.    --  - "resize_column" 
  848.    --    procedure Handler (Clist  : access Gtk_Clist_Record'Class; 
  849.    --                       Column : Gint; 
  850.    --                       Width  : Gint); 
  851.    -- 
  852.    --    Emitted to request a new size for a given column. You should use 
  853.    --    Set_Column_Width instead. 
  854.    -- 
  855.    --  - "toggle_focus_row" 
  856.    --    procedure Handler (Clist  : access Gtk_Clist_Record'Class); 
  857.    -- 
  858.    --    Emitted to request the change of the selection status (selected/ 
  859.    --    unselected) of the focus row. This signal is not emitted internally 
  860.    --    by GtkAda. 
  861.    -- 
  862.    --  - "select_all" 
  863.    --    procedure Handler (Clist  : access Gtk_Clist_Record'Class); 
  864.    -- 
  865.    --    Emitted to request the selection of all the rows in the Clist, if the 
  866.    --    selection mode allows. You should use Select_All instead. 
  867.    -- 
  868.    --  - "unselect_all" 
  869.    --    procedure Handler (Clist  : access Gtk_Clist_Record'Class); 
  870.    -- 
  871.    --    Emitted to request the unselection of all the rows in the Clist, if 
  872.    --    the selection mode is different from Browse. You should use 
  873.    --    Unselect_All instead. 
  874.    -- 
  875.    --  - "undo_selection" 
  876.    --    procedure Handler (Clist  : access Gtk_Clist_Record'Class); 
  877.    -- 
  878.    --    Emitted to request the cancellation of the last select/unselect 
  879.    --    operation. You should use Undo_Selection instead. 
  880.    -- 
  881.    --  - "start_selection" 
  882.    --    procedure Handler (Clist  : access Gtk_Clist_Record'Class); 
  883.    -- 
  884.    --    Request the start of the selection. This signal is not emitted 
  885.    --    internally by GtkAda, but acts as if the user had clicked on the 
  886.    --    focus row (the exact visual modification depends on the selection 
  887.    --    mode). 
  888.    -- 
  889.    --  - "end_selection" 
  890.    --    procedure Handler (Clist  : access Gtk_Clist_Record'Class); 
  891.    -- 
  892.    --    Ends the current selection process. This is never emitted internally 
  893.    --    by GtkAda, but acts as if the user had just released the mouse button. 
  894.    -- 
  895.    --  - "toggle_add_mode" 
  896.    --    procedure Handler (Clist  : access Gtk_Clist_Record'Class); 
  897.    -- 
  898.    --    Changes the add_mode for the clist (indicates whether the next line 
  899.    --    clicked on will be added to the selection or will replace it). 
  900.    --    This is never emitted internally by GtkAda. 
  901.    -- 
  902.    --  - "extend_selection" 
  903.    --    procedure Handler (Clist       : access Gtk_Clist_Record'Class; 
  904.    --                       Scroll_Type : Gtk.Enums.Gtk_Scroll_Type; 
  905.    --                       Position    : Gfloat; 
  906.    --                       Auto_Start_Selection : Boolean); 
  907.    -- 
  908.    --    Extends the current selection. Position is used only for certain 
  909.    --    values of Scroll_Type. It is never emitted internally by GtkAda. It 
  910.    --    has no effect if the selection mode is not Extended. 
  911.    -- 
  912.    --  - "scroll_vertical" 
  913.    --    procedure Handler (Clist       : access Gtk_Clist_Record'Class; 
  914.    --                       Scroll_Type : Gtk.Enums.Gtk_Scroll_Type; 
  915.    --                       Position    : Gfloat); 
  916.    -- 
  917.    --    Scrolls the clist vertically. This also modifies the selection. 
  918.    --    It is never emitted internally by GtkAda. You should consider using 
  919.    --    Moveto instead. 
  920.    -- 
  921.    --  - "scroll_horizontal" 
  922.    --    procedure Handler (Clist       : access Gtk_Clist_Record'Class; 
  923.    --                       Scroll_Type : Gtk.Enums.Gtk_Scroll_Type; 
  924.    --                       Position    : Gfloat); 
  925.    -- 
  926.    --    Scrolls the clist horizontally. This also modifies the selection. 
  927.    --    It is never emitted internally by GtkAda. You should consider using 
  928.    --    Moveto instead. 
  929.    -- 
  930.    --  - "abort_column_resize" 
  931.    --    procedure Handler (Clist       : access Gtk_Clist_Record'Class); 
  932.    -- 
  933.    --    Aborts the current interactive resizing of the column by the user. 
  934.    --    This releases the grab done on the pointer. It is never emitted 
  935.    --    internally by GtkAda. 
  936.    -- 
  937.    --  </signals> 
  938.  
  939.    Signal_Abort_Column_Resize    : constant Glib.Signal_Name := 
  940.                                      "abort_column_resize"; 
  941.    Signal_Click_Column           : constant Glib.Signal_Name := 
  942.                                      "click_column"; 
  943.    Signal_End_Selection          : constant Glib.Signal_Name := 
  944.                                      "end_selection"; 
  945.    Signal_Extend_Selection       : constant Glib.Signal_Name := 
  946.                                      "extend_selection"; 
  947.    Signal_Resize_Column          : constant Glib.Signal_Name := 
  948.                                      "resize_column"; 
  949.    Signal_Row_Move               : constant Glib.Signal_Name := 
  950.                                      "row_move"; 
  951.    Signal_Scroll_Horizontal      : constant Glib.Signal_Name := 
  952.                                      "scroll_horizontal"; 
  953.    Signal_Scroll_Vertical        : constant Glib.Signal_Name := 
  954.                                      "scroll_vertical"; 
  955.    Signal_Select_All             : constant Glib.Signal_Name := 
  956.                                      "select_all"; 
  957.    Signal_Select_Row             : constant Glib.Signal_Name := 
  958.                                      "select_row"; 
  959.    Signal_Set_Scroll_Adjustments : constant Glib.Signal_Name := 
  960.                                      "set_scroll_adjustments"; 
  961.    Signal_Start_Selection        : constant Glib.Signal_Name := 
  962.                                      "start_selection"; 
  963.    Signal_Toggle_Add_Mode        : constant Glib.Signal_Name := 
  964.                                      "toggle_add_mode"; 
  965.    Signal_Toggle_Focus_Row       : constant Glib.Signal_Name := 
  966.                                      "toggle_focus_row"; 
  967.    Signal_Undo_Selection         : constant Glib.Signal_Name := 
  968.                                      "undo_selection"; 
  969.    Signal_Unselect_All           : constant Glib.Signal_Name := 
  970.                                      "unselect_all"; 
  971.    Signal_Unselect_Row           : constant Glib.Signal_Name := 
  972.                                      "unselect_row"; 
  973.  
  974. private 
  975.    type Gtk_Clist_Record is new Gtk.Container.Gtk_Container_Record with record 
  976.       Sort_Func : Gtk_Clist_Compare_Func := null; 
  977.    end record; 
  978.  
  979.    pragma Import (C, Get_Type, "gtk_clist_get_type"); 
  980. end Gtk.Clist; 
  981.  
  982. --  <example> 
  983. --  <include>../examples/documentation/clist.adb</include> 
  984. --  </example> 
  985.  
  986. --  The following subprograms never had a binding, and are now obsolescent: 
  987. --  No binding: gtk_clist_find_row_from_data 
  988. --  No binding: gtk_clist_set_row_data