/** * @file XTPTabClientContext.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(__XTPTABCLIENTCONTEXT_H__) # define __XTPTABCLIENTCONTEXT_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" /** * @brief * CXTPTabClientAlphaWnd is CWnd derived class represents alpha context helper window */ class _XTP_EXT_CLASS CXTPAlphaWnd : public CWnd { public: /** * @brief * Constructs a CXTPTabClientAlphaWnd object. */ CXTPAlphaWnd(); /** * @brief * Destroys a CXTPTabClientAlphaWnd object, handles cleanup and deallocation. */ virtual ~CXTPAlphaWnd(); protected: /** @cond */ DECLARE_MESSAGE_MAP() //{{AFX_MSG(CXTPTabClientAlphaWnd) afx_msg BOOL OnEraseBkgnd(CDC* pDC); afx_msg void OnPaint(); //}}AFX_MSG /** @endcond */ }; /** * @brief * CXTPTabClientContext is a standalone class. It is used internally * for docking and sizing tabs. */ class _XTP_EXT_CLASS CXTPTabClientContext { private: class CXTPTabClientContextSticker { public: CXTPTabClientContextSticker(); ~CXTPTabClientContextSticker(); void InitContext(CXTPTabClientContext* pContext); BOOL Enable(); BOOL Update(); void Disable(); int GetLastWorkspace() const; CXTPTabClientWnd* GetLastTarget() const; XTPTabClientStickerPart GetLastSelectedSticker() const; CXTPTabClientSticker* GetSticker() const; private: CXTPTabClientContext* m_pContext; int m_lastWorkspace; CXTPTabClientWnd* m_pLastTarget; XTPTabClientStickerPart m_lastSelectedSticker; CXTPTabClientSticker* m_sticker; HCURSOR m_hCursor; HCURSOR m_hCursorNew; }; # ifndef _XTP_COMMANDBARS_ACTIVEX # ifdef _XTP_INCLUDE_DOCKINGPANE class CXTPDockPaneContextSticker { public: CXTPDockPaneContextSticker(); ~CXTPDockPaneContextSticker(); void InitContext(CXTPTabClientContext* pContext); BOOL Enable(); BOOL Update(); void Disable(); CXTPDockingPaneTabbedContainer* GetLastTarget() const; XTPDockingPaneStickerType GetLastSelectedSticker() const; // CXTPDockPaneSticker* GetSticker() const; private: CXTPTabClientContext* m_pContext; CXTPDockingPaneTabbedContainer* m_pLastTarget; XTPDockingPaneStickerType m_lastSelectedSticker; CXTPDockPaneSticker* m_sticker; HCURSOR m_hCursor; HCURSOR m_hCursorNew; }; # endif # endif class CXTPAlphaWndBase { public: CXTPAlphaWndBase(); virtual ~CXTPAlphaWndBase(); void InitContext(CXTPTabClientContext* pContext); BOOL Enable(); virtual BOOL Update() = 0; void Disable(); protected: CXTPTabClientContext* m_pContext; PVOID m_pfnSetLayeredWindowAttributes; CXTPAlphaWnd m_wndAlpha; typedef BOOL(WINAPI* PFNSETLAYEREDWINDOWATTRIBUTES)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags); }; class CXTPTabClientAlphaWnd : public CXTPAlphaWndBase { public: virtual BOOL Update(); }; # ifndef _XTP_COMMANDBARS_ACTIVEX # ifdef _XTP_INCLUDE_DOCKINGPANE class CXTPDockPaneAlphaWnd : public CXTPAlphaWndBase { public: virtual BOOL Update(); }; # endif # endif class CXTPDraggingContents { public: CXTPDraggingContents(); ~CXTPDraggingContents(); void InitContext(CXTPTabClientContext* pContext); BOOL Enable(); void Update(); void Disable(); private: CXTPTabClientContext* m_pContext; CXTPTabClientDraggingContents* m_pWndDrag; }; class CXTPFocusRectBase { public: CXTPFocusRectBase(); virtual ~CXTPFocusRectBase(); void InitContext(CXTPTabClientContext* pContext); virtual void Enable() = 0; virtual void Update(CRect rcGroup) = 0; void Disable(); protected: void InitLoop(CWnd* pWnd); void CancelLoop(); void DrawFocusRect(BOOL bRemoveRect = FALSE); CXTPTabClientContext* m_pContext; BOOL m_focusRect; CDC* m_pDC; CRect m_rcGroup; CRect m_rectLast; CSize m_sizeLast; }; class CXTPTabFocusRect : public CXTPFocusRectBase { public: virtual void Enable(); virtual void Update(CRect rcGroup); }; # ifndef _XTP_COMMANDBARS_ACTIVEX # ifdef _XTP_INCLUDE_DOCKINGPANE class CXTPDockFocusRect : public CXTPFocusRectBase { public: virtual void Enable(); virtual void Update(CRect rcGroup); }; # endif # endif public: /** * @brief * Constructs a CXTPTabClientContext object */ CXTPTabClientContext(); /** * @brief * Destroys a CXTPTabClientContext object, handles cleanup and deallocation. */ virtual ~CXTPTabClientContext(); /** * @brief * Gets an associated tab client window pointer. * @return * An associated tab client window pointer. */ CXTPTabClientWnd* GetTabClient() const; /** * @brief * Sets an associated tab client window pointer. * @param pTabClientWnd a new associated tab client window pointer. */ void SetTabClient(CXTPTabClientWnd* pTabClientWnd); /** * @brief * Hit tests tab client window at the specific screen point. * @param pt Screen point at which a tab client window is to be tested. * @return * A tab client window pointer at the specific screen point or NULL if no tab client window * is detected. */ CXTPTabClientWnd* FindTargetTabClient(POINT pt) const; # ifndef _XTP_COMMANDBARS_ACTIVEX # ifdef _XTP_INCLUDE_DOCKINGPANE /** * @brief * Hit tests dockpane window at the specific screen point. * @param pt Screen point at which a dockpane window is to be tested. * @return * A tab client window pointer at the specific screen point or NULL if no dockpane window * is detected. */ CXTPDockingPaneTabbedContainer* FindTargetDockPane(POINT pt) const; # endif # endif /** * @brief * Gets a flag value that controls whether tab client stickers will be shown when * needed. * @return * TRUE if stickers will be shown when needed, or FALSE otherwise. */ BOOL GetShowTabClientContextStickers() const; /** * @brief * Sets a flag value that controls whether tab client stickers will be shown when * needed. * @param value TRUE to show stickers, or FALSE otherwise. */ void SetShowTabClientContextStickers(BOOL value); /** * @brief * Gets a flag that controls whether tab client context will be drawn as a * semi-transparent rectangle. * @return * TRUE if tab client context is to be drawn semi-transparent, FALSE otherwise. */ BOOL GetAlphaTabClientContext() const; /** * @brief * Sets a flag that controls whether tab client context will be drawn as a * semi-transparent rectangle. * @param value TRUE to enable semi-transparent rectangle drawing, FALSE otherwise. */ void SetAlphaTabClientContext(BOOL value); /** * @brief * Gets a flag that controls whether tab floating frame contents will be shown while * dragging. * @return * TRUE if contents is to be shown while dragging, FALSE otherwise. */ BOOL GetShowContentsWhileDragging() const; /** * @brief * Sets a flag that controls whether tab floating frame contents will be shown while * dragging. * @param value TRUE to show contents while dragging, FALSE otherwise. */ void SetShowContentsWhileDragging(BOOL value); /** * @brief * Gets a flag that controls whether tab floating floating frame enables frame theme * set for the primary tab client. * @return * TRUE if frame theme is enabled, FALSE otherwise. */ BOOL IsFloatingFrameThemeEnabled() const; /** * @brief * Sets a flag that controls whether tab floating floating frame enables frame theme * set for the primary tab client. * @param value TRUE if frame theme is enabled, FALSE otherwise. */ void EnableFloatingFrameTheme(BOOL value); /** * @brief * Enables tab stickers. * @return * TRUE if stickers are enabled, FALSE otherwise. * @see * DisableTabSticker */ BOOL EnableTabSticker(); /** * @brief * Disables tab stickers. * @see * EnableTabSticker */ void DisableTabSticker(); /** * @brief * Updates tab stickers. * @return TRUE if operation succeedes, FALSE otherwise. */ BOOL UpdateTabSticker(); # ifndef _XTP_COMMANDBARS_ACTIVEX # ifdef _XTP_INCLUDE_DOCKINGPANE /** * @brief * Enables dock stickers. * @return * TRUE if stickers are enabled, FALSE otherwise. * @see * DisableTabSticker */ BOOL EnableDockSticker(); /** * @brief * Disables dock stickers. * @see * EnableDockSticker */ void DisableDockSticker(); /** * @brief * Updates dock stickers. */ BOOL UpdateDockSticker(); # endif # endif /** * @brief * Enables tab context window. * @return * TRUE if the context window is enabled. * @see * DisableTabContextWindow. */ BOOL EnableTabContextWindow(); /** * @brief * Disables context window. * @see * EnableTabContextWindow */ void DisableTabContextWindow(); /** * @brief * Updates tab context window. * @return * TRUE if context window is updated, FALSE otherwise. */ BOOL UpdateTabContextWindow(); # ifndef _XTP_COMMANDBARS_ACTIVEX # ifdef _XTP_INCLUDE_DOCKINGPANE /** * @brief * Enables dock context window. * @return * TRUE if the context window is enabled. * @see * DisableDockContextWindow. */ BOOL EnableDockContextWindow(); /** * @brief * Disables dock context window. * @see * EnableDockContextWindow */ void DisableDockContextWindow(); /** * @brief * Updates dock context window. * @return * TRUE if context window is updated, FALSE otherwise. */ BOOL UpdateDockContextWindow(); # endif # endif /** * @brief * Enables/disables dragging tab client context contents. */ void EnableDraggingContents(); /** * @brief * Enables/disables dragging tab client context contents. */ void DisableDraggingContents(); /** * @brief * Updates tab client context contents while dragging. */ void UpdateDraggingContents(); /** * @brief * Enables/disables showing focus rectangle for a dragged tab client context contents. */ void EnableTabFocusRect(); /** * @brief * Enables/disables showing focus rectangle for a dragged tab client context contents. */ void DisableTabFocusRect(); /** * @brief * Updates focus rectangle. * @param rcGroup New focus rectangle value. */ void UpdateTabFocusRect(CRect rcGroup); # ifndef _XTP_COMMANDBARS_ACTIVEX # ifdef _XTP_INCLUDE_DOCKINGPANE void EnableDockFocusRect(); void DisableDockFocusRect(); void UpdateDockFocusRect(CRect rcGroup); # endif # endif /** * @brief * Obtains the last target tab client window pointed by the mouse while dragging a frame. * @return * A pointer to the last pointed target tab client window or NULL is there is no such. */ CXTPTabClientWnd* GetLastTargetTabClient() const; # ifndef _XTP_COMMANDBARS_ACTIVEX # ifdef _XTP_INCLUDE_DOCKINGPANE CXTPDockingPaneTabbedContainer* GetLastTargetDockPane() const; # endif # endif /** * @brief * Obtains the last pointed workspace index. * @return * The last pointed workspace index. */ int GetLastWorkspace() const; /** * @brief * Obtains the last pointed sticker identifier. * @return * The last pointed sticker identifier. * @see * XTPTabClientStickerPart */ XTPTabClientStickerPart GetLastSelectedTabClientSticker() const; # ifndef _XTP_COMMANDBARS_ACTIVEX # ifdef _XTP_INCLUDE_DOCKINGPANE XTPDockingPaneStickerType GetLastSelectedDockSticker() const; # endif # endif /** * @brief * Obtains the pointer to the last pointed sticker or NULL is there is no such. * @return * The pointer to the last pointed sticker or NULL is there is no such. */ CXTPTabClientSticker* GetSticker() const; private: BOOL m_bShowTabClientContextStickers; /**< If TRUE, tab client context stickers are drawn when the tab is being dragged and dropped. m_bAlphaTabClientContext must be TRUE.*/ BOOL m_bAlphaTabClientContext; /**< If TRUE, alpha tab client context is used when dragging a tab, the shaded area indicates the tab new location of dropped.*/ BOOL m_bShowContentsWhileDragging; /**< If TRUE, window contents is visible while dragging. */ BOOL m_bThemedFloatingFrames; /**< If TRUE, floating Tab frame will use the currently set theme. */ CXTPTabClientWnd* m_pTabClientWnd; /**< Tabbed client. */ CXTPTabClientContextSticker m_tabSticker; CXTPTabClientAlphaWnd m_tabAlphaWnd; CXTPTabFocusRect m_tabFocusRect; # ifndef _XTP_COMMANDBARS_ACTIVEX # ifdef _XTP_INCLUDE_DOCKINGPANE CXTPDockPaneContextSticker* m_pDockSticker; CXTPDockPaneAlphaWnd* m_pDockAlphaWnd; CXTPDockFocusRect* m_pDockFocusRect; # else // Required for padding. LPVOID m_pDockSticker; LPVOID m_pDockAlphaWnd; LPVOID m_pDockFocusRect; # endif # endif CXTPDraggingContents m_draggingContents; }; AFX_INLINE void CXTPTabClientContext::SetShowTabClientContextStickers(BOOL value) { m_bShowTabClientContextStickers = value; } AFX_INLINE void CXTPTabClientContext::SetAlphaTabClientContext(BOOL value) { m_bAlphaTabClientContext = value; } AFX_INLINE void CXTPTabClientContext::SetShowContentsWhileDragging(BOOL value) { m_bShowContentsWhileDragging = value; } AFX_INLINE void CXTPTabClientContext::EnableFloatingFrameTheme(BOOL value) { m_bThemedFloatingFrames = value; } AFX_INLINE BOOL CXTPTabClientContext::GetAlphaTabClientContext() const { return m_bAlphaTabClientContext; } AFX_INLINE BOOL CXTPTabClientContext::GetShowTabClientContextStickers() const { return m_bShowTabClientContextStickers; } AFX_INLINE BOOL CXTPTabClientContext::GetShowContentsWhileDragging() const { return m_bShowContentsWhileDragging; } AFX_INLINE BOOL CXTPTabClientContext::IsFloatingFrameThemeEnabled() const { return m_bThemedFloatingFrames; } AFX_INLINE CXTPTabClientWnd* CXTPTabClientContext::GetLastTargetTabClient() const { return m_tabSticker.GetLastTarget(); } # ifndef _XTP_COMMANDBARS_ACTIVEX # ifdef _XTP_INCLUDE_DOCKINGPANE AFX_INLINE CXTPDockingPaneTabbedContainer* CXTPTabClientContext::GetLastTargetDockPane() const { return m_pDockSticker->GetLastTarget(); } # endif # endif AFX_INLINE int CXTPTabClientContext::GetLastWorkspace() const { return m_tabSticker.GetLastWorkspace(); } AFX_INLINE XTPTabClientStickerPart CXTPTabClientContext::GetLastSelectedTabClientSticker() const { return m_tabSticker.GetLastSelectedSticker(); } # ifndef _XTP_COMMANDBARS_ACTIVEX # ifdef _XTP_INCLUDE_DOCKINGPANE AFX_INLINE XTPDockingPaneStickerType CXTPTabClientContext::GetLastSelectedDockSticker() const { return m_pDockSticker->GetLastSelectedSticker(); } # endif # endif AFX_INLINE CXTPTabClientSticker* CXTPTabClientContext::GetSticker() const { return m_tabSticker.GetSticker(); } /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif // !defined(__XTPTABCLIENTCONTEXT_H__) /** @endcond */