HildonEntry

HildonEntry — Widget representing a text entry in the Hildon framework.

Synopsis

                    HildonEntryPrivate;
                    HildonEntry;
GtkWidget*          hildon_entry_new                    (HildonSizeType size);
void                hildon_entry_set_text               (HildonEntry *entry,
                                                         const gchar *text);
const gchar*        hildon_entry_get_text               (HildonEntry *entry);
void                hildon_entry_set_placeholder        (HildonEntry *entry,
                                                         const gchar *text);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----GtkObject
               +----GtkWidget
                     +----GtkEntry
                           +----HildonEntry

Implemented Interfaces

HildonEntry implements AtkImplementorIface, GtkBuildable, GtkEditable and GtkCellEditable.

Description

The HildonEntry is a GTK widget which represents a text entry. It is derived from the GtkEntry widget and provides additional commodities specific to the Hildon framework.

Besides all the features inherited from GtkEntry, a HildonEntry can also have a placeholder text. This text will be shown if the entry is empty and doesn't have the input focus, but it's otherwise ignored. Thus, calls to hildon_entry_get_text() will never return the placeholder text, not even when it's being displayed.

Although HildonEntry is derived from GtkEntry, gtk_entry_get_text() and gtk_entry_set_text() must never be used to get/set the text in this widget. hildon_entry_get_text() and hildon_entry_set_text() must be used instead.

Example 19. Creating a HildonEntry with a placeholder

GtkWidget *
create_entry (void)
{
    GtkWidget *entry;

    entry = hildon_entry_new (HILDON_SIZE_AUTO);
    hildon_entry_set_placeholder (HILDON_ENTRY (entry), "First name");

    return entry;
}


Details

HildonEntryPrivate

typedef struct _HildonEntryPrivate HildonEntryPrivate;


HildonEntry

typedef struct _HildonEntry HildonEntry;


hildon_entry_new ()

GtkWidget*          hildon_entry_new                    (HildonSizeType size);

Creates a new entry.

size : The size of the entry
Returns : a new HildonEntry

hildon_entry_set_text ()

void                hildon_entry_set_text               (HildonEntry *entry,
                                                         const gchar *text);

Sets the text in entry to text, replacing its current contents.

Note that you must never use gtk_entry_set_text() to set the text of a HildonEntry.

entry : a HildonEntry
text : the new text

hildon_entry_get_text ()

const gchar*        hildon_entry_get_text               (HildonEntry *entry);

Gets the current text in entry.

Note that you must never use gtk_entry_get_text() to get the text from a HildonEntry.

Also note that placeholder text (set using hildon_entry_set_placeholder()) is never returned. Only text set by hildon_entry_set_text() or typed by the user is considered.

entry : a HildonEntry
Returns : the text in entry. This text must not be modified or freed.

hildon_entry_set_placeholder ()

void                hildon_entry_set_placeholder        (HildonEntry *entry,
                                                         const gchar *text);

Sets the placeholder text in entry to text.

entry : a HildonEntry
text : the new text