Index

Package: Editable

Description

package Gtk.Editable is

The Gtk.Editable.Gtk_Editable interface is an interface which should be implemented by text editing widgets, such as Gtk.GEntry.Gtk_Entry and Gtk.Spin_Button.Gtk_Spin_Button. It contains functions for generically manipulating an editable widget, a large number of action signals used for key bindings, and several signals that an application can connect to to modify the behavior of a widget.

As an example of the latter usage, by connecting the following handler to Gtk.Editable.Gtk_Editable::insert-text, an application can convert all entry into a widget into uppercase. == Forcing entry to uppercase. == include <ctype.h> void insert_text_handler (GtkEditable *editable, const gchar *text, gint length, gint *position, gpointer data) { gchar *result = g_utf8_strup (text, length); g_signal_handlers_block_by_func (editable, (gpointer) insert_text_handler, data); gtk_editable_insert_text (editable, result, length, position); g_signal_handlers_unblock_by_func (editable, (gpointer) insert_text_handler, data); g_signal_stop_emission_by_name (editable, "insert_text"); g_free (result); }

Types

Gtk_Editable

type Gtk_Editable is new Glib.Types.GType_Interface;

Cb_Gtk_Editable_Void

type Cb_Gtk_Editable_Void is not null access procedure (Self : Gtk_Editable);

Cb_GObject_Void

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

Cb_Gtk_Editable_Gint_Gint_Void

type Cb_Gtk_Editable_Gint_Gint_Void is not null access procedure
     (Self      : Gtk_Editable;
      Start_Pos : Gint;
      End_Pos   : Gint);

Cb_GObject_Gint_Gint_Void

type Cb_GObject_Gint_Gint_Void is not null access procedure
     (Self      : access Glib.Object.GObject_Record'Class;
      Start_Pos : Gint;
      End_Pos   : Gint);

Cb_Gtk_Editable_UTF8_String_Gint_Gint_Void

type Cb_Gtk_Editable_UTF8_String_Gint_Gint_Void is not null access procedure
     (Self            : Gtk_Editable;
      New_Text        : UTF8_String;
      New_Text_Length : Gint;
      Position        : access Gint);

Cb_GObject_UTF8_String_Gint_Gint_Void

type Cb_GObject_UTF8_String_Gint_Gint_Void is not null access procedure
     (Self            : access Glib.Object.GObject_Record'Class;
      New_Text        : UTF8_String;
      New_Text_Length : Gint;
      Position        : access Gint);

Constants & Global variables

Null_Gtk_Editable (Gtk_Editable)

Null_Gtk_Editable : constant Gtk_Editable;

Signal_Changed (Glib.Signal_Name)

Signal_Changed : constant Glib.Signal_Name := "changed";

Signal_Delete_Text (Glib.Signal_Name)

Signal_Delete_Text : constant Glib.Signal_Name := "delete-text";

Signal_Insert_Text (Glib.Signal_Name)

Signal_Insert_Text : constant Glib.Signal_Name := "insert-text";

Subprograms & Entries

Get_Type

function Get_Type return Glib.GType;

Copy_Clipboard

procedure Copy_Clipboard 
(Editable: Gtk_Editable);

Cut_Clipboard

procedure Cut_Clipboard 
(Editable: Gtk_Editable);

Delete_Selection

procedure Delete_Selection 
(Editable: Gtk_Editable);

Delete_Text

procedure Delete_Text 
(Editable: Gtk_Editable;
Start_Pos: Gint;
End_Pos: Gint := -1);

Get_Chars

function Get_Chars 
(Editable: Gtk_Editable;
Start_Pos: Gint;
End_Pos: Gint := -1) return UTF8_String;
Retrieves a sequence of characters. The characters that are retrieved are those characters at positions from Start_Pos up to, but not including End_Pos. If End_Pos is negative, then the characters retrieved are those characters from Start_Pos to the end of the text. Note that positions are specified in characters, not bytes. "start_pos": start of text "end_pos": end of text

Get_Editable

function Get_Editable 
(Editable: Gtk_Editable) return Boolean;
Retrieves whether Editable is editable. See Gtk.Editable.Set_Editable.

Set_Editable

procedure Set_Editable 
(Editable: Gtk_Editable;
Is_Editable: Boolean);
Determines if the user can edit the text in the editable widget or not. "is_editable": True if the user is allowed to edit the text in the widget

Get_Position

function Get_Position 
(Editable: Gtk_Editable) return Gint;

Set_Position

procedure Set_Position 
(Editable: Gtk_Editable;
Position: Gint);

Get_Selection_Bounds

procedure Get_Selection_Bounds 
(Editable: Gtk_Editable;
Start_Pos: out Gint;
End_Pos: out Gint;
Has_Selection: out Boolean);
Retrieves the selection bound of the editable. start_pos will be filled with the start of the selection and End_Pos with end. If no text was selected both will be identical and False will be returned. Note that positions are specified in characters, not bytes. "start_pos": location to store the starting position, or null "end_pos": location to store the end position, or null

Insert_Text

procedure Insert_Text 
(Editable: Gtk_Editable;
New_Text: UTF8_String;
New_Text_Length: Gint;
Position: in out Gint);
Inserts New_Text_Length bytes of New_Text into the contents of the widget, at position Position. Note that the position is in characters, not in bytes. The function updates Position to point after the newly inserted text. "new_text": the text to append "new_text_length": the length of the text in bytes, or -1 "position": location of the position text will be inserted at

Paste_Clipboard

procedure Paste_Clipboard 
(Editable: Gtk_Editable);

Select_Region

procedure Select_Region 
(Editable: Gtk_Editable;
Start_Pos: Gint;
End_Pos: Gint := -1);

Insert_Text

procedure Insert_Text 
(Editable: Gtk_Editable;
New_Text: UTF8_String;
Position: in out Gint);
Convenience subprogram, identical to Insert_Text above without the requirement to supply the New_Text_Length argument.

On_Changed

procedure On_Changed 
(Self: Gtk_Editable;
Call: Cb_Gtk_Editable_Void;
After: Boolean := False);

On_Changed

procedure On_Changed 
(Self: Gtk_Editable;
Call: Cb_GObject_Void;
Slot: not null access Glib.Object.GObject_Record'Class;
After: Boolean := False);
The ::changed signal is emitted at the end of a single user-visible operation on the contents of the Gtk.Editable.Gtk_Editable. E.g., a paste operation that replaces the contents of the selection will cause only one signal emission (even though it is implemented by first deleting the selection, then inserting the new content, and may cause multiple ::notify::text signals to be emitted).

On_Delete_Text

procedure On_Delete_Text 
(Self: Gtk_Editable;
Call: Cb_Gtk_Editable_Gint_Gint_Void;
After: Boolean := False);

On_Delete_Text

procedure On_Delete_Text 
(Self: Gtk_Editable;
Call: Cb_GObject_Gint_Gint_Void;
Slot: not null access Glib.Object.GObject_Record'Class;
After: Boolean := False);
This signal is emitted when text is deleted from the widget by the user. The default handler for this signal will normally be responsible for deleting the text, so by connecting to this signal and then stopping the signal with g_signal_stop_emission, it is possible to modify the range of deleted text, or prevent it from being deleted entirely. The Start_Pos and End_Pos parameters are interpreted as for Gtk.Editable.Delete_Text. Callback parameters: -- "start_pos": the starting position -- "end_pos": the end position

On_Insert_Text

procedure On_Insert_Text 
(Self: Gtk_Editable;
Call: Cb_Gtk_Editable_UTF8_String_Gint_Gint_Void;
After: Boolean := False);

On_Insert_Text

procedure On_Insert_Text 
(Self: Gtk_Editable;
Call: Cb_GObject_UTF8_String_Gint_Gint_Void;
Slot: not null access Glib.Object.GObject_Record'Class;
After: Boolean := False);
This signal is emitted when text is inserted into the widget by the user. The default handler for this signal will normally be responsible for inserting the text, so by connecting to this signal and then stopping the signal with g_signal_stop_emission, it is possible to modify the inserted text, or prevent it from being inserted entirely. Callback parameters: -- "new_text": the new text to insert -- "new_text_length": the length of the new text, in bytes, or -1 if -- new_text is nul-terminated -- "position": the position, in characters, at which to insert the new -- text. this is an in-out parameter. After the signal emission is -- finished, it should point after the newly inserted text.

+

function "+" 
(W: Gtk_Editable) return Gtk_Editable;