package Implements_Gtk_Buildable is new Glib.Types.Implements (Gtk.Buildable.Gtk_Buildable, Gtk_Entry_Completion_Record, Gtk_Entry_Completion);
package Implements_Gtk_Cell_Layout is new Glib.Types.Implements (Gtk.Cell_Layout.Gtk_Cell_Layout, Gtk_Entry_Completion_Record, Gtk_Entry_Completion);
type Gtk_Entry_Completion_Record is new GObject_Record with null record;
type Gtk_Entry_Completion is access all Gtk_Entry_Completion_Record'Class;
type Gtk_Entry_Completion_Match_Func is access function (Completion : not null access Gtk_Entry_Completion_Record'Class; Key : UTF8_String; Iter : Gtk.Tree_Model.Gtk_Tree_Iter) return Boolean;
type Gtk_Cell_Layout_Data_Func is access procedure (Cell_Layout : Gtk.Cell_Layout.Gtk_Cell_Layout; Cell : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; Tree_Model : Gtk.Tree_Model.Gtk_Tree_Model; Iter : Gtk.Tree_Model.Gtk_Tree_Iter);
type Cb_Gtk_Entry_Completion_Gint_Void is not null access procedure (Self : access Gtk_Entry_Completion_Record'Class; Index : Gint);
type Cb_GObject_Gint_Void is not null access procedure (Self : access Glib.Object.GObject_Record'Class; Index : Gint);
type Cb_Gtk_Entry_Completion_Gtk_Tree_Model_Gtk_Tree_Iter_Boolean is not null access function (Self : access Gtk_Entry_Completion_Record'Class; Model : Gtk.Tree_Model.Gtk_Tree_Model; Iter : Gtk.Tree_Model.Gtk_Tree_Iter) return Boolean;
type Cb_GObject_Gtk_Tree_Model_Gtk_Tree_Iter_Boolean is not null access function (Self : access Glib.Object.GObject_Record'Class; Model : Gtk.Tree_Model.Gtk_Tree_Model; Iter : Gtk.Tree_Model.Gtk_Tree_Iter) return Boolean;
type Cb_Gtk_Entry_Completion_UTF8_String_Boolean is not null access function (Self : access Gtk_Entry_Completion_Record'Class; Prefix : UTF8_String) return Boolean;
type Cb_GObject_UTF8_String_Boolean is not null access function (Self : access Glib.Object.GObject_Record'Class; Prefix : UTF8_String) return Boolean;
Cell_Area_Property : constant Glib.Properties.Property_Object;
Inline_Completion_Property : constant Glib.Properties.Property_Boolean;
Inline_Selection_Property : constant Glib.Properties.Property_Boolean;
Minimum_Key_Length_Property : constant Glib.Properties.Property_Int;
Model_Property : constant Glib.Properties.Property_Interface;
Popup_Completion_Property : constant Glib.Properties.Property_Boolean;
Popup_Set_Width_Property : constant Glib.Properties.Property_Boolean;
Popup_Single_Match_Property : constant Glib.Properties.Property_Boolean;
Text_Column_Property : constant Glib.Properties.Property_Int;
Signal_Action_Activated : constant Glib.Signal_Name := "action-activated";
Signal_Cursor_On_Match : constant Glib.Signal_Name := "cursor-on-match";
Signal_Insert_Prefix : constant Glib.Signal_Name := "insert-prefix";
Signal_Match_Selected : constant Glib.Signal_Name := "match-selected";
procedure Gtk_New
( | Completion | : out Gtk_Entry_Completion); |
procedure Initialize
( | Completion | : not null access Gtk_Entry_Completion_Record'Class); |
function Gtk_Entry_Completion_New return Gtk_Entry_Completion;
procedure Gtk_New_With_Area
( | Completion | : out Gtk_Entry_Completion; |
Area | : not null access Gtk.Cell_Area.Gtk_Cell_Area_Record'Class); |
procedure Initialize_With_Area
( | Completion | : not null access Gtk_Entry_Completion_Record'Class; |
Area | : not null access Gtk.Cell_Area.Gtk_Cell_Area_Record'Class); |
function Gtk_Entry_Completion_New_With_Area
( | Area | : not null access Gtk.Cell_Area.Gtk_Cell_Area_Record'Class) return Gtk_Entry_Completion; |
function Get_Type return Glib.GType;
procedure Complete
( | Completion | : not null access Gtk_Entry_Completion_Record); |
function Compute_Prefix
( | Completion | : not null access Gtk_Entry_Completion_Record; |
Key | : UTF8_String) return UTF8_String; |
procedure Delete_Action
( | Completion | : not null access Gtk_Entry_Completion_Record; |
Index | : Gint); |
function Get_Completion_Prefix
( | Completion | : not null access Gtk_Entry_Completion_Record) return UTF8_String; |
function Get_Entry
( | Completion | : not null access Gtk_Entry_Completion_Record) return Gtk.Widget.Gtk_Widget; |
function Get_Inline_Completion
( | Completion | : not null access Gtk_Entry_Completion_Record) return Boolean; |
procedure Set_Inline_Completion
( | Completion | : not null access Gtk_Entry_Completion_Record; |
Inline_Completion | : Boolean); |
function Get_Inline_Selection
( | Completion | : not null access Gtk_Entry_Completion_Record) return Boolean; |
procedure Set_Inline_Selection
( | Completion | : not null access Gtk_Entry_Completion_Record; |
Inline_Selection | : Boolean); |
function Get_Minimum_Key_Length
( | Completion | : not null access Gtk_Entry_Completion_Record) return Gint; |
procedure Set_Minimum_Key_Length
( | Completion | : not null access Gtk_Entry_Completion_Record; |
Length | : Gint); |
function Get_Model
( | Completion | : not null access Gtk_Entry_Completion_Record) return Gtk.Tree_Model.Gtk_Tree_Model; |
procedure Set_Model
( | Completion | : not null access Gtk_Entry_Completion_Record; |
Model | : Gtk.Tree_Model.Gtk_Tree_Model); |
function Get_Popup_Completion
( | Completion | : not null access Gtk_Entry_Completion_Record) return Boolean; |
procedure Set_Popup_Completion
( | Completion | : not null access Gtk_Entry_Completion_Record; |
Popup_Completion | : Boolean); |
function Get_Popup_Set_Width
( | Completion | : not null access Gtk_Entry_Completion_Record) return Boolean; |
procedure Set_Popup_Set_Width
( | Completion | : not null access Gtk_Entry_Completion_Record; |
Popup_Set_Width | : Boolean); |
function Get_Popup_Single_Match
( | Completion | : not null access Gtk_Entry_Completion_Record) return Boolean; |
procedure Set_Popup_Single_Match
( | Completion | : not null access Gtk_Entry_Completion_Record; |
Popup_Single_Match | : Boolean); |
function Get_Text_Column
( | Completion | : not null access Gtk_Entry_Completion_Record) return Gint; |
procedure Set_Text_Column
( | Completion | : not null access Gtk_Entry_Completion_Record; |
Column | : Gint); |
procedure Insert_Action_Markup
( | Completion | : not null access Gtk_Entry_Completion_Record; |
Index | : Gint; | |
Markup | : UTF8_String); |
procedure Insert_Action_Text
( | Completion | : not null access Gtk_Entry_Completion_Record; |
Index | : Gint; | |
Text | : UTF8_String); |
procedure Insert_Prefix
( | Completion | : not null access Gtk_Entry_Completion_Record); |
procedure Set_Match_Func
( | Completion | : not null access Gtk_Entry_Completion_Record; |
Func | : Gtk_Entry_Completion_Match_Func); |
procedure Set_Cell_Data_Func
( | Cell_Layout | : not null access Gtk_Entry_Completion_Record; |
Cell | : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; | |
Func | : Gtk_Cell_Layout_Data_Func); |
procedure Add_Attribute
( | Cell_Layout | : not null access Gtk_Entry_Completion_Record; |
Cell | : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; | |
Attribute | : UTF8_String; | |
Column | : Gint); |
procedure Clear
( | Cell_Layout | : not null access Gtk_Entry_Completion_Record); |
procedure Clear_Attributes
( | Cell_Layout | : not null access Gtk_Entry_Completion_Record; |
Cell | : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class); |
function Get_Cells
( | Cell_Layout | : not null access Gtk_Entry_Completion_Record) return Glib.Object.Object_Simple_List.Glist; |
procedure Pack_End
( | Cell_Layout | : not null access Gtk_Entry_Completion_Record; |
Cell | : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; | |
Expand | : Boolean); |
procedure Pack_Start
( | Cell_Layout | : not null access Gtk_Entry_Completion_Record; |
Cell | : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; | |
Expand | : Boolean); |
procedure Reorder
( | Cell_Layout | : not null access Gtk_Entry_Completion_Record; |
Cell | : not null access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; | |
Position | : Gint); |
procedure On_Action_Activated
( | Self | : not null access Gtk_Entry_Completion_Record; |
Call | : Cb_Gtk_Entry_Completion_Gint_Void; | |
After | : Boolean := False); |
procedure On_Action_Activated
( | Self | : not null access Gtk_Entry_Completion_Record; |
Call | : Cb_GObject_Gint_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
procedure On_Cursor_On_Match
( | Self | : not null access Gtk_Entry_Completion_Record; |
Call | : Cb_Gtk_Entry_Completion_Gtk_Tree_Model_Gtk_Tree_Iter_Boolean; | |
After | : Boolean := False); |
procedure On_Cursor_On_Match
( | Self | : not null access Gtk_Entry_Completion_Record; |
Call | : Cb_GObject_Gtk_Tree_Model_Gtk_Tree_Iter_Boolean; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
procedure On_Insert_Prefix
( | Self | : not null access Gtk_Entry_Completion_Record; |
Call | : Cb_Gtk_Entry_Completion_UTF8_String_Boolean; | |
After | : Boolean := False); |
procedure On_Insert_Prefix
( | Self | : not null access Gtk_Entry_Completion_Record; |
Call | : Cb_GObject_UTF8_String_Boolean; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
procedure On_Match_Selected
( | Self | : not null access Gtk_Entry_Completion_Record; |
Call | : Cb_Gtk_Entry_Completion_Gtk_Tree_Model_Gtk_Tree_Iter_Boolean; | |
After | : Boolean := False); |
procedure On_Match_Selected
( | Self | : not null access Gtk_Entry_Completion_Record; |
Call | : Cb_GObject_Gtk_Tree_Model_Gtk_Tree_Iter_Boolean; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
function "+"
( | Widget | : access Gtk_Entry_Completion_Record'Class) return Gtk.Buildable.Gtk_Buildable renames Implements_Gtk_Buildable.To_Interface; |
function "-"
( | Interf | : Gtk.Buildable.Gtk_Buildable) return Gtk_Entry_Completion renames Implements_Gtk_Buildable.To_Object; |
function "+"
( | Widget | : access Gtk_Entry_Completion_Record'Class) return Gtk.Cell_Layout.Gtk_Cell_Layout renames Implements_Gtk_Cell_Layout.To_Interface; |
function "-"
( | Interf | : Gtk.Cell_Layout.Gtk_Cell_Layout) return Gtk_Entry_Completion renames Implements_Gtk_Cell_Layout.To_Object; |
Gtk.Entry_Completion.Gtk_Entry_Completion is an auxiliary object to be used in conjunction with Gtk.GEntry.Gtk_Entry to provide the completion functionality. It implements the Gtk.Cell_Layout.Gtk_Cell_Layout interface, to allow the user to add extra cells to the Gtk.Tree_View.Gtk_Tree_View with completion matches. "Completion functionality" means that when the user modifies the text in the entry, Gtk.Entry_Completion.Gtk_Entry_Completion checks which rows in the model match the current content of the entry, and displays a list of matches. By default, the matching is done by comparing the entry text case-insensitively against the text column of the model (see Gtk.Entry_Completion.Set_Text_Column), but this can be overridden with a custom match function (see Gtk.Entry_Completion.Set_Match_Func).
When the user selects a completion, the content of the entry is updated.
By default, the content of the entry is replaced by the text column of the model, but this can be overridden by connecting to the Gtk.Entry_Completion.Gtk_Entry_Completion::match-selected signal and updating the entry in the signal handler. Note that you should return True from the signal handler to suppress the default behaviour.
To add completion functionality to an entry, use Gtk.GEntry.Set_Completion.
In addition to regular completion matches, which will be inserted into the entry when they are selected, Gtk.Entry_Completion.Gtk_Entry_Completion also allows to display "actions" in the popup window. Their appearance is similar to menuitems, to differentiate them clearly from completion strings. When an action is selected, the Gtk.Entry_Completion.Gtk_Entry_Completion::action-activated signal is emitted.
GtkEntryCompletion uses a Gtk.Tree_Model_Filter.Gtk_Tree_Model_Filter model to represent the subset of the entire model that is currently matching. While the GtkEntryCompletion signals Gtk.Entry_Completion.Gtk_Entry_Completion::match-selected and Gtk.Entry_Completion.Gtk_Entry_Completion::cursor-on-match take the original model and an iter pointing to that model as arguments, other callbacks and signals (such as Gtk_Cell_Layout_Data_Funcs or Gtk.Cell_Area.Gtk_Cell_Area::apply-attributes) will generally take the filter model as argument. As long as you are only calling gtk_tree_model_get, this will make no difference to you. If for some reason, you need the original model, use Gtk.Tree_Model_Filter.Get_Model.
Don't forget to use Gtk.Tree_Model_Filter.Convert_Iter_To_Child_Iter to obtain a matching iter.