XTPCalendarThemeOffice2007.h
上传用户:szled88
上传日期:2015-04-09
资源大小:43957k
文件大小:32k
源码类别:

对话框与窗口

开发平台:

Visual C++

  1. // XTPCalendarThemeOffice2007.h: interface for the CXTPCalendarControlPaintManager class.
  2. //
  3. // This file is a part of the XTREME CALENDAR MFC class library.
  4. // (c)1998-2008 Codejock Software, All Rights Reserved.
  5. //
  6. // THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE
  7. // RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN
  8. // CONSENT OF CODEJOCK SOFTWARE.
  9. //
  10. // THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED
  11. // IN THE XTREME TOOLKIT PRO LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO
  12. // YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A
  13. // SINGLE COMPUTER.
  14. //
  15. // CONTACT INFORMATION:
  16. // support@codejock.com
  17. // http://www.codejock.com
  18. //
  19. /////////////////////////////////////////////////////////////////////////////
  20. //{{AFX_CODEJOCK_PRIVATE
  21. #if !defined(_XTP_CALENDAR_THEME_OFFICE_2007_H__)
  22. #define _XTP_CALENDAR_THEME_OFFICE_2007_H__
  23. //}}AFX_CODEJOCK_PRIVATE
  24. #if _MSC_VER > 1000
  25. #pragma once
  26. #endif // _MSC_VER > 1000
  27. #include "XTPCalendarTheme.h"
  28. #if (_MSC_VER > 1100)
  29. #pragma warning(push)
  30. #endif
  31. #pragma warning(disable: 4250)
  32. //#pragma warning(disable: 4097)
  33. #pragma warning(disable : 4100)// TODO: remove when themes will be finished
  34. class CXTPOffice2007Images;
  35. class CXTPImageManager;
  36. /////////////////////////////////////////////////////////////////////////////
  37. // Initial version. Will be expanded in the feature.
  38. //{{AFX_CODEJOCK_PRIVATE
  39. class _XTP_EXT_CLASS CXTPCalendarThemeOffice2007 : public CXTPCalendarTheme
  40. {
  41. //{{ AFX_CODEJOCK_PRIVATE
  42. DECLARE_DYNCREATE(CXTPCalendarThemeOffice2007)
  43. //}} AFX_CODEJOCK_PRIVATE
  44. typedef CXTPCalendarTheme TBase;
  45. public:
  46. DECLARE_THEMEPART(CTOHeader, CXTPCalendarTheme::CTOHeader)
  47. DECLARE_THEMEPART_MEMBER(0, CTOFormula_MulDivC, HeightFormula)
  48. //===========================================
  49. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  50. virtual void Draw(CCmdTarget* pObject, CDC* pDC) {ASSERT(FALSE);};
  51. protected:
  52. };
  53. friend class CTOHeader;
  54. //=======================================================================
  55. DECLARE_THEMEPART(CTOEvent, CXTPCalendarTheme::CTOEvent)
  56. struct CEventFontsColorsSet
  57. {
  58. CXTPPaintManagerColor           clrBorder;
  59. CXTPPaintManagerColorGradient   grclrBackground;
  60. CThemeFontColorSetValue         fcsetSubject;
  61. CThemeFontColorSetValue         fcsetLocation;
  62. CThemeFontColorSetValue         fcsetBody;
  63. CThemeFontColorSetValue         fcsetStartEnd; // for a month view single day event times
  64.                                                // or DayView multiday event From/To
  65. virtual void CopySettings(const CEventFontsColorsSet& rSrc);
  66. virtual void doPX(CXTPPropExchange* pPX, LPCTSTR pcszPropName, CXTPCalendarTheme* pTheme);
  67. virtual void Serialize(CArchive& ar);
  68. };
  69. CEventFontsColorsSet    m_fcsetNormal;
  70. CEventFontsColorsSet    m_fcsetSelected;
  71. CXTPPaintManagerColor   m_clrGripperBorder;
  72. CXTPPaintManagerColor   m_clrGripperBackground;
  73. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  74. virtual void RefreshFromParent(CTOEvent* pParentSrc);
  75. virtual void DoPropExchange(CXTPPropExchange* pPX);
  76. virtual void Serialize(CArchive& ar);
  77. virtual int CalcMinEventHeight(CDC* pDC);
  78. virtual void GetEventColors(CDC* pDC, CXTPCalendarViewEvent* pViewEvent, COLORREF& rClrBorder,
  79. COLORREF& rClrBorderNotSel, CXTPPaintManagerColorGradient& rGrclrBk,
  80. BOOL bSelected = -1, int* pnColorsSrc_1Cat2Lbl = NULL);
  81. virtual void FillEventBackgroundEx(CDC* pDC, CXTPCalendarViewEvent* pViewEvent, const CRect& rcRect);
  82. protected:
  83. virtual BOOL Draw_ArrowL(CXTPCalendarViewEvent* pViewEvent, CDC* pDC, CRect& rrcRect);
  84. virtual BOOL Draw_ArrowR(CXTPCalendarViewEvent* pViewEvent, CDC* pDC, CRect& rrcRect);
  85. virtual CSize Draw_Icons(CXTPCalendarViewEvent* pViewEvent, CDC* pDC, const CRect& rcIconsMax, BOOL bCalculate = FALSE);
  86. };
  87. friend class CTOEvent;
  88. DECLARE_THEMEPART(CTODay, CXTPCalendarTheme::CTODay)
  89. virtual int HitTestExpandDayButton(CXTPCalendarViewDay* pViewDay, const CPoint* pPoint = NULL); // return 0 or xtpCalendarHitTestDayExpandButton
  90. };
  91. DECLARE_THEMEPART(CTOPrevNextEventButton, CXTPCalendarThemePart)
  92. CXTPCalendarThemeIntValue   m_nBitmapID;
  93. CXTPCalendarThemeRectValue  m_rcBitmapBorder;
  94. CThemeFontColorSetValue     m_fcsetText;
  95. CXTPPaintManagerColor       m_clrDisabledText;
  96. CXTPCalendarThemeStringValue m_strText;
  97. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  98. virtual void DoPropExchange(CXTPPropExchange* pPX){};
  99. virtual void Serialize(CArchive& ar){};
  100. virtual void AdjustLayout(CXTPCalendarView* pObject, CDC* pDC, const CRect& rcRect);
  101. virtual void Draw(CXTPCalendarView* pObject, CDC* pDC);
  102. virtual int HitTest(const CPoint* pPoint = NULL); // return 0, xtpCalendarHitTestPrevEventButton or xtpCalendarHitTestNextEventButton
  103. virtual void OnMouseMove(CCmdTarget* pObject, UINT nFlags, CPoint point);
  104. virtual BOOL OnLButtonDown(CCmdTarget* pObject, UINT nFlags, CPoint point);
  105. virtual CRect GetRect();
  106. //------------------------------
  107. CTOPrevNextEventButton()
  108. {
  109. m_bPrev = TRUE;
  110. m_rcRect.SetRect(0,0,0,0);
  111. m_bHot = FALSE;
  112. m_bDisabled = FALSE;
  113. m_bVisible = TRUE;
  114. }
  115. protected:
  116. CSize GetSize(const CRect* prcRect = NULL);
  117. BOOL m_bPrev;
  118. CRect m_rcRect;
  119. public:
  120. BOOL m_bHot;
  121. BOOL m_bDisabled;
  122. BOOL m_bVisible;
  123. };
  124. friend class CTOPrevNextEventButton;
  125. DECLARE_THEMEPART(CTOPrevNextEventController, CXTPCalendarThemePart)
  126. DECLARE_THEMEPART_MEMBER_(0, CTOPrevNextEventButton, PrevEventButton, CXTPCalendarThemePart)
  127. DECLARE_THEMEPART_MEMBER_(1, CTOPrevNextEventButton, NextEventButton, CXTPCalendarThemePart)
  128. virtual void AdjustLayout(CXTPCalendarView* pObject, CDC* pDC, const CRect& rcRect);
  129. virtual void Draw(CXTPCalendarView* pObject, CDC* pDC);
  130. virtual int HitTest(const CPoint* pPoint = NULL); // return 0, xtpCalendarHitTestPrevEventButton or xtpCalendarHitTestNextEventButton
  131. CTOPrevNextEventController()
  132. {
  133. m_nRefreshTimerID = 0;
  134. m_nRefreshDaysPerIdleStep = 2;
  135. m_nIdleStepTime_ms = 120;
  136. m_ndtRefreshDatePrev = 0;
  137. m_ndtRefreshDateNext = 0;
  138. m_bScanPrev = FALSE;
  139. m_bScanNext = FALSE;
  140. m_ndtMinScanDay = (long)COleDateTime::GetCurrentTime();
  141. m_ndtMaxScanDay = m_ndtMinScanDay + 365 * 1;
  142. m_ndtMinScanDay -= 365 * 1;
  143. }
  144. virtual ~CTOPrevNextEventController() {
  145. ASSERT(m_nRefreshTimerID == 0);
  146. }
  147. virtual BOOL IsPrevNextButtonsVisible();
  148. virtual BOOL _IsSomeEventVisible();
  149. COleDateTime GetVisibleDay(BOOL bFirst);
  150. virtual BOOL GetPrevEventDay(COleDateTime* pdtDay = NULL);
  151. virtual BOOL GetNextEventDay(COleDateTime* pdtDay = NULL);
  152. virtual void OnStatusChanged();
  153. virtual void OnMouseMove(CCmdTarget* pObject, UINT nFlags, CPoint point);
  154. virtual BOOL OnLButtonDown(CCmdTarget* pObject, UINT nFlags, CPoint point);
  155. protected:
  156. void _RequestToFindEvents();
  157. void _StopRequests();
  158. BOOL _RefreshDay(long ndtDay);
  159. //void _ResetData();
  160. virtual BOOL OnTimer(UINT_PTR uTimerID);
  161. virtual void OnDetachCalendar();
  162. UINT_PTR     m_nRefreshTimerID;
  163. int          m_nRefreshDaysPerIdleStep;
  164. int          m_nIdleStepTime_ms;
  165. long m_ndtRefreshDatePrev;
  166. long m_ndtRefreshDateNext;
  167. BOOL m_bScanPrev;
  168. BOOL m_bScanNext;
  169. long m_ndtMinScanDay;
  170. long m_ndtMaxScanDay;
  171. CRect m_rcRect;
  172. class CDaysArray : public CXTPArrayT<long, long>
  173. {
  174. public:
  175. int AddDay(long nDay)
  176. {
  177. int nCount =  GetSize();
  178. for(int i = 0; i < nCount; i++)
  179. {
  180. long nDay_i = GetAt(i);
  181. if (nDay <= nDay_i)
  182. {
  183. if (nDay < nDay_i)
  184. InsertAt(i, nDay);
  185. return i;
  186. }
  187. }
  188. return Add(nDay);
  189. }
  190. };
  191. CDaysArray m_arNotEmptyDays;
  192. };
  193. friend class CTOPrevNextEventController;
  194. /////////////////////////////////////////////////////////////////////////
  195. // ******** Day View *********
  196. //=======================================================================
  197. DECLARE_THEMEPART2(CTODayViewEvent, CTOEvent, CXTPCalendarTheme::CTODayViewEvent)
  198. DECLARE_THEMEPART_MEMBER(0, CTOEventIconsToDraw, EventIconsToDraw)
  199. DECLARE_THEMEPART_MEMBER(1, CTOFormula_MulDivC,  HeightFormula)
  200. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  201. protected:
  202. };
  203. DECLARE_THEMEPART2(CTODayViewEvent_MultiDay, CTODayViewEvent, CXTPCalendarTheme::CTODayViewEvent_MultiDay)
  204. CXTPCalendarThemeStringValue m_strDateFormatFrom;
  205. CXTPCalendarThemeStringValue m_strDateFormatTo;
  206. virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect, int nEventPlaceNumber);
  207. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  208. virtual void DoPropExchange(CXTPPropExchange* pPX);
  209. virtual void Serialize(CArchive& ar);
  210. virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  211. virtual void CalcEventYs(CRect& rcRect, int nEventPlaceNumber);
  212. protected:
  213. virtual BOOL Draw_ArrowLtext(CXTPCalendarViewEvent* pViewEvent, CDC* pDC, CThemeFontColorSetValue* pfcsetText, CRect& rrcRect, int nLeft_x);
  214. virtual BOOL Draw_ArrowRtext(CXTPCalendarViewEvent* pViewEvent, CDC* pDC, CThemeFontColorSetValue* pfcsetText, CRect& rrcRect, int nRight_x);
  215. virtual CString Format_FromToDate(CXTPCalendarViewEvent* pViewEvent, int nStart1End2);
  216. };
  217. friend class CTODayViewEvent_MultiDay;
  218. DECLARE_THEMEPART2(CTODayViewEvent_SingleDay, CTODayViewEvent, CXTPCalendarTheme::CTODayViewEvent_SingleDay)
  219. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  220. virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect, int nEventPlaceNumber);
  221. virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  222. virtual void DrawShadow(CDC* pDC, CXTPCalendarDayViewEvent* pViewEvent);
  223. protected:
  224. virtual void InitBusyStatusDefaultColors();
  225. };
  226. friend class CTODayViewEvent_SingleDay;
  227. //=======================================================================
  228. DECLARE_THEMEPART(CTODayViewTimeScale, CXTPCalendarTheme::CTODayViewTimeScale)
  229. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  230. virtual int CalcMinRowHeight(CDC* pDC, CXTPCalendarDayViewTimeScale* pTimeScale);
  231. DECLARE_THEMEPART_MEMBER(0, CTOFormula_MulDivC, HeightFormula)
  232. };
  233. //=======================================================================
  234. DECLARE_THEMEPART2(CTODayViewDayGroupHeader, CTOHeader, CXTPCalendarTheme::CTODayViewDayGroupHeader)
  235. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  236. virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  237. };
  238. DECLARE_THEMEPART(CTODayViewDayGroupAllDayEvents, CXTPCalendarTheme::CTODayViewDayGroupAllDayEvents)
  239. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  240. virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  241. virtual void SetDynColors(CXTPCalendarDayViewGroup* pViewGroup);
  242. protected:
  243. COLORREF m_clrDynHatch;
  244. int      m_nDynBusyStatus;
  245. };
  246. DECLARE_THEMEPART(CTODayViewDayGroupCell, CXTPCalendarTheme::CTODayViewDayGroupCell)
  247. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  248. virtual int CalcHeight(CDC* pDC, int nCellWidth) {return 23;}
  249. virtual void Draw(CDC* pDC, const CRect& rcRect,
  250.   const XTP_CALENDAR_THEME_DAYVIEWCELL_PARAMS& cellParams, CXTPPropsStateContext* pStateCnt = NULL);
  251. };
  252. //=======================================================================
  253. DECLARE_THEMEPART(CTODayViewDayGroup, CXTPCalendarTheme::CTODayViewDayGroup)
  254. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  255. virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  256. virtual BOOL IsSelected(CXTPCalendarViewGroup* pViewGroup);
  257. DECLARE_THEMEPART_MEMBER(0, CTODayViewDayGroupHeader,       Header)
  258. DECLARE_THEMEPART_MEMBER(1, CTODayViewDayGroupAllDayEvents, AllDayEvents)
  259. DECLARE_THEMEPART_MEMBER(2, CTODayViewDayGroupCell,         Cell)
  260. DECLARE_THEMEPART_MEMBER(3, CTODayViewEvent_MultiDay,       MultiDayEvent)
  261. DECLARE_THEMEPART_MEMBER(4, CTODayViewEvent_SingleDay,      SingleDayEvent)
  262. public:
  263. virtual void OnMouseMove(CCmdTarget* pObject, UINT nFlags, CPoint point);
  264. virtual BOOL OnLButtonDown(CCmdTarget* pObject, UINT nFlags, CPoint point);
  265. virtual CRect GetScrollButtonRect(const CXTPCalendarDayViewGroup::XTP_DAY_VIEW_GROUP_LAYOUT& groupLayout, int nButton);
  266. protected:
  267. virtual void AdjustDayEvents(CXTPCalendarDayViewGroup* pDayViewGroup, CDC* pDC);
  268. };
  269. DECLARE_THEMEPART2(CTODayViewDayHeader, CTOHeader, CXTPCalendarTheme::CTODayViewDayHeader)
  270. CXTPCalendarThemeBOOLValue m_UseOffice2003HeaderFormat;
  271. CTODayViewDayHeader() {
  272. m_nWeekDayFormat = 0;
  273. }
  274. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  275. virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect);
  276. virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  277. virtual void DoPropExchange(CXTPPropExchange* pPX);
  278. virtual void Serialize(CArchive& ar);
  279. private:
  280. int m_nWeekDayFormat; // 0 - no Week Day, 1 - short, 2 - long
  281. };
  282. //=======================================================================
  283. DECLARE_THEMEPART(CTODayViewDay, CXTPCalendarTheme::CTODayViewDay)
  284. CXTPPaintManagerColor         m_clrBorder;
  285. CXTPPaintManagerColor         m_clrTodayBorder;
  286. DECLARE_THEMEPART_MEMBER(0, CTODayViewDayHeader,            Header)
  287. DECLARE_THEMEPART_MEMBER(1, CTODayViewDayGroup,             Group)
  288. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  289. virtual void DoPropExchange(CXTPPropExchange* pPX);
  290. virtual void Serialize(CArchive& ar);
  291. virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  292. virtual void Draw_DayBorder(CXTPCalendarDayViewDay* pDayViewDay, CDC* pDC);
  293. virtual CRect ExcludeDayBorder(CXTPCalendarDayViewDay* pDayViewDay, const CRect& rcDay);
  294. public:
  295. virtual void OnMouseMove(CCmdTarget* pObject, UINT nFlags, CPoint point);
  296. };
  297. DECLARE_THEMEPART(CTODayViewHeader, CTOHeader)
  298. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  299. };
  300. //=======================================================================
  301. DECLARE_THEMEPART(CTODayView, CXTPCalendarTheme::CTODayView)
  302. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  303. virtual void AdjustLayout(CDC* pDC, const CRect& rcRect);
  304. virtual void Draw(CDC* pDC);
  305. DECLARE_THEMEPART_MEMBER_(0, CTODayViewHeader,   Header, CXTPCalendarTheme::CTOHeader)
  306. DECLARE_THEMEPART_MEMBER(1, CTODayViewEvent,     Event)
  307. DECLARE_THEMEPART_MEMBER(2, CTODayViewTimeScale, TimeScale)
  308. DECLARE_THEMEPART_MEMBER(3, CTODayViewDay, Day)
  309. // theme specific control options
  310. virtual BOOL IsUseCellAlignedDraggingInTimeArea() {return TRUE;};
  311. protected:
  312. };
  313. /////////////////////////////////////////////////////////////////////////
  314. // ******** Month View *********
  315. // ======= MonthViewEvent ======
  316. DECLARE_THEMEPART2(CTOMonthViewEvent, CTOEvent, CXTPCalendarTheme::CTOMonthViewEvent)
  317. DECLARE_THEMEPART_MEMBER(0, CTOEventIconsToDraw, EventIconsToDraw)
  318. DECLARE_THEMEPART_MEMBER(1, CTOFormula_MulDivC,  HeightFormula)
  319. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  320. virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect, int nEventPlaceNumber);
  321. };
  322. friend class CTOMonthViewEvent;
  323. // ---- MonthViewEvent_SingleDay ----
  324. DECLARE_THEMEPART2(CTOMonthViewEvent_SingleDay, CTOMonthViewEvent, CXTPCalendarTheme::CTOMonthViewEvent_SingleDay)
  325. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  326. virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  327. protected:
  328. virtual void Draw_Background(CDC* pDC, const CRect& rcEventRect, CXTPCalendarMonthViewEvent* pViewEvent);
  329. virtual CSize Draw_Time(CDC* pDC, const CRect& rcEventRect, CXTPCalendarMonthViewEvent* pViewEvent);
  330. virtual void Draw_Caption(CDC* pDC, const CRect& rcTextRect, CXTPCalendarMonthViewEvent* pViewEvent);
  331. protected:
  332. };
  333. friend class CTOMonthViewEvent_SingleDay;
  334. // ---- MonthViewEvent_MultiDay ----
  335. DECLARE_THEMEPART2(CTOMonthViewEvent_MultiDay, CTOMonthViewEvent, CXTPCalendarTheme::CTOMonthViewEvent_MultiDay)
  336. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  337. virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  338. protected:
  339. virtual void Draw_Time(CDC* pDC, const CRect& rcEventRect, CXTPCalendarMonthViewEvent* pViewEvent);
  340. };
  341. friend class CTOMonthViewEvent_MultiDay;
  342. // ===== MonthViewDayHeader ====
  343. DECLARE_THEMEPART2(CTOMonthViewDayHeader, CTOHeader, CXTPCalendarTheme::CTOMonthViewDayHeader)
  344. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  345. virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  346. };
  347. friend class CTOMonthViewDayHeader;
  348. // ======= MonthViewDay =======
  349. DECLARE_THEMEPART2(CTOMonthViewDay, CTODay, CXTPCalendarTheme::CTOMonthViewDay)
  350. CXTPPaintManagerColor m_clrBorder;
  351. CXTPPaintManagerColor m_clrTodayBorder;
  352. CXTPPaintManagerColor m_clrBackgroundLight;
  353. CXTPPaintManagerColor m_clrBackgroundDark;
  354. CXTPPaintManagerColor m_clrBackgroundSelected;
  355. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  356. virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  357. virtual void DoPropExchange(CXTPPropExchange* pPX);
  358. virtual void Serialize(CArchive& ar);
  359. DECLARE_THEMEPART_MEMBER(0, CTOMonthViewDayHeader,       Header);
  360. DECLARE_THEMEPART_MEMBER(1, CTOMonthViewEvent_MultiDay,  MultiDayEvent);
  361. DECLARE_THEMEPART_MEMBER(2, CTOMonthViewEvent_SingleDay, SingleDayEvent);
  362. public:
  363. virtual void OnMouseMove(CCmdTarget* pObject, UINT nFlags, CPoint point);
  364. virtual BOOL OnLButtonDown(CCmdTarget* pObject, UINT nFlags, CPoint point);
  365. void SetDynColors(CXTPCalendarMonthViewDay* pMViewDay);
  366. protected:
  367. COLORREF m_clrDynHatch;
  368. int      m_nDynBusyStatus;
  369. };
  370. friend class CTOMonthViewDay;
  371. // ======= MonthViewWeekDayHeader =======
  372. DECLARE_THEMEPART2(CTOMonthViewWeekDayHeader, CTOHeader, CXTPCalendarTheme::CTOMonthViewWeekDayHeader)
  373. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  374. virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect);
  375. virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  376. protected:
  377. virtual void Draw_Borders2(CDC* pDC, const CRect& rcRect, BOOL bDrawRightBorder);
  378. protected:
  379. BOOL m_bWeekDayNamesLong;
  380. BOOL m_bWeekDayNameSaSuLong;
  381. CStringArray m_arWeekDayNamesLong;  // 0 - Sunday, 1 - Monday, ...; 7 - Sat/Sun
  382. CStringArray m_arWeekDayNamesShort; // 0 - Sunday, 1 - Monday, ...; 7 - Sat/Sun
  383. public:
  384. CTOMonthViewWeekDayHeader()
  385. {
  386. m_bWeekDayNamesLong = FALSE;
  387. m_bWeekDayNameSaSuLong = FALSE;
  388. }
  389. };
  390. friend class CTOMonthViewWeekDayHeader;
  391. // ======= MonthViewWeekHeader =======
  392. DECLARE_THEMEPART(CTOMonthViewWeekHeader, CTOHeader)
  393. CXTPPaintManagerColor   m_clrFreeSpaceBk;
  394. // CTOHeader::m_TextCenter.fcsetNormal is used to draw header caption;
  395. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  396. virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect);
  397. virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  398. virtual void DoPropExchange(CXTPPropExchange* pPX);
  399. virtual void Serialize(CArchive& ar);
  400. virtual int CalcWidth(CDC* pDC);
  401. CTOMonthViewWeekHeader()
  402. {
  403. m_rcHeader.SetRect(0,0,0,0);
  404. m_bDateFormatShort = TRUE;
  405. }
  406. protected:
  407. CRect m_rcHeader;
  408. BOOL  m_bDateFormatShort;
  409. virtual void FormatWeekCaption(COleDateTime dtWDay1, CString& rstrShort, CString& rstrLong, int nShort1Long2 = 0);
  410. virtual CString _FormatWCaption(LPCTSTR pcszDay1, LPCTSTR pcszMonth1, LPCTSTR pcszDay7,
  411. LPCTSTR pcszMonth7, LPCTSTR pcszDayMonthSeparator, int nDateOrdering);
  412. virtual void Draw_TextCenter(CDC* pDC, const CRect& rcRect, int nState,
  413.  LPCTSTR pcszCenterText, int* pnWidth = NULL);
  414. };
  415. friend class CTOMonthViewWeekHeader;
  416. // ******* MonthView theme part object *******
  417. DECLARE_THEMEPART(CTOMonthView, CXTPCalendarTheme::CTOMonthView)
  418. // TODO:
  419. // BOOL m_bShowWeekNumbers;
  420. //
  421. //virtual void DoPropExchange(CXTPPropExchange* pPX);
  422. //virtual void Serialize(CArchive& ar);
  423. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  424. virtual void AdjustLayout(CDC* pDC, const CRect& rcRect, BOOL bCallPostAdjustLayout);
  425. virtual void Draw(CDC* pDC);
  426. DECLARE_THEMEPART_MEMBER( 0, CTOHeader,                 Header);
  427. DECLARE_THEMEPART_MEMBER( 1, CTOMonthViewEvent,         Event);
  428. DECLARE_THEMEPART_MEMBER( 2, CTOMonthViewWeekDayHeader, WeekDayHeader);
  429. DECLARE_THEMEPART_MEMBER_(3, CTOMonthViewWeekHeader,    WeekHeader, CTOHeader);
  430. DECLARE_THEMEPART_MEMBER( 4, CTOMonthViewDay,           Day);
  431. };
  432. friend class CTOMonthView;
  433. /////////////////////////////////////////////////////////////////////////
  434. // ******** WeekView *********
  435. // ======= WeekViewEvent =======
  436. DECLARE_THEMEPART2(CTOWeekViewEvent, CTOEvent, CXTPCalendarTheme::CTOWeekViewEvent)
  437. DECLARE_THEMEPART_MEMBER(0, CTOEventIconsToDraw, EventIconsToDraw)
  438. DECLARE_THEMEPART_MEMBER(1, CTOFormula_MulDivC,  HeightFormula)
  439. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  440. virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect, int nEventPlaceNumber);
  441. };
  442. friend class CTOWeekViewEvent;
  443. // ==== WeekViewEvent_SingleDay ====
  444. DECLARE_THEMEPART2(CTOWeekViewEvent_SingleDay, CTOWeekViewEvent, CXTPCalendarTheme::CTOWeekViewEvent_SingleDay)
  445. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  446. virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  447. protected:
  448. virtual void Draw_Background(CDC* pDC, const CRect& rcEventRect, CXTPCalendarWeekViewEvent* pViewEvent);
  449. virtual CSize Draw_Time(CDC* pDC, const CRect& rcEventRect, CXTPCalendarWeekViewEvent* pViewEvent);
  450. virtual void Draw_Caption(CDC* pDC, const CRect& rcTextRect, CXTPCalendarWeekViewEvent* pViewEvent);
  451. };
  452. friend class CTOWeekViewEvent_SingleDay;
  453. // ==== WeekViewEvent_MultiDay ====
  454. DECLARE_THEMEPART2(CTOWeekViewEvent_MultiDay, CTOWeekViewEvent, CXTPCalendarTheme::CTOWeekViewEvent_MultiDay)
  455. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  456. virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  457. };
  458. friend class CTOWeekViewEvent_MultiDay;
  459. // ==== WeekViewDayHeader ====
  460. DECLARE_THEMEPART2(CTOWeekViewDayHeader, CTOHeader, CXTPCalendarTheme::CTOWeekViewDayHeader)
  461. CXTPCalendarThemeStringValue m_strHeaderFormat;
  462. CXTPCalendarThemeBOOLValue m_UseOffice2003HeaderFormat;
  463. virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect);
  464. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  465. virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  466. virtual void DoPropExchange(CXTPPropExchange* pPX);
  467. virtual void Serialize(CArchive& ar);
  468. };
  469. friend class CTOWeekViewDayHeader;
  470. // ======= WeekViewDay =======
  471. DECLARE_THEMEPART2(CTOWeekViewDay, CTODay, CXTPCalendarTheme::CTOWeekViewDay)
  472. CXTPPaintManagerColor m_clrBorder;
  473. CXTPPaintManagerColor m_clrTodayBorder;
  474. CXTPPaintManagerColor m_clrBackgroundLight;
  475. CXTPPaintManagerColor m_clrBackgroundDark;
  476. CXTPPaintManagerColor m_clrBackgroundSelected;
  477. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  478. virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  479. virtual void DoPropExchange(CXTPPropExchange* pPX);
  480. virtual void Serialize(CArchive& ar);
  481. virtual void OnMouseMove(CCmdTarget* pObject, UINT nFlags, CPoint point);
  482. virtual BOOL OnLButtonDown(CCmdTarget* pObject, UINT nFlags, CPoint point);
  483. DECLARE_THEMEPART_MEMBER(0, CTOWeekViewDayHeader,       Header);
  484. DECLARE_THEMEPART_MEMBER(1, CTOWeekViewEvent_MultiDay,  MultiDayEvent);
  485. DECLARE_THEMEPART_MEMBER(2, CTOWeekViewEvent_SingleDay, SingleDayEvent);
  486. virtual void SetDynColors(CXTPCalendarWeekViewDay* pWViewDay);
  487. protected:
  488. COLORREF m_clrDynHatch;
  489. int      m_nDynBusyStatus;
  490. };
  491. friend class CTOWeekViewDay;
  492. // ==== WeekView theme part object ====
  493. DECLARE_THEMEPART(CTOWeekView, CXTPCalendarTheme::CTOWeekView)
  494. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  495. virtual void AdjustLayout(CDC* pDC, const CRect& rcRect, BOOL bCallPostAdjustLayout);
  496. virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  497. DECLARE_THEMEPART_MEMBER(0, CTOWeekViewEvent, Event);
  498. DECLARE_THEMEPART_MEMBER(1, CTOWeekViewDay,   Day);
  499. };
  500. DECLARE_THEMEPART(CTOCellDynBackground, CXTPCalendarThemePart)
  501. virtual int GetCellDynBackground(CXTPCalendarViewGroup* pVioewGroup, COleDateTime dtCellTime,
  502.  int nCellIndex, XTP_BUSY_STATUS_CONTEXT& rContext);
  503. virtual CXTPCalendarViewEvent* GetCellBackgroundEvent(CXTPCalendarViewGroup* pVioewGroup,
  504.  COleDateTime dtCellTime, int nCellIndex);
  505. protected:
  506. virtual int CmpEventBusyStatus(CXTPCalendarEvent* pEvent1, CXTPCalendarEvent* pEvent2);
  507. virtual int _GetEventBusyStatusRank(CXTPCalendarEvent* pEvent);
  508. };
  509. //=======================================================================
  510. DECLARE_THEMEPART_MEMBER(0, CTOColorsSet,   ColorsSet)
  511. virtual BOOL IsBaseColorOrig();
  512. virtual COLORREF GetColor(int eCLR, COLORREF clrBase = (COLORREF)-1);
  513. virtual COLORREF GetColor2(LPCTSTR pcszColorName, COLORREF clrDefault);
  514. virtual CXTPOffice2007Image* GetBitmap(LPCTSTR pcszStdBmpName);
  515. DECLARE_THEMEPART_MEMBER(1, CTOHeader,      Header)
  516. DECLARE_THEMEPART_MEMBER(2, CTOEvent,       Event)
  517. DECLARE_THEMEPART_MEMBER(3, CTODayView,     DayView)
  518. DECLARE_THEMEPART_MEMBER(4, CTOMonthView,   MonthView)
  519. DECLARE_THEMEPART_MEMBER(5, CTOWeekView,    WeekView)
  520. // office 2007 theme specific parts
  521. DECLARE_THEMEPART_MEMBER_(6, CTOCellDynBackground, CellDynBackground, CTOCellDynBackground)
  522. DECLARE_THEMEPART_MEMBER_(7, CTOPrevNextEventController, PrevNextEventController, CXTPCalendarThemePart)
  523. //  DECLARE_THEMEPART_MEMBER_(8, CTOPrevNextEventButton, PrevEventButton, CXTPCalendarThemePart)
  524. //  DECLARE_THEMEPART_MEMBER_(9, CTOPrevNextEventButton, NextEventButton, CXTPCalendarThemePart)
  525. //=======================================================================
  526. CXTPCalendarThemeOffice2007();
  527. virtual ~CXTPCalendarThemeOffice2007();
  528. // If enough space on the rect - draw 3 strings one under other
  529. // as multi-line text.
  530. // If rect height allow draw only 1 line - string 1 an 2 are drawn
  531. // as single line with a separator.
  532. // Separate font settings are used to draw each text.
  533. virtual CSize DrawText_Auto2SL3ML(CDC* pDC,
  534. LPCTSTR pcszText1, LPCTSTR pcszText2, LPCTSTR pcszText3,
  535. CThemeFontColorSet* pFontColor1, CThemeFontColorSet* pFontColor2,
  536. CThemeFontColorSet* pFontColor3,
  537. CRect& rcRect, LPCTSTR pcszText1Separator, UINT uWordBreakMode = DT_WORDBREAK);
  538. // Common    colors id's: {0   - 99}
  539. // DayViev   colors id's: {100 - 499}
  540. // MonthViev colors id's: {500 - 999}
  541. // WeekViev  colors id's: {1000 - 1499}
  542. //
  543. // For darken colors: id + 5000
  544. enum XTPEnumThemeColorsSet
  545. {
  546. xtpCLR_DarkenOffset = 5000,
  547. xtpCLR_SelectedBk   = 1 + xtpCLR_DarkenOffset,
  548. xtpCLR_HeaderBorder = 2,
  549. xtpCLR_DayBorder    = 3,
  550. xtpCLR_MultiDayEventBorder          = 10,
  551. xtpCLR_MultiDayEventSelectedBorder  = 11 + xtpCLR_DarkenOffset,
  552. xtpCLR_MultiDayEventBkGRfrom        = 12,
  553. xtpCLR_MultiDayEventBkGRto          = 13,
  554. xtpCLR_MultiDayEventFromToDates     = 20,
  555. //xtpCLR_DayView_ = 100,
  556. xtpCLR_DayViewCellWorkBk                = 101,
  557. xtpCLR_DayViewCellNonWorkBk             = 102,
  558. xtpCLR_DayViewCellWorkBorderBottomInHour    = 103,
  559. xtpCLR_DayViewCellWorkBorderBottomHour      = 104,
  560. xtpCLR_DayViewCellNonWorkBorderBottomInHour = 105,
  561. xtpCLR_DayViewCellNonWorkBorderBottomHour   = 106,
  562. xtpCLR_DayViewAllDayEventsBk            = 110,
  563. xtpCLR_DayViewAllDayEventsBorderBottom  = 111,
  564. xtpCLR_DayViewSingleDayEventBorder      = 120,
  565. xtpCLR_DayViewSingleDayEventSelectedBorder= 121 + xtpCLR_DarkenOffset,
  566. xtpCLR_DayViewSingleDayEventBkGRfrom    = 122,
  567. xtpCLR_DayViewSingleDayEventBkGRto      = 123,
  568. //xtpCLR_MonthView_ = 500,
  569. xtpCLR_MonthViewDayBkLight                  = 501,
  570. xtpCLR_MonthViewDayBkDark                   = 502,
  571. xtpCLR_MonthViewDayBkSelected               = 503,
  572. xtpCLR_MonthViewEventTime                   = 510 + xtpCLR_DarkenOffset,
  573. xtpCLR_MonthViewSingleDayEventBorder        = 520,
  574. xtpCLR_MonthViewSingleDayEventSelectedBorder= 521 + xtpCLR_DarkenOffset,
  575. xtpCLR_MonthViewSingleDayEventBkGRfrom      = 522,
  576. xtpCLR_MonthViewSingleDayEventBkGRto        = 523,
  577. //xtpCLR_WeekView_ = 1000,
  578. xtpCLR_WeekViewDayBkLight                  = 1001,
  579. xtpCLR_WeekViewDayBkDark                   = 1002,
  580. xtpCLR_WeekViewDayBkSelected               = 1003,
  581. xtpCLR_WeekViewEventTime                   = 1010 + xtpCLR_DarkenOffset,
  582. xtpCLR_WeekViewSingleDayEventBorder         = 1020,
  583. xtpCLR_WeekViewSingleDayEventSelectedBorder = 1021 + xtpCLR_DarkenOffset,
  584. xtpCLR_WeekViewSingleDayEventBkGRfrom       = 1022,
  585. xtpCLR_WeekViewSingleDayEventBkGRto         = 1023,
  586. };
  587. public:
  588. virtual CXTPCalendarViewEventSubjectEditor* StartEditSubject(CXTPCalendarViewEvent* pViewEvent);
  589. //-----------------------------------------------------------------------
  590. // Summary:
  591. //     Thin method determine event view type (day, week, month) and
  592. //     return corresponding drawing part.
  593. // Returns:
  594. //     Theme drawing part for editing event.
  595. //-----------------------------------------------------------------------
  596. virtual CTOEvent* GetThemePartForEvent(CXTPCalendarViewEvent* pViewEvent);
  597. virtual void GetItemTextIfNeed(int nItem, CString* pstrText, CXTPCalendarViewDay* pViewDay);
  598. static const int cnGripperSize;
  599. static const int cnShadowWidth;
  600. static COLORREF AFX_CDECL PowerColor(COLORREF clrB, double dFactor, double dPower);
  601. protected:
  602. virtual void SetCalendarControl(CXTPCalendarControl* pCalendar);
  603. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  604. virtual void _DrawEventLTHighlight(CDC* pDC, CPoint ptLT, int nRTx, const CXTPPaintManagerColorGradient& grclrBk,
  605. int nLTCorner = 0, int nLBy = INT_MAX, BOOL bRCorner = TRUE);
  606. protected:
  607. //{{AFX_CODEJOCK_PRIVATE
  608. DECLARE_XTP_SINK(CXTPCalendarThemeOffice2007, m_Sink)
  609. virtual void OnEvent_Office2007ImagesChanged(XTP_NOTIFY_CODE Event, WPARAM wParam, LPARAM lParam);
  610. //}}AFX_CODEJOCK_PRIVATE
  611. protected:
  612. };
  613. //}}AFX_CODEJOCK_PRIVATE
  614. //===========================================================================
  615. // Summary:
  616. //      This class is used to edit event subject in Office 2007 Theme.
  617. // Remarks:
  618. //      This class is derived from CXTPCalendarViewEventSubjectEditor and
  619. //      draw editor background in Office 2007 Theme event object style
  620. //      or use no background (transparent background).
  621. // See Also:
  622. //      CXTPCalendarViewEventSubjectEditor
  623. //===========================================================================
  624. class _XTP_EXT_CLASS  CXTPCalendarViewEventSubjectEditor2007 : public CXTPCalendarViewEventSubjectEditor
  625. {
  626. public:
  627. //-----------------------------------------------------------------------
  628. // Summary:
  629. //     Default object constructor.
  630. // Parameters:
  631. //     pOwner     - A pointer to an owner calendar control object.
  632. //     pViewEvent - A pointer to an editing event view object.
  633. //     pTheme2007 - A pointer to an owner theme.
  634. // See Also: ~CXTPCalendarViewEventSubjectEditor2007()
  635. //-----------------------------------------------------------------------
  636. CXTPCalendarViewEventSubjectEditor2007(CXTPCalendarControl* pOwner, CXTPCalendarViewEvent* pViewEvent, CXTPCalendarThemeOffice2007* pTheme2007);
  637. //-----------------------------------------------------------------------
  638. // Summary:
  639. //     Default class destructor.
  640. //-----------------------------------------------------------------------
  641. virtual ~CXTPCalendarViewEventSubjectEditor2007();
  642. protected:
  643. CXTPCalendarViewEvent* m_pViewEvent;        // Stored pointer to the editing event object.
  644. CXTPCalendarThemeOffice2007* m_pTheme2007;  // Stored pointer to the owner theme.
  645. CXTPPaintManagerColorGradient m_grclrBk;    // Subject Editor background color (or gradient colors).
  646. //{{AFX_CODEJOCK_PRIVATE
  647. DECLARE_MESSAGE_MAP()
  648. afx_msg virtual BOOL OnEraseBkgnd(CDC* pDC);
  649. afx_msg virtual HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
  650. afx_msg virtual void OnChange();
  651. //}}AFX_CODEJOCK_PRIVATE
  652. };
  653. /////////////////////////////////////////////////////////////////////////////
  654. #if (_MSC_VER > 1100)
  655. #pragma warning(pop)
  656. #endif
  657. #endif // !defined(_XTP_CALENDAR_THEME_OFFICE_2007_H__)