/** * @file XTPDatePickerControl.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(_XTPDATEPICKERCONTROL_H__) # define _XTPDATEPICKERCONTROL_H__ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 ///////////////////////////////////////////////////////////////////////////// // CXTPDatePickerControl window # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPDatePickerPaintManager; class CXTPDatePickerItemMonth; class CXTPDatePickerDaysCollection; class CXTPDatePickerList; class CXTPDatePickerControl; class CXTPNotifyConnection; class CXTPNotifySink; /** * @brief * This structure represents a set of parameters which are * used to display day items. * * 1. There could be customized foreground and background colors. * 2. Also you can text font for the displayed day text. * 3. And as the last thing you can customize a day picture displayed there, * using OLE PICTUREDISP interface and OleSetPicture method. */ struct _XTP_EXT_CLASS XTP_DAYITEM_METRICS : public CXTPCmdTarget { /** * @brief * Get day item font. * * @return Return a day font stored by the structure. */ CFont* GetFont(); /** * @brief * Set a new font for the day item. * * @param pFont Pointer to a CFont object. */ void SetFont(CFont* pFont); COLORREF clrForeground; /**< A COLORREF object that contains the item's foreground color.*/ COLORREF clrBackground; /**< A COLORREF object that contains the item's background color.*/ XTP_DAYITEM_METRICS(); virtual ~XTP_DAYITEM_METRICS(){}; private: CXTPFont m_xtpFontText; /**< A CFont object that contains the item's text font.*/ XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, m_fntText, m_xtpFontText, GetTextFontHandle); # ifdef _XTP_ACTIVEX CPictureHolder m_olePicture; /**< A Picture object holder.*/ DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() public: LPFONTDISP OleGetFont(); void OleSetFont(LPFONTDISP pFontDisp); LPPICTUREDISP OleGetPicture(); /** * @brief * Set a new picture to display for the day item. */ void OleSetPicture(LPPICTUREDISP pPictureDisp); /** * @brief * Returns a picture holder for the picture assigned to be displayed * in the day item. * * @see CPictureHolder overview. */ CPictureHolder* GetPictureHolder(); # endif }; # ifdef _XTP_ACTIVEX AFX_INLINE CPictureHolder* XTP_DAYITEM_METRICS::GetPictureHolder() { return &m_olePicture; } # endif /** * @brief * Structure used to send button notification messages. * * @details This structure represents a set of parameters which are sent * to the Main window in a WM_NOTIFY message from DatePicker control * and notify the main window when a button event occurs. */ struct XTP_NC_DATEPICKER_BUTTON { NMHDR hdr; /**< Contains information about a notification message.*/ int nID; /**< Date picker button ID (could be XTP_IDS_DATEPICKER_TODAY or XTP_IDS_DATEPICKER_NONE)*/ }; /** * @brief * Callback function definition for the IsITEMMETRICS function. * @details First three arguments are required. The pUserData can be NULL. * pDatePicker - is CXTPDatePickerControl* type to provide DatePicker * control pointer. * rDateTime - is COleDateTime reference type to provide date time * storage object. * pDayItemMetrics - is XTP_DAYITEM_METRICS* pointer type to provide display * metrics. * pUserData - is void* pointer to any additional user's defined parameter, * this value can be NULL. */ typedef void(CALLBACK* PFNITEMMETRICS)(CXTPDatePickerControl* pDatePicker, const COleDateTime& rDateTime, XTP_DAYITEM_METRICS* pDayItemMetrics, void* pUserData); const UINT XTP_NC_DATEPICKER_BUTTON_CLICK = (NM_FIRST - 50); /**< Notify ID to parent window.*/ const UINT XTP_NC_DATEPICKER_SELECTION_CHANGED = (NM_FIRST - 51); /**< Notify ID to parent window.*/ const UINT XTP_DATEPICKER_TIMERID = 255; /**< Date picker timer ID.*/ const UINT XTP_DATEPICKER_TIMER_INTERVAL = 200; /**< Date picker timer interval.*/ const UINT XTP_SELECTION_INFINITE = (UINT)-1; /**< Infinite number of selected days.*/ /** * @brief * Border style of Date picker control */ enum XTPDatePickerBorderStyle { xtpDatePickerBorderNone, /**< No border.*/ xtpDatePickerBorder3D, /**< 3D border.*/ xtpDatePickerBorderOffice, /**< Office-like border*/ xtpDatePickerBorderStatic /**< Static border.*/ }; /** * @brief * This class represents a DatePicker button. * * @return CXTPDatePickerButton provides storage for all parameters needed to * display and handle a button. */ class _XTP_EXT_CLASS CXTPDatePickerButton { public: /** * @brief * Default button constructor. * * @details Default button constructor handles all necessary * initialization. */ CXTPDatePickerButton(); /** * @brief * Destroys a CXTPDatePickerButton object, handles cleanup and deallocation. */ virtual ~CXTPDatePickerButton() { } /** * @brief * Get a button caption. * * @details Load from resources string using ID stored in m_nID member or * value which was set by SetCaption() call. * * @return Returns a button caption. * * @see m_nID * @see SetCaption */ virtual CString GetCaption() const; /** * @brief * Set a button caption. * * @param pcszCaption A caption string. * * @details If pcszCaption is empty string - GetCaption will the m_nID to load * caption string from resources. * * @see GetCaption * @see m_nID */ virtual void SetCaption(LPCTSTR pcszCaption); public: int m_nID; /**< This member variable is used to specify the identifier of the button. Also it used as resource ID for a caption string. */ CRect m_rcButton; /**< This member variable is used to specify the bounding rectangle coordinates of a button.*/ BOOL m_bVisible; /**< This member variable is used to indicate if a button is visible.*/ BOOL m_bPressed; /**< This member variable is used to indicate if a button is pressed.*/ BOOL m_bHighlight; /**< This member variable is used to indicate if a button is highlighted.*/ protected: CString m_strCaption; /**< This member variable is used to specify the caption of the button.*/ }; /** * @brief * Class CXTPDatePickerButtons represents a collection of buttons. * * @details CXTPDatePickerButtons inherits most of the behavior of the * standard MFC CArray. The DatePicker control can display and handle * any number of buttons. CXTPDatePickerButtons provides the basic * functionality to handle the collection.
* Create a CXTPDatePickerButtons object by calling the default * constructor without parameters. Furthermore, add buttons to * collection using standard CArray member functions. * * @see CArray */ class _XTP_EXT_CLASS CXTPDatePickerButtons : public CArray
* // Declare a local CXTPDatePickerControl object.
* CXTPDatePickerControl myDatePicker;
*
* // Declare a dynamic CXTPDatePickerControl object.
* CXTPDatePickerControl* pMyDatePicker = new CXTPDatePickerControl();
*
* // Create a window
* if (!myDatePicker.Create(WS_CHILD | WS_TABSTOP | WS_VISIBLE, CRect(0, 0, 200, 200), this,
* ID_DATEPICKER_CONTROL))
* {
* TRACE(_T("Failed to create the date picker window\\n"));
* }
*
*
* @see Create
*/
CXTPDatePickerControl();
/**
* @brief
* Destroys a CXTPDatePickerControl object, handles cleanup and deallocation.
*/
virtual ~CXTPDatePickerControl();
public:
/**
* @brief
* This member function is used to create the Date Picker Control
* Window.
*
* @param dwStyle Specifies the window style attributes.
* @param rect A RECT object that contains the coordinates of the
* window, in the client coordinates of pParentWnd.
* @param pParentWnd A CWnd pointer to the parent window.
* @param nID A UINT that contains the ID of the child window.
* @param pContext A CCreateContext pointer that contains the create context
* of the window.
*
* @return Nonzero if successful. Otherwise 0.
*/
virtual BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID,
CCreateContext* pContext = NULL);
/**
* @brief
* This member function implements pop-up window behavior for the
* Date Picker control.
*
* @param rect Rectangle that contains the size and position of the
* window, in client coordinates of pParentWnd.
* @param pParentWnd Pointer to the parent window.
*
* @return TRUE if successful, FALSE otherwise.
*
* @see IsModal
*/
virtual BOOL GoModal(const RECT& rect, CWnd* pParentWnd = NULL);
/**
* @brief
* Is the control runs in modal mode.
*
* @return TRUE when the control is used as a pop-up window,
* FALSE otherwise.
*
* @see GoModal
*/
BOOL IsModal() const;
/**
* @brief
* This member function returns a pointer to the associated paint
* manager.
*
* @details Call this member function to obtain a pointer to the paint manager
* -object. The paint manager object is used for drawing the date
* picker window.
* @return Pointer to the paint manager object.
*
* @see SetTheme
* @see CXTPCalendarControl::SetPaintManager
*/
CXTPDatePickerPaintManager* GetPaintManager() const;
/**
* @brief
* This member function redraws the control windows.
*
* @details Call this member function to redraw all control windows
* according to the stored parameter values. The window will be
* updated immediately: CWnd::UpdateWindow() will be called.
*
* @see _RedrawControl
*/
virtual void RedrawControl();
/**
* @brief
* This member function sets the new control drawing theme.
*
* @param pPaintManager Pointer of the new paint manager object or derived
* class like CXTPDatePickerThemeOffice2007.
* If NULL, then the default paint manager object is set.
*
* @details Call this member function to set the paint manager object that is
* used for drawing a date picker window.
*
* @see GetPaintManager
*/
void SetTheme(CXTPDatePickerPaintManager* pPaintManager = NULL);
/**
* @brief
* This function is called to determine if AutoSize mode is set.
*
* @details Call this member function to determine whether the control's auto
* size mode is enabled.
*
* @return A boolean value that specifies is AutoSize is enabled.
* TRUE if AutoSize is enabled.
* Otherwise return FALSE.
*
* @see SetAutoSize
*/
BOOL IsAutoSize() const;
/**
* @brief
* This function sets the AutoSize mode.
*
* @param bAuto Boolean value. If bAuto is TRUE, then AutoSize
* is enabled. If this parameter is FALSE, then
* AutoSize is disabled.
*
* @details Set AutoSize mode to TRUE if you want the control to automatically
* calculate the number of month items according to control's size.
* When this mode is enabled and there is enough space on control's
* client area, the control adds a row or a column of month items
* and centers them both horizontally and vertically.
*
* @see IsAutoSize
*/
void SetAutoSize(BOOL bAuto = TRUE);
/**
* @brief
* This member function sets the user-defined day metrics callback
* function.
*
* @param pFunc Pointer to the callback function.
* @param pParam Pointer to any user-defined parameter provided to the
* callback function.
*
* @details Call this member function to set up the user-defined callback
* function to manipulate the 'special day's attributes'.
*
* @see PFNITEMMETRICS
* @see GetCallbackDayMetrics
* @see GetDayMetrics
*/
virtual void SetCallbackDayMetrics(PFNITEMMETRICS pFunc, void* pParam = NULL);
/**
* @brief
* This member function returns the day metrics callback function.
*
* @details Call this member function to obtain a pointer to the user-defined
* day metrics callback function.
* @return Pointer to the callback function.
*
* @see PFNITEMMETRICS
* @see SetCallbackDayMetrics
* @see GetDayMetrics
*/
PFNITEMMETRICS GetCallbackDayMetrics() const;
/**
* @brief
* This member function returns the day item drawing metrics.
*
* @param dtDay Reference to the DateTime value to check.
* @param pDayMetics Pointer to the day metrics structure.
*
* @details Determines whether or not a given date is special. This function
* calls a callback function to make this determination.
*
* @see GetCallbackDayMetrics
* @see SetCallbackDayMetrics
*/
virtual void GetDayMetrics(COleDateTime& dtDay, XTP_DAYITEM_METRICS* pDayMetics);
/**
* @brief
* This member function sets the day of the week that is displayed in
* the leftmost column of the calendar.
*
* @param nDay An integer value representing which day is set as the first day
* of the week. This value must be one of the day numbers. See
* GetFirstDayOfWeek for a description of the day numbers.
*
* @see GetFirstDayOfWeek
*/
void SetFirstDayOfWeek(int nDay);
/**
* @brief
* This member function obtains the first day of the week that is
* displayed in the leftmost column of the calendar.
*
* @details An integer value that represents the first day of the week. The
* days of the week are represented as integers, as follows.
* - 1: Sunday
* - 2: Monday
* - 3: Tuesday
* - 4: Wednesday
* - 5: Thursday
* - 6: Friday
* - 7: Saturday
* @return Gets the first day of the week
* @see SetFirstDayOfWeek
*/
int GetFirstDayOfWeek() const;
/**
* @brief
* This member function sets the required number of this year days
* in the first week of the year.
*
* @param nDays An integer value representing the required number of
* days of the new year in the first week of the year.
* The value should be between 1 (default) and 7 (full week).
*
* @see GetFirstWeekOfYearDay
*
* Example:
* * // Setup German style of week numbers calculation. * pMyDatePicker->SetFirstWeekOfYearDays(4); **/ void SetFirstWeekOfYearDays(int nDays); /** * @brief * This member function obtains the current required number of year days * in the first week of the year. * * @return An integer value that represents the required number of * days of the new year in the first week of this year. * The value should be between 1 (by default) and 7 (full week). * * @see SetFirstWeekOfYearDays */ int GetFirstWeekOfYearDays() const; /** * @brief * This function sets visibility for the "Today" and "None" buttons. * * @param bShowToday Provide TRUE to show the "Today" button, or FALSE to * hide it. * @param bShowNone Provide TRUE to show the "None" button, or FALSE to * hide it. * * @details Call this member function to hide or show any of the control's * service buttons. * * @see IsTodayButtonVisible * @see IsNoneButtonVisible */ virtual void SetButtonsVisible(BOOL bShowToday, BOOL bShowNone); /** * @brief * This member function is used to obtain the value of the visibility * flag for the "Today" button. * * @details Call this member function to determine the visibility of the * "Today" service button. * @return A boolean value that specifies if the "Today" button is visible. * TRUE if the "Today" button is visible. * Otherwise FALSE. * * @see IsNoneButtonVisible * @see SetButtonsVisible */ virtual BOOL IsTodayButtonVisible(); /** * @brief * This function returns the boolean visibility flag of the "None" * button. * * @details Call this member function to determine the visibility of the * "None" service button. * @return A boolean value that specifies if the "None" button is visible. * TRUE when the "None" button is visible. * Otherwise FALSE. * * @see IsTodayButtonVisible * @see SetButtonsVisible */ virtual BOOL IsNoneButtonVisible(); /** * @brief * Call this member function to enable or disable highlighting of the * "Today" cell. * * @param bValue Boolean value determines if the "Today" cell is * highlighted. * * @details The "Today" cell is determined and changed using the SetToday and * GetToday member functions. When highlighting is enabled, the cell * is surrounded by a rectangle frame of the specific color. * * @see GetHighlightToday * @see SetToday * @see GetToday * @see CXTPDatePickerPaintManager::GetHighlightTodayColor */ void SetHighlightToday(BOOL bValue); /** * @brief * Call this member function to determine whether the "Today" cell * highlighting is enabled or disabled. * * @details This member function returns a boolean flag that specifies the * "Today" button highlighting mode. * @return A BOOL that indicates if the "Today" cell is highlighted. * TRUE if the "Today" cell is highlighted. Otherwise FALSE. * * @see GetHighlightToday * @see SetToday * @see GetToday * @see CXTPDatePickerPaintManager::GetHighlightTodayColor */ BOOL GetHighlightToday() const; /** * @brief * Call this member to set right-to-left mode. * * @param bRightToLeft TRUE to set right-to-left reading-order properties. */ virtual void SetLayoutRTL(BOOL bRightToLeft); /** * @brief * Call this member function to show or hide the week numbers. * * @param bValue Boolean value determines whether week numbers are visible. * * @details Week numbers are shown for each week in each month at the very * left column of the month, separated by the vertical line from the * -other week days. This member function controls the visibility * mode of the week numbers. * * @see GetShowWeekNumbers * @see CXTPDatePickerPaintManager::GetWeekNumbersBackColor * @see CXTPDatePickerPaintManager::GetWeekNumbersTextColor * @see CXTPDatePickerPaintManager::GetWeekNumbersTextFont */ virtual void SetShowWeekNumbers(BOOL bValue); /** * @brief * Call this member function to determine if the week numbers are * visible. * * @details The week numbers are shown for each week in each month as the very * left column of the month, separated by the vertical line from the * -other week days. This member function determines if the week * numbers are shown. * @return Boolean value that determines if the week numbers are set to be * shown. * TRUE - If the week numbers are visible. * FALSE - If the week numbers are not visible. * * @see SetShowWeekNumbers * @see CXTPDatePickerPaintManager::GetWeekNumbersBackColor * @see CXTPDatePickerPaintManager::GetWeekNumbersTextColor * @see CXTPDatePickerPaintManager::GetWeekNumbersTextFont */ BOOL GetShowWeekNumbers() const; /** * @brief * Call this member function to show or hide non-month days. * * @param bShow Boolean value determines if the non-month days are * shown. * TRUE If the non\-month days are visible. * FALSE If the non\-month days are not visible. * * @details Non-month days are shown in a special color or font. Non-month * days are shown just before and after regular days of a specific * month. * Note: * For a control showing more than 1 month, non-month days will be * shown before the first month, and after the last one. * * @see GetShowNonMonthDays * @see CXTPDatePickerPaintManager::GetNonMonthDayBackColor * @see CXTPDatePickerPaintManager::GetNonMonthDayTextColor * @see CXTPDatePickerPaintManager::GetNonMonthDayTextFont */ void SetShowNonMonthDays(BOOL bShow); /** * @brief * Call this member function to determine if the non-month days are * visible. * * @details Non-month days are shown in a special color or font just before * and after regular days of a specific month. * Note: * For a control showing more than 1 month, non-month days are shown * before the first month, and after the last month. * @return A boolean value that specifies if the "non-month days" are * visible. * TRUE if non-month days are visible. * FALSE otherwise. * * @see SetShowNonMonthDays * @see CXTPDatePickerPaintManager::GetNonMonthDayBackColor * @see CXTPDatePickerPaintManager::GetNonMonthDayTextColor * @see CXTPDatePickerPaintManager::GetNonMonthDayTextFont */ BOOL GetShowNonMonthDays() const; /** * @brief * Call this member function to set borders style * around the control. * * @param borderStyle New border style value determined by XTPDatePickerBorderStyle * enumeration. * * @see GetBorderStyle * @see CXTPDatePickerPaintManager::DrawBorder * @see XTPDatePickerBorderStyle */ void SetBorderStyle(XTPDatePickerBorderStyle borderStyle); /** * @brief * Call this member function to determine if the border is * visible. * * @return XTPDatePickerBorderStyle value that specifies the border style. * * @see SetBorderStyle * @see CXTPDatePickerPaintManager::DrawBorder * @see XTPDatePickerBorderStyle */ XTPDatePickerBorderStyle GetBorderStyle() const; /** * @brief * Call this member function to set the number of months in the * control's grid. * * @param nRows int that contains the new rows count value. * @param nCols int that contains the new columns count value. * @param bRestrictMode BOOL flag used for resizing. * * @details This member function is called in the AutoSize mode. It sets the * new number of columns and rows in the control's months grid. Also, * the function redraws each month within the existing control's * coordinates, reducing or enlarging the size of each month item as * necessary. * Note: * This function does nothing when AutoSize mode is enabled. * * @see GetRows * @see GetCols */ virtual void SetGridSize(int nRows, int nCols, BOOL bRestrictMode = FALSE); /** * @brief * Call this member function to obtain the number of rows in the * months grid. * * @return The number of rows in the control's months grid. * * @see GetCols * @see SetGridSize */ int GetRows() const; /** * @brief * Call this member function to obtain the number of columns in the * months grid. * * @return An int that contains the number of columns in the control's months * grid. * * @see GetRows * @see SetGridSize */ int GetCols() const; /** * @brief * This member function finds the month item at the provided point. * * @param ptMouse The mouse coordinates to test. * * @details Call this function to retrieve a pointer to the month item * at the specified position. * * This HitTest(PMCHITTESTINFO pMCHitTest) function determines which date portion of the * picker control, if any, is at a specified position. It implements the behavior of * the CMonthCalCtrl::HitTest function. * @return A pointer to the month item where the mouse was clicked. * Returns NULL if the mouse was clicked outside the months grid area. * * HitTest(PMCHITTESTINFO pMCHitTest) returns a DWORD value. Equal to the uHit member of * the MCHITTESTINFO structure. * * @see HitTest * @see CMonthCalCtrl::HitTest * @see MCHITTESTINFO */ virtual CXTPDatePickerItemMonth* HitTest(CPoint ptMouse) const; /** * @brief * This member function finds the month item at the provided point. * * @param pMCHitTest A pointer to a MCHITTESTINFO structure * containing hit testing points for the * date picker control. * * @details Call this function to retrieve a pointer to the month item * at the specified position. * * This HitTest(PMCHITTESTINFO pMCHitTest) function determines which date portion of the * picker control, if any, is at a specified position. It implements the behavior of * the CMonthCalCtrl::HitTest function. * @return A pointer to the month item where the mouse was clicked. * Returns NULL if the mouse was clicked outside the months grid area. * * HitTest(PMCHITTESTINFO pMCHitTest) returns a DWORD value. Equal to the uHit member of * the MCHITTESTINFO structure. * * @see HitTest * @see CMonthCalCtrl::HitTest * @see MCHITTESTINFO */ virtual DWORD HitTest(PMCHITTESTINFO pMCHitTest) const; /** * @brief * This member function scrolls the control's months grid to the left * by the specified number of months. * * @param nMonthCount Integer value that specifies how many months to scroll. * The default value is 1. * * @details Call this member function to scroll the months grid to the left by * nMonthCount positions. * * @see ScrollRight */ virtual void ScrollLeft(int nMonthCount = 1); /** * @brief * This member function scrolls the control's months grid to the * right by the specified amount of months. * * @param nMonthCount Integer value that specifies how many months to scroll. * The default value is 1. * * @details Call this member function to scroll the months grid to the right * by nMonthCount positions. * * @see ScrollLeft */ virtual void ScrollRight(int nMonthCount = 1); /** * @brief * Call this member function to send notifications to the parent * window. * * @param nMessage An int that contains the identifier of the message. See remarks * section for a list of valid values. * @param pNMHDR Pointer to the XTP_NC_DATEPICKER_BUTTON notification * structure. * * @details The following values are valid for nMessage: * - XTP_NC_DATEPICKER_BUTTON_CLICK - Notifies that one of date * picker buttons was clicked. * - XTP_NC_DATEPICKER_SELECTION_CHANGED - Notifies that the date * picker selection has changed. * This function notifies the parent window that something happened. * For the example of how to catch these messages see below. * * Example: *
* // First, add the message handler to your message map.
* ON_NOTIFY(XTP_NC_DATEPICKER_BUTTON_CLICK, 1000, OnButtonPressed)
*
* // Then implement the message handler like the example below
* void YourDlg::OnButtonPressed(NMHDR* pNotifyStruct, LRESULT*)
* {
* XTP_NC_DATEPICKER_BUTTON* pNMButton = (XTP_NC_DATEPICKER_BUTTON*)pNotifyStruct;
*
* switch (pNMButton-\>nID)
* {
* case XTP_IDS_DATEPICKER_TODAY:
* TRACE(_T("TODAY BUTTON PRESSEDn"));
* break;
* case XTP_IDS_DATEPICKER_NONE:
* TRACE(_T("NONE BUTTON PRESSEDn"));
* break;
* }
* }
*
*
* @return An LRESULT that is used to indicate the success of the function. Nonzero
* if the message is sent successfully, zero otherwise.
*/
virtual LRESULT SendMessageToParent(int nMessage, NMHDR* pNMHDR = NULL);
/**
* @brief
* This function checks a specific date to determine if it is
* contained in the control's selection.
*
* @param dtDay - A date to check.
*
* @details Call this member function to determine whether dtDay is selected.
*
* @return A boolean value that specifies if the date is contained in the
* current selection.
* TRUE when the day is selected.
* Otherwise FALSE.
*
* @see Select
* @see Deselect
*/
virtual BOOL IsSelected(const COleDateTime& dtDay) const;
/**
* @brief
* This function checks a specific date to determine if it is
* focused.
*
* @param dtDay A date to check.
*
* @details Focused item is used only for the keyboard navigation and selecting.
* It is initialized by keyboard using first day of the current
* selection or if selection is empty the first day of the first
* visible month is used.
* Focused item is cleared by mouse or by set selection externally.
* @return TRUE when the day is focused, FALSE otherwise.
*
* @see ClearFocus
*/
virtual BOOL IsFocused(const COleDateTime& dtDay) const;
/**
* @brief
* This function clear focused attribute if it is set.
*
* @details Focused item is used only for the keyboard navigation and selecting.
* It is initialized by keyboard using first day of the current
* selection or if selection is empty the first day of the first
* visible month is used.
* Focused item is cleared by mouse or by set selection externally.
*
* @see IsFocused
*/
virtual void ClearFocus();
/**
* @brief
* Call this member function to select a specific day.
*
* @param dtDay Date to be selected.
*
* @details This function determines if one more item can be added to the
* collection of selected days. If yes, then the selected day is
* added to the list of selected items.
*
* @see Deselect
* @see IsSelected
*/
virtual void Select(const COleDateTime& dtDay);
/**
* @brief
* Call this member function to de-select the specified day.
*
* @param dtDay Date to be deselected.
*
* @details This member function removes the provided day from the control's
* selected days collection.
*
* @see Select
* @see IsSelected
*/
virtual void Deselect(const COleDateTime& dtDay);
/**
* @brief
* Call this member function to ensure that a specified
* COleDateTime item is visible.
*
* @param dtDate Reference to the COleDateTime item whose visibility
* must be ensured.
*
* @details If necessary, the function scrolls the month grid on the control
* to make the day visible.
*
* @see EnsureVisibleSelection
*/
virtual void EnsureVisible(const COleDateTime& dtDate);
/**
* @brief
* Call this member function to ensure that the selection range is
* visible.
*
* @details If necessary, the function scrolls the month grid on the control
* to make all selected days visible.
*
* @see EnsureVisible
* @see EnsureVisibleFocus
*/
virtual void EnsureVisibleSelection();
/**
* @brief
* Call this member function to ensure that the focused item is visible.
*
* @details Focused item is used only for the keyboard navigation and selecting.
* It is initialized by keyboard using first day of the current
* selection or if selection is empty the first day of the first
* visible month is used.
* Focused item is cleared by mouse or by set selection externally.
*
* @see EnsureVisible
* @see EnsureVisibleSelection
*/
virtual void EnsureVisibleFocus();
/**
* @brief
* This member function sets the user-defined month name.
*
* @param nMonth An int that contains the Month number corresponding to the
* month name. i.e. 1 = January, 2 = February, 3 = March, ...
* Valid values are from 1 to 12.
* @param strMonthName A CString that contains the New month name.
*
* @details Use this function to change the shown month name to any preferred
* -or localized values.
*
* @see GetMonthName
* @see SetDayOfWeekName
* @see GetDayOfWeekName
*/
void SetMonthName(int nMonth, LPCTSTR strMonthName);
/**
* @brief
* This member function returns the month name of the given integer
* value.
*
* @param nMonth - Month number. The valid range is 1 \<= nMonth \>= 12.
*
* @details Call this member function to retrieve the name of the month which
* was previously set by SetMonthName function. If month name was not
* set by SetMonthName function, it will return the default value,
* which is the default localized month name.
* @return If nMonth is a valid integer value, then the function returns the
* name of the month. If nMonth is not valid, then the function
* \returns an empty string.
*
* @see SetMonthName
* @see SetDayOfWeekName
* @see GetDayOfWeekName
*/
CString GetMonthName(int nMonth) const;
/**
* @brief
* This member function sets the system-defined format of year_month string.
*
* @param nEnable Boolean value determines if the system-defined format
* of year_month string are shown.
*
* @details String m_strYearMonthFormat can be defined proper only if
* operating system is Windows 2000 or a later version.
*
* @see SetMonthName
* @see GetMonthName
* @see m_strYearMonthFormat
*/
void EnableSysYearMonthFormat(BOOL nEnable);
/**
* @brief
* This member function sets the user-defined DayOfWeek name.
*
* @param nDayOfWeek DayOfWeek number to set new name for.
* @param strDayOfWeekName New DayOfWeek name.
*
* @details Valid day-of-week range is between 1 and 7, where
* 1 = Sunday, 2 = Monday, and so on.
*
* @see GetDayOfWeekName
* @see SetMonthName
* @see GetMonthName
*/
void SetDayOfWeekName(int nDayOfWeek, LPCTSTR strDayOfWeekName);
/**
* @brief
* This member function returns the DayOfWeek name associated
* with the integer value of nDayOfWeek.
*
* @param nDayOfWeek DayOfWeek number.
*
* @return Valid day-of-week range is between 1 and 7, where
* 1 = Sunday, 2 = Monday, and so on.
*
* @details If nDayOfWeek is a valid integer value, then the function
* returns the name of the week associated with the integer value
* of nDayOfWeek. If nDayOfWeek is not a valid integer value, then
* the function returns an empty string.
*
* @see SetDayOfWeekName
* @see SetMonthName
* @see GetMonthName
*/
CString GetDayOfWeekName(int nDayOfWeek) const;
/**
* @brief
* This member function retrieves date information representing the
* upper and lower limits of the date range currently selected by the
* user.
*
* @param refMinRange A reference to a COleDateTime object containing the
* minimum date allowed.
* @param refMaxRange A reference to a COleDateTime object containing the
* maximum date allowed.
*
* @details This member function implements the behavior of the
* CMonthCalCtrl::GetSelRange function.
*
* @return Nonzero if successful. Otherwise 0.
*
* @see SetSelRange
* @see CMonthCalCtrl::GetSelRange
*/
virtual BOOL GetSelRange(COleDateTime& refMinRange, COleDateTime& refMaxRange) const;
/**
* @brief
* This member function sets the selection for a date picker
* control to a given date range.
*
* @param refMinRange A reference to a COleDateTime object containing the
* date at the lowest end of the range.
* @param refMaxRange A reference to a COleDateTime object containing the
* date at the highest end of the range.
*
* @details This member function implements the behavior of the
* CMonthCalCtrl::SetSelRange function.
*
* Please note that this method doesn't refresh the control, and in
* order to update control's picture you'll have to call RedrawControl
* method after changing a selection.
*
* @return Nonzero if successful. Otherwise 0.
*
* @see GetSelRange
* @see CMonthCalCtrl::SetSelRange
*/
virtual BOOL SetSelRange(const COleDateTime& refMinRange, const COleDateTime& refMaxRange);
/**
* @brief
* This member function retrieves the minimum size required to show a
* full month in the date picker control or a
* specified number of full month items in a date picker control.
*
* @param pRect A pointer to a RECT structure that receives the bounding
* rectangle information. This parameter must be a valid address
* and cannot be NULL.
*
* @details This member function implements the behavior of the
* CMonthCalCtrl::GetMinReqRect function.
*
* GetMinReqRect(RECT* pRect, int nRows, int nCols) retrieves the minimum
* size required to show a specified number of full month items in
* a date picker control. The functionality implemented by this function is similar to
* the CMonthCalCtrl::GetMinReqRect, but instead of calculating a rectangle size for 1 month
* only, it can also calculate a rectangle size for any specified number of month items.
* @return If successful, this member function returns nonzero and pRect
* receives the applicable bounding rectangle information. If
* unsuccessful, the member function returns 0.
*
* @see CMonthCalCtrl::GetMinReqRect
*/
virtual BOOL GetMinReqRect(RECT* pRect) const;
/**
* @brief
* This member function retrieves the minimum size required to show a
* full month in the date picker control or a
* specified number of full month items in a date picker control.
*
* @param pRect A pointer to a RECT structure that receives the bounding
* rectangle information. This parameter must be a valid address
* and cannot be NULL.
* @param nRows A number of months in a row inside the calculated rectangle.
* @param nCols A number of months in a column inside the calculated rectangle.
*
* @details This member function implements the behavior of the
* CMonthCalCtrl::GetMinReqRect function.
*
* GetMinReqRect(RECT* pRect, int nRows, int nCols) retrieves the minimum
* size required to show a specified number of full month items in
* a date picker control. The functionality implemented by this function is similar to
* the CMonthCalCtrl::GetMinReqRect, but instead of calculating a rectangle size for 1 month
* only, it can also calculate a rectangle size for any specified number of month items.
* @return If successful, this member function returns nonzero and pRect
* receives the applicable bounding rectangle information. If
* unsuccessful, the member function returns 0.
*
* @see CMonthCalCtrl::GetMinReqRect
*/
virtual BOOL GetMinReqRect(RECT* pRect, int nRows, int nCols) const;
/**
* @brief
* This member function adjusts the date picker control to the
* minimum size required to display one month.
*
* @param bRepaint A BOOL that specifies whether the control is to be
* repainted. By default, TRUE. If FALSE, no repainting occurs.
*
* @details Calling SizeMinReq successfully displays the entire date picker
* control for one month's calendar.
*
* @return Nonzero if the date picker control is sized to its minimum.
* Otherwise 0.
*
* @see GetMinReqRect
* @see CMonthCalCtrl::SizeMinReq
*/
virtual BOOL SizeMinReq(BOOL bRepaint = TRUE);
/**
* @brief
* This member function retrieves the scroll rate for the date
* picker control.
*
* @details This member function implements the behavior of the
* CMonthCalCtrl::GetMonthDelta function.
* The scroll rate is the number of months that the control
* moves its display when the user clicks a scroll button once.
*
* @return The scroll rate for the date picker control.
*
* @see SetMonthDelta
* @see CMonthCalCtrl::GetMonthDelta
*/
int GetMonthDelta() const;
/**
* @brief
* This member function sets the scroll rate for the date picker
* control.
*
* @param iDelta The number of months set as the control's scroll rate. If this
* value is zero, the month delta is reset to the default, which
* is the number of months displayed in the control.
*
* @details This member function implements the behavior of the
* CMonthCalCtrl::SetMonthDelta function.
*
* @see GetMonthDelta
* @see CMonthCalCtrl::SetMonthDelta
*/
void SetMonthDelta(int iDelta);
/**
* @brief
* This member function retrieves the system time as indicated by the
* currently-selected date.
*
* @param refDateTime A reference to a COleDateTime object. Receives the
* currently selected time.
*
* @details This member function fails if more than 1 date is selected.
*
* @return A BOOL that indicates the success of the function.
* TRUE if the function is successfully able to retrieve the system
* time. FALSE if more than one date is selected.
*
* @see SetCurSel
* @see CMonthCalCtrl::GetCurSel
*/
virtual BOOL GetCurSel(COleDateTime& refDateTime) const;
/**
* @brief
* This member function sets the currently selected date for the
* date picker control.
*
* @param refDateTime A reference to a COleDateTime object, which
* contains a date to select.
*
* @details This member function clears the selection of a date picker
* control and selects a specified date.
*
* @return Nonzero if successful. Otherwise 0.
*
* @see GetCurSel
* @see CMonthCalCtrl::GetCurSel
*/
virtual BOOL SetCurSel(const COleDateTime& refDateTime);
/**
* @brief
* This member function retrieves the current maximum number of days
* that can be selected in a date picker control.
*
* @details This member function implements the behavior of the
* CMonthCalCtrl::GetMaxSelCount function.
*
* @return An integer value that represents the total number of days that can
* be selected for the control. XTP_SELECTION_INFINITE if selection
* is not bounded.
*
* @see SetMaxSelCount
* @see CMonthCalCtrl::GetMaxSelCount
* @see AllowNoncontinuousSelection
*/
int GetMaxSelCount() const;
/**
* @brief
* This member function sets the maximum number of days that can be
* selected in a date picker control.
*
* @param nMax The value that is set to represent the maximum number of
* selectable days. XTP_SELECTION_INFINITE if selection is not
* bounded.
*
* @details This member function implements the behavior of the
* CMonthCalCtrl::SetMaxSelCount function.
*
* @see GetMaxSelCount
* @see AllowNoncontinuousSelection
* @see CMonthCalCtrl::SetMaxSelCount
*/
void SetMaxSelCount(int nMax = XTP_SELECTION_INFINITE);
/**
* @brief
* This member function sets the flag which shows whether control
* allows non-continuous days selection or not.
*
* @param bAllow TRUE to allow non-continuous days selection (default value),
* FALSE to disallow.
*
* @details Allowing continuous days selection means that user will be able
* to select only a single days interval between 2 dates, where all
* dates will be selected inside.
* Non-continuous days selection means that user will be able to
* select any specific dates totally up to MaxSelCount count.
*
* @see IsAllowNoncontinuousSelection
* @see SetMaxSelCount
* @see GetMaxSelCount
*/
void AllowNoncontinuousSelection(BOOL bAllow = TRUE);
/**
* @brief
* This member function returns the flag which shows whether control
* allows non-continuous days selection or not.
*
* @details Allowing continuous days selection means that user will be able
* to select only a single days interval between 2 dates, where all
* dates will be selected inside.
* Non-continuous days selection means that user will be able to
* select any specific dates totally up to MaxSelCount count.
*
* @return TRUE when non-continuous days selection is allowed,
* FALSE otherwise.
*
* @see AllowNoncontinuousSelection
* @see SetMaxSelCount
* @see GetMaxSelCount
*/
BOOL IsAllowNoncontinuousSelection() const;
/**
* @brief
* Determines if the multiple selection mode is enabled.
*
* @return TRUE if the multiple selection mode is enabled.
*
* @see SetMultiSelectionMode
*/
BOOL IsMultiSelectionMode() const;
/**
* @brief
* Enables/disables the multiple selection mode for the control.
*
* @param bMultiSelectionMode TRUE for enabling, FALSE for disabling.
*
* @details Sets the flag that determines whether the report is in multiple selection mode.
*
* @see IsMultiSelectionMode
*/
void SetMultiSelectionMode(BOOL bMultiSelectionMode);
/**
* @brief
* This member function retrieves the date information for the date
* specified as "Today" for the date picker control.
*
* @param refDateTime A reference to a COleDateTime object indicating the
* current day.
*
* @details This member function implements the behavior of the
* CMonthCalCtrl::GetToday function.
*
* @return Nonzero if successful. Otherwise 0.
*
* @see GetHighlightToday
* @see SetHighlightToday
* @see SetToday
* @see CMonthCalCtrl::GetToday
*/
virtual BOOL GetToday(COleDateTime& refDateTime) const;
/**
* @brief
* This member function sets the calendar control to the current day.
*
* @param refDateTime A reference to a COleDateTime object that
* contains the current date.
*
* @details This member function implements the behavior of the
* CMonthCalCtrl::SetToday function.
*
* @see GetHighlightToday
* @see SetHighlightToday
* @see SetToday
* @see GetToday
* @see CMonthCalCtrl::SetToday
*/
virtual void SetToday(const COleDateTime& refDateTime);
/**
* @brief
* This member function retrieves the current minimum and maximum
* dates set in a date picker control.
*
* @param pMinRange A pointer to a COleDateTime object containing the date at
* the lowest end of the range.
* @param pMaxRange A pointer to a COleDateTime object containing the date at
* the highest end of the range.
*
* @details This member function implements the behavior of the
* CMonthCalCtrl::GetRange function.
* @return A DWORD that can be zero (no limits are set) or a combination of
* the following values that specify limit information:
*
* - GDTR_MAX: A maximum limit is set for the control. pMaxRange
* is valid and contains the applicable date information.
* - GDTR_MIN: A minimum limit is set for the control. pMinRange
* is valid and contains the applicable date information.
*
* Example:
* See CMonthCalCtrl::GetRange documentation for the example.
*
* @see SetRange
* @see CMonthCalCtrl::GetRange
*/
virtual DWORD GetRange(COleDateTime* pMinRange, COleDateTime* pMaxRange) const;
/**
* @brief
* This member function sets the minimum and maximum allowable
* dates for a date picker control.
*
* @param pMinRange A pointer to a COleDateTime object containing the
* date at the lowest end of the range.
* @param pMaxRange A pointer to a COleDateTime object containing the
* date at the highest end of the range.
*
* @details This member function implements the behavior of the
* CMonthCalCtrl::GetRange function.
*
* @return Nonzero if successful. Otherwise 0.
*
* @see GetRange
* @see CMonthCalCtrl::SetRange
*/
virtual BOOL SetRange(const COleDateTime* pMinRange, const COleDateTime* pMaxRange);
/**
* @brief
* This member function retrieves date information representing
* the high and low limits of a date picker control's display.
*
* @param refMinRange A reference to a COleDateTime object containing
* the minimum date allowed.
* @param refMaxRange A reference to a COleDateTime object containing
* the maximum date allowed.
* @param dwFlags Value specifying the scope of the range limits
* to be retrieved. This value must be one of the
* following:
*
* - GMR_DAYSTATE: Include preceding and trailing
* months of visible range that
* are only partially displayed.
* - GMR_VISIBLE: Include only those months that
* are entirely displayed.
*
* @details This member function implements the behavior of the
* CMonthCalCtrl::GetMonthRange function.
*
* @return An integer that represents the range, in months, spanned by the
* two limits indicated by refMinRange and refMaxRange.
*
* @see CMonthCalCtrl::GetMonthRange
*/
virtual int GetMonthRange(COleDateTime& refMinRange, COleDateTime& refMaxRange,
DWORD dwFlags) const;
/**
* @brief
* This member function retrieves the first and last displayed days dates.
*
* @param refFirstVisibleDay A first displayed day date.
* @param refLastVisibleDay A last displayed day date.
*
* @return TRUE if successful, otherwise FALSE.
*
* @see GetMonthRange
*/
virtual BOOL GetVisibleRange(COleDateTime& refFirstVisibleDay,
COleDateTime& refLastVisibleDay) const;
/**
* @brief
* This member function allows scrolling between FirstDay and LastDay and
* tries to show the initial visible range between FirstVisibleDay and LastVisibleDay.
*
* @param FirstVisibleDay A first displayed day date.
* @param LastVisibleDay A last displayed day date.
* @param FirstDay A first allowed day date.
* @param LastDay A last allowed day date.
*/
virtual void SetDesiredVisibleAndFullRange(COleDateTime FirstVisibleDay,
COleDateTime LastVisibleDay, COleDateTime FirstDay,
COleDateTime LastDay);
/**
* @brief
* This member function returns the number of CXTPDatePickerButton
* items shown on the control.
*
* @details Call this member function to determine the number of buttons
* currently used on the control.
*
* @return A number of CXTPDatePickerButton items shown on the control.
*
* @see GetButton
* @see AddButton
*/
int GetButtonCount() const;
/**
* @brief
* This member function returns a pointer to the CXTPDatePickerButton
* object using its numeric index.
*
* @param nIndex The index of the CXTPDatePickerButton to retrieve.
*
* @details Call this member function to retrieve a pointer to the button
* object using its numeric index.
*
* @return A pointer to the CXTPDatePickerButton object.
*
* @see GetButtonCount
* @see AddButton
*/
CXTPDatePickerButton* GetButton(int nIndex) const;
/**
* @brief
* This member function adds one more buttons to the control.
*
* @param nID ID of the string resource item. This is the caption of the
* new button.
*
* @details Call this member function to add one more CXTPDatePickerButton
* objects to the control's collection.
*
* @see GetButton
* @see GetButtonCount
*/
virtual void AddButton(UINT nID);
/**
* @brief
* This member function obtains a notification connection object
* pointer.
*
* @details Used to subscribe (Advice) for notifications events from the control.
*
* @return A CXTPNotifyConnection pointer to the connection object.
*
* @see CXTPNotifyConnection overview
* @see IXTPNotificationSink overview
*/
CXTPNotifyConnection* GetConnection() const;
/**
* @brief
* Returns a collection of the days selected in the date picker.
*
* @details Call this member function to return a CXTPDatePickerDaysCollection
* collection of the days selected in the date picker control.
*
* @return Pointer to the collection of the selected days.
* If you want to use pointer to this collection lately in your code,
* you should increment and decrement references to the object manually.
*
* @see m_pSelectedDays
*/
CXTPDatePickerDaysCollection* GetSelectedDays() const;
/**
* @brief
* This member function adjusts the layout of all sub-items depending
* on the current window client size.
*
* @details AdjustLayout depends on the AutoSize flag (changing control size
* or item fonts correspondingly).
*
* @see AdjustLayout
* @see IsAutoSize
*/
virtual void AdjustLayout();
/**
* @brief
* This member function is used to obtain current paint theme.
*
* @return A paint theme ID from enum XTPCalendarTheme.
*/
XTPCalendarTheme GetPaintTheme() const;
/**
* @brief
* This member function is used to set current paint theme.
*
* @param ePaintTheme A paint theme ID from enum XTPCalendarTheme.
*/
void SetPaintTheme(XTPCalendarTheme ePaintTheme);
/**
* @brief
* This member function registers the window class if it has not
* already been registered.
*
* @param hInstance Instance of the resource where the control is located.
*
* @return TRUE if the window class was successfully registered, otherwise FALSE.
*/
BOOL RegisterWindowClass(HINSTANCE hInstance = NULL);
BOOL IsLimitMonthDaysSelection() const;
void SetLimitMonthDaysSelection(BOOL bLimitMonthDaysSelection);
protected:
/**
* @brief
* This member function sends a notification to all control's
* event subscribers.
*
* @param EventCode The specific code of the event.
* @param wParam First custom parameter. Depends on the event type.
* See specific event description for details.
* @param lParam Second custom parameter. Depends on the event type.
* See specific event description for details.
*
* @details This member function is called internally from inside the
* control when a notification is sent to all notification
* listeners.
*
* @see XTP_NOTIFICATIONCODE
* @see GetConnection
*/
virtual void SendNotification(XTP_NOTIFY_CODE EventCode, WPARAM wParam = 0, LPARAM lParam = 0);
protected:
/**
* @brief
* This member function initializes the month and day names depending
* on localization.
*
* @details This is an internal initialization function that reads the system
* user locale defaults and fills the month and day of the week
* arrays with the locale defaults.
*
* @see GetMonthName
* @see SetMonthName
* @see GetDayOfWeekName
* @see SetDayOfWeekName
*/
virtual void InitNames();
/**
* @brief
* This member function performs control population, creating the
* view from the data.
*
* @details Creates a new month collection for the control, populating it with
* the new objects created according to the stored properties and
* settings. Call this member function if the number of months to
* show needs adjusting.
*
* @see ClearMonths
*/
virtual void Populate();
/**
* @brief
* This member function redraws the control windows.
*
* @param bUpdateNow If TRUE then CWnd::UpdateWindow() will be called,
* otherwise only CWnd::Invalidate() will be called.
*
* @details Call this member function to redraw all control windows
* according to the stored parameter values.
*
* @see RedrawControl
*/
virtual void _RedrawControl(BOOL bUpdateNow);
/**
* @brief
* This member function is used to cleanup the months array.
*
* @see Populate
*/
virtual void ClearMonths();
/**
* @brief
* This member function is used to perform all drawing logic.
*
* @param pDC Pointer to a valid device context.
*
* @see DrawButtons
*/
virtual void OnDraw(CDC* pDC);
/**
* @brief
* Call this member function to draw the calendar's buttons.
*
* @param pDC Pointer to a valid device context.
*
* @see OnDraw
*/
virtual void DrawButtons(CDC* pDC);
/**
* @brief
* This member function adjusts the layout of all sub-items depending
* on the current window client size.
*
* @details AdjustLayout depends on the AutoSize flag (changing control size
* or item fonts correspondingly).
* @param rcClient A CRect that contains the control's client area rectangle cordinates
*/
virtual void AdjustLayout(CRect rcClient);
/**
* @brief
* This member function calculates the size of the button.
*
* @return CSize object with button size.
*
* @see SetButtonRect
* @see CalcButtonBandRect
*/
virtual CSize CalcButtonSize() const;
/**
* @brief
* Call this member function to calculate and set the button's
* bounding rectangle.
*
* @see CalcButtonSize
* @see CalcButtonBandRect
*/
virtual void SetButtonRect();
/**
* @brief
* Call this member function to calculate and set the button's band
* rectangle.
*
* @details The band rectangle is a box that is drawn around the button to
* highlight the button.
*
* @see SetButtonRect
* @see CalcButtonSize
*/
virtual void CalcButtonBandRect();
/**
* @brief
* This member function is used to implement button behavior.
*
* @param point Current mouse position.
*
* @details This member function is called from the following member
* functions: OnLButtonDown, OnLButtonDblClk, OnLButtonUp,
* OnMouseLeave, and OnMouseMove.
*/
virtual void ProcessButtons(CPoint point);
/**
* @brief
* This member function shows a CXTPDatePickerList control at the
* coordinates specified by rcHeader.
*
* @param rcHeader The coordinates of the list window.
* @param dtMonth The month date to start from.
*
* @details Call this member function to force showing of the months
* pop-up list control.
*
* @see CXTPDatePickerList overview
*/
virtual void ShowListHeader(CRect rcHeader, COleDateTime dtMonth);
/**
* @brief
* This function shifts the specified date for the specified number
* of months.
*
* @param refDate Reference to the COleDateTime object to shift the date
* on.
* @param nMonthCount Number of months used for shifting. Can be both positive
* and negative numbers.
*
* @details This is a utility function that is used to shift the specified
* date for a specific number of months.
*
* @return A BOOL value that specifies if the function is successful.
* Return zero if the value of this COleDateTime object is set
* successfully.
* Otherwise return 1.
*
* @see COleDateTime overview
*/
static BOOL AFX_CDECL ShiftDate(COleDateTime& refDate, int nMonthCount);
/**
* @brief
* This member function sets new dimensions for the month grid.
*
* @param rcGrid New rectangle coordinates of the Grid area.
*
* @return Calculates and sets Grid dimensions (rows and columns count) for
* the grid size.
*
* @see AdjustLayout
*/
virtual CSize SetGridDimentions(CRect rcGrid);
/**
* @brief
* This member function creates the internal month array.
*
* @details Fills the internal month array with the new DatPickerItemMonth
* objects, using the values of the initialized data members.
*
* @see Populate
*/
virtual void CreateMonthArray();
/**
* @brief
* This member function is called by the framework to allow other
* necessary sub-classing to occur before the window is sub-classed.
*
* @details This member function is used to call some internal initialization
* functions like AdjustLayout() immediately after instantiating the
* DatePickerControl object.
*
* @see Create
* @see CXTPDatePickerControl::CXTPDatePickerControl
*/
virtual void PreSubclassWindow();
/**
* @brief
* This member function is used to process the control's button
* clicks.
*
* @param nID Date picker button ID (could be XTP_IDS_DATEPICKER_TODAY
* or XTP_IDS_DATEPICKER_NONE)
*
* @details This member function performs internal button click processing and
* sends a XTP_NC_DATEPICKER_BUTTON_CLICK notification to the parent
* window.
*
* @see SendMessageToParent
*/
virtual void OnButtonClick(UINT nID);
protected:
DatePickerMouseMode m_mouseMode; /**< This member variable is used to specify the current Mouse
operating mode.*/
int m_nLockUpdateCount; /**< This member variable is used as a counter that is used to count
the update locks. An image will be redrawn only when the lock
counter is equal to zero.*/
int m_nTimerID; /**< This member variable is used to specify the control timer ID.*/
CRect m_rcControl; /**< This data member is used to store the control drawing coordinates.*/
CXTPDatePickerPaintManager* m_pPaintManager; /**< This member variable is a pointer to the paint
manager.*/
BOOL m_bAutoSize; /**< This member variable is used as the AutoSize flag.*/
BOOL m_bIsModal; /**< This member variable is used to specify if the control is used as
a pop-up window. TRUE when the control is used as a pop-up. FALSE
-otherwise.*/
BOOL m_bChanged; /**< This member variable is used to determine if the control requires
redrawing.*/
CBitmap m_bmpCache; /**< This member variable is a cached window bitmap.*/
int m_nRows; /**< This member variable is used to specify the number of rows in the
column month's grid.*/
int m_nColumns; /**< This member variable is used to specify the number of columns in
the column month's grid.
MODIFICATION - DESIRED MATRIX*/
int m_nDesiredRows; /**< The desired rows.*/
int m_nDesiredColumns; /**< The desired columns.*/
CXTPNotifyConnection* m_pConnection; /**< This member variable is a connection object that is
used to send notifications.*/
COleDateTime m_dtMinRange; /**< This member variable specifies the minimum allowable date for a
date picker control.*/
COleDateTime m_dtMaxRange; /**< This member variable specifies the maximum allowable date for a
date picker control.*/
COleDateTime m_dtToday; /**< This member variable is used to specify the "Today" date for a
date picker control.*/
COleDateTime m_dtFirstMonth; /**< This member variable is used to specify the first month in the
grid.*/
int m_nFirstDayOfWeek; /**< This member variable is used to specify the first day of the week
to display (1-Sunday, 2-Monday ... etc).*/
int m_nFirstWeekOfYearDays; /**< This member variable is used to specify the number of days of
the new year in the first week of this year.*/
PFNITEMMETRICS m_pfnCallback; /**< This member variable is a pointer to the user's IsSpecialDay
function.*/
void* m_pCallbackParam; /**< This member variable is a pointer to the user's additional
parameter for the callback function.*/
CArray