/** * @file XTPCalendarControl.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(_XTPCALENDARCONTROL_H__) # define _XTPCALENDARCONTROL_H__ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPCalendarView; class CXTPCalendarPaintManager; class CXTPCalendarData; class CXTPCalendarDayView; class CXTPCalendarWeekView; class CXTPCalendarMonthView; class CXTPCalendarTimeLineView; class CXTPCalendarOptions; class CXTPNotifyConnection; class CXTPNotifySink; class CXTPCalendarRemindersManager; class CXTPCalendarResources; class CXTPCalendarResourcesNf; class CXTPCalendarTheme; class CXTPMarkupContext; class CXTPMarkupUIElement; class CXTPCalendarTip; typedef DWORD_PTR XTP_CONNECTION_ID; /** * @brief * Class CXTPCalendarControl implements the calendar's view interface. * * @details * A CXTPCalendarControl object implements a calendar view interface * similar to an Outlook 2003 interface. * * There are 2 main separated concepts: Calendar data contents * and Calendar views representing this contents. * * It can show 3 types of following predefined views. Also any type * of user view could also be implemented as a descendant of CXTPCalendarView class. * * Day and work week views - using CXTPCalendarDayView class. * Week view - using CXTPCalendarWeekView class. * Month view - using CXTPCalendarMonthView class. * * One of the other main Control's concepts is Calendar Resources. * Resource is the source of Calendar data contents with some additional * properties. This concept is designed to represent a schedule of a * separate person, or a shared resource (sic!) like a conference room, * a projector, and any similar entity. Each Resource has its own Data * Provider, therefore the Control can show different data sources on the * same screen. For example, you can configure Control to show your own * Outlook events in "your" resource (using MAPI Data Provider), then * you can use some shared resource data using Database Data Provider, etc. * * Note that each event now has a standard "Schedule" property, defining * which user's schedule it belongs to. And each resource has a collection * of Schedule ID's to represent on it. For example, you can have only * one common Data Provider which stores events data for all members of * your organization. Every member has a corresponding schedule (i.e. * Jeff - ID 1, Matt - ID 2, John - ID 3, Room 1 - ID 10, Room 2 - ID 11, etc). * You can configure a number of resources to show data for every team * member separately, and one resource to show events for both room 1 and * room 2 together. Or for example, you want to show a common view of all * events for a specified team including only some of employees. You will * add their schedule ID's to the corresponding Resource collection, and * see all of them. Of course, when you open event details, you'll see * who it belongs to. * * * There are 2 regular models of using your custom data source with Calendar control. * * a) Firstly, you can use built-in Memory data provider, which will handle * all the data in itself. If you do not specify neither XML nor Binary * filename, it will not be automatically loaded or saved. In this case, * you'll have 2 entry points in your application: * -- Loading all data from your data source (could be done on form load * for example). Your data access code would transfer CalendarEvents * records from the data storage to objects and add them into * corresponding Calendar's collection. * -- Saving data to your data storage. You'll have to iterate all CalendarEvents, * transfer them into your data records and upload into the database. * This could be implemented through pressing the Save button for example. * This is the most easy way. * * b) Second idea is to handle basic data storage operations by yourself. * This is called "custom data provider model". It could be needed when * you have many CalendarEvents records and do not want to store * them all in memory because of a huge size. Another possible need of * using this model is having all the information always updated if your * data storage is shared. * * * For some predefined examples of this functionality look Calendar Samples, * and menu items: MultiSchedules configuration and Load sample configurations... * * @see CXTPCalendarView * @see CXTPCalendarData * @see CXTPCalendarResource */ class _XTP_EXT_CLASS CXTPCalendarControl : public CWnd { friend class CXTPCalendarView; friend class CXTPCalendarViewDay; friend class CXTPCalendarViewGroup; friend class CXTPCalendarViewEvent; friend class CCalendarControlCtrl; friend class CXTPCalendarControlView; friend class CXTPCalendarResource; friend class CXTPCalendarThemePart; public: /** * @brief * This member function constructs a CXTPCalendarControl object. * * @details * Construct a CXTPCalendarControl object in two steps. * First, call the constructor CXTPCalendarControl and then * call Create method, which initializes the window. * * Example: *
* Declare a local CXTPCalendarControl object.
* CXTPCalendarControl myCalendar;
*
* // Declare a dynamic CXTPCalendarControl object.
* CXTPCalendarControl* pMyCalendar = new CXTPCalendarControl();
*
* // Create a window
* if (!myCalendar.Create(WS_CHILD | WS_TABSTOP | WS_VISIBLE, rcRect, this,
* ID_CALENDAR_CONTROL))
* {
* TRACE(_T("Failed to create calendar control window\n"));
* }
*
*
* @see Create
*/
CXTPCalendarControl();
/**
* @brief
* This member function destroys a CXTPCalendarControl object and
* handles cleanup and deallocation.
*/
virtual ~CXTPCalendarControl();
/**
* @brief
* This member function handles control window creation.
*
* @param dwStyle Specifies the window style attributes.
* @param rect The size and position of the window, in client coordinates of pParentWnd.
* @param pParentWnd The parent window.
* @param nID The ID of the child window.
*
* @return Nonzero if successful; otherwise 0.
*/
virtual BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
/**
* @brief
* This member function populates the active control view with
* events data.
*
* @details
* Creates a new events views collection for the view, populating it
* with the data objects taken from the associated data provider.
*/
virtual void Populate();
// Operations
public:
/**
* @brief
* This member function is used to obtain current paint theme.
*
* @return A paint theme ID from enum XTPCalendarTheme.
*/
virtual XTPCalendarTheme GetPaintTheme() const;
/**
* @brief
* This member function is used to set current paint theme.
*
* @param ePaintTheme A paint theme ID from enum XTPCalendarTheme.
*/
virtual void SetPaintTheme(XTPCalendarTheme ePaintTheme);
/**
* @brief
* This member function is used to set current paint theme.
*
* @param pPaintManager A valid pointer to a CXTPCalendarPaintManager object.
* @param pTheme Pointer to a CXTPCalendarTheme object when using resource DLL otherwise NULL.
*/
virtual void SetPaintTheme(CXTPCalendarPaintManager* pPaintManager, CXTPCalendarTheme* pTheme);
/**
* @brief
* This member function is used to obtain the current theme ID. Basically
* this can be used to check if the 2010 or 2007 theme is used.
*
* @return A theme version ID from enum XTPCalendarThemeVersion.
*/
XTPCalendarThemeVersion GetThemeVersion() const;
/////////////////////////////////////////////////////////////////////////
// drawing related
/**
* @brief
* This member function obtains a pointer to the associated paint
* manager.
*
* @details
* Call this member function to obtain the paint manager object used
* for drawing a calendar control window.
*
* @return A CXTPCalendarPaintManager pointer to the associated paint manager object.
*/
CXTPCalendarPaintManager* GetPaintManager() const;
/**
* @brief
* This member function obtains a pointer to the associated theme
* object.
*
* @details
* Themes are used for drawing a calendar control window instead of
* a Paint manager.
* This is a new feature of Calendar control which will be further
* developed.
* Some new drawing features will be added for themes only
* (no for Paint manager). But the Paint manager will also be used
* for compatibility.
*
* Initial version. Themes will be expanded in the feature.
*
* @return A CXTPCalendarTheme pointer to the associated theme object or NULL.
*
* @see CXTPCalendarView::GetTheme
* @see GetPaintManager
*/
CXTPCalendarTheme* GetTheme() const;
/**
* @brief
* This member function sets (or disables) the new control drawing
* theme.
*
* @param pTheme A CXTPCalendarTheme pointer to the theme object.
* If pTheme is NULL - themes are disabled and the paint
* manager is used.
*
* @details
* Themes are used for drawing a calendar control window instead of
* a Paint manager.
* This is a new feature of Calendar control which will be further
* developed.
* Some new drawing features will be added for themes only
* (no for Paint manager). But the Paint manager will also be used
* for compatibility.
*
* Initial version. Themes will be expanded in the feature.
*
* @see GetPaintManager
*/
void SetTheme(CXTPCalendarTheme* pTheme);
/////////////////////////////////////////////////////////////////////////
// resources related
/**
* @brief
* Obtain a pointer to collection of Calendar Resources.
*
* @details
* Use this method to retrieve a pointer to the Calendar Resources
* collection of this Calendar control.
*
* @return CXTPCalendarResources pointer.
*
* @see CXTPCalendarResources overview
*/
CXTPCalendarResources* GetResources() const;
/**
* @brief
* This member function sets the new Resources collection for the control.
*
*
* @param pResources A pointer to the CXTPCalendarResources collection object.
* @param pOptionsDataProvider A pointer to the Data Provider object for
* using on Calendar Options.
*
* @details
* Call this member function to programmatically set the new
* Resources collection for the control.
*/
void SetResources(CXTPCalendarResources* pResources,
CXTPCalendarData* pOptionsDataProvider = NULL);
/////////////////////////////////////////////////////////////////////////
// data provider related
/**
* @brief
* This member function sets the custom data provider for the control.
*
* @param lpszConnectionString A text Calendar connection string.
*
* @details
* Call this member function to set the custom data provider
* that is currently used by this calendar control. Note that
* custom data provider must be a descendant of CXTPCalendarData.
*
* @see CXTPCalendarData
* @see XTPCalendarDataProvider
* @see GetDataProvider
*/
void SetDataProvider(LPCTSTR lpszConnectionString);
/**
* @brief
* This member function sets the custom data provider for the control.
*
* @param pDataProvider Pointer to the custom data provider object.
* @param bCloseDataProviderWhenDestroy BOOL value shows whether data
* provider should be closed with the
* control's destruction.
*
* @details
* Call this member function to set the custom data provider
* that is currently used by this calendar control. Note that
* custom data provider must be a descendant of CXTPCalendarData.
*
* @see CXTPCalendarData
* @see XTPCalendarDataProvider
* @see GetDataProvider
*/
void SetDataProvider(CXTPCalendarData* pDataProvider,
BOOL bCloseDataProviderWhenDestroy = TRUE);
/**
* @brief
* This member function sets the custom data provider for the control.
*
* @param eDataProvider Data provider type.
* @param lpszConnectionString A text Calendar connection string.
*
* @details
* Call this member function to set the custom data provider
* that is currently used by this calendar control. Note that
* custom data provider must be a descendant of CXTPCalendarData.
*
* @see CXTPCalendarData
* @see XTPCalendarDataProvider
* @see GetDataProvider
*/
void SetDataProvider(XTPCalendarDataProvider eDataProvider,
LPCTSTR lpszConnectionString = NULL);
/**
* @brief
* Returns common data provider if it was previously set.
*
* @return A pointer to the common data provider if it was previously set;
* otherwise, returns NULL.
*/
CXTPCalendarData* GetDataProvider() const;
/////////////////////////////////////////////////////////////////////////
// view related
/**
* @brief
* This member function obtains a pointer to the current calendar view.
*
* @details
* Call this member function to obtain the calendar view object
* currently used in this calendar control.
*
* @return A CXTPCalendarView pointer to the associated calendar view object.
*
* @see CXTPCalendarView overview
* @see SetActiveView
* @see GetViewDay
* @see GetWeekView
* @see GetMonthView
*/
virtual CXTPCalendarView* GetActiveView() const;
/**
* @brief
* This member function obtains a pointer to the Day calendar view.
*
* @details
* Call this member function to obtain a Day calendar view object
* regardless of its visibility.
*
* @return A CXTPCalendarView pointer to the associated calendar view object.
*
* @see CXTPCalendarView overview
* @see GetActiveView
* @see GetWeekView
* @see GetMonthView
*/
CXTPCalendarDayView* GetDayView() const;
/**
* @brief
* This member function obtains a pointer to the Week calendar view.
*
* @details
* Call this member function to obtain a Week calendar view object
* regardless of its visibility.
*
* @return A CXTPCalendarView pointer to the associated calendar view object.
*
* @see CXTPCalendarView overview
* @see GetActiveView
* @see GetDayView
* @see GetMonthView
*/
CXTPCalendarWeekView* GetWeekView() const;
/**
* @brief
* This member function obtains a pointer to the Month calendar view.
*
* @details
* Call this member function to obtain a Month calendar view object
* regardless of its visibility.
*
* @return A CXTPCalendarView pointer to the associated calendar view object.
*
* @see CXTPCalendarView overview
* @see GetActiveView
* @see GetWeekView
* @see GetDayView
*/
CXTPCalendarMonthView* GetMonthView() const;
/**
* @brief
* This member function obtains a pointer to the TimeLine calendar view.
*
* @details
* Call this member function to obtain a TimeLine calendar view object
* regardless of its visibility.
*
* @return A CXTPCalendarView pointer to the associated calendar view object.
*
* @see CXTPCalendarView overview
* @see GetActiveView
* @see GetWeekView
* @see GetDayView
* @see GetMonthView
*/
CXTPCalendarTimeLineView* GetTimeLineView() const;
/**
* @brief
* This member function sets a predefined calendar view for the control.
*
* @param eView Calendar view type.
*
* @details
* Call this member function to set the predefined calendar view
* that is currently used by this calendar control.
*
* @see CXTPCalendarView overview
* @see XTPCalendarViewType
* @see GetActiveView
*/
virtual void SwitchActiveView(XTPCalendarViewType eView);
// Implementation
public:
/////////////////////////////////////////////////////////////////////////
// drawing related
/**
* @brief
* Call this member to set right-to-left mode.
*
* @param bRightToLeft TRUE to set right-to-left reading-order properties.
*/
void SetLayoutRTL(BOOL bRightToLeft);
/**
* @brief
* Call this member to determine if right-to-left mode is active.
*
* @return TRUE if right-to-left mode is enabled and FALSE otherwise.
*/
BOOL IsLayoutRTL() const;
/**
* @brief
* Call this member to get current TimeLine mode.
*
* @return An integer representing one of the following values.
*
* xtpTSPID_Day = 1,
* xtpTSPID_Week = 2,
* xtpTSPID_Month = 3,
* xtpTSPID_WorkWeek = 4,
*/
int GetTimeLineScale() const;
/**
* @brief
* This member function initiates the Calendar control's redrawing.
*
* @param bForce Set this parameter to TRUE if you'd like to force
* control's redrawing even if update is locked.
*
* @details
* Call this member function if you want to force the control's
* redrawing. The control will be redrawn to reflect its latest state.
*
* @see CXTPCalendarControl::CUpdateContext
* @see AdjustLayout
* @see AdjustScrollBar
* @see LockUpdate
* @see UnlockUpdate.
*/
virtual void RedrawControl(BOOL bForce = FALSE);
/**
* @brief
* This member function adjusts the main control parts depending
* on the current control's size.
*
* @see CXTPCalendarControl::CUpdateContext
* @see AdjustScrollBar
* @see RedrawControl
*/
virtual void AdjustLayout();
/**
* @brief
* This member function adjusts the main control parts depending
* on the current control's size.
*
* @param pDC Pointer to a valid device context.
* @param rcView A rectangle for calendar control.
*
* @see CXTPCalendarControl::CUpdateContext
* @see AdjustScrollBar
* @see RedrawControl
*/
virtual void AdjustLayout(CDC* pDC, const CRect& rcView);
/**
* @brief
* This member function adjusts the scroll bar to reflect the current
* control's state.
*
* @param nSBType Specifies the scroll bar type to be adjusted.
* This parameter can be either of the following:
* * SB_HORZ - Horizontal scroll bar.
* * SB_VERT - Vertical scroll bar.
*
* @see CXTPCalendarControl::CUpdateContext
* @see AdjustLayout
* @see RedrawControl
*/
virtual void AdjustScrollBar(int nSBType = -1);
/**
* @brief
* This member function switch calendar to timeline mode
*/
void OnCalendarTimeline();
private:
// Always updates the screen on exit block
void BeginUpdate();
void EndUpdate();
// Update the screen on exit block only when something has changed
void LockUpdate();
void UnlockUpdate();
// Adjusts layout on exit block
void BeginAdjust(BOOL bWithScrollBar = FALSE);
void EndAdjust(BOOL bWithScrollBar = FALSE);
public:
/////////////////////////////////////////////////////////////////////////
// managing calendar settings
/**
* @brief
* This member function gets the bitwise mask of the work week.
*
* @return An integer containing the bitwise day mask.
*
* @see SetWorkWeekMask
* @see XTPCalendarWeekDay
*/
int GetWorkWeekMask() const;
/**
* @brief
* This member function sets the bitwise mask for the work week.
*
* @param nMask An int that contains the new bitwise mask for the work week.
*
* @see GetWorkWeekMask
* @see XTPCalendarWeekDay
*/
void SetWorkWeekMask(const int nMask);
/**
* @brief
* This member function gets the first day of the week.
*
* @return First day of the week represented by an integer from
* range between 1 and 7, where 1 = Sunday, 2 = Monday, and so on.
*
* @see SetFirstDayOfWeek
* @see XTPCalendarWeekDay
*/
int GetFirstDayOfWeek() const;
/**
* @brief
* This member function gets the first week of year days.
*
* @return An integer denoting the first week of year days,
*/
int GetFirstWeekOfYearDays() const;
/**
* @brief
* This member function sets the first day of the week.
*
* @param nFirstDayOfWeek An int that contains the new first day of the
* week. An integer from range between 1 and 7,
* where 1 = Sunday, 2 = Monday, and so on.
*
* @see GetFirstDayOfWeek
* @see XTPCalendarWeekDay
*/
void SetFirstDayOfWeek(const int nFirstDayOfWeek);
/**
* @brief
* Call this member function to set the first week of year days.
*
* @param nFirstWeekOfYearDays An integer denoting the first week of year days.
*/
void SetFirstWeekOfYearDays(const int nFirstWeekOfYearDays);
/**
* @brief
* This member function gets the begin time of the working day.
*
* @param dtTime A reference to the COleDateTime value to store the result.
*
* @see SetWorkDayStartTime
* @see GetWorkDayEndTime
* @see SetWorkDayEndTime
*/
void GetWorkDayStartTime(COleDateTime& dtTime) const;
/**
* @brief
* This member function gets the begin time of the working day.
*
* @param nHour An int. A reference to the hour part of the result.
* @param nMin An int. A reference to the minutes part of the result.
* @param nSec An int. A reference to the seconds part of the result.
*
* @see SetWorkDayStartTime
* @see GetWorkDayEndTime
* @see SetWorkDayEndTime
*/
void GetWorkDayStartTime(int& nHour, int& nMin, int& nSec) const;
/**
* @brief
* This member function gets the end time of the working day.
*
* @param dtTime A reference to the COleDateTime value to store the result.
*
* @see SetWorkDayEndTime
* @see GetWorkDayStartTime
* @see SetWorkDayStartTime
*/
void GetWorkDayEndTime(COleDateTime& dtTime) const;
/**
* @brief
* This member function gets the end time of the working day.
*
* @param nHour An int. A reference to the hour part of the result.
* @param nMin An int. A reference to the minutes part of the result.
* @param nSec An int. A reference to the seconds part of the result.
*
* @see SetWorkDayEndTime
* @see GetWorkDayStartTime
* @see SetWorkDayStartTime
*/
void GetWorkDayEndTime(int& nHour, int& nMin, int& nSec) const;
/**
* @brief
* Sets format for Cell's Day Header in Month View.
*
* @param pcszCustomFormat An string sd custom format.
*/
void SetLongDayHeaderFormat(LPCTSTR pcszCustomFormat);
/**
* @brief
* Sets format for Cell's Day Header in Month View.
*
* @param pcszCustomFormat An string sd custom format.
*/
void SetSmallDayHeaderFormat(LPCTSTR pcszCustomFormat);
/**
* @brief
* This member function sets the begin time for the working day.
*
* @param dtTime A new begin time value.
*
* @see GetWorkDayStartTime
* @see GetWorkDayEndTime
* @see SetWorkDayEndTime
*/
void SetWorkDayStartTime(const COleDateTime& dtTime);
/**
* @brief
* This member function sets the begin time for the working day.
*
* @param nHour An int. The hour part of the new time value.
* @param nMin An int. The minutes part of the new time value.
* @param nSec An int. The seconds part of the new time value.
*
* @see GetWorkDayStartTime
* @see GetWorkDayEndTime
* @see SetWorkDayEndTime
*/
void SetWorkDayStartTime(int nHour, int nMin, int nSec);
/**
* @brief
* This member function sets an end time for the working day.
*
* @param dtTime A new end time value.
*
* @see GetWorkDayEndTime
* @see GetWorkDayStartTime
* @see SetWorkDayStartTime
*/
void SetWorkDayEndTime(const COleDateTime& dtTime);
/**
* @brief
* This member function sets an end time for the working day.
*
* @param nHour An int. The hour part of the new time value.
* @param nMin An int. The minutes part of the new time value.
* @param nSec An int. The seconds part of the new time value.
*
* @see GetWorkDayEndTime
* @see GetWorkDayStartTime
* @see SetWorkDayStartTime
*/
void SetWorkDayEndTime(int nHour, int nMin, int nSec);
/**
* @brief
* This member function adds a custom time interval for an event to choose in the event
* properties dialog.
*
* @param nMin An int. Custom reminder interval in minutes.
* @param szCustomMeaning A string that describes this interval (e.g. hour, day). Default
* string is CXTPCalendarUtils::FormatTimeDuration(nMin).
* @param bIgnoreDefaultValues Tells the event properties dialog to ignore default reminder
* time intervals (1,5,10,15 minutes)
*/
void AddCustomTimeIntervalForReminder(int nMin, LPCTSTR szCustomMeaning = NULL,
BOOL bIgnoreDefaultValues = FALSE);
/**
* @brief
* Call this method to determine if the AutoResetBusyFlag is set.
*
* @return Value of AutoResetBusyFlag.
*
* @see MonthView_SetCompressWeekendDays
*/
BOOL DayView_IsAutoResetBusyFlag() const;
/**
* @brief
* Call this method to set the AutoResetBusyFlag.
*
* @param bAutoResetBusyFlag A BOOL.
* TRUE to set the AutoResetBusyFlag.
* FALSE otherwise.
*
* @see MonthView_SetCompressWeekendDays
*/
void DayView_SetAutoResetBusyFlag(BOOL bAutoResetBusyFlag = TRUE);
/**
* @brief
* Call this method to determine whether weekend days are
* drawn compressed in month view or not.
*
* @return TRUE if weekend days are drawn compressed. FALSE otherwise.
*
* @see MonthView_SetCompressWeekendDays
*/
BOOL MonthView_IsCompressWeekendDays() const;
/**
* @brief
* Call this method to specify whether weekend days are
* drawn compressed in the month view.
*
* @param bCompress A BOOL. TRUE if weekend days are drawn compressed.
* FALSE otherwise.
*
* @see MonthView_IsCompressWeekendDays
*/
void MonthView_SetCompressWeekendDays(BOOL bCompress = TRUE);
/**
* @brief
* Call this method to determine whether the end date is
* shown for events in the month view.
*
* @return TRUE if the end date is shown. FALSE otherwise.
*
* @see MonthView_SetShowEndDate
*/
BOOL MonthView_IsShowEndDate() const;
/**
* @brief
* Call this method to specify whether the end date is
* shown in the month view.
*
* @param bShowEnd A BOOL. TRUE if the end date is shown in month view.
* FALSE otherwise.
*
* @see MonthView_IsShowEndDate
*/
void MonthView_SetShowEndDate(BOOL bShowEnd = TRUE);
/**
* @brief
* Call this method to determine if the time is
* shown as a graphical clock for events in the month view.
*
* @return TRUE for time shown as graphical clock. FALSE otherwise.
*
* @see MonthView_SetShowTimeAsClocks
*/
BOOL MonthView_IsShowTimeAsClocks() const;
/**
* @brief
* Call this method to specify if the events start and end time is
* shown as a graphical clock in the month view.
*
* @param bShowClocks A BOOL. TRUE if the time is shown as a graphical clock.
* FALSE otherwise.
*
* @see MonthView_IsShowTimeAsClocks
*/
void MonthView_SetShowTimeAsClocks(BOOL bShowClocks = TRUE);
/**
* @brief
* Call this method to determine if the end date is
* shown for events in the week view.
*
* @return TRUE if the end date is shown. FALSE otherwise.
*
* @see WeekView_SetShowEndDate
*/
BOOL WeekView_IsShowEndDate() const;
/**
* @brief
* Call this method to specify if the end date is
* shown in week view.
*
* @param bShowEnd A BOOL. TRUE if the end date is shown in week view.
* FALSE otherwise.
*
* @see WeekView_IsShowEndDate
*/
void WeekView_SetShowEndDate(BOOL bShowEnd);
/**
* @brief
* Call this method to determine if the time is
* shown as a graphical clock for events in the week view.
*
* @return TRUE for time shown as graphical clocks, FALSE otherwise.
*
* @see WeekView_SetShowTimeAsClocks
*/
BOOL WeekView_IsShowTimeAsClocks() const;
/**
* @brief
* Call this method to specify if the events start and end time is
* shown as a graphical clock in week view.
*
* @param bShowClocks A BOOL. TRUE for time to be shown as graphical clocks, FALSE
* otherwise.
*
* @see WeekView_IsShowTimeAsClocks
*/
void WeekView_SetShowTimeAsClocks(BOOL bShowClocks);
/**
* @brief
* This member function sets the new control drawing PaintManager.
*
* @param pPaintManager A CXTPCalendarPaintManager pointer to the
* new paint manager object.
*
* @details
* Call this member function to set the paint manager object used
* for drawing a calendar control window.
*
* @see GetPaintManager
*/
void SetPaintManager(CXTPCalendarPaintManager* pPaintManager);
/**
* @brief
* This member function updates the mouse cursor in relation with
* the control's state.
*
* @return A BOOL. TRUE if the mouse cursor was updated to one of the known modes,
* FALSE if the mode is unknown and the cursor was set to default arrow.
*/
virtual BOOL UpdateMouseCursor();
//---- Time Management functions ----------------------------------------
/**
* @brief
* This member function is used to determine if the provided date is "today"
* The today date may be overriden with SetTodayDateOverride() call or with custom time
* provider
* @param dtDate A specific date.
*
* @return A BOOL. TRUE if the provided date is "today" for this calendar control instance,
*FALSE otherwise
*/
virtual BOOL IsToday(const COleDateTime& dtDate) const;
/**
* @brief
* This member function is used to determine the "today" date
* The today date may be overriden with SetTodayDateOverride() call or with custom time
* provider.
*
* @return COleDateTime with "today" date for this calendar control instance
*/
COleDateTime GetTodayDate() const;
/**
* @brief
* This member function is used to override the "today" date. Calendar control will assume
* the date provided as "today" The today date is used to draw highlight border for day
* views (mark them as today).
*
* @param dtTodayOverride reference to a COleDateTime object
*/
void SetTodayDateOverride(const COleDateTime& dtTodayOverride);
/**
* @brief
* This member function returns override for "today" date is it was set with
* SetTodayDateOverride() call. If the GetState() member function of COleDateTime returns
* invalid flag for returned date, then no override was applied.
*
* @return COleDateTime object with override today date.
*/
COleDateTime GetTodayDateOverride() const;
/**
* @brief
* This member function resets override for "today" date to the current date. If no
* override is applied the calls to GetTodayDate() and IsToday() will use the
* CXTPCalendarUtils::GetCurrentTime() to determine the current time on user machine.
*/
void ResetTodayDateOverride();
public:
// for compatibility with previous versions
// use xtp_wm_UserAction for the feature
//
/**
* @brief
* This member function queues the calendar view while changing
* to the day view for the specified day.
*
* @param dtDate A specified date to change to.
*
* @details
* Call this member function for changing calendar view
* to the day view for the specified day.
*
* @see CXTPCalendarDayView overview
* @see XTPCalendarViewType
* @see GetAvtiveView
* @see SetAvtiveView
*/
virtual void QueueDayViewSwitch(DATE dtDate);
/**
* @brief
* 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.
*/
virtual BOOL RegisterWindowClass(HINSTANCE hInstance = NULL);
protected:
/**
* @brief
* This member function performs all of the drawing logic of the
* calendar control window.
*
* @param pDC Pointer to a valid device context.
*
* @see OnPaint
*/
virtual void OnDraw(CDC* pDC);
/**
* @brief
* This member function sets the custom calendar view for the control.
*
* @param pView Pointer to the custom calendar view object.
*
* @details
* Call this member function to set the custom calendar view
* currently used by the calendar control. Note that
* custom calendar view must be descendant of CXTPCalendarView.
*
* @see CXTPCalendarView overview
* @see GetActiveView
*/
virtual void SetActiveView(CXTPCalendarView* pView);
/**
* @brief
* This member function creates a timer event.
*
* @param uTimeOut_ms Duration of timer in milliseconds.
*
* @return The identifier of the timer.
*/
virtual UINT SetTimer(UINT uTimeOut_ms);
/**
* @brief
* This member function is called by the framework before the
* view is destroyed.
*/
virtual void OnBeforeDestroy();
/**
* @brief
* This member function adjusts the scroll bar to reflect the current
* control's state.
*
* @param nSBType Specifies the scroll bar type to be adjusted.
* This parameter can be either of the following:
* * SB_HORZ - Horizontal scroll bar.
* * SB_VERT - Vertical scroll bar.
*
* @see CXTPCalendarControl::CUpdateContext
* @see AdjustLayout
* @see RedrawControl
*/
virtual void AdjustScrollBarEx(int nSBType);
/**
* @brief
* This member function internally sets the custom data provider
* for the control.
*
* @param pDataProvider Pointer to the custom data provider object.
* @param bCloseDataProviderWhenDestroy BOOL value shows whether data
* provider should be closed with the
* control's destruction.
*
* @details
* This method is used by SetDataProvider().
*
* @see SetDataProvider
*/
virtual void _SetDataProvider(CXTPCalendarData* pDataProvider,
BOOL bCloseDataProviderWhenDestroy = TRUE);
public:
/**
* @brief
* Obtain a pointer to the notification connection object.
*
* @details
* Used to subscribe (Advice) for notification events from the
* control.
*
* @return Connection object pointer.
*
* @see CXTPNotifyConnection overview
* @see IXTPNotificationSink overview
*/
CXTPNotifyConnection* GetConnection() const;
/**
* @brief
* This member function sends a notification to all control's
* event subscribers.
*
* @param EventCode A specific code identifying 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.
* SendNotification depends on EnableSendNotifications flag.
* SendNotificationAlways - Performs send in any case.
*
* @see XTP_NOTIFY_CODE
* @see GetConnection
*/
virtual void SendNotification(XTP_NOTIFY_CODE EventCode, WPARAM wParam, LPARAM lParam);
/**
* @brief
* This member function sends a notification to all control's
* event subscribers.
*
* @param EventCode A specific code identifying 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.
* SendNotification depends on EnableSendNotifications flag.
* SendNotificationAlways - Performs send in any case.
*
* @see XTP_NOTIFY_CODE
* @see GetConnection
*/
virtual void SendNotificationAlways(XTP_NOTIFY_CODE EventCode, WPARAM wParam, LPARAM lParam);
/**
* @brief
* This member function enables or disables sending a notification
* to all control's event subscribers.
*
* @param bEnable TRUE to allow sending notifications,
* FALSE to disallow.
*
* @see SendNotification
*/
virtual void EnableSendNotifications(BOOL bEnable = TRUE);
/**
* @brief
* Obtain an associated Reminders Manager object.
*
* @details
* Use this method to retrieve a pointer to the Reminders Manager
* object associated to this Calendar control.
*
* @return Calendar Reminders Manager.
*
* @see CXTPCalendarRemindersManager overview
*/
virtual CXTPCalendarRemindersManager* GetRemindersManager() const;
public:
/**
* @brief
* This member function is used to process the command with the
* specified ID.
*
* @param uCommandID Command ID. Specifies which command to process.
*
* @see OnUndo
* @see OnCut
* @see OnCopy
* @see OnPaste
*/
virtual void OnEditCommand(UINT uCommandID);
/**
* @brief
* This member function is used to process the "Undo" command.
*
* @see OnCommand
* @see OnCut
* @see OnCopy
* @see OnPaste
*/
afx_msg virtual void OnUndo();
/**
* @brief
* This member function is used to process the "Cut" command.
*
* @see OnCommand
* @see OnUndo
* @see OnCopy
* @see OnPaste
*/
afx_msg virtual void OnCut();
/**
* @brief
* This member function is used to process the "Copy" command.
*
* @see OnCommand
* @see OnUndo
* @see OnCut
* @see OnPaste
*/
afx_msg virtual void OnCopy();
/**
* @brief
* This member function is used to process the "Paste" command.
*
* @see OnCommand
* @see OnUndo
* @see OnCut
* @see OnCopy
*/
afx_msg virtual void OnPaste();
/**
* @brief
* This member function is used to update the user interface
* object represented by pCmdUI.
*
* @param pCmdUI pointer to the CCmdUI object.
*
* @see OnUpdateUndo
* @see OnUpdateCut
* @see OnUpdateCopy
* @see OnUpdatePaste
*/
afx_msg virtual void OnUpdateCmdUI(CCmdUI* pCmdUI);
/**
* @brief
* This member function is used to update the user interface
* object represented by pCmdUI for the "Undo" command only.
*
* @param pCmdUI pointer to the CCmdUI object.
*
* @see OnUpdateUndo
* @see OnUpdateCut
* @see OnUpdateCopy
* @see OnUpdatePaste
*/
afx_msg virtual void OnUpdateUndo(CCmdUI* pCmdUI);
/**
* @brief
* This member function is used to update the user interface object
* represented by pCmdUI for the "Cut" command only.
*
* @param pCmdUI pointer to the CCmdUI object.
*
* @see OnUpdateUndo
* @see OnUpdateUndo
* @see OnUpdateCopy
* @see OnUpdatePaste
*/
afx_msg virtual void OnUpdateCut(CCmdUI* pCmdUI);
/**
* @brief
* This member function is used to update the user interface object
* represented by pCmdUI for the "Copy" command only.
*
* @param pCmdUI pointer to the CCmdUI object.
*
* @see OnUpdateUndo
* @see OnUpdateUndo
* @see OnUpdateCut
* @see OnUpdatePaste
*/
afx_msg virtual void OnUpdateCopy(CCmdUI* pCmdUI);
/**
* @brief
* This member function is used to update the user interface
* object represented by pCmdUI for the "Paste" command only.
*
* @param pCmdUI pointer to the CCmdUI object.
*
* @see OnUpdateUndo
* @see OnUpdateUndo
* @see OnUpdateCut
* @see OnUpdateCopy
*/
afx_msg virtual void OnUpdatePaste(CCmdUI* pCmdUI);
/**
* @brief
* This member function is called by WindowProc, or is called during
* message reflection.
*
* @param message Specifies the message to be sent.
* @param wParam Specifies additional message-dependent information.
* @param lParam Specifies additional message-dependent information.
* @param pResult The return value of WindowProc. Depends on the message; may be NULL.
*
* @return TRUE if the message is handled properly, FALSE else.
*/
afx_msg virtual BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult);
/**
* @brief
* This member function is used to catch messages before child
* windows (like Subject editor).
*
* @details
* The child windows must call OnWndMsg_Children() for the messages
* which are interesting for other calendar control parts (main control
* window, view, day view, event view). The OnWndMsg() method may be
* overridden for this purposes. This mechanism is used instead of
* PreTranslateMessage() for ActiveX builds.
*
* @param message Specifies the message to be sent.
* @param wParam Specifies additional message-dependent information.
* @param lParam Specifies additional message-dependent information.
* @param pResult The return value of WindowProc. Depends on the message;
* may be NULL.
*
* @return TRUE if message was handled; otherwise FALSE.
*
* @see CXTPCalendarViewEventSubjectEditor
* @see OnWndMsg().
*/
virtual BOOL OnWndMsg_Children(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult);
/**
* @brief
* This member function deletes a specified event from the calendar.
*
* @param pViewEvent View of the event to delete.
*
* @details
* Call member function if you want to delete an event basing
* on its View object.
*
* @return TRUE if event was deleted successfully; otherwise FALSE.
*/
virtual BOOL DoDeleteEvent(CXTPCalendarViewEvent* pViewEvent);
/**
* @brief
* This member function deletes selected events from the calendar.
*
* @param pViewEvent View of the last event to delete.
*
* @details
* Call member function if you want to delete all selected events.
*
* @return TRUE if events were deleted successfully; otherwise FALSE.
*/
virtual BOOL DoDeleteSelectedEvents(CXTPCalendarViewEvent* pViewEvent);
/**
* @brief
* Call this member function to get direct access to calendar options
* data.
*
* @details
* This member function wraps CXTPCalendarData::GetCalendarOptions()
* method. If you read or change returned structure members
* no additional checks are made and no notifications are sent.
* The preferred way is to use CXTPCalendarControl options methods
* like GetWorkWeekMask(), SetWorkWeekMask(), GetFirstDayOfWeek(),
* SetFirstDayOfWeek(), ... etc.
*
* @return A pointer to calendar options data class CXTPCalendarOptions.
*
* @see CXTPCalendarOptions
* @see CXTPCalendarData::GetCalendarOptions().
*/
CXTPCalendarOptions* GetCalendarOptions() const;
/**
* @brief
* This member function attempts to select an event through a passed event ID.
*
* @param dEventID : DWORD of event id.
* @param bSelect : BOOL - EnsureVisible && Select if bSelect = TRUE, EnsureVisible only if
* bSelect = FALSE.
*
* @return TRUE if successful.
*/
BOOL SelectEventById(DWORD dEventID, BOOL bSelect = TRUE);
/**
* @brief
* This member function is making attempt to select view event by passed Schedule ID and
* event ID
*
* @param nScheduleID Schedule ID - used in case with multiple links.
* @param dEventID DWORD of event id.
* @param bSelect BOOL - EnsureVisible && Select if bSelect = TRUE, EnsureVisible only if
* bSelect = FALSE.
*
* @return TRUE if successful.
*/
BOOL SelectViewEventByIdAndGroup(int nScheduleID, DWORD dEventID, BOOL bSelect = TRUE);
/**
* @brief
* This member function is used to adjust the object's layout depending
* on the provided bounding rectangle.
*
* @param nLeft rectange data.
* @param nTop rectange data.
* @param nRight rectange data.
* @param nBottom rectange data.
*/
virtual void SetBorders(int nLeft, int nTop, int nRight, int nBottom);
/**
* @brief
* This member function is used to adjust the object's layout depending
* on the provided bounding rectangle.
*/
virtual void UpdateBorders();
protected:
CRect m_Borders; /**< Store options to draw border lines;*/
DECLARE_MESSAGE_MAP()
//## Generated message map functions
//{{AFX_MSG(CXTPCalendarControl)
afx_msg void OnNcPaint();
afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp);
afx_msg void OnPaint();
afx_msg LRESULT OnPrintClient(WPARAM wParam, LPARAM /*lParam*/);
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnContextMenu(CWnd* pWnd, CPoint pos);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
afx_msg void OnMouseLeave();
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnCaptureChanged(CWnd* pWnd);
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
afx_msg void OnTimer(UINT_PTR uTimerID);
afx_msg void OnDestroy();
afx_msg UINT OnGetDlgCode();
afx_msg void OnSysColorChange();
afx_msg void OnTimeChange();
afx_msg LRESULT OnTimeZoneChanged(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnSwitchView(WPARAM nDate, LPARAM); // for compatibility with previous versions
afx_msg LRESULT OnUserAction(WPARAM dwParam1, LPARAM dwParam2);
afx_msg void OnSetFocus(CWnd* pOldWnd);
afx_msg void OnKillFocus(CWnd* pNewWnd);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
afx_msg void OnEnable(BOOL bEnable);
//}}AFX_MSG
CXTPNotifySink* m_pSink;
virtual void OnEvent_FromDataProvider(XTP_NOTIFY_CODE Event, WPARAM wParam, LPARAM lParam);
virtual void OnEvent_Reminders(XTP_NOTIFY_CODE Event, WPARAM wParam, LPARAM lParam);
virtual void OnFinalRelease();
virtual CScrollBar* GetScrollBarCtrl(int nBar) const;
virtual void PreSubclassWindow();
virtual void _InitCalendarView();
/**
* @brief
* This member function is called by the calendar control when a calendar
* option is changed.
*
* @details
* It is called from the set option methods like SetWorkWeekMask(),
* SetFirstDayOfWeek(), SetWorkDayStartTime(), SetWorkDayEndTime(),
* DayView_SetAutoResetBusyFlag(), ... etc.
* See CXTPCalendarOptions for details.
* Default implementation sends XTP_NC_CALENDAROPTIONSWASCHANGED
* notification.
*
* @param nOptionRelation Changed option relation (or kind).
* Value -1 specify global or common option.
* Value from XTPCalendarViewType enum specify
* which kind of view changed option is related.
*
* @details TRUE if events were deleted successfully; otherwise FALSE.
*
* @see CXTPCalendarOptions
* @see CXTPCalendarData::GetCalendarOptions()
* @see XTP_NC_CALENDAROPTIONSWASCHANGED
*/
virtual void OnOptionsChanged(int nOptionRelation);
protected:
virtual void AdviseToDataProvider();
virtual void _AdviseToReminders_StartMonitoring();
public:
/**
* @brief
* This member function is used to show a ToolTip rectangle.
*
* @param strText A text to be shown inside a tooltip rectangle.
* @param rcToolTip A rect for a tooltip window.
* @param pFont Font for to draw tooltip text.
* @param bAdvanced TRUE for advanced processing (Office2007 theme "add new appt").
*/
virtual void ShowToolTip(const CString& strText, const CRect rcToolTip, CFont* pFont,
BOOL bAdvanced = FALSE);
/**
* @brief
* This member function is used to hide the ToolTip rectangle.
*
* @see IsToolTipVisible
*/
virtual void HideToolTip();
/**
* @brief
* This member function is the ToolTip rectangle visible on the screen.
*
* @return TRUE if ToolTip rectangle visible, FALSE otherwise.
*
* @see HideToolTip
*/
virtual BOOL IsToolTipVisible() const;
/**
* @brief
* This member function returns TRUE if the ToolTips enabled,
* FALSE otherwise.
*
* @return TRUE if the ToolTips enabled, FALSE otherwise.
*
* @see EnableToolTips
*/
BOOL IsToolTipsEnabled() const;
/**
* @brief
* This member function is used to enable or disable ToolTips
* for the control.
*
* @param bEnable A BOOL. Specifies whether ToolTips should be
* enabled (TRUE) or disabled (FALSE).
*
* @see IsToolTipsEnabled
*/
void EnableToolTips(BOOL bEnable = TRUE);
/**
* @brief
* This member function returns TRUE if the Reminders functionality
* is enabled for this Calendar control and FALSE otherwise.
*
* @return TRUE if reminders are enabled, FALSE otherwise.
*
* @see EnableReminders()
*/
BOOL IsRemindersEnabled() const;
/**
* @brief
* This member function is used to enable or disable Reminders
* functionality for the control.
*
* @param bEnable A BOOL. Specifies whether Reminders functionality
* should be enabled (TRUE) or disabled (FALSE).
*
* @see IsRemindersEnabled
*/
void EnableReminders(BOOL bEnable = TRUE);
/**
* @brief
* This member function returns set of flags which define calendar items
* to send XTP_NC_CALENDAR_GETITEMTEXT notification.
* If Calendar theme is set - return value is got from the theme object,
* otherwise it is got from the paint manager object.
*
* @return Set of flags from enums XTPCalendarGetItemText, XTPCalendarGetItemTextEx.
*
* @see XTPCalendarGetItemText
* @see XTPCalendarGetItemTextEx
* @see CXTPCalendarPaintManager::GetAskItemTextFlags
* @see CXTPCalendarPaintManager::SetAskItemTextFlags
* @see CXTPCalendarTheme::GetAskItemTextFlags
* @see CXTPCalendarTheme::SetAskItemTextFlags
* @see XTP_NC_CALENDAR_GETITEMTEXT
*/
virtual DWORD GetAskItemTextFlags() const;
/**
* @brief
* This member function returns TRUE if Markup functionality
* is enabled for this Calendar control and FALSE otherwise.
* Enabled state automatically processes static Markup text for
* events, and enables processing of dynamic Markup text customization
* using XTP_NC_CALENDAR_GETITEMTEXT notification.
*
* @return TRUE if Markup feature is enabled, FALSE otherwise.
*
* @see CXTPCalendarViewEvent::GetMarkupText()
*/
BOOL IsMarkupEnabled() const;
/**
* @brief
* This member function is used to enable or disable Markup
* functionality for the control. Enabling this functionality allows
* a control to process customized special property xtpMarkupTemplate
* which could be set for each event. If this property exists and
* contains text with Markup information, it will be drawn inside the
* Event rectangle (instead of Subject and Body).
*
* @param bEnableMarkup Specifies whether Markup functionality
* should be enabled (TRUE) or disabled (FALSE).
*/
void EnableMarkup(BOOL bEnableMarkup = TRUE);
/**
* @brief
* Retrieves a pointer to the markup context.
*
* @return A pointer to a CXTPMarkupContext object.
*/
CXTPMarkupContext* GetMarkupContext() const;
/**
* @brief
* This member function Refresh Caption Bar after some layout modifications
*/
void RefreshCaptionBar();
private:
BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect,
CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
public:
/**
* @brief
* Class CUpdateContext updates context and redraws control parts
* depending on input parameters.
*
* @see XTPCalendarUpdateOptions
* @see AdjustLayout
* @see AdjustScrollBar
* @see RedrawControl
*/
class _XTP_EXT_CLASS CUpdateContext
{
public:
/**
* @brief
* Constructs a CUpdateContext object.
*
* @param pControl Pointer to the CXTPCalendarControl to adjust.
* @param nOptions A bitwise combination of the adjusting
* parameters.
*
* @details
* When constructing a CUpdateContext object, specify
* if the control's layout needs adjustment and/or
* redrawing.
*
* @see XTPCalendarUpdateOptions
*/
CUpdateContext(CXTPCalendarControl* pControl,
int nOptions = xtpCalendarUpdateLayout | xtpCalendarUpdateRedraw)
: m_pControl(pControl)
{
/**
* WARNING. (no error)
* There is no need to use xtpCalendarUpdateRedraw and xtpCalendarUpdateRedrawIfNeed
* together
*/
_ASSERTE(!((nOptions & xtpCalendarUpdateRedraw)
&& (nOptions & xtpCalendarUpdateRedrawIfNeed)));
m_nOptions = nOptions;
if (!m_pControl)
{
_ASSERTE(FALSE);
return;
}
if (m_nOptions & (xtpCalendarUpdateLayout | xtpCalendarUpdateScrollBar))
m_pControl->BeginAdjust(nOptions & xtpCalendarUpdateScrollBar);
if (m_nOptions & xtpCalendarUpdateRedraw)
m_pControl->BeginUpdate();
if (m_nOptions & xtpCalendarUpdateRedrawIfNeed)
m_pControl->LockUpdate();
}
/**
* @brief
* Destroys a CUpdateContext object and calls all the required
* Calendar Control adjusting and redrawing functions.
*
* @see XTPCalendarUpdateOptions
*/
~CUpdateContext()
{
if (!m_pControl)
{
return;
}
if (m_nOptions & (xtpCalendarUpdateLayout | xtpCalendarUpdateScrollBar))
m_pControl->EndAdjust(m_nOptions & xtpCalendarUpdateScrollBar);
if (m_nOptions & xtpCalendarUpdateRedraw)
m_pControl->EndUpdate();
if (m_nOptions & xtpCalendarUpdateRedrawIfNeed)
m_pControl->UnlockUpdate();
}
private:
CXTPCalendarControl* m_pControl;
int m_nOptions;
};
/**
* @brief
* Class CViewChangedContext used to avoid multiple sending of
* XTP_NC_CALENDARVIEWWASCHANGED notification for one action.
*/
class _XTP_EXT_CLASS CViewChangedContext
{
public:
/**
* @brief
* Constructs a CViewChangedContext object.
*
* @param pView Pointer to parent CXTPCalendarView object.
* @param eType Value from enum XTPCalendarViewChangedUpdateOptions.
*
* @see XTP_NC_CALENDARVIEWWASCHANGED
*/
CViewChangedContext(CXTPCalendarView* pView, int eType = xtpCalendarViewChangedSend);
/**
* @brief
* Constructs a CViewChangedContext object.
*
* @param pControl Pointer to parent CXTPCalendarControl object.
* @param eType Value from enum XTPCalendarViewChangedUpdateOptions.
*
* @see XTP_NC_CALENDARVIEWWASCHANGED
*/
CViewChangedContext(CXTPCalendarControl* pControl, int eType = xtpCalendarViewChangedSend);
/**
* @brief
* Destroys a CViewChangedContext object and send notification
* if this is last locker object.
*/
virtual ~CViewChangedContext();
private:
void Init(CXTPCalendarControl* pControl, int eType);
CXTPCalendarControl* m_pControl;
int m_eType;
};
friend class CUpdateContext;
friend class CViewChangedContext;
protected:
/**
* @brief
* Class CViewChanged_ContextData is used as locker context for
* CViewChangedContext.
*/
class CViewChanged_ContextData
{
public:
/**
* @brief
* Default object constructor.
*/
CViewChanged_ContextData();
int m_nLockCount; /**< View change notification lock counter.*/
BOOL m_bRequest; /**< View change send notification request.*/
};
CViewChanged_ContextData m_cntViewChanged; /**< Locker context for CViewChangedContext.*/
int m_nRowsPerWheel; /**< Amount of rows to scroll when using the mouse wheel.*/
CString m_strUndoUIText; /**< Text label for the Undo UI command.*/
CString m_strRedoUIText; /**< Text label for the Redo UI command.*/
BOOL m_bUpdateWhenEventChangedNotify; /**< Whether to update control when notification comes
about an event change.*/
CXTPCalendarRemindersManager* m_pRemindersManager; /**< Stores reminders manager object.*/
CXTPMarkupContext* m_pMarkupContext; /**< The markup context.*/
private:
BOOL m_bChanged;
int m_nLockUpdateCount;
int m_nLockAdjustCount;
BOOL m_bAdjustScrollBar;
CXTPCalendarView* m_pActiveView;
CXTPCalendarDayView* m_pDayView;
CXTPCalendarMonthView* m_pMonthView;
CXTPCalendarWeekView* m_pWeekView;
CXTPCalendarTimeLineView* m_pTimeLineView;
CXTPCalendarResourcesNf* m_pResourcesNf; /**< Resources array*/
CXTPCalendarTheme* m_pTheme;
CXTPCalendarPaintManager* m_pPaintManager;
CXTPNotifyConnection* m_pConnection;
CXTPCalendarOptions* m_pOptions; /**< This member stores user's calendar view options.*/
CBitmap m_bmpCache; /**< Current view cached picture*/
CXTPCalendarTip* m_pWndTip;
UINT m_uNextTimerID;
BOOL m_bEnableToolTips;
BOOL m_bEnableSendNotifications;
UINT m_uPopulateRequest_TimerID;
UINT m_uRedrawRequest_TimerID;
XTP_CONNECTION_ID m_cnidOnReminders;
COleDateTimeSpan m_spRemindersUpdatePeriod;
LCID m_lcidActiveLocale;
int m_nFirstWeekOfYearDays; /**< This member shows the first Week Of Year Days.*/
COleDateTime m_dtTodayOverride;
public:
/**
* @brief
* This member function is used to get the state of Read-only mode.
*
* @return TRUE if current mode is Read-only.
*/
BOOL IsReadonlyMode() const;
XTPCalendarMouseMode m_mouseMode; /**< Current mouse operation mode.*/
BOOL m_bDeleteOnFinalRelease; /**< If TRUE - Delete self OnFinalRelease() call.*/
BOOL m_bDisableRedraw; /**< If TRUE - control window is not redraw, it is draw last window
content (draw cached bitmap). FALSE by default.*/
BOOL m_bTimelineMode; /**< flag to separate timeline (if TRUE) and other calendar modes*/
XTPCalendarViewType m_eViewType; /**< current view type*/
int m_nTimelineScale; /**< current timeline scale type*/
int m_nCaptionHeight; /**< height param - can be used for custom layout adjustment*/
BOOL m_bPreventAutoAllDayMode; /**< Flag to prevent dragging event into AllDay zone*/
BOOL m_bMultiColorScheduleMode; /**< Flag to show Schedules titles in different colors*/
BOOL m_bMultiColumnWeekMode; /**< Flag to select Outlook2007 and Outlook2003 behavior*/
BOOL m_bHideCaptionBar; /**< Flag to Hide Caption Bar when TimeLine mode used*/
BOOL m_bReadOnlyMode; /**< View- and Print-only mode to use Calendar*/
BOOL m_bFullDateMode; /**< Useful for Multi-schedules case flag to use DayHeader special
format*/
BOOL m_bTooltipUnderMouse; /**< 2-way tooltip positioning - TRUE - under mouse cursor, FALSE -
on the top of mouse cursor*/
BOOL m_bShowLinks; /**< flag to show or hide 'virtual' view events*/
BOOL m_bHideLinkContainer; /**< flag to hide or show 'virtual' view events container column*/
BOOL m_bPromptToDeleteRecurrentEvent; /**< flag to use Ocurrence or Master case selector
(default = TRUE)*/
BOOL m_bDeleteOcurrenceEventIfNoPrompt; /**< True to delete Ocurrence event, False - delete
Master (default = TRUE)*/
CString m_OwnerUser; /**< string as current user name place holder*/
CString m_sCustomFormat4Tooltip; /**< Free-styled tooltip tag-based way to fill tooltip string
used tags
<BODY>,<LOC>,<SUBJ>,<TIME> in any
combination with fillers*/
CString m_sCustomTitle; /**< used for unique title - e.g. for PrintJob name*/
BOOL m_bForcePagination; /**< flag to Force Pagination during PrintPreview*/
BOOL m_bShowTooltipForNotFocused; /**< flag to Show Tooltip For Not Focused Control*/
BOOL m_bShowTooltipForAllDayEvents; /**< flag to Show Tooltip For All Day Events*/
BOOL m_bSwitchToDayViewIfPickedSingleDay; /**< flag to switch to DatView on DatePicker one day
selection (if TRUE) or keep previous view
(FALSE)*/
BOOL m_bMultipleSchedulesMode; /**< flag to use MutilpleSchedulesModel (one event - many view
events case)*/
BOOL m_bMultipleSchedulesNoSelfLinks; /**< flag to use MutilpleSchedulesModel (one event - many
view events case - allow to eliminate selflinks)*/
/** custom time intervals for reminder*/
CMap