Manages the style attributes of SOUI windows. More...
#include <SWndStyle.h>
Public Types | |
enum | { Align_Left = 0x000U , Align_Center = 0x100U , Align_Right = 0x200U , Align_MaskX = 0x300U } |
Alignment constants for horizontal alignment. More... | |
enum | { VAlign_Top = 0x0000U , VAlign_Middle = 0x1000U , VAlign_Bottom = 0x2000U , Align_MaskY = 0x3000U } |
Alignment constants for vertical alignment. More... | |
Public Member Functions | |
SwndStyle () | |
Constructor. | |
UINT | GetTextAlign () const |
Retrieves the text alignment. | |
UINT | GetAlign () const |
Retrieves the alignment (horizontal and vertical). | |
int | GetStates () |
Retrieves the number of states. | |
COLORREF | GetTextColor (int iState) |
Retrieves the text color for a specific state. | |
IFontPtr | GetTextFont (int iState) |
Retrieves the text font for a specific state. | |
CRect | GetMargin () const |
Retrieves the margin rectangle. | |
CRect | GetPadding () const |
Retrieves the padding rectangle. | |
void | SetTextColor (int iState, COLORREF cr) |
Sets the text color for a specific state. | |
void | SetScale (int nScale) |
Sets the scale factor. | |
int | GetScale () const |
Retrieves the scale factor. | |
void | SetAlign (UINT uAlign) |
Sets the horizontal alignment. | |
void | SetVAlign (UINT uAlign) |
Sets the vertical alignment. | |
BOOL | GetMultiLines () const |
Retrieves the multi-line flag. | |
void | SetMultiLines (BOOL bMultiLines) |
Sets the multi-line flag. | |
void | UpdateFont () |
Updates the font based on the current scale. | |
Public Attributes | |
COLORREF | m_crBg |
COLORREF | m_crBorder |
SStringT | m_strCursor |
DWORD | m_bDotted: 1 |
DWORD | m_bTrackMouseEvent: 1 |
DWORD | m_bVideoCanvas: 1 |
Protected Member Functions | |
HRESULT | OnAttrPadding (const SStringW &strValue, BOOL bLoading) |
Handles the 'padding' attribute. | |
HRESULT | OnAttrMargin (const SStringW &strValue, BOOL bLoading) |
Handles the 'margin' attribute. | |
HRESULT | OnAttrMarginX (const SStringW &strValue, BOOL bLoading) |
Handles the 'margin-x' attribute. | |
HRESULT | OnAttrMarginY (const SStringW &strValue, BOOL bLoading) |
Handles the 'margin-y' attribute. | |
void | _ParseLayoutSize4 (const SStringW &strValue, SLayoutSize layoutSizes[]) |
Parses a string into an array of layout sizes. | |
virtual HRESULT | SetAttribute (const SNS::SStringW &amp;amp;amp;strAttribName, const SNS::SStringW &amp;amp;amp;strValue, BOOL bLoading=FALSE) |
Protected Attributes | |
SLayoutSize | m_rcMargin [4] |
SLayoutSize | m_rcInset [4] |
BOOL | m_bMultiLines |
UINT | m_nTextAlign |
UINT | m_uAlign |
UINT | m_uVAlign |
COLORREF | m_crText [4] |
SDpiAwareFont | m_ftText [4] |
int | m_nScale |
Manages the style attributes of SOUI windows.
This class provides functionality to manage various style attributes of SOUI windows, including text alignment, background and border colors, cursor, text colors, fonts, margins, and padding.
Definition at line 28 of file SWndStyle.h.
anonymous enum |
Alignment constants for horizontal alignment.
Definition at line 33 of file SWndStyle.h.
anonymous enum |
Alignment constants for vertical alignment.
Definition at line 44 of file SWndStyle.h.
SNSBEGIN SwndStyle::SwndStyle | ( | ) |
Constructor.
Definition at line 12 of file SwndStyle.cpp.
|
protected |
Parses a string into an array of layout sizes.
strValue | String containing layout sizes. |
layoutSizes | Array to store parsed layout sizes. |
Definition at line 114 of file SwndStyle.cpp.
UINT SwndStyle::GetAlign | ( | ) | const |
Retrieves the alignment (horizontal and vertical).
Definition at line 31 of file SwndStyle.cpp.
CRect SwndStyle::GetMargin | ( | ) | const |
Retrieves the margin rectangle.
Definition at line 156 of file SwndStyle.cpp.
|
inline |
Retrieves the multi-line flag.
Definition at line 149 of file SWndStyle.h.
CRect SwndStyle::GetPadding | ( | ) | const |
Retrieves the padding rectangle.
Definition at line 166 of file SwndStyle.cpp.
int SwndStyle::GetScale | ( | ) | const |
int SwndStyle::GetStates | ( | ) |
Retrieves the number of states.
Definition at line 66 of file SwndStyle.cpp.
UINT SwndStyle::GetTextAlign | ( | ) | const |
Retrieves the text alignment.
Definition at line 36 of file SwndStyle.cpp.
COLORREF SwndStyle::GetTextColor | ( | int | iState | ) |
Retrieves the text color for a specific state.
iState | State index. |
Definition at line 79 of file SwndStyle.cpp.
IFontPtr SwndStyle::GetTextFont | ( | int | iState | ) |
Retrieves the text font for a specific state.
iState | State index. |
Definition at line 87 of file SwndStyle.cpp.
|
protected |
Handles the 'margin' attribute.
strValue | Attribute value. |
bLoading | TRUE if loading, FALSE otherwise. |
Definition at line 95 of file SwndStyle.cpp.
|
protected |
Handles the 'margin-x' attribute.
strValue | Attribute value. |
bLoading | TRUE if loading, FALSE otherwise. |
Definition at line 101 of file SwndStyle.cpp.
|
protected |
Handles the 'margin-y' attribute.
strValue | Attribute value. |
bLoading | TRUE if loading, FALSE otherwise. |
Definition at line 107 of file SwndStyle.cpp.
|
protected |
Handles the 'padding' attribute.
strValue | Attribute value. |
bLoading | TRUE if loading, FALSE otherwise. |
Definition at line 136 of file SwndStyle.cpp.
void SwndStyle::SetAlign | ( | UINT | uAlign | ) |
Sets the horizontal alignment.
uAlign | Horizontal alignment flags. |
Definition at line 176 of file SwndStyle.cpp.
|
inlineprotectedvirtual |
Definition at line 218 of file SWndStyle.h.
|
inline |
Sets the multi-line flag.
bMultiLines | TRUE to enable multi-lines, FALSE to disable. |
Definition at line 158 of file SWndStyle.h.
void SwndStyle::SetScale | ( | int | nScale | ) |
Sets the scale factor.
nScale | Scale factor to set. |
Definition at line 142 of file SwndStyle.cpp.
|
inline |
Sets the text color for a specific state.
iState | State index. |
cr | Text color to set. |
Definition at line 116 of file SWndStyle.h.
void SwndStyle::SetVAlign | ( | UINT | uAlign | ) |
Sets the vertical alignment.
uAlign | Vertical alignment flags. |
Definition at line 181 of file SwndStyle.cpp.
void SwndStyle::UpdateFont | ( | ) |
Updates the font based on the current scale.
Definition at line 186 of file SwndStyle.cpp.
DWORD SwndStyle::m_bDotted |
Support ellipsis for text
Definition at line 63 of file SWndStyle.h.
|
protected |
Multiple lines flag
Definition at line 171 of file SWndStyle.h.
DWORD SwndStyle::m_bTrackMouseEvent |
Monitor mouse enter and leave messages
Definition at line 64 of file SWndStyle.h.
DWORD SwndStyle::m_bVideoCanvas |
Video rendering canvas
Definition at line 65 of file SWndStyle.h.
COLORREF SwndStyle::m_crBg |
Background color
Definition at line 58 of file SWndStyle.h.
COLORREF SwndStyle::m_crBorder |
Border color
Definition at line 59 of file SWndStyle.h.
|
protected |
Text color for 4 states
Definition at line 174 of file SWndStyle.h.
|
protected |
Text font for 4 states
Definition at line 175 of file SWndStyle.h.
|
protected |
Definition at line 177 of file SWndStyle.h.
|
protected |
Text alignment
Definition at line 172 of file SWndStyle.h.
|
protected |
Text area 4-directional inner padding
Definition at line 170 of file SWndStyle.h.
|
protected |
4-week non-client area size
Definition at line 169 of file SWndStyle.h.
SStringT SwndStyle::m_strCursor |
Cursor name
Definition at line 61 of file SWndStyle.h.
|
protected |
Definition at line 173 of file SWndStyle.h.
|
protected |
Horizontal and vertical alignment
Definition at line 173 of file SWndStyle.h.