1. ----------------------------------------------------------------------- 
  2. --              GtkAda - Ada95 binding for Gtk+/Gnome                -- 
  3. --                                                                   -- 
  4. --                Copyright (C) 2006 AdaCore                         -- 
  5. --                                                                   -- 
  6. -- This library is free software; you can redistribute it and/or     -- 
  7. -- modify it under the terms of the GNU General Public               -- 
  8. -- License as published by the Free Software Foundation; either      -- 
  9. -- version 2 of the License, or (at your option) any later version.  -- 
  10. --                                                                   -- 
  11. -- This library is distributed in the hope that it will be useful,   -- 
  12. -- but WITHOUT ANY WARRANTY; without even the implied warranty of    -- 
  13. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -- 
  14. -- General Public License for more details.                          -- 
  15. --                                                                   -- 
  16. -- You should have received a copy of the GNU General Public         -- 
  17. -- License along with this library; if not, write to the             -- 
  18. -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      -- 
  19. -- Boston, MA 02111-1307, USA.                                       -- 
  20. --                                                                   -- 
  21. -- -- -- -- -- -- -- -- -- -- -- --
  22. ----------------------------------------------------------------------- 
  23.  
  24. --  <description> 
  25. --  A Gtk_Combo_Box_Entry is a widget that allows the user to choose from a 
  26. --  list of valid choices or enter a different value. It is very similar to 
  27. --  Gtk_Combo_Box, but it displays the selected value in an entry to allow 
  28. --  modifying it. 
  29. -- 
  30. --  In contrast to a Gtk_Combo_Box, the underlying model of a 
  31. --  Gtk_Combo_Box_Entry must always have a text column (see Set_Text_Column), 
  32. --  and the entry will show the content of the text column in the selected row. 
  33. --  To get the text from the entry, use Gtk.Combo_Box.Get_Active_Text. 
  34. -- 
  35. --  The changed signal will be emitted while typing into a Gtk_Combo_Box_Entry, 
  36. --  as well as when selecting an item from the Gtk_Combo_Box_Entry's list. Use 
  37. --  Gtk.Combo_Box.Get_Active or Gtk.Combo_Box.Get_Active_Iter to discover 
  38. --  whether an item was actually selected from the list. 
  39. -- 
  40. --  Connect to the activate signal of the Gtk_Entry (use Gtk.Bin.Get_Child) to 
  41. --  detect when the user actually finishes entering text. 
  42. -- 
  43. --  The convenience API to construct simple text-only Gtk_Combo_Box can also be 
  44. --  used with Gtk_Combo_Box_Entry which have been constructed with 
  45. --  Gtk_New_Text. 
  46. --  </description> 
  47. --  </description> 
  48. --  <c_version>2.8.17</c_version> 
  49. --  <group>Trees and Lists</group> 
  50. --  <screenshot>gtk-combo_box_entry</screenshot> 
  51.  
  52. with Glib.Properties; 
  53. with Glib.Types; 
  54. with Gtk.Cell_Editable; 
  55. with Gtk.Cell_Layout; 
  56. with Gtk.Combo_Box; 
  57. with Gtk.Tree_Model; 
  58.  
  59. package Gtk.Combo_Box_Entry is 
  60.  
  61.    type Gtk_Combo_Box_Entry_Record is new Gtk.Combo_Box.Gtk_Combo_Box_Record 
  62.       with null record; 
  63.    type Gtk_Combo_Box_Entry is access all Gtk_Combo_Box_Entry_Record'Class; 
  64.  
  65.    procedure Gtk_New    (Combo : out Gtk_Combo_Box_Entry); 
  66.    procedure Initialize (Combo : access Gtk_Combo_Box_Entry_Record'Class); 
  67.    --  Creates a new combo entry which has a Gtk.Gentry.Gtk_Entry as child. 
  68.    --  After construction, you should set a model using Gtk.Combo_Box.Set_Model 
  69.    --  and text_column using Set_Text_Column. 
  70.  
  71.    procedure Gtk_New_Text    (Combo : out Gtk_Combo_Box_Entry); 
  72.    procedure Initialize_Text (Combo : access Gtk_Combo_Box_Entry_Record'Class); 
  73.    --  Convenience function which constructs a new editable text combo box, 
  74.    --  which is an entry just displaying strings. If you use this function to 
  75.    --  create a text combo box, you should only manipulate its data source with 
  76.    --  the convenience functions Gtk.Combo_Box.Append_Text, 
  77.    --  Gtk.Combo_Box.Insert_Text,... 
  78.  
  79.    procedure Gtk_New_With_Model 
  80.      (Combo       : out Gtk_Combo_Box_Entry; 
  81.       Model       : access Gtk.Tree_Model.Gtk_Tree_Model_Record'Class; 
  82.       Text_Column : Gint); 
  83.    procedure Initialize_With_Model 
  84.      (Combo       : access Gtk_Combo_Box_Entry_Record'Class; 
  85.       Model       : access Gtk.Tree_Model.Gtk_Tree_Model_Record'Class; 
  86.       Text_Column : Gint); 
  87.    --  Creates a new entry which has a Gtk_Entry as child and a list of strings 
  88.    --  as popup. You can get the Gtk_Entry using Gtk.Bin.Get_Child. To add and 
  89.    --  remove strings from the list, just modify Model 
  90.  
  91.    function Get_Type return Glib.GType; 
  92.    --  Returns the internal value used for Gtk_Combo_Box_Entry widgets 
  93.  
  94.    procedure Set_Text_Column 
  95.      (Entry_Box : access Gtk_Combo_Box_Entry_Record; Text_Column : Gint); 
  96.    function Get_Text_Column 
  97.      (Entry_Box : access Gtk_Combo_Box_Entry_Record)  return Gint; 
  98.    --  Sets the model column which Entry_Box should use to get strings from 
  99.    --  to be Text_Column. 
  100.  
  101.    ---------------- 
  102.    -- Interfaces -- 
  103.    ---------------- 
  104.    --  This class implements several interfaces. See Glib.Types 
  105.    -- 
  106.    --  - "Gtk_Cell_Layout" 
  107.    --    This interface should be used to add new renderers to the view, to 
  108.    --    render various columns of the model 
  109.    --  - "Gtk_Cell_Editable" 
  110.    --    This interface should be used to edit the contents of a tree model 
  111.    --    cell 
  112.  
  113.    package Implements_Cell_Layout is new Glib.Types.Implements 
  114.      (Gtk.Cell_Layout.Gtk_Cell_Layout, Gtk_Combo_Box_Entry_Record, 
  115.       Gtk_Combo_Box_Entry); 
  116.    function "+" 
  117.      (Box : access Gtk_Combo_Box_Entry_Record'Class) 
  118.       return Gtk.Cell_Layout.Gtk_Cell_Layout 
  119.       renames Implements_Cell_Layout.To_Interface; 
  120.    function "-" 
  121.      (Layout : Gtk.Cell_Layout.Gtk_Cell_Layout) 
  122.       return Gtk_Combo_Box_Entry 
  123.       renames Implements_Cell_Layout.To_Object; 
  124.    --  Converts to and from the Gtk_Cell_Layout interface 
  125.  
  126.    package Implements_Cell_Editable is new Glib.Types.Implements 
  127.      (Gtk.Cell_Editable.Gtk_Cell_Editable, 
  128.       Gtk_Combo_Box_Entry_Record, Gtk_Combo_Box_Entry); 
  129.    function "+" 
  130.      (Box : access Gtk_Combo_Box_Entry_Record'Class) 
  131.       return Gtk.Cell_Editable.Gtk_Cell_Editable 
  132.       renames Implements_Cell_Editable.To_Interface; 
  133.    function "-" 
  134.      (Editable : Gtk.Cell_Editable.Gtk_Cell_Editable) 
  135.       return Gtk_Combo_Box_Entry 
  136.       renames Implements_Cell_Editable.To_Object; 
  137.    --  Converts to and from the Gtk_Cell_Editable interface 
  138.  
  139.    ---------------- 
  140.    -- Properties -- 
  141.    ---------------- 
  142.    --  The following properties are defined for this widget. See 
  143.    --  Glib.Properties for more information on properties. 
  144.  
  145.    --  <properties> 
  146.    --  Name:  Text_Column_Property 
  147.    --  Type:  Int 
  148.    --  Descr: A column in the data source model to get the strings from 
  149.    --  </properties> 
  150.  
  151.    Text_Column_Property : constant Glib.Properties.Property_Int; 
  152.  
  153. private 
  154.    Text_Column_Property : constant Glib.Properties.Property_Int := 
  155.      Glib.Properties.Build ("text-column"); 
  156.  
  157.    pragma Import (C, Get_Type, "gtk_combo_box_entry_get_type"); 
  158. end Gtk.Combo_Box_Entry;