| GTK+ Reference Manual | |||
|---|---|---|---|
| <<< Previous Page | Home | Up | Next Page >>> |
"height-lines" gint : Read / Write "width-columns" gint : Read / Write "pixels-above-lines" gint : Read / Write "pixels-below-lines" gint : Read / Write "pixels-inside-wrap" gint : Read / Write "editable" gboolean : Read / Write "wrap-mode" GtkWrapMode : Read / Write "justify" GtkJustification : Read / Write "left-margin" gint : Read / Write "right-margin" gint : Read / Write "indent" gint : Read / Write "tabs" PangoTabArray : Read / Write |
"copy-clipboard" void user_function (GtkTextView *textview, gpointer user_data); "cut-clipboard" void user_function (GtkTextView *textview, gpointer user_data); "delete-from-cursor" void user_function (GtkTextView *textview, GtkDeleteType arg1, gint arg2, gpointer user_data); "insert-at-cursor" void user_function (GtkTextView *textview, gchar *arg1, gpointer user_data); "move-cursor" void user_function (GtkTextView *textview, GtkMovementStep arg1, gint arg2, gboolean arg3, gpointer user_data); "paste-clipboard" void user_function (GtkTextView *textview, gpointer user_data); "populate-popup" void user_function (GtkTextView *textview, GtkMenu *arg1, gpointer user_data); "set-anchor" void user_function (GtkTextView *textview, gpointer user_data); "set-scroll-adjustments" void user_function (GtkTextView *textview, GtkAdjustment *arg1, GtkAdjustment *arg2, gpointer user_data); "toggle-overwrite" void user_function (GtkTextView *textview, gpointer user_data); |
You may wish to begin by reading the text widget conceptual overview which gives an overview of all the objects and data types related to the text widget and how they work together.
typedef enum
{
GTK_TEXT_WINDOW_PRIVATE,
GTK_TEXT_WINDOW_WIDGET,
GTK_TEXT_WINDOW_TEXT,
GTK_TEXT_WINDOW_LEFT,
GTK_TEXT_WINDOW_RIGHT,
GTK_TEXT_WINDOW_TOP,
GTK_TEXT_WINDOW_BOTTOM
} GtkTextWindowType; |
GtkWidget* gtk_text_view_new (void); |
Creates a new GtkTextView. If you don't call gtk_text_view_set_buffer() before using the text view, an empty default buffer will be created for you. Get the buffer with gtk_text_view_get_buffer(). If you want to specify your own buffer, consider gtk_text_view_new_with_buffer().
| Returns : | a new GtkTextView |
GtkWidget* gtk_text_view_new_with_buffer (GtkTextBuffer *buffer); |
Creates a new GtkTextView widget displaying the buffer buffer. One buffer can be shared among many widgets. buffer may be NULL to create a default buffer, in which case this function is equivalent to gtk_text_view_new(). The text view adds its own reference count to the buffer; it does not take over an existing reference.
| buffer : | a GtkTextBuffer |
| Returns : | a new GtkTextView. |
void gtk_text_view_set_buffer (GtkTextView *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; GtkTextView will not "adopt" it.
| text_view : | a GtkTextView |
| buffer : | a GtkTextBuffer |
GtkTextBuffer* gtk_text_view_get_buffer (GtkTextView *text_view); |
Returns the GtkTextBuffer being displayed by this text view. The reference count on the buffer is not incremented; the caller of this function won't own a new reference.
| text_view : | a GtkTextView |
| Returns : | a GtkTextBuffer |
void gtk_text_view_scroll_to_mark (GtkTextView *text_view, GtkTextMark *mark, gdouble within_margin, gboolean use_align, gdouble xalign, gdouble yalign); |
Scrolls text_view so that mark is on the screen in the position indicated by xalign and yalign. An alignment of 0.0 indicates left or top, 1.0 indicates right or bottom, 0.5 means center. If use_align is FALSE, the text scrolls the minimal distance to get the mark onscreen, possibly not scrolling at all. The effective screen for purposes of this function is reduced by a margin of size within_margin.
| text_view : | a GtkTextView |
| mark : | a GtkTextMark |
| within_margin : | margin as a [0.0,0.5) fraction of screen size |
| use_align : | whether to use alignment arguments (if FALSE, just get the mark onscreen) |
| xalign : | horizontal alignment of mark within visible area. |
| yalign : | vertical alignment of mark within visible area |
gboolean gtk_text_view_scroll_to_iter (GtkTextView *text_view, GtkTextIter *iter, gdouble within_margin, gboolean use_align, gdouble xalign, gdouble yalign); |
Scrolls text_view so that iter is on the screen in the position indicated by xalign and yalign. An alignment of 0.0 indicates left or top, 1.0 indicates right or bottom, 0.5 means center. If use_align is FALSE, the text scrolls the minimal distance to get the mark onscreen, possibly not scrolling at all. The effective screen for purposes of this function is reduced by a margin of size within_margin. NOTE: This function uses the currently-computed height of the lines in the text buffer. Note that line heights are computed in an idle handler; so this function may not have the desired effect if it's called before the height computations. To avoid oddness, consider using gtk_text_view_scroll_to_mark() which saves a point to be scrolled to after line validation.
| text_view : | a GtkTextView |
| iter : | a GtkTextIter |
| within_margin : | margin as a [0.0,0.5) fraction of screen size |
| use_align : | whether to use alignment arguments (if FALSE, just get the mark onscreen) |
| xalign : | horizontal alignment of mark within visible area. |
| yalign : | vertical alignment of mark within visible area |
| Returns : | TRUE if scrolling occurred |
void gtk_text_view_scroll_mark_onscreen
(GtkTextView *text_view,
GtkTextMark *mark); |
gboolean gtk_text_view_move_mark_onscreen (GtkTextView *text_view, GtkTextMark *mark); |
Moves a mark within the buffer so that it's located within the currently-visible text area.
| text_view : | a GtkTextView |
| mark : | a GtkTextMark |
| Returns : | TRUE if the mark moved (wasn't already onscreen) |
gboolean gtk_text_view_place_cursor_onscreen (GtkTextView *text_view); |
Moves the cursor to the currently visible region of the buffer, it it isn't there already.
| text_view : | a GtkTextView |
| Returns : | TRUE if the cursor had to be moved. |
void gtk_text_view_get_visible_rect (GtkTextView *text_view, GdkRectangle *visible_rect); |
Fills visible_rect with the currently-visible region of the buffer, in buffer coordinates. Convert to window coordinates with gtk_text_view_buffer_to_window_coords().
| text_view : | a GtkTextView |
| visible_rect : | rectangle to fill |
void gtk_text_view_get_iter_location (GtkTextView *text_view, const GtkTextIter *iter, GdkRectangle *location); |
Gets a rectangle which roughly contains the character at iter. The rectangle position is in buffer coordinates; use gtk_text_view_buffer_to_window_coords() to convert these coordinates to coordinates for one of the windows in the text view.
| text_view : | a GtkTextView |
| iter : | a GtkTextIter |
| location : | bounds of the character at iter |
void gtk_text_view_get_line_at_y (GtkTextView *text_view, GtkTextIter *target_iter, gint y, gint *line_top); |
Gets the GtkTextIter at the start of the line containing the coordinate y. y is in buffer coordinates, convert from window coordinates with gtk_text_view_window_to_buffer_coords(). If non-NULL, line_top will be filled with the coordinate of the top edge of the line.
| text_view : | a GtkTextView |
| target_iter : | a GtkTextIter |
| y : | a y coordinate |
| line_top : | return location for top coordinate of the line |
void gtk_text_view_get_line_yrange (GtkTextView *text_view, const GtkTextIter *iter, gint *y, gint *height); |
Gets the y coordinate of the top of the line containing iter, and the height of the line. The coordinate is a buffer coordinate; convert to window coordinates with gtk_text_view_buffer_to_window_coords().
| text_view : | a GtkTextView |
| iter : | a GtkTextIter |
| y : | return location for a y coordinate |
| height : | return location for a height |
void gtk_text_view_get_iter_at_location
(GtkTextView *text_view,
GtkTextIter *iter,
gint x,
gint y); |
Retrieves the iterator at buffer coordinates x and y. Buffer coordinates are coordinates for the entire buffer, not just the currently-displayed portion. If you have coordinates from an event, you have to convert those to buffer coordinates with gtk_text_view_window_to_buffer_coords().
| text_view : | a GtkTextView |
| iter : | a GtkTextIter |
| x : | x position, in buffer coordinates |
| y : | y position, in buffer coordinates |
void gtk_text_view_buffer_to_window_coords
(GtkTextView *text_view,
GtkTextWindowType win,
gint buffer_x,
gint buffer_y,
gint *window_x,
gint *window_y); |
Converts coordinate (buffer_x, buffer_y) to coordinates for the window win, and stores the result in (window_x, window_y).
| text_view : | a GtkTextView |
| win : | a GtkTextWindowType |
| buffer_x : | buffer x coordinate |
| buffer_y : | buffer y coordinate |
| window_x : | window x coordinate return location |
| window_y : | window y coordinate return location |
void gtk_text_view_window_to_buffer_coords
(GtkTextView *text_view,
GtkTextWindowType win,
gint window_x,
gint window_y,
gint *buffer_x,
gint *buffer_y); |
Converts coordinates on the window identified by win to buffer coordinates, storing the result in (buffer_x,buffer_y).
| text_view : | a GtkTextView |
| win : | a GtkTextWindowType |
| window_x : | window x coordinate |
| window_y : | window y coordinate |
| buffer_x : | buffer x coordinate return location |
| buffer_y : | buffer y coordinate return location |
GdkWindow* gtk_text_view_get_window (GtkTextView *text_view, GtkTextWindowType win); |
Retrieves the GdkWindow corresponding to an area of the text view; possible windows include the overall widget window, child windows on the left, right, top, bottom, and the window that displays the text buffer. Windows are NULL and nonexistent if their width or height is 0, and are nonexistent before the widget has been realized.
| text_view : | a GtkTextView |
| win : | window to get |
| Returns : | a GdkWindow, or NULL |
GtkTextWindowType gtk_text_view_get_window_type (GtkTextView *text_view, GdkWindow *window); |
Usually used to find out which window an event corresponds to. If you connect to an event signal on text_view, this function should be called on <literal>event->window</literal> to see which window it was.
| text_view : | a GtkTextView |
| window : | a window type |
| Returns : | the window type. |
void gtk_text_view_set_border_window_size
(GtkTextView *text_view,
GtkTextWindowType type,
gint size); |
Sets the width of GTK_TEXT_WINDOW_LEFT or GTK_TEXT_WINDOW_RIGHT, or the height of GTK_TEXT_WINDOW_TOP or GTK_TEXT_WINDOW_BOTTOM. Automatically destroys the corresponding window if the size is set to 0, and creates the window if the size is set to non-zero.
| text_view : | a GtkTextView |
| type : | window to affect |
| size : | width or height of the window |
void gtk_text_view_set_text_window_size
(GtkTextView *text_view,
gint width,
gint height); |
Sets the size request for the main text window (GTK_TEXT_WINDOW_TEXT). If the widget gets more space than it requested, the main text window will be larger than this.
| text_view : | a GtkTextView |
| width : | a width in pixels |
| height : | a height in pixels |
gboolean gtk_text_view_forward_display_line (GtkTextView *text_view, GtkTextIter *iter); |
gboolean gtk_text_view_backward_display_line (GtkTextView *text_view, GtkTextIter *iter); |
gboolean gtk_text_view_forward_display_line_end (GtkTextView *text_view, GtkTextIter *iter); |
gboolean gtk_text_view_backward_display_line_start (GtkTextView *text_view, GtkTextIter *iter); |
gboolean gtk_text_view_starts_display_line (GtkTextView *text_view, const GtkTextIter *iter); |
gboolean gtk_text_view_move_visually (GtkTextView *text_view, GtkTextIter *iter, gint count); |
void gtk_text_view_add_child_at_anchor
(GtkTextView *text_view,
GtkWidget *child,
GtkTextChildAnchor *anchor); |
void gtk_text_view_add_child_in_window
(GtkTextView *text_view,
GtkWidget *child,
GtkTextWindowType which_window,
gint xpos,
gint ypos); |
void gtk_text_view_move_child (GtkTextView *text_view, GtkWidget *child, gint xpos, gint ypos); |
void gtk_text_view_set_wrap_mode (GtkTextView *text_view, GtkWrapMode wrap_mode); |
Sets the line wrapping for the view.
| text_view : | a GtkTextView |
| wrap_mode : | a GtkWrapMode |
GtkWrapMode gtk_text_view_get_wrap_mode (GtkTextView *text_view); |
Gets the line wrapping for the view.
| text_view : | a GtkTextView |
| Returns : | the line wrap setting |
void gtk_text_view_set_editable (GtkTextView *text_view, gboolean setting); |
Sets the default editability of the GtkTextView. You can override this default setting with tags in the buffer, using the "editable" attribute of tags.
| text_view : | a GtkTextView |
| setting : | whether it's editable |
gboolean gtk_text_view_get_editable (GtkTextView *text_view); |
Returns the default editability of the GtkTextView. Tags in the buffer may override this setting for some ranges of text.
| text_view : | a GtkTextView |
| Returns : | whether text is editable by default |
void gtk_text_view_set_cursor_visible
(GtkTextView *text_view,
gboolean setting); |
Toggles whether the insertion point is displayed. A buffer with no editable text probably shouldn't have a visible cursor, so you may want to turn the cursor off.
| text_view : | a GtkTextView |
| setting : | whether to show the insertion cursor |
gboolean gtk_text_view_get_cursor_visible (GtkTextView *text_view); |
Find out whether the cursor is being displayed.
| text_view : | a GtkTextView |
| Returns : | whether the insertion mark is visible |
void gtk_text_view_set_pixels_above_lines
(GtkTextView *text_view,
gint pixels_above_lines); |
gint gtk_text_view_get_pixels_above_lines (GtkTextView *text_view); |
void gtk_text_view_set_pixels_below_lines
(GtkTextView *text_view,
gint pixels_below_lines); |
gint gtk_text_view_get_pixels_below_lines (GtkTextView *text_view); |
void gtk_text_view_set_pixels_inside_wrap
(GtkTextView *text_view,
gint pixels_inside_wrap); |
gint gtk_text_view_get_pixels_inside_wrap (GtkTextView *text_view); |
void gtk_text_view_set_justification (GtkTextView *text_view, GtkJustification justification); |
GtkJustification gtk_text_view_get_justification (GtkTextView *text_view); |
void gtk_text_view_set_left_margin (GtkTextView *text_view, gint left_margin); |
void gtk_text_view_set_right_margin (GtkTextView *text_view, gint right_margin); |
void user_function (GtkTextView *textview, GtkDeleteType arg1, gint arg2, gpointer user_data); |
void user_function (GtkTextView *textview, gchar *arg1, gpointer user_data); |
void user_function (GtkTextView *textview, GtkMovementStep arg1, gint arg2, gboolean arg3, gpointer user_data); |
void user_function (GtkTextView *textview, GtkMenu *arg1, gpointer user_data); |
void user_function (GtkTextView *textview, GtkAdjustment *arg1, GtkAdjustment *arg2, gpointer user_data); |