/** * @file XTPCalendarTimeLineView.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(_XTPCALENDARTIMELINEVIEW_H__) # define _XTPCALENDARTIMELINEVIEW_H__ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" # pragma warning(disable : 4100) class CXTPCalendarTimeLineView; class CXTPCalendarTimeLineViewGroups; class CXTPCalendarTimeLineViewTimeScale; class CXTPCalendarTimeLineViewTimeScaleGrid; /** * @brief * Set of parameters transferred from calendar items to * mouse handlers. * * @details * This structure groups together all essential parameters used in * item processing activities. It is a basic structure for all * particular calendar's structures. * * @see XTP_CALENDAR_HITTESTINFO */ struct XTP_CALENDAR_HITTESTINFO_TIMELINE_VIEW : public XTP_CALENDAR_HITTESTINFO { POINT pt; // Point where the mouse was clicked in client coordinates. COleDateTime dt; // A datetime object to fill and return. /** * @brief * Default constructor. * * @details * Initializes an XTP_CALENDAR_HITTESTINFO_TIMELINE_VIEW object to the * empty values. */ XTP_CALENDAR_HITTESTINFO_TIMELINE_VIEW() { pt.x = pt.y = -1; dt = COleDateTime::GetCurrentTime(); } }; /** * @brief * This class implements a specific view portion of the Calendar * control - called Timeline view. */ class _XTP_EXT_CLASS CXTPCalendarTimeLineView : public CXTPCalendarView { friend class CXTPCalendarControl; friend class CXTPDatePickerControl; /** @cond */ DECLARE_DYNAMIC(CXTPCalendarTimeLineView) /** @endcond */ public: /** * @details * Base class type definition. */ typedef CXTPCalendarView TBase; /** * @brief * Default object constructor. * * @param pCalendarControl Pointer to a CXTPCalendarControl object. */ CXTPCalendarTimeLineView(CXTPCalendarControl* pCalendarControl); /** * @brief * Default class destructor. * * @details * Handles class members deallocation. */ virtual ~CXTPCalendarTimeLineView(); /** * @brief * Call this member function to obtain the view type flag. * * @return An XTPCalendarViewType object that contains the view type flag. * * @see XTPCalendarViewType */ virtual XTPCalendarViewType GetViewType() const; /** * @brief * This member function is used to populate the view with data * for all items contained in the view. */ virtual void Populate(); /** * @brief * This member function is used to adjust the view's layout * depending on the window's client dimensions and calls. * * @param pDC Pointer to a valid device context. * @param rcView A CRect that contains the bounding rectangle dimensions * of the view. * @param bCallPostAdjustLayout TRUE for calling additional post-adjustments. * * @details * Call Populate() prior to adjusting layout. Adjust layout of all sub-items. */ virtual void AdjustLayout(CDC* pDC, const CRect& rcView, BOOL bCallPostAdjustLayout = TRUE); /** * @brief * This member function performs all of the drawing logic of the * calendar view. * * @param pDC Pointer to a valid device context. */ virtual void Draw(CDC* pDC); /** * @brief * This member function performs all of the drawing logic of the * calendar view. * Draw2 is called by the calendar control instead of Draw when * a theme is set. * * @param pDC Pointer to a valid device context. */ virtual void Draw2(CDC* pDC); /** * @brief * Call this member function to obtain the date of the day view by * the day's index. * * @param nIndex An int that contains the day view index in the view collection. * * @details * Indexed number starts from 0 and cannot be negative. * * @return A COleDateTime object that contains the day view date and time. */ virtual COleDateTime GetViewDayDate(int nIndex) const; /** * @brief * Call this member function to obtain the start view date. * * @return A COleDateTime object that contains the day view date and time. */ virtual COleDateTime GetStartViewDate() const; /** * @brief * Call this member function to set the start view date. * * @param dt Start view date as COleDateTime. */ virtual void SetStartViewDate(COleDateTime dt); /** * @brief * Call this member function to get the current time scale ID. * * @return An int that contains the current time scale ID. */ virtual int GetTimeScaleID() const; /** * @brief * Call this member function to set the current time scale * * @param eTimeScaleParamsID An int or XTPEnumCalendarTimeScaleParamsID. */ virtual void SetTimeScaleID(int eTimeScaleParamsID); /** * @brief * Call this member function to set the current time scale as an object. * * @return A pointer to CXTPCalendarTimeLineViewTimeScale. */ CXTPCalendarTimeLineViewTimeScale* GetTimeScale() const; /** * @brief * This member function is used to determine which view item, * if any, is at a specified position index, and returns * additional info in an XTP_CALENDAR_HITTESTINFO structure. * * @param pt Coordinates of a point to test. * @param pHitTest Pointer to an XTP_CALENDAR_HITTESTINFO structure. * * @return TRUE if an item is found, otherwise FALSE. */ virtual BOOL HitTest(CPoint pt, XTP_CALENDAR_HITTESTINFO* pHitTest) const; /** * @brief * This member function is used to determine which view item, * if any, is at a specified position index, and returns * additional info in an XTP_CALENDAR_HITTESTINFO_TIMELINE_VIEW structure. * * @param pt Coordinates of a point to test. * @param pHitTest Pointer to an XTP_CALENDAR_HITTESTINFO_TIMELINE_VIEW structure. * * @return TRUE if an item is found, otherwise FALSE. * * @see XTP_CALENDAR_HITTESTINFO_TIMELINE_VIEW */ virtual BOOL HitTestEx(CPoint pt, XTP_CALENDAR_HITTESTINFO_TIMELINE_VIEW* pHitTest) const; using CXTPCalendarView::HitTestEx; /** * @brief * This member function is used to retrieve information about a * scrollbar's state. * * @param pSI A pointer to a scrollbar information structure. * * @return A BOOL. TRUE if the vertical scrollbar is enabled, otherwise FALSE. */ virtual BOOL GetScrollBarInfoV(SCROLLINFO* pSI) const; /** * @brief * This member function is used to retrieve information about a * scrollbar's state. * * @param pSI A pointer to a scrollbar information structure. * @param pnScrollStep A pointer to an int to receive scroll step. Can be NULL. * * @return A BOOL. TRUE if the horizontal scrollbar is enabled, otherwise FALSE. */ virtual BOOL GetScrollBarInfoH(SCROLLINFO* pSI, int* pnScrollStep = NULL) const; /** * @brief * This member function is used to scroll the content of a view. * * @param nPos Position value. * @param nPos_raw Raw position value. */ virtual void ScrollH(int nPos, int nPos_raw); /** * @brief * This member function is used to scroll the content of a view. * * @param nPos Position value. * @param nPos_raw Raw position value. */ virtual void ScrollV(int nPos, int nPos_raw); /** * @brief * Scrolls the specified date into view and selects it if required. * * @param date A datetime value to scroll into view. * @param bSelect A flag to select the date or not. */ virtual void ShowDay(const COleDateTime& date, BOOL bSelect = TRUE) { SetStartViewDate(date); } /** * @brief * This member function shows a pop-up DatePicker control. * * @param dt The initial pop-up datetime selection. * @param point The point to show the pop-up. */ void ShowCalendarPopup(COleDateTime dt, CPoint point); protected: /** * @brief * This member function is called by the framework when metrics * must be updated. */ virtual void RefreshMetrics(); /** * @brief * This member function is called by the framework before the * view is destroyed. */ virtual void OnBeforeDestroy(); /** * @brief * This member function is used to force scroll to the end of the scroll range. * * @param nBar Standard 0 - 1 values (for vertical or horizontal scrollbar). */ virtual void OnScrollEnd(int nBar); /** * @brief * Call this member function to obtain the bounding rectangle of * the tooltip space. * Tooltip rectangle is calculated based on the current mouse position. * * @param ptHit CPoint& of mouse position. * @param hitInfo XTP_CALENDAR_HITTESTINFO. * * @return A CRect object with relative coordinates of the tooltip. * * @details * This member function returns a rectangle calculated as an event * rect which the user currently holds a mouse on. */ CRect GetTooltipRect(const CPoint& ptHit, const XTP_CALENDAR_HITTESTINFO& hitInfo) const; /** * @brief * Call this member function to get all events in a given range. * * @param dtStartDay The start of the range. * @param dtEndDay The end of the range. * * @return A CXTPCalendarEventsPtr object. */ virtual CXTPCalendarEventsPtr _GetEvents(COleDateTime dtStartDay, COleDateTime dtEndDay); CXTPCalendarTimeLineViewTimeScale* m_pTimeScale; /**< Pointer to attached Time Scale object.*/ CXTPCalendarTimeLineViewTimeScaleGrid* m_pTimeScaleGrid; int m_nHScrollPos; /**< keep HScroll position.*/ int m_nVScrollPos; /**< Keep VScroll position.*/ private: CRect m_rcLastPopulate; /**< Last populated view rectangle - used for refresh by demand.*/ public: CXTPCalendarTimeLineViewGroups* m_pGroups; /**< Array of events organized in groups.*/ BOOL m_bTimeLineSeparateGroup; /**< Flag to use separatore line between groups or not.*/ int m_nTimelineMaxPixelsForEvent_ScaleDay; /**< Width in pixels for 1 event for day scale.*/ int m_nTimelineMaxPixelsForEvent_ScaleWeek; /**< Width in pixels for 1 event for week scale.*/ int m_nTimelineMaxPixelsForEvent; /**< Width in pixels for 1 event for month scale.*/ COLORREF m_clrEventBar; /**< Event Bar Color.*/ COLORREF m_clrEventBarLine; /**< Event Bar Line Color.*/ COLORREF m_clrEventBorderLine; /**< Event Border Line Color.*/ COLORREF m_clrTimeScaleBackground; /**< Time Scale Background Color.*/ COLORREF m_clrTimeScaleBorder; /**< Time Scale Border Color.*/ COLORREF m_clrTimeScaleHighlight; /**< Time Scale Highlight Color.*/ COLORREF m_clrTimeScaleText; /**< Time Scale Text Color.*/ COLORREF m_clrSelectedBackground; /**< Selected Background Color.*/ COLORREF m_clrSelectedText; /**< Selected Text Color.*/ COLORREF m_clrBackground; /**< Background Color.*/ COLORREF m_clrText; /**< Text Color.*/ COLORREF m_clrWeekendBackground; /**< Weekend Background Color.*/ # ifdef _XTP_ACTIVEX DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPCalendarTimeLineView); public: afx_msg void OleSetMaxPixelsForEvent(long nPixels); afx_msg long OleGetMaxPixelsForEvent(); afx_msg void OleSetMaxPixelsForEvent_ScaleDay(long nPixels); afx_msg long OleGetMaxPixelsForEvent_ScaleDay(); afx_msg void OleSetMaxPixelsForEvent_ScaleWeek(long nPixels); afx_msg long OleGetMaxPixelsForEvent_ScaleWeek(); afx_msg BOOL OleGetTimeLineSeparateGroup(); afx_msg void OleSetTimeLineSeparateGroup(BOOL bSet); afx_msg OLE_COLOR OleGetTimeLineEventBarColor(); afx_msg void OleSetTimeLineEventBarColor(OLE_COLOR clrOleColor); afx_msg OLE_COLOR OleGetTimeLineEventBarLineColor(); afx_msg void OleSetTimeLineEventBarLineColor(OLE_COLOR clrOleColor); afx_msg OLE_COLOR OleGetTimeLineEventBorderLineColor(); afx_msg void OleSetTimeLineEventBorderLineColor(OLE_COLOR clrOleColor); afx_msg OLE_COLOR OleGetTimeLineScaleBackgroundColor(); afx_msg void OleSetTimeLineScaleBackgroundColor(OLE_COLOR clrOleColor); afx_msg OLE_COLOR OleGetTimeLineScaleBorderColor(); afx_msg void OleSetTimeLineScaleBorderColor(OLE_COLOR clrOleColor); afx_msg OLE_COLOR OleGetTimeLineScaleHighlightColor(); afx_msg void OleSetTimeLineScaleHighlightColor(OLE_COLOR clrOleColor); afx_msg OLE_COLOR OleGetTimeLineScaleTextColor(); afx_msg void OleSetTimeLineScaleTextColor(OLE_COLOR clrOleColor); afx_msg OLE_COLOR OleGetTimeLineSelectedBackgroundColor(); afx_msg void OleSetTimeLineSelectedBackgroundColor(OLE_COLOR clrOleColor); afx_msg OLE_COLOR OleGetTimeLineWeekendBackgroundColor(); afx_msg void OleSetTimeLineWeekendBackgroundColor(OLE_COLOR clrOleColor); afx_msg OLE_COLOR OleGetTimeLineSelectedTextColor(); afx_msg void OleSetTimeLineSelectedTextColor(OLE_COLOR clrOleColor); afx_msg OLE_COLOR OleGetTimeLineBackgroundColor(); afx_msg void OleSetTimeLineBackgroundColor(OLE_COLOR clrOleColor); afx_msg OLE_COLOR OleGetTimeLineTextColor(); afx_msg void OleSetTimeLineTextColor(OLE_COLOR clrOleColor); DATE OleGetTimeScaleMinTime(); void OleSetTimeScaleMinTime(DATE dtNewScaleMinTime); DATE OleGetTimeScaleMaxTime(); void OleSetTimeScaleMaxTime(DATE dtNewScaleMaxTime); # endif }; //=========================================================================== AFX_INLINE XTPCalendarViewType CXTPCalendarTimeLineView::GetViewType() const { return xtpCalendarTimeLineView; } AFX_INLINE CXTPCalendarTimeLineViewTimeScale* CXTPCalendarTimeLineView::GetTimeScale() const { return m_pTimeScale; } # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif // !defined(_XTPCALENDARTIMELINEVIEW_H__)