/** * @file XTPRibbonControlTab.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(__XTPRIBBONCONTROLTAB_H__) # define __XTPRIBBONCONTROLTAB_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPRibbonGroups; class CXTPRibbonBar; class CXTPRibbonGroup; class CXTPRibbonTab; /** * @brief * Structure used as a parameter for TCN_SELCHANGING and TCN_SELCHANGE * messages when a Ribbon tab is changed. */ struct NMXTPTABCHANGE : public NMXTPCONTROL { CXTPRibbonTab* pTab; /**< Ribbon tab to be selected. */ }; /** * @brief * CXTPRibbonControlTab is a CXTPTabManager derived class. * It represents tabs of the Ribbon Bar. */ class _XTP_EXT_CLASS CXTPRibbonControlTab : public CXTPControlPopup , public CXTPTabManager { /** @cond */ DECLARE_XTP_CONTROL(CXTPRibbonControlTab) /** @endcond */ public: /** * @brief * Constructs a CXTPRibbonControlTab object. */ CXTPRibbonControlTab(); /** * @brief * Destroys a CXTPRibbonControlTab object, handles cleanup and deallocation. */ virtual ~CXTPRibbonControlTab(); public: /** * @brief * Call this member to get a pointer to the tab paint manager. * @details * The tab paint manager is used to customize the appearance of * CXTPTabManagerItem objects and the tab manager (i.e. tab colors, * styles, etc.). This member must be overridden in derived classes. * @return * A pointer to the CXTPTabPaintManager that contains the * visual elements of the tabs. */ virtual CXTPTabPaintManager* GetPaintManager() const; /** * @brief * Retrieves the parent CXTPRibbonBar object. * @return * A pointer to the parent CXTPRibbonBar object. */ CXTPRibbonBar* GetRibbonBar() const; /** * @brief * Call this method to find a tab with a specified identifier. * @param nId Identifier of the tab to be found. * @return * A pointer to the CXTPRibbonTab object with the specified identifier. * @see * FindGroup */ CXTPRibbonTab* FindTab(int nId) const; /** * @brief * Call this method to retrieve the tab at a specified position. * @param nIndex Index of the tab to retrieve. * @return * A pointer to the CXTPRibbonTab object at the specified position. * @see * GetTabCount */ CXTPRibbonTab* GetTab(int nIndex) const; /** * @brief * Call this member to select an item in the ribbon bar. * @param pItem Pointer to the CXTPTabManagerItem object to be selected. */ void SetSelectedItem(CXTPTabManagerItem* pItem); protected: /** * @brief * This method is called to update the position of the tab manager. */ void Reposition(); /** * @brief * The implementation should return TRUE if * the header has focus or FALSE otherwise. * @return * TRUE if the header has focus, otherwise FALSE. */ virtual BOOL HeaderHasFocus() const; /** * @brief * Call this member to set focus to the control. * @param bFocused TRUE to set focus to the control. */ virtual void SetFocused(BOOL bFocused); /** * @brief * Determines if the control has focus. * @return * TRUE if the control has focus, otherwise FALSE. */ virtual BOOL IsFocused() const; /** * @brief * This method is called when the user actives the control using * its underline. */ void OnUnderlineActivate(); /** * @brief * This method is called to check if the control can accept focus. * @return * TRUE if the control can accept focus, otherwise FALSE. * @see * SetFocused */ virtual BOOL IsFocusable() const; /** * @brief * This method is called when the control becomes selected. * @param bSelected TRUE if the control becomes selected. * @return * TRUE if successful, otherwise FALSE. */ BOOL OnSetSelected(int bSelected); /** * @brief * This method is called when a non-system key is pressed. * @param nChar Specifies the virtual key code of the given key. * @param lParam Specifies additional message-dependent information. * @return * TRUE if the key was handled, otherwise FALSE. */ BOOL OnHookKeyDown(UINT nChar, LPARAM lParam); /** * @brief * This method is called when an item (tab button) is clicked. * @param pItem Item that was clicked. */ void OnItemClick(CXTPTabManagerItem* pItem); protected: /** * @brief * This member is called when the icon of the ribbon tab needs to be drawn. * @param pDC Pointer to the destination device context. * @param pt Specifies the location of the image. * @param pItem CXTPTabManagerItem object to draw icon on. * @param bDraw TRUE if the icon needs to be drawn (e.g. the icon size changed), * FALSE if the icon does not need to be drawn or redrawn. * @param szIcon Size of the tab icon. * @details * This member is overridden by its descendants. * This member must be overridden in derived classes. * @return * TRUE if the icon was successfully drawn, FALSE if the icon was not drawn. */ BOOL DrawIcon(CDC* pDC, CPoint pt, CXTPTabManagerItem* pItem, BOOL bDraw, CSize& szIcon) const; /** * @brief * Initiates redrawing of the ribbon bar control. * @details * Call this member function if you want to initialize redrawing * of the control. The control will be redrawn taking into account * its latest state. * @param lpRect The rectangular area of the window that is invalid. * @param bAnimate TRUE to animate changes in the bounding rectangle. */ void RedrawControl(LPCRECT lpRect, BOOL bAnimate); /** * @brief * Checks to see if the mouse is locked. * @details * The mouse is locked when a CXTPCommandBarsPopup is currently visible. * @return * TRUE if the mouse is locked, otherwise FALSE. */ BOOL IsMouseLocked() const; /** * @brief * This method is called to draw the control. * @param pDC Pointer to a valid device context. */ void Draw(CDC* pDC); /** * @brief * Call this member function to store/load a properties collection * using the specified data object. * @param pPX Source/destination CXTPPropExchange data object reference. * @details * This member function is used to store/load properties collection * data to/form storage. */ void DoPropExchange(CXTPPropExchange* pPX); /** * @brief * This method is called to copy the control. * @param pControl Pointer to a source CXTPControl object. * @param bRecursive TRUE to copy recursively. */ void Copy(CXTPControl* pControl, BOOL bRecursive = FALSE); /** * @brief * Call this member to get the tracking state. * @return * TRUE if the ribbon is in tracking mode. */ BOOL IsPopupBarTracking() const; protected: /** @cond */ void OnClick(BOOL bKeyboard = FALSE, CPoint pt = CPoint(0, 0)); void ShowPopupBar(BOOL bKeyboard); BOOL OnSetPopup(BOOL bPopup); void SetEnabled(BOOL bEnabled); CString GetItemTooltip(const CXTPTabManagerItem* pItem) const; virtual void AdjustExcludeRect(CRect& rc, BOOL bVertical); /** @endcond */ protected: /** @cond */ virtual HRESULT GetAccessibleChildCount(long* pcountChildren); virtual HRESULT GetAccessibleChild(VARIANT varChild, IDispatch** ppdispChild); virtual HRESULT GetAccessibleName(VARIANT varChild, BSTR* pszName); virtual HRESULT GetAccessibleRole(VARIANT varChild, VARIANT* pvarRole); virtual HRESULT AccessibleLocation(long* pxLeft, long* pyTop, long* pcxWidth, long* pcyHeight, VARIANT varChild); virtual HRESULT AccessibleHitTest(long xLeft, long yTop, VARIANT* pvarChild); virtual HRESULT GetAccessibleState(VARIANT varChild, VARIANT* pvarState); virtual HRESULT GetAccessibleDefaultAction(VARIANT varChild, BSTR* pszDefaultAction); virtual HRESULT AccessibleDoDefaultAction(VARIANT varChild); virtual HRESULT AccessibleSelect(long flagsSelect, VARIANT varChild); /** @endcond */ protected: BOOL m_bFocused; /**< TRUE if groups is focused. */ friend class CXTPRibbonBar; }; AFX_INLINE CXTPRibbonBar* CXTPRibbonControlTab::GetRibbonBar() const { return (CXTPRibbonBar*)m_pParent; } # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // !defined(__XTPRIBBONCONTROLTAB_H__) /** @endcond */