1. ----------------------------------------------------------------------- 
  2. --               GtkAda - Ada95 binding for Gtk+/Gnome               -- 
  3. --                                                                   -- 
  4. --   Copyright (C) 1998-1999 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 an abstract widget designed to support the common 
  27. --  functionalities of all widgets for editing text. It provides general 
  28. --  services to manipulate an editable widget, a large number of action 
  29. --  signals used for key bindings, and several signals that an 
  30. --  application can connect to to modify the behavior of a widget. 
  31. --  </description> 
  32. --  <c_version>2.8.17</c_version> 
  33. --  <group>Obsolescent widgets</group> 
  34.  
  35. with Gtk.Widget; 
  36.  
  37. package Gtk.Old_Editable is 
  38.    pragma Obsolescent; 
  39.  
  40.    type Gtk_Old_Editable_Record is new 
  41.      Gtk.Widget.Gtk_Widget_Record with private; 
  42.    type Gtk_Old_Editable is access all Gtk_Old_Editable_Record'Class; 
  43.  
  44.    function Get_Type return Gtk.Gtk_Type; 
  45.    --  Return the internal value associated with a Gtk_Old_Editable. 
  46.  
  47.    procedure Changed (Editable : access Gtk_Old_Editable_Record); 
  48.    --  Cause the "changed" signal to be emitted. 
  49.  
  50.    procedure Claim_Selection 
  51.      (Editable : access Gtk_Old_Editable_Record; 
  52.       Claim    : in Boolean := True; 
  53.       Time     : in Guint32); 
  54.    --  If Claim is set to True, claim the ownership of the primary X selection. 
  55.    --  Otherwise, release it. "Time" should be set to the 
  56.    --  time of the last-change time for the specified selection. It is 
  57.    --  discarded if it is earlier than the current last-change time, or 
  58.    --  later than the current X server time. 
  59.  
  60.    procedure Copy_Clipboard 
  61.      (Editable : access Gtk_Old_Editable_Record; 
  62.       Time     : in Guint32); 
  63.    --  Copy the characters in the current selection to the clipboard. 
  64.  
  65.    procedure Cut_Clipboard 
  66.      (Editable : access Gtk_Old_Editable_Record; 
  67.       Time     : Guint32); 
  68.    --  Copy the characters in the current selection to the clipboard. 
  69.    --  The selection is then deleted. 
  70.  
  71.    procedure Delete_Selection (Editable : access Gtk_Old_Editable_Record); 
  72.    --  Disclaim and delete the current selection. 
  73.  
  74.    procedure Delete_Text 
  75.      (Editable  : access Gtk_Old_Editable_Record; 
  76.       Start_Pos : Gint := 0; 
  77.       End_Pos   : Gint := -1); 
  78.    --  Delete the characters from Start_Pos to End_Pos. 
  79.    --  If End_Pos is negative, the characters are deleted from Start_Pos to the 
  80.    --  end of the text. 
  81.  
  82.    function Get_Chars 
  83.      (Editable  : access Gtk_Old_Editable_Record; 
  84.       Start_Pos : Gint := 0; 
  85.       End_Pos   : Gint := -1) return UTF8_String; 
  86.    --  Get the text from Start_Pos to End_Pos. 
  87.    --  If End_Pos is negative, the text from Start_Pos to the end is returned. 
  88.  
  89.    function Get_Clipboard_Text 
  90.      (Widget : access Gtk_Old_Editable_Record) return UTF8_String; 
  91.    --  Return the last text copied from the clipboard. 
  92.  
  93.    function Get_Editable 
  94.      (Widget : access Gtk_Old_Editable_Record) return Boolean; 
  95.    --  Return True if the widget is editable by the user. 
  96.  
  97.    procedure Set_Editable 
  98.      (Widget   : access Gtk_Old_Editable_Record; 
  99.       Editable : Boolean := True); 
  100.    --  Set the editable status of the entry. 
  101.    --  If Editable is False, the user can not modify the contents of the entry. 
  102.    --  This does not affect the user of the insertion functions above. 
  103.  
  104.    function Get_Has_Selection 
  105.      (Widget : access Gtk_Old_Editable_Record) return Boolean; 
  106.    --  Return True if the selection is owned by the widget. 
  107.  
  108.    function Get_Selection_End_Pos 
  109.      (Widget : access Gtk_Old_Editable_Record) return Guint; 
  110.    --  Return the position of the end of the current selection. 
  111.  
  112.    function Get_Selection_Start_Pos 
  113.      (Widget : access Gtk_Old_Editable_Record) return Guint; 
  114.    --  Return the position of the beginning of the current selection. 
  115.  
  116.    procedure Insert_Text 
  117.      (Editable : access Gtk_Old_Editable_Record; 
  118.       New_Text : UTF8_String; 
  119.       Position : in out Gint); 
  120.    --  Insert the given string at the given position. 
  121.    --  Position is set to the new cursor position. 
  122.  
  123.    procedure Paste_Clipboard 
  124.      (Editable : access Gtk_Old_Editable_Record; 
  125.       Time     : Guint32); 
  126.    --  The contents of the clipboard is pasted into the given widget at 
  127.    --  the current cursor position. 
  128.  
  129.    procedure Select_Region 
  130.      (Editable : access Gtk_Old_Editable_Record; 
  131.       Start    : Gint; 
  132.       The_End  : Gint := -1); 
  133.    --  Select the region of text from Start to The_End. 
  134.    --  The characters that are selected are those characters at positions 
  135.    --  from Start up to, but not including The_End. If The_End_Pos is 
  136.    --  negative, then the characters selected will be those characters 
  137.    --  from Start to the end of the text. 
  138.  
  139.    procedure Set_Position 
  140.      (Editable : access Gtk_Old_Editable_Record; 
  141.       Position : Gint); 
  142.    --  Change the position of the cursor in the entry. 
  143.    --  The cursor is displayed before the character with the given 
  144.    --  index in the widget (the first character has index 0). The 
  145.    --  value must be less than or equal to the number of characters in the 
  146.    --  widget. A value of -1 indicates that the position 
  147.    --  should be set after the last character in the entry. 
  148.    --  Note that this position is in characters, not in bytes. 
  149.  
  150.    function Get_Position 
  151.      (Editable : access Gtk_Old_Editable_Record) return Gint; 
  152.    --  Return the position of the cursor. 
  153.  
  154.    --------------- 
  155.    --  Signals  -- 
  156.    --------------- 
  157.  
  158.    --  <signals> 
  159.    --  The following new signals are defined for this widget: 
  160.    -- 
  161.    --  - "changed" 
  162.    --    procedure Handler (Widget : access Gtk_Old_Editable_Record'Class); 
  163.    -- 
  164.    --    emitted when the user has changed the text of the widget. 
  165.    -- 
  166.    --  - "insert_text" 
  167.    --    procedure Handler (Widget   : access Gtk_Old_Editable_Record'Class; 
  168.    --                       Text     : in UTF8_String; 
  169.    --                       Length   : in Gint; 
  170.    --                       Position : in Gint_Access); 
  171.    -- 
  172.    --    Emitted when some text is inserted inside the widget by the 
  173.    --    user. The default handler inserts the text into the widget. 
  174.    --    By connecting a handler to this signal, and then by stopping 
  175.    --    the signal with Gtk.Handlers.Emit_Stop_By_Name, it is possible 
  176.    --    to modify the inserted text, or even prevent it from being 
  177.    --    inserted. 
  178.    --    Position.all should be modified by the callback, and indicates 
  179.    --    the new position of the cursor after the text has been inserted. 
  180.    -- 
  181.    --  - "delete_text" 
  182.    --    procedure Handler (Widget    : access Gtk_Old_Editable_Record'Class; 
  183.    --                       Start_Pos : in Gint; 
  184.    --                       End_Pos   : in Gint); 
  185.    -- 
  186.    --    Emitted when some text is deleted by the user. As for the 
  187.    --    "insert-text" handler, it is possible to override the default 
  188.    --    behavior by connecting a handler to this signal, and then 
  189.    --    stopping the signal. 
  190.    -- 
  191.    --  - "activate" 
  192.    --    procedure Handler (Widget : access Gtk_Old_Editable_Record'Class); 
  193.    -- 
  194.    --    Emitted when the user has activated the widget in some fashion. 
  195.    -- 
  196.    --  - "set-editable" 
  197.    --    procedure Handler (Widget     : access Gtk_Old_Editable_Record'Class; 
  198.    --                       Is_Editable: in Boolean); 
  199.    -- 
  200.    --    Emitting this signal is equivalent to calling Set_Old_Editable. 
  201.    -- 
  202.    --  - "move_cursor" 
  203.    --    procedure Handler (Widget : access Gtk_Old_Editable_Record'Class; 
  204.    --                       X, Y   : in Gint); 
  205.    -- 
  206.    --    Emitting this signal will move the cursor position for X 
  207.    --    characters horizontally, and Y characters vertically. 
  208.    -- 
  209.    --  - "move_word" 
  210.    --    procedure Handler (Widget : access Gtk_Old_Editable_Record'Class; 
  211.    --                       N      : in Gint); 
  212.    -- 
  213.    --    Emitting this signal will move the cursor by N words (N can be 
  214.    --    negative). 
  215.    -- 
  216.    --  - "move_page" 
  217.    --    procedure Handler (Widget : access Gtk_Old_Editable_Record'Class; 
  218.    --                       X, Y   : in Gint); 
  219.    -- 
  220.    --    Emitting this signal will move the cursor for X pages 
  221.    --    horizontally, and Y pages vertically. 
  222.    -- 
  223.    --  - "move_to_row" 
  224.    --    procedure Handler (Widget : access Gtk_Old_Editable_Record'Class; 
  225.    --                       Row    : in Gint); 
  226.    -- 
  227.    --    Emitting this signal will move the cursor to the given row. 
  228.    -- 
  229.    --  - "move_to_column" 
  230.    --    procedure Handler (Widget : access Gtk_Old_Editable_Record'Class; 
  231.    --                       Column : in Gint); 
  232.    -- 
  233.    --    Emitting this signal will move the cursor to the given column. 
  234.    -- 
  235.    --  - "kill_char" 
  236.    --    procedure Handler (Widget    : access Gtk_Old_Editable_Record'Class; 
  237.    --                       Direction : in Gint); 
  238.    -- 
  239.    --    Emitting this signal deletes a single character. If Direction 
  240.    --    is positive, delete forward, else delete backward. 
  241.    -- 
  242.    --  - "kill_word" 
  243.    --    procedure Handler (Widget    : access Gtk_Old_Editable_Record'Class; 
  244.    --                       Direction : in Gint); 
  245.    -- 
  246.    --    Emitting this signal deletes a single word. If Direction is 
  247.    --    positive, delete forward, otherwise delete backward. 
  248.    -- 
  249.    --  - "kill_line" 
  250.    --    procedure Handler (Widget    : access Gtk_Old_Editable_Record'Class; 
  251.    --                       Direction : in Gint); 
  252.    -- 
  253.    --    Emitting this signal deletes a single line. If Direction is 
  254.    --    positive, delete forward, otherwise delete backward. 
  255.    -- 
  256.    --  - "cut_clipboard" 
  257.    --    procedure Handler (Widget : access Gtk_Old_Editable_Record'Class); 
  258.    -- 
  259.    --    Emitting this signal will cut the current selection to the 
  260.    --    clipboard. 
  261.    -- 
  262.    --  - "copy_clipboard" 
  263.    --    procedure Handler (Widget : access Gtk_Old_Editable_Record'Class); 
  264.    -- 
  265.    --    Emitting this signal will copy the current selection to the 
  266.    --    clipboard. 
  267.    -- 
  268.    --  - "paste_clipboard" 
  269.    --    procedure Handler (Widget : access Gtk_Old_Editable_Record'Class); 
  270.    -- 
  271.    --    Emitting this signal will paste the clipboard into the text 
  272.    --    of the widget at the current cursor position. 
  273.    -- 
  274.    --  </signals> 
  275.  
  276.    Signal_Activate        : constant Glib.Signal_Name := "activate"; 
  277.    Signal_Copy_Clipboard  : constant Glib.Signal_Name := "copy_clipboard"; 
  278.    Signal_Cut_Clipboard   : constant Glib.Signal_Name := "cut_clipboard"; 
  279.    Signal_Kill_Char       : constant Glib.Signal_Name := "kill_char"; 
  280.    Signal_Kill_Line       : constant Glib.Signal_Name := "kill_line"; 
  281.    Signal_Kill_Word       : constant Glib.Signal_Name := "kill_word"; 
  282.    Signal_Move_Cursor     : constant Glib.Signal_Name := "move_cursor"; 
  283.    Signal_Move_Page       : constant Glib.Signal_Name := "move_page"; 
  284.    Signal_Move_To_Column  : constant Glib.Signal_Name := "move_to_column"; 
  285.    Signal_Move_To_Row     : constant Glib.Signal_Name := "move_to_row"; 
  286.    Signal_Move_Word       : constant Glib.Signal_Name := "move_word"; 
  287.    Signal_Paste_Clipboard : constant Glib.Signal_Name := "paste_clipboard"; 
  288.    Signal_Set_Editable    : constant Glib.Signal_Name := "set-editable"; 
  289.  
  290. private 
  291.    type Gtk_Old_Editable_Record is new Gtk.Widget.Gtk_Widget_Record 
  292.      with null record; 
  293.    pragma Import (C, Get_Type, "gtk_old_editable_get_type"); 
  294. end Gtk.Old_Editable;