EntryBufferProtocol

public protocol EntryBufferProtocol : ObjectProtocol

A GtkEntryBuffer hold the text displayed in a GtkText widget.

A single GtkEntryBuffer object can be shared by multiple widgets which will then share the same text content, but not the cursor position, visibility attributes, icon etc.

GtkEntryBuffer may be derived from. Such a derived class might allow text to be stored in an alternate location, such as non-pageable memory, useful in the case of important passwords. Or a derived class could integrate with an application’s concept of undo/redo.

The EntryBufferProtocol protocol exposes the methods and properties of an underlying GtkEntryBuffer instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see EntryBuffer. Alternatively, use EntryBufferRef as a lighweight, unowned reference if you already have an instance you just want to use.

  • ptr

    Untyped pointer to the underlying GtkEntryBuffer instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • entry_buffer_ptr Default implementation

    Typed pointer to the underlying GtkEntryBuffer instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the GtkEntryBuffer instance.

    Declaration

    Swift

    var entry_buffer_ptr: UnsafeMutablePointer<GtkEntryBuffer>! { get }
  • Required Initialiser for types conforming to EntryBufferProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

EntryBuffer Class

  • Bind a EntryBufferPropertyName source property to a given target object.

    Declaration

    Swift

    @discardableResult
    @inlinable
    func bind<Q, T>(property source_property: EntryBufferPropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocol

    Parameters

    source_property

    the source property to bind

    target

    the target object to bind to

    target_property

    the target property to bind to

    flags

    the flags to pass to the Binding

    transform_from

    ValueTransformer to use for forward transformation

    transform_to

    ValueTransformer to use for backwards transformation

    Return Value

    binding reference or nil in case of an error

  • get(property:) Extension method

    Get the value of a EntryBuffer property

    Declaration

    Swift

    @inlinable
    func get(property: EntryBufferPropertyName) -> GLibObject.Value

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

  • set(property:value:) Extension method

    Set the value of a EntryBuffer property. Note that this will only have an effect on properties that are writable and not construct-only!

    Declaration

    Swift

    @inlinable
    func set(property: EntryBufferPropertyName, value v: GLibObject.Value)

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

EntryBuffer signals

  • Connect a Swift signal handler to the given, typed EntryBufferSignalName signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func connect(signal s: EntryBufferSignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> Int

    Parameters

    signal

    The signal to connect

    flags

    The connection flags to use

    data

    A pointer to user data to provide to the callback

    destroyData

    A GClosureNotify C function to destroy the data pointed to by userData

    handler

    The Swift signal handler (function or callback) to invoke on the given signal

    Return Value

    The signal handler ID (always greater than 0 for successful connections)

  • Connect a C signal handler to the given, typed EntryBufferSignalName signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func connect(signal s: EntryBufferSignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> Int

    Parameters

    signal

    The signal to connect

    flags

    The connection flags to use

    data

    A pointer to user data to provide to the callback

    destroyData

    A GClosureNotify C function to destroy the data pointed to by userData

    signalHandler

    The C function to be called on the given signal

    Return Value

    The signal handler ID (always greater than 0 for successful connections)

  • The text is altered in the default handler for this signal.

    If you want access to the text after the text has been modified, use G_CONNECT_AFTER.

    Note

    This represents the underlying deleted-text signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onDeletedText(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EntryBufferRef, _ position: UInt, _ nChars: UInt) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    position

    the position the text was deleted at.

    nChars

    The number of characters that were deleted.

    handler

    The signal handler to call Run the given callback whenever the deletedText signal is emitted

  • deletedTextSignal Extension method

    Typed deleted-text signal for using the connect(signal:) methods

    Declaration

    Swift

    static var deletedTextSignal: EntryBufferSignalName { get }
  • This signal is emitted after text is inserted into the buffer.

    Note

    This represents the underlying inserted-text signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onInsertedText(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EntryBufferRef, _ position: UInt, _ chars: String, _ nChars: UInt) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    position

    the position the text was inserted at.

    chars

    The text that was inserted.

    nChars

    The number of characters that were inserted.

    handler

    The signal handler to call Run the given callback whenever the insertedText signal is emitted

  • insertedTextSignal Extension method

    Typed inserted-text signal for using the connect(signal:) methods

    Declaration

    Swift

    static var insertedTextSignal: EntryBufferSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::length signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyLength(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EntryBufferRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyLength signal is emitted

  • notifyLengthSignal Extension method

    Typed notify::length signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyLengthSignal: EntryBufferSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::max-length signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyMaxLength(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EntryBufferRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyMaxLength signal is emitted

  • notifyMaxLengthSignal Extension method

    Typed notify::max-length signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyMaxLengthSignal: EntryBufferSignalName { get }
  • onNotifyText(flags:handler:) Extension method

    The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::text signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyText(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EntryBufferRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyText signal is emitted

  • notifyTextSignal Extension method

    Typed notify::text signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyTextSignal: EntryBufferSignalName { get }

EntryBuffer Class: EntryBufferProtocol extension (methods and fields)

  • deleteText(position:nChars:) Extension method

    Deletes a sequence of characters from the buffer.

    n_chars characters are deleted starting at position. If n_chars is negative, then all characters until the end of the text are deleted.

    If position or n_chars are out of bounds, then they are coerced to sane values.

    Note that the positions are specified in characters, not bytes.

    Declaration

    Swift

    @inlinable
    func deleteText(position: Int, nChars: Int) -> Int
  • Used when subclassing GtkEntryBuffer.

    Declaration

    Swift

    @inlinable
    func emitDeletedText(position: Int, nChars: Int)
  • Used when subclassing GtkEntryBuffer.

    Declaration

    Swift

    @inlinable
    func emitInsertedText(position: Int, chars: UnsafePointer<CChar>!, nChars: Int)
  • getBytes() Extension method

    Retrieves the length in bytes of the buffer.

    See [methodGtk.EntryBuffer.get_length].

    Declaration

    Swift

    @inlinable
    func getBytes() -> Int
  • getLength() Extension method

    Retrieves the length in characters of the buffer.

    Declaration

    Swift

    @inlinable
    func getLength() -> Int
  • getMaxLength() Extension method

    Retrieves the maximum allowed length of the text in buffer.

    Declaration

    Swift

    @inlinable
    func getMaxLength() -> Int
  • getText() Extension method

    Retrieves the contents of the buffer.

    The memory pointer returned by this call will not change unless this object emits a signal, or is finalized.

    Declaration

    Swift

    @inlinable
    func getText() -> String!
  • Inserts n_chars characters of chars into the contents of the buffer, at position position.

    If n_chars is negative, then characters from chars will be inserted until a null-terminator is found. If position or n_chars are out of bounds, or the maximum buffer text length is exceeded, then they are coerced to sane values.

    Note that the position and length are in characters, not in bytes.

    Declaration

    Swift

    @inlinable
    func insertText(position: Int, chars: UnsafePointer<CChar>!, nChars: Int) -> Int
  • set(maxLength:) Extension method

    Sets the maximum allowed length of the contents of the buffer.

    If the current contents are longer than the given length, then they will be truncated to fit.

    Declaration

    Swift

    @inlinable
    func set(maxLength: Int)
  • setText(chars:nChars:) Extension method

    Sets the text in the buffer.

    This is roughly equivalent to calling [methodGtk.EntryBuffer.delete_text] and [methodGtk.EntryBuffer.insert_text].

    Note that n_chars is in characters, not in bytes.

    Declaration

    Swift

    @inlinable
    func setText(chars: UnsafePointer<CChar>!, nChars: Int)
  • bytes Extension method

    Retrieves the length in bytes of the buffer.

    See [methodGtk.EntryBuffer.get_length].

    Declaration

    Swift

    @inlinable
    var bytes: Int { get }
  • length Extension method

    The length (in characters) of the text in buffer.

    Declaration

    Swift

    @inlinable
    var length: Int { get }
  • maxLength Extension method

    Retrieves the maximum allowed length of the text in buffer.

    Declaration

    Swift

    @inlinable
    var maxLength: Int { get nonmutating set }
  • text Extension method

    The contents of the buffer.

    Declaration

    Swift

    @inlinable
    var text: String! { get }
  • parentInstance Extension method

    Undocumented

    Declaration

    Swift

    @inlinable
    var parentInstance: GObject { get }