/** * @file XTPChartAxisCustomLabels.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(__XTPCHARTAXISCUSTOMLABELS_H__) # define __XTPCHARTAXISCUSTOMLABELS_H__ /** @endcond */ # if _MSC_VER >= 1000 # pragma once # endif // _MSC_VER >= 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPChartAxis; class CXTPChartLineStyle; class CXTPChartLineStyle; /** * @brief * CXTPChartAxisCustomLabel is a CXTPChartElement derived class. * This class represents a custom label text on Axis (CXTPChartAxis). */ class _XTP_EXT_CLASS CXTPChartAxisCustomLabel : public CXTPChartElement { /** @cond */ DECLARE_DYNCREATE(CXTPChartAxisCustomLabel) /** @endcond */ public: /** * @brief * Constructs a CXTPChartAxisCustomLabel object. */ CXTPChartAxisCustomLabel(); /** * @brief * Destroys a CXTPChartAxisCustomLabel object, handles cleanup */ virtual ~CXTPChartAxisCustomLabel(); public: /** * @brief * Use this function to set the text of the custom label. * * @param lpszTitle The string value for the new text. Its type is CXTPChartString. */ void SetText(const CXTPChartString& lpszTitle); /** * @brief * Call this function to get the text of the custom label. * * @return The string value for the item text. Its type is CXTPChartString. */ CXTPChartString GetText() const; /** * @brief * Use this function to get the value of the constant line in the axis. * * @return A string/double denoting the axis value. */ CXTPChartString GetAxisValue() const; /** * @brief * Use this function to get the value of the constant line in the axis. * * @return A string/double denoting the axis value. */ double GetAxisValueInternal() const; /** * @brief * Call this function to set the value of the constant line in the axis. * * @param lpszValue A string denoting the axis value. */ void SetAxisValue(LPCTSTR lpszValue); /** * @brief * Call this function to set the value of the constant line in the axis. * * @param dValue A double denoting the axis value. */ void SetAxisValue(double dValue); public: /** * @brief * Call this member function to Store/Load the label properties using the specified data * object. * * @param pPX Source or destination CXTPPropExchange data object reference. * * @details * This member function is used to store property data to or load property * data from storage. */ void DoPropExchange(CXTPPropExchange* pPX); protected: # ifdef _XTP_ACTIVEX /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPChartAxisCustomLabel); BSTR OleGetText(); void OleSetText(LPCTSTR lpszText); VARIANT OleGetAxisValue(); void OleSetAxisValue(const VARIANT& var); /** @endcond */ # endif protected: CXTPChartString m_strText; /**< The text of the item.*/ CXTPChartString m_strAxisValue; /**< The axis value.*/ double m_dAxisValue; friend class CXTPChartAxisCustomLabels; }; /** * @brief * This class encapsulates a collection of CXTPChartAxisCustomLabel objects. */ class _XTP_EXT_CLASS CXTPChartAxisCustomLabels : public CXTPChartElementCollection { public: /** * @brief * Constructs a CXTPChartAxisCustomLabels object. * * @param pAxis The pointer to a CXTPChartAxis object. */ CXTPChartAxisCustomLabels(CXTPChartAxis* pAxis); /** * @brief * Destroys a CXTPChartAxisCustomLabels object, handles cleanup. */ virtual ~CXTPChartAxisCustomLabels(); public: /** * @brief * This function adds a new custom label to the collection of labels. * * @param pCustomLabel The pointer to a CXTPChartAxisCustomLabel object. * @return A newly added custom label object pointer. */ CXTPChartAxisCustomLabel* Add(CXTPChartAxisCustomLabel* pCustomLabel); /** * @brief * Call this function to get the label object at a particular * index in the collection. * * @param nIndex The zero-based index of the item in the collection. * * @return The pointer to the CXTPChartAxisCustomLabel object at the index selected. */ CXTPChartAxisCustomLabel* GetAt(int nIndex) const; public: void DoPropExchange(CXTPPropExchange* pPX); public: # ifdef _XTP_ACTIVEX /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPChartAxisCustomLabels); afx_msg long OleGetItemCount(); afx_msg LPDISPATCH OleGetItem(long nIndex); DECLARE_ENUM_VARIANT(CXTPChartAxisCustomLabels) afx_msg LPDISPATCH OleAdd(LPCTSTR lpszName, const VARIANT& Value); /** @endcond */ # endif protected: }; AFX_INLINE CXTPChartAxisCustomLabel* CXTPChartAxisCustomLabels::GetAt(int nIndex) const { return nIndex >= 0 && nIndex < m_arrElements.GetSize() ? (CXTPChartAxisCustomLabel*)m_arrElements.GetAt(nIndex) : NULL; } AFX_INLINE CXTPChartString CXTPChartAxisCustomLabel::GetAxisValue() const { return m_strAxisValue; } AFX_INLINE double CXTPChartAxisCustomLabel::GetAxisValueInternal() const { return m_dAxisValue; } AFX_INLINE void CXTPChartAxisCustomLabel::SetAxisValue(LPCTSTR lpszValue) { m_strAxisValue = lpszValue; OnChartChanged(); } AFX_INLINE void CXTPChartAxisCustomLabel::SetAxisValue(double dValue) { m_dAxisValue = dValue; m_strAxisValue.Empty(); OnChartChanged(); } AFX_INLINE CXTPChartString CXTPChartAxisCustomLabel::GetText() const { return m_strText; } /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif //#if !defined(__XTPCHARTAXISCUSTOMLABELS_H__) /** @endcond */