/** * @file XTPCalendarEventPropertiesDlg.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(_XTP_CALENDAR_EVENT_PROPERTIS_DLG_H__) # define _XTP_CALENDAR_EVENT_PROPERTIS_DLG_H__ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPCalendarViewEvent; class CXTPCalendarControl; class CXTPCalendarEventCategories; class CXTPCalendarEventCategoryIDs; /** * @brief * This class is used as the base class for all owner drawn * Calendar Event comboboxes. */ class _XTP_EXT_CLASS CXTPCalendarComboBoxBase : public CComboBox { public: /** * @brief * Standard object constructor. */ CXTPCalendarComboBoxBase(); /** * @brief * Standard object destructor. */ virtual ~CXTPCalendarComboBoxBase(); /** * @brief * Call this member function to initialize the combobox. * * @param pEvent Pointer to the selected calendar event. * @param nTheme Current Calendar theme. * * @return TRUE if successful, FALSE otherwise. */ virtual BOOL Init(CXTPCalendarEvent* pEvent, XTPCalendarTheme nTheme); protected: /** * @brief * This function implements measure items for custom draw. * * @param lpMIS A pointer to a LPMEASUREITEMSTRUCT structure. */ virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMIS); /** * @brief * This member function is called to calculate the size * for the color rectangle displayed for each item. * * @param rItem Combobox client coordinates of the item. * * @return Client coordinates of the color rectangle for the item. */ virtual CRect CalcColorRect(CRect rItem); protected: CSize m_sizeColor; // Size in pixels of the color selection box. XTPCalendarTheme m_nTheme; // Current Calendar theme. CXTPCalendarEvent* m_pEvent; // Pointer to the selected calendar event. }; /** * @brief * This class implements the event category selector combobox. */ class _XTP_EXT_CLASS CXTPCalendarEventCategoryComboBox : public CXTPCalendarComboBoxBase { public: /** * @brief * Standard object constructor. */ CXTPCalendarEventCategoryComboBox(); /** * @brief * Standard object destructor. */ virtual ~CXTPCalendarEventCategoryComboBox(); /** * @brief * Call this member function to initialize the combobox. * * @param pEvent Pointer to the selected calendar event. * @param nTheme Current Calendar theme. * * @return TRUE if successful, FALSE otherwise. */ virtual BOOL Init(CXTPCalendarEvent* pEvent, XTPCalendarTheme nTheme); /** * @brief * Use this member to get selected categories. * * @param pChecked [in/out] A pointer to a CXTPCalendarEventCategoryIDs * collection to receive selected category's IDs. * @param pbChanged [in/out] This member is set to TRUE if the category's * IDs set changed. */ virtual void GetChecked(CXTPCalendarEventCategoryIDs* pChecked, BOOL* pbChanged); /** * @brief * Call this member function to retrieve a reference to the * combobox category array. * * @return A reference to the combobox category array. */ CXTPCalendarEventCategoryIDs& GetCategoryArray(); protected: /** * @brief * This function implements custom draw combobox items. * * @param lpDIS A pointer to LPDRAWITEMSTRUCT structure. */ virtual void DrawItem(LPDRAWITEMSTRUCT lpDIS); /** * @brief * Called to draw an event category item when the combobox * is collapsed. * * @param pDC Pointer to a valid device context. * @param rcItem Size of the category item to draw. * @param bFocused TRUE if the combobox has input focus. * @param bDisabled TRUE if the combobox is disabled. */ virtual void DrawCollapsed(CDC* pDC, CRect rcItem, BOOL bFocused, BOOL bDisabled); /** * @brief * Called to draw an event category item when the combobox * is expanded. * * @param pDC Points to a valid device context. * @param rcItem Size of the category item to draw. * @param bSelected TRUE if the category item is selected. * @param uItemID Index ID of the category item. */ virtual void DrawExpanded(CDC* pDC, CRect rcItem, BOOL bSelected, UINT uItemID); /** * @brief * Use this member function to get the list box selected item (works * for dropped state only). * * @return Currently selected item index or LB_ERR. */ virtual int GetLBCurSel() const; /** * @brief * Use this member function to redraw the list box (works for * dropped state only). * * @param bUpdateNow Set as TRUE to call UpdateWindow, FALSE to * call Invalidate. */ virtual void RedrawLB(BOOL bUpdateNow = FALSE); afx_msg void OnSelChange(); afx_msg void OnDropDown(); afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); virtual void _OnSelChange(int nItemIndex); protected: CXTPCalendarEventCategories* m_pCategories; /**< Pointer to categories array.*/ CXTPCalendarEventCategoryIDs m_arChecked; /**< Array which stores checked item IDs.*/ private: UINT m_nLastKey; DECLARE_MESSAGE_MAP() }; AFX_INLINE CXTPCalendarEventCategoryIDs& CXTPCalendarEventCategoryComboBox::GetCategoryArray() { return m_arChecked; } /** * @brief * This class implements the event label selector combobox. */ class _XTP_EXT_CLASS CXTPCalendarEventLabelComboBox : public CXTPCalendarComboBoxBase { public: /** * @brief * Call this member function to initialize the combobox. * * @param pEvent Pointer to the selected calendar event. * @param nTheme Current Calendar theme. * * @return TRUE if successful, FALSE otherwise. */ virtual BOOL Init(CXTPCalendarEvent* pEvent, XTPCalendarTheme nTheme); /** * @brief * Use this member to get the selected label ID. * * @return A selected label ID. */ virtual int GetLabelID() const; /** * @brief * Use this member to get the selected label ID. * * @param nID A selected label ID. * * @return A selected label ID. */ virtual int GetLabelID(int nID) const; /** * @brief * Use this member to set the selected label ID. * * @param nID A selected label ID. */ virtual void SetLabelID(int nID); protected: /** * @brief * This function implements the custom draw combobox items. * * @param lpDIS A pointer to a LPDRAWITEMSTRUCT structure. */ virtual void DrawItem(LPDRAWITEMSTRUCT lpDIS); protected: //{{AFX_MSG(CXTPCalendarEventLabelComboBox) //}}AFX_MSG DECLARE_MESSAGE_MAP() }; /** * @brief * This class implements the busy status selector combobox. */ class _XTP_EXT_CLASS CXTPCalendarBusyStatusComboBox : public CXTPCalendarComboBoxBase { public: /** * @brief * Call this member function to initialize the combobox. * * @param pEvent Pointer to the selected calendar event. * @param nTheme Current Calendar theme. * * @return TRUE if successful, FALSE otherwise. */ virtual BOOL Init(CXTPCalendarEvent* pEvent, XTPCalendarTheme nTheme); protected: /** * @brief * This function implements custom draw combobox items. * * @param lpDIS A pointer to a LPDRAWITEMSTRUCT structure. */ virtual void DrawItem(LPDRAWITEMSTRUCT lpDIS); }; /** * @brief * This class is used to edit calendar event properties. This is a default * implementation which can be used as either an example or as a base class * for custom dialogs. * It is designed to be localized; XTPResourceManager is used to load * resources. * * @see CXTPCalendarEventRecurrenceDlg */ class _XTP_EXT_CLASS CXTPCalendarEventPropertiesDlg : public CDialog { /** @cond */ DECLARE_DYNAMIC(CXTPCalendarEventPropertiesDlg) /** @endcond */ public: enum { IDD = XTP_IDD_CALENDAR_EVENT_PROPERTIES }; /** * @cond * @brief * Dialog class constructor. * * @param pControl [in] Pointer to control. * @param bAddEvent [in] If TRUE DataProvider->AddEvent() will be called * on OK button pressed, otherwise ChangeEvent * will be called. * @param pParent [in] Pointer to parent window. Can be NULL. * @param pEditingEvent [in, out] Pointer to editing event object. If NULL, then * a new event will be created. * @param nIDTemplate [in] Contains the ID number of a dialog-box template resource. * * @details * If pEditingEvent is NULL, then a new event will be created and the StartTime, * EndTime, AllDayEvent, ScheduleID properties will be initialized using * current view selection. * If OK button pressed event will be added or changed and control updated * automatically. * * @see ~CXTPCalendarEventRecurrenceDlg() * CXTPCalendarEventPropertiesDlg(CXTPCalendarControl* pControl, BOOL bAddEvent, CWnd* pParent = NULL, CXTPCalendarEvent* pEditingEvent = NULL, UINT nIDTemplate = CXTPCalendarEventPropertiesDlg::IDD); * @endcond */ /** * @brief * Constructor with extra COleDateTime parameter - initial Dialog * setting - user can change it if needed.
* * @param pControl Pointer to CXTPCalendarControl. * @param bAddEvent BOOL flag to add event (if TRUE) or modify existing (if FALSE). * @param pParent Parent CWnd*. * @param pEditingEvent Pointer to passed event. * @param nIDTemplate Dialog resource template ID. * @param dtInitial Initial datetime passed. */ CXTPCalendarEventPropertiesDlg(CXTPCalendarControl* pControl, BOOL bAddEvent, CWnd* pParent = NULL, CXTPCalendarEvent* pEditingEvent = NULL, UINT nIDTemplate = CXTPCalendarEventPropertiesDlg::IDD, COleDateTime dtInitial = COleDateTime::GetCurrentTime()); /** * @brief * Default object destructor. */ virtual ~CXTPCalendarEventPropertiesDlg(){}; protected: /** * @brief * Update dialog controls values using editing event properties. */ virtual void UpdateControlsFromEvent(); /** * @brief * Update dialog controls state (enabled and visible) using editing * event properties. */ virtual void UpdateControlsState(); /** * @brief * Initialize Reminder combobox. * * @details * Time duration formatted using active resource file. */ virtual void InitReminderComboBox(); virtual void RepairCheckedEvent(); // Generated message map functions virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support virtual BOOL OnInitDialog(); virtual void OnOK(); virtual void OnCancel(); afx_msg void OnCheckReminder(); afx_msg void OnBnClickedButtonRecurrecnce(); afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnBnClickedCheckAlldayEvent(); afx_msg void OnScheduleIdChanged(); afx_msg void OnSelChangeEventCategory(); virtual CString LoadString(UINT nIDResource) const; virtual void AddEndDate_ResetTime(COleDateTime dtStartDate, COleDateTime& rdtEndDate, int nDays); /** @cond */ DECLARE_MESSAGE_MAP() /** @endcond */ public: DWORD GetLastEventID(); BOOL m_bOccurrence; /**< If TRUE the not recurring event or recurrence exception (ocurrence) is editing, otherwise master event is editing. */ BOOL m_bRecurrenceUpdate; /**< Flag to force update event if recurrence dialog used. */ protected: void OnStartDateChanged(NMHDR* pNMHDR, LRESULT* pResult); void OnStartTimeChanged(NMHDR* pNMHDR, LRESULT* pResult); void OnEndDateChanged(NMHDR* pNMHDR, LRESULT* pResult); void OnEndTimeChanged(NMHDR* pNMHDR, LRESULT* pResult); protected: CXTPCalendarEventPtr m_ptrEditingEvent; /**< Pointer to editing event object. */ CXTPCalendarControl* m_ptrControl; /**< Pointer to Calendar control. */ CWnd* m_pOwnerWnd; /**< Pointer to Owner Wnd. */ BOOL m_bAddEvent; /**< Store edit mode: Add or Change. */ DWORD m_dNewEventID; /**< Successfully added Event ID. */ BOOL m_bHScrollEnabled; /**< Tells whether the horizontal scrollbar is enabled or not.*/ BOOL m_bVScrollEnabled; /**< Tells whether the vertical scrollbar is enabled or not. */ protected: //------------------------------------------------------------------------ CString m_strSubject; /**< Store subject editor value. UpdateData method used to Exchange value with dialog control.*/ CString m_strLocation; /**< Store location editor value. UpdateData method used to Exchange value with dialog control*/ CString m_strBody; /**< Store body editor value. UpdateData method used to Exchange value with dialog control.*/ COleDateTime m_dtStartDate; /**< Store StartDate editor value. UpdateData method used to Exchange value with dialog control.*/ COleDateTime m_dtStartTime; /**< Store StartTime editor value. UpdateData method used to Exchange value with dialog control.*/ COleDateTime m_dtEndDate; /**< Store EndDate editor value. UpdateData method used to Exchange value with dialog control.*/ COleDateTime m_dtEndTime; /**< Store EndTime editor value. UpdateData method used to Exchange value with dialog control.*/ int m_nBusyStatus; /**< Store BusyStatus checkbox value. UpdateData method used to Exchange value with dialog control.*/ BOOL m_bAllDayEvent; /**< Store AllDayEvent checkbox value. UpdateData method used to Exchange value with dialog control.*/ BOOL m_bPrivate; /**< Store Private checkbox value. UpdateData method used to Exchange value with dialog control.*/ BOOL m_bMeeting; /**< Store Meeting checkbox value. UpdateData method used to Exchange value with dialog control.*/ BOOL m_bReminder; /**< Store Reminder checkbox value. UpdateData method used to Exchange value with dialog control.*/ int m_nAllDayEventSet; /**< If value \< 0 - AllDayEvent control initialized from editing event, otherwise it is initialized from m_nAllDayEventSet value.*/ CXTPCalendarEventCategoryComboBox m_wndCategoryCombo; /**< Categories combobox control instance.*/ CXTPCalendarEventLabelComboBox m_wndLabelCombo; /**< Label combobox control instance.*/ CComboBox m_wndReminderCombo; /**< Reminder combobox control instance.*/ CXTPCalendarBusyStatusComboBox m_wndBusyStatusCombo; /**< BusyStatus combobox control instance.*/ CComboBox m_ctrlScheduleIDCB; /**< ScheduleID combobox control instance.*/ CStatic m_ctrlScheduleLabel; /**< Label window for ScheduleID combobox control.*/ CCheckListBox m_ctrlScheduleSet; /**< for MultipleSchedules support*/ XTPCalendarTheme m_nTheme; }; # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif // !defined(_XTP_CALENDAR_EVENT_PROPERTIS_DLG_H__)