CtkEntry

CtkEntry — A single line text entry field

Functions

CtkWidget * ctk_entry_new ()
CtkWidget * ctk_entry_new_with_buffer ()
CtkEntryBuffer * ctk_entry_get_buffer ()
void ctk_entry_set_buffer ()
void ctk_entry_set_text ()
const gchar * ctk_entry_get_text ()
guint16 ctk_entry_get_text_length ()
void ctk_entry_get_text_area ()
void ctk_entry_set_visibility ()
void ctk_entry_set_invisible_char ()
void ctk_entry_unset_invisible_char ()
void ctk_entry_set_max_length ()
gboolean ctk_entry_get_activates_default ()
gboolean ctk_entry_get_has_frame ()
const CtkBorder * ctk_entry_get_inner_border ()
gint ctk_entry_get_width_chars ()
gint ctk_entry_get_max_width_chars ()
void ctk_entry_set_activates_default ()
void ctk_entry_set_has_frame ()
void ctk_entry_set_inner_border ()
void ctk_entry_set_width_chars ()
void ctk_entry_set_max_width_chars ()
gunichar ctk_entry_get_invisible_char ()
void ctk_entry_set_alignment ()
gfloat ctk_entry_get_alignment ()
void ctk_entry_set_placeholder_text ()
const gchar * ctk_entry_get_placeholder_text ()
void ctk_entry_set_overwrite_mode ()
gboolean ctk_entry_get_overwrite_mode ()
PangoLayout * ctk_entry_get_layout ()
void ctk_entry_get_layout_offsets ()
gint ctk_entry_layout_index_to_text_index ()
gint ctk_entry_text_index_to_layout_index ()
void ctk_entry_set_attributes ()
PangoAttrList * ctk_entry_get_attributes ()
gint ctk_entry_get_max_length ()
gboolean ctk_entry_get_visibility ()
void ctk_entry_set_completion ()
CtkEntryCompletion * ctk_entry_get_completion ()
void ctk_entry_set_cursor_hadjustment ()
CtkAdjustment * ctk_entry_get_cursor_hadjustment ()
void ctk_entry_set_progress_fraction ()
gdouble ctk_entry_get_progress_fraction ()
void ctk_entry_set_progress_pulse_step ()
gdouble ctk_entry_get_progress_pulse_step ()
void ctk_entry_progress_pulse ()
gboolean ctk_entry_im_context_filter_keypress ()
void ctk_entry_reset_im_context ()
PangoTabArray * ctk_entry_get_tabs ()
void ctk_entry_set_tabs ()
void ctk_entry_set_icon_from_pixbuf ()
void ctk_entry_set_icon_from_stock ()
void ctk_entry_set_icon_from_icon_name ()
void ctk_entry_set_icon_from_gicon ()
CtkImageType ctk_entry_get_icon_storage_type ()
GdkPixbuf * ctk_entry_get_icon_pixbuf ()
const gchar * ctk_entry_get_icon_stock ()
const gchar * ctk_entry_get_icon_name ()
GIcon * ctk_entry_get_icon_gicon ()
void ctk_entry_set_icon_activatable ()
gboolean ctk_entry_get_icon_activatable ()
void ctk_entry_set_icon_sensitive ()
gboolean ctk_entry_get_icon_sensitive ()
gint ctk_entry_get_icon_at_pos ()
void ctk_entry_set_icon_tooltip_text ()
gchar * ctk_entry_get_icon_tooltip_text ()
void ctk_entry_set_icon_tooltip_markup ()
gchar * ctk_entry_get_icon_tooltip_markup ()
void ctk_entry_set_icon_drag_source ()
gint ctk_entry_get_current_icon_drag_source ()
void ctk_entry_get_icon_area ()
void ctk_entry_set_input_purpose ()
CtkInputPurpose ctk_entry_get_input_purpose ()
void ctk_entry_set_input_hints ()
CtkInputHints ctk_entry_get_input_hints ()
void ctk_entry_grab_focus_without_selecting ()

Properties

gboolean activates-default Read / Write
PangoAttrList * attributes Read / Write
CtkEntryBuffer * buffer Read / Write / Construct
gboolean caps-lock-warning Read / Write
CtkEntryCompletion * completion Read / Write
int cursor-position Read
gboolean editable Read / Write
gboolean enable-emoji-completion Read / Write
gboolean has-frame Read / Write
char * im-module Read / Write
CtkBorder * inner-border Read / Write
CtkInputHints input-hints Read / Write
CtkInputPurpose input-purpose Read / Write
guint invisible-char Read / Write
gboolean invisible-char-set Read / Write
int max-length Read / Write
int max-width-chars Read / Write
gboolean overwrite-mode Read / Write
char * placeholder-text Read / Write
gboolean populate-all Read / Write
gboolean primary-icon-activatable Read / Write
GIcon * primary-icon-gicon Read / Write
char * primary-icon-name Read / Write
GdkPixbuf * primary-icon-pixbuf Read / Write
gboolean primary-icon-sensitive Read / Write
char * primary-icon-stock Read / Write
CtkImageType primary-icon-storage-type Read
char * primary-icon-tooltip-markup Read / Write
char * primary-icon-tooltip-text Read / Write
double progress-fraction Read / Write
double progress-pulse-step Read / Write
int scroll-offset Read
gboolean secondary-icon-activatable Read / Write
GIcon * secondary-icon-gicon Read / Write
char * secondary-icon-name Read / Write
GdkPixbuf * secondary-icon-pixbuf Read / Write
gboolean secondary-icon-sensitive Read / Write
char * secondary-icon-stock Read / Write
CtkImageType secondary-icon-storage-type Read
char * secondary-icon-tooltip-markup Read / Write
char * secondary-icon-tooltip-text Read / Write
int selection-bound Read
CtkShadowType shadow-type Read / Write
gboolean show-emoji-icon Read / Write
PangoTabArray * tabs Read / Write
char * text Read / Write
guint text-length Read
gboolean truncate-multiline Read / Write
gboolean visibility Read / Write
int width-chars Read / Write
float xalign Read / Write

Signals

void activate Action
void backspace Action
void copy-clipboard Action
void cut-clipboard Action
void delete-from-cursor Action
void icon-press Run Last
void icon-release Run Last
void insert-at-cursor Action
void insert-emoji Action
void move-cursor Action
void paste-clipboard Action
void populate-popup Run Last
void preedit-changed Action
void toggle-overwrite Action

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── CtkWidget
            ╰── CtkEntry
                ├── CtkSearchEntry
                ╰── CtkSpinButton

Implemented Interfaces

CtkEntry implements AtkImplementorIface, CtkBuildable, CtkEditable and CtkCellEditable.

Includes

#include <ctk/ctk.h>

Description

The CtkEntry widget is a single line text entry widget. A fairly large set of key bindings are supported by default. If the entered text is longer than the allocation of the widget, the widget will scroll so that the cursor position is visible.

When using an entry for passwords and other sensitive information, it can be put into “password mode” using ctk_entry_set_visibility(). In this mode, entered text is displayed using a “invisible” character. By default, CTK+ picks the best invisible character that is available in the current font, but it can be changed with ctk_entry_set_invisible_char(). Since 2.16, CTK+ displays a warning when Caps Lock or input methods might interfere with entering text in a password entry. The warning can be turned off with the “caps-lock-warning” property.

Since 2.16, CtkEntry has the ability to display progress or activity information behind the text. To make an entry display such information, use ctk_entry_set_progress_fraction() or ctk_entry_set_progress_pulse_step().

Additionally, CtkEntry can show icons at either side of the entry. These icons can be activatable by clicking, can be set up as drag source and can have tooltips. To add an icon, use ctk_entry_set_icon_from_gicon() or one of the various other functions that set an icon from a stock id, an icon name or a pixbuf. To trigger an action when the user clicks an icon, connect to the “icon-press” signal. To allow DND operations from an icon, use ctk_entry_set_icon_drag_source(). To set a tooltip on an icon, use ctk_entry_set_icon_tooltip_text() or the corresponding function for markup.

Note that functionality or information that is only available by clicking on an icon in an entry may not be accessible at all to users which are not able to use a mouse or other pointing device. It is therefore recommended that any such functionality should also be available by other means, e.g. via the context menu of the entry.

CSS nodes

1
2
3
4
5
6
7
8
entry[.read-only][.flat][.warning][.error]
├── image.left
├── image.right
├── undershoot.left
├── undershoot.right
├── [selection]
├── [progress[.pulse]]
╰── [window.popup]

CtkEntry has a main node with the name entry. Depending on the properties of the entry, the style classes .read-only and .flat may appear. The style classes .warning and .error may also be used with entries.

When the entry shows icons, it adds subnodes with the name image and the style class .left or .right, depending on where the icon appears.

When the entry has a selection, it adds a subnode with the name selection.

When the entry shows progress, it adds a subnode with the name progress. The node has the style class .pulse when the shown progress is pulsing.

The CSS node for a context menu is added as a subnode below entry as well.

The undershoot nodes are used to draw the underflow indication when content is scrolled out of view. These nodes get the .left and .right style classes added depending on where the indication is drawn.

When touch is used and touch selection handles are shown, they are using CSS nodes with name cursor-handle. They get the .top or .bottom style class depending on where they are shown in relation to the selection. If there is just a single handle for the text cursor, it gets the style class .insertion-cursor.

Functions

ctk_entry_new ()

CtkWidget *
ctk_entry_new (void);

Creates a new entry.

Returns

a new CtkEntry.


ctk_entry_new_with_buffer ()

CtkWidget *
ctk_entry_new_with_buffer (CtkEntryBuffer *buffer);

Creates a new entry with the specified text buffer.

Parameters

buffer

The buffer to use for the new CtkEntry.

 

Returns

a new CtkEntry

Since: 2.18


ctk_entry_get_buffer ()

CtkEntryBuffer *
ctk_entry_get_buffer (CtkEntry *entry);

Get the CtkEntryBuffer object which holds the text for this widget.

Parameters

entry

a CtkEntry

 

Returns

A CtkEntryBuffer object.

[transfer none]

Since: 2.18


ctk_entry_set_buffer ()

void
ctk_entry_set_buffer (CtkEntry *entry,
                      CtkEntryBuffer *buffer);

Set the CtkEntryBuffer object which holds the text for this widget.

Parameters

entry

a CtkEntry

 

buffer

a CtkEntryBuffer

 

Since: 2.18


ctk_entry_set_text ()

void
ctk_entry_set_text (CtkEntry *entry,
                    const gchar *text);

Sets the text in the widget to the given value, replacing the current contents.

See ctk_entry_buffer_set_text().

Parameters

entry

a CtkEntry

 

text

the new text

 

ctk_entry_get_text ()

const gchar *
ctk_entry_get_text (CtkEntry *entry);

Retrieves the contents of the entry widget. See also ctk_editable_get_chars().

This is equivalent to getting entry 's CtkEntryBuffer and calling ctk_entry_buffer_get_text() on it.

Parameters

entry

a CtkEntry

 

Returns

a pointer to the contents of the widget as a string. This string points to internally allocated storage in the widget and must not be freed, modified or stored.


ctk_entry_get_text_length ()

guint16
ctk_entry_get_text_length (CtkEntry *entry);

Retrieves the current length of the text in entry .

This is equivalent to getting entry 's CtkEntryBuffer and calling ctk_entry_buffer_get_length() on it.

Parameters

entry

a CtkEntry

 

Returns

the current number of characters in CtkEntry, or 0 if there are none.

Since: 2.14


ctk_entry_get_text_area ()

void
ctk_entry_get_text_area (CtkEntry *entry,
                         CdkRectangle *text_area);

Gets the area where the entry’s text is drawn. This function is useful when drawing something to the entry in a draw callback.

If the entry is not realized, text_area is filled with zeros.

See also ctk_entry_get_icon_area().

Parameters

entry

a CtkEntry

 

text_area

Return location for the text area.

[out]

Since: 3.0


ctk_entry_set_visibility ()

void
ctk_entry_set_visibility (CtkEntry *entry,
                          gboolean visible);

Sets whether the contents of the entry are visible or not. When visibility is set to FALSE, characters are displayed as the invisible char, and will also appear that way when the text in the entry widget is copied elsewhere.

By default, CTK+ picks the best invisible character available in the current font, but it can be changed with ctk_entry_set_invisible_char().

Note that you probably want to set “input-purpose” to CTK_INPUT_PURPOSE_PASSWORD or CTK_INPUT_PURPOSE_PIN to inform input methods about the purpose of this entry, in addition to setting visibility to FALSE.

Parameters

entry

a CtkEntry

 

visible

TRUE if the contents of the entry are displayed as plaintext

 

ctk_entry_set_invisible_char ()

void
ctk_entry_set_invisible_char (CtkEntry *entry,
                              gunichar ch);

Sets the character to use in place of the actual text when ctk_entry_set_visibility() has been called to set text visibility to FALSE. i.e. this is the character used in “password mode” to show the user how many characters have been typed. By default, CTK+ picks the best invisible char available in the current font. If you set the invisible char to 0, then the user will get no feedback at all; there will be no text on the screen as they type.

Parameters

entry

a CtkEntry

 

ch

a Unicode character

 

ctk_entry_unset_invisible_char ()

void
ctk_entry_unset_invisible_char (CtkEntry *entry);

Unsets the invisible char previously set with ctk_entry_set_invisible_char(). So that the default invisible char is used again.

Parameters

entry

a CtkEntry

 

Since: 2.16


ctk_entry_set_max_length ()

void
ctk_entry_set_max_length (CtkEntry *entry,
                          gint max);

Sets the maximum allowed length of the contents of the widget. If the current contents are longer than the given length, then they will be truncated to fit.

This is equivalent to getting entry 's CtkEntryBuffer and calling ctk_entry_buffer_set_max_length() on it. ]|

Parameters

entry

a CtkEntry

 

max

the maximum length of the entry, or 0 for no maximum. (other than the maximum length of entries.) The value passed in will be clamped to the range 0-65536.

 

ctk_entry_get_activates_default ()

gboolean
ctk_entry_get_activates_default (CtkEntry *entry);

Retrieves the value set by ctk_entry_set_activates_default().

Parameters

entry

a CtkEntry

 

Returns

TRUE if the entry will activate the default widget


ctk_entry_get_has_frame ()

gboolean
ctk_entry_get_has_frame (CtkEntry *entry);

Gets the value set by ctk_entry_set_has_frame().

Parameters

entry

a CtkEntry

 

Returns

whether the entry has a beveled frame


ctk_entry_get_inner_border ()

const CtkBorder *
ctk_entry_get_inner_border (CtkEntry *entry);

ctk_entry_get_inner_border has been deprecated since version 3.4 and should not be used in newly-written code.

Use the standard border and padding CSS properties (through objects like CtkStyleContext and CtkCssProvider); the value returned by this function is ignored by CtkEntry.

This function returns the entry’s “inner-border” property. See ctk_entry_set_inner_border() for more information.

Parameters

entry

a CtkEntry

 

Returns

the entry’s CtkBorder, or NULL if none was set.

[nullable][transfer none]

Since: 2.10


ctk_entry_get_width_chars ()

gint
ctk_entry_get_width_chars (CtkEntry *entry);

Gets the value set by ctk_entry_set_width_chars().

Parameters

entry

a CtkEntry

 

Returns

number of chars to request space for, or negative if unset


ctk_entry_get_max_width_chars ()

gint
ctk_entry_get_max_width_chars (CtkEntry *entry);

Retrieves the desired maximum width of entry , in characters. See ctk_entry_set_max_width_chars().

Parameters

entry

a CtkEntry

 

Returns

the maximum width of the entry, in characters

Since: 3.12


ctk_entry_set_activates_default ()

void
ctk_entry_set_activates_default (CtkEntry *entry,
                                 gboolean setting);

If setting is TRUE, pressing Enter in the entry will activate the default widget for the window containing the entry. This usually means that the dialog box containing the entry will be closed, since the default widget is usually one of the dialog buttons.

(For experts: if setting is TRUE, the entry calls ctk_window_activate_default() on the window containing the entry, in the default handler for the “activate” signal.)

Parameters

entry

a CtkEntry

 

setting

TRUE to activate window’s default widget on Enter keypress

 

ctk_entry_set_has_frame ()

void
ctk_entry_set_has_frame (CtkEntry *entry,
                         gboolean setting);

Sets whether the entry has a beveled frame around it.

Parameters

entry

a CtkEntry

 

setting

new value

 

ctk_entry_set_inner_border ()

void
ctk_entry_set_inner_border (CtkEntry *entry,
                            const CtkBorder *border);

ctk_entry_set_inner_border has been deprecated since version 3.4 and should not be used in newly-written code.

Use the standard border and padding CSS properties (through objects like CtkStyleContext and CtkCssProvider); the value set with this function is ignored by CtkEntry.

Sets entry’s inner-border property to border , or clears it if NULL is passed. The inner-border is the area around the entry’s text, but inside its frame.

If set, this property overrides the inner-border style property. Overriding the style-provided border is useful when you want to do in-place editing of some text in a canvas or list widget, where pixel-exact positioning of the entry is important.

Parameters

entry

a CtkEntry

 

border

a CtkBorder, or NULL.

[allow-none]

Since: 2.10


ctk_entry_set_width_chars ()

void
ctk_entry_set_width_chars (CtkEntry *entry,
                           gint n_chars);

Changes the size request of the entry to be about the right size for n_chars characters. Note that it changes the size request, the size can still be affected by how you pack the widget into containers. If n_chars is -1, the size reverts to the default entry size.

Parameters

entry

a CtkEntry

 

n_chars

width in chars

 

ctk_entry_set_max_width_chars ()

void
ctk_entry_set_max_width_chars (CtkEntry *entry,
                               gint n_chars);

Sets the desired maximum width in characters of entry .

Parameters

entry

a CtkEntry

 

n_chars

the new desired maximum width, in characters

 

Since: 3.12


ctk_entry_get_invisible_char ()

gunichar
ctk_entry_get_invisible_char (CtkEntry *entry);

Retrieves the character displayed in place of the real characters for entries with visibility set to false. See ctk_entry_set_invisible_char().

Parameters

entry

a CtkEntry

 

Returns

the current invisible char, or 0, if the entry does not show invisible text at all.


ctk_entry_set_alignment ()

void
ctk_entry_set_alignment (CtkEntry *entry,
                         gfloat xalign);

Sets the alignment for the contents of the entry. This controls the horizontal positioning of the contents when the displayed text is shorter than the width of the entry.

Parameters

entry

a CtkEntry

 

xalign

The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL layouts

 

Since: 2.4


ctk_entry_get_alignment ()

gfloat
ctk_entry_get_alignment (CtkEntry *entry);

Gets the value set by ctk_entry_set_alignment().

Parameters

entry

a CtkEntry

 

Returns

the alignment

Since: 2.4


ctk_entry_set_placeholder_text ()

void
ctk_entry_set_placeholder_text (CtkEntry *entry,
                                const gchar *text);

Sets text to be displayed in entry when it is empty and unfocused. This can be used to give a visual hint of the expected contents of the CtkEntry.

Note that since the placeholder text gets removed when the entry received focus, using this feature is a bit problematic if the entry is given the initial focus in a window. Sometimes this can be worked around by delaying the initial focus setting until the first key event arrives.

Parameters

entry

a CtkEntry

 

text

a string to be displayed when entry is empty and unfocused, or NULL.

[nullable]

Since: 3.2


ctk_entry_get_placeholder_text ()

const gchar *
ctk_entry_get_placeholder_text (CtkEntry *entry);

Retrieves the text that will be displayed when entry is empty and unfocused

Parameters

entry

a CtkEntry

 

Returns

a pointer to the placeholder text as a string. This string points to internally allocated storage in the widget and must not be freed, modified or stored.

Since: 3.2


ctk_entry_set_overwrite_mode ()

void
ctk_entry_set_overwrite_mode (CtkEntry *entry,
                              gboolean overwrite);

Sets whether the text is overwritten when typing in the CtkEntry.

Parameters

entry

a CtkEntry

 

overwrite

new value

 

Since: 2.14


ctk_entry_get_overwrite_mode ()

gboolean
ctk_entry_get_overwrite_mode (CtkEntry *entry);

Gets the value set by ctk_entry_set_overwrite_mode().

Parameters

entry

a CtkEntry

 

Returns

whether the text is overwritten when typing.

Since: 2.14


ctk_entry_get_layout ()

PangoLayout *
ctk_entry_get_layout (CtkEntry *entry);

Gets the PangoLayout used to display the entry. The layout is useful to e.g. convert text positions to pixel positions, in combination with ctk_entry_get_layout_offsets(). The returned layout is owned by the entry and must not be modified or freed by the caller.

Keep in mind that the layout text may contain a preedit string, so ctk_entry_layout_index_to_text_index() and ctk_entry_text_index_to_layout_index() are needed to convert byte indices in the layout to byte indices in the entry contents.

Parameters

entry

a CtkEntry

 

Returns

the PangoLayout for this entry.

[transfer none]


ctk_entry_get_layout_offsets ()

void
ctk_entry_get_layout_offsets (CtkEntry *entry,
                              gint *x,
                              gint *y);

Obtains the position of the PangoLayout used to render text in the entry, in widget coordinates. Useful if you want to line up the text in an entry with some other text, e.g. when using the entry to implement editable cells in a sheet widget.

Also useful to convert mouse events into coordinates inside the PangoLayout, e.g. to take some action if some part of the entry text is clicked.

Note that as the user scrolls around in the entry the offsets will change; you’ll need to connect to the “notify::scroll-offset” signal to track this. Remember when using the PangoLayout functions you need to convert to and from pixels using PANGO_PIXELS() or PANGO_SCALE.

Keep in mind that the layout text may contain a preedit string, so ctk_entry_layout_index_to_text_index() and ctk_entry_text_index_to_layout_index() are needed to convert byte indices in the layout to byte indices in the entry contents.

Parameters

entry

a CtkEntry

 

x

location to store X offset of layout, or NULL.

[out][allow-none]

y

location to store Y offset of layout, or NULL.

[out][allow-none]

ctk_entry_layout_index_to_text_index ()

gint
ctk_entry_layout_index_to_text_index (CtkEntry *entry,
                                      gint layout_index);

Converts from a position in the entry’s PangoLayout (returned by ctk_entry_get_layout()) to a position in the entry contents (returned by ctk_entry_get_text()).

Parameters

entry

a CtkEntry

 

layout_index

byte index into the entry layout text

 

Returns

byte index into the entry contents


ctk_entry_text_index_to_layout_index ()

gint
ctk_entry_text_index_to_layout_index (CtkEntry *entry,
                                      gint text_index);

Converts from a position in the entry contents (returned by ctk_entry_get_text()) to a position in the entry’s PangoLayout (returned by ctk_entry_get_layout(), with text retrieved via pango_layout_get_text()).

Parameters

entry

a CtkEntry

 

text_index

byte index into the entry contents

 

Returns

byte index into the entry layout text


ctk_entry_set_attributes ()

void
ctk_entry_set_attributes (CtkEntry *entry,
                          PangoAttrList *attrs);

Sets a PangoAttrList; the attributes in the list are applied to the entry text.

Parameters

entry

a CtkEntry

 

attrs

a PangoAttrList

 

Since: 3.6


ctk_entry_get_attributes ()

PangoAttrList *
ctk_entry_get_attributes (CtkEntry *entry);

Gets the attribute list that was set on the entry using ctk_entry_set_attributes(), if any.

Parameters

entry

a CtkEntry

 

Returns

the attribute list, or NULL if none was set.

[transfer none][nullable]

Since: 3.6


ctk_entry_get_max_length ()

gint
ctk_entry_get_max_length (CtkEntry *entry);

Retrieves the maximum allowed length of the text in entry . See ctk_entry_set_max_length().

This is equivalent to getting entry 's CtkEntryBuffer and calling ctk_entry_buffer_get_max_length() on it.

Parameters

entry

a CtkEntry

 

Returns

the maximum allowed number of characters in CtkEntry, or 0 if there is no maximum.


ctk_entry_get_visibility ()

gboolean
ctk_entry_get_visibility (CtkEntry *entry);

Retrieves whether the text in entry is visible. See ctk_entry_set_visibility().

Parameters

entry

a CtkEntry

 

Returns

TRUE if the text is currently visible


ctk_entry_set_completion ()

void
ctk_entry_set_completion (CtkEntry *entry,
                          CtkEntryCompletion *completion);

Sets completion to be the auxiliary completion object to use with entry . All further configuration of the completion mechanism is done on completion using the CtkEntryCompletion API. Completion is disabled if completion is set to NULL.

Parameters

entry

A CtkEntry

 

completion

The CtkEntryCompletion or NULL.

[allow-none]

Since: 2.4


ctk_entry_get_completion ()

CtkEntryCompletion *
ctk_entry_get_completion (CtkEntry *entry);

Returns the auxiliary completion object currently in use by entry .

Parameters

entry

A CtkEntry

 

Returns

The auxiliary completion object currently in use by entry .

[transfer none]

Since: 2.4


ctk_entry_set_cursor_hadjustment ()

void
ctk_entry_set_cursor_hadjustment (CtkEntry *entry,
                                  CtkAdjustment *adjustment);

Hooks up an adjustment to the cursor position in an entry, so that when the cursor is moved, the adjustment is scrolled to show that position. See ctk_scrolled_window_get_hadjustment() for a typical way of obtaining the adjustment.

The adjustment has to be in pixel units and in the same coordinate system as the entry.

Parameters

entry

a CtkEntry

 

adjustment

an adjustment which should be adjusted when the cursor is moved, or NULL.

[nullable]

Since: 2.12


ctk_entry_get_cursor_hadjustment ()

CtkAdjustment *
ctk_entry_get_cursor_hadjustment (CtkEntry *entry);

Retrieves the horizontal cursor adjustment for the entry. See ctk_entry_set_cursor_hadjustment().

Parameters

entry

a CtkEntry

 

Returns

the horizontal cursor adjustment, or NULL if none has been set.

[transfer none][nullable]

Since: 2.12


ctk_entry_set_progress_fraction ()

void
ctk_entry_set_progress_fraction (CtkEntry *entry,
                                 gdouble fraction);

Causes the entry’s progress indicator to “fill in” the given fraction of the bar. The fraction should be between 0.0 and 1.0, inclusive.

Parameters

entry

a CtkEntry

 

fraction

fraction of the task that’s been completed

 

Since: 2.16


ctk_entry_get_progress_fraction ()

gdouble
ctk_entry_get_progress_fraction (CtkEntry *entry);

Returns the current fraction of the task that’s been completed. See ctk_entry_set_progress_fraction().

Parameters

entry

a CtkEntry

 

Returns

a fraction from 0.0 to 1.0

Since: 2.16


ctk_entry_set_progress_pulse_step ()

void
ctk_entry_set_progress_pulse_step (CtkEntry *entry,
                                   gdouble fraction);

Sets the fraction of total entry width to move the progress bouncing block for each call to ctk_entry_progress_pulse().

Parameters

entry

a CtkEntry

 

fraction

fraction between 0.0 and 1.0

 

Since: 2.16


ctk_entry_get_progress_pulse_step ()

gdouble
ctk_entry_get_progress_pulse_step (CtkEntry *entry);

Retrieves the pulse step set with ctk_entry_set_progress_pulse_step().

Parameters

entry

a CtkEntry

 

Returns

a fraction from 0.0 to 1.0

Since: 2.16


ctk_entry_progress_pulse ()

void
ctk_entry_progress_pulse (CtkEntry *entry);

Indicates that some progress is made, but you don’t know how much. Causes the entry’s progress indicator to enter “activity mode,” where a block bounces back and forth. Each call to ctk_entry_progress_pulse() causes the block to move by a little bit (the amount of movement per pulse is determined by ctk_entry_set_progress_pulse_step()).

Parameters

entry

a CtkEntry

 

Since: 2.16


ctk_entry_im_context_filter_keypress ()

gboolean
ctk_entry_im_context_filter_keypress (CtkEntry *entry,
                                      CdkEventKey *event);

Allow the CtkEntry input method to internally handle key press and release events. If this function returns TRUE, then no further processing should be done for this key event. See ctk_im_context_filter_keypress().

Note that you are expected to call this function from your handler when overriding key event handling. This is needed in the case when you need to insert your own key handling between the input method and the default key event handling of the CtkEntry. See ctk_text_view_reset_im_context() for an example of use.

Parameters

entry

a CtkEntry

 

event

the key event.

[type Cdk.EventKey]

Returns

TRUE if the input method handled the key event.

Since: 2.22


ctk_entry_reset_im_context ()

void
ctk_entry_reset_im_context (CtkEntry *entry);

Reset the input method context of the entry if needed.

This can be necessary in the case where modifying the buffer would confuse on-going input method behavior.

Parameters

entry

a CtkEntry

 

Since: 2.22


ctk_entry_get_tabs ()

PangoTabArray *
ctk_entry_get_tabs (CtkEntry *entry);

Gets the tabstops that were set on the entry using ctk_entry_set_tabs(), if any.

Parameters

entry

a CtkEntry

 

Returns

the tabstops, or NULL if none was set.

[nullable][transfer none]

Since: 3.10


ctk_entry_set_tabs ()

void
ctk_entry_set_tabs (CtkEntry *entry,
                    PangoTabArray *tabs);

Sets a PangoTabArray; the tabstops in the array are applied to the entry text.

Parameters

entry

a CtkEntry

 

tabs

a PangoTabArray

 

Since: 3.10


ctk_entry_set_icon_from_pixbuf ()

void
ctk_entry_set_icon_from_pixbuf (CtkEntry *entry,
                                CtkEntryIconPosition icon_pos,
                                GdkPixbuf *pixbuf);

Sets the icon shown in the specified position using a pixbuf.

If pixbuf is NULL, no icon will be shown in the specified position.

Parameters

entry

a CtkEntry

 

icon_pos

Icon position

 

pixbuf

A GdkPixbuf, or NULL.

[allow-none]

Since: 2.16


ctk_entry_set_icon_from_stock ()

void
ctk_entry_set_icon_from_stock (CtkEntry *entry,
                               CtkEntryIconPosition icon_pos,
                               const gchar *stock_id);

ctk_entry_set_icon_from_stock has been deprecated since version 3.10 and should not be used in newly-written code.

Use ctk_entry_set_icon_from_icon_name() instead.

Sets the icon shown in the entry at the specified position from a stock image.

If stock_id is NULL, no icon will be shown in the specified position.

Parameters

entry

A CtkEntry

 

icon_pos

Icon position

 

stock_id

The name of the stock item, or NULL.

[allow-none]

Since: 2.16


ctk_entry_set_icon_from_icon_name ()

void
ctk_entry_set_icon_from_icon_name (CtkEntry *entry,
                                   CtkEntryIconPosition icon_pos,
                                   const gchar *icon_name);

Sets the icon shown in the entry at the specified position from the current icon theme.

If the icon name isn’t known, a “broken image” icon will be displayed instead.

If icon_name is NULL, no icon will be shown in the specified position.

Parameters

entry

A CtkEntry

 

icon_pos

The position at which to set the icon

 

icon_name

An icon name, or NULL.

[allow-none]

Since: 2.16


ctk_entry_set_icon_from_gicon ()

void
ctk_entry_set_icon_from_gicon (CtkEntry *entry,
                               CtkEntryIconPosition icon_pos,
                               GIcon *icon);

Sets the icon shown in the entry at the specified position from the current icon theme. If the icon isn’t known, a “broken image” icon will be displayed instead.

If icon is NULL, no icon will be shown in the specified position.

Parameters

entry

A CtkEntry

 

icon_pos

The position at which to set the icon

 

icon

The icon to set, or NULL.

[allow-none]

Since: 2.16


ctk_entry_get_icon_storage_type ()

CtkImageType
ctk_entry_get_icon_storage_type (CtkEntry *entry,
                                 CtkEntryIconPosition icon_pos);

Gets the type of representation being used by the icon to store image data. If the icon has no image data, the return value will be CTK_IMAGE_EMPTY.

Parameters

entry

a CtkEntry

 

icon_pos

Icon position

 

Returns

image representation being used

Since: 2.16


ctk_entry_get_icon_pixbuf ()

GdkPixbuf *
ctk_entry_get_icon_pixbuf (CtkEntry *entry,
                           CtkEntryIconPosition icon_pos);

Retrieves the image used for the icon.

Unlike the other methods of setting and getting icon data, this method will work regardless of whether the icon was set using a GdkPixbuf, a GIcon, a stock item, or an icon name.

Parameters

entry

A CtkEntry

 

icon_pos

Icon position

 

Returns

A GdkPixbuf, or NULL if no icon is set for this position.

[transfer none][nullable]

Since: 2.16


ctk_entry_get_icon_stock ()

const gchar *
ctk_entry_get_icon_stock (CtkEntry *entry,
                          CtkEntryIconPosition icon_pos);

ctk_entry_get_icon_stock has been deprecated since version 3.10 and should not be used in newly-written code.

Use ctk_entry_get_icon_name() instead.

Retrieves the stock id used for the icon, or NULL if there is no icon or if the icon was set by some other method (e.g., by pixbuf, icon name or gicon).

Parameters

entry

A CtkEntry

 

icon_pos

Icon position

 

Returns

A stock id, or NULL if no icon is set or if the icon wasn’t set from a stock id

Since: 2.16


ctk_entry_get_icon_name ()

const gchar *
ctk_entry_get_icon_name (CtkEntry *entry,
                         CtkEntryIconPosition icon_pos);

Retrieves the icon name used for the icon, or NULL if there is no icon or if the icon was set by some other method (e.g., by pixbuf, stock or gicon).

Parameters

entry

A CtkEntry

 

icon_pos

Icon position

 

Returns

An icon name, or NULL if no icon is set or if the icon wasn’t set from an icon name.

[nullable]

Since: 2.16


ctk_entry_get_icon_gicon ()

GIcon *
ctk_entry_get_icon_gicon (CtkEntry *entry,
                          CtkEntryIconPosition icon_pos);

Retrieves the GIcon used for the icon, or NULL if there is no icon or if the icon was set by some other method (e.g., by stock, pixbuf, or icon name).

Parameters

entry

A CtkEntry

 

icon_pos

Icon position

 

Returns

A GIcon, or NULL if no icon is set or if the icon is not a GIcon.

[transfer none][nullable]

Since: 2.16


ctk_entry_set_icon_activatable ()

void
ctk_entry_set_icon_activatable (CtkEntry *entry,
                                CtkEntryIconPosition icon_pos,
                                gboolean activatable);

Sets whether the icon is activatable.

Parameters

entry

A CtkEntry

 

icon_pos

Icon position

 

activatable

TRUE if the icon should be activatable

 

Since: 2.16


ctk_entry_get_icon_activatable ()

gboolean
ctk_entry_get_icon_activatable (CtkEntry *entry,
                                CtkEntryIconPosition icon_pos);

Returns whether the icon is activatable.

Parameters

entry

a CtkEntry

 

icon_pos

Icon position

 

Returns

TRUE if the icon is activatable.

Since: 2.16


ctk_entry_set_icon_sensitive ()

void
ctk_entry_set_icon_sensitive (CtkEntry *entry,
                              CtkEntryIconPosition icon_pos,
                              gboolean sensitive);

Sets the sensitivity for the specified icon.

Parameters

entry

A CtkEntry

 

icon_pos

Icon position

 

sensitive

Specifies whether the icon should appear sensitive or insensitive

 

Since: 2.16


ctk_entry_get_icon_sensitive ()

gboolean
ctk_entry_get_icon_sensitive (CtkEntry *entry,
                              CtkEntryIconPosition icon_pos);

Returns whether the icon appears sensitive or insensitive.

Parameters

entry

a CtkEntry

 

icon_pos

Icon position

 

Returns

TRUE if the icon is sensitive.

Since: 2.16


ctk_entry_get_icon_at_pos ()

gint
ctk_entry_get_icon_at_pos (CtkEntry *entry,
                           gint x,
                           gint y);

Finds the icon at the given position and return its index. The position’s coordinates are relative to the entry ’s top left corner. If x , y doesn’t lie inside an icon, -1 is returned. This function is intended for use in a “query-tooltip” signal handler.

Parameters

entry

a CtkEntry

 

x

the x coordinate of the position to find

 

y

the y coordinate of the position to find

 

Returns

the index of the icon at the given position, or -1

Since: 2.16


ctk_entry_set_icon_tooltip_text ()

void
ctk_entry_set_icon_tooltip_text (CtkEntry *entry,
                                 CtkEntryIconPosition icon_pos,
                                 const gchar *tooltip);

Sets tooltip as the contents of the tooltip for the icon at the specified position.

Use NULL for tooltip to remove an existing tooltip.

See also ctk_widget_set_tooltip_text() and ctk_entry_set_icon_tooltip_markup().

If you unset the widget tooltip via ctk_widget_set_tooltip_text() or ctk_widget_set_tooltip_markup(), this sets CtkWidget:has-tooltip to FALSE, which suppresses icon tooltips too. You can resolve this by then calling ctk_widget_set_has_tooltip() to set CtkWidget:has-tooltip back to TRUE, or setting at least one non-empty tooltip on any icon achieves the same result.

Parameters

entry

a CtkEntry

 

icon_pos

the icon position

 

tooltip

the contents of the tooltip for the icon, or NULL.

[allow-none]

Since: 2.16


ctk_entry_get_icon_tooltip_text ()

gchar *
ctk_entry_get_icon_tooltip_text (CtkEntry *entry,
                                 CtkEntryIconPosition icon_pos);

Gets the contents of the tooltip on the icon at the specified position in entry .

Parameters

entry

a CtkEntry

 

icon_pos

the icon position

 

Returns

the tooltip text, or NULL. Free the returned string with g_free() when done.

[nullable]

Since: 2.16


ctk_entry_set_icon_tooltip_markup ()

void
ctk_entry_set_icon_tooltip_markup (CtkEntry *entry,
                                   CtkEntryIconPosition icon_pos,
                                   const gchar *tooltip);

Sets tooltip as the contents of the tooltip for the icon at the specified position. tooltip is assumed to be marked up with the Pango text markup language.

Use NULL for tooltip to remove an existing tooltip.

See also ctk_widget_set_tooltip_markup() and ctk_entry_set_icon_tooltip_text().

Parameters

entry

a CtkEntry

 

icon_pos

the icon position

 

tooltip

the contents of the tooltip for the icon, or NULL.

[allow-none]

Since: 2.16


ctk_entry_get_icon_tooltip_markup ()

gchar *
ctk_entry_get_icon_tooltip_markup (CtkEntry *entry,
                                   CtkEntryIconPosition icon_pos);

Gets the contents of the tooltip on the icon at the specified position in entry .

Parameters

entry

a CtkEntry

 

icon_pos

the icon position

 

Returns

the tooltip text, or NULL. Free the returned string with g_free() when done.

[nullable]

Since: 2.16


ctk_entry_set_icon_drag_source ()

void
ctk_entry_set_icon_drag_source (CtkEntry *entry,
                                CtkEntryIconPosition icon_pos,
                                CtkTargetList *target_list,
                                CdkDragAction actions);

Sets up the icon at the given position so that CTK+ will start a drag operation when the user clicks and drags the icon.

To handle the drag operation, you need to connect to the usual “drag-data-get” (or possibly “drag-data-delete”) signal, and use ctk_entry_get_current_icon_drag_source() in your signal handler to find out if the drag was started from an icon.

By default, CTK+ uses the icon as the drag icon. You can use the “drag-begin” signal to set a different icon. Note that you have to use g_signal_connect_after() to ensure that your signal handler gets executed after the default handler.

Parameters

entry

a CtkEntry

 

icon_pos

icon position

 

target_list

the targets (data formats) in which the data can be provided

 

actions

a bitmask of the allowed drag actions

 

Since: 2.16


ctk_entry_get_current_icon_drag_source ()

gint
ctk_entry_get_current_icon_drag_source
                               (CtkEntry *entry);

Returns the index of the icon which is the source of the current DND operation, or -1.

This function is meant to be used in a “drag-data-get” callback.

Parameters

entry

a CtkEntry

 

Returns

index of the icon which is the source of the current DND operation, or -1.

Since: 2.16


ctk_entry_get_icon_area ()

void
ctk_entry_get_icon_area (CtkEntry *entry,
                         CtkEntryIconPosition icon_pos,
                         CdkRectangle *icon_area);

Gets the area where entry’s icon at icon_pos is drawn. This function is useful when drawing something to the entry in a draw callback.

If the entry is not realized or has no icon at the given position, icon_area is filled with zeros. Otherwise, icon_area will be filled with the icon’s allocation, relative to entry ’s allocation.

See also ctk_entry_get_text_area()

Parameters

entry

A CtkEntry

 

icon_pos

Icon position

 

icon_area

Return location for the icon’s area.

[out]

Since: 3.0


ctk_entry_set_input_purpose ()

void
ctk_entry_set_input_purpose (CtkEntry *entry,
                             CtkInputPurpose purpose);

Sets the “input-purpose” property which can be used by on-screen keyboards and other input methods to adjust their behaviour.

Parameters

entry

a CtkEntry

 

purpose

the purpose

 

Since: 3.6


ctk_entry_get_input_purpose ()

CtkInputPurpose
ctk_entry_get_input_purpose (CtkEntry *entry);

Gets the value of the “input-purpose” property.

Parameters

entry

a CtkEntry

 

Since: 3.6


ctk_entry_set_input_hints ()

void
ctk_entry_set_input_hints (CtkEntry *entry,
                           CtkInputHints hints);

Sets the “input-hints” property, which allows input methods to fine-tune their behaviour.

Parameters

entry

a CtkEntry

 

hints

the hints

 

Since: 3.6


ctk_entry_get_input_hints ()

CtkInputHints
ctk_entry_get_input_hints (CtkEntry *entry);

Gets the value of the “input-hints” property.

Parameters

entry

a CtkEntry

 

Since: 3.6


ctk_entry_grab_focus_without_selecting ()

void
ctk_entry_grab_focus_without_selecting
                               (CtkEntry *entry);

Causes entry to have keyboard focus.

It behaves like ctk_widget_grab_focus(), except that it doesn't select the contents of the entry. You only want to call this on some special entries which the user usually doesn't want to replace all text in, such as search-as-you-type entries.

Parameters

entry

a CtkEntry

 

Since: 3.16

Types and Values

struct CtkEntry

struct CtkEntry;

struct CtkEntryClass

struct CtkEntryClass {
  CtkWidgetClass parent_class;

  /* Hook to customize right-click popup */
  void (* populate_popup)   (CtkEntry       *entry,
                             CtkWidget      *popup);

  /* Action signals
   */
  void (* activate)           (CtkEntry             *entry);
  void (* move_cursor)        (CtkEntry             *entry,
			       CtkMovementStep       step,
			       gint                  count,
			       gboolean              extend_selection);
  void (* insert_at_cursor)   (CtkEntry             *entry,
			       const gchar          *str);
  void (* delete_from_cursor) (CtkEntry             *entry,
			       CtkDeleteType         type,
			       gint                  count);
  void (* backspace)          (CtkEntry             *entry);
  void (* cut_clipboard)      (CtkEntry             *entry);
  void (* copy_clipboard)     (CtkEntry             *entry);
  void (* paste_clipboard)    (CtkEntry             *entry);
  void (* toggle_overwrite)   (CtkEntry             *entry);

  /* hooks to add other objects beside the entry (like in CtkSpinButton) */
  void (* get_text_area_size) (CtkEntry       *entry,
			       gint           *x,
			       gint           *y,
			       gint           *width,
			       gint           *height);
  void (* get_frame_size)     (CtkEntry       *entry,
                               gint           *x,
                               gint           *y,
			       gint           *width,
			       gint           *height);
  void (* insert_emoji)       (CtkEntry             *entry);
};

Class structure for CtkEntry. All virtual functions have a default implementation. Derived classes may set the virtual function pointers for the signal handlers to NULL, but must keep get_text_area_size and get_frame_size non-NULL; either use the default implementation, or provide a custom one.

Members

populate_popup ()

Class handler for the “populate-popup” signal. If non-NULL, this will be called to add additional entries to the context menu when it is displayed.

 

activate ()

Class handler for the “activate” signal. The default implementation calls ctk_window_activate_default() on the entry’s top-level window.

 

move_cursor ()

Class handler for the “move-cursor” signal. The default implementation specifies the standard CtkEntry cursor movement behavior.

 

insert_at_cursor ()

Class handler for the “insert-at-cursor” signal. The default implementation inserts text at the cursor.

 

delete_from_cursor ()

Class handler for the “delete-from-cursor” signal. The default implementation deletes the selection or the specified number of characters or words.

 

backspace ()

Class handler for the “backspace” signal. The default implementation deletes the selection or a single character or word.

 

cut_clipboard ()

Class handler for the “cut-clipboard” signal. The default implementation cuts the selection, if one exists.

 

copy_clipboard ()

Class handler for the “copy-clipboard” signal. The default implementation copies the selection, if one exists.

 

paste_clipboard ()

Class handler for the “paste-clipboard” signal. The default implementation pastes at the current cursor position or over the current selection if one exists.

 

toggle_overwrite ()

Class handler for the “toggle-overwrite” signal. The default implementation toggles overwrite mode and blinks the cursor.

 

get_text_area_size ()

Calculate the size of the text area, which is its allocated width and requested height, minus space for margins and borders. This virtual function must be non-NULL.

 

get_frame_size ()

Calculate the size of the text area frame, which is its allocated width and requested height, minus space for margins and borders, and taking baseline and text height into account. This virtual function must be non-NULL.

 

insert_emoji ()

The Emoji chooser.

 

enum CtkEntryIconPosition

Specifies the side of the entry at which an icon is placed.

Members

CTK_ENTRY_ICON_PRIMARY

At the beginning of the entry (depending on the text direction).

 

CTK_ENTRY_ICON_SECONDARY

At the end of the entry (depending on the text direction).

 

Since: 2.16


enum CtkInputPurpose

Describes primary purpose of the input widget. This information is useful for on-screen keyboards and similar input methods to decide which keys should be presented to the user.

Note that the purpose is not meant to impose a totally strict rule about allowed characters, and does not replace input validation. It is fine for an on-screen keyboard to let the user override the character set restriction that is expressed by the purpose. The application is expected to validate the entry contents, even if it specified a purpose.

The difference between CTK_INPUT_PURPOSE_DIGITS and CTK_INPUT_PURPOSE_NUMBER is that the former accepts only digits while the latter also some punctuation (like commas or points, plus, minus) and “e” or “E” as in 3.14E+000.

This enumeration may be extended in the future; input methods should interpret unknown values as “free form”.

Members

CTK_INPUT_PURPOSE_FREE_FORM

Allow any character

 

CTK_INPUT_PURPOSE_ALPHA

Allow only alphabetic characters

 

CTK_INPUT_PURPOSE_DIGITS

Allow only digits

 

CTK_INPUT_PURPOSE_NUMBER

Edited field expects numbers

 

CTK_INPUT_PURPOSE_PHONE

Edited field expects phone number

 

CTK_INPUT_PURPOSE_URL

Edited field expects URL

 

CTK_INPUT_PURPOSE_EMAIL

Edited field expects email address

 

CTK_INPUT_PURPOSE_NAME

Edited field expects the name of a person

 

CTK_INPUT_PURPOSE_PASSWORD

Like CTK_INPUT_PURPOSE_FREE_FORM , but characters are hidden

 

CTK_INPUT_PURPOSE_PIN

Like CTK_INPUT_PURPOSE_DIGITS , but characters are hidden

 

CTK_INPUT_PURPOSE_TERMINAL

Allow any character, in addition to control codes

 

Since: 3.6


enum CtkInputHints

Describes hints that might be taken into account by input methods or applications. Note that input methods may already tailor their behaviour according to the CtkInputPurpose of the entry.

Some common sense is expected when using these flags - mixing CTK_INPUT_HINT_LOWERCASE with any of the uppercase hints makes no sense.

This enumeration may be extended in the future; input methods should ignore unknown values.

Members

CTK_INPUT_HINT_NONE

No special behaviour suggested

 

CTK_INPUT_HINT_SPELLCHECK

Suggest checking for typos

 

CTK_INPUT_HINT_NO_SPELLCHECK

Suggest not checking for typos

 

CTK_INPUT_HINT_WORD_COMPLETION

Suggest word completion

 

CTK_INPUT_HINT_LOWERCASE

Suggest to convert all text to lowercase

 

CTK_INPUT_HINT_UPPERCASE_CHARS

Suggest to capitalize all text

 

CTK_INPUT_HINT_UPPERCASE_WORDS

Suggest to capitalize the first character of each word

 

CTK_INPUT_HINT_UPPERCASE_SENTENCES

Suggest to capitalize the first word of each sentence

 

CTK_INPUT_HINT_INHIBIT_OSK

Suggest to not show an onscreen keyboard (e.g for a calculator that already has all the keys).

 

CTK_INPUT_HINT_VERTICAL_WRITING

The text is vertical. Since 3.18

 

CTK_INPUT_HINT_EMOJI

Suggest offering Emoji support. Since 3.22.20

 

CTK_INPUT_HINT_NO_EMOJI

Suggest not offering Emoji support. Since 3.22.20

 

Since: 3.6

Property Details

The “activates-default” property

  “activates-default”        gboolean

Whether to activate the default widget (such as the default button in a dialog) when Enter is pressed.

Owner: CtkEntry

Flags: Read / Write

Default value: FALSE


The “attributes” property

  “attributes”               PangoAttrList *

A list of Pango attributes to apply to the text of the entry.

This is mainly useful to change the size or weight of the text.

The PangoAttribute's start_index and end_index must refer to the CtkEntryBuffer text, i.e. without the preedit string.

Owner: CtkEntry

Flags: Read / Write

Since: 3.6


The “buffer” property

  “buffer”                   CtkEntryBuffer *

Text buffer object which actually stores entry text.

Owner: CtkEntry

Flags: Read / Write / Construct


The “caps-lock-warning” property

  “caps-lock-warning”        gboolean

Whether password entries will show a warning when Caps Lock is on.

Note that the warning is shown using a secondary icon, and thus does not work if you are using the secondary icon position for some other purpose.

Owner: CtkEntry

Flags: Read / Write

Default value: TRUE

Since: 2.16


The “completion” property

  “completion”               CtkEntryCompletion *

The auxiliary completion object to use with the entry.

Owner: CtkEntry

Flags: Read / Write

Since: 3.2


The “cursor-position” property

  “cursor-position”          int

The current position of the insertion cursor in chars.

Owner: CtkEntry

Flags: Read

Allowed values: [0,65535]

Default value: 0


The “editable” property

  “editable”                 gboolean

Whether the entry contents can be edited.

Owner: CtkEntry

Flags: Read / Write

Default value: TRUE


The “enable-emoji-completion” property

  “enable-emoji-completion”  gboolean

Whether to suggest Emoji replacements.

Owner: CtkEntry

Flags: Read / Write

Default value: FALSE


The “has-frame” property

  “has-frame”                gboolean

FALSE removes outside bevel from entry.

Owner: CtkEntry

Flags: Read / Write

Default value: TRUE


The “im-module” property

  “im-module”                char *

Which IM (input method) module should be used for this entry. See CtkIMContext.

Setting this to a non-NULL value overrides the system-wide IM module setting. See the CtkSettings “ctk-im-module” property.

Owner: CtkEntry

Flags: Read / Write

Default value: NULL

Since: 2.16


The “inner-border” property

  “inner-border”             CtkBorder *

Sets the text area's border between the text and the frame.

CtkEntry:inner-border has been deprecated since version 3.4 and should not be used in newly-written code.

Use the standard border and padding CSS properties (through objects like CtkStyleContext and CtkCssProvider); the value of this style property is ignored.

Owner: CtkEntry

Flags: Read / Write

Since: 2.10


The “input-hints” property

  “input-hints”              CtkInputHints

Additional hints (beyond “input-purpose”) that allow input methods to fine-tune their behaviour.

Owner: CtkEntry

Flags: Read / Write

Since: 3.6


The “input-purpose” property

  “input-purpose”            CtkInputPurpose

The purpose of this text field.

This property can be used by on-screen keyboards and other input methods to adjust their behaviour.

Note that setting the purpose to CTK_INPUT_PURPOSE_PASSWORD or CTK_INPUT_PURPOSE_PIN is independent from setting “visibility”.

Owner: CtkEntry

Flags: Read / Write

Default value: CTK_INPUT_PURPOSE_FREE_FORM

Since: 3.6


The “invisible-char” property

  “invisible-char”           guint

The invisible character is used when masking entry contents (in \"password mode\")"). When it is not explicitly set with the “invisible-char” property, CTK+ determines the character to use from a list of possible candidates, depending on availability in the current font.

This style property allows the theme to prepend a character to the list of candidates.

Owner: CtkEntry

Flags: Read / Write

Default value: '*'

Since: 2.18


The “invisible-char-set” property

  “invisible-char-set”       gboolean

Whether the invisible char has been set for the CtkEntry.

Owner: CtkEntry

Flags: Read / Write

Default value: FALSE

Since: 2.16


The “max-length” property

  “max-length”               int

Maximum number of characters for this entry. Zero if no maximum.

Owner: CtkEntry

Flags: Read / Write

Allowed values: [0,65535]

Default value: 0


The “max-width-chars” property

  “max-width-chars”          int

The desired maximum width of the entry, in characters. If this property is set to -1, the width will be calculated automatically.

Owner: CtkEntry

Flags: Read / Write

Allowed values: >= -1

Default value: -1

Since: 3.12


The “overwrite-mode” property

  “overwrite-mode”           gboolean

If text is overwritten when typing in the CtkEntry.

Owner: CtkEntry

Flags: Read / Write

Default value: FALSE

Since: 2.14


The “placeholder-text” property

  “placeholder-text”         char *

The text that will be displayed in the CtkEntry when it is empty and unfocused.

Owner: CtkEntry

Flags: Read / Write

Default value: NULL

Since: 3.2


The “populate-all” property

  “populate-all”             gboolean

If :populate-all is TRUE, the “populate-popup” signal is also emitted for touch popups.

Owner: CtkEntry

Flags: Read / Write

Default value: FALSE

Since: 3.8


The “primary-icon-activatable” property

  “primary-icon-activatable” gboolean

Whether the primary icon is activatable.

CTK+ emits the “icon-press” and “icon-release” signals only on sensitive, activatable icons.

Sensitive, but non-activatable icons can be used for purely informational purposes.

Owner: CtkEntry

Flags: Read / Write

Default value: TRUE

Since: 2.16


The “primary-icon-gicon” property

  “primary-icon-gicon”       GIcon *

The GIcon to use for the primary icon for the entry.

Owner: CtkEntry

Flags: Read / Write

Since: 2.16


The “primary-icon-name” property

  “primary-icon-name”        char *

The icon name to use for the primary icon for the entry.

Owner: CtkEntry

Flags: Read / Write

Default value: NULL

Since: 2.16


The “primary-icon-pixbuf” property

  “primary-icon-pixbuf”      GdkPixbuf *

A pixbuf to use as the primary icon for the entry.

Owner: CtkEntry

Flags: Read / Write

Since: 2.16


The “primary-icon-sensitive” property

  “primary-icon-sensitive”   gboolean

Whether the primary icon is sensitive.

An insensitive icon appears grayed out. CTK+ does not emit the “icon-press” and “icon-release” signals and does not allow DND from insensitive icons.

An icon should be set insensitive if the action that would trigger when clicked is currently not available.

Owner: CtkEntry

Flags: Read / Write

Default value: TRUE

Since: 2.16


The “primary-icon-stock” property

  “primary-icon-stock”       char *

The stock id to use for the primary icon for the entry.

CtkEntry:primary-icon-stock has been deprecated since version 3.10 and should not be used in newly-written code.

Use “primary-icon-name” instead.

Owner: CtkEntry

Flags: Read / Write

Default value: NULL

Since: 2.16


The “primary-icon-storage-type” property

  “primary-icon-storage-type” CtkImageType

The representation which is used for the primary icon of the entry.

Owner: CtkEntry

Flags: Read

Default value: CTK_IMAGE_EMPTY

Since: 2.16


The “primary-icon-tooltip-markup” property

  “primary-icon-tooltip-markup” char *

The contents of the tooltip on the primary icon, which is marked up with the Pango text markup language.

Also see ctk_entry_set_icon_tooltip_markup().

Owner: CtkEntry

Flags: Read / Write

Default value: NULL

Since: 2.16


The “primary-icon-tooltip-text” property

  “primary-icon-tooltip-text” char *

The contents of the tooltip on the primary icon.

Also see ctk_entry_set_icon_tooltip_text().

Owner: CtkEntry

Flags: Read / Write

Default value: NULL

Since: 2.16


The “progress-fraction” property

  “progress-fraction”        double

The current fraction of the task that's been completed.

Owner: CtkEntry

Flags: Read / Write

Allowed values: [0,1]

Default value: 0

Since: 2.16


The “progress-pulse-step” property

  “progress-pulse-step”      double

The fraction of total entry width to move the progress bouncing block for each call to ctk_entry_progress_pulse().

Owner: CtkEntry

Flags: Read / Write

Allowed values: [0,1]

Default value: 0.1

Since: 2.16


The “scroll-offset” property

  “scroll-offset”            int

Number of pixels of the entry scrolled off the screen to the left.

Owner: CtkEntry

Flags: Read

Allowed values: >= 0

Default value: 0


The “secondary-icon-activatable” property

  “secondary-icon-activatable” gboolean

Whether the secondary icon is activatable.

CTK+ emits the “icon-press” and “icon-release” signals only on sensitive, activatable icons.

Sensitive, but non-activatable icons can be used for purely informational purposes.

Owner: CtkEntry

Flags: Read / Write

Default value: TRUE

Since: 2.16


The “secondary-icon-gicon” property

  “secondary-icon-gicon”     GIcon *

The GIcon to use for the secondary icon for the entry.

Owner: CtkEntry

Flags: Read / Write

Since: 2.16


The “secondary-icon-name” property

  “secondary-icon-name”      char *

The icon name to use for the secondary icon for the entry.

Owner: CtkEntry

Flags: Read / Write

Default value: NULL

Since: 2.16


The “secondary-icon-pixbuf” property

  “secondary-icon-pixbuf”    GdkPixbuf *

An pixbuf to use as the secondary icon for the entry.

Owner: CtkEntry

Flags: Read / Write

Since: 2.16


The “secondary-icon-sensitive” property

  “secondary-icon-sensitive” gboolean

Whether the secondary icon is sensitive.

An insensitive icon appears grayed out. CTK+ does not emit the “icon-press” and “icon-release” signals and does not allow DND from insensitive icons.

An icon should be set insensitive if the action that would trigger when clicked is currently not available.

Owner: CtkEntry

Flags: Read / Write

Default value: TRUE

Since: 2.16


The “secondary-icon-stock” property

  “secondary-icon-stock”     char *

The stock id to use for the secondary icon for the entry.

CtkEntry:secondary-icon-stock has been deprecated since version 3.10 and should not be used in newly-written code.

Use “secondary-icon-name” instead.

Owner: CtkEntry

Flags: Read / Write

Default value: NULL

Since: 2.16


The “secondary-icon-storage-type” property

  “secondary-icon-storage-type” CtkImageType

The representation which is used for the secondary icon of the entry.

Owner: CtkEntry

Flags: Read

Default value: CTK_IMAGE_EMPTY

Since: 2.16


The “secondary-icon-tooltip-markup” property

  “secondary-icon-tooltip-markup” char *

The contents of the tooltip on the secondary icon, which is marked up with the Pango text markup language.

Also see ctk_entry_set_icon_tooltip_markup().

Owner: CtkEntry

Flags: Read / Write

Default value: NULL

Since: 2.16


The “secondary-icon-tooltip-text” property

  “secondary-icon-tooltip-text” char *

The contents of the tooltip on the secondary icon.

Also see ctk_entry_set_icon_tooltip_text().

Owner: CtkEntry

Flags: Read / Write

Default value: NULL

Since: 2.16


The “selection-bound” property

  “selection-bound”          int

The position of the opposite end of the selection from the cursor in chars.

Owner: CtkEntry

Flags: Read

Allowed values: [0,65535]

Default value: 0


The “shadow-type” property

  “shadow-type”              CtkShadowType

Which kind of shadow to draw around the entry when “has-frame” is set to TRUE.

CtkEntry:shadow-type has been deprecated since version 3.20 and should not be used in newly-written code.

Use CSS to determine the style of the border; the value of this style property is ignored.

Owner: CtkEntry

Flags: Read / Write

Default value: CTK_SHADOW_IN

Since: 2.12


The “show-emoji-icon” property

  “show-emoji-icon”          gboolean

Whether to show an icon for Emoji.

Owner: CtkEntry

Flags: Read / Write

Default value: FALSE


The “tabs” property

  “tabs”                     PangoTabArray *

A list of tabstop locations to apply to the text of the entry.

Owner: CtkEntry

Flags: Read / Write


The “text” property

  “text”                     char *

The contents of the entry.

Owner: CtkEntry

Flags: Read / Write

Default value: ""


The “text-length” property

  “text-length”              guint

The length of the text in the CtkEntry.

Owner: CtkEntry

Flags: Read

Allowed values: <= 65535

Default value: 0

Since: 2.14


The “truncate-multiline” property

  “truncate-multiline”       gboolean

When TRUE, pasted multi-line text is truncated to the first line.

Owner: CtkEntry

Flags: Read / Write

Default value: FALSE

Since: 2.10


The “visibility” property

  “visibility”               gboolean

FALSE displays the "invisible char" instead of the actual text (password mode).

Owner: CtkEntry

Flags: Read / Write

Default value: TRUE


The “width-chars” property

  “width-chars”              int

Number of characters to leave space for in the entry.

Owner: CtkEntry

Flags: Read / Write

Allowed values: >= -1

Default value: -1


The “xalign” property

  “xalign”                   float

The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL layouts.

Owner: CtkEntry

Flags: Read / Write

Allowed values: [0,1]

Default value: 0

Since: 2.4

Signal Details

The “activate” signal

void
user_function (CtkEntry *entry,
               gpointer  user_data)

The ::activate signal is emitted when the user hits the Enter key.

While this signal is used as a keybinding signal, it is also commonly used by applications to intercept activation of entries.

The default bindings for this signal are all forms of the Enter key.

Parameters

entry

The entry on which the signal is emitted

 

user_data

user data set when the signal handler was connected.

 

Flags: Action


The “backspace” signal

void
user_function (CtkEntry *entry,
               gpointer  user_data)

The ::backspace signal is a keybinding signal which gets emitted when the user asks for it.

The default bindings for this signal are Backspace and Shift-Backspace.

Parameters

entry

the object which received the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: Action


The “copy-clipboard” signal

void
user_function (CtkEntry *entry,
               gpointer  user_data)

The ::copy-clipboard signal is a keybinding signal which gets emitted to copy the selection to the clipboard.

The default bindings for this signal are Ctrl-c and Ctrl-Insert.

Parameters

entry

the object which received the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: Action


The “cut-clipboard” signal

void
user_function (CtkEntry *entry,
               gpointer  user_data)

The ::cut-clipboard signal is a keybinding signal which gets emitted to cut the selection to the clipboard.

The default bindings for this signal are Ctrl-x and Shift-Delete.

Parameters

entry

the object which received the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: Action


The “delete-from-cursor” signal

void
user_function (CtkEntry     *entry,
               CtkDeleteType type,
               int           count,
               gpointer      user_data)

The ::delete-from-cursor signal is a keybinding signal which gets emitted when the user initiates a text deletion.

If the type is CTK_DELETE_CHARS, CTK+ deletes the selection if there is one, otherwise it deletes the requested number of characters.

The default bindings for this signal are Delete for deleting a character and Ctrl-Delete for deleting a word.

Parameters

entry

the object which received the signal

 

type

the granularity of the deletion, as a CtkDeleteType

 

count

the number of type units to delete

 

user_data

user data set when the signal handler was connected.

 

Flags: Action


The “icon-press” signal

void
user_function (CtkEntry            *entry,
               CtkEntryIconPosition icon_pos,
               CdkEvent            *event,
               gpointer             user_data)

The ::icon-press signal is emitted when an activatable icon is clicked.

Parameters

entry

The entry on which the signal is emitted

 

icon_pos

The position of the clicked icon

 

event

the button press event

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 2.16


The “icon-release” signal

void
user_function (CtkEntry            *entry,
               CtkEntryIconPosition icon_pos,
               CdkEvent            *event,
               gpointer             user_data)

The ::icon-release signal is emitted on the button release from a mouse click over an activatable icon.

Parameters

entry

The entry on which the signal is emitted

 

icon_pos

The position of the clicked icon

 

event

the button release event

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 2.16


The “insert-at-cursor” signal

void
user_function (CtkEntry *entry,
               char     *string,
               gpointer  user_data)

The ::insert-at-cursor signal is a keybinding signal which gets emitted when the user initiates the insertion of a fixed string at the cursor.

This signal has no default bindings.

Parameters

entry

the object which received the signal

 

string

the string to insert

 

user_data

user data set when the signal handler was connected.

 

Flags: Action


The “insert-emoji” signal

void
user_function (CtkEntry *entry,
               gpointer  user_data)

The ::insert-emoji signal is a keybinding signal which gets emitted to present the Emoji chooser for the entry .

The default bindings for this signal are Ctrl-. and Ctrl-;

Parameters

entry

the object which received the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: Action

Since: 3.22.27


The “move-cursor” signal

void
user_function (CtkEntry       *entry,
               CtkMovementStep step,
               int             count,
               gboolean        extend_selection,
               gpointer        user_data)

The ::move-cursor signal is a keybinding signal which gets emitted when the user initiates a cursor movement. If the cursor is not visible in entry , this signal causes the viewport to be moved instead.

Applications should not connect to it, but may emit it with g_signal_emit_by_name() if they need to control the cursor programmatically.

The default bindings for this signal come in two variants, the variant with the Shift modifier extends the selection, the variant without the Shift modifer does not. There are too many key combinations to list them all here.

  • Arrow keys move by individual characters/lines

  • Ctrl-arrow key combinations move by words/paragraphs

  • Home/End keys move to the ends of the buffer

Parameters

entry

the object which received the signal

 

step

the granularity of the move, as a CtkMovementStep

 

count

the number of step units to move

 

extend_selection

TRUE if the move should extend the selection

 

user_data

user data set when the signal handler was connected.

 

Flags: Action


The “paste-clipboard” signal

void
user_function (CtkEntry *entry,
               gpointer  user_data)

The ::paste-clipboard signal is a keybinding signal which gets emitted to paste the contents of the clipboard into the text view.

The default bindings for this signal are Ctrl-v and Shift-Insert.

Parameters

entry

the object which received the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: Action


The “populate-popup” signal

void
user_function (CtkEntry  *entry,
               CtkWidget *widget,
               gpointer   user_data)

The ::populate-popup signal gets emitted before showing the context menu of the entry.

If you need to add items to the context menu, connect to this signal and append your items to the widget , which will be a CtkMenu in this case.

If “populate-all” is TRUE, this signal will also be emitted to populate touch popups. In this case, widget will be a different container, e.g. a CtkToolbar. The signal handler should not make assumptions about the type of widget .

Parameters

entry

The entry on which the signal is emitted

 

widget

the container that is being populated

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “preedit-changed” signal

void
user_function (CtkEntry *entry,
               char     *preedit,
               gpointer  user_data)

If an input method is used, the typed text will not immediately be committed to the buffer. So if you are interested in the text, connect to this signal.

Parameters

entry

the object which received the signal

 

preedit

the current preedit string

 

user_data

user data set when the signal handler was connected.

 

Flags: Action

Since: 2.20


The “toggle-overwrite” signal

void
user_function (CtkEntry *entry,
               gpointer  user_data)

The ::toggle-overwrite signal is a keybinding signal which gets emitted to toggle the overwrite mode of the entry.

The default bindings for this signal is Insert.

Parameters

entry

the object which received the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: Action

See Also

CtkTextView, CtkEntryCompletion