/** * @file XTPDrawHelpers.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(__XTPDRAWHELPERS_H__) # define __XTPDRAWHELPERS_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPPaintManagerColorGradient; class CXTPSvgImage; # ifndef DT_HIDEPREFIX # define DT_HIDEPREFIX 0x00100000 # endif # ifndef LAYOUT_BITMAPORIENTATIONPRESERVED # define LAYOUT_BITMAPORIENTATIONPRESERVED 0x00000008 # endif # ifndef LAYOUT_RTL # define LAYOUT_RTL 0x00000001 # endif /** * @brief * CXTPTransparentBitmap is a helper class used to extract the * transparent color from a transparent BitMap. Also, this class * is used to convert a transparent BitMap into a transparent icon. */ class _XTP_EXT_CLASS CXTPTransparentBitmap { public: /** * @brief * Constructor. Construct a new CXTPTransparentBitmap from a * handle to an existing BitMap. * @param hBitmap Handle to an existing BitMap. */ CXTPTransparentBitmap(HBITMAP hBitmap); /** * @brief * Call this function to get the transparent color of the BitMap. * @return * -1 if the BitMap is NULL. * Otherwise, a COLORREF that contains the transparent color of the BitMap. */ COLORREF GetTransparentColor() const; /** * @brief * Call this function to create an icon based on the BitMap. * @return * NULL if the BitMap is NULL. * NULL if the width or height of the BitMap is 0. * Otherwise, a handle to the icon created from the BitMap. */ HICON ConvertToIcon() const; protected: HBITMAP m_hBitmap; /**< A handle to a BtiMap. */ }; /** * @brief * CXTPClientCursorPos is a helper class used to retrieve the cursor * position in client coordinates. */ class _XTP_EXT_CLASS CXTPClientCursorPos : public CPoint { public: /** * @brief * Constructs a CXTPClientCursorPos object used to retrieve the * cursor position in client coordinates. * @param pWnd Pointer to the window that contains the client area to * get the cursor position for. */ CXTPClientCursorPos(CWnd* pWnd); }; /** * @brief * CXTPEmptyRect is a helper class used to instantiate an empty * CRect object. */ class _XTP_EXT_CLASS CXTPEmptyRect : public CRect { public: /** * @brief * Constructs a CXTPEmptyRect object used to instantiate an * empty CRect object. */ CXTPEmptyRect(); }; /** * @brief * CXTPEmptySize is a helper class used to instantiate an empty * CSize object. */ class _XTP_EXT_CLASS CXTPEmptySize : public CSize { public: /** * @brief * Constructs a CXTPEmptySize object used to instantiate an * empty CSize object. */ CXTPEmptySize(); /** * @brief * Makes CXTPEmptySize a null size by setting all coordinates to zero. */ void SetSizeEmpty(); /** * @brief * Assigns srcSize to CSize. * @param srcSize Refers to a source size. Can be a SIZE or CSize. * @return Self reference. */ const SIZE& operator=(const SIZE& srcSize); }; /** * @brief * CXTPWindowRect is a helper class used to retrieve the screen * size for a specified window. */ class _XTP_EXT_CLASS CXTPWindowRect : public CRect { public: /** * @brief * Constructs a CXTPWindowRect object used to retrieve the * screen size for the specified window. * @param hWnd Handle to the window to retrieve the screen size for. */ CXTPWindowRect(HWND hWnd); /** * @brief * Constructs a CXTPWindowRect object used to retrieve the * screen size for the specified window. * @param pWnd Points to the window to retrieve the screen size for. */ CXTPWindowRect(const CWnd* pWnd); }; /** * @brief * CXTPClientRect is a helper class used to retrieve the client * area for a specified window. */ class _XTP_EXT_CLASS CXTPClientRect : public CRect { public: /** * @brief * Constructs a CXTPClientRect object used to retrieve the * client area for the specified window. * @param hWnd Handle to the window to retrieve the client area for. */ CXTPClientRect(HWND hWnd); /** * @brief * Constructs a CXTPClientRect object used to retrieve the * client area for the specified window. * @param pWnd Points to the window to retrieve the client area for. */ CXTPClientRect(const CWnd* pWnd); }; /** * @brief * CXTPBufferDC is a helper class used to create a memory device * context used to draw to an off-screen bitmap. When destroyed, the * class selects the previous bitmap back into the device context to * handle GDI resource cleanup. */ class _XTP_EXT_CLASS CXTPBufferDC : public CDC { /** @cond */ DECLARE_DYNAMIC(CXTPBufferDC) public: /** * @brief * Constructs a CXTPBufferDC object used to create a memory * device context used to draw to an off-screen bitmap. * @param hDestDC Handle to the destination device context the memory * device is BitBlt to. * @param rcPaint Size of the area to paint. */ CXTPBufferDC(HDC hDestDC, const CRect& rcPaint); /** * @brief * Constructs a CXTPBufferDC object used to create a memory * device context used to draw to an off-screen bitmap. * @param hDestDC Handle to the destination device context the memory * device is BitBlt to. * @param rcPaint Size of the area to paint. * @param clrBack Represents background color for fill, can be COLORREF or gradient values using * CXTPPaintManagerColorGradient. * @param bHorz Used when drawing gradient background, TRUE to * draw gradient from left to right, otherwise drawn top to bottom. */ CXTPBufferDC(HDC hDestDC, const CRect& rcPaint, const CXTPPaintManagerColorGradient& clrBack, const BOOL bHorz = FALSE); /** * @brief * Constructs a CXTPBufferDC object used to create a memory * device context used to draw to an off-screen bitmap. * @param paintDC Handle to the destination device context the memory */ CXTPBufferDC(CPaintDC& paintDC); /** * @brief * Destroys a CXTPBufferDC object, handles cleanup and de- * allocation. */ virtual ~CXTPBufferDC(); /** * @brief * This member function is called to set the valid flag to false * so that the off screen device context will not be drawn. */ void Discard(); /** * @brief * Call this method to retrieve the destination * device context object pointer. * @return Retrieves the destination device context object pointer. */ CDC* GetDestDC() const; /** * @brief * Call this method to retrieve the destination * device context handle. * @return Retrieves the destination device context handle */ HDC GetDestHDC() const; /** * @brief * Call this member function to take a snapshot of the screen underneath * the area where the off screen bitmap is to be drawn. */ void TakeSnapshot(); protected: HDC m_hDestDC; /**< Handle to the destination device context. */ HBITMAP m_hBitmap; /**< Bitmap in memory device context */ CRect m_rect; /**< Size of the area to paint. */ HGDIOBJ m_hOldBitmap; /**< Handle to the previously selected bitmap. */ }; /** * @brief * CXTPBufferDCEx is a helper class used to create a memory device * context used to draw to an off-screen bitmap. When destroyed, the * class selects the previous bitmap back into the device context to * handle GDI resource cleanup. */ class _XTP_EXT_CLASS CXTPBufferDCEx : public CDC { DECLARE_DYNAMIC(CXTPBufferDCEx); public: /** * @brief * Constructs a CXTPBufferDCEx object used to create a memory * device context used to draw to an off-screen bitmap. * @param hDestDC Handle to the destination device context the memory * device is BitBlt to. * @param rcPaint Size of the area to paint. */ CXTPBufferDCEx(HDC hDestDC, const CRect rcPaint); /** * @brief * Destroys a CXTPBufferDC object, handles cleanup and de- * allocation. */ virtual ~CXTPBufferDCEx(); /** * @brief * Call this method to retrieve the destination * device context object pointer. * @return Retrieves the destination device context object pointer. */ CDC* GetDestDC() const; /** * @brief * Call this method to retrieve the destination * device context handle. * @return Retrieves the destination device context handle */ HDC GetDestHDC() const; protected: HDC m_hDestDC; /**< Handle to the destination device context. */ HBITMAP m_hBitmap; /**< Bitmap in memory device context */ CRect m_rect; /**< Size of the area to paint. */ HGDIOBJ m_hOldBitmap; /**< Handle to the previously selected bitmap. */ }; /** * @brief * CXTPBitmapDC is a helper class used to select a bitmap into the * device context specified by hDC. When destroyed, the class * selects the previous bitmap back into the device context to * handle GDI resource cleanup. */ class _XTP_EXT_CLASS CXTPBitmapDC : public CDC { public: /** * @brief * Constructs CXTPBitmapDC */ CXTPBitmapDC(); /** * @brief * Constructs a CXTPBitmapDC object and selects the specified bitmap * into the device context specified by pDC. * @param pDC Pointer to a valid device context. * @param pBitmap Pointer to a CBitmap object to select into the device * context. */ CXTPBitmapDC(CDC* pDC, CBitmap* pBitmap); /** * @brief * Constructs a CXTPBitmapDC object and selects the specified bitmap * into the device context specified by pDC. * @param pDC Pointer to a valid device context. * @param hBitmap Bitmap handle */ CXTPBitmapDC(CDC* pDC, HBITMAP hBitmap); /** * @brief * Destroys a CXTPBitmapDC object, handles cleanup and de- * allocation. */ virtual ~CXTPBitmapDC(); /** * @brief * Call this member function to change the bitmap selected by the * device context. * @param hBitmap Handle to a HBITMAP object to select into the device * context. */ void SetBitmap(HBITMAP hBitmap); /** * @brief * Releases the currently selected bitmap and selects the initial bitmap into device * context. */ void SelectOld(); protected: HBITMAP m_hOldBitmap; /**< Handle to the previously selected bitmap. */ HBITMAP m_hCurrentBitmap; /**< Currently selected bitmap handle */ }; /** * @brief * CXTPFontDC is a helper class used to select a font into the * device context specified by pDC. When destroyed, the class * selects the previous font back into the device context to * handle GDI resource cleanup. */ class _XTP_EXT_CLASS CXTPFontDC { public: /** * @brief * Constructs a CXTPFontDC object and selects the specified font * into the device context specified by pDC. * @param pDC Pointer to a valid device context. * @param pFont Pointer to a CFont object to select into the device * context. */ CXTPFontDC(CDC* pDC, CFont* pFont = NULL); /** * @brief * Constructs a CXTPFontDC object and selects the specified font * into the device context specified by pDC. * @param pDC Pointer to a valid device context. * @param pFont Pointer to a CFont object to select into the device * context. * @param clrTextColor Text color to set in the DC. */ CXTPFontDC(CDC* pDC, CFont* pFont, COLORREF clrTextColor); /** * @brief * Destroys a CXTPFontDC object, handles cleanup and de- * allocation. */ virtual ~CXTPFontDC(); /** * @brief * Call this member function to change the font selected by the * device context. * @param pFont Pointer to a CFont object to select into the device * context. */ void SetFont(CFont* pFont); /** * @brief * Call this member function to change the text color set in the * device context. * @param clrTextColor Text color to set in the DC. */ void SetColor(COLORREF clrTextColor); /** * @brief * Call this member function to change the font and color selected * by the device context. * @param pFont Pointer to a CFont object to select into the device * context. * @param clrTextColor Text color to set in the DC. */ void SetFontColor(CFont* pFont, COLORREF clrTextColor); /** * @brief * Call this member function to select the initial font back into the * device context. * @details * This method is also called from the destructor. */ void ReleaseFont(); /** * @brief * Call this member function to set the initial text color back into the * device context. * @details * This method is also called from the destructor. */ void ReleaseColor(); /** * @brief * Disables handle leak detection in debug mode. Must be used cautiously * and only when there is no control over the code being executed. */ void DisableHandleLeakDetection(); protected: CDC* m_pDC; /**< Stored pointer to a device context. */ CFont* m_pOldFont; /**< Stored pointer to an initial font from the device context. */ CFont* m_pCurrentFont; /**< Stored pointer to the current font from the device context. */ COLORREF m_clrOldTextColor; /**< Stored an initial text color from the device context. */ }; /** * @brief * CXTPPenDC is a helper class used to create a pen using * the color specified by crColor. The pen is then selected * into the device context specified by hDC. When destroyed, the * class selects the previous pen back into the device context to * handle GDI resource cleanup. */ class _XTP_EXT_CLASS CXTPPenDC { public: /** * @brief * Constructs a CXTPPenDC object using an existing CPen object. The * pen is then selected into the device context specified by hDC. * @param pDC Pointer to a valid device context. * @param pPen Pointer to a CPen object to select into the device * context. * @details * Constructs a CXTPPenDC object use the CPen object specified by pPen * into the device context specified by pDC. */ CXTPPenDC(CDC* pDC, CPen* pPen); /** * @brief * Constructs a CXTPPenDC object using an existing CPen object. The * pen is then selected into the device context specified by hDC. * @param hDC Handle to a valid device context. * @param crColor RGB value used to create pen. * @details * Constructs a CXTPPenDC object and creates a pen using * the color specified by crColor. The pen is then selected * into the device context specified by hDC. */ CXTPPenDC(HDC hDC, COLORREF crColor); /** * @brief * Constructs a CXTPPenDC object using an existing CPen object. The * pen is then selected into the device context specified by hDC. * @param hDC Handle to a valid device context. * @param nStyle Pen style, one of PS_* constants. * @param crColor RGB value used to create pen. * @details * Constructs a CXTPPenDC object and creates a pen using * the color specified by crColor. The pen is then selected * into the device context specified by hDC. */ CXTPPenDC(HDC hDC, int nStyle, COLORREF crColor); /** * @brief * Constructs a CXTPPenDC object using an existing CPen object. The * pen is then selected into the device context specified by hDC. * @param hDC Handle to a valid device context. * @param nStyle Pen style, one of PS_* constants. * @param nWidth Pen width in pixels * @param crColor RGB value used to create pen. * @details * Constructs a CXTPPenDC object and creates a pen using * the color specified by crColor. The pen is then selected * into the device context specified by hDC. */ CXTPPenDC(HDC hDC, int nStyle, int nWidth, COLORREF crColor); /** * @brief * Destroys a CXTPPenDC object, handles cleanup and de- * allocation. */ virtual ~CXTPPenDC(); /** * @brief * Constructs a CXTPPenDC object using an existing CPen object. The * pen is then selected into the device context specified by hDC. * @param hDC Handle to a valid device context. * @param nStyle Pen style, one of PS_* constants. * @param nWidth Pen width in pixels * @param crColor RGB value used to create pen. * @details * Creates a CXTPPenDC object and creates a pen using * the color specified by crColor. The pen is then selected * into the device context specified by hDC. */ void Create(HDC hDC, int nStyle, int nWidth, COLORREF crColor); /** * @brief * Call this member function to retrieve the color used by the * device context pen. * @details * Retrieves the color used by the device context pen. * @return * An RGB value that represents the selected pen color. */ COLORREF Color(); /** * @brief * Call this member function to change the color used by the * device context pen. * @param crColor RGB value to change the pen color to. */ void Color(COLORREF crColor); private: void ReleasePen(); protected: CPen m_pen; /**< Pen selected into device context. */ HDC m_hDC; /**< Device context handle. */ HPEN m_hOldPen; /**< Handle to the previously selected pen. */ HPEN m_hCurrentPen; /**< Handle to the currently selected pen. */ int m_nStyle; /**< Pen style, one of PS_* constants. */ int m_nWidth; /**< Pen width in pixels */ COLORREF m_crColor; /**< Pen color */ }; /** * @brief * CXTPBrushDC is a helper class used to create a brush using * the color specified by crColor. The brush is then selected * into the device context specified by hDC. When destroyed, the * class selects the previous brush back into the device context to * handle GDI resource cleanup. */ class _XTP_EXT_CLASS CXTPBrushDC { public: /** * @brief * Constructs a CXTPBrushDC object and creates a brush using * the color specified by crColor. The brush is then selected * into the device context specified by hDC. * @param hDC Handle to a valid device context. * @param crColor RGB value used to create brush. */ CXTPBrushDC(HDC hDC, COLORREF crColor); /** * @brief * Destroys a CXTPBrushDC object, handles cleanup and de- * allocation. */ virtual ~CXTPBrushDC(); /** * @brief * Call this member function to change the color used by the * device context brush. * @param crColor RGB value to change the brush color to. */ void Color(COLORREF crColor); private: void ReleaseBrush(); protected: CBrush m_brush; /**< Brush selected into device context. */ HDC m_hDC; /**< Device context handle. */ HBRUSH m_hOldBrush; /**< Handle to the previously selected brush. */ }; /** @cond */ # ifndef COLORREF_NULL # define COLORREF_NULL (COLORREF) - 1 # endif /** @endcond */ /** * @brief * CXTPDCSaveState is a helper class used to save the current state of the * specified device context by copying state information (such as clipping * region, selected objects, and mapping mode) to a context stack maintained * by Windows. The saved device context will be restored once the object is * destroyed. */ class _XTP_EXT_CLASS CXTPDCSaveState { public: /** * @brief * Constructs a CXTPDCSaveState object and saves the state of the * specified device context. * @param pDC Points to to a valid device context. */ CXTPDCSaveState(CDC* pDC); /** * @brief * Destroys a CXTPDCSaveState object, handles cleanup and de- * allocation. */ virtual ~CXTPDCSaveState(); private: CDC* m_pDC; /**< Pointer to a valid device context. */ int m_nState; /**< Integer identifying the saved device context */ }; /** * @brief * CXTPCompatibleDC is a helper class used to create a memory device * context (DC) compatible with the device specified by pDC. When * destroyed, the class selects the previous bitmap back into the * device context to handle GDI resource cleanup. */ class _XTP_EXT_CLASS CXTPCompatibleDC : public CDC { public: /** * @brief * Constructs a CXTPCompatibleDC object and creates a memory * device context (DC) compatible with the device specified by * pDC. The bitmap specified by pBitmap is then selected into * the device context. * @param pDC Points to a valid device context. * @param pBitmap Points to the previously selected bitmap. */ CXTPCompatibleDC(CDC* pDC, CBitmap* pBitmap); /** * @brief * Constructs a CXTPCompatibleDC object and creates a memory * device context (DC) compatible with the device specified by * pDC. The bitmap specified by pBitmap is then selected into * the device context. * @param pDC Points to a valid device context. * @param hBitmap Points to the previously selected bitmap. */ CXTPCompatibleDC(CDC* pDC, HBITMAP hBitmap); /** * @brief * Destroys a CXTPCompatibleDC object, handles cleanup and de- * allocation. */ virtual ~CXTPCompatibleDC(); protected: HBITMAP m_hBitmap; /**< Currently selected bitmap. */ HBITMAP m_hOldBitmap; /**< Pointer to the previously selected bitmap. */ }; /** * @brief * CXTPSplitterTracker is a standalone class. It is used * to track a splitter rectangle. */ class _XTP_EXT_CLASS CXTPSplitterTracker { public: /** * @brief * Constructs a CXTPSplitterTracker object. * @param bSolid TRUE to use solid tracker; FALSE for HalftoneBrush. * @param bDesktopDC TRUE to use the desktop device context. */ CXTPSplitterTracker(BOOL bSolid = FALSE, BOOL bDesktopDC = TRUE); public: /** * @brief * This method is called to track size of the splitter. * @param pTrackWnd Pointer to a CWnd object. * @param rcAvail Available rectangle of tracking. * @param rectTracker Current rectangle of tracking. * @param point Starting point. * @param bHoriz TRUE to track horizontally. * @return * TRUE if successful; otherwise returns FALSE */ BOOL Track(CWnd* pTrackWnd, CRect rcAvail, CRect& rectTracker, CPoint point, BOOL bHoriz); /** * @brief * Controls the accumulation of bounding-rectangle information for the specified device * context. * @param rcBoundRect A CRect object that specifies the boundaries of the bounding rectangle. */ void SetBoundRect(CRect rcBoundRect); private: /** * @brief * This function is called by the framework during the resizing of splitter windows. * This function inverts the contents of the Splitter Tracker rectangle. * Inversion is a logical NOT operation and flips the bits of each pixel. * @param rc A CRect object that specifies the XY position of the Splitter Tracker. */ void OnInvertTracker(CRect rc); private: CDC* m_pDC; BOOL m_bSolid; CRect m_rcBoundRect; CWnd* m_pWnd; BOOL m_bDesktopDC; CWnd* m_pSplitterWnd; PVOID m_pfnSetLayeredWindowAttributes; /**< Pointer to SetLayeredWindowAttributes method. */ }; /** * @brief * The class CXTPMouseMonitor is a helper class that is used to * monitor mouse messages for in-place controls. This class is used * in XTPPropertyGridInPlaceList and XTPGridInplaceControls. */ class _XTP_EXT_CLASS CXTPMouseMonitor { public: /** * @brief * Call this function to set up a hook to monitor mouse messages. * @param pWndMonitor A pointer to a CWnd object. Used to determine * which monitor currently contains the mouse cursor. * @return */ static void AFX_CDECL SetupHook(CWnd* pWndMonitor); /** * @brief * Call this function to determine if mouse messages was hooked. * @return TRUE if mouse if already hooked, FALSE otherwise. */ static BOOL AFX_CDECL IsMouseHooked(); protected: /** * @brief * The MouseProc hook procedure is an application-defined or * library-defined callback function used with the SetWindowsHookEHC_NOREMOVEx * function. The system calls this function whenever an application * calls the GetMessage or PeekMessage function and there is a mouse * message to be processed. * @param nCode Specifies a code the hook procedure uses to determine * how to process the message. This parameter can be one of the * following values: HC_ACTION and HC_NOREMOVE. * HC_ACTION * The wParam and lParam parameters contain information * about a mouse message. HC_NOREMOVE The wParam and lParam parameters contain * information about a mouse message, and the mouse message has not been removed from the * message queue. (An application called the PeekMessage function, specifying the * PM_NOREMOVE flag.) * @param wParam Specifies the identifier of the mouse message. * @param lParam Pointer to a MOUSEHOOKSTRUCT structure. * @return * If nCode is less than zero, the hook procedure must return the value returned by * CallNextHookEx. If nCode is greater than or equal to zero, and the hook * procedure did not process the message, it is highly recommended that you call * CallNextHookEx and return the value it returns; otherwise, other applications * that have installed WH_MOUSE hooks will not receive hook notifications and may * behave incorrectly as a result. If the hook procedure processed the message, it may return a * nonzero value to prevent the system from passing the message to the target window procedure. */ static LRESULT CALLBACK MouseProc(int nCode, WPARAM wParam, LPARAM lParam); private: static HHOOK m_hHookMouse; /**< A handle to a hook. */ static CWnd* m_pWndMonitor; /**< A pointer to the in-place control. */ }; /** * @brief * The XTPTrackMouseEvent() function Posts messages when the mouse pointer * leaves a window or hovers over a window for a specified amount of time. * @param hWndTrack A handle to the window to track. * @param dwFlags The services requested. This member can be a combination * of the following values. * * TME_CANCEL The caller wants to cancel a prior tracking * request. The caller should also specify * the type of tracking that it wants to * cancel. For example, to cancel hover tracking, * the caller must pass the TME_CANCEL and * * TME_HOVER flags. * * TME_HOVER The caller wants hover notification. * Notification is delivered as a WM_MOUSEHOVER * message. If the caller requests hover tracking * while hover tracking is already active, * the hover timer will be reset. This flag is * ignored if the mouse pointer is not over the * specified window or area. * * TME_LEAVE The caller wants leave notification. Notification * is delivered as a WM_MOUSELEAVE message. If the * mouse is not over the specified window or area, * a leave notification is generated immediately * and no further tracking is performed. * * TME_NONCLIENT The caller wants hover and leave notification * for the nonclient areas. Notification is delivered * as WM_NCMOUSEHOVER and WM_NCMOUSELEAVE messages. * * TME_QUERY The function fills in the structure instead of * treating it as a tracking request. The structure * is filled such that had that structure been passed * to TrackMouseEvent, it would generate the current * tracking. The only anomaly is that the hover time-out * returned is always the actual time-out and not * HOVER_DEFAULT, if HOVER_DEFAULT was specified during * the original TrackMouseEvent request. * * @param dwHoverTime The hover time-out (if TME_HOVER was specified in dwFlags), in * milliseconds. Can be HOVER_DEFAULT, which means to use the system default * hover time-out. * @details * The mouse pointer is considered to be hovering when it stays within a * specified rectangle for a specified period of time. Call SystemParametersInfo. * and use the values SPI_GETMOUSEHOVERWIDTH, SPI_GETMOUSEHOVERHEIGHT, and * SPI_GETMOUSEHOVERTIME to retrieve the size of the rectangle and the time. * * The function can post the following messages. * * WM_NCMOUSEHOVER The same meaning as WM_MOUSEHOVER except this is for * the nonclient area of the window. * * WM_NCMOUSELEAVE The same meaning as WM_MOUSELEAVE except this is for * the nonclient area of the window. * * WM_MOUSEHOVER The mouse hovered over the client area of the window * for the period of time specified in a prior call to * XTPTrackMouseEvent. Hover tracking stops when this message * is generated. The application must call XTPTrackMouseEvent * again if it requires further tracking of mouse hover behavior. * * WM_MOUSELEAVE The mouse left the client area of the window specified * in a prior call to XTPTrackMouseEvent. All tracking requested * by XTPTrackMouseEvent is canceled when this message is generated. * The application must call XTPTrackMouseEvent when the mouse * reenters its window if it requires further tracking of mouse * hover behavior. * @return * If the function succeeds, the return value is nonzero. If the function fails, * return value is zero. To get extended error information, call GetLastError. */ _XTP_EXT_CLASS BOOL AFX_CDECL XTPTrackMouseEvent(HWND hWndTrack, DWORD dwFlags = TME_LEAVE, DWORD dwHoverTime = HOVER_DEFAULT); /** * @brief * CXTPDrawHelpers is a helper class used to perform specialized * drawing tasks. You can use this class to perform such tasks as * gradient fills and blending colors. */ class _XTP_EXT_CLASS CXTPDrawHelpers { friend class CXTPSingleton; public: /** @cond */ /* Function pointer used to access the Windows API GradientFill function. */ typedef BOOL(__stdcall* PFNGRADIENTFILL)(HDC, PTRIVERTEX, ULONG, PVOID, ULONG, ULONG); /* AlphaBlend function declaration */ typedef BOOL(__stdcall* PFNALPHABLEND)(HDC, int, int, int, int, HDC, int, int, int, int, BLENDFUNCTION); typedef BOOL(WINAPI* PFNTRANSPARENTBLT)(HDC, int, int, int, int, HDC, int, int, int, int, UINT); /** @endcond */ public: /** * @brief * Constructs a CXTPDrawHelpers object. */ CXTPDrawHelpers(); /** * @brief * Destroys a CXCSplitPath object, handles cleanup and de-allocation. */ virtual ~CXTPDrawHelpers(); public: void SolidRectangle(CDC* pDC, CRect rc, COLORREF clrRect, COLORREF clrFill); /** * @brief * Call this member function to perform a gradient fill using * the specified COLORREF values crFrom and crTo. * @param pDC Points to the device context * @param lpRect Size of area to fill * @param crFrom RGB value to start from * @param crTo RGB value to fill to * @param bHorz TRUE if fill is horizontal. * @details * Call this member function to fill rectangle and triangle structures * with color that smoothly fades from one side to the other. */ void GradientFill(CDC* pDC, LPCRECT lpRect, COLORREF crFrom, COLORREF crTo, BOOL bHorz); /** * @brief * Call this member function to perform a gradient fill using * the specified COLORREF values crFrom and crTo. * @param pDC Points to the device context * @param lpRect Size of area to fill * @param crFrom RGB value to start from * @param crTo RGB value to fill to * @param bHorz TRUE if fill is horizontal. * @param lpRectClip Pointer to a RECT structure that contains a clipping rectangle. * This parameter is optional and may be set to NULL. * @details * Call this member function to fill rectangle and triangle structures * with color that smoothly fades from one side to the other. */ void GradientFill(CDC* pDC, LPCRECT lpRect, COLORREF crFrom, COLORREF crTo, BOOL bHorz, LPCRECT lpRectClip); /** * @brief * Call this member function to perform a gradient fill using * the specified COLORREF values crFrom and crTo. * @param pDC Points to the device context * @param lpRect Size of area to fill * @param grc CXTPPaintManagerColorGradient struct containing start from and * fill to RGB color values. * @param bHorz TRUE if fill is horizontal. * @param lpRectClip Pointer to a RECT structure that contains a clipping rectangle. * This parameter is optional and may be set to NULL. * @details * Call this member function to fill rectangle and triangle structures * with color that smoothly fades from one side to the other. */ void GradientFill(CDC* pDC, LPCRECT lpRect, const CXTPPaintManagerColorGradient& grc, BOOL bHorz, LPCRECT lpRectClip = NULL); /** * @brief * Call this member function to perform a gradient fill using * the specified COLORREF values crFrom and crTo. * @param hdc Handle to a device context. * @param pVertex Pointer to an array of TRIVERTEX structures that * @param dwNumVertex The number of vertices. * @param pMesh Array of GRADIENT_TRIANGLE structures in triangle * mode, or an array of GRADIENT_RECT structures in * rectangle mode. * @param dwNumMesh The number of elements (triangles or rectangles) * in pMesh. * @param dwMode Specifies gradient fill mode. For a list of possible * values, see GradientFill in the Platform SDK. * @details * Call this member function to fill rectangle and triangle structures * with color that smoothly fades from one side to the other. * @return * The HDC version TRUE if successful; otherwise FALSE. */ BOOL GradientFill(HDC hdc, PTRIVERTEX pVertex, ULONG dwNumVertex, PVOID pMesh, ULONG dwNumMesh, ULONG dwMode); /** * @brief * Call this member function to draw a 1 or 2 pixel wide border * using the colors specified by pOutsideClr and pInsideClr. If * pInsideClr is NULL, then a 1 pixel border is drawn. * @param pDC Pointer to a valid device context. * @param rBorder Size of the border to draw. * @param pOutsideClr Points to an array of 4 colors that represent the left, * top, right and bottom outside border color. * @param pInsideClr Points to an array of 4 colors that represent the left, * top, right and bottom inside border color. * @return */ static void AFX_CDECL DrawBorder(CDC* pDC, CRect rBorder, COLORREF* pOutsideClr, COLORREF* pInsideClr = NULL); /** * @brief * Call this member to exclude the pixels for each corner of the * area specified by rc. * @param pDC Points to the device context * @param rc Area to exclude corners from * @param bTopCornersOnly TRUE to exclude top corners only. */ void ExcludeCorners(CDC* pDC, CRect rc, BOOL bTopCornersOnly = FALSE); /** * @brief * This member function will search a string, strip off the mnemonic * '&', and reformat the string. * @param strClear Text needed to strip. * @return */ static void AFX_CDECL StripMnemonics(CString& strClear); /** * @brief * This member function will search a string, strip off the mnemonic * '&', and reformat the string. * @param lpszClear Text needed to strip. * @return */ static void AFX_CDECL StripMnemonics(LPTSTR lpszClear); /** * @brief * Call this member function to blur the color value for the * points specified by pts * @param pDC Points to the device context * @param pts Array of points to blur * @param nCount Number of points in array. */ void BlurPoints(CDC* pDC, LPPOINT pts, int nCount); /** * @brief * Call this member function to blend the colors specified by * crA and crB. * @param crA RGB value to blend * @param crB RGB value to blend * @param fAmountA The amount that crA saturates crB. * @return * An RGB value that represents the blended color. */ static COLORREF AFX_CDECL BlendColors(COLORREF crA, COLORREF crB, double fAmountA); static BOOL AFX_CDECL GetIconLogFont(LOGFONT* pLogFont); /** * @brief * Checks for the system for non-standard character set and * retrieves DEFAULT_GUI_FONT object. If a standard character * set is used, then SPI_GETICONTITLELOGFONT is used to retrieve * system font information. If bModernFont is specified, then the * system is checked for the existence of "Segoe UI" or "Tahoma" * fonts and sets the lfFaceName member to the first value found. * If the modern fonts do not exist, then the default value for * SPI_GETICONTITLELOGFONT will be used. * @param pLogFont Destination LOGFONT structure to recive font * information. * @param bModernFont TRUE to search for "Segoe UI" and "Tahoma" * fonts and use those values for lfFaceName if * found. * @param bVertFont TRUE if the font is to be used for vertical * display. * @return * TRUE if successful, otherwise FALSE. */ static BOOL AFX_CDECL GetDefaultLogFont(LOGFONT* pLogFont, BOOL bModernFont = TRUE, BOOL bVertFont = FALSE); /** * @brief * Call this member function to search for and replace a single * color using the specified device context. * @param pDC Points to a valid device context. * @param rArea Area on device context to replace colors. * @param crFind RGB value specifying which color to locate. * @param crReplace RGB value specifying which color to replace crFind with. * @return */ static void AFX_CDECL ReplaceColor(CDC* pDC, CRect rArea, COLORREF crFind, COLORREF crReplace); /** * @brief * Call this member function to get dark color from specified by lColor * @param lScale Scale value * @param lColor RGB value to get * @return A darken color value. * @see * LightenColor */ static COLORREF AFX_CDECL DarkenColor(long lScale, COLORREF lColor); /** * @brief * Call this member function to get light color from specified by lColor * @param lScale Scale value * @param lColor RGB value to get * @return A lighten color value. * @see * DarkenColor */ static COLORREF AFX_CDECL LightenColor(long lScale, COLORREF lColor); /** * @brief * Call this member function to convert a color from RGB to HSL color model. * @param rgb RGB color to convert * @return * An HSL representation of the specified color. * @see * HSLtoRGB */ static COLORREF AFX_CDECL RGBtoHSL(COLORREF rgb); /** * @brief * Call this member function to convert a color from RGB to HSL color model. * @param clr An RGB color to convert * @param h Reference to a double to receive the hue value for the specified color. * @param s Reference to a double to receive the sat value for the sepcified color. * @param l Reference to a double to receive the lum value for the specified color. * @return * @see * HSLtoRGB */ static void AFX_CDECL RGBtoHSL(COLORREF clr, double& h, double& s, double& l); /** * @brief * Call this member function to convert a color from HSL to RGB color model. * @param hsl An RGB color value representing the HSL color to convert * @return * An RGB representation of the specified color. * @see * HueToRGB, RGBtoHSL */ static COLORREF AFX_CDECL HSLtoRGB(COLORREF hsl); /** * @brief * Call this member function to convert a color from HSL to RGB color model. * @param h Represents the hue value for the specified color to convert. * @param s Represents the sat value for the sepcified color to convert. * @param l Represents the lum value for the specified color to convert. * @return * An RGB representation of the specified color. * @see * HueToRGB, RGBtoHSL */ static COLORREF AFX_CDECL HSLtoRGB(double h, double s, double l); /** * @brief * Call this member function to darken or lighten the color specified * by clr. Unlike DarkenColor() which modifies the red, green and blue * color values, DarkenColorLum() adjusts the luminosity (brightness) * for the color. * @param clr RGB representing the color to adjust. * @param dPercent A double value representing the percentage in decimal * format to darken the color by. For example if you * wanted to darken the color by 75% you would use 0.25. * @return * A COLORREF value representing the adjusted color value. */ static COLORREF AFX_CDECL DarkenColorLum(COLORREF clr, double dPercent); /** * @brief * This member function will either lighten or darken the color * specified by clr using the value specified by nPercent. The * value must be a value between -100 and +100. Negative values * will darken the color, positive values will lighten it. * @param clr RGB value representing the color to adjust. * @param nPercent Amount to adjust the color by, must be a value * between -100 and +100 percent. * @return * An RGB value representing the adjusted color value. If the * value specified by nPercent is 0, then the return value will * be the same value as clr. If nPercent is not a valid value, * the return value will be COLORREF_NULL (-1). */ static COLORREF AFX_CDECL AdjustBrightness(COLORREF clr, int nPercent); /** * @brief * Call this member function to convert the specified color to * greyscale values. * @param clr RGB value of the color to convert to greyscale. * @return * An RGB value representing a greyscale version of the * color specified by clr. */ static COLORREF AFX_CDECL GreyScaleColor(COLORREF clr); /** * @brief * Call this member function to determine if the specified font * exists. * @param lpszFaceName A NULL-terminated string that represents the * font face name. * @return * TRUE if the font was found, otherwise FALSE. */ static BOOL AFX_CDECL FontExists(LPCTSTR lpszFaceName); /** * @brief * Retrieves DEFAULT_GUI_FONT font name. * @return * Face name of DEFAULT_GUI_FONT font. */ static CString AFX_CDECL GetDefaultFontName(); /** * @brief * Draws text using the font name and height provided. * @param pDC Device context pointer. * @param lpszFontFaceName Pointer to font name string * @param nFontHeight Font height. If 0, the text will be fit into the rectangle. * @param lpchText Text string to draw. * @param nCount The length, in characters, of the string. If nCount is -1, * then string length will be computed. * @param lpRect A pointer to a RECT structure that contains the rectangle * (in logical coordinates) in which the text is to be formatted. * @param uFormat The method of formatting the text. Refer to DrawText SDK * function documentation for more details. * @param crForeColor Foreground text color. When equals to COLORREF_NULL, no * foreground text color is used. * @param crBackColor Background text color. When equals to COLORREF_NULL, no * background text color is used. * @return * If the function succeeds, the return value is the height of the text * in logical units. If DT_VCENTER or DT_BOTTOM is specified, the return * value is the offset from lpRect->top to the bottom of the drawn text * If the function fails, the return value is zero. */ static int AFX_CDECL DrawFontText(CDC* pDC, LPCTSTR lpszFontFaceName, int nFontHeight, LPCTSTR lpchText, int nCount, LPRECT lpRect, UINT uFormat, COLORREF crForeColor = COLORREF_NULL, COLORREF crBackColor = COLORREF_NULL); /** * @brief * Draws text using the font name and height provided. * @param pDC Device context pointer. * @param pFont Pointer to a CFont object. * @param lpchText Text string to draw. * @param nCount The length, in characters, of the string. If nCount is -1, * then string length will be computed. * @param lpRect A pointer to a RECT structure that contains the rectangle * (in logical coordinates) in which the text is to be formatted. * @param uFormat The method of formatting the text. Refer to DrawText SDK * function documentation for more details. * @param crForeColor Foreground text color. When equals to COLORREF_NULL, no * foreground text color is used. * @param crBackColor Background text color. When equals to COLORREF_NULL, no * background text color is used. * @return * If the function succeeds, the return value is the height of the text * in logical units. If DT_VCENTER or DT_BOTTOM is specified, the return * value is the offset from lpRect->top to the bottom of the drawn text * If the function fails, the return value is zero. */ static int AFX_CDECL DrawFontText(CDC* pDC, CFont* pFont, LPCTSTR lpchText, int nCount, LPRECT lpRect, UINT uFormat, COLORREF crForeColor = COLORREF_NULL, COLORREF crBackColor = COLORREF_NULL); /** * @brief * Converts the values specificed by dluX and dluY to a CPoint value. * @param dluX Specifies the initial x-position. * @param dluY Specifies the initial y-position. * @return * A CPoint object that represents the specified values for x and y. */ static CPoint AFX_CDECL Dlu2Pix(int dluX, int dluY); /** * @brief * Retrieves vertical font name * @param bUseOfficeFont TRUE to use "Tahoma" font if exists. * @return * Face name of vertical font. */ static CString AFX_CDECL GetVerticalFontName(BOOL bUseOfficeFont); /** * @brief * Call this member function to draw a triangle onto the * specified device context. * @param pDC Points to the device context * @param pt0 First point of the triangle * @param pt1 Second point of the triangle * @param pt2 Third point of the triangle * @param clrPen An RGB value that represents the border color. * @param clrBrush An RGB value that represents the fill color, if COLORREF_NULL * the value specified by clrPen is used. * @return */ static void AFX_CDECL Triangle(CDC* pDC, CPoint pt0, CPoint pt1, CPoint pt2, COLORREF clrPen, COLORREF clrBrush = COLORREF_NULL); /** * @brief * Call this member function to draw a triangle onto the * specified device context. * @param pDC Points to the device context * @param pt0 First point of the triangle * @param pt1 Second point of the triangle * @param pt2 Third point of the triangle * the value specified by clrPen is used. * @return */ static void AFX_CDECL Triangle(CDC* pDC, CPoint pt0, CPoint pt1, CPoint pt2); /** * @brief * Call this member function to draw an expand triangle commonly * used on tree controls or other controls that need to show the * expanded state of a list or group of items. * @param pDC Points to the device context * @param pt Top left anchor point for the triangle. * @param bExpanded TRUE to draw the expanded triangle. * @param clrPen An RGB value that represents the border color. * @param clrBrush An RGB value that represents the fill color, if * COLORREF_NULL the value specified by clrPen is used. * @return */ static void AFX_CDECL DrawExpandTriangle(CDC* pDC, CPoint pt, BOOL bExpanded, COLORREF clrPen, COLORREF clrBrush = COLORREF_NULL); /** * @brief * Call this member function to draw an expand arrow commonly * used on pop-up windows or other controls that need to show the * expanded state of a docked window. * @param pDC Points to the device context * @param rc Size for the triangle. * @param bExpanded TRUE to draw the expanded triangle. * @param clrArrow An RGB value that represents the arrow color. * @return */ static void AFX_CDECL DrawExpandArrow(CDC* pDC, CRect rc, BOOL bExpanded, COLORREF clrArrow); /** * @brief * Call this member function to draw a vertical or horizontal line using * the specified device context. * @param pDC Points to the device context * @param x1 Specifies the logical x-coordinate of the start position. * @param y1 Specifies the logical y-coordinate of the start position. * @param x2 Specifies the logical x-coordinate of the end position. * @param y2 Specifies the logical y-coordinate of the end position. * @param crLine Specifies the RGB color value used to draw the line. * @return * TRUE if the specified device context is valid, otherwise FALSE. */ static BOOL AFX_CDECL DrawLine(CDC* pDC, int x1, int y1, int x2, int y2, COLORREF crLine); /** * @brief * Call this member function to determine if the system display * is set to low resolution. * @param hDC Handle to a device context, if NULL the desktop window * device context is used. * @return * TRUE if the system display is set to low resolution, * otherwise FALSE. */ static BOOL AFX_CDECL IsLowResolution(HDC hDC = 0); /** * @brief * Determines if GradientFill from msimg32.dll available. * @return * TRUE if GradientFill can be used */ BOOL IsFastFillAvailable() const; /** * @brief * This member function is called by the Theme Manager to capture the * area on the parent window underneath the specified owner window. * This is then used for rendering the owner transparent. * @param pWndOwner Pointer the child of the parent window to take a * snapshot for. * @param bmpSnapshot Bitmap used to store transparent background. * @return * TRUE if the parent area was successfully captured, otherwise * returns FALSE. * @see * DrawTransparentBack */ BOOL TakeSnapShot(CWnd* pWndOwner, CBitmap& bmpSnapshot); /** * @brief * This member function is called to render the window specified * by pWndOwner transparent displaying the parent windows background * instead. * @param pDC Pointer to pWndOwner device context. * @param pWndOwner Pointer the child of the parent window to draw * transparent. * @param bmpSnapshot Bitmap used to store transparent background. * @return * TRUE if the area was dran transparently, otherwise returns FALSE. * @see * TakeSnapShot */ BOOL DrawTransparentBack(CDC* pDC, CWnd* pWndOwner, CBitmap& bmpSnapshot); /** * @brief * Determines if top level parent is active for window handle * @param hWnd Window handle to test * @return * TRUE if top level parent is active. */ static BOOL AFX_CDECL IsTopParentActive(HWND hWnd); /** * @brief * Call this member function to switch Left and Right keys if window * in Right To Left layout * @param pWnd Window to test * @param nChar Virtual key, passed to OnKeyDown member. * @return */ static void AFX_CDECL KeyToLayout(CWnd* pWnd, UINT& nChar); /** * @brief * Converts the screen coordinates of a given point on the display to window coordinates. * @param pWnd window whose area is used for the conversion * @param lpPoint Points to a CPoint object or POINT structure that contains the screen * coordinates to be converted. * @return */ static void AFX_CDECL ScreenToWindow(CWnd* pWnd, LPPOINT lpPoint); static DWORD AFX_CDECL GetLayout(CDC* pDC); static DWORD AFX_CDECL GetLayout(HDC hDC); static DWORD AFX_CDECL SetLayout(CDC* pDC, DWORD dwLayout); static DWORD AFX_CDECL SetLayout(HDC hDC, DWORD dwLayout); /** * @brief * Determines if layout of a device context right to left. * @param pDC Device context to test * @return True if layout is right-to-left, false if not */ static BOOL AFX_CDECL IsContextRTL(CDC* pDC); /** * @brief * Determines if layout of a device context right to left. * @param hDC Device context to test * @return True if layout is right-to-left, false if not */ static BOOL AFX_CDECL IsContextRTL(HDC hDC); /** * @brief * Call this method to set right to left layout for device context * @param pDC Device context to set layout * @param dwLayoutRTL Layout flags to be passed to SetLayout GDI function. * @return */ static void AFX_CDECL SetContextRTL(CDC* pDC, DWORD dwLayoutRTL); /** * @brief * Call this method to set right to left layout for device context * @param hDC Device context to set layout * @param dwLayoutRTL Layout flags to be passed to SetLayout GDI function. * @return */ static void AFX_CDECL SetContextRTL(HDC hDC, DWORD dwLayoutRTL); /** * @brief * Determines if window has right-to-left layout. * @param pWnd Window handle to test * @return True if window has right-to-left layout, false if not */ static BOOL AFX_CDECL IsWindowRTL(CWnd* pWnd); /** * @brief * Determines if window has right-to-left layout. * @param hWnd Window handle to test * @return True if window has right-to-left layout, false if not */ static BOOL AFX_CDECL IsWindowRTL(HWND hWnd); /** * @brief * Determines if window has vertical scroll bar on the left side. * @param pWnd Window handle to test * @return True if scroll bar on left, false if not */ static BOOL AFX_CDECL IsVScrollOnTheLeft(CWnd* pWnd); /** * @brief * Determines if window has vertical scroll bar on the left side. * @param hWnd Window handle to test * @return True if scroll bar on left, false if not */ static BOOL AFX_CDECL IsVScrollOnTheLeft(HWND hWnd); /** * @brief * Register class helper. * @param hInstance Handle to the instance that contains the window procedure for the class. * @param lpszClassName Pointer to a null-terminated string or is an atom * @param style Specifies the class style(s). * @param hIcon Handle to the class icon * @param hbrBackground Handle to the class background brush. * @return TRUE if window class is successfully registered, FALSE otherwise. */ static BOOL AFX_CDECL RegisterWndClass(HINSTANCE hInstance, LPCTSTR lpszClassName, UINT style, HICON hIcon = 0, HBRUSH hbrBackground = 0); /** * @brief * Copies the CWnd caption title (if it has one) into the destination * string strWindowText. * @param hWnd Handle to the window or control containing the text. * @param strWindowText A CString object that is to receive the copied string * of the window's title. * @return */ static void AFX_CDECL GetWindowCaption(HWND hWnd, CString& strWindowText); /** * @brief * Call this function to render a color rectangle with a border. * @param pDC Pointer to a valid device context. * @param rColor Size of the color rectangle to draw. * @param clrFill Background color for the rectangle. * @param clrBorder Border color for the rectangle. * @return */ static void AFX_CDECL DrawColorRect(CDC* pDC, CRect rColor, COLORREF clrFill, COLORREF clrBorder); /** * @brief * Call this function to render a color rectangle with a border. * @param pDC Pointer to a valid device context. * @param l Left edge of the rectangle. * @param t Top edge of the rectangle. * @param cx Width of the rectangle. * @param cy Height of the rectangle. * @param clrFill Background color for the rectangle. * @param clrBorder Border color for the rectangle. * @return */ static void AFX_CDECL DrawColorRect(CDC* pDC, int l, int t, int cx, int cy, COLORREF clrFill, COLORREF clrBorder); /** * @brief * Call this function to render a hatch pattern rectangle with a border. * @param pDC Pointer to a valid device context. * @param rColor Size of the hatch rectangle to draw. * @param clrFill Background color for the hatch rectangle. * @param clrBorder Border color for the hatch rectangle. * @return */ static void AFX_CDECL DrawHatchRect(CDC* pDC, CRect rColor, COLORREF clrFill, COLORREF clrBorder); /** * @brief * Call this function to create a pattern brush used for fill. * @param bmp Reference to a bitmap object. * @param brush Reference to a brush object. * @param clrFill Background color for the hatch rectangle. * @param pBitsBrush Pattern defined as a WORD array containing 8 hex * values that represent an 8 x 8 pixel pattern. * @return */ static void AFX_CDECL CreatePatternBrush(CBitmap& bmp, CBrush& brush, COLORREF clrFill, const void* pBitsBrush); /** * @brief * Call this function to render a pattern rectangle with a border. * @param pDC Pointer to a valid device context. * @param rColor Size of the hatch rectangle to draw. * @param clrFill Background color for the hatch rectangle. * @param clrBorder Border color for the hatch rectangle. * @param pBitsBrush Pattern defined as a WORD array containing 8 hex * values that represent an 8 x 8 pixel pattern. * @return */ static void AFX_CDECL DrawBrushRect(CDC* pDC, CRect rColor, COLORREF clrFill, COLORREF clrBorder, const void* pBitsBrush); /** * @brief * Computes font height such that the string provided fits the specified * rectangle as tight as possible. * @param pDC Pointer to a valid device context. * @param lpStr Pointer to a string which is to be fitted into the specified * rectangle. * @param cch Number of characters to use from the string provided, or * -1 to compute the length of the string. * @param rc Rectangle to contain the string specified. * @param fntTest Font used to draw the text specified. Font height is ignored. * Font width has to be 0. * @return * If successful, the return value is the height of the font necessary to fit the * specified rectangle as tight as possible. Otherwise, the return value is 0. */ static int ComputeFittingFontHeight(CDC* pDC, LPCTSTR lpStr, int cch, const CRect& rc, CFont& fntTest); /** * @brief * Draws a stretched image from an image list. * @param pDC Pointer to a valid device context where the image is * to be drawn to. * @param rcDest Destination rectangle. * @param pImageList A valid image list pointer. * @param nImage Image index to draw. * @return * TRUE is the image is drawn successfully, otherwise FALSE. */ static BOOL AFX_CDECL StretchImageListImage(CDC* pDC, CRect rcDest, CImageList* pImageList, int nImage); /** * @brief * Processes all pending WM_PAINT message in the message queue of the calling * thread. Ensures the painting never causes deadlock. * @param hWnd Window handle for which the painting messages have to be processed, * or NULL to process painting message for all thread windows. * @return * FALSE if message loop is broken due to either WM_QUIT or error in GetMessage. */ static BOOL AFX_CDECL ProcessPendingPaintMessages(HWND hWnd = NULL); /** @cond */ _XTP_DEPRECATED_IN_FAVOR2(XTPSystemVersion, GetComCtlVersion) static DWORD AFX_CDECL GetComCtlVersion(); _XTP_DEPRECATED_IN_FAVOR2(XTPMultiMonitor, GetWorkArea) static CRect AFX_CDECL GetWorkArea(); _XTP_DEPRECATED_IN_FAVOR2(XTPMultiMonitor, GetWorkArea) static CRect AFX_CDECL GetWorkArea(const POINT& point); _XTP_DEPRECATED_IN_FAVOR2(XTPMultiMonitor, GetWorkArea) static CRect AFX_CDECL GetWorkArea(LPCRECT rect); _XTP_DEPRECATED_IN_FAVOR2(XTPMultiMonitor, GetWorkArea) static CRect AFX_CDECL GetWorkArea(const CWnd* pWnd); _XTP_DEPRECATED_IN_FAVOR2(XTPMultiMonitor, GetScreenArea) static CRect AFX_CDECL GetScreenArea(const CWnd* pWnd); /** @endcond */ private: /** * @brief * Auxiliary function for color convertion from HSL to RGB color model. * @param m1 Input value. * @param m2 Input value. * @param h Input value. * @return * A converted value * @see * RGBtoHSL */ static int AFX_CDECL HueToRGB(int m1, int m2, int h); static double AFX_CDECL HueToRGB(double temp1, double temp2, double temp3); public: PFNALPHABLEND m_pfnAlphaBlend; PFNTRANSPARENTBLT m_pfnTransparentBlt; PFNGRADIENTFILL m_pfnFastGradientFill; private: HMODULE m_hMsImgDll; /**< Handle to MsImg32.dll. */ // private members used for draw routines. void GradientFillFast(CDC* pDC, LPCRECT lpRect, COLORREF crFrom, COLORREF crTo, BOOL bHorz); void GradientFillSlow(CDC* pDC, LPCRECT lpRect, COLORREF crFrom, COLORREF crTo, BOOL bHorz); // singleton friend _XTP_EXT_CLASS CXTPDrawHelpers* AFX_CDECL XTPDrawHelpers(); // Used to access the // CXTPDrawHelpers object. }; /** * @brief * CXTPNoFlickerWnd is a TBase derived general purpose template * helper class. The CXTPNoFlickerWnd class is used for drawing * flicker free controls. To use, instantiate the template using * any CWnd derived class. For example, to create a tab control * that is flicker free you would use the following declaration: * * Example: * The following example demonstrates how to use CXTPNoFlickerWnd * to create a flicker free object. *
 * CXTPNoFlickerWnd \ m_tabCtrl;
 * 
*/ template class CXTPNoFlickerWnd : public TBase { public: /** * @brief * Constructs a CXTPNoFlickerWnd object. */ CXTPNoFlickerWnd() { m_crBack = ::GetSysColor(COLOR_3DFACE); } public: /** * @brief * This member function is called to set the background fill * color for the flicker free control. * @param crBack An RGB value. */ void SetBackColor(COLORREF crBack) { m_crBack = crBack; } /** * @brief * This member function is called to retrieve the background * fill color for the flicker free control. * @return * An RGB value. */ COLORREF GetBackColor() { return m_crBack; } /** * @brief * This method provides a CE procedure (WindowProc) for a CWnd * object. It dispatches messages through the window message * map. The return value depends on the message. * @param message Specifies the Windows message to be processed. * @param wParam Provides additional information used in processing * the message. The parameter value depends on the * message. * @param lParam Provides additional information used in processing * the message. The parameter value depends on the * message. * @return * An LRESULT object. */ virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_PAINT: { CPaintDC dc(this); // Get the client rect and paint to a memory device context. // This will help reduce screen flicker. Pass the memory // device context to the default window procedure to do // default painting. CRect rc; TBase::GetClientRect(&rc); CXTPBufferDC memDC(dc.GetSafeHdc(), rc); memDC.FillSolidRect(rc, m_crBack); return TBase::DefWindowProc(WM_PAINT, (WPARAM)memDC.m_hDC, 0); } case WM_ERASEBKGND: { return TRUE; } } return TBase::WindowProc(message, wParam, lParam); } protected: COLORREF m_crBack; /**< An RGB value. */ }; /** @cond */ _XTP_EXT_CLASS COLORREF AFX_CDECL XTPOfficeBorder_GetBorderColor(bool bTopLeft); _XTP_EXT_CLASS void AFX_CDECL XTPOfficeBorder_OnPaint(CWnd* pWnd, COLORREF clr1, COLORREF clr2); /** @endcond */ /** * @brief * CXTPOfficeBorder is a template class used for windows that requires * a thin border. This class can be used as the base class for any * CWnd derived class to display an Office style, non-client border. * @param TBase Object class name. * @param bCalcSize true to remove non-client edge and adjust borders to 1 pixel, * false to only draw 1 pixel border. * * Example: * Sample code demonstrates how to use the CXTPOfficeBorder template * class with your base class. *
 * class CTreeCtrlEx : public CXTPOfficeBorder
 * {
 *    ...
 * };
 *       
* Sample code demonstrates how to use the CXTPOfficeBorder template * class with a member variable. *
 * class CMyView : public CView
 * {
 *    ...
 *    protected:
 *    CXTPOfficeBorder m_edit;
 * };
 * 
*/ template class CXTPOfficeBorder : public TBase { protected: /** * @brief * Call this function to return the color used for drawing non-client * Office style borders for the active current theme. * @param bTopLeft true to return the top-left border color, * false to return the bottom-right border color. * @return * An RGB color value that represents the non-client border color. */ virtual COLORREF GetBorderColor(bool bTopLeft) const { return XTPOfficeBorder_GetBorderColor(bTopLeft); } /** @cond */ virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_NCPAINT: { TBase::WindowProc(message, wParam, lParam); XTPOfficeBorder_OnPaint(this, GetBorderColor(true), GetBorderColor(false)); return 0; // Handled. } case WM_CREATE: { if (TBase::WindowProc(message, wParam, lParam) == -1) return -1; # if (_MSC_VER > 1300) # pragma warning(push) # pragma warning(disable : 4127) // conditional expression is constant # endif if (bCalcSize) # if (_MSC_VER > 1300) # pragma warning(pop) # endif { // remove 3D borders. long lStyle = ::GetWindowLong(TBase::m_hWnd, GWL_STYLE) & ~WS_BORDER; ::SetWindowLong(TBase::m_hWnd, GWL_STYLE, lStyle); long lExStyle = ::GetWindowLong(TBase::m_hWnd, GWL_EXSTYLE) & ~WS_EX_CLIENTEDGE; ::SetWindowLong(TBase::m_hWnd, GWL_EXSTYLE, lExStyle); // force non-client area to be recalculated. ::SetWindowPos(TBase::m_hWnd, NULL, NULL, NULL, NULL, NULL, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); } return 0; // Handled. } break; case WM_NCCALCSIZE: { LRESULT lResult = TBase::WindowProc(message, wParam, lParam); # if (_MSC_VER > 1300) # pragma warning(push) # pragma warning(disable : 4127) // conditional expression is constant # endif if (bCalcSize) # if (_MSC_VER > 1300) # pragma warning(pop) # endif { NCCALCSIZE_PARAMS FAR* lpncsp = (NCCALCSIZE_PARAMS FAR*)lParam; // adjust non-client area for border space lpncsp->rgrc[0].left += 1; lpncsp->rgrc[0].top += 1; lpncsp->rgrc[0].right -= 1; lpncsp->rgrc[0].bottom -= 1; } return lResult; } } return TBase::WindowProc(message, wParam, lParam); } /** @endcond */ }; /** * @brief * Call this function to access CXTPDrawHelpers 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 CXTPDrawHelpers. * * Example: *
BOOL bLowRes = XTPDrawHelpers()->IsLowResolution();
* @return A global draw helper object pointer. */ _XTP_EXT_CLASS CXTPDrawHelpers* AFX_CDECL XTPDrawHelpers(); /** * @brief * Prepares a printer device context for printing and calculates * DEVMODE and DEVNAMES values. * @param ref_hDevMode Reference to a handle of a movable global memory object * that contains a DEVMODE structure. * @param ref_hDevNames Reference to a handle of a movable global memory object * that contains a DEVNAMES structure. * @return * Nonzero if successful, otherwise 0. * @see * CWinApp::GetPrinterDeviceDefaults, DEVMODE, DEVNAMES */ _XTP_EXT_CLASS BOOL AFX_CDECL XTPGetPrinterDeviceDefaults(HGLOBAL& ref_hDevMode, HGLOBAL& ref_hDevNames); /** * @brief * Helper class which provides currently selected printer information. */ class _XTP_EXT_CLASS CXTPPrinterInfo : public CXTPCmdTarget { /** @cond */ DECLARE_DYNAMIC(CXTPPrinterInfo) /** @endcond */ public: /** * @brief * Default object constructor. * @see * ~CXTPPrinterInfo */ CXTPPrinterInfo(); /** * @brief * Default object destructor. * @see * CXTPPrinterInfo */ virtual ~CXTPPrinterInfo(); /** * @brief * This enum defines some printer properties IDs. * @see * GetName */ enum XTPEnumDeviceName { xtpDevName_Driver = 0, /**< Define Driver name property. */ xtpDevName_Device = 1, /**< Define Device name property. */ xtpDevName_Port = 2 /**< Define Port name property. */ }; /** * @brief * Call this member function to retrieve the currently selected printer * Driver name, Device name, or Port name. * @param eNameID [in] A value from XTPEnumDeviceName enum which specifies * the property. * @return * A string with the requested name. * @see * XTPEnumDeviceName */ CString GetName(XTPEnumDeviceName eNameID); protected: /** * @brief * This member function retrieves name offset by name ID. * @param pDevNames [in] A pointer to a DEVNAMES structure. * @param eNameID [in] Name ID. * @return * Name offset in chars. * @see * XTPEnumDeviceName, DEVNAMES */ WORD _GetNameOffset(LPDEVNAMES pDevNames, XTPEnumDeviceName eNameID); # ifdef _XTP_ACTIVEX /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPPrinterInfo); afx_msg BSTR OleGetDeviceName(); afx_msg BSTR OleGetDriverName(); afx_msg BSTR OleGetPortName(); /** @endcond */ # endif }; /** * @brief * This class is used to define a printed page header or footer. * Also some calculation and drawing functionalities are provided. * Used as a member of printing options. * @see * CXTPPrintOptions */ class _XTP_EXT_CLASS CXTPPrintPageHeaderFooter : public CXTPCmdTarget { /** @cond */ friend class CXTPPrintOptions; DECLARE_DYNAMIC(CXTPPrintPageHeaderFooter) /** @endcond */ public: /** * @brief * Object constructor. * @param pOwner A pointer to the owner object. * @param bHeader TRUE if the object represents a header, * FALSE if the object represents a footer. * @see * CXTPPrintOptions */ CXTPPrintPageHeaderFooter(CXTPPrintOptions* pOwner, BOOL bHeader); /** * @brief * Default object destructor. * @see * CXTPPrintPageHeaderFooter */ virtual ~CXTPPrintPageHeaderFooter(); /** * @brief * Call this member function to format a header or footer using * the format string specified in the m_strFormatString member. * The formatted text is copied into the following members: * m_strLeft, m_strCenter, m_strRight. * If m_strFormatString is empty, then this function does nothing. * @param pInfo [in] Printing context. * @param pcszWndTitle [in] Pointer to window title (for &w format string specifier). * @param nVirtualPage int number of page (e.g. in horizontal direction for wide data) * @details * FormatTexts should be called before Draw call. Format specifiers * are the same as in Internet Explorer: * * &d: Date in short format (as specified by Regional Settings * in Control Panel). * &D: Date in long format (as specified by Regional Settings * in Control Panel). * * &t: Time in the format specified by Regional Settings in Control Panel. * &T: Time in 24-hour format. * * &p: Current page number. * &P: Total number of pages. * * &b: The text immediately following these characters as centered. * &b&b: The text immediately following the first "&b" as centered, and * the text following the second "&b" as right-justified. * * &w: Window title. * * &&: A single ampersand (&). * \\n: New line marker. * * @see * m_strFormatString, m_strLeft, m_strCenter, m_strRight */ virtual void FormatTexts(CPrintInfo* pInfo, LPCTSTR pcszWndTitle, int nVirtualPage = 0); /** * @brief * Call this member function to draw a header or footer on the device context. * @param pDC [in] A pointer to a device context. * @param rcRect [in, out] A reference to a bounding rectangle. * After the function call, this member contains a rect * necessary to draw a header or footer. A header * is aligned to the top of the passed bounding rectangle, * while a footer is aligned to the bottom. * @param bCalculateOnly TRUE to calculate the rectangle without drawing. * @see * FormatTexts, m_strLeft, m_strCenter, m_strRight */ virtual void Draw(CDC* pDC, CRect& rcRect, BOOL bCalculateOnly = FALSE); /** * @brief * Call this member function to copy members from a specified source object. * @param pSrc A pointer to the source object to copy data from. * @see * Clear */ virtual void Set(const CXTPPrintPageHeaderFooter* pSrc); /** * @brief * Call this member function to clear all members' values. * @see * Set */ virtual void Clear(); /** * @brief * Checks if all strings are empty. * @return * TRUE if all strings are empty. */ virtual BOOL IsEmpty(); LOGFONT m_lfFont; /**< Font details. */ COLORREF m_clrColor; /**< Text color. */ CString m_strFormatString; /**< Text as Format string. */ CString m_strLeft; /**< A string to show with left align. */ CString m_strCenter; /**< A string to show with center align. */ CString m_strRight; /**< A string to show with right align. */ /** @cond */ static CString AFX_CDECL GetParentFrameTitle(CWnd* pWnd); static void AFX_CDECL DoInsertHFFormatSpecifierViaMenu(CWnd* pParent, CEdit* pEdit, CButton* pButton); /** @endcond */ protected: BOOL m_bHeader; /**< If TRUE, the object represents a Header. Otherwise footer. */ CXTPPrintOptions* m_pOwner; /**< Store pointer to owner object. */ /** @cond */ virtual int Calc3ColSizes(CDC* pDC, int nW, const CString& str1, const CString& str2, const CString& str3, CSize& rsz1, CSize& rsz2, CSize& rsz3); virtual int _Calc3ColSizesIfSingleCol(CDC* pDC, int nW, const CString& str1, const CString& str2, const CString& str3, CSize& rsz1, CSize& rsz2, CSize& rsz3); virtual void _SplitFormatLCR(CString strFormat); virtual void _FormatDateTime(CString& strFormat, LCID lcidLocale); /** @endcond */ # ifdef _XTP_ACTIVEX /** @cond */ afx_msg LPFONTDISP OleGetFont(); afx_msg void OleSetFont(LPFONTDISP pFontDisp); afx_msg void OleClear(); DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPPrintPageHeaderFooter); /** @endcond */ # endif private: int fnYi(int Xi, int Wi); }; /** * @brief * Obtains a native handle of a specified object. * @param pDC Pointer to a device context. * @return * A native handle value. */ AFX_INLINE HDC XTPGetHandle(CDC* pDC) { _ASSERTE(NULL != pDC); return pDC->m_hDC; } /** * @brief * Obtains a native handle of a specified object. * @param dc Reference to a device context. * @return * A native handle value. */ AFX_INLINE HDC XTPGetHandle(CDC& dc) { return dc.m_hDC; } /** * @brief * Obtains a native handle of a specified object. * @param hDC Handle to a device context. * @return * A native handle value. */ AFX_INLINE HDC XTPGetHandle(HDC hDC) { return hDC; } /** * @brief * Specifies process DPI awareness level. Refer to platform SDK * documentation for its analogue called PROCESS_DPI_AWARENESS. */ enum XTPDpiAwareness { xtpDpiUnaware = 0, /**< Same as PROCESS_DPI_AWARENESS::PROCESS_DPI_UNAWARE. */ xtpDpiSystemAware = 1, /**< Same as PROCESS_DPI_AWARENESS::PROCESS_SYSTEM_DPI_AWARE. */ xtpDpiPerMonitorAware = 2 /**< Same as PROCESS_DPI_AWARENESS::PROCESS_PER_MONITOR_DPI_AWARE. */ }; /** * @brief * This helper class is used in drawing when DPI is different than 96. * @details * relative pixel = 1 pixel at 96 DPI and scaled based on actual DPI. * * Original code comes from: * http://msdn.microsoft.com/en-us/library/windows/desktop/dd464660(v=vs.85).aspx */ class _XTP_EXT_CLASS CXTPDpi { friend class CXTPSingleton; public: enum { DefaultDpi = 96 // Normal DPI. }; /** * @brief * Constructs a DPI helper object that works with global DPI settings. */ CXTPDpi(); /** * @brief * Constructs a DPI helper object that works with the * provided device context's settings. * @param hDC Device context with DPI settings to be used. */ CXTPDpi(HDC hDC); /** * @brief * Constructs a DPI helper object that works with the * provided window's device context's settings. * @param hWnd Window handle with DPI settings to be used. */ CXTPDpi(HWND hWnd); /** * @brief * Handles object destruction. */ ~CXTPDpi(); /** * @brief * Sets process DPI awareness level. Whenever possible, prefer setting * DPI awareness level in the application's manifest file. Refer to * platform SDK's documentation for SetProcessDpiAwareness and * SetProcessDpiAware details and supported OS versions. * @param dpiAwareness DPI awareness level that is to be set only if * it is supported by the OS. * @return * TRUE if successful. */ BOOL SetDpiAwareness(XTPDpiAwareness dpiAwareness); /** * @brief * Obtains process DPI awareness level if possible. Refer to platform * SDK's documentation for GetProcessDpiAwareness details * and supported OS versions. * @return * DPI awareness level enabled for the calling process. */ XTPDpiAwareness GetDpiAwareness() const; /** * @brief * Processes a DPI related message. Must not be called for DPI helper * objects specific to a device context or window handle. * @param hWnd Window handle. * @param message Message code. * @param wParam Message argument. * @param lParam Message argument. * @param pResult Pointer to the result of message processing. * @return * TRUE if the message has been processed. */ BOOL OnWndMsg(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult); /** * @brief * Obtains horizontal DPI values for the system, device * context, or window handle. * @return * DPI values. */ int GetDPIX() const; /** * @brief * Obtains vertical DPI values for the system, device * context, or window handle. * @return * DPI values. */ int GetDPIY() const; /** * @brief * Determines if system, device context, or window handle DPI settings are default. * @return * TRUE if DPI setting are default for the target context. */ BOOL IsDefaultDpiX() const; /** * @brief * Determines if system, device context, or window handle DPI settings are default. * @return * TRUE if DPI setting are default for the target context. */ BOOL IsDefaultDpiY() const; /** * @brief * Determines if system, device context, or window handle DPI settings are default. * @return * TRUE if DPI setting are default for the target context. */ BOOL IsDefaultDpi() const; /** * @brief * Gets global global DPI bitmap scaling flag for the current process. * The controls can use this value as a default value for a control specific * DPI bitmap flag flag. * @return * The current value of the bitmap scaling flag. */ BOOL IsDpiBitmapScalingEnabled() const; /** * @brief * Sets global global DPI bitmap scaling flag for the current process. * The controls can use this value as a default value for a control specific * DPI bitmap flag flag. * @param bEnable TRUE to enable bitmaps scaling, FALSE to disable. */ void EnableDpiBitmapScaling(BOOL bEnable = TRUE); /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param x X-coordinate to scale/unscale using current horizontal DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ int ScaleX(int x, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param y Y-coordinate to scale/unscale using current vertical DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ int ScaleY(int y, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param x X-coordinate to scale/unscale using current horizontal DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ long ScaleX(long x, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param y Y-coordinate to scale/unscale using current vertical DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ long ScaleY(long y, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param x X-coordinate to scale/unscale using current horizontal DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ float ScaleX(float x, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param y Y-coordinate to scale/unscale using current vertical DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ float ScaleY(float y, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param x X-coordinate to scale/unscale using current horizontal DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ double ScaleX(double x, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param y Y-coordinate to scale/unscale using current vertical DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ double ScaleY(double y, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param x X-coordinate to scale/unscale using current horizontal DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ unsigned int ScaleX(unsigned int x, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param y Y-coordinate to scale/unscale using current vertical DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ unsigned int ScaleY(unsigned int y, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param x X-coordinate to scale/unscale using current horizontal DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ int UnscaleX(int x, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param y Y-coordinate to scale/unscale using current vertical DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ int UnscaleY(int y, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param x X-coordinate to scale/unscale using current horizontal DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ long UnscaleX(long x, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param y Y-coordinate to scale/unscale using current vertical DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ long UnscaleY(long y, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param x X-coordinate to scale/unscale using current horizontal DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ float UnscaleX(float x, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param y Y-coordinate to scale/unscale using current vertical DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ float UnscaleY(float y, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param x X-coordinate to scale/unscale using current horizontal DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ double UnscaleX(double x, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param y Y-coordinate to scale/unscale using current vertical DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ double UnscaleY(double y, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param x X-coordinate to scale/unscale using current horizontal DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ unsigned int UnscaleX(unsigned int x, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param y Y-coordinate to scale/unscale using current vertical DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ unsigned int UnscaleY(unsigned int y, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param x X-coordinate to scale/unscale using current horizontal DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ int ScaleX(HDC hDC, int x, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param y Y-coordinate to scale/unscale using current vertical DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ int ScaleY(HDC hDC, int y, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param x X-coordinate to scale/unscale using current horizontal DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ long ScaleX(HDC hDC, long x, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param y Y-coordinate to scale/unscale using current vertical DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ long ScaleY(HDC hDC, long y, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param x X-coordinate to scale/unscale using current horizontal DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ float ScaleX(HDC hDC, float x, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param y Y-coordinate to scale/unscale using current vertical DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ float ScaleY(HDC hDC, float y, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param x X-coordinate to scale/unscale using current horizontal DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ double ScaleX(HDC hDC, double x, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param y Y-coordinate to scale/unscale using current vertical DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ double ScaleY(HDC hDC, double y, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param x X-coordinate to scale/unscale using current horizontal DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ unsigned int ScaleX(HDC hDC, unsigned int x, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param y Y-coordinate to scale/unscale using current vertical DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ unsigned int ScaleY(HDC hDC, unsigned int y, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param x X-coordinate to scale/unscale using current horizontal DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ int UnscaleX(HDC hDC, int x, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param y Y-coordinate to scale/unscale using current vertical DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ int UnscaleY(HDC hDC, int y, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param x X-coordinate to scale/unscale using current horizontal DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ long UnscaleX(HDC hDC, long x, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param y Y-coordinate to scale/unscale using current vertical DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ long UnscaleY(HDC hDC, long y, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param x X-coordinate to scale/unscale using current horizontal DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ float UnscaleX(HDC hDC, float x, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param y Y-coordinate to scale/unscale using current vertical DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ float UnscaleY(HDC hDC, float y, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param x X-coordinate to scale/unscale using current horizontal DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ double UnscaleX(HDC hDC, double x, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param y Y-coordinate to scale/unscale using current vertical DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ double UnscaleY(HDC hDC, double y, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param x X-coordinate to scale/unscale using current horizontal DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ unsigned int UnscaleX(HDC hDC, unsigned int x, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param y Y-coordinate to scale/unscale using current vertical DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ unsigned int UnscaleY(HDC hDC, unsigned int y, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pRect A pointer to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void ScaleRect(RECT* pRect, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param rc A reference to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ RECT ScaleRect(const RECT& rc, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pRect A pointer to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void UnscaleRect(RECT* pRect, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param rc A reference to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ RECT UnscaleRect(const RECT& rc, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pRect A pointer to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void Scale(RECT* pRect, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param rc A reference to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ RECT Scale(const RECT& rc, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pRect A pointer to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void Unscale(RECT* pRect, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param rc A reference to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ RECT Unscale(const RECT& rc, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pRect A pointer to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void ScaleRect(CRect* pRect, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param rc A reference to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ CRect ScaleRect(const CRect& rc, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pRect A pointer to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void UnscaleRect(CRect* pRect, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param rc A reference to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ CRect UnscaleRect(const CRect& rc, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pRect A pointer to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void Scale(CRect* pRect, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param rc A reference to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ CRect Scale(const CRect& rc, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pRect A pointer to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void Unscale(CRect* pRect, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param rc A reference to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ CRect Unscale(const CRect& rc, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pRect A pointer to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void ScaleRect(HDC hDC, RECT* pRect, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param rc A reference to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ RECT ScaleRect(HDC hDC, const RECT& rc, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pRect A pointer to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void UnscaleRect(HDC hDC, RECT* pRect, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param rc A reference to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ RECT UnscaleRect(HDC hDC, const RECT& rc, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pRect A pointer to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void Scale(HDC hDC, RECT* pRect, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param rc A reference to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ RECT Scale(HDC hDC, const RECT& rc, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pRect A pointer to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void Unscale(HDC hDC, RECT* pRect, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param rc A reference to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ RECT Unscale(HDC hDC, const RECT& rc, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pRect A pointer to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void ScaleRect(HDC hDC, CRect* pRect, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param rc A reference to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ CRect ScaleRect(HDC hDC, const CRect& rc, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pRect A pointer to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void UnscaleRect(HDC hDC, CRect* pRect, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param rc A reference to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ CRect UnscaleRect(HDC hDC, const CRect& rc, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pRect A pointer to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void Scale(HDC hDC, CRect* pRect, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param rc A reference to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ CRect Scale(HDC hDC, const CRect& rc, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pRect A pointer to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void Unscale(HDC hDC, CRect* pRect, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param rc A reference to a rectangle object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ CRect Unscale(HDC hDC, const CRect& rc, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pPoint A pointer to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void ScalePoint(POINT* pPoint, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pt A reference to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ POINT ScalePoint(const POINT& pt, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pPoint A pointer to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void UnscalePoint(POINT* pPoint, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pt A reference to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ POINT UnscalePoint(const POINT& pt, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pPoint A pointer to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void Scale(POINT* pPoint, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pt A reference to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ POINT Scale(const POINT& pt, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pPoint A pointer to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void Unscale(POINT* pPoint, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pt A reference to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ POINT Unscale(const POINT& pt, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pPoint A pointer to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void ScalePoint(CPoint* pPoint, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pt A reference to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ CPoint ScalePoint(const CPoint& pt, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pPoint A pointer to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void UnscalePoint(CPoint* pPoint, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pt A reference to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ CPoint UnscalePoint(const CPoint& pt, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pPoint A pointer to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void Scale(CPoint* pPoint, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pt A reference to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ CPoint Scale(const CPoint& pt, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pPoint A pointer to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void Unscale(CPoint* pPoint, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pt A reference to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ CPoint Unscale(const CPoint& pt, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pPoint A pointer to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void ScalePoint(HDC hDC, POINT* pPoint, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pt A reference to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ POINT ScalePoint(HDC hDC, const POINT& pt, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pPoint A pointer to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void UnscalePoint(HDC hDC, POINT* pPoint, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pt A reference to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ POINT UnscalePoint(HDC hDC, const POINT& pt, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pPoint A pointer to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void Scale(HDC hDC, POINT* pPoint, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pt A reference to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ POINT Scale(HDC hDC, const POINT& pt, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pPoint A pointer to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void Unscale(HDC hDC, POINT* pPoint, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pt A reference to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ POINT Unscale(HDC hDC, const POINT& pt, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pPoint A pointer to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void ScalePoint(HDC hDC, CPoint* pPoint, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pt A reference to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ CPoint ScalePoint(HDC hDC, const CPoint& pt, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pPoint A pointer to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void UnscalePoint(HDC hDC, CPoint* pPoint, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pt A reference to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ CPoint UnscalePoint(HDC hDC, const CPoint& pt, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pPoint A pointer to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void Scale(HDC hDC, CPoint* pPoint, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pt A reference to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ CPoint Scale(HDC hDC, const CPoint& pt, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pPoint A pointer to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void Unscale(HDC hDC, CPoint* pPoint, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pt A reference to a point object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ CPoint Unscale(HDC hDC, const CPoint& pt, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pSize A pointer to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void ScaleSize(SIZE* pSize, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param sz A reference to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ SIZE ScaleSize(const SIZE& sz, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pSize A pointer to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void UnscaleSize(SIZE* pSize, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param sz A reference to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ SIZE UnscaleSize(const SIZE& sz, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pSize A pointer to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void Scale(SIZE* pSize, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param sz A reference to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ SIZE Scale(const SIZE& sz, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pSize A pointer to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void Unscale(SIZE* pSize, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param sz A reference to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ SIZE Unscale(const SIZE& sz, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pSize A pointer to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void ScaleSize(CSize* pSize, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param sz A reference to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ CSize ScaleSize(const CSize& sz, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pSize A pointer to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void UnscaleSize(CSize* pSize, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param sz A reference to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ CSize UnscaleSize(const CSize& sz, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pSize A pointer to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void Scale(CSize* pSize, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param sz A reference to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ CSize Scale(const CSize& sz, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param pSize A pointer to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void Unscale(CSize* pSize, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param sz A reference to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ CSize Unscale(const CSize& sz, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pSize A pointer to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void ScaleSize(HDC hDC, SIZE* pSize, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param sz A reference to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ SIZE ScaleSize(HDC hDC, const SIZE& sz, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pSize A pointer to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void UnscaleSize(HDC hDC, SIZE* pSize, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param sz A reference to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ SIZE UnscaleSize(HDC hDC, const SIZE& sz, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pSize A pointer to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void Scale(HDC hDC, SIZE* pSize, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param sz A reference to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ SIZE Scale(HDC hDC, const SIZE& sz, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pSize A pointer to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void Unscale(HDC hDC, SIZE* pSize, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param sz A reference to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ SIZE Unscale(HDC hDC, const SIZE& sz, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pSize A pointer to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void ScaleSize(HDC hDC, CSize* pSize, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param sz A reference to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ CSize ScaleSize(HDC hDC, const CSize& sz, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pSize A pointer to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void UnscaleSize(HDC hDC, CSize* pSize, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param sz A reference to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ CSize UnscaleSize(HDC hDC, const CSize& sz, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pSize A pointer to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void Scale(HDC hDC, CSize* pSize, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param sz A reference to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ CSize Scale(HDC hDC, const CSize& sz, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param pSize A pointer to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. */ void Unscale(HDC hDC, CSize* pSize, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Perform scalling/unscalling of X, Y coordinates, rectangle, * size, and point objects according to active DPI settings. * @param hDC Handle to a device context. * @param sz A reference to a size object to scale/unscale using current DPI settings. * @param iDpiScaleAbove Scaled only if current DPI is larger than specified. * @return * Scaled/unscaled value. */ CSize Unscale(HDC hDC, const CSize& sz, int iDpiScaleAbove = CXTPDpi::DefaultDpi) const; /** * @brief * Selects one of the provided values that is specific to the current screen DPI. * @param upToDpi120 The value that is selected if the current DPI is in range [96-120). * @param upToDpi144 The value that is selected if the current DPI is in range [120-144). * @param upToDpi192 The value that is selected if the current DPI is in range [144-192). * @param theLargest The value that is selected if the current DPI is in range [192-*). * @return * An interger representing the scaled screen size according to active DPI settings. */ int SelectDpiSpecific(int upToDpi120, int upToDpi144, int upToDpi192, int theLargest) const; /** * @brief * Selects one of the provided values that is specific to the current screen DPI. * @param upToDpi120 The value that is selected if the current DPI is in range [96-120). * @param upToDpi144 The value that is selected if the current DPI is in range [120-144). * @param upToDpi192 The value that is selected if the current DPI is in range [144-192). * @param theLargest The value that is selected if the current DPI is in range [192-*). * @return * A LPCTSTR value representing the scaled screen size according to active DPI settings. */ LPCTSTR SelectDpiSpecific(LPCTSTR upToDpi120, LPCTSTR upToDpi144, LPCTSTR upToDpi192, LPCTSTR theLargest) const; /** * @brief * Selects one of the provided values that is specific to the current screen DPI. * @param upToDpi120 The value that is selected if the current DPI is in range [96-120). * @param upToDpi144 The value that is selected if the current DPI is in range [120-144). * @param upToDpi192 The value that is selected if the current DPI is in range [144-192). * @param theLargest The value that is selected if the current DPI is in range [192-*). * @return */ void* SelectDpiSpecific(void* upToDpi120, void* upToDpi144, void* upToDpi192, void* theLargest) const; /** * @brief * Scale screen width according to active DPI settings. * @return * Scaled screen size according to active DPI settings. */ int ScaledScreenWidth() const; /** * @brief * Scale screen height according to active DPI settings. * @return * Scaled screen size according to active DPI settings. */ int ScaledScreenHeight() const; /** * @brief * Determines if screen resolution meets minimum requirements in relative pixels. * @param cxMin A minimum acceptable width in pixels. * @param cyMin A minimum acceptable height in pixels. * @return * TRUE if screen resolution meets minimum requirements in relative pixels. */ bool IsResolutionAtLeast(int cxMin, int cyMin) const; /** * @brief * Convert a point size (1/72 of an inch) to raw pixels. * @param pt A point value to convert. * @return * Converted point size. */ int PointsToPixels(int pt) const; /** * @brief * Invalidates any cached metrics. */ void Invalidate(); /** * @brief * Tries to obtain physical scaling factors for a window regardless of window * or process DPI awareness. * @param hWnd Windows handle for which physical scaling factors are to be obtained. * @param xScale Gets set to the horizontal physical scaling factor * upon successful completion. * @param yScale Gets set to the vertical physical scaling factor * upon successful completion. * @return * TRUE if the physical scaling factors are obtained successfully. */ BOOL GetPhysicalWindowScaleFactors(HWND hWnd, double& xScale, double& yScale) const; private: void Construct(HDC hDC = NULL, HWND hWnd = NULL); void Init(int dpiX = 0, int dpiY = 0, BOOL bUpdate = FALSE); void InitDpiAwareness(); int ScaleSystemMetricX(int nIndex) const; int ScaleSystemMetricY(int nIndex) const; LRESULT OnWmCreate(HWND hWnd, WPARAM wParam, LPARAM lParam); LRESULT OnWmDpiChanged(HWND hWnd, WPARAM wParam, LPARAM lParam); private: enum { DpiValueCount = 0x100 }; BOOL m_bInitialized; BOOL m_bSupportsDpiChange; HDC m_hDC; HWND m_hWnd; BOOL m_bReleaseDC; BOOL m_bDpiBitmapScaling; int m_dpiX; int m_dpiY; POINT m_nPositiveDpiValues[DpiValueCount + 1]; POINT m_nNegativeDpiValues[DpiValueCount + 1]; static BOOL m_bDpiAwarenessInitialized; typedef HRESULT(WINAPI* PFNSetProcessDpiAwareness)(XTPDpiAwareness dpiAwareness); typedef HRESULT(WINAPI* PFNGetProcessDpiAwareness)(HANDLE hProcess, XTPDpiAwareness* dpiAwareness); static PFNSetProcessDpiAwareness m_pfnSetProcessDpiAwareness; static PFNGetProcessDpiAwareness m_pfnGetProcessDpiAwareness; typedef BOOL(WINAPI* PFNSetProcessDPIAware)(); static PFNSetProcessDPIAware m_pfnSetProcessDPIAware; static BOOL m_bSetProcessDPIAwareResult; typedef HANDLE(WINAPI* PFNMonitorFromWindow)(HWND hWnd, DWORD dwFlags); static PFNMonitorFromWindow m_pfnMonitorFromWindow; enum MonitorDpiType { xtpEffectiveDpiType = 0, // Same as MONITOR_DPI_TYPE::MDT_EFFECTIVE_DPI. xtpAngularDpiType = 1, // Same as MONITOR_DPI_TYPE::MDT_ANGULAR_DPI. xtpRawDpiType = 2, // Same as MONITOR_DPI_TYPE::MDT_RAW_DPI. xtpDefaultDpiType = xtpEffectiveDpiType // Same as MONITOR_DPI_TYPE::MDT_DEFAULT. }; typedef HRESULT(WINAPI* PFNGetDpiForMonitor)(HANDLE hMonitor, MonitorDpiType dpiType, UINT* dpiX, UINT* dpiY); static PFNGetDpiForMonitor m_pfnGetDpiForMonitor; }; AFX_INLINE BOOL CXTPDpi::IsDpiBitmapScalingEnabled() const { return m_bDpiBitmapScaling; } AFX_INLINE void CXTPDpi::EnableDpiBitmapScaling(BOOL bEnable /*= TRUE*/) { m_bDpiBitmapScaling = bEnable; } /** * @brief * Provides access to a global DPI helper object instance. * @return * A pointer to a global DPI helper object instance. */ _XTP_EXT_CLASS CXTPDpi* AFX_CDECL XTPDpiHelper(); /** * @brief * Helper macros for scaling of x- and y- coordinates, rectangle, * size, and point objects according to active DPI settings. */ # define XTP_DPI_X(n) XTPDpiHelper()->ScaleX(n) /**< @see XTP_DPI_X */ # define XTP_DPI_Y(n) XTPDpiHelper()->ScaleY(n) /**< @see XTP_DPI_X */ # define XTP_DPI(what) XTPDpiHelper()->Scale(what) /**< @see XTP_DPI_X */ # define XTP_DPI_RECT(rc) XTP_DPI(rc) /**< @see XTP_DPI_X */ # define XTP_DPI_POINT(pt) XTP_DPI(pt) /**< @see XTP_DPI_X */ # define XTP_DPI_SIZE(sz) XTP_DPI(sz) /**< @see XTP_DPI_X */ # define XTP_DC_DPI_X(dc, n) \ XTPDpiHelper()->ScaleX(XTPGetHandle(dc), n) /**< @see XTP_DPI_X \ \ \ \ */ # define XTP_DC_DPI_Y(dc, n) \ XTPDpiHelper()->ScaleY(XTPGetHandle(dc), n) /**< @see XTP_DPI_X \ \ \ \ */ # define XTP_DC_DPI(dc, what) \ XTPDpiHelper()->Scale(XTPGetHandle(dc), what) /**< @see XTP_DPI_X */ # define XTP_DC_DPI_RECT(dc, rc) XTP_DC_DPI(dc, rc) /**< @see XTP_DPI_X */ # define XTP_DC_DPI_POINT(dc, pt) XTP_DC_DPI(dc, pt) /**< @see XTP_DPI_X */ # define XTP_DC_DPI_SIZE(dc, sz) XTP_DC_DPI(dc, sz) /**< @see XTP_DPI_X */ /** * @brief * Macro used for unscaling coordinates according to active DPI settings. * @see CXTPDpi::UnscaleX */ # define XTP_UNDPI_X(n) XTPDpiHelper()->UnscaleX(n) /** * @brief * Macro used for unscaling coordinates according to active DPI settings. * @see CXTPDpi::UnscaleY */ # define XTP_UNDPI_Y(n) XTPDpiHelper()->UnscaleY(n) /** * @brief * Macro used for unscaling coordinates according to active DPI settings. * @see CXTPDpi::Unscale */ # define XTP_UNDPI(what) XTPDpiHelper()->Unscale(what) /** * @brief * Macro used for unscaling coordinates according to active DPI settings. * @see CXTPDpi::Unscale */ # define XTP_UNDPI_RECT(rc) XTP_UNDPI(rc) /** * @brief * Macro used for unscaling coordinates according to active DPI settings. * @see CXTPDpi::Unscale */ # define XTP_UNDPI_POINT(pt) XTP_UNDPI(pt) /** * @brief * Macro used for unscaling coordinates according to active DPI settings. * @see CXTPDpi::Unscale */ # define XTP_UNDPI_SIZE(sz) XTP_UNDPI(sz) /** * @brief * Macro used for unscaling coordinates according to active DPI settings. * @see CXTPDpi::UnscaleX */ # define XTP_DC_UNDPI_X(dc, n) XTPDpiHelper()->UnscaleX(XTPGetHandle(dc), n) /** * @brief * Macro used for unscaling coordinates according to active DPI settings. * @see CXTPDpi::UnscaleY */ # define XTP_DC_UNDPI_Y(dc, n) XTPDpiHelper()->UnscaleY(XTPGetHandle(dc), n) /** * @brief * Macro used for unscaling coordinates according to active DPI settings. * @see CXTPDpi::Unscale */ # define XTP_DC_UNDPI(dc, what) XTPDpiHelper()->Unscale(XTPGetHandle(dc), what) /** * @brief * Macro used for unscaling coordinates according to active DPI settings. * @see CXTPDpi::Unscale */ # define XTP_DC_UNDPI_RECT(dc, rc) XTP_DC_UNDPI(dc, rc) /** * @brief * Macro used for unscaling coordinates according to active DPI settings. * @see CXTPDpi::Unscale */ # define XTP_DC_UNDPI_POINT(dc, pt) XTP_DC_UNDPI(dc, pt) /** * @brief * Macro used for unscaling coordinates according to active DPI settings. * @see CXTPDpi::Unscale */ # define XTP_DC_UNDPI_SIZE(dc, sz) XTP_DC_UNDPI(dc, sz) /** * @brief * Identifies supported primitive symbols rendered from internal primitive font. */ XTP_DECLARE_ENUM(XTPPrimitiveSymbol){ xtpPrimitiveSymbolInvalid = -1, xtpPrimitiveSymbolFirst = 0x41, // Common glyphs. xtpPrimitiveSymbolMinimize = xtpPrimitiveSymbolFirst, xtpPrimitiveSymbolMaximize, xtpPrimitiveSymbolRestore, xtpPrimitiveSymbolQuestionMark, xtpPrimitiveSymbolClose, xtpPrimitiveSymbolHome, xtpPrimitiveSymbolCheckMark, xtpPrimitiveSymbolCheckMarkRTL, xtpPrimitiveSymbolRadioMark, // Normal Play glyph. xtpPrimitiveSymbolPlayLeft, xtpPrimitiveSymbolPlayRight, xtpPrimitiveSymbolPlayUp, xtpPrimitiveSymbolPlayDown, // Small Play glyph. xtpPrimitiveSymbolPlayLeft2, xtpPrimitiveSymbolPlayRight2, xtpPrimitiveSymbolPlayUp2, xtpPrimitiveSymbolPlayDown2, // Rewind glyph. xtpPrimitiveSymbolRewindLeft, xtpPrimitiveSymbolRewindRight, xtpPrimitiveSymbolRewindUp, xtpPrimitiveSymbolRewindDown, // Shift glyph. xtpPrimitiveSymbolShiftLeft = 0x61, xtpPrimitiveSymbolShiftRight, xtpPrimitiveSymbolShiftDown, xtpPrimitiveSymbolShiftUp, // Eject glyph. xtpPrimitiveSymbolEjectLeft, xtpPrimitiveSymbolEjectRight, xtpPrimitiveSymbolEjectUp, xtpPrimitiveSymbolEjectDown, // Inject glyph. xtpPrimitiveSymbolInjectLeft, xtpPrimitiveSymbolInjectRight, xtpPrimitiveSymbolInjectUp, xtpPrimitiveSymbolInjectDown, // Pin glyph. xtpPrimitiveSymbolPinLeft, xtpPrimitiveSymbolPinRight, xtpPrimitiveSymbolPinDown, xtpPrimitiveSymbolPlus, xtpPrimitiveSymbolMinus, xtpPrimitiveSymbolEllipsis, xtpPrimitiveSymbolTabClose, xtpPrimitiveSymbolTabPlayLeft, xtpPrimitiveSymbolTabPlayRight, xtpPrimitiveSymbolTabPlayLeftDisabled, xtpPrimitiveSymbolTabPlayRightDisabled, xtpPrimitiveSymbolTabPlayUp, xtpPrimitiveSymbolTabPlayDown, xtpPrimitiveSymbolTabPlayUpDisabled, xtpPrimitiveSymbolTabPlayDownDisabled, xtpPrimitiveSymbolLast = xtpPrimitiveSymbolTabPlayDownDisabled }; /** * @brief * Provides tools for drawing predefined primitives. */ class _XTP_EXT_CLASS CXTPPrimitiveDrawer { friend class CXTPSingleton; CXTPPrimitiveDrawer(); ~CXTPPrimitiveDrawer(); public: /** * @brief * Draws a known primitive symbol. * @param pDC Target device context pointer. * @param nSymbol Primitive symbol identifier. * @param rc Target rectangle. * @param crForeColor Foreground color value, or COLORREF_NULL if left unchanged. * @param crBackColor Background color value, or COLORREF_NULL if left unchanged. * @param bOutline TRUE to draw an outline. * @param hOutlinePen Handle of the PEN to use. */ void DrawSymbol(CDC* pDC, XTPPrimitiveSymbol nSymbol, const CRect& rc, COLORREF crForeColor = COLORREF_NULL, COLORREF crBackColor = COLORREF_NULL, BOOL bOutline = FALSE, HPEN hOutlinePen = NULL); private: int PrimitiveSymbolToSVG(XTPPrimitiveSymbol nSymbol); BOOL SVGInit(XTPPrimitiveSymbol nSymbol); BOOL SVGLoad(CString& svg, UINT nIDResource); BOOL SVGSetColor(CDC* pDC, XTPPrimitiveSymbol nSymbol, COLORREF crForeColor = COLORREF_NULL); BOOL SVGDraw(CDC* pDC, const CRect& rc, XTPPrimitiveSymbol nSymbol, COLORREF crForeColor = COLORREF_NULL); private: struct SymbolColor { CMap m_map; }; struct SymbolData { ~SymbolData(); CString svg; CMap m_mapImage; }; CMap m_map; CRITICAL_SECTION m_mapAccess; }; /** * @brief * Provides access to a global primitive drawer instance. * @return A global primitive drawer object pointer. * @see * CXTPPrimitiveDrawer */ _XTP_EXT_CLASS CXTPPrimitiveDrawer* AFX_CDECL XTPPrimitiveDrawer(); /** * @brief * This class is used as a base class to store printing options. * It contains base properties and operations for printing tasks. * @see * CXTPPrintPageHeaderFooter */ class _XTP_EXT_CLASS CXTPPrintOptions : public CXTPCmdTarget { /** @cond */ DECLARE_DYNAMIC(CXTPPrintOptions) /** @endcond */ public: /** * @brief * Default Object constructor. */ CXTPPrintOptions(); /** * @brief * Default Object destructor. */ virtual ~CXTPPrintOptions(); CRect m_rcMargins; /**< Margins (mm*100 or inches*1000). */ BOOL m_bBlackWhitePrinting; /**< Store printing mode: Color or Black&White. */ int m_nBlackWhiteContrast; /**< Black&White printing contrast: 0 ... 255. (default value is 0). */ /** * @brief * Retrieves page header properties. * @return * Page header properties. * @see * GetPageFooter */ CXTPPrintPageHeaderFooter* GetPageHeader(); /** * @brief * Retrieves page footer properties. * @return * Page footer properties. * @see * GetPageHeader */ CXTPPrintPageHeaderFooter* GetPageFooter(); /** * @brief * Call this member function to copy members from a specified source object. * @param pSrc A pointer to a source object to copy data from. */ void Set(const CXTPPrintOptions* pSrc); /** * @brief * Call this member function to determine if margines are measured * in inches or millimeters (mm*100 or inches*1000). * @return * TRUE if margins are measured in inches, otherwise FALSE. * @see * m_rcMargins, GetMarginsHimetric, GetMarginsLP */ virtual BOOL IsMarginsMeasureInches(); /** * @brief * Call this member function to get margins in Himetric units. * @return * Margins in Himetric units. * @see * m_rcMargins, GetMarginsLP */ virtual CRect GetMarginsHimetric(); /** * @brief * Call this member function to get margins in Logical points. * @param pDC [in] A pointer to a device context. * @return * Margins in Logical points. * @see * m_rcMargins, GetMarginsHimetric */ virtual CRect GetMarginsLP(CDC* pDC); /** * @brief * Override this member function in a derived class to retrieve * the active locale ID. * @return * Locale ID. Base implementation returns LOCALE_USER_DEFAULT. */ virtual LCID GetActiveLCID(); protected: CXTPPrintPageHeaderFooter* m_pPageHeader; /**< Page header properties. */ CXTPPrintPageHeaderFooter* m_pPageFooter; /**< Page footer properties. */ # ifdef _XTP_ACTIVEX /** @cond */ DECLARE_DISPATCH_MAP() afx_msg BOOL OleGetMarginsMeasureMetrics(); afx_msg BOOL OleGetLandscape(); afx_msg void OleSetLandscape(BOOL bLandscape); afx_msg LPDISPATCH OleGetHeader(); afx_msg LPDISPATCH OleGetFooter(); afx_msg LPDISPATCH OleGetPrinterInfo(); /** @endcond */ # endif }; /** @cond */ ///////////////////////////////////////////////////////////////////////////// _XTP_EXT_CLASS BOOL CALLBACK _XTPAbortProc(HDC, int); // Printing Dialog class _XTP_EXT_CLASS CXTPPrintingDialog : public CDialog { public: enum { IDD = AFX_IDD_PRINTDLG }; CXTPPrintingDialog(CWnd* pParent); virtual ~CXTPPrintingDialog() { } virtual BOOL OnInitDialog(); virtual void OnCancel(); }; /** @endcond */ ///////////////////////////////////////////////////////////////////////////// AFX_INLINE BOOL CXTPDrawHelpers::IsFastFillAvailable() const { return m_pfnFastGradientFill != NULL; } AFX_INLINE void CXTPDrawHelpers::Triangle(CDC* pDC, CPoint pt0, CPoint pt1, CPoint pt2) { CPoint pts[] = { pt0, pt1, pt2 }; pDC->Polygon(pts, 3); } AFX_INLINE void CXTPSplitterTracker::SetBoundRect(CRect rcBoundRect) { m_rcBoundRect = rcBoundRect; } ///////////////////////////////////////////////////////////////////////////// # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // !defined(__XTPDRAWHELPERS_H__) /** @endcond */