Gtk.Search_Entry.Gtk_Search_Entry is a subclass of Gtk.GEntry.Gtk_Entry that has been tailored for use as a search entry.
It will show an inactive symbolic "find" icon when the search entry is empty, and a symbolic "clear" icon when there is text. Clicking on the "clear" icon will empty the search entry.
Note that the search/clear icon is shown using a secondary icon, and thus does not work if you are using the secondary icon position for some other purpose.
To make filtering appear more reactive, it is a good idea to not react to every change in the entry text immediately, but only after a short delay. To support this, Gtk.Search_Entry.Gtk_Search_Entry emits the Gtk.Search_Entry.Gtk_Search_Entry::search-changed signal which can be used instead of the Gtk.Editable.Gtk_Editable::changed signal.
The Gtk.Search_Entry.Gtk_Search_Entry::previous-match, Gtk.Search_Entry.Gtk_Search_Entry::next-match and Gtk.Search_Entry.Gtk_Search_Entry::stop-search signals can be used to implement moving between search results and ending the search.
Often, GtkSearchEntry will be fed events by means of being placed inside a Gtk.Search_Bar.Gtk_Search_Bar. If that is not the case, you can use Gtk.Search_Entry.Handle_Event to pass events.
function "+"
(Widget : access Gtk_Search_Entry_Record'Class)
return Gtk.Buildable.Gtk_Buildable
function "+"
(Widget : access Gtk_Search_Entry_Record'Class)
return Gtk.Cell_Editable.Gtk_Cell_Editable
function "+"
(Widget : access Gtk_Search_Entry_Record'Class)
return Gtk.Editable.Gtk_Editable
function "-"
(Interf : Gtk.Buildable.Gtk_Buildable)
return Gtk_Search_Entry
function "-"
(Interf : Gtk.Cell_Editable.Gtk_Cell_Editable)
return Gtk_Search_Entry
function "-"
(Interf : Gtk.Editable.Gtk_Editable)
return Gtk_Search_Entry
type Cb_GObject_Void is not null access procedure
(Self : access Glib.Object.GObject_Record'Class);
type Cb_Gtk_Search_Entry_Void is not null access procedure
(Self : access Gtk_Search_Entry_Record'Class);
procedure Copy_Clipboard
(Editable : not null access Gtk_Search_Entry_Record)
procedure Cut_Clipboard
(Editable : not null access Gtk_Search_Entry_Record)
procedure Delete_Selection
(Editable : not null access Gtk_Search_Entry_Record)
procedure Delete_Text
(Editable : not null access Gtk_Search_Entry_Record;
Start_Pos : Glib.Gint;
End_Pos : Glib.Gint := -1)
procedure Editing_Done
(Cell_Editable : not null access Gtk_Search_Entry_Record)
function Get_Chars
(Editable : not null access Gtk_Search_Entry_Record;
Start_Pos : Glib.Gint;
End_Pos : Glib.Gint := -1) return UTF8_String
function Get_Editable
(Editable : not null access Gtk_Search_Entry_Record) return Boolean
function Get_Position
(Editable : not null access Gtk_Search_Entry_Record) return Glib.Gint
procedure Get_Selection_Bounds
(Editable : not null access Gtk_Search_Entry_Record;
Start_Pos : out Glib.Gint;
End_Pos : out Glib.Gint;
Has_Selection : out Boolean)
function Get_Type return Glib.GType
procedure Gtk_New (Self : out Gtk_Search_Entry)
Creates a Gtk.Search_Entry.Gtk_Search_Entry, with a find icon when the search field is empty, and a clear icon when it isn't. Since: gtk+ 3.6 Initialize does nothing if the object was already created with another call to Initialize* or G_New.
type Gtk_Search_Entry is access all Gtk_Search_Entry_Record'Class;
function Gtk_Search_Entry_New return Gtk_Search_Entry
Creates a Gtk.Search_Entry.Gtk_Search_Entry, with a find icon when the search field is empty, and a clear icon when it isn't. Since: gtk+ 3.6
type Gtk_Search_Entry_Record is new Gtk_Entry_Record with null record;
function Handle_Event
(Self : not null access Gtk_Search_Entry_Record;
Event : Gdk.Event.Gdk_Event) return Boolean
This function should be called when the top-level window which contains the search entry received a key event. If the entry is part of a Gtk.Search_Bar.Gtk_Search_Bar, it is preferable to call Gtk.Search_Bar.Handle_Event instead, which will reveal the entry in addition to passing the event to this function. If the key event is handled by the search entry and starts or continues a search, GDK_EVENT_STOP will be returned. The caller should ensure that the entry is shown in this case, and not propagate the event further. Since: gtk+ 3.16
a key event
GDK_EVENT_STOP if the key press event resulted in a search beginning or continuing, GDK_EVENT_PROPAGATE otherwise.
package Implements_Gtk_Buildable is new Glib.Types.Implements
(Gtk.Buildable.Gtk_Buildable, Gtk_Search_Entry_Record, Gtk_Search_Entry);
package Implements_Gtk_Cell_Editable is new Glib.Types.Implements
(Gtk.Cell_Editable.Gtk_Cell_Editable, Gtk_Search_Entry_Record, Gtk_Search_Entry);
package Implements_Gtk_Editable is new Glib.Types.Implements
(Gtk.Editable.Gtk_Editable, Gtk_Search_Entry_Record, Gtk_Search_Entry);
procedure Initialize
(Self : not null access Gtk_Search_Entry_Record'Class)
Creates a Gtk.Search_Entry.Gtk_Search_Entry, with a find icon when the search field is empty, and a clear icon when it isn't. Since: gtk+ 3.6 Initialize does nothing if the object was already created with another call to Initialize* or G_New.
procedure Insert_Text
(Editable : not null access Gtk_Search_Entry_Record;
New_Text : UTF8_String;
New_Text_Length : Glib.Gint;
Position : in out Glib.Gint)
procedure On_Next_Match
(Self : not null access Gtk_Search_Entry_Record;
Call : Cb_GObject_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
The ::next-match signal is a [keybinding signal][GtkBindingSignal] which gets emitted when the user initiates a move to the next match for the current search string.
Applications should connect to it, to implement moving between matches.
The default bindings for this signal is Ctrl-g.
procedure On_Next_Match
(Self : not null access Gtk_Search_Entry_Record;
Call : Cb_Gtk_Search_Entry_Void;
After : Boolean := False)
The ::next-match signal is a [keybinding signal][GtkBindingSignal] which gets emitted when the user initiates a move to the next match for the current search string.
Applications should connect to it, to implement moving between matches.
The default bindings for this signal is Ctrl-g.
procedure On_Previous_Match
(Self : not null access Gtk_Search_Entry_Record;
Call : Cb_GObject_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
The ::previous-match signal is a [keybinding signal][GtkBindingSignal] which gets emitted when the user initiates a move to the previous match for the current search string.
Applications should connect to it, to implement moving between matches.
The default bindings for this signal is Ctrl-Shift-g.
procedure On_Previous_Match
(Self : not null access Gtk_Search_Entry_Record;
Call : Cb_Gtk_Search_Entry_Void;
After : Boolean := False)
The ::previous-match signal is a [keybinding signal][GtkBindingSignal] which gets emitted when the user initiates a move to the previous match for the current search string.
Applications should connect to it, to implement moving between matches.
The default bindings for this signal is Ctrl-Shift-g.
procedure On_Search_Changed
(Self : not null access Gtk_Search_Entry_Record;
Call : Cb_GObject_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
The Gtk.Search_Entry.Gtk_Search_Entry::search-changed signal is emitted with a short delay of 150 milliseconds after the last change to the entry text.
procedure On_Search_Changed
(Self : not null access Gtk_Search_Entry_Record;
Call : Cb_Gtk_Search_Entry_Void;
After : Boolean := False)
The Gtk.Search_Entry.Gtk_Search_Entry::search-changed signal is emitted with a short delay of 150 milliseconds after the last change to the entry text.
procedure On_Stop_Search
(Self : not null access Gtk_Search_Entry_Record;
Call : Cb_GObject_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
The ::stop-search signal is a [keybinding signal][GtkBindingSignal] which gets emitted when the user stops a search via keyboard input.
Applications should connect to it, to implement hiding the search entry in this case.
The default bindings for this signal is Escape.
procedure On_Stop_Search
(Self : not null access Gtk_Search_Entry_Record;
Call : Cb_Gtk_Search_Entry_Void;
After : Boolean := False)
The ::stop-search signal is a [keybinding signal][GtkBindingSignal] which gets emitted when the user stops a search via keyboard input.
Applications should connect to it, to implement hiding the search entry in this case.
The default bindings for this signal is Escape.
procedure Paste_Clipboard
(Editable : not null access Gtk_Search_Entry_Record)
procedure Remove_Widget
(Cell_Editable : not null access Gtk_Search_Entry_Record)
procedure Select_Region
(Editable : not null access Gtk_Search_Entry_Record;
Start_Pos : Glib.Gint;
End_Pos : Glib.Gint := -1)
procedure Set_Editable
(Editable : not null access Gtk_Search_Entry_Record;
Is_Editable : Boolean)
procedure Set_Position
(Editable : not null access Gtk_Search_Entry_Record;
Position : Glib.Gint)
Signal_Next_Match : constant Glib.Signal_Name := "next-match";
The ::next-match signal is a [keybinding signal][GtkBindingSignal] which gets emitted when the user initiates a move to the next match for the current search string.
Applications should connect to it, to implement moving between matches.
The default bindings for this signal is Ctrl-g.
Signal_Previous_Match : constant Glib.Signal_Name := "previous-match";
The ::previous-match signal is a [keybinding signal][GtkBindingSignal] which gets emitted when the user initiates a move to the previous match for the current search string.
Applications should connect to it, to implement moving between matches.
The default bindings for this signal is Ctrl-Shift-g.
Signal_Search_Changed : constant Glib.Signal_Name := "search-changed";
The Gtk.Search_Entry.Gtk_Search_Entry::search-changed signal is emitted with a short delay of 150 milliseconds after the last change to the entry text.
Signal_Stop_Search : constant Glib.Signal_Name := "stop-search";
The ::stop-search signal is a [keybinding signal][GtkBindingSignal] which gets emitted when the user stops a search via keyboard input.
Applications should connect to it, to implement hiding the search entry in this case.
The default bindings for this signal is Escape.
procedure Start_Editing
(Cell_Editable : not null access Gtk_Search_Entry_Record;
Event : Gdk.Event.Gdk_Event)