wxTextAttr(3)

๐Ÿ“ฆ
version 29.0.6 ยท 3 versions
, in ubuntu stonking

๐ŸŒธ 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 ?wxTextAttrAlignment for 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. peep setFlags/2 for 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 the wxTextAttr object. ngl, heads up: wxTextAttr does not store a wxFont object, 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(). โ€” returns true if 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(). โ€” returns true if the attribute object specifies a background colour.
  • hasFont(This) -> boolean() when This :: wxTextAttr(). โ€” returns true if the attribute object specifies any font attributes.
  • hasTextColour(This) -> boolean() when This :: wxTextAttr(). โ€” returns true if the attribute object specifies a text foreground colour.
  • isDefault(This) -> boolean() when This :: wxTextAttr(). โ€” returns false if we have any attributes set, true otherwise. (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 that wxTextAttr does not store an actual wxFont object.
  • 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