/** * @file XTPChartDeviceContext.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(__XTPCHARTDEVICECONTEXT_H__) # define __XTPCHARTDEVICECONTEXT_H__ /** @endcond */ # if _MSC_VER >= 1000 # pragma once # endif // _MSC_VER >= 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPChartContainer; class CXTPChartDeviceCommand; class CXTPMarkupUIElement; class CXTPChartFont; class CXTPChartDrawingObjectFactory; class CXTPOpenGLTriangleRenderList; /** * @brief * This class abstracts a device context. A device context stores, * retrieves, and modifies the attributes of graphic objects and * specifies graphic modes. This class is a kind of CXTPCmdTarget to * enhance the MFC command routing. */ class _XTP_EXT_CLASS CXTPChartDeviceContext : public CXTPCmdTarget { DECLARE_DYNAMIC(CXTPChartDeviceContext); protected: /** * @brief * Constructs a CXTPChartDeviceContext object. * * @param pContainer Parent container pointer. * @param hDC Handle to the windows device context. * @param bIs3D TRUE identifies device context used for 3D rendering. * @param pDrawingObjectFactory Drawing object factory pointer. * * @see * CXTPChart2dDrawingObjectFactory, CXTPChart3dDrawingObjectFactory */ CXTPChartDeviceContext(CXTPChartContainer* pContainer, HDC hDC, BOOL bIs3D, CXTPChartDrawingObjectFactory* pDrawingObjectFactory); public: /** * @brief * Destroys a CXTPChartDeviceContext object, handles cleanup. */ virtual ~CXTPChartDeviceContext() = 0; /** * @brief * Initializes devices context. * * @return TRUE if initialization is successful. */ virtual BOOL Initialize(); /** * @brief * Call this function to trigger the drawing. * * @param pCommand A pointer to chart device command object. */ virtual void Execute(CXTPChartDeviceCommand* pCommand); /** * @brief * Determines if the derived device context is a 3D device context. * * @return TRUE if the derived device context is a 3D device context, FALSE otherwise. */ BOOL Is3D() const; /** * @brief * Call this function to get the windows device context. * * @return A handle to the windows device context. */ HDC GetHDC() const; /** * @brief * Provides access to the parent container object. * * @return Parent container object pointer. */ CXTPChartContainer* GetContainer() const; /** * @brief * Provides access to the drawing object factory used by * the device context implementation. * * @return Drawing object factory instance pointer. */ CXTPChartDrawingObjectFactory* GetDrawingObjectFactory() const; /** * @brief * Call this function to get the measurements of texts rendered in a * device context using a specific font. * * @param pText The string to be measured. * @param pFont Pointer to chart font object. * @return Returns mesurements of texts rendered in a device context using a specific font */ virtual CXTPChartSizeF MeasureString(const CXTPChartString* pText, CXTPChartFont* pFont) = 0; /** * @brief * Measures the markup element size provided with the font set as the * default font for the associated markup context. * * @param pMarkupUIElement Markup element pointer to measure. * @param pFont A default markup context font pointer. * * @return Measured markup element size or empty size in case of an error. */ virtual CXTPChartSizeF MeasureMarkupElement(CXTPMarkupUIElement* pMarkupUIElement, CXTPChartFont* pFont) = 0; protected: const BOOL m_bIs3D; /**< TRUE identifies device context used for 3D rendering*/ HDC m_hDC; /**< The windows device context.*/ CXTPChartContainer* m_pContainer; /**< Parent container pointer.*/ CXTPChartDrawingObjectFactory* m_pDrawingObjectFactory; /**< Drawing object factory pointer.*/ }; AFX_INLINE BOOL CXTPChartDeviceContext::Is3D() const { return m_bIs3D; } AFX_INLINE HDC CXTPChartDeviceContext::GetHDC() const { return m_hDC; } AFX_INLINE CXTPChartContainer* CXTPChartDeviceContext::GetContainer() const { return m_pContainer; } AFX_INLINE CXTPChartDrawingObjectFactory* CXTPChartDeviceContext::GetDrawingObjectFactory() const { return m_pDrawingObjectFactory; } /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif //#if !defined(__XTPCHARTDEVICECONTEXT_H__) /** @endcond */