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

113 lines
3.3 KiB

5 months ago
#pragma once
#include "interface/slayout-i.h"
#include "SouiLayoutParamStruct.h"
namespace SOUI{
class SouiLayoutParam: public SObjectImpl<TObjRefImpl<ILayoutParam>>
, protected SouiLayoutParamStruct
{
SOUI_CLASS_NAME(SouiLayoutParam,L"SouiLayoutParam")
friend class SouiLayout;
public:
SouiLayoutParam();
virtual bool IsMatchParent(ORIENTATION orientation) const;
virtual bool IsSpecifiedSize(ORIENTATION orientation) const;
virtual bool IsWrapContent(ORIENTATION orientation) const;
virtual SLayoutSize GetSpecifiedSize(ORIENTATION orientation) const;
virtual void Clear();
virtual void SetMatchParent(ORIENTATION orientation);
virtual void SetWrapContent(ORIENTATION orientation);
virtual void SetSpecifiedSize(ORIENTATION orientation, const SLayoutSize& layoutSize);
virtual void * GetRawData();
virtual ILayoutParam * Clone() const;
public:
bool IsOffsetRequired(ORIENTATION orientation) const;
int GetExtraSize(ORIENTATION orientation,int nScale) const;
protected:
HRESULT OnAttrWidth(const SStringW & strValue,BOOL bLoading);
HRESULT OnAttrHeight(const SStringW & strValue,BOOL bLoading);
HRESULT OnAttrSize(const SStringW & strValue,BOOL bLoading);
HRESULT OnAttrPos(const SStringW & strValue,BOOL bLoading);
HRESULT OnAttrOffset(const SStringW & strValue,BOOL bLoading);
SOUI_ATTRS_BEGIN()
ATTR_CUSTOM(L"width",OnAttrWidth)
ATTR_CUSTOM(L"height",OnAttrHeight)
ATTR_CUSTOM(L"pos",OnAttrPos)
ATTR_CUSTOM(L"size",OnAttrSize)
ATTR_CUSTOM(L"offset",OnAttrOffset)
SOUI_ATTRS_BREAK()
protected:
//将字符串描述的坐标转换成POSITION_ITEM
BOOL StrPos2ItemPos(const SStringW &strPos,POS_INFO & posItem);
//解析在pos中定义的前两个位置
BOOL ParsePosition12(const SStringW & pos1, const SStringW &pos2);
//解析在pos中定义的后两个位置
BOOL ParsePosition34(const SStringW & pos3, const SStringW &pos4);
};
class SOUI_EXP SouiLayout: public SObjectImpl<TObjRefImpl<ILayout>>
{
SOUI_CLASS_NAME_EX(SouiLayout,L"SouiLayout",Layout)
public:
SouiLayout(void);
~SouiLayout(void);
virtual bool IsParamAcceptable(ILayoutParam *pLayoutParam) const;
virtual void LayoutChildren(SWindow * pParent);
virtual ILayoutParam * CreateLayoutParam() const;
virtual CSize MeasureChildren(const SWindow * pParent,int nWidth,int nHeight) const;
protected:
struct WndPos{
SWindow *pWnd;
CRect rc;
bool bWaitOffsetX;
bool bWaitOffsetY;
};
void CalcPositionEx(SList<WndPos> *pListChildren,int nWidth,int nHeight) const;
int CalcPostion(SList<WndPos> *pListChildren,int nWidth,int nHeight) const;
int PositionItem2Value(SList<WndPos> *pLstChilds,SPOSITION position,const POS_INFO &pos , int nMax,BOOL bX,int nScale) const;
int CalcChildLeft(SWindow *pWindow,SouiLayoutParam *pParam);
int CalcChildRight(SWindow *pWindow,SouiLayoutParam *pParam);
int CalcChildTop(SWindow *pWindow,SouiLayoutParam *pParam);
int CalcChildBottom(SWindow *pWindow,SouiLayoutParam *pParam);
BOOL IsWaitingPos( int nPos ) const;
SWindow * GetRefSibling(SWindow *pCurWnd,int uCode);
CRect GetWindowLayoutRect(SWindow *pWindow);
};
}