Gtk.Search_Entry

Entities

Tagged Types

Access Types

Constants

Subprograms

Generic Instantiations

Description

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
Parameters
Widget
Return Value

"+"

function "+"
  (Widget : access Gtk_Search_Entry_Record'Class)
return Gtk.Cell_Editable.Gtk_Cell_Editable
Parameters
Widget
Return Value

"+"

function "+"
  (Widget : access Gtk_Search_Entry_Record'Class)
return Gtk.Editable.Gtk_Editable
Parameters
Widget
Return Value

"-"

function "-"
  (Interf : Gtk.Buildable.Gtk_Buildable)
return Gtk_Search_Entry
Parameters
Interf
Return Value

"-"

function "-"
  (Interf : Gtk.Cell_Editable.Gtk_Cell_Editable)
return Gtk_Search_Entry
Parameters
Interf
Return Value

"-"

function "-"
  (Interf : Gtk.Editable.Gtk_Editable)
return Gtk_Search_Entry
Parameters
Interf
Return Value

Cb_GObject_Void

type Cb_GObject_Void is not null access procedure
  (Self : access Glib.Object.GObject_Record'Class);
Parameters
Self

Cb_Gtk_Search_Entry_Void

type Cb_Gtk_Search_Entry_Void is not null access procedure
  (Self : access Gtk_Search_Entry_Record'Class);
Parameters
Self

Copy_Clipboard

procedure Copy_Clipboard
   (Editable : not null access Gtk_Search_Entry_Record)
Parameters
Editable

Cut_Clipboard

procedure Cut_Clipboard
   (Editable : not null access Gtk_Search_Entry_Record)
Parameters
Editable

Delete_Selection

procedure Delete_Selection
   (Editable : not null access Gtk_Search_Entry_Record)
Parameters
Editable

Delete_Text

procedure Delete_Text
   (Editable  : not null access Gtk_Search_Entry_Record;
    Start_Pos : Glib.Gint;
    End_Pos   : Glib.Gint := -1)
Parameters
Editable
Start_Pos
End_Pos

Editing_Done

procedure Editing_Done
   (Cell_Editable : not null access Gtk_Search_Entry_Record)
Parameters
Cell_Editable

Get_Chars

function Get_Chars
   (Editable  : not null access Gtk_Search_Entry_Record;
    Start_Pos : Glib.Gint;
    End_Pos   : Glib.Gint := -1) return UTF8_String
Parameters
Editable
Start_Pos
End_Pos
Return Value

Get_Editable

function Get_Editable
   (Editable : not null access Gtk_Search_Entry_Record) return Boolean
Parameters
Editable
Return Value

Get_Position

function Get_Position
   (Editable : not null access Gtk_Search_Entry_Record) return Glib.Gint
Parameters
Editable
Return Value

Get_Selection_Bounds

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)
Parameters
Editable
Start_Pos
End_Pos
Has_Selection

Get_Type

function Get_Type return Glib.GType
Return Value

Gtk_New

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.

Parameters
Self

Gtk_Search_Entry

type Gtk_Search_Entry is access all Gtk_Search_Entry_Record'Class;

Gtk_Search_Entry_New

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

Return Value

Gtk_Search_Entry_Record

type Gtk_Search_Entry_Record is new Gtk_Entry_Record with null record;

Handle_Event

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

Parameters
Self
Event

a key event

Return Value

GDK_EVENT_STOP if the key press event resulted in a search beginning or continuing, GDK_EVENT_PROPAGATE otherwise.

Implements_Gtk_Buildable

package Implements_Gtk_Buildable is new Glib.Types.Implements
  (Gtk.Buildable.Gtk_Buildable, Gtk_Search_Entry_Record, Gtk_Search_Entry);

Implements_Gtk_Cell_Editable

package Implements_Gtk_Cell_Editable is new Glib.Types.Implements
  (Gtk.Cell_Editable.Gtk_Cell_Editable, Gtk_Search_Entry_Record, Gtk_Search_Entry);

Implements_Gtk_Editable

package Implements_Gtk_Editable is new Glib.Types.Implements
  (Gtk.Editable.Gtk_Editable, Gtk_Search_Entry_Record, Gtk_Search_Entry);

Initialize

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.

Parameters
Self

Insert_Text

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)
Parameters
Editable
New_Text
New_Text_Length
Position

On_Next_Match

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.

Parameters
Self
Call
Slot
After

On_Next_Match

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.

Parameters
Self
Call
After

On_Previous_Match

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.

Parameters
Self
Call
Slot
After

On_Previous_Match

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.

Parameters
Self
Call
After

On_Search_Changed

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.

Parameters
Self
Call
Slot
After

On_Search_Changed

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.

Parameters
Self
Call
After

On_Stop_Search

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.

Parameters
Self
Call
Slot
After

On_Stop_Search

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.

Parameters
Self
Call
After

Paste_Clipboard

procedure Paste_Clipboard
   (Editable : not null access Gtk_Search_Entry_Record)
Parameters
Editable

Remove_Widget

procedure Remove_Widget
   (Cell_Editable : not null access Gtk_Search_Entry_Record)
Parameters
Cell_Editable

Select_Region

procedure Select_Region
   (Editable  : not null access Gtk_Search_Entry_Record;
    Start_Pos : Glib.Gint;
    End_Pos   : Glib.Gint := -1)
Parameters
Editable
Start_Pos
End_Pos

Set_Editable

procedure Set_Editable
   (Editable    : not null access Gtk_Search_Entry_Record;
    Is_Editable : Boolean)
Parameters
Editable
Is_Editable

Set_Position

procedure Set_Position
   (Editable : not null access Gtk_Search_Entry_Record;
    Position : Glib.Gint)
Parameters
Editable
Position

Signal_Next_Match

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

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

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

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.

Start_Editing

procedure Start_Editing
   (Cell_Editable : not null access Gtk_Search_Entry_Record;
    Event         : Gdk.Event.Gdk_Event)
Parameters
Cell_Editable
Event