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 is similar to Gtk_Clist but it displays a tree with expandable 
  29. --  nodes instead of a simple list. Gtk_Tree is a more flexible tree widget 
  30. --  (it can have arbitrary widgets in the tree cells), but it is less efficient 
  31. --  and is limited to 32768 pixels. 
  32. -- 
  33. --  If you need horizontal or vertical scrolling, you mustn't put this widget 
  34. --  in a Gtk_Viewport, and then in a Gtk_Scrolled_Window. Put it directly into 
  35. --  a Gtk_Scrolled_Window, or horizontal scrolling will be disabled, and the 
  36. --  column headers will disappear when scrolling vertically. 
  37. -- 
  38. --  </description> 
  39. --  <c_version>2.8.17</c_version> 
  40. --  <group>Obsolescent widgets</group> 
  41. --  <testgtk>create_ctree.adb</testgtk> 
  42.  
  43. with Interfaces.C.Strings; 
  44. with Unchecked_Conversion; 
  45.  
  46. with Gdk.Bitmap; 
  47. with Gdk.Color; 
  48. with Gdk.Pixmap; 
  49.  
  50. with Glib.Glist; 
  51. pragma Elaborate_All (Glib.Glist); 
  52. with Glib.Gnodes; 
  53.  
  54. pragma Warnings (Off);  --  Gtk.Clist is obsolescent 
  55. with Gtk.Clist; 
  56. pragma Warnings (On); 
  57. with Gtk.Enums;            use Gtk.Enums; 
  58. with Gtk.Style; 
  59.  
  60. with Gtkada.Types;         use Gtkada.Types; 
  61.  
  62. package Gtk.Ctree is 
  63.    pragma Obsolescent ("use Gtk.Tree_View instead"); 
  64.    pragma Elaborate_Body; 
  65.  
  66.    pragma Warnings (Off); --  Gtk.Clist is obsolescent; 
  67.    type Gtk_Ctree_Record is new Gtk.Clist.Gtk_Clist_Record with private; 
  68.    type Gtk_Ctree is access all Gtk_Ctree_Record'Class; 
  69.  
  70.    type Gtk_Ctree_Row is new Gtk.Clist.Gtk_Clist_Row; 
  71.    pragma Warnings (On); 
  72.    --  Similar to Clist_Row, but for a Ctree. 
  73.  
  74.    type Gtk_Ctree_Node is new Gdk.C_Proxy; 
  75.    --  This type represents a node inside a Ctree. 
  76.  
  77.    --  <doc_ignore> 
  78.    Null_Ctree_Node : constant Gtk_Ctree_Node := null; 
  79.  
  80.    type Gtk_Ctree_Line_Style is 
  81.      (Ctree_Lines_None, 
  82.       --  No line will be drawn in the Ctree 
  83.  
  84.       Ctree_Lines_Solid, 
  85.       --  Solid lines will be drawn 
  86.  
  87.       Ctree_Lines_Dotted, 
  88.       --  Dotted lines will be drawn 
  89.  
  90.       Ctree_Lines_Tabbed 
  91.       --  The tree won't be highlighted by lines but by tabs surrounding nodes 
  92.      ); 
  93.    pragma Convention (C, Gtk_Ctree_Line_Style); 
  94.    --  See Gtk.Ctree.Set_Line_Style for more details. 
  95.  
  96.    type Gtk_Ctree_Expander_Style is 
  97.      (Ctree_Expander_None, 
  98.       --  No pixmap will be drawn, you will have to double-click on the node to 
  99.       --  expand it. 
  100.  
  101.       Ctree_Expander_Square, 
  102.       --  The pixmap will be a square 
  103.  
  104.       Ctree_Expander_Triangle, 
  105.       --  The pixmap will be a triangle 
  106.  
  107.       Ctree_Expander_Circular 
  108.       --  The pixmap will be a circle 
  109.      ); 
  110.    --  See Gtk.Ctree.Set_Expander_Style for more details. 
  111.    pragma Convention (C, Gtk_Ctree_Expander_Style); 
  112.  
  113.    package Row_List is new Glib.Glist.Generic_List (Gtk_Ctree_Row); 
  114.  
  115.    function Convert is new Unchecked_Conversion 
  116.      (Gtk_Ctree_Node, System.Address); 
  117.    function Convert is new Unchecked_Conversion 
  118.      (System.Address, Gtk_Ctree_Node); 
  119.    package Node_List is new Glib.Glist.Generic_List (Gtk_Ctree_Node); 
  120.    --  </doc_ignore> 
  121.  
  122.    ----------------------------------- 
  123.    -- Creation, insertion, deletion -- 
  124.    ----------------------------------- 
  125.    --  Elements inside a Gtk_Ctree are not ordered from the top to the bottom 
  126.    --  as is the case for Gtk_Clist. Instead, they are put in the ctree by 
  127.    --  indicating where in the tree they should be placed. The position of an 
  128.    --  element (called a node) is defined by a parent node and a sibling node. 
  129.    --  The node will be attached in the parent subtree, on top of the sibling 
  130.    --  node. 
  131.  
  132.    procedure Gtk_New (Widget      :    out Gtk_Ctree; 
  133.                       Columns     : in     Gint; 
  134.                       Tree_Column : in     Gint := 0); 
  135.    --  Create a ctree with Columns columns. 
  136.    --  Tree_Column indicates in which column the tree will be displayed. 
  137.  
  138.    procedure Initialize (Widget      : access Gtk_Ctree_Record'Class; 
  139.                          Columns     : in     Gint; 
  140.                          Tree_Column : in     Gint := 0); 
  141.    --  Internal initialization function. 
  142.    --  See the section "Creating your own widgets" in the documentation. 
  143.  
  144.    procedure Gtk_New (Widget      :    out Gtk_Ctree; 
  145.                       Titles      : in     Chars_Ptr_Array; 
  146.                       Tree_Column : in     Gint := 0); 
  147.    --  Create a ctree with Titles'Length columns. 
  148.    --  Titles gives the title of each column. 
  149.    --  Tree_Column indicates in which column the tree will be displayed. 
  150.  
  151.    procedure Initialize (Widget      : access Gtk_Ctree_Record'Class; 
  152.                          Titles      : in     Chars_Ptr_Array; 
  153.                          Tree_Column : in     Gint := 0); 
  154.    --  Internal initialization function. 
  155.    --  See the section "Creating your own widgets" in the documentation. 
  156.  
  157.    function Get_Type return Gtk.Gtk_Type; 
  158.    --  Return the internal value associated with a Gtk_Ctree. 
  159.  
  160.    function Insert_Node (Ctree         : access Gtk_Ctree_Record; 
  161.                          Parent        : in     Gtk_Ctree_Node; 
  162.                          Sibling       : in     Gtk_Ctree_Node; 
  163.                          Text          : in     Chars_Ptr_Array; 
  164.                          Spacing       : in     Guint8; 
  165.                          Pixmap_Closed : in     Gdk.Pixmap.Gdk_Pixmap; 
  166.                          Mask_Closed   : in     Gdk.Bitmap.Gdk_Bitmap; 
  167.                          Pixmap_Opened : in     Gdk.Pixmap.Gdk_Pixmap; 
  168.                          Mask_Opened   : in     Gdk.Bitmap.Gdk_Bitmap; 
  169.                          Is_Leaf       : in     Boolean; 
  170.                          Expanded      : in     Boolean) 
  171.                          return                 Gtk_Ctree_Node; 
  172.    --  Insert a new node in the Ctree. 
  173.    --  Parent is the parent node. If null, the new node is part of the root. 
  174.    --  The new node will be inserted right on top of Sibling. If Sibling is 
  175.    --  null, then it will be the first node in the subtree. 
  176.    --  Text contains the text for each cell of the node. Note that Insert_Node 
  177.    --  expects the length of the Text parameter to be equal to the number of 
  178.    --  columns of the Ctree. 
  179.    --  Spacing is the number of pixels between the lines of the tree and the 
  180.    --  text in the same column. 
  181.    --  If Is_Leaf is True, then the node won't contain any subtree. If False, 
  182.    --  the newly created node can be used as the Parent for further node 
  183.    --  creation. In this case, Expanded indicates whether the subtree 
  184.    --  associated with this node should be initially visible. 
  185.    --  In addition to the "+" or "-" sign indicating whether the subtree is 
  186.    --  expanded or not, it is possible to put a pixmap giving this information. 
  187.    --  Pixmap_Closed and Mask_Closed represent the image and the mask used when 
  188.    --  the subtree is closed; similarly, Pixmap_Opened and Mask_Opened 
  189.    --  represent the image and the mask used when the subtree is opened. 
  190.  
  191.    procedure Remove_Node (Ctree : access Gtk_Ctree_Record; 
  192.                           Node  : in     Gtk_Ctree_Node); 
  193.    --  Remove Node from Ctree. 
  194.  
  195.    ------------------------------------------- 
  196.    -- Tree, Node and Row basic manipulation -- 
  197.    ------------------------------------------- 
  198.  
  199.    function Get_Tree_Column 
  200.      (Widget : access Gtk.Ctree.Gtk_Ctree_Record'Class) return Gint; 
  201.    --  Return the Tree_Column attribute of a given Node. 
  202.    --  Tree_Column indicates in which column the tree will be displayed. 
  203.  
  204.    function Get_Node_List 
  205.      (Ctree : access Gtk_Ctree_Record) return Node_List.Glist; 
  206.    --   Return the list of nodes associated with a given Ctree. 
  207.    --   Note: you need to extract the nodes with Node_List.Get_Gpointer. 
  208.  
  209.    function Get_Row_List 
  210.      (Ctree : access Gtk_Ctree_Record) return Row_List.Glist; 
  211.    --  Return the list of rows associated with a given Ctree. 
  212.  
  213.    function Get_Selection 
  214.      (Ctree : access Gtk_Ctree_Record) return Node_List.Glist; 
  215.    --   Return the list of nodes currently selected. 
  216.    --   Extract the nodes with Node_List.Get_Data 
  217.  
  218.    function Node_Get_Row (Node : in Gtk_Ctree_Node) return Gtk_Ctree_Row; 
  219.    --  Return the row of a given Node. 
  220.  
  221.    function Row_Get_Children (Row : in Gtk_Ctree_Row) return Gtk_Ctree_Node; 
  222.    --  Return the children node of a given Row. 
  223.  
  224.    function Row_Get_Expanded (Row : in Gtk_Ctree_Row) return Boolean; 
  225.    --  Return the expanded attribute of a given Row. 
  226.    --  Note that Expanded can also be retrieved via Get_Node_Info, 
  227.    --  this function is just a quick accessor. 
  228.  
  229.    function Row_Get_Is_Leaf (Row : in Gtk_Ctree_Row) return Boolean; 
  230.    --  Return the leaf attribute of a given Row. 
  231.    --  Note that Is_Leaf can also be retrieved via Get_Node_Info, 
  232.    --  this function is just a quick accessor. 
  233.  
  234.    function Row_Get_Parent (Row : in Gtk_Ctree_Row) return Gtk_Ctree_Node; 
  235.    --  Return the parent node of a given Row. 
  236.  
  237.    function Row_Get_Sibling (Row : in Gtk_Ctree_Row) return Gtk_Ctree_Node; 
  238.    --  Return the sibling node of a given Row. 
  239.  
  240.    function Is_Created (Node : in Gtk_Ctree_Node) return Boolean; 
  241.    --  Return True if Node is different from Null_Ctree_Node 
  242.  
  243.    ----------------------------------------- 
  244.    -- Querying / finding tree information -- 
  245.    ----------------------------------------- 
  246.  
  247.    function Is_Viewable 
  248.      (Ctree  : access Gtk_Ctree_Record; 
  249.       Node   : in     Gtk_Ctree_Node) 
  250.       return Boolean; 
  251.    --  Return True if Node is viewable. 
  252.    --  A Node is viewable if all the trees and subtrees containing it are 
  253.    --  expanded. 
  254.  
  255.    function Last 
  256.      (Ctree  : access Gtk_Ctree_Record; 
  257.       Node   : in     Gtk_Ctree_Node) 
  258.       return Gtk_Ctree_Node; 
  259.    --  Return the last node of a given subtree. 
  260.    --  Starting at Node, this function will recursively look for the last 
  261.    --  sibling of the last child. 
  262.    --  Return an empty node is Node is empty. 
  263.  
  264.    function Find_Node_Ptr 
  265.      (Ctree     : access Gtk_Ctree_Record; 
  266.       Ctree_Row : in     Gtk_Ctree_Row) 
  267.       return Gtk_Ctree_Node; 
  268.    --  Return the node corresponding to a given row. 
  269.  
  270.    function Node_Nth (Ctree  : access Gtk_Ctree_Record; 
  271.                       Row    : in     Guint) 
  272.                       return          Gtk_Ctree_Node; 
  273.    --  Return the Node corresponding to the nth row of a given Ctree. 
  274.    --  This can be used to retrieve the root node of the tree, by passing 0 for 
  275.    --  Row. 
  276.  
  277.    function Find (Ctree : access Gtk_Ctree_Record; 
  278.                   Node  : in     Gtk_Ctree_Node; 
  279.                   Child : in     Gtk_Ctree_Node) return Boolean; 
  280.    --  Recursively search for a given Child in a given subtree. 
  281.    --  the subtree is determined by Node. If Node is empty, the search will 
  282.    --  occur on the whole tree. 
  283.    --  Return True if Child is found, False otherwise. 
  284.  
  285.    function Is_Ancestor 
  286.      (Ctree  : access Gtk_Ctree_Record; 
  287.       Node   : in     Gtk_Ctree_Node; 
  288.       Child  : in     Gtk_Ctree_Node) return Boolean; 
  289.    --  Indicate whether Node is an ancestor of Child. 
  290.    --  It is assumed that Node is not empty. 
  291.  
  292.    function Is_Hot_Spot 
  293.      (Ctree  : access Gtk_Ctree_Record; 
  294.       X      : in     Gint; 
  295.       Y      : in     Gint) return Boolean; 
  296.    --  Return True if the Ctree is centered on (x,y) 
  297.  
  298.    ------------------------------------------------------ 
  299.    -- Tree signals: move, expand, collapse, (un)select -- 
  300.    ------------------------------------------------------ 
  301.  
  302.    procedure Move (Ctree       : access Gtk_Ctree_Record; 
  303.                    Node        : in     Gtk_Ctree_Node; 
  304.                    New_Parent  : in     Gtk_Ctree_Node; 
  305.                    New_Sibling : in     Gtk_Ctree_Node); 
  306.    --  Move a node in a Ctree. 
  307.    --  After its creation, a node can be moved. 
  308.    --  New_Parent points to the new parent node that will contain Node. 
  309.    --  If null, Node will be attached to the root. 
  310.    --  New_Sibling indicates under which node Node will be inserted. 
  311.    --  If New_Sibling is null, the new node will be the lowest in its branch. 
  312.  
  313.    procedure Expand (Ctree : access Gtk_Ctree_Record; 
  314.                      Node  : in     Gtk_Ctree_Node); 
  315.    --  Expand the first level of the subtree associated with Node. 
  316.  
  317.    procedure Expand_Recursive 
  318.      (Ctree : access Gtk_Ctree_Record; 
  319.       Node  : in     Gtk_Ctree_Node := null); 
  320.    --  Expand the whole subtree associated with Node. 
  321.  
  322.    procedure Expand_To_Depth 
  323.      (Ctree : access Gtk_Ctree_Record; 
  324.       Node  : in     Gtk_Ctree_Node := null; 
  325.       Depth : in     Gint); 
  326.    --  Expand the subtree associated with Node and its descendants until Depth 
  327.    --  levels of subtrees have been reached. 
  328.  
  329.    procedure Collapse (Ctree : access Gtk_Ctree_Record; 
  330.                        Node  : in     Gtk_Ctree_Node); 
  331.    --  Collapse the first level of the subtree associated with Node. 
  332.  
  333.    procedure Collapse_Recursive 
  334.      (Ctree : access Gtk_Ctree_Record; 
  335.       Node  : in     Gtk_Ctree_Node := null); 
  336.    --  Collapse the whole subtree associated with Node. 
  337.  
  338.    procedure Collapse_To_Depth 
  339.      (Ctree : access Gtk_Ctree_Record; 
  340.       Node  : in     Gtk_Ctree_Node := null; 
  341.       Depth : in     Gint); 
  342.    --  Collapse the subtree associated with Node and its descendants until 
  343.    --  Depth levels of subtrees have been reached. 
  344.  
  345.    procedure Toggle_Expansion (Ctree : access Gtk_Ctree_Record; 
  346.                                Node  : in     Gtk_Ctree_Node); 
  347.    --  Change the state of the Ctree from expanded to collapsed and the other 
  348.    --  way around on one level. 
  349.  
  350.    procedure Toggle_Expansion_Recursive (Ctree : access Gtk_Ctree_Record; 
  351.                                          Node  : in     Gtk_Ctree_Node); 
  352.    --  Change the state of the Ctree from expanded to collapsed and the other 
  353.    --  way around for the whole subtree. 
  354.  
  355.    procedure Gtk_Select (Ctree : access  Gtk_Ctree_Record; 
  356.                          Node  : in      Gtk_Ctree_Node); 
  357.    --  Select a specified Node, and only this one. 
  358.  
  359.    procedure Select_Recursive 
  360.      (Ctree : access Gtk_Ctree_Record; 
  361.       Node  : in     Gtk_Ctree_Node := null); 
  362.    --  Select a specified Node, and its whole subtree. 
  363.  
  364.    procedure Unselect (Ctree : access Gtk_Ctree_Record; 
  365.                        Node  : in     Gtk_Ctree_Node); 
  366.    --  Unselect a specified Node, and only this one. 
  367.  
  368.    procedure Unselect_Recursive 
  369.      (Ctree : access Gtk_Ctree_Record; 
  370.       Node  : in     Gtk_Ctree_Node := null); 
  371.    --  Unselect a specified Node, and its whole subtree. 
  372.  
  373.    procedure Real_Select_Recursive (Ctree     : access Gtk_Ctree_Record; 
  374.                                     Node      : in     Gtk_Ctree_Node := null; 
  375.                                     Do_Select : in     Boolean); 
  376.    --  Similar to Select_Recursive or Unselect_Recursive. 
  377.    --  If Do_Select is True, equivalent to Select_Recursive. 
  378.    --  If Do_Select is False, equivalent to Unselect_Recursive. 
  379.  
  380.    ------------------------------------ 
  381.    -- Analogs of Gtk_Clist functions -- 
  382.    ------------------------------------ 
  383.  
  384.    procedure Node_Set_Text (Ctree  : access Gtk_Ctree_Record; 
  385.                             Node   : in     Gtk_Ctree_Node; 
  386.                             Column : in     Gint; 
  387.                             Text   : in     UTF8_String); 
  388.    --  Set the cell's text, replacing its current contents. 
  389.    --  This changes the type of the cell to Cell_Text. The pixmap (if any) 
  390.    --  will no longer be displayed. 
  391.  
  392.    function Node_Get_Text (Ctree   : access Gtk_Ctree_Record; 
  393.                            Node    : in     Gtk_Ctree_Node; 
  394.                            Column  : in     Gint) return UTF8_String; 
  395.    --  Return the text contained in cell. 
  396.    --  An empty string is returned if Column is invalid or if the Cell did not 
  397.    --  contain any text (only a pixmap) 
  398.  
  399.    procedure Node_Set_Pixmap (Ctree  : access Gtk_Ctree_Record; 
  400.                               Node   : in     Gtk_Ctree_Node; 
  401.                               Column : in     Gint; 
  402.                               Pixmap : in     Gdk.Pixmap.Gdk_Pixmap; 
  403.                               Mask   : in     Gdk.Bitmap.Gdk_Bitmap); 
  404.    --  Set the cell's pixmap, replacing its current contents. 
  405.    --  The type of the cell becomes Cell_Pixmap, and the text is no longer 
  406.    --  displayed. 
  407.  
  408.    procedure Node_Get_Pixmap (Ctree   : access Gtk_Ctree_Record; 
  409.                               Node    : in     Gtk_Ctree_Node; 
  410.                               Column  : in     Gint; 
  411.                               Pixmap  :    out Gdk.Pixmap.Gdk_Pixmap; 
  412.                               Mask    :    out Gdk.Bitmap.Gdk_Bitmap; 
  413.                               Success :    out Boolean); 
  414.    --  Return the Pixmap contained in a cell. 
  415.    --  The type of the cell should be Cell_Pixmap. 
  416.    --  The result is meaningful only if Success is True. If the Cell did not 
  417.    --  contain a pixmap, Success is set to False. 
  418.  
  419.    procedure Node_Set_Pixtext (Ctree   : access Gtk_Ctree_Record; 
  420.                                Node    : in     Gtk_Ctree_Node; 
  421.                                Column  : in     Gint; 
  422.                                Text    : in     UTF8_String; 
  423.                                Spacing : in     Guint8; 
  424.                                Pixmap  : in     Gdk.Pixmap.Gdk_Pixmap; 
  425.                                Mask    : in     Gdk.Bitmap.Gdk_Bitmap); 
  426.    --  Set both the Text and the Pixmap for the cell. 
  427.    --  Replace its current contents. The type of the cell becomes Cell_Pixtext, 
  428.    --  and both the text and the pixmap are displayed. 
  429.  
  430.    procedure Node_Get_Pixtext (Ctree   : access Gtk_Ctree_Record; 
  431.                                Node    : in     Gtk_Ctree_Node; 
  432.                                Column  : in     Gint; 
  433.                                Text    :    out Interfaces.C.Strings.chars_ptr; 
  434.                                Spacing :    out Guint8; 
  435.                                Pixmap  :    out Gdk.Pixmap.Gdk_Pixmap; 
  436.                                Mask    :    out Gdk.Bitmap.Gdk_Bitmap; 
  437.                                Success :    out Boolean); 
  438.    --  Return the Text and the Pixmap for the cell. 
  439.    --  The result is not meaningful if Success is False. 
  440.  
  441.    procedure Node_Set_Shift (Ctree      : access Gtk_Ctree_Record; 
  442.                              Node       : in     Gtk_Ctree_Node; 
  443.                              Column     : in     Gint; 
  444.                              Vertical   : in     Gint; 
  445.                              Horizontal : in     Gint); 
  446.    --  Set a horizontal and vertical shift for drawing the content of the cell. 
  447.    --  Both shifts can be either positive or negative. 
  448.    --  This is particularly useful for indenting items in a columns. 
  449.  
  450.    procedure Set_Node_Info (Ctree         : access Gtk_Ctree_Record; 
  451.                             Node          : in     Gtk_Ctree_Node; 
  452.                             Text          : in     UTF8_String; 
  453.                             Spacing       : in     Guint8; 
  454.                             Pixmap_Closed : in     Gdk.Pixmap.Gdk_Pixmap; 
  455.                             Mask_Closed   : in     Gdk.Bitmap.Gdk_Bitmap; 
  456.                             Pixmap_Opened : in     Gdk.Pixmap.Gdk_Pixmap; 
  457.                             Mask_Opened   : in     Gdk.Bitmap.Gdk_Bitmap; 
  458.                             Is_Leaf       : in     Boolean; 
  459.                             Expanded      : in     Boolean); 
  460.    --  Set all the info related to a specific Node. 
  461.  
  462.    procedure Get_Node_Info 
  463.      (Ctree         : access Gtk_Ctree_Record; 
  464.       Node          : in     Gtk_Ctree_Node; 
  465.       Text          :    out Interfaces.C.Strings.chars_ptr; 
  466.       Spacing       :    out Guint8; 
  467.       Pixmap_Closed :    out Gdk.Pixmap.Gdk_Pixmap; 
  468.       Mask_Closed   :    out Gdk.Bitmap.Gdk_Bitmap; 
  469.       Pixmap_Opened :    out Gdk.Pixmap.Gdk_Pixmap; 
  470.       Mask_Opened   :    out Gdk.Bitmap.Gdk_Bitmap; 
  471.       Is_Leaf       :    out Boolean; 
  472.       Expanded      :    out Boolean; 
  473.       Success       :    out Boolean); 
  474.    --  Return all the info related to a specific Node. 
  475.  
  476.    procedure Node_Set_Selectable (Ctree      : access Gtk_Ctree_Record; 
  477.                                   Node       : in     Gtk_Ctree_Node; 
  478.                                   Selectable : in     Boolean := True); 
  479.    --  Indicate whether the Node can be selected or not. 
  480.    --  The default value is True. 
  481.  
  482.    function Node_Get_Selectable (Ctree  : access Gtk_Ctree_Record; 
  483.                                  Node   : in     Gtk_Ctree_Node) 
  484.                                  return          Boolean; 
  485.    --  Return the selectable status of the Node. 
  486.  
  487.    procedure Node_Set_Row_Style (Ctree : access Gtk_Ctree_Record; 
  488.                                  Node  : in     Gtk_Ctree_Node; 
  489.                                  Style : in     Gtk.Style.Gtk_Style); 
  490.    --  Set the default style for the cells in the Node. 
  491.    --  This can be overridden for each cell with Node_Set_Cell_Style. 
  492.  
  493.    function Node_Get_Row_Style (Ctree  : access Gtk_Ctree_Record; 
  494.                                 Node   : in     Gtk_Ctree_Node) 
  495.                                 return          Gtk.Style.Gtk_Style; 
  496.    --  Return the default style used for the Node. 
  497.  
  498.    procedure Node_Set_Cell_Style (Ctree  : access Gtk_Ctree_Record; 
  499.                                   Node   : in     Gtk_Ctree_Node; 
  500.                                   Column : in     Gint; 
  501.                                   Style  : in     Gtk.Style.Gtk_Style); 
  502.    --  Set the style (font, color, ...) used for the cell. 
  503.    --  This overrides the Node's style. 
  504.  
  505.    function Node_Get_Cell_Style (Ctree  : access Gtk_Ctree_Record; 
  506.                                  Node   : in     Gtk_Ctree_Node; 
  507.                                  Column : in     Gint) 
  508.                                  return          Gtk.Style.Gtk_Style; 
  509.    --  Return the style of the cell. 
  510.  
  511.    procedure Node_Set_Foreground (Ctree : access Gtk_Ctree_Record; 
  512.                                   Node  : in     Gtk_Ctree_Node; 
  513.                                   Color : in     Gdk.Color.Gdk_Color); 
  514.    --  Set the foreground color for the Node. 
  515.    --  The color must already be allocated. 
  516.    --  If no such Node exists in the tree, nothing is done. 
  517.  
  518.    procedure Node_Set_Background (Ctree : access Gtk_Ctree_Record; 
  519.                                   Node  : in     Gtk_Ctree_Node; 
  520.                                   Color : in     Gdk.Color.Gdk_Color); 
  521.    --  Set the background color for the Node. 
  522.    --  The color must already be allocated. 
  523.    --  If no such Node exists in the tree, nothing is done. 
  524.  
  525.    pragma Warnings (Off);  --  Gtk.Clist is obsolescent 
  526.    function Node_Get_Cell_Type (Ctree  : access Gtk_Ctree_Record; 
  527.                                 Node   : in     Gtk_Ctree_Node; 
  528.                                 Column : in     Gint) 
  529.                                 return Gtk.Clist.Gtk_Cell_Type; 
  530.    pragma Warnings (On); 
  531.    --  Return the type of the cell at Node/Column. 
  532.    --  This indicates which of the functions Node_Get_Text. Node_Get_Pixmap, 
  533.    --  etc. should be used with this cell. 
  534.  
  535.    procedure Node_Moveto (Ctree     : access Gtk_Ctree_Record; 
  536.                           Node      : in     Gtk_Ctree_Node; 
  537.                           Column    : in     Gint; 
  538.                           Row_Align : in     Gfloat := 0.5; 
  539.                           Col_Align : in     Gfloat := 0.5); 
  540.    --  Make a Node visible. 
  541.    --  Column indicates which column of the Node should be visible, if not 
  542.    --  all columns can be displayed. 
  543.    --  Row_Align and Col_Align are parameters between 0.0 and 1.0, and 
  544.    --  specify how the Node and the Column will be centered in the Ctree 
  545.    --  window. 0.0 means a Node on the top, and a Column on the left. 
  546.  
  547.    function Node_Is_Visible 
  548.      (Ctree  : access Gtk_Ctree_Record; 
  549.       Node   : in     Gtk_Ctree_Node) 
  550.       return Gtk_Visibility; 
  551.    --  Indicate the visibility of a Node. 
  552.    --  Return Visibility_None if the Node is not visible in the Ctree window; 
  553.    --  Visibility_Partial if the Node is partially visible; Visibility_Full 
  554.    --  if the Node is entirely visible. 
  555.    --  This function ignores the fact that Node is in an expanded or collapsed 
  556.    --  subtree. 
  557.  
  558.    ------------------------------ 
  559.    -- Ctree specific functions -- 
  560.    ------------------------------ 
  561.  
  562.    procedure Set_Indent (Ctree  : access Gtk_Ctree_Record; 
  563.                          Indent : in     Gint := 20); 
  564.    --  Change the indentation of the Ctree. 
  565.    --  Each different level of a subtree is indented by a number of pixels. 
  566.    --  By default, the indentation is 20 pixels, and can be changed using this 
  567.    --  procedure. 
  568.  
  569.    function Get_Indent 
  570.      (Widget : access Gtk.Ctree.Gtk_Ctree_Record'Class) return Gint; 
  571.    --  Return the indentation of a Ctree. 
  572.  
  573.    procedure Set_Spacing (Ctree   : access Gtk_Ctree_Record; 
  574.                           Spacing : in     Gint := 5); 
  575.    --  Set the spacing between the tree's icon and the additional pixmap. 
  576.    --  The additional pixmap indicates whether the subtree is opened or closed. 
  577.    --  The default value is 5 pixels. 
  578.  
  579.    function Get_Spacing 
  580.      (Widget : access Gtk.Ctree.Gtk_Ctree_Record'Class) return Gint; 
  581.    --  Return the spacing between the tree's icon and the additional pixmap. 
  582.  
  583.    procedure Set_Show_Stub (Ctree     : access Gtk_Ctree_Record; 
  584.                             Show_Stub : in     Boolean); 
  585.    --  Set the Show_Stub attribute of Ctree. 
  586.  
  587.    function Get_Show_Stub (Ctree : access Gtk_Ctree_Record) return Boolean; 
  588.    --  Return the Show_Stub attribute of Ctree. 
  589.  
  590.    procedure Set_Line_Style 
  591.      (Ctree      : access Gtk_Ctree_Record; 
  592.       Line_Style : in     Gtk_Ctree_Line_Style := Ctree_Lines_Solid); 
  593.    --  Change the style of the lines representing the tree of a given Ctree. 
  594.    --  By default, solid lines are used. 
  595.    --  See the description of Gtk_Ctree_Line_Style for more details of the 
  596.    --  possible values. 
  597.  
  598.    function Get_Line_Style 
  599.      (Ctree : access Gtk_Ctree_Record) return Gtk_Ctree_Line_Style; 
  600.    --  return the style of the lines representing the tree of a given Ctree. 
  601.  
  602.    procedure Set_Expander_Style 
  603.      (Ctree          : access Gtk_Ctree_Record; 
  604.       Expander_Style : in     Gtk_Ctree_Expander_Style := 
  605.         Ctree_Expander_Square); 
  606.    --  Set the way a given Ctree can be expanded. 
  607.    --  To expand a subtree, you can either double-click on a node, or click on 
  608.    --  the "+/-" icon. This icon is by default included in a square pixmap. 
  609.    --  This procedure can change the form of this pixmap. 
  610.    --  See the description of Gtk_Ctree_Expander_Style for more details. 
  611.  
  612.    function Get_Expander_Style 
  613.      (Ctree : access Gtk_Ctree_Record) return Gtk_Ctree_Expander_Style; 
  614.    --  Return the way a given Ctree can be expanded. 
  615.  
  616.    type Gtk_Ctree_Compare_Drag_Func is access 
  617.      function (Ctree        : in Gtk_Ctree; 
  618.                Source_Node  : in Gtk_Ctree_Node; 
  619.                New_Parent   : in Gtk_Ctree_Node; 
  620.                New_Sibling  : in Gtk_Ctree_Node) return Boolean; 
  621.    --  Function type used in Set_Drag_Compare_Func. 
  622.  
  623.    procedure Set_Drag_Compare_Func 
  624.      (Ctree    : access Gtk_Ctree_Record; 
  625.       Cmp_Func : in     Gtk_Ctree_Compare_Drag_Func); 
  626.    --  Set the drag compare function of a given Ctree. 
  627.    --  This function is used when the Ctree receives a dragged data. 
  628.  
  629.    ---------------------------- 
  630.    -- Tree sorting functions -- 
  631.    ---------------------------- 
  632.  
  633.    procedure Sort_Node (Ctree : access Gtk_Ctree_Record; 
  634.                         Node  : in     Gtk_Ctree_Node); 
  635.    --  Sort the nodes of a given Ctree. 
  636.    --  This procedure only sorts the first level of the tree. 
  637.  
  638.    procedure Sort_Recursive (Ctree : access Gtk_Ctree_Record; 
  639.                              Node  : in     Gtk_Ctree_Node := null); 
  640.    --  Sort the nodes of a given Ctree recursively. 
  641.    --  This procedure sorts the whole tree and subtrees associated with Ctree. 
  642.    --  Set Node to null if you want to sort the whole tree starting from its 
  643.    --  root. 
  644.  
  645.    -------------------------- 
  646.    -- Ctree_Gnode handling -- 
  647.    -------------------------- 
  648.  
  649.    --  <doc_ignore> 
  650.    --  This package needs to be documented ??? 
  651.  
  652.    generic 
  653.       type Data_Type (<>) is private; 
  654.    package Ctree_Gnode is 
  655.  
  656.       type Data_Type_Access is access all Data_Type; 
  657.  
  658.       type Gtk_Ctree_Gnode_Func is access 
  659.         function (Ctree : access Gtk_Ctree_Record'Class; 
  660.                   Depth : in     Guint; 
  661.                   Gnode : in     Glib.Gnodes.Gnode; 
  662.                   Cnode : in     Gtk_Ctree_Node; 
  663.                   Data  : in     Data_Type_Access) return Boolean; 
  664.  
  665.       function Export_To_Gnode (Ctree   : access Gtk_Ctree_Record'Class; 
  666.                                 Parent  : in     Glib.Gnodes.Gnode; 
  667.                                 Sibling : in     Glib.Gnodes.Gnode; 
  668.                                 Node    : in     Gtk_Ctree_Node; 
  669.                                 Func    : in     Gtk_Ctree_Gnode_Func; 
  670.                                 Data    : in     Data_Type_Access) 
  671.         return Glib.Gnodes.Gnode; 
  672.  
  673.       function Insert_Gnode (Ctree   : access Gtk_Ctree_Record'Class; 
  674.                              Parent  : in     Glib.Gnodes.Gnode; 
  675.                              Sibling : in     Glib.Gnodes.Gnode; 
  676.                              Node    : in     Gtk_Ctree_Node; 
  677.                              Func    : in     Gtk_Ctree_Gnode_Func; 
  678.                              Data    : in     Data_Type_Access) 
  679.         return Gtk_Ctree_Node; 
  680.    private 
  681.       --  <doc_ignore> 
  682.       type Ctree_Gnode_Func_Record is record 
  683.          Func : Gtk_Ctree_Gnode_Func; 
  684.          Data : Data_Type_Access; 
  685.       end record; 
  686.       type Ctree_Gnode_Func_Record_Access is 
  687.         access all Ctree_Gnode_Func_Record; 
  688.  
  689.       function C_Ctree_Gnode_Func 
  690.         (C_Ctree : System.Address; 
  691.          Depth   : Guint; 
  692.          C_Gnode : Glib.Gnodes.Gnode; 
  693.          C_Cnode : Gtk_Ctree_Node; 
  694.          C_Data  : Ctree_Gnode_Func_Record_Access) return Gboolean; 
  695.       pragma Convention (C, C_Ctree_Gnode_Func); 
  696.       --  </doc_ignore> 
  697.    end Ctree_Gnode; 
  698.  
  699.    --  </doc_ignore> 
  700.  
  701.    ----------------------- 
  702.    -- Row_Data handling -- 
  703.    ----------------------- 
  704.  
  705.    --  <doc_ignore> 
  706.    generic 
  707.       type Data_Type (<>) is private; 
  708.    package Row_Data is 
  709.  
  710.       type Data_Type_Access is access all Data_Type; 
  711.       --  </doc_ignore> 
  712.  
  713.       procedure Node_Set_Row_Data (Ctree : access Gtk_Ctree_Record'Class; 
  714.                                    Node  : in     Gtk_Ctree_Node; 
  715.                                    Data  : in     Data_Type); 
  716.       --  Associate a Data with a Node. 
  717.  
  718.       function Node_Get_Row_Data 
  719.         (Ctree : access Gtk_Ctree_Record'Class; 
  720.          Node  : in     Gtk_Ctree_Node) 
  721.          return Data_Type; 
  722.       --  Retrieve a data associated with a Node. 
  723.       --  Error Handling: 
  724.       --  Gtkada.Types.Data_Error is raised when trying to retrieve 
  725.       --  the data from a Node for which no data has been set 
  726.       --  (using Node_Set_Row_Data). 
  727.  
  728.       function Find_By_Row_Data 
  729.         (Ctree : access Gtk_Ctree_Record'Class; 
  730.          Node  : in     Gtk_Ctree_Node; 
  731.          Data  : in     Data_Type) 
  732.          return Gtk_Ctree_Node; 
  733.       --  Find the first node containing a specified Data. 
  734.       --  Node is the starting point of the search. If null, the search will 
  735.       --  start from the root. 
  736.       --  Return the first Node whose associated data is Data, null if none 
  737.       --  can be found. 
  738.  
  739.       function Find_All_By_Row_Data 
  740.         (Ctree : access Gtk_Ctree_Record'Class; 
  741.          Node  : in     Gtk_Ctree_Node; 
  742.          Data  : in     Data_Type) 
  743.          return Node_List.Glist; 
  744.       --  Find all nodes containing a specified Data. 
  745.       --  Node is the starting point of the search. If null, the search will 
  746.       --  start from the root. 
  747.  
  748.       type Gcompare_Func is access 
  749.         function (A, B : in Data_Type) return Boolean; 
  750.       --  Function used to compare data types in the functions 
  751.       --  Find_[All] By_Row_Data_Custom. 
  752.  
  753.       function Find_By_Row_Data_Custom 
  754.         (Ctree : access Gtk_Ctree_Record'Class; 
  755.          Node  : in     Gtk_Ctree_Node; 
  756.          Data  : in     Data_Type; 
  757.          Func  : in     Gcompare_Func) 
  758.          return Gtk_Ctree_Node; 
  759.       --  Find the first node containing a specified Data. 
  760.       --  Similar to Find_By_Row_Data but Func is used to allow a more flexible 
  761.       --  (user defined) method to compare two nodes. 
  762.  
  763.       function Find_All_By_Row_Data_Custom 
  764.         (Ctree : access Gtk_Ctree_Record'Class; 
  765.          Node  : in     Gtk_Ctree_Node; 
  766.          Data  : in     Data_Type; 
  767.          Func  : in     Gcompare_Func) return Node_List.Glist; 
  768.       --  Find all the nodes containing a specified Data. 
  769.       --  Similar to Find_All_By_Row_Data but Func is used to allow a more 
  770.       --  flexible (user defined) method to compare two nodes. 
  771.  
  772.       type Gtk_Ctree_Func is access 
  773.         procedure (Ctree : access Gtk_Ctree_Record'Class; 
  774.                    Node  : in     Gtk_Ctree_Node; 
  775.                    Data  : in     Data_Type_Access); 
  776.       --  Function used by Post/Pre_Recursive functions below. 
  777.  
  778.       procedure Post_Recursive (Ctree : access Gtk_Ctree_Record'Class; 
  779.                                 Node  : in     Gtk_Ctree_Node; 
  780.                                 Func  : in     Gtk_Ctree_Func; 
  781.                                 Data  : in     Data_Type_Access); 
  782.       --  Apply Func to each node of a subtree. 
  783.       --  Node designates the root of the subtree. 
  784.       --  Data will be passed as a parameter to Func. 
  785.       --  This procedure will first apply Func to the children nodes. 
  786.  
  787.       procedure Post_Recursive_To_Depth (Ctree : access Gtk_Ctree_Record'Class; 
  788.                                          Node  : in     Gtk_Ctree_Node; 
  789.                                          Depth : in     Gint; 
  790.                                          Func  : in     Gtk_Ctree_Func; 
  791.                                          Data  : in     Data_Type_Access); 
  792.       --  Apply Func to each node of a subtree until a specified Depth. 
  793.       --  Node designates the root of the subtree. 
  794.       --  Data will be passed as a parameter to Func. 
  795.       --  This function is similar to Post_Recursive except that it 
  796.       --  stop at a specified subtree depth. 
  797.  
  798.       procedure Pre_Recursive (Ctree : access Gtk_Ctree_Record'Class; 
  799.                                Node  : in     Gtk_Ctree_Node; 
  800.                                Func  : in     Gtk_Ctree_Func; 
  801.                                Data  : in     Data_Type_Access); 
  802.       --  Apply Func to each node of a subtree. 
  803.       --  Similar to Post_Recursive but will apply Func to the parent before 
  804.       --  applying it to its children. 
  805.  
  806.       procedure Pre_Recursive_To_Depth (Ctree : access Gtk_Ctree_Record'Class; 
  807.                                         Node  : in     Gtk_Ctree_Node; 
  808.                                         Depth : in     Gint; 
  809.                                         Func  : in     Gtk_Ctree_Func; 
  810.                                         Data  : in     Data_Type_Access); 
  811.       --  Apply Func to each node of a subtree until a specific Depth. 
  812.       --  Similar to Post_Recursive_To_Depth but will apply Func to the parent 
  813.       --  before applying it to its children. 
  814.  
  815.    private 
  816.  
  817.       --  <doc_ignore> 
  818.       function Default_Gcompare_Func (A, B : in Data_Type) return Boolean; 
  819.       -- 
  820.       --  This function needs to be declared in the spec, although it is 
  821.       --  only used in the body. Otherwise, the compiler does not allow 
  822.       --  to apply the 'Access attribute to it. 
  823.  
  824.       type Ctree_Func_Record is record 
  825.          Func : Gtk_Ctree_Func; 
  826.          Data : Data_Type_Access; 
  827.       end record; 
  828.       type Ctree_Func_Record_Access is access all Ctree_Func_Record; 
  829.  
  830.       procedure Free_Data (Data : Data_Type_Access); 
  831.       pragma Convention (C, Free_Data); 
  832.       --  Note that Data is *not* an in out parameter here, since Free_Data 
  833.       --  will be used as a callback, and when called, the original variable 
  834.       --  holding the pointer no longer exists. 
  835.  
  836.       procedure C_Ctree_Func (C_Ctree : in System.Address; 
  837.                               C_Node  : in Gtk_Ctree_Node; 
  838.                               C_Data  : in Ctree_Func_Record_Access); 
  839.       pragma Convention (C, C_Ctree_Func); 
  840.  
  841.       type Gcompare_Func_Record is record 
  842.          Func : Gcompare_Func; 
  843.          Data : Data_Type_Access; 
  844.       end record; 
  845.       type Gcompare_Func_Record_Access is access all Gcompare_Func_Record; 
  846.  
  847.       function C_Gcompare_Func 
  848.         (Row_Data           : in Data_Type_Access; 
  849.          Gcompare_Func_Data : in Gcompare_Func_Record_Access) return Gint; 
  850.       pragma Convention (C, C_Gcompare_Func); 
  851.       --  </doc_ignore> 
  852.  
  853.    end Row_Data; 
  854.    -- 
  855.    --  The previous package implements the Row_Data stuff. 
  856.    --  !! Warning !! No type verification is made to check if you are 
  857.    --  using the appropriate function Get. This is your own responsability 
  858.  
  859.    ---------------- 
  860.    -- Properties -- 
  861.    ---------------- 
  862.  
  863.    --  <properties> 
  864.    --  The following properties are defined for this widget. See 
  865.    --  Glib.Properties for more information on properties. 
  866.    --  </properties> 
  867.  
  868.    ------------- 
  869.    -- Signals -- 
  870.    ------------- 
  871.  
  872.    --  <signals> 
  873.    --  The following new signals are defined for this widget: 
  874.    -- 
  875.    --  - "tree_select_row" 
  876.    --    procedure Handler (Ctree  : access Gtk_Ctree_Record'Class; 
  877.    --                       Node   : Gtk_Ctree_Node; 
  878.    --                       Column : Gint); 
  879.    -- 
  880.    --    Emitted to request the selection of a node. 
  881.    --    Column is the column number where the user clicked. 
  882.    -- 
  883.    --  - "tree_unselect_row" 
  884.    --    procedure Handler (Ctree  : access Gtk_Ctree_Record'Class; 
  885.    --                       Node   : Gtk_Ctree_Node; 
  886.    --                       Column : Gint); 
  887.    -- 
  888.    --    Emitted to request the unselection of a node. 
  889.    -- 
  890.    --  - "tree_expand" 
  891.    --    procedure Handler (Ctree  : access Gtk_Clist_Record'Class; 
  892.    --                       Node   : Gtk_Ctree_Node); 
  893.    -- 
  894.    --    Emitted when the subtree associated with a Node is expanded. 
  895.    -- 
  896.    --  - "tree_collapse" 
  897.    --    procedure Handler (Ctree  : access Gtk_Clist_Record'Class; 
  898.    --                       Node   : Gtk_Ctree_Node); 
  899.    -- 
  900.    --    Emitted when the subtree associated with a Node is collapsed. 
  901.    -- 
  902.    --  - "tree_move" 
  903.    --    procedure Handler (Ctree       : access Gtk_Clist_Record'Class; 
  904.    --                       Node        : Gtk_Ctree_Node); 
  905.    --                       New_Parent  : Gtk_Ctree_Node); 
  906.    --                       New_Sibling : Gtk_Ctree_Node); 
  907.    -- 
  908.    --    Emitted when a Node is moved (e.g its parent and/or its sibling 
  909.    --    changed). 
  910.    -- 
  911.    --  </signals> 
  912.  
  913.    Signal_Change_Focus_Row_Expansion : constant Glib.Signal_Name := 
  914.                                          "change_focus_row_expansion"; 
  915.    Signal_Tree_Collapse              : constant Glib.Signal_Name := 
  916.                                          "tree_collapse"; 
  917.    Signal_Tree_Expand                : constant Glib.Signal_Name := 
  918.                                          "tree_expand"; 
  919.    Signal_Tree_Move                  : constant Glib.Signal_Name := 
  920.                                          "tree_move"; 
  921.    Signal_Tree_Select_Row            : constant Glib.Signal_Name := 
  922.                                          "tree_select_row"; 
  923.    Signal_Tree_Unselect_Row          : constant Glib.Signal_Name := 
  924.                                          "tree_unselect_row"; 
  925.  
  926. private 
  927.  
  928.    pragma Warnings (Off);  --  Gtk.Clist is obsolescent 
  929.    type Gtk_Ctree_Record is new Gtk.Clist.Gtk_Clist_Record with null record; 
  930.    pragma Warnings (On); 
  931.  
  932.    pragma Import (C, Get_Type, "gtk_ctree_get_type"); 
  933.    pragma Import (C, Node_Get_Row, "ada_ctree_node_get_row"); 
  934.    pragma Import (C, Row_Get_Children, "ada_ctree_row_get_children"); 
  935.    pragma Import (C, Row_Get_Parent, "ada_ctree_row_get_parent"); 
  936.    pragma Import (C, Row_Get_Sibling, "ada_ctree_row_get_sibling"); 
  937.  
  938. end Gtk.Ctree; 
  939.  
  940. --  These subprograms never had a binding, and are now obsolescent: 
  941. --  No binding: gtk_ctree_find_all_by_row_data 
  942. --  No binding: gtk_ctree_find_by_row_data 
  943. --  No binding: gtk_ctree_node_get_type 
  944. --  No binding: gtk_ctree_node_set_row_data