TextViewRef

public struct TextViewRef : TextViewProtocol, GWeakCapturing

A widget that displays the contents of a [classGtk.TextBuffer].

An example GtkTextview

You may wish to begin by reading the conceptual overview, which gives an overview of all the objects and data types related to the text widget and how they work together.

CSS nodes

textview.view
├── border.top
├── border.left
├── text
   ╰── [selection]
├── border.right
├── border.bottom
╰── [window.popup]

GtkTextView has a main css node with name textview and style class .view, and subnodes for each of the border windows, and the main text area, with names border and text, respectively. The border nodes each get one of the style classes .left, .right, .top or .bottom.

A node representing the selection will appear below the text node.

If a context menu is opened, the window node will appear as a subnode of the main node.

Accessibility

GtkTextView uses the GTK_ACCESSIBLE_ROLE_TEXT_BOX role.

The TextViewRef type acts as a lightweight Swift reference to an underlying GtkTextView instance. It exposes methods that can operate on this data type through TextViewProtocol conformance. Use TextViewRef only as an unowned reference to an existing GtkTextView instance.

  • ptr
    Untyped pointer to the underlying `GtkTextView` instance.
    

    For type-safe access, use the generated, typed pointer text_view_ptr property instead.

    Declaration

    Swift

    public let ptr: UnsafeMutableRawPointer!

TextView Class

  • Designated initialiser from the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafeMutablePointer<GtkTextView>)
  • Designated initialiser from a constant pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafePointer<GtkTextView>)
  • Conditional initialiser from an optional pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafeMutablePointer<GtkTextView>?)
  • Conditional initialiser from an optional, non-mutable pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafePointer<GtkTextView>?)
  • Conditional initialiser from an optional gpointer

    Declaration

    Swift

    @inlinable
    init!(gpointer g: gpointer?)
  • Conditional initialiser from an optional, non-mutable gconstpointer

    Declaration

    Swift

    @inlinable
    init!(gconstpointer g: gconstpointer?)
  • Reference intialiser for a related type that implements TextViewProtocol

    Declaration

    Swift

    @inlinable
    init<T>(_ other: T) where T : TextViewProtocol
  • This factory is syntactic sugar for setting weak pointers wrapped in GWeak<T>

    Declaration

    Swift

    @inlinable
    static func unowned<T>(_ other: T) -> TextViewRef where T : TextViewProtocol
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to TextViewProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(cPointer: UnsafeMutablePointer<T>)
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to TextViewProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(constPointer: UnsafePointer<T>)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to TextViewProtocol.

    Declaration

    Swift

    @inlinable
    init(mutating raw: UnsafeRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to TextViewProtocol.

    Declaration

    Swift

    @inlinable
    init(raw: UnsafeMutableRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to TextViewProtocol.

    Declaration

    Swift

    @inlinable
    init(opaquePointer: OpaquePointer)
  • Creates a new `GtkTextView`.
    

    If you don’t call [methodGtk.TextView.set_buffer] before using the text view, an empty default buffer will be created for you. Get the buffer with [methodGtk.TextView.get_buffer]. If you want to specify your own buffer, consider [ctorGtk.TextView.new_with_buffer].

    Declaration

    Swift

    @inlinable
    init()
  • Creates a new GtkTextView widget displaying the buffer buffer.

    One buffer can be shared among many widgets. buffer may be nil to create a default buffer, in which case this function is equivalent to [ctorGtk.TextView.new]. The text view adds its own reference count to the buffer; it does not take over an existing reference.

    Declaration

    Swift

    @inlinable
    init<TextBufferT>(buffer: TextBufferT) where TextBufferT : TextBufferProtocol
  • Creates a new GtkTextView widget displaying the buffer buffer.

    One buffer can be shared among many widgets. buffer may be nil to create a default buffer, in which case this function is equivalent to [ctorGtk.TextView.new]. The text view adds its own reference count to the buffer; it does not take over an existing reference.

    Declaration

    Swift

    @inlinable
    static func newWith<TextBufferT>(buffer: TextBufferT) -> WidgetRef! where TextBufferT : TextBufferProtocol