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