wxMaxima
Loading...
Searching...
No Matches
Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes
Style Class Referencefinal

Text Style Definition. More...

#include <TextStyle.h>

Collaboration diagram for Style:
[legend]

Public Types

using did_change = bool
 

Public Member Functions

 Style (AFontSize fontSize)
 
 Style (const Style &)
 
Styleoperator= (const Style &)
 
bool operator== (const Style &o) const
 Compares.
 
StyleRead (wxConfigBase *config, const wxString &where)
 Read this style from a config source.
 
void Write (wxConfigBase *config, const wxString &where) const
 Write this style to a config source.
 
wxFontFamily GetFamily () const
 
wxFontEncoding GetEncoding () const
 
wxFontWeight GetWeight () const
 
bool IsBold () const
 
bool IsLight () const
 
wxFontStyle GetFontStyle () const
 
bool IsItalic () const
 
bool IsSlant () const
 
bool IsUnderlined () const
 
bool IsStrikethrough () const
 
const wxString & GetFontName () const
 
AFontSize GetFontSize () const
 The size of this style's font, asserted to be valid.
 
uint32_t GetRGBColor () const
 
wxColor GetColor () const
 
did_change SetFamily (wxFontFamily family)
 
did_change SetEncoding (wxFontEncoding encoding)
 
did_change SetWeight (wxFontWeight weight)
 
did_change SetBold (bool bold=true)
 
did_change SetLight (bool light=true)
 
did_change SetFontStyle (wxFontStyle style)
 
did_change SetItalic (bool italic=true)
 
did_change SetSlant (bool slant=true)
 
did_change SetUnderlined (bool underlined=true)
 
did_change SetStrikethrough (bool strikethrough=true)
 
did_change SetFontName (wxString fontName)
 
did_change SetFontSize (AFontSize fontSize)
 
did_change SetRGBColor (uint32_t rgb)
 
did_change SetColor (const wxColor &color)
 
did_change SetColor (wxSystemColour sysColour)
 
StyleFamily (wxFontFamily family)
 
StyleEncoding (wxFontEncoding encoding)
 
StyleWeight (wxFontWeight weight)
 
StyleFontStyle (wxFontStyle style)
 
StyleBold (bool bold=true)
 
StyleLight (bool light=true)
 
StyleItalic (bool italic=true)
 
StyleSlant (bool slant=true)
 
StyleUnderlined (bool underlined=true)
 
StyleStrikethrough (bool strikethrough=true)
 
StyleFontSize (float size)
 
StyleFontSize (AFontSize fontSize)
 
StyleRGBColor (uint32_t rgb)
 
StyleColor (const wxColor &color)
 
StyleColor (uint8_t r, uint8_t g, uint8_t b)
 
StyleColor (wxSystemColour sysColour)
 
StyleChangeLightness (int alpha)
 
bool CantChangeFontName () const
 
bool CantChangeFontVariant () const
 
void CantChangeFontName (bool changeForbidden)
 
void CantChangeFontVariant (bool changeForbidden)
 
wxFontInfo GetAsFontInfo () const
 
bool IsFontOk () const
 
const wxFont & GetFont (AFontSize fontSize) const
 Returns the font associated with this style, but with the size fontSize.
 
const wxFont & GetFont () const
 Returns the font associated with this style.
 
did_change SetFromFont (const wxFont &)
 Sets all font-related properties based on another font.
 
did_change SetFontFrom (const Style &)
 Sets all font-related properties based on another style, including size, font style and weight.
 
did_change SetFontFaceFrom (const Style &)
 Sets font-face-only properties based on another style.
 
did_change SetFontFaceAndSizeFrom (const Style &)
 Sets font-face and size only properties based on another style (not attributes like bold, etc.)
 
void ClearCache () const
 Empties the font variant cache.
 
std::shared_ptr< FontVariantCacheGetFontCache () const
 

Static Public Member Functions

static const StyleFromFont (const wxFont &font)
 Gets a style that represents a given font. The font gets cached.
 
static Style FromStockFont (wxStockGDI::Item font)
 Gets a style that represents a stock font. The font is pre-cached.
 
static const wxColor & Default_Color ()
 
static constexpr bool IsFractionalFontSizeSupported ()
 Old wxWidgets versions only support integers as font sizes.
 
static AFontSize GetFontSize (const wxFont &)
 Returns the font size that this style has when not zoomed or being used as subscript/...
 
static void SetFontSize (wxFont &, AFontSize fontSize)
 Sets the font size that this style has when not zoomed or being used as subscript/...
 

Static Public Attributes

static constexpr wxFontFamily Default_Family {wxFONTFAMILY_DEFAULT}
 
static constexpr wxFontEncoding Default_Encoding {wxFONTENCODING_DEFAULT}
 
static constexpr wxFontWeight Default_Weight {wxFONTWEIGHT_NORMAL}
 
static constexpr wxFontStyle Default_FontStyle {wxFONTSTYLE_NORMAL}
 
static constexpr bool Default_Underlined {false}
 
static constexpr bool Default_Strikethrough {false}
 
static constexpr AFontSize Default_FontSize {10.0f}
 
static constexpr uint32_t Default_ColorRGB {MAKE_RGB(0, 0, 0)}
 

Detailed Description

Text Style Definition.

It is a well-performing replacement for wxFontInfo, with additional color attribute.

Since we only use a few handful text styles in a handful of sizes and since creating a wxFont object from a style definition is slow we employ a separate FontVariantCache that caches the wxFont objects we need for fonts with this font name.

Member Function Documentation

◆ Read()

Style & Style::Read ( wxConfigBase *  config,
const wxString &  where 
)

Read this style from a config source.

Only touches the attributes that were successfully read. Remaining attributes are unchanged.


The documentation for this class was generated from the following files: