/** * @file XTPExcelTabCtrl.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(__XTPEXCELTABCTRL_H__) # define __XTPEXCELTABCTRL_H__ /** @endcond */ # if _MSC_VER >= 1000 # pragma once # endif // _MSC_VER >= 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPExcelTabCtrlTheme; /** * @brief * Enumeration used to determine arrow button display. * @details * XTPArrowIcon type defines constants used by the * CXTPExcelTabCtrlButtonState to determine which arrow is to be * displayed for a particular tab button. * @see * CXTPExcelTabCtrlButtonState, CXTPExcelTabCtrl * * @see xtpArrowIconLeft, xtpArrowIconLeftHome, xtpArrowIconRight, xtpArrowIconRightHome */ enum XTPArrowIcon { xtpArrowIconLeft = 0x0200, /**< Left arrow display. */ xtpArrowIconLeftHome = 0x0201, /**< Left home arrow display. */ xtpArrowIconRight = 0x0000, /**< Right arrow display. */ xtpArrowIconRightHome = 0x0001 /**< Right home arrow display. */ }; /** * @brief * The CXTPExcelTabCtrlButtonState class is used by the CXTPExcelTabCtrl class * to manage navigation button information. This class contains information * about the state and command identifiers for the button. */ class _XTP_EXT_CLASS CXTPExcelTabCtrlButtonState { public: /** * @brief * Constructs a CXTPExcelTabCtrlButtonState object. */ CXTPExcelTabCtrlButtonState(); public: /** * @brief * This member function is called to initialize the information * about the tab control navigation button. * @param rect Size and location of the button. * @param iCommand Command ID for the button. * @param iconType Icon style of the button. */ void SetInfo(CRect rect, int iCommand, XTPArrowIcon iconType); public: int m_iCommand; /**< Button command ID. */ bool m_bPressed; /**< true if the button is pressed. */ bool m_bEnabled; /**< true if the button is enabled. */ bool m_bHilight; /**< true if the mouse if hovering. */ CRect m_rect; /**< Size and location of the button. */ XTPArrowIcon m_IconType; /**< Icon style of the button. */ }; /** @cond */ typedef CArray CTabItemArray; /** @endcond */ /** * @brief * CXTPExcelTabCtrl is a CWnd derived class. It is used to create an Excel * style sheet control. This control allows you to define if you want the * control to have home, end, back, and next buttons. */ class _XTP_EXT_CLASS CXTPExcelTabCtrl : public CWnd { /** @cond */ DECLARE_DYNAMIC(CXTPExcelTabCtrl) /** @endcond */ public: /** * @brief * Constructs a CXTPExcelTabCtrl object. */ CXTPExcelTabCtrl(); /** * @brief * Destroys a CXTPExcelTabCtrl object, handles cleanup and deallocation. */ virtual ~CXTPExcelTabCtrl(); public: /** * @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 * nStyle 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 CXTPExcelTabCtrlTheme object representing the currently * selected theme. */ CXTPExcelTabCtrlTheme* GetTheme(); /** * @brief * Call this member function to retrieve a reference to the tab item array. * @return * A reference to a CTabItemArray object used for maintaining the list * of tabs for the tab control. */ CTabItemArray& GetTabItemArray() { return m_tcbItems; } /** * @brief * This member function gets the text of a specific tab. * @param nIndex The index of the tab whose text is to be retrieved. * @return * The text of a particular tab, or NULL if an error occurs. */ LPCTSTR GetItemText(int nIndex) const; /** * @brief * This member function will set the text for a particular tab. * @param nIndex The index of the tab whose text is to be changed. * @param pszText The new title for the tab. * @return * true if successful, otherwise false. */ bool SetItemText(int nIndex, LPCTSTR pszText); /** * @brief * This member function gets a CWnd pointer to the window that is associated * with a specific tab. * @param nIndex The index of the tab whose managed window is to be retrieved. * @return * A pointer to the window that is associated with a tab, or NULL * if no window is associated with (managed by) the tab. */ CWnd* GetItemWindow(int nIndex) const; /** * @brief * This member function will set the fonts to be used by the tab control. * @param pNormFont Represents the font used by non-selected tabs. * @param pBoldFont Represents the font used by selected tabs. */ virtual void SetTabFonts(CFont* pNormFont, CFont* pBoldFont); /** * @brief * This member function will insert a tab into the flat tab control. * @param nItem Index of the tab to insert. * @param nTextID String resource ID of the tab label. * @param pWndControl Optional pointer to the managed control. * @return * The index of the tab that has been inserted if successful, * otherwise -1. */ virtual int InsertItem(int nItem, UINT nTextID, CWnd* pWndControl = NULL); /** * @brief * This member function will insert a tab into the flat tab control. * @param nItem Index of the tab to insert. * @param lpszItem A NULL-terminated string that represents the tab label. * @param pWndControl Optional pointer to the managed control. * @return * The index of the tab that has been inserted if successful, * otherwise -1. */ virtual int InsertItem(int nItem, LPCTSTR lpszItem, CWnd* pWndControl = NULL); /** * @brief * This member function will delete the tab specified by 'nItem' from the * tab control. * @param nItem Index of the tab to delete. * @return * TRUE if successful, otherwise FALSE. */ virtual BOOL DeleteItem(int nItem); /** * @brief * This member function will remove all tabs from the tab control. * @return * TRUE if successful, otherwise FALSE. */ virtual BOOL DeleteAllItems(); /** * @brief * This member function will retrieve the size of the tab specified * by 'nItem'. * @param nItem Index of the tab to retrieve the size of. * @param lpRect Pointer to a RECT structure to receive the size of the tab. * @return * TRUE if successful, otherwise FALSE. */ virtual BOOL GetItemRect(int nItem, LPRECT lpRect); /** * @brief * Call this function to determine which tab, if any, is at the * specified screen position. * @param pHitTestInfo Pointer to a TCHITTESTINFO structure, as * described in the Platform SDK, which specifies * the screen position to test. * @return * The zero-based index of the tab, or -1 if no tab is at the * specified position. */ virtual int HitTest(TCHITTESTINFO* pHitTestInfo) const; /** * @brief * Call this function to retrieve the currently selected tab in a flat * tab control. * @return * The zero-based index of the selected tab if successful, or * -1 if no tab is selected. */ virtual int GetCurSel() const; /** * @brief * This member function selects a tab in a flat tab control. * @param nItem The zero-based index of the item to be selected. * @return * The zero-based index of the previously selected tab if successful, * otherwise -1. */ virtual int SetCurSel(int nItem); /** * @brief * Call this function to retrieve the number of tabs in the tab * control. * @return * The number of tabs in the tab control. */ virtual int GetItemCount() const; /** * @brief * This member function will set the tooltip for the tab specified * by 'nItem'. * @param nItem The zero-based index of the tab to receive the tooltip text. * @param lpszTabTip A pointer to a string containing the tooltip text. */ virtual void SetTipText(int nItem, LPCTSTR lpszTabTip); /** * @brief * This member function will get the tooltip text associated with the * tab specified by 'nItem'. * @param nItem The zero-based index of the tab to retrieve the tooltip * text for. * @return * A CString object containing the text to be used in the tooltip. */ virtual CString GetTipText(int nItem); /** * @brief * This member function will cause the tab control to reposition * the tabs to the home position. */ virtual void Home(); /** * @brief * This member function changes the location of the sizing gripper. * The function has no effect if FTS_XTP_HSCROLL is not used. * @param nPos The position for the gripper, relative to the left-hand * side of the control. * @param bPercent Indicates that the position is a percent of the control * width, as opposed to an absolute location in pixels. */ void SetGripperPosition(int nPos, bool bPercent); /** * @brief * This member function gets the location of the sizing gripper in pixels * relative to the left-hand side of the control. * @return * An integer value representing the location of the sizing gripper * in pixels relative to the left hand side of the control. */ int GetGripperPosition() const; /** * @brief * Synchronizes the scrollbar with the horizontal scroll position. * @details * Call this function to synchronize the tab control's horizontal * scrollbar with the horizontal scrollbar of the current view. * * This function should be called if anything happens in the view * that affects the horizontal scroll bar (e.g., a user typing text * into an edit control could make the text wider, thus requiring * a call to this function). */ void SyncScrollBar(); /** * @brief * This member function is called to set the shadow color for all tabs. * @param crShadow An RGB value that represents the tab shadow color. */ void SetTabShadowColor(COLORREF crShadow); /** * @brief * This member function gets an RGB value that represents the shadow color * of the tab. * @return * An RGB value that represents the tab shadow color. */ COLORREF GetTabShadowColor() const; /** * @brief * This member function is called to set the highlight color for all tabs. * @param crHighlight An RGB value that represents the tab highlight color. */ void SetTabHighlightColor(COLORREF crHighlight); /** @cond */ _XTP_DEPRECATED_IN_FAVOR(SetTabHighlightColor) void SetTabHilightColor(COLORREF crHighlight) { SetTabHighlightColor(crHighlight); } /** @endcond */ /** * @brief * This member function gets an RGB value that represents the highlight * color of the tab. * @return * An RGB value that represents the tab highlight color. */ COLORREF GetTabHighlightColor() const; /** @cond */ _XTP_DEPRECATED_IN_FAVOR(GetTabHighlightColor) COLORREF GetTabHilightColor() const { return GetTabHighlightColor(); } /** @endcond */ /** * @brief * This member function is called to set the default background color * for all tabs. * @param crBack An RGB value that represents the tab background color. */ void SetTabBackColor(COLORREF crBack); /** * @brief * This member function is called to set the default background color * for the specified tab located at 'nIndex'. * @param nIndex The index of the tab to set the background color for. * @param crBack An RGB value that represents the tab background color. */ void SetTabBackColor(int nIndex, COLORREF crBack); /** * @brief * This member function gets an RGB value that represents the background * color of the tab. * @return * An RGB value that represents the tab background color if successful, * otherwise COLORREF_NULL. */ COLORREF GetTabBackColor() const; /** * @brief * This member function gets an RGB value that represents the background * color of the tab. * @param nIndex The index of the tab to get the background color for. * @return * An RGB value that represents the tab background color if successful, * otherwise COLORREF_NULL. */ COLORREF GetTabBackColor(int nIndex) const; /** * @brief * This member function is called to set the default text color for * all tabs. If nIndex is specified, then the color is only set for * the tab located at 'nIndex'. * @param crText An RGB value that represents the tab text color. */ void SetTabTextColor(COLORREF crText); /** * @brief * This member function is called to set the default text color for * all tabs. If nIndex is specified, then the color is only set for * the tab located at 'nIndex'. * @param nIndex The index of the tab to set the text color for. * @param crText An RGB value that represents the tab text color. */ void SetTabTextColor(int nIndex, COLORREF crText); /** * @brief * This member function gets an RGB value that represents the text color * of the tab. * @return * An RGB value that represents the tab text color if successful, * otherwise COLORREF_NULL. */ COLORREF GetTabTextColor() const; /** * @brief * This member function gets an RGB value that represents the text color * of the tab. * @param nIndex The index of the tab to get text color for. * @return * An RGB value that represents the tab text color if successful, * otherwise COLORREF_NULL. */ COLORREF GetTabTextColor(int nIndex) const; /** * @brief * This member function is called to set the selected background color * for all tabs. If nIndex is specified, then the color is only set for * the tab located at 'nIndex'. * @param crBack An RGB value that represents the selected tab background color. */ void SetSelTabBackColor(COLORREF crBack); /** * @brief * This member function is called to set the selected background color * for all tabs. If nIndex is specified, then the color is only set for * the tab located at 'nIndex'. * @param nIndex The index of the tab to set the selected background color for. * @param crBack An RGB value that represents the selected tab background color. */ void SetSelTabBackColor(int nIndex, COLORREF crBack); /** * @brief * This member function gets an RGB value that represents the background * color for selected tabs. * @return * An RGB value that represents the selected tabs background color if * successful, otherwise COLORREF_NULL. */ COLORREF GetSelTabBackColor() const; /** * @brief * This member function gets an RGB value that represents the background * color for selected tabs. * @param nIndex The index of the tab to get the selected background color for. * @return * An RGB value that represents the selected tabs background color if * successful, otherwise COLORREF_NULL. */ COLORREF GetSelTabBackColor(int nIndex) const; /** * @brief * This member function is called to set the selected text color for * all tabs. If nIndex is specified, then the color is only set for * the tab located at 'nIndex'. * @param crText An RGB value that represents the selected tab text color. */ void SetSelTabTextColor(COLORREF crText); /** * @brief * This member function is called to set the selected text color for * all tabs. If nIndex is specified, then the color is only set for * the tab located at 'nIndex'. * @param nIndex The index of the tab to set the selected text color for. * @param crText An RGB value that represents the selected tab text color. */ void SetSelTabTextColor(int nIndex, COLORREF crText); /** * @brief * This member function gets an RGB value that represents the text color * for selected tabs. * @return * An RGB value that represents the selected tab text color if * successful, otherwise COLORREF_NULL. */ COLORREF GetSelTabTextColor() const; /** * @brief * This member function gets an RGB value that represents the text color * for selected tabs. * @param nIndex The index of the tab to get selected text color for. * @return * An RGB value that represents the selected tab text color if * successful, otherwise COLORREF_NULL. */ COLORREF GetSelTabTextColor(int nIndex) const; /** * @brief * Call this member function to reset the tab control to use default * system colors. */ void UpdateDefaultColors(); /** * @brief * This method obtains a pointer to the specified sibling scrollbar for * the flat tab control. * @param nBar Specifies the type of scrollbar. The parameter can take one * of the values specified in the Remarks section. * @details * The scrollbar type can be one of the following values: * SB_HORZ: Retrieves the position of the horizontal scrollbar. * SB_VERT: Retrieves the position of the vertical scrollbar. * @return Returns a pointer to the specified sibling scrollbar */ virtual CScrollBar* GetScrollBarCtrl(int nBar) const; /** * @brief * Retrieves the area occupied by the tabs. * @details * This member function is called to retrieve the size and location * of the area that is occupied by the tab items. * @return * A CRect object representing the tab item area. */ CRect GetTabsRect(); /** * @brief * Retrieves the tab font. * @param bBold TRUE to retrieve the bold font. * @details * Call this member function to return a pointer to the font * used to display the tab item label for the tab control. * @return * A pointer to a CFont object. */ CFont* GetTabFont(BOOL bBold); /** * @brief * Retrieves the FTS_XTP_ styles that are currently in use for * the flat tab control. * @return * A DWORD value that represents the FTS_XTP_ styles * currently in use for the flat tab control. * @details * This value is a combination of tab control FTS_XTP_ styles. * See the CXTPExcelTabCtrl::Create method for a list of * available styles. * @see * Create, SetTabStyle */ DWORD GetTabStyle(); /** * @brief * Sets the FTS_XTP_ styles for a flat tab control. * @param dwStyle Value specifying a combination of flat tab control * FTS_XTP_ styles. * @details * The dwStyle parameter allows you to set one or more FTS_XTP_ * styles. See the CXTPExcelTabCtrl::Create method for a list of * available styles. * @see * Create, GetTabStyle */ void SetTabStyle(DWORD dwStyle); /** * @brief * Creates a flat tab control and attaches it to an instance of a * CXTPExcelTabCtrl object. * @param dwStyle Specifies the tab control's style. Apply any combination of * tab control styles mentioned below in the Remarks section. * @param rect Specifies the tab control's size and position. It can be * either a CRect object or a RECT structure. * @param pParentWnd Specifies the tab control's parent window, usually a CDialog. * It must not be NULL. * @param nID Specifies the tab control's ID. * @return * TRUE if initialization of the object was successful, otherwise FALSE. * @details * You construct a CXTPExcelTabCtrl object in two steps. First, * call the constructor, and then call Create, which creates the tab * control and attaches it to the CXTPExcelTabCtrl object. You * can use the following tab control styles when creating the object: * * FTS_XTP_BOTTOM: Show tabs on bottom. * FTS_XTP_HASARROWS: Show back and next arrows. * FTS_XTP_HASHOMEEND: Show home and end arrows. Used with FTS_XTP_HASARROWS. * FTS_XTP_TOOLTIPS: Show tab tooltips. * FTS_XTP_DEFAULT: Same as (FTS_XTP_BOTTOM | FTS_XTP_HASARROWS | FTS_XTP_HASHOMEEND | * FTS_XTP_TOOLTIPS). FTS_XTP_HSCROLL: Show a horizontal scrollbar. * FTS_XTP_SQUARETABS: Shows square tabs instead of angled tabs. * FTS_XTP_MASK: Combines all FTS_ styles. * * In addition to tab control styles, you can apply the following * window styles to a tab control: * * WS_CHILD: Creates a child window that represents the tab * control. Cannot be used with the WS_POPUP style. * WS_VISIBLE: Creates a tab control that is initially visible. * WS_DISABLED: Creates a window that is initially disabled. * WS_GROUP: Specifies the first control of a group of controls * in which the user can move from one control to the * next with the arrow keys. All controls defined with * the WS_GROUP style after the first control belong * to the same group. The next control with the WS_GROUP * style ends the style group and starts the next group * (that is, one group ends where the next begins). * WS_TABSTOP: Specifies one of any number of controls through which * the user can move by using the TAB key. The TAB key * moves the user to the next control specified by the * WS_TABSTOP style. * Example: * The following code sample demonstrates the usage of Create. *
	 * // Create  the flat tab control.
	 * if (!m_wndFlatTabCtrl.Create(WS_CHILD | WS_VISIBLE | FTS_XTP_DEFAULT,
	 *    m_rcTabs, this, IDC_FLAT_TABCTRL))
	 * {
	 *    TRACE0("Failed to create flattab control\n");
	 *    return;
	 * }
	 *
	 * CreateViews();
	 *
	 * // Insert tabs into the flat tab control.
	 * m_wndFlatTabCtrl.InsertItem(0, _T("Build"),           &m_sheet1);
	 * m_wndFlatTabCtrl.InsertItem(1, _T("Debug"),           &m_sheet2);
	 * m_wndFlatTabCtrl.InsertItem(2, _T("Find in Files 1"), &m_sheet3);
	 * m_wndFlatTabCtrl.InsertItem(3, _T("Find in Files 2"), &m_sheet4);
	 * m_wndFlatTabCtrl.InsertItem(4, _T("Results"),         &m_sheet5);
	 * m_wndFlatTabCtrl.InsertItem(5, _T("SQL Debugging"),   &m_sheet6);
	 * m_wndFlatTabCtrl.InsertItem(6, _T("Form View"),       m_pSheet7);
	 * 
* @see * GetTabStyle, SetTabStyle */ virtual BOOL Create(DWORD dwStyle, const CRect& rect, CWnd* pParentWnd, UINT nID); /** * @brief * Call this member function to set the height for the tab control. * @param iTabHeight Size in pixels for the tab control. Minimum height * must be no smaller than the size returned from * GetSystemMetrics(SM_CYHSCROLL). */ void SetTabHeight(int iTabHeight); /** * @brief * Call this member function to retrieve the current height in pixels * for the tab control. * @return * The height in pixels for the tab control. */ int GetTabHeight() const; protected: /** * @brief * Call this function to determine which button, if any, is at the specified * screen position. * @param pt A CPoint reference representing the specified screen position. * @return * The zero-based index of the button within the button's array, or -1 if no * button is at the specified position. */ virtual int ButtonHitTest(CPoint& pt); /** * @brief * This member function will get the width in pixels of the tab specified * by 'nItem'. * @param nItem The zero-based index of the tab to retrieve the width for. * @return * The width in pixels of the tab. */ int GetTabWidth(int nItem) const; /** * @brief * This member function will calculate the total width of all the tabs * in the flat tab control. * @return * The total combined width in pixels of all the tabs in the control. */ int GetTotalTabWidth() const; /** * @brief * This member function will calculate the total width of all the arrow * buttons that are visible in the flat tab control. * @return * The total width in pixels of all the visible arrow buttons. */ int GetTotalArrowWidth() const; /** * @brief * This member function will calculate the total area width of all the * tabs in the flat tab control. * @return * The total area width in pixels of all the tabs in the flat tab control. */ int GetTotalTabAreaWidth() const; /** * @brief * This member function will force all of the tabs to be repainted. */ void InvalidateTabs(); /** * @brief * This member function will enable/disable the arrow buttons * depending on the current tab display state. */ void EnableButtons(); /** * @brief * This member function will free the resources allocated for the * icons used by the arrow buttons. */ void FreeButtonIcons(); /** * @brief * This member function will create the icon resources that are * used by the arrow buttons. */ void CreateButtonIcons(); /** * @brief * This member function will draw the horizontal sizing gripper at a * specified location. * @param pDC Pointer to the device context to draw the gripper to. * @param rect Location of the gripper. */ void DrawGripper(CDC* pDC, CRect rect) const; /** * @brief * The member function is used internally to toggle the state of the * sizing-grip tracking mode. * @param bTracking true to enable tracking, false to disable. */ void SetTracking(bool bTracking); /** * @brief * This member function frees all memory occupied by the tab items. */ void ClearAllItems(); /** * @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 * This internal function deletes an item from the tab item list. * @param nItem Index of the tab to delete. * @return * TRUE if successful, otherwise FALSE. */ virtual BOOL _DeleteItem(int nItem); /** * @brief * This internal function calculates the overlap between two tabs. * @return * An integer value that represents the overlap between the tabs. */ virtual int GetOverlap() const; /** * @brief * Call this member function to remove the highlight from all of the * buttons. */ void ResetMouseOver(); /** * @brief * Call this member function to get the dimensions of the rectangle * that encompasses all of the buttons. * @return Gets the dimensions of the rectangle that encompasses all of the buttons */ CRect GetTotalButtonRect() const; protected: /** * @brief * This member function is called by the CXTPExcelTabCtrl 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 refresh theme colors and redraw the * control. */ virtual void RefreshMetrics(); /** @cond */ DECLARE_MESSAGE_MAP() //{{AFX_VIRTUAL(CXTPExcelTabCtrl) virtual BOOL PreTranslateMessage(MSG* pMsg); virtual BOOL OnNotify(WPARAM, LPARAM lParam, LRESULT* pResult); virtual BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult); virtual void PreSubclassWindow(); virtual BOOL PreCreateWindow(CREATESTRUCT& cs); //}}AFX_VIRTUAL //{{AFX_MSG(CXTPExcelTabCtrl) afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnPaint(); void OnDraw(CDC* pDC); afx_msg LRESULT OnPrintClient(WPARAM wParam, LPARAM); afx_msg BOOL OnEraseBkgnd(CDC* pDC); afx_msg void OnLeftArrow(); afx_msg void OnRightArrow(); afx_msg void OnHomeArrow(); afx_msg void OnEndArrow(); afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message); afx_msg void OnLButtonUp(UINT nFlags, CPoint point); afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); afx_msg void OnTimer(UINT_PTR nIDEvent); //}}AFX_MSG afx_msg LRESULT OnSetTheme(WPARAM wParam, LPARAM lParam); /** @endcond */ private: BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL); protected: int m_cx; /**< Width for each arrow button. */ int m_cy; /**< Height for each arrow button. */ int m_nCurSel; /**< Index of the currently selected tab. */ int m_nClientWidth; /**< Width in pixels of the tab control client area. */ int m_nClientHeight; /**< Height in pixels of the tab control client area. */ int m_nOffset; /**< Amount in pixels of the displayed tab offset. */ int m_xGripperPos; /**< The current gripper position in pixels from the left. */ int m_iGripperPosPerCent; /**< The current gripper position in percent of the control width. */ int m_xTrackingDelta; /**< Tracking delta. */ int m_iBtnLeft; /**< Index of "left" button in button array. */ int m_iBtnRight; /**< Index of "right" button in button array. */ int m_iBtnHome; /**< Index of "home" button in button array. */ int m_iBtnEnd; /**< Index of "end" button in button array. */ int m_iBtnHilight; /**< Index of the button that has the mouse hovering over it. */ int m_iTabHeight; /**< Max height in pixels for the tab control. */ bool m_bTracking; /**< Tracking state. */ bool m_bManagingViews; /**< true if the control is managing views. */ bool m_bUserColors; /**< true if user defined colors are used. */ bool m_bPainted; /**< Set to TRUE to indicate that a button has been painted. FALSE otherwise. */ DWORD m_dwStyle; /**< Tab control style. */ CWnd* m_pWndLastFocus; /**< Last focused window. */ CRect m_rectTabs; /**< Area occupied by tabs. */ CRect m_rectViews; /**< Area occupied by managed views. */ CRect m_rectSB_H; /**< Area occupied by the horizontal scrollbar. */ CRect m_rectGripper; /**< Area occupied by the sizing gripper. */ CFont* m_pNormFont; /**< Font that is used for non-selected tabs. */ CFont* m_pBoldFont; /**< Font that is used for selected tabs. */ CXTPScrollBar m_wndHScrollBar; /**< The horizontal scrollbar (used with FTS_XTP_HSCROLL). */ CToolTipCtrl m_ToolTip; /**< Tooltip for the flat tab control. */ CXTPExcelTabCtrlButtonState m_buttons[4]; /**< Array of button information. */ CTabItemArray m_tcbItems; /**< Template list containing tab information. */ CXTPExcelTabCtrlTheme* m_pTheme; /**< Pointer to the current theme object. */ BOOL m_bSubclassed; /**< TRUE if the window was sub-classed. */ }; ////////////////////////////////////////////////////////////////////// /** @cond */ AFX_INLINE BOOL CXTPExcelTabCtrl::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) { return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext); } AFX_INLINE int CXTPExcelTabCtrl::GetCurSel() const { _ASSERTE(IsWindow(m_hWnd)); return m_nCurSel; } AFX_INLINE int CXTPExcelTabCtrl::GetItemCount() const { _ASSERTE(IsWindow(m_hWnd)); int iItemCount = (int)m_tcbItems.GetSize(); return iItemCount; } AFX_INLINE void CXTPExcelTabCtrl::SetTabFonts(CFont* pNormFont, CFont* pBoldFont) { if (pNormFont) { m_pNormFont = pNormFont; } if (pBoldFont) { m_pBoldFont = pBoldFont; } } AFX_INLINE DWORD CXTPExcelTabCtrl::GetTabStyle() { return m_dwStyle; } AFX_INLINE CRect CXTPExcelTabCtrl::GetTabsRect() { return m_rectTabs; } AFX_INLINE CFont* CXTPExcelTabCtrl::GetTabFont(BOOL bBold) { return bBold ? m_pBoldFont : m_pNormFont; } AFX_INLINE CXTPExcelTabCtrlTheme* CXTPExcelTabCtrl::GetTheme() { return m_pTheme; } /** @endcond */ const DWORD FTS_XTP_BOTTOM = 0x0001; /**< @see CXTPExcelTabCtrl::Create */ const DWORD FTS_XTP_HASARROWS = 0x0002; /**< @see CXTPExcelTabCtrl::Create */ const DWORD FTS_XTP_HASHOMEEND = 0x0004; /**< @see CXTPExcelTabCtrl::Create */ const DWORD FTS_XTP_TOOLTIPS = 0x0008; /**< @see CXTPExcelTabCtrl::Create */ const DWORD FTS_XTP_DEFAULT = 0x000F; /**< @see CXTPExcelTabCtrl::Create */ const DWORD FTS_XTP_HSCROLL = 0x0010; /**< @see CXTPExcelTabCtrl::Create */ const DWORD FTS_XTP_SQUARETABS = 0X0020; /**< @see CXTPExcelTabCtrl::Create */ const DWORD FTS_XTP_MASK = 0x003F; /**< @see CXTPExcelTabCtrl::Create */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // #if !defined(__XTPEXCELTABCTRL_H__) /** @endcond */