#pragma once
|
|
#define ID_MSG_VIEW_ACTIVE WM_USER+2356
|
#define ID_MSG_BTN_CLICKED WM_USER+2357
|
#define ID_MSG_BTN_MENU_ITEM WM_USER+2358
|
|
|
class CComponentDlg : public CDialogEx
|
{
|
private:
|
typedef struct _TOOLBTN
|
{
|
int id;
|
HICON hIcon[4];
|
char szTooltip[256];
|
BOOL bEnable;
|
HMENU hMenu;
|
} TOOLBTN;
|
|
|
DECLARE_DYNAMIC(CComponentDlg)
|
|
public:
|
CComponentDlg(UINT id, CWnd* pPage); // ±ê×¼¹¹Ô캯Êý
|
virtual ~CComponentDlg();
|
|
|
public:
|
void OnViewActive();
|
void OnViewInactive();
|
void AddToolBtn(int id, const char* pszIcon0Path, const char* pszIcon1Path, const char* pszIcon2Path, const char* pszIcon3Path, const char* pszTooltip);
|
void SetToolBtnEnable(int id, BOOL bEnable);
|
void SetToolBtnMenu(int id, HMENU hMenu);
|
void Show(CWnd* pParent, LPRECT lprcBtn);
|
void SetContext(void* pContext);
|
void* GetContext();
|
virtual void OnApply();
|
|
private:
|
int MyHitTest(POINT& point, TOOLBTN*& pBtn);
|
CComponentDlg::TOOLBTN* GetToolBtn(int id);
|
BOOL GetBtnRect(int id, LPRECT lprcBtn);
|
|
|
private:
|
std::vector<TOOLBTN> m_toolbtns;
|
TOOLBTN* m_pHotBtn;
|
TOOLBTN* m_pPressBtn;
|
int m_nState;
|
|
|
protected:
|
COLORREF m_crBkgnd;
|
HBRUSH m_hbrBkgnd;
|
void* m_pContext;
|
|
|
DECLARE_MESSAGE_MAP()
|
public:
|
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
|
afx_msg void OnDestroy();
|
afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
|
afx_msg void OnNcPaint();
|
afx_msg int OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message);
|
afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp);
|
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
afx_msg LRESULT OnNcHitTest(CPoint point);
|
afx_msg void OnNcMouseMove(UINT nHitTest, CPoint point);
|
afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
|
afx_msg void OnNcLButtonUp(UINT nHitTest, CPoint point);
|
virtual INT_PTR OnToolHitTest(CPoint point, TOOLINFO* pTI) const;
|
};
|