1. ------------------------------------------------------------------------------ 
  2. --                                                                          -- 
  3. --      Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet       -- 
  4. --                     Copyright (C) 2000-2014, AdaCore                     -- 
  5. --                                                                          -- 
  6. -- This library is free software;  you can redistribute it and/or modify it -- 
  7. -- under terms of the  GNU General Public License  as published by the Free -- 
  8. -- Software  Foundation;  either version 3,  or (at your  option) any later -- 
  9. -- version. This library is distributed in the hope that it will be useful, -- 
  10. -- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- -- 
  11. -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.                            -- 
  12. --                                                                          -- 
  13. -- As a special exception under Section 7 of GPL version 3, you are granted -- 
  14. -- additional permissions described in the GCC Runtime Library Exception,   -- 
  15. -- version 3.1, as published by the Free Software Foundation.               -- 
  16. --                                                                          -- 
  17. -- You should have received a copy of the GNU General Public License and    -- 
  18. -- a copy of the GCC Runtime Library Exception along with this program;     -- 
  19. -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    -- 
  20. -- <http://www.gnu.org/licenses/>.                                          -- 
  21. --                                                                          -- 
  22. ------------------------------------------------------------------------------ 
  23.  
  24. --  <description> 
  25. --  A Gtk.Tree_Model_Filter.Gtk_Tree_Model_Filter is a tree model which wraps 
  26. --  another tree model, and can do the following things: 
  27. -- 
  28. --     * Filter specific rows, based on data from a "visible column", a column 
  29. --  storing booleans indicating whether the row should be filtered or not, or 
  30. --  based on the return value of a "visible function", which gets a model, iter 
  31. --  and user_data and returns a boolean indicating whether the row should be 
  32. --  filtered or not. 
  33. -- 
  34. --     * Modify the "appearance" of the model, using a modify function. This 
  35. --  is extremely powerful and allows for just changing some values and also for 
  36. --  creating a completely different model based on the given child model. 
  37. -- 
  38. --     * Set a different root node, also known as a "virtual root". You can 
  39. --  pass in a Gtk.Tree_Model.Gtk_Tree_Path indicating the root node for the 
  40. --  filter at construction time. 
  41. -- 
  42. --  The basic API is similar to Gtk.Tree_Model_Sort.Gtk_Tree_Model_Sort. For 
  43. --  an example on its usage, see the section on 
  44. --  Gtk.Tree_Model_Sort.Gtk_Tree_Model_Sort. 
  45. -- 
  46. --  When using Gtk.Tree_Model_Filter.Gtk_Tree_Model_Filter, it is important to 
  47. --  realize that Gtk.Tree_Model_Filter.Gtk_Tree_Model_Filter maintains an 
  48. --  internal cache of all nodes which are visible in its clients. The cache is 
  49. --  likely to be a subtree of the tree exposed by the child model. 
  50. --  Gtk.Tree_Model_Filter.Gtk_Tree_Model_Filter will not cache the entire child 
  51. --  model when unnecessary to not compromise the caching mechanism that is 
  52. --  exposed by the reference counting scheme. If the child model implements 
  53. --  reference counting, unnecessary signals may not be emitted because of 
  54. --  reference counting rule 3, see the Gtk.Tree_Model.Gtk_Tree_Model 
  55. --  documentation. (Note that e.g. Gtk.Tree_Store.Gtk_Tree_Store does not 
  56. --  implement reference counting and will always emit all signals, even when 
  57. --  the receiving node is not visible). 
  58. -- 
  59. --  Because of this, limitations for possible visible functions do apply. In 
  60. --  general, visible functions should only use data or properties from the node 
  61. --  for which the visibility state must be determined, its siblings or its 
  62. --  parents. Usually, having a dependency on the state of any child node is not 
  63. --  possible, unless references are taken on these explicitly. When no such 
  64. --  reference exists, no signals may be received for these child nodes (see 
  65. --  reference couting rule number 3 in the Gtk.Tree_Model.Gtk_Tree_Model 
  66. --  section). 
  67. -- 
  68. --  Determining the visibility state of a given node based on the state of its 
  69. --  child nodes is a frequently occurring use case. Therefore, 
  70. --  Gtk.Tree_Model_Filter.Gtk_Tree_Model_Filter explicitly supports this. For 
  71. --  example, when a node does not have any children, you might not want the 
  72. --  node to be visible. As soon as the first row is added to the node's child 
  73. --  level (or the last row removed), the node's visibility should be updated. 
  74. -- 
  75. --  This introduces a dependency from the node on its child nodes. In order to 
  76. --  accommodate this, Gtk.Tree_Model_Filter.Gtk_Tree_Model_Filter must make 
  77. --  sure the necesary signals are received from the child model. This is 
  78. --  achieved by building, for all nodes which are exposed as visible nodes to 
  79. --  Gtk.Tree_Model_Filter.Gtk_Tree_Model_Filter's clients, the child level (if 
  80. --  any) and take a reference on the first node in this level. Furthermore, for 
  81. --  every row-inserted, row-changed or row-deleted signal (also these which 
  82. --  were not handled because the node was not cached), 
  83. --  Gtk.Tree_Model_Filter.Gtk_Tree_Model_Filter will check if the visibility 
  84. --  state of any parent node has changed. 
  85. -- 
  86. --  Beware, however, that this explicit support is limited to these two cases. 
  87. --  For example, if you want a node to be visible only if two nodes in a 
  88. --  child's child level (2 levels deeper) are visible, you are on your own. In 
  89. --  this case, either rely on Gtk.Tree_Store.Gtk_Tree_Store to emit all signals 
  90. --  because it does not implement reference counting, or for models that do 
  91. --  implement reference counting, obtain references on these child levels 
  92. --  yourself. 
  93. -- 
  94. --  </description> 
  95. pragma Ada_2005; 
  96.  
  97. pragma Warnings (Off, "*is already use-visible*"); 
  98. with Glib;                 use Glib; 
  99. with Glib.Properties;      use Glib.Properties; 
  100. with Glib.Types;           use Glib.Types; 
  101. with Glib.Values;          use Glib.Values; 
  102. with Gtk.Selection_Data;   use Gtk.Selection_Data; 
  103. with Gtk.Tree_Drag_Source; use Gtk.Tree_Drag_Source; 
  104. with Gtk.Tree_Model;       use Gtk.Tree_Model; 
  105.  
  106. package Gtk.Tree_Model_Filter is 
  107.  
  108.    type Gtk_Tree_Model_Filter_Record is new Gtk_Root_Tree_Model_Record with null record; 
  109.    type Gtk_Tree_Model_Filter is access all Gtk_Tree_Model_Filter_Record'Class; 
  110.  
  111.    --------------- 
  112.    -- Callbacks -- 
  113.    --------------- 
  114.  
  115.    type Gtk_Tree_Model_Filter_Modify_Func is access procedure 
  116.      (Model  : Gtk.Tree_Model.Gtk_Tree_Model; 
  117.       Iter   : Gtk.Tree_Model.Gtk_Tree_Iter; 
  118.       Value  : in out Glib.Values.GValue; 
  119.       Column : Gint); 
  120.    --  A function which calculates display values from raw values in the 
  121.    --  model. It must fill Value with the display value for the column Column 
  122.    --  in the row indicated by Iter. 
  123.    --  Since this function is called for each data access, it's not a 
  124.    --  particularly efficient operation. 
  125.    --  "model": the Gtk.Tree_Model_Filter.Gtk_Tree_Model_Filter 
  126.    --  "iter": a Gtk.Tree_Model.Gtk_Tree_Iter pointing to the row whose 
  127.    --  display values are determined 
  128.    --  "value": A Glib.Values.GValue which is already initialized for with the 
  129.    --  correct type for the column Column. 
  130.    --  "column": the column whose display value is determined 
  131.  
  132.    type Gtk_Tree_Model_Filter_Visible_Func is access function 
  133.      (Model : Gtk.Tree_Model.Gtk_Tree_Model; 
  134.       Iter  : Gtk.Tree_Model.Gtk_Tree_Iter) return Boolean; 
  135.    --  A function which decides whether the row indicated by Iter is visible. 
  136.    --  "model": the child model of the 
  137.    --  Gtk.Tree_Model_Filter.Gtk_Tree_Model_Filter 
  138.    --  "iter": a Gtk.Tree_Model.Gtk_Tree_Iter pointing to the row in Model 
  139.    --  whose visibility is determined 
  140.  
  141.    type Gtk_Tree_Model_Foreach_Func is access function 
  142.      (Model : Gtk.Tree_Model.Gtk_Tree_Model; 
  143.       Path  : Gtk.Tree_Model.Gtk_Tree_Path; 
  144.       Iter  : Gtk.Tree_Model.Gtk_Tree_Iter) return Boolean; 
  145.    --  Type of the callback passed to Gtk.Tree_Model.Foreach to iterate over 
  146.    --  the rows in a tree model. 
  147.    --  "model": the Gtk.Tree_Model.Gtk_Tree_Model being iterated 
  148.    --  "path": the current Gtk.Tree_Model.Gtk_Tree_Path 
  149.    --  "iter": the current Gtk.Tree_Model.Gtk_Tree_Iter 
  150.  
  151.    ------------------ 
  152.    -- Constructors -- 
  153.    ------------------ 
  154.  
  155.    procedure Gtk_New 
  156.       (Self        : out Gtk_Tree_Model_Filter; 
  157.        Child_Model : Gtk.Tree_Model.Gtk_Tree_Model; 
  158.        Root        : Gtk.Tree_Model.Gtk_Tree_Path := Null_Gtk_Tree_Path); 
  159.    procedure Initialize 
  160.       (Self        : not null access Gtk_Tree_Model_Filter_Record'Class; 
  161.        Child_Model : Gtk.Tree_Model.Gtk_Tree_Model; 
  162.        Root        : Gtk.Tree_Model.Gtk_Tree_Path := Null_Gtk_Tree_Path); 
  163.    --  Creates a new Gtk.Tree_Model.Gtk_Tree_Model, with Child_Model as the 
  164.    --  child_model and Root as the virtual root. 
  165.    --  Since: gtk+ 2.4 
  166.    --  "child_model": A Gtk.Tree_Model.Gtk_Tree_Model. 
  167.    --  "root": A Gtk.Tree_Model.Gtk_Tree_Path or null. 
  168.  
  169.    function Gtk_Tree_Model_Filter_Filter_New 
  170.       (Child_Model : Gtk.Tree_Model.Gtk_Tree_Model; 
  171.        Root        : Gtk.Tree_Model.Gtk_Tree_Path := Null_Gtk_Tree_Path) 
  172.        return Gtk_Tree_Model_Filter; 
  173.    --  Creates a new Gtk.Tree_Model.Gtk_Tree_Model, with Child_Model as the 
  174.    --  child_model and Root as the virtual root. 
  175.    --  Since: gtk+ 2.4 
  176.    --  "child_model": A Gtk.Tree_Model.Gtk_Tree_Model. 
  177.    --  "root": A Gtk.Tree_Model.Gtk_Tree_Path or null. 
  178.  
  179.    function Get_Type return Glib.GType; 
  180.    pragma Import (C, Get_Type, "gtk_tree_model_filter_get_type"); 
  181.  
  182.    ------------- 
  183.    -- Methods -- 
  184.    ------------- 
  185.  
  186.    procedure Clear_Cache 
  187.       (Self : not null access Gtk_Tree_Model_Filter_Record); 
  188.    --  This function should almost never be called. It clears the Filter of 
  189.    --  any cached iterators that haven't been reffed with 
  190.    --  Gtk.Tree_Model.Ref_Node. This might be useful if the child model being 
  191.    --  filtered is static (and doesn't change often) and there has been a lot 
  192.    --  of unreffed access to nodes. As a side effect of this function, all 
  193.    --  unreffed iters will be invalid. 
  194.    --  Since: gtk+ 2.4 
  195.  
  196.    procedure Convert_Child_Iter_To_Iter 
  197.       (Self        : not null access Gtk_Tree_Model_Filter_Record; 
  198.        Filter_Iter : out Gtk.Tree_Model.Gtk_Tree_Iter; 
  199.        Child_Iter  : Gtk.Tree_Model.Gtk_Tree_Iter); 
  200.    --  Sets Filter_Iter to point to the row in Filter that corresponds to the 
  201.    --  row pointed at by Child_Iter. If Filter_Iter was not set, False is 
  202.    --  returned. 
  203.    --  Since: gtk+ 2.4 
  204.    --  "filter_iter": An uninitialized Gtk.Tree_Model.Gtk_Tree_Iter. 
  205.    --  "child_iter": A valid Gtk.Tree_Model.Gtk_Tree_Iter pointing to a row on 
  206.    --  the child model. 
  207.  
  208.    function Convert_Child_Path_To_Path 
  209.       (Self       : not null access Gtk_Tree_Model_Filter_Record; 
  210.        Child_Path : Gtk.Tree_Model.Gtk_Tree_Path) 
  211.        return Gtk.Tree_Model.Gtk_Tree_Path; 
  212.    --  Converts Child_Path to a path relative to Filter. That is, Child_Path 
  213.    --  points to a path in the child model. The rerturned path will point to 
  214.    --  the same row in the filtered model. If Child_Path isn't a valid path on 
  215.    --  the child model or points to a row which is not visible in Filter, then 
  216.    --  null is returned. 
  217.    --  Since: gtk+ 2.4 
  218.    --  "child_path": A Gtk.Tree_Model.Gtk_Tree_Path to convert. 
  219.  
  220.    procedure Convert_Iter_To_Child_Iter 
  221.       (Self        : not null access Gtk_Tree_Model_Filter_Record; 
  222.        Child_Iter  : out Gtk.Tree_Model.Gtk_Tree_Iter; 
  223.        Filter_Iter : Gtk.Tree_Model.Gtk_Tree_Iter); 
  224.    --  Sets Child_Iter to point to the row pointed to by Filter_Iter. 
  225.    --  Since: gtk+ 2.4 
  226.    --  "child_iter": An uninitialized Gtk.Tree_Model.Gtk_Tree_Iter. 
  227.    --  "filter_iter": A valid Gtk.Tree_Model.Gtk_Tree_Iter pointing to a row 
  228.    --  on Filter. 
  229.  
  230.    function Convert_Path_To_Child_Path 
  231.       (Self        : not null access Gtk_Tree_Model_Filter_Record; 
  232.        Filter_Path : Gtk.Tree_Model.Gtk_Tree_Path) 
  233.        return Gtk.Tree_Model.Gtk_Tree_Path; 
  234.    --  Converts Filter_Path to a path on the child model of Filter. That is, 
  235.    --  Filter_Path points to a location in Filter. The returned path will point 
  236.    --  to the same location in the model not being filtered. If Filter_Path 
  237.    --  does not point to a location in the child model, null is returned. 
  238.    --  Since: gtk+ 2.4 
  239.    --  "filter_path": A Gtk.Tree_Model.Gtk_Tree_Path to convert. 
  240.  
  241.    function Get_Model 
  242.       (Self : not null access Gtk_Tree_Model_Filter_Record) 
  243.        return Gtk.Tree_Model.Gtk_Tree_Model; 
  244.    --  Returns a pointer to the child model of Filter. 
  245.    --  Since: gtk+ 2.4 
  246.  
  247.    procedure Refilter (Self : not null access Gtk_Tree_Model_Filter_Record); 
  248.    --  Emits ::row_changed for each row in the child model, which causes the 
  249.    --  filter to re-evaluate whether a row is visible or not. 
  250.    --  Since: gtk+ 2.4 
  251.  
  252.    procedure Set_Modify_Func 
  253.       (Self  : not null access Gtk_Tree_Model_Filter_Record; 
  254.        Types : Glib.GType_Array; 
  255.        Func  : Gtk_Tree_Model_Filter_Modify_Func); 
  256.    --  With the N_Columns and Types parameters, you give an array of column 
  257.    --  types for this model (which will be exposed to the parent model/view). 
  258.    --  The Func, Data and Destroy parameters are for specifying the modify 
  259.    --  function. The modify function will get called for *each* data access, 
  260.    --  the goal of the modify function is to return the data which should be 
  261.    --  displayed at the location specified using the parameters of the modify 
  262.    --  function. 
  263.    --  Since: gtk+ 2.4 
  264.    --  "types": The GType<!-- -->s of the columns. 
  265.    --  "func": A Gtk_Tree_Model_Filter_Modify_Func 
  266.  
  267.    generic 
  268.       type User_Data_Type (<>) is private; 
  269.       with procedure Destroy (Data : in out User_Data_Type) is null; 
  270.    package Set_Modify_Func_User_Data is 
  271.  
  272.       type Gtk_Tree_Model_Filter_Modify_Func is access procedure 
  273.         (Model  : Gtk.Tree_Model.Gtk_Tree_Model; 
  274.          Iter   : Gtk.Tree_Model.Gtk_Tree_Iter; 
  275.          Value  : in out Glib.Values.GValue; 
  276.          Column : Gint; 
  277.          Data   : User_Data_Type); 
  278.       --  A function which calculates display values from raw values in the 
  279.       --  model. It must fill Value with the display value for the column Column 
  280.       --  in the row indicated by Iter. 
  281.       --  Since this function is called for each data access, it's not a 
  282.       --  particularly efficient operation. 
  283.       --  "model": the Gtk.Tree_Model_Filter.Gtk_Tree_Model_Filter 
  284.       --  "iter": a Gtk.Tree_Model.Gtk_Tree_Iter pointing to the row whose 
  285.       --  display values are determined 
  286.       --  "value": A Glib.Values.GValue which is already initialized for with the 
  287.       --  correct type for the column Column. 
  288.       --  "column": the column whose display value is determined 
  289.       --  "data": user data given to Gtk.Tree_Model_Filter.Set_Modify_Func 
  290.  
  291.       procedure Set_Modify_Func 
  292.          (Self  : not null access Gtk.Tree_Model_Filter.Gtk_Tree_Model_Filter_Record'Class; 
  293.           Types : Glib.GType_Array; 
  294.           Func  : Gtk_Tree_Model_Filter_Modify_Func; 
  295.           Data  : User_Data_Type); 
  296.       --  With the N_Columns and Types parameters, you give an array of column 
  297.       --  types for this model (which will be exposed to the parent 
  298.       --  model/view). The Func, Data and Destroy parameters are for specifying 
  299.       --  the modify function. The modify function will get called for *each* 
  300.       --  data access, the goal of the modify function is to return the data 
  301.       --  which should be displayed at the location specified using the 
  302.       --  parameters of the modify function. 
  303.       --  Since: gtk+ 2.4 
  304.       --  "types": The GType<!-- -->s of the columns. 
  305.       --  "func": A Gtk_Tree_Model_Filter_Modify_Func 
  306.       --  "data": User data to pass to the modify function, or null. 
  307.  
  308.    end Set_Modify_Func_User_Data; 
  309.  
  310.    procedure Set_Visible_Column 
  311.       (Self   : not null access Gtk_Tree_Model_Filter_Record; 
  312.        Column : Gint); 
  313.    --  Sets Column of the child_model to be the column where Filter should 
  314.    --  look for visibility information. Columns should be a column of type 
  315.    --  G_TYPE_BOOLEAN, where True means that a row is visible, and False if 
  316.    --  not. 
  317.    --  Since: gtk+ 2.4 
  318.    --  "column": A Gint which is the column containing the visible 
  319.    --  information. 
  320.  
  321.    procedure Set_Visible_Func 
  322.       (Self : not null access Gtk_Tree_Model_Filter_Record; 
  323.        Func : Gtk_Tree_Model_Filter_Visible_Func); 
  324.    --  Sets the visible function used when filtering the Filter to be Func. 
  325.    --  The function should return True if the given row should be visible and 
  326.    --  False otherwise. 
  327.    --  If the condition calculated by the function changes over time (e.g. 
  328.    --  because it depends on some global parameters), you must call 
  329.    --  Gtk.Tree_Model_Filter.Refilter to keep the visibility information of the 
  330.    --  model uptodate. 
  331.    --  Note that Func is called whenever a row is inserted, when it may still 
  332.    --  be empty. The visible function should therefore take special care of 
  333.    --  empty rows, like in the example below. 
  334.    --    static gboolean 
  335.    --    visible_func (GtkTreeModel *model, 
  336.    --       GtkTreeIter  *iter, 
  337.    --       gpointer      data) 
  338.    --    { 
  339.    --       /* Visible if row is non-empty and first column is "HI" */ 
  340.    --       gchar *str; 
  341.    --       gboolean visible = FALSE; 
  342.    --       gtk_tree_model_get (model, iter, 0, &str, -1); 
  343.    --       if (str && strcmp (str, "HI") == 0) 
  344.    --       visible = TRUE; 
  345.    --       g_free (str); 
  346.    --       return visible; 
  347.    --    } 
  348.    --  Since: gtk+ 2.4 
  349.    --  "func": A Gtk_Tree_Model_Filter_Visible_Func, the visible function. 
  350.  
  351.    generic 
  352.       type User_Data_Type (<>) is private; 
  353.       with procedure Destroy (Data : in out User_Data_Type) is null; 
  354.    package Set_Visible_Func_User_Data is 
  355.  
  356.       type Gtk_Tree_Model_Filter_Visible_Func is access function 
  357.         (Model : Gtk.Tree_Model.Gtk_Tree_Model; 
  358.          Iter  : Gtk.Tree_Model.Gtk_Tree_Iter; 
  359.          Data  : User_Data_Type) return Boolean; 
  360.       --  A function which decides whether the row indicated by Iter is visible. 
  361.       --  "model": the child model of the 
  362.       --  Gtk.Tree_Model_Filter.Gtk_Tree_Model_Filter 
  363.       --  "iter": a Gtk.Tree_Model.Gtk_Tree_Iter pointing to the row in Model 
  364.       --  whose visibility is determined 
  365.       --  "data": user data given to Gtk.Tree_Model_Filter.Set_Visible_Func 
  366.  
  367.       procedure Set_Visible_Func 
  368.          (Self : not null access Gtk.Tree_Model_Filter.Gtk_Tree_Model_Filter_Record'Class; 
  369.           Func : Gtk_Tree_Model_Filter_Visible_Func; 
  370.           Data : User_Data_Type); 
  371.       --  Sets the visible function used when filtering the Filter to be Func. 
  372.       --  The function should return True if the given row should be visible 
  373.       --  and False otherwise. 
  374.       --  If the condition calculated by the function changes over time (e.g. 
  375.       --  because it depends on some global parameters), you must call 
  376.       --  Gtk.Tree_Model_Filter.Refilter to keep the visibility information of 
  377.       --  the model uptodate. 
  378.       --  Note that Func is called whenever a row is inserted, when it may 
  379.       --  still be empty. The visible function should therefore take special 
  380.       --  care of empty rows, like in the example below. 
  381.       --    static gboolean 
  382.       --    visible_func (GtkTreeModel *model, 
  383.       --       GtkTreeIter  *iter, 
  384.       --       gpointer      data) 
  385.       --    { 
  386.       --       /* Visible if row is non-empty and first column is "HI" */ 
  387.       --       gchar *str; 
  388.       --       gboolean visible = FALSE; 
  389.       --       gtk_tree_model_get (model, iter, 0, &str, -1); 
  390.       --       if (str && strcmp (str, "HI") == 0) 
  391.       --       visible = TRUE; 
  392.       --       g_free (str); 
  393.       --       return visible; 
  394.       --    } 
  395.       --  Since: gtk+ 2.4 
  396.       --  "func": A Gtk_Tree_Model_Filter_Visible_Func, the visible function. 
  397.       --  "data": User data to pass to the visible function, or null. 
  398.  
  399.    end Set_Visible_Func_User_Data; 
  400.  
  401.    procedure Foreach 
  402.       (Tree_Model : not null access Gtk_Tree_Model_Filter_Record; 
  403.        Func       : Gtk_Tree_Model_Foreach_Func); 
  404.    --  Calls func on each node in model in a depth-first fashion. 
  405.    --  If Func returns True, then the tree ceases to be walked, and 
  406.    --  Gtk.Tree_Model.Foreach returns. 
  407.    --  "func": a function to be called on each row 
  408.  
  409.    generic 
  410.       type User_Data_Type (<>) is private; 
  411.       with procedure Destroy (Data : in out User_Data_Type) is null; 
  412.    package Foreach_User_Data is 
  413.  
  414.       type Gtk_Tree_Model_Foreach_Func is access function 
  415.         (Model : Gtk.Tree_Model.Gtk_Tree_Model; 
  416.          Path  : Gtk.Tree_Model.Gtk_Tree_Path; 
  417.          Iter  : Gtk.Tree_Model.Gtk_Tree_Iter; 
  418.          Data  : User_Data_Type) return Boolean; 
  419.       --  Type of the callback passed to Gtk.Tree_Model.Foreach to iterate over 
  420.       --  the rows in a tree model. 
  421.       --  "model": the Gtk.Tree_Model.Gtk_Tree_Model being iterated 
  422.       --  "path": the current Gtk.Tree_Model.Gtk_Tree_Path 
  423.       --  "iter": the current Gtk.Tree_Model.Gtk_Tree_Iter 
  424.       --  "data": The user data passed to Gtk.Tree_Model.Foreach 
  425.  
  426.       procedure Foreach 
  427.          (Tree_Model : not null access Gtk.Tree_Model_Filter.Gtk_Tree_Model_Filter_Record'Class; 
  428.           Func       : Gtk_Tree_Model_Foreach_Func; 
  429.           User_Data  : User_Data_Type); 
  430.       --  Calls func on each node in model in a depth-first fashion. 
  431.       --  If Func returns True, then the tree ceases to be walked, and 
  432.       --  Gtk.Tree_Model.Foreach returns. 
  433.       --  "func": a function to be called on each row 
  434.       --  "user_data": user data to passed to Func 
  435.  
  436.    end Foreach_User_Data; 
  437.  
  438.    --------------------------------------------- 
  439.    -- Inherited subprograms (from interfaces) -- 
  440.    --------------------------------------------- 
  441.  
  442.    function Drag_Data_Delete 
  443.       (Self : not null access Gtk_Tree_Model_Filter_Record; 
  444.        Path : Gtk.Tree_Model.Gtk_Tree_Path) return Boolean; 
  445.  
  446.    function Drag_Data_Get 
  447.       (Self           : not null access Gtk_Tree_Model_Filter_Record; 
  448.        Path           : Gtk.Tree_Model.Gtk_Tree_Path; 
  449.        Selection_Data : Gtk.Selection_Data.Gtk_Selection_Data) 
  450.        return Boolean; 
  451.  
  452.    function Row_Draggable 
  453.       (Self : not null access Gtk_Tree_Model_Filter_Record; 
  454.        Path : Gtk.Tree_Model.Gtk_Tree_Path) return Boolean; 
  455.  
  456.    function Get_Column_Type 
  457.       (Tree_Model : not null access Gtk_Tree_Model_Filter_Record; 
  458.        Index      : Gint) return GType; 
  459.  
  460.    function Get_Flags 
  461.       (Tree_Model : not null access Gtk_Tree_Model_Filter_Record) 
  462.        return Gtk.Tree_Model.Tree_Model_Flags; 
  463.  
  464.    function Get_Iter 
  465.       (Tree_Model : not null access Gtk_Tree_Model_Filter_Record; 
  466.        Path       : Gtk.Tree_Model.Gtk_Tree_Path) 
  467.        return Gtk.Tree_Model.Gtk_Tree_Iter; 
  468.  
  469.    function Get_Iter_First 
  470.       (Tree_Model : not null access Gtk_Tree_Model_Filter_Record) 
  471.        return Gtk.Tree_Model.Gtk_Tree_Iter; 
  472.  
  473.    function Get_Iter_From_String 
  474.       (Tree_Model  : not null access Gtk_Tree_Model_Filter_Record; 
  475.        Path_String : UTF8_String) return Gtk.Tree_Model.Gtk_Tree_Iter; 
  476.  
  477.    function Get_N_Columns 
  478.       (Tree_Model : not null access Gtk_Tree_Model_Filter_Record) 
  479.        return Gint; 
  480.  
  481.    function Get_Path 
  482.       (Tree_Model : not null access Gtk_Tree_Model_Filter_Record; 
  483.        Iter       : Gtk.Tree_Model.Gtk_Tree_Iter) 
  484.        return Gtk.Tree_Model.Gtk_Tree_Path; 
  485.  
  486.    function Get_String_From_Iter 
  487.       (Tree_Model : not null access Gtk_Tree_Model_Filter_Record; 
  488.        Iter       : Gtk.Tree_Model.Gtk_Tree_Iter) return UTF8_String; 
  489.  
  490.    procedure Get_Value 
  491.       (Tree_Model : not null access Gtk_Tree_Model_Filter_Record; 
  492.        Iter       : Gtk.Tree_Model.Gtk_Tree_Iter; 
  493.        Column     : Gint; 
  494.        Value      : out Glib.Values.GValue); 
  495.  
  496.    function Children 
  497.       (Tree_Model : not null access Gtk_Tree_Model_Filter_Record; 
  498.        Parent     : Gtk.Tree_Model.Gtk_Tree_Iter) 
  499.        return Gtk.Tree_Model.Gtk_Tree_Iter; 
  500.  
  501.    function Has_Child 
  502.       (Tree_Model : not null access Gtk_Tree_Model_Filter_Record; 
  503.        Iter       : Gtk.Tree_Model.Gtk_Tree_Iter) return Boolean; 
  504.  
  505.    function N_Children 
  506.       (Tree_Model : not null access Gtk_Tree_Model_Filter_Record; 
  507.        Iter       : Gtk.Tree_Model.Gtk_Tree_Iter := Gtk.Tree_Model.Null_Iter) 
  508.        return Gint; 
  509.  
  510.    procedure Next 
  511.       (Tree_Model : not null access Gtk_Tree_Model_Filter_Record; 
  512.        Iter       : in out Gtk.Tree_Model.Gtk_Tree_Iter); 
  513.  
  514.    function Nth_Child 
  515.       (Tree_Model : not null access Gtk_Tree_Model_Filter_Record; 
  516.        Parent     : Gtk.Tree_Model.Gtk_Tree_Iter; 
  517.        N          : Gint) return Gtk.Tree_Model.Gtk_Tree_Iter; 
  518.  
  519.    function Parent 
  520.       (Tree_Model : not null access Gtk_Tree_Model_Filter_Record; 
  521.        Child      : Gtk.Tree_Model.Gtk_Tree_Iter) 
  522.        return Gtk.Tree_Model.Gtk_Tree_Iter; 
  523.  
  524.    procedure Previous 
  525.       (Tree_Model : not null access Gtk_Tree_Model_Filter_Record; 
  526.        Iter       : in out Gtk.Tree_Model.Gtk_Tree_Iter); 
  527.  
  528.    procedure Ref_Node 
  529.       (Tree_Model : not null access Gtk_Tree_Model_Filter_Record; 
  530.        Iter       : Gtk.Tree_Model.Gtk_Tree_Iter); 
  531.  
  532.    procedure Row_Changed 
  533.       (Tree_Model : not null access Gtk_Tree_Model_Filter_Record; 
  534.        Path       : Gtk.Tree_Model.Gtk_Tree_Path; 
  535.        Iter       : Gtk.Tree_Model.Gtk_Tree_Iter); 
  536.  
  537.    procedure Row_Deleted 
  538.       (Tree_Model : not null access Gtk_Tree_Model_Filter_Record; 
  539.        Path       : Gtk.Tree_Model.Gtk_Tree_Path); 
  540.  
  541.    procedure Row_Has_Child_Toggled 
  542.       (Tree_Model : not null access Gtk_Tree_Model_Filter_Record; 
  543.        Path       : Gtk.Tree_Model.Gtk_Tree_Path; 
  544.        Iter       : Gtk.Tree_Model.Gtk_Tree_Iter); 
  545.  
  546.    procedure Row_Inserted 
  547.       (Tree_Model : not null access Gtk_Tree_Model_Filter_Record; 
  548.        Path       : Gtk.Tree_Model.Gtk_Tree_Path; 
  549.        Iter       : Gtk.Tree_Model.Gtk_Tree_Iter); 
  550.  
  551.    procedure Rows_Reordered 
  552.       (Tree_Model : not null access Gtk_Tree_Model_Filter_Record; 
  553.        Path       : Gtk.Tree_Model.Gtk_Tree_Path; 
  554.        Iter       : Gtk.Tree_Model.Gtk_Tree_Iter; 
  555.        New_Order  : Gint_Array); 
  556.  
  557.    procedure Unref_Node 
  558.       (Tree_Model : not null access Gtk_Tree_Model_Filter_Record; 
  559.        Iter       : Gtk.Tree_Model.Gtk_Tree_Iter); 
  560.  
  561.    ---------------- 
  562.    -- Properties -- 
  563.    ---------------- 
  564.    --  The following properties are defined for this widget. See 
  565.    --  Glib.Properties for more information on properties) 
  566.  
  567.    Child_Model_Property : constant Glib.Properties.Property_Interface; 
  568.    --  Type: Gtk.Tree_Model.Gtk_Tree_Model 
  569.  
  570.    Virtual_Root_Property : constant Glib.Properties.Property_Object; 
  571.    --  Type: Gtk.Tree_Model.Gtk_Tree_Path 
  572.  
  573.    ---------------- 
  574.    -- Interfaces -- 
  575.    ---------------- 
  576.    --  This class implements several interfaces. See Glib.Types 
  577.    -- 
  578.    --  - "TreeDragSource" 
  579.    -- 
  580.    --  - "TreeModel" 
  581.  
  582.    package Implements_Gtk_Tree_Drag_Source is new Glib.Types.Implements 
  583.      (Gtk.Tree_Drag_Source.Gtk_Tree_Drag_Source, Gtk_Tree_Model_Filter_Record, Gtk_Tree_Model_Filter); 
  584.    function "+" 
  585.      (Widget : access Gtk_Tree_Model_Filter_Record'Class) 
  586.    return Gtk.Tree_Drag_Source.Gtk_Tree_Drag_Source 
  587.    renames Implements_Gtk_Tree_Drag_Source.To_Interface; 
  588.    function "-" 
  589.      (Interf : Gtk.Tree_Drag_Source.Gtk_Tree_Drag_Source) 
  590.    return Gtk_Tree_Model_Filter 
  591.    renames Implements_Gtk_Tree_Drag_Source.To_Object; 
  592.  
  593.    package Implements_Gtk_Tree_Model is new Glib.Types.Implements 
  594.      (Gtk.Tree_Model.Gtk_Tree_Model, Gtk_Tree_Model_Filter_Record, Gtk_Tree_Model_Filter); 
  595.    function "+" 
  596.      (Widget : access Gtk_Tree_Model_Filter_Record'Class) 
  597.    return Gtk.Tree_Model.Gtk_Tree_Model 
  598.    renames Implements_Gtk_Tree_Model.To_Interface; 
  599.    function "-" 
  600.      (Interf : Gtk.Tree_Model.Gtk_Tree_Model) 
  601.    return Gtk_Tree_Model_Filter 
  602.    renames Implements_Gtk_Tree_Model.To_Object; 
  603.  
  604. private 
  605.    Virtual_Root_Property : constant Glib.Properties.Property_Object := 
  606.      Glib.Properties.Build ("virtual-root"); 
  607.    Child_Model_Property : constant Glib.Properties.Property_Interface := 
  608.      Glib.Properties.Build ("child-model"); 
  609. end Gtk.Tree_Model_Filter;