1-----------------------------------------------------------------------
2--               GtkAda - Ada95 binding for Gtk+/Gnome               --
3--                                                                   --
4--   Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet   --
5--                Copyright (C) 2000-2013, 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--  A Gtk_Entry is a single line text editing widget.
32--  The text is automatically scrolled if it is longer than can be displayed
33--  on the screen, so that the cursor position is visible at all times.
34--
35--  See Gtk_Text_View for a multiple-line text editing widget.
36--  </description>
37--  <c_version>2.16.6</c_version>
38--  <group>Numeric/Text Data Entry</group>
39--  <testgtk>create_entry.adb</testgtk>
40--  <screenshot>gtk-gentry</screenshot>
41
42with Glib.G_Icon;
43with Glib.Properties;
44with Gdk.Dnd;
45with Gdk.Pixbuf;
46with Gtk.Adjustment;
47with Gtk.Editable;
48with Gtk.Entry_Completion;  use Gtk.Entry_Completion;
49with Gtk.Image;
50with Gtk.Selection;
51with Gtk.Style;
52with Pango.Layout;
53
54package Gtk.GEntry is
55
56   type Gtk_Entry_Icon_Position is
57     (Gtk_Entry_Icon_Primary, Gtk_Entry_Icon_Secondary);
58   pragma Convention (C, Gtk_Entry_Icon_Position);
59
60   type Gtk_Entry_Record is new Gtk.Editable.Gtk_Editable_Record with private;
61   --  Gtk_Entry is actually a child of Gtk_Widget, and implements the
62   --  Gtk_Editable interface, but GtkAda does not support yet interfaces,
63   --  so use direct inheritance for now ???
64
65   type Gtk_Entry is access all Gtk_Entry_Record'Class;
66   subtype Gtk_GEntry is Gtk_Entry;
67
68   procedure Gtk_New (Widget : out Gtk_Entry);
69   --  Create a new entry with no maximum length for the text
70
71   procedure Initialize (Widget : access Gtk_Entry_Record'Class);
72   --  Internal initialization function.
73   --  See the section "Creating your own widgets" in the documentation.
74
75   function Get_Type return Gtk.Gtk_Type;
76   --  Return the internal value associated with a Gtk_Entry.
77
78   function Get_Text_Length (The_Entry : access Gtk_Entry_Record)
79      return Guint16;
80   --  Retrieves the current length of the text in The_Entry.
81
82   procedure Set_Visibility
83     (The_Entry : access Gtk_Entry_Record; Visible : Boolean);
84   function Get_Visibility
85     (The_Entry : access Gtk_Entry_Record) return Boolean;
86   --  Set the visibility of the characters in the entry.
87   --  If Visible is set to False, the characters will be replaced with
88   --  the invisible character ('*' by default) in the display, and when the
89   --  text is copied elsewhere.
90
91   procedure Set_Invisible_Char
92     (The_Entry : access Gtk_Entry_Record; Char : Gunichar);
93   function Get_Invisible_Char
94     (The_Entry : access Gtk_Entry_Record) return Gunichar;
95   --  Gets/Sets the character to use in place of the actual text when
96   --  Set_Visibility has been called to set text visibility to False.
97   --  i.e. this is the character used in "password mode" to
98   --  show the user how many characters have been typed. By default, GTK+
99   --  picks the best invisible char available in the current font. If you
100   --  set the invisible char to 0, then the user will get no feedback
101   --  at all; there will be no text on the screen as they type.
102
103   procedure Unset_Invisible_Char (The_Entry : access Gtk_Entry_Record);
104   --  Unsets the invisible char previously set with Set_Invisible_Char,
105   --  so that the default invisible char is used again.
106
107   procedure Set_Has_Frame
108     (The_Entry : access Gtk_Entry_Record; Setting : Boolean := True);
109   function Get_Has_Frame
110     (The_Entry : access Gtk_Entry_Record) return Boolean;
111   --  Set whether the entry has a beveled frame around it.
112
113   procedure Set_Max_Length
114     (The_Entry : access Gtk_Entry_Record; Max : Gint);
115   function Get_Max_Length (The_Entry : access Gtk_Entry_Record) return Gint;
116   --  Set the maximum length for the text.
117   --  The current text is truncated if needed.
118
119   procedure Set_Activates_Default
120     (The_Entry : access Gtk_Entry_Record; Setting : Boolean);
121   function Get_Activates_Default
122     (The_Entry : access Gtk_Entry_Record) return Boolean;
123   --  If Setting is True, pressing Enter in the Entry will activate the
124   --  default widget for the window containing the entry. This usually means
125   --  that the dialog box containing the entry will be closed, since the
126   --  default widget is usually one of the dialog buttons.
127   --
128   --  (For experts: if Setting is True, the entry calls
129   --  Gtk.Window.Activate_Default on the window containing the entry, in
130   --  the default handler for the "activate" signal.)
131
132   procedure Set_Width_Chars
133     (The_Entry : access Gtk_Entry_Record'Class; Width : Gint);
134   function Get_Width_Chars
135     (The_Entry : access Gtk_Entry_Record'Class) return Gint;
136   --  Number of characters to leave space for in the entry, on the screen.
137   --  This is the number of visible characters, not the maximal number of
138   --  characters the entry can contain
139
140   procedure Set_Text
141     (The_Entry : access Gtk_Entry_Record; Text : UTF8_String);
142   function Get_Text (The_Entry : access Gtk_Entry_Record) return UTF8_String;
143   --  Modify the text in the entry.
144   --  The text is cut at the maximum length that was set when the entry was
145   --  created.
146   --  The text replaces the current contents.
147
148   procedure Set_Alignment (Ent  : access Gtk_Entry_Record; Xalign : Gfloat);
149   function Get_Alignment   (Ent : access Gtk_Entry_Record) return Gfloat;
150   --  Sets the alignment for the contents of the entry. This controls
151   --  the horizontal positioning of the contents when the displayed
152   --  text is shorter than the width of the entry.
153
154   procedure Set_Completion
155     (Ent        : access Gtk_Entry_Record;
156      Completion : access Gtk_Entry_Completion_Record'Class);
157   function Get_Completion
158     (Ent : access Gtk_Entry_Record)
159      return Gtk_Entry_Completion;
160   --  Sets Completion to be the auxiliary completion object to use with Ent.
161   --  All further configuration of the completion mechanism is done on
162   --  Completion using the Gtk.Entry_Completion API.
163
164   function Text_Index_To_Layout_Index
165     (Ent        : access Gtk_Entry_Record;
166      Text_Index : Gint)
167      return Gint;
168   --  Converts from a position in the entry's layout (returned by Get_Layout)
169   --  to a position in the entry contents (returned by Get_Text).
170   --  Returns the byte index into the entry layout text
171
172   function Layout_Index_To_Text_Index
173     (Ent           : access Gtk_Entry_Record;
174      Layout_Index : Gint)
175      return Gint;
176   --  Converts from a position in the entry contents (returned
177   --  by Get_Text) to a position in the
178   --  entry's layout (returned by Get_Layout,
179   --  with text retrieved via pango.layout.Get_Text).
180   --  Return the byte index into the entry contents
181
182   procedure Get_Layout_Offsets
183     (The_Entry : access Gtk_Entry_Record;
184      X         : out Gint;
185      Y         : out Gint);
186   --  Obtain the position of the Pango_Layout used to render text
187   --  in the entry, in widget coordinates. Useful if you want to line
188   --  up the text in an entry with some other text, e.g. when using the
189   --  entry to implement editable cells in a sheet widget.
190   --
191   --  Also useful to convert mouse events into coordinates inside the
192   --  Pango_Layout, e.g. to take some action if some part of the entry text
193   --  is clicked.
194   --
195   --  Note that as the user scrolls around in the entry the offsets will
196   --  change; you'll need to connect to the "notify::scroll_offset"
197   --  signal to track this. Remember when using the Pango_Layout
198   --  functions you need to convert to and from pixels using
199   --  Pango_Pixels or Pango_Scale.
200
201   function Get_Layout (The_Entry : access Gtk_Entry_Record)
202      return Pango.Layout.Pango_Layout;
203   --  Return the widget that manages all the layout of text (left-to-right,
204   --  right-to-left, fonts,...). Changing the font used for the entry should
205   --  be done by changing the font using for this layout. Note that you should
206   --  also change the font in the Pango_Context returned by Get_Pango_Context,
207   --  or the next keypress event in the entry will restore the default initial
208   --  font.
209   --
210   --  The layout is useful to e.g. convert text positions to pixel positions,
211   --  in combination with Get_Layout_Offsets.  The returned layout is owned by
212   --  the entry so need not be freed by the caller.
213
214   function Get_Current_Icon_Drag_Source (The_Entry : access Gtk_Entry_Record)
215      return Gint;
216   --  Returns the index of the icon which is the source of the current
217   --  DND operation, or -1.
218   --
219   --  This function is meant to be used in a #GtkWidget::drag-data-get
220   --  callback.
221
222   procedure Set_Icon_Drag_Source
223     (The_Entry   : access Gtk_Entry_Record;
224      Icon_Pos    : Gtk_Entry_Icon_Position;
225      Target_List : Gtk.Selection.Target_List;
226      Actions     : Gdk.Dnd.Drag_Action);
227   --  Sets up the icon at the given position so that GTK+ will start a drag
228   --  operation when the user clicks and drags the icon.
229   --
230   --  To handle the drag operation, you need to connect to the usual
231   --  #GtkWidget::drag-data-get (or possibly #GtkWidget::drag-data-delete)
232   --  signal, and use Get_Current_Icon_Drag_Source in your signal handler
233   --  to find out if the drag was started from an icon.
234   --
235   --  By default, GTK+ uses the icon as the drag icon. You can use the
236   --  #GtkWidget::drag-begin signal to set a different icon. Note that you
237   --  have to use g_signal_connect_after() to ensure that your signal handler
238   --  gets executed after the default handler.
239
240   function Get_Cursor_Hadjustment (The_Entry : access Gtk_Entry_Record)
241      return Gtk.Adjustment.Gtk_Adjustment;
242   procedure Set_Cursor_Hadjustment
243     (The_Entry  : access Gtk_Entry_Record;
244      Adjustment : access Gtk.Adjustment.Gtk_Adjustment_Record'Class);
245   --  Hooks up an adjustment to the cursor position in an entry, so that when
246   --  the cursor is moved, the adjustment is scrolled to show that position.
247   --  See Gtk.Scrolled_Window.Get_Hadjustment for a typical way of obtaining
248   --  the adjustment.
249   --
250   --  The adjustment has to be in pixel units and in the same coordinate
251   --  system as the entry.
252   --
253   --  Get_Cursor_Hadjustment returns the horizontal cursor adjustment, or
254   --  null if none has been set.
255
256   function Get_Icon_Activatable
257     (The_Entry : access Gtk_Entry_Record;
258      Icon_Pos  : Gtk_Entry_Icon_Position)
259      return Boolean;
260   procedure Set_Icon_Activatable
261     (The_Entry   : access Gtk_Entry_Record;
262      Icon_Pos    : Gtk_Entry_Icon_Position;
263      Activatable : Boolean);
264   --  Get/Sets whether the icon is activatable.
265
266   function Get_Icon_At_Pos
267     (The_Entry : access Gtk_Entry_Record;
268      X         : Gint;
269      Y         : Gint)
270      return Gint;
271   --  Finds the icon at the given position and return its index.
272   --  If (X, Y) doesn't lie inside an icon, -1 is returned.
273   --  This function is intended for use in a GtkWidget "query-tooltip"
274   --  signal handler.
275
276   function Get_Icon_Gicon
277     (The_Entry : access Gtk_Entry_Record;
278      Icon_Pos  : Gtk_Entry_Icon_Position)
279      return Glib.G_Icon.G_Icon;
280   procedure Set_Icon_From_Gicon
281     (The_Entry : access Gtk_Entry_Record;
282      Icon_Pos  : Gtk_Entry_Icon_Position;
283      Icon      : Glib.G_Icon.G_Icon);
284   --  Sets the icon shown in the entry at the specified position
285   --  from the current icon theme.
286   --  If the icon isn't known, a "broken image" icon will be displayed
287   --  instead.
288   --
289   --  If Icon is null, no icon will be shown in the specified position.
290
291   function Get_Icon_Name
292     (The_Entry : access Gtk_Entry_Record;
293      Icon_Pos  : Gtk_Entry_Icon_Position)
294      return UTF8_String;
295   --  Retrieves the icon name used for the icon, or "" if there is
296   --  no icon or if the icon was set by some other method (e.g., by
297   --  pixbuf, stock or gicon).
298
299   procedure Set_Icon_From_Icon_Name
300     (The_Entry : access Gtk_Entry_Record;
301      Icon_Pos  : Gtk_Entry_Icon_Position;
302      Icon_Name : UTF8_String);
303   --  Sets the icon shown in the entry at the specified position
304   --  from the current icon theme.
305   --
306   --  If the icon name isn't known, a "broken image" icon will be displayed
307   --  instead.
308   --
309   --  If Icon_Name is "", no icon will be shown in the specified position.
310
311   function Get_Icon_Pixbuf
312     (The_Entry : access Gtk_Entry_Record;
313      Icon_Pos  : Gtk_Entry_Icon_Position)
314      return Gdk.Pixbuf.Gdk_Pixbuf;
315   --  Retrieves the image used for the icon.
316   --
317   --  Unlike the other methods of setting and getting icon data, this
318   --  method will work regardless of whether the icon was set using a
319   --  Gdk_Pixbuf, a G_Icon, a stock item, or an icon name.
320   --
321   --  Returns: A Gdk_Pixbuf, or null if no icon is set for this position.
322
323   procedure Set_Icon_From_Pixbuf
324     (The_Entry : access Gtk_Entry_Record;
325      Icon_Pos  : Gtk_Entry_Icon_Position;
326      Pixbuf    : Gdk.Pixbuf.Gdk_Pixbuf);
327   --  Sets the icon shown in the specified position using a pixbuf.
328   --  If Pixbuf is null, no icon will be shown in the specified position.
329
330   function Get_Icon_Stock
331     (The_Entry : access Gtk_Entry_Record;
332      Icon_Pos  : Gtk_Entry_Icon_Position)
333      return UTF8_String;
334   --  Retrieves the stock id used for the icon, or "" if there is
335   --  no icon or if the icon was set by some other method (e.g., by
336   --  pixbuf, icon name or gicon).
337   --
338   --  Returns a stock id, or "" if no icon is set or if the icon
339   --  wasn't set from a stock id
340
341   procedure Set_Icon_From_Stock
342     (The_Entry : access Gtk_Entry_Record;
343      Icon_Pos  : Gtk_Entry_Icon_Position;
344      Stock_Id  : UTF8_String);
345   --  Sets the icon shown in the entry at the specified position from
346   --  a stock image.
347   --
348   --  If Stock_Id is "", no icon will be shown in the specified position.
349
350   function Get_Icon_Sensitive
351     (The_Entry : access Gtk_Entry_Record;
352      Icon_Pos  : Gtk_Entry_Icon_Position)
353      return Boolean;
354   procedure Set_Icon_Sensitive
355     (The_Entry : access Gtk_Entry_Record;
356      Icon_Pos  : Gtk_Entry_Icon_Position;
357      Sensitive : Boolean);
358   --  Gets/Sets the sensitivity for the specified icon.
359
360   function Get_Icon_Storage_Type
361     (The_Entry : access Gtk_Entry_Record;
362      Icon_Pos  : Gtk_Entry_Icon_Position)
363      return Gtk.Image.Gtk_Image_Type;
364   --  Gets the type of representation being used by the icon
365   --  to store image data. If the icon has no image data,
366   --  the return value will be Gtk.Image.Image_Empty.
367
368   function Get_Icon_Tooltip_Markup
369     (The_Entry : access Gtk_Entry_Record;
370      Icon_Pos  : Gtk_Entry_Icon_Position)
371      return UTF8_String;
372   procedure Set_Icon_Tooltip_Markup
373     (The_Entry : access Gtk_Entry_Record;
374      Icon_Pos  : Gtk_Entry_Icon_Position;
375      Tooltip   : UTF8_String);
376   --  Gets/Sets Tooltip as the contents of the tooltip for the icon at
377   --  the specified position. Tooltip is assumed to be marked up with
378   --  the Pango text markup language.
379   --
380   --  Use "" for Tooltip to remove an existing tooltip.
381   --
382   --  See also Gtk.Widget.Set_Tooltip_Markup and Set_Icon_Tooltip_Text
383
384   function Get_Icon_Tooltip_Text
385     (The_Entry : access Gtk_Entry_Record;
386      Icon_Pos  : Gtk_Entry_Icon_Position)
387      return UTF8_String;
388   procedure Set_Icon_Tooltip_Text
389     (The_Entry : access Gtk_Entry_Record;
390      Icon_Pos  : Gtk_Entry_Icon_Position;
391      Tooltip   : UTF8_String);
392   --  Gets/Sets Tooltip as the contents of the tooltip for the icon
393   --  at the specified position.
394   --
395   --  Use "" for Tooltip to remove an existing tooltip.
396   --
397   --  See also Gtk.Widget.Set_Tooltip_Text and Set_Icon_Tooltip_Markup
398
399   function Get_Inner_Border (The_Entry : access Gtk_Entry_Record)
400      return Gtk.Style.Gtk_Border;
401   procedure Set_Inner_Border
402     (The_Entry : access Gtk_Entry_Record;
403      Border    : Gtk.Style.Gtk_Border);
404   --  Gets/Sets The_Entry's inner-border property.  null signifies that
405   --  the property is (should be) cleared.  The inner-border is the area
406   --  around the entry's text, but inside its frame.
407   --
408   --  If set, this property overrides the inner-border style property.
409   --  Overriding the style-provided border is useful when you want to do
410   --  in-place editing of some text in a canvas or list widget, where
411   --  pixel-exact positioning of the entry is important.
412
413   function Get_Overwrite_Mode (The_Entry : access Gtk_Entry_Record)
414      return Boolean;
415   procedure Set_Overwrite_Mode
416     (The_Entry : access Gtk_Entry_Record;
417      Overwrite : Boolean);
418   --  Gets/Sets whether text is overwritten when typing in the Gtk_Entry.
419
420   function Get_Progress_Fraction (The_Entry : access Gtk_Entry_Record)
421      return Gdouble;
422   procedure Set_Progress_Fraction
423     (The_Entry : access Gtk_Entry_Record;
424      Fraction  : Gdouble);
425   --  Causes the entry's progress indicator to "fill in" the given
426   --  fraction of the bar. The fraction should be between 0.0 and 1.0,
427   --  inclusive.
428
429   function Get_Progress_Pulse_Step (The_Entry : access Gtk_Entry_Record)
430      return Gdouble;
431   procedure Set_Progress_Pulse_Step
432     (The_Entry : access Gtk_Entry_Record;
433      Fraction  : Gdouble);
434   --  Gets/Sets the fraction of total entry width to move the progress
435   --  bouncing block for each call to Progress_Pulse.
436
437   procedure Progress_Pulse (The_Entry : access Gtk_Entry_Record);
438   --  Indicates that some progress is made, but you don't know how much.
439   --  Causes the entry's progress indicator to enter "activity mode,"
440   --  where a block bounces back and forth. Each call to
441   --  Progress_Pulse causes the block to move by a little bit
442   --  (the amount of movement per pulse is determined by
443   --  Set_Progress_Pulse_Step).
444
445   -----------------
446   -- Obsolescent --
447   -----------------
448   --  All subprograms below are now obsolescent in gtk+. They might be removed
449   --  from future versions of gtk+ (and therefore GtkAda).
450   --  To find out whether your code uses any of these, we recommend compiling
451   --  with the -gnatwj switch
452   --  <doc_ignore>
453
454   procedure Gtk_New (Widget : out Gtk_Entry; Max : Gint);
455   pragma Obsolescent;  --  New_With_Max_Length
456   --  Create a new entry with a maximum length for the text.
457   --  The text can never be longer than Max characters.
458
459   procedure Initialize
460     (Widget : access Gtk_Entry_Record'Class; Max : Gint);
461   pragma Obsolescent;
462   --  Internal initialization function.
463   --  See the section "Creating your own widgets" in the documentation.
464
465   procedure Append_Text
466     (The_Entry : access Gtk_Entry_Record; Text : UTF8_String);
467   pragma Obsolescent ("See Gtk.Editable.Insert_Text");  --  Append_Text
468   --  Append a new string at the end of the existing one.
469
470   procedure Prepend_Text
471     (The_Entry : access Gtk_Entry_Record; Text : UTF8_String);
472   pragma Obsolescent ("See Gtk.Editable.Insert_Text");  --  Prepend_Text
473   --  Insert some text at the beginning of the entry.
474
475   procedure Set_Editable
476     (The_Entry : access Gtk_Entry_Record; Editable : Boolean);
477   pragma Obsolescent;  --  Set_Editable
478
479   function Get_Chars (The_Entry : access Gtk_Entry_Record) return UTF8_String
480                       renames Get_Text;
481   --  pragma Obsolescent;
482   --  Convenience function provided for compatibility with GtkAda 1.2
483
484   --  </doc_ignore>
485
486   ----------------
487   -- Properties --
488   ----------------
489
490   --  <properties>
491   --  The following properties are defined for this widget. See
492   --  Glib.Properties for more information on properties.
493   --
494   --  Name:  Activates_Default_Property
495   --  Type:  Boolean
496   --  Flags: read-write
497   --  Descr: Whether to activate the default widget (such as the default
498   --         button in a dialog) when Enter is pressed.)
499   --
500   --  Name:  Caps_Lock_Warning_Property
501   --  Type:  Boolean
502   --  Descr: Whether password entries will show a warning when Caps Lock is on
503   --
504   --  Name:  Cursor_Position_Property
505   --  Type:  Int
506   --  Descr: The current position of the insertion cursor in chars
507   --
508   --  Name:  Editable_Property
509   --  Type:  Boolean
510   --  Flags: read-write
511   --  Descr: Whether the entry contents can be edited
512   --  See also:  Set_Editable
513   --
514   --  Name:  Has_Frame_Property
515   --  Type:  Boolean
516   --  Descr: FALSE removes outside bevel from entry
517   --
518   --  Name:  Im_Module_Property
519   --  Type:  String
520   --  Descr: Which IM module should be used
521   --
522   --  Name:  Inner_Border_Property
523   --  Type:  Boxed
524   --  Descr: Border between text and frame. Overrides the inner-border
525   --         style property
526   --
527   --  Name:  Invisible_Char_Property
528   --  Type:  Gunichar
529   --  Flags: read-write
530   --  Descr: The character to use when masking entry contents
531   --         (in "password mode")
532   --
533   --  Name:  Invisible_Char_Set_Property
534   --  Type:  Boolean
535   --  Descr: Whether the invisible char has been set
536   --
537   --  Name:  Max_Length_Property
538   --  Type:  Gint
539   --  Flags: read-write
540   --  Descr: Maximum number of characters for this entry
541   --  See also:  Set_Max_Length
542   --
543   --  Name:  Overwrite_Mode_Property
544   --  Type:  Boolean
545   --  Descr: Whether new text overwrites existing text
546   --
547   --  Name:  Primary_Icon_Activatable_Property
548   --  Type:  Boolean
549   --  Descr: Whether the primary icon is activatable
550   --
551   --  Name:  Primary_Icon_Gicon_Property
552   --  Type:  Object
553   --  Descr: GIcon for primary icon
554   --
555   --  Name:  Primary_Icon_Name_Property
556   --  Type:  String
557   --  Descr: Icon name for primary icon
558   --
559   --  Name:  Primary_Icon_Pixbuf_Property
560   --  Type:  Object
561   --  Descr: Primary pixbuf for the entry
562   --
563   --  Name:  Primary_Icon_Sensitive_Property
564   --  Type:  Boolean
565   --  Descr: Whether the primary icon is sensitive
566   --
567   --  Name:  Primary_Icon_Stock_Property
568   --  Type:  String
569   --  Descr: Stock ID for primary icon
570   --
571   --  Name:  Primary_Icon_Storage_Type_Property
572   --  Type:  Enum
573   --  Descr: The representation being used for primary icon
574   --
575   --  Name:  Primary_Icon_Tooltip_Markup_Property
576   --  Type:  String
577   --  Descr: The contents of the tooltip on the primary icon
578   --
579   --  Name:  Primary_Icon_Tooltip_Text_Property
580   --  Type:  String
581   --  Descr: The contents of the tooltip on the primary icon
582   --
583   --  Name:  Progress_Fraction_Property
584   --  Type:  Double
585   --  Descr: The current fraction of the task that's been completed
586   --
587   --  Name:  Progress_Pulse_Step_Property
588   --  Type:  Double
589   --  Descr: The fraction of total entry width to move the progress
590   --         bouncing block for each call to Progress_Pulse
591   --
592   --  Name:  Scroll_Offset_Property
593   --  Type:  Gint
594   --  Flags: read only
595   --  Descr: Number of pixels of the entry scrolled off the screen to the
596   --         left
597   --
598   --  Name:  Secondary_Icon_Activatable_Property
599   --  Type:  Boolean
600   --  Descr: Whether the secondary icon is activatable
601   --
602   --  Name:  Secondary_Icon_Gicon_Property
603   --  Type:  Object
604   --  Descr: GIcon for secondary icon
605   --
606   --  Name:  Secondary_Icon_Name_Property
607   --  Type:  String
608   --  Descr: Icon name for secondary icon
609   --
610   --  Name:  Secondary_Icon_Pixbuf_Property
611   --  Type:  Object
612   --  Descr: Secondary pixbuf for the entry
613   --
614   --  Name:  Secondary_Icon_Sensitive_Property
615   --  Type:  Boolean
616   --  Descr: Whether the secondary icon is sensitive
617   --
618   --  Name:  Secondary_Icon_Stock_Property
619   --  Type:  String
620   --  Descr: Stock ID for secondary icon
621   --
622   --  Name:  Secondary_Icon_Storage_Type_Property
623   --  Type:  Enum
624   --  Descr: The representation being used for secondary icon
625   --
626   --  Name:  Secondary_Icon_Tooltip_Markup_Property
627   --  Type:  String
628   --  Descr: The contents of the tooltip on the secondary icon
629   --
630   --  Name:  Secondary_Icon_Tooltip_Text_Property
631   --  Type:  String
632   --  Descr: The contents of the tooltip on the secondary icon
633   --
634   --  Name:  Selection_Bound_Property
635   --  Type:  Int
636   --  Descr: The position of the opposite end of the selection from the cursor
637   --         in chars
638   --
639   --  Name:  Shadow_Type_Property
640   --  Type:  Enum
641   --  Descr: Which kind of shadow to draw around the entry when has-frame
642   --         is set
643   --
644   --  Name:  Text_Length_Property
645   --  Type:  Uint
646   --  Descr: Length of the text currently in the entry
647   --
648   --  Name:  Text_Position_Property
649   --  Type:  Gint
650   --  Flags: read-write
651   --  Descr: The current position of the insertion point
652   --
653   --  Name:  Text_Property
654   --  Type:  String
655   --  Descr: The contents of the entry
656   --
657   --  Name:  Truncate_Multiline_Property
658   --  Type:  Boolean
659   --  Descr: Whether to truncate multiline pastes to one line.
660   --
661   --  Name:  Visibility_Property
662   --  Type:  Boolean
663   --  Flags: read-write
664   --  Descr: FALSE displays the "invisible char" instead of the actual
665   --         text (password mode)
666   --  See also:  Set_Visibility
667   --
668   --  Name:  Width_Chars_Property
669   --  Type:  Gint
670   --  Flags: read-write
671   --  Descr: Number of characters to leave space for in the entry.
672   --  See also: Set_Width_Chars
673   --
674   --  Name:  Xalign_Property
675   --  Type:  Float
676   --  Descr: The horizontal alignment, from 0 (left) to 1 (right). Reversed
677   --         for RTL layouts.
678   --
679   --  </properties>
680
681   Activates_Default_Property : constant Glib.Properties.Property_Boolean;
682   Caps_Lock_Warning_Property : constant Glib.Properties.Property_Boolean;
683   Cursor_Position_Property   : constant Glib.Properties.Property_Int;
684   Editable_Property          : constant Glib.Properties.Property_Boolean;
685   Has_Frame_Property         : constant Glib.Properties.Property_Boolean;
686   Im_Module_Property         : constant Glib.Properties.Property_String;
687   Inner_Border_Property      : constant Glib.Properties.Property_Boxed;
688   Invisible_Char_Property    : constant Glib.Properties.Property_Unichar;
689   Invisible_Char_Set_Property :
690                                constant Glib.Properties.Property_Boolean;
691   Max_Length_Property        : constant Glib.Properties.Property_Int;
692   Overwrite_Mode_Property    : constant Glib.Properties.Property_Boolean;
693   Primary_Icon_Activatable_Property :
694                                constant Glib.Properties.Property_Boolean;
695   Primary_Icon_Gicon_Property :
696                                constant Glib.Properties.Property_Object;
697   Primary_Icon_Name_Property : constant Glib.Properties.Property_String;
698   Primary_Icon_Pixbuf_Property :
699                                constant Glib.Properties.Property_Object;
700   Primary_Icon_Sensitive_Property :
701                                constant Glib.Properties.Property_Boolean;
702   Primary_Icon_Stock_Property :
703                                constant Glib.Properties.Property_String;
704   Primary_Icon_Storage_Type_Property :
705                                constant Glib.Properties.Property_Enum;
706   Primary_Icon_Tooltip_Markup_Property :
707                                constant Glib.Properties.Property_String;
708   Primary_Icon_Tooltip_Text_Property :
709                                constant Glib.Properties.Property_String;
710   Progress_Fraction_Property : constant Glib.Properties.Property_Double;
711   Progress_Pulse_Step_Property :
712                                constant Glib.Properties.Property_Double;
713   Scroll_Offset_Property     : constant Glib.Properties.Property_Int;
714   Secondary_Icon_Activatable_Property :
715                                constant Glib.Properties.Property_Boolean;
716   Secondary_Icon_Gicon_Property :
717                                constant Glib.Properties.Property_Object;
718   Secondary_Icon_Name_Property :
719                                constant Glib.Properties.Property_String;
720   Secondary_Icon_Pixbuf_Property :
721                                constant Glib.Properties.Property_Object;
722   Secondary_Icon_Sensitive_Property :
723                                constant Glib.Properties.Property_Boolean;
724   Secondary_Icon_Stock_Property :
725                                constant Glib.Properties.Property_String;
726   Secondary_Icon_Storage_Type_Property :
727                                constant Glib.Properties.Property_Enum;
728   Secondary_Icon_Tooltip_Markup_Property :
729                                constant Glib.Properties.Property_String;
730   Secondary_Icon_Tooltip_Text_Property :
731                                constant Glib.Properties.Property_String;
732   Selection_Bound_Property   : constant Glib.Properties.Property_Int;
733   Shadow_Type_Property       : constant Glib.Properties.Property_Enum;
734   Text_Length_Property       : constant Glib.Properties.Property_Uint;
735   Text_Position_Property     : constant Glib.Properties.Property_Int;
736   Text_Property              : constant Glib.Properties.Property_String;
737   Truncate_Multiline_Property :
738                                constant Glib.Properties.Property_Boolean;
739   Visibility_Property        : constant Glib.Properties.Property_Boolean;
740   Width_Chars_Property       : constant Glib.Properties.Property_Int;
741   Xalign_Property            : constant Glib.Properties.Property_Float;
742
743   ----------------------
744   -- Style Properties --
745   ----------------------
746   --  The following properties can be changed through the gtk theme and
747   --  configuration files, and retrieved through Gtk.Widget.Style_Get_Property
748
749   --  <style_properties>
750   --  Name:  Icon_Prelight_Property
751   --  Type:  Boolean
752   --  Descr: Whether activatable icons should prelight when hovered
753   --
754   --  Name:  Progress_Border_Property
755   --  Type:  Boxed
756   --  Descr: Border around the progress bar
757   --
758   --  Name:  State_Hint_Property
759   --  Type:  Boolean
760   --  Descr: Whether to pass a proper state when drawing shadow or background
761   --
762   --  </style_properties>
763
764   Icon_Prelight_Property   : constant Glib.Properties.Property_Boolean;
765   Progress_Border_Property : constant Glib.Properties.Property_Boxed;
766   State_Hint_Property      : constant Glib.Properties.Property_Boolean;
767
768   -------------
769   -- Signals --
770   -------------
771
772   --  <signals>
773   --  The following new signals are defined for this widget:
774   --
775   --  - "activate"
776   --    procedure Handler (Ent : access Gtk_Entry_Record'Class);
777   --    Called when the entry is activated, for instance when the user
778   --    presses <enter> while in it
779   --
780   --  - "populate_popup"
781   --    procedure Handler
782   --       (Ent  : access Gtk_Entry_Record'Class;
783   --        Menu : access Gtk_Menu_Record'Class);
784   --    ???
785   --
786   --  - "move_cursor"
787   --    procedure Handler
788   --       (Ent              : access Gtk_Entry_Record'Class;
789   --        Step             : Gtk_Movement_Step;
790   --        Amount           : Gint;
791   --        Extend_Selection : Boolean);
792   --    You should emit this signal to request that the cursor be moved. This
793   --    is mostly used when connected to a keybinding, as is done by default
794   --    for the arrow keys for instance.
795   --
796   --  - "insert_at_cursor"
797   --    procedure Handler
798   --       (Ent  : access Gtk_Entry_Record'Class;
799   --        Text : String);
800   --    You should emit this signal to request that some text be inserted at
801   --    the current cursor location. This is mostly used from key bindings.
802   --
803   --  - "delete_from_cursor"
804   --    procedure Handler
805   --       (Ent              : access Gtk_Entry_Record'Class;
806   --        Step             : Gtk_Movement_Step;
807   --        Amount           : Gint);
808   --    You should emit this signal to request that some text be delete from
809   --    the cursor position.
810   --
811   --  - "cut_clipboard"
812   --    procedure Handler (Ent : access Gtk_Entry_Record'Class);
813   --    You should emit this signal to request that the current selection be
814   --    deleted and copied into the clipboard. This is mostly used from key
815   --    bindings.
816   --
817   --  - "copy_clipboard"
818   --    procedure Handler (Ent : access Gtk_Entry_Record'Class);
819   --    You should emit this signal to request that the current selection be
820   --    copied into the clipboard. This is mostly used from key
821   --    bindings.
822   --
823   --  - "paste_clipboard"
824   --    procedure Handler (Ent : access Gtk_Entry_Record'Class);
825   --    You should emit this signal to request that the clipboard be inserted
826   --    at the current cursor location. This is mostly used from key bindings.
827   --
828   --  - "toggle_overwrite"
829   --    procedure Handler (Ent : access Gtk_Entry_Record'Class);
830   --    You should emit this signal to request that the insertion mode be
831   --    changed. This is mostly used from a key binding, as is done by default
832   --    for the Insert key.
833   --  </signals>
834
835   Signal_Activate           : constant Glib.Signal_Name :=
836                                 "activate";
837   Signal_Backspace          : constant Glib.Signal_Name :=
838                                 "backspace";
839   Signal_Copy_Clipboard     : constant Glib.Signal_Name :=
840                                 "copy_clipboard";
841   Signal_Cut_Clipboard      : constant Glib.Signal_Name :=
842                                 "cut_clipboard";
843   Signal_Delete_From_Cursor : constant Glib.Signal_Name :=
844                                 "delete_from_cursor";
845   Signal_Insert_At_Cursor   : constant Glib.Signal_Name :=
846                                 "insert_at_cursor";
847   Signal_Move_Cursor        : constant Glib.Signal_Name :=
848                                 "move_cursor";
849   Signal_Paste_Clipboard    : constant Glib.Signal_Name :=
850                                 "paste_clipboard";
851   Signal_Populate_Popup     : constant Glib.Signal_Name :=
852                                 "populate_popup";
853   Signal_Toggle_Overwrite   : constant Glib.Signal_Name :=
854                                 "toggle_overwrite";
855
856private
857   type Gtk_Entry_Record is new
858     Gtk.Editable.Gtk_Editable_Record with null record;
859
860   --  properties
861   Activates_Default_Property : constant Glib.Properties.Property_Boolean :=
862     Glib.Properties.Build ("activates_default");
863   Caps_Lock_Warning_Property : constant Glib.Properties.Property_Boolean :=
864     Glib.Properties.Build ("caps-lock-warning");
865   Cursor_Position_Property : constant Glib.Properties.Property_Int :=
866     Glib.Properties.Build ("cursor-position");
867   Editable_Property : constant Glib.Properties.Property_Boolean :=
868     Glib.Properties.Build ("editable");
869   Has_Frame_Property : constant Glib.Properties.Property_Boolean :=
870     Glib.Properties.Build ("has-frame");
871   Im_Module_Property : constant Glib.Properties.Property_String :=
872     Glib.Properties.Build ("im-module");
873   Inner_Border_Property : constant Glib.Properties.Property_Boxed :=
874     Glib.Properties.Build ("inner-border");
875   Invisible_Char_Property : constant Glib.Properties.Property_Unichar :=
876     Glib.Properties.Build ("invisible_char");
877   Invisible_Char_Set_Property : constant Glib.Properties.Property_Boolean :=
878     Glib.Properties.Build ("invisible-char-set");
879   Max_Length_Property : constant Glib.Properties.Property_Int :=
880     Glib.Properties.Build ("max_length");
881   Overwrite_Mode_Property : constant Glib.Properties.Property_Boolean :=
882     Glib.Properties.Build ("overwrite-mode");
883   Primary_Icon_Activatable_Property :
884     constant Glib.Properties.Property_Boolean :=
885     Glib.Properties.Build ("primary-icon-activatable");
886   Primary_Icon_Gicon_Property : constant Glib.Properties.Property_Object :=
887     Glib.Properties.Build ("primary-icon-gicon");
888   Primary_Icon_Name_Property : constant Glib.Properties.Property_String :=
889     Glib.Properties.Build ("primary-icon-name");
890   Primary_Icon_Pixbuf_Property : constant Glib.Properties.Property_Object :=
891     Glib.Properties.Build ("primary-icon-pixbuf");
892   Primary_Icon_Sensitive_Property :
893     constant Glib.Properties.Property_Boolean :=
894     Glib.Properties.Build ("primary-icon-sensitive");
895   Primary_Icon_Stock_Property : constant Glib.Properties.Property_String :=
896     Glib.Properties.Build ("primary-icon-stock");
897   Primary_Icon_Storage_Type_Property :
898     constant Glib.Properties.Property_Enum :=
899     Glib.Properties.Build ("primary-icon-storage-type");
900   Primary_Icon_Tooltip_Markup_Property :
901     constant Glib.Properties.Property_String :=
902     Glib.Properties.Build ("primary-icon-tooltip-markup");
903   Primary_Icon_Tooltip_Text_Property :
904     constant Glib.Properties.Property_String :=
905     Glib.Properties.Build ("primary-icon-tooltip-text");
906   Progress_Fraction_Property : constant Glib.Properties.Property_Double :=
907     Glib.Properties.Build ("progress-fraction");
908   Progress_Pulse_Step_Property : constant Glib.Properties.Property_Double :=
909     Glib.Properties.Build ("progress-pulse-step");
910   Scroll_Offset_Property : constant Glib.Properties.Property_Int :=
911     Glib.Properties.Build ("scroll_offset");
912   Secondary_Icon_Activatable_Property :
913     constant Glib.Properties.Property_Boolean :=
914     Glib.Properties.Build ("secondary-icon-activatable");
915   Secondary_Icon_Gicon_Property : constant Glib.Properties.Property_Object :=
916     Glib.Properties.Build ("secondary-icon-gicon");
917   Secondary_Icon_Name_Property : constant Glib.Properties.Property_String :=
918     Glib.Properties.Build ("secondary-icon-name");
919   Secondary_Icon_Pixbuf_Property : constant Glib.Properties.Property_Object :=
920     Glib.Properties.Build ("secondary-icon-pixbuf");
921   Secondary_Icon_Sensitive_Property :
922     constant Glib.Properties.Property_Boolean :=
923     Glib.Properties.Build ("secondary-icon-sensitive");
924   Secondary_Icon_Stock_Property : constant Glib.Properties.Property_String :=
925     Glib.Properties.Build ("secondary-icon-stock");
926   Secondary_Icon_Storage_Type_Property :
927     constant Glib.Properties.Property_Enum :=
928     Glib.Properties.Build ("secondary-icon-storage-type");
929   Secondary_Icon_Tooltip_Markup_Property :
930     constant Glib.Properties.Property_String :=
931     Glib.Properties.Build ("secondary-icon-tooltip-markup");
932   Secondary_Icon_Tooltip_Text_Property :
933     constant Glib.Properties.Property_String :=
934     Glib.Properties.Build ("secondary-icon-tooltip-text");
935   Selection_Bound_Property : constant Glib.Properties.Property_Int :=
936     Glib.Properties.Build ("selection-bound");
937   Shadow_Type_Property : constant Glib.Properties.Property_Enum :=
938     Glib.Properties.Build ("shadow-type");
939   Text_Length_Property : constant Glib.Properties.Property_Uint :=
940     Glib.Properties.Build ("text-length");
941   Text_Position_Property : constant Glib.Properties.Property_Int :=
942     Glib.Properties.Build ("text_position");
943   Text_Property : constant Glib.Properties.Property_String :=
944     Glib.Properties.Build ("text");
945   Truncate_Multiline_Property : constant Glib.Properties.Property_Boolean :=
946     Glib.Properties.Build ("truncate-multiline");
947   Visibility_Property : constant Glib.Properties.Property_Boolean :=
948     Glib.Properties.Build ("visibility");
949   Width_Chars_Property : constant Glib.Properties.Property_Int :=
950     Glib.Properties.Build ("width_chars");
951   Xalign_Property : constant Glib.Properties.Property_Float :=
952     Glib.Properties.Build ("xalign");
953
954   --  style properties
955   Icon_Prelight_Property : constant Glib.Properties.Property_Boolean :=
956     Glib.Properties.Build ("icon-prelight");
957   Progress_Border_Property : constant Glib.Properties.Property_Boxed :=
958     Glib.Properties.Build ("progress-border");
959   State_Hint_Property : constant Glib.Properties.Property_Boolean :=
960     Glib.Properties.Build ("state-hint");
961
962   pragma Import (C, Get_Type, "gtk_entry_get_type");
963end Gtk.GEntry;
964
965--  This subprogram was never bound, and is now obsolescent:
966--  No binding: gtk_entry_select_region
967--  No binding: gtk_entry_set_position
968