GntTextView: GNT Reference Manual

## GntTextView GntTextView — A widget for displaying larger bodies of formatted text |

## Functions

#define | GNT_TEXT_VIEW_FLAGS()
#define | GNT_TEXT_VIEW_SET_FLAGS()
#define | GNT_TEXT_VIEW_UNSET_FLAGS()
GType | gnt_text_view_get_gtype ()
GntWidget * | gnt_text_view_new ()
void | gnt_text_view_scroll ()
void | gnt_text_view_append_text_with_flags ()
void | gnt_text_view_append_text_with_tag ()
const gchar * | gnt_text_view_get_text ()
void | gnt_text_view_next_line ()
chtype | gnt_text_format_flag_to_chtype ()
void | gnt_text_view_clear ()
int | gnt_text_view_get_lines_below ()
int | gnt_text_view_get_lines_above ()
int | gnt_text_view_tag_change ()
void | gnt_text_view_attach_scroll_widget ()
void | gnt_text_view_attach_pager_widget ()
void | gnt_text_view_attach_editor_widget ()
void | gnt_text_view_set_flag ()

## Types and Values

enum | GntTextViewFlag
struct | GntTextView
enum | GntTextFormatFlags
| GntTextViewPriv

## Description

## Functions

### GNT_TEXT_VIEW_FLAGS()

    #define GNT_TEXT_VIEW_FLAGS(obj)				(GNT_TEXT_VIEW(obj)->priv.flags)

`GNT_TEXT_VIEW_FLAGS` has been deprecated since version 2.14.0 and should not be used in newly-written code.

This is an internal implementation detail.

### GNT_TEXT_VIEW_SET_FLAGS()

    #define GNT_TEXT_VIEW_SET_FLAGS(obj, flags)		(GNT_TEXT_VIEW_FLAGS(obj) |= flags)

`GNT_TEXT_VIEW_SET_FLAGS` has been deprecated since version 2.14.0 and should not be used in newly-written code.

This is an internal implementation detail.

### GNT_TEXT_VIEW_UNSET_FLAGS()

    #define GNT_TEXT_VIEW_UNSET_FLAGS(obj, flags) (GNT_TEXT_VIEW_FLAGS(obj) &= ~(flags))

`GNT_TEXT_VIEW_UNSET_FLAGS` has been deprecated since version 2.14.0 and should not be used in newly-written code.

This is an internal implementation detail.

### gnt_text_view_get_gtype ()

    GType
    gnt_text_view_get_gtype (void);

#### Returns

GType for GntTextView.

### gnt_text_view_new ()

    GntWidget *
    gnt_text_view_new (void);

Create a new textview.

#### Returns

The newly created textview.

### gnt_text_view_scroll ()

    void
    gnt_text_view_scroll (GntTextView *view,
                          int scroll);

Scroll the textview.

#### Parameters

view | The textview to scroll. |
scroll | scroll > 0 means scroll up, < 0 means scroll down, == 0 means scroll to the end. |

### gnt_text_view_append_text_with_flags ()

    void
    gnt_text_view_append_text_with_flags (GntTextView *view,
                                          const char *text,
                                          GntTextFormatFlags flags);

Append new text in a textview.

#### Parameters

view | The textview. |
text | The text to append to the textview. |
flags | The text-flags to apply to the new text. |

### gnt_text_view_append_text_with_tag ()

    void
    gnt_text_view_append_text_with_tag (GntTextView *view,
                                        const char *text,
                                        GntTextFormatFlags flags,
                                        const char *tag);

Append text in the textview, with some identifier (tag) for the added text.

#### Parameters

view | The textview. |
text | The text to append. |
flags | The text-flags to apply to the new text. |
tag | The tag for the appended text, so it can be changed later (see `gnt_text_view_tag_change()`) |

### gnt_text_view_get_text ()

    const gchar *
    gnt_text_view_get_text (GntTextView *view);

Get the text of the textview.

#### Parameters

view | The textview. |

#### Returns

The text.

Since: 2.14.0

### gnt_text_view_next_line ()

    void
    gnt_text_view_next_line (GntTextView *view);

Move the cursor to the beginning of the next line and resets text-attributes. It first completes the current line with the current text-attributes.

#### Parameters

view | The textview. |

### gnt_text_format_flag_to_chtype ()

    chtype
    gnt_text_format_flag_to_chtype (GntTextFormatFlags flags);

Convert GNT-text formats to ncurses-text attributes.

#### Parameters

flags | The GNT text format. |

#### Returns

Nucrses text attribute.

### gnt_text_view_clear ()

    void
    gnt_text_view_clear (GntTextView *view);

Clear the contents of the textview.

#### Parameters

view | The textview. |

### gnt_text_view_get_lines_below ()

    int
    gnt_text_view_get_lines_below (GntTextView *view);

The number of lines below the bottom-most visible line.

#### Parameters

view | The textview. |

#### Returns

Number of lines below the bottom-most visible line.

### gnt_text_view_get_lines_above ()

    int
    gnt_text_view_get_lines_above (GntTextView *view);

The number of lines above the topmost visible line.

#### Parameters

view | The textview. |

#### Returns

Number of lines above the topmost visible line.

### gnt_text_view_tag_change ()

    int
    gnt_text_view_tag_change (GntTextView *view,
                              const char *name,
                              const char *text,
                              gboolean all);

Change the text of a tag.

#### Parameters

view | The textview. |
name | The name of the tag. |
text | The new text for the text. If 'text' is `NULL`, the tag is removed. |
all | `TRUE` if all of the instancess of the tag should be changed, `FALSE` if only the first instance should be changed. |

#### Returns

The number of instances changed.

### gnt_text_view_attach_scroll_widget ()

    void
    gnt_text_view_attach_scroll_widget (GntTextView *view,
                                        GntWidget *widget);

Setup hooks so that pressing up/down/page-up/page-down keys when 'widget' is in focus scrolls the textview.

#### Parameters

view | The textview. |
widget | The trigger widget. |

### gnt_text_view_attach_pager_widget ()

    void
    gnt_text_view_attach_pager_widget (GntTextView *view,
                                       GntWidget *pager);

Setup appropriate hooks so that pressing some keys when the 'pager' widget is in focus triggers the PAGER to popup with the contents of the textview in it.

The default key-combination to trigger the pager is a-v, and the default PAGER application is $PAGER. Both can be changed in ~/.gntrc like this:

    [pager]
    key = a-v
    path = /path/to/pager

#### Parameters

view | The textview. |
pager | The widget to trigger the PAGER. |

### gnt_text_view_attach_editor_widget ()

    void
    gnt_text_view_attach_editor_widget (GntTextView *view,
                                        GntWidget *widget);

Setup appropriate hooks so that pressing some keys when 'widget' is in focus triggers the EDITOR to popup with the contents of the textview in it.

The default key-combination to trigger the pager is a-e, and the default EDITOR application is $EDITOR. Both can be changed in ~/.gntrc like this:

    [editor]
    key = a-e
    path = /path/to/editor

#### Parameters

view | The textview. |
widget | The widget to trigger the EDITOR. |

### gnt_text_view_set_flag ()

    void
    gnt_text_view_set_flag (GntTextView *view,
                            GntTextViewFlag flag);

Set a GntTextViewFlag for the textview widget.

#### Parameters

view | The textview widget |
flag | The flag to set |

Since: 2.1.0

## Types and Values

### enum GntTextViewFlag

#### Members

GNT_TEXT_VIEW_NO_SCROLL |  |
GNT_TEXT_VIEW_WRAP_CHAR |  |
GNT_TEXT_VIEW_TOP_ALIGN |  |

Since: 2.1.0

### struct GntTextView

    struct GntTextView {
    	GntWidget parent;

    	GString *GNTSEAL(string);    /* Deprecated. Use gnt_text_view_get_text. */
    	GList *GNTSEAL(list);        /* List of GntTextLine */

    	GList *GNTSEAL(tags);       /* A list of tags */
    	GntTextViewFlag GNTSEAL(flags);
    };

Access to any fields is deprecated. See inline comments for replacements.

### enum GntTextFormatFlags

#### Members

GNT_TEXT_FLAG_NORMAL |  |
GNT_TEXT_FLAG_BOLD |  |
GNT_TEXT_FLAG_UNDERLINE |  |
GNT_TEXT_FLAG_BLINK |  |
GNT_TEXT_FLAG_DIM |  |
GNT_TEXT_FLAG_HIGHLIGHT |  |

### GntTextViewPriv

    typedef struct _GntTextViewPriv GntTextViewPriv;

`GntTextViewPriv` has been deprecated since version 2.14.0 and should not be used in newly-written code.

This is an internal implementation detail.