gi-atk-2.0.11: Atk bindings

CopyrightWill Thompson, Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Atk.Interfaces.Text

Contents

Description

Text should be implemented by AtkObjects on behalf of widgets that have text content which is either attributed or otherwise non-trivial. AtkObjects whose text content is simple, unattributed, and very brief may expose that content via atk_object_get_name instead; however if the text is editable, multi-line, typically longer than three or four words, attributed, selectable, or if the object already uses the 'name' ATK property for other information, the Text interface should be used to expose the text content. In the case of editable text content, EditableText (a subtype of the Text interface) should be implemented instead.

Text provides not only traversal facilities and change notification for text content, but also caret tracking and glyph bounding box calculations. Note that the text strings are exposed as UTF-8, and are therefore potentially multi-byte, and caret-to-byte offset mapping makes no assumptions about the character length; also bounding box glyph-to-offset mapping may be complex for languages which use ligatures.

Synopsis

Exported types

newtype Text Source #

Constructors

Text (ManagedPtr Text) 

Instances

WrappedPtr Text Source # 
IsText Text Source # 
((~) * info (ResolveTextMethod t Text), MethodInfo * info Text p) => IsLabel t (Text -> p) Source # 

Methods

fromLabel :: Proxy# Symbol t -> Text -> p #

((~) * info (ResolveTextMethod t Text), MethodInfo * info Text p) => IsLabelProxy t (Text -> p) Source # 

Methods

fromLabelProxy :: Proxy Symbol t -> Text -> p #

HasAttributeList * Text Source # 
type AttributeList Text Source # 
type SignalList Text Source # 

Methods

addSelection

data TextAddSelectionMethodInfo Source #

Instances

((~) * signature (Int32 -> Int32 -> m Bool), MonadIO m, IsText a) => MethodInfo * TextAddSelectionMethodInfo a signature Source # 

textAddSelection Source #

Arguments

:: (HasCallStack, MonadIO m, IsText a) 
=> a

text: an Text

-> Int32

startOffset: the start position of the selected region

-> Int32

endOffset: the offset of the first character after the selected region.

-> m Bool

Returns: True if success, False otherwise

Adds a selection bounded by the specified offsets.

freeRanges

textFreeRanges Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr (Ptr TextRange)

ranges: A pointer to an array of TextRange which is to be freed.

-> m () 

Frees the memory associated with an array of AtkTextRange. It is assumed that the array was returned by the function atk_text_get_bounded_ranges and is NULL terminated.

Since: 1.3

getBoundedRanges

textGetBoundedRanges Source #

Arguments

:: (HasCallStack, MonadIO m, IsText a) 
=> a

text: an Text

-> TextRectangle

rect: An AtkTextRectangle giving the dimensions of the bounding box.

-> CoordType

coordType: Specify whether coordinates are relative to the screen or widget window.

-> TextClipType

xClipType: Specify the horizontal clip type.

-> TextClipType

yClipType: Specify the vertical clip type.

-> m [TextRange]

Returns: Array of AtkTextRange. The last element of the array returned by this function will be NULL.

Get the ranges of text in the specified bounding box.

Since: 1.3

getCaretOffset

textGetCaretOffset Source #

Arguments

:: (HasCallStack, MonadIO m, IsText a) 
=> a

text: an Text

-> m Int32

Returns: the offset position of the caret (cursor).

Gets the offset position of the caret (cursor).

getCharacterAtOffset

textGetCharacterAtOffset Source #

Arguments

:: (HasCallStack, MonadIO m, IsText a) 
=> a

text: an Text

-> Int32

offset: position

-> m Char

Returns: the character at offset.

Gets the specified text.

getCharacterCount

textGetCharacterCount Source #

Arguments

:: (HasCallStack, MonadIO m, IsText a) 
=> a

text: an Text

-> m Int32

Returns: the number of characters.

Gets the character count.

getCharacterExtents

textGetCharacterExtents Source #

Arguments

:: (HasCallStack, MonadIO m, IsText a) 
=> a

text: an Text

-> Int32

offset: The offset of the text character for which bounding information is required.

-> CoordType

coords: specify whether coordinates are relative to the screen or widget window

-> m (Int32, Int32, Int32, Int32) 

Get the bounding box containing the glyph representing the character at a particular text offset.

getDefaultAttributes

textGetDefaultAttributes Source #

Arguments

:: (HasCallStack, MonadIO m, IsText a) 
=> a

text: an Text

-> m [Ptr ()]

Returns: an AtkAttributeSet which contains the default values of attributes. at offset. this atkattributeset should be freed by a call to attributeSetFree.

Creates an AtkAttributeSet which consists of the default values of attributes for the text. See the enum AtkTextAttribute for types of text attributes that can be returned. Note that other attributes may also be returned.

getNSelections

textGetNSelections Source #

Arguments

:: (HasCallStack, MonadIO m, IsText a) 
=> a

text: an Text

-> m Int32

Returns: The number of selected regions, or -1 if a failure occurred.

Gets the number of selected regions.

getOffsetAtPoint

textGetOffsetAtPoint Source #

Arguments

:: (HasCallStack, MonadIO m, IsText a) 
=> a

text: an Text

-> Int32

x: screen x-position of character

-> Int32

y: screen y-position of character

-> CoordType

coords: specify whether coordinates are relative to the screen or widget window

-> m Int32

Returns: the offset to the character which is located at the specified x and y coordinates.

Gets the offset of the character located at coordinates x and y. x and y are interpreted as being relative to the screen or this widget's window depending on coords.

getRangeExtents

textGetRangeExtents Source #

Arguments

:: (HasCallStack, MonadIO m, IsText a) 
=> a

text: an Text

-> Int32

startOffset: The offset of the first text character for which boundary information is required.

-> Int32

endOffset: The offset of the text character after the last character for which boundary information is required.

-> CoordType

coordType: Specify whether coordinates are relative to the screen or widget window.

-> m TextRectangle 

Get the bounding box for text within the specified range.

Since: 1.3

getRunAttributes

textGetRunAttributes Source #

Arguments

:: (HasCallStack, MonadIO m, IsText a) 
=> a

text: an Text

-> Int32

offset: the offset at which to get the attributes, -1 means the offset of the character to be inserted at the caret location.

-> m ([Ptr ()], Int32, Int32)

Returns: an AtkAttributeSet which contains the attributes explicitly set at offset. This AtkAttributeSet should be freed by a call to attributeSetFree.

Creates an AtkAttributeSet which consists of the attributes explicitly set at the position offset in the text. startOffset and endOffset are set to the start and end of the range around offset where the attributes are invariant. Note that endOffset is the offset of the first character after the range. See the enum AtkTextAttribute for types of text attributes that can be returned. Note that other attributes may also be returned.

getSelection

data TextGetSelectionMethodInfo Source #

Instances

((~) * signature (Int32 -> m (Text, Int32, Int32)), MonadIO m, IsText a) => MethodInfo * TextGetSelectionMethodInfo a signature Source # 

textGetSelection Source #

Arguments

:: (HasCallStack, MonadIO m, IsText a) 
=> a

text: an Text

-> Int32

selectionNum: The selection number. The selected regions are assigned numbers that correspond to how far the region is from the start of the text. The selected region closest to the beginning of the text region is assigned the number 0, etc. Note that adding, moving or deleting a selected region can change the numbering.

-> m (Text, Int32, Int32)

Returns: a newly allocated string containing the selected text. Use free to free the returned string.

Gets the text from the specified selection.

getStringAtOffset

textGetStringAtOffset Source #

Arguments

:: (HasCallStack, MonadIO m, IsText a) 
=> a

text: an Text

-> Int32

offset: position

-> TextGranularity

granularity: An TextGranularity

-> m (Maybe Text, Int32, Int32)

Returns: a newly allocated string containing the text at the offset bounded by the specified granularity. Use free to free the returned string. Returns Nothing if the offset is invalid or no implementation is available.

Gets a portion of the text exposed through an Text according to a given offset and a specific granularity, along with the start and end offsets defining the boundaries of such a portion of text.

If granularity is ATK_TEXT_GRANULARITY_CHAR the character at the offset is returned.

If granularity is ATK_TEXT_GRANULARITY_WORD the returned string is from the word start at or before the offset to the word start after the offset.

The returned string will contain the word at the offset if the offset is inside a word and will contain the word before the offset if the offset is not inside a word.

If granularity is ATK_TEXT_GRANULARITY_SENTENCE the returned string is from the sentence start at or before the offset to the sentence start after the offset.

The returned string will contain the sentence at the offset if the offset is inside a sentence and will contain the sentence before the offset if the offset is not inside a sentence.

If granularity is ATK_TEXT_GRANULARITY_LINE the returned string is from the line start at or before the offset to the line start after the offset.

If granularity is ATK_TEXT_GRANULARITY_PARAGRAPH the returned string is from the start of the paragraph at or before the offset to the start of the following paragraph after the offset.

Since: 2.10

getText

data TextGetTextMethodInfo Source #

Instances

((~) * signature (Int32 -> Int32 -> m Text), MonadIO m, IsText a) => MethodInfo * TextGetTextMethodInfo a signature Source # 

Methods

overloadedMethod :: MethodProxy TextGetTextMethodInfo a -> signature -> s #

textGetText Source #

Arguments

:: (HasCallStack, MonadIO m, IsText a) 
=> a

text: an Text

-> Int32

startOffset: start position

-> Int32

endOffset: end position, or -1 for the end of the string.

-> m Text

Returns: a newly allocated string containing the text from startOffset up to, but not including endOffset. Use free to free the returned string.

Gets the specified text.

getTextAfterOffset

textGetTextAfterOffset Source #

Arguments

:: (HasCallStack, MonadIO m, IsText a) 
=> a

text: an Text

-> Int32

offset: position

-> TextBoundary

boundaryType: An TextBoundary

-> m (Text, Int32, Int32)

Returns: a newly allocated string containing the text after offset bounded by the specified boundaryType. Use free to free the returned string.

Deprecated: (Since version 2.9.3)Please use textGetStringAtOffset instead.

Gets the specified text.

getTextAtOffset

textGetTextAtOffset Source #

Arguments

:: (HasCallStack, MonadIO m, IsText a) 
=> a

text: an Text

-> Int32

offset: position

-> TextBoundary

boundaryType: An TextBoundary

-> m (Text, Int32, Int32)

Returns: a newly allocated string containing the text at offset bounded by the specified boundaryType. Use free to free the returned string.

Deprecated: This method is deprecated since ATK version2.9.4. Please use textGetStringAtOffset instead.

Gets the specified text.

If the boundary_type if ATK_TEXT_BOUNDARY_CHAR the character at the offset is returned.

If the boundary_type is ATK_TEXT_BOUNDARY_WORD_START the returned string is from the word start at or before the offset to the word start after the offset.

The returned string will contain the word at the offset if the offset is inside a word and will contain the word before the offset if the offset is not inside a word.

If the boundary type is ATK_TEXT_BOUNDARY_SENTENCE_START the returned string is from the sentence start at or before the offset to the sentence start after the offset.

The returned string will contain the sentence at the offset if the offset is inside a sentence and will contain the sentence before the offset if the offset is not inside a sentence.

If the boundary type is ATK_TEXT_BOUNDARY_LINE_START the returned string is from the line start at or before the offset to the line start after the offset.

getTextBeforeOffset

textGetTextBeforeOffset Source #

Arguments

:: (HasCallStack, MonadIO m, IsText a) 
=> a

text: an Text

-> Int32

offset: position

-> TextBoundary

boundaryType: An TextBoundary

-> m (Text, Int32, Int32)

Returns: a newly allocated string containing the text before offset bounded by the specified boundaryType. Use free to free the returned string.

Deprecated: (Since version 2.9.3)Please use textGetStringAtOffset instead.

Gets the specified text.

removeSelection

textRemoveSelection Source #

Arguments

:: (HasCallStack, MonadIO m, IsText a) 
=> a

text: an Text

-> Int32

selectionNum: The selection number. The selected regions are assigned numbers that correspond to how far the region is from the start of the text. The selected region closest to the beginning of the text region is assigned the number 0, etc. Note that adding, moving or deleting a selected region can change the numbering.

-> m Bool

Returns: True if success, False otherwise

Removes the specified selection.

setCaretOffset

textSetCaretOffset Source #

Arguments

:: (HasCallStack, MonadIO m, IsText a) 
=> a

text: an Text

-> Int32

offset: position

-> m Bool

Returns: True if success, False otherwise.

Sets the caret (cursor) position to the specified offset.

setSelection

data TextSetSelectionMethodInfo Source #

Instances

((~) * signature (Int32 -> Int32 -> Int32 -> m Bool), MonadIO m, IsText a) => MethodInfo * TextSetSelectionMethodInfo a signature Source # 

textSetSelection Source #

Arguments

:: (HasCallStack, MonadIO m, IsText a) 
=> a

text: an Text

-> Int32

selectionNum: The selection number. The selected regions are assigned numbers that correspond to how far the region is from the start of the text. The selected region closest to the beginning of the text region is assigned the number 0, etc. Note that adding, moving or deleting a selected region can change the numbering.

-> Int32

startOffset: the new start position of the selection

-> Int32

endOffset: the new end position of (e.g. offset immediately past) the selection

-> m Bool

Returns: True if success, False otherwise

Changes the start and end offset of the specified selection.

Signals

textAttributesChanged

textCaretMoved

textChanged

type C_TextTextChangedCallback = Ptr () -> Int32 -> Int32 -> Ptr () -> IO () Source #

type TextTextChangedCallback = Int32 -> Int32 -> IO () Source #

Deprecated: (Since version 2.9.4)Use Object::text-insert orObject::text-remove instead.

textInsert

type C_TextTextInsertCallback = Ptr () -> Int32 -> Int32 -> CString -> Ptr () -> IO () Source #

textRemove

type C_TextTextRemoveCallback = Ptr () -> Int32 -> Int32 -> CString -> Ptr () -> IO () Source #

textSelectionChanged