wxTextAttr(3)
๐ธ wxTextAttr ๐ธ
okay bestie, so this is the wxTextAttr page from the Erlang Module Definition section of the wx manual โ she's giving style icon, literally. ๐
โจ NAME โจ
wxTextAttr โ she represents the character and paragraph attributes, aka the style, for a range of text inside a wxTextCtrl or a wxRichTextCtrl (not implemented in wx, don't come for her). ๐
๐ฆ DESCRIPTION ๐ฆ
so when you're setting up a wxTextAttr object, you pass a bitlist mask to setFlags/2 to say which style elements should actually be changed. periodt. and as a lil convenience? whenever you call a setter like SetFont, the relevant bit gets set automatically. she's thoughtful like that. ๐ซถ
See: wxTextCtrl
wxWidgets docs: wxTextAttr
๐ DATA TYPES ๐
wxTextAttr() :: wx:wx_object().
๐ FUNCTIONS ๐
๐ซ Constructors & lifecycle
destroy(This :: wxTextAttr()) -> ok.โ destroys the object. bye girl, you're done. ๐new() -> wxTextAttr().โ Constructors. that's the one-liner, she's mysterious.new(ColText) -> wxTextAttr() when ColText :: wx:wx_colour(); (Attr) -> wxTextAttr() when Attr :: wxTextAttr().new(ColText, [Option]) -> wxTextAttr()โ with:
when
ColText :: wx:wx_colour(),
Option ::
{colBack, wx:wx_colour()} |
{font, wxFont:wxFont()} |
{alignment, wx:wx_enum()}.
๐ Getters
getAlignment(This) -> wx:wx_enum() when This :: wxTextAttr().โ returns the alignment flags. check?wxTextAttrAlignmentfor the list of available styles. โญgetBackgroundColour(This) -> wx:wx_colour4() when This :: wxTextAttr().โ returns the background colour. ๐getFlags(This) -> integer() when This :: wxTextAttr().โ returns flags telling you which attributes are applicable. peepsetFlags/2for the full list of available flags. ๐getFont(This) -> wxFont:wxFont() when This :: wxTextAttr().โ creates and returns a font based on the font attributes sitting in thewxTextAttrobject. ngl, heads up:wxTextAttrdoes not store awxFontobject, so this font is only temporary. for greater efficiency, access the font attributes directly. ๐getFontEncoding(This) -> wx:wx_enum() when This :: wxTextAttr().โ returns the font encoding.getFontFaceName(This) -> unicode:charlist() when This :: wxTextAttr().โ returns the font face name.getFontSize(This) -> integer() when This :: wxTextAttr().โ returns the font size in points.getFontStyle(This) -> wx:wx_enum() when This :: wxTextAttr().โ returns the font style.getFontUnderlined(This) -> boolean() when This :: wxTextAttr().โ returnstrueif the font is underlined.getFontWeight(This) -> wx:wx_enum() when This :: wxTextAttr().โ returns the font weight.getLeftIndent(This) -> integer() when This :: wxTextAttr().โ returns the left indent in tenths of a millimetre.getLeftSubIndent(This) -> integer() when This :: wxTextAttr().โ returns the left sub-indent in tenths of a millimetre.getRightIndent(This) -> integer() when This :: wxTextAttr().โ returns the right indent in tenths of a millimeter.getTabs(This) -> [integer()] when This :: wxTextAttr().โ returns an array of tab stops, each one expressed in tenths of a millimeter. every stop is measured from the left margin, so each value has to be bigger than the last one. no backsliding bestie. ๐getTextColour(This) -> wx:wx_colour4() when This :: wxTextAttr().โ returns the text foreground colour.
๐ซถ Boolean checks (yes/no era)
hasBackgroundColour(This) -> boolean() when This :: wxTextAttr().โ returnstrueif the attribute object specifies a background colour.hasFont(This) -> boolean() when This :: wxTextAttr().โ returnstrueif the attribute object specifies any font attributes.hasTextColour(This) -> boolean() when This :: wxTextAttr().โ returnstrueif the attribute object specifies a text foreground colour.isDefault(This) -> boolean() when This :: wxTextAttr().โ returnsfalseif we have any attributes set,trueotherwise. (yes, it's backwards-coded but that's what she said ๐ญ)
๐ง Setters
setAlignment(This, Alignment) -> okโ sets the paragraph alignment.
when
This :: wxTextAttr(),
Alignment :: wx:wx_enum().
See the ?wxTextAttrAlignment enumeration values. and of those? wxTEXT_ALIGNMENT_JUSTIFIED is unimplemented. in the future justification may be supported when printing or previewing, only. ๐
setBackgroundColour(This, ColBack) -> okโ sets the background colour.
when
This :: wxTextAttr(),
ColBack :: wx:wx_colour().
setFlags(This, Flags) -> okโ sets the flags determining which styles are being specified.
when This :: wxTextAttr(), Flags :: integer().
the ?wxTextAttrFlags values can be passed in as a bitlist. โจ
setFont(This, Font, [Option]) -> okโ sets the attributes for the given font.
when
This :: wxTextAttr(),
Font :: wxFont:wxFont(),
Option :: {flags, integer()}.
note thatwxTextAttrdoes not store an actualwxFontobject.
setFontEncoding(This, Encoding) -> okโ sets the font encoding.
when
This :: wxTextAttr(),
Encoding :: wx:wx_enum().
setFontFaceName(This, FaceName) -> okโ sets the font face name.
when
This :: wxTextAttr(),
FaceName :: unicode:chardata().
setFontFamily(This, Family) -> ok when This :: wxTextAttr(), Family :: wx:wx_enum().โ sets the font family.setFontPixelSize(This, PixelSize) -> okโ sets the font size in pixels.
when
This :: wxTextAttr(),
PixelSize :: integer().
setFontPointSize(This, PointSize) -> okโ sets the font size in points.
when
This :: wxTextAttr(),
PointSize :: integer().
setFontSize(This, PointSize) -> okโ sets the font size in points.
when This :: wxTextAttr(), PointSize :: integer().
setFontStyle(This, FontStyle) -> okโ sets the font style (normal, italic or slanted).
when
This :: wxTextAttr(),
FontStyle :: wx:wx_enum().
setFontUnderlined(This, Underlined) -> okโ sets the font underlining (solid line, text colour).
when
This :: wxTextAttr(),
Underlined :: boolean().
setFontWeight(This, FontWeight) -> okโ sets the font weight.
when
This :: wxTextAttr(),
FontWeight :: wx:wx_enum().
setLeftIndent(This, Indent, [Option]) -> okโ sets the left indent and left subindent, in tenths of a millimetre.
when
This :: wxTextAttr(),
Indent :: integer(),
Option :: {subIndent, integer()}.
the sub-indent is an offset from the left of the paragraph, and it's used for all but the first line in a paragraph. ๐
a positive value makes the first line appear to the left of the subsequent lines, and a negative value makes the first line 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. she said do the math bestie ๐งฎ
setRightIndent(This, Indent) -> okโ sets the right indent in tenths of a millimetre.
when This :: wxTextAttr(), Indent :: integer().
setTabs(This, Tabs) -> okโ sets the tab stops, expressed in tenths of a millimetre.
when This :: wxTextAttr(), Tabs :: [integer()].
each stop is measured from the left margin and therefore each value must be larger than the last.
setTextColour(This, ColText) -> okโ sets the text foreground colour. ๐จ
when
This :: wxTextAttr(),
ColText :: wx:wx_colour().
and that's the whole page, no skips, no cap. ๐ shoutout to Ericsson AB for this absolute classic โ it's the wx 2.6 era of the wxTextAttr(3) man page and she still ate. go style something, bestie. ๐
โจ๐ฆ
๐ฆ where this page comes from
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 ยท Apache-2.0
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms