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

245 lines
5.3 KiB

5 months ago
#pragma once
#include "slistboxex.h"
namespace SOUI
{
class EventOfComoboxExItem : public TplEventArgs<EventOfComoboxExItem>
{
SOUI_CLASS_NAME(EventOfComoboxExItem,L"on_event_of_comboxex_item")
public:
EventOfComoboxExItem(SObject *pSender,EventCmd *_pOrgEvt )
:TplEventArgs<EventOfComoboxExItem>(pSender)
,pOrgEvt(_pOrgEvt)
,bCancel(FALSE)
{
}
enum{EventID=EVT_EXTERNAL_BEGIN + 300};
EventCmd * pOrgEvt;
BOOL bCancel;
};
class SComboBoxEx : public SComboBase
{
SOUI_CLASS_NAME(SComboBoxEx, L"comboboxex")
public:
/**
* SComboBoxEx::SComboBoxEx
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*
* Describe <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
SComboBoxEx();
/**
* SComboBoxEx::~SComboBoxEx
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*
* Describe <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
virtual ~SComboBoxEx();
/**
* SComboBoxEx::SetCurSel
* @brief <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>ǰѡ<EFBFBD><EFBFBD>
* @param int iSel -- ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*
* Describe <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>ǰѡ<EFBFBD><EFBFBD>
*/
BOOL SetCurSel(int iSel)
{
if(m_pListBox->SetCurSel(iSel))
{
OnSelChanged();
return TRUE;
}else
{
return FALSE;
}
}
/**
* SComboBoxEx::GetCurSel
* @brief <EFBFBD><EFBFBD>ȡѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return <EFBFBD><EFBFBD><EFBFBD><EFBFBD>int -- ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*
* Describe <EFBFBD><EFBFBD>ȡѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
int GetCurSel() const
{
return m_pListBox->GetCurSel();
}
/**
* SComboBox::GetCount
* @brief <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return <EFBFBD><EFBFBD><EFBFBD><EFBFBD>int
*
* Describe <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
int GetCount() const
{
return m_pListBox->GetItemCount();
}
/**
* SComboBoxEx::GetItemData
* @brief <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param UINT iItem -- ѡ<EFBFBD><EFBFBD>ֵ
*
* Describe <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
LPARAM GetItemData(UINT iItem) const
{
return m_pListBox->GetItemData(iItem);
}
/**
* SComboBoxEx::SetItemData
* @brief <EFBFBD><EFBFBD><EFBFBD>ø<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param UINT iItem -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
* @param LPARAM lParam -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
*
* Describe <EFBFBD><EFBFBD><EFBFBD>ø<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
void SetItemData(UINT iItem, LPARAM lParam)
{
m_pListBox->SetItemData(iItem,lParam);
}
/**
* SComboBoxEx::InsertItem
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param UINT iPos -- λ<EFBFBD><EFBFBD>
* @param LPCTSTR pszText -- <EFBFBD>ı<EFBFBD>ֵ
* @param int iIcon -- ͼ<EFBFBD><EFBFBD>
* @param LPARAM lParam -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
*
* Describe <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
int InsertItem(UINT iPos,LPCTSTR pszText,int iIcon,LPARAM lParam)
{
int iInserted= m_pListBox->InsertItem(iPos,NULL,lParam);
if(iInserted!=-1)
{
SWindow *pWnd=m_pListBox->GetItemPanel(iInserted);
if(m_uTxtID!=0)
{
SWindow *pText=pWnd->FindChildByID(m_uTxtID);
if(pText) pText->SetWindowText(pszText);
}
if(m_uIconID!=0)
{
SImageWnd *pIcon=pWnd->FindChildByID2<SImageWnd>(m_uIconID);
if(pIcon) pIcon->SetIcon(iIcon);
}
}
return iInserted;
}
/**
* SComboBoxEx::DeleteString
* @brief ɾ<EFBFBD><EFBFBD>ijһ<EFBFBD><EFBFBD>
* @param UINT iItem -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
*
* Describe ɾ<EFBFBD><EFBFBD>ijһ<EFBFBD><EFBFBD>
*/
void DeleteString(UINT iItem)
{
m_pListBox->DeleteItem(iItem);
}
/**
* SComboBoxEx::ResetContent
* @brief ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*
* Describe <EFBFBD><EFBFBD><EFBFBD>ø<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
void ResetContent()
{
return m_pListBox->DeleteAllItems();
}
/**
* SComboBoxEx::GetLBText
* @brief <EFBFBD><EFBFBD>ȡ<EFBFBD>ı<EFBFBD>
* @param int iItem -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
*
* Describe <EFBFBD><EFBFBD>ȡ<EFBFBD>ı<EFBFBD>
*/
SStringT GetLBText(int iItem);
SListBoxEx * GetListBox(){return m_pListBox;}
protected:
/**
* SComboBox::OnSelChanged
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>selected<EFBFBD>¼<EFBFBD>
*
* Describe <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>selected<EFBFBD>¼<EFBFBD>
*/
virtual void OnSelChanged();
protected:
/**
* SComboBoxEx::FireEvent
* @brief ֪ͨ<EFBFBD><EFBFBD>Ϣ
* @param EventArgs &evt -- <EFBFBD>¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*
* Describe <EFBFBD>˺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
virtual BOOL FireEvent(EventArgs &evt);
/**
* SComboBoxEx::CreateListBox
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
* @param <EFBFBD><EFBFBD><EFBFBD><EFBFBD>BOOL TRUE -- <EFBFBD>ɹ<EFBFBD> FALSE -- ʧ<EFBFBD><EFBFBD>
*
* Describe <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
*/
virtual BOOL CreateListBox(pugi::xml_node xmlNode);
/**
* SComboBoxEx::GetListBoxHeight
* @brief <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><EFBFBD>߶<EFBFBD>
* @param <EFBFBD><EFBFBD><EFBFBD><EFBFBD>int
*
* Describe <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><EFBFBD>߶<EFBFBD>
*/
virtual int GetListBoxHeight();
/**
* SComboBoxEx::OnDropDown
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><EFBFBD>¼<EFBFBD>
* @param SDropDownWnd *pDropDown -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>ָ<EFBFBD><EFBFBD>
*
* Describe <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><EFBFBD>¼<EFBFBD>
*/
virtual void OnCreateDropDown(SDropDownWnd *pDropDown);
/**
* SComboBox::OnCloseUp
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><EFBFBD>ر<EFBFBD><EFBFBD>¼<EFBFBD>
* @param SDropDownWnd *pDropDown -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>ָ<EFBFBD><EFBFBD>
*
* Describe <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>ָ<EFBFBD><EFBFBD>
*/
virtual void OnDestroyDropDown(SDropDownWnd *pDropDown);
protected:
SOUI_ATTRS_BEGIN()
ATTR_UINT(L"id_text", m_uTxtID, FALSE)
ATTR_UINT(L"id_icon", m_uIconID, FALSE)
SOUI_ATTRS_END()
SListBoxEx *m_pListBox; /**< SListBoxָ<EFBFBD><EFBFBD> */
UINT m_uTxtID; /**< <EFBFBD>ı<EFBFBD>ID */
UINT m_uIconID; /**< ͼ<EFBFBD><EFBFBD>ID */
};
}