gi-gtk3-3.0.44: Gtk 3.x bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gtk.Objects.EntryBuffer

Contents

- Exported types
- Methods
  - deleteText
  - emitDeletedText
  - emitInsertedText
  - getBytes
  - getLength
  - getMaxLength
  - getText
  - insertText
  - new
  - setMaxLength
  - setText
- Properties
  - length
  - maxLength
  - text
- Signals
  - deletedText
  - insertedText

Description

The `EntryBuffer` class contains the actual text displayed in a `Entry` widget.

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

`EntryBuffer` 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.

Since: 2.18

Synopsis

- newtype EntryBuffer = EntryBuffer (ManagedPtr EntryBuffer)
- class (GObject o, IsDescendantOf EntryBuffer o) => IsEntryBuffer o
- toEntryBuffer :: (MonadIO m, IsEntryBuffer o) => o -> m EntryBuffer
- entryBufferDeleteText :: (HasCallStack, MonadIO m, IsEntryBuffer a) => a -> Word32 -> Int32 -> m Word32
- entryBufferEmitDeletedText :: (HasCallStack, MonadIO m, IsEntryBuffer a) => a -> Word32 -> Word32 -> m ()
- entryBufferEmitInsertedText :: (HasCallStack, MonadIO m, IsEntryBuffer a) => a -> Word32 -> Text -> Word32 -> m ()
- entryBufferGetBytes :: (HasCallStack, MonadIO m, IsEntryBuffer a) => a -> m CSize
- entryBufferGetLength :: (HasCallStack, MonadIO m, IsEntryBuffer a) => a -> m Word32
- entryBufferGetMaxLength :: (HasCallStack, MonadIO m, IsEntryBuffer a) => a -> m Int32
- entryBufferGetText :: (HasCallStack, MonadIO m, IsEntryBuffer a) => a -> m Text
- entryBufferInsertText :: (HasCallStack, MonadIO m, IsEntryBuffer a) => a -> Word32 -> Text -> Int32 -> m Word32
- entryBufferNew :: (HasCallStack, MonadIO m) => Maybe Text -> Int32 -> m EntryBuffer
- entryBufferSetMaxLength :: (HasCallStack, MonadIO m, IsEntryBuffer a) => a -> Int32 -> m ()
- entryBufferSetText :: (HasCallStack, MonadIO m, IsEntryBuffer a) => a -> Text -> Int32 -> m ()
- getEntryBufferLength :: (MonadIO m, IsEntryBuffer o) => o -> m Word32
- constructEntryBufferMaxLength :: (IsEntryBuffer o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getEntryBufferMaxLength :: (MonadIO m, IsEntryBuffer o) => o -> m Int32
- setEntryBufferMaxLength :: (MonadIO m, IsEntryBuffer o) => o -> Int32 -> m ()
- clearEntryBufferText :: (MonadIO m, IsEntryBuffer o) => o -> m ()
- constructEntryBufferText :: (IsEntryBuffer o, MonadIO m) => Text -> m (GValueConstruct o)
- getEntryBufferText :: (MonadIO m, IsEntryBuffer o) => o -> m Text
- setEntryBufferText :: (MonadIO m, IsEntryBuffer o) => o -> Text -> m ()
- type EntryBufferDeletedTextCallback = Word32 -> Word32 -> IO ()
- afterEntryBufferDeletedText :: (IsEntryBuffer a, MonadIO m) => a -> ((?self :: a) => EntryBufferDeletedTextCallback) -> m SignalHandlerId
- onEntryBufferDeletedText :: (IsEntryBuffer a, MonadIO m) => a -> ((?self :: a) => EntryBufferDeletedTextCallback) -> m SignalHandlerId
- type EntryBufferInsertedTextCallback = Word32 -> Text -> Word32 -> IO ()
- afterEntryBufferInsertedText :: (IsEntryBuffer a, MonadIO m) => a -> ((?self :: a) => EntryBufferInsertedTextCallback) -> m SignalHandlerId
- onEntryBufferInsertedText :: (IsEntryBuffer a, MonadIO m) => a -> ((?self :: a) => EntryBufferInsertedTextCallback) -> m SignalHandlerId

# Exported types

newtype EntryBuffer Source #

Memory-managed wrapper type.

Constructors

EntryBuffer (ManagedPtr EntryBuffer) |

#### Instances

Instances details

Eq EntryBuffer Source # |
Instance details Defined in GI.Gtk.Objects.EntryBuffer Methods (==) :: EntryBuffer -> EntryBuffer -> Bool Source # (/=) :: EntryBuffer -> EntryBuffer -> Bool Source #
GObject EntryBuffer Source # |
Instance details Defined in GI.Gtk.Objects.EntryBuffer
ManagedPtrNewtype EntryBuffer Source # |
Instance details Defined in GI.Gtk.Objects.EntryBuffer Methods toManagedPtr :: EntryBuffer -> ManagedPtr EntryBuffer Source #
TypedObject EntryBuffer Source # |
Instance details Defined in GI.Gtk.Objects.EntryBuffer Methods glibType :: IO GType Source #
HasParentTypes EntryBuffer Source # |
Instance details Defined in GI.Gtk.Objects.EntryBuffer
IsGValue (Maybe EntryBuffer) Source # | Convert `EntryBuffer` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gtk.Objects.EntryBuffer Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe EntryBuffer -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe EntryBuffer) Source #
type ParentTypes EntryBuffer Source # |
Instance details Defined in GI.Gtk.Objects.EntryBuffer type ParentTypes EntryBuffer = '[Object]

class (GObject o, IsDescendantOf EntryBuffer o) => IsEntryBuffer o Source #

Type class for types which can be safely cast to `EntryBuffer`, for instance with `toEntryBuffer`.

#### Instances

Instances details

(GObject o, IsDescendantOf EntryBuffer o) => IsEntryBuffer o Source # |
Instance details Defined in GI.Gtk.Objects.EntryBuffer

toEntryBuffer :: (MonadIO m, IsEntryBuffer o) => o -> m EntryBuffer Source #

Cast to `EntryBuffer`, for types for which this is known to be safe. For general casts, use `castTo`.

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

bindProperty, bindPropertyFull, deleteText, emitDeletedText, emitInsertedText, forceFloating, freezeNotify, getv, insertText, isFloating, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.

#### Getters

getBytes, getData, getLength, getMaxLength, getProperty, getQdata, getText.

#### Setters

setData, setDataFull, setMaxLength, setProperty, setText.

## deleteText

entryBufferDeleteText Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryBuffer a) |
=> a | `buffer`: a `EntryBuffer`
-> Word32 | `position`: position at which to delete text
-> Int32 | `nChars`: number of characters to delete
-> m Word32 | Returns: The number of characters deleted.

Deletes a sequence of characters from the buffer. `nChars` characters are deleted starting at `position`. If `nChars` is negative, then all characters until the end of the text are deleted.

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

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

Since: 2.18

## emitDeletedText

entryBufferEmitDeletedText Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryBuffer a) |
=> a | `buffer`: a `EntryBuffer`
-> Word32 | `position`: position at which text was deleted
-> Word32 | `nChars`: number of characters deleted
-> m () |

Used when subclassing `EntryBuffer`

Since: 2.18

## emitInsertedText

entryBufferEmitInsertedText Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryBuffer a) |
=> a | `buffer`: a `EntryBuffer`
-> Word32 | `position`: position at which text was inserted
-> Text | `chars`: text that was inserted
-> Word32 | `nChars`: number of characters inserted
-> m () |

Used when subclassing `EntryBuffer`

Since: 2.18

## getBytes

entryBufferGetBytes Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryBuffer a) |
=> a | `buffer`: a `EntryBuffer`
-> m CSize | Returns: The byte length of the buffer.

Retrieves the length in bytes of the buffer. See `entryBufferGetLength`.

Since: 2.18

## getLength

entryBufferGetLength Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryBuffer a) |
=> a | `buffer`: a `EntryBuffer`
-> m Word32 | Returns: The number of characters in the buffer.

Retrieves the length in characters of the buffer.

Since: 2.18

## getMaxLength

entryBufferGetMaxLength Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryBuffer a) |
=> a | `buffer`: a `EntryBuffer`
-> m Int32 | Returns: the maximum allowed number of characters in `EntryBuffer`, or 0 if there is no maximum.

Retrieves the maximum allowed length of the text in `buffer`. See `entryBufferSetMaxLength`.

Since: 2.18

## getText

entryBufferGetText Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryBuffer a) |
=> a | `buffer`: a `EntryBuffer`
-> m Text | Returns: a pointer to the contents of the widget as a string. This string points to internally allocated storage in the buffer and must not be freed, modified or stored.

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.

Since: 2.18

## insertText

entryBufferInsertText Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryBuffer a) |
=> a | `buffer`: a `EntryBuffer`
-> Word32 | `position`: the position at which to insert text.
-> Text | `chars`: the text to insert into the buffer.
-> Int32 | `nChars`: the length of the text in characters, or -1
-> m Word32 | Returns: The number of characters actually inserted.

Inserts `nChars` characters of `chars` into the contents of the buffer, at position `position`.

If `nChars` is negative, then characters from chars will be inserted until a null-terminator is found. If `position` or `nChars` 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.

Since: 2.18

## new

entryBufferNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Maybe Text | `initialChars`: initial buffer text, or `Nothing`
-> Int32 | `nInitialChars`: number of characters in `initialChars`, or -1
-> m EntryBuffer | Returns: A new GtkEntryBuffer object.

Create a new GtkEntryBuffer object.

Optionally, specify initial text to set in the buffer.

Since: 2.18

## setMaxLength

entryBufferSetMaxLength Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryBuffer a) |
=> a | `buffer`: a `EntryBuffer`
-> Int32 | `maxLength`: the maximum length of the entry buffer, or 0 for no maximum. (other than the maximum length of entries.) The value passed in will be clamped to the range 0-65536.
-> m () |

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.

Since: 2.18

## setText

entryBufferSetText Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryBuffer a) |
=> a | `buffer`: a `EntryBuffer`
-> Text | `chars`: the new text
-> Int32 | `nChars`: the number of characters in `text`, or -1
-> m () |

Sets the text in the buffer.

This is roughly equivalent to calling `entryBufferDeleteText` and `entryBufferInsertText`.

Note that `nChars` is in characters, not in bytes.

Since: 2.18

# Properties

## length

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

Since: 2.18

getEntryBufferLength :: (MonadIO m, IsEntryBuffer o) => o -> m Word32 Source #

Get the value of the “`length`” property. When overloading is enabled, this is equivalent to

    get entryBuffer #length

## maxLength

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

Since: 2.18

constructEntryBufferMaxLength :: (IsEntryBuffer o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`max-length`” property. This is rarely needed directly, but it is used by `new`.

getEntryBufferMaxLength :: (MonadIO m, IsEntryBuffer o) => o -> m Int32 Source #

Get the value of the “`max-length`” property. When overloading is enabled, this is equivalent to

    get entryBuffer #maxLength

setEntryBufferMaxLength :: (MonadIO m, IsEntryBuffer o) => o -> Int32 -> m () Source #

Set the value of the “`max-length`” property. When overloading is enabled, this is equivalent to

    set entryBuffer [ #maxLength := value ]

## text

The contents of the buffer.

Since: 2.18

clearEntryBufferText :: (MonadIO m, IsEntryBuffer o) => o -> m () Source #

Set the value of the “`text`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #text

constructEntryBufferText :: (IsEntryBuffer o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`text`” property. This is rarely needed directly, but it is used by `new`.

getEntryBufferText :: (MonadIO m, IsEntryBuffer o) => o -> m Text Source #

Get the value of the “`text`” property. When overloading is enabled, this is equivalent to

    get entryBuffer #text

setEntryBufferText :: (MonadIO m, IsEntryBuffer o) => o -> Text -> m () Source #

Set the value of the “`text`” property. When overloading is enabled, this is equivalent to

    set entryBuffer [ #text := value ]

# Signals

## deletedText

type EntryBufferDeletedTextCallback Source #

Arguments

= Word32 | `position`: the position the text was deleted at.
-> Word32 | `nChars`: The number of characters that were deleted.
-> IO () |

This signal is emitted after text is deleted from the buffer.

Since: 2.18

afterEntryBufferDeletedText :: (IsEntryBuffer a, MonadIO m) => a -> ((?self :: a) => EntryBufferDeletedTextCallback) -> m SignalHandlerId Source #

Connect a signal handler for the deletedText signal, to be run after the default handler. When overloading is enabled, this is equivalent to

    after entryBuffer #deletedText callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit `?self` parameter. Note that this requires activating the `ImplicitParams` GHC extension.

onEntryBufferDeletedText :: (IsEntryBuffer a, MonadIO m) => a -> ((?self :: a) => EntryBufferDeletedTextCallback) -> m SignalHandlerId Source #

Connect a signal handler for the deletedText signal, to be run before the default handler. When overloading is enabled, this is equivalent to

    on entryBuffer #deletedText callback

## insertedText

type EntryBufferInsertedTextCallback Source #

Arguments

= Word32 | `position`: the position the text was inserted at.
-> Text | `chars`: The text that was inserted.
-> Word32 | `nChars`: The number of characters that were inserted.
-> IO () |

This signal is emitted after text is inserted into the buffer.

Since: 2.18

afterEntryBufferInsertedText :: (IsEntryBuffer a, MonadIO m) => a -> ((?self :: a) => EntryBufferInsertedTextCallback) -> m SignalHandlerId Source #

Connect a signal handler for the insertedText signal, to be run after the default handler. When overloading is enabled, this is equivalent to

    after entryBuffer #insertedText callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit `?self` parameter. Note that this requires activating the `ImplicitParams` GHC extension.

onEntryBufferInsertedText :: (IsEntryBuffer a, MonadIO m) => a -> ((?self :: a) => EntryBufferInsertedTextCallback) -> m SignalHandlerId Source #

Connect a signal handler for the insertedText signal, to be run before the default handler. When overloading is enabled, this is equivalent to

    on entryBuffer #insertedText callback