/** * @file XTPCalendarViewPart.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 * */ #if !defined(_XTPCALENDARVIEWPART_H__) # define _XTPCALENDARVIEWPART_H__ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" # pragma warning(disable : 4097) class CXTPCalendarView; class CXTPPropExchange; class CXTPCalendarTimeLineView; class CXTPCalendarTimeLineViewEvent; class CXTPCalendarControl; /** * @brief * Helper class provides functionality to manage font settings for * various graphical elements of control. */ class _XTP_EXT_CLASS CXTPCalendarViewPartFontValue { public: /** * @brief * Default constructor. */ CXTPCalendarViewPartFontValue(); /** * @brief * This member function is used to determine if the default font * value is set. * * @return A BOOL. TRUE if the default value is set. FALSE otherwise. */ BOOL IsDefaultValue(); /** * @brief * This member function is used to set the value for the standard * font. * * @param pLogFont A pointer to a LOGFONT structure that contains the * standard font value. * * @details * Call this member function to set the standard font. This font * is used as the default font if there is not a custom font value * set. */ void SetStandardValue(LOGFONT* pLogFont); /** * @brief * This member function is used to delete the custom font and to * set the default font value as the default font. * * @details * Call this member function to ensure that the default font is * used and not the custom font. */ void SetDefaultValue(); /** * @brief * This member function is use to overload the function call operator * for the CXTPCalendarViewPartFontValue class. * * @details * Use the default font if the custom font does not work. Otherwise, * use a custom font. * * @return A reference to a CFont object that contains either the standard * font value or the custom font value. */ operator CFont&(); /** * @brief * This member function is used to overload the function call operator * for the CXTPCalendarViewPartFontValue class. * * @details * Use the default font if the custom font does not work. Otherwise, * use a custom font. * * @return A pointer to a CFont object that contains either the standard * font value or the custom font value. */ operator CFont*(); /** * @brief * This member function overloads the assignment operator for the * CXTPCalendarViewPartFontValue class. * * @param pLogFont A pointer to a LOGFONT structure. * * @details * Creates a new custom font. * * @return A reference to a CXTPCalendarViewPartFontValue. */ const CXTPCalendarViewPartFontValue& operator=(LOGFONT* pLogFont); /** * @brief * Get a current value object. * * @return Pointer to the current value object. */ CFont* operator->(); protected: CXTPFont m_xtpFontStandardValue; /**< Stores default font.*/ CXTPFont m_xtpFontCustomValue; /**< Stores custom font.*/ XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, m_fntStandardValue, m_xtpFontStandardValue, GetStandardFontHandle); XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, m_fntCustomValue, m_xtpFontCustomValue, GetCustomFontHandle); }; /** * @brief * Helper class template provides functionality to manage customized * value for the specified type. */ template class CXTPCalendarThemeCustomizableXValueT { public: /** * @brief * Default object constructor. */ CXTPCalendarThemeCustomizableXValueT() { m_bIsStandardSet = FALSE; m_bIsCustomSet = FALSE; m_bAutoDestroy_Standard = FALSE; m_bAutoDestroy_Custom = FALSE; m_ValueStandard = _TValue(); m_ValueCustom = _TValue(); } /** * @brief * Default object destructor. */ virtual ~CXTPCalendarThemeCustomizableXValueT() { if (m_bAutoDestroy_Standard) { DoDestroy(m_ValueStandard); } if (m_bAutoDestroy_Custom) { DoDestroy(m_ValueCustom); } } /** * @brief * This member function is used to destroy objects of type _TValue if * necessary (Close handles, free memory, ...). * * @param refValue An object reference to destroy. */ virtual void DoDestroy(_TValue& refValue) { UNREFERENCED_PARAMETER(refValue); }; /** * @brief * This member function is used to determine if the default value is set. * * @return A BOOL. TRUE if the default value is set. FALSE otherwise. */ virtual BOOL IsDefaultValue() const { return !m_bIsCustomSet && !m_bIsStandardSet; } /** * @brief * This member function determines if the standard value is set and * used. * * @return TRUE if standard value is set and custom value is not set, * otherwise FALSE. */ virtual BOOL IsStandardValue() const { return !m_bIsCustomSet && m_bIsStandardSet; } /** * @brief * This member function determines if the custom value is set and * used. * * @return TRUE if custom value is set, otherwise FALSE. */ virtual BOOL IsCustomValue() const { return m_bIsCustomSet; } /** * @brief * This member function is used to set the standard value. * * @param refValue A standard value. * @param bAutoDestroy Set to TRUE if the value being set will be * automatically destroyed when no longer needed, * otherwise set it to FALSE. * * @details * Call this member function to set the standard value. This value * is used as the default value if there is not a custom value set. * * @see SetCustomValue * @see SetDefaultValue */ virtual void SetStandardValue(_TValueRef refValue, BOOL bAutoDestroy) { if (m_bIsStandardSet && m_bAutoDestroy_Standard) { DoDestroy(m_ValueStandard); } m_ValueStandard = refValue; m_bAutoDestroy_Standard = bAutoDestroy; m_bIsStandardSet = TRUE; } /** * @brief * This member function is used to set the standard value. * * @param refValue A standard value. * * @details * Call this member function to set the standard value. This value * is used as the default value if there is not a custom value set. * * @see SetCustomValue * @see SetDefaultValue */ virtual void SetStandardValue(_TValueRef refValue) { SetStandardValue(refValue, m_bAutoDestroy_Standard); } /** * @brief * This member function is used to set the custom value. * * @param refValue A custom value. * @param bAutoDestroy Set to TRUE if the value being set will be * automatically destroyed when no longer needed, * otherwise set it to FALSE. * * @details * Call this member function to set the custom value. If set, this value * is used instead of default value. * * @see SetStandardValue * @see SetDefaultValue */ virtual void SetCustomValue(_TValueRef refValue, BOOL bAutoDestroy) { if (m_bIsCustomSet && m_bAutoDestroy_Custom) { DoDestroy(m_ValueCustom); } m_ValueCustom = refValue; m_bAutoDestroy_Custom = bAutoDestroy; m_bIsCustomSet = TRUE; } /** * @brief * This member function is used to set the custom value. * * @param refValue A custom value. * * @details * Call this member function to set the custom value. If set, this value * is used instead of default value. * * @see SetStandardValue * @see SetDefaultValue */ virtual void SetCustomValue(_TValueRef refValue) { SetCustomValue(refValue, m_bAutoDestroy_Custom); } /** * @brief * This member function is used to reset the custom value. * * @details * Call this member function to ensure that the default value is * used and not the custom value. * If the default value is not set - method does nothing. * * @see SetStandardValue * @see SetCustomValue */ virtual void SetDefaultValue() { if (m_bIsStandardSet) { if (m_bIsCustomSet && m_bAutoDestroy_Custom) { DoDestroy(m_ValueCustom); } m_bIsCustomSet = FALSE; m_bAutoDestroy_Custom = FALSE; } } /** * @brief * This member function is used to get the current value. * * @details * The default value is used if the custom value is not set. Otherwise, * a custom value is used. * * @return Current value as _TValueRef. * * @see SetStandardValue * @see SetCustomValue * @see SetDefaultValue */ virtual _TValueRef GetValue() const { return m_bIsCustomSet ? m_ValueCustom : m_ValueStandard; } /** * @brief * This member function is used to get the current value. * * @details * The default value is used if the custom value is not set. Otherwise, * a custom value is used. * * @return Current value as const _TValue&. * * @see SetStandardValue * @see SetCustomValue * @see SetDefaultValue */ virtual const _TValue& GetValueX() const { return m_bIsCustomSet ? m_ValueCustom : m_ValueStandard; } /** * @brief * This member function is used to get the standard value. * * @return Standard value. * * @see SetStandardValue * @see SetCustomValue * @see SetDefaultValue */ virtual _TValueRef GetStandardValue() const { return m_ValueStandard; } /** * @brief * This member operator is used to get the current value. * * @details * The default value is used if the custom value is not set. Otherwise, * a custom value is used. * * @return Current value. * * @see SetStandardValue * @see SetCustomValue * @see SetDefaultValue * @see GetValue */ operator _TValueRef() const { return GetValue(); } /** * @brief * This member function is used to set the standard value using the * current value from the specified object. * * @param refSrc Reference to a source object. * * @see SetStandardValue * @see SetCustomValue * @see SetDefaultValue * @see GetValue * @see IsStandardValue * @see IsCustomValue * @see GetStandardValue */ void CopySettings(const CXTPCalendarThemeCustomizableXValueT<_TValue, _TValueRef>& refSrc) { SetStandardValue(refSrc.GetValue()); } /** * @brief * This member operator is used to set the custom value. * * @param refValue A new custom value. * * @return Reference to this object. */ const CXTPCalendarThemeCustomizableXValueT<_TValue, _TValueRef>& operator=(_TValueRef refValue) { SetCustomValue(refValue); return *this; } /** * @brief * This method reads data from or writes data to an archive. * * @param ar A CArchive object to serialize to or from. * * @see DoPropExchange() */ virtual void Serialize(CArchive& ar) /**< for simple types which can be easy serialized. override for more complex cases */ { if (ar.IsStoring()) { ar << m_bIsStandardSet; ar << m_bIsCustomSet; ar << m_ValueStandard; ar << m_ValueCustom; } else { _ASSERTE(ar.IsLoading()); ar >> m_bIsStandardSet; ar >> m_bIsCustomSet; ar >> m_ValueStandard; ar >> m_ValueCustom; } } /** * @brief * This method reads data from or writes data to storage. * * @param pPX A CXTPPropExchange object to serialize to or from. * @param pcszPropName The name of the property being exchanged. * * @see Serialize() * @see DoPX_Value() */ virtual void DoPropExchange(CXTPPropExchange* pPX, LPCTSTR pcszPropName) = 0; protected: _TValue m_ValueStandard; /**< Stores default value. */ BOOL m_bAutoDestroy_Standard; /**< Call DoDestroy for standard value.*/ BOOL m_bIsStandardSet; /**< Is standard value set. */ _TValue m_ValueCustom; /**< Stores custom value. */ BOOL m_bAutoDestroy_Custom; /**< Call DoDestroy for custom vale. */ BOOL m_bIsCustomSet; /**< Is custom value set. */ }; /** * @brief * Helper class template provides functionality to manage customized * values for the specified class objects. */ template class CXTPCalendarViewPartCustomizableValueT { public: typedef CXTPCalendarViewPartCustomizableValueT<_TValue> TBase; public: /** * @brief * Default object constructor. */ CXTPCalendarViewPartCustomizableValueT() { m_pValueStandard = NULL; m_bAutoDelete_Standard = FALSE; m_pValueCustom = NULL; m_bAutoDelete_Custom = FALSE; } /** * @brief * Default object destructor. */ virtual ~CXTPCalendarViewPartCustomizableValueT() { CXTPCalendarViewPartCustomizableValueT::DeleteStandardValue(); CXTPCalendarViewPartCustomizableValueT::DeleteCustomValue(); } /** * @brief * This member function is used to determine if the default value is set. * * @return A BOOL. TRUE if the default value is set. FALSE otherwise. */ virtual BOOL IsDefaultValue() const { return (m_pValueCustom == NULL) && (m_pValueStandard == NULL); } /** * @brief * This member function determines if the standard value is set and * used. * * @return TRUE if standard value is set and custom value is not set, * otherwise FALSE. */ virtual BOOL IsStandardValue() const { return (m_pValueCustom == NULL) && (m_pValueStandard != NULL); } /** * @brief * This member function determines if the custom value is set and * used. * * @return TRUE if custom value is set, otherwise FALSE. */ virtual BOOL IsCustomValue() const { return m_pValueCustom != NULL; } /** * @brief * This member function is used to set the standard value. * * @param pValue A pointer to a value object. * @param bAutoDelete Set to TRUE if the value being set will be * automatically deleted when no longer needed, * otherwise set it to FALSE. * * @details * Call this member function to set the standard value. This value * is used as the default value if there is not a custom value set. * * Example: * See example for SetCustomValue. * * @see SetCustomValue * @see SetDefaultValue */ virtual void SetStandardValue(_TValue* pValue, BOOL bAutoDelete) { DeleteStandardValue(); m_pValueStandard = pValue; m_bAutoDelete_Standard = bAutoDelete; } /** * @brief * This member function is used to set the custom value. * * @param pValue A pointer to a value object. * @param bAutoDelete Set to TRUE if the value being set will be * automatically deleted when no longer needed, * otherwise set it to FALSE. * * @details * Call this member function to set the custom value. If set, this value * is used instead of default value. * * Example: *
	 *  class CMyClass
	 *
	 *  {
	 *  public:
	 *     CMyClass();
	 *
	 *     void Draw(CDC* pDC, CRect& rcRect, BOOL bCustom);
	 *     // ...
	 *     CXTPBrush m_brushBusy_Custom;
	 *
	 *     CXTPCalendarViewPartBrushValue m_brushVal_auto;
	 *     CXTPCalendarViewPartBrushValue m_brushVal_static;
	 *  };
	 *
	 *  CMyClass::CMyClass()
	 *  {
	 *     m_brushBusy_Custom.CreateSolidBrush(RGB(0, 0, 0xFF));
	 *
	 *     m_brushVal_auto.SetStandardValue(new CBrush(RGB(0xFF, 0xFF, 0xFF)), TRUE);
	 *     m_brushVal_static.SetStandardValue(&m_brushBusy_Custom, FALSE);
	 *  }
	 *
	 *  void CMyClass::Draw(CDC* pDC, CRect& rcRect, BOOL bCustom)
	 *  {
	 *     if (bCustom)
	 *     {
	 *         m_brushVal_auto.SetCustomValue(new CBrush(RGB(0, 0, 0)), TRUE);
	 *         m_brushVal_static.SetCustomValue(new CBrush(RGB(255, 255, 255)), TRUE);
	 *     }
	 *     else
	 *     {
	 *         // Reset to standard value
	 *         m_brushVal_auto.SetDefaultValue();
	 *         m_brushVal_static.SetDefaultValue();
	 *     }
	 *
	 *     pDC->FillRect(&rcRect, (CBrush*)m_brushVal_auto);
	 *
	 *     CBrush* pBrushOld = pDC->SelectObject(m_brushVal_static.GetValue());
	 *     // ....
	 *     pDC->SelectObject(pBrushOld);
	 *  }
	 *
	 * 
* * @see SetStandardValue * @see SetDefaultValue */ virtual void SetCustomValue(_TValue* pValue, BOOL bAutoDelete) { DeleteCustomValue(); m_pValueCustom = pValue; m_bAutoDelete_Custom = bAutoDelete; } /** * @brief * This member function is used to reset the custom value. * * @details * Call this member function to ensure that the default value is * used and not the custom value. * If the default value is not set - method does nothing. * * Example: * See example for SetCustomValue. * * @see SetStandardValue * @see SetCustomValue */ virtual void SetDefaultValue() { if (m_pValueStandard) { DeleteCustomValue(); m_pValueCustom = NULL; } } /** * @brief * This member function is used to get the current value. * * @details * The default value is used if the custom value is not set. Otherwise, * a custom value is used. * * @return A pointer to the current value. * * Example: * See example for SetCustomValue. * * @see SetStandardValue * @see SetCustomValue * @see SetDefaultValue * @see operator _TValue* */ virtual _TValue* GetValue() const { return m_pValueCustom ? m_pValueCustom : m_pValueStandard; } /** * @brief * This member function is use to get the standard value. * * @return A pointer to the standard value. * * Example: * See example for SetCustomValue. * * @see SetStandardValue * @see SetCustomValue * @see SetDefaultValue * @see operator _TValue* */ virtual _TValue* GetStandardValue() const { return m_pValueStandard; } /** * @brief * This member operator is used to get the current value. * * @details * The default value is used if the custom value is not set. Otherwise, * a custom value is used. * * @return A pointer to the current value. * * Example: * See example for SetCustomValue. * * @see SetStandardValue * @see SetCustomValue * @see SetDefaultValue * @see GetValue */ operator _TValue*() const { return GetValue(); } /** * @brief * Get a current value object. * * @return Pointer to the current value object. */ _TValue* operator->() { return GetValue(); }; /** * @brief * This member function is used to set the standard value using the * current value from the specified object. * * @param refSrc Reference to a source object. * * @see SetStandardValue * @see SetCustomValue * @see SetDefaultValue * @see GetValue * @see IsStandardValue * @see IsCustomValue * @see GetStandardValue */ void CopySettings(const CXTPCalendarViewPartCustomizableValueT<_TValue>& refSrc) { SetStandardValue(refSrc.GetValue(), FALSE); } protected: /** * @brief * Implementation can override this method for standard value specific * cleaup logic. * * @details * The method is called from destructor so implementation must not use * any implementation specific members. */ virtual void DeleteStandardValue() { if (m_bAutoDelete_Standard) { SAFE_DELETE(m_pValueStandard); } } /** * @brief * Implementation can override this method for custom value specific * cleaup logic. * * @details * The method is called from destructor so implementation must not use * any implementation specific members. */ virtual void DeleteCustomValue() { if (m_bAutoDelete_Custom) { SAFE_DELETE(m_pValueCustom); } } _TValue* m_pValueStandard; /**< Stores default value.*/ BOOL m_bAutoDelete_Standard; /**< Call operator delete for the standard value.*/ _TValue* m_pValueCustom; /**< Stores custom value.*/ BOOL m_bAutoDelete_Custom; /**< Call operator delete for the custom value.*/ }; /** * @brief * Helper class provides functionality to manage brush value objects. */ class _XTP_EXT_CLASS CXTPCalendarViewPartBrushValue : public CXTPCalendarViewPartCustomizableValueT { public: /** * @brief * Handles object deallocation. */ ~CXTPCalendarViewPartBrushValue(); private: virtual void DeleteStandardValue(); virtual void DeleteCustomValue(); }; /** * @brief * Helper class provides functionality to manage font value objects. */ class _XTP_EXT_CLASS CXTPCalendarThemeFontValue : public CXTPCalendarViewPartCustomizableValueT { public: using CXTPCalendarViewPartCustomizableValueT::SetCustomValue; using CXTPCalendarViewPartCustomizableValueT::SetStandardValue; /** * @brief * Default constructor. */ CXTPCalendarThemeFontValue(); /** * @brief * Handles object deallocation. */ ~CXTPCalendarThemeFontValue(); /** * @brief * This member function is used to set the value for the standard * font. * * @param pLogFont A pointer to a LOGFONT structure that contains the * standard font value. * * @details * Call this member function to set the standard font. This font * is used as the default font if there is not a custom font value * set. */ virtual void SetStandardValue(LOGFONT* pLogFont); /** * @brief * This member function is used to set the value for the custom * font. * * @param pLogFont A pointer to a LOGFONT structure that contains the * custom font value. * * @details * Call this member function to set the custom font. * If set, this font is used as the object value. */ virtual void SetCustomValue(LOGFONT* pLogFont); /** * @brief * Used to assign the standard value to a view part element. * * @param pFont pointer to CFont object */ virtual void SetStandardValue(CFont* pFont); /** * @brief * Used to assign the custom value to a view part element. * * @param pFont pointer to CFont object */ virtual void SetCustomValue(CFont* pFont); /** * @brief * This member function overloads the assignment operator for the * CXTPCalendarViewPartFontValue class. * * @param rLogFont A reference to LOGFONT structure. * * @details * Creates a new custom font. * * @return A reference to a CXTPCalendarViewPartFontValue. */ const CXTPCalendarThemeFontValue& operator=(LOGFONT& rLogFont); /** * @brief * This member function is use to set the standard value using the * current value from the specified object. * * @param refSrc Reference to a source object. * * @see SetStandardValue * @see SetCustomValue * @see SetDefaultValue * @see GetValue * @see IsStandardValue * @see IsCustomValue * @see GetStandardValue */ void CopySettings(const CXTPCalendarThemeFontValue& refSrc); /** * @brief * This method reads data from or writes data to an archive. * * @param ar A CArchive object to serialize to or from. * * @see DoPropExchange() */ virtual void Serialize(CArchive& ar); private: virtual void DeleteStandardValue(); virtual void DeleteCustomValue(); }; /** * @brief * Helper class provides functionality to manage customized string value * objects. */ class _XTP_EXT_CLASS CXTPCalendarThemeStringValue : public CXTPCalendarThemeCustomizableXValueT { public: /** * @brief * Default constructor. */ CXTPCalendarThemeStringValue(); /** * @brief * This member operator is used to get the current value. * * @details * The default value is used if the custom value is not set. Otherwise, * a custom value is used. * * @return A pointer to the current value. * * Example: * See example for SetCustomValue. * * @see SetStandardValue * @see SetCustomValue * @see SetDefaultValue * @see GetValue */ operator const CString&() const { return GetValueX(); } /** * @brief * This member operator is used to set a custom value. * * @param pcszValue A new custom value. * * @return Reference to this object. */ const CXTPCalendarThemeStringValue& operator=(LPCTSTR pcszValue); public: /** * @brief * This method reads data from or writes data to storage. * * @param pPX A CXTPPropExchange object to serialize to or from. * @param pcszPropName The name of the property being exchanged. * * @see Serialize() * @see DoPX_Value() */ virtual void DoPropExchange(CXTPPropExchange* pPX, LPCTSTR pcszPropName); protected: /** * @brief * This member operator is used to destroy/clear value data. * * @param refValue A value reference to destroy/clear data. */ virtual void DoDestroy(CString& refValue) { refValue.Empty(); } /** * @brief * This method reads value data from or writes value data to storage. * * @param pPX A CXTPPropExchange object to serialize to or from. * @param pcszPropName A value name. * @param rXValue Reference to value. * @param bStandard Standard or Custom value. * * @see DoPropExchange() */ void DoPX_Value(CXTPPropExchange* pPX, LPCTSTR pcszPropName, CString& rXValue, BOOL bStandard); }; /** * @brief * Helper class provides functionality to manage customized int value * objects. */ class _XTP_EXT_CLASS CXTPCalendarThemeIntValue : public CXTPCalendarThemeCustomizableXValueT { public: /** * @brief * Default object constructor. */ CXTPCalendarThemeIntValue(); public: /** * @brief * This method reads data from or writes data to storage. * * @param pPX A CXTPPropExchange object to serialize to or from. * @param pcszPropName The name of the property being exchanged. * * @see Serialize() * @see DoPX_Value() */ virtual void DoPropExchange(CXTPPropExchange* pPX, LPCTSTR pcszPropName); /** * @brief * This member operator is used to set the custom value. * * @param nValue A new custom value. * * @return Reference to this object. */ const CXTPCalendarThemeIntValue& operator=(int nValue); protected: /** * @brief * This method reads value data from or writes value data to storage. * * @param pPX A CXTPPropExchange object to serialize to or from. * @param pcszPropName A value name. * @param rXValue Reference to value. * @param bStandard Standard or Custom value. * * @see DoPropExchange() */ void DoPX_Value(CXTPPropExchange* pPX, LPCTSTR pcszPropName, int& rXValue, BOOL bStandard); }; /** * @brief * Helper class provides functionality to manage customized BOOL value * objects. */ class _XTP_EXT_CLASS CXTPCalendarThemeBOOLValue : public CXTPCalendarThemeCustomizableXValueT { public: /** * @brief * Default object constructor. */ CXTPCalendarThemeBOOLValue(); public: /** * @brief * This method reads data from or writes data to storage. * * @param pPX A CXTPPropExchange object to serialize to or from. * @param pcszPropName The name of the property being exchanged. * * @see Serialize() * @see DoPX_Value() */ virtual void DoPropExchange(CXTPPropExchange* pPX, LPCTSTR pcszPropName); /** * @brief * This member operator is used to set the custom value. * * @param bValue A new custom value. * * @return Reference to this object. */ const CXTPCalendarThemeBOOLValue& operator=(BOOL bValue); protected: /** * @brief * This method reads value data from or writes value data to storage. * * @param pPX A CXTPPropExchange object to serialize to or from. * @param pcszPropName A value name. * @param rXValue Reference to value. * @param bStandard Standard or Custom value. * * @see DoPropExchange() */ void DoPX_Value(CXTPPropExchange* pPX, LPCTSTR pcszPropName, BOOL& rXValue, BOOL bStandard); }; /** * @brief * Helper class provides functionality to manage customized CRect value * objects. */ class _XTP_EXT_CLASS CXTPCalendarThemeRectValue : public CXTPCalendarThemeCustomizableXValueT { public: /** * @brief * Default object constructor. */ CXTPCalendarThemeRectValue(); public: /** * @brief * This method reads value data from or writes value data to storage. * * @param pPX A CXTPPropExchange object to serialize to or from. * @param pcszPropName The name of the property being exchanged. * * @see Serialize() * @see DoPX_Value() */ virtual void DoPropExchange(CXTPPropExchange* pPX, LPCTSTR pcszPropName); /** * @brief * This member operator is use to set custom value. * * @param rcValue A new custom value. * * @return Reference to this object. */ const CXTPCalendarThemeRectValue& operator=(const CRect& rcValue); protected: /** * @brief * This methods reads value data from or writes value data to storage. * * @param pPX A CXTPPropExchange object to serialize to or from. * @param pcszPropName A value name. * @param rXValue Reference to value. * @param bStandard Standard or Custom value. * * @see DoPropExchange() */ void DoPX_Value(CXTPPropExchange* pPX, LPCTSTR pcszPropName, CRect& rXValue, BOOL bStandard); }; /** * @brief * Helper base class to implement parts for calendar paint manager. * objects. */ class _XTP_EXT_CLASS CXTPCalendarViewPart : public CXTPCmdTarget { friend class CXTPCalendarPaintManager; public: /** * @brief * Default constructor. * * @param pParentPart Pointer to parent class, can be NULL. */ CXTPCalendarViewPart(CXTPCalendarViewPart* pParentPart = NULL); /** * @brief * Default destructor. */ virtual ~CXTPCalendarViewPart(); public: /** * @brief * This member function is used to set graphical related * parameters equal to the system settings. */ virtual void RefreshMetrics(); public: /** * @brief * This member function is used to obtain the color used to fill * the background of UI elements. * * @return A COLORREF that contains the value of the background color. */ virtual COLORREF GetBackgroundColor(); /** * @brief * This member function is used to obtain the color used to display text. * * @return A COLORREF that contains the value of text color. */ virtual COLORREF GetTextColor(); /** * @brief * This member function is used to obtain a pointer to a CFont * object that contains the font that is used for displaying the * text. * * @return A reference to a CFont object that contains the font used to * display the text. */ virtual CFont& GetTextFont(); /** * @brief * This member function is used to display the text using the * custom font and color. * * @param pDC A pointer to a valid device context. * @param str A CString that contains the text to display. * @param lpRect An LPRECT that contains the rectangle coordinates * used to display the text. * @param nFormat A UINT that contains additional format parameters. * @param clrText RGB value indicating text color, if COLORREF_NULL default color is used. * @param pFont Points to a valid CFont object, if NULL default color is used. */ void DrawText(CDC* pDC, const CString& str, LPRECT lpRect, UINT nFormat, COLORREF clrText = COLORREF_NULL, CFont* pFont = NULL); /** * @brief * This member function is used to draw a single line text in the * center of the rect. If rect width is not enough to draw all chars - * text is aligned to left (or right, see nFormat) or the rect. * * @param pDC A pointer to a valid device context. * @param str A CString that contains the text to display. * @param lpRect An LPRECT that contains the rectangle coordinates * used to display the text. * @param nFormat A UINT that contains additional format parameters as * combination of flags: DT_VCENTER, DT_LEFT, DT_RIGHT or 0. */ void DrawLine_CenterLR(CDC* pDC, const CString& str, LPRECT lpRect, UINT nFormat); /** * @brief * This member function is used to draw a single line text in the rect. * If rect width is not enough to draw all chars - nFormatSmall flags are used, * otherwise nFormatNormal flags are used. * * @param pDC A pointer to a valid device context. * @param str A CString that contains the text to display. * @param lpRect An LPRECT that contains the rectangle coordinates * used to display the text. * @param nFormatNormal A UINT that contains format parameters when rect width * is enough to draw all text chars. * @param nFormatSmall A UINT that contains format parameters when rect width * is not enough to draw all text chars. */ void DrawLineEx(CDC* pDC, const CString& str, LPRECT lpRect, UINT nFormatNormal, UINT nFormatSmall); /** * @brief * This member function is used to calculate the size of the area * required to display the given text. * * @param pDC A pointer to a valid device context. * @param str A CString that contains the string of text to display. * * @return A CSize object that contains the dimensions required to display * the text. */ CSize GetTextExtent(CDC* pDC, const CString& str); /** * @brief * This member function is used to set the new color used to fill * the background. * * @param clr A COLORREF that contains the new color value. */ void SetBackgroundColor(COLORREF clr); /** * @brief * This member function is used to set the new color used to display * the text. * * @param clr A COLORREF that contains the new color value. */ void SetTextColor(COLORREF clr); /** * @brief * This member function is used to set the new font used to display * the text. * * @param pLogFont A pointer to a LOGFONT struct that contains the new * font used to display the text. */ void SetTextFont(LOGFONT* pLogFont); CXTPCalendarControl* GetCalendarControl() const; // Attributes CXTPPaintManagerColor m_clrTextColor; /**< Stores color settings used to display text.*/ CXTPPaintManagerColor m_clrBackground; /**< Stores color settings used to to fill background of UI item.*/ CXTPCalendarViewPartFontValue m_fntText; /**< Stores font settings used to display text.*/ CXTPCalendarViewPart* m_pParentPart; /**< Pointer to the parent CXTPCalendarViewPart object.*/ CXTPCalendarPaintManager* m_pPaintManager; /**< Pointer to containing CXTPCalendarPaintManager object*/ protected: virtual void _Init(){}; }; /** * @brief * Helper base class to implement parts for calendar paint manager. * objects. */ class _XTP_EXT_CLASS CXTPCalendarTimeLineViewTimeScalePart : public CXTPCalendarViewPart { public: /** * @brief * Default object constructor. * * @param pParentPart Pointer to CXTPCalendarViewPart. */ CXTPCalendarTimeLineViewTimeScalePart(CXTPCalendarViewPart* pParentPart = NULL); /** * @brief * This member function is used to set graphical related * parameters equal to the system settings. */ virtual void RefreshMetrics(); /** * @brief * This member function is used to calculate height utilizing * the specified device context. * * @param pDC Pointer to a valid device context. * * @return Calculated height as int. */ virtual int CalcHeigt(CDC* pDC); /** * @brief * This member function is used to draw the part content utilizing * the specified device context. * * @param pDC Pointer to a valid device context. * @param rcRect Rectangle to use. * @param pView Pointer to CXTPCalendarTimeLineView. */ virtual void Draw(CDC* pDC, const CRect& rcRect, CXTPCalendarTimeLineView* pView); /** * @brief * Access function to get header height. * * @return Current header height as int. */ virtual int GetHeaderHeight() { return m_nHeaderHeight; } /** * @brief * Access function to get header date format. * * @param nLabelInterval int param used to select format. * * @return Current header date format as CString object. */ virtual CString GetHeaderDateFormat(int nLabelInterval); /** * @brief * This member function is used to draw the part content utilizing * the specified device context. * * @param pDC Pointer to a valid device context. * @param rcRect Rectangle to use. * @param pView Pointer to CXTPCalendarTimeLineView. * @param nLabelInterval int param used to select format. */ virtual void DrawHeader(CDC* pDC, const CRect& rcRect, CXTPCalendarTimeLineView* pView, int nLabelInterval); public: CXTPCalendarViewPartFontValue m_fntScaleHeaderText; /**< Time scale header text font.*/ protected: int m_nHeaderHeight; // internal value of current header height friend class CXTPCalendarPaintManager; }; /** * @brief * Helper base class to implement parts for calendar paint manager * objects. */ class _XTP_EXT_CLASS CXTPCalendarTimeLineViewPart : public CXTPCalendarViewPart { public: /** * @brief * Default object constructor. * * @param pParentPart Pointer to CXTPCalendarViewPart. */ CXTPCalendarTimeLineViewPart(CXTPCalendarViewPart* pParentPart = NULL) : CXTPCalendarViewPart(pParentPart) { UNREFERENCED_PARAMETER(pParentPart); }; /** * @brief * This member function is used to draw the part content utilizing * the specified device context. * * @param pDC Pointer to a valid device context. * @param rcRect Rectangle to use. * @param pView Pointer to CXTPCalendarTimeLineView. */ virtual void Draw(CDC* pDC, const CRect& rcRect, CXTPCalendarTimeLineView* pView) { UNREFERENCED_PARAMETER(pDC); UNREFERENCED_PARAMETER(rcRect); UNREFERENCED_PARAMETER(pView); }; /** * @brief * This member function is used to calculate the rectangle needed to draw an event. * * @param pDC Pointer to a valid device context. * @param pEventView Pointer to CXTPCalendarTimeLineViewEvent. * * @return CSize object needed to draw event. */ virtual CSize CalcEventSize(CDC* pDC, CXTPCalendarTimeLineViewEvent* pEventView) { UNREFERENCED_PARAMETER(pDC); UNREFERENCED_PARAMETER(pEventView); return CSize(0, 0); }; /** * @brief * This member function is used to draw the event utilizing * the specified device context. * * @param pDC Pointer to a valid device context. * @param rcEvents Rectangle to use. * @param pEventView Pointer to CXTPCalendarTimeLineViewEvent. */ virtual void DrawEvent(CDC* pDC, const CRect& rcEvents, CXTPCalendarTimeLineViewEvent* pEventView) { UNREFERENCED_PARAMETER(pDC); UNREFERENCED_PARAMETER(rcEvents); UNREFERENCED_PARAMETER(pEventView); }; }; /** * @brief * Call this function within your class's DoPropExchange member function * to serialize or initialize a customized Gradient Color property. * The property's value is read from or written to the variable referenced * by refGrColor, as appropriate. * * @param pPX Pointer to the CXTPPropExchange object * (typically passed as a parameter to DoPropExchange). * @param pcszPropName The name of the property being exchanged. * @param refColor Reference to the variable where the property is stored. * * @return Nonzero if the exchange was successful; 0 if unsuccessful. */ _XTP_EXT_CLASS BOOL AFX_CDECL PX_Color(CXTPPropExchange* pPX, LPCTSTR pcszPropName, COLORREF& refColor); /** * @brief * Call this function within your class's DoPropExchange member function * to serialize or initialize a customized Gradient Color property. * The property's value is read from or written to the variable referenced * by refGrColor, as appropriate. * * @param pPX Pointer to the CXTPPropExchange object * (typically passed as a parameter to DoPropExchange). * @param pcszPropName The name of the property being exchanged. * @param refColor Reference to the variable where the property is stored. * * @return Nonzero if the exchange was successful; 0 if unsuccessful. */ _XTP_EXT_CLASS BOOL AFX_CDECL PX_Color(CXTPPropExchange* pPX, LPCTSTR pcszPropName, CXTPPaintManagerColor& refColor); /** * @brief * Call this function within your class's DoPropExchange member function * to serialize or initialize a customized Gradient Color property. * The property's value is read from or written to the variable referenced * by refGrColor, as appropriate. * * @param pPX Pointer to the CXTPPropExchange object * (typically passed as a parameter to DoPropExchange). * @param psczPropName The name of the property being exchanged. * @param refGrColor Reference to the variable where the property is stored. * * @return Nonzero if the exchange was successful; 0 if unsuccessful. */ _XTP_EXT_CLASS BOOL AFX_CDECL PX_GrColor(CXTPPropExchange* pPX, LPCTSTR psczPropName, CXTPPaintManagerColorGradient& refGrColor); /** * @brief * Call this function within your class's DoPropExchange member function * to serialize or initialize a LOGFONT property. * The property's value is read from or written to the variable referenced * by rLogFont, as appropriate. * * @param pPX Pointer to the CXTPPropExchange object * (typically passed as a parameter to DoPropExchange). * @param pcszPropName The name of the property being exchanged. * @param rLogFont Reference to the variable where the property is stored. * * @return Nonzero if the exchange was successful; 0 if unsuccessful. */ _XTP_EXT_CLASS BOOL AFX_CDECL PX_Font(CXTPPropExchange* pPX, LPCTSTR pcszPropName, LOGFONT& rLogFont); /** * @brief * Call this function within your class's DoPropExchange member function * to serialize or initialize a customized Font property. * The property's value is read from or written to the variable referenced * by refFont, as appropriate. * * @param pPX Pointer to the CXTPPropExchange object * (typically passed as a parameter to DoPropExchange). * @param pcszPropName The name of the property being exchanged. * @param refFont Reference to the variable where the property is stored. * * @return Nonzero if the exchange was successful; 0 if unsuccessful. */ _XTP_EXT_CLASS BOOL AFX_CDECL PX_Font(CXTPPropExchange* pPX, LPCTSTR pcszPropName, CXTPCalendarThemeFontValue& refFont); ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif // !defined(_XTPCALENDARVIEWPART_H__)