/** * @file XTPDatePickerList.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(_XTPDATEPICKERITEMLIST_H__) # define _XTPDATEPICKERITEMLIST_H__ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPDatePickerControl; /** * @brief * This class provides the functionality of a list control which * displays month names. * * @details The CXTPDatePickerList provides a functionality of a list control * which displays a collection of month names in a pop-up list window, * allowing the user to scroll up and down and to choose any specific * month for further selecting in the date picker control. * * @see CMonthCalCtrl */ class _XTP_EXT_CLASS CXTPDatePickerList : public CWnd { friend class CXTPDatePickerControl; public: /** * @brief * Constructs a CXTPDatePickerList object. * * @param pControl Pointer to the parent CXTPDatePickerControl object. * @param dtStartMonth A date containing the month which will be created * as the central item in the list. * * @details Construct a CXTPDatePickerList object in two steps. * First, call the constructor CXTPDatePickerList and then * call Create method, which initializes the window. * * Example: *
* // Declare a dynamic CXTPDatePickerList object. * pListControl = new CXTPDatePickerList(pDatePickerWnd, dtMonthToShow); * * // create control * pListControl->Create(rcHeader); ** * @see Create */ CXTPDatePickerList(CXTPDatePickerControl* pControl, COleDateTime dtStartMonth); /** * @brief * Destroys a CXTPDatePickerList object, handles cleanup and deallocation. */ virtual ~CXTPDatePickerList(); /** * @brief * Creates the List Window with position and sizes. * * @param rcList Rectangle determining list window position and size. * * @details Construct a CXTPDatePickerList object in two steps. * First, call the constructor CXTPDatePickerList and then * call Create method, which initializes the window. * Example: For the example, see CXTPDatePickerList::CXTPDatePickerList. * * @return Nonzero if successful; otherwise 0. * * @see CXTPDatePickerList::CXTPDatePickerList */ BOOL Create(CRect rcList); // Operations public: /** * @brief * Returns an interval between start month and selected month. * * @details Call this member function at any time to determine which * month is currently selected in the list. * * @return A number of months between start month and selected one. */ int GetMonthInterval() const; public: /** * @brief * Implements scroll down functionality. * * @param nCount determines how many positions will be scrolled. * * @details Call this member function to scroll the list with months down * by a specified amount of items. * * @see ScrollUp */ void ScrollDown(int nCount = 1); /** * @brief * Implements scroll up functionality * * @param nCount Determines how many positions will be scrolled. * * @details Call this member function to scroll the list with months up * by a specified amount of items. * * @see ScrollDown */ void ScrollUp(int nCount = 1); private: static void AFX_CDECL ShiftMonthUp(int& nYear, int& nMonth, const int nCount); static void AFX_CDECL ShiftMonthDown(int& nYear, int& nMonth, const int nCount); protected: /** * @brief * Calculates size of list by font and control sizes. * * @return A size of the list to create. */ CSize GetListSize() const; /** * @brief * Determines whether an item is selected. * * @param nX Item zero-based numeric index from the beginning of the list. * @param rcItem Coordinates of the item to check. * * @return TRUE if item is selected, FALSE otherwise. */ BOOL IsSelected(int nX, CRect rcItem) const; /** @cond */ DECLARE_MESSAGE_MAP() /** @endcond */ // {{AFX_MSG(CXTPDatePickerList) afx_msg BOOL OnEraseBkgnd(CDC* pDC); afx_msg void OnPaint(); afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg void OnTimer(UINT_PTR nIDEvent); // }}AFX_MSG private: /** @cond */ DISABLE_WNDCREATE() /** @endcond */ // Attributes protected: CXTPDatePickerControl* m_pControl; /**< Pointer to the parent control.*/ COleDateTime m_dtStartMonth; /**< The month to start selection from (will be placed in the middle of the list for the beginning).*/ COleDateTime m_dtMiddleMonth; /**< The month currently in center.*/ COleDateTime m_dtSelMonth; /**< Currently selected month in the list.*/ int m_nItemsAbove; /**< How many items are from the top of the middle item on the list.*/ int m_nItemsBelow; /**< How many items are from the bottom of the middle item on the list.*/ CRect m_rcListControl; /**< Coordinates of list control in screen coordinates.*/ }; # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif // !defined(_XTPDATEPICKERITEMLIST_H__)