/** * @file XTPChartTitle.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(__XTPCHARTTITLE_H__) # define __XTPCHARTTITLE_H__ /** @endcond */ # if _MSC_VER >= 1000 # pragma once # endif // _MSC_VER >= 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPChartDeviceContext; class CXTPChartDeviceCommand; class CXTPChartFont; class CXTPChartElementView; class CXTPChartContent; class CXTPPropExchange; /** * @brief * Specifies chart docking direction */ enum XTPChartDocking { xtpChartDockTop, /**< Specifies top docking direction */ xtpChartDockBottom, /**< Specifies bottom docking direction */ xtpChartDockLeft, /**< Specifies left docking direction */ xtpChartDockRight /**< Specifies right docking direction */ }; /** * @brief * This class represents a chart title. */ class _XTP_EXT_CLASS CXTPChartTitle : public CXTPChartTextElement { /** @cond */ DECLARE_DYNAMIC(CXTPChartTitle) /** @endcond */ public: /** * @brief * Constructs a CXTPChartTitle object. */ CXTPChartTitle(); /** * @brief * Destroys a CXTPChartTitle object, handles cleanup. */ virtual ~CXTPChartTitle(); public: /** * @brief * Call this function to set the visibility of the title. * * @param bVisible A BOOL value. TRUE to set the title to visible, * FALSE to hide the title. */ void SetVisible(BOOL bVisible); /** * @brief * Call this function to check if the title is visible. * * @return * A BOOL value. TRUE if the title is visible, FALSE otherwise. */ BOOL IsVisible() const; /** * @brief * Call this function to set the text of the title. * * @param lpszTitle New text of the title. * * @see * GetText */ void SetText(LPCTSTR lpszTitle); /** * @brief * Call this function to get the text of the title. * * @return * Text of the title. * * @see * SetText */ CXTPChartString GetText() const; /** * @brief * Call this method to set the custom text color of the title. * * @param clrTextColor New text color of the title. It can be CXTPChartColor::Empty * to use the default appearance color. * * @see * GetTextColor */ void SetTextColor(const CXTPChartColor& clrTextColor); /** * @brief * Call this method to get the custom text color of the title. * * @return * The text color of the title. If default appearance color is used, then * CXTPChartColor::Empty will be returned. * * @see * SetTextColor */ CXTPChartColor GetTextColor() const; /** * @brief * Call this method to get the actual text color of the title. * * @return * The actual text color of the title. * * @see * GetTextColor */ CXTPChartColor GetActualTextColor() const; /** * @brief * Call this method to set the font of the title. * * @param pFont New font to be set. * * @see * GetFont */ void SetFont(CXTPChartFont* pFont); /** * @brief * Call this method to get the font for the title. * * @return * Pointer to a CXTPChartFont object that holds font information. * * @see * SetFont */ CXTPChartFont* GetFont() const; /** * @brief * Call this method to set the docking position of the title. * * @param nDocking docking position of the title. It can be one of the following: * xtpChartDockTop, xtpChartDockBottom, xtpChartDockLeft, xtpChartDockRight. * * @see * GetDocking */ void SetDocking(XTPChartDocking nDocking); /** * @brief * Call this method to get the docking position of the title. * * @return * Docking position of title. It can be one of the following: * xtpChartDockTop, xtpChartDockBottom, xtpChartDockLeft, xtpChartDockRight. * * @see * SetDocking */ XTPChartDocking GetDocking() const; /** * @brief * Call this method to set the indent between 2 titles. * * @param nIndent New indent to be set. * * @see * GetIndent */ void SetIndent(int nIndent); /** * @brief * Call this method to get the indent between 2 titles. * * @return * Indent between 2 titles. * * @see * GetIndent */ int GetIndent() const; /** * @brief * Call this method to set the text alignment of the title. * * @param nAlignment New text alignment to be set. It can be one of the following: * xtpChartAlignNear, xtpChartAlignCenter, xtpChartAlignFar. * * @see * GetAlignment */ void SetAlignment(XTPChartStringAlignment nAlignment); /** * @brief * Call this method to get the text alignment of the title. * * * @details * Text alignment of the title. It can be one of the following: * xtpChartAlignNear, xtpChartAlignCenter, xtpChartAlignFar. * @return Returns text alignment of title * @see * SetAlignment */ XTPChartStringAlignment GetAlignment() const; /** * @brief * Call this function to set anti-aliasing ON or OFF. Anti-aliasing is * the smoothing of sharp edges of text and drawing. * * @param bAntialiasing A BOOL value. TRUE to set anti-aliasing to ON, * FALSE to set anti-aliasing to OFF. */ void SetAntialiasing(BOOL bAntialiasing); /** * @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. */ BOOL GetAntialiasing() const; public: /** * @brief * This method calculates text angle according to the current docking position. * @return Returns text angle * @see * GetDocking */ int GetTextAngle() const; public: /** * @brief * Call this member function to Store/Load the properties of a title object * 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); public: /** @cond */ virtual CXTPChartElementView* CreateView(CXTPChartDeviceContext* pDC, CXTPChartElementView* pParentView); CPoint CalcOrigin(CRect bounds, CRect startBounds, CRect rect); XTPChartNearTextPosition GetNearTextPosition(); /** @endcond */ # ifdef _XTP_ACTIVEX public: /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPChartTitle); BSTR OleGetText(); void OleSetText(LPCTSTR lpszText); LPDISPATCH OleGetFont(); OLE_COLOR OleGetTextColor(); void OleSetTextColor(OLE_COLOR clr); /** @endcond */ # endif protected: friend class CXTPChartTitleCollection; CXTPChartString m_strText; /**< Text of the title.*/ CXTPChartColor m_clrTextColor; /**< Text color*/ BOOL m_bVisible; /**< TRUE if title is visible*/ CXTPChartFont* m_pFont; /**< Font of the title*/ BOOL m_bAntialiasing; /**< Antialiasing flag*/ XTPChartDocking m_nDocking; /**< Current docking position of the title*/ int m_nIndent; /**< Indent between 2 titles*/ int m_nInnerIndent; /**< Inner indent*/ XTPChartStringAlignment m_nAlignment; /**< Text alignment*/ }; /** * @brief * CXTPChartTitleCollection represents a collection of chart titles. */ class _XTP_EXT_CLASS CXTPChartTitleCollection : public CXTPChartElementCollection { public: /** * @brief * Constructs a CXTPChartTitleCollection object. * * @param pOwner Owner object. */ CXTPChartTitleCollection(CXTPChartElement* pOwner); /** * @brief * Destroys a CXTPChartTitleCollection object, handles cleanup. */ virtual ~CXTPChartTitleCollection(); public: /** * @brief * Call this method to add a new title. * * @param pTitle New title to add. * @return An added title object pointer. */ CXTPChartTitle* Add(CXTPChartTitle* pTitle); /** * @brief * Call this method to get a title by its index. * * @param nIndex Index of the title to get. * @return Returns title by its index */ CXTPChartTitle* GetAt(int nIndex) const; public: /** * @brief * Call this member function to Store/Load the properties of a title object * 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. */ virtual void DoPropExchange(CXTPPropExchange* pPX); public: /** @cond */ void CreateView(CXTPChartDeviceContext* pDC, CXTPChartElementView* pParentView); void CalculateView(CXTPChartDeviceContext* pDC, CRect& rcChart, CXTPChartElementView* pParentView); /** @endcond */ # ifdef _XTP_ACTIVEX public: /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPChartTitleCollection); afx_msg long OleGetItemCount(); afx_msg LPDISPATCH OleGetItem(long nIndex); DECLARE_ENUM_VARIANT(CXTPChartTitleCollection) afx_msg LPDISPATCH OleAdd(LPCTSTR lpszTitle); /** @endcond */ # endif protected: friend class CXTPChartContent; }; AFX_INLINE CXTPChartTitle* CXTPChartTitleCollection::GetAt(int nIndex) const { return nIndex >= 0 && nIndex < m_arrElements.GetSize() ? (CXTPChartTitle*)m_arrElements.GetAt(nIndex) : NULL; } AFX_INLINE CXTPChartString CXTPChartTitle::GetText() const { return m_strText; } AFX_INLINE CXTPChartFont* CXTPChartTitle::GetFont() const { return m_pFont; } AFX_INLINE XTPChartDocking CXTPChartTitle::GetDocking() const { return m_nDocking; } AFX_INLINE int CXTPChartTitle::GetIndent() const { return m_nIndent; } AFX_INLINE XTPChartStringAlignment CXTPChartTitle::GetAlignment() const { return m_nAlignment; } AFX_INLINE void CXTPChartTitle::SetAntialiasing(BOOL bAntialiasing) { m_bAntialiasing = bAntialiasing; OnChartChanged(); } AFX_INLINE BOOL CXTPChartTitle::GetAntialiasing() const { return m_bAntialiasing; } AFX_INLINE BOOL CXTPChartTitle::IsVisible() const { return m_bVisible; } AFX_INLINE void CXTPChartTitle::SetVisible(BOOL bVisible) { m_bVisible = bVisible; OnChartChanged(); } /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif //#if !defined(__XTPCHARTTITLE_H__) /** @endcond */