www.pudn.com > DrawerMenu(完整版).rar > DrawerMenuCtl.h


#if !defined(AFX_DRAWERMENUCTL_H__F8EDECBE_9A62_4F74_B9D5_C7A9EE7C5C65__INCLUDED_) 
#define AFX_DRAWERMENUCTL_H__F8EDECBE_9A62_4F74_B9D5_C7A9EE7C5C65__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
// DrawerMenuCtl.h : Declaration of the CDrawerMenuCtrl ActiveX Control class. 
 
///////////////////////////////////////////////////////////////////////////// 
// CDrawerMenuCtrl : See DrawerMenuCtl.cpp for implementation. 
 
#include "SuperItem.h" 
 
#define MODE_NONE		0		//不可能存在这种情况 
#define MODE_MOVE		1 
#define MODE_DOWN		2 
 
#define WHICH_NONE		0 
#define WHICH_SUPER		1 
#define WHICH_SUB		2 
 
 
typedef CTypedPtrArray CSuperArray; 
 
class CDrawerMenuCtrl : public COleControl 
{ 
	DECLARE_DYNCREATE(CDrawerMenuCtrl) 
 
// Constructor 
public: 
	CDrawerMenuCtrl(); 
 
// Overrides 
	// ClassWizard generated virtual function overrides 
	//{{AFX_VIRTUAL(CDrawerMenuCtrl) 
	public: 
	virtual void OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid); 
	virtual void DoPropExchange(CPropExchange* pPX); 
	virtual void OnResetState(); 
	//}}AFX_VIRTUAL 
 
// Implementation 
protected: 
	void DrawSubNormal(int index); 
	void DrawSubSelected(int index); 
	void DrawSubDown(int index); 
	void DrawSuperSelected(int index); 
	void DrawSuperDown(int index); 
	void DrawOneSuper(int index, COLORREF crText, COLORREF crRect); 
	void DrawOneSub(int index, COLORREF crBack, COLORREF crUp, COLORREF crBtm); 
	void OnMouseLeave(UINT nFlags, CPoint point); 
	void OnMouseEnter(UINT nFlags, CPoint point); 
	BOOL m_bEnter; 
	int m_nMode; 
	int m_nWhich; 
	int m_nIndex; 
	CFont m_fontSong; 
 
	int SubItemHitTest(CPoint & point); 
	int SuperItemHitTest(CPoint & point); 
	CImageList * m_pImageList; 
	void DrawSubItems(CDC *pDC, const CRect &rcBounds); 
	void DrawSuperItems(CDC * pDC, const CRect & rcBounds); 
	int m_nSpaceH; 
	int m_nSuperH; 
	int m_nSubH; 
	int m_nCurSel; 
	CSuperArray m_superItems; 
	~CDrawerMenuCtrl(); 
 
	DECLARE_OLECREATE_EX(CDrawerMenuCtrl)    // Class factory and guid 
	DECLARE_OLETYPELIB(CDrawerMenuCtrl)      // GetTypeInfo 
	DECLARE_PROPPAGEIDS(CDrawerMenuCtrl)     // Property page IDs 
	DECLARE_OLECTLTYPE(CDrawerMenuCtrl)		// Type name and misc status 
 
// Message maps 
	//{{AFX_MSG(CDrawerMenuCtrl) 
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point); 
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); 
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); 
	afx_msg void OnMouseMove(UINT nFlags, CPoint point); 
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point); 
	//}}AFX_MSG 
	DECLARE_MESSAGE_MAP() 
 
// Dispatch maps 
	//{{AFX_DISPATCH(CDrawerMenuCtrl) 
	afx_msg long SetSubCurSel(long nSuperIndex, long nCurSel); 
	afx_msg BOOL AddSubItem(short nSuperIndex, short nItemID, short nImageIndex, long FAR* pText); 
	afx_msg BOOL AddSuperItem(short nItemID, long FAR* pText); 
	afx_msg long SetSuperCurSel(short nCurSel); 
	afx_msg long SetImageList(long FAR* pImageList); 
	//}}AFX_DISPATCH 
	DECLARE_DISPATCH_MAP() 
 
	afx_msg void AboutBox(); 
 
// Event maps 
	//{{AFX_EVENT(CDrawerMenuCtrl) 
	void FireSubItemSelected(long nItemID, LPCTSTR strText) 
		{FireEvent(eventidSUBITEMSELECTED,EVENT_PARAM(VTS_I4  VTS_BSTR), nItemID, strText);} 
	//}}AFX_EVENT 
	DECLARE_EVENT_MAP() 
// Dispatch and event IDs 
public: 
	void DrawSuperNormal(int index); 
	enum { 
	//{{AFX_DISP_ID(CDrawerMenuCtrl) 
	dispidSetSubCurSel = 1L, 
	dispidAddSubItem = 2L, 
	dispidAddSuperItem = 3L, 
	dispidSetSuperCurSel = 4L, 
	dispidSetImageList = 5L, 
	eventidSUBITEMSELECTED = 1L, 
	//}}AFX_DISP_ID 
	}; 
}; 
 
//{{AFX_INSERT_LOCATION}} 
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. 
 
#endif // !defined(AFX_DRAWERMENUCTL_H__F8EDECBE_9A62_4F74_B9D5_C7A9EE7C5C65__INCLUDED)