/** * @file XTPCalendarShadowDrawer.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 * */ #if !defined(_XTPCALENDARSHADOWDRAWER_H__) # define _XTPCALENDARSHADOWDRAWER_H__ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" /** * @brief * This is a helper class which handles shadows drawing (for events, etc). */ class _XTP_EXT_CLASS CXTPCalendarShadowDrawer { public: /** * @brief * Constructs the object and initializes. * * @param pDC A pointer to the device context. * @param dMaxAlpha The maximum value for the alpha channel. */ CXTPCalendarShadowDrawer(CDC* pDC, double dMaxAlpha); /** * @brief * Destroy the CXTPCalendarShadowDrawer and does the cleanups. */ virtual ~CXTPCalendarShadowDrawer(); /** * @brief * Call this function to get the alpha pixel. * * @param crPixel The color of the pixel. * @param i The alpha value. * * @return The alpha pixel value. */ static COLORREF AFX_CDECL AlphaPixel(const COLORREF crPixel, const UINT i); /** * @brief * Call this function to check whether the input is within the limit of * 0 and 255. * * @param iValue - The input. * * @return The returns 0 if the input is less than 0 and 255 if it is greater than * 255, else returns the value. */ static int AFX_CDECL CheckValue(int iValue); enum XTPShadowPart { // Regular theme - Office 2003 xtpShadowLR = 0, xtpShadowTB = 1, xtpShadowTR = 2, xtpShadowBR = 3, xtpShadowBL = 4, // Office 2007 Theme xtpShadow2007Right = 5, xtpShadow2007Bottom = 6, xtpShadow2007TopRight = 7, xtpShadow2007BottomRight = 8, xtpShadow2007BottomLeft = 9, xtpShadow2007Center = 10 }; /** * @brief * Generic drawing of the shadow rectangle part. * * @param rcShadow rectangle to draw. * @param part XTPShadowPart. */ void DrawShadowRectPart(const CRect& rcShadow, const XTPShadowPart part); // Methods for Office 2003 theme /** * @brief * Applied shadow to bitmap. * * @param pBitmap UINT*. * @param ulBitmapWidth ULONG. * @param ulBitmapHeight ULONG. */ void ApplyShadowLR(UINT* pBitmap, const ULONG ulBitmapWidth, const ULONG ulBitmapHeight); /** * @brief * Applied shadow to bitmap. * * @param pBitmap UINT*. * @param ulBitmapWidth ULONG. * @param ulBitmapHeight ULONG. */ void ApplyShadowTB(UINT* pBitmap, const ULONG ulBitmapWidth, const ULONG ulBitmapHeight); /** * @brief * Applies shadow to bitmap. * * @param pBitmap UINT*. * @param ulBitmapWidth ULONG. * @param ulBitmapHeight ULONG. */ void ApplyShadowTR(UINT* pBitmap, const ULONG ulBitmapWidth, const ULONG ulBitmapHeight); /** * @brief * Applies shadow to bitmap. * * @param pBitmap UINT*. * @param ulBitmapWidth ULONG. * @param ulBitmapHeight ULONG. */ void ApplyShadowBR(UINT* pBitmap, const ULONG ulBitmapWidth, const ULONG ulBitmapHeight); /** * @brief * Applies shadow to bitmap. * * @param pBitmap UINT*. * @param ulBitmapWidth ULONG. * @param ulBitmapHeight ULONG. */ void ApplyShadowBL(UINT* pBitmap, const ULONG ulBitmapWidth, const ULONG ulBitmapHeight); // methods for Office 2007 theme /** * @brief * Applies shadow to bitmap. * * @param pBitmap UINT*. * @param ulBitmapWidth ULONG. * @param ulBitmapHeight ULONG. */ void ApplyShadow2007Right(UINT* pBitmap, const ULONG ulBitmapWidth, const ULONG ulBitmapHeight); /** * @brief * Applies shadow to bitmap. * * @param pBitmap UINT*. * @param ulBitmapWidth ULONG. * @param ulBitmapHeight ULONG. */ void ApplyShadow2007Bottom(UINT* pBitmap, const ULONG ulBitmapWidth, const ULONG ulBitmapHeight); /** * @brief * Applies shadow to bitmap. * * @param pBitmap UINT*. * @param ulBitmapWidth ULONG. * @param ulBitmapHeight ULONG. */ void ApplyShadow2007TR(UINT* pBitmap, const ULONG ulBitmapWidth, const ULONG ulBitmapHeight); /** * @brief * Applies shadow to bitmap. * * @param pBitmap UINT*. * @param ulBitmapWidth ULONG. * @param ulBitmapHeight ULONG. */ void ApplyShadow2007BL(UINT* pBitmap, const ULONG ulBitmapWidth, const ULONG ulBitmapHeight); /** * @brief * Applies shadow to bitmap. * * @param pBitmap UINT*. * @param ulBitmapWidth ULONG. * @param ulBitmapHeight ULONG. */ void ApplyShadow2007BR(UINT* pBitmap, const ULONG ulBitmapWidth, const ULONG ulBitmapHeight); /** * @brief * Applies shadow to bitmap. * * @param pBitmap UINT*. * @param ulBitmapWidth ULONG. * @param ulBitmapHeight ULONG. */ void ApplyShadow2007Center(UINT* pBitmap, const ULONG ulBitmapWidth, const ULONG ulBitmapHeight); protected: CDC* m_pDC; /**< drawing device context */ double m_dMaxAlpha; /**< maximal shadow alpha grade */ private: }; # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif // !defined(_XTPCALENDARSHADOWDRAWER_H__)