/** * @file XTPRibbonSystemButton.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(__XTPRIBBONSYSTEMBUTTON_H__) # define __XTPRIBBONSYSTEMBUTTON_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" /** * @brief * CXTPRibbonControlSystemButton is a CXTPControlPopup derived class used * as a system button for a Ribbon Bar. */ class _XTP_EXT_CLASS CXTPRibbonControlSystemButton : public CXTPControlPopup { /** @cond */ DECLARE_XTP_CONTROL(CXTPRibbonControlSystemButton) /** @endcond */ public: /** * @brief * Constructs a CXTPRibbonControlSystemButton object. */ CXTPRibbonControlSystemButton(); public: /** * @brief * This method is called to draw the control. * @param pDC Pointer to a valid device context. */ void Draw(CDC* pDC); /** * @brief * This method is called to determine if this system button is a * normal button or the Office 2007 style system button. * @return * TRUE if this system button is a normal button, * FALSE if this system button is an Office 2007 style system button. */ BOOL IsSimpleButton() const; /** * @brief * This method is called to determine the size of the control. * @param pDC Pointer to a valid device context. * @return * The size of the control. */ virtual CSize GetSize(CDC* pDC); /** * @brief * Call this member to get the caption of the control. * @return * The caption of the control. */ virtual CString GetCaption() const; protected: /** * @brief * This member is called when the user double-clicks the left mouse button. * @param point Specifies the x- and y- coordinates of the cursor. * @return * TRUE if successful, otherwise FALSE. */ virtual BOOL OnLButtonDblClk(CPoint point); /** * @brief * Updates rectangle to set the position where a child pop-up bar * becomes visible. * @param rc CRect object specifying size of area. * @param bVertical TRUE if vertical, FALSE otherwise. */ void AdjustExcludeRect(CRect& rc, BOOL bVertical); # ifdef _XTP_COMMANDBARS_ACTIVEX /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPRibbonControlSystemButton); /** @endcond */ # endif protected: BOOL m_bCloseOnDblClick; friend class CXTPRibbonBackstageView; friend class CXTPRibbonBar; }; /** * @brief * CXTPRibbonControlSystemPopupBarButton is a CXTPControlButton derived * class used in a system pop-up bar for bottom option buttons. */ class _XTP_EXT_CLASS CXTPRibbonControlSystemPopupBarButton : public CXTPControlButton { /** @cond */ DECLARE_XTP_CONTROL(CXTPRibbonControlSystemPopupBarButton) /** @endcond */ public: /** * @brief * Constructs a CXTPRibbonControlSystemPopupBarButton object. */ CXTPRibbonControlSystemPopupBarButton(); /** * @brief * This method is called to determine the size of the control. * @param pDC Pointer to a valid device context. * @return * The size of the control. */ virtual CSize GetSize(CDC* pDC); /** * @brief * This method is called to draw the control. * @param pDC Pointer to a valid device context. */ virtual void Draw(CDC* pDC); /** * @brief * Determines if the control needs to draw its background. * @return * TRUE if the paint manager must skip filling the background of the control. */ BOOL IsTransparent() const; /** * @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 toolbar icon. * @return * The size of the toolbar icon. * @see * GetButtonSize */ virtual CSize GetIconSize() const; private: BOOL IsSystemPopupButton() const; }; /** * @brief * CXTPRibbonSystemPopupBar is a CXTPPopupBar derived class used * as a system pop-up bar for a Ribbon Bar. */ class _XTP_EXT_CLASS CXTPRibbonSystemPopupBar : public CXTPPopupBar { /** @cond */ DECLARE_XTP_COMMANDBAR(CXTPRibbonSystemPopupBar) /** @endcond */ public: /** * @brief * Constructs a CXTPRibbonSystemPopupBar object. */ CXTPRibbonSystemPopupBar(); public: /** * @brief * This method is called to get the border margins of the command bar. * @return * A CRect object containing the border margins of the command bar. */ virtual CRect GetBorders(); /** * @brief * This method is called to draw the background of the command bar. * @param pDC Pointer to the device context to draw. * @see * DrawCommandBar */ virtual void FillCommandBarEntry(CDC* pDC); /** * @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 dwMode. * @param dwMode See CControlBar::CalcDynamicLayout for the list of * supported flags. * @return * The size of the command bar. */ virtual CSize CalcDynamicLayout(int nLength, DWORD dwMode); protected: /** @cond */ DECLARE_MESSAGE_MAP() afx_msg LRESULT OnNcHitTest(CPoint point); /** @endcond */ }; /** * @brief * CXTPRibbonSystemPopupBarPage is a CXTPPopupBar derived class used * as a system pop-up bar page of a Ribbon Bar. */ class _XTP_EXT_CLASS CXTPRibbonSystemPopupBarPage : public CXTPPopupBar { /** @cond */ DECLARE_XTP_COMMANDBAR(CXTPRibbonSystemPopupBarPage) /** @endcond */ public: /** * @brief * Constructs a CXTPRibbonSystemPopupBarPage object. */ CXTPRibbonSystemPopupBarPage(); protected: /** * @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 dwMode. * @param dwMode See CControlBar::CalcDynamicLayout for the list of * supported flags. * @return * The size of the command bar. */ virtual CSize CalcDynamicLayout(int nLength, DWORD dwMode); /** * @brief * Updates rectangle to set the position where the pop-up bar becomes visible. * @param rc CRect object specifying the size of the area. * @param bVertical TRUE if vertical, FALSE otherwise. */ virtual void AdjustExcludeRect(CRect& rc, BOOL bVertical); }; /** * @brief * CXTPRibbonControlSystemPopupBarListCaption is a CXTPControl derived class * used in a Ribbon system pop-up to draw captions of enumerable controls. */ class _XTP_EXT_CLASS CXTPRibbonControlSystemPopupBarListCaption : public CXTPControl { /** @cond */ DECLARE_XTP_CONTROL(CXTPRibbonControlSystemPopupBarListCaption) /** @endcond */ public: /** * @brief * Constructs a CXTPRibbonControlSystemPopupBarListCaption object. */ CXTPRibbonControlSystemPopupBarListCaption(); protected: /** * @brief * This method is called to determine the size of the control. * @param pDC Pointer to a valid device context. * @return * The size of the control. */ virtual CSize GetSize(CDC* pDC); /** * @brief * This method is called to draw the control. * @param pDC Pointer to a valid device context. */ virtual void Draw(CDC* pDC); }; /** * @brief * CXTPRibbonControlSystemPopupBarListItem is a CXTPControlButton derived class * used in a Ribbon system pop-up to draw buttons of enumerable controls. */ class _XTP_EXT_CLASS CXTPRibbonControlSystemPopupBarListItem : public CXTPControlButton { /** @cond */ DECLARE_XTP_CONTROL(CXTPRibbonControlSystemPopupBarListItem) /** @endcond */ public: /** * @brief * Constructs a CXTPRibbonControlSystemPopupBarListItem object. */ CXTPRibbonControlSystemPopupBarListItem(); /** * @brief * This method is called to determine the size of the control. * @param pDC Pointer to a valid device context. * @return * The size of the control. */ virtual CSize GetSize(CDC* pDC); /** * @brief * This method is called to draw the control. * @param pDC Pointer to a valid device context. */ virtual void Draw(CDC* pDC); protected: BOOL m_bAlignShortcut; /**< Alignment of the shortcut in the list. */ }; /** * @brief * CXTPRibbonControlSystemPopupBarPinableListItem is a * CXTPRibbonControlSystemPopupBarListItem derived class used in a * Ribbon system pop-up to draw recent file list items. */ class _XTP_EXT_CLASS CXTPRibbonControlSystemPopupBarPinableListItem : public CXTPRibbonControlSystemPopupBarListItem { /** @cond */ DECLARE_XTP_CONTROL(CXTPRibbonControlSystemPopupBarPinableListItem) /** @endcond */ public: /** * @brief * Constructs a CXTPRibbonControlSystemPopupBarListItem object. */ CXTPRibbonControlSystemPopupBarPinableListItem(); /** * @brief * Destroys a CXTPRibbonControlSystemPopupBarPinableListItem object, * handles cleanup and deallocation. */ ~CXTPRibbonControlSystemPopupBarPinableListItem(); protected: /** * @brief * This method is called to draw the control. * @param pDC Pointer to a valid device context. */ virtual void Draw(CDC* pDC); /** * @brief * This member is called when the mouse cursor moves. * @param point Specifies the x- and y-coordinate of the cursor. */ virtual void OnMouseMove(CPoint point); /** * @brief * This member is called when the user releases the left mouse button. * @param point Specifies the x- and y-coordinate of the cursor. */ virtual void OnLButtonUp(CPoint point); /** * @brief * This method is called when the MRU item becomes selected. * @param bSelected TRUE if the MRU item becomes selected. * @return * TRUE if successful, otherwise FALSE. */ virtual BOOL OnSetSelected(int bSelected); protected: CXTPImageManager* m_pIcons; /**< Icons used for the MRU item. */ }; /** * @brief * CXTPRibbonControlSystemRecentFileList is a * CXTPRibbonControlSystemPopupBarListCaption derived class used in a * Ribbon system pop-up to draw recent file list controls. */ class _XTP_EXT_CLASS CXTPRibbonControlSystemRecentFileList : public CXTPRibbonControlSystemPopupBarListCaption { class CControlFileItem; class CControlPinableFileItem; public: /** * @brief * Constructs a CXTPRibbonControlSystemRecentFileList object. */ CXTPRibbonControlSystemRecentFileList(); protected: /** * @brief * This method is called before recalculating the parent command bar * size to calculate the dimensions of the control. * @param dwMode Flags used to determine the height and width of the * dynamic command bar. See Remarks section for a list of * values. * @details * The following predefined flags are used to determine the height and * width of the dynamic command bar. Use the bitwise-OR (|) operator to * combine the flags.
* * LM_STRETCH: Indicates whether the command bar should be * stretched to the size of the frame. Set if the bar is * not a docking bar (not available for docking). Not set * when the bar is docked or floating (available for * docking). If set, LM_STRETCH returns dimensions based * on LM_HORZ state. LM_STRETCH works similarly to * the bStretch parameter used in CalcFixedLayout; * see that member function for more information about * the relationship between stretching and orientation. * LM_HORZ: Indicates that the bar is horizontally or * vertically oriented. Set if the bar is horizontally * oriented, and if it is vertically oriented, it is not * set. LM_HORZ works similarly to the the bHorz * parameter used in CalcFixedLayout; see that member * function for more information about the relationship * between stretching and orientation. * LM_MRUWIDTH: Most Recently Used Dynamic Width. Uses the * remembered most recently used width. * LM_HORZDOCK: Horizontal Docked Dimensions. Returns the * dynamic size with the largest width. * LM_VERTDOCK: Vertical Docked Dimensions. Returns the dynamic * size with the largest height. * LM_COMMIT: Resets LM_MRUWIDTH to the current width of the * floating command bar. */ virtual void OnCalcDynamicSize(DWORD dwMode); /** * @brief * The implementation may implement a custom drag over handling logic in this method. * @param pCommandBar Pointer to a CXTPCommandBar object. * @param point Mouse position. * @param dropEffect DROPEFFECT enumerator. * @return * TRUE if custom implementation handles drag over, otherwise FALSE. */ virtual BOOL DoCustomDragOver(CXTPCommandBar* pCommandBar, CPoint point, DROPEFFECT& dropEffect); protected: /** * @brief * Retrieves a pointer to the recent file list collection. * @return * A pointer to the recent file list collection. */ virtual CRecentFileList* GetRecentFileList(); /** * @brief * Retrieves ID_FILE_MRU_FILE1. * @return * ID_FILE_MRU_FILE1. */ virtual int GetFirstMruID(); private: CString ConstructCaption(const CString& lpszTitle, int nIndex); private: DECLARE_XTP_CONTROL(CXTPRibbonControlSystemRecentFileList) }; # define CXTPPinableRecentFileList CXTPRecentFileList # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // !defined(__XTPRIBBONSYSTEMBUTTON_H__) /** @endcond */