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. --  Gtk.Entry_Completion.Gtk_Entry_Completion is an auxiliary object to be 
  26. --  used in conjunction with Gtk.GEntry.Gtk_Entry to provide the completion 
  27. --  functionality. It implements the Gtk.Cell_Layout.Gtk_Cell_Layout interface, 
  28. --  to allow the user to add extra cells to the Gtk.Tree_View.Gtk_Tree_View 
  29. --  with completion matches. 
  30. -- 
  31. --  "Completion functionality" means that when the user modifies the text in 
  32. --  the entry, Gtk.Entry_Completion.Gtk_Entry_Completion checks which rows in 
  33. --  the model match the current content of the entry, and displays a list of 
  34. --  matches. By default, the matching is done by comparing the entry text 
  35. --  case-insensitively against the text column of the model (see 
  36. --  Gtk.Entry_Completion.Set_Text_Column), but this can be overridden with a 
  37. --  custom match function (see Gtk.Entry_Completion.Set_Match_Func). 
  38. -- 
  39. --  When the user selects a completion, the content of the entry is updated. 
  40. --  By default, the content of the entry is replaced by the text column of the 
  41. --  model, but this can be overridden by connecting to the 
  42. --  Gtk.Entry_Completion.Gtk_Entry_Completion::match-selected signal and 
  43. --  updating the entry in the signal handler. Note that you should return True 
  44. --  from the signal handler to suppress the default behaviour. 
  45. -- 
  46. --  To add completion functionality to an entry, use 
  47. --  Gtk.GEntry.Set_Completion. 
  48. -- 
  49. --  In addition to regular completion matches, which will be inserted into the 
  50. --  entry when they are selected, Gtk.Entry_Completion.Gtk_Entry_Completion 
  51. --  also allows to display "actions" in the popup window. Their appearance is 
  52. --  similar to menuitems, to differentiate them clearly from completion 
  53. --  strings. When an action is selected, the 
  54. --  Gtk.Entry_Completion.Gtk_Entry_Completion::action-activated signal is 
  55. --  emitted. 
  56. -- 
  57. --  GtkEntryCompletion uses a Gtk.Tree_Model_Filter.Gtk_Tree_Model_Filter 
  58. --  model to represent the subset of the entire model that is currently 
  59. --  matching. While the GtkEntryCompletion signals 
  60. --  Gtk.Entry_Completion.Gtk_Entry_Completion::match-selected and 
  61. --  Gtk.Entry_Completion.Gtk_Entry_Completion::cursor-on-match take the 
  62. --  original model and an iter pointing to that model as arguments, other 
  63. --  callbacks and signals (such as Gtk_Cell_Layout_Data_Funcs or 
  64. --  Gtk.Cell_Area.Gtk_Cell_Area::apply-attributes) will generally take the 
  65. --  filter model as argument. As long as you are only calling 
  66. --  gtk_tree_model_get, this will make no difference to you. If for some 
  67. --  reason, you need the original model, use Gtk.Tree_Model_Filter.Get_Model. 
  68. --  Don't forget to use Gtk.Tree_Model_Filter.Convert_Iter_To_Child_Iter to 
  69. --  obtain a matching iter. 
  70. -- 
  71. --  </description> 
  72. --  <group>Numeric/Text Data Entry</group> 
  73. pragma Ada_2005; 
  74.  
  75. pragma Warnings (Off, "*is already use-visible*"); 
  76. with Glib;              use Glib; 
  77. with Glib.Object;       use Glib.Object; 
  78. with Glib.Properties;   use Glib.Properties; 
  79. with Glib.Types;        use Glib.Types; 
  80. with Gtk.Buildable;     use Gtk.Buildable; 
  81. with Gtk.Cell_Area;     use Gtk.Cell_Area; 
  82. with Gtk.Cell_Layout;   use Gtk.Cell_Layout; 
  83. with Gtk.Cell_Renderer; use Gtk.Cell_Renderer; 
  84. with Gtk.Tree_Model;    use Gtk.Tree_Model; 
  85. with Gtk.Widget;        use Gtk.Widget; 
  86.  
  87. package Gtk.Entry_Completion is 
  88.  
  89.    type Gtk_Entry_Completion_Record is new GObject_Record with null record; 
  90.    type Gtk_Entry_Completion is access all Gtk_Entry_Completion_Record'Class; 
  91.  
  92.    --------------- 
  93.    -- Callbacks -- 
  94.    --------------- 
  95.  
  96.    type Gtk_Entry_Completion_Match_Func is access function 
  97.      (Completion : not null access Gtk_Entry_Completion_Record'Class; 
  98.       Key        : UTF8_String; 
  99.       Iter       : Gtk.Tree_Model.Gtk_Tree_Iter) return Boolean; 
  100.    --  A function which decides whether the row indicated by Iter matches a 
  101.    --  given Key, and should be displayed as a possible completion for Key. 
  102.    --  Note that Key is normalized and case-folded (see g_utf8_normalize and 
  103.    --  g_utf8_casefold). If this is not appropriate, match functions have 
  104.    --  access to the unmodified key via 'gtk_entry_get_text (GTK_ENTRY 
  105.    --  (gtk_entry_completion_get_entry (<!-- -->)))'. 
  106.    --  "completion": the Gtk.Entry_Completion.Gtk_Entry_Completion 
  107.    --  "key": the string to match, normalized and case-folded 
  108.    --  "iter": a Gtk.Tree_Model.Gtk_Tree_Iter indicating the row to match 
  109.  
  110.    type Gtk_Cell_Layout_Data_Func is access procedure 
  111.      (Cell_Layout : Gtk.Cell_Layout.Gtk_Cell_Layout; 
  112.       Cell        : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; 
  113.       Tree_Model  : Gtk.Tree_Model.Gtk_Tree_Model; 
  114.       Iter        : Gtk.Tree_Model.Gtk_Tree_Iter); 
  115.    --  A function which should set the value of Cell_Layout's cell renderer(s) 
  116.    --  as appropriate. 
  117.    --  "cell_layout": a Gtk.Cell_Layout.Gtk_Cell_Layout 
  118.    --  "cell": the cell renderer whose value is to be set 
  119.    --  "tree_model": the model 
  120.    --  "iter": a Gtk.Tree_Model.Gtk_Tree_Iter indicating the row to set the 
  121.    --  value for 
  122.  
  123.    ------------------ 
  124.    -- Constructors -- 
  125.    ------------------ 
  126.  
  127.    procedure Gtk_New (Completion : out Gtk_Entry_Completion); 
  128.    procedure Initialize 
  129.       (Completion : not null access Gtk_Entry_Completion_Record'Class); 
  130.    --  Creates a new Gtk.Entry_Completion.Gtk_Entry_Completion object. 
  131.    --  Since: gtk+ 2.4 
  132.  
  133.    function Gtk_Entry_Completion_New return Gtk_Entry_Completion; 
  134.    --  Creates a new Gtk.Entry_Completion.Gtk_Entry_Completion object. 
  135.    --  Since: gtk+ 2.4 
  136.  
  137.    procedure Gtk_New_With_Area 
  138.       (Completion : out Gtk_Entry_Completion; 
  139.        Area       : not null access Gtk.Cell_Area.Gtk_Cell_Area_Record'Class); 
  140.    procedure Initialize_With_Area 
  141.       (Completion : not null access Gtk_Entry_Completion_Record'Class; 
  142.        Area       : not null access Gtk.Cell_Area.Gtk_Cell_Area_Record'Class); 
  143.    --  Creates a new Gtk.Entry_Completion.Gtk_Entry_Completion object using 
  144.    --  the specified Area to layout cells in the underlying 
  145.    --  Gtk.Tree_View_Column.Gtk_Tree_View_Column for the drop-down menu. 
  146.    --  Since: gtk+ 3.0 
  147.    --  "area": the Gtk.Cell_Area.Gtk_Cell_Area used to layout cells 
  148.  
  149.    function Gtk_Entry_Completion_New_With_Area 
  150.       (Area : not null access Gtk.Cell_Area.Gtk_Cell_Area_Record'Class) 
  151.        return Gtk_Entry_Completion; 
  152.    --  Creates a new Gtk.Entry_Completion.Gtk_Entry_Completion object using 
  153.    --  the specified Area to layout cells in the underlying 
  154.    --  Gtk.Tree_View_Column.Gtk_Tree_View_Column for the drop-down menu. 
  155.    --  Since: gtk+ 3.0 
  156.    --  "area": the Gtk.Cell_Area.Gtk_Cell_Area used to layout cells 
  157.  
  158.    function Get_Type return Glib.GType; 
  159.    pragma Import (C, Get_Type, "gtk_entry_completion_get_type"); 
  160.  
  161.    ------------- 
  162.    -- Methods -- 
  163.    ------------- 
  164.  
  165.    procedure Complete 
  166.       (Completion : not null access Gtk_Entry_Completion_Record); 
  167.    --  Requests a completion operation, or in other words a refiltering of the 
  168.    --  current list with completions, using the current key. The completion 
  169.    --  list view will be updated accordingly. 
  170.    --  Since: gtk+ 2.4 
  171.  
  172.    function Compute_Prefix 
  173.       (Completion : not null access Gtk_Entry_Completion_Record; 
  174.        Key        : UTF8_String) return UTF8_String; 
  175.    --  Computes the common prefix that is shared by all rows in Completion 
  176.    --  that start with Key. If no row matches Key, null will be returned. Note 
  177.    --  that a text column must have been set for this function to work, see 
  178.    --  Gtk.Entry_Completion.Set_Text_Column for details. 
  179.    --  Since: gtk+ 3.4 
  180.    --  "key": The text to complete for 
  181.  
  182.    procedure Delete_Action 
  183.       (Completion : not null access Gtk_Entry_Completion_Record; 
  184.        Index      : Gint); 
  185.    --  Deletes the action at Index_ from Completion's action list. 
  186.    --  Since: gtk+ 2.4 
  187.    --  "index_": the index of the item to delete 
  188.  
  189.    function Get_Completion_Prefix 
  190.       (Completion : not null access Gtk_Entry_Completion_Record) 
  191.        return UTF8_String; 
  192.    --  Get the original text entered by the user that triggered the completion 
  193.    --  or null if there's no completion ongoing. 
  194.    --  Since: gtk+ 2.12 
  195.  
  196.    function Get_Entry 
  197.       (Completion : not null access Gtk_Entry_Completion_Record) 
  198.        return Gtk.Widget.Gtk_Widget; 
  199.    --  Gets the entry Completion has been attached to. 
  200.    --  Since: gtk+ 2.4 
  201.  
  202.    function Get_Inline_Completion 
  203.       (Completion : not null access Gtk_Entry_Completion_Record) 
  204.        return Boolean; 
  205.    --  Returns whether the common prefix of the possible completions should be 
  206.    --  automatically inserted in the entry. 
  207.    --  Since: gtk+ 2.6 
  208.  
  209.    procedure Set_Inline_Completion 
  210.       (Completion        : not null access Gtk_Entry_Completion_Record; 
  211.        Inline_Completion : Boolean); 
  212.    --  Sets whether the common prefix of the possible completions should be 
  213.    --  automatically inserted in the entry. 
  214.    --  Since: gtk+ 2.6 
  215.    --  "inline_completion": True to do inline completion 
  216.  
  217.    function Get_Inline_Selection 
  218.       (Completion : not null access Gtk_Entry_Completion_Record) 
  219.        return Boolean; 
  220.    --  Returns True if inline-selection mode is turned on. 
  221.    --  Since: gtk+ 2.12 
  222.  
  223.    procedure Set_Inline_Selection 
  224.       (Completion       : not null access Gtk_Entry_Completion_Record; 
  225.        Inline_Selection : Boolean); 
  226.    --  Sets whether it is possible to cycle through the possible completions 
  227.    --  inside the entry. 
  228.    --  Since: gtk+ 2.12 
  229.    --  "inline_selection": True to do inline selection 
  230.  
  231.    function Get_Minimum_Key_Length 
  232.       (Completion : not null access Gtk_Entry_Completion_Record) return Gint; 
  233.    --  Returns the minimum key length as set for Completion. 
  234.    --  Since: gtk+ 2.4 
  235.  
  236.    procedure Set_Minimum_Key_Length 
  237.       (Completion : not null access Gtk_Entry_Completion_Record; 
  238.        Length     : Gint); 
  239.    --  Requires the length of the search key for Completion to be at least 
  240.    --  Length. This is useful for long lists, where completing using a small 
  241.    --  key takes a lot of time and will come up with meaningless results anyway 
  242.    --  (ie, a too large dataset). 
  243.    --  Since: gtk+ 2.4 
  244.    --  "length": the minimum length of the key in order to start completing 
  245.  
  246.    function Get_Model 
  247.       (Completion : not null access Gtk_Entry_Completion_Record) 
  248.        return Gtk.Tree_Model.Gtk_Tree_Model; 
  249.    --  Returns the model the Gtk.Entry_Completion.Gtk_Entry_Completion is 
  250.    --  using as data source. Returns null if the model is unset. 
  251.    --  Since: gtk+ 2.4 
  252.  
  253.    procedure Set_Model 
  254.       (Completion : not null access Gtk_Entry_Completion_Record; 
  255.        Model      : Gtk.Tree_Model.Gtk_Tree_Model); 
  256.    --  Sets the model for a Gtk.Entry_Completion.Gtk_Entry_Completion. If 
  257.    --  Completion already has a model set, it will remove it before setting the 
  258.    --  new model. If model is null, then it will unset the model. 
  259.    --  Since: gtk+ 2.4 
  260.    --  "model": the Gtk.Tree_Model.Gtk_Tree_Model 
  261.  
  262.    function Get_Popup_Completion 
  263.       (Completion : not null access Gtk_Entry_Completion_Record) 
  264.        return Boolean; 
  265.    --  Returns whether the completions should be presented in a popup window. 
  266.    --  Since: gtk+ 2.6 
  267.  
  268.    procedure Set_Popup_Completion 
  269.       (Completion       : not null access Gtk_Entry_Completion_Record; 
  270.        Popup_Completion : Boolean); 
  271.    --  Sets whether the completions should be presented in a popup window. 
  272.    --  Since: gtk+ 2.6 
  273.    --  "popup_completion": True to do popup completion 
  274.  
  275.    function Get_Popup_Set_Width 
  276.       (Completion : not null access Gtk_Entry_Completion_Record) 
  277.        return Boolean; 
  278.    --  Returns whether the completion popup window will be resized to the 
  279.    --  width of the entry. 
  280.    --  Since: gtk+ 2.8 
  281.  
  282.    procedure Set_Popup_Set_Width 
  283.       (Completion      : not null access Gtk_Entry_Completion_Record; 
  284.        Popup_Set_Width : Boolean); 
  285.    --  Sets whether the completion popup window will be resized to be the same 
  286.    --  width as the entry. 
  287.    --  Since: gtk+ 2.8 
  288.    --  "popup_set_width": True to make the width of the popup the same as the 
  289.    --  entry 
  290.  
  291.    function Get_Popup_Single_Match 
  292.       (Completion : not null access Gtk_Entry_Completion_Record) 
  293.        return Boolean; 
  294.    --  Returns whether the completion popup window will appear even if there 
  295.    --  is only a single match. 
  296.    --  Since: gtk+ 2.8 
  297.  
  298.    procedure Set_Popup_Single_Match 
  299.       (Completion         : not null access Gtk_Entry_Completion_Record; 
  300.        Popup_Single_Match : Boolean); 
  301.    --  Sets whether the completion popup window will appear even if there is 
  302.    --  only a single match. You may want to set this to False if you are using 
  303.    --  <link linkend="GtkEntryCompletion--inline-completion">inline 
  304.    --  completion</link>. 
  305.    --  Since: gtk+ 2.8 
  306.    --  "popup_single_match": True if the popup should appear even for a single 
  307.    --  match 
  308.  
  309.    function Get_Text_Column 
  310.       (Completion : not null access Gtk_Entry_Completion_Record) return Gint; 
  311.    --  Returns the column in the model of Completion to get strings from. 
  312.    --  Since: gtk+ 2.6 
  313.  
  314.    procedure Set_Text_Column 
  315.       (Completion : not null access Gtk_Entry_Completion_Record; 
  316.        Column     : Gint); 
  317.    --  Convenience function for setting up the most used case of this code: a 
  318.    --  completion list with just strings. This function will set up Completion 
  319.    --  to have a list displaying all (and just) strings in the completion list, 
  320.    --  and to get those strings from Column in the model of Completion. 
  321.    --  This functions creates and adds a 
  322.    --  Gtk.Cell_Renderer_Text.Gtk_Cell_Renderer_Text for the selected column. 
  323.    --  If you need to set the text column, but don't want the cell renderer, 
  324.    --  use g_object_set to set the 
  325.    --  Gtk.Entry_Completion.Gtk_Entry_Completion:text-column property directly. 
  326.    --  Since: gtk+ 2.4 
  327.    --  "column": the column in the model of Completion to get strings from 
  328.  
  329.    procedure Insert_Action_Markup 
  330.       (Completion : not null access Gtk_Entry_Completion_Record; 
  331.        Index      : Gint; 
  332.        Markup     : UTF8_String); 
  333.    --  Inserts an action in Completion's action item list at position Index_ 
  334.    --  with markup Markup. 
  335.    --  Since: gtk+ 2.4 
  336.    --  "index_": the index of the item to insert 
  337.    --  "markup": markup of the item to insert 
  338.  
  339.    procedure Insert_Action_Text 
  340.       (Completion : not null access Gtk_Entry_Completion_Record; 
  341.        Index      : Gint; 
  342.        Text       : UTF8_String); 
  343.    --  Inserts an action in Completion's action item list at position Index_ 
  344.    --  with text Text. If you want the action item to have markup, use 
  345.    --  Gtk.Entry_Completion.Insert_Action_Markup. 
  346.    --  Since: gtk+ 2.4 
  347.    --  "index_": the index of the item to insert 
  348.    --  "text": text of the item to insert 
  349.  
  350.    procedure Insert_Prefix 
  351.       (Completion : not null access Gtk_Entry_Completion_Record); 
  352.    --  Requests a prefix insertion. 
  353.    --  Since: gtk+ 2.6 
  354.  
  355.    procedure Set_Match_Func 
  356.       (Completion : not null access Gtk_Entry_Completion_Record; 
  357.        Func       : Gtk_Entry_Completion_Match_Func); 
  358.    --  Sets the match function for Completion to be Func. The match function 
  359.    --  is used to determine if a row should or should not be in the completion 
  360.    --  list. 
  361.    --  Since: gtk+ 2.4 
  362.    --  "func": the Gtk_Entry_Completion_Match_Func to use 
  363.  
  364.    generic 
  365.       type User_Data_Type (<>) is private; 
  366.       with procedure Destroy (Data : in out User_Data_Type) is null; 
  367.    package Set_Match_Func_User_Data is 
  368.  
  369.       type Gtk_Entry_Completion_Match_Func is access function 
  370.         (Completion : not null access Gtk.Entry_Completion.Gtk_Entry_Completion_Record'Class; 
  371.          Key        : UTF8_String; 
  372.          Iter       : Gtk.Tree_Model.Gtk_Tree_Iter; 
  373.          User_Data  : User_Data_Type) return Boolean; 
  374.       --  A function which decides whether the row indicated by Iter matches a 
  375.       --  given Key, and should be displayed as a possible completion for Key. 
  376.       --  Note that Key is normalized and case-folded (see g_utf8_normalize and 
  377.       --  g_utf8_casefold). If this is not appropriate, match functions have 
  378.       --  access to the unmodified key via 'gtk_entry_get_text (GTK_ENTRY 
  379.       --  (gtk_entry_completion_get_entry (<!-- -->)))'. 
  380.       --  "completion": the Gtk.Entry_Completion.Gtk_Entry_Completion 
  381.       --  "key": the string to match, normalized and case-folded 
  382.       --  "iter": a Gtk.Tree_Model.Gtk_Tree_Iter indicating the row to match 
  383.       --  "user_data": user data given to Gtk.Entry_Completion.Set_Match_Func 
  384.  
  385.       procedure Set_Match_Func 
  386.          (Completion : not null access Gtk.Entry_Completion.Gtk_Entry_Completion_Record'Class; 
  387.           Func       : Gtk_Entry_Completion_Match_Func; 
  388.           Func_Data  : User_Data_Type); 
  389.       --  Sets the match function for Completion to be Func. The match 
  390.       --  function is used to determine if a row should or should not be in the 
  391.       --  completion list. 
  392.       --  Since: gtk+ 2.4 
  393.       --  "func": the Gtk_Entry_Completion_Match_Func to use 
  394.       --  "func_data": user data for Func 
  395.  
  396.    end Set_Match_Func_User_Data; 
  397.  
  398.    procedure Set_Cell_Data_Func 
  399.       (Cell_Layout : not null access Gtk_Entry_Completion_Record; 
  400.        Cell        : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; 
  401.        Func        : Gtk_Cell_Layout_Data_Func); 
  402.    --  Sets the Gtk_Cell_Layout_Data_Func to use for Cell_Layout. 
  403.    --  This function is used instead of the standard attributes mapping for 
  404.    --  setting the column value, and should set the value of Cell_Layout's cell 
  405.    --  renderer(s) as appropriate. 
  406.    --  Func may be null to remove a previously set function. 
  407.    --  Since: gtk+ 2.4 
  408.    --  "cell": a Gtk.Cell_Renderer.Gtk_Cell_Renderer 
  409.    --  "func": the Gtk_Cell_Layout_Data_Func to use, or null 
  410.  
  411.    generic 
  412.       type User_Data_Type (<>) is private; 
  413.       with procedure Destroy (Data : in out User_Data_Type) is null; 
  414.    package Set_Cell_Data_Func_User_Data is 
  415.  
  416.       type Gtk_Cell_Layout_Data_Func is access procedure 
  417.         (Cell_Layout : Gtk.Cell_Layout.Gtk_Cell_Layout; 
  418.          Cell        : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; 
  419.          Tree_Model  : Gtk.Tree_Model.Gtk_Tree_Model; 
  420.          Iter        : Gtk.Tree_Model.Gtk_Tree_Iter; 
  421.          Data        : User_Data_Type); 
  422.       --  A function which should set the value of Cell_Layout's cell renderer(s) 
  423.       --  as appropriate. 
  424.       --  "cell_layout": a Gtk.Cell_Layout.Gtk_Cell_Layout 
  425.       --  "cell": the cell renderer whose value is to be set 
  426.       --  "tree_model": the model 
  427.       --  "iter": a Gtk.Tree_Model.Gtk_Tree_Iter indicating the row to set the 
  428.       --  value for 
  429.       --  "data": user data passed to Gtk.Cell_Layout.Set_Cell_Data_Func 
  430.  
  431.       procedure Set_Cell_Data_Func 
  432.          (Cell_Layout : not null access Gtk.Entry_Completion.Gtk_Entry_Completion_Record'Class; 
  433.           Cell        : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; 
  434.           Func        : Gtk_Cell_Layout_Data_Func; 
  435.           Func_Data   : User_Data_Type); 
  436.       --  Sets the Gtk_Cell_Layout_Data_Func to use for Cell_Layout. 
  437.       --  This function is used instead of the standard attributes mapping for 
  438.       --  setting the column value, and should set the value of Cell_Layout's 
  439.       --  cell renderer(s) as appropriate. 
  440.       --  Func may be null to remove a previously set function. 
  441.       --  Since: gtk+ 2.4 
  442.       --  "cell": a Gtk.Cell_Renderer.Gtk_Cell_Renderer 
  443.       --  "func": the Gtk_Cell_Layout_Data_Func to use, or null 
  444.       --  "func_data": user data for Func 
  445.  
  446.    end Set_Cell_Data_Func_User_Data; 
  447.  
  448.    --------------------------------------------- 
  449.    -- Inherited subprograms (from interfaces) -- 
  450.    --------------------------------------------- 
  451.    --  Methods inherited from the Buildable interface are not duplicated here 
  452.    --  since they are meant to be used by tools, mostly. If you need to call 
  453.    --  them, use an explicit cast through the "-" operator below. 
  454.  
  455.    procedure Add_Attribute 
  456.       (Cell_Layout : not null access Gtk_Entry_Completion_Record; 
  457.        Cell        : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; 
  458.        Attribute   : UTF8_String; 
  459.        Column      : Gint); 
  460.  
  461.    procedure Clear 
  462.       (Cell_Layout : not null access Gtk_Entry_Completion_Record); 
  463.  
  464.    procedure Clear_Attributes 
  465.       (Cell_Layout : not null access Gtk_Entry_Completion_Record; 
  466.        Cell        : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class); 
  467.  
  468.    function Get_Cells 
  469.       (Cell_Layout : not null access Gtk_Entry_Completion_Record) 
  470.        return Glib.Object.Object_Simple_List.Glist; 
  471.  
  472.    procedure Pack_End 
  473.       (Cell_Layout : not null access Gtk_Entry_Completion_Record; 
  474.        Cell        : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; 
  475.        Expand      : Boolean); 
  476.  
  477.    procedure Pack_Start 
  478.       (Cell_Layout : not null access Gtk_Entry_Completion_Record; 
  479.        Cell        : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; 
  480.        Expand      : Boolean); 
  481.  
  482.    procedure Reorder 
  483.       (Cell_Layout : not null access Gtk_Entry_Completion_Record; 
  484.        Cell        : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; 
  485.        Position    : Gint); 
  486.  
  487.    ---------------- 
  488.    -- Properties -- 
  489.    ---------------- 
  490.    --  The following properties are defined for this widget. See 
  491.    --  Glib.Properties for more information on properties) 
  492.  
  493.    Cell_Area_Property : constant Glib.Properties.Property_Object; 
  494.    --  Type: Gtk.Cell_Area.Gtk_Cell_Area 
  495.    --  The Gtk.Cell_Area.Gtk_Cell_Area used to layout cell renderers in the 
  496.    --  treeview column. 
  497.    -- 
  498.    --  If no area is specified when creating the entry completion with 
  499.    --  Gtk.Entry_Completion.Gtk_New_With_Area a horizontally oriented 
  500.    --  Gtk.Cell_Area_Box.Gtk_Cell_Area_Box will be used. 
  501.  
  502.    Inline_Completion_Property : constant Glib.Properties.Property_Boolean; 
  503.    --  Determines whether the common prefix of the possible completions should 
  504.    --  be inserted automatically in the entry. Note that this requires 
  505.    --  text-column to be set, even if you are using a custom match function. 
  506.  
  507.    Inline_Selection_Property : constant Glib.Properties.Property_Boolean; 
  508.    --  Determines whether the possible completions on the popup will appear in 
  509.    --  the entry as you navigate through them. 
  510.  
  511.    Minimum_Key_Length_Property : constant Glib.Properties.Property_Int; 
  512.  
  513.    Model_Property : constant Glib.Properties.Property_Interface; 
  514.    --  Type: Gtk.Tree_Model.Gtk_Tree_Model 
  515.  
  516.    Popup_Completion_Property : constant Glib.Properties.Property_Boolean; 
  517.    --  Determines whether the possible completions should be shown in a popup 
  518.    --  window. 
  519.  
  520.    Popup_Set_Width_Property : constant Glib.Properties.Property_Boolean; 
  521.    --  Determines whether the completions popup window will be resized to the 
  522.    --  width of the entry. 
  523.  
  524.    Popup_Single_Match_Property : constant Glib.Properties.Property_Boolean; 
  525.    --  Determines whether the completions popup window will shown for a single 
  526.    --  possible completion. You probably want to set this to False if you are 
  527.    --  using <link linkend="GtkEntryCompletion--inline-completion">inline 
  528.    --  completion</link>. 
  529.  
  530.    Text_Column_Property : constant Glib.Properties.Property_Int; 
  531.    --  The column of the model containing the strings. Note that the strings 
  532.    --  must be UTF-8. 
  533.  
  534.    ------------- 
  535.    -- Signals -- 
  536.    ------------- 
  537.  
  538.    type Cb_Gtk_Entry_Completion_Gint_Void is not null access procedure 
  539.      (Self  : access Gtk_Entry_Completion_Record'Class; 
  540.       Index : Gint); 
  541.  
  542.    type Cb_GObject_Gint_Void is not null access procedure 
  543.      (Self  : access Glib.Object.GObject_Record'Class; 
  544.       Index : Gint); 
  545.  
  546.    Signal_Action_Activated : constant Glib.Signal_Name := "action-activated"; 
  547.    procedure On_Action_Activated 
  548.       (Self  : not null access Gtk_Entry_Completion_Record; 
  549.        Call  : Cb_Gtk_Entry_Completion_Gint_Void; 
  550.        After : Boolean := False); 
  551.    procedure On_Action_Activated 
  552.       (Self  : not null access Gtk_Entry_Completion_Record; 
  553.        Call  : Cb_GObject_Gint_Void; 
  554.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  555.        After : Boolean := False); 
  556.    --  Gets emitted when an action is activated. 
  557.  
  558.    type Cb_Gtk_Entry_Completion_Gtk_Tree_Model_Gtk_Tree_Iter_Boolean is not null access function 
  559.      (Self  : access Gtk_Entry_Completion_Record'Class; 
  560.       Model : Gtk.Tree_Model.Gtk_Tree_Model; 
  561.       Iter  : Gtk.Tree_Model.Gtk_Tree_Iter) return Boolean; 
  562.  
  563.    type Cb_GObject_Gtk_Tree_Model_Gtk_Tree_Iter_Boolean is not null access function 
  564.      (Self  : access Glib.Object.GObject_Record'Class; 
  565.       Model : Gtk.Tree_Model.Gtk_Tree_Model; 
  566.       Iter  : Gtk.Tree_Model.Gtk_Tree_Iter) return Boolean; 
  567.  
  568.    Signal_Cursor_On_Match : constant Glib.Signal_Name := "cursor-on-match"; 
  569.    procedure On_Cursor_On_Match 
  570.       (Self  : not null access Gtk_Entry_Completion_Record; 
  571.        Call  : Cb_Gtk_Entry_Completion_Gtk_Tree_Model_Gtk_Tree_Iter_Boolean; 
  572.        After : Boolean := False); 
  573.    procedure On_Cursor_On_Match 
  574.       (Self  : not null access Gtk_Entry_Completion_Record; 
  575.        Call  : Cb_GObject_Gtk_Tree_Model_Gtk_Tree_Iter_Boolean; 
  576.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  577.        After : Boolean := False); 
  578.    --  Gets emitted when a match from the cursor is on a match of the list. 
  579.    --  The default behaviour is to replace the contents of the entry with the 
  580.    --  contents of the text column in the row pointed to by Iter. 
  581.    -- 
  582.    --  Note that Model is the model that was passed to 
  583.    --  Gtk.Entry_Completion.Set_Model. 
  584.    --  
  585.    --  Callback parameters: 
  586.    --    --  "model": the Gtk.Tree_Model.Gtk_Tree_Model containing the matches 
  587.    --    --  "iter": a Gtk.Tree_Model.Gtk_Tree_Iter positioned at the selected match 
  588.    --    --  Returns True if the signal has been handled 
  589.  
  590.    type Cb_Gtk_Entry_Completion_UTF8_String_Boolean is not null access function 
  591.      (Self   : access Gtk_Entry_Completion_Record'Class; 
  592.       Prefix : UTF8_String) return Boolean; 
  593.  
  594.    type Cb_GObject_UTF8_String_Boolean is not null access function 
  595.      (Self   : access Glib.Object.GObject_Record'Class; 
  596.       Prefix : UTF8_String) return Boolean; 
  597.  
  598.    Signal_Insert_Prefix : constant Glib.Signal_Name := "insert-prefix"; 
  599.    procedure On_Insert_Prefix 
  600.       (Self  : not null access Gtk_Entry_Completion_Record; 
  601.        Call  : Cb_Gtk_Entry_Completion_UTF8_String_Boolean; 
  602.        After : Boolean := False); 
  603.    procedure On_Insert_Prefix 
  604.       (Self  : not null access Gtk_Entry_Completion_Record; 
  605.        Call  : Cb_GObject_UTF8_String_Boolean; 
  606.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  607.        After : Boolean := False); 
  608.    --  Gets emitted when the inline autocompletion is triggered. The default 
  609.    --  behaviour is to make the entry display the whole prefix and select the 
  610.    --  newly inserted part. 
  611.    -- 
  612.    --  Applications may connect to this signal in order to insert only a 
  613.    --  smaller part of the Prefix into the entry - e.g. the entry used in the 
  614.    --  Gtk.File_Chooser.Gtk_File_Chooser inserts only the part of the prefix up 
  615.    --  to the next '/'. 
  616.    --  
  617.    --  Callback parameters: 
  618.    --    --  "prefix": the common prefix of all possible completions 
  619.    --    --  Returns True if the signal has been handled 
  620.  
  621.    Signal_Match_Selected : constant Glib.Signal_Name := "match-selected"; 
  622.    procedure On_Match_Selected 
  623.       (Self  : not null access Gtk_Entry_Completion_Record; 
  624.        Call  : Cb_Gtk_Entry_Completion_Gtk_Tree_Model_Gtk_Tree_Iter_Boolean; 
  625.        After : Boolean := False); 
  626.    procedure On_Match_Selected 
  627.       (Self  : not null access Gtk_Entry_Completion_Record; 
  628.        Call  : Cb_GObject_Gtk_Tree_Model_Gtk_Tree_Iter_Boolean; 
  629.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  630.        After : Boolean := False); 
  631.    --  Gets emitted when a match from the list is selected. The default 
  632.    --  behaviour is to replace the contents of the entry with the contents of 
  633.    --  the text column in the row pointed to by Iter. 
  634.    -- 
  635.    --  Note that Model is the model that was passed to 
  636.    --  Gtk.Entry_Completion.Set_Model. 
  637.    --  
  638.    --  Callback parameters: 
  639.    --    --  "model": the Gtk.Tree_Model.Gtk_Tree_Model containing the matches 
  640.    --    --  "iter": a Gtk.Tree_Model.Gtk_Tree_Iter positioned at the selected match 
  641.    --    --  Returns True if the signal has been handled 
  642.  
  643.    ---------------- 
  644.    -- Interfaces -- 
  645.    ---------------- 
  646.    --  This class implements several interfaces. See Glib.Types 
  647.    -- 
  648.    --  - "Buildable" 
  649.    -- 
  650.    --  - "CellLayout" 
  651.  
  652.    package Implements_Gtk_Buildable is new Glib.Types.Implements 
  653.      (Gtk.Buildable.Gtk_Buildable, Gtk_Entry_Completion_Record, Gtk_Entry_Completion); 
  654.    function "+" 
  655.      (Widget : access Gtk_Entry_Completion_Record'Class) 
  656.    return Gtk.Buildable.Gtk_Buildable 
  657.    renames Implements_Gtk_Buildable.To_Interface; 
  658.    function "-" 
  659.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  660.    return Gtk_Entry_Completion 
  661.    renames Implements_Gtk_Buildable.To_Object; 
  662.  
  663.    package Implements_Gtk_Cell_Layout is new Glib.Types.Implements 
  664.      (Gtk.Cell_Layout.Gtk_Cell_Layout, Gtk_Entry_Completion_Record, Gtk_Entry_Completion); 
  665.    function "+" 
  666.      (Widget : access Gtk_Entry_Completion_Record'Class) 
  667.    return Gtk.Cell_Layout.Gtk_Cell_Layout 
  668.    renames Implements_Gtk_Cell_Layout.To_Interface; 
  669.    function "-" 
  670.      (Interf : Gtk.Cell_Layout.Gtk_Cell_Layout) 
  671.    return Gtk_Entry_Completion 
  672.    renames Implements_Gtk_Cell_Layout.To_Object; 
  673.  
  674. private 
  675.    Text_Column_Property : constant Glib.Properties.Property_Int := 
  676.      Glib.Properties.Build ("text-column"); 
  677.    Popup_Single_Match_Property : constant Glib.Properties.Property_Boolean := 
  678.      Glib.Properties.Build ("popup-single-match"); 
  679.    Popup_Set_Width_Property : constant Glib.Properties.Property_Boolean := 
  680.      Glib.Properties.Build ("popup-set-width"); 
  681.    Popup_Completion_Property : constant Glib.Properties.Property_Boolean := 
  682.      Glib.Properties.Build ("popup-completion"); 
  683.    Model_Property : constant Glib.Properties.Property_Interface := 
  684.      Glib.Properties.Build ("model"); 
  685.    Minimum_Key_Length_Property : constant Glib.Properties.Property_Int := 
  686.      Glib.Properties.Build ("minimum-key-length"); 
  687.    Inline_Selection_Property : constant Glib.Properties.Property_Boolean := 
  688.      Glib.Properties.Build ("inline-selection"); 
  689.    Inline_Completion_Property : constant Glib.Properties.Property_Boolean := 
  690.      Glib.Properties.Build ("inline-completion"); 
  691.    Cell_Area_Property : constant Glib.Properties.Property_Object := 
  692.      Glib.Properties.Build ("cell-area"); 
  693. end Gtk.Entry_Completion;