17#include <core/SSkinObjBase.h>
18#include <layout/SLayoutSize.h>
19#include <helper/SplitString.h>
20#include <matrix/SPoint.h>
21#include <sobject/Sobject.hpp>
49 STDMETHOD_(SIZE,
GetSkinSize)(THIS) SCONST OVERRIDE;
55 STDMETHOD_(
int,
GetStates)(THIS) SCONST OVERRIDE;
61 STDMETHOD_(
void,
OnColorize)(THIS_ COLORREF cr) OVERRIDE;
77 virtual bool SetImage(
IBitmapS *pImg);
109 m_bVertical = bVertical;
126 virtual UINT GetExpandMode()
const;
133 STDMETHOD_(
void, OnInitFinished)(THIS_
IXmlNode *pNode) OVERRIDE;
157 FilterLevel m_filterLevel;
171 HRESULT OnAttrSrc(
const SStringW &value, BOOL bLoading);
174 ATTR_CUSTOM(L
"src", OnAttrSrc)
175 ATTR_BOOL(L
"tile", m_bTile, FALSE)
176 ATTR_BOOL(L
"autoFit", m_bAutoFit, FALSE)
177 ATTR_BOOL(L
"vertical", m_bVertical, FALSE)
178 ATTR_INT(L
"states", m_nStates, FALSE)
179 ATTR_BOOL(L
"lazyLoad", m_bLazyLoad, FALSE)
180 ATTR_ENUM_BEGIN(L
"filterLevel", FilterLevel, FALSE)
181 ATTR_ENUM_VALUE(L
"none", kNone_FilterLevel)
182 ATTR_ENUM_VALUE(L
"low", kLow_FilterLevel)
183 ATTR_ENUM_VALUE(L
"medium", kMedium_FilterLevel)
184 ATTR_ENUM_VALUE(L
"high", kHigh_FilterLevel)
185 ATTR_ENUM_END(m_filterLevel)
238 m_rcMargin = rcMargin;
255 UINT GetExpandMode()
const override;
277 ATTR_RECT(L
"margin", m_rcMargin, FALSE)
278 ATTR_INT(L
"left", m_rcMargin.left, FALSE)
279 ATTR_INT(L
"top", m_rcMargin.top, FALSE)
280 ATTR_INT(L
"right", m_rcMargin.right, FALSE)
281 ATTR_INT(L
"bottom", m_rcMargin.bottom, FALSE)
282 ATTR_INT(L
"margin-x", m_rcMargin.left = m_rcMargin.right, FALSE)
283 ATTR_INT(L
"margin-y", m_rcMargin.top = m_rcMargin.bottom, FALSE)
284 ATTR_MARGIN(L
"margin2", m_rcMargin, FALSE)
331 COLORREF m_crBorder[4];
333 COLORREF m_crDown[4];
346 STDMETHOD_(
int,
GetStates)(THIS) SCONST OVERRIDE;
359 STDMETHOD_(
void,
OnColorize)(THIS_ COLORREF cr) OVERRIDE;
367 void SetColors(COLORREF crUp[4], COLORREF crDown[4], COLORREF crBorder[4]);
381 BTNCOLORS m_colorsBackup;
384 float m_fCornerPercent;
387 ATTR_COLOR(L
"colorBorder", m_colors.m_crBorder[0], TRUE)
388 ATTR_COLOR(L
"colorBorderHover", m_colors.m_crBorder[1], TRUE)
389 ATTR_COLOR(L
"colorBorderPush", m_colors.m_crBorder[2], TRUE)
390 ATTR_COLOR(L
"colorBorderDisable", m_colors.m_crBorder[3], TRUE)
391 ATTR_COLOR(L
"colorUp", m_colors.m_crUp[ST_NORMAL], TRUE)
392 ATTR_COLOR(L
"colorDown", m_colors.m_crDown[ST_NORMAL], TRUE)
393 ATTR_COLOR(L
"colorUpHover", m_colors.m_crUp[ST_HOVER], TRUE)
394 ATTR_COLOR(L
"colorDownHover", m_colors.m_crDown[ST_HOVER], TRUE)
395 ATTR_COLOR(L
"colorUpPush", m_colors.m_crUp[ST_PUSHDOWN], TRUE)
396 ATTR_COLOR(L
"colorDownPush", m_colors.m_crDown[ST_PUSHDOWN], TRUE)
397 ATTR_COLOR(L
"colorUpDisable", m_colors.m_crUp[ST_DISABLE], TRUE)
398 ATTR_COLOR(L
"colorDownDisable", m_colors.m_crDown[ST_DISABLE], TRUE)
399 ATTR_INT(L
"cornerRadius", m_nCornerRadius, TRUE)
400 ATTR_FLOAT(L
"cornerPercent", m_fCornerPercent, TRUE)
452 STDMETHOD_(
ISkinObj *, Scale)(THIS_
int nScale) OVERRIDE;
470 ATTR_COLOR(L
"colorFrom", m_crFrom, TRUE)
471 ATTR_COLOR(L
"colorTo", m_crTo, TRUE)
472 ATTR_BOOL(L
"vertical", m_bVert, TRUE)
492 float m_ratio_radius;
520 ATTR_ENUM_BEGIN(L
"type", GradientType, TRUE)
521 ATTR_ENUM_VALUE(L
"linear", linear)
522 ATTR_ENUM_VALUE(L
"radial", radial)
523 ATTR_ENUM_VALUE(L
"sweep", sweep)
524 ATTR_ENUM_END(m_type)
525 ATTR_LAYOUTSIZE(L
"radius", m_radius, TRUE)
526 ATTR_FLOAT(L
"ratio_radius", m_ratio_radius, TRUE)
527 ATTR_FLOAT(L
"angle", m_angle, TRUE)
528 ATTR_FLOAT(L
"centerX", m_centerX, TRUE)
529 ATTR_FLOAT(L
"centerY", m_centerY, TRUE)
530 ATTR_BOOL(L
"fullArc", m_bFullArc, TRUE)
531 ATTR_GRADIENT(L
"gradient", m_gradient, TRUE)
532 ATTR_CHAIN_PTR(m_gradient, 0)
583 ATTR_SPOINT(L
"ratio_corners", m_ptCorner, TRUE)
584 ATTR_LAYOUTSIZE2(L
"corners", m_szCorner, TRUE)
611#define MAKESBSTATE(sbCode, nState1, bVertical) MAKELONG((sbCode), MAKEWORD((nState1), (bVertical)))
623#define SB_THUMBGRIPPER 11
629#define THUMB_MINSIZE 18
659 virtual int GetIdealSize()
const;
669 virtual CRect GetPartRect(
int nSbCode,
int nState, BOOL bVertical)
const;
705 ATTR_INT(L
"margin", m_nMargin, FALSE)
706 ATTR_INT(L
"hasGripper", m_bHasGripper, FALSE)
707 ATTR_INT(L
"hasInactive", m_bHasInactive, FALSE)
736 STDMETHOD_(
int,
GetStates)(THIS) SCONST OVERRIDE;
757 float m_fCornerPercent;
759 COLORREF m_crStates[4];
760 COLORREF m_crBorders[4];
764 ATTR_COLOR(L
"normal", m_crStates[0], FALSE)
765 ATTR_COLOR(L
"hover", m_crStates[1], FALSE)
766 ATTR_COLOR(L
"pushdown", m_crStates[2], FALSE)
767 ATTR_COLOR(L
"disable", m_crStates[3], FALSE)
768 ATTR_COLOR(L
"normalBorder", m_crBorders[0], FALSE)
769 ATTR_COLOR(L
"hoverBorder", m_crBorders[1], FALSE)
770 ATTR_COLOR(L
"pushdownBorder", m_crBorders[2], FALSE)
771 ATTR_COLOR(L
"disableBorder", m_crBorders[3], FALSE)
772 ATTR_INT(L
"borderWidth", m_nBorderWidth, FALSE)
773 ATTR_INT(L
"cornerRadius", m_nRadius, FALSE)
774 ATTR_FLOAT(L
"cornerPercent", m_fCornerPercent, FALSE)
794 class SShapeSolid :
public TObjRefImpl<SObject> {
795 DEF_SOBJECT(TObjRefImpl<SObject>, L
"solid")
802 : m_crSolid(CR_INVALID)
807 ATTR_COLOR(L
"color", m_crSolid, TRUE)
816 IBrushS *CreateBrush(IRenderTarget *pRT, BYTE byAlpha);
828 class SShapeBitmap : public TObjRefImpl<SObject> {
829 DEF_SOBJECT(TObjRefImpl<SObject>, L
"bitmap")
836 : m_tileX(kRepeat_TileMode)
837 , m_tileY(kRepeat_TileMode)
842 ATTR_IMAGEAUTOREF(L
"src", m_pImg, TRUE)
843 ATTR_ENUM_BEGIN(L
"tileX", TileMode, TRUE)
844 ATTR_ENUM_VALUE(L
"clamp", kClamp_TileMode)
845 ATTR_ENUM_VALUE(L
"repeat", kRepeat_TileMode)
846 ATTR_ENUM_VALUE(L
"mirror", kMirror_TileMode)
847 ATTR_ENUM_END(m_tileX)
848 ATTR_ENUM_BEGIN(L
"tileY", TileMode, TRUE)
849 ATTR_ENUM_VALUE(L
"clamp", kClamp_TileMode)
850 ATTR_ENUM_VALUE(L
"repeat", kRepeat_TileMode)
851 ATTR_ENUM_VALUE(L
"mirror", kMirror_TileMode)
852 ATTR_ENUM_END(m_tileY)
861 IBrushS *CreateBrush(IRenderTarget *pRT, BYTE byAlpha);
864 SAutoRefPtr<IBitmapS> m_pImg;
865 TileMode m_tileX, m_tileY;
875 : public TObjRefImpl<SObject>
876 , public SGradientDesc {
877 DEF_SOBJECT(TObjRefImpl<SObject>, L
"gradient")
896 IBrushS *CreateBrush(IRenderTarget *pRT,
int nScale, BYTE byAlpha,
int wid,
int hei)
const;
902 STDMETHOD_(
void, OnInitFinished)(THIS_ IXmlNode *xmlNode)
override;
906 ATTR_CHAIN_CLASS(SGradientDesc)
916 class SStroke : public TObjRefImpl<SObject> {
917 DEF_SOBJECT(TObjRefImpl<SObject>, L
"stroke")
926 ATTR_LAYOUTSIZE(L
"width", m_width, TRUE)
927 ATTR_COLOR(L
"color", m_color, TRUE)
928 ATTR_ENUM_BEGIN(L
"style",
int, TRUE)
929 ATTR_ENUM_VALUE(L
"solid", PS_SOLID)
930 ATTR_ENUM_VALUE(L
"dash", PS_DASH)
931 ATTR_ENUM_VALUE(L
"dashDot", PS_DASHDOT)
932 ATTR_ENUM_VALUE(L
"dashDotDot", PS_DASHDOTDOT)
933 ATTR_ENUM_END(m_style)
934 ATTR_ENUM_BEGIN(L
"endStyle",
int, TRUE)
935 ATTR_ENUM_VALUE(L
"flat", PS_ENDCAP_FLAT)
936 ATTR_ENUM_VALUE(L
"round", PS_ENDCAP_ROUND)
937 ATTR_ENUM_VALUE(L
"square", PS_ENDCAP_SQUARE)
938 ATTR_ENUM_END(m_endStyle)
939 ATTR_ENUM_BEGIN(L
"joinStyle",
int, TRUE)
940 ATTR_ENUM_VALUE(L
"round", PS_JOIN_ROUND)
941 ATTR_ENUM_VALUE(L
"bevel", PS_JOIN_BEVEL)
942 ATTR_ENUM_VALUE(L
"miter", PS_JOIN_MITER)
943 ATTR_ENUM_END(m_joinStyle)
954 int GetStyle() const;
969 class SCornerSize : public TObjRefImpl<SObject> {
970 DEF_SOBJECT(TObjRefImpl<SObject>, L
"corners")
979 HRESULT OnAttrRadius(
const SStringW strValue, BOOL bLoading);
982 ATTR_CUSTOM(L
"radius", OnAttrRadius)
983 ATTR_LAYOUTSIZE(L
"radiusX", m_radiusX, TRUE)
984 ATTR_LAYOUTSIZE(L
"radiusY", m_radiusY, TRUE)
992 POINT GetConner(
int nScale)
const
994 return CPoint(m_radiusX.toPixelSize(nScale), m_radiusY.toPixelSize(nScale));
998 SLayoutSize m_radiusX, m_radiusY;
1008 class SRatioCornerSize :
public TObjRefImpl<SObject> {
1009 DEF_SOBJECT(TObjRefImpl<SObject>, L
"ratio_corners")
1017 m_radius.fX = m_radius.fY = 0.0f;
1026 HRESULT OnAttrRadius(
const SStringW strValue, BOOL bLoading);
1029 ATTR_CUSTOM(L
"radius", OnAttrRadius)
1030 ATTR_FLOAT(L
"radiusX", m_radius.fX, TRUE)
1031 ATTR_FLOAT(L
"radiusY", m_radius.fY, TRUE)
1039 POINT GetConner(const CRect &rc)
const
1041 return CPoint((
int)(rc.Width() / 2 * m_radius.fX), (
int)(rc.Height() / 2 * m_radius.fY));
1053 class SShapeSize :
public TObjRefImpl<SObject> {
1054 DEF_SOBJECT(TObjRefImpl<SObject>, L
"size")
1055 friend class SSkinShape;
1059 ATTR_LAYOUTSIZE(L
"width", m_width, TRUE)
1060 ATTR_LAYOUTSIZE(L
"height", m_height, TRUE)
1063 SLayoutSize m_width, m_height;
1072 class SShapeRing : public TObjRefImpl<SObject> {
1073 DEF_SOBJECT(TObjRefImpl<SObject>, L
"ring")
1074 friend class SSkinShape;
1081 : m_startAngle(0.0f)
1082 , m_sweepAngle(360.0f)
1087 ATTR_FLOAT(L
"startAngle", m_startAngle, TRUE)
1088 ATTR_FLOAT(L
"sweepAngle", m_sweepAngle, TRUE)
1099 STDMETHOD_(SIZE, GetSkinSize)(THIS) SCONST OVERRIDE;
1100 STDMETHOD_(
int, GetStates)(THIS) SCONST OVERRIDE;
1103 ATTR_ENUM_BEGIN(L
"shape", Shape, TRUE)
1104 ATTR_ENUM_VALUE(L
"rectangle", rectangle)
1105 ATTR_ENUM_VALUE(L
"oval", oval)
1106 ATTR_ENUM_VALUE(L
"ring", ring)
1107 ATTR_ENUM_END(m_shape)
1110 STDMETHOD_(
void, OnInitFinished)(THIS_ IXmlNode *pNode) OVERRIDE;
1112 void _DrawByIndex(IRenderTarget *pRT, LPCRECT rcDraw,
int iState, BYTE byAlpha) const override;
1114 void _Scale(ISkinObj *pObj,
int nScale) override;
1115 POINT GetCornerSize(const CRect &rc) const;
1119 SAutoRefPtr<SShapeSolid> m_solid;
1120 SAutoRefPtr<SShapeBitmap> m_bitmap;
1121 SAutoRefPtr<SGradientBrush> m_gradient;
1122 SAutoRefPtr<SShapeSize> m_shapeSize;
1123 SAutoRefPtr<SCornerSize> m_cornerSize;
1124 SAutoRefPtr<SRatioCornerSize> m_ratioCornerSize;
1125 SAutoRefPtr<SStroke> m_stroke;
1126 SAutoRefPtr<SShapeRing> m_ringParam;
1143 STDMETHOD_(SIZE,
GetSkinSize)(CTHIS) SCONST OVERRIDE;
1149 STDMETHOD_(
int,
GetStates)(CTHIS) SCONST OVERRIDE;
1152 ATTR_SKIN(L
"normal", m_skins[0], FALSE)
1153 ATTR_SKIN(L
"hover", m_skins[1], FALSE)
1154 ATTR_SKIN(L
"pushDown", m_skins[2], FALSE)
1155 ATTR_SKIN(L
"disable", m_skins[3], FALSE)
SBSTATE
Scrollbar State Enum.
Smart pointer class for managing COM-style reference-counted objects.
SGradientDesc()
Constructor for SGradientDesc.
GradientInfo GetGradientInfo(int nScale, int wid, int hei) const
Gets the gradient information.
IGradient * GetGradient()
Gets the gradient object.
Represents a group of skins for different states.
void _DrawByIndex(IRenderTarget *pRT, LPCRECT rcDraw, int iState, BYTE byAlpha) const override
Draws the skin group by index.
int GetStates() SCONST OVERRIDE
Gets the number of states supported by the skin group.
SIZE GetSkinSize() SCONST OVERRIDE
Gets the size of the skin group.
void _Scale(ISkinObj *skinObj, int nScale) override
Scales the skin group.
SSkinColorRect()
Constructor for SSkinColorRect.
ISkinObj * Scale(int nScale) OVERRIDE
Scales the skin.
int GetStates() SCONST OVERRIDE
Gets the number of states in the skin.
ISkinObj * Scale(int nScale) OVERRIDE
Scales the skin.
SSkinGradation2()
Constructor for SSkinGradation2.
void OnInitFinished(IXmlNode *xmlNode) OVERRIDE
Called when initialization is finished.
void SetColorFrom(COLORREF crFrom)
Sets the starting color of the gradient.
void SetColorTo(COLORREF crTo)
Sets the ending color of the gradient.
SSkinGradation()
Constructor for SSkinGradation.
void SetVertical(BOOL bVertical)
Sets whether the gradient is vertical.
SSkinImgCenter()
Constructor for SSkinImgCenter.
Enhanced Image Frame Skin.
HRESULT OnAttrSrc(const SStringW &strValue, BOOL bLoading)
Handles the 'src' attribute.
SSkinImgFrame()
Constructor for SSkinImgFrame.
void SetMargin(const CRect rcMargin)
Sets the margins for the image frame.
CRect GetMargin()
Gets the margins for the image frame.
virtual void SetVertical(BOOL bVertical)
Sets whether the images are arranged vertically.
virtual void SetStates(int nStates)
Sets the number of states in the skin.
SIZE GetSkinSize() SCONST OVERRIDE
Gets the size of the skin.
virtual BOOL IsVertical() const
Checks if the images are arranged vertically.
virtual void SetTile(BOOL bTile)
Sets whether the image should be tiled.
virtual BOOL IsTile() const
Checks if the image is tiled.
SSkinImgList()
Constructor for SSkinImgList.
void OnColorize(COLORREF cr) OVERRIDE
Handles colorization of the skin.
int GetStates() SCONST OVERRIDE
Gets the number of states in the skin.
Base class for skin objects.
virtual void _DrawByState(IRenderTarget *pRT, LPCRECT rcDraw, DWORD dwState, BYTE byAlpha) const
Draws the skin by state with alpha blending.
virtual void _DrawByIndex(IRenderTarget *pRT, LPCRECT rcDraw, int iState, BYTE byAlpha) const =0
Draws the skin by index with alpha blending.
virtual void _Scale(ISkinObj *pObj, int nScale)
Scales the skin object.
SSkinObjBase()
Constructor.
A class representing an ASCII string.
Interface for rendering target objects.
Interface for Skin Objects.