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

503 lines
23 KiB

5 months ago
<EFBFBD><EFBFBD>/**
* Copyright (C) 2014-2050 SOUI<EFBFBD>V<EFBFBD>
* All rights reserved.
*
* @file SListboxex.h
* @brief
* @version v1.0
* @author soui
* @date 2014-07-06
*
* Describe ibU\Rh<EFBFBD>Fh
*/
#pragma once
#include "core/SPanel.h"
#include "core/Sitempanel.h"
namespace SOUI
{
class EventLBGetDispInfo : public TplEventArgs<EventLBGetDispInfo>
{
SOUI_CLASS_NAME(EventLBGetDispInfo,L"on_listbox_get_display_info")
public:
EventLBGetDispInfo(SObject *pSender):TplEventArgs<EventLBGetDispInfo>(pSender){}
enum{EventID=EVT_EXTERNAL_BEGIN+301};
int iItem;
SWindow * pItem;
BOOL bSel;
BOOL bHover;
};
/**
* @class SListBox
* @brief ibU\Rh<EFBFBD>Fh
*
* Describe ibU\Rh<EFBFBD>Fh
*/
class SListBoxEx :public SScrollView
,public IItemContainer
{
public:
SOUI_CLASS_NAME(SListBoxEx, L"listboxex")
/**
* SListBoxEx::SListBox
* @brief <EFBFBD>g <EFBFBD><EFBFBD>Qpe
*
* Describe <EFBFBD>g <EFBFBD><EFBFBD>Qpe
*/
SListBoxEx();
/**
* SListBox::~SListBox
* @brief <EFBFBD>g<EFBFBD>g<EFBFBD>Qpe
*
* Describe <EFBFBD>g<EFBFBD>g<EFBFBD>Qpe
*/
virtual ~SListBoxEx();
/**
* SListBoxEx::DeleteAllItems
* @brief Rd<EFBFBD>@b g
* @param BOOL bUpdate -- /f&T<EFBFBD>f<EFBFBD>e
*
* Describe Rd<EFBFBD>@b g
*/
void DeleteAllItems(BOOL bUpdate=TRUE);
/**
* SListBoxEx::DeleteItem
* @brief Rd<EFBFBD>c<EFBFBD>[y<EFBFBD>
* @param int iItem -- "}_
*
* Describe Rd<EFBFBD>c<EFBFBD>[y<EFBFBD>
*/
void DeleteItem(int iItem);
/**
* SListBoxEx::InsertItem
* @brief <EFBFBD>ceQ<EFBFBD>ey<EFBFBD>
* @param int iItem -- "}_
* @param pugi::xml_node xmlNode -- xml<EFBFBD>e<EFBFBD>N
* @param DWORD dwData -- D<EFBFBD><EFBFBD>Rpenc
*
* Describe (W<EFBFBD>gy<EFBFBD>KNT<EFBFBD>ceQ
*/
int InsertItem(int iItem,pugi::xml_node xmlNode,LPARAM dwData=0);
/**
* SListBoxEx::InsertItem
* @brief <EFBFBD>ceQ<EFBFBD>ey<EFBFBD>
* @param int iItem -- "}_
* @param LPCWSTR pszXml -- xml<EFBFBD>e<EFBFBD>N
* @param DWORD dwData -- D<EFBFBD><EFBFBD>Rpenc
*
* Describe (W<EFBFBD>gy<EFBFBD>KNT<EFBFBD>ceQ
*/
int InsertItem(int iItem,LPCWSTR pszXml,LPARAM dwData=0);
/**
* SListBoxEx::SetCurSel
* @brief <EFBFBD><EFBFBD>n <EFBFBD>-Ny<EFBFBD>
* @param int nIndex -- <EFBFBD>_ <EFBFBD>-N"}_
*
* Describe <EFBFBD><EFBFBD>n <EFBFBD>-Ny<EFBFBD>
*/
BOOL SetCurSel(int iItem);
/**
* SListBoxEx::EnsureVisible
* @brief <EFBFBD><EFBFBD>n<EFBFBD>gy<EFBFBD>>f:y
* @param int nIndex -- "}_
*
* Describe <EFBFBD><EFBFBD>n<EFBFBD>gy<EFBFBD>>f:y
*/
void EnsureVisible(int iItem);
/**
* SListBoxEx::GetCurSel
* @brief <EFBFBD><EFBFBD><EFBFBD>SS_MR <EFBFBD>-Ny<EFBFBD>"}_
* @return ԏ<EFBFBD>Vint
*
* Describe <EFBFBD><EFBFBD><EFBFBD>SS_MR <EFBFBD>-Ny<EFBFBD>"}_
*/
int GetCurSel();
/**
* SListBoxEx::GetItemPanel
* @brief <EFBFBD><EFBFBD><EFBFBD>Sc<EFBFBD>[y<EFBFBD><EFBFBD>~<EFBFBD>g
* @param int iItem -- "}_
* @return ԏ<EFBFBD>VSWindow
*
* Describe <EFBFBD><EFBFBD><EFBFBD>Sc<EFBFBD>[y<EFBFBD>"}_
*/
SWindow * GetItemPanel(int iItem);
/**
* SListBoxEx::GetItemData
* @brief <EFBFBD><EFBFBD><EFBFBD>SD<EFBFBD><EFBFBD>Rpenc
* @param int nIndex -- <EFBFBD>y<EFBFBD>"}_
* @return ԏ<EFBFBD>VLPARAM
*
* Describe <EFBFBD><EFBFBD><EFBFBD>SD<EFBFBD><EFBFBD>Rpenc
*/
LPARAM GetItemData(int iItem);
/**
* SListBoxEx::SetItemData
* @brief <EFBFBD><EFBFBD>n <EFBFBD>y<EFBFBD>D<EFBFBD><EFBFBD>Rpenc
* @param int nIndex -- <EFBFBD>y<EFBFBD>"}_
* @param LPARAM lParam -- D<EFBFBD><EFBFBD>Rpenc
* @return ԏ<EFBFBD>VBOOL
*
* Describe <EFBFBD><EFBFBD>n <EFBFBD>y<EFBFBD>D<EFBFBD><EFBFBD>Rpenc
*/
void SetItemData(int iItem,LPARAM lParam);
/**
* SListBoxEx::SetItemCount
* @brief <EFBFBD><EFBFBD>nag<EFBFBD>vpeϑ
* @param int nItems ag<EFBFBD>vpeϑ
* @param LPCTSTR pszXmlTemplate >f:y<EFBFBD>eO(u<EFBFBD>vXML!jg <EFBFBD>
* :Nzz<EFBFBD>eO(uXML<EFBFBD>,g-Nc<EFBFBD>[<EFBFBD>vtemplateP[<EFBFBD><EFBFBD><EFBFBD>ppenc
* @return <EFBFBD><EFBFBD>nag<EFBFBD>vpeϑ
*
* Describe <EFBFBD><EFBFBD>n <EFBFBD>y<EFBFBD>D<EFBFBD><EFBFBD>Rpenc
*/
BOOL SetItemCount(int nItems,LPCTSTR pszXmlTemplate=NULL);
/**
* SListBoxEx::GetItemCount
* @brief <EFBFBD><EFBFBD><EFBFBD>Sag<EFBFBD>vpeϑ
* @return ԏ<EFBFBD>V int
*
* Describe <EFBFBD><EFBFBD><EFBFBD>Sag<EFBFBD>vpeϑ
*/
int GetItemCount() ;
/**
* SListBoxEx::GetItemHeight
* @brief <EFBFBD><EFBFBD><EFBFBD>Sؚ<EFBFBD>^
* @return ԏ<EFBFBD>Vint
*
* Describe <EFBFBD><EFBFBD><EFBFBD>Sؚ<EFBFBD>^
*/
int GetItemHeight()
{
return m_nItemHei;
}
/**
* SListBoxEx::RedrawItem
* @brief ͑<EFBFBD>~ <EFBFBD>y<EFBFBD>
* @param int iItem -- "}_
*
* Describe ͑<EFBFBD>~ <EFBFBD>y<EFBFBD>
*/
void RedrawItem(int iItem);
/**
* SListBoxEx::HitTest
* @brief <EFBFBD><EFBFBD><EFBFBD>S <EFBFBD>h<EFBFBD>vsQ<EFBFBD>Oo`
* @param CPoint &pt -- PWh
*
* Describe R<EFBFBD>O9ept<EFBFBD>vMOn:N<EFBFBD>v<EFBFBD>[S_MRy<EFBFBD><EFBFBD>vOP<EFBFBD>
*/
int HitTest(CPoint &pt);
protected:
/**
* SListBoxEx::OnItemSetCapture
* @brief
* @param SItemPanel *pItem
* @param BOOL bCapture
*
* Describe
*/
virtual void OnItemSetCapture(SItemPanel *pItem,BOOL bCapture);
/**
* SListBoxEx::OnItemGetRect
* @brief
* @param SItemPanel *pItem
* @param CRect &rcItem
*
* Describe
*/
virtual BOOL OnItemGetRect(SItemPanel *pItem,CRect &rcItem);
/**
* SListBoxEx::IsItemRedrawDelay
* @brief
*
* Describe
*/
virtual BOOL IsItemRedrawDelay(){return m_bItemRedrawDelay;}
virtual void OnItemRequestRelayout(SItemPanel *pItem);
protected:
/**
* SListBoxEx::UpdatePanelsIndex
* @brief <EFBFBD>f<EFBFBD>e"}_
* @param UINT nFirst
* @param UINT nLast
*
* Describe <EFBFBD>f<EFBFBD>e"}_
*/
void UpdatePanelsIndex(UINT nFirst=0,UINT nLast=-1);
/**
* SListBoxEx::GetItemRect
* @brief <EFBFBD><EFBFBD><EFBFBD>Sc<EFBFBD>[MOn
* @param int iItem -- "}_
* @return ԏ<EFBFBD>VCRect
*
* Describe <EFBFBD>f<EFBFBD>e"}_
*/
CRect GetItemRect(int iItem);
/**
* SListBoxEx::OnPaint
* @brief <EFBFBD>~6R
* @param IRenderTarget *pRT -- <EFBFBD>~6R<EFBFBD><EFBFBD>Y
*
* Describe <EFBFBD>mo`<EFBFBD>T<EFBFBD>^<EFBFBD>Qpe
*/
void OnPaint(IRenderTarget * pRT);
/**
* SListBoxEx::OnSize
* @brief <EFBFBD>mo`<EFBFBD>T<EFBFBD>^<EFBFBD>Qpe
* @param UINT nType --
* @param CSize size --
*
* Describe <EFBFBD><EFBFBD><EFBFBD>S<EFBFBD>gy<EFBFBD><EFBFBD>_"}_
*/
void OnSize(UINT nType, CSize size);
/**
* SListBoxEx::DrawItem
* @brief <EFBFBD>~6R
* @param IRenderTarget *pRT -- <EFBFBD>~6R<EFBFBD><EFBFBD>Y
* @param CRect & rc -- MOn
* @param int iItem -- "}_
*
* Describe <EFBFBD>~6R
*/
virtual void DrawItem(IRenderTarget *pRT, CRect & rc, int iItem);
/**
* SListBoxEx::CreateChildren
* @brief R<EFBFBD>^<EFBFBD>ey<EFBFBD>
* @param pugi::xml_node xmlNode -- xml<EFBFBD>e<EFBFBD>N
*
* Describe <EFBFBD>Ǐgxml<EFBFBD>e<EFBFBD>NR<EFBFBD>^
*/
virtual BOOL CreateChildren(pugi::xml_node xmlNode);
/**
* SListBoxEx::OnUpdateToolTip
* @brief <EFBFBD>f<EFBFBD>e<EFBFBD>c:y
* @param CPoint pt -- a<EFBFBD>^MOn
* @param SwndToolTipInfo & tipInfo -- <EFBFBD>c:y<EFBFBD>Oo`
* @return BOOL
*
* Describe
*/
virtual BOOL OnUpdateToolTip(CPoint pt, SwndToolTipInfo & tipInfo);
/**
* SListBoxEx::NotifySelChange
* @brief <EFBFBD>O9e <EFBFBD>-Ny<EFBFBD>
* @param int nOldSel -- <EFBFBD>e <EFBFBD>-Ny<EFBFBD>
* @param int nNewSel -- <EFBFBD>e <EFBFBD>-Ny<EFBFBD>
*
* Describe <EFBFBD>O9e <EFBFBD>-Ny<EFBFBD>
*/
void NotifySelChange(int nOldSel,int nNewSel);
/**
* SListBoxEx::OnMouseEvent
* @brief [IN<EFBFBD>mo`<EFBFBD>T<EFBFBD>^<EFBFBD>Qpe
* @param UINT uMsg -- <EFBFBD>h<EFBFBD>mo`{|<EFBFBD>W
* @param WPARAM wParam -- wParam
* @param LPARAM lParam -- lParam
* @return ԏ<EFBFBD>VLRESULT
*
* Describe [IN<EFBFBD>mo`<EFBFBD>T<EFBFBD>^<EFBFBD>Qpe
*/
LRESULT OnMouseEvent(UINT uMsg,WPARAM wParam,LPARAM lParam);
/**
* SListBoxEx::OnKeyEvent
* @brief [IN<EFBFBD>mo`<EFBFBD>T<EFBFBD>^<EFBFBD>Qpe
* @param UINT uMsg -- .<EFBFBD><EFBFBD>v<EFBFBD>mo`{|<EFBFBD>W
* @param WPARAM wParam -- wParam
* @param LPARAM lParam -- lParam
* @return ԏ<EFBFBD>VLRESULT
*
* Describe [IN<EFBFBD>mo`<EFBFBD>T<EFBFBD>^<EFBFBD>Qpe
*/
LRESULT OnKeyEvent( UINT uMsg,WPARAM wParam,LPARAM lParam );
/**
* SListBoxEx::OnMouseLeave
* @brief [IN<EFBFBD>mo`<EFBFBD>T<EFBFBD>^<EFBFBD>Qpe
*
* Describe [IN<EFBFBD>mo`<EFBFBD>T<EFBFBD>^<EFBFBD>Qpe
*/
void OnMouseLeave();
/**
* SListBoxEx::OnMouseWheel
* @brief <EFBFBD>h<EFBFBD>nn<EFBFBD><EFBFBD>N<EFBFBD>N
* @param UINT nFlags -- h<EFBFBD>_
* @param short zDelta -- <EFBFBD>nn<EFBFBD><EFBFBD>n<EFBFBD>R<EFBFBD><EFBFBD>y
* @param CPoint pt -- PWh
* @return ԏ<EFBFBD>VBOOL
*
* Describe <EFBFBD>h<EFBFBD>nn<EFBFBD><EFBFBD>N<EFBFBD>N
*/
BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
/**
* SListBoxEx::OnKeyDown
* @brief c.<EFBFBD> c N
* @param TCHAR nChar -- .<EFBFBD>x<P
* @param UINT nRepCnt -- ͑ Y!kpe
* @param UINT nFlags -- h<EFBFBD>_
*
* Describe <EFBFBD>mo`<EFBFBD>T<EFBFBD>^<EFBFBD>Qpe
*/
void OnKeyDown( TCHAR nChar, UINT nRepCnt, UINT nFlags );
/**
* SListBoxEx::OnChar
* @brief c.<EFBFBD> c N
* @param TCHAR nChar -- .<EFBFBD>x<P
* @param UINT nRepCnt -- ͑ Y!kpe
* @param UINT nFlags -- h<EFBFBD>_
*
* Describe <EFBFBD>mo`<EFBFBD>T<EFBFBD>^<EFBFBD>Qpe
*/
void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
/**
* SListBoxEx::OnGetDlgCode
* @brief <EFBFBD><EFBFBD><EFBFBD>S<EFBFBD>z<EFBFBD>S<EFBFBD>mo`x
* @param ԏ<EFBFBD>VUINT
*
* Describe <EFBFBD><EFBFBD><EFBFBD>S<EFBFBD>z<EFBFBD>S<EFBFBD>mo`x
*/
UINT OnGetDlgCode();
/**
* SListBoxEx::OnSetCursor
* @brief <EFBFBD><EFBFBD>n <EFBFBD>hMOn
* @param ԏ<EFBFBD>VBOOL
*
* Describe <EFBFBD><EFBFBD>n <EFBFBD>hMOn
*/
virtual BOOL OnSetCursor(const CPoint &pt);
/**
* SListBoxEx::OnViewOriginChanged
* @brief
* @param CPoint ptOld --
* @param CPoint ptNew --
*
* Describe
*/
virtual void OnViewOriginChanged(CPoint ptOld,CPoint ptNew);
/**
* SListBoxEx::OnDestroy
* @brief <EFBFBD><EFBFBD>k
*
* Describe <EFBFBD><EFBFBD>k
*/
void OnDestroy();
/**
* SListBoxEx::OnSetFocus
* @brief <EFBFBD><EFBFBD><EFBFBD>_&q<EFBFBD>p
*
* Describe <EFBFBD><EFBFBD><EFBFBD>_&q<EFBFBD>p
*/
void OnSetFocus(SWND wndOld);
/**
* SListBoxEx::OnKillFocus
* @brief 1Y<EFBFBD>S&q<EFBFBD>p
*
* Describe 1Y<EFBFBD>S&q<EFBFBD>p
*/
void OnKillFocus(SWND wndFocus);
/**
* SListBoxEx::OnNcCalcSize
* @brief <EFBFBD><EFBFBD><EFBFBD>{^<EFBFBD><EFBFBD>[7b:S'Y\
* @param BOOL bCalcValidRects -- 'Y\
* @param LPARAM lParam -- D<EFBFBD><EFBFBD>R<EFBFBD>Spe
* Describe <EFBFBD><EFBFBD><EFBFBD>{^<EFBFBD><EFBFBD>[7b:S'Y\
*/
LRESULT OnNcCalcSize(BOOL bCalcValidRects, LPARAM lParam);
/**
* SListBoxEx::Relayout
* @brief ͑<EFBFBD>e^@\
*
* Describe ͑<EFBFBD>e^@\
*/
void Relayout();
protected:
SArray<SItemPanel *> m_arrItems; /**< <EFBFBD>OX[ag<EFBFBD>v<EFBFBD>vpe<EFBFBD>~ */
int m_nItemHei; /**< ؚ<EFBFBD>^ */
int m_iSelItem; /**< <EFBFBD>-Nag<EFBFBD>v */
int m_iHoverItem; /**< Hover<EFBFBD>r`ag<EFBFBD>v */
int m_iScrollSpeed; /**< <EFBFBD>n<EFBFBD>R<EFBFBD><EFBFBD>^ */
BOOL m_bHotTrack; /**< */
pugi::xml_document m_xmlTempl; /**< Rh<EFBFBD>!jgXML */
SItemPanel *m_pCapturedFrame; /**< S_MR<EFBFBD>(u<EFBFBD>Nsetcapture<EFBFBD>vRh<EFBFBD>y<EFBFBD> */
ISkinObj *m_pItemSkin; /**< Rh<EFBFBD>y<EFBFBD><EFBFBD>v̀ofskin */
COLORREF m_crItemBg; /**< ̀ofr<EFBFBD> */
COLORREF m_crItemSelBg; /**< <EFBFBD>-Ǹofr<EFBFBD> */
COLORREF m_crItemHotBg; /**< Hot̀ofr<EFBFBD> */
BOOL m_bItemRedrawDelay; /**< h<EFBFBD>y<EFBFBD>͑<EFBFBD>~<EFBFBD>e<EFBFBD>Q */
public:
SOUI_ATTRS_BEGIN()
ATTR_INT(L"itemHeight", m_nItemHei, FALSE)
ATTR_SKIN(L"itemSkin", m_pItemSkin, TRUE)
ATTR_COLOR(L"colorItemBkgnd",m_crItemBg,FALSE)
ATTR_COLOR(L"colorItemSelBkgnd",m_crItemSelBg,FALSE)
ATTR_COLOR(L"colorItemHotBkgnd",m_crItemHotBg,FALSE)
ATTR_INT(L"itemRedrawDelay", m_bItemRedrawDelay, TRUE)
ATTR_INT(L"hotTrack",m_bHotTrack,FALSE)
SOUI_ATTRS_END()
SOUI_MSG_MAP_BEGIN()
MSG_WM_MOUSEWHEEL(OnMouseWheel)
MESSAGE_RANGE_HANDLER_EX(WM_MOUSEFIRST,WM_MOUSELAST,OnMouseEvent)
MESSAGE_RANGE_HANDLER_EX(WM_KEYFIRST,WM_KEYLAST,OnKeyEvent)
MESSAGE_RANGE_HANDLER_EX(WM_IME_STARTCOMPOSITION,WM_IME_KEYLAST,OnKeyEvent)
MESSAGE_HANDLER_EX(WM_IME_CHAR,OnKeyEvent)
MSG_WM_DESTROY(OnDestroy)
MSG_WM_PAINT_EX(OnPaint)
MSG_WM_MOUSELEAVE(OnMouseLeave)
MSG_WM_KEYDOWN(OnKeyDown)
MSG_WM_CHAR(OnChar)
MSG_WM_SIZE(OnSize)
MSG_WM_SETFOCUS_EX(OnSetFocus)
MSG_WM_KILLFOCUS_EX(OnKillFocus)
MSG_WM_NCCALCSIZE(OnNcCalcSize)
SOUI_MSG_MAP_END()
};
}//namespace SOUI