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

238 lines
7.9 KiB

5 months ago
/**
* Copyright (C) 2014-2050 SOUI团队
* All rights reserved.
*
* @file SDropDown.h
* @brief
* @version v1.0
* @author soui
* @date 2014-05-25
*
* Describe
*
* PreTranslateMessage函数
* SetCapture来截获鼠标消息SetCapture会有一个副作用
* WM_SETCURSOR消息PreTranslateMessage函数中通过WM_MOUSEMOVE消息来模拟WM_SETCURSOR
*/
#pragma once
#include "core/shostwnd.h"
namespace SOUI
{
class SDropDownWnd;
/**
* @struct ISDropDownOwner
* @brief ISDropDownOwner接口类
*
* Describe
*/
struct ISDropDownOwner
{
/**
* ISDropDownOwner::GetDropDownOwner
* @brief
*
* Describe
*/
virtual SWindow * GetDropDownOwner() =0;
/**
* ISDropDownOwner::OnCreateDropDown
* @brief
*
* Describe
*/
virtual void OnCreateDropDown(SDropDownWnd *pDropDown) = 0;
/**
* ISDropDownOwner::OnDestroyDropDown
* @brief
*
* Describe
*/
virtual void OnDestroyDropDown(SDropDownWnd *pDropDown) = 0;
};
/**
* @class SDropDownWnd
* @brief
*
* Describe
*/
class SOUI_EXP SDropDownWnd : public SHostWnd, public IMessageFilter
{
public:
/**
* SDropDownWnd::SDropDownWnd
* @brief
* @param ISDropDownOwner* pOwner --
*
* Describe SDropDownWnd类的构造函数
*/
SDropDownWnd(ISDropDownOwner* pOwner);
/**
* SDropDownWnd::~SDropDownWnd
* @brief
*
* Describe SDropDownWnd类的析构函数
*/
virtual ~SDropDownWnd();
SWindow * GetDropDownOwner();
/**
* SDropDownWnd::Create
* @brief
* @param LPCRECT lpRect --
* @param LPVOID lParam --
* @param DWORD dwStyle --
* @param DWORD dwExStyle --
*
* Describe
*/
virtual BOOL Create(LPCRECT lpRect,LPVOID lParam,DWORD dwStyle=WS_POPUP,DWORD dwExStyle=WS_EX_TOOLWINDOW|WS_EX_TOPMOST);
/**
* SDropDownWnd::EndDropDown
* @brief
* @param UINT uCode -- IDCANCEL
*
* Describe ( )
*/
void EndDropDown(UINT uCode=IDCANCEL);
//返回退出代码
UINT GetExitCode() const {return m_uExitCode;}
//返回下拉列表的状态值,由派生类提供。
virtual int GetValue() const {return 0;}
protected:
virtual SMessageLoop * GetMsgLoop();
/**
* OnReleaseSwndCapture
* @brief ReleaseCapture
* @return BOOL
*
* Describe ReleaseCapture后重新调用SetCapture
*/
virtual BOOL OnReleaseSwndCapture();
/**
* PreTranslateMessage
* @brief
* @param MSG * pMsg --
* @return BOOL-- TRUE消息被处理
*
* Describe
*/
virtual BOOL PreTranslateMessage(MSG* pMsg);
/**
* SDropDownWnd::OnLButtonDown
* @brief
* @param UINT nFlags --
* @param CPoint point --
*
* Describe
*/
void OnLButtonDown(UINT nFlags, CPoint point);
/**
* SDropDownWnd::OnLButtonDown
* @brief
* @param UINT nFlags --
* @param CPoint point --
*
* Describe
*/
void OnLButtonUp(UINT nFlags, CPoint point);
/**
* SDropDownWnd::OnKeyDown
* @brief
* @param UINT nChar --
* @param UINT nRepCnt --
* @param UINT nFlags --
*
* Describe
*/
void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
/**
* SDropDownWnd::OnKillFocus
* @brief
* @param HWND wndFocus --
*
* Describe
*/
void OnKillFocus(HWND wndFocus);
/**
* SDropDownWnd::OnDestroy
* @brief
*
* Describe
*/
void OnDestroy();
/**
* SDropDownWnd::OnActivateApp
* @brief
* @param BOOL bActive --
* @param DWORD dwThreadID -- 线ID
*
* Describe MSDN
*/
void OnActivateApp(BOOL bActive, DWORD dwThreadID);
/**
* SDropDownWnd::OnMouseActivate
* @brief 使
* @param HWND wndTopLevel --
* @param UINT nHitTest --
* @param UINT message --
*
* Describe
* MSDN
*/
int OnMouseActivate(HWND wndTopLevel, UINT nHitTest, UINT message);
/**
* SDropDownWnd::OnActivate
* @brief
* @param UINT nState --
* @param BOOL bMinimized --
* @param HWND wndOther --
*
* Describe
* MSDN
*/
void OnActivate(UINT nState, BOOL bMinimized, HWND wndOther){}//中断消息处理,防止设置焦点
virtual void OnFinalMessage(HWND);
protected:
ISDropDownOwner* m_pOwner; /**< 窗口所属者 */
BOOL m_bClick; /**< 单击状态 */
UINT m_uExitCode; /**< 退出消息码 */
BEGIN_MSG_MAP_EX(SDropDownWnd)
MSG_WM_LBUTTONDOWN(OnLButtonDown)
MSG_WM_LBUTTONUP(OnLButtonUp)
MSG_WM_KEYDOWN(OnKeyDown);
MSG_WM_KILLFOCUS(OnKillFocus)
MSG_WM_DESTROY(OnDestroy)
MSG_WM_ACTIVATE(OnActivate)
MSG_WM_ACTIVATEAPP(OnActivateApp)
MSG_WM_MOUSEACTIVATE(OnMouseActivate)
CHAIN_MSG_MAP(SHostWnd)
END_MSG_MAP()
};
}//end of namespace SOUI