/** * @file XTPDockingPaneKeyboardHook.h * * @copyright * (c) 1998-2025 Codejock Software, All Rights Reserved. * * This source file is the property of Codejock Software and must not be * redistributed by any means without the explicit written permission of * Codejock Software. * * The use of this source code is governed by the terms and conditions specified * in the Toolkit Pro license agreement. Codejock Software grants you, as a * single software developer, the limited right to use this software on one * computer only. * * Contact Information: * support@codejock.com * http://www.codejock.com * */ /** @cond */ #if !defined(__XTPDOCKINGPANEKEYBOARDHOOK_H__) # define __XTPDOCKINGPANEKEYBOARDHOOK_H__ /** @endcond */ # if _MSC_VER >= 1000 # pragma once # endif // _MSC_VER >= 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPDockingPane; class CXTPDockingPaneManager; /** * @brief * CXTPDockingPaneWindowSelect is a CMiniFrameWnd derived class used to * show a window selector for Ctrl+F9 and Alt+F7 handlers. */ class _XTP_EXT_CLASS CXTPDockingPaneWindowSelect : public CMiniFrameWnd { /** @cond */ DECLARE_DYNCREATE(CXTPDockingPaneWindowSelect) /** @endcond */ public: /** * @brief * Item type enumeration. */ enum ItemType { itemPane, /**< Item is a docking pane.*/ itemMDIFrame, /**< Item is a handle of a MDI child.*/ itemSDIFrame /**< Item is a handle of a SDI frame.*/ }; /** * @brief * Item description. */ struct CItem { CRect rc; /**< Item bounding rectangle. */ union { CXTPDockingPane* pPane; HWND hWndFrame; }; int nIndex; /**< Index of the item. */ int nColumn; /**< Column of the index. */ int nRow; /**< Row of the item. */ ItemType type; /**< Item type. */ }; /** * @brief * Column description. */ struct CColumn { int nFirst; int nLast; }; protected: /** * @brief * Constructs a CXTPDockingPaneWindowSelect object. */ CXTPDockingPaneWindowSelect(); public: /** * @brief * Destroys a CXTPDockingPaneMiniWnd object, handles cleanup and deallocation. */ virtual ~CXTPDockingPaneWindowSelect(); public: /** * @brief * Call this method to determine which item, if any, is at the specified * position. * @param pt Client coordinates to test. * @return * A pointer to a CItem object if successful, or 0 if no item is at the * specified position. */ CItem* HitTest(CPoint pt) const; /** * @brief * Call this method to select a specified item. * @param pItem Item to select. */ void Select(CItem* pItem); /** * @brief * Call this method to select an item by its index. * @param nItem Index of the item to select. */ void Select(int nItem); public: /** * @brief * This method is called to retrieve an item's caption. * @param pItem Pointer to the item with the caption to retrieve. * @return * The item's caption. */ virtual CString GetItemCaption(CItem* pItem) const; /** * @brief * This method is called to retrieve an item's description. * @param pItem Pointer to the item with the description to retrieve. * @return * The item's description. */ virtual CString GetItemDescription(CItem* pItem) const; /** * @brief * This method is called to retrieve an item's path string. * @param pItem Pointer to the item with the path string to retrieve. * @return * The item's path string. */ virtual CString GetItemPath(CItem* pItem) const; public: /** * @brief * This method is called to update the position of all items inside the dialog. * @return * TRUE is successful. */ virtual BOOL Reposition(); protected: /** @cond */ DECLARE_MESSAGE_MAP() //{{AFX_VIRTUAL(CXTPDockingPaneWindowSelect) protected: virtual void PostNcDestroy(); //}}AFX_VIRTUAL //{{AFX_MSG(CXTPDockingPaneWindowSelect) public: afx_msg void OnKillFocus(CWnd* pNewWnd); afx_msg void OnCaptureChanged(CWnd* pWnd); afx_msg void OnPaint(); afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnLButtonUp(UINT nFlags, CPoint point); afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); //}}AFX_MSG /** @endcond */ private: int CalcItemHeight(CDC* pDC); BOOL DoModal(); HWND GetMDIClient() const; void FillItems(HWND hWndClient, int& nItemHeight, int& nItemWidth, int& x, int& y, int& nRow, int& nColumn, int& nTotalRow, int& nFirstColumn); private: CXTPDockingPaneManager* m_pManager; /**< Owner DockingPaneManager class. */ CArray m_arrItems; /**< Items in Windows Selector. */ CArray m_arrColumns; /**< Columns collection. */ CItem* m_pSelected; /**< Selected item. */ HCURSOR m_hHandCursor; /**< Hand cursor handle. */ HCURSOR m_hArrowCursor; /**< Arrow cursor handle. */ int m_nFirstFile; /**< Index of first file in Items. */ int m_nPaneCount; /**< Total number of panes. */ CString m_strActiveTools; /**< ActiveTools string. */ CString m_strActiveFiles; /**< ActiveFiles string. */ CXTPFont m_fnt; /**< Normal font. */ CXTPFont m_fntBold; /**< Bold font. */ BOOL m_bActivatePanes; /**< TRUE to activate panes. */ friend class CXTPDockingPaneKeyboardHook; }; /** @cond */ class _XTP_EXT_CLASS CXTPDockingPaneKeyboardHook : public CNoTrackObject { public: CXTPDockingPaneKeyboardHook(); ~CXTPDockingPaneKeyboardHook(); public: void SetupKeyboardHook(CXTPDockingPaneManager* pManager, BOOL bSetup); CXTPDockingPaneManager* FindFocusedManager(); static CXTPDockingPaneKeyboardHook* AFX_CDECL GetThreadState(); protected: static LRESULT CALLBACK KeyboardProc(int code, WPARAM wParam, LPARAM lParam); CXTPDockingPaneManager* Lookup(HWND hSite) const; protected: HHOOK m_hHookKeyboard; /**< Keyboard hook */ static CThreadLocal _xtpKeyboardThreadState; /**< Instance of Keyboard hook */ CMap m_mapSites; # ifdef _AFXDLL AFX_MODULE_STATE* m_pModuleState; /**< Module state */ # endif CXTPDockingPaneWindowSelect* m_pWindowSelect; }; AFX_INLINE CXTPDockingPaneKeyboardHook* AFX_CDECL CXTPDockingPaneKeyboardHook::GetThreadState() { return _xtpKeyboardThreadState.GetData(); } /** @endcond */ /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif //#if !defined(__XTPDOCKINGPANEKEYBOARDHOOK_H__) /** @endcond */