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

162 lines
4.0 KiB

5 months ago
#include "stdafx.h"
#include "SSplitBar.h"
#include <layout\SouiLayoutParamStruct.h>
#include <layout\SouiLayout.h>
namespace SOUI
{
SSplitBar::SSplitBar():m_bDragging(FALSE)
,m_bResizeHostWnd(FALSE)
,m_nSizeMin(0)
,m_nSizeMax(0)
,m_bVertical(FALSE)
{
}
SSplitBar::~SSplitBar()
{
}
LRESULT SSplitBar::OnCreate( LPVOID )
{
if(0 != __super::OnCreate(NULL)) return 1;
ORIENTATION pi = m_bVertical ? Vert : Horz;
m_nOrginPos = GetLayoutParam()->GetSpecifiedSize(pi).toPixelSize(GetScale());
m_nTrackingPos = m_nOrginPos;
return 0;
}
BOOL SSplitBar::OnSetCursor(const CPoint &pt)
{
HCURSOR hCursor=GETRESPROVIDER->LoadCursor(m_bVertical?IDC_SIZEWE:IDC_SIZENS);
SetCursor(hCursor);
return TRUE;
}
void SSplitBar::OnLButtonDown(UINT nFlags,CPoint pt)
{
SWindow::OnLButtonDown(nFlags, pt);
m_ptDragPrev = pt;
m_bDragging = TRUE;
}
void SSplitBar::OnLButtonUp(UINT nFlags,CPoint pt)
{
SWindow::OnLButtonUp(nFlags, pt);
m_bDragging = FALSE;
ORIENTATION pi = m_bVertical ? Vert : Horz;
m_nOrginPos = GetLayoutParam()->GetSpecifiedSize(pi).toPixelSize(GetScale());
m_nTrackingPos = m_nOrginPos;
}
void SSplitBar::OnMouseMove(UINT nFlags,CPoint pt)
{
SWindow::OnMouseMove(nFlags, pt);
static int nLastUpdateTicks = 0;
int now = GetTickCount();
if (now - nLastUpdateTicks < 30 || !m_bDragging)
{
return;
}
nLastUpdateTicks = now;
int nWindowOffset = 0;
int nOffset = 0;
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>ƫ<EFBFBD><EFBFBD>
if (m_bVertical)
nOffset = pt.x - m_ptDragPrev.x;
else
nOffset = pt.y - m_ptDragPrev.y;
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>λ<EFBFBD><EFBFBD>
//SwndLayout * pLayout = GetLayout();
ORIENTATION pi = m_bVertical ? Vert : Horz;
SouiLayoutParamStruct* pLayout = (SouiLayoutParamStruct*)GetLayoutParamT<SouiLayoutParam>()->GetRawData();
int nNewPos = m_nOrginPos + nOffset * pLayout->posLeft.cMinus;
/*
* - <EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<EFBFBD><EFBFBD>Ҫ<EFBFBD>޸<EFBFBD>hostwnd<EFBFBD>ijߴ<EFBFBD>,top/left<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-XXX<EFBFBD>ķ<EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߼<EFBFBD><EFBFBD>Ƚϸ<EFBFBD><EFBFBD>ӣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>Ҳ<EFBFBD><EFBFBD><EFBFBD>ú<EFBFBD><EFBFBD><EFBFBD>@_@
*
* - <EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>޸<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>left/top<EFBFBD><EFBFBD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FBD><EFBFBD><EFBFBD>ڼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>5px<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>295<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD>λ<EFBFBD>ñ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>190
*
* - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>maxsize<EFBFBD><EFBFBD>minisize<EFBFBD>Ŀ<EFBFBD><EFBFBD>ơ<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>bottom/right<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>ò<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD>
* ʹ<EFBFBD>õĽǶȽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>г<EFBFBD><EFBFBD><EFBFBD> [maxsize,minisize] <EFBFBD>ķ<EFBFBD>Χ<EFBFBD><EFBFBD>
*/
HWND hWnd = GetContainer()->GetHostHwnd();
BOOL bZoomed = ::IsZoomed(hWnd);
BOOL bResizeWnd = m_bResizeHostWnd && !bZoomed;
if (!(bResizeWnd && pLayout->posLeft.cMinus < 0))
{
if (nNewPos > m_nSizeMax)
nNewPos = m_nSizeMax;
if (nNewPos < m_nSizeMin)
nNewPos = m_nSizeMin;
if (nNewPos == pLayout->posLeft.nPos.toPixelSize(100))
return;
pLayout->posLeft.nPos = nNewPos;
}
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
nWindowOffset = nNewPos - m_nTrackingPos;
nWindowOffset *= pLayout->posLeft.cMinus;
m_nTrackingPos = nNewPos;
if (bResizeWnd)
ResizeHostWindow(nWindowOffset);
else
RequestRelayout();
}
void SSplitBar::ResizeHostWindow(int nOffset)
{
if ( m_bResizeHostWnd && nOffset != 0)
{
HWND hWnd = GetContainer()->GetHostHwnd();
CRect rcWnd;
::GetWindowRect(hWnd, rcWnd);
if (m_bVertical)
{
::MoveWindow(hWnd,
rcWnd.left,
rcWnd.top,
rcWnd.Width() + nOffset,
rcWnd.Height(),
TRUE);
}
else
{
::MoveWindow(hWnd,
rcWnd.left,
rcWnd.top,
rcWnd.Width(),
rcWnd.Height() + nOffset,
TRUE);
}
}
}
}//namespace SOUI