W Wrapl, The Programming Language

Libraries:Gtk:Gtk:Editable

Types

T

The T interface is an interface which should be implemented by text editing widgets, such as Gtk.Gtk.Entry.T and GtkText. 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 "insert_text", an application can convert all entry into a widget into uppercase.

Example 19. Forcing entry to uppercase.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <ctype.h>
void
insert_text_handler (GtkEditable *editable,
                     const gchar *text,
                     gint         length,
                     gint        *position,
                     gpointer     data)
{
  int i;
  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);
}





ParentT

Constants

InterfaceInfo : Std.Object.T

Nil : T

Functions

GetType() : Gtk.GObject.Type.T



Methods

:Changed(_ @ ParentT)

:CopyClipboard(self @ T) : Std.Object.T

Copies the contents of the currently selected content in the editable and puts it on the clipboard.

editable a T


:CutClipboard(self @ T) : Std.Object.T

Removes the contents of the currently selected content in the editable and puts it on the clipboard.

editable a T


:DeleteSelection(self @ T) : Std.Object.T

Deletes the currently selected text of the editable. This call doesn't do anything if there is no selected text.

editable a T


:DeleteText(self @ T, start_pos @ Std.Integer.SmallT, end_pos @ Std.Integer.SmallT) : Std.Object.T

Deletes a sequence of characters. The characters that are deleted are those characters at positions from start_pos up to, but not including end_pos. If end_pos is negative, then the the characters deleted are those from start_pos to the end of the text.

Note that the positions are specified in characters, not bytes.

editable a T
start_pos start position
end_pos end position


:DeleteText(_ @ ParentT, _ @ Std.Integer.SmallT, _ @ Std.Integer.SmallT)

:DoDeleteText(_ @ ParentT, _ @ Std.Integer.SmallT, _ @ Std.Integer.SmallT)

:DoInsertText(_ @ ParentT, _ @ Std.String.T, _ @ Std.Integer.SmallT, _ @ Std.Object.T)

:GetChars(self @ T, start_pos @ Std.Integer.SmallT, end_pos @ Std.Integer.SmallT) : Std.String.T

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 the characters retrieved are those characters from start_pos to the end of the text.

Note that positions are specified in characters, not bytes.

editable a T
start_pos start of text
end_pos end of text
Returns a pointer to the contents of the widget as a string. This string is allocated by the T implementation and should be freed by the caller.


:GetChars(_ @ ParentT, _ @ Std.Integer.SmallT, _ @ Std.Integer.SmallT)

:GetEditable(self @ T) : Std.Symbol.T

Retrieves whether editable is editable. See SetEditable.

editable a T
Returns TRUE if editable is editable.


:GetPosition(self @ T) : Std.Integer.SmallT

Retrieves the current position of the cursor relative to the start of the content of the editable.

Note that this position is in characters, not in bytes.

editable a T
Returns the cursor position


:GetPosition(_ @ ParentT)

:GetSelectionBounds(self @ T, start_pos @ Std.Object.T, end_pos @ Std.Object.T) : Std.Symbol.T

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.

editable a T
start_pos location to store the starting position, or NULL. [out][allow-none]
end_pos location to store the end position, or NULL. [out][allow-none]
Returns TRUE if an area is selected, FALSE otherwise


:GetSelectionBounds(_ @ ParentT, _ @ Std.Object.T, _ @ Std.Object.T)

:InsertText(self @ T, new_text @ Std.String.T, new_text_length @ Std.Integer.SmallT, position @ Std.Object.T) : Std.Object.T

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.

editable a T
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. [inout]


:InsertText(_ @ ParentT, _ @ Std.String.T, _ @ Std.Integer.SmallT, _ @ Std.Object.T)

:PasteClipboard(self @ T) : Std.Object.T

Pastes the content of the clipboard to the current position of the cursor in the editable.

editable a T


:SelectRegion(self @ T, start_pos @ Std.Integer.SmallT, end_pos @ Std.Integer.SmallT) : Std.Object.T

Selects a region of text. The characters that are selected are those characters at positions from start_pos up to, but not including end_pos. If end_pos is negative, then the the characters selected are those characters from start_pos to the end of the text.

Note that positions are specified in characters, not bytes.

editable a T
start_pos start of region
end_pos end of region


:SetEditable(self @ T, is_editable @ Std.Symbol.T) : Std.Object.T

Determines if the user can edit the text in the editable widget or not.

editable a T
is_editable TRUE if the user is allowed to edit the text in the widget


:SetPosition(self @ T, position @ Std.Integer.SmallT) : Std.Object.T

Sets the cursor position in the editable to the given value.

The cursor is displayed before the character with the given (base 0) index in the contents of the editable. The value must be less than or equal to the number of characters in the editable. A value of -1 indicates that the position should be set after the last character of the editable. Note that position is in characters, not in bytes.

editable a T
position the position of the cursor


:SetPosition(_ @ ParentT, _ @ Std.Integer.SmallT)

:SetSelectionBounds(_ @ ParentT, _ @ Std.Integer.SmallT, _ @ Std.Integer.SmallT)