用于EagleEye3.0 规则集漏报和误报测试的示例项目,项目收集于github和gitee
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1052 lines
27 KiB

5 months ago
/**
* Copyright (C) 2014-2050 SOUI团队
* All rights reserved.
*
* @file SCmnCtrl.h
* @brief
* @version v1.0
* @author soui
* @date 2014-05-28
*
* Describe :
*/
#pragma once
#include "core/SWnd.h"
#include "core/SAccelerator.h"
#include "core/SFocusManager.h"
namespace SOUI
{
/**
* @class SStatic
* @brief
*
* Describe \n可以强制换行
* Usage <text>inner text example</text>
*/
class SOUI_EXP SStatic : public SWindow
{
SOUI_CLASS_NAME(SStatic, L"text")
public:
/**
* SStatic::SStatic
* @brief
*
* Describe
*/
SStatic();
/**
* SStatic::SDrawText
* @brief
* @param IRenderTarget *pRT --
* @param LPCTSTR pszBuf --
* @param int cchText --
* @param LPRECT pRect -- RECT的指针
* @param UINT uFormat --
*
* Describe DrawText封装
*/
virtual void DrawText(IRenderTarget *pRT,LPCTSTR pszBuf,int cchText,LPRECT pRect,UINT uFormat);
protected:
virtual void OnDrawLine(IRenderTarget *pRT, LPCTSTR pszBuf, int iBegin, int cchText, LPRECT pRect, UINT uFormat);
virtual SIZE OnMeasureText(IRenderTarget *pRT,LPCTSTR pszText,int cchLen);
void DrawMultiLine(IRenderTarget *pRT,LPCTSTR pszBuf,int cchText,LPRECT pRect,UINT uFormat);
int m_nLineInter; /**< 行间距 */
bool m_bWordbreak;
SOUI_ATTRS_BEGIN()
ATTR_INT(L"interHeight", m_nLineInter, TRUE)
ATTR_BOOL(L"wordBreak",m_bWordbreak,TRUE)
SOUI_ATTRS_END()
};
/**
* @class SLink
* @brief
*
* Describe Only For Header Drag Test
* Usage <link>inner text example</link>
*/
class SOUI_EXP SLink : public SWindow
{
SOUI_CLASS_NAME(SLink, L"link")
public:
/**
* SLink::SLink
* @brief
*
* Describe
*/
SLink();
protected:
/**
* SLink::OnAttributeFinish
* @brief xml设置属性
*
* Describe xml文件设置相关属性
*/
virtual void OnInitFinished(pugi::xml_node xmlNode);
/**
* SLink::SDrawText
* @brief
* @param IRenderTarget *pRT --
* @param LPCTSTR pszBuf --
* @param int cchText --
* @param LPRECT pRect -- RECT的指针
* @param UINT uFormat --
*
* Describe DrawText封装
*/
virtual void DrawText(IRenderTarget *pRT,LPCTSTR pszBuf,int cchText,LPRECT pRect,UINT uFormat);
/**
* SLink::OnSetCursor
* @brief
* @param CPoint &pt --
* @return BOOL --TRUE --FALSE
*
* Describe
*/
virtual BOOL OnSetCursor(const CPoint &pt);
void OnLButtonDown(UINT nFlags,CPoint pt);
void OnLButtonUp(UINT nFlags,CPoint pt);
void OnMouseMove(UINT nFlags,CPoint pt);
void OnMouseHover(WPARAM wParam, CPoint ptPos);
SOUI_ATTRS_BEGIN()
ATTR_STRINGT(L"href", m_strLinkUrl, FALSE)
SOUI_ATTRS_END()
SOUI_MSG_MAP_BEGIN()
MSG_WM_LBUTTONDOWN(OnLButtonDown)
MSG_WM_LBUTTONUP(OnLButtonUp)
MSG_WM_MOUSEMOVE(OnMouseMove)
MSG_WM_MOUSEHOVER(OnMouseHover)
SOUI_MSG_MAP_END()
protected:
CRect m_rcText; /**< 文本显示所在位置 */
SStringT m_strLinkUrl; /**< 窗口URL */
};
/**
* @class SButton
* @brief
*
* Describe ID绑定click事件 Use id attribute to process click event
* Usage <button id=xx>inner text example</button>
*/
class SOUI_EXP SButton : public SWindow
, public IAcceleratorTarget
, public ITimelineHandler
{
SOUI_CLASS_NAME(SButton, L"button")
public:
/**
* SButton::SButton
* @brief
*
* Describe
*/
SButton();
protected:
/**
* SButton::NeedRedrawWhenStateChange
* @brief
* @return BOOL --TRUE --FALSE
*
* Describe TRUE
*/
virtual BOOL NeedRedrawWhenStateChange()
{
return TRUE;
}
/**
* SButton::OnGetDlgCode
* @brief
*
* Describe SC_WANTCHARS代表需要WM_CHAR消息
*/
virtual UINT OnGetDlgCode()
{
return SC_WANTCHARS;
}
/**
* SButton::OnAcceleratorPressed
* @brief
* @param CAccelerator& accelerator --
* @return BOOL --TRUE --FALSE
*
* Describe
*/
virtual bool OnAcceleratorPressed(const SAccelerator& accelerator);
virtual BOOL InitFromXml(pugi::xml_node xmlNode);
protected:
/**
* SButton::OnStateChanged
* @brief
* @param DWORD dwOldState --
* @param DWORD dwNewState --
*
* Describe
*/
virtual void OnStateChanged(DWORD dwOldState,DWORD dwNewState);
virtual void OnContainerChanged(ISwndContainer *pOldContainer,ISwndContainer *pNewContainer);
void OnPaint(IRenderTarget *pRT);
void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
void OnDestroy();
void OnSize(UINT nType, CSize size);
BOOL OnEraseBkgnd(IRenderTarget * pRT){return TRUE;}
HRESULT OnAttrAccel(SStringW strAccel,BOOL bLoading);
protected:
virtual void OnNextFrame();
/**
* SLink::StopCurAnimate
* @brief
*
* Describe
*/
void StopCurAnimate();
DWORD m_accel;
BOOL m_bAnimate; /**< 动画标志 */
WORD m_byAlphaAni; /**< 动画状态 */
BYTE m_nAniStep; /**< alpha for an animate step */
BOOL m_bDisableAccelIfInvisible; /**< disable accel if invisible */
public:
SOUI_ATTRS_BEGIN()
ATTR_CUSTOM(L"accel",OnAttrAccel)
ATTR_BOOL(L"animate", m_bAnimate, FALSE)
ATTR_INT(L"animateStep",m_nAniStep,FALSE)
ATTR_BOOL(L"disableAccelIfInvisible",m_bDisableAccelIfInvisible,FALSE)
SOUI_ATTRS_END()
SOUI_MSG_MAP_BEGIN()
MSG_WM_PAINT_EX(OnPaint)
MSG_WM_ERASEBKGND_EX(OnEraseBkgnd)
MSG_WM_LBUTTONDBLCLK(OnLButtonDown) //将双击消息处理为单击
MSG_WM_KEYDOWN(OnKeyDown)
MSG_WM_KEYUP(OnKeyUp)
MSG_WM_DESTROY(OnDestroy)
MSG_WM_SIZE(OnSize)
SOUI_MSG_MAP_END()
};
/**
* @class SImageButton
* @brief
*
* Describe SButton
*/
class SOUI_EXP SImageButton : public SButton
{
SOUI_CLASS_NAME(SImageButton, L"imgbtn")
public:
SImageButton();
protected:
/**
* SButton::GetDesiredSize
* @brief
* @param int wid --
* @param int hei --
*
* Describe
*/
virtual CSize GetDesiredSize(int wid,int hei);
};
/**
* @class SImageWnd
* @brief
*
* Describe Image Control
* Usage Usage: <img skin="skin" sub="0"/>
*/
class SOUI_EXP SImageWnd : public SWindow
{
SOUI_CLASS_NAME(SImageWnd, L"img")
public:
/**
* SImageWnd::SImageWnd
* @brief
*
* Describe
*/
SImageWnd();
/**
* SImageWnd::~SImageWnd
* @brief
*
* Describe
*/
virtual ~SImageWnd();
void OnPaint(IRenderTarget *pRT);
/**
* SImageWnd::SetSkin
* @param ISkinObj *pSkin --
* @param int iFrame --
* @param BOOL bAutoFree -- ID
* @brief
* @return BOOL --TRUE --FALSE
*
* Describe
*/
BOOL SetSkin(ISkinObj *pSkin,int iFrame=0,BOOL bAutoFree=TRUE);
/**
* SImageWnd::SetImage
* @param IBitmap * pBitmap --
* @param FilterLevel fl -- FilterLevel
* @return void
*
* Describe
*/
void SetImage(IBitmap * pBitmap,FilterLevel fl=kNone_FilterLevel);
IBitmap* GetImage();
/**
* SImageWnd::SetIcon
* @param int nSubID -- ID
* @brief
* @return BOOL --TRUE --FALSE
*
* Describe
*/
BOOL SetIcon(int nSubID);
/**
* SImageWnd::GetSkin
* @brief
* @return ISkinObj指针
*
* Describe
*/
ISkinObj * GetSkin(){return m_pSkin;}
protected:
virtual void OnColorize(COLORREF cr);
virtual void OnScaleChanged(int scale);
/**
* SImageWnd::GetDesiredSize
* @brief
* @param LPRECT pRcContainer --
* @return CSize对象
*
* Describe ()
*/
virtual CSize GetDesiredSize(int wid, int hei) ;
int m_iTile; /**<绘制是否平铺,0--位伸(默认),1--不变常规绘制, 2--平铺 */
BOOL m_bManaged; /**< 是否要自动释放当前的m_pSkin对象 */
int m_iIcon; /**< 绘制状态索引 */
SAutoRefPtr<ISkinObj> m_pSkin; /**< ISkinObj对象 */
SAutoRefPtr<IBitmap> m_pImg;/**<使用代码设定的图片*/
FilterLevel m_fl;/**<绘制图片的放大精度*/
bool m_bKeepAspect; /**< keep aspect ratio */
SOUI_ATTRS_BEGIN()
ATTR_SKIN(L"skin", m_pSkin, TRUE)
ATTR_INT(L"iconIndex", m_iIcon, FALSE)
ATTR_INT(L"tile", m_iTile, TRUE)
ATTR_BOOL(L"keepAspect",m_bKeepAspect,TRUE)
SOUI_ATTRS_END()
SOUI_MSG_MAP_BEGIN()
MSG_WM_PAINT_EX(OnPaint)
SOUI_MSG_MAP_END()
};
/**
* @class SAnimateImgWnd
* @brief
*
* Describe
*/
class SOUI_EXP SAnimateImgWnd : public SWindow, public ITimelineHandler
{
SOUI_CLASS_NAME(SAnimateImgWnd, L"animateimg")
public:
/**
* SAnimateImgWnd::SAnimateImgWnd
* @brief
*
* Describe
*/
SAnimateImgWnd();
/**
* SAnimateImgWnd::~SAnimateImgWnd
* @brief
*
* Describe
*/
virtual ~SAnimateImgWnd() {}
/**
* SAnimateImgWnd::Start
* @brief
*
* Describe
*/
void Start();
/**
* SAnimateImgWnd::Stop
* @brief
*
* Describe
*/
void Stop();
/**
* SAnimateImgWnd::IsPlaying
* @brief
* @return TRUE --
*
* Describe
*/
BOOL IsPlaying(){return m_bPlaying;}
protected:
/**
* SAnimateImgWnd::GetDesiredSize
* @brief
* @param LPRECT pRcContainer --
* @return CSize对象
*
* Describe ()
*/
virtual CSize GetDesiredSize(int wid, int hei);
virtual void OnNextFrame();
virtual void OnColorize(COLORREF cr);
virtual void OnContainerChanged(ISwndContainer *pOldContainer,ISwndContainer *pNewContainer);
void OnPaint(IRenderTarget *pRT);
void OnShowWindow(BOOL bShow, UINT nStatus);
void OnDestroy();
SOUI_MSG_MAP_BEGIN()
MSG_WM_PAINT_EX(OnPaint)
MSG_WM_DESTROY(OnDestroy)
MSG_WM_SHOWWINDOW(OnShowWindow)
SOUI_MSG_MAP_END()
SOUI_ATTRS_BEGIN()
ATTR_SKIN(L"skin", m_pSkin, TRUE)
ATTR_UINT(L"speed", m_nSpeed, FALSE)
ATTR_BOOL(L"autoStart", m_bAutoStart, FALSE)
ATTR_INT(L"repeat",m_nRepeat,FALSE)
SOUI_ATTRS_END()
protected:
SAutoRefPtr<ISkinObj> m_pSkin; /**< 动画图片 */
int m_nSpeed; /**< 速度 */
int m_iCurFrame; /**< 当前帧 */
BOOL m_bAutoStart; /**< 是否自动启动 */
BOOL m_bPlaying; /**< 是否运行中 */
int m_iTimeFrame; /**< OnNextFrame的执行次数 */
int m_nRepeat; /**< 播放循环次数,-1代表无限循环 */
int m_iRepeat; /**< 当前播放循环轮次 */
};
/**
* @class SProgress
* @brief
*
* Describe
* Usage: <progress bgskin=xx posskin=xx min=0 max=100 value=10,showpercent=0/>
*/
class SOUI_EXP SProgress : public SWindow
{
SOUI_CLASS_NAME(SProgress, L"progress")
public:
/**
* SProgress::SProgress
* @brief
*
* Describe
*/
SProgress();
/**
* SProgress::SetValue
* @brief
* @param int nValue --
* @return TRUE --
*
* Describe
*/
BOOL SetValue(int nValue);
/**
* SProgress::GetValue
* @brief
* @return int
*
* Describe
*/
int GetValue(){return m_nValue;}
/**
* SProgress::SetRange
* @param int nMin --
* @param int nMax --
* @brief
*
* Describe
*/
void SetRange(int nMin,int nMax);
/**
* SProgress::GetRange
* @param int nMin --
* @param int nMax --
* @brief
*
* Describe
*/
void GetRange(int *pMin,int *pMax);
/**
* SProgress::IsVertical
* @brief
* @return TRUE --
*
* Describe
*/
BOOL IsVertical() const{return m_bVertical;}
protected:
/**
* SProgress::GetDesiredSize
* @brief
* @param int wid --
* @param int hei --
* @return CSize对象
*
* Describe ()
*/
virtual CSize GetDesiredSize(int wid, int hei);
virtual void OnColorize(COLORREF cr);
virtual void OnScaleChanged(int scale);
void OnPaint(IRenderTarget *pRT);
int OnCreate(void*);
int m_nMinValue; /**< 进度最小值 */
int m_nMaxValue; /**< 进度最大值 */
int m_nValue; /**< 进度值 */
BOOL m_bShowPercent; /**< 是否显示百分比 */
BOOL m_bVertical; /**< 是否竖直状态 */
SAutoRefPtr<ISkinObj> m_pSkinBg; /**< 背景资源 */
SAutoRefPtr<ISkinObj> m_pSkinPos; /**< 前景资源 */
SOUI_MSG_MAP_BEGIN()
MSG_WM_PAINT_EX(OnPaint)
MSG_WM_CREATE(OnCreate)
SOUI_MSG_MAP_END()
SOUI_ATTRS_BEGIN()
ATTR_SKIN(L"bkgndSkin", m_pSkinBg, TRUE)
ATTR_SKIN(L"posSkin", m_pSkinPos, TRUE)
ATTR_INT(L"min", m_nMinValue, FALSE)
ATTR_INT(L"max", m_nMaxValue, FALSE)
ATTR_INT(L"value", m_nValue, FALSE)
ATTR_BOOL(L"vertical", m_bVertical, FALSE)
ATTR_BOOL(L"showPercent", m_bShowPercent, FALSE)
SOUI_ATTRS_END()
};
/**
* @class SLine
* @brief 线
*
* Describe 线
* Usage: <hr size=1 mode="vert" lineStyle="dash"/>
*/
class SOUI_EXP SLine : public SWindow
{
SOUI_CLASS_NAME(SLine, L"hr")
public:
/**
* SLine::SLine
* @brief
*
* Describe
*/
SLine();
void OnPaint(IRenderTarget *pRT);
protected:
int m_nLineStyle;
int m_nLineSize;
COLORREF m_crLine;
enum HRMODE{
HR_HORZ=0,
HR_VERT,
HR_TILT,
}m_mode;
SOUI_ATTRS_BEGIN()
ATTR_COLOR(L"colorLine", m_crLine, FALSE)
ATTR_COLOR(L"lineColor", m_crLine, FALSE)
ATTR_INT(L"lineSize", m_nLineSize, FALSE)
ATTR_ENUM_BEGIN(L"mode", HRMODE, FALSE)
ATTR_ENUM_VALUE(L"vertical", HR_VERT)
ATTR_ENUM_VALUE(L"horizontal", HR_HORZ)
ATTR_ENUM_VALUE(L"tilt", HR_TILT)
ATTR_ENUM_END(m_mode)
ATTR_ENUM_BEGIN(L"lineStyle", int, FALSE)
ATTR_ENUM_VALUE(L"solid", PS_SOLID) // default
ATTR_ENUM_VALUE(L"dash", PS_DASH) /* ------- */
ATTR_ENUM_VALUE(L"dot", PS_DOT) /* ....... */
ATTR_ENUM_VALUE(L"dashdot", PS_DASHDOT) /* _._._._ */
ATTR_ENUM_VALUE(L"dashdotdot", PS_DASHDOTDOT) /* _.._.._ */
ATTR_ENUM_END(m_nLineStyle)
SOUI_ATTRS_END()
SOUI_MSG_MAP_BEGIN()
MSG_WM_PAINT_EX(OnPaint)
SOUI_MSG_MAP_END()
};
/**
* @class SCheckBox
* @brief
*
* Describe
* Usage: <check checked="1">This is a check-box</check>
*/
class SOUI_EXP SCheckBox : public SWindow
{
SOUI_CLASS_NAME(SCheckBox, L"check")
enum
{
CheckBoxSpacing = 4,
};
public:
/**
* SCheckBox::SCheckBox
* @brief
*
* Describe
*/
SCheckBox();
protected:
SAutoRefPtr<ISkinObj> m_pSkin; /**< 状态图片资源 */
SAutoRefPtr<ISkinObj> m_pFocusSkin; /**< 焦点状态资源 */
/**
* SCheckBox::GetCheckRect
* @brief
* @return CRect矩形框
*
* Describe
*/
CRect GetCheckRect();
/**
* SCheckBox::GetDesiredSize
* @brief
* @param int wid --
* @param int hei --
* @return CSize对象
*
* Describe ()
*/
virtual CSize GetDesiredSize(int wid, int hei);
/**
* SCheckBox::GetTextRect
* @brief
* @param LPRECT pRect --
*
* Describe
*/
virtual void GetTextRect(LPRECT pRect);
/**
* SCheckBox::NeedRedrawWhenStateChange
* @brief
* @return BOOL
*
* Describe
*/
virtual BOOL NeedRedrawWhenStateChange()
{
return TRUE;
}
/**
* SCheckBox::OnGetDlgCode
* @brief
* @return UINT
*
* Describe
*/
virtual UINT OnGetDlgCode()
{
return SC_WANTCHARS;
}
/**
* SCheckBox::DrawFocus
* @brief
* @param IRenderTarget *pRT --
*
* Describe
*/
virtual void DrawFocus(IRenderTarget *pRT);
virtual void OnColorize(COLORREF cr);
virtual void OnScaleChanged(int nScale);
void OnLButtonUp(UINT nFlags, CPoint point);
void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
void OnPaint(IRenderTarget *pRT);
HRESULT OnAttrCheck(const SStringW& strValue, BOOL bLoading);
SOUI_ATTRS_BEGIN()
ATTR_SKIN(L"skin", m_pSkin, FALSE)
ATTR_SKIN(L"focusSkin", m_pFocusSkin, FALSE)
ATTR_CUSTOM(L"checked",OnAttrCheck)
SOUI_ATTRS_END()
SOUI_MSG_MAP_BEGIN()
MSG_WM_PAINT_EX(OnPaint)
MSG_WM_LBUTTONDBLCLK(OnLButtonDown)
MSG_WM_LBUTTONUP(OnLButtonUp)
MSG_WM_KEYDOWN(OnKeyDown)
SOUI_MSG_MAP_END()
};
/**
* @class SIconWnd
* @brief
*
* Describe
* Usage: <icon src="icon:16" />
*/
class SOUI_EXP SIconWnd : public SWindow
{
SOUI_CLASS_NAME(SIconWnd, L"icon")
public:
/**
* SIconWnd::SIconWnd
* @brief
*
* Describe
*/
SIconWnd();
virtual ~SIconWnd();
void OnPaint(IRenderTarget *pRT);
/**
* SIconWnd::AttachIcon
* @brief
* @param HICON hIcon --
* @return HICON
*
* Describe
*/
void SetIcon(HICON hIcon);
protected:
/**
* SIconWnd::GetDesiredSize
* @brief
* @param int wid --
* @param int hei --
* @return CSize对象
*
* Describe ()
*/
virtual CSize GetDesiredSize(int wid, int hei);
HICON m_theIcon; /**< 图标资源句柄 */
SOUI_ATTRS_BEGIN()
ATTR_ICON(L"src", m_theIcon, FALSE)
SOUI_ATTRS_END()
SOUI_MSG_MAP_BEGIN()
MSG_WM_PAINT_EX(OnPaint)
SOUI_MSG_MAP_END()
};
/**
* @class SRadioBox
* @brief
*
* Describe
* Usage: <radio checked="1">This is a check-box</radio>
*/
class SOUI_EXP SRadioBox : public SWindow
{
SOUI_CLASS_NAME(SRadioBox, L"radio")
public:
/**
* SRadioBox::SRadioBox
* @brief
*
* Describe
*/
SRadioBox();
protected:
/**
* SRadioBox::GetRadioRect
* @brief radio显示位置
*
* Describe
*/
CRect GetRadioRect();
/**
* SRadioBox::GetTextRect
* @brief
* @param LPRECT pRect -- Rect
*
* Describe
*/
virtual void GetTextRect(LPRECT pRect);
/**
* SRadioBox::GetDesiredSize
* @brief
* @param LPRECT pRcContainer -- Rect
*
* Describe
*/
virtual CSize GetDesiredSize(int wid, int hei);
/**
* SRadioBox::NeedRedrawWhenStateChange
* @brief
* @return BOOL
*
* Describe
*/
virtual BOOL NeedRedrawWhenStateChange();
/**
* SRadioBox::DrawFocus
* @brief
* @param IRenderTarget *pRT --
*
* Describe
*/
virtual void DrawFocus(IRenderTarget *pRT);
/**
* SRadioBox::OnGetDlgCode
* @brief
* @return
*
* Describe
*/
virtual UINT OnGetDlgCode()
{
return 0;
}
/**
* SRadioBox::IsSiblingsAutoGroupped
* @brief
* @return BOOL
*
* Describe
*/
virtual BOOL IsSiblingsAutoGroupped() {return TRUE;}
/**
* SRadioBox::GetSelectedSiblingInGroup
* @brief group中有选中状态的兄弟
* @return
*
* Describe NULL
*/
virtual SWindow * GetSelectedSiblingInGroup();
/**
* OnStateChanging
* @brief
* @param DWORD dwOldState --
* @param DWORD dwNewState --
* @return void
*
* Describe
*/
virtual void OnStateChanging(DWORD dwOldState,DWORD dwNewState);
virtual void OnColorize(COLORREF cr);
virtual void OnScaleChanged(int nScale);
protected:
void OnSetFocus(SWND wndOld,SFocusManager::FocusChangeReason reason);
void OnLButtonUp(UINT nFlags,CPoint pt);
void OnPaint(IRenderTarget *pRT);
HRESULT OnAttrCheck(const SStringW& strValue, BOOL bLoading);
SOUI_ATTRS_BEGIN()
ATTR_SKIN(L"skin", m_pSkin, FALSE)
ATTR_SKIN(L"focusSkin", m_pFocusSkin, FALSE)
ATTR_CUSTOM(L"checked",OnAttrCheck)
ATTR_ENUM_BEGIN(L"iconAlign", UINT, TRUE)
ATTR_ENUM_VALUE(L"left", SwndStyle::Align_Left)
ATTR_ENUM_VALUE(L"center", SwndStyle::Align_Center)
ATTR_ENUM_VALUE(L"right", SwndStyle::Align_Right)
ATTR_ENUM_END(m_uIconAlign)
ATTR_ENUM_BEGIN(L"iconValign", UINT, TRUE)
ATTR_ENUM_VALUE(L"top", SwndStyle::VAlign_Top)
ATTR_ENUM_VALUE(L"middle", SwndStyle::VAlign_Middle)
ATTR_ENUM_VALUE(L"bottom", SwndStyle::VAlign_Bottom)
ATTR_ENUM_END(m_uIconVAlign)
ATTR_INT(L"sep",m_nRadioBoxSpacing,TRUE)
SOUI_ATTRS_END()
SOUI_MSG_MAP_BEGIN()
MSG_WM_PAINT_EX(OnPaint)
MSG_WM_LBUTTONUP(OnLButtonUp)
MSG_WM_SETFOCUS_EX2(OnSetFocus)
SOUI_MSG_MAP_END()
protected:
SAutoRefPtr<ISkinObj> m_pSkin; /**< 皮肤资源 */
SAutoRefPtr<ISkinObj> m_pFocusSkin; /**< 焦点皮肤资源 */
UINT m_uIconAlign;
UINT m_uIconVAlign;
int m_nRadioBoxSpacing;
};
class SOUI_EXP SRadioGroup : public SWindow
{
SOUI_CLASS_NAME(SRadioGroup, L"radioGroup")
public:
SRadioGroup();
BOOL Check(int nID);
BOOL Check(LPCTSTR pszName);
BOOL ClearCheck();
protected:
virtual BOOL FireEvent(EventArgs &evt);
virtual void OnInsertChild(SWindow *pChild);
virtual void OnRemoveChild(SWindow *pChild);
};
/**
* @class SToggle
* @brief Toggle控件
*
* Describe Toggle控件
*/
class SOUI_EXP SToggle : public SCheckBox
{
SOUI_CLASS_NAME(SToggle, L"toggle")
public:
/**
* SToggle::SToggle
* @brief
*
* Describe
*/
SToggle();
/**
* SToggle::SetToggle
* @brief Toggle属性
* @param BOOL bToggle -- Toggle特效
* @param BOOL bUpdate -- TRUE
*
* Describe Toggle属性
*/
void SetToggle(BOOL bToggle,BOOL bUpdate=TRUE);
/**
* SToggle::GetToggle
* @brief Toggle属性
* @return BOOL
*
* Describe Toggle属性 Toggle
*/
BOOL GetToggle();
protected:
virtual CSize GetDesiredSize(int wid, int hei);
virtual BOOL NeedRedrawWhenStateChange(){return TRUE;}
protected:
void OnPaint(IRenderTarget *pRT);
SOUI_MSG_MAP_BEGIN()
MSG_WM_PAINT_EX(OnPaint)
SOUI_MSG_MAP_END()
};
/**
* @class SGroup
* @brief
*
* Describe
* Usage <group colorLine1="#b8d5e2" colorLine2="#999999">group text</>
*/
class SOUI_EXP SGroup : public SWindow
{
SOUI_CLASS_NAME(SGroup, L"group")
public:
SGroup();
protected:
virtual CRect GetChildrenLayoutRect() const;
virtual CSize GetDesiredSize(int nParentWid, int nParentHei);
void OnPaint(IRenderTarget *pRT);
COLORREF m_crLine1,m_crLine2; /**< group 3D显示使用的两种颜色 */
SLayoutSize m_nRound; /**< 圆角半径 */
SLayoutSize m_nHeaderHeight; /**< 头部高度 */
public:
SOUI_ATTRS_BEGIN()
ATTR_COLOR(L"colorLine1", m_crLine1, FALSE)
ATTR_COLOR(L"colorLine2", m_crLine2, FALSE)
ATTR_LAYOUTSIZE(L"round",m_nRound,FALSE)
ATTR_LAYOUTSIZE(L"headerHeight",m_nHeaderHeight,TRUE)
SOUI_ATTRS_END()
SOUI_MSG_MAP_BEGIN()
MSG_WM_PAINT_EX(OnPaint)
SOUI_MSG_MAP_END()
};
}//namespace SOUI