/** * @file XTPCalendarEventLabel.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(_XTPCALENDAREVENTLABEL_H__) # define _XTPCALENDAREVENTLABEL_H__ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" ///////////////////////////////////////////////////////////////////////////// class CXTPCalendarEventLabel; class CXTPCalendarEventLabels; class CXTPPropExchange; /** * @brief * This class defines Calendar Event label properties. * * @see CXTPCalendarEvent */ class _XTP_EXT_CLASS CXTPCalendarEventLabel : public CXTPCmdTarget { /** @cond */ DECLARE_DYNAMIC(CXTPCalendarEventLabel) /** @endcond */ public: int m_nLabelID; /**< Label ID.*/ COLORREF m_clrColor; /**< Label color used to fill the event background.*/ CString m_strName; /**< Label name.*/ /** * @brief * Default class constructor. * * @param nID Label ID. * @param clrColor Label color. * @param pcszName Label name. */ CXTPCalendarEventLabel(int nID = 0, COLORREF clrColor = 0, LPCTSTR pcszName = _T("")); /** * @brief * Default class constructor. * * @param pSrc Pointer to the source used initialize this object. */ CXTPCalendarEventLabel(CXTPCalendarEventLabel* pSrc); /** * @brief * Default class destructor. * * @details * Handles class member deallocation. */ virtual ~CXTPCalendarEventLabel(); /** * @brief * This member function is used to set new object properties. * * @param rSrc Reference to the source object. * * @details * This is the overloaded assignment operator. * * @return Reference to this class instance. */ const CXTPCalendarEventLabel& operator=(const CXTPCalendarEventLabel& rSrc); protected: # ifdef _XTP_ACTIVEX afx_msg OLE_COLOR OleGetColor(); afx_msg void OleSetColor(OLE_COLOR clrOleColor); DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPCalendarEventLabel); # endif }; //=========================================================================== ///////////////////////////////////////////////////////////////////////////// /** * @brief * This class is used as a collection of CXTPCalendarEventLabel * objects. * * @see CXTPCalendarEventLabel * @see CXTPCalendarEvent */ class _XTP_EXT_CLASS CXTPCalendarEventLabels : public CXTPCalendarPtrCollectionT { /** @cond */ DECLARE_DYNAMIC(CXTPCalendarEventLabels) /** @endcond */ public: /** * @brief * Default class constructor. */ CXTPCalendarEventLabels(); /** * @brief * Default class destructor. * * @details * Handles class members deallocation. */ virtual ~CXTPCalendarEventLabels(); /** * @brief * This member function is used to fill the collection using * a default label list. */ virtual void InitDefaultValues(); /** * @brief * This member function updates the default colors of labels when * the theme is changed * @param clrEventColors An array of colors. * @param uCount Number of items in the array above. */ void UpdateDefaultValues(COLORREF* clrEventColors, UINT uCount); /** * @brief * Call this member function to set a flag indicating that custom * labels are defined. * * @param bDefault Set to FALSE when using custom values. */ void SetDefaultValues(BOOL bDefault); /** * @brief * This member function is used to search for the label with a * specified ID. * * @param nLabelID An int that contains the label ID. * * @return A pointer to a CXTPCalendarEventLabel object or NULL. */ CXTPCalendarEventLabel* Find(int nLabelID) const; using CXTPCalendarPtrCollectionT::Find; protected: /** * @brief * Finds label index in the internal array by its ID. * * @param nLabelID Label ID. * * @return Label index in the internal label array. * * @see Find */ int FindIndex(int nLabelID) const; protected: BOOL m_bDefaultValues; /**< Set to FALSE when using custom values.*/ # ifdef _XTP_ACTIVEX // afx_msg long OleGetItemCount(); // afx_msg LPDISPATCH OleGetItem(long nIndex); afx_msg void OleAddLabel(long nLabelID, OLE_COLOR clrOleColor, LPCTSTR pcszName); // afx_msg void OleRemoveAll(); afx_msg LPDISPATCH OleFind(long nID); // afx_msg void OleInitDefaultValues(); DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPCalendarEventLabels); DECLARE_ENUM_VARIANT(CXTPCalendarEventLabels); # endif }; /** * @brief * This class defines Calendar Event Category properties. * Visual effects for Event Categories (event and day's cells background * colors) are implemented in Office 2007 theme only. If one or more categories * are set for an event, then the the category's colors are used. Otherwise * the label's colors are used (is label defined). For Office 2003 theme, the * label's colors are used in any case. * * @see CXTPCalendarEvent * @see CXTPCalendarEventCategories */ class _XTP_EXT_CLASS CXTPCalendarEventCategory : public CXTPCmdTarget { /** @cond */ DECLARE_DYNCREATE(CXTPCalendarEventCategory) /** @endcond */ public: /** * @brief * Default class constructor. * * @param nID Category identifier. * @param pcszName Category name. * @param clrBorder Event border color. * @param clrBkBase Base color to calculate few background colors for event * background and other elements. */ CXTPCalendarEventCategory(UINT nID = 0, LPCTSTR pcszName = _T(""), COLORREF clrBorder = 0, COLORREF clrBkBase = 0); /** * @brief * Default class constructor. * * @param pCategory Points to the source category object to initialize this object with. */ CXTPCalendarEventCategory(CXTPCalendarEventCategory* pCategory); /** * @brief * Default class destructor. */ virtual ~CXTPCalendarEventCategory(); /** * @brief * This member function is used to obtain a unique category ID. * * @return A unique category ID. * * @see SetID */ UINT GetID() const; /** * @brief * This member function is used to set a unique category ID. * * @param nID A unique category ID. * * @see GetID */ void SetID(UINT nID); /** * @brief * This member function is used to obtain a category name. * * @return A category name. * * @see SetName */ CString GetName() const; /** * @brief * This member function is used to set a category name. * * @param pcszName A category name. * * @see GetName */ void SetName(LPCTSTR pcszName); /** * @brief * This member function is used to obtain an event border color. * * @return An event border color. * * @see SetBorderColor */ virtual COLORREF GetBorderColor() const; /** * @brief * This member function is used to set an event border color. * * @param clrColor An event border color. * * @see GetBorderColor */ virtual void SetBorderColor(COLORREF clrColor); /** * @brief * This member function is used to obtain a background base color. * * @return A background base color. * * @see SetBkBaseColor */ virtual COLORREF GetBkBaseColor() const; /** * @brief * This member function is used to set a background base color. * * @param clrColor A background base color. * * @see GetBkBaseColor */ virtual void SetBkBaseColor(COLORREF clrColor); /** * @brief * This member function is used to obtain an event background color. * * @return An event background gradient color. * * @see GetBkBaseColor * @see SetBkBaseColor */ virtual CXTPPaintManagerColorGradient& GetBackgroundColor(); /** * @brief * This member function is used to obtain All Day Events area background color. * * @return All Day Events area background color. * * @see GetBkBaseColor * @see SetBkBaseColor */ virtual COLORREF GetBkColorAllDayEvents() const; /** * @brief * This member function is used to obtain Day View Work Cell background color. * * @return A Day View Work Cell background color. * * @see GetBkBaseColor * @see SetBkBaseColor */ virtual COLORREF GetBkColorWorkCell() const; /** * @brief * This member function is used to obtain Day View NonWork Cell background color. * * @return A Day View NonWork Cell background color. * * @see GetBkBaseColor * @see SetBkBaseColor */ virtual COLORREF GetBkColorNonWorkCell() const; /** * @brief * This member function is used to obtain Day View Cell border color. * * @return A Day View Cell border color. * * @see GetBkBaseColor * @see SetBkBaseColor */ virtual COLORREF GetColorCellBorder() const; protected: // nID - // pcszName - Category name. // clrBorder - Event border color. // clrBkBase - Base color to calculate few background colors for event // background and other elements. UINT m_nID; /**< Stores category identifier.*/ CString m_strName; /**< Stores category name.*/ COLORREF m_clrBorder; /**< Stores Event border color.*/ COLORREF m_clrBkBase; /**< Stores Base color to calculate few background colors for event background and other elements.*/ CXTPPaintManagerColorGradient m_grclrBackground; /**< Stores an event background gradient color.*/ protected: # ifdef _XTP_ACTIVEX DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPCalendarEventCategory); DECLARE_OLECREATE_EX(CXTPCalendarEventCategory); OLE_COLOR OleGetBorderColor(); void OleSetBorderColor(OLE_COLOR oleColor); LPDISPATCH OleGetBackground(); /**< implemented in the CalendarThemesAxParts.cpp*/ # endif }; /** * @brief * This class is used as a collection of CXTPCalendarEventCategory * objects. * @see * CXTPCalendarEventCategory, CXTPCalendarEvent */ class _XTP_EXT_CLASS CXTPCalendarEventCategories : public CXTPCalendarPtrCollectionT { /** @cond */ DECLARE_DYNCREATE(CXTPCalendarEventCategories) /** @endcond */ protected: // CXTPCalendarEventCategories(BOOL bDefaultColorsSet); public: /** * @brief * Default class constructor. */ CXTPCalendarEventCategories(); /** * @brief * Default class destructor. * * @details * Handles class members deallocation. */ virtual ~CXTPCalendarEventCategories(); /** * @brief * This member function is used to fill the collection using * a default label list. */ virtual void InitDefaultValues(); /** * @brief * This member function updates the default colors of a category list * when the theme is changed. * * @param pClrBkBase Array of COLORREF values representing the background * color for each category item. * @param pClrBorder Array of COLORREF values represening the border * color for each category item. * @param nCount Size of pClrBack and pClrBorder arrays. */ void UpdateDefaultValues(COLORREF* pClrBkBase, COLORREF* pClrBorder, int nCount); /** * @brief * Call this member function to set a flag indicating custom * labels are defined. * * @param bDefault Set to FALSE when using custom values. */ void SetDefaultValues(BOOL bDefault); /** * @brief * This member function is used to search for the event category with * a specified ID. * * @param nID An UINT that contains the category ID. * * @return A pointer to a CXTPCalendarEventCategory object or NULL. */ virtual CXTPCalendarEventCategory* Find(UINT nID) const; using CXTPCalendarPtrCollectionT::Find; protected: /** * @brief * Finds an event category index in the collection by its ID. * * @param nID An UINT that contains the category ID. * * @return Category index in the collection. * * @see Find */ virtual int FindIndex(UINT nID) const; CString LoadCategoryName(UINT nIDResource) const; BOOL m_bDefaultValues; /**< Set to FALSE when using custom values.*/ # ifdef _XTP_ACTIVEX DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPCalendarEventCategories); DECLARE_OLECREATE_EX(CXTPCalendarEventCategories); DECLARE_ENUM_VARIANT(CXTPCalendarEventCategories); afx_msg void OleSetItem(long nIndex, LPDISPATCH pdispItem); afx_msg void OleAdd(LPDISPATCH pdispItem); afx_msg LPDISPATCH OleFind(long nID); # endif }; /** * @brief * This class represents the collection of UINT elements. * * @details * It also implements some useful operations on elements. */ class _XTP_EXT_CLASS CXTPCalendarUIntArray : public CXTPArrayT { /** @cond */ DECLARE_DYNAMIC(CXTPCalendarUIntArray) /** @endcond */ public: typedef CXTPArrayT TBase; /** * @brief * Call this member function to find an ID in the collection. * * @param uID ID to find. * * @return Zero-based index in the collection, or -1 if the element is not found. */ int Find(UINT uID) const; /** * @brief * Call this member function to remove an ID from the collection. * * @param uID ID to remove. * * @return TRUE if specified ID find and removed, FALSE otherwise. * * @see CArray::RemoveAt * @see CArray::RemoveAll */ virtual BOOL RemoveID(UINT uID); /** * @brief * Call this member function to store collection data as a comma separated * string. * * @return Comma separated string with collection elements. * * @see LoadFromString */ virtual CString SaveToString() const; /** * @brief * Call this member function to read collection data from a comma separated * string. * * @param pcszData String with collection data. * * @see SaveToString */ virtual void LoadFromString(LPCTSTR pcszData); /** * @brief * Call this member function to Store/Load collection data using the * specified data object. * * @param pPX Source or destination CXTPPropExchange data object reference. * @param pcszSection Section name for elements set. * @param pcszElement Element value property name. * * @details * This member function is used to either store event data to or * load event data from storage. */ virtual void DoPropExchange(CXTPPropExchange* pPX, LPCTSTR pcszSection, LPCTSTR pcszElement); protected: # ifdef _XTP_ACTIVEX DECLARE_DISPATCH_MAP() DECLARE_ENUM_VARIANTLIST(CXTPCalendarUIntArray); void OleLoadFromString(LPCTSTR strData); BSTR OleSaveToString(); # endif }; ///////////////////////////////////////////////////////////////////////////// /** * @brief * This class represents the collection of custom icons IDs. * * @details * It also implements some useful operations on custom icons * IDs collection. */ class _XTP_EXT_CLASS CXTPCalendarIconIDs : public CXTPCalendarUIntArray { /** @cond */ DECLARE_DYNAMIC(CXTPCalendarIconIDs) /** @endcond */ public: typedef CXTPCalendarUIntArray TBase; /** * @brief * Default object constructor. * * @see ~CXTPCalendarIconIDs() */ CXTPCalendarIconIDs(); /** * @brief * Default object destructor. * * @see CXTPCalendarIconIDs() */ virtual ~CXTPCalendarIconIDs(); /** * @brief * Call this member function to Store/Load collection data using the * specified data object. * * @param pPX Source or destination CXTPPropExchange data object reference. * * @details * This member function is used to either store event data to or * load event data from storage. */ virtual void DoPropExchange(CXTPPropExchange* pPX); using CXTPCalendarUIntArray::DoPropExchange; protected: # ifdef _XTP_ACTIVEX DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPCalendarIconIDs); # endif }; /** * @brief * This class represents the collection of event categories IDs. * * @details * It also implements some useful operations. */ class _XTP_EXT_CLASS CXTPCalendarEventCategoryIDs : public CXTPCalendarUIntArray { /** @cond */ DECLARE_DYNAMIC(CXTPCalendarEventCategoryIDs) /** @endcond */ public: typedef CXTPCalendarUIntArray TBase; /** * @brief * Default object constructor. */ CXTPCalendarEventCategoryIDs(); /** * @brief * Default object destructor. */ virtual ~CXTPCalendarEventCategoryIDs(); /** * @brief * Call this member function to Store/Load collection data using the * specified data object. * * @param pPX Source or destination CXTPPropExchange data object reference. * * @details * This member function is used to either store event data to or * load event data from storage. */ virtual void DoPropExchange(CXTPPropExchange* pPX); using CXTPCalendarUIntArray::DoPropExchange; protected: # ifdef _XTP_ACTIVEX DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPCalendarEventCategoryIDs); # endif }; AFX_INLINE void CXTPCalendarIconIDs::DoPropExchange(CXTPPropExchange* pPX) { TBase::DoPropExchange(pPX, _T("CustomIcons"), _T("IconID")); } AFX_INLINE void CXTPCalendarEventCategoryIDs::DoPropExchange(CXTPPropExchange* pPX) { TBase::DoPropExchange(pPX, _T("EventCategories"), _T("CategoryID")); } AFX_INLINE UINT CXTPCalendarEventCategory::GetID() const { return m_nID; } AFX_INLINE void CXTPCalendarEventCategory::SetID(UINT nID) { m_nID = nID; } AFX_INLINE CString CXTPCalendarEventCategory::GetName() const { return m_strName; } AFX_INLINE void CXTPCalendarEventCategory::SetName(LPCTSTR pcszName) { m_strName = pcszName; } AFX_INLINE COLORREF CXTPCalendarEventCategory::GetBorderColor() const { return m_clrBorder; } AFX_INLINE void CXTPCalendarEventCategory::SetBorderColor(COLORREF clrColor) { m_clrBorder = clrColor; } AFX_INLINE COLORREF CXTPCalendarEventCategory::GetBkBaseColor() const { return m_clrBkBase; } AFX_INLINE void CXTPCalendarEventCategory::SetBkBaseColor(COLORREF clrColor) { m_clrBkBase = clrColor; } # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif // !defined(_XTPCALENDAREVENTLABEL_H__)