soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SwndStyle Class Reference

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;amp;strAttribName, const SNS::SStringW &amp;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
 

Detailed Description

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.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Alignment constants for horizontal alignment.

Definition at line 33 of file SWndStyle.h.

◆ anonymous enum

anonymous enum

Alignment constants for vertical alignment.

Definition at line 44 of file SWndStyle.h.

Constructor & Destructor Documentation

◆ SwndStyle()

SNSBEGIN SwndStyle::SwndStyle ( )

Constructor.

Definition at line 12 of file SwndStyle.cpp.

Member Function Documentation

◆ _ParseLayoutSize4()

void SwndStyle::_ParseLayoutSize4 ( const SStringW & strValue,
SLayoutSize layoutSizes[] )
protected

Parses a string into an array of layout sizes.

Parameters
strValueString containing layout sizes.
layoutSizesArray to store parsed layout sizes.

Definition at line 114 of file SwndStyle.cpp.

◆ GetAlign()

UINT SwndStyle::GetAlign ( ) const

Retrieves the alignment (horizontal and vertical).

Returns
Alignment flags.

Definition at line 31 of file SwndStyle.cpp.

◆ GetMargin()

CRect SwndStyle::GetMargin ( ) const

Retrieves the margin rectangle.

Returns
Margin rectangle.

Definition at line 156 of file SwndStyle.cpp.

◆ GetMultiLines()

BOOL SwndStyle::GetMultiLines ( ) const
inline

Retrieves the multi-line flag.

Returns
TRUE if multi-lines are enabled, FALSE otherwise.

Definition at line 149 of file SWndStyle.h.

◆ GetPadding()

CRect SwndStyle::GetPadding ( ) const

Retrieves the padding rectangle.

Returns
Padding rectangle.

Definition at line 166 of file SwndStyle.cpp.

◆ GetScale()

int SwndStyle::GetScale ( ) const

Retrieves the scale factor.

Returns
Scale factor.

Definition at line 151 of file SwndStyle.cpp.

◆ GetStates()

int SwndStyle::GetStates ( )

Retrieves the number of states.

Returns
Number of states.

Definition at line 66 of file SwndStyle.cpp.

◆ GetTextAlign()

UINT SwndStyle::GetTextAlign ( ) const

Retrieves the text alignment.

Returns
Text alignment flags.

Definition at line 36 of file SwndStyle.cpp.

◆ GetTextColor()

COLORREF SwndStyle::GetTextColor ( int iState)

Retrieves the text color for a specific state.

Parameters
iStateState index.
Returns
Text color for the specified state.

Definition at line 79 of file SwndStyle.cpp.

◆ GetTextFont()

IFontPtr SwndStyle::GetTextFont ( int iState)

Retrieves the text font for a specific state.

Parameters
iStateState index.
Returns
Text font for the specified state.

Definition at line 87 of file SwndStyle.cpp.

◆ OnAttrMargin()

HRESULT SwndStyle::OnAttrMargin ( const SStringW & strValue,
BOOL bLoading )
protected

Handles the 'margin' attribute.

Parameters
strValueAttribute value.
bLoadingTRUE if loading, FALSE otherwise.
Returns
HRESULT indicating success or failure.

Definition at line 95 of file SwndStyle.cpp.

◆ OnAttrMarginX()

HRESULT SwndStyle::OnAttrMarginX ( const SStringW & strValue,
BOOL bLoading )
protected

Handles the 'margin-x' attribute.

Parameters
strValueAttribute value.
bLoadingTRUE if loading, FALSE otherwise.
Returns
HRESULT indicating success or failure.

Definition at line 101 of file SwndStyle.cpp.

◆ OnAttrMarginY()

HRESULT SwndStyle::OnAttrMarginY ( const SStringW & strValue,
BOOL bLoading )
protected

Handles the 'margin-y' attribute.

Parameters
strValueAttribute value.
bLoadingTRUE if loading, FALSE otherwise.
Returns
HRESULT indicating success or failure.

Definition at line 107 of file SwndStyle.cpp.

◆ OnAttrPadding()

HRESULT SwndStyle::OnAttrPadding ( const SStringW & strValue,
BOOL bLoading )
protected

Handles the 'padding' attribute.

Parameters
strValueAttribute value.
bLoadingTRUE if loading, FALSE otherwise.
Returns
HRESULT indicating success or failure.

Definition at line 136 of file SwndStyle.cpp.

◆ SetAlign()

void SwndStyle::SetAlign ( UINT uAlign)

Sets the horizontal alignment.

Parameters
uAlignHorizontal alignment flags.

Definition at line 176 of file SwndStyle.cpp.

◆ SetAttribute()

virtual HRESULT SwndStyle::SetAttribute ( const SNS::SStringW &amp;amp;amp;amp; strAttribName,
const SNS::SStringW &amp;amp;amp;amp; strValue,
BOOL bLoading = FALSE )
inlineprotectedvirtual

Definition at line 218 of file SWndStyle.h.

◆ SetMultiLines()

void SwndStyle::SetMultiLines ( BOOL bMultiLines)
inline

Sets the multi-line flag.

Parameters
bMultiLinesTRUE to enable multi-lines, FALSE to disable.

Definition at line 158 of file SWndStyle.h.

◆ SetScale()

void SwndStyle::SetScale ( int nScale)

Sets the scale factor.

Parameters
nScaleScale factor to set.

Definition at line 142 of file SwndStyle.cpp.

◆ SetTextColor()

void SwndStyle::SetTextColor ( int iState,
COLORREF cr )
inline

Sets the text color for a specific state.

Parameters
iStateState index.
crText color to set.

Definition at line 116 of file SWndStyle.h.

◆ SetVAlign()

void SwndStyle::SetVAlign ( UINT uAlign)

Sets the vertical alignment.

Parameters
uAlignVertical alignment flags.

Definition at line 181 of file SwndStyle.cpp.

◆ UpdateFont()

void SwndStyle::UpdateFont ( )

Updates the font based on the current scale.

Definition at line 186 of file SwndStyle.cpp.

Member Data Documentation

◆ m_bDotted

DWORD SwndStyle::m_bDotted

Support ellipsis for text

Definition at line 63 of file SWndStyle.h.

◆ m_bMultiLines

BOOL SwndStyle::m_bMultiLines
protected

Multiple lines flag

Definition at line 171 of file SWndStyle.h.

◆ m_bTrackMouseEvent

DWORD SwndStyle::m_bTrackMouseEvent

Monitor mouse enter and leave messages

Definition at line 64 of file SWndStyle.h.

◆ m_bVideoCanvas

DWORD SwndStyle::m_bVideoCanvas

Video rendering canvas

Definition at line 65 of file SWndStyle.h.

◆ m_crBg

COLORREF SwndStyle::m_crBg

Background color

Definition at line 58 of file SWndStyle.h.

◆ m_crBorder

COLORREF SwndStyle::m_crBorder

Border color

Definition at line 59 of file SWndStyle.h.

◆ m_crText

COLORREF SwndStyle::m_crText[4]
protected

Text color for 4 states

Definition at line 174 of file SWndStyle.h.

◆ m_ftText

SDpiAwareFont SwndStyle::m_ftText[4]
protected

Text font for 4 states

Definition at line 175 of file SWndStyle.h.

◆ m_nScale

int SwndStyle::m_nScale
protected

Definition at line 177 of file SWndStyle.h.

◆ m_nTextAlign

UINT SwndStyle::m_nTextAlign
protected

Text alignment

Definition at line 172 of file SWndStyle.h.

◆ m_rcInset

SLayoutSize SwndStyle::m_rcInset[4]
protected

Text area 4-directional inner padding

Definition at line 170 of file SWndStyle.h.

◆ m_rcMargin

SLayoutSize SwndStyle::m_rcMargin[4]
protected

4-week non-client area size

Definition at line 169 of file SWndStyle.h.

◆ m_strCursor

SStringT SwndStyle::m_strCursor

Cursor name

Definition at line 61 of file SWndStyle.h.

◆ m_uAlign

UINT SwndStyle::m_uAlign
protected

Definition at line 173 of file SWndStyle.h.

◆ m_uVAlign

UINT SwndStyle::m_uVAlign
protected

Horizontal and vertical alignment

Definition at line 173 of file SWndStyle.h.


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