/** * @file XTPDockingPane.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(__XTPDOCKINGPANE_H__) # define __XTPDOCKINGPANE_H__ /** @endcond */ # if _MSC_VER >= 1000 # pragma once # endif // _MSC_VER >= 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPImageManagerIcon; /** * @brief * CXTPDockingPane is a CXTPDockingPaneBase derived class. * It is used as a container for a user window. */ class _XTP_EXT_CLASS CXTPDockingPane : public CXTPCmdTarget , public CXTPDockingPaneBase , public CXTPAccessible { protected: /** * @brief * Constructs a CXTPDockingPane object. Protected constructor. * Use CXTPDockingPaneManager::CreatePane() to create it. * @param pLayout Pointer to a CXTPDockingPaneLayout object. */ CXTPDockingPane(CXTPDockingPaneLayout* pLayout); /** * @brief * Destroys a CXTPDockingPane object, handles cleanup and deallocation. */ virtual ~CXTPDockingPane(); public: /** * @brief * Call this member to set a title for this object. * @param lpszTitle Title to be set. */ void SetTitle(LPCTSTR lpszTitle); /** * @brief * Call this member to set the focus of the pane. */ virtual void SetFocus(); /** * @brief * Call this member to get the pane's identifier. * @return * The identifier of the pane. */ int GetID() const; /** * @brief * Call this member to get the title of the pane. * @return * The title of the pane. */ virtual CString GetTitle() const; /** * @brief * Call this member to get the tab caption of the pane. * @return * The tab caption of the pane. */ virtual CString GetTabCaption() const; /** * @brief * Call this member to set the tab caption of the pane. * @param lpszTabCaption The tab caption of the pane to be set. */ void SetTabCaption(LPCTSTR lpszTabCaption); /** * @brief * Call this member to get the title tooltip text of the pane. * @return * The title tooltip text of the pane. */ virtual CString GetTitleToolTip() const; /** * @brief * Call this member to set the title tooltip text for the pane. * @param lpszTitleToolTip The title tooltip text to be set for the pane. */ void SetTitleToolTip(LPCTSTR lpszTitleToolTip); /** * @brief * Call this member to close the pane. */ void Close(); /** * @brief * Call this member to hide the pane. */ void Hide(); /** * @brief * Call this member to check if the pane is associated with a user window. * @return * TRUE if the pane is associated with a user window. */ BOOL IsValid() const; /** * @brief * Call this member to check if the pane is closed. * @return * TRUE if the pane is closed. */ BOOL IsClosed() const; /** * @brief * Call this member to check if the pane is hidden. * @return * TRUE if the pane is hidden. */ BOOL IsHidden() const; /** * @brief * Call this member to check if the pane is selected. * @return * TRUE if the pane is selected. */ BOOL IsSelected() const; /** * @brief * Call this member to check if the pane is floating. * @return * TRUE if the pane is floating. */ BOOL IsFloating() const; /** * @brief * Call this member to check if the pane is a side panel. * @return * TRUE if the pane is a side panel. */ BOOL IsSidePanel() const; /** * @brief * Call this member to check if the tab bar is visible. * @return * TRUE if the tab bar is visible. */ BOOL IsTabsVisible() const; /** * @brief * Call this member to associate the pane with a user window. * @param pWnd Pointer to a user window. * @details * The best place to create a user window and associate it with a * pane is after the pane becomes visible. To catch this event, use * the XTPWM_DOCKINGPANE_NOTIFY Handler. */ void Attach(CWnd* pWnd); /** * @brief * This member function dynamically creates a view based on a CRuntimeClass * object and attaches it to the pane. * @param pParentWnd Pointer to the parent of the view to be created. The parent * must be valid. * @param pViewClass CView runtime class. * @param pDocument CDocument associated with the view. It can be NULL. * @param pContext Create context for the view. It can be NULL. * @details * The best place to create a user window and associate it with a * pane is after the pane becomes visible. To catch this event, use * the XTPWM_DOCKINGPANE_NOTIFY Handler. * @return * A CWnd* pointer to the newly created view if successful, otherwise NULL. */ CWnd* AttachView(CWnd* pParentWnd, CRuntimeClass* pViewClass, CDocument* pDocument = NULL, CCreateContext* pContext = NULL); /** * @brief * Call this member to disassociate the pane from a user window. */ void Detach(); /** * @brief * Call this member to select the pane. */ void Select(); /** * @brief * Retrieves the identifier of the icon. * @return * The identifier of the icon if set. Otherwise, returns the identifier * of the pane. */ int GetIconID() const; /** * @brief * Retrieves the icon associated with the pane. * @param nWidth Width of the icon to retrieve. * @return * Handle of the icon. */ virtual CXTPImageManagerIcon* GetIcon(int nWidth = 16) const; /** * @brief * Call this member to set the identifier of the icon. * @param nID Identifier of the icon */ void SetIconID(UINT nID); /** * @brief * Call this member to get the associated user window. * @return * Pointer to the associated user child window. */ CWnd* GetChild() const; /** * @brief * Call this member to set options for the pane. * @param dwOptions Options to be set. Can be any of the values listed in the * Remarks section. * @details * dwOptions parameter can be one or more of the following: * xtpPaneNoCloseable: Indicates the pane can't be closed. * xtpPaneNoHideable: Indicates the pane can't be hidden. * xtpPaneNoFloatable: Indicates the pane can't be floated. * xtpPaneNoCaption: Indicates the pane has no caption. * xtpPaneHasMenuButton: Indicates the pane has menu button. * xtpPaneNoDockable: Indicates the pane can't be docked. * @see * XTPDockingPaneOptions */ void SetOptions(DWORD dwOptions); /** * @brief * Call this member to get the options of the pane. * @return * The options of the pane. * @see * XTPDockingPaneOptions */ DWORD GetOptions() const; /** * @brief * Call this method to set the 32-bit value associated with the pane. * @param dwData Contains the new value to associate with the pane. * @see * GetPaneData */ void SetPaneData(DWORD_PTR dwData); /** * @brief * This method retrieves the application-supplied, 32-bit value * associated with the tab item. * @return * The 32-bit value associated with the pane. * @see * SetPaneData */ DWORD_PTR GetPaneData() const; /** * @brief * This member function retrieves the RGB value for the referenced * item tab color, or (COLORREF)-1 if the color was not set. * @return * The RGB value for the referenced item tab color, or (COLORREF)-1 * if the color was not set. */ virtual COLORREF GetItemColor() const; /** * @brief * Call this member to set the RGB value for the item tab. * @param clr Color of the item tab. */ void SetItemColor(COLORREF clr); /** * @brief * Call this member to fill the pMinMaxInfo structure with the * minimum and maximum width and height of the container. * This will look at the MinMaxInfo for each pane in the * container and set the appropriate minimum and maximum width * and height for the container. * @param pMinMaxInfo Pointer to a MINMAXINFO structure. */ virtual void GetMinMaxInfo(LPMINMAXINFO pMinMaxInfo) const; /** * @brief * Retrieves the state of the child window. * @return * TRUE if child window is focused. */ BOOL IsFocus() const; /** * @brief * Call this method to set the minimum size for the pane. * @param sz Minimum size to be set for the pane. * @return The applied minimum track size. */ CSize SetMinTrackSize(CSize sz); /** * @brief * Call this method to set the maximum size for the pane. * @param sz Maximum size to be set for the pane. * @return The applied maximum track size. */ CSize SetMaxTrackSize(CSize sz); /** * @brief * Sets a context-sensitive help ID for the child pane. * @param nIDR Specifies the context-sensitive help ID. */ void SetHelpID(int nIDR); /** * @brief * Call this member function to retrieve the parent frame window. * @details * The member function searches up the parent chain until a CFrameWnd * (or derived class) object is found. * @return * A pointer to a frame window if successful, otherwise NULL */ CFrameWnd* GetParentFrame() const; /** * @brief * Call this member function to retrieve the parent window for the pane. * @return * A pointer to a parent window if successful, otherwise NULL. */ CWnd* GetDockingSite() const; /** * @brief * Determines the pane's enabled state. * @return * Pane's enabled state value. * @see * XTPDockingPaneEnableOptions */ XTPDockingPaneEnableOptions GetEnabled() const; /** * @brief * Call this method to set the pane's enabled state. * @param nState New pane enabled state value. * @see * XTPDockingPaneEnableOptions */ void SetEnabled(XTPDockingPaneEnableOptions nState); protected: /** * @brief * Copies self data from another pane. * @param pPane Pane which members need to copy. * @see * Clone */ virtual void Copy(CXTPDockingPane* pPane); /** * @brief * This method is called to set the position of the pane. * @param pParent Pointer to a CWnd object. * @param rect Rectangle of the pane to be set. * @param lParam Pointer to an AFX_SIZEPARENTPARAMS structure. */ virtual void OnSizeParent(CWnd* pParent, CRect rect, LPVOID lParam); /** * @brief * Call this method to set the parent container of the pane. * @param pContainer Pointer to a CXTPDockingPaneBase object. */ virtual void SetParentContainer(CXTPDockingPaneBase* pContainer); /** * @brief * Call this member function to save/restore the settings of the pane. * @param pPX Pointer to a CXTPPropExchange object. * @return * TRUE if successful, otherwise returns FALSE. */ virtual BOOL DoPropExchange(CXTPPropExchange* pPX); /** * @brief * Sets the visibility state of the window. * @param bShow TRUE to show the window, or FALSE to hide it. */ void ShowWindow(BOOL bShow); /** * @brief * Call this member to set the identifier of the item. * @param nID Identifier of the item. */ void SetID(int nID); /** * @brief * Call this member to set the bounding rectangle. * @param rc Bounding rectangle to draw. */ void SetWindowRect(CRect rc); /** * @brief * This method is called to the destroy the pane. */ virtual void DeletePane(); private: virtual void Copy(CXTPDockingPaneBase* pClone, CXTPPaneToPaneMap* pMap, DWORD dwIgnoredOptions); protected: /** @cond */ virtual HRESULT GetAccessibleParent(IDispatch** ppdispParent); virtual HRESULT GetAccessibleDescription(VARIANT varChild, BSTR* pszDescription); virtual HRESULT GetAccessibleChildCount(long* pcountChildren); virtual HRESULT GetAccessibleChild(VARIANT varChild, IDispatch** ppdispChild); virtual HRESULT GetAccessibleName(VARIANT varChild, BSTR* pszName); virtual HRESULT GetAccessibleRole(VARIANT varChild, VARIANT* pvarRole); virtual HRESULT AccessibleLocation(long* pxLeft, long* pyTop, long* pcxWidth, long* pcyHeight, VARIANT varChild); virtual HRESULT AccessibleHitTest(long xLeft, long yTop, VARIANT* pvarChild); virtual HRESULT GetAccessibleState(VARIANT varChild, VARIANT* pvarState); virtual CCmdTarget* GetAccessible(); virtual HRESULT GetAccessibleDefaultAction(VARIANT varChild, BSTR* pszDefaultAction); virtual HRESULT AccessibleDoDefaultAction(VARIANT varChild); virtual HRESULT AccessibleSelect(long flagsSelect, VARIANT varChild); DECLARE_INTERFACE_MAP() /** @endcond */ protected: HWND m_hwndChild; /**< Child window handle. */ int m_nID; /**< Pane identifier. */ int m_nIconID; /**< Icon identifier. */ CString m_strTitle; /**< Caption of the pane. */ CString m_strTabCaption; /**< Tab caption, text inside tab button. */ CString m_strTitleToolTip; /**< Tooltip text for the tab button. */ DWORD m_dwOptions; /**< Options of the pane. See XTPDockingPaneOptions. */ DWORD_PTR m_dwData; /**< User item data. */ CPoint m_ptMinTrackSize; /**< Minimum pane size. */ CPoint m_ptMaxTrackSize; /**< Maximum pane size. */ COLORREF m_clrItemTab; /**< Color used to fill the docking pane tab buttons. */ int m_nIDHelp; /**< Context-sensitive help ID for a child pane. */ XTPDockingPaneEnableOptions m_bEnabled; /**< Pane enabled options. */ # ifdef _XTP_ACTIVEX /** @cond */ private: DECLARE_DYNAMIC(CXTPDockingPane) DECLARE_DISPATCH_MAP() DECLARE_OLETYPELIB_EX(CXTPDockingPane); afx_msg void OleSetHandle(long nHandle); afx_msg long OleGetHandle(); afx_msg void OleAttachTo(LPDISPATCH pNeighbourDisp); afx_msg void OleSetHidden(BOOL bHidden); afx_msg void OleSetClosed(BOOL bClosed); afx_msg void OleSetSelected(BOOL bSelected); afx_msg void OleSetFloating(BOOL bFloating); afx_msg LPDISPATCH OleGetMinTrackSize(); afx_msg LPDISPATCH OleGetMaxTrackSize(); afx_msg BOOL OleGetHidden(); DECLARE_PROPERTY(TabColor, COLORREF); DECLARE_PROPERTY(Maximized, BOOL); afx_msg LPDISPATCH OleGetContainer(); afx_msg int OleGetType(); afx_msg LPDISPATCH OleGetDispatch(BOOL bAddRef); afx_msg int OleGetPosition(); afx_msg void OleGetClientRect(long* pLeft, long* pTop, long* pRight, long* pBottom); afx_msg BSTR OleGetTabCaption(); afx_msg BSTR OleGetTitleToolTip(); afx_msg BSTR OleGetTitle(); afx_msg void OleSetTitle(LPCTSTR sTitle); enum { dispidTitle = 1L, dispidId = 2L, dispidIconId = 3L, dispidHidden = 4L, dispidClosed = 5L, dispidSelected = 6L, dispidOptions = 7L, dispidFloating = 8L, dispidHide = 10L, dispidClose = 11L, dispidSelect = 12L, dispidAttachTo = 13L, dispidTag = 14L, }; static CXTPDockingPane* AFX_CDECL FromDispatch(LPDISPATCH pDisp); /** @endcond */ # endif /*_XTP_ACTIVEX*/ private: friend class CXTPDockingPaneMiniWnd; friend class CXTPDockingPaneManager; friend class CXTPDockingPaneTabbedContainer; friend class CXTPDockingPaneLayout; friend class CDockingPaneCtrl; }; # ifdef _XTP_ACTIVEX /** @cond */ class _XTP_EXT_CLASS CXTPDockingPaneTrackSize : public CXTPCmdTarget { public: CXTPDockingPaneTrackSize(CPoint*); public: void OnPropertyChanged(); protected: DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPDockingPaneTrackSize); afx_msg void OleSetSize(long nWidth, long nHeight); protected: CPoint* m_pPoint; long m_nWidth; long m_nHeight; }; /** @endcond */ # endif AFX_INLINE int CXTPDockingPane::GetID() const { return m_nID; } AFX_INLINE void CXTPDockingPane::SetOptions(DWORD dwOptions) { m_dwOptions = dwOptions; } AFX_INLINE DWORD_PTR CXTPDockingPane::GetPaneData() const { return m_dwData; } AFX_INLINE void CXTPDockingPane::SetPaneData(DWORD_PTR dwData) { m_dwData = dwData; } AFX_INLINE void CXTPDockingPane::SetHelpID(int nIDR) { m_nIDHelp = nIDR; } /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif // #if !defined(__XTPDOCKINGPANE_H__) /** @endcond */