用于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.

316 lines
7.6 KiB

5 months ago
/**
* Copyright (C) 2014-2050 SOUI团队
* All rights reserved.
*
* @file SSplitWnd.h
* @brief
* @version v1.0
* @author soui
* @date 2014-07-08
*
* Describe
*/
#pragma once
#include <core/swnd.h>
#include <layout/slayoutsize.h>
namespace SOUI
{
/**
* @class SSplitPane
* @brief
*
* Describe
*/
class SOUI_EXP SSplitPane : public SWindow
{
friend class SSplitWnd;
SOUI_CLASS_NAME(SSplitPane, L"pane")
public:
/**
* SSplitPane::SSplitPane
* @brief
*
* Describe
*/
SSplitPane();
/**
* SSplitPane::~SSplitPane
* @brief
*
* Describe
*/
virtual ~SSplitPane() {}
void Move(CRect rc);
SOUI_ATTRS_BEGIN()
ATTR_LAYOUTSIZE(L"idealSize", m_nSizeIdeal, FALSE)
ATTR_LAYOUTSIZE(L"minSize", m_nSizeMin, FALSE)
ATTR_LAYOUTSIZE(L"maxSize", m_nSizeMax,FALSE)
ATTR_INT(L"priority", m_nPriority, FALSE)
SOUI_ATTRS_END()
protected:
SLayoutSize m_nSizeIdeal; /**< 理想大小 */
SLayoutSize m_nSizeMin; /**< 最小大小 */
SLayoutSize m_nSizeMax; /**< 最大大小 */
int m_nPriority; /**< 优先级,值越大优先级越高,优先级越高,窗格越先到达idealSize */
};
/**
* @class SSplitWnd
* @brief
*
* Describe
*/
class SOUI_EXP SSplitWnd :
public SWindow
{
SOUI_CLASS_NAME(SSplitWnd, L"splitwnd")
enum SPLIT_ORINTATION
{
Horizontal=0,
Vertical,
};
//窗口的SIZE信息
struct PANESIZE
{
int actural;
int preferred;
int minimum;
int maximum;
};
typedef SArray<PANESIZE> PANESIZELIST;
protected:
typedef SArray<SSplitPane*> SplitPaneList;
SplitPaneList m_lstPane; /**< 按显示顺序排序的分隔列表 */
SplitPaneList m_lstPriority; /**< 按优先级排序的分隔列表 */
int m_spliterSize; /**< 分隔条的size */
int m_orintation; /**< 分割方向,参考 SPLIT_ORINTATION */
BOOL m_bAdjustable; /**< 是否支持拖动调节窗格大小 */
SAutoRefPtr<ISkinObj> m_pSkinSep; /**< ISkinObj对象 */
CPoint m_ptDragPrev; /**< 拖动调整的前一个位置 */
int m_iDragSep; /**< 正在拖动哪一根分隔条,-1代表没有拖动状态 */
public:
/**
* SSplitWnd::SSplitWnd
* @brief
*
* Describe
*/
SSplitWnd(void);
/**
* SSplitWnd::~SSplitWnd
* @brief
*
* Describe
*/
virtual ~SSplitWnd(void);
SSplitPane * GetPane(UINT iPane);
/**
* SSplitWnd::ShowPane
* @brief pane
* @param UINT iPane -- pane index
* @return BOOL
*
* Describe pane
*/
BOOL ShowPane(UINT iPane);
/**
* SSplitWnd::HidePane
* @brief pane
* @param UINT iPane -- panel index
* @return BOOL
*
* Describe pane
*/
BOOL HidePane(UINT iPane);
/**
* SSplitWnd::PaneIndex
* @brief Pane的索引
* @param const SStringW & strName -- Pane的name
* @return int -- Pane的索引
* Describe
*/
int PaneIndex(const SStringW & strName) const;
/**
* SSplitWnd::InsertItem
* @brief
* @param SSplitPane* pane --
* @param int index --
* @return int -- Pane的索引
* Describe
*/
int InsertItem( SSplitPane* pane, int index = -1 );
/**
* SSplitWnd::RemoveItem
* @brief
* @param SSplitPane* pane --
* @return void
* Describe
*/
void RemoveItem( SSplitPane * pane );
protected:
virtual CRect GetChildrenLayoutRect() const;
/**
* SSplitWnd::UpdateChildrenPosition
* @brief
*
* Describe
*/
virtual void UpdateChildrenPosition();
/**
* SSplitWnd::CreateChildren
* @brief panel
* @param pugi::xml_node xmlNode -- xml文件
* @return BOOL
*
* Describe panel
*/
virtual BOOL CreateChildren(pugi::xml_node xmlNode);
/**
* SSplitWnd::OnSetCursor
* @brief
* @param const CPoint &pt --
* @return BOOL
*
* Describe
*/
virtual BOOL OnSetCursor(const CPoint &pt);
/**
* SSplitWnd::OnPaint
* @brief
* @param IRenderTarget * pRT --
*
* Describe
*/
void OnPaint(IRenderTarget * pRT);
/**
* SSplitWnd::OnLButtonDown
* @brief
* @param UINT nFlags --
* @param CPoint point --
*
* Describe
*/
void OnLButtonDown(UINT nFlags,CPoint pt);
/**
* SSplitWnd::OnLButtonUp
* @brief
* @param UINT nFlags --
* @param CPoint point --
*
* Describe
*/
void OnLButtonUp(UINT nFlags,CPoint pt);
/**
* SSplitWnd::OnMouseMove
* @brief
* @param UINT nFlags --
* @param CPoint point --
*
* Describe
*/
void OnMouseMove(UINT nFlags,CPoint pt);
protected:
//qsort比较函数
static int FunComp(const void * p1,const void * p2);
//将一个SplitPaneList按照优先级从大到小排序
void SortPriorityList(SplitPaneList & lstPane);
//从SplitPaneList获取size信息
void FatchPaneSizeInfo(const SplitPaneList & lstPane, PANESIZELIST & lstPaneSize);
//根据计算获得的窗格size信息设置窗格位置
int ResetPanesPostion(SplitPaneList & lstPane, SplitPaneList & lstPanePriority, PANESIZELIST & lstPaneSize, int offset);
//调整列表中控件的高度(宽度)
int AdjustPanesSize(PANESIZELIST & lstPriority, int remain);
//重新布局
void Relayout(const CRect &rc,PANESIZELIST lstPaneSize=PANESIZELIST());
public:
SOUI_ATTRS_BEGIN()
ATTR_INT(L"sepSize", m_spliterSize, TRUE)
ATTR_SKIN(L"sepSkin",m_pSkinSep,TRUE)
ATTR_BOOL(L"adjustable", m_bAdjustable, TRUE)
ATTR_INT(L"vertical", m_orintation, TRUE)
SOUI_ATTRS_END()
SOUI_MSG_MAP_BEGIN()
MSG_WM_PAINT_EX(OnPaint)
MSG_WM_LBUTTONDOWN(OnLButtonDown)
MSG_WM_LBUTTONUP(OnLButtonUp)
MSG_WM_MOUSEMOVE(OnMouseMove)
SOUI_MSG_MAP_END()
};
/**
* @class SSplitWnd_Col
* @brief
*
* Describe
*/
class SOUI_EXP SSplitWnd_Col : public SSplitWnd
{
SOUI_CLASS_NAME(SSplitWnd_Col, L"splitcol")
public:
SSplitWnd_Col()
{
m_pSkinSep= GETBUILTINSKIN(SKIN_SYS_SPLIT_VERT);
m_orintation=Vertical;
}
};
/**
* @class SSplitWnd_Row
* @brief
*
* Describe
*/
class SOUI_EXP SSplitWnd_Row : public SSplitWnd
{
SOUI_CLASS_NAME(SSplitWnd_Row, L"splitrow")
public:
SSplitWnd_Row()
{
m_pSkinSep=GETBUILTINSKIN(SKIN_SYS_SPLIT_HORZ);
m_orintation=Horizontal;
}
};
}//namespace SOUI