## GtkText

GtkText — A text widget

## Functions

GtkWidget * | gtk_text_new ()
void | gtk_text_set_editable ()
void | gtk_text_set_word_wrap ()
void | gtk_text_set_line_wrap ()
void | gtk_text_set_adjustments ()
void | gtk_text_set_point ()
guint | gtk_text_get_point ()
guint | gtk_text_get_length ()
void | gtk_text_freeze ()
void | gtk_text_thaw ()
void | gtk_text_insert ()
gboolean | gtk_text_backward_delete ()
gboolean | gtk_text_forward_delete ()
#define | GTK_TEXT_INDEX()

## Properties

GtkAdjustment * | hadjustment | Read / Write
gboolean | line-wrap | Read / Write
GtkAdjustment * | vadjustment | Read / Write
gboolean | word-wrap | Read / Write

## Signals

void | set-scroll-adjustments | Run Last

## Types and Values

struct | GtkText
| GtkTextFont
struct | GtkPropertyMark

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkObject
                ╰── GtkWidget
                    ╰── GtkOldEditable
                        ╰── GtkText

## Implemented Interfaces

GtkText implements AtkImplementorIface, GtkBuildable and GtkEditable.

## Includes

    #include <gtk/gtk.h>

## Description

GtkText is deprecated and unsupported. It is known to be buggy. To use it, you must define the symbol `GTK_ENABLE_BROKEN` prior to including the GTK+ header files. Use GtkTextView instead.

A GtkText widget allows one to display any given text and manipulate it by deleting from one point to another, selecting a region, and various other functions as outlined below. It is inherited from GtkEditable.

## Functions

### gtk_text_new ()

    GtkWidget *
    gtk_text_new (GtkAdjustment *hadj,
                  GtkAdjustment *vadj);

`gtk_text_new` is deprecated and should not be used in newly-written code.

Creates a new GtkText widget, initialized with the given pointers to GtkAdjustments. These pointers can be used to track the viewing position of the GtkText widget. Passing `NULL` to either or both of them will make the GtkText create its own. You can set these later with the function `gtk_text_set_adjustment()`.

#### Parameters

hadj | horizontal adjustment. |
vadj | vertical adjustment. |

#### Returns

the new GtkText widget.

### gtk_text_set_editable ()

    void
    gtk_text_set_editable (GtkText *text,
                           gboolean editable);

`gtk_text_set_editable` is deprecated and should not be used in newly-written code.

Sets whether the GtkText widget can be edited by the user or not. This still allows you the programmer to make changes with the various GtkText functions.

#### Parameters

text | the GtkText widget |
editable | `TRUE` makes it editable, `FALSE` makes it immutable by the user |

### gtk_text_set_word_wrap ()

    void
    gtk_text_set_word_wrap (GtkText *text,
                            gboolean word_wrap);

`gtk_text_set_word_wrap` is deprecated and should not be used in newly-written code.

Sets whether the GtkText widget wraps words down to the next line if it can't be completed on the current line.

#### Parameters

text | the GtkText widget |
word_wrap | `TRUE` makes it word wrap, `FALSE` disables word wrapping |

### gtk_text_set_line_wrap ()

    void
    gtk_text_set_line_wrap (GtkText *text,
                            gboolean line_wrap);

`gtk_text_set_line_wrap` is deprecated and should not be used in newly-written code.

Controls how GtkText handles long lines of continuous text. If line wrap is on, the line is broken when it reaches the extent of the GtkText widget viewing area and the rest is displayed on the next line. If it is not set, the line continues regardless size of current viewing area. Similar to word wrap but it disregards word boundaries.

#### Parameters

text | the GtkText widget |
line_wrap | `TRUE` turns line wrap on, `FALSE` turns it off |

### gtk_text_set_adjustments ()

    void
    gtk_text_set_adjustments (GtkText *text,
                              GtkAdjustment *hadj,
                              GtkAdjustment *vadj);

`gtk_text_set_adjustments` is deprecated and should not be used in newly-written code.

Allows you to set GtkAdjustment pointers which in turn allows you to keep track of the viewing position of the GtkText widget.

#### Parameters

text | the GtkText widget |
hadj | the horizontal adjustment |
vadj | the vertical adjustment |

### gtk_text_set_point ()

    void
    gtk_text_set_point (GtkText *text,
                        guint index);

`gtk_text_set_point` is deprecated and should not be used in newly-written code.

Sets the cursor at the given point. In this case a point constitutes the number of characters from the extreme upper left corner of the GtkText widget.

#### Parameters

text | the GtkText widget |
index | the number of characters from the upper left corner |

### gtk_text_get_point ()

    guint
    gtk_text_get_point (GtkText *text);

`gtk_text_get_point` is deprecated and should not be used in newly-written code.

Gets the current position of the cursor as the number of characters from the upper left corner of the GtkText widget.

#### Parameters

text | the GtkText widget |

#### Returns

the number of characters from the upper left corner

### gtk_text_get_length ()

    guint
    gtk_text_get_length (GtkText *text);

`gtk_text_get_length` is deprecated and should not be used in newly-written code.

Returns the length of the all the text contained within the GtkText widget; disregards current point position.

#### Parameters

text | the GtkText widget |

#### Returns

the length of the text

### gtk_text_freeze ()

    void
    gtk_text_freeze (GtkText *text);

`gtk_text_freeze` is deprecated and should not be used in newly-written code.

Freezes the GtkText widget which disallows redrawing of the widget until it is thawed. This is useful if a large number of changes are going to made to the text within the widget, reducing the amount of flicker seen by the user.

#### Parameters

text | the GtkText widget |

### gtk_text_thaw ()

    void
    gtk_text_thaw (GtkText *text);

`gtk_text_thaw` is deprecated and should not be used in newly-written code.

Allows the GtkText widget to be redrawn again by GTK.

#### Parameters

text | the GtkText widget |

### gtk_text_insert ()

    void
    gtk_text_insert (GtkText *text,
                     GdkFont *font,
                     const GdkColor *fore,
                     const GdkColor *back,
                     const char *chars,
                     gint length);

`gtk_text_insert` is deprecated and should not be used in newly-written code.

Inserts given text into the GtkText widget with the given properties as outlined below.

#### Parameters

text | the GtkText widget |
font | the GdkFont to use |
fore | the foreground color to insert with |
back | the background color to insert with |
chars | the actual text to be inserted |
length | the length of the text to be inserted, passing -1 makes it insert all the text. |

### gtk_text_backward_delete ()

    gboolean
    gtk_text_backward_delete (GtkText *text,
                              guint nchars);

`gtk_text_backward_delete` is deprecated and should not be used in newly-written code.

Deletes from the current point position backward the given number of characters.

#### Parameters

text | the GtkText widget |
nchars | the number of characters to delete |

#### Returns

`TRUE` if the operation was successful, otherwise returns `FALSE`

### gtk_text_forward_delete ()

    gboolean
    gtk_text_forward_delete (GtkText *text,
                             guint nchars);

`gtk_text_forward_delete` is deprecated and should not be used in newly-written code.

Deletes from the current point position forward the given number of characters.

#### Parameters

text | the GtkText widget |
nchars | the number of characters to delete |

#### Returns

`TRUE` if the operation was successful, otherwise returns `FALSE`

### GTK_TEXT_INDEX()

    #define             GTK_TEXT_INDEX(t, index)

`GTK_TEXT_INDEX` is deprecated and should not be used in newly-written code.

Returns the character at the given index within the GtkText widget.

#### Parameters

t | the GtkText widget |
index | the number of characters from the upper left corner |

## Types and Values

### struct GtkText

    struct GtkText;

`GtkText` is deprecated and should not be used in newly-written code.

Most of the GtkText struct members should not be accessed directly. Listed below are a few exceptions and how to use them.

### GtkTextFont

    typedef struct _GtkTextFont GtkTextFont;

`GtkTextFont` is deprecated and should not be used in newly-written code.

Internal GtkText data type.

### struct GtkPropertyMark

    struct GtkPropertyMark {
      /* Position in list. */
      GList* property;

      /* Offset into that property. */
      guint offset;

      /* Current index. */
      guint index;
    };

`GtkPropertyMark` is deprecated and should not be used in newly-written code.

Internal GtkText data type. Should not be accessed directly.

## Property Details

### The `“hadjustment”` property

      “hadjustment”              GtkAdjustment *

Used by the GtkText widget to keep track of the size of its horizontal text.

Flags: Read / Write

### The `“line-wrap”` property

      “line-wrap”                gboolean

Boolean value indicating whether line wrap is enabled or not.

Flags: Read / Write

Default value: TRUE

### The `“vadjustment”` property

      “vadjustment”              GtkAdjustment *

Used by the GtkText widget to keep track of the size of its vertical text.

Flags: Read / Write

### The `“word-wrap”` property

      “word-wrap”                gboolean

Boolean value indicated whether word wrap is enabled or not.

Flags: Read / Write

Default value: FALSE

## Signal Details

### The `“set-scroll-adjustments”` signal

    void
    user_function (GtkText       *text,
                   GtkAdjustment *arg1,
                   GtkAdjustment *arg2,
                   gpointer       user_data)

#### Parameters

text | the object which received the signal. |
user_data | user data set when the signal handler was connected. |

Flags: Run Last