/**
* @file XTPTabBase.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 */
#ifndef __XTTABCTRLBASE_H__
# define __XTTABCTRLBASE_H__
/** @endcond */
# if _MSC_VER >= 1000
# pragma once
# endif // _MSC_VER >= 1000
# include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h"
class CXTPTabCtrlButtons;
class CXTPTabBaseTheme;
/**
* @brief
* Enumeration used to determine the navigation button display for a
* CXTPTabCtrl object.
* @details
* XTPNavBtnState type defines the constants used by the CXTPTabCtrl
* class to determine which navigation buttons to display.
* @see
* CXTPTabCtrl
* @see
* xtpNavBtnArrows, xtpNavBtnClose, xtpNavBtnShowAll>
*/
enum XTPNavBtnState
{
xtpNavBtnArrows = 1, /**< Display arrow buttons. */
xtpNavBtnClose = 2, /**< Display close button. */
xtpNavBtnShowAll = 3 /**< Display arrow and close buttons. */
};
/**
* @brief
* CXTPTabBase is a standalone base class. It is used to draw an XP
* style tab control.
*/
class _XTP_EXT_CLASS CXTPTabBase
{
public:
/**
* @brief
* Constructs a CXTPTabBase object.
*/
CXTPTabBase();
/**
* @brief
* Destroys a CXTPTabBase object, handles cleanup and deallocation.
*/
virtual ~CXTPTabBase();
public:
/**
* @brief
* Retrieves a pointer to the associated tab control.
* @details
* This member function is called by the base class to manage a
* pointer for the derived class CTabCtrl object.
* @return
* A pointer to a CTabCtrl object if successful, otherwise NULL.
*/
CTabCtrl* GetTabCtrlImpl();
/**
* @brief
* Retrieves a pointer to the tab control navigation button object.
* @details
* This member function is called to retrieve a pointer to the tab
* control buttons used for navigating and closing tab windows.
* @return
* A pointer to a CXTPTabCtrlButtons object if successful, otherwise NULL.
*/
CXTPTabCtrlButtons* GetButtons();
/**
* @brief
* This member function copies the child coordinates of the CTabCtrl client
* area into the object referenced by 'rcChild'. The client coordinates
* specify the upper-left and lower-right corners of the client area.
* @param rcChild A reference to a CRect object to receive the client coordinates.
*/
virtual void GetChildRect(CRect& rcChild) const;
/**
* @brief
* Call this member function to set the visibility of the navigation buttons.
* These buttons are used in place of the default forward and back buttons
* that are displayed when the tab control is not wide enough to display all
* tabs. You can also define a close button to be used to close the active
* tab. This will give the tab control a VS.NET style tabbed interface.
* @param dwFlags The value can be one or more of the values listed in the
* Remarks section.
* @details
* Styles to be added or removed can be combined by using the bitwise
* OR (|) operator. It can be one or more of the following:
* xtpNavBtnArrows: To show arrow buttons.
* xtpNavBtnClose: To show close button.
* xtpNavBtnShowAll: To show arrow and close buttons.
*/
void ShowNavButtons(DWORD dwFlags);
/**
* @brief
* Call this member to switch the visual theme of the control.
* @param eTheme New visual theme. Can be any of the values listed in the
* Remarks section.
* @details
* eTheme can be one of the following:
* xtpControlThemeDefault: Use default theme.
* xtpControlThemeOfficeXP: Use Office XP theme.
* xtpControlThemeOffice2003: Use Office 2003 theme.
* @return TRUE if successful; otherwise FALSE.
*/
BOOL SetTheme(XTPControlTheme eTheme);
/**
* @brief
* Call this member function to get a pointer to the currently selected
* theme.
* @return
* A pointer to a CXTPTabBaseTheme object representing the currently
* selected theme.
*/
CXTPTabBaseTheme* GetTheme();
protected:
/**
* @brief
* Call this member function to refresh theme colors and redraw the control.
*/
virtual void RefreshMetrics();
/**
* @brief
* This member function is called by the CXTPTabBase class to perform
* initialization when the window is created or sub-classed.
* @return
* TRUE if the window was successfully initialized, otherwise FALSE.
*/
virtual BOOL Init();
/**
* @brief
* Call this member function to associate the tab control with this object.
* @param pTabCtrl Pointer to a valid tab control object.
*/
void ImplAttach(CTabCtrl* pTabCtrl);
/**
* @brief
* This member function is called by the tab control to add padding to a
* tab label for use with XP style tabs.
* @param strLabelText Tab label to add padding to.
*/
virtual void OnAddPadding(CString& strLabelText);
public:
bool m_bBoldFont; /**< true to set the selected tab font to bold. */
bool m_bXPBorder; /**< true to draw an XP border around the tab child window. */
BOOL m_bAutoCondensing; /**< TRUE for auto-condensing tabs. */
protected:
CTabCtrl* m_pTabCtrl; /**< Pointer to the tab control associated with this object. */
CXTPTabCtrlButtons* m_pNavBtns; /**< Arrow buttons. */
CXTPTabBaseTheme* m_pTheme; /**< Pointer to the current theme object. */
BOOL m_bSubclassed; /**< TRUE if the window was sub-classed. */
/** @cond */
virtual void PreSubclassWindow();
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
/** @endcond */
/** @cond */
afx_msg void OnPaint();
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);
afx_msg void OnSysColorChange();
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg LRESULT OnSetTheme(WPARAM wParam, LPARAM lParam);
/** @endcond */
};
/** @cond */
AFX_INLINE CTabCtrl* CXTPTabBase::GetTabCtrlImpl()
{
return m_pTabCtrl;
}
AFX_INLINE CXTPTabCtrlButtons* CXTPTabBase::GetButtons()
{
return m_pNavBtns;
}
AFX_INLINE CXTPTabBaseTheme* CXTPTabBase::GetTheme()
{
return m_pTheme;
}
# define DECLARE_TABCTRL_BASE(ClassName, Tab, Base) \
class _XTP_EXT_CLASS ClassName \
: public Tab \
, public Base \
{ \
protected: \
virtual void PreSubclassWindow() \
{ \
Tab::PreSubclassWindow(); \
Base::PreSubclassWindow(); \
} \
virtual BOOL PreCreateWindow(CREATESTRUCT& cs) \
{ \
if (!Tab::PreCreateWindow(cs)) \
return FALSE; \
return Base::PreCreateWindow(cs); \
} \
afx_msg void OnPaint() \
{ \
Base::OnPaint(); \
} \
afx_msg BOOL OnEraseBkgnd(CDC* pDC) \
{ \
return Base::OnEraseBkgnd(pDC); \
} \
afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection) \
{ \
Base::OnSettingChange(uFlags, lpszSection); \
} \
afx_msg void OnSysColorChange() \
{ \
Base::OnSysColorChange(); \
} \
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct) \
{ \
if (Tab::OnCreate(lpCreateStruct) == -1) \
return -1; \
return Base::OnCreate(lpCreateStruct); \
} \
afx_msg LRESULT OnSetTheme(WPARAM wParam, LPARAM lParam) \
{ \
return Base::OnSetTheme(wParam, lParam); \
} \
};
# define ON_TABCTRL_REFLECT \
ON_MESSAGE(WM_XTP_SETCONTROLTHEME, OnSetTheme) \
ON_WM_PAINT() \
ON_WM_ERASEBKGND() \
ON_WM_SETTINGCHANGE() \
ON_WM_SYSCOLORCHANGE() \
ON_WM_CREATE
/** @endcond */
/**
* @brief
* CXTPTabExBase is a standalone base class. It is used to draw an XP
* style tab control.
*/
class _XTP_EXT_CLASS CXTPTabExBase : public CXTPTabBase
{
private:
struct ITEMANDWIDTH;
public:
/**
* @brief
* Constructs a CXTPTabExBase object.
*/
CXTPTabExBase();
/**
* @brief
* Destroys a CXTPTabExBase object, handles cleanup and deallocation.
*/
virtual ~CXTPTabExBase();
public:
/**
* @brief
* Call this member function to enable/disable the control from
* being redrawn or updated.
* @param bRedraw Specifies the state of the redraw flag. If this parameter
* is TRUE, then the redraw flag is set. If this parameter
* is FALSE, then the flag is cleared.
*/
void EnableRedraw(BOOL bRedraw);
/**
* @brief
* This member function is called to initialize the font for the tab
* control associated with this view.
*/
virtual void InitializeFont();
/**
* @brief
* This member function retrieves the handle of the tooltip control associated
* with the tab control. The tab control creates a tooltip control if
* it has the TCS_TOOLTIPS style. You can also assign a tooltip control
* to a tab control by using the SetToolTips member function.
* @return
* The handle of the tooltip control if successful, otherwise NULL.
*/
virtual CToolTipCtrl* GetTips();
/**
* @brief
* Call this function to assign a tooltip control to the tab control.
* You can associate the tooltip control with a tab control by making
* a call to GetToolTips.
* @param pWndTip Pointer to a tooltip control.
*/
virtual void SetTips(CToolTipCtrl* pWndTip);
/**
* @brief
* Call this function to register a tab with the tooltip control so
* that the information stored in the tooltip is displayed when the
* cursor is on the tab.
* @param nIDTab Index of the tab.
* @param lpszText Pointer to the text for the tool.
*/
virtual void AddToolTip(UINT nIDTab, LPCTSTR lpszText);
/**
* @brief
* Call this function to update the tooltip text for the specified tab.
* @param nIDTab Index of the tab.
* @param lpszText Pointer to the text for the tool.
*/
virtual void UpdateToolTip(int nIDTab, LPCTSTR lpszText);
/**
* @brief
* Call this function to update the tooltip text for the specified tab.
* @param pViewClass CRuntimeClass associated with the tab.
* @param lpszText Pointer to the text for the tool.
*/
virtual void UpdateToolTip(CRuntimeClass* pViewClass, LPCTSTR lpszText);
/**
* @brief
* This member function is called to reset the values for the tooltip
* control based upon the information stored for each tab.
*/
virtual void ResetToolTips();
/**
* @brief
* Call this member function to enable/disable tooltip usage.
* @param bEnable TRUE to enable tooltip usage.
* @return
* TRUE if the tooltip control was found and updated, otherwise FALSE.
*/
virtual BOOL EnableToolTipsEx(BOOL bEnable);
/**
* @brief
* Call this member function to add a view to the tab control associated
* with this view.
* @param lpszLabel Pointer to the text for the tab associated with the view.
* @param pView An existing view to be added to the tab control.
* @param iIndex -1 to add to the end.
* @param iIconIndex Icon index for the tab. If -1, then 'iIndex' is used to
* determine the index.
* @param lParam Application defined parameter
* @return
* TRUE if successful, otherwise FALSE.
*/
virtual BOOL AddView(LPCTSTR lpszLabel, CView* pView, int iIndex = -1, int iIconIndex = -1,
LPARAM lParam = 0);
/**
* @brief
* Call this member function to add a view to the tab control associated
* with this view.
* @param lpszLabel Pointer to the text for the tab associated with the view.
* @param pViewClass CView runtime class associated with the tab.
* @param pDoc CDocument associated with the view.
* @param pContext Create context for the view.
* @param iIndex -1 to add to the end.
* @param iIconIndex Icon index for the tab. If -1, then 'iIndex' is used to
* determine the index.
* @param lParam Application defined parameter
* @return
* TRUE if successful, otherwise FALSE.
*/
virtual BOOL AddView(LPCTSTR lpszLabel, CRuntimeClass* pViewClass, CDocument* pDoc = NULL,
CCreateContext* pContext = NULL, int iIndex = -1, int iIconIndex = -1,
LPARAM lParam = 0);
/**
* @brief
* This member function is called to add a control to the tab control
* associated with this view.
* @param lpszLabel Pointer to the text for the tab associated with the view.
* @param pWnd CWnd object associated with the tab.
* @param iIndex Tab index of where to insert the new view. By default,
* this parameter is -1 to add to the end.
* @param iIconIndex Icon index for the tab. If -1, then 'iIndex' is used to
* determine the index.
* @param lParam Application defined parameter
* @return
* TRUE if successful, otherwise FALSE.
*/
virtual BOOL AddControl(LPCTSTR lpszLabel, CWnd* pWnd, int iIndex = -1, int iIconIndex = -1,
LPARAM lParam = 0);
/**
* @brief
* This member function retrieves a pointer to a view from the specified
* runtime class.
* @param nView Tab index.
* @return
* A pointer to a CView object, otherwise NULL.
*/
virtual CWnd* GetView(int nView);
/**
* @brief
* This member function retrieves a pointer to a view from the specified
* runtime class.
* @param pViewClass CView runtime class associated with the tab.
* @return
* A pointer to a CView object, otherwise NULL.
*/
virtual CWnd* GetView(CRuntimeClass* pViewClass);
/**
* @brief
* This member function retrieves a pointer to the active view associated
* with the selected tab.
* @return
* A pointer to the active view, otherwise NULL.
*/
virtual CWnd* GetActiveView();
/**
* @brief
* This member function is called to activate the specified view and
* deactivate all remaining views.
* @param pTabView CWnd object to make active.
*/
virtual void ActivateView(CWnd* pTabView);
/**
* @brief
* This member function will set a view active based on the specified
* runtime class.
* @param nActiveTab Tab index.
*/
virtual void SetActiveView(int nActiveTab);
/**
* @brief
* This member function will set a view active based on the specified
* runtime class.
* @param pTabView CWnd object to make active.
*/
virtual void SetActiveView(CWnd* pTabView);
/**
* @brief
* This member function will set a view active based on the specified
* runtime class.
* @param pViewClass CView runtime class associated with the tab.
*/
virtual void SetActiveView(CRuntimeClass* pViewClass);
/**
* @brief
* This member function will remove a view based on the specified
* tab index.
* @param nView Tab index of the view.
* @param bDestroyWnd TRUE to destroy the list item.
*/
virtual void DeleteView(int nView, BOOL bDestroyWnd = TRUE);
/**
* @brief
* This member function will remove a view based on the specified
* tab index.
* @param pView Pointer to the CWnd object associated with the tab.
* @param bDestroyWnd TRUE to destroy the list item.
*/
virtual void DeleteView(CWnd* pView, BOOL bDestroyWnd = TRUE);
/**
* @brief
* This member function will remove a view based on the specified
* tab index.
* @param pViewClass CView runtime class associated with the tab.
* @param bDestroyWnd TRUE to destroy the list item.
*/
virtual void DeleteView(CRuntimeClass* pViewClass, BOOL bDestroyWnd = TRUE);
/**
* @brief
* This member function will return the name for a view based on the
* tab index.
* @param nView Tab index of the view.
* @return
* A NULL-terminated string that represents the tab item text.
*/
virtual LPCTSTR GetViewName(int nView);
/**
* @brief
* This member function will return the name for a view based on the
* tab index.
* @param pViewClass CView runtime class associated with the tab.
* @return
* A NULL-terminated string that represents the tab item text.
*/
virtual LPCTSTR GetViewName(CRuntimeClass* pViewClass);
/**
* @brief
* This member function is called when the tab control is resized.
* It is responsible for updating internal structures that are
* dependent on the control's size.
*/
virtual void RecalcLayout();
/**
* @brief
* Helper methods.
* @param hDWP Handle to a multiple-window position structure that contains
* size and position information for one or more windows.
* @param pView A pointer to a CWnd object to be resized.
* @return TRUE if successful, FALSE otherwise.
*/
virtual BOOL Defer(HDWP& hDWP, CWnd* pView);
/**
* @brief
* Call this member function to resize the tab view specified by 'pView'.
* @param pView A pointer to a CWnd object to be resized.
*/
virtual void ResizeTabView(CWnd* pView);
/**
* @brief
* This member function is used by the tab control bar to remove an item
* from the tab view list.
* @param pos The POSITION value of the item to be removed.
* @param bDestroyWnd TRUE to destroy the list item.
*/
virtual void RemoveListItem(POSITION pos, BOOL bDestroyWnd = TRUE);
/**
* @brief
* Call this member function to remove all tabs, including all associated
* views.
* @param bDestroyWnd TRUE to destroy the window associated with the tab item.
* @return
* TRUE if successful, otherwise FALSE.
*/
virtual BOOL RemoveAllTabs(BOOL bDestroyWnd = TRUE);
/**
* @brief
* Call this member function to retrieve the tab index from the current
* cursor position.
* @param point Pointer to a CPoint object that contains the cursor screen
* coordinates. Use default for the current cursor position.
* @return
* An integer based index of the tab, or -1 if no tab is at the
* specified 'point'.
*/
virtual int GetTabFromPoint(CPoint point);
/**
* @brief
* Call this member function to see if the specified CWnd object is a
* child of the tab control.
* @param pView A pointer to a CWnd object.
* @return
* TRUE if the specified CWnd object is a child of the tab control,
* otherwise FALSE.
*/
virtual BOOL IsChildView(CWnd* pView);
/**
* @brief
* Call this member function to set the text for the specified tab.
* @param nTab Index of the tab.
* @param lpszLabel New text for the tab label.
* @return
* TRUE if successful, otherwise FALSE.
*/
BOOL SetTabText(int nTab, LPCTSTR lpszLabel);
/**
* @brief
* Call this member function to set the text for the specified tab.
* @param pView CWnd object associated with the tab.
* @param lpszLabel New text for the tab label.
* @return
* TRUE if successful, otherwise FALSE.
*/
BOOL SetTabText(CWnd* pView, LPCTSTR lpszLabel);
/**
* @brief
* Call this member function to set the text for the specified tab.
* @param pViewClass CRuntimeClass of the CWnd associated with the tab.
* @param lpszLabel New text for the tab label.
* @return
* TRUE if successful, otherwise FALSE.
*/
BOOL SetTabText(CRuntimeClass* pViewClass, LPCTSTR lpszLabel);
/**
* @brief
* This member function is called to activate the next view in the tab
* control.
* @return
* A CWnd pointer to the newly activated view.
*/
CWnd* NextView();
/**
* @brief
* This member function is called to activate the previous view in the
* tab control.
* @return
* A CWnd pointer to the newly activated view.
*/
CWnd* PrevView();
/**
* @brief
* Call this member function to enable/disable the tab auto-condensing
* mode. Auto-condensing mode affects the tab control's behavior when
* there is not enough room to fit all tabs. Without auto-condensation,
* the CXTPTabCtrl control behaves like a standard tab control (i.e. it
* will display a slider control that allows the user to pan between
* tabs). With the auto-condensing mode enabled, CXTPTabCtrl attempts to
* fit all tabs in the available space by trimming the tab label text.
* This behavior is similar to the behavior displayed by Visual C++'s
* Workspace View. For instance, you can see the FileView tab shrink if
* you shrink the Workspace View.
* @param bEnable TRUE to enable auto-condense mode, FALSE to disable.
*/
void SetAutoCondense(BOOL bEnable);
/**
* @brief
* This member function returns the state of the tab control's auto-condense
* mode. See SetAutoCondense() for a full explanation of this mode.
* @return
* TRUE if auto-condense is enabled, or FALSE if it is disabled.
*/
BOOL GetAutoCondense();
/**
* @brief
* This member function will modify the style for the tab control associated
* with this view and set the appropriate font depending on the tab's
* orientation.
* @param dwRemove Specifies window styles to be removed during style modification.
* @param dwAdd Specifies window styles to be added during style modification.
* @param nFlags Flags to be passed to SetWindowPos, or zero if SetWindowPos should
* not be called. The default is zero. See CWnd::ModifyStyle for more
* details.
* @return
* Nonzero if the style was successfully modified, otherwise zero.
*/
virtual BOOL ModifyTabStyle(DWORD dwRemove, DWORD dwAdd, UINT nFlags = 0);
/**
* @brief
* This member function is used to get the last known view that belongs
* to the frame.
* @return
* A CView pointer to the last known view.
*/
CView* GetLastKnownChildView();
/**
* @brief
* This member function is used to set the resource ID for the pop-up menu
* used by the tab control.
* @param popupMenuID ID for the tab control pop-up menu.
* @param nPos Index position in the menu resource.
*/
virtual void SetMenuID(UINT popupMenuID, int nPos = 0);
/**
* @brief
* This member function returns the menu resource associated with the
* tab control.
* @return
* The resource ID of the menu associated with the tab control.
*/
virtual UINT GetMenuID();
/**
* @brief
* Call this member function to allow a WM_INITIALUPATE message to be sent
* to views after creation.
* @param bInitialUpdate TRUE to send initial update message.
*/
virtual void SendInitialUpdate(BOOL bInitialUpdate);
protected:
/**
* @brief
* This member function is called whenever the theme has changed.
* @see
* CXTPControlThemeManagerStyleHost::OnThemeChanged(), CXTPHeaderCtrl::OnThemeChanged()
*/
virtual void OnThemeChanged();
/**
* @brief
* Override this member function to handle a TCN_SELCHANGING event in
* your derived class to provide additional functionality.
* @see
* OnSelChange, TCN_XTP_SELCHANGE, TCN_XTP_SELCHANGING
*/
virtual void OnSelChanging();
/**
* @brief
* Override this member function to handle a TCN_SELCHANGE event in
* your derived class to provide additional functionality.
* @see
* OnSelChanging, TCN_XTP_SELCHANGE, TCN_XTP_SELCHANGING
*/
virtual void OnSelChange();
/**
* @brief
* This member function is called to set the tooltip and tab text for
* the specified tab.
* @param nTab Index of the tab.
* @param pMember Address of an CXTPTcbItem struct associated with the tab.
* @param lpszLabel A NULL-terminated string that represents the new tab label.
* @return
* TRUE if successful, otherwise FALSE.
*/
BOOL UpdateTabLabel(int nTab, CXTPTcbItem* pMember, LPCTSTR lpszLabel);
/**
* @brief
* This member function creates the CWnd object that is associated
* with a tab control item.
* @param pViewClass CView runtime class to be created.
* @param pDocument CDocument associated with view.
* @param pContext Create context for the view.
* @return
* A pointer to the newly created CWnd object, otherwise NULL.
*/
virtual CWnd* CreateTabView(CRuntimeClass* pViewClass, CDocument* pDocument,
CCreateContext* pContext);
/**
* @brief
* This member function is used internally by the tab control to calculate
* the width of a tab based on its label text.
* @param pDC Pointer to the current device context.
* @param sLabel Represents the tab label text.
* @param bHasIcon Set to true if the tab item has an icon.
* @return
* An integer value that represents the width of a tab.
*/
int CalculateTabWidth(CDC* pDC, CString& sLabel, bool bHasIcon);
/**
* @brief
* This member function is used internally by the tab control to shrink,
* or un-shrink, tabs based on the control's width and the state of the
* auto-condensation mode. See SetAutoCondense() for more information.
*/
void Condense();
/**
* @brief
* This member function is called by the CXTPTabExBase class to
* perform initialization when the window is created or sub-classed.
* @return
* TRUE if the window was successfully initialized, otherwise FALSE.
*/
virtual BOOL Init();
/** @cond */
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
virtual BOOL PreTranslateMessage(MSG* pMsg);
virtual void OnPreWindowPosChanged(WINDOWPOS FAR* lpwndpos);
virtual void OnPostWindowPosChanged();
/** @endcond */
/** @cond */
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnDestroy();
afx_msg BOOL OnSelchange(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg BOOL OnSelchanging(NMHDR* pNMHDR, LRESULT* pResult);
/** @endcond */
public:
CList m_tcbItems; /**< Template list containing tab information. */
protected:
int m_nPos; /**< Index of the pop-up menu contained in the menu. */
UINT m_popupMenuID; /**< Pop-up menu resource ID. */
BOOL m_bInitialUpdate; /**< TRUE to send initial update to views when created. */
CWnd* m_pParentWnd; /**< Pointer to the parent and will equal 'm_pParentFrame' in non-dialog
applications. */
CView* m_pLastActiveView; /**< Pointer to the last active view that belongs to the main frame
window. */
CFrameWnd* m_pParentFrame; /**< Pointer to the parent frame. */
private:
int m_nOldIndex;
};
/** @cond */
AFX_INLINE CWnd* CXTPTabExBase::GetActiveView()
{
return GetView(m_pTabCtrl->GetCurSel());
}
AFX_INLINE CView* CXTPTabExBase::GetLastKnownChildView()
{
return m_pLastActiveView;
}
AFX_INLINE void CXTPTabExBase::SetMenuID(UINT popupMenuID, int nPos)
{
m_popupMenuID = popupMenuID;
m_nPos = nPos;
}
AFX_INLINE UINT CXTPTabExBase::GetMenuID()
{
_ASSERTE(::IsWindow(m_pTabCtrl->GetSafeHwnd()));
return m_popupMenuID;
}
AFX_INLINE void CXTPTabExBase::SendInitialUpdate(BOOL bInitialUpdate)
{
m_bInitialUpdate = bInitialUpdate;
}
/** @endcond */
/** @cond */
class _XTP_EXT_CLASS CXTPTabCtrlBaseEx
: public CXTPTabExBase // CXTPTabCtrlBaseEx deprecated, use CXTPTabExBase instead (included for
// backward compatibility).
{
public:
virtual BOOL EnableToolTipsImpl(BOOL bEnable)
{
return CXTPTabExBase::EnableToolTipsEx(bEnable);
}
protected:
void OnRButtonDownImpl(UINT nFlags, CPoint point)
{
CXTPTabExBase::OnRButtonDown(nFlags, point);
}
int OnCreateImpl_Post(LPCREATESTRUCT lpCreateStruct)
{
return CXTPTabExBase::OnCreate(lpCreateStruct);
}
void OnDestroyImpl_Pre()
{
CXTPTabExBase::OnDestroy();
}
BOOL OnSelchangeImpl(NMHDR* pNMHDR, LRESULT* pResult)
{
return CXTPTabExBase::OnSelchange(pNMHDR, pResult);
}
BOOL OnSelchangingImpl(NMHDR* pNMHDR, LRESULT* pResult)
{
return CXTPTabExBase::OnSelchanging(pNMHDR, pResult);
}
void OnWindowPosChangedImpl_Pre(WINDOWPOS FAR* lpwndpos)
{
CXTPTabExBase::OnPreWindowPosChanged(lpwndpos);
}
void OnWindowPosChangedImpl_Post(WINDOWPOS FAR*)
{
CXTPTabExBase::OnPostWindowPosChanged();
}
BOOL PreTranslateMessageImpl(MSG* pMsg)
{
return CXTPTabExBase::PreTranslateMessage(pMsg);
}
void PreSubclassWindowImpl_Post()
{
CXTPTabExBase::PreSubclassWindow();
}
BOOL OnCmdMsgImpl_Pre(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
return CXTPTabExBase::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}
LRESULT OnInitializeImpl(WPARAM, LPARAM)
{
_ASSERTE(0);
return 0; /**< this is deprecated, tab is self initializing via Init(). */
}
void OnInitialUpdateImpl()
{
CXTPTabExBase::Init();
}
};
# define DECLARE_TABCTRLEX_BASE(ClassName, Tab, Base) \
class _XTP_EXT_CLASS ClassName \
: public Tab \
, public Base \
{ \
protected: \
virtual void PreSubclassWindow() \
{ \
Tab::PreSubclassWindow(); \
Base::PreSubclassWindow(); \
} \
virtual BOOL PreCreateWindow(CREATESTRUCT& cs) \
{ \
if (!Tab::PreCreateWindow(cs)) \
return FALSE; \
return Base::PreCreateWindow(cs); \
} \
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, \
AFX_CMDHANDLERINFO* pHandlerInfo) \
{ \
if (Base::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo)) \
return TRUE; \
return Tab::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo); \
} \
virtual BOOL PreTranslateMessage(MSG* pMsg) \
{ \
if (Base::PreTranslateMessage(pMsg)) \
return TRUE; \
return Tab::PreTranslateMessage(pMsg); \
} \
afx_msg void OnPaint() \
{ \
Base::OnPaint(); \
} \
afx_msg BOOL OnEraseBkgnd(CDC* pDC) \
{ \
return Base::OnEraseBkgnd(pDC); \
} \
afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection) \
{ \
Tab::OnSettingChange(uFlags, lpszSection); \
Base::OnSettingChange(uFlags, lpszSection); \
} \
afx_msg void OnSysColorChange() \
{ \
Tab::OnSysColorChange(); \
Base::OnSysColorChange(); \
} \
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct) \
{ \
if (Tab::OnCreate(lpCreateStruct) == -1) \
return -1; \
return Base::OnCreate(lpCreateStruct); \
} \
afx_msg void OnRButtonDown(UINT nFlags, CPoint point) \
{ \
Base::OnRButtonDown(nFlags, point); \
} \
afx_msg void OnDestroy() \
{ \
Base::OnDestroy(); \
Tab::OnDestroy(); \
} \
afx_msg BOOL OnSelchange(NMHDR* pNMHDR, LRESULT* pResult) \
{ \
return Base::OnSelchange(pNMHDR, pResult); \
} \
afx_msg BOOL OnSelchanging(NMHDR* pNMHDR, LRESULT* pResult) \
{ \
return Base::OnSelchanging(pNMHDR, pResult); \
} \
afx_msg void OnWindowPosChanged(WINDOWPOS FAR* lpwndpos) \
{ \
Base::OnPreWindowPosChanged(lpwndpos); \
Tab::OnWindowPosChanged(lpwndpos); \
Base::OnPostWindowPosChanged(); \
} \
afx_msg LRESULT OnSetTheme(WPARAM wParam, LPARAM lParam) \
{ \
return Base::OnSetTheme(wParam, lParam); \
} \
};
# define ON_TABCTRLEX_REFLECT \
ON_WM_CREATE() \
ON_WM_DESTROY() \
ON_WM_RBUTTONDOWN() \
ON_WM_WINDOWPOSCHANGED() \
ON_NOTIFY_REFLECT_EX(TCN_SELCHANGE, OnSelchange) \
ON_NOTIFY_REFLECT_EX(TCN_SELCHANGING, OnSelchanging) \
ON_TABCTRL_REFLECT
/** @endcond */
# include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h"
/** @cond */
#endif // __XTTABCTRLBASE_H__
/** @endcond */