/** * @file XTPCalendarMonthViewDay.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(_XTPCALENDARMONTHVIEWDAY_H__) # define _XTPCALENDARMONTHVIEWDAY_H__ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPCalendarMonthView; /** * @brief * Forward definition of the structure. */ struct XTP_CALENDAR_HITTESTINFO; /** * @brief * This class represents a single resource view portion of the Calendar * Month View. * * @details * It represents a specific view of the CalendarView's associated events * data grouped by one day and one resource group. And provides basic * functionality on this data using user input through keyboard and mouse. * * @see CXTPCalendarMonthViewDay */ class _XTP_EXT_CLASS CXTPCalendarMonthViewGroup : public CXTPCalendarViewGroupT { public: /** * @brief * Base class type definition. */ typedef CXTPCalendarViewGroupT TBase; /** * @brief * Default object constructor. * Construct CXTPCalendarMonthViewGroup object. * * @param pViewDay Pointer to CXTPCalendarMonthViewDay object. */ CXTPCalendarMonthViewGroup(CXTPCalendarMonthViewDay* pViewDay); /** * @brief * Default class destructor. * * @details * Handles member items deallocation. */ virtual ~CXTPCalendarMonthViewGroup(); /** * @brief * Call this member function to obtain the bounding rectangle of * the tooltip space (currently this is only "click to add new appointment"). * Tooltip rectangle is calculated based on the current mouse position. * * @param ptHit mouse position point * @param hitInfo info to get * * @return A CRect object with relative coordinates of the tooltip. * * @details * This member function returns a rectangle calculated as a bottom * cell rect of the day area where user currently holds a mouse on. */ virtual CRect GetTooltipRect(const CPoint& ptHit, const XTP_CALENDAR_HITTESTINFO& hitInfo) const; protected: /** * @brief * This member function is used to obtain a pointer to itself. * * @details * Call this member function to get the "this" pointer. * * @return Pointer to a CXTPCalendarMonthViewGroup. */ virtual CXTPCalendarMonthViewGroup* GetPThis(); /** * @brief * This member function is used to fill a * XTP_CALENDAR_HITTESTINFO structure. * * @param pHitTest Pointer to XTP_CALENDAR_HITTESTINFO structure. * * @details * Call this member function to gather hit-test information. * * @see XTP_CALENDAR_HITTESTINFO */ virtual void FillHitTestEx(XTP_CALENDAR_HITTESTINFO* pHitTest) const; }; AFX_INLINE CXTPCalendarMonthViewGroup* CXTPCalendarMonthViewGroup::GetPThis() { return this; } /** * @brief * This class represents a day view portion of the CalendarMonthView. * * @details * It represents a specific view of the CalendarView's associated events * data grouped by one day and provides basic functionality on this * data using user input through keyboard and mouse. * * CXTPCalendarMonthViewDay is based on CXTPCalendarViewDayT template * class. It inherits basic behavior from its parent and overlaps/add some * methods to get its own behavior and look. * * @see CXTPCalendarViewDay * @see CXTPCalendarViewDayT */ class _XTP_EXT_CLASS CXTPCalendarMonthViewDay : public CXTPCalendarViewDayT { /** @cond */ friend class CXTPCalendarMonthViewEvent; DECLARE_DYNAMIC(CXTPCalendarMonthViewDay) /** @endcond */ public: /** * @brief * Base class type definition. */ typedef CXTPCalendarViewDayT TBase; /** * @brief * Default object constructor. Construct a CXTPCalendarMonthViewDay * object. * * @param pMonthView Pointer to CXTPCalendarMonthView object. * @param nWeekIndex An int that contains a week view identifier. * @param nWeekDayIndex An int that contains a day view identifier. * * @see ~CXTPCalendarMonthViewDay() */ CXTPCalendarMonthViewDay(const CXTPCalendarMonthView* pMonthView, int nWeekIndex, int nWeekDayIndex); /** * @brief * Default class destructor. * * @details * Handles member items deallocation. */ virtual ~CXTPCalendarMonthViewDay(); /** * @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 rcDay A CRect object that contains the coordinates for * drawing the view. * * @details * Call Populate(COleDateTime dtDayDate) prior to calling AdjustLayout(). * AdjustLayout2 is called by calendar control instead of AdjustLayout * when theme is set. */ virtual void AdjustLayout(CDC* pDC, const CRect& rcDay); /** * @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 rcDay A CRect object that contains the coordinates for * drawing the view. * * @details * Call Populate(COleDateTime dtDayDate) prior to calling AdjustLayout(). * AdjustLayout2 is called by calendar control instead of AdjustLayout * when theme is set. */ virtual void AdjustLayout2(CDC* pDC, const CRect& rcDay); /** * @brief * This member function is used to draw the view contents using * the specified device context. * * @param pDC Pointer to a valid device context. * * @details * Call AdjustLayout() before Draw() * * @see AdjustLayout(CRect rcDay) */ virtual void Draw(CDC* pDC); /** * @brief * This member function is used to fill a * XTP_CALENDAR_HITTESTINFO structure. * * @param pInfo Pointer to XTP_CALENDAR_HITTESTINFO structure. * * @details * Call this member function to gather hit-test information. * * @see XTP_CALENDAR_HITTESTINFO */ virtual void FillHitTestEx(XTP_CALENDAR_HITTESTINFO* pInfo) const; /** * @brief * This member function is used to determine which view item, * if any, is at the specified position index, and returns additional * info in the XTP_CALENDAR_HITTESTINFO template object. * * @param pt A CPoint that contains the coordinates of the point test. * @param pHitTest A pointer to a XTP_CALENDAR_HITTESTINFO structure. * * @details * Implements standard functionality for the HitTestEx method. * * @return A BOOL. TRUE if the item is found. FALSE otherwise. * * @see XTP_CALENDAR_HITTESTINFO */ virtual BOOL HitTestEx(CPoint pt, XTP_CALENDAR_HITTESTINFO* pHitTest) const; /** * @brief * This member function is used to calculate the day date bounding * rectangle. * * @return A CRect object denoting the day date bounding rectangle. * * @details * Call this member function to determine the day view header's * bounding rectangle. */ CRect CalcDayDateRect() const; /** * @brief * This member function is used to calculate the day view area in * which to draw event views. * * @details * Call this member function to determine the day view area that is * used for drawing the event views. * * @return CRect object with rectangle coordinates. */ CRect GetDayEventsRect() const; virtual void SetSelected(); protected: /** * @brief * This member function is used to process left mouse button events. * * @param nFlags A UINT that is used to indicates whether various virtual * keys are down. * @param point A CPoint that specifies the x- and y- coordinates of the cursor. * These coordinates are always relative to the * upper-left corner of the window. * * @return TRUE if the message is handled properly, FALSE else. * * @details * This method is called by the CalendarControl when the user * presses the left mouse button. */ virtual BOOL OnLButtonDown(UINT nFlags, CPoint point); /** * @brief * This member function is used to processes mouse movement events. * * @param nFlags A UINT that is used to indicate whether various virtual * keys are down. * @param point A CPoint that specifies the x- and y- coordinates of the cursor. * These coordinates are always relative to the * upper-left corner of the window. * * @details * This method is called by the CalendarControl when the user * moves the mouse cursor or stylus. */ virtual void OnMouseMove(UINT nFlags, CPoint point); /** * @brief * This member function is used to obtain a pointer to itself. * * @details * Call this member function to get the "this" pointer. * * @return Pointer to a CXTPCalendarMonthViewDay. */ virtual CXTPCalendarMonthViewDay* GetPThis(); int m_nWeekIndex; /**< Week identifier.*/ int m_nWeekDayIndex; /**< Day identifier.*/ }; //=========================================================================== AFX_INLINE CXTPCalendarMonthViewDay* CXTPCalendarMonthViewDay::GetPThis() { return this; } # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif // !defined(_XTPCALENDARMONTHVIEWDAY_H__)