/** * @file XTPRibbonPopups.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(__XTPRIBBONPOPUPS_H__) # define __XTPRIBBONPOPUPS_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPRibbonQuickAccessControls; class CXTPRibbonTab; class CXTPRibbonControlTab; class CXTPTabPaintManager; class CXTPRibbonBar; class CXTPRibbonGroup; class CXTPCommandBarsFrameHook; class CXTPRibbonTabContextHeaders; class CXTPRibbonGroups; /** @cond */ class _XTP_EXT_CLASS CXTPRibbonScrollableBar { public: CXTPRibbonScrollableBar(); /** * @brief * Handles object destruction */ virtual ~CXTPRibbonScrollableBar() { } private: class CControlGroupsScroll; protected: void InitScrollableBar(CXTPCommandBar* pParent); void ShowScrollableRect(CXTPRibbonGroups* pGroups, CRect rc); public: void EnableGroupsScroll(BOOL bScrollLeft, BOOL bScrollRight); virtual void OnGroupsScroll(BOOL bScrollLeft) = 0; virtual CRect GetGroupsRect() const = 0; virtual CXTPRibbonGroup* HitTestGroup(CPoint point) const = 0; void CreateGroupKeyboardTips(CXTPRibbonTab* pSelectedTab); /** * @brief * Call this method to get the highlighted group. * @return * A pointer to the CXTPRibbonGroup object under the mouse cursor. * @see * CXTPRibbonGroup */ CXTPRibbonGroup* GetHighlightedGroup() const; void HighlightGroup(CXTPRibbonGroup* pHighlightedGroup); protected: void CreateControlKeyboardTips(CXTPControl* pControl, LPCTSTR lpszPrefix, BOOL bVisible); BOOL ProcessSpecialKey(XTPSpecialKey key); CRect _GetBoundRect(CXTPControl* pControl, BOOL bSelected, XTPSpecialKey key); public: int m_nGroupsScrollPos; /**< Groups scroll position. */ protected: CXTPCommandBar* m_pParent; CXTPControl* m_pControlScrollGroupsLeft; /**< Control to draw left scroll. */ CXTPControl* m_pControlScrollGroupsRight; /**< Control to draw right scroll. */ CXTPRibbonGroup* m_pHighlightedGroup; /**< Currently highlighted group. */ }; _XTP_EXT_CLASS CXTPRibbonScrollableBar* AFX_CDECL GetScrollableBar(CXTPCommandBar* pCommandBar); /** @endcond */ /** * @brief * Implements a pop-up when the Ribbon is in minimzed mode. */ class _XTP_EXT_CLASS CXTPRibbonTabPopupToolBar : public CXTPPopupToolBar , public CXTPRibbonScrollableBar { /** @cond */ DECLARE_DYNAMIC(CXTPRibbonTabPopupToolBar) /** @endcond */ public: /** * @brief * Constructs a CXTPRibbonTabPopupToolBar object. * @param pRibbonTab Ribbon tab that the pop-up toolbar belongs to. */ CXTPRibbonTabPopupToolBar(CXTPRibbonTab* pRibbonTab); /** * @brief * Destroys a CXTPRibbonTabPopupToolBar object, handles cleanup and deallocation. */ ~CXTPRibbonTabPopupToolBar(); public: /** * @brief * Retrieves the groups bounding rectangle. * @return * A CRect object containing the groups bounding rectangle. */ CRect GetGroupsRect() const; /** * @brief * The framework calls this member function when the group pop-up is scrolled. * @param bScrollLeft TRUE when scrolling left, FALSE when scrolling right. */ void OnGroupsScroll(BOOL bScrollLeft); /** * @brief * Call this method to make sure that a control is visible on the ribbon bar. * @param pControl Pointer to the CXTPControl child whose visibility must be checked. */ void EnsureVisible(CXTPControl* pControl); /** * @brief * This method is called to create a keyboard tips collection for the ribbon. */ void CreateKeyboardTips(); /** * @brief * This method is called to get the size of the command bar. * @param nLength The requested dimension of the control bar, either * horizontal or vertical depending on nMode. * @param nMode See CControlBar::CalcDynamicLayout for the list of * supported flags. * @return * The size of the command bar. */ CSize CalcDynamicLayout(int nLength, DWORD nMode); /** * @brief * This method is called to draw the command bar in the given context. * @param pDC Pointer to a valid device context. * @param rcClipBox The rectangular area of the control that is invalid. */ void DrawCommandBar(CDC* pDC, CRect rcClipBox); /** * @brief * Call this function to get the size of the command bar button. * @return * The width and height values of the command bar button. */ virtual CSize GetButtonSize() const; /** * @brief * Call this member function to get the size of the icon for a minimized group. * @return * The size of the icon for a minimized group * @see * GetLargeIconSize */ virtual CSize GetIconSize() const; /** * @brief * This method is called to calculate the destination rectangle of the pop-up bar. * @param ptPopup Point to display the pop-up bar. * @param sz Size of the pop-up bar. * @return * Rectangle where the pop-up bar will be located. */ virtual CRect CalculatePopupRect(CPoint ptPopup, CSize sz); /** * @brief * This member function determines which ribbon group, if any, is at * a specified position. * @param point Point to test. * @return * A pointer to the CXTPRibbonGroup at the specified position, if any, * otherwise NULL. */ CXTPRibbonGroup* HitTestGroup(CPoint point) const; /** * @brief * Call this member to change the tracking state. * @param bMode TRUE to set the tracking mode; otherwise FALSE. * @param bSelectFirst TRUE to select the first item. * @param bKeyboard TRUE if the item is pop-up'ed by the keyboard. * @return * TRUE if the method was successful. */ virtual BOOL SetTrackingMode(int bMode, BOOL bSelectFirst = TRUE, BOOL bKeyboard = FALSE); /** * @brief * This method is called when a keyboard tip is found for the command bar. * @param pTip Keyboard tip that was found for the command bar. */ void OnKeyboardTip(CXTPCommandBarKeyboardTip* pTip); /** * @brief * Call this method to determine if keyboard cues are visible. * @return * TRUE if keyboard cues are visible, otherwise FALSE. */ BOOL IsKeyboardCuesVisible() const; /** * @brief * The framework calls this member function to determine whether * a point is in the bounding rectangle of the specified tool. * @param point Specifies the x- and y- coordinates of the cursor. These * coordinates are always relative to the upper-left * corner of the window. * @param pTI A pointer to a TOOLINFO structure. * @return * If the tooltip control was found, then the window control ID is returned. * If the tooltip control was not found, then a value of -1 is returned. */ INT_PTR OnToolHitTest(CPoint point, TOOLINFO* pTI) const; protected: /** @cond */ void OnMouseMove(UINT nFlags, CPoint point); afx_msg void OnMouseLeave(); /** @endcond */ /** * @brief * This method is called to process special keys. * @param key Special keys enumerator. Can be any of the values listed in * the Remarks section. * @details * CXTPCommandBar maps key passed as parameter of OnKeyDown to XTPSpecialKey * enumerator and call ProcessSpecialKey.
The key parameter can be one * of the following: * xtpKeyNext: Indicates that the RIGHT or DOWN key was pressed. * Next control must be selected. * xtpKeyPrev: Indicates that the LEFT or UP key was pressed. * Previous control must be selected. * xtpKeyBack: Indicates that the LEFT key was pressed for pop-up bar. * Current sub-menu must be closed. * xtpKeyPopup: Indicates that the RIGHT key was pressed for pop-up bar. * Sub-menu must be opened. * xtpKeyEscape: Indicates that the ESCAPE key was pressed. * xtpKeyReturn: Indicates that the RETURN key was pressed. * xtpKeyHome: Indicates that the HOME key was pressed. * First control must be selected. * xtpKeyEnd: Indicates that the END key was pressed. * Last control must be selected. * @return * TRUE if the key was handled, otherwise FALSE. */ virtual BOOL ProcessSpecialKey(XTPSpecialKey key); /** @cond */ DECLARE_MESSAGE_MAP() /** @endcond */ public: CXTPRibbonTab* m_pRibbonTab; /**< Ribbon bar tab that the group belongs to. */ CXTPRibbonBar* m_pRibbonBar; /**< The CXTPRibbonBar object that the CXTPRibbonTab belongs to. */ CRect m_rcGroups; /**< Groups bounding rectangle. */ }; /** @cond */ class _XTP_EXT_CLASS CXTPRibbonBarMorePopupToolBar : public CXTPPopupToolBar { DECLARE_DYNAMIC(CXTPRibbonBarMorePopupToolBar) public: CXTPRibbonBarMorePopupToolBar(CXTPRibbonBar* pRibbonBar); public: void FillCommandBarEntry(CDC* pDC); CSize GetIconSize() const; CSize GetButtonSize() const; public: CXTPRibbonBar* m_pRibbonBar; }; class _XTP_EXT_CLASS CXTPRibbonGroupPopupToolBar : public CXTPPopupToolBar , public CXTPRibbonScrollableBar { DECLARE_XTP_COMMANDBAR(CXTPRibbonGroupPopupToolBar) public: CXTPRibbonGroupPopupToolBar(CXTPRibbonGroup* pRibbonGroup = NULL); ~CXTPRibbonGroupPopupToolBar(); public: CSize CalcDynamicLayout(int, DWORD /*nMode*/); void DrawCommandBar(CDC* pDC, CRect rcClipBox); void CreateKeyboardTips(); CSize GetIconSize() const; CSize GetButtonSize() const; virtual void OnGroupsScroll(BOOL bScrollLeft); virtual CRect GetGroupsRect() const; virtual BOOL SetTrackingMode(int bMode, BOOL bSelectFirst = TRUE, BOOL bKeyboard = FALSE); virtual CXTPRibbonGroup* HitTestGroup(CPoint point) const; BOOL IsKeyboardCuesVisible() const; protected: void OnMouseMove(UINT nFlags, CPoint point); afx_msg void OnMouseLeave(); virtual BOOL ProcessSpecialKey(XTPSpecialKey key); DECLARE_MESSAGE_MAP() public: CXTPRibbonGroup* m_pRibbonGroup; CXTPRibbonBar* m_pRibbonBar; CXTPRibbonGroup* m_pParentGroup; }; /** @endcond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // !defined(__XTPRIBBONPOPUPS_H__) /** @endcond */