// XTPDatePickerControl.h: interface for the CXTPDatePickerControl class. // // This file is a part of the XTREME CALENDAR MFC class library. // (c)1998-2012 Codejock Software, All Rights Reserved. // // THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE // RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN // CONSENT OF CODEJOCK SOFTWARE. // // THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED // IN THE XTREME TOOLKIT PRO LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO // YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A // SINGLE COMPUTER. // // CONTACT INFORMATION: // support@codejock.com // http://www.codejock.com // ///////////////////////////////////////////////////////////////////////////// //{{AFX_CODEJOCK_PRIVATE #if !defined(_XTPDATEPICKERCONTROL_H__) #define _XTPDATEPICKERCONTROL_H__ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 //}}AFX_CODEJOCK_PRIVATE // XTPDatePickerControl.h : header file // ///////////////////////////////////////////////////////////////////////////// // CXTPDatePickerControl window class CXTPDatePickerPaintManager; class CXTPDatePickerItemMonth; class CXTPDatePickerDaysCollection; class CXTPDatePickerList; class CXTPDatePickerControl; class CXTPNotifyConnection; class CXTPNotifySink; //=========================================================================== // Summary: // 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 { //----------------------------------------------------------------------- // Summary: // Get day item font.. // Returns: // A pointer to the font object. // Remarks: // Return a day font stored by the structure. //----------------------------------------------------------------------- CFont* GetFont(); //----------------------------------------------------------------------- // Summary: // Set a new font for the day item. // Parameters: // 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. //{{AFX_CODEJOCK_PRIVATE XTP_DAYITEM_METRICS(); virtual ~XTP_DAYITEM_METRICS(){}; private: CFont m_fntText; // A CFont object that contains the item's text font. //}}AFX_CODEJOCK_PRIVATE }; //=========================================================================== // Summary: // Structure used to send button notification messages. // Remarks: // 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) }; //--------------------------------------------------------------------------- // Summary: // Callback function definition for the IsITEMMETRICS function. // Remarks: // 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); //{{AFX_CODEJOCK_PRIVATE 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. //}}AFX_CODEJOCK_PRIVATE // ---------------------------------------------------------------------- // Summary: // Border style of Date picker control // ---------------------------------------------------------------------- enum XTPDatePickerBorderStyle { xtpDatePickerBorderNone, // No border. xtpDatePickerBorder3D, // 3D border. xtpDatePickerBorderOffice, // Office-like border xtpDatePickerBorderStatic // Static border. }; // ---------------------------------------------------------------------- // Summary: // This class represents a DatePicker button. // Remarks: // CXTPDatePickerButton provides storage for all parameters needed to // display and handle a button. // ---------------------------------------------------------------------- class _XTP_EXT_CLASS CXTPDatePickerButton { public: //----------------------------------------------------------------------- // Summary: // Default button constructor. // Remarks: // Default button constructor handles all necessary // initialization. //----------------------------------------------------------------------- CXTPDatePickerButton(); //----------------------------------------------------------------------- // Summary: // Destroys a CXTPDatePickerButton object, handles cleanup // and de-allocation. //----------------------------------------------------------------------- virtual ~CXTPDatePickerButton() { } //----------------------------------------------------------------------- // Summary: // Get a button caption. // Remarks: // Load from resources string using ID stored in m_nID member or // value which was set by SetCaption() call. // Returns: // Returns a button caption. // See Also: m_nID, SetCaption //----------------------------------------------------------------------- virtual CString GetCaption() const; //----------------------------------------------------------------------- // Summary: // Set a button caption. // Parameters: // pcszCaption - A caption string. // Remarks: // If pcszCaption is empty string - GetCaption will the m_nID to load // caption string from resources. // See Also: GetCaption, 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. }; // ---------------------------------------------------------------------- // Summary: // Class CXTPDatePickerButtons represents a collection of buttons. // Remarks: // 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 Also: // 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 Also:
// Create
// -------------------------------------------------------------------------------------------------------------
CXTPDatePickerControl();
//-----------------------------------------------------------------------
// Summary:
// Destroys a CXTPDatePickerControl object, handles cleanup
// and de-allocation.
//-----------------------------------------------------------------------
virtual ~CXTPDatePickerControl();
public:
// -----------------------------------------------------------------------
// Summary:
// This member function is used to create the Date Picker Control
// Window.
// Parameters:
// dwStyle : Specifies the window style attributes.
// rect : A RECT object that contains the coordinates of the
// window, in the client coordinates of pParentWnd.
// pParentWnd : A CWnd pointer to the parent window.
// nID : A UINT that contains the ID of the child window.
// pContext : A CCreateContext pointer that contains the create context
// of the window.
// Returns:
// Nonzero if successful. Otherwise 0.
// -----------------------------------------------------------------------
virtual BOOL Create(DWORD dwStyle,
const RECT& rect,
CWnd* pParentWnd,
UINT nID,
CCreateContext* pContext = NULL);
// ----------------------------------------------------------------------
// Summary:
// This member function implements pop-up window behavior for the
// Date Picker control.
// Parameters:
// rect : Rectangle that contains the size and position of the
// window, in client coordinates of pParentWnd.
// pParentWnd : Pointer to the parent window.
// Returns:
// TRUE if successful, FALSE otherwise.
// See Also:
// IsModal
// ----------------------------------------------------------------------
virtual BOOL GoModal(const RECT& rect, CWnd* pParentWnd = NULL);
// ----------------------------------------------------------------------
// Summary:
// Is the control runs in modal mode.
// Returns:
// TRUE when the control is used as a pop-up window,
// FALSE otherwise.
// See Also:
// GoModal
// ----------------------------------------------------------------------
BOOL IsModal() const;
// ----------------------------------------------------------------------
// Summary:
// This member function returns a pointer to the associated paint
// manager.
// Remarks:
// 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.
// Returns:
// Pointer to the paint manager object.
// See Also:
// SetTheme, SetPaintManager
// ----------------------------------------------------------------------
CXTPDatePickerPaintManager* GetPaintManager() const;
//-----------------------------------------------------------------------
// Summary:
// This member function redraws the control windows.
// Remarks:
// 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 Also:
// _RedrawControl
//-----------------------------------------------------------------------
virtual void RedrawControl();
// ---------------------------------------------------------------------
// Summary:
// This member function sets the new control drawing theme.
// Parameters:
// pPaintManager : Pointer of the new paint manager object or derived
// class like CXTPDatePickerThemeOffice2007.
// if NULL - the default paint manager object is set.
// Remarks:
// Call this member function to set the paint manager object that is
// used for drawing a date picker window.
// See Also:
// GetPaintManager
// ---------------------------------------------------------------------
void SetTheme(CXTPDatePickerPaintManager* pPaintManager = NULL);
// ---------------------------------------------------------------------
// Summary:
// This function is called to determine if AutoSize mode is set.
// Remarks:
// Call this member function to determine whether the control's auto
// size mode is enabled.
// Returns:
// A boolean value that specifies is AutoSize is enabled.
// TRUE if AutoSize is enabled.
// Otherwise return FALSE.
// See Also:
// SetAutoSize
// ---------------------------------------------------------------------
BOOL IsAutoSize() const;
//-----------------------------------------------------------------------
// Summary:
// This function sets the AutoSize mode.
// Parameters:
// bAuto - Boolean value. If bAuto is TRUE, then AutoSize
// is enabled. If this parameter is FALSE, then
// AutoSize is disabled.
// Remarks:
// 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 Also: IsAutoSize
//-----------------------------------------------------------------------
void SetAutoSize(BOOL bAuto = TRUE);
// -------------------------------------------------------------------
// Summary:
// This member function sets the user defined day metrics callback
// function.
// Parameters:
// pFunc : Pointer to the callback function.
// pParam : Pointer to any user defined parameter provided to the
// callback function.
// Remarks:
// Call this member function to set up the user defined callback
// function to manipulate the 'special day's attributes'.
// See Also:
// PFNITEMMETRICS, GetCallbackDayMetrics, GetDayMetrics
// -------------------------------------------------------------------
virtual void SetCallbackDayMetrics(PFNITEMMETRICS pFunc, void* pParam = NULL);
// ---------------------------------------------------------------------
// Summary:
// This member function returns the day metrics callback function.
// Remarks:
// Call this member function to obtain a pointer to the user defined
// day metrics callback function.
// Returns:
// Pointer to the callback function.
// See Also:
// PFNITEMMETRICS, SetCallbackDayMetrics, GetDayMetrics
// ---------------------------------------------------------------------
PFNITEMMETRICS GetCallbackDayMetrics() const;
// --------------------------------------------------------------------
// Summary:
// This member function returns the day item drawing metrics.
// Parameters:
// dtDay : Reference to the DateTime value to check.
// pDayMetics : Pointer to the day metrics structure.
// Remarks:
// Determines whether or not a given date is special. This function
// calls a callback function to make this determination.
// See Also:
// GetCallbackDayMetrics, SetCallbackDayMetrics
// --------------------------------------------------------------------
virtual void GetDayMetrics(COleDateTime& dtDay, XTP_DAYITEM_METRICS* pDayMetics);
// ----------------------------------------------------------------------
// Summary:
// This member function sets the day of the week that is displayed in
// the leftmost column of the calendar.
// Parameters:
// 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 Also:
// GetFirstDayOfWeek
// ----------------------------------------------------------------------
void SetFirstDayOfWeek(int nDay);
// ----------------------------------------------------------------------
// Summary:
// This member function obtains the first day of the week that is
// displayed in the leftmost column of the calendar.
// Returns:
// 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
// See Also:
// SetFirstDayOfWeek
// ----------------------------------------------------------------------
int GetFirstDayOfWeek() const;
// ----------------------------------------------------------------------
// Summary:
// This member function sets the required number of this year days
// in the first week of the year.
// Parameters:
// 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 Also:
// GetFirstWeekOfYearDay
// Example:
//
// // Setup German style of week numbers calculation.
// pMyDatePicker->SetFirstWeekOfYearDays(4);
//
// ----------------------------------------------------------------------
void SetFirstWeekOfYearDays(int nDays);
// ----------------------------------------------------------------------
// Summary:
// This member function obtains the current required number of year days
// in the first week of the year.
// Returns:
// 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 Also:
// SetFirstWeekOfYearDays
// ----------------------------------------------------------------------
int GetFirstWeekOfYearDays() const;
// ----------------------------------------------------------------------
// Summary:
// This function sets visibility for the "Today" and "None" buttons.
// Parameters:
// bShowToday : Provide TRUE to show the "Today" button, or FALSE to
// hide it.
// bShowNone : Provide TRUE to show the "None" button, or FALSE to
// hide it.
// Remarks:
// Call this member function to hide or show any of the control's
// service buttons.
// See Also:
// IsTodayButtonVisible, IsNoneButtonVisible
// ----------------------------------------------------------------------
virtual void SetButtonsVisible(BOOL bShowToday, BOOL bShowNone);
// ------------------------------------------------------------------------
// Summary:
// This member function is used to obtain the value of the visibility
// flag for the "Today" button.
// Remarks:
// Call this member function to determine the visibility of the
// "Today" service button.
// Returns:
// A boolean value that specifies if the "Today" button is visible.
// TRUE if the "Today" button is visible.
// Otherwise FALSE.
// See Also:
// IsNoneButtonVisible, SetButtonsVisible
// ------------------------------------------------------------------------
virtual BOOL IsTodayButtonVisible();
// -----------------------------------------------------------------------
// Summary:
// This function returns the boolean visibility flag of the "None"
// button.
// Remarks:
// Call this member function to determine the visibility of the
// "None" service button.
// Returns:
// A boolean value that specifies if the "None" button is visible.
// TRUE when the "None" button is visible.
// Otherwise FALSE.
// See Also:
// IsTodayButtonVisible, SetButtonsVisible
// -----------------------------------------------------------------------
virtual BOOL IsNoneButtonVisible();
// ----------------------------------------------------------------------
// Summary:
// Call this member function to enable or disable highlighting of the
// "Today" cell.
// Parameters:
// bValue : Boolean value determines if the "Today" cell is
// highlighted.
// Remarks:
// 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 Also:
// GetHighlightToday, SetToday, GetToday,
// CXTPDatePickerPaintManager::GetHighlightTodayColor
// ----------------------------------------------------------------------
void SetHighlightToday(BOOL bValue);
// -------------------------------------------------------------------
// Summary:
// Call this member function to determine whether the "Today" cell
// highlighting is enabled or disabled.
// Remarks:
// This member function returns a boolean flag that specifies the
// "Today" button highlighting mode.
// Returns:
// A BOOL that indicates if the "Today" cell is highlighted.
// TRUE if the "Today" cell is highlighted. Otherwise FALSE.
// See Also:
// GetHighlightToday, SetToday, GetToday,
// CXTPDatePickerPaintManager::GetHighlightTodayColor
// -------------------------------------------------------------------
BOOL GetHighlightToday() const;
//-----------------------------------------------------------------------
// Summary:
// Call this member to set right-to-left mode.
// Parameters:
// bRightToLeft - TRUE to set right-to-left reading-order properties.
//-----------------------------------------------------------------------
virtual void SetLayoutRTL(BOOL bRightToLeft);
// ------------------------------------------------------------------------
// Summary:
// Call this member function to show or hide the week numbers.
// Parameters:
// bValue : Boolean value determines whether week numbers are visible.
// Remarks:
// 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 Also:
// GetShowWeekNumbers,
// CXTPDatePickerPaintManager::GetWeekNumbersBackColor,
// CXTPDatePickerPaintManager::GetWeekNumbersTextColor,
// CXTPDatePickerPaintManager::GetWeekNumbersTextFont
// ------------------------------------------------------------------------
virtual void SetShowWeekNumbers(BOOL bValue);
// ----------------------------------------------------------------------
// Summary:
// Call this member function to determine if the week numbers are
// visible.
// Remarks:
// 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.
// Returns:
// 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 Also:
// SetShowWeekNumbers,
// CXTPDatePickerPaintManager::GetWeekNumbersBackColor,
// CXTPDatePickerPaintManager::GetWeekNumbersTextColor,
// CXTPDatePickerPaintManager::GetWeekNumbersTextFont
// ----------------------------------------------------------------------
BOOL GetShowWeekNumbers() const;
// -------------------------------------------------------------------
// Summary:
// Call this member function to show or hide non-month days.
// Parameters:
// 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.
// Remarks:
// 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 Also:
// GetShowNonMonthDays,
// CXTPDatePickerPaintManager::GetNonMonthDayBackColor,
// CXTPDatePickerPaintManager::GetNonMonthDayTextColor,
// CXTPDatePickerPaintManager::GetNonMonthDayTextFont
// -------------------------------------------------------------------
void SetShowNonMonthDays(BOOL bShow);
// ---------------------------------------------------------------------
// Summary:
// Call this member function to determine if the non-month days are
// visible.
// Remarks:
// 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.
// Returns:
// A boolean value that specifies if the "non-month days" are
// visible.
// TRUE if non-month days are visible.
// FALSE otherwise.
// See Also:
// SetShowNonMonthDays,
// CXTPDatePickerPaintManager::GetNonMonthDayBackColor,
// CXTPDatePickerPaintManager::GetNonMonthDayTextColor,
// CXTPDatePickerPaintManager::GetNonMonthDayTextFont
// ---------------------------------------------------------------------
BOOL GetShowNonMonthDays() const;
// ----------------------------------------------------------------------
// Summary:
// Call this member function to set borders style
// around the control.
// Parameters:
// borderStyle - XTPDatePickerBorderStyle value determines whether border style
// See Also:
// GetBorderStyle, CXTPDatePickerPaintManager::DrawBorder, XTPDatePickerBorderStyle
// ----------------------------------------------------------------------
void SetBorderStyle(XTPDatePickerBorderStyle borderStyle);
// ----------------------------------------------------------------------
// Summary:
// Call this member function to determine if the border is
// visible.
// Returns:
// XTPDatePickerBorderStyle value that specifies the border style.
// See Also:
// SetBorderStyle, CXTPDatePickerPaintManager::DrawBorder, XTPDatePickerBorderStyle
// ----------------------------------------------------------------------
XTPDatePickerBorderStyle GetBorderStyle() const;
// ----------------------------------------------------------------------
// Summary:
// Call this member function to set the number of months in the
// control's grid.
// Parameters:
// nRows : int that contains the new rows count value.
// nCols : int that contains the new columns count value.
// bRestrictMode : BOOL flag used for resizing
// Remarks:
// 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 Also:
// GetRows, GetCols
// ----------------------------------------------------------------------
virtual void SetGridSize(int nRows, int nCols, BOOL bRestrictMode = FALSE);
//-----------------------------------------------------------------------
// Summary:
// Call this member function to obtain the number of rows in the
// months grid.
// Returns:
// The number of rows in the control's months grid.
// See Also: GetCols, SetGridSize
//-----------------------------------------------------------------------
int GetRows() const;
// ----------------------------------------------------------------------
// Summary:
// Call this member function to obtain the number of columns in the
// months grid.
// Returns:
// An int that contains the number of columns in the control's months
// grid.
// See Also:
// GetRows, SetGridSize
// ----------------------------------------------------------------------
int GetCols() const;
//-----------------------------------------------------------------------
// Summary:
// This member function finds the month item at the provided point.
// Parameters:
// ptMouse - The mouse coordinates to test.
// pMCHitTest - A pointer to a MCHITTESTINFO structure
// containing hit testing points for the
// date picker control.
// Remarks:
// 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.
// Returns:
// 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 Also: HitTest, CMonthCalCtrl::HitTest, MCHITTESTINFO
//-----------------------------------------------------------------------
virtual CXTPDatePickerItemMonth* HitTest(CPoint ptMouse) const;
virtual DWORD HitTest(PMCHITTESTINFO pMCHitTest) const; //
// // 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;
// }
// }
//
// Returns:
// An LRESULT that is used to indicate the success of the function. Non-zero
// if the message is sent successfully, zero otherwise.
// -----------------------------------------------------------------------------------
virtual LRESULT SendMessageToParent(int nMessage, NMHDR* pNMHDR = NULL);
// ---------------------------------------------------------------------
// Summary:
// This function checks a specific date to determine if it is
// contained in the control's selection.
// Parameters:
// dtDay : A date to check.
// Remarks:
// Call this member function to determine whether dtDay is selected.
// Returns:
// A boolean value that specifies if the date is contained in the
// current selection.
// TRUE when the day is selected.
// Otherwise FALSE.
// See Also:
// Select, Deselect
// ---------------------------------------------------------------------
virtual BOOL IsSelected(const COleDateTime& dtDay) const;
// ---------------------------------------------------------------------
// Summary:
// This function checks a specific date to determine if it is
// focused.
// Parameters:
// dtDay : A date to check.
// Remarks:
// 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.
// Returns:
// TRUE when the day is focused, FALSE otherwise.
// See Also:
// ClearFocus
// ---------------------------------------------------------------------
virtual BOOL IsFocused(const COleDateTime& dtDay) const;
// ---------------------------------------------------------------------
// Summary:
// This function clear focused attribute if it is set.
// Remarks:
// 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 Also:
// IsFocused
// ---------------------------------------------------------------------
virtual void ClearFocus();
// -----------------------------------------------------------------
// Summary:
// Call this member function to select a specific day.
// Parameters:
// dtDay : Date to be selected.
// Remarks:
// 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 Also:
// Deselect, IsSelected
// -----------------------------------------------------------------
virtual void Select(const COleDateTime& dtDay);
// --------------------------------------------------------------------
// Summary:
// Call this member function to de-select the specified day.
// Parameters:
// dtDay : Date to be deselected.
// Remarks:
// This member function removes the provided day from the control's
// selected days collection.
// See Also:
// Select, IsSelected
// --------------------------------------------------------------------
virtual void Deselect(const COleDateTime& dtDay);
// ---------------------------------------------------------------------
// Summary:
// Call this member function to ensure that the COleDateTime item is
// visible.
// Parameters:
// dtDate : The date to test.
// Remarks:
// If necessary, the function scrolls the month grid on the control
// to make the day visible.
// See Also:
// EnsureVisibleSelection
// ---------------------------------------------------------------------
virtual void EnsureVisible(const COleDateTime& dtDate);
// ---------------------------------------------------------------------
// Summary:
// Call this member function to ensure that the selection range is
// visible.
// Remarks:
// If necessary, the function scrolls the month grid on the control
// to make all selected days visible.
// See Also:
// EnsureVisible, EnsureVisibleFocus
// ---------------------------------------------------------------------
virtual void EnsureVisibleSelection();
// Summary:
// Call this member function to ensure that the focused item is visible.
// Remarks:
// 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 Also:
// EnsureVisible, EnsureVisibleSelection
// ---------------------------------------------------------------------
virtual void EnsureVisibleFocus();
// ------------------------------------------------------------------------------
// Summary:
// This member function sets the user-defined month name.
// Parameters:
// 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.
// strMonthName : A CString that contains the New month name.
// Remarks:
// Use this function to change the shown month name to any preferred
// \or localized values.
// See Also:
// GetMonthName, SetDayOfWeekName, GetDayOfWeekName
// ------------------------------------------------------------------------------
void SetMonthName(int nMonth, LPCTSTR strMonthName);
// ----------------------------------------------------------------------
// Summary:
// This member function returns the month name of the given integer
// value.
// Parameters:
// nMonth : Month number. The valid range is 1 \<= nMonth \>= 12.
// Remarks:
// 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.
// Returns:
// 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 Also:
// SetMonthName, SetDayOfWeekName, GetDayOfWeekName
// ----------------------------------------------------------------------
CString GetMonthName(int nMonth) const;
//-----------------------------------------------------------------------
// Summary:
// This member function sets the user-defined DayOfWeek name.
// Parameters:
// nDayOfWeek - DayOfWeek number to set new name for.
// strDayOfWeekName - New DayOfWeek name.
// Remarks:
// Valid day-of-week range is between 1 and 7, where
// 1 = Sunday, 2 = Monday, and so on.
// See Also: GetDayOfWeekName, SetMonthName, GetMonthName
//-----------------------------------------------------------------------
void SetDayOfWeekName(int nDayOfWeek, LPCTSTR strDayOfWeekName);
//-----------------------------------------------------------------------
// Summary:
// This member function returns the DayOfWeek name associated
// with the integer value of nDayOfWeek.
// Parameters:
// nDayOfWeek - DayOfWeek number.
// Remarks:
// Valid day-of-week range is between 1 and 7, where
// 1 = Sunday, 2 = Monday, and so on.
// Returns:
// 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 Also: SetDayOfWeekName, SetMonthName, GetMonthName
//-----------------------------------------------------------------------
CString GetDayOfWeekName(int nDayOfWeek) const;
// ----------------------------------------------------------------------
// Summary:
// This member function retrieves date information representing the
// upper and lower limits of the date range currently selected by the
// user.
// Parameters:
// refMinRange : A reference to a COleDateTime object containing the
// minimum date allowed.
// refMaxRange : A reference to a COleDateTime object containing the
// maximum date allowed.
// Remarks:
// This member function implements the behavior of the
// CMonthCalCtrl::GetSelRange function.
// Returns:
// Nonzero if successful. Otherwise 0.
// See Also:
// SetSelRange, CMonthCalCtrl::GetSelRange
// ----------------------------------------------------------------------
virtual BOOL GetSelRange(COleDateTime& refMinRange, COleDateTime& refMaxRange) const;
//-----------------------------------------------------------------------
// Summary:
// This member function sets the selection for a date picker
// control to a given date range.
// Parameters:
// refMinRange - A reference to a COleDateTime object containing the
// date at the lowest end of the range.
// refMaxRange - A reference to a COleDateTime object containing the
// date at the highest end of the range.
// Remarks:
// 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.
// Returns:
// Nonzero if successful. Otherwise 0.
// See Also: GetSelRange, CMonthCalCtrl::SetSelRange
//-----------------------------------------------------------------------
virtual BOOL SetSelRange(const COleDateTime& refMinRange, const COleDateTime& refMaxRange);
// --------------------------------------------------------------------------
// Summary:
// 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.
// Parameters:
// pRect : A pointer to a RECT structure that receives the bounding
// rectangle information. This parameter must be a valid address
// and cannot be NULL.
// nRows : A number of months in a row inside the calculated rectangle.
// nCols : A number of months in a column inside the calculated rectangle.
// Remarks:
// 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.
// Returns:
// If successful, this member function returns nonzero and pRect
// receives the applicable bounding rectangle information. If
// unsuccessful, the member function returns 0.
// See Also:
// CMonthCalCtrl::GetMinReqRect
// --------------------------------------------------------------------------
virtual BOOL GetMinReqRect(RECT* pRect) const;
virtual BOOL GetMinReqRect(RECT* pRect, int nRows, int nCols) const; //