/** * @file XTPTabClientWnd.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(__TABCLIENTWNDEX_H__) && defined(_XTP_INCLUDE_TABMANAGER) # define __TABCLIENTWNDEX_H__ /** @endcond */ # if _MSC_VER >= 1000 # pragma once # endif // _MSC_VER >= 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPMarkupContext; class CXTPTearOffFrame; class CXTPTabClientContext; # ifndef _XTP_COMMANDBARS_ACTIVEX # ifdef _XTP_INCLUDE_DOCKINGPANE class CXTPDockingPaneManager; class CXTPDockingPaneTabbedContainer; # endif # endif /** * @brief * The WM_XTP_PRETRANSLATEMOUSEMSG message is sent to the owner window to * pre-translate mouse messages. * @param point CPoint((DWORD)lParam) mouse cursor position. * @param wParam mouse notification. * @return * If the application is to process this message, the return value * should be TRUE. * * Example: * Here is an example of how an application would process the WM_XTP_PRETRANSLATEMOUSEMSG * message. *
 * BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
 *     //{{AFX_MSG_MAP(CMainFrame)
 *     ON_MESSAGE(WM_XTP_PRETRANSLATEMOUSEMSG, OnTabbarMouseMsg)
 *     //}}AFX_MSG_MAP
 * END_MESSAGE_MAP()
 *
 * LRESULT CMainFrame::OnTabbarMouseMsg(WPARAM wParam, LPARAM lParam)
 * {
 *    CPoint point = CPoint((DWORD)lParam);
 *
 *    CXTPTabManagerItem* pItem =  m_MTIClientWnd.HitTest(point);
 *
 *    if (pItem)
 *    {
 *       if (wParam == WM_RBUTTONDOWN)
 *       {
 *
 *          CWnd* pFrame = CWnd::FromHandle(pItem->GetHandle());
 *          MDIActivate(pFrame);
 *
 *          m_MTIClientWnd.Refresh();
 *
 *          CMenu menuPopup;
 *          VERIFY(menuPopup.LoadMenu(IDR_WORKSPACE_POPUP));
 *
 *          m_MTIClientWnd.WorkspaceToScreen(&point);
 *          CXTPCommandBars::TrackPopupMenu(menuPopup.GetSubMenu(0), 0, point.x, point.y, this);
 *
 *          m_MTIClientWnd.Refresh();
 *
 *          return TRUE;
 *       }
 *    }
 *
 *    return FALSE;
 * }
 * 
* @see * CXTPTabClientWnd */ const UINT WM_XTP_PRETRANSLATEMOUSEMSG = (WM_XTP_COMMANDBARS_BASE + 20); /** * @brief * The WM_XTP_GETWINDOWTEXT message is sent to the MDI child window to * retrieve the text that will be used for the tabbed interface. * @details * If application returns 0, CDocument::GetTitle will be used. You can override * CXTPTabClientWnd::GetItemText instead of process the message. * @return * Pointer to a null-terminated string that specifies the text to be used. * * Example: * Here is an example of how an application would process the WM_XTP_GETWINDOWTEXT * message. *
 * BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
 *     //{{AFX_MSG_MAP(CChildFrame)
 *     ON_MESSAGE(WM_XTP_GETWINDOWTEXT, OnGetTabText)
 *     //}}AFX_MSG_MAP
 * END_MESSAGE_MAP()
 *
 * LRESULT CChildFrame::OnGetTabText(WPARAM //wParam//, LPARAM //lParam//)
 * {
 *    return (LPCTSTR)m_strCaption;
 * }
 * 
* @see * CXTPTabClientWnd, WM_XTP_GETTABICON, WM_XTP_GETWINDOWTOOLTIP */ const UINT WM_XTP_GETWINDOWTEXT = (WM_XTP_COMMANDBARS_BASE + 21); /** * @brief * The WM_XTP_GETWINDOWTOOLTIP message is sent to the MDI child window to * retrieve tooltips for CXTPTabClientWnd's tabs. * @details * You must call CXTPTabClientWnd::EnableToolTips to enable tooltips. * @return * Pointer to a null-terminated string that specifies the tooltip to be used.

* If the application returns 0, CDocument::GetPathName will be used. * * Example: * Here is an example of how an application would process the WM_XTP_GETWINDOWTOOLTIP * message. *

 * BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
 *     //{{AFX_MSG_MAP(CChildFrame)
 *     ON_MESSAGE(WM_XTP_GETWINDOWTOOLTIP, OnGetTabTip)
 *     //}}AFX_MSG_MAP
 * END_MESSAGE_MAP()
 *
 * LRESULT CChildFrame::OnGetTabTip(WPARAM //wParam//, LPARAM //lParam//)
 * {
 *    return (LPCTSTR)m_strToolTip;
 * }
 * 
* @see * CXTPTabClientWnd, WM_XTP_GETTABICON, WM_XTP_GETWINDOWTEXT */ const UINT WM_XTP_GETWINDOWTOOLTIP = (WM_XTP_COMMANDBARS_BASE + 23); /** * @brief * The WM_XTP_NEWTABITEM message is sent to the owner window when a new tab is created. * @param pNewItem (CXTPTabManagerItem*)wParam. Pointer to the tab that was created. * * Example: * Here is an example of how an application would process the WM_XTP_NEWTABITEM * message. *
 * BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
 *     //{{AFX_MSG_MAP(CMainFrame)
 *     ON_MESSAGE(WM_XTP_NEWTABITEM, OnTabbarNewItem)
 *     //}}AFX_MSG_MAP
 * END_MESSAGE_MAP()
 *
 * LRESULT CMainFrame::OnTabbarNewItem(WPARAM wParam, LPARAM //lParam//)
 * {
 *    CXTPTabManagerItem* pItem = (CXTPTabManagerItem*)wParam;
 *    return 0;
 * }
 * 
* @see * CXTPTabClientWnd */ const UINT WM_XTP_NEWTABITEM = (WM_XTP_COMMANDBARS_BASE + 24); /** * @brief * The WM_XTP_TABTODOCKPANE message is sent to the owner window when a tab * is being docked to Docking Panes. * @param pNewItem (CXTPTabManagerItem*)wParam. Pointer to the tab that is being docking. * @return * A new docking pane ID to be used for a new pane to be created. * * Example: * Here is an example of how an application would process the WM_XTP_NEWTABITEM * message. *
 * BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
 *     //{{AFX_MSG_MAP(CMainFrame)
 *     ON_MESSAGE(WM_XTP_TABTODOCKPANE, OnTabbarDockPane)
 *     //}}AFX_MSG_MAP
 * END_MESSAGE_MAP()
 *
 * LRESULT CMainFrame::OnTabbarDockPane(WPARAM wParam, LPARAM //lParam//)
 * {
 * CXTPTabManagerItem* pItem = (CXTPTabManagerItem*)wParam;
 * return 123;
 * }
 * 
* @see * CXTPTabClientWnd */ const UINT WM_XTP_TABTODOCKPANE = (WM_XTP_COMMANDBARS_BASE + 26); /** * @brief * The WM_XTP_PRETRANSLATEMOUSEMSG_EX message is sent to the main window * from TearOffFrame to pre-translate mouse messages. * @param wParam mouse notification. * @param lParam pointer to TTHITTESTINFO struct. * @return * If the application is to process this message, the return value * should be TRUE. * * Example: * Here is an example of how an application would process the WM_XTP_PRETRANSLATEMOUSEMSG_EX * message. *
 * BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
 *     //{{AFX_MSG_MAP(CMainFrame)
 *     ON_MESSAGE(WM_XTP_PRETRANSLATEMOUSEMSG_EX, OnTabbarMouseMsgEx)
 *     //}}AFX_MSG_MAP
 * END_MESSAGE_MAP()
 *
 * LRESULT CMainFrame::OnTabbarMouseMsgEx(WPARAM wParam, LPARAM lParam)
 * {
 *    if (wParam != WM_RBUTTONDOWN)
 *       return FALSE;
 *
 *    TTHITTESTINFO* info = reinterpret_cast(lParam);
 *
 *    CWnd* pWnd = CWnd::FromHandle(info->hwnd);
 *    CXTPTabClientWnd* pTabClientWnd = DYNAMIC_DOWNCAST(CXTPTabClientWnd, pWnd);
 *    CXTPTabManagerItem* pItem = pTabClientWnd->HitTest(info->pt);
 *    if (!pItem)
 *       return FALSE;
 *
 *    CFrameWnd* pFrame = DYNAMIC_DOWNCAST(CMDIChildWnd, CWnd::FromHandle(pItem->GetHandle()));
 *    if (!pFrame)
 *       return FALSE;
 *
 *    MDIActivate(pFrame);
 *    pFrame->GetActiveView()->SetFocus();
 *
 *    pTabClientWnd->Refresh();
 *
 *    CMenu menu;
 *    VERIFY(XTPResourceManager()->LoadMenu(&menu, IDR_POPUP_TABS_EX));
 *    CMenu* pPopup = menu.GetSubMenu(0);
 *
 *    pTabClientWnd->WorkspaceToScreen(&info->pt);
 *
 *    CXTPPopupBar* pPopupBar = (CXTPPopupBar*)CXTPPopupBar::CreatePopupBar(GetCommandBars());
 *    VERIFY(pPopupBar->LoadMenu(pPopup));
 *    VERIFY(pPopupBar->Popup(info->pt.x, info->pt.y, NULL));
 *
 *    while (pPopupBar->IsTrackingMode())
 *    {
 *       AfxGetApp()->PumpMessage();
 *    }
 *    pPopupBar->InternalRelease();
 *
 *    pTabClientWnd->Refresh();
 *    return TRUE;
 * }
 * 
* @see * CXTPTabClientWnd */ const UINT WM_XTP_PRETRANSLATEMOUSEMSG_EX = (WM_XTP_COMMANDBARS_BASE + 28); /** * @brief * The WM_XTP_SETACTIVEWORKSPACE message is sent to the owner window when * workspace changed. * @param wParam Active workspace. * @return * If the application is to process this message, the return value * should be TRUE. */ const UINT WM_XTP_SETACTIVEWORKSPACE = (WM_XTP_COMMANDBARS_BASE + 29); /** * @brief * Workspace buttons enumerator. Used to indicate which tab navigation * buttons to display in the TabWorkspace. * * Example: *
m_MTIClientWnd.SetFlags(xtpWorkspaceHideClose);
* @see CXTPTabClientWnd::SetFlags, xtpWorkspaceHideArrows, xtpWorkspaceHideClose, * xtpWorkspaceHideAll */ enum XTPWorkspaceButtons { xtpWorkspaceHideArrows = 1, /**< To hide arrow buttons. */ xtpWorkspaceHideClose = 2, /**< To hide close button. */ xtpWorkspaceHideAll = 3, /**< To hide arrow and close buttons. */ xtpWorkspaceShowActiveFiles = 4, /**< To show active file button. */ xtpWorkspaceHideArrowsAlways = 1 + 8, /**< To hide arrow buttons always */ xtpWorkspaceShowCloseTab = 16, /**< To show close button for all tabs. */ xtpWorkspaceShowCloseSelectedTab = 32, /**< To show close button for selected tabs.*/ }; /** * @brief * XTPWorkspaceNewTabPosition enumerator. Used to determine where new tabs will appear. * * Example: *
m_MTIClientWnd.SetNewTabPosition(xtpWorkspaceNewTabLeftMost);
* @see * CXTPTabClientWnd::SetNewTabPosition, xtpWorkspaceNewTabRightMost, xtpWorkspaceNewTabLeftMost, * xtpWorkspaceNewTabNextToActive */ enum XTPWorkspaceNewTabPosition { xtpWorkspaceNewTabRightMost, /**< New tab will be created after all tabs.*/ xtpWorkspaceNewTabLeftMost, /**< New tab will be created before all tabs.*/ xtpWorkspaceNewTabNextToActive /**< New tab will be created after active tab.*/ }; /** * @brief * XTPWorkspaceActivateTab enumerator. Used to determine which tab will * become active after the currently active tab is closed. * @see * CXTPTabClientWnd.SetAfterCloseActiveTab, xtpWorkspaceActivateNextToClosed, * xtpWorkspaceActivateTopmost */ enum XTPWorkspaceActivateTab { xtpWorkspaceActivateNextToClosed, /**< Activate tab next to the closed tab.*/ xtpWorkspaceActivateTopmost /**< Activate the left-most tab.*/ }; /** @cond */ class CXTPTabPaintManager; class CXTPCommandBars; class CXTPMDIFrameWnd; class CXTPToolTipContext; /** @endcond */ # define XTP_TABCLIENT_ACTION_CANCEL 0 # define XTP_TABCLIENT_ACTION_POPUP 1 # define XTP_TABCLIENT_ACTION_ATTACH_CENTER 2 # define XTP_TABCLIENT_ACTION_ATTACH_LEFT 3 # define XTP_TABCLIENT_ACTION_ATTACH_RIGHT 4 # define XTP_TABCLIENT_ACTION_ATTACH_TOP 5 # define XTP_TABCLIENT_ACTION_ATTACH_BOTTOM 6 # define XTP_TABCLIENT_ACTION_DETACH 7 # define XTP_TABCLIENT_ACTION_ATTACH_TEAR_OFF_CENTER 8 # define XTP_TABCLIENT_ACTION_ATTACH_TEAR_OFF_LEFT 9 # define XTP_TABCLIENT_ACTION_ATTACH_TEAR_OFF_RIGHT 10 # define XTP_TABCLIENT_ACTION_ATTACH_TEAR_OFF_TOP 11 # define XTP_TABCLIENT_ACTION_ATTACH_TEAR_OFF_BOTTOM 12 # define XTP_TABCLIENT_NO_ACTION 14 # ifndef _XTP_COMMANDBARS_ACTIVEX # ifdef _XTP_INCLUDE_DOCKINGPANE # define XTP_TABCLIENT_ACTION_DOCK_CENTER 15 # define XTP_TABCLIENT_ACTION_DOCK_LEFT 16 # define XTP_TABCLIENT_ACTION_DOCK_RIGHT 17 # define XTP_TABCLIENT_ACTION_DOCK_TOP 18 # define XTP_TABCLIENT_ACTION_DOCK_BOTTOM 19 # endif # endif /** * @brief * CXTPTabClientWnd is a CWnd derived class. It represents a tabbed * workspace. */ class _XTP_EXT_CLASS CXTPTabClientWnd : public CWnd , public CXTPTabManagerAtom { /** @cond */ DECLARE_DYNAMIC(CXTPTabClientWnd) class CTabClientDropTarget; class CNavigateButtonActiveFiles; /** @endcond */ public: class CWorkspace; class CSingleWorkspace; public: /** * @brief * Constructs a CXTPTabClientWnd object. */ CXTPTabClientWnd(); /** * @brief * Destroys a CXTPTabClientWnd object, handles cleanup and deallocation. */ virtual ~CXTPTabClientWnd(); public: /** * @brief * Attaches the tabbed workspace. * @param pParentFrame Pointer to a CMDIFrameWnd object. * @param bEnableGroups TRUE to enable groups. * @return * TRUE if successful, otherwise FALSE. */ BOOL Attach(CXTPMDIFrameWnd* pParentFrame, BOOL bEnableGroups = FALSE); /** * @brief * Attaches the tabbed workspace. * @param pParentFrame Pointer to a CMDIFrameWnd object. * @param bEnableGroups TRUE to enable groups. * @param pCommandBars Pointer to a CXTPCommandBars object. * @return * TRUE if successful, otherwise FALSE. */ BOOL Attach(CXTPCommandBars* pCommandBars, CMDIFrameWnd* pParentFrame, BOOL bEnableGroups); /** * @brief * Detaches the tabbed workspace. * @return * TRUE if successful, otherwise FALSE. */ BOOL Detach(); /** * @brief * Determines if a tab workspace is attached. * @return * TRUE if attached, otherwise FALSE. */ BOOL IsAttached() const; /** * @brief * Retrieves the parent frame of the control. * @return * Pointer to a CMDIFrameWnd object. */ CMDIFrameWnd* GetParentFrame() const; /** * @brief * Determines if right-to-left (RTL) mode is set. * @return * TRUE if text is displayed using right-to-left (RTL) * reading-order properties. */ BOOL IsLayoutRTL() const; /** * @brief * Specifies if right-to-left (RTL) mode should be set. * @param bRightToLeft TRUE to display text using right-to-left (RTL) * reading-order properties. */ void SetLayoutRTL(BOOL bRightToLeft); /** * @brief * Call this member to set where new tab must appear. * @param tabPosition Position of new tab regarding other tabs. * It can be one of the following: * xtpWorkspaceNewTabRightMost: New tab will be created after all * tabs. * xtpWorkspaceNewTabLeftMost: New tab will be created before all * tabs. * xtpWorkspaceNewTabNextToActive: New tab will be created after * active tab. */ void SetNewTabPosition(XTPWorkspaceNewTabPosition tabPosition); /** * @brief * Call this member to set where new tab must appear. * @param activeTab Enumerator that determines which tab will be activated after closing another * one. * It can be one of the following: * xtpWorkspaceActivateNextToClosed: Activate tab next to the * closed tab. * xtpWorkspaceActivateTopmost: Activate the top-most tab. * @see * XTPWorkspaceNewTabPosition, GetNewTabPositon, XTPWorkspaceActivateTab */ void SetAfterCloseActiveTab(XTPWorkspaceActivateTab activeTab); /** * @brief * This method is called to determine where the new tab must appear. * @return * XTPWorkspaceNewTabPosition enumerator that shows where the new tab must appear. * @see * XTPWorkspaceNewTabPosition, SetNewTabPosition */ XTPWorkspaceNewTabPosition GetNewTabPositon() const; /** * @brief * Saves Position state. */ void SaveState(); /** * @brief * Loads previous docking state. */ void LoadState(); /** * @brief * Scan through all MDIChild windows and update the corresponding * tab items if any changes happened (e.g. window text or active MDIChild). */ virtual void UpdateContents(); /** * @brief * This method is called to create a new CWorkspace class. * You can override it for a custom Workskspace. * @return A newly created workspace object pointer. */ virtual CWorkspace* CreateWorkspace(); /** * @brief * Call this member to set the flags of the tab workspace. * @param dwButtons Buttons to hide. Can be any of the values listed in the * remarks section. * @details * dwButtons can be one of the following: * xtpWorkspaceHideArrows: Hides the arrow buttons. * xtpWorkspaceHideClose: Hides the close button. * xtpWorkspaceHideAll: Hides the arrow and close buttons. * @see * GetFlags, XTPWorkspaceButtons */ void SetFlags(DWORD dwButtons); /** * @brief * Call this member to determine which tab navigation buttons are * currently displayed in the tab workspace. * @return * Retrieves the tab navigation flags of the tab workspace. * @see * SetFlags, XTPWorkspaceButtons */ DWORD GetFlags() const; /** * @brief * Call this member function to enable/disable tooltips show. * @param behaviour Tooltips behaviour to be set. See remarks section for available flags. * @details * behaviour parameter can be one of the following: * xtpTabToolTipNever: Show tooltips for tabs always. * xtpTabToolTipAlways: Doesn't show tooltips for tabs. * xtpTabToolTipShrinkedOnly: Show tooltips only if tab was shrinked * (see xtpTabLayoutSizeToFit layout). */ void EnableToolTips(XTPTabToolTipBehaviour behaviour = xtpTabToolTipAlways); /** * @brief * Call this method to retrieve the paint manager. * @return * A pointer to a CXTPTabPaintManager object. */ CXTPTabPaintManager* GetPaintManager() const; /** * @brief * Call this member to set the specified paint manager. * @param pPaintManager Pointer to a CXTPTabPaintManager object. */ void SetPaintManager(CXTPTabPaintManager* pPaintManager); /** * @brief * Call this member to specify whether auto themes are used for the * TabWorkspace. * @param bAutoTheme TRUE to use auto themes. * @details * By default, AutoTheme = TRUE. When AutoTheme = TRUE, the theme * of the TabWorkspace will change when the theme of the CommandBars * control is changed. Set AutoTheme = FALSE to keep the currently * set theme even if the CommandBars theme is changed. */ void SetAutoTheme(BOOL bAutoTheme = FALSE); /** * @brief * Call this member to determine if auto themes are used to * theme the TabWorkspace. * @return * TRUE if auto themes are used to theme the TabWorkspace, FALSE * if auto themes are not used. */ BOOL GetAutoTheme() const; /** * @brief * Call this member to find the item that corresponds to the * specified window. * @param hWnd Handle of the window. * @return * A pointer to a CXTPTabManagerItem object. */ CXTPTabManagerItem* FindItem(const HWND hWnd) const; /** * @brief * Call this function to determine which tab, if any, is at the * specified screen position. * @param pt Point to be tested. * @return * The zero-based index of the tab, or returns -1 if no tab is * at the specified position. */ CXTPTabManagerItem* HitTest(CPoint pt) const; /** * @brief * Call this member to retrieve the current number of workspaces. * @return * An integer value that represents the current number of workspaces. * @details * If tab groups are enabled, then there will be more than * one workspace. If tab groups are disabled, then there is only 1 * workspace with an index of 0. * @see * GetWorkspace */ int GetWorkspaceCount() const; /** * @brief * Call this member to return the workspace at the specified index. * @param nIndex An integer index starting at 0. * @return * A pointer to the workspace currently at this index. * @details * If tab groups are enabled, then there will be more than * one workspace. If tab groups are disabled, then there is only 1 * workspace with an index of 0. * @see * GetWorkspaceCount */ CWorkspace* GetWorkspace(int nIndex) const; /** * @brief * Returns the workspace command mode. * @param nID Specifies the identifier of the workspace. * @param ppItem MDI active item. * @details * Call this member function if you want to determine whether or * not workspace command is enabled. * @return * TRUE when workspace command is enabled, FALSE when it is disabled. */ BOOL IsWorkspaceCommandEnabled(UINT nID, CXTPTabManagerItem** ppItem = NULL); /** * @brief * Creates a new vertical group. */ void CreateNewVerticalGroup(); /** * @brief * Creates a new horizontal group. */ void CreateNewHorizontalGroup(); /** * @brief * Moves an item to the previous group. */ void MoveToPreviousGroup(); /** * @brief * Moves an item to the next group. */ void MoveToNextGroup(); /** * @brief * Call this method to refresh all the items. * @param bRecalcLayout TRUE to recalculate the layout of the frame. */ void Refresh(BOOL bRecalcLayout = TRUE); /** * @brief * Converts the workspace coordinates of a given point on the * display to screen coordinates. * @param lpPoint Pointer to a POINT structure or CPoint object that * contains the client coordinates to be converted. */ void WorkspaceToScreen(LPPOINT lpPoint) const; /** * @brief * Converts the screen coordinates of a given point or rectangle on the * display to client coordinates. * @param lpPoint Pointer to a CPoint object or POINT structure that * contains the screen coordinates to be converted. */ void ScreenToWorkspace(LPPOINT lpPoint) const; /** * @brief * Call this member function to show/hide the workspace. * @param bShow TRUE to show the workspace, FALSE to hide it. */ void ShowWorkspace(BOOL bShow); /** * @brief * Call this method to set the custom workspace control. * @param pWorkspace Custom workspace control. */ void SetTabWorkspace(CWorkspace* pWorkspace); /** * @brief * Returns the current reordering allowance. * @return * TRUE when reordering is allowed, FALSE when it is disallowed. */ BOOL IsAllowReorder() const; /** * @brief * Call this member function to allow or disallow reordering. * @param bAllowReorder TRUE for allowing reordering, * FALSE for disallowing reordering. */ void SetAllowReorder(BOOL bAllowReorder); /** * @brief * This member is called when the background is filled. * @param pDC Pointer to a valid device context. * @param rc Rectangle area to be filled. */ virtual void OnFillBackground(CDC* pDC, CRect rc); /** * @brief * This member is called when the client is drawn. * @param pDC Pointer to a valid device context. * @param rc Rectangle area to be drawn. */ virtual void OnDraw(CDC* pDC, CRect rc); /** * @brief * Call this method to get a pointer to the tooltip context. * @return * A pointer to the tooltip context. */ CXTPToolTipContext* GetToolTipContext() const; /** * @brief * Call this member to use trackers. * @param bSplitterTracker TRUE to use trackers. * @details * This member function will display the contents for child windows * while the splitter is resized if bSplitterTracker is set to FALSE. * @see * IsSplitterTrackerUsed */ void UseSplitterTracker(BOOL bSplitterTracker); /** * @brief * Call this member to determine if the splitter tracker is used. * @return * TRUE if the splitter tracker is used, otherwise FALSE. * @see * UseSplitterTracker */ BOOL IsSplitterTrackerUsed() const; /** * @brief * Gets the command bars object. * @return * A pointer to the command bars object (can be NULL). */ virtual CXTPCommandBars* GetCommandBars() const; /** * @brief * Sets the command bars object * @param pCommandBars A new command bars object point */ void SetCommandBars(CXTPCommandBars* pCommandBars); /** * @brief * Call this member to tile child windows in the workspace * (only if EnableGroups is enabled). * @param bHorizontal TRUE to tile horizontally. */ void MDITile(BOOL bHorizontal); /** * @brief * Returns an item by its index. * @param nIndex Zero-based index of the item in the collection. * @details * You use this member function to get an item from collection by * item index. If the given index is less than 0 or greater than * the value returned by GetItemCount(), GetItem() returns NULL. * @return * Pointer to the found item, if any, or NULL otherwise. */ CXTPTabManagerItem* GetItem(int nIndex) const; /** * @brief * Returns the number of items. * @return * The number of items. */ int GetItemCount() const; /** * @brief * Call this method to reposition items. */ virtual void Reposition(); /** * @brief * This member function is used to enable/disable Markup * functionality for the control. * @param bEnableMarkup A BOOL. Specifies whether Markup functionality * should be enabled (TRUE) or disabled (FALSE). */ void EnableMarkup(BOOL bEnableMarkup); /** * @brief * Call this method to add an Explorer 7 style new window tab button. * @param bShowNewWindowTab TRUE to show new window tab button. * @param nCommand Command to execute. */ void ShowNewWindowTab(BOOL bShowNewWindowTab = TRUE, int nCommand = ID_FILE_NEW); /** * @brief * Call this member to find the specified index. * @param pWorkspace Pointer to a CXTPTabManger object. * @return * The index of the matching item. */ int FindIndex(CXTPTabManager* pWorkspace) const; //{{AFX_CODEJOCK_PRIVATE _XTP_DEPRECATED_IN_FAVOR4(CreateNewVerticalGroup, CreateNewHorizontalGroup, MoveToPreviousGroup, MoveToNextGroup) void OnWorkspaceCommand(UINT nID); //}}AFX_CODEJOCK_PRIVATE protected: /** * @brief * If m_bAutoTheme is FALSE, then it checks to see if the theme * set for the TabWorkspace is different from the theme set for * the CommandBars. If the themes are different, then the TabWorkSpace * theme is set to the theme specified in m_themeCommandBars. */ virtual void CheckCommandBarsTheme(); /** * @brief * Retrieves the current active MDI child window. * @return * A pointer to the active MDI child window. */ virtual CWnd* MDIGetActive(); /** * @brief * Call this member function to activate an MDI child window * independently of the MDI frame window. * @param pWnd Pointer to a valid device context. */ virtual void MDIActivate(CWnd* pWnd); /** * @brief * This member function retrieves the text of a specific tab. * @param pChildWnd A CWnd pointer that represents the child to be * displayed when the window is activated. * @return * The text of a particular tab, or NULL if an error occurs. */ virtual CString GetItemText(const CWnd* pChildWnd) const; /** * @brief * This member function returns the RGB value for the referenced * item text, or (COLORREF)-1 if the color was not set. * @param pItem A pointer to a CXTPTabManagerItem. * @return * The RGB value for the referenced item text, or (COLORREF)-1 * if the color was not set. */ virtual COLORREF GetItemColor(const CXTPTabManagerItem* pItem) const; /** * @brief * This member function retrieves the icon of a specific tab. * @param pItem A pointer to a CXTPTabManagerItem. * @return * The icon of a particular tab, or NULL if an error occurs. */ virtual HICON GetItemIcon(const CXTPTabManagerItem* pItem) const; /** * @brief * Returns the tooltip associated with the specified item. * @param pItem Pointer to a CXTPTabManagerItem object. * @return * Associated tooltip. */ virtual CString GetItemTooltip(const CXTPTabManagerItem* pItem) const; /** * @brief * Call this member function to add a workspace. * @param nIndex Index of the workspace. * @return * TRUE if successful, otherwise FALSE. */ virtual CWorkspace* AddWorkspace(int nIndex = -1); /** * @brief * This member function adds a new tab item for the specified window. * @param pChildWnd A CWnd pointer that represents the child to be * displayed when the window is activated. * @return * A pointer to a CXTPTabManagerItem object. */ virtual CXTPTabManagerItem* AddItem(CWnd* pChildWnd); /** * @brief * This member function sets a workspace active. * @param pWorkspace Pointer to a CWorkspace object. */ void SetActiveWorkspace(CWorkspace* pWorkspace); /** * @brief * This method shows the context menu for toolbars. * @param pt Position of the menu to show. */ void ContextMenu(CPoint pt); /** * @brief * This member function is called to update the status of the * TabWorkspace navigation buttons. * @param pWorkspace Pointer to a CWorkspace object. * SeeAlso: * SetFlags, GetFlags */ virtual void UpdateFlags(CWorkspace* pWorkspace); /** * @brief * Returns the selected item in the control. * @return * A pointer to a CXTPTabManagerItem object. */ CXTPTabManagerItem* GetSelectedItem() const; protected: /** @cond */ void OnWorkspaceCommandImpl(UINT nID); void DoWorkspaceCommand(CXTPTabManagerItem* pItem, CWorkspace* pFocusWorkspace, int nAction, CPoint pt = CPoint(), CXTPTabClientWnd* pTargetTab = NULL # ifndef _XTP_COMMANDBARS_ACTIVEX , # ifdef _XTP_INCLUDE_DOCKINGPANE CXTPDockingPaneTabbedContainer* pTargetPane = NULL # else LPVOID pReserved = NULL # endif # endif ); void TrackSplitter(int nWorkspace, CPoint point); void RepositionWorkspaces(CRect rc, CRect rcAvail, CWorkspace* pWorkspaceFirst, CWorkspace* pWorkspaceSecond); void NormalizeWorkspaceSize(); void ActivateNextItem(CXTPTabManagerItem* pItem); void ActivateNextTopmostItem(CXTPTabManagerItem* pItem); virtual BOOL OnBeforeItemClick(CXTPTabManagerItem* pItem); /** @endcond */ protected: /** @cond */ DECLARE_MESSAGE_MAP() //{{AFX_VIRTUAL(CXTPTabClientWnd) virtual void CalcWindowRect(LPRECT lpClientRect, UINT nAdjustType); virtual BOOL PreTranslateMessage(MSG* pMsg); virtual INT_PTR OnToolHitTest(CPoint point, TOOLINFO* pTI) const; virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); //}}AFX_VIRTUAL //{{AFX_MSG(CXTPTabClientWnd) afx_msg void OnSetFocus(CWnd* pOldWnd); afx_msg void OnKillFocus(CWnd* pNewWnd); afx_msg LRESULT OnMDIActivate(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnMDICreate(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnMDIDestroy(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnMDINext(WPARAM wParam, LPARAM lParam); afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnPaint(); afx_msg BOOL OnEraseBkgnd(CDC*); afx_msg LRESULT OnPrintClient(WPARAM wParam, LPARAM lParam); afx_msg void OnNcPaint(); afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp); afx_msg void OnRButtonDown(UINT nFlags, CPoint point); afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); afx_msg void OnMouseLeave(); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg void OnSysColorChange(); afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message); afx_msg void OnUpdateWorkspaceCommand(CCmdUI* pCmdUI); afx_msg BOOL OnNcActivate(BOOL bActive); public: afx_msg void OnIdleUpdateCmdUI(); //}}AFX_MSG /** @endcond */ public: BOOL m_bDelayLock; /**< TRUE to lock update with small delay. */ BOOL m_bLockUpdate; /**< TRUE to lock update tabs. */ BOOL m_bForceToRecalc; /**< TRUE to recalculate in next idle event. */ BOOL m_bLockReposition; /**< TRUE to lock reposition. */ protected: CArray m_arrWorkspace; /**< Array of workspaces. */ CWorkspace* m_pTabWorkspace; /**< Custom workspace. */ BOOL m_bUserWorkspace; /**< TRUE if custom workspace used. */ CMDIFrameWnd* m_pParentFrame; /**< Pointer to the corresponding parent MDIFrame window. */ BOOL m_bRefreshed; /**< TRUE if Refresh currently executed. */ CXTPTabPaintManager* m_pPaintManager; /**< Current paint manager. */ XTPPaintTheme m_themeCommandBars; /**< Theme set for the TabWorkspace (Can be different from CommandBars if m_bAutoTheme is FALSE) */ BOOL m_bAutoTheme; /**< TRUE to auto theme the TabWorkspace. */ CWorkspace* m_pActiveWorkspace; /**< Active workspace. */ BOOL m_bHorizSplitting; /**< TRUE if groups divided horizontally. */ HCURSOR m_hCursorHoriz; /**< Horizontal split cursor handle. */ HCURSOR m_hCursorVert; /**< Vertical split cursor handle. */ HCURSOR m_hCursorNew; /**< New item cursor handle. */ HCURSOR m_hCursorDelete; /**< Remove item cursor handle. */ BOOL m_bThemedBackColor; /**< TRUE if a themed backcolor will be used. If TRUE, then the backcolor of the MDIClient is calculated from the current theme, if FALSE, then the standard BackColor property will be used. */ BOOL m_bEnableGroups; /**< TRUE if TabWorkspace groups are enabled. */ DWORD m_dwFlags; /**< Specifies which tab navigation buttons are displayed. */ BOOL m_bAllowReorder; /**< TRUE to allow the user to reorder tabs. */ BOOL m_bShowWorkspace; /**< TRUE to show the TabWorkspace, FALSE to hide the TabWorkspace. */ BOOL m_bUpdateContents; /**< TRUE if UpdateContents executed. */ CXTPToolTipContext* m_pToolTipContext; /**< Tooltip Context. */ BOOL m_bUseSplitterTracker; /**< If TRUE, splitter trackers are used. When resizing a workspace, an outline of the workspace is drawn as the splitter is dragged. If FALSE, then the workspace will be resized in "real-time." */ int m_nSplitterSize; /**< Splitter size. */ XTPWorkspaceNewTabPosition m_newTabPosition; /**< New tab position. */ XTPWorkspaceActivateTab m_afterCloseTabPosition; /**< Tab to make active after the currently active tab is closed. */ BOOL m_bAutoUpdateTabCaption; /**< TRUE if the tab caption is to be updated automatically when changed, FALSE if it must manually be updated. */ CXTPMarkupContext* m_pMarkupContext; /**< Markup Context. */ BOOL m_bShowNewWindowTab; int m_nNewWindowTabCommand; CXTPCommandBars* m_pCommandBars; public: void EnableTearOff(); BOOL IsTearOffEnabled() const; BOOL IsGroupingEnabled() const; # ifndef _XTP_COMMANDBARS_ACTIVEX # ifdef _XTP_INCLUDE_DOCKINGPANE public: void SetDockingPaneManager(CXTPDockingPaneManager* pPaneManager); CXTPDockingPaneManager* GetDockingPaneManager(); protected: CXTPDockingPaneManager* m_paneManager; CXTPDockingPaneTabbedContainer* FindTargetDockPane(POINT pt); # else /** @cond */ // Required for padding LPVOID m_paneManager; /** @endcond */ # endif # endif private: BOOL m_bEnableTearOff; /**< TRUE if tear-off enabled */ CPtrList m_lstNextTab; CPtrList m_lstPrevTab; CXTPTabClientWnd* GetTabClientHead(); CXTPTabClientWnd* FindTargetTabClient(POINT pt); # ifdef _XTP_COMMANDBARS_ACTIVEX static CMDIFrameWnd* pTabClientParentFrame; # endif static BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam); void FindTargetTabClients(CXTPTabClientWnd* pTabClient, CArray* collection, POINT pt); void EnumTabClients(CXTPTabClientWnd* pTabClient, CArray* collection); void ChangeMDIChildFrame(CWnd* pTarget); void CloseTearOffFrame(CXTPTabClientWnd* pTarget); void ChangeItemWorkspace(CXTPTabClientWnd* pTarget, int nOldWorkspace, int nSticker); CXTPTabClientContext* m_pTabClientContext; public: void SetShowTabClientContextStickers(BOOL value); void SetAlphaTabClientContext(BOOL value); void SetShowContentsWhileDragging(BOOL value); void EnableFloatingFrameTheme(BOOL value); BOOL GetAlphaTabClientContext() const; BOOL GetShowTabClientContextStickers() const; BOOL GetShowContentsWhileDragging() const; BOOL IsFloatingFrameThemeEnabled() const; void SetForegroundTearOffFrames(); void CloseAllTearOffFrames(); void GetTabClients(CArray& collection); HWND GetLastSelecedItem(); protected: /** @cond */ CRect m_rcGroup; CTabClientDropTarget* m_pDropTarget; CWorkspace* m_pFocusWorkspace; int m_nFocusedAction; BOOL m_bIgnoreFlickersOnActivate; BOOL m_bRightToLeft; UINT m_nMsgUpdateSkinState; UINT m_nMsgQuerySkinState; CString m_strIniFileName; BOOL NeedsRefresh(XTPPaintTheme theme); /** @endcond */ # ifdef _XTP_COMMANDBARS_ACTIVEX /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() XTP_DECLARE_CMDTARGETPROVIDER_INTERFACE() DECLARE_OLETYPELIB_EX(CXTPTabClientWnd); DECLARE_CONNECTION_EX(CXTPTabClientWnd) DECLARE_ENUM_VARIANT(CXTPTabClientWnd) afx_msg LPDISPATCH OleGetItem(int nItem); afx_msg LPDISPATCH OleGetSelected(); afx_msg long OleGetItemCount(); afx_msg LPDISPATCH OleHitTest(OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y); afx_msg void OleRefresh(); afx_msg BOOL OleIsWorkspaceCommandEnabled(long nID); afx_msg void OleSetEnableMarkup(BOOL bEnableMarkup); afx_msg BOOL OleGetEnableMarkup(); afx_msg LPDISPATCH OleGetToolTipContext(); afx_msg void OleSetHorizGroupSplitting(BOOL bHorizSplitting); afx_msg BOOL OleGetHorizGroupSplitting(); afx_msg long OlegGetGroupCount(); afx_msg double OleGetGroupSplitter(int nGroup); afx_msg void OleSetGroupSplitter(int nGroup, double dSplitterPos); afx_msg OLE_HANDLE OleGetHwnd(); afx_msg LPDISPATCH OleFindItem(OLE_HANDLE hWnd); afx_msg int OleFindGroup(LPDISPATCH Item); afx_msg void OleCreateGroup(LPDISPATCH Item, BOOL Horiz); afx_msg void OleMoveToGroup(LPDISPATCH Item, int nGroup); void FireRClick(LPDISPATCH lpDispatch) { FireEvent(1, EVENT_PARAM(VTS_DISPATCH), lpDispatch); } void FireNewItem(LPDISPATCH lpDispatch) { FireEvent(2, EVENT_PARAM(VTS_DISPATCH), lpDispatch); } void FireSelectedChanged(LPDISPATCH Item) { FireEvent(3, EVENT_PARAM(VTS_DISPATCH), Item); } void FireBeforeItemClick(LPDISPATCH Item) { FireEvent(4, EVENT_PARAM(VTS_DISPATCH), Item); } enum { dispidFlags = 1L, }; LPDISPATCH OleGetPaintManager(); void OleEnableGroups(); /** @endcond */ # endif friend class CWorkspace; friend class CSingleWorkspace; friend class CTabClientDropTarget; friend class CNavigateButtonActiveFiles; friend class CXTPControlTabWorkspace; friend class CXTPTearOffFrame; friend class CXTPTabClientSticker; friend class CXTPDockPaneContextSticker; friend class CXTPTabClientContext; friend class CXTPTabClientDraggingContents; # ifndef _XTP_COMMANDBARS_ACTIVEX # ifdef _XTP_INCLUDE_DOCKINGPANE friend class CXTPDockingPaneContext; # endif # endif }; ///////////////////////////////////////////////////////////////////////////// AFX_INLINE BOOL CXTPTabClientWnd::IsAttached() const { return (m_pParentFrame != NULL ? TRUE : FALSE); } AFX_INLINE CMDIFrameWnd* CXTPTabClientWnd::GetParentFrame() const { return m_pParentFrame; } AFX_INLINE DWORD CXTPTabClientWnd::GetFlags() const { return m_dwFlags; } AFX_INLINE CXTPToolTipContext* CXTPTabClientWnd::GetToolTipContext() const { return m_pToolTipContext; } AFX_INLINE void CXTPTabClientWnd::UseSplitterTracker(BOOL bSplitterTracker) { m_bUseSplitterTracker = bSplitterTracker; } AFX_INLINE BOOL CXTPTabClientWnd::IsSplitterTrackerUsed() const { return m_bUseSplitterTracker; } AFX_INLINE void CXTPTabClientWnd::SetNewTabPosition(XTPWorkspaceNewTabPosition tabPosition) { m_newTabPosition = tabPosition; } AFX_INLINE XTPWorkspaceNewTabPosition CXTPTabClientWnd::GetNewTabPositon() const { return m_newTabPosition; } AFX_INLINE void CXTPTabClientWnd::SetAfterCloseActiveTab(XTPWorkspaceActivateTab activeTab) { m_afterCloseTabPosition = activeTab; } AFX_INLINE void CXTPTabClientWnd::EnableTearOff() { m_bEnableTearOff = TRUE; } AFX_INLINE BOOL CXTPTabClientWnd::IsTearOffEnabled() const { return m_bEnableTearOff; } AFX_INLINE BOOL CXTPTabClientWnd::IsGroupingEnabled() const { return m_bEnableGroups; } AFX_INLINE void CXTPTabClientWnd::OnWorkspaceCommand(UINT nID) { OnWorkspaceCommandImpl(nID); } # ifndef _XTP_COMMANDBARS_ACTIVEX # ifdef _XTP_INCLUDE_DOCKINGPANE AFX_INLINE void CXTPTabClientWnd::SetDockingPaneManager(CXTPDockingPaneManager* pPaneManager) { m_paneManager = pPaneManager; } AFX_INLINE CXTPDockingPaneManager* CXTPTabClientWnd::GetDockingPaneManager() { return m_paneManager; } # endif # endif # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // #if !defined(__XTPTABCLIENTWNDEX_H__) /** @endcond */