/** * @file XTPCommandBarsResourceTheme.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(__XTPRESOURCETHEME_H__) # define __XTPRESOURCETHEME_H__ /** @endcond */ # if _MSC_VER >= 1000 # pragma once # endif // _MSC_VER >= 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPResourceImage; class CXTPResourceImages; class CXTPCommandBarsFrameHook; class CXTPMarkupContext; /** * @brief * The CXTPResourceTheme class is used to enable a * resource style theme for Command Bars. * @see * CXTPPaintManager::SetTheme */ class _XTP_EXT_CLASS CXTPResourceTheme : public CXTPCommandBarsOffice2003Theme { /** @cond */ DECLARE_DYNAMIC(CXTPResourceTheme) /** @endcond */ public: /** * @brief * Constructs a CXTPResourceTheme object. */ CXTPResourceTheme(); /** * @brief * Destroys a CXTPResourceTheme object, handles cleanup and deallocation. */ virtual ~CXTPResourceTheme(); public: /** * @brief * Loads a bitmap image from the specified path. * @param lpszFileName The name of the file that contains the bitmaps * to load. * @details * The images are the bitmaps that represent all the visual components * of the Ribbon Bar. For example tab buttons, group buttons, menu buttons, * toolbar buttons, option button, toolbar dropdown, etc. * The images are loaded using LoadImage and are stored in the m_pImages * image collection. * Images for the Office 2007 theme can be found in the /Source/Ribbon/Res * folder. * @return * New CXTPResourceImage containing the loaded bitmap. * @see * SetImageHandle, m_pImages */ CXTPResourceImage* LoadImage(LPCTSTR lpszFileName); /** * @brief * Specifies the resource that contains the bitmaps to be loaded for the * theme. This allows images to be loaded from something other than bitmap files. * @param hResource Handle to a visual style dll file handle. Or * some other resource that contains the images * to load for the theme. * @param lpszIniFileName String identifier of ini file with color specifications. * @details * The images are the bitmaps that represent all the visual components * of the Ribbon Bar. For example tab buttons, group buttons, menu buttons, * toolbar buttons, option button, toolbar dropdown, etc. * The images are loaded using LoadImage and are stored in the m_pImages * image collection. * Images for the Office 2007 theme can be found in the /Source/Ribbon/Res * folder. * * Example: *
((CXTPResourceTheme*)XTPPaintManager())->SetImageHandle(XTPSkinManager()->GetResourceFile()->GetModuleHandle());
* @see * LoadImage, m_pImages */ void SetImageHandle(HMODULE hResource, LPCTSTR lpszIniFileName); virtual BOOL RequiresResourceImages(); protected: /** * @brief * This method is called to refresh the visual metrics of the manager. */ virtual void RefreshMetrics(); /** * @brief * Retrieves the base theme of the manager. * @return * Returns the base theme. */ virtual XTPPaintTheme BaseTheme() { return xtpThemeResource; } public: /** * @brief * This method is called to get the CXTPResourceImages pointer. * @return * Pointer to the image collection of the class. */ CXTPResourceImages* GetImages() const; /** * @brief * Call this method to set images for the theme. * @param pImages new CXTPResourceImages to be set. * @see * GetImages */ void SetImages(CXTPResourceImages* pImages); /** * @brief * This method retrieves a button's text color. * @param bSelected TRUE if the control is selected. * @param bPressed TRUE if the control is pushed. * @param bChecked TRUE if the control is checked. * @param bEnabled TRUE if the control is enabled. * @param bPopuped TRUE if the control is pop-up'ed. * @param barType Parent's bar type. * @param barPosition Parent's bar position. * @return * Button's text color. */ virtual COLORREF GetRectangleTextColor(BOOL bSelected, BOOL bPressed, BOOL bEnabled, BOOL bChecked, BOOL bPopuped, XTPBarType barType, XTPBarPosition barPosition); /** * @brief * Draws workspace space. * @param pDC Pointer to device context. * @param rc Bounding rectangle. * @param rcExclude Excluded rectangle. */ virtual void FillWorkspace(CDC* pDC, CRect rc, CRect rcExclude); /** * @brief * Returns the paint manager used to draw frames. * @return * Paint manager used to draw frames. */ virtual CXTPFramePaintManager* GetFramePaintManager(); /** * @brief * Retrieves the ribbon paint manager. * @return * A pointer to a CXTPRibbonPaintManager object. */ virtual CXTPRibbonPaintManager* GetRibbonPaintManager(); protected: /** * @brief * Determines if images are available. * @return * TRUE if images exist in the application, FALSE otherwise. */ BOOL IsImagesAvailable(); protected: int m_nRibbonCaptionHeight; /**< Ribbon caption height */ protected: /** @cond */ CXTPResourceImages* m_pImages; COLORREF m_clrMenuBarText; COLORREF m_clrStatusBarShadow; CXTPPaintManagerColorGradient m_clrStatusBarTop; CXTPPaintManagerColorGradient m_clrStatusBarBottom; COLORREF m_clrWorkspaceClientTop; COLORREF m_clrWorkspaceClientMiddle; COLORREF m_clrWorkspaceClientBottom; int m_nMessageBarHeight; CSize m_szMessageBarDefaultButtonSize; CXTPPaintManagerColorGradient m_clrMessageBar; COLORREF m_clrMessageBarFrame; COLORREF m_clrMessageBarFace; /** @endcond */ friend class CXTPStatusBarThemeResource; friend class CXTPMessageBarThemeResource; }; AFX_INLINE BOOL CXTPResourceTheme::RequiresResourceImages() { return TRUE; } // Obsolete class # define CXTPOffice2007Theme CXTPResourceTheme /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif // #if !defined(__XTPRESOURCETHEME_H__) /** @endcond */