#if !defined(__KTMENUCTRLBAR_H__) #define __KTMENUCTRLBAR_H__ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #if ARX < 16 // Palette Set Styles #define PSS_AUTO_ROLLUP 0x00000002 // Support automatic roll-up when the pin is up. #define PSS_PROPERTIES_MENU 0x00000004 // Display properties button in the caption to edit palette properties. #define PSS_CLOSE_BUTTON 0x00000008 // Support "close" button in caption #define PSS_EDIT_NAME 0x00000010 // Support editing of palette set name through in-place editing #define PSS_SNAP 0x00000020 // Support snapping to application, screen, and other palette sets #define PSS_SINGLE_PALETTE_TAB 0x00000040 // Tab visibility for palette set containing a single palette. #define PSS_USE_SINGLE_PALETTE_TAB_NAME 0x00000080 // Use palette name in paletee set title bar for single palette set. class CAdUiPaletteSet : public CAdUiDockControlBar { DECLARE_DYNCREATE(CAdUiPaletteSet); public: CAdUiPaletteSet(int nStyle = 0); virtual ~CAdUiPaletteSet(); BOOL Create(LPCTSTR strTitle, DWORD dwStyle, const RECT &rect, CWnd *pwndParent, DWORD dwPaletteSetStyle = PSS_PROPERTIES_MENU | PSS_AUTO_ROLLUP | PSS_CLOSE_BUTTON | PSS_SNAP); }; #endif // ARX < 16 class KTMenuCtrlBar : public CAdUiPaletteSet { DECLARE_DYNAMIC(KTMenuCtrlBar); public: KTMenuCtrlBar(); virtual ~KTMenuCtrlBar(); BOOL CreateMenuBar(LPCTSTR pszTitle); protected: protected: virtual bool OnClosing(); virtual void GetFloatingMinSize(long *plMinWidth, long *plMinHeight); virtual void SizeChanged(CRect *lpRect, BOOL bFloating, int flags); virtual void GetMinimumSize (CSize &size) ; virtual void GetMaximumSize (CSize &size) ; protected: afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); afx_msg void OnTimer(UINT_PTR nIDEvent); afx_msg void OnDestroy(); DECLARE_MESSAGE_MAP() // 解决AutoCAD2009以后屏幕菜单拖动限制最小尺寸问题 protected: virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz); // 子类化DockBar窗口 BOOL SubclassDockBar(HWND hWnd); // 反子类化DockBar窗口 void UnsubclassDockBar(); // 检测点击到边框的位置 UINT OnTrackHitTest(CPoint pt); // 获取点中边框的位置尺寸 UINT OnGetTrackRect(UINT nDockOrHit, CRect& rc); // 启动拖动操作 void OnStartTracking(UINT nHit); // 拖动更新过程 void OnTrackUpdate(CPoint pt); // 停止拖动操作 void OnStopTracking(); // 拖动更新显示 void OnTrackPaint(); // 拖动状态 BOOL m_bTracking; // 拖动边框位置尺寸 CRect m_rcTracking; private: // 被子类化的DockBar窗口 HWND m_hDockBar; // 子类化DockBar的窗口过程 WNDPROC m_pfnOldProc; // 被子类化DockBar新窗口过程实现 LRESULT OnDockBarProc(HWND hWnd, UINT nMessage, WPARAM wParam, LPARAM lParam); // 被子类化DockBar新窗口过程函数 static LRESULT CALLBACK DockBarProc(HWND hWnd, UINT nMessage, WPARAM wParam, LPARAM lParam); static KTMenuCtrlBar* m_pMySelft; public: }; #endif // !defined(__KTMENUCTRLBAR_H__)