/** * @file XTPCalendarDayViewEvent.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(_XTPCALENDARVIEWEVENT_H__) # define _XTPCALENDARVIEWEVENT_H__ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPCalendarEvent; class CXTPCalendarControl; class CXTPCalendarDayViewDay; class CXTPCalendarDayViewGroup; /** * @brief * This class represents an event view portion of the CalendarDayViewDay. * * @details * This class is used to represent a specific view of the event associated * data according to various view types and display settings. This class also * provides basic functionality on the data by using user input through the * keyboard and mouse. * * CXTPCalendarDayViewEvent is based on the CXTPCalendarDayEventT template * class. It inherits basic behavior from the CXTPCalendarDayEventT template * class. Furthermore, CXTPCalendarDayViewEvent overlaps and adds some * new functionality to get its own behavior and appearance. * * @see CXTPCalendarViewEvent * @see CXTPCalendarViewEventT */ class _XTP_EXT_CLASS CXTPCalendarDayViewEvent : public CXTPCalendarViewEventT { /** @cond */ DECLARE_DYNAMIC(CXTPCalendarDayViewEvent) /** @endcond */ public: /** * @details * Base class type definition. */ typedef CXTPCalendarViewEventT TBase; /** * @brief * Default object constructor. * * @param pEvent Pointer to CXTPCalendarEvent. * @param pViewGroup Pointer to CXTPCalendarDayViewGroup object. * * @see ~CXTPCalendarDayViewDay() */ CXTPCalendarDayViewEvent(CXTPCalendarEvent* pEvent, CXTPCalendarDayViewGroup* pViewGroup); /** * @brief * Default class destructor. */ virtual ~CXTPCalendarDayViewEvent(); /** * @brief * This member function is used to adjust the view's layout depending * on the provided rectangle and then calls AdjustLayout() for all * sub-items. * * @param pDC Pointer to a valid device context. * @param rcEventMax A CRect object that contains the rectangle dimensions * for drawing the view. * @param nEventPlaceNumber An int that is used as a sequential place number. * * @details * Call Populate(COleDateTime dtDayDate) prior to adjust layout. * AdjustLayout2 is called by calendar control instead of AdjustLayout * when theme is set. */ virtual void AdjustLayout(CDC* pDC, const CRect& rcEventMax, int nEventPlaceNumber); /** * @brief * This member function is used to adjust the view's layout depending * on the provided rectangle and then calls AdjustLayout() for all * sub-items. * * @param pDC Pointer to a valid device context. * @param rcEventMax A CRect object that contains the rectangle dimensions * for drawing the view. * @param nEventPlaceNumber An int that is used as a sequential place number. * * @details * Call Populate(COleDateTime dtDayDate) prior to adjust layout. * AdjustLayout2 is called by calendar control instead of AdjustLayout * when theme is set. */ virtual void AdjustLayout2(CDC* pDC, const CRect& rcEventMax, int nEventPlaceNumber); /** * @brief * This member function is used to perform additional adjustments * in some kinds of views. * * @details * Call this member function to perform additional adjustments after * all adjustment activities are completed. */ virtual void OnPostAdjustLayout(); /** * @brief * This member function is used to draw the view content using * the specified device context. * * @param pDC Pointer to a valid device context. * * @details * Call AdjustLayout() before calling Draw(). * * @see AdjustLayout(CRect rcDay) */ virtual void Draw(CDC* pDC); /** * @brief * This member function is used to fill an * XTP_CALENDAR_HITTESTINFO structure. * * @param point A CPoint object that contains the point to test. * @param pInfo A pointer to an XTP_CALENDAR_HITTESTINFO structure. * * @return TRUE if the test is successful, FALSE otherwise. * * @details * Call this member function to gather hit test information from * the day view. * * @see XTP_CALENDAR_HITTESTINFO */ virtual BOOL HitTestEx(CPoint point, XTP_CALENDAR_HITTESTINFO* pInfo) const; /** * @brief * Call this member function to determine if an event is "Multi Day". * * @return TRUE if events is "Multi Day". FALSE otherwise. */ virtual BOOL IsMultidayEvent() const; /** * @brief * This member function is used to determine if the event is visible. * * @details * This function calls IsVisibleEx(TRUE, TRUE, FALSE); * * @return A BOOL that contains the value of the visibility of the event. * TRUE if the event is visible. FALSE otherwise. */ virtual BOOL IsVisible() const; /** * @brief * This member function is used to obtain the value of the visibility flag. * * @param bCheckTop A BOOL that indicates if the top bound visibility is checked. * @param bCheckBottom A BOOL that indicates if the bottom bound visibility is checked. * @param bTopAndBottom A BOOL that indicates if the top and bottom bound visibility is checked. * * @details * Checks visibility of boundaries. * * @return A BOOL that contains the value of the visibility flag. * TRUE if boundaries are visible. FALSE otherwise. */ virtual BOOL IsVisibleEx(BOOL bCheckTop, BOOL bCheckBottom, BOOL bTopAndBottom) const; /** * @brief * This member function is used to create and show the subject editor. * * @details * A subject is created only for the master event if the event is * multi-day. If this member function is called for a slave event, * then the editing process is passed to the master event.\ * * @return A pointer to an CXTPCalendarViewEvent object for which the * editor is created. */ virtual CXTPCalendarViewEvent* StartEditSubject(); /** * @brief * This member function is used to obtain the event's bounding rectangle. * * @details * Call this member function to get the event's bounding rectangle coordinates. * * @return A CRect object containing the bounding rectangle coordinates. */ CRect GetEventsRect() const; /** * @brief * This member function is used to obtain the event's view position identifier. * * @details * The position identifier is a sequential number used to identify the event views. * * @return An int that contains the value of the position identifier. */ int GetEventPlacePos() const; /** * @brief * This member function is used to obtain the count of the event * view positions. * * @details * Call this member function to count the number of event view positions. * * @return An int that contains the number of view positions. */ int GetEventPlaceCount() const; /** * @brief * This member function is used to set the event view place identifier. * * @param nPlace An int that contains the place identifier value. * * @details * Call this member function to set the event view place identifier. */ void SetEventPlacePos(int nPlace); /** * @brief * This member function is used to set the event view places count. * * @param nPlaceCount An int that contains the number of view places. * * @details * Call this member function to set event view places count. */ void SetEventPlaceCount(int nPlaceCount); /** * @brief * This member function is used to determine if the event time * should not be displayed. * * @return A BOOL that contains the HideExentTime value. * TRUE - if event time should not be displayed. Otherwise FALSE. */ BOOL IsHideEventTime() const; /** * @brief * This member function is used to obtain timeframe's bounding rectangle. * * @details * Call this member function to get timeframe's bounding rectangle coordinates. * * @return A CRect object containing the bounding rectangle coordinates. */ CRect GetTimeframeRect() const; protected: /** * @brief * This member function is used to obtain the editor window font. * * @return Pointer to a CFont object that contains the editor window font. */ virtual CFont* GetSubjectEditorFont() const; /** * @brief * This member function is used to obtain the styles of the * editor window. * * @return A DWORD that contains the value of the window styles. */ virtual DWORD GetSubjectEditorStyles() const; /** * @brief * This function is used to change the event place number. * * @param nNewPlace New event place number. */ virtual void ChangeEventPlace(int nNewPlace); public: /** * @brief * This member function is used to perform adjustments of the subject * editor area. * * @details * Call this member function to perform adjustment of subject editor * rectangle. */ virtual void AdjustSubjectEditor(); /** * @brief * This member function is used to perform adjustments of the subject * editor area. Inputs bUpdateView - A BOOL. TRUE if event view * update is required. * * @param bUpdateView TRUE if event view update is required, otherwise FALSE. * * @details * Call this member function to perform adjustment of subject editor * rectangle. */ virtual void AdjustSubjectEditorEx(BOOL bUpdateView); /** * @brief * This member function returns the slot number of event in all day/ * multiday events. * * @return An integer specifying the slot number. */ int GetSlotNumber() const; /** * @brief * This member function set the slot number of event in all day/ * multiday events. * * @param nSlotNumber An integer specifying the slot number. */ void SetSlotNumber(int nSlotNumber); public: CRect m_rcTimeframe; /**< Rectangle area to display times.*/ BOOL m_bHideEventTime; /**< Flag determines if event time should not be displayed.*/ BOOL m_bShowArrow; /**< TRUE if event in AllDay area should have arrow to indicate more events follows*/ private: int m_nSlotNumber; }; ////////////////////////////////////////////////////////////////////////// AFX_INLINE void CXTPCalendarDayViewEvent::SetSlotNumber(int nSlotNumber) { m_nSlotNumber = nSlotNumber; } AFX_INLINE int CXTPCalendarDayViewEvent::GetSlotNumber() const { return m_nSlotNumber; } AFX_INLINE int CXTPCalendarDayViewEvent::GetEventPlacePos() const { return (int)LOWORD((DWORD)m_nEventPlaceNumber); } AFX_INLINE int CXTPCalendarDayViewEvent::GetEventPlaceCount() const { return (int)HIWORD((DWORD)m_nEventPlaceNumber); } AFX_INLINE void CXTPCalendarDayViewEvent::SetEventPlacePos(int nPlace) { m_nEventPlaceNumber = (int)MAKELONG((WORD)nPlace, HIWORD((DWORD)m_nEventPlaceNumber)); } AFX_INLINE void CXTPCalendarDayViewEvent::SetEventPlaceCount(int nPlaceCount) { m_nEventPlaceNumber = (int)MAKELONG(LOWORD((DWORD)m_nEventPlaceNumber), (WORD)nPlaceCount); } AFX_INLINE DWORD CXTPCalendarDayViewEvent::GetSubjectEditorStyles() const { if (IsMultidayEvent()) { return TBase::GetSubjectEditorStyles(); } return (ES_NOHIDESEL | ES_MULTILINE | ES_AUTOVSCROLL); } AFX_INLINE BOOL CXTPCalendarDayViewEvent::IsHideEventTime() const { return m_bHideEventTime; } AFX_INLINE CRect CXTPCalendarDayViewEvent::GetTimeframeRect() const { return m_rcTimeframe; } # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif // !defined(_XTPCALENDARVIEWEVENT_H__)