/** * @file XTPRibbonBar.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(__XTPRIBBONBAR_H__) # define __XTPRIBBONBAR_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; class CXTPRibbonPaintManager; class CXTPRibbonControlSystemButton; /** * @brief * The WM_XTP_RIBBONMINIMIZE message is sent to the CXTPCommandBars site * when the user minimizes the ribbon bar. */ # define WM_XTP_RIBBONMINIMIZE (WM_XTP_COMMANDBARS_BASE + 25) # define WM_XTP_CUSTOMIZATION_RIBBONRESET (WM_XTP_COMMANDBARS_BASE + 27) /** * @brief * CXTPRibbonBar is a CXTPMenuBar derived class. * It represents a Ribbon control from Office 2007. * * Example: * The following code sample demonstrates how to create a CXTPRibbonBar: *
* CXTPRibbonBar* pRibbonBar = (CXTPRibbonBar*)pCommandBars->Add(_T("The Ribbon"), xtpBarTop,
* RUNTIME_CLASS(CXTPRibbonBar));
*
*/
class _XTP_EXT_CLASS CXTPRibbonBar
: public CXTPMenuBar
, public CXTPRibbonScrollableBar
{
private:
class CControlQuickAccessMorePopup;
class CControlQuickAccessCommand;
private:
/** @cond */
DECLARE_XTP_COMMANDBAR(CXTPRibbonBar)
/** @endcond */
public:
/**
* @brief
* Constructs a CXTPRibbonBar object.
*/
CXTPRibbonBar();
/**
* @brief
* Destroys a CXTPRibbonBar object, handles cleanup and deallocation.
*/
virtual ~CXTPRibbonBar();
public:
/**
* @brief
* Call this method to add a new tab to the ribbon bar.
* @param lpszCaption Caption of the tab to be added.
* @return
* A pointer to a new CXTPRibbonTab object.
* @see
* InsertTab
*/
CXTPRibbonTab* AddTab(LPCTSTR lpszCaption);
/**
* @brief
* Call this method to add a new tab to the ribbon bar.
* @param nID Identifier of the tab to be added.
* @return
* A pointer to a new CXTPRibbonTab object.
* @see
* InsertTab
*/
CXTPRibbonTab* AddTab(int nID);
/**
* @brief
* Call this method to insert a new tab to the ribbon bar at a specified position.
* @param nItem Position to insert the new tab.
* @param nID Identifier of the tab to be added.
* @return
* A pointer to a new CXTPRibbonTab object.
* @see
* AddTab
*/
CXTPRibbonTab* InsertTab(int nItem, int nID);
/**
* @brief
* Call this method to insert a new tab to the ribbon bar at a specified position.
* @param nItem Position to insert the new tab.
* @param nID Identifier of the tab to be added.
* @param lpszCaption Caption of the tab to be added.
* @return
* A pointer to a new CXTPRibbonTab object.
* @see
* AddTab
*/
CXTPRibbonTab* InsertTab(int nItem, LPCTSTR lpszCaption, int nID = 0);
/**
* @brief
* Call this method to insert a new tab to the ribbon bar at a specified position.
* @param nItem Position to insert the new tab.
* @param pTab Pointer to a CXTPRibbonTab object.
* @return
* A pointer to a new CXTPRibbonTab object.
* @see
* AddTab
*/
CXTPRibbonTab* InsertTab(int nItem, CXTPRibbonTab* pTab);
/**
* @brief
* Call this method to get the currently selected tab.
* @return
* A pointer to the currently selected CXTPRibbonTab object.
* @see
* SetCurSel
*/
CXTPRibbonTab* GetSelectedTab() 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 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 find a group with a specified identifier.
* @param nId Identifier of the group to be found.
* @return
* A pointer to the CXTPRibbonGroup object with the specified identifier.
* @see
* FindTab
*/
CXTPRibbonGroup* FindGroup(int nId) const;
/**
* @brief
* Retrieves the number of tabs in the ribbon bar.
* @return
* The number of tabs in the ribbon bar.
* @see
* GetTab
*/
int GetTabCount() const;
/**
* @brief
* Retrieves the ribbon paint manager.
* @return
* A pointer to a CXTPRibbonPaintManager object.
* @see
* AddTab
*/
CXTPRibbonPaintManager* GetRibbonPaintManager() const;
/**
* @brief
* Call this method to set the currently selected tab.
* @param nIndex Index of the tab to be set.
* @see
* GetSelectedTab
*/
void SetCurSel(int nIndex);
/**
* @brief
* Call this function to get the size of the command bar button.
* @return
* The width and height values of the command bar button.
*/
CSize GetButtonSize() const;
/**
* @brief
* Call this method to get the index of the currently selected tab.
* @return
* The index of the currently selected tab.
* @see
* SetCurSel
*/
int GetCurSel() const;
/**
* @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.
*/
CXTPTabPaintManager* GetTabPaintManager() const;
/**
* @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;
/**
* @brief
* Determines if the Ribbon state is active/inactive.
* @return
* TRUE if the Ribbon state is active, FALSE if the Ribbon state is inactive.
*/
BOOL IsActive() const;
/**
* @brief
* Determines if the groups part of the ribbon bar is visible.
* @return
* TRUE if the groups part of the ribbon bar is visible.
* @see
* SetGroupsVisible
*/
BOOL IsGroupsVisible() const;
/**
* @brief
* Determines if the tabs part of the ribbon bar is visible.
* @return
* TRUE if the tabs part of the ribbon bar is visible.
* @see
* SetTabsVisible
*/
BOOL IsTabsVisible() const;
/**
* @brief
* Determines if the ribbon bar is visible.
* @return
* TRUE if the ribbon bar is visible.
*/
BOOL IsRibbonBarVisible() const;
/**
* @brief
* Call this member function to show/hide the ribbon.
* @param bVisible TRUE to show the ribbon, FALSE to hide.
*/
virtual void SetVisible(BOOL bVisible);
/**
* @brief
* Call this method to show/hide the groups part of the ribbon bar.
* @param bVisible TRUE to show the groups part of the ribbon bar.
* @see
* IsGroupsVisible
*/
void SetGroupsVisible(BOOL bVisible);
/**
* @brief
* Call this method to show/hide the tabs part of the ribbon bar.
* @param bVisible TRUE to show the tabs part of the ribbon bar.
* @see
* IsTabsVisible
*/
void SetTabsVisible(BOOL bVisible);
/**
* @brief
* Call this method to get the CXTPRibbonControlTab object that represents
* ribbon tabs.
* @return
* A pointer to the CXTPRibbonControlTab object that represents ribbon tabs.
*/
CXTPRibbonControlTab* GetControlTab() const;
/**
* @brief
* Call this method to set the minimum width/height before the ribbon bar disappears.
* @param nMinVisibleWidth New minimum width.
* @details
* Default value is 250 pixels.
* @see
* GetMinimumVisibleWidth
*/
void SetMinimumVisibleWidth(int nMinVisibleWidth);
/**
* @brief
* Call this method to set the minimum width/height before the ribbon bar disappears.
* @param nMinVisibleWidth New minimum width.
* @param nMinVisibleHeight New minimum height.
* @details
* Default value is 250 pixels.
* @see
* GetMinimumVisibleWidth
*/
void SetMinimumVisibleSize(int nMinVisibleWidth, int nMinVisibleHeight);
/**
* @brief
* Call this method to get the minimum width before the ribbon bar disappears.
* @return
* The minimum width before the ribbon bar disappears.
* @see
* SetMinimumVisibleWidth
*/
int GetMinimumVisibleWidth() const;
/**
* @brief
* Retrieves the collection of Quick Access controls.
* @return
* A pointer to the CXTPRibbonQuickAccessControls object that represents
* the collection of Quick Access controls.
*/
CXTPRibbonQuickAccessControls* GetQuickAccessControls() const;
/**
* @brief
* Call this method to add the Ribbon top-left system button.
* @param nID Identifier of the system button.
* @return Adds the Ribbon top-left system button
* @see
* GetSystemButton
*/
CXTPControlPopup* AddSystemButton(int nID = 0);
/**
* @brief
* Call this method to get the Ribbon top-left system button.
* @return
* The Ribbon top-left system button.
* @see
* AddSystemButton
*/
CXTPRibbonControlSystemButton* GetSystemButton() const;
/**
* @brief
* Call this member function to determine if the command bar is a
* CXTPRibbonBar.
* @return
* TRUE if the command bar is a CXTPRibbonBar, otherwise FALSE.
* @see
* CXTPCommandBar, CXTPRibbonBar
*/
virtual BOOL IsRibbonBar() const;
/**
* @brief
* Call this member to remove all tabs.
* @see
* RemoveTab
*/
void RemoveAllTabs();
/**
* @brief
* Call this member to remove a single tab.
* @param nIndex Index of the tab to remove.
* @see
* RemoveTab
*/
void RemoveTab(int nIndex);
/**
* @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.
*/
virtual void EnsureVisible(CXTPControl* pControl);
BOOL OnFrameMouseWheel(BOOL bForward);
public:
/**
* @brief
* Call this method to enable/disable Office 2007 frame.
* @param bEnable TRUE to enable Office 2007 frame, FALSE to disable.
* @see
* IsFrameThemeEnabled
*/
void EnableFrameTheme(BOOL bEnable = TRUE);
/**
* @brief
* Determines if Office 2007 frame is enabled/disabled.
* @return
* TRUE if enabled, FALSE if disabled.
* @see
* EnableFrameTheme
*/
BOOL IsFrameThemeEnabled() const;
/**
* @brief
* Call this method to show Quick Access controls below/above the ribbon bar.
* @param bBelow TRUE to show Quick Access controls below the ribbon bar,
* FALSE to show Quick Access controls above the ribbon bar.
* @see
* IsQuickAccessBelowRibbon
*/
void ShowQuickAccessBelowRibbon(BOOL bBelow = TRUE);
/**
* @brief
* Determines if Quick Access controls are shown below/above the ribbon bar.
* @return
* TRUE if Quick Access controls are shown below the ribbon bar,
* FALSE if Quick Access controls are shown above the ribbon bar.
* @see
* ShowQuickAccessBelowRibbon
*/
BOOL IsQuickAccessBelowRibbon() const;
/**
* @brief
* Call this method to show/hide Quick Access.
* @param bShow TRUE to show Quick Access, FALSE to hide.
* @see
* IsQuickAccessVisible, ShowQuickAccessBelowRibbon
*/
void ShowQuickAccess(BOOL bShow = TRUE);
/**
* @brief
* Determines if Quick Access is visible.
* @return
* TRUE if Quick Access is visible, otherwise FALSE.
* @see
* ShowQuickAccess
*/
BOOL IsQuickAccessVisible() const;
/**
* @brief
* Call this method to allow for duplicate controls for Quick Access.
* @param bAllow TRUE to allow for duplicate controls for Quick Access.
* @see
* IsAllowQuickAccessDuplicates, ShowQuickAccessBelowRibbon
*/
void AllowQuickAccessDuplicates(BOOL bAllow);
/**
* @brief
* Call this method to allow for customization of Quick Access.
* @param bAllow TRUE to allow for customization of Quick Access.
* @see
* IsAllowQuickAccessDuplicates, ShowQuickAccessBelowRibbon
*/
void AllowQuickAccessCustomization(BOOL bAllow);
/**
* @brief
* Determines if duplicate controls are allowed for Quick Access.
* @return
* TRUE if duplicate controls are allowed for Quick Acess.
* @see
* AllowQuickAccessDuplicates
*/
BOOL IsAllowQuickAccessDuplicates() const;
/**
* @brief
* Call this method to select the next/previous tab.
* @param bNext TRUE to select next, FALSE to select previous.
*/
void SelectNextTab(BOOL bNext);
/**
* @brief
* Call this method to minimize the ribbon bar.
* @param bMinimized TRUE to minimize the ribbon bar.
*/
virtual void SetRibbonMinimized(BOOL bMinimized);
/**
* @brief
* Determines if the ribon bar is minimized.
* @return
* TRUE if the ribbon bar is minimized.
*/
BOOL IsRibbonMinimized() const;
/**
* @brief
* Call this method to allow/disallow the minimize feature of the ribbon bar.
* @param bAllow TRUE to allow the minimize feature of the ribbon bar,
* FALSE to disallow.
*/
void AllowMinimize(BOOL bAllow);
public:
/**
* @brief
* When switching tabs, RebuildControls first deletes all of the controls
* from the old tab groups. Then controls are added to the tab groups
* of the tab to be selected. Finally, the new tab is selected.
* @param pSelected New tab to be selected.
* @see
* CXTPRibbonControlTab::SetSelectedItem, CXTPRibbonTab::GetGroups
*/
void RebuildControls(CXTPRibbonTab* pSelected);
/**
* @brief
* Gets the bounding rectangle of the ribbon tabs.
* @return
* A CRect object containing the bounding rectangle of the
* ribbon tabs.
* @see
* CXTPRibbonThemeOffice2007Theme::FillRibbonBar
*/
CRect GetTabControlRect() const;
/**
* @brief
* Gets the bounding rectangle of the ribbon caption.
* @return
* A CRect object containing the bounding rectangle of the
* ribbon caption.
* @see
* GetCaptionTextRect, GetQuickAccessRect, GetTabControlRect
*/
CRect GetCaptionRect() const;
/**
* @brief
* Gets the bounding rectangle of the ribbon caption text.
* @return
* A CRect object containing the bounding rectangle of the
* ribbon caption text.
* @see
* GetCaptionRect, GetQuickAccessRect, GetTabControlRect
*/
CRect GetCaptionTextRect() const;
/**
* @brief
* Gets the bounding rectangle of the ribbon Quick Access controls.
* @return
* A CRect object containing the bounding rectangle of the
* ribbon Quick Access Controls.
* @see
* GetCaptionRect, GetCaptionTextRect, GetTabControlRect
*/
CRect GetQuickAccessRect() const;
/**
* @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
* Gets the tabs area height.
* @return
* The tabs area height.
* @see
* GetGroupsHeight
*/
virtual int GetTabsHeight() const;
/**
* @brief
* Gets the Quick Access area height.
* @return
* The Quick Access area height.
* @see
* GetGroupsHeight, GetTabsHeight
*/
int GetQuickAccessHeight() const;
/**
* @brief
* Calculates the Quick Access area height.
* @return
* The Quick Access area height.
*/
int CalcQuickAccessHeight();
/**
* @brief
* Gets the group area height.
* @return
* The group area height.
* @see
* GetTabsHeight
*/
virtual int GetGroupsHeight();
/**
* @brief
* Gets the group client area height.
* @return
* The group client area height.
* @see
* GetGroupsHeight, GetTabsHeight
*/
virtual int CalcClientHeight();
/**
* @brief
* Gets the ribbon groups bounding rectangle.
* @return
* A CRect object containing the groups bounding rectangle.
*/
CRect GetGroupsRect() const;
/**
* @brief
* Calculates the ribbon groups height using the GetLargeIconSize method
* and the height of the captions.
* @return
* The ribbon groups height.
* @see
* GetGroupsHeight
*/
virtual int CalcGroupsHeight();
/**
* @brief
* Sets the height of the ribbon groups.
* @param nHeight New height to be set.
* @see
* GetTabsHeight
*/
void SetGroupsHeight(int nHeight);
/**
* @brief
* Gets the caption height of the ribbon bar, in pixels.
* @return
* The caption height of the ribbon bar, in pixels.
* @see
* CalcGroupsHeight
*/
int GetCaptionHeight() const;
/**
* @brief
* Retrieves the collection of context headers.
* @return
* A pointer to the CXTPRinnobTabContextHeaders object that represents
* the collection of context headers.
* @see
* CXTPRibbonTabContextHeader
*/
CXTPRibbonTabContextHeaders* GetContextHeaders() const;
/**
* @brief
* Determines if a control belongs to Quick Access controls.
* @param pControl Control to check.
* @return
* TRUE if the control is located in the Quick Access area.
*/
BOOL IsQuickAccessControl(CXTPControl* pControl) const;
/**
* @brief
* Determines if a control can be added to Quick Access controls.
* @param pControl Control to check.
* @return
* TRUE if the control can be added to the Quick Access area.
*/
virtual BOOL IsAllowQuickAccessControl(CXTPControl* pControl);
/**
* @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.
*/
virtual void DrawCommandBar(CDC* pDC, CRect rcClipBox);
/**
* @brief
* Retrieves the CXTPCommandBarsFrameHook object used to skin the frame.
* @return
* A pointer to the CXTPCommandBarsFrameHook object used to skin the frame.
* @see
* EnableFrameTheme
*/
CXTPCommandBarsFrameHook* GetFrameHook() const;
/**
* @brief
* Determines if Vista Glass effect is enabled for the ribbon bar.
* @return
* TRUE if Vista Glass effect is enabled for the ribbon bar.
*/
BOOL IsDwmEnabled() const;
/**
* @brief
* Sets the font height for the ribbon bar.
* @param nFontHeight New font height to set.
*/
void SetFontHeight(int nFontHeight);
/**
* @brief
* Gets the font height of the ribbon bar.
* @return
* The font height of the ribbon bar.
*/
int GetFontHeight() const;
/**
* @brief
* Determines if the caption part of the ribbon is visible.
* @return
* TRUE if the caption part of the ribbon is visible.
*/
BOOL IsCaptionVisible() const;
/**
* @brief
* Call this method to show/hide the caption if the frame theme is not enabled.
* @param bShowCaption TRUE to show the caption if the frame theme is not enabled,
* FALSE to hide the caption if the frame theme is not enabled.
*/
void ShowCaptionAlways(BOOL bShowCaption);
/**
* @brief
* Determines if the caption is shown/hidden if the frame theme is not enabled.
* @return
* TRUE if the caption is shown if the frame theme is not enabled,
* FALSE if the caption is hidden if the frame theme is not enabled.
*/
BOOL GetShowCaptionAlways() const;
/**
* @brief
* Call this member function to get the size of the toolbar icon.
* @return
* The size of the toolbar icon.
* @see
* GetLargeIconSize
*/
virtual CSize GetIconSize() const;
/**
* @brief
* Call this method to get a pointer to the Quick Access button.
* @return
* A pointer to the Quick Access button.
*/
CXTPControl* GetControlQuickAccess() const;
/**
* @brief
* Call this method to determine if keyboard cues are visible.
* @return
* TRUE if keyboard cues are visible, otherwise FALSE.
*/
BOOL IsKeyboardCuesVisible() const;
/**
* @brief
* Resets the ribbon/Quick Access toolbar.
* @param bShowWarningMessage TRUE to show a warning message box to the user.
*/
void Reset(BOOL bShowWarningMessage);
/**
* @brief
* Determines if backstage view is visible.
* @return
* TRUE if backstage view is visible, otherwise FALSE.
*/
BOOL IsBackstageViewVisible() const;
/**
* @brief
* Call this method to set the icon ID that will be used if the user
* adds a new control to Quick Access without an icon.
* @param nIconId Icon to be associated with the new Quick Access control.
*/
void SetQuickAccessEmptyIconId(int nIconId);
/**
* @brief
* Call this method to allow the backstage view to process keyboard
* input if it is active.
* @param message Code of the Window message (like WM_KEYDOWN).
* @param wParam WPARAM of Window message.
* @param lParam LPARAM of Window message.
* @return True to allow backstage view, False otherwise
*/
BOOL PassKeyboardInputToBackstageView(UINT message, WPARAM wParam, LPARAM lParam);
protected:
/**
* @brief
* This virtual method is called when the current tab is about to be changed.
* @param pTab New tab to be selected.
* @return
* TRUE to cancel tab changing, FALSE to allow.
*/
virtual BOOL OnTabChanging(CXTPRibbonTab* pTab);
/**
* @brief
* This virtual method called when the current tab is changed.
* @param pTab New selected tab.
*/
virtual void OnTabChanged(CXTPRibbonTab* pTab);
/**
* @brief
* Calculates the ribbon groups height using the GetLargeIconSize method
* and the height of the captions.
* @param nClientHeight Client height for which the ribbon groups height
* is to be computed.
* @return
* The ribbon groups height.
* @see
* GetGroupsHeight
*/
virtual int CalcGroupsHeight(int nClientHeight);
/**
* @brief
* Creates a new pop-up toolbar object for a provided tab.
* @param pTab Pointer to the tab for which a new pop-up toolbar must be created.
* @return
* A pointer to the newly allocated pop-up toolbar object. The caller
* is responsible for releasing resources.
*/
virtual CXTPRibbonTabPopupToolBar* CreateTabPopupToolBar(CXTPRibbonTab* pTab);
/**
* @brief
* Determines whether a control is enabled.
* @param pControl Pointer to the control to check.
* @return
* TRUE if the control is enabled, otherwise FALSE.
*/
BOOL IsControlEnabled(const CXTPControl* pControl) const;
/** @cond */
protected:
/**
* @brief
* This method is called to assign self identifiers for the serialization process.
* @param nID Identifier to assign.
* @param pCommandBarList List of command bars.
* @param pParam Address of an XTP_COMMANDBARS_PROPEXCHANGE_PARAM structure.
*/
void GenerateCommandBarList(DWORD& nID, CXTPCommandBarList* pCommandBarList,
XTP_COMMANDBARS_PROPEXCHANGE_PARAM* pParam);
/**
* @brief
* This method is called in the serialization process to restore pop-ups
* from a list of command bars.
* @param pCommandBarList List of command bars.
*/
void RestoreCommandBarList(CXTPCommandBarList* pCommandBarList);
void DoPropExchange(CXTPPropExchange* pPX);
void Copy(CXTPCommandBar* pCommandBar, BOOL bRecursive = FALSE);
virtual CXTPPopupBar* CreateContextMenu(CXTPControl* pSelectedControl);
virtual CXTPPopupBar* CreateMoreQuickAccessContextMenu();
virtual BOOL ShouldSerializeBar();
virtual void MergeToolBar(CXTPCommandBar* pCommandBar, BOOL bSilent);
virtual void MergeToolBar(CXTPCommandBar* pCommandBar, BOOL bSilent,
int nDefaultConfirmationChoice);
int HitTestCaption(CPoint point) const;
void RepositionCaptionButtons();
void RepositionContextHeaders();
void AddCaptionButton(int nId, BOOL bAdd, BOOL bEnabled, CRect& rcCaption);
BOOL ShrinkContextHeaders(int nLeft, int nRight);
void ShowContextMenu(CPoint point, CXTPControl* pSelectedControl);
virtual void CreateKeyboardTips();
virtual void OnKeyboardTip(CXTPCommandBarKeyboardTip* pTip);
virtual void OnCustomizeDrop(CXTPControl* pDataObject, DROPEFFECT& dropEffect, CPoint ptDrop,
CPoint ptDrag);
void RefreshSysButtons();
virtual BOOL ProcessSpecialKey(XTPSpecialKey key);
protected:
public:
virtual CSize CalcDockingLayout(int nLength, DWORD dwMode, int nWidth = 0);
void Reposition(int cx, int cy);
void RepositionGroups(CDC* pDC, CRect rcGroups);
virtual BOOL PreviewAccel(UINT chAccel);
BOOL IsCaptionBarInBackstageMode() const;
void SetCaptionBarBackstageMode(BOOL bMode);
int GetBackstageModeMenuWidth() const;
void SetBackstageModeMenuWidth(int nWidth);
int GetBackstageSysButtonTop() const;
void SetBackstageSysButtonTop(int nTop);
int GetBackstageSysButtonBottom() const;
void SetBackstageSysButtonBottom(int nBottom);
/**
* @brief
* Call this member to change the tracking state.
* @param bMode TRUE to set the tracking mode, FALSE otherwise.
* @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);
int OnHookMessage(HWND /*hWnd*/, UINT nMessage, WPARAM& wParam, LPARAM& lParam,
LRESULT& /*lResult*/);
void OnRemoved();
void OnGroupsScroll(BOOL bScrollLeft);
int GetRibbonTopBorder() const;
void CustomizeFindDropIndex(CXTPControl* pDataObject, const CPoint& point, CRect& rcMarker,
int& nDropIndex, BOOL& bDropAfter);
/** @endcond */
protected:
/** @cond */
DECLARE_MESSAGE_MAP()
//{{AFX_VIRTUAL(CXTPRibbonBar)
//}}AFX_VIRTUAL
//{{AFX_MSG(CXTPRibbonBar)
afx_msg void OnMouseLeave();
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg INT_PTR OnToolHitTest(CPoint point, TOOLINFO* pTI) const;
afx_msg void OnSysColorChange();
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
void OnPopupRButtonUp(CXTPCommandBar* pCommandBar, CPoint point);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnCustomizePlaceQuickAccess(UINT nCommand);
afx_msg LRESULT OnCustomizeCommand(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnNcHitTest(CPoint point);
//}}AFX_MSG
/** @endcond */
protected:
# ifdef _XTP_COMMANDBARS_ACTIVEX
/** @cond */
afx_msg LPDISPATCH OleInsertTab(int nIndex, LPCTSTR lpszTitle);
afx_msg long OleGetItemCount();
afx_msg LPDISPATCH OleGetItem(int nIndex);
afx_msg LPDISPATCH OleAddSystemButton();
afx_msg LPDISPATCH OleGetSystemButton();
afx_msg void OleSetSelectedTab(LPDISPATCH lpTab);
afx_msg LPDISPATCH OleGetSelectedTab();
afx_msg void OleEnableFrameTheme();
afx_msg LPDISPATCH OleGetRibbonPaintManager();
afx_msg LPDISPATCH OleGetTabPaintManager();
afx_msg LPDISPATCH OleGetQuickAccessControls();
afx_msg LPDISPATCH OleFindGroup(int nID);
afx_msg LPDISPATCH OleFindTab(int nID);
virtual void OleEnableCustomization();
afx_msg LPDISPATCH OleGetControlQuickAccess();
afx_msg LPDISPATCH OleGetControlSystemButton();
afx_msg void OleSetRibbonMinimized(BOOL bNewValue);
afx_msg long OleGetGroupsHeight();
afx_msg void OleSetGroupsHeight(long nHeight);
afx_msg long OleGetClientHeight();
afx_msg void OleSetClientHeight(long nHeight);
DECLARE_DISPATCH_MAP()
DECLARE_OLETYPELIB_EX(CXTPRibbonBar);
DECLARE_INTERFACE_MAP()
DECLARE_ENUM_VARIANT(CXTPRibbonBar);
/** @endcond */
# endif
protected:
CRect m_rcTabControl; /**< Bounding rectangle of tabs. */
CRect m_rcGroups; /**< Groups bounding rectangle. */
CRect m_rcCaption; /**< Caption bounding rectangle. */
CRect m_rcCaptionText; /**< Caption text bounding rectangle. */
CRect m_rcHeader; /**< Header bounding rectangle. */
CRect m_rcQuickAccess; /**< Quick Access bounding rectangle. */
BOOL m_bRibbonBarVisible; /**< TRUE if the ribbon bar is visible. */
BOOL m_bGroupsVisible; /**< TRUE if groups is visible. */
BOOL m_bTabsVisible; /**< TRUE if tabs are visible. */
BOOL m_bShowQuickAccessBelow; /**< TRUE to show Quick Access controls below the ribbon bar. */
BOOL m_bShowQuickAccess; /**< TRUE to show Quick Access. */
BOOL m_bAllowQuickAccessDuplicates; /**< TRUE to allow Quick Access duplicates. */
BOOL m_bAllowQuickAccessCustomization; /**< TRUE to allow Quick Access customization. */
BOOL m_bGroupReducedChanged; /**< Some group appear in resize handler. */
int m_nQuickAccessHeight; /**< Quick Access height. */
BOOL m_bAllowMinimize; /**< TRUE to allow minimize ribbon. */
CXTPRibbonQuickAccessControls* m_pQuickAccessControls; /**< Quick Access controls (not used
now). */
CXTPRibbonControlTab* m_pControlTab; /**< Control tab pointer. */
CXTPControl* m_pControlQuickAccess; /**< Quick Access menu control. */
CXTPControl* m_pControlQuickAccessMore; /**< Quick Access more control. */
CXTPRibbonControlSystemButton* m_pControlSystemButton; /**< System button control. */
BOOL m_bMinimizeOnDblClick; /**< TRUE to allow the ribbon to be minimized/maximized when double
clicked. */
int m_nMinVisibleWidth; /**< Minimum width before ribbon bar disappears. */
int m_nMinVisibleHeight; /**< Minimum height before ribbon bar disappears. */
CXTPRibbonTabContextHeaders* m_pContextHeaders; /**< Context header collection. */
int m_nCustomGroupsHeight; /**< Custom groups height. */
int m_nCustomClientHeight; /**< Custom client height. */
BOOL m_bMinimized; /**< TRUE if the Ribbon is currently minimized. */
BOOL m_bShowCaptionAlways; /**< TRUE to show caption even if EnableFrameTheme was not called. */
CString m_strCaptionText; /**< Caption text. */
const int m_nQuickAccessHeightDiff;
int m_nQuickAccessEmptyIconId;
BOOL m_bIsCaptionBarInBackstageMode; /**< Is backstage active. */
int m_nBackstageMenuWidth; /**< The width of the panel with commands and tabs in the backstage.
*/
int m_nBackstageSysButtonTop; /**< The top of the sysbutton on the backstage. */
int m_nBackstageSysButtonBottom; /**< The buttom of the sysbutton on the backstage. */
private:
friend class CXTPRibbonControlTab;
friend class CXTPRibbonBarControlQuickAccessPopup;
friend class CControlQuickAccessMorePopup;
friend class CXTPRibbonGroup;
friend class CXTPRibbonControls;
friend class CXTPRibbonGroups;
friend class CXTPRibbonTabPopupToolBar;
};
AFX_INLINE CRect CXTPRibbonBar::GetTabControlRect() const
{
return m_rcTabControl;
}
AFX_INLINE CXTPRibbonGroup* CXTPRibbonBar::GetHighlightedGroup() const
{
return m_pHighlightedGroup;
}
/** @cond */
AFX_INLINE CXTPRibbonGroup* CXTPRibbonScrollableBar::GetHighlightedGroup() const
{
return m_pHighlightedGroup;
}
/** @endcond */
AFX_INLINE CXTPRibbonControlTab* CXTPRibbonBar::GetControlTab() const
{
return m_pControlTab;
}
AFX_INLINE void CXTPRibbonBar::SetMinimumVisibleWidth(int nMinVisibleWidth)
{
m_nMinVisibleWidth = nMinVisibleWidth;
}
AFX_INLINE void CXTPRibbonBar::SetMinimumVisibleSize(int nMinVisibleWidth, int nMinVisibleHeight)
{
m_nMinVisibleWidth = nMinVisibleWidth;
m_nMinVisibleHeight = nMinVisibleHeight;
}
AFX_INLINE int CXTPRibbonBar::GetMinimumVisibleWidth() const
{
return m_nMinVisibleWidth;
}
AFX_INLINE CRect CXTPRibbonBar::GetCaptionRect() const
{
return m_rcCaption;
}
AFX_INLINE CRect CXTPRibbonBar::GetCaptionTextRect() const
{
return m_rcCaptionText;
}
AFX_INLINE CRect CXTPRibbonBar::GetQuickAccessRect() const
{
return m_rcQuickAccess;
}
AFX_INLINE CXTPRibbonQuickAccessControls* CXTPRibbonBar::GetQuickAccessControls() const
{
return m_pQuickAccessControls;
}
AFX_INLINE CXTPRibbonControlSystemButton* CXTPRibbonBar::GetSystemButton() const
{
return m_pControlSystemButton;
}
AFX_INLINE BOOL CXTPRibbonBar::IsRibbonBarVisible() const
{
return m_bVisible && m_bRibbonBarVisible;
}
AFX_INLINE CXTPRibbonTabContextHeaders* CXTPRibbonBar::GetContextHeaders() const
{
return m_pContextHeaders;
}
AFX_INLINE BOOL CXTPRibbonBar::IsRibbonBar() const
{
return TRUE;
}
AFX_INLINE void CXTPRibbonBar::ShowQuickAccess(BOOL bShow)
{
m_bShowQuickAccess = bShow;
OnRecalcLayout();
}
AFX_INLINE BOOL CXTPRibbonBar::IsQuickAccessVisible() const
{
return m_bShowQuickAccess;
}
AFX_INLINE void CXTPRibbonBar::AllowQuickAccessDuplicates(BOOL bAllow)
{
m_bAllowQuickAccessDuplicates = bAllow;
}
AFX_INLINE void CXTPRibbonBar::AllowQuickAccessCustomization(BOOL bAllow)
{
m_bAllowQuickAccessCustomization = bAllow;
}
AFX_INLINE BOOL CXTPRibbonBar::IsAllowQuickAccessDuplicates() const
{
return m_bAllowQuickAccessDuplicates;
}
AFX_INLINE void CXTPRibbonBar::SetGroupsHeight(int nHeight)
{
m_nCustomGroupsHeight = nHeight;
}
AFX_INLINE void CXTPRibbonBar::AllowMinimize(BOOL bAllow)
{
m_bAllowMinimize = bAllow;
}
AFX_INLINE CRect CXTPRibbonBar::GetGroupsRect() const
{
return m_rcGroups;
}
AFX_INLINE void CXTPRibbonBar::ShowCaptionAlways(BOOL bShowCaption)
{
m_bShowCaptionAlways = bShowCaption;
}
AFX_INLINE BOOL CXTPRibbonBar::GetShowCaptionAlways() const
{
return m_bShowCaptionAlways;
}
AFX_INLINE CXTPControl* CXTPRibbonBar::GetControlQuickAccess() const
{
return m_pControlQuickAccess;
}
AFX_INLINE void CXTPRibbonBar::SetQuickAccessEmptyIconId(int nIconId)
{
m_nQuickAccessEmptyIconId = nIconId;
}
/** @cond */
AFX_INLINE BOOL CXTPRibbonBar::IsCaptionBarInBackstageMode() const
{
return m_bIsCaptionBarInBackstageMode;
}
AFX_INLINE void CXTPRibbonBar::SetCaptionBarBackstageMode(BOOL bMode)
{
m_bIsCaptionBarInBackstageMode = bMode;
}
AFX_INLINE int CXTPRibbonBar::GetBackstageModeMenuWidth() const
{
return m_nBackstageMenuWidth;
}
AFX_INLINE void CXTPRibbonBar::SetBackstageModeMenuWidth(int nWidth)
{
m_nBackstageMenuWidth = nWidth;
}
AFX_INLINE int CXTPRibbonBar::GetBackstageSysButtonTop() const
{
return m_nBackstageSysButtonTop;
}
AFX_INLINE void CXTPRibbonBar::SetBackstageSysButtonTop(int nTop)
{
m_nBackstageSysButtonTop = nTop;
}
AFX_INLINE int CXTPRibbonBar::GetBackstageSysButtonBottom() const
{
return m_nBackstageSysButtonBottom;
}
AFX_INLINE void CXTPRibbonBar::SetBackstageSysButtonBottom(int nBottom)
{
m_nBackstageSysButtonBottom = nBottom;
}
/** @endcond */
# include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h"
/** @cond */
#endif // !defined(__XTPRIBBONBAR_H__)
/** @endcond */