/** * @file XTPChartElement.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(__XTPCHARTELEMENT_H__) # define __XTPCHARTELEMENT_H__ /** @endcond */ # if _MSC_VER >= 1000 # pragma once # endif // _MSC_VER >= 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPChartFont; class CXTPChartContent; class CXTPChartElementView; class CXTPPropExchange; class CXTPChartDeviceContext; class CXTPChartDeviceCommand; class CXTPChartAppearance; /** * @brief * Specifies chart update options. */ enum XTPChartUpdateOptions { xtpChartUpdateView = 1, /**< Recreate View*/ xtpChartUpdateLayout = 2, /**< Don't recreate View but call Calculate*/ xtpChartUpdateRedraw = 4, /**< Rebuild Command Tree*/ }; /** * @brief * A base class for all chart objects. */ class _XTP_EXT_CLASS CXTPChartObject # ifdef _XTP_ACTIVEX : public CXTPCmdTarget # else : public CObject # endif { DECLARE_DYNAMIC(CXTPChartObject); protected: /** * @brief * Constructs an empty chart object. */ CXTPChartObject(); /** * @brief * Constructs an empty chart object. * * @param bIs3D By default all derived objects are assumed to work in 2D * mode which corresponds to FALSE used as a value for this parameter. * However if a derived object is associated with 3D mode, * e.g. a command the render 3D graphics or 3D device context, * this value must be TRUE. */ CXTPChartObject(BOOL bIs3D); public: /** * @brief * Determines if a derived object is used in 3D mode. * * @return * TRUE if a derived object is used in 3D mode, FALSE otherwise. */ BOOL Is3D() const; /** @cond */ protected: void Set3D(); /** @endcond */ private: BOOL m_bIs3D; /**< TRUE indicated the derived object is used in 3D mode.*/ }; AFX_INLINE CXTPChartObject::CXTPChartObject() : m_bIs3D(FALSE) { } AFX_INLINE CXTPChartObject::CXTPChartObject(BOOL bIs3D) : m_bIs3D(bIs3D) { } /** @cond */ AFX_INLINE void CXTPChartObject::Set3D() { m_bIs3D = TRUE; } /** @endcond */ AFX_INLINE BOOL CXTPChartObject::Is3D() const { return m_bIs3D; } /** * @brief * This class abstracts a chart element, this class acts as a base class for * all chart elements. * * @details * This is an MFC class, which has capacity to route Windows command messages. * Each element has an owner element. */ class _XTP_EXT_CLASS CXTPChartElement : public CXTPChartObject { DECLARE_DYNAMIC(CXTPChartElement); public: /** * @brief * Constructs a CXTPChartElement object. */ CXTPChartElement(); /** * @brief * Destroys a CXTPChartElement object, handles cleanup. */ virtual ~CXTPChartElement(); public: /** * @brief * Call this function to decrease the usage count of the object. */ virtual void Release(); /** * @brief * Call this function to get the owner element. * * @return * Returns the parent CXTPChartElement. */ CXTPChartElement* GetOwner() const; public: /** * @brief * Call this virtual function to trigger a re-painting when there is * a change in the intrinsic properties of the chart. * @param updateOptions Options which indicate the kind of change performed. */ virtual void OnChartChanged(XTPChartUpdateOptions updateOptions = xtpChartUpdateView); /** * @brief * Call this virtual function to get the chart content object. * * @return * A pointer to the chart content object. * * @details * A chart content object is an aggregate of various chart components * like panels, titles, series, legend etc. */ CXTPChartContent* GetContent() const; /** * @brief * Call this function to get the the appearance of the chart. * * @return * A pointer to a CXTPChartAppearance object. */ CXTPChartAppearance* GetAppearance() const; public: /** * @brief * Reads this object from or writes this object to an archive. * * @param pPX A CXTPPropExchange object to serialize to or from. */ virtual void DoPropExchange(CXTPPropExchange* pPX); public: # ifdef _XTP_ACTIVEX public: /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPChartElement); /** @endcond */ # else DWORD InternalAddRef(); DWORD InternalRelease(); long m_dwRef; # endif protected: CXTPChartElement* m_pOwner; // Owner of the element. friend class CXTPChartElementCollection; }; /** * @brief * This class represents the chart container. This class acts as a container * for the chart content. */ class _XTP_EXT_CLASS CXTPChartContainer { public: /** * @brief * Constructs a CXTPChartContainer object. */ CXTPChartContainer(); /** * @brief * Destroys a CXTPChartContainer object, handles cleanup. */ virtual ~CXTPChartContainer(); public: /** * @brief * Obtains Chart control's window object. * @return Chart control's window object pointer. */ virtual CWnd* GetControl() = 0; /** * @brief * Call this function to trigger a re-painting when there is a change * in the intrinsic properties of the chart. * @param updateOptions Options which indicate the kind of change performed. */ virtual void OnChartChanged(XTPChartUpdateOptions updateOptions = xtpChartUpdateView); /** * @brief * This method is called to set capture to view. * * @param pView View that will receive all mouse messages. */ virtual void SetCapture(CXTPChartElementView* pView); /** * @brief * Enters a mode in which a container is expected to be frequently * updated. * * @see * EndFrequentUpdates, IsBeingFrequentlyUpdated */ void BeginFrequentUpdates(); /** * @brief * Determines if the container is currently being frequently updated. * * @return * TRUE if the container is currently being frequently updated, FALSE otherwise. * * @see * BeginFrequentUpdates, EndFrequentUpdates */ BOOL IsBeingFrequentlyUpdated() const; /** * @brief * Leave the frequent update mode and performs the final update. * * @param updateOptions The final update type. * * @see * BeginFrequentUpdates, IsBeingFrequentlyUpdated */ void EndFrequentUpdates(XTPChartUpdateOptions updateOptions = xtpChartUpdateRedraw); private: BOOL m_bBeingFrequentlyUpdated; }; AFX_INLINE BOOL CXTPChartContainer::IsBeingFrequentlyUpdated() const { return m_bBeingFrequentlyUpdated; } /** * @brief * This class abstracts a chart text element. This class is a kind of * CXTPChartElement class. * * @details * This class acts as an abstract base class for various specialized chart text * elements like axis label, axis title etc. */ class _XTP_EXT_CLASS CXTPChartTextElement : public CXTPChartElement { DECLARE_DYNAMIC(CXTPChartTextElement); public: /** * @brief * Call this function to get the font of the text element. * * @return * A pointer to a chart font object, which holds the current font of the * text element. */ virtual CXTPChartFont* GetFont() const = 0; /** * @brief * Call this function to check if anti-aliasing is ON or OFF. Anti-aliasing is * the smoothing of sharp edges of text and drawing. * * @return * A BOOL value. TRUE if anti-aliasing is ON, FALSE if anti-aliasing is OFF. */ virtual BOOL GetAntialiasing() const = 0; }; /** * @brief * This class abstracts a chart collection. This class is a kind of * CXTPChartElement class. * * @details * This class acts as an abstract base class for collection objects * such as a collection of points, titles, panels, strips. */ class _XTP_EXT_CLASS CXTPChartElementCollection : public CXTPChartElement { /** @cond */ DECLARE_DYNAMIC(CXTPChartElementCollection) /** @endcond */ public: /** * @brief * Constructs a CXTPChartElementCollection object. */ CXTPChartElementCollection(); /** * @brief * Destroys a CXTPChartElementCollection object, handles cleanup. */ ~CXTPChartElementCollection(); public: /** * @brief * This function removes all the individual objects * from this collection object. * * @see * RemoveAt */ virtual void RemoveAll(); /** * @brief * Call this function to get the number of objects in * the internal array of this object. * * @return * The number of point elements present in this object. */ virtual int GetCount() const; /** * @brief * Use this function to remove an object from the collection. * * @param nIndex Index of the object to remove. */ virtual void RemoveAt(int nIndex); /** * @brief * Use this function to remove an object from the collection. * * @param pElement Object to remove. */ virtual void Remove(CXTPChartElement* pElement); /** * @brief * Call this function to get an element by its index. * * @param nIndex Index of the object to get. * * @return * Element by its index. */ CXTPChartElement* GetAt(int nIndex) const; /** * @brief * Call this function to get the index of a specified element. * * @param pElement Object to test. * * @return * Index of pElement inside internal collection. */ int IndexOf(CXTPChartElement* pElement) const; /** * @brief * Call this method to add a new element to the collection. * * @param pElement Object to add. * @param nIndex Index of object to add. */ void InsertAt(int nIndex, CXTPChartElement* pElement); /** * @brief * Call this function to decrease the usage count of the object. */ virtual void Release(); protected: CArray m_arrElements; /**< Array of CXTPChartElement pointer.*/ }; AFX_INLINE CXTPChartElement* CXTPChartElement::GetOwner() const { return m_pOwner; } AFX_INLINE CXTPChartElement* CXTPChartElementCollection::GetAt(int nIndex) const { return nIndex >= 0 && nIndex < m_arrElements.GetSize() ? m_arrElements.GetAt(nIndex) : NULL; } AFX_INLINE int CXTPChartElementCollection::GetCount() const { return (int)m_arrElements.GetSize(); } /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif //#if !defined(__XTPCHARTELEMENT_H__) /** @endcond */