wxTextAttr — wx v2.4.2

Search documentation of wx

# View Source wxTextAttr (wx v2.4.2)

Functions for wxTextAttr class

`wxTextAttr` represents the character and paragraph attributes, or style, for a range of text in a `wxTextCtrl` or `wxRichTextCtrl` (not implemented in wx).

When setting up a `wxTextAttr` object, pass a bitlist mask to `setFlags/2` to indicate which style elements should be changed. As a convenience, when you call a setter such as SetFont, the relevant bit will be set.

See: `wxTextCtrl`, `wxRichTextCtrl` (not implemented in wx)

wxWidgets docs: wxTextAttr

# Summary

## Types

wxTextAttr()

## Functions

destroy(This)

Destroys the object.

getAlignment(This)

Returns the alignment flags.

getBackgroundColour(This)

Returns the background colour.

getFlags(This)

Returns flags indicating which attributes are applicable.

getFont(This)

Creates and returns a font specified by the font attributes in the `wxTextAttr` object.

getFontEncoding(This)

Returns the font encoding.

getFontFaceName(This)

Returns the font face name.

getFontSize(This)

Returns the font size in points.

getFontStyle(This)

Returns the font style.

getFontUnderlined(This)

Returns true if the font is underlined.

getFontWeight(This)

Returns the font weight.

getLeftIndent(This)

Returns the left indent in tenths of a millimetre.

getLeftSubIndent(This)

Returns the left sub-indent in tenths of a millimetre.

getRightIndent(This)

Returns the right indent in tenths of a millimeter.

getTabs(This)

Returns an array of tab stops, each expressed in tenths of a millimeter.

getTextColour(This)

Returns the text foreground colour.

hasBackgroundColour(This)

Returns true if the attribute object specifies a background colour.

hasFont(This)

Returns true if the attribute object specifies any font attributes.

hasTextColour(This)

Returns true if the attribute object specifies a text foreground colour.

isDefault(This)

Returns false if we have any attributes set, true otherwise.

new()

Constructors.

new/1
new(ColText, Options)
setAlignment(This, Alignment)

Sets the paragraph alignment.

setBackgroundColour(This, ColBack)

Sets the background colour.

setFlags(This, Flags)

Sets the flags determining which styles are being specified.

setFont(This, Font)
setFont/3

Sets the attributes for the given font.

setFontEncoding(This, Encoding)

Sets the font encoding.

setFontFaceName(This, FaceName)

Sets the font face name.

setFontFamily(This, Family)

Sets the font family.

setFontPixelSize(This, PixelSize)

Sets the font size in pixels.

setFontPointSize(This, PointSize)

Sets the font size in points.

setFontSize(This, PointSize)

Sets the font size in points.

setFontStyle(This, FontStyle)

Sets the font style (normal, italic or slanted).

setFontUnderlined(This, Underlined)

Sets the font underlining (solid line, text colour).

setFontWeight(This, FontWeight)

Sets the font weight.

setLeftIndent(This, Indent)
setLeftIndent/3

Sets the left indent and left subindent in tenths of a millimetre.

setRightIndent(This, Indent)

Sets the right indent in tenths of a millimetre.

setTabs(This, Tabs)

Sets the tab stops, expressed in tenths of a millimetre.

setTextColour(This, ColText)

Sets the text foreground colour.

# Types

Link to this type

# wxTextAttr()

View Source

    -type wxTextAttr() :: wx:wx_object().

# Functions

Link to this function

# destroy(This)

View Source

    -spec destroy(This :: wxTextAttr()) -> ok.

Destroys the object.

Link to this function

# getAlignment(This)

View Source

    -spec getAlignment(This) -> wx:wx_enum() when This :: wxTextAttr().

Returns the alignment flags.

See ?wxTextAttrAlignment for a list of available styles.

Link to this function

# getBackgroundColour(This)

View Source

    -spec getBackgroundColour(This) -> wx:wx_colour4() when This :: wxTextAttr().

Returns the background colour.

Link to this function

# getFlags(This)

View Source

    -spec getFlags(This) -> integer() when This :: wxTextAttr().

Returns flags indicating which attributes are applicable.

See `setFlags/2` for a list of available flags.

Link to this function

# getFont(This)

View Source

    -spec getFont(This) -> wxFont:wxFont() when This :: wxTextAttr().

Creates and returns a font specified by the font attributes in the `wxTextAttr` object.

Note that `wxTextAttr` does not store a `wxFont` object, so this is only a temporary font.

For greater efficiency, access the font attributes directly.

Link to this function

# getFontEncoding(This)

View Source

    -spec getFontEncoding(This) -> wx:wx_enum() when This :: wxTextAttr().

Returns the font encoding.

Link to this function

# getFontFaceName(This)

View Source

    -spec getFontFaceName(This) -> unicode:charlist() when This :: wxTextAttr().

Returns the font face name.

Link to this function

# getFontSize(This)

View Source

    -spec getFontSize(This) -> integer() when This :: wxTextAttr().

Returns the font size in points.

Link to this function

# getFontStyle(This)

View Source

    -spec getFontStyle(This) -> wx:wx_enum() when This :: wxTextAttr().

Returns the font style.

Link to this function

# getFontUnderlined(This)

View Source

    -spec getFontUnderlined(This) -> boolean() when This :: wxTextAttr().

Returns true if the font is underlined.

Link to this function

# getFontWeight(This)

View Source

    -spec getFontWeight(This) -> wx:wx_enum() when This :: wxTextAttr().

Returns the font weight.

Link to this function

# getLeftIndent(This)

View Source

    -spec getLeftIndent(This) -> integer() when This :: wxTextAttr().

Returns the left indent in tenths of a millimetre.

Link to this function

# getLeftSubIndent(This)

View Source

    -spec getLeftSubIndent(This) -> integer() when This :: wxTextAttr().

Returns the left sub-indent in tenths of a millimetre.

Link to this function

# getRightIndent(This)

View Source

    -spec getRightIndent(This) -> integer() when This :: wxTextAttr().

Returns the right indent in tenths of a millimeter.

Link to this function

# getTabs(This)

View Source

    -spec getTabs(This) -> [integer()] when This :: wxTextAttr().

Returns an array of tab stops, each expressed in tenths of a millimeter.

Each stop is measured from the left margin and therefore each value must be larger than the last.

Link to this function

# getTextColour(This)

View Source

    -spec getTextColour(This) -> wx:wx_colour4() when This :: wxTextAttr().

Returns the text foreground colour.

Link to this function

# hasBackgroundColour(This)

View Source

    -spec hasBackgroundColour(This) -> boolean() when This :: wxTextAttr().

Returns true if the attribute object specifies a background colour.

Link to this function

# hasFont(This)

View Source

    -spec hasFont(This) -> boolean() when This :: wxTextAttr().

Returns true if the attribute object specifies any font attributes.

Link to this function

# hasTextColour(This)

View Source

    -spec hasTextColour(This) -> boolean() when This :: wxTextAttr().

Returns true if the attribute object specifies a text foreground colour.

Link to this function

# isDefault(This)

View Source

    -spec isDefault(This) -> boolean() when This :: wxTextAttr().

Returns false if we have any attributes set, true otherwise.

Link to this function

# new()

View Source

    -spec new() -> wxTextAttr().

Constructors.

Link to this function

# new/1

View Source

    -spec new(ColText) -> wxTextAttr() when ColText :: wx:wx_colour();
             (Attr) -> wxTextAttr() when Attr :: wxTextAttr().

Link to this function

# new(ColText, Options)

View Source

    -spec new(ColText, [Option]) -> wxTextAttr()
                 when
                     ColText :: wx:wx_colour(),
                     Option ::
                         {colBack, wx:wx_colour()} | {font, wxFont:wxFont()} | {alignment, wx:wx_enum()}.

Link to this function

# setAlignment(This, Alignment)

View Source

    -spec setAlignment(This, Alignment) -> ok when This :: wxTextAttr(), Alignment :: wx:wx_enum().

Sets the paragraph alignment.

See ?wxTextAttrAlignment enumeration values.

Of these, wxTEXT_ALIGNMENT_JUSTIFIED is unimplemented. In future justification may be supported when printing or previewing, only.

Link to this function

# setBackgroundColour(This, ColBack)

View Source

    -spec setBackgroundColour(This, ColBack) -> ok when This :: wxTextAttr(), ColBack :: wx:wx_colour().

Sets the background colour.

Link to this function

# setFlags(This, Flags)

View Source

    -spec setFlags(This, Flags) -> ok when This :: wxTextAttr(), Flags :: integer().

Sets the flags determining which styles are being specified.

The ?wxTextAttrFlags values can be passed in a bitlist.

Link to this function

# setFont(This, Font)

View Source

    -spec setFont(This, Font) -> ok when This :: wxTextAttr(), Font :: wxFont:wxFont().

Link to this function

# setFont/3

View Source

    -spec setFont(This, Font, [Option]) -> ok
                     when This :: wxTextAttr(), Font :: wxFont:wxFont(), Option :: {flags, integer()}.

Sets the attributes for the given font.

Note that `wxTextAttr` does not store an actual `wxFont` object.

Link to this function

# setFontEncoding(This, Encoding)

View Source

    -spec setFontEncoding(This, Encoding) -> ok when This :: wxTextAttr(), Encoding :: wx:wx_enum().

Sets the font encoding.

Link to this function

# setFontFaceName(This, FaceName)

View Source

    -spec setFontFaceName(This, FaceName) -> ok when This :: wxTextAttr(), FaceName :: unicode:chardata().

Sets the font face name.

Link to this function

# setFontFamily(This, Family)

View Source

    -spec setFontFamily(This, Family) -> ok when This :: wxTextAttr(), Family :: wx:wx_enum().

Sets the font family.

Link to this function

# setFontPixelSize(This, PixelSize)

View Source

    -spec setFontPixelSize(This, PixelSize) -> ok when This :: wxTextAttr(), PixelSize :: integer().

Sets the font size in pixels.

Link to this function

# setFontPointSize(This, PointSize)

View Source

    -spec setFontPointSize(This, PointSize) -> ok when This :: wxTextAttr(), PointSize :: integer().

Sets the font size in points.

Link to this function

# setFontSize(This, PointSize)

View Source

    -spec setFontSize(This, PointSize) -> ok when This :: wxTextAttr(), PointSize :: integer().

Sets the font size in points.

Link to this function

# setFontStyle(This, FontStyle)

View Source

    -spec setFontStyle(This, FontStyle) -> ok when This :: wxTextAttr(), FontStyle :: wx:wx_enum().

Sets the font style (normal, italic or slanted).

Link to this function

# setFontUnderlined(This, Underlined)

View Source

    -spec setFontUnderlined(This, Underlined) -> ok when This :: wxTextAttr(), Underlined :: boolean().

Sets the font underlining (solid line, text colour).

Link to this function

# setFontWeight(This, FontWeight)

View Source

    -spec setFontWeight(This, FontWeight) -> ok when This :: wxTextAttr(), FontWeight :: wx:wx_enum().

Sets the font weight.

Link to this function

# setLeftIndent(This, Indent)

View Source

    -spec setLeftIndent(This, Indent) -> ok when This :: wxTextAttr(), Indent :: integer().

Link to this function

# setLeftIndent/3

View Source

    -spec setLeftIndent(This, Indent, [Option]) -> ok
                           when This :: wxTextAttr(), Indent :: integer(), Option :: {subIndent, integer()}.

Sets the left indent and left subindent in tenths of a millimetre.

The sub-indent is an offset from the left of the paragraph, and is used for all but the first line in a paragraph.

A positive value will cause the first line to appear to the left of the subsequent lines, and a negative value will cause the first line to be indented relative to the subsequent lines.

`wxRichTextBuffer` (not implemented in wx) uses indentation to render a bulleted item. The left indent is the distance between the margin and the bullet. The content of the paragraph, including the first line, starts at leftMargin + leftSubIndent. So the distance between the left edge of the bullet and the left of the actual paragraph is leftSubIndent.

Link to this function

# setRightIndent(This, Indent)

View Source

    -spec setRightIndent(This, Indent) -> ok when This :: wxTextAttr(), Indent :: integer().

Sets the right indent in tenths of a millimetre.

Link to this function

# setTabs(This, Tabs)

View Source

    -spec setTabs(This, Tabs) -> ok when This :: wxTextAttr(), Tabs :: [integer()].

Sets the tab stops, expressed in tenths of a millimetre.

Each stop is measured from the left margin and therefore each value must be larger than the last.

Link to this function

# setTextColour(This, ColText)

View Source

    -spec setTextColour(This, ColText) -> ok when This :: wxTextAttr(), ColText :: wx:wx_colour().

Sets the text foreground colour.