/** * @file XTPChartAxisStrips.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(__XTPCHARTAXISSTRIPS_H__) # define __XTPCHARTAXISSTRIPS_H__ /** @endcond */ # if _MSC_VER >= 1000 # pragma once # endif // _MSC_VER >= 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPChartAxis; class CXTPChartFillStyle; /** * @brief * This is a hybrid object of CXTPChartElement and CXTPChartLegendItemView. * This class represents a strip parallel to an axis. */ class _XTP_EXT_CLASS CXTPChartAxisStrip : public CXTPChartElement , public CXTPChartLegendItemView { /** @cond */ DECLARE_DYNCREATE(CXTPChartAxisStrip) /** @endcond */ public: /** * @brief * Constructs a CXTPChartAxisStrip object. */ CXTPChartAxisStrip(); /** * @brief * Destroys a CXTPChartAxisStrip object, handles cleanup. */ virtual ~CXTPChartAxisStrip(); public: /** * @brief * Use this function to set the visibility of the axis strip. * * @param bVisible A BOOL value. TRUE to set the axis strip to visible, * FALSE to hide the axis strip. */ void SetVisible(BOOL bVisible); /** * @brief * Call this function to check the visibility of the axis strip. * * @return A BOOL value. TRUE if the axis strip is visible, FALSE otherwise. */ BOOL IsVisible() const; /** * @brief * Use this function to set the visibility of the legend item. * * @param bVisible A BOOL value. TRUE to set the legend item to visible, * FALSE to hide the legend item. */ void SetLegendVisible(BOOL bVisible); /** * @brief * Call this function to check the visibility of the legend item. * * @return A BOOL value. TRUE if the legend item is visible, FALSE otherwise. */ BOOL IsLegendVisible() const; /** * @brief * Use this function to set the name for the axis strip. * * @param lpszName A string value denoting the name of the axis strip. */ void SetName(const CXTPChartString& lpszName); /** * @brief * Call this function to get the name of the axis strip. * * @return A string value denoting the name of the axis strip. */ CXTPChartString GetName() const; /** * @brief * Use this function to set the legend item name for the axis strip. * * @param * lpszName - A string value denoting the legend item name of the axis strip. */ void SetLegendName(const CXTPChartString& lpszName); /** * @brief * Call this function get the legend item name of the axis strip. * * @return * A string value denoting the legend item name of the axis strip. */ CXTPChartString GetLegendName() const; /** * @brief * Call this function to get the fill style of the axis strip. * * @return * Returns a pointer to a CXTPChartFillStyle object which represents the * fill style of the axis strip. */ CXTPChartFillStyle* GetFillStyle() const; /** * @brief * Call this function to get the minimum value of the strip in the axis.\ * * @return * Returns a string/double describing the minimum value of the strip in the axis. */ CXTPChartString GetAxisMinValue() const; /** * @brief * Call this function to get the minimum value of the strip in the axis.\ * * @return * Returns a string/double describing the minimum value of the strip in the axis. */ double GetAxisMinValueInternal() const; /** * @brief * Call this function to set the minimum value for the strip in the axis. * * @param lpszValue A string describing the minimum value of the strip in the axis. */ void SetAxisMinValue(LPCTSTR lpszValue); /** * @brief * Call this function to set the minimum value for the strip in the axis. * * @param dValue A double describing the minimum value of the strip in the axis. */ void SetAxisMinValue(double dValue); /** * @brief * Call this function to get the maximum value of the strip in the axis. * * @return Returns a string describing the maximum value of the strip in the axis. */ CXTPChartString GetAxisMaxValue() const; double GetAxisMaxValueInternal() const; /** * @brief * Call this function to get the maximum value for the strip in the axis. * * @param lpszValue A string describing the maximum value of the strip in the axis. */ void SetAxisMaxValue(LPCTSTR lpszValue); void SetAxisMaxValue(double dValue); /** * @brief * Call this function to get the actual color of the axis strip. * * @return A chart color object representing an ARGB value. */ CXTPChartColor GetActualColor() const; CXTPChartColor GetActualColor2() const; /** * @brief * Use this function to get the apparent color of the axis strip. * * @return A CXTPChartColor object representing the ARGB color value selected. */ CXTPChartColor GetColor() const; /** * @brief * Call this function to set the color of the axis strip. * * @param color A chart color object representing an ARGB value. */ void SetColor(const CXTPChartColor& color); CXTPChartColor GetColor2() const; /** * @brief * Call this function to set the color of the axis strip. * * @param color A chart color object representing an ARGB value. */ void SetColor2(const CXTPChartColor& color); public: void DoPropExchange(CXTPPropExchange* pPX); protected: /** * @brief * This function creates a CXTPChartDeviceCommand object. This object * represents the rendering of an axis strip in the chart. * * @param pDC Pointer to a CXTPChartDeviceContext object. * @param rcBounds The bounding rectangle of the axis strip. * * @return Returns a CXTPChartDeviceCommand object. This object handles * the rendering of an element in the chart. Here it handles * the drawing of the axis strip. */ virtual CXTPChartDeviceCommand* CreateLegendDeviceCommand(CXTPChartDeviceContext* pDC, CRect rcBounds); # ifdef _XTP_ACTIVEX /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPChartAxisStrip); BSTR OleGetText(); void OleSetText(LPCTSTR lpszText); VARIANT OleGetAxisMinValue(); void OleSetAxisMinValue(const VARIANT& var); VARIANT OleGetAxisMaxValue(); void OleSetAxisMaxValue(const VARIANT& var); BOOL OleGetLegendVisible(); void OleSetLegendVisible(BOOL bValue); BOOL OleGetVisible(); void OleSetVisible(BOOL bValue); LPDISPATCH OleGetFillStyle(); OLE_COLOR OleGetColor(); OLE_COLOR OleGetColor2(); void OleSetColor(OLE_COLOR clr); void OleSetColor2(OLE_COLOR clr); /** @endcond */ # endif protected: BOOL m_bLegendVisible; /**< TRUE if the legend item is visible, FALSE if not visible.*/ BOOL m_bVisible; /**< TRUE if the strip is visible, FALSE if not visible.*/ CXTPChartString m_strName; /**< The name of the strip.*/ CXTPChartString m_strLegendName; /**< The name of the legend item.*/ CXTPChartString m_strAxisMinValue; /**< The minimum value of the strip in the axis.*/ CXTPChartString m_strAxisMaxValue; /**< The maximum value of the strip in the axis.*/ double m_dAxisMinValue; /**< The minimum value of the strip in the axis.*/ double m_dAxisMaxValue; /**< The maximum value of the strip in the axis.*/ CXTPChartColor m_clrColor; /**< The color of the strip.*/ CXTPChartColor m_clrColor2; /**< The color of the strip.*/ CXTPChartFillStyle* m_pFillStyle; /**< The fill style used for the background painting.*/ friend class CXTPChartAxisStrips; }; /** * @brief * This class encapsulates a collection of chart axis strip objects. * CXTPChartAxisStrips class is designed as a kind of CXTPChartElement. */ class _XTP_EXT_CLASS CXTPChartAxisStrips : public CXTPChartElementCollection { public: /** * @brief * Constructs a CXTPChartAxisStrips object. * * @param pAxis The pointer to the chart axis object to which the strips are associated. */ CXTPChartAxisStrips(CXTPChartAxis* pAxis); /** * @brief * Destroys a CXTPChartAxisStrip object, handles cleanup. */ virtual ~CXTPChartAxisStrips(); public: /** * @brief * Call this function to add a new strip to the collection. * * @param pStrip A pointer to an axis strip object. * @return A newly added axis strip object pointer. */ CXTPChartAxisStrip* Add(CXTPChartAxisStrip* pStrip); /** * @brief * Use this function to get a strip at a particular index in the strips collection. * * @param nIndex The zero-based index of the item of choice. * * @return A pointer to the strip object in the selected index. */ CXTPChartAxisStrip* GetAt(int nIndex) const; public: void DoPropExchange(CXTPPropExchange* pPX); # ifdef _XTP_ACTIVEX /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPChartAxisStrips); afx_msg long OleGetItemCount(); afx_msg LPDISPATCH OleGetItem(long nIndex); DECLARE_ENUM_VARIANT(CXTPChartAxisStrips) afx_msg LPDISPATCH OleAdd(LPCWSTR lpszTitle); /** @endcond */ # endif protected: }; AFX_INLINE CXTPChartAxisStrip* CXTPChartAxisStrips::GetAt(int nIndex) const { return nIndex >= 0 && nIndex < m_arrElements.GetSize() ? (CXTPChartAxisStrip*)m_arrElements.GetAt(nIndex) : NULL; } AFX_INLINE CXTPChartString CXTPChartAxisStrip::GetName() const { return m_strName; } AFX_INLINE void CXTPChartAxisStrip::SetVisible(BOOL bVisible) { m_bVisible = bVisible; OnChartChanged(); } AFX_INLINE BOOL CXTPChartAxisStrip::IsVisible() const { return m_bVisible; } AFX_INLINE CXTPChartFillStyle* CXTPChartAxisStrip::GetFillStyle() const { return m_pFillStyle; } AFX_INLINE CXTPChartString CXTPChartAxisStrip::GetAxisMinValue() const { return m_strAxisMinValue; } AFX_INLINE double CXTPChartAxisStrip::GetAxisMinValueInternal() const { return m_dAxisMinValue; } AFX_INLINE void CXTPChartAxisStrip::SetAxisMinValue(LPCTSTR lpszValue) { m_strAxisMinValue = lpszValue; OnChartChanged(); } AFX_INLINE void CXTPChartAxisStrip::SetAxisMinValue(double dValue) { m_dAxisMinValue = dValue; m_strAxisMinValue.Empty(); OnChartChanged(); } AFX_INLINE CXTPChartString CXTPChartAxisStrip::GetAxisMaxValue() const { return m_strAxisMaxValue; } AFX_INLINE double CXTPChartAxisStrip::GetAxisMaxValueInternal() const { return m_dAxisMaxValue; } AFX_INLINE void CXTPChartAxisStrip::SetAxisMaxValue(LPCTSTR lpszValue) { m_strAxisMaxValue = lpszValue; OnChartChanged(); } AFX_INLINE void CXTPChartAxisStrip::SetAxisMaxValue(double dValue) { m_dAxisMaxValue = dValue; m_strAxisMaxValue.Empty(); OnChartChanged(); } AFX_INLINE BOOL CXTPChartAxisStrip::IsLegendVisible() const { return m_bLegendVisible; } AFX_INLINE void CXTPChartAxisStrip::SetLegendVisible(BOOL bLegendVisible) { m_bLegendVisible = bLegendVisible; OnChartChanged(); } AFX_INLINE CXTPChartColor CXTPChartAxisStrip::GetColor() const { return m_clrColor; } AFX_INLINE CXTPChartColor CXTPChartAxisStrip::GetColor2() const { return m_clrColor2; } AFX_INLINE void CXTPChartAxisStrip::SetLegendName(const CXTPChartString& lpszName) { m_strLegendName = lpszName; OnChartChanged(); } /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif //#if !defined(__XTPCHARTAXISStripS_H__) /** @endcond */