/************************************************************************/ /* Copyright (C), 2016-2020, [IT], 保留所有权利; /* 模 块 名:; /* 描 述:; /* /* 版 本:[V]; /* 作 者:[IT]; /* 日 期:[8/19/2016]; /* /* /* 注 意:; /* /* 修改记录:[IT]; /* 修改日期:; /* 修改版本:; /* 修改内容:; /************************************************************************/ #ifndef __DRAWERCTRL__ #define __DRAWERCTRL__ #if _MSC_VER >= 1000 #pragma once #endif // _MSC_VER >= 1000 #include #include "EnBitmap.h" #include "ChildFrameList.h" class CDrawerCtrl : public CWnd { // Construction DECLARE_DYNCREATE(CDrawerCtrl) public: CDrawerCtrl(); // Attributes public: // 正常时的抽屉图片; CEnBitmap m_bmpNormalFolder; // 鼠标在上面的抽屉图片; CEnBitmap m_bmpHoverFolder; COLORREF m_crBackground; // 图片高度; UINT m_nFolderHeight; // 鼠标位置; CPoint m_curpoint; COLORREF m_crText; CFont* m_pFont; HCURSOR hHandCursor; int iLastFolderHighlighted; int iHoverFolder; // 当前选中的项; int m_nCurSelFolder; HICON iSelcon; CPtrArray m_arFolder; class CBm_arFolder { public: CBm_arFolder(const char* name, DWORD exData); virtual ~CBm_arFolder(); char* cName; DWORD dwData; CWnd* pChild; }; // Operations public: enum { htNothing = -1, htFolder, htFind }; // Implementation public: void SetAutoFolder(IN const DWORD& dwTime = 800); DWORD GetFolderData(int iFolder = -1); CWnd* GetFolderChild(int iFolder = -1); int AddFolderBar(const char* pFolder, CWnd* pSon, const DWORD exData = 0); void HighlightFolder(const int index); void SetFolderText(const int index, const char* text); void SetFolderImage(LPCTSTR lpszPath); void SetSelIcon(LPCTSTR lpszIconPath); void RemoveFolder(const int index); int GetSelFolder() const; int GetFolderCount() const; void SetSelFolder(const int index); int HitTestEx(const CPoint& point, int& index); void GetInsideRect(CRect& rect) const; int AddFolder(const char* cFolderName, const DWORD exData); bool GetFolderRect(const int iIndex, CRect& rect) const; bool PtInFolderHeadRect(CPoint pt) const; BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID); void SetFolderHeight(UINT nHeight) { m_nFolderHeight = nHeight; }; virtual ~CDrawerCtrl(); // Generated message map functions protected: void DrawFolder(CDC* pDC, const int iIdx, CRect rect); //{{AFX_MSG(CDrawerCtrl) afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnPaint(); afx_msg BOOL OnEraseBkgnd(CDC* pDC); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg void OnTimer(UINT_PTR nIDEvent); afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message); afx_msg void OnSize(UINT nType, int cx, int cy); //}}AFX_MSG DECLARE_MESSAGE_MAP() public: CWnd* GetFolderWnd(const char* pszName); afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt); afx_msg void OnNMClickNavQuarter(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnNMClickNavOthers(NMHDR* pNMHDR, LRESULT* pResult); }; #endif