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