/**
* @file XTPCalendarMonthView.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(_XTPCALENDARMONTHVIEW_H__)
# define _XTPCALENDARMONTHVIEW_H__
# if _MSC_VER > 1000
# pragma once
# endif // _MSC_VER > 1000
# include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h"
class CXTPCalendarMonthView;
/**
* @brief
* Define minimum count of weeks which can be shown in the
* Month View.
*
* @see CXTPCalendarMonthView::CMonthViewGrid::GetWeeksCount
* @see CXTPCalendarMonthView::CMonthViewGrid::SetWeeksCount
* @see XTP_CALENDAR_MONTHVIEW_SHOW_WEEKS_MAX
*/
# define XTP_CALENDAR_MONTHVIEW_SHOW_WEEKS_MIN 1
/**
* @brief
* Define maximum count of weeks which can be shown in the
* Month View.
*
* @see CXTPCalendarMonthView::CMonthViewGrid::GetWeeksCount
* @see CXTPCalendarMonthView::CMonthViewGrid::SetWeeksCount
* @see XTP_CALENDAR_MONTHVIEW_SHOW_WEEKS_MIN
*/
# define XTP_CALENDAR_MONTHVIEW_SHOW_WEEKS_MAX 64
/**
* @brief
* This class implements a specific view portion of the Calendar
* control - called Month view.
*
* @details
* The Month can contain one or more weeks, placed in
* a column. Each week consist of 7 days, as a normal week.
* Weekend days of the week can be drawn compressed, which means
* that 2 weekend days will be drawn in a rectangle of a usual day.
* Each day is represented by a CXTPCalendarMonthViewDay class.
*
* @see CXTPCalendarView
* @see CXTPCalendarDayView
* @see CXTPCalendarWeekView
* @see CXTPCalendarMonthViewDay
* @see CXTPCalendarMonthViewEvent
*/
class _XTP_EXT_CLASS CXTPCalendarMonthView : public CXTPCalendarViewT
{
friend class CXTPCalendarMonthViewDay;
friend class CXTPCalendarMonthViewEvent;
/** @cond */
DECLARE_DYNAMIC(CXTPCalendarMonthView)
/** @endcond */
public:
/**
* @details
* Base class type definition
*/
typedef CXTPCalendarViewT TBase;
/**
* @brief
* Default object constructor.
*
* @param pCalendarControl - Pointer to a CXTPCalendarControl object.
*
* @see ~CXTPCalendarMonthView()
*/
CXTPCalendarMonthView(CXTPCalendarControl* pCalendarControl);
/**
* @brief
* Default class destructor.
*
* @details
* Handles member item deallocation.
*/
virtual ~CXTPCalendarMonthView();
/**
* @brief
* This member function is used to populate the view with data
* for all items contained in the view.
*/
virtual void Populate();
/**
* @brief
* This member function is used to adjust the view's layout
* depending on the window's client size and then calls AdjustLayout()
* for all sub-items.
*
* @param pDC Pointer to a valid device context.
* @param rcView A CRect object that contains the
* coordinates used to draw the view.
* @param bCallPostAdjustLayout A BOOL. Flag used to call for additional
* adjustments.
*
* @details
* Call Populate() prior to AdjustLayout.
* AdjustLayout2 is called by calendar control instead of AdjustLayout
* when theme is set.
*/
virtual void AdjustLayout(CDC* pDC, const CRect& rcView, BOOL bCallPostAdjustLayout = TRUE);
/**
* @brief
* This member function is used to adjust the view's layout
* depending on the window's client size and then calls AdjustLayout()
* for all sub-items.
*
* @param pDC Pointer to a valid device context.
* @param rcView A CRect object that contains the
* coordinates used to draw the view.
* @param bCallPostAdjustLayout A BOOL. Flag used to call for additional
* adjustments.
*
* @details
* Call Populate() prior to AdjustLayout.
* AdjustLayout2 is called by calendar control instead of AdjustLayout
* when theme is set.
*/
virtual void AdjustLayout2(CDC* pDC, const CRect& rcView, BOOL bCallPostAdjustLayout = TRUE);
/**
* @brief
* This member function is used to show the specified day in the
* calendar view.
*
* @param date A COleDateTime object that contains the date to show.
* @param bSelect TRUE to select the specified day after showing,
* FALSE otherwise. TRUE is the default value.
*
* @details
* Call this member function to show only the specified day in the
* calendar view.
*/
virtual void ShowDay(const COleDateTime& date, BOOL bSelect = TRUE);
/**
* @brief
* This member function is used to retrieve information about the
* current scroll bar state.
*
* @param pSI A SCROLLINFO pointer. Pointer to a scrollbar information
* structure.
* @return TRUE if scroll bar information is obtained, FALSE otherwise.
*/
virtual BOOL GetScrollBarInfoV(SCROLLINFO* pSI) const;
/**
* @brief
* This member function is used to scroll the contents of a view.
*
* @param nPos An int that contains the position value.
* @param nPos_raw An int that contains the raw position value.
*
* @details
* ScrollV internally uses Populate() to fill new view data.
* Note: nPos is not used at this time. It is reserved for future use.
*
* @see Populate()
* @see GetScrollBarInfoV.
*/
virtual void ScrollV(int nPos, int nPos_raw);
/**
* @brief
* This member function is used to draw the view content using
* the specified device context.
*
* @param pDC Pointer to a valid device context.
*
* @details
* Call AdjustLayout() before Draw().
* Draw2 is called by calendar control instead of Draw when theme
* is set.
*
* @see AdjustLayout().
*/
virtual void Draw(CDC* pDC);
/**
* @brief
* This member function is used to draw the view content using
* the specified device context.
*
* @param pDC Pointer to a valid device context.
*
* @details
* Call AdjustLayout() before Draw().
* Draw2 is called by calendar control instead of Draw when theme
* is set.
*
* @see AdjustLayout().
*/
virtual void Draw2(CDC* pDC);
/**
* @brief
* This member function is used to obtain the event caption format flags.
*
* @details
* Call this member function to obtain event caption format flags.
* Event caption format flags are stored in a packed form. Use bitwise
* operations to determine each flag state.
*
* @return Integer value containing flags.
*/
virtual int GetEventCaptionFormat() const;
/**
* @brief
* This member function is used to obtain the width necessary to display
* the event's time.
*
* @return An int that contains the width as an integer value.
*/
virtual int GetEventTimeWidth() const;
/**
* @brief
* This member function is used to processes mouse movement events.
*
* @param nFlags A UINT that is used to indicate whether various virtual
* keys are down.
* @param point A CPoint that specifies the x- and y- coordinates of the cursor.
* These coordinates are always relative to the
* upper-left corner of the window.
*
* @details
* This method is called by the CalendarControl when the user
* moves the mouse cursor or stylus.
*/
virtual void OnMouseMove(UINT nFlags, CPoint point);
/**
* @brief
* This member function is used to process left mouse button events.
*
* @param nFlags A UINT that is used to indicates whether various virtual
* keys are down.
* @param point A CPoint that specifies the x- and y- coordinates of the cursor.
* These coordinates are always relative to the
* upper-left corner of the window.
*
* @return TRUE if the message is handled properly, FALSE otherwise.
*
* @details
* This method is called by the CalendarControl when the user
* presses the left mouse button.
*/
virtual BOOL OnLButtonDown(UINT nFlags, CPoint point);
/**
* @brief
* This member function is used to process keyboard events.
*
* @param nChar A UINT. Virtual key code of the given key.
* @param nRepCnt A UINT. Number of times the keystroke is repeated as
* a result of the user holding down the key.
* @param nFlags A UINT. Scan code, key-transition code, previous key state,
* and context code.
*
* @details
* This method is called by the CalendarControl when the user
* presses keys on the keyboard.
*/
virtual void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
/**
* @brief
* This member function is used to obtain the view's day object by
* the given index.
*
* @param nIndex An int. Day view index in the view collection.
*
* @details
* Index numbers start with 0 and cannot be negative.
*
* @return Pointer to a CXTPCalendarMonthViewDay object.
*
* @see GetViewDayCount()
*/
virtual CXTPCalendarViewDay* GetViewDay_(int nIndex) const;
/**
* @brief
* Call this member function to obtain the date of a day view by the
* day's index.
*
* @param nIndex An int. Day view index in the view collection.
*
* @details
* Index numbers start with 0 and cannot be negative.
*
* @return A COleDateTime object that contains the day view date and time.
*
* @see GetViewDayCount()
*/
virtual COleDateTime GetViewDayDate(int nIndex) const;
/**
* @brief
* This member function is used to obtain week day header text.
*
* @param pstrText [in, out] Pointer to item text.
* @param nWeekDay Week day number as: 1 - Sunday, 2 - Monday, ... 7 - Satyrday.
*
* @details
* If AskItemTextFlags has the xtpCalendarItemText_MonthViewWeekDayHeader
* flag set, an XTP_NC_CALENDAR_GETITEMTEXT notification is sent to
* customize standard text.
*
* @see XTPCalendarGetItemText,XTPCalendarGetItemTextEx
* @see XTP_NC_CALENDAR_GETITEMTEXT
* @see CXTPCalendarControl::GetAskItemTextFlags
* @see CXTPCalendarPaintManager::GetAskItemTextFlags
* @see CXTPCalendarPaintManager::SetAskItemTextFlags
* @see CXTPCalendarTheme::GetAskItemTextFlags
* @see CXTPCalendarTheme::SetAskItemTextFlags
*/
virtual void GetWeekDayTextIfNeed(CString* pstrText, int nWeekDay);
/**
* @brief
* This member function is used to obtain the format string of a
* day date.
*
* @param dtDay A COleDateTime object that contains the date to be formatted.
* @param bLong A BOOL. Determines whether to apply a long date format.
*
* @details
* Call this member function to obtain the date in a form appropriate
* to display in the day header text.
*
* @return CString object with the formatted date.
*
* @see GetViewDayCount()
*/
CString _FormatDayDate(COleDateTime dtDay, BOOL bLong);
protected:
/**
* @brief
* This member function is used to calculate the view's date
* format based on the current locale.
*
* @param pDC Pointer to a valid device context.
*/
void _CalculateDateFormats(CDC* pDC);
/**
* @brief
* This member function is used to build day header date format
* default strings.
*
* @details
* This member function read locale settings and fill
* m_strDayHeaderFormatDefaultXXX members.
*
* @see _CalculateDateFormats()
* @see CXTPCalendarView::_ReadDefaultHeaderFormats(),
* @see m_strDayHeaderFormatDefaultLong
* @see m_strDayHeaderFormatDefaultMiddle
* @see m_strDayHeaderFormatDefaultShort
* @see m_strDayHeaderFormatDefaultShortest.
*/
void _ReadDefaultDateFormats();
/**
* @brief
* This member function is used to parse the format string into tokens.
*
* @param strDateFormat A CString that contains the string to parse.
* @param rarTokens A CStringArray that contains the resultant token array.
*/
void _SplitDateFormat(const CString& strDateFormat, CStringArray& rarTokens);
/**
* @brief
* This member function is used to calculate the event view's date
* format based on the current locale.
*
* @param pDC Pointer to a valid device context.
*/
void _CalculateEventCaptionFormat(CDC* pDC);
CString m_strLongDateFormat; /**< String of the long date format.*/
CString m_strSmallDateFormat; /**< String of the short date format.*/
int m_nEventCaptionFormat; /**< Event caption format flags are stored in packed form by bitwise
operations.*/
int m_nEventTimeWidth; /**< width of the area to display the event times.*/
XTP_CALENDAR_MONTHVIEW_DAYPOS m_DayPOS_LastSelected; /**< Last selected day positions.*/
COleDateTime m_dtLightColorDateBase; /**< Month from this date will be painted with light color
in month view.*/
public:
void SetMDayViewLightColorBaseDate(const COleDateTime& dtBase);
const COleDateTime& GetMDayViewLightColorBaseDate() const;
/**
* @brief
* Sets the format for Cell's Day Header in Month View.
*
* @param pcszCustomFormat : format string
*/
void SetLongDayHeaderFormat(LPCTSTR pcszCustomFormat);
/**
* @brief
* Sets the format for Cell's Day Header in Month View.
*
* @param pcszCustomFormat : format string
*/
void SetSmallDayHeaderFormat(LPCTSTR pcszCustomFormat);
BOOL m_bDraftMode; /**< print mode flag for B/W prinitng without Headers and Footers*/
/**
* @details
* This helper class implements a grid for the month view.
*
* @see CXTPCalendarMonthView overview
*/
class _XTP_EXT_CLASS CMonthViewGrid
{
public:
/**
* @brief
* Default class constructor.
*
* @param pView A CXTPCalendarMonthView pointer to the parent view class.
*/
CMonthViewGrid(CXTPCalendarMonthView* pView);
/**
* @brief
* Default class destructor.
*
* @details
* Handles member item deallocation.
*/
virtual ~CMonthViewGrid();
/**
* @brief
* This member function is used to obtain the date of the first
* cell (cell [0, 0]) in the grid.
*
* @return A COleDateTime object that contains the date of the first cell
* (cell [0, 0]) in the grid.
*
* @see SetBeginDate
* @see ShiftDateToCell_00
*/
COleDateTime GetBeginDate() const;
/**
* @brief
* This member function is used to set the start view date.
*
* @param dtBeginDate A COleDateTime object that contains the start view date.
*
* @details
* This date will be adjusted (shifted) to be the first cell
* (cell [0, 0]) date in the grid.
*
* @see GetBeginDate
* @see ShiftDateToCell_00
*/
void SetBeginDate(COleDateTime dtBeginDate);
/**
* @brief
* This member function is used to shift the specified date to
* the first cell date in the grid.
*
* @param dtDate A COleDateTime object that contains the date to shift.
*
* @return A COleDateTime object that contains the date that was shifted
* to the first cell in the grid.
*
* @see GetBeginDate
* @see SetBeginDate
*/
COleDateTime ShiftDateToCell_00(COleDateTime dtDate) const;
/**
* @brief
* This member function is used to obtain the weeks (rows) count
* in the grid.
*
* @return An int that contains the number of weeks (rows) in the grid.
*
* @see SetWeeksCount
*/
int GetWeeksCount() const;
/**
* @brief
* This member function is used to set the number of weeks that are
* shown in the grid (Month View).
*
* @param nWeeks An int that contains the number of weeks shown in the
* grid. Minimum and maximum values are defined as
* XTP_CALENDAR_MONTHVIEW_SHOW_WEEKS_MIN and
* XTP_CALENDAR_MONTHVIEW_SHOW_WEEKS_MAX.
*
* @see GetWeeksCount
* @see XTP_CALENDAR_MONTHVIEW_SHOW_WEEKS_MIN
* @see XTP_CALENDAR_MONTHVIEW_SHOW_WEEKS_MAX
*/
void SetWeeksCount(int nWeeks);
/**
* @brief
* This member function is used to retrieve the specified day date.
*
* @param nWeekIndex An int that contains the index of the week.
* Valid values are from 0 to GetWeeksCount()-1.
* @param nWeekDayIndex An int that contains the index of the day cell
* in the week. Valid values are from 0 to 6.
*
* @return A COleDateTime object that contains the specified day date.
*
* @see GetWeeksCount
* @see SetWeeksCount
*/
COleDateTime GetDayDate(int nWeekIndex, int nWeekDayIndex) const;
/**
* @brief
* This member function is used to obtain the bounding rectangle
* of the day cell.
*
* @param nWeekIndex An int that contains the index of the week.
* Valid values are from 0 to GetWeeksCount()-1.
* @param nWeekDayIndex An int that contains the index of the day cell
* in the week. Valid values are from 0 to 6.
* @param bIncludeBorders A BOOL. If TRUE, then borders between days are
* included in the bounding rectangle coordinates.
* If FALSE, then borders are not included in the
* bounding rectangle coordinates.
*
* @return A CRect object that contains the bounding rectangle coordinates
* of the day cell.
*
* @see GetCelRect
* @see GetWeeksCount
* @see CRect
*/
CRect GetDayRect(int nWeekIndex, int nWeekDayIndex, BOOL bIncludeBorders = FALSE) const;
/**
* @brief
* This member function is used to obtain the bounding rectangle
* of the full grid cell.
*
* @param nWeekIndex An int that contains the index of the week.
* Valid values are from 0 to GetWeeksCount()-1.
* @param nColIndex An int that contains the index of the cell in the grid.
* Valid values are from 0 to GetColsCount()-1.
* @param bIncludeBorders A BOOL. If TRUE, then borders between cells
* are included in the bounding rectangle coordinates.
* If FALSE, then the borders between cells are not
* included in the bounding rectangle coordinates.
*
* @details
* Full grid cell means either a day cell for no compressed days or a
* cell which includes 2 day cells for compressed Sat/Sun if the
* "compress weekend days" option is ON.
*
* @return A CRect object that contains the bounding rectangle coordinates
* of the full grid cell.
*
* @see GetDayRect
* @see GetWeeksCount
* @see GetColsCount
* @see CRect
*/
CRect GetCelRect(int nWeekIndex, int nColIndex, BOOL bIncludeBorders = FALSE) const;
/**
* @brief
* This member function is used to obtain the column for the
* specified week day.
*
* @param nWeekDayIndex An int that contains the index of the week day.
* 1-Sunday, 2-Monday, ....
*
* @details
* If the "compress weekend days" option is ON then, only one
* column number is returned for Saturday and Sunday.
*
* @return An int that contains the column number for the specified week day.
*
* @see GetColsCount
* @see GetWeekDayForColIndex
*/
int GetWeekDayCol(int nWeekDayIndex) const;
/**
* @brief
* This member function is used to obtain the week day index for the
* specified column.
*
* @param nColIdx An int that contains the index of the week day.
* 1-Sunday, 2-Monday, ....
*
* @details
* If the "compress weekend days" option is ON then,
* 7 (Saturday) returned for the compressed column.
*
* @return Index of the week day as: 1-Sunday, 2-Monday, ....
*
* @see GetColsCount
* @see GetWeekDayCol
*/
int GetWeekDayForColIndex(int nColIdx) const;
/**
* @brief
* This member function is used to obtain the number of columns
* that are displayed in the Month View.
*
* @details
* If the "compress weekend days" option is ON, then 6 is returned,
* otherwise 7.
*
* @return An int that contains the number of columns that are displayed
* in the Month View.
*
* @see GetWeekDayCol
*/
int GetColsCount() const;
/**
* @brief
* This member function is used to obtain the number of pixels in
* the height of the Month View week days columns header.
*
* @return An int that contains the value of the columns header height in pixels.
*/
int GetColHeaderHeight() const;
/**
* @brief
* This member function is used to set the height of the Month View
* week days columns header.
*
* @param nHeight A new height value in pixels.
*
* @details
* Should be used in visual themes AdjustLayout processing.
*/
void SetColHeaderHeight(int nHeight);
/**
* @brief
* This member function is used to scroll the contents of a grid.
*
* @param nPos An int that contains the position value.
*
* @details
* This member function calculates the date time that corresponds
* with the current scroll bar position. Next, the function adjusts
* the dates in the grid so that the date that is associated with the
* current scroll bar position is placed in the beginning cell of the
* grid.
*
* @see GetScrollPos
* @see CXTPCalendarMonthView::ScrollV
* @see CXTPCalendarMonthView::GetScrollBarInfoV
*/
void ScrollV(int nPos);
/**
* @brief
* This member function is used to obtain the current scrolling
* position.
*
* @return An int that contains the current scrolling position.
*
* @see ScrollV
* @see CXTPCalendarMonthView::ScrollV
* @see CXTPCalendarMonthView::GetScrollBarInfoV
*/
int GetScrollPos() const;
/**
* @brief
* This member function is used to adjust the grid's layout
* depending on the window's client size and then
* calls AdjustLayout() for all sub-items.
*
* @param pDC Pointer to a valid device context.
*
* @see CXTPCalendarMonthView::AdjustLayout
*/
void AdjustLayout(CDC* pDC);
/**
* @brief
* This member function is used to draw the grid content using the
* specified device context.
*
* @param pDC Pointer to a valid device context.
*
* @details
* Call CXTPCalendarMonthView::AdjustLayout before Draw().
*
* @see CXTPCalendarMonthView::Draw
* @see CXTPCalendarMonthView::AdjustLayout
*/
void Draw(CDC* pDC);
/**
* @brief
* This member function is used to adjust the grid's columns
* depending on the FirstDayOfWeek calendar control option value.
*
* @see CXTPCalendarControl::GetFirstDayOfWeek
*/
void AdjustFirstDayOfWeek();
/**
* @brief
* This member function is used to adjust the grid's columns and rows.
*
* @param rcRect A rectangle for grid.
*
* @see AdjustDays
*/
void AdjustGrid(const CRect& rcRect);
/**
* @brief
* This member function is used to call AdjustLayout for each day in
* the days collection with corresponding day rect.
*
* @param pDC Pointer to a valid device context.
*
* @see AdjustEvents
*/
void AdjustDays(CDC* pDC);
/**
* @brief
* This member function is used to adjust the event views layout.
*
* @param pDC Pointer to a valid device context.
*
* @see AdjustLayout
* @see CXTPCalendarMonthView::AdjustLayout
*/
void AdjustEvents(CDC* pDC);
/**
* @brief
* This function is used to obtain the view day object that is
* associated with the given indexes.
*
* @param nWeekIndex An int that contains the index of the week.
* Valid values are from 0 to GetWeeksCount()-1.
* @param nWeekDayIndex An int that contains the index of the day cell
* in the week.
*
* @return A pointer to a CXTPCalendarMonthViewDay object that contains the
* view day that is associated with the given indexes.
*
* @see CXTPCalendarMonthView::GetViewDay
*/
CXTPCalendarMonthViewDay* GetViewDay(int nWeekIndex, int nWeekDayIndex) const;
/**
* @brief
* This member function is used to obtain the maximum number of
* available day positions.
*
* @return A XTP_CALENDAR_MONTHVIEW_DAYPOS object that contains the
* maximum number of available day positions.
*
* @see XTP_CALENDAR_MONTHVIEW_DAYPOS
* @see XTP_CALENDAR_HITTESTINFO
* @see CXTPCalendarMonthView::m_DayPOS_LastSelected
*/
XTP_CALENDAR_MONTHVIEW_DAYPOS GetMaxDayPOS() const;
/**
* @brief
* This member function is used to obtain the First Day Of Week index.
*
* @return An int that contains the First Day Of Week index. (1-Sunday, 2-Monday ...)
*
* @see GetWeekDayCol
*/
int GetFirstDayOfWeek() const;
protected:
COleDateTime m_dtBeginDate; /**< First Cell (cell [0, 0]) date in the grid.*/
int m_nWeeksCount; /**< The number of weeks that are displayed.*/
int m_nColHeaderHeight; /**< Column header height in pixels.*/
CStringArray m_arColHeaderText; /**< Array of columns (week days) headers names.*/
CUIntArray m_arColsLeftX; /**< Array of columns left borders positions.*/
CUIntArray m_arRowsTopY; /**< Array of rows top borders positions.*/
int m_nFirstDayOfWeekIndex; /**< First Day Of Week index: 1-Sunday, 2-Monday ...*/
/**
* @brief
* This member function is used to adjust the grid's column header layout.
*
* @param pDC Pointer to a valid device context.
*
* @see AdjustLayout
* @see CXTPCalendarMonthView::AdjustLayout
*/
void AdjustHeader(CDC* pDC);
/**
* @brief
* This member function is used to calculate the date for a
* middle scrollbar position.
*
* @return A COleDateTime object that contains the date for a middle
* scrollbar position.
*
* @see ScrollV
* @see GetScrollPos
* @see CXTPCalendarMonthView::ScrollV
* @see CXTPCalendarMonthView::GetScrollBarInfoV
*/
COleDateTime GetMiddleScrollBeginDate() const;
protected:
CXTPCalendarMonthView* m_pView; /**< Pointer to the parent view class.*/
};
friend class CMonthViewGrid;
/**
* @brief
* This member function is used to obtain the Month View days
* grid object.
*
* @return A pointer to a CMonthViewGrid object that contains the Month
* View days grid object.
*
* @see CMonthViewGrid
*/
CMonthViewGrid* GetGrid() const;
protected:
CMonthViewGrid* m_pGrid; /**< Pointer to the grid object.*/
# ifdef _XTP_ACTIVEX
DECLARE_DISPATCH_MAP()
DECLARE_INTERFACE_MAP()
DECLARE_OLETYPELIB_EX(CXTPCalendarMonthView);
long OleGetWeeksCount();
void OleSetWeeksCount(long);
BOOL OleGetDraftMode();
void OleSetDraftMode(BOOL bSet);
# endif
};
//===========================================================================
// XTP_CALENDAR_MONTHVIEW_DAYPOS
//-----------------------------
AFX_INLINE int XTP_CALENDAR_MONTHVIEW_DAYPOS::GetPOS() const
{
int nPOS = nWeekIndex * 7 + nWeekDayIndex;
return nPOS;
}
AFX_INLINE void XTP_CALENDAR_MONTHVIEW_DAYPOS::SetPOS(int nWidx, int nWDidx)
{
nWeekIndex = nWidx;
nWeekDayIndex = nWDidx;
}
AFX_INLINE void XTP_CALENDAR_MONTHVIEW_DAYPOS::SetPOS(int nPOS)
{
nWeekIndex = nPOS / 7;
nWeekDayIndex = nPOS % 7;
}
AFX_INLINE BOOL XTP_CALENDAR_MONTHVIEW_DAYPOS::IsValid() const
{
BOOL bValid = (nWeekIndex >= 0 || nWeekDayIndex >= 0);
return bValid;
}
AFX_INLINE XTP_CALENDAR_MONTHVIEW_DAYPOS::operator int() const
{
_ASSERTE(IsValid());
return GetPOS();
}
AFX_INLINE const XTP_CALENDAR_MONTHVIEW_DAYPOS& XTP_CALENDAR_MONTHVIEW_DAYPOS::operator=(int nPOS)
{
SetPOS(nPOS);
return *this;
}
AFX_INLINE XTP_CALENDAR_MONTHVIEW_DAYPOS& XTP_CALENDAR_MONTHVIEW_DAYPOS::operator++()
{
_ASSERTE(IsValid());
SetPOS(GetPOS() + 1);
return *this;
}
AFX_INLINE XTP_CALENDAR_MONTHVIEW_DAYPOS XTP_CALENDAR_MONTHVIEW_DAYPOS::operator++(int)
{
_ASSERTE(IsValid());
XTP_CALENDAR_MONTHVIEW_DAYPOS retPOS = *this;
SetPOS(GetPOS() + 1);
return retPOS;
}
//===========================================================================
AFX_INLINE void CXTPCalendarMonthView::SetMDayViewLightColorBaseDate(const COleDateTime& dtBase)
{
m_dtLightColorDateBase = dtBase;
}
AFX_INLINE const COleDateTime& CXTPCalendarMonthView::GetMDayViewLightColorBaseDate() const
{
return m_dtLightColorDateBase;
}
//===========================================================================
AFX_INLINE int CXTPCalendarMonthView::CMonthViewGrid::GetWeeksCount() const
{
return m_nWeeksCount;
}
AFX_INLINE COleDateTime CXTPCalendarMonthView::CMonthViewGrid::GetBeginDate() const
{
return m_dtBeginDate;
}
AFX_INLINE XTP_CALENDAR_MONTHVIEW_DAYPOS CXTPCalendarMonthView::CMonthViewGrid::GetMaxDayPOS() const
{
XTP_CALENDAR_MONTHVIEW_DAYPOS maxPOS;
maxPOS.SetPOS((int)(GetWeeksCount() * 7 - 1));
return maxPOS;
}
AFX_INLINE CXTPCalendarMonthView::CMonthViewGrid* CXTPCalendarMonthView::GetGrid() const
{
return m_pGrid;
}
AFX_INLINE int CXTPCalendarMonthView::CMonthViewGrid::GetFirstDayOfWeek() const
{
return m_nFirstDayOfWeekIndex;
}
AFX_INLINE int CXTPCalendarMonthView::GetEventCaptionFormat() const
{
return m_nEventCaptionFormat;
}
AFX_INLINE int CXTPCalendarMonthView::GetEventTimeWidth() const
{
return m_nEventTimeWidth;
}
AFX_INLINE void CXTPCalendarMonthView::SetLongDayHeaderFormat(LPCTSTR pcszCustomFormat)
{
m_strLongDateFormat = pcszCustomFormat;
}
AFX_INLINE void CXTPCalendarMonthView::SetSmallDayHeaderFormat(LPCTSTR pcszCustomFormat)
{
m_strSmallDateFormat = pcszCustomFormat;
}
# include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h"
#endif // !defined(_XTPCALENDARMONTHVIEW_H__)