HildonTextView

HildonTextView — Widget representing a text view in the Hildon framework.

Synopsis

                    HildonTextView;
GtkWidget*          hildon_text_view_new                (void);
void                hildon_text_view_set_buffer         (HildonTextView *text_view,
                                                         GtkTextBuffer *buffer);
GtkTextBuffer*      hildon_text_view_get_buffer         (HildonTextView *text_view);
void                hildon_text_view_set_placeholder    (HildonTextView *text_view,
                                                         const gchar *text);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----GtkObject
               +----GtkWidget
                     +----GtkContainer
                           +----GtkTextView
                                 +----HildonTextView

Implemented Interfaces

HildonTextView implements AtkImplementorIface and GtkBuildable.

Description

The HildonTextView is a GTK widget which represents a text view. It is derived from the GtkTextView widget and provides additional commodities specific to the Hildon framework.

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

Although HildonTextView is derived from GtkTextView, gtk_text_view_get_buffer() and gtk_text_view_set_buffer() must never be used to get/set the buffer in this widget. hildon_text_view_get_buffer() and hildon_text_view_set_buffer() must be used instead.

Example 20. Creating a HildonTextView with a placeholder

GtkWidget *
create_text_view (void)
{
    GtkWidget *text_view;

    text_view = hildon_text_view_new ();
    hildon_text_view_set_placeholder (HILDON_TEXT_VIEW (text_view),
                                      "Type some text here");

    return text_view;
}


Details

HildonTextView

typedef struct _HildonTextView HildonTextView;


hildon_text_view_new ()

GtkWidget*          hildon_text_view_new                (void);

Creates a new text view.

Returns : a new HildonTextView

hildon_text_view_set_buffer ()

void                hildon_text_view_set_buffer         (HildonTextView *text_view,
                                                         GtkTextBuffer *buffer);

Sets buffer as the buffer being displayed by text_view. The previous buffer displayed by the text view is unreferenced, and a reference is added to buffer. If you owned a reference to buffer before passing it to this function, you must remove that reference yourself

Note that you must never use gtk_text_view_set_buffer() to set the buffer of a HildonTextView.

text_view : a HildonTextView
buffer : a GtkTextBuffer

hildon_text_view_get_buffer ()

GtkTextBuffer*      hildon_text_view_get_buffer         (HildonTextView *text_view);

Returns the text buffer in text_view. The reference count is not incremented; the caller of this function won't own a new reference.

Note that you must never use gtk_text_view_get_buffer() to get the buffer from a HildonTextView.

Also note that placeholder text (set using hildon_text_view_set_placeholder()) is never contained in this buffer.

text_view : a HildonTextView
Returns : a GtkTextBuffer

hildon_text_view_set_placeholder ()

void                hildon_text_view_set_placeholder    (HildonTextView *text_view,
                                                         const gchar *text);

Sets the placeholder text in text_view to text.

text_view : a HildonTextView
text : the new text