/** * @file XTPGlobal.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(__XTGLOBALS_H__) # define __XTGLOBALS_H__ /** @endcond */ # if _MSC_VER >= 1000 # pragma once # endif // _MSC_VER >= 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" /** * @brief * The CXTPTcbItem class is used to maintain information for a particular * tab item in a CXTPExcelTabCtrl, CXTPTabCtrl, or CXTPTabView object. * @see * CXTPExcelTabCtrl, CXTPTabCtrl and CXTPTabView */ class _XTP_EXT_CLASS CXTPTcbItem { public: /** * @brief * Constructs a CXTPTcbItem object. */ CXTPTcbItem(); UINT uiToolTipId; /**< Resource ID for the tooltip. */ CWnd* pWnd; /**< A CWnd pointer to the window associated with a tab. */ CString szTabLabel; /**< User specified label for the tab. */ CString szToolTipLabel; /**< Tooltip text for the tab. */ CString szCondensedLabel; /**< The label actually being displayed for auto-condensing tabs. */ DWORD dwStyle; /**< Stores the window style when the tab item was created. */ DWORD dwExStyle; /**< Stores the extended window style when the tab item was created. */ COLORREF crTabBack; /**< Application defined tab background color. */ COLORREF crTabText; /**< Application defined tab text color. */ COLORREF crTabSelBack; /**< Application defined selected tab background color. */ COLORREF crTabSelText; /**< Application defined selected tab text color. */ }; /** * @brief * CXTPLogFont is a self initializing LOGFONT derived class. It * will allow you to create or copy a LOGFONT object, and defines the * attributes of a font. */ class _XTP_EXT_CLASS CXTPLogFont : public LOGFONT { public: /** * @brief * Constructs a CXTPLogFont object. */ CXTPLogFont(); /** * @brief * Constructs a CXTPLogFont object. * @param rhs The CXTPLogFont object to copy from. */ CXTPLogFont(const CXTPLogFont& rhs); /** * @brief * Constructs a CXTPLogFont object. * @param logFont The LOGFONT structure to initialize the class object with. */ CXTPLogFont(const LOGFONT& logFont); public: /** * @brief * Assigns the specified value. * @return * A reference to itself. * @param rhs The CXTPLogFont object to copy from. */ CXTPLogFont& operator=(const CXTPLogFont& rhs); /** * @brief * Assigns the specified value. * @return * A reference to itself. * @param logFont The LOGFONT structure to copy from. */ CXTPLogFont& operator=(const LOGFONT& logFont); public: DWORD dwType; /**< Used to hold the font type, i.e. TT_FONT, DEVICE_FONT. */ }; /** @cond */ AFX_INLINE CXTPLogFont::CXTPLogFont() { memset(this, 0, sizeof(*this)); } AFX_INLINE CXTPLogFont::CXTPLogFont(const CXTPLogFont& rhs) { *this = rhs; } AFX_INLINE CXTPLogFont::CXTPLogFont(const LOGFONT& logFont) { *this = logFont; } AFX_INLINE CXTPLogFont& CXTPLogFont::operator=(const CXTPLogFont& rhs) { memcpy(this, &rhs, sizeof(*this)); return *this; } AFX_INLINE CXTPLogFont& CXTPLogFont::operator=(const LOGFONT& logFont) { memcpy(static_cast(this), &logFont, sizeof(logFont)); return *this; } /** @endcond */ class CXTPAuxData; /** * @brief * The XTPAuxData function is used for access to the * CXTPAuxData class. * @details * Call this function to access CXTPAuxData members. Since * this class is designed as a single instance object, you can only * access its members through this method. You cannot directly * instantiate an object of type CXTPAuxData. * @return * A pointer to the one and only CXTPAuxData instance. * Example: * The following example demonstrates the use of XTPAuxData: *
 * bool bIsWinNT = XTPAuxData().bWinNT;
 * 
* @see * CXTPAuxData */ _XTP_EXT_CLASS CXTPAuxData& AFXAPI XTPAuxData(); /** * @brief * CXTPAuxData is a standalone global item data structure * class. It is used by the toolkit to initialize and store resource * and item data shared by all objects. Items include system colors, * icons, fonts, and OS flags. */ class _XTP_EXT_CLASS CXTPAuxData { friend class CXTPSingleton; private: /** * @brief * Constructs an CXTPAuxData object. */ CXTPAuxData(); public: /** * @brief * Destroys an CXTPAuxData object, handles cleanup and deallocation. */ virtual ~CXTPAuxData(); public: /** * @brief * Initializes the cursors used by the library. * @return * TRUE if successful, otherwise FALSE. */ BOOL LoadSysCursors(); /** * @brief * Initializes the fonts used by the library. * @param lpszHorzFaceName [in] Pointer to a NULL-terminated font name that is used * to create the horizontal fonts used by the library. * @param lpszVertFaceName [in] Pointer to a NULL-terminated font name that is used * to create the vertical fonts used by the library. * @details * Call this member function to update all of the fonts used by the library. * @return * TRUE if successful, otherwise FALSE if a font fails to load. */ BOOL LoadSysFonts(LPCTSTR lpszHorzFaceName = NULL, LPCTSTR lpszVertFaceName = NULL); /** * @brief * This member function frees font resources. */ void FreeSysFonts(); /** * @brief * This member function updates system colors used by the library. */ void UpdateSysColors(); /** * @brief * This member function updates system metrics used by the library. */ void UpdateSysMetrics(); /** * @brief * This member function is called to retrieve the version information * for the common control .dll (comctl32.dll). * @return * A DWORD value. */ DWORD GetComCtlVersion(); /** * @brief * This member function is called to check the current version of * the common control .dll (comctl32.dll). * @return * TRUE if the version is 4.72 or higher, otherwise FALSE. */ BOOL IsComCtlValid() const; /** * @brief * This member function is called by the library to initialize resources. * @param hInst Instance handle for resources. */ void InitResources(HINSTANCE hInst); /** * @brief * Enables/disables Tahoma font usage for the library. * @param bOfficeFont [in] True to use the "Tahoma" font if found on the * operating system. * @details * Call this member function to use the Office font (Tahoma) if it * exists on the operating system. */ void UseOfficeFont(BOOL bOfficeFont); /** * @brief * Determines if a font is installed. * @param lpszFaceName [in] A NULL-terminated string that represents the font * name to search for. * @details * Call this member function to determine if the font specified by * strFaceName has been installed on the operating system. * @return * TRUE if the font is installed, otherwise FALSE. */ BOOL FontExists(LPCTSTR lpszFaceName); /** * @brief * Initializes the fonts used by the library. * @param lf [in] Reference to a CXTPLogFont or LOGFONT structure. * @param font [in] Reference to a CFont object. * @param lfWeight [in] Optional; specifies font weight. * @param lfUnderline [in] Optional; specifies font underline. * @param lfOrientation [in] Optional; specifies font orientation. * @param lfEscapement [in] Optional; specifies font escapement. * @details * Call this member function to create a CFont object from an * existing CXTPLogFont or LOGFONT structure. You can specify * additional values to set that will override what is specified * in the LOGFONT structure passed in. * @return * TRUE if the font was successfully created, otherwise FALSE. */ BOOL CreateSysFont(const CXTPLogFont& lf, CFont& font, long lfWeight = -1, char lfUnderline = -1, long lfOrientation = -1, long lfEscapement = -1); /** * @brief * Initializes the fonts used by the library. * @param lf [in] Reference to a CXTPLogFont or LOGFONT structure. * @param font [in] Reference to a CFont object. * @param lfWeight [in] Optional; specifies font weight. * @param lfUnderline [in] Optional; specifies font underline. * @param lfOrientation [in] Optional; specifies font orientation. * @param lfEscapement [in] Optional; specifies font escapement. * @details * Call this member function to create a CFont object from an * existing CXTPLogFont or LOGFONT structure. You can specify * additional values to set that will override what is specified * in the LOGFONT structure passed in. * @return * TRUE if the font was successfully created, otherwise FALSE. */ BOOL CreateSysFont(const CXTPLogFont& lf, CXTPFont& font, long lfWeight = -1, char lfUnderline = -1, long lfOrientation = -1, long lfEscapement = -1); /** * @brief * Initializes the fonts used by the library. * @param pHorzFont [in] A pointer to a valid CFont object that is used to * define the fonts that the library will use. * @param pVertFont [in] A pointer to a valid CFont object that is used to * define the vertical fonts used by the library. If NULL, * then 'pFont' will be used. * @details * Call this member function to update the fonts used by the library. * This function will not update the fonts used for Icon Title, * Marlett Icon or Small Captions. To change these fonts as well, use * the CreateSysFont method. * @return * TRUE if successful, otherwise returns FALSE if a font fails to load. */ BOOL SetGlobalFont(CFont* pHorzFont, CFont* pVertFont = NULL); /** * @brief * Initializes the fonts used by the library. * @param lpszFaceName [in] A pointer to a NULL-terminated font name that is * used to create the horizontal fonts used by the library. * @param lpszVertFaceName [in] A pointer to a NULL-terminated font name that is * used to create the vertical fonts used by the library. * @details * Call this member function to update the fonts used by the library. * This function will not update the fonts used for Icon Title, * Marlett Icon or Small Captions. To change these fonts as well, use * the CreateSysFont method. * @return * TRUE if successful, otherwise returns FALSE if a font fails to load. */ BOOL SetGlobalFont(LPCTSTR lpszFaceName, LPCTSTR lpszVertFaceName = NULL); /** * @brief * Retrieves the library version. * @param bVerNumOnly [in] true to return the version number only * (excluding "Xtreme Toolkit v"). * @details * Call this member function to retrieve a CString object that * represents the current version of the Xtreme Toolkit. The string * returned is formatted like so: "Xtreme Toolkit v1.94". * @return * A NULL-terminated string that indicates the version of the Xtreme * Toolkit. */ CString XTPGetVersion(bool bVerNumOnly = false); private: /** @cond */ static int CALLBACK EnumFontFamExProc(ENUMLOGFONTEX* pelf, NEWTEXTMETRICEX*, int, LPVOID pThis); DISABLE_COPY_OPERATOR(CXTPAuxData) /** @endcond */ public: //======================================================================= //## (RGB) System colors used by Xtreme Toolkit //======================================================================= COLORREF clr3DFace; /**< An RGB value that represents the face color for three dimensional display elements. */ COLORREF clr3DShadow; /**< An RGB value that represents the shadow color for three dimensional display elements. */ COLORREF clr3DDkShadow; /**< An RGB value that represents the dark shadow for three dimensional display elements. */ COLORREF clr3DHilight; /**< An RGB value that represents the highlight color for three dimensional display elements. */ COLORREF clr3DLight; /**< An RGB value that represents the light color for three dimensional display elements. */ COLORREF clrBtnText; /**< An RGB value that represents the text color on push buttons. */ COLORREF clrGrayText; /**< An RGB value that represents the grayed (disabled) text. */ COLORREF clrHighlight; /**< An RGB value that represents the item(s) selected in a control. */ COLORREF clrHighlightText; /**< An RGB value that represents the text color of item(s) selected in a control. */ COLORREF clrMenu; /**< An RGB value that represents the menu background. */ COLORREF clrMenuText; /**< An RGB value that represents the text color in menus. */ COLORREF clrWindow; /**< An RGB value that represents the window background. */ COLORREF clrWindowFrame; /**< An RGB value that represents the window frame. */ COLORREF clrWindowText; /**< An RGB value that represents the text color in windows. */ COLORREF clrActiveCaption; /**< An RGB value that represents the active window title bar. */ COLORREF clrInActiveCaption; /**< An RGB value that represents the inactive window title bar. */ COLORREF clrGradActiveCapt; /**< An RGB value that represents the gradient active title bar. */ COLORREF clrGradInActiveCapt; /**< An RGB value that represents the gradient inactive title bar. */ COLORREF clrActiveCaptText; /**< An RGB value that represents the active caption text. */ COLORREF clrInactiveCaptText; /**< An RGB value that represents the inactive caption text. */ COLORREF clrXPBarFace; /**< An RGB value that represents the XP toolbar background color. */ COLORREF clrXPHighlight; /**< An RGB value that represents the XP menu item selected color. */ COLORREF clrXPHighlightBorder; /**< An RGB value that represents the XP menu item selected border color. */ COLORREF clrXPHighlightPushed; /**< An RGB value that represents the XP menu item pushed color. */ COLORREF clrXPIconShadow; /**< An RGB value that represents the XP menu item icon shadow. */ COLORREF clrXPGrayText; /**< An RGB value that represents the XP menu item disabled text color. */ COLORREF clrXPHighlightChecked; /**< An RGB value that represents the XP menu item checked color. */ COLORREF clrXPHighlightCheckedBorder; /**< An RGB value that represents the XP menu item checked border color. */ COLORREF clrXPGripper; /**< An RGB value that represents the XP toolbar gripper color. */ COLORREF clrXPSeparator; /**< An RGB value that represents the XP toolbar separator color. */ COLORREF clrXPDisabled; /**< An RGB value that represents the XP menu icon disabled color. */ COLORREF clrXPMenuTextBack; /**< An RGB value that represents the XP menu item text background color. */ COLORREF clrXPMenuExpanded; /**< An RGB value that represents the XP hidden menu commands background color. */ COLORREF clrXPMenuBorder; /**< An RGB value that represents the XP menu border color. */ COLORREF clrXPMenuText; /**< An RGB value that represents the XP menu item text color. */ COLORREF clrXPHighlightText; /**< An RGB value that represents the XP menu item selected text color. */ COLORREF clrXPBarText; /**< An RGB value that represents the XP toolbar text color. */ COLORREF clrXPBarTextPushed; /**< An RGB value that represents the XP toolbar pushed text color. */ COLORREF clrXPTabInactiveBack; /**< An RGB value that represents the XP inactive tab background color. */ COLORREF clrXPTabInactiveText; /**< An RGB value that represents the XP inactive tab text color. */ //======================================================================= //## Cursors used by Xtreme Toolkit //======================================================================= HCURSOR hcurDragCopy; /**< Drag copy cursor handle. */ HCURSOR hcurDragMove; /**< Drag move cursor handle. */ HCURSOR hcurDragNone; /**< Drag none cursor handle. */ HCURSOR hcurHand; /**< Hand cursor handle. */ HCURSOR hcurHSplitBar; /**< Horizontal Splitter cursor handle. */ HCURSOR hcurVSplitBar; /**< Vertical Splitter cursor handle. */ HCURSOR hcurMove; /**< 4 way move cursor handle. */ //======================================================================= //## System metrics //======================================================================= int cxSmIcon; /**< cx small icon size (width). */ int cySmIcon; /**< cy small icon size (height). */ int cxSize; /**< Width, in pixels, of a button in a window's caption or title bar. */ int cySize; /**< Height, in pixels, of a button in a window's caption or title bar. */ int cxHThumb; /**< Width, in pixels, of the thumb box in a horizontal scrollbar. */ int cyVThumb; /**< Height, in pixels, of the thumb box in a vertical scrollbar. */ int cyMenuItem; /**< Height, in pixels, of single-line menu bar. */ //======================================================================= //## Fonts used by Xtreme Toolkit //======================================================================= CXTPFont xtpFont; /**< Menu font. */ CXTPFont xtpFontBold; /**< Menu bold font. */ CXTPFont xtpFontULine; /**< Menu underlined font. */ CXTPFont xtpFontVert; /**< Vertical menu font. */ CXTPFont xtpFontVertBold; /**< Vertical menu bold font. */ CXTPFont xtpFontIconTitle; /**< Icon title font. */ CXTPFont xtpFontIconTitleBold; /**< Icon title bold font. */ CXTPFont xtpFontMarlettIcon; /**< Marlett icon font. */ CXTPFont xtpFontStatus; /**< Status bar font. */ CXTPFont xtpFontSmCaption; /**< Small caption font. */ XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, font, xtpFont, GetFontHandle); XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, fontBold, xtpFontBold, GetBoldFontHandle); XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, fontULine, xtpFontULine, GetULineFontHandle); XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, fontVert, xtpFontVert, GetVertFontHandle); XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, fontVertBold, xtpFontVertBold, GetVertBoldFontHandle); XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, fontIconTitle, xtpFontIconTitle, GetIconTitleFontHandle); XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, fontIconTitleBold, xtpFontIconTitleBold, GetIconTitleBoldFontHandle); XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, fontMarlettIcon, xtpFontMarlettIcon, GetMarlettIconFontHandle); XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, fontStatus, xtpFontStatus, GetStatusFontHandle); XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, fontSmCaption, xtpFontSmCaption, GetSmCaptionFontHandle); //======================================================================= //## Flags used by Xtreme Toolkit //======================================================================= BOOL bWin95; /**< TRUE if Windows 95. */ BOOL bWin98; /**< TRUE if Windows 98. */ BOOL bWinNT; /**< TRUE if Windows NT. */ BOOL bWin2K; /**< TRUE if Windows 2000. */ BOOL bWinXP; /**< TRUE if Windows XP. */ BOOL bUseOfficeFont; /**< TRUE to use the Tahoma font if found, good for Office style applications by default. */ BOOL bUseSolidShadows; /**< TRUE to use solid shadows for operating systems that do not supported layered windows. */ BOOL bMenuShadows; /**< TRUE to use shadows under the menus. */ //======================================================================= //## Miscellaneous settings //======================================================================= int iComCtlVersion; /**< Common control .dll (comctl32.dll) version information. */ friend _XTP_EXT_CLASS CXTPAuxData& AFXAPI XTPAuxData(); }; ////////////////////////////////////////////////////////////////////// # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // #if !defined(__XTGLOBALS_H__) /** @endcond */