Gtk2::TextView(3)

πŸ“¦
version 1.24993 Β· 2 versions
, in fedora 43

✨ Gtk2::TextView(3) ✨

okay bestie, welcome to the Gtk2::TextView page, part 1. This is the wrapper for GtkTextView, and it's literally giving main character energy in the text-widget universe. No cap, we're keeping every option, type, default, and signal exactly as they are. Periodt. πŸ’…βœ¨

πŸ’– NAME πŸ’–

Gtk2::TextView β€” wrapper for GtkTextView. That's the name, and it ate. πŸ‘‘

πŸ¦‹ HIERARCHY πŸ¦‹

the family tree, and yes it's giving legacy. 🌳

         Glib::Object
         +----Glib::InitiallyUnowned
              +----Gtk2::Object
                   +----Gtk2::Widget
                        +----Gtk2::Container
                             +----Gtk2::TextView

🌈 INTERFACES 🌈

the interfaces it carries, lowkey iconic. πŸ¦‹

  • Glib::Object::_Unregistered::AtkImplementorIface
  • Gtk2::Buildable

πŸŽ€ METHODS πŸŽ€

okay so here's the whole method buffet. every signature, every arg, every Since β€” we're not skipping a single one, bestie. πŸ“

  • widget = Gtk2::TextView->new β€” constructor core, no buffer attached.
  • widget = Gtk2::TextView->new_with_buffer ($buffer) β€” constructor but with a buffer.
    • $buffer (Gtk2::TextBuffer)
  • boolean = $text_view->get_accepts_tab β€” getter for accepts-tab.
Since: gtk+ 2.4
  • $text_view->set_accepts_tab ($accepts_tab) β€” setter for accepts-tab.
    • $accepts_tab (boolean)
Since: gtk+ 2.4
  • $text_view->add_child_at_anchor ($child, $anchor) β€” add a child at an anchor.
    • $child (Gtk2::Widget)
    • $anchor (Gtk2::TextChildAnchor)
  • $text_view->add_child_in_window ($child, $which_window, $xpos, $ypos) β€” add a child in a window.
    • $child (Gtk2::Widget)
    • $which_window (Gtk2::TextWindowType)
    • $xpos (integer)
    • $ypos (integer)
  • boolean = $text_view->backward_display_line ($iter) β€” backward display line.
    • $iter (Gtk2::TextIter)
  • boolean = $text_view->backward_display_line_start ($iter) β€” backward display line start.
    • $iter (Gtk2::TextIter)
  • integer = $text_view->get_border_window_size ($type) β€” get border window size.
    • $type (Gtk2::TextWindowType)
  • $text_view->set_border_window_size ($type, $size) β€” set border window size.
    • $type (Gtk2::TextWindowType)
    • $size (integer)
  • textbuffer = $text_view->get_buffer β€” get the buffer.
  • $text_view->set_buffer ($buffer) β€” set the buffer.
    • $buffer (Gtk2::TextBuffer)
  • (window_x, window_y) = $text_view->buffer_to_window_coords ($win, $buffer_x, $buffer_y) β€” buffer coords to window coords.
    • $win (Gtk2::TextWindowType)
    • $buffer_x (integer)
    • $buffer_y (integer)
  • boolean = $text_view->get_cursor_visible β€” get cursor visible.
  • $text_view->set_cursor_visible ($setting) β€” set cursor visible.
    • $setting (boolean)
  • textattributes = $text_view->get_default_attributes β€” get default attributes.
  • boolean = $text_view->get_editable β€” get editable.
  • $text_view->set_editable ($setting) β€” set editable.
    • $setting (boolean)
  • boolean = $text_view->forward_display_line ($iter) β€” forward display line.
    • $iter (Gtk2::TextIter)
  • boolean = $text_view->forward_display_line_end ($iter) β€” forward display line end.
    • $iter (Gtk2::TextIter)
  • adjustment = $text_view->get_hadjustment β€” get horizontal adjustment.
Since: gtk+ 2.22
  • boolean = $text_view->im_context_filter_keypress ($event) β€” IM context filter keypress.
    • $event (Gtk2::Gdk::Event)
Since: gtk+ 2.22
  • integer = $text_view->get_indent β€” get indent.
  • $text_view->set_indent ($indent) β€” set indent.
    • $indent (integer)
  • textiter = $text_view->get_iter_at_location ($x, $y) β€” get iter at location.
    • $x (integer)
    • $y (integer)
  • ($iter, $trailing) = $text_view->get_iter_at_position ($x, $y)
  • $iter = $text_view->get_iter_at_position ($x, $y)
    • $x (integer)
    • $y (integer)

Okay so this one retrieves the iterator pointing to the character 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 $text_view->window_to_buffer_coords().

Note that this is different from $text_view->get_iter_at_location(), which returns cursor locations, i.e. positions between characters.

Since: gtk+ 2.6
  • rectangle = $text_view->get_iter_location ($iter) β€” get iter location.
    • $iter (Gtk2::TextIter)
  • justification = $text_view->get_justification β€” get justification.
  • $text_view->set_justification ($justification) β€” set justification.
    • $justification (Gtk2::Justification)
  • integer = $text_view->get_left_margin β€” get left margin.
  • $text_view->set_left_margin ($left_margin) β€” set left margin.
    • $left_margin (integer)
  • (target_iter, line_top) = $text_view->get_line_at_y ($y) β€” get line at y.
    • $y (integer)
  • (y, height) = $text_view->get_line_yrange ($iter) β€” get line y range.
    • $iter (Gtk2::TextIter)
  • $text_view->move_child ($child, $xpos, $ypos) β€” move child.
    • $child (Gtk2::Widget)
    • $xpos (integer)
    • $ypos (integer)
  • boolean = $text_view->move_mark_onscreen ($mark) β€” move mark onscreen.
    • $mark (Gtk2::TextMark)
  • boolean = $text_view->move_visually ($iter, $count) β€” move visually.
    • $iter (Gtk2::TextIter)
    • $count (integer)
  • boolean = $text_view->get_overwrite β€” get overwrite.
Since: gtk+ 2.4
  • $text_view->set_overwrite ($overwrite) β€” set overwrite.
    • $overwrite (boolean)
Since: gtk+ 2.4
  • integer = $text_view->get_pixels_above_lines β€” get pixels above lines.
  • $text_view->set_pixels_above_lines ($pixels_above_lines) β€” set pixels above lines.
    • $pixels_above_lines (integer)
  • integer = $text_view->get_pixels_below_lines β€” get pixels below lines.
  • $text_view->set_pixels_below_lines ($pixels_below_lines) β€” set pixels below lines.
    • $pixels_below_lines (integer)
  • integer = $text_view->get_pixels_inside_wrap β€” get pixels inside wrap.
  • $text_view->set_pixels_inside_wrap ($pixels_inside_wrap) β€” set pixels inside wrap.
    • $pixels_inside_wrap (integer)
  • boolean = $text_view->place_cursor_onscreen β€” place cursor onscreen.
  • $text_view->reset_im_context β€” reset IM context.
Since: gtk+ 2.22
  • integer = $text_view->get_right_margin β€” get right margin.
  • $text_view->set_right_margin ($right_margin) β€” set right margin.
    • $right_margin (integer)
  • $text_view->scroll_mark_onscreen ($mark) β€” scroll mark onscreen.
    • $mark (Gtk2::TextMark)
  • boolean = $text_view->scroll_to_iter ($iter, $within_margin, $use_align, $xalign, $yalign) β€” scroll to iter.
    • $iter (Gtk2::TextIter)
    • $within_margin (double)
    • $use_align (boolean)
    • $xalign (double)
    • $yalign (double)
  • $text_view->scroll_to_mark ($mark, $within_margin, $use_align, $xalign, $yalign) β€” scroll to mark.
    • $mark (Gtk2::TextMark)
    • $within_margin (double)
    • $use_align (boolean)
    • $xalign (double)
    • $yalign (double)
  • boolean = $text_view->starts_display_line ($iter) β€” starts display line.
    • $iter (Gtk2::TextIter)
  • tabarray = $text_view->get_tabs β€” get tabs.
  • $text_view->set_tabs ($tabs) β€” set tabs.
    • $tabs (Pango::TabArray)
  • adjustment = $text_view->get_vadjustment β€” get vertical adjustment.
Since: gtk+ 2.22
  • rectangle = $text_view->get_visible_rect β€” get visible rect.
  • window = $text_view->get_window ($win) β€” get window.
    • $win (Gtk2::TextWindowType)
  • (buffer_x, buffer_y) = $text_view->window_to_buffer_coords ($win, $window_x, $window_y) β€” window coords to buffer coords.
    • $win (Gtk2::TextWindowType)
    • $window_x (integer)
    • $window_y (integer)
  • textwindowtype = $text_view->get_window_type ($window) β€” get window type.
    • $window (Gtk2::Gdk::Window)
  • wrapmode = $text_view->get_wrap_mode β€” get wrap mode.
  • $text_view->set_wrap_mode ($wrap_mode) β€” set wrap mode.
    • $wrap_mode (Gtk2::WrapMode)

πŸ’… PROPERTIES πŸ’…

the properties, and they're all readable / writable / private / static-nick / static-blurb unless noted. slay. ✨

  • 'accepts-tab' (boolean : default true : readable / writable / private / static-nick / static-blurb) β€” Whether Tab will result in a tab character being entered.
  • 'buffer' (Gtk2::TextBuffer : default undef : readable / writable / private / static-nick / static-blurb) β€” The buffer which is displayed.
  • 'cursor-visible' (boolean : default true : readable / writable / private / static-nick / static-blurb) β€” If the insertion cursor is shown.
  • 'editable' (boolean : default true : readable / writable / private / static-nick / static-blurb) β€” Whether the text can be modified by the user.
  • 'im-module' (string : default undef : readable / writable / private / static-nick / static-blurb) β€” Which IM module should be used.
  • 'indent' (integer : default 0 : readable / writable / private / static-nick / static-blurb) β€” Amount to indent the paragraph, in pixels.
  • 'justification' (Gtk2::Justification : default "left" : readable / writable / private / static-nick / static-blurb) β€” Left, right, or center justification.
  • 'left-margin' (integer : default 0 : readable / writable / private / static-nick / static-blurb) β€” Width of the left margin in pixels.
  • 'overwrite' (boolean : default false : readable / writable / private / static-nick / static-blurb) β€” Whether entered text overwrites existing contents.
  • 'pixels-above-lines' (integer : default 0 : readable / writable / private / static-nick / static-blurb) β€” Pixels of blank space above paragraphs.
  • 'pixels-below-lines' (integer : default 0 : readable / writable / private / static-nick / static-blurb) β€” Pixels of blank space below paragraphs.
  • 'pixels-inside-wrap' (integer : default 0 : readable / writable / private / static-nick / static-blurb) β€” Pixels of blank space between wrapped lines in a paragraph.
  • 'right-margin' (integer : default 0 : readable / writable / private / static-nick / static-blurb) β€” Width of the right margin in pixels.
  • 'tabs' (Pango::TabArray : default undef : readable / writable / private / static-nick / static-blurb) β€” Custom tabs for this text.
  • 'wrap-mode' (Gtk2::WrapMode : default "none" : readable / writable / private / static-nick / static-blurb) β€” Whether to wrap lines never, at word boundaries, or at character boundaries.

🌸 STYLE PROPERTIES 🌸

  • 'error-underline-color' (Gtk2::Gdk::Color : default undef : readable / private / static-nick / static-blurb) β€” Color with which to draw error-indication underlines.

πŸ”₯ SIGNALS πŸ”₯

  • backspace (Gtk2::TextView)
  • copy-clipboard (Gtk2::TextView)
  • cut-clipboard (Gtk2::TextView)
  • delete-from-cursor (Gtk2::TextView, Gtk2::DeleteType, integer)
  • insert-at-cursor (Gtk2::TextView, string)
  • move-cursor (Gtk2::TextView, Gtk2::MovementStep, integer, boolean)
  • move-viewport (Gtk2::TextView, GtkScrollStep, integer)
  • page-horizontally (Gtk2::TextView, integer, boolean)
  • paste-clipboard (Gtk2::TextView)
  • populate-popup (Gtk2::TextView, Gtk2::Menu)
  • preedit-changed (Gtk2::TextView, string)
  • select-all (Gtk2::TextView, boolean)
  • set-anchor (Gtk2::TextView)
  • set-scroll-adjustments (Gtk2::TextView, Gtk2::Adjustment, Gtk2::Adjustment)
  • toggle-cursor-visible (Gtk2::TextView)
  • toggle-overwrite (Gtk2::TextView)

ENUMS AND FLAGS ✨

okay bestie, this is the part where we vibe-check all the enum constants. no cap, every single one is here. 🫢

enum Gtk2::DeleteType πŸ’–

the delete-type menu, served fresh:

  • 'chars' / 'GTK_DELETE_CHARS'
  • 'word-ends' / 'GTK_DELETE_WORD_ENDS'
  • 'words' / 'GTK_DELETE_WORDS'
  • 'display-lines' / 'GTK_DELETE_DISPLAY_LINES'
  • 'display-line-ends' / 'GTK_DELETE_DISPLAY_LINE_ENDS'
  • 'paragraph-ends' / 'GTK_DELETE_PARAGRAPH_ENDS'
  • 'paragraphs' / 'GTK_DELETE_PARAGRAPHS'
  • 'whitespace' / 'GTK_DELETE_WHITESPACE'

enum Gtk2::Justification πŸŽ€

how we line things up, periodt:

  • 'left' / 'GTK_JUSTIFY_LEFT'
  • 'right' / 'GTK_JUSTIFY_RIGHT'
  • 'center' / 'GTK_JUSTIFY_CENTER'
  • 'fill' / 'GTK_JUSTIFY_FILL'

enum Gtk2::MovementStep πŸ¦‹

the movement-step lineup, iconic:

  • 'logical-positions' / 'GTK_MOVEMENT_LOGICAL_POSITIONS'
  • 'visual-positions' / 'GTK_MOVEMENT_VISUAL_POSITIONS'
  • 'words' / 'GTK_MOVEMENT_WORDS'
  • 'display-lines' / 'GTK_MOVEMENT_DISPLAY_LINES'
  • 'display-line-ends' / 'GTK_MOVEMENT_DISPLAY_LINE_ENDS'
  • 'paragraphs' / 'GTK_MOVEMENT_PARAGRAPHS'
  • 'paragraph-ends' / 'GTK_MOVEMENT_PARAGRAPH_ENDS'
  • 'pages' / 'GTK_MOVEMENT_PAGES'
  • 'buffer-ends' / 'GTK_MOVEMENT_BUFFER_ENDS'
  • 'horizontal-pages' / 'GTK_MOVEMENT_HORIZONTAL_PAGES'

enum Gtk2::TextWindowType πŸͺŸ

all the text-window types, bestie:

  • 'private' / 'GTK_TEXT_WINDOW_PRIVATE'
  • 'widget' / 'GTK_TEXT_WINDOW_WIDGET'
  • 'text' / 'GTK_TEXT_WINDOW_TEXT'
  • 'left' / 'GTK_TEXT_WINDOW_LEFT'
  • 'right' / 'GTK_TEXT_WINDOW_RIGHT'
  • 'top' / 'GTK_TEXT_WINDOW_TOP'
  • 'bottom' / 'GTK_TEXT_WINDOW_BOTTOM'

enum Gtk2::WrapMode πŸŒ€

wrap it up, literally:

  • 'none' / 'GTK_WRAP_NONE'
  • 'char' / 'GTK_WRAP_CHAR'
  • 'word' / 'GTK_WRAP_WORD'
  • 'word-char' / 'GTK_WRAP_WORD_CHAR'

enum GtkScrollStep 🌈

scroll-step energy, fr fr:

  • 'steps' / 'GTK_SCROLL_STEPS'
  • 'pages' / 'GTK_SCROLL_PAGES'
  • 'ends' / 'GTK_SCROLL_ENDS'
  • 'horizontal-steps' / 'GTK_SCROLL_HORIZONTAL_STEPS'
  • 'horizontal-pages' / 'GTK_SCROLL_HORIZONTAL_PAGES'
  • 'horizontal-ends' / 'GTK_SCROLL_HORIZONTAL_ENDS'

SEE ALSO πŸ‘€

if you wanna go down the rabbit hole, these are the besties:

  • Gtk2
  • Glib::Object
  • Glib::InitiallyUnowned
  • Gtk2::Object
  • Gtk2::Widget
  • Gtk2::Container

Copyright (C) 2003-2011 by the gtk2-perl team.

This software is licensed under the LGPL. See Gtk2 for a full notice.


okay that's a wrap, bestie πŸ’… this page was perl v5.42.0, dated 2025-07-25, and it's Gtk2::TextView(3) β€” go slay some text views βœ¨πŸ¦‹

πŸ“¦ where this page comes from