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.Search_Entry.Gtk_Search_Entry is a subclass of Gtk.GEntry.Gtk_Entry 
  26. --  that has been tailored for use as a search entry. 
  27. -- 
  28. --  It will show an inactive symbolic "find" icon when the search entry is 
  29. --  empty, and a symbolic "clear" icon when there is text. Clicking on the 
  30. --  "clear" icon will empty the search entry. 
  31. -- 
  32. --  Note that the search/clear icon is shown using a secondary icon, and thus 
  33. --  does not work if you are using the secondary icon position for some other 
  34. --  purpose. 
  35. -- 
  36. --  </description> 
  37. pragma Ada_2005; 
  38.  
  39. pragma Warnings (Off, "*is already use-visible*"); 
  40. with Gdk.Event;         use Gdk.Event; 
  41. with Glib;              use Glib; 
  42. with Glib.Types;        use Glib.Types; 
  43. with Gtk.Buildable;     use Gtk.Buildable; 
  44. with Gtk.Cell_Editable; use Gtk.Cell_Editable; 
  45. with Gtk.Editable;      use Gtk.Editable; 
  46. with Gtk.GEntry;        use Gtk.GEntry; 
  47.  
  48. package Gtk.Search_Entry is 
  49.  
  50.    type Gtk_Search_Entry_Record is new Gtk_Entry_Record with null record; 
  51.    type Gtk_Search_Entry is access all Gtk_Search_Entry_Record'Class; 
  52.  
  53.    ------------------ 
  54.    -- Constructors -- 
  55.    ------------------ 
  56.  
  57.    procedure Gtk_New (Self : out Gtk_Search_Entry); 
  58.    procedure Initialize 
  59.       (Self : not null access Gtk_Search_Entry_Record'Class); 
  60.    --  Creates a Gtk.Search_Entry.Gtk_Search_Entry, with a find icon when the 
  61.    --  search field is empty, and a clear icon when it isn't. 
  62.    --  Since: gtk+ 3.6 
  63.  
  64.    function Gtk_Search_Entry_New return Gtk_Search_Entry; 
  65.    --  Creates a Gtk.Search_Entry.Gtk_Search_Entry, with a find icon when the 
  66.    --  search field is empty, and a clear icon when it isn't. 
  67.    --  Since: gtk+ 3.6 
  68.  
  69.    function Get_Type return Glib.GType; 
  70.    pragma Import (C, Get_Type, "gtk_search_entry_get_type"); 
  71.  
  72.    --------------------------------------------- 
  73.    -- Inherited subprograms (from interfaces) -- 
  74.    --------------------------------------------- 
  75.    --  Methods inherited from the Buildable interface are not duplicated here 
  76.    --  since they are meant to be used by tools, mostly. If you need to call 
  77.    --  them, use an explicit cast through the "-" operator below. 
  78.  
  79.    procedure Editing_Done 
  80.       (Cell_Editable : not null access Gtk_Search_Entry_Record); 
  81.  
  82.    procedure Remove_Widget 
  83.       (Cell_Editable : not null access Gtk_Search_Entry_Record); 
  84.  
  85.    procedure Start_Editing 
  86.       (Cell_Editable : not null access Gtk_Search_Entry_Record; 
  87.        Event         : Gdk.Event.Gdk_Event); 
  88.  
  89.    procedure Copy_Clipboard 
  90.       (Editable : not null access Gtk_Search_Entry_Record); 
  91.  
  92.    procedure Cut_Clipboard 
  93.       (Editable : not null access Gtk_Search_Entry_Record); 
  94.  
  95.    procedure Delete_Selection 
  96.       (Editable : not null access Gtk_Search_Entry_Record); 
  97.  
  98.    procedure Delete_Text 
  99.       (Editable  : not null access Gtk_Search_Entry_Record; 
  100.        Start_Pos : Gint; 
  101.        End_Pos   : Gint := -1); 
  102.  
  103.    function Get_Chars 
  104.       (Editable  : not null access Gtk_Search_Entry_Record; 
  105.        Start_Pos : Gint; 
  106.        End_Pos   : Gint := -1) return UTF8_String; 
  107.  
  108.    function Get_Editable 
  109.       (Editable : not null access Gtk_Search_Entry_Record) return Boolean; 
  110.  
  111.    procedure Set_Editable 
  112.       (Editable    : not null access Gtk_Search_Entry_Record; 
  113.        Is_Editable : Boolean); 
  114.  
  115.    function Get_Position 
  116.       (Editable : not null access Gtk_Search_Entry_Record) return Gint; 
  117.  
  118.    procedure Set_Position 
  119.       (Editable : not null access Gtk_Search_Entry_Record; 
  120.        Position : Gint); 
  121.  
  122.    procedure Get_Selection_Bounds 
  123.       (Editable      : not null access Gtk_Search_Entry_Record; 
  124.        Start_Pos     : out Gint; 
  125.        End_Pos       : out Gint; 
  126.        Has_Selection : out Boolean); 
  127.  
  128.    procedure Insert_Text 
  129.       (Editable        : not null access Gtk_Search_Entry_Record; 
  130.        New_Text        : UTF8_String; 
  131.        New_Text_Length : Gint; 
  132.        Position        : in out Gint); 
  133.  
  134.    procedure Paste_Clipboard 
  135.       (Editable : not null access Gtk_Search_Entry_Record); 
  136.  
  137.    procedure Select_Region 
  138.       (Editable  : not null access Gtk_Search_Entry_Record; 
  139.        Start_Pos : Gint; 
  140.        End_Pos   : Gint := -1); 
  141.  
  142.    ---------------- 
  143.    -- Interfaces -- 
  144.    ---------------- 
  145.    --  This class implements several interfaces. See Glib.Types 
  146.    -- 
  147.    --  - "Buildable" 
  148.    -- 
  149.    --  - "CellEditable" 
  150.    -- 
  151.    --  - "Editable" 
  152.  
  153.    package Implements_Gtk_Buildable is new Glib.Types.Implements 
  154.      (Gtk.Buildable.Gtk_Buildable, Gtk_Search_Entry_Record, Gtk_Search_Entry); 
  155.    function "+" 
  156.      (Widget : access Gtk_Search_Entry_Record'Class) 
  157.    return Gtk.Buildable.Gtk_Buildable 
  158.    renames Implements_Gtk_Buildable.To_Interface; 
  159.    function "-" 
  160.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  161.    return Gtk_Search_Entry 
  162.    renames Implements_Gtk_Buildable.To_Object; 
  163.  
  164.    package Implements_Gtk_Cell_Editable is new Glib.Types.Implements 
  165.      (Gtk.Cell_Editable.Gtk_Cell_Editable, Gtk_Search_Entry_Record, Gtk_Search_Entry); 
  166.    function "+" 
  167.      (Widget : access Gtk_Search_Entry_Record'Class) 
  168.    return Gtk.Cell_Editable.Gtk_Cell_Editable 
  169.    renames Implements_Gtk_Cell_Editable.To_Interface; 
  170.    function "-" 
  171.      (Interf : Gtk.Cell_Editable.Gtk_Cell_Editable) 
  172.    return Gtk_Search_Entry 
  173.    renames Implements_Gtk_Cell_Editable.To_Object; 
  174.  
  175.    package Implements_Gtk_Editable is new Glib.Types.Implements 
  176.      (Gtk.Editable.Gtk_Editable, Gtk_Search_Entry_Record, Gtk_Search_Entry); 
  177.    function "+" 
  178.      (Widget : access Gtk_Search_Entry_Record'Class) 
  179.    return Gtk.Editable.Gtk_Editable 
  180.    renames Implements_Gtk_Editable.To_Interface; 
  181.    function "-" 
  182.      (Interf : Gtk.Editable.Gtk_Editable) 
  183.    return Gtk_Search_Entry 
  184.    renames Implements_Gtk_Editable.To_Object; 
  185.  
  186. end Gtk.Search_Entry;