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

对话框与窗口

开发平台:

Visual C++

  1. // XTPCalendarTheme.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_H__)
  22. #define _XTP_CALENDAR_THEME_H__
  23. //}}AFX_CODEJOCK_PRIVATE
  24. #if _MSC_VER > 1000
  25. #pragma once
  26. #endif // _MSC_VER > 1000
  27. #include "Common/XTPColorManager.h"
  28. #include "XTPCalendarViewPart.h"
  29. #include "XTPCalendarPtrCollectionT.h"
  30. #include "XTPCalendarView.h"
  31. #include "XTPCalendarDayView.h"
  32. #include "XTPCalendarDayViewTimeScale.h"
  33. #include "XTPCalendarWeekView.h"
  34. #if (_MSC_VER > 1100)
  35. #pragma warning(push)
  36. #endif
  37. #pragma warning(disable: 4250)
  38. #pragma warning(disable : 4100)// TODO: remove when themes will be finished
  39. /////////////////////////////////////////////////////////////////////////////
  40. class CXTPCalendarControl;
  41. class CXTPCalendarViewDay;
  42. class CXTPCalendarDayView;
  43. class CXTPCalendarDayViewDay;
  44. class CXTPCalendarDayViewGroup;
  45. class CXTPCalendarMonthView;
  46. class CXTPCalendarWeekView;
  47. class CXTPCalendarDayViewEvent;
  48. class CXTPCalendarMonthViewEvent;
  49. class CXTPCalendarWeekViewEvent;
  50. class CXTPCalendarViewEvent;
  51. class CXTPCalendarDayViewTimeScale;
  52. class CXTPImageManager;
  53. class CXTPOffice2007Image;
  54. class CXTPOffice2007Images;
  55. class CXTPOffice2007ImageList;
  56. class CXTPCalendarTheme;
  57. /////////////////////////////////////////////////////////////////////////////
  58. //{{AFX_CODEJOCK_PRIVATE
  59. //===========================================================================
  60. // In VS 7.1 the call TBase::memberFunc sometimes crash.
  61. // The Service Pack 1 for VS 7.1 fix this compiler bug.
  62. // XTP_SAFE_CALL_BASE macro helps to avoid this problem in any VS version.
  63. //===========================================================================
  64. #if (_MSC_VER == 1310)
  65. #define XTP_SAFE_CALL_BASE(_TBase, memberFunc) ((_TBase*)this)->_TBase::memberFunc
  66. #else
  67. #define XTP_SAFE_CALL_BASE(_TBase, memberFunc) _TBase::memberFunc
  68. #endif
  69. #define DECLARE_THEMEPART_MEMBER_BASE
  70. #undef DECLARE_THEMEPART_MEMBER_BASE
  71. #define DECLARE_THEMEPART_MEMBER_BASE(cClassBase, memberName) 
  72. public:                             
  73. virtual cClassBase* Get##memberName##Part() {   
  74. ASSERT(FALSE);                          
  75. return NULL;                            
  76. }
  77. #define DECLARE_THEMEPART_MEMBER_BASE2
  78. #undef DECLARE_THEMEPART_MEMBER_BASE2
  79. #define DECLARE_THEMEPART_MEMBER_BASE2(cClassBase, memberName) 
  80. public:                             
  81. virtual cClassBase* Get##memberName##Part() {   
  82. return NULL;                            
  83. }
  84. //=============================================================
  85. #define DECLARE_THEMEPART
  86. #undef DECLARE_THEMEPART
  87. #define DECLARE_THEMEPART_CUSTOM
  88. #undef DECLARE_THEMEPART_CUSTOM
  89. #define DECLARE_THEMEPART2
  90. #undef DECLARE_THEMEPART2
  91. #if (_MSC_VER <= 1200) // Using Visual C++ 5.0, 6.0
  92. #define DECLARE_THEMEPART(cClass, cClassBase) 
  93. class _XTP_EXT_CLASS cClass##_Base : virtual public cClassBase {}; /* To access base class members (in VC 6 compiler) */ 
  94. class _XTP_EXT_CLASS cClass : virtual public cClass##_Base 
  95. {public:  
  96. typedef cClass##_Base TBase;    
  97. public:                             
  98. #define DECLARE_THEMEPART_CUSTOM(cClass, cClassBase) 
  99. class cClass##_Base : virtual public cClassBase {}; /* To access base class members (in VC 6 compiler) */ 
  100. class cClass : virtual public cClass##_Base 
  101. {public:  
  102. typedef cClass##_Base TBase; 
  103. public:
  104. #define DECLARE_THEMEPART2(cClass, cClassBase, cClassBase2) 
  105. class _XTP_EXT_CLASS cClass##_Base : virtual public cClassBase {}; /* To access base class members (in VC 6 compiler) */ 
  106. class _XTP_EXT_CLASS cClass##_Base2 : virtual public cClassBase2 {}; /* To access base class members (in VC 6 compiler) */ 
  107. class _XTP_EXT_CLASS cClass : virtual public cClass##_Base, virtual public cClass##_Base2 
  108. {public:  
  109. typedef cClass##_Base TBase; 
  110. typedef cClass##_Base2 TBase2; 
  111. public:
  112. #else
  113. #define DECLARE_THEMEPART(cClass, cClassBase) 
  114. class _XTP_EXT_CLASS cClass : virtual public cClassBase 
  115. { public: 
  116. typedef cClassBase TBase;    
  117. public:                             
  118. #define DECLARE_THEMEPART_CUSTOM(cClass, cClassBase) 
  119. class cClass : virtual public cClassBase 
  120. {public: 
  121. typedef cClassBase TBase; 
  122. public:
  123. #define DECLARE_THEMEPART2(cClass, cClassBase, cClassBase2) 
  124. class _XTP_EXT_CLASS cClass : virtual public cClassBase, virtual public cClassBase2 
  125. {public: 
  126. typedef cClassBase TBase; 
  127. typedef cClassBase2 TBase2; 
  128. public:
  129. #endif
  130. //=============================================================
  131. // TODO: custom via defines...
  132. #define DECLARE_THEMEPART2_CUSTOM
  133. #undef DECLARE_THEMEPART2_CUSTOM
  134. #define DECLARE_THEMEPART2_CUSTOM(cClass, cClassBase, cClassBase2) 
  135. class cClass##_Base : virtual public cClassBase {}; /* To access base class members (in VC 6 compiler) */ 
  136. class cClass##_Base2 : virtual public cClassBase2 {}; /* To access base class members (in VC 6 compiler) */ 
  137. class cClass : virtual public cClass##_Base, virtual public cClass##_Base2 
  138. {public: 
  139. typedef cClass##_Base TBase; 
  140. typedef cClass##_Base2 TBase2; 
  141. public:
  142. //=============================================================
  143. #define DECLARE_THEMEPART_MEMBER_
  144. #undef DECLARE_THEMEPART_MEMBER_
  145. #define DECLARE_THEMEPART_MEMBER_(nIndex, cClass, memberName, cClassBase) 
  146. protected:                                                  
  147. virtual CXTPCalendarThemePart* CreateMember##nIndex(){  
  148. ASSERT(TBase::CreateMember##nIndex() == NULL);      
  149. m_p##memberName = new cClass();                     
  150. if (m_p##memberName)                                
  151. m_p##memberName->SetInstanceName(_T(#memberName));  
  152. return m_p##memberName;     
  153. }                               
  154. public:                             
  155. cClass* m_p##memberName;        
  156. public:                             
  157. virtual cClassBase* Get##memberName##Part() {       
  158. return m_p##memberName;                         
  159. }                                                   
  160. virtual cClass* Get##memberName##PartX() {          
  161. return m_p##memberName;                         
  162. }                                                   
  163. virtual void Set##memberName##Part(cClass* pPart) { 
  164. if (pPart)                                      
  165. {                                               
  166. if (!pPart->IsCreated())                    
  167. pPart->Create(GetTheme(), this);        
  168. pPart->SetInstanceName(_T(#memberName));    
  169. }                                               
  170. m_p##memberName = pPart;                        
  171. m_arMembers.SetAt(nIndex, pPart);               
  172. }
  173. //=============================================================
  174. #define DECLARE_THEMEPART_MEMBER
  175. #undef DECLARE_THEMEPART_MEMBER
  176. #define DECLARE_THEMEPART_MEMBER(nIndex, cClass, memberName) 
  177. DECLARE_THEMEPART_MEMBER_(nIndex, cClass, memberName, CXTPCalendarTheme::##cClass)
  178. // }}AFX_CODEJOCK_PRIVATE
  179. // {{AFX_CODEJOCK_PRIVATE
  180. /////////////////////////////////////////////////////////////////////////////
  181. //=============================================================================
  182. class _XTP_EXT_CLASS CXTPCalendarThemePart : public CXTPCmdTarget
  183. {
  184. DECLARE_DYNAMIC(CXTPCalendarThemePart)
  185. public:
  186. CXTPCalendarThemePart();
  187. virtual ~CXTPCalendarThemePart();
  188. virtual CXTPCalendarThemePart* GetOwner();
  189. virtual CXTPCalendarTheme* GetTheme();
  190. virtual LPCTSTR GetInstanceName();
  191. virtual void SetInstanceName(LPCTSTR pcszInstanceName);
  192. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  193. virtual void DoPropExchange(CXTPPropExchange* pPX);
  194. virtual void Serialize(CArchive& ar);
  195. //****************
  196. virtual void Draw(CCmdTarget* pObject, CDC* pDC){};
  197. public:
  198. virtual UINT_PTR SetTimer(UINT uTimeOut_ms);
  199. virtual void KillTimer(UINT_PTR uTimerID);
  200. // messages handlers
  201. virtual void OnMouseMove(CCmdTarget* pObject, UINT nFlags, CPoint point){};
  202. virtual BOOL OnLButtonDown(CCmdTarget* pObject, UINT nFlags, CPoint point){return FALSE;};
  203. virtual BOOL OnTimer(UINT_PTR uTimerID);
  204. virtual void OnDetachCalendar();
  205. protected:
  206. CXTPCalendarTheme*      m_pTheme;
  207. CXTPCalendarThemePart*  m_pOwner;
  208. CString                 m_strInstanceName;
  209. protected:
  210. typedef CXTPCalendarPtrCollectionT<CXTPCalendarThemePart> CThemePartsArray;
  211. CThemePartsArray    m_arMembers;
  212. public:
  213. virtual BOOL IsCreated();
  214. virtual void Create(CXTPCalendarTheme* pTheme, CXTPCalendarThemePart* pOwner);
  215. protected:
  216. virtual void _CreateMembers();
  217. virtual CXTPCalendarThemePart* CreateMember0(){return NULL;};
  218. virtual CXTPCalendarThemePart* CreateMember1(){return NULL;};
  219. virtual CXTPCalendarThemePart* CreateMember2(){return NULL;};
  220. virtual CXTPCalendarThemePart* CreateMember3(){return NULL;};
  221. virtual CXTPCalendarThemePart* CreateMember4(){return NULL;};
  222. virtual CXTPCalendarThemePart* CreateMember5(){return NULL;};
  223. virtual CXTPCalendarThemePart* CreateMember6(){return NULL;};
  224. virtual CXTPCalendarThemePart* CreateMember7(){return NULL;};
  225. virtual CXTPCalendarThemePart* CreateMember8(){return NULL;};
  226. virtual CXTPCalendarThemePart* CreateMember9(){return NULL;};
  227. protected:
  228. class _XTP_EXT_CLASS CXTPPropsState
  229. {
  230. public:
  231. CXTPPropsState();
  232. virtual ~CXTPPropsState();
  233. void SaveState();
  234. void RestoreState(BOOL bClearData);
  235. void ClearLastState();
  236. void ClearAll();
  237. #ifdef _DEBUG
  238. static int s_dbg_nActiveStates;
  239. #endif
  240. protected:
  241. CXTPCalendarTypedPtrAutoDeleteArray<CPtrArray, CMemFile*> m_arStates;
  242. static BOOL s_bUseSerialize;
  243. };
  244. friend class CXTPPropsState;
  245. //---------------------------------------------
  246. class _XTP_EXT_CLASS CXTPPropsStateContext
  247. {
  248. CXTPCalendarThemePart* m_pPart;
  249. int                    m_eBeroreDrawFlag;
  250. //BOOL  m_bAttached;
  251. public:
  252. CXTPPropsStateContext(CXTPCalendarThemePart* pPart = NULL, int eBDFlag = 0, BOOL bClearAll = FALSE);
  253. virtual ~CXTPPropsStateContext();
  254. BOOL IsActive() {
  255. return !!m_pPart;
  256. }
  257. void SetData(CXTPCalendarThemePart* pPart, int eBDFlag = 0, BOOL bClearAll = FALSE);
  258. void Clear();
  259. //void Attach(CXTPCalendarThemePart* pPart, int eBDFlag = 0);
  260. void RestoreState();
  261. void SendBeforeDrawThemeObject(LPARAM lParam, int eBDFlag = 0);
  262. };
  263. friend class CXTPPropsStateContext;
  264. virtual void SendNotificationAlways(XTP_NOTIFY_CODE EventCode, WPARAM wParam , LPARAM lParam);
  265. CXTPPropsState m_xPropsState;
  266. BOOL m_bSendBeforeDrawThemeObjectEnabled;
  267. };
  268. /////////////////////////////////////////////////////////////////////////////
  269. // Initial version. Will be expanded in the feature.
  270. class _XTP_EXT_CLASS CXTPCalendarTheme: public CXTPCalendarThemePart
  271. {
  272. friend class CXTPCalendarControl;
  273. DECLARE_DYNAMIC(CXTPCalendarTheme)
  274. typedef CXTPCalendarThemePart TBase;
  275. protected:
  276. CXTPCalendarControl* m_pCalendar;
  277. virtual void SetCalendarControl(CXTPCalendarControl* pCalendar);
  278. virtual void Init();
  279. public:
  280. CXTPCalendarTheme();
  281. virtual ~CXTPCalendarTheme();
  282. virtual CXTPCalendarControl* GetCalendarControl();
  283. //=======================================================================
  284. class _XTP_EXT_CLASS CThemeFontColorSet
  285. {
  286. public:
  287. virtual CFont* Font() const = 0;
  288. virtual COLORREF Color() const = 0;
  289. };
  290. //=======================================================================
  291. class _XTP_EXT_CLASS CThemeFontColorSetValue : public CThemeFontColorSet
  292. {
  293. public:
  294. CXTPPaintManagerColor       clrColor;
  295. CXTPCalendarThemeFontValue  fntFont;
  296. void SetStandardValue(const CThemeFontColorSet& fcsetValue)
  297. {
  298. clrColor.SetStandardValue(fcsetValue.Color());
  299. fntFont.SetStandardValue(fcsetValue.Font());
  300. }
  301. void CopySettings(const CThemeFontColorSetValue& refSrc) {
  302. CXTPCalendarTheme::CopySettings(clrColor, refSrc.clrColor);
  303. fntFont.CopySettings(refSrc.fntFont);
  304. }
  305. //--------------------------------------------
  306. virtual CFont* Font() const {
  307. return fntFont;
  308. }
  309. virtual COLORREF Color() const {
  310. return clrColor;
  311. }
  312. virtual void doPX(CXTPPropExchange* pPX, LPCTSTR pcszPropName, CXTPCalendarTheme* pTheme);
  313. virtual void Serialize(CArchive& ar);
  314. };
  315. //=======================================================================
  316. class _XTP_EXT_CLASS CTOFormula_MulDivC : virtual public CXTPCalendarThemePart
  317. {
  318. public:
  319. CTOFormula_MulDivC();
  320. virtual void RefreshFromParent(CTOFormula_MulDivC* pParentSrc);
  321. virtual void SetStandardValue(int nMul, int nDiv, int nC);
  322. virtual int Calculate(int nY) const;
  323. virtual void DoPropExchange(CXTPPropExchange* pPX);
  324. virtual void Serialize(CArchive& ar);
  325. //------------------------------------------------------------
  326. CXTPCalendarThemeIntValue m_Multiplier;
  327. CXTPCalendarThemeIntValue m_Divisor;
  328. CXTPCalendarThemeIntValue m_Constant;
  329. };
  330. friend class CTOFormula_MulDivC;
  331. //=======================================================================
  332. class _XTP_EXT_CLASS CTOEventIconsToDraw : virtual public CXTPCalendarThemePart
  333. {
  334. public:
  335. CXTPCalendarThemeBOOLValue m_ShowReminder;
  336. CXTPCalendarThemeBOOLValue m_ShowOccurrence;
  337. CXTPCalendarThemeBOOLValue m_ShowException;
  338. CXTPCalendarThemeBOOLValue m_ShowMeeting;
  339. CXTPCalendarThemeBOOLValue m_ShowPrivate;
  340. virtual void RefreshFromParent(CTOEventIconsToDraw* pParentSrc);
  341. virtual void SetStandardValue(BOOL bRmd, BOOL bOcc, BOOL bExc, BOOL bMee, BOOL bPrv);
  342. virtual void DoPropExchange(CXTPPropExchange* pPX);
  343. virtual void Serialize(CArchive& ar);
  344. CTOEventIconsToDraw();
  345. virtual void FillIconIDs(CUIntArray& rarGlyphIDs, CUIntArray& rarGlyphIndex, CXTPCalendarEvent* pEvent);
  346. };
  347. friend class CTOEventIconsToDraw;
  348. //=======================================================================
  349. struct _XTP_EXT_CLASS XTP_BUSY_STATUS_CONTEXT
  350. {
  351. COLORREF clrBkAllDayEvents;
  352. COLORREF clrBkWorkCell;
  353. COLORREF clrBkNonWorkCell;
  354. COLORREF clrCellBorder;
  355. //      BOOL IsNull() {
  356. //          return clrBkAllDayEvents == 0 && clrBkWorkCell == 0 &&
  357. //                  clrBkNonWorkCell == 0 && clrCellBorder == 0;
  358. //      }
  359. };
  360. //=======================================================================
  361. class _XTP_EXT_CLASS CTOHeader : virtual public CXTPCalendarThemePart
  362. {
  363. public:
  364. enum XTPEnumCalendarItemState
  365. {
  366. xtpCalendarItemState_Normal     = 0,
  367. xtpCalendarItemState_Selected   = 0x001,
  368. xtpCalendarItemState_Today      = 0x002,
  369. xtpCalendarItemState_Hot        = 0x004,
  370. xtpCalendarItemState_mask       = 0x00F,
  371. xtpCalendarItemFirst            = 0x010,
  372. xtpCalendarItemLast             = 0x020,
  373. };
  374. struct _XTP_EXT_CLASS CHeaderText
  375. {
  376. CThemeFontColorSetValue fcsetNormal;
  377. CThemeFontColorSetValue fcsetSelected;
  378. CThemeFontColorSetValue fcsetToday;
  379. CThemeFontColorSetValue fcsetTodaySelected;
  380. virtual CThemeFontColorSet* GetFontColor(int nItemState);
  381. virtual void CopySettings(const CHeaderText& rSrc);
  382. virtual void doPX(CXTPPropExchange* pPX, LPCTSTR pcszPropName, CXTPCalendarTheme* pTheme);
  383. virtual void Serialize(CArchive& ar);
  384. };
  385. struct _XTP_EXT_CLASS CHeaderBackground
  386. {
  387. CXTPCalendarThemeIntValue   nBitmapID;
  388. CXTPCalendarThemeRectValue  rcBitmapBorder;
  389. // effects ...
  390. // CXTPCalendarThemeIntValue eDrawOptions;
  391. //
  392. // CXTPCalendarThemeBOOLValue bFillBySelectedColorBeforeDraw;
  393. // CXTPCalendarThemeBOOLValue bFillTextBySelectedColorAfterDraw;
  394. virtual void CopySettings(const CHeaderBackground& rSrc)
  395. {
  396. nBitmapID.CopySettings(rSrc.nBitmapID);
  397. rcBitmapBorder.CopySettings(rSrc.rcBitmapBorder);
  398. }
  399. virtual void doPX(CXTPPropExchange* pPX, LPCTSTR pcszPropName, CXTPCalendarTheme* pTheme);
  400. virtual void Serialize(CArchive& ar);
  401. };
  402. //===========================================
  403. CXTPPaintManagerColor m_clrBaseColor;
  404. CXTPPaintManagerColor m_clrTodayBaseColor;
  405. CHeaderBackground   m_bkNormal;
  406. CHeaderBackground   m_bkSelected;
  407. CHeaderBackground   m_bkToday;
  408. CHeaderBackground   m_bkTodaySelected;
  409. CHeaderText  m_TextLeftRight;
  410. CHeaderText  m_TextCenter;
  411. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  412. virtual void RefreshFromParent(CTOHeader* pParentSrc);
  413. virtual void DoPropExchange(CXTPPropExchange* pPX);
  414. virtual void Serialize(CArchive& ar);
  415. virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect){};
  416. virtual int CalcHeight(CDC* pDC, int nCellWidth);
  417. //-------------------------------------------------------------------
  418. virtual BOOL IsToday(CXTPCalendarViewDay* pViewDay);
  419. virtual BOOL IsSelected(CXTPCalendarViewDay* pViewDay);
  420. virtual BOOL IsSelected(CXTPCalendarViewGroup* pViewGroup);
  421. //-------------------------------------------------------------------
  422. virtual void Draw_Header(CDC* pDC, const CRect& rcRect, int nFlags,
  423.  LPCTSTR pcszLeftText, LPCTSTR pcszCenterText = NULL, LPCTSTR pcszRightText = NULL);
  424. virtual void Draw_Background(CDC* pDC, const CRect& rcRect, int nState);
  425. virtual void Draw_TextLR(CDC* pDC, const CRect& rcRect, int nFlags,
  426.  LPCTSTR pcszText, UINT uFormat, int* pnWidth = NULL);
  427. virtual void Draw_TextCenter(CDC* pDC, const CRect& rcRect, int nState,
  428.  LPCTSTR pcszCenterText, int* pnWidth = NULL);
  429. DECLARE_THEMEPART_MEMBER_BASE(CTOFormula_MulDivC, HeightFormula)
  430. protected:
  431. };
  432. class _XTP_EXT_CLASS CTOEvent : virtual public CXTPCalendarThemePart
  433. {
  434. public:
  435. virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect, int nEventPlaceNumber){};
  436. virtual int CalcMinEventHeight(CDC* pDC) {return 19;};
  437. DECLARE_THEMEPART_MEMBER_BASE2(CTOFormula_MulDivC, HeightFormula)
  438. DECLARE_THEMEPART_MEMBER_BASE2(CTOEventIconsToDraw, EventIconsToDraw)
  439. };
  440. class _XTP_EXT_CLASS CTODay : virtual public CXTPCalendarThemePart
  441. {
  442. public:
  443. virtual int GetExpandButtonHeight();
  444. virtual int HitTestExpandDayButton(CXTPCalendarViewDay* pViewDay, const CPoint* pPoint = NULL); // return 0 or xtpCalendarHitTestDayExpandButton
  445. protected:
  446. virtual int _HitTestExpandDayButton(CXTPCalendarViewDay* pViewDay, const CRect& rc, const CPoint* pPoint = NULL); // return 0 or xtpCalendarHitTestDayExpandButton
  447. };
  448. /////////////////////////////////////////////////////////////////////////
  449. //
  450. // *** DayView theme parts ***
  451. //
  452. // Parts Hierarchy:
  453. //   *Theme                    CXTPCalendarTheme
  454. //   *--Header*                 CTOHeader
  455. //   *--Event*                  CTOEvent
  456. //
  457. //   *--DayView                 CTODayView
  458. //   *----Event*                CTODayViewEvent
  459. //   *----Header                CTOHeader
  460. //   *----TimeScale             CTODayViewTimeScale
  461. //   *----Day                   CTODayViewDay
  462. //   *------Header              CTODayViewDayHeader
  463. //   *------Group               CTODayViewDayGroup
  464. //   *--------Header            CTODayViewDayGroupHeader
  465. //   *--------AllDayEvents      CTODayViewDayGroupAllDayEvents
  466. //   *--------Cell              CTODayViewDayGroupCell
  467. //   *--------MultiDayEvent     CTODayViewEvent_MultiDay
  468. //   *--------SingleDayEvent    CTODayViewEvent_SingleDay
  469. //
  470. /////////////////////////////////////////////////////////////////////////
  471. /////////////////////////////////////////////////////////////////////////
  472. // DayView Time Scale
  473. class _XTP_EXT_CLASS CTODayViewTimeScale : virtual public CXTPCalendarThemePart
  474. {
  475. public:
  476. CXTPPaintManagerColor   m_clrBackground;
  477. CXTPPaintManagerColor   m_clrLine;
  478. CThemeFontColorSetValue m_fcsetCaption;
  479. CThemeFontColorSetValue m_fcsetAMPM;
  480. CThemeFontColorSetValue m_fcsetSmall;
  481. CThemeFontColorSetValue m_fcsetBigBase;
  482. CXTPPaintManagerColorGradient m_grclrNowLineBk;
  483. CXTPPaintManagerColor         m_clrNowLine;
  484. CXTPCalendarThemeBOOLValue m_ShowMinutes;
  485. DECLARE_THEMEPART_MEMBER_BASE(CTOFormula_MulDivC, HeightFormula)
  486. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  487. virtual void DoPropExchange(CXTPPropExchange* pPX);
  488. virtual void Serialize(CArchive& ar);
  489. virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect);
  490. virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  491. virtual int CalcMinRowHeight(CDC* pDC, CXTPCalendarDayViewTimeScale* pTimeScale);
  492. virtual int CalcWidth(CDC* pDC, CXTPCalendarDayViewTimeScale* pTimeScale, int nRowHeight);
  493. virtual int CalcWidth_AmPmMinutesPart(CDC* pDC, CXTPCalendarDayViewTimeScale* pTimeScale, int* pnCharWidth = NULL);
  494. virtual int GetRightOffsetX(CDC* pDC, CXTPCalendarDayViewTimeScale* pTimeScale);
  495. public:
  496. virtual void Draw_SmallHourCell(CDC* pDC, CXTPCalendarDayViewTimeScale* pTimeScale,
  497. const CRect& rcCell,
  498. const CString& strPart1, const CString& strPart2,
  499. CThemeFontColorSetValue* pfcsetPart1,
  500. CThemeFontColorSetValue* pfcsetPart2,
  501. CXTPPropsStateContext& autoStateCnt,
  502. XTP_CALENDAR_THEME_DAYVIEWTIMESCALECELL_PARAMS& tsCell);
  503. virtual void Draw_BigHourCell(CDC* pDC, CXTPCalendarDayViewTimeScale* pTimeScale,
  504.   const CRect& rcCell, int nRowPerHour,
  505.   const CString& strHour, const CString& strMinAmPm,
  506.   CThemeFontColorSetValue* pfcsetHour,
  507.   CThemeFontColorSetValue* pfcsetMinAmPm,
  508.   CXTPPropsStateContext& autoStateCnt,
  509.   XTP_CALENDAR_THEME_DAYVIEWTIMESCALECELL_PARAMS& tsCell);
  510. virtual void Draw_Caption(CDC* pDC, const CRect& rcRect, const CString& strCaption,
  511.   CThemeFontColorSetValue* pfcsetCaption);
  512. virtual CRect Calc_NowLineRect(CDC* pDC, CXTPCalendarDayViewTimeScale* pTimeScale);
  513. virtual void Draw_NowLineBk(CDC* pDC, const CRect& rcRect);
  514. virtual void Draw_NowLine(CDC* pDC, const CRect& rcRect);
  515. virtual BOOL IsDrawNowLine(CDC* pDC, CXTPCalendarDayViewTimeScale* pTS);
  516. CTODayViewTimeScale()
  517. {
  518. m_nWidthAmPmMinutesPart_ = 0;
  519. m_nCharWidthAmPmMinutesPart_ = 0;
  520. }
  521. protected:
  522. CThemeFontColorSetValue m_fcsetBigHour_;
  523. int  m_nWidthAmPmMinutesPart_;
  524. int  m_nCharWidthAmPmMinutesPart_;
  525. CTOFormula_MulDivC m_hflaBigHourFont;
  526. virtual void AdjustBigHourFont(CDC* pDC, const CRect& rcRowCell);
  527. virtual void RefreshBigHourFontIfNeed(BOOL bRefreshToStandard);
  528. struct XTP_LC_TIMEFORMAT
  529. {
  530. XTP_LC_TIMEFORMAT();
  531. virtual void RefreshMetrics();
  532. BOOL    bAMPM_timeFormat;
  533. BOOL    bLeadingZeroTime;
  534. CString strSeparator;
  535. CString strAM;
  536. CString strPM;
  537. };
  538. XTP_LC_TIMEFORMAT   m_localeTimeFormat;
  539. CString FormatTime(XTP_LC_TIMEFORMAT& lcTimeFormat, COleDateTime dtTime,
  540. BOOL bAmPmEnshure, CString& rstrHour, CString& rstrMin, CString& rstrAmPm);
  541. };
  542. friend class CTODayViewTimeScale;
  543. /////////////////////////////////////////////////////////////////////////
  544. // Day View Events (different types)
  545. class _XTP_EXT_CLASS CTODayViewEvent : virtual public CTOEvent
  546. {
  547. public:
  548. virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect, int nEventPlaceNumber);
  549. };
  550. friend class CTODayViewEvent;
  551. //==========================================================================
  552. class _XTP_EXT_CLASS CTODayViewEvent_MultiDay : virtual public CTODayViewEvent
  553. {
  554. public:
  555. virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect, int nEventPlaceNumber);
  556. virtual void CalcEventYs(CRect& rcRect, int nEventPlaceNumber){};
  557. };
  558. friend class CTODayViewEvent_MultiDay;
  559. //==========================================================================
  560. class _XTP_EXT_CLASS CTODayViewEvent_SingleDay : virtual public CTODayViewEvent
  561. {
  562. public:
  563. virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect, int nEventPlaceNumber);
  564. virtual CBrush* GetBusyStatusBrush(int nBusyStatus);
  565. virtual void SetBusyStatusBrush(int nBusyStatus, CBrush* pBrush, BOOL bAutodeleteBrush);
  566. virtual void DrawShadow(CDC* pDC, CXTPCalendarDayViewEvent* pViewEvent){};
  567. protected:
  568. virtual void InitBusyStatusDefaultColors();
  569. virtual CXTPCalendarViewPartBrushValue* _GetBusyStatusBrushValue(int nBusyStatus, BOOL bCreateIfNotExist);
  570. CXTPCalendarTypedPtrAutoDeleteMap<int, CXTPCalendarViewPartBrushValue*> m_mapBusyStatusBrushes;
  571. CBitmap     m_bmpTentativePattern;  // Stores standard bitmap pattern to draw Tentative event busy status.
  572. CBrush      m_brushTentative;       // Stores standard brush to draw Tentative event busy status.
  573. };
  574. friend class CTODayViewEvent_SingleDay;
  575. /////////////////////////////////////////////////////////////////////////
  576. // DayView Resource Group
  577. class _XTP_EXT_CLASS CTODayViewDayGroupHeader : virtual public CTOHeader
  578. {
  579. public:
  580. };
  581. friend class CTODayViewDayGroupHeader;
  582. //=======================================================================
  583. class _XTP_EXT_CLASS CTODayViewDayGroupAllDayEvents : virtual public CXTPCalendarThemePart
  584. {
  585. public:
  586. CXTPPaintManagerColor         m_clrBackground;
  587. CXTPPaintManagerColor         m_clrBackgroundSelected;
  588. CXTPPaintManagerColor         m_clrBottomBorder;
  589. virtual void DoPropExchange(CXTPPropExchange* pPX);
  590. virtual void Serialize(CArchive& ar);
  591. virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  592. virtual void SetDynColors(CXTPCalendarDayViewGroup* pViewGroup){};
  593. };
  594. friend class CTODayViewDayGroupAllDayEvents;
  595. //=======================================================================
  596. class _XTP_EXT_CLASS CTODayViewDayGroupCell : virtual public CXTPCalendarThemePart
  597. {
  598. public:
  599. struct XTP_GROUP_CELL_COLOR_SET
  600. {
  601. CXTPPaintManagerColor clrBackground;
  602. CXTPPaintManagerColor clrBorderBottomInHour;
  603. CXTPPaintManagerColor clrBorderBottomHour;
  604. CXTPPaintManagerColor clrSelected;
  605. void doPX(CXTPPropExchange* pPX, LPCTSTR pcszPropName, CXTPCalendarTheme* pTheme);
  606. virtual void Serialize(CArchive& ar);
  607. };
  608. XTP_GROUP_CELL_COLOR_SET m_clrsetWorkCell;
  609. XTP_GROUP_CELL_COLOR_SET m_clrsetNonWorkCell;
  610. virtual void DoPropExchange(CXTPPropExchange* pPX);
  611. virtual void Serialize(CArchive& ar);
  612. virtual void Draw(CDC* pDC, const CRect& rcRect,
  613.   const XTP_CALENDAR_THEME_DAYVIEWCELL_PARAMS& cellParams, CXTPPropsStateContext* pStateCnt = NULL);
  614. virtual int CalcHeight(CDC* pDC, int nCellWidth) {return 19;} // pDayView->CalculateHeaderFormatAndHeight(pDC, nCellWidth);
  615. };
  616. friend class CTODayViewDayGroupCell;
  617. //=======================================================================
  618. class _XTP_EXT_CLASS CTODayViewDayGroup : virtual public CXTPCalendarThemePart
  619. {
  620. public:
  621. CXTPPaintManagerColor         m_clrBorderLeft;
  622. virtual void DoPropExchange(CXTPPropExchange* pPX);
  623. virtual void Serialize(CArchive& ar);
  624. virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect);
  625. virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  626. virtual BOOL IsSelected(CXTPCalendarViewGroup* pViewGroup){return FALSE;};
  627. DECLARE_THEMEPART_MEMBER_BASE(CTODayViewDayGroupHeader,         Header)
  628. DECLARE_THEMEPART_MEMBER_BASE(CTODayViewDayGroupAllDayEvents,   AllDayEvents)
  629. DECLARE_THEMEPART_MEMBER_BASE(CTODayViewDayGroupCell,           Cell)
  630. DECLARE_THEMEPART_MEMBER_BASE(CTODayViewEvent_MultiDay,         MultiDayEvent)
  631. DECLARE_THEMEPART_MEMBER_BASE(CTODayViewEvent_SingleDay,        SingleDayEvent)
  632. virtual int HitTestScrollButton(CXTPCalendarDayViewGroup* pViewGroup, const CPoint* pPoint = NULL); // return 0 or ... flag
  633. virtual CRect GetScrollButtonRect(const CXTPCalendarDayViewGroup::XTP_DAY_VIEW_GROUP_LAYOUT& groupLayout, int nButton) = 0;
  634. protected:
  635. virtual void AdjustDayEvents(CXTPCalendarDayViewGroup* pDayViewGroup, CDC* pDC);
  636. };
  637. friend class CTODayViewDayGroup;
  638. /////////////////////////////////////////////////////////////////////////
  639. // DayView day theme part
  640. class _XTP_EXT_CLASS CTODayViewDayHeader : virtual public CTOHeader
  641. {
  642. public:
  643. virtual void Draw(CCmdTarget* pObject, CDC* pDC){};
  644. };
  645. friend class CTODayViewDayHeader;
  646. //==========================================================================
  647. class _XTP_EXT_CLASS CTODayViewDay : virtual public CXTPCalendarThemePart
  648. {
  649. public:
  650. virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect);
  651. virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  652. virtual CRect ExcludeDayBorder(CXTPCalendarDayViewDay* pDayViewDay, const CRect& rcDay) {return rcDay;};
  653. virtual void Draw_DayBorder(CXTPCalendarDayViewDay* pDayViewDay, CDC* pDC) {};
  654. DECLARE_THEMEPART_MEMBER_BASE(CTODayViewDayHeader,          Header)
  655. DECLARE_THEMEPART_MEMBER_BASE(CTODayViewDayGroup,           Group)
  656. };
  657. friend class CTODayViewDay;
  658. /////////////////////////////////////////////////////////////////////////
  659. // DayView theme part object
  660. class _XTP_EXT_CLASS CTODayView : virtual public CXTPCalendarThemePart
  661. {
  662. public:
  663. virtual void AdjustLayout(CDC* pDC, const CRect& rcRect);
  664. virtual void OnPostAdjustLayout();
  665. virtual void Draw(CDC* pDC);
  666. DECLARE_THEMEPART_MEMBER_BASE(CTOHeader,            Header)
  667. DECLARE_THEMEPART_MEMBER_BASE(CTODayViewEvent,      Event)
  668. DECLARE_THEMEPART_MEMBER_BASE(CTODayViewTimeScale,  TimeScale)
  669. DECLARE_THEMEPART_MEMBER_BASE(CTODayViewDay, Day)
  670. // theme specific control options
  671. virtual BOOL IsUseCellAlignedDraggingInTimeArea() {return FALSE;};
  672. protected:
  673. virtual int CalcMinCellHeight(CDC* pDC, CXTPCalendarDayView* pDayView);
  674. };
  675. friend class CTODayView;
  676. /////////////////////////////////////////////////////////////////////////
  677. //
  678. // *** MonthView theme parts ***
  679. //
  680. // Parts Hierarchy:
  681. //   *Theme                    CXTPCalendarTheme
  682. //   *--Header*                 CTOHeader
  683. //   *--Event*                  CTOEvent
  684. //
  685. //   *--MonthView               CTOMonthView
  686. //   *----Event*                CTOMonthViewEvent
  687. //   *----Header*               CTOHeader
  688. //   *----WeekDayHeader         CTOMonthViewWeekDayHeader
  689. //   *----Day                   CTOMonthViewDay
  690. //   *------Header              CTOMonthViewDayHeader
  691. //   *------MultiDayEvent       CTOMonthViewEvent_MultiDay
  692. //   *------SingleDayEvent      CTOMonthViewEvent_SingleDay
  693. //
  694. /////////////////////////////////////////////////////////////////////////
  695. class _XTP_EXT_CLASS CTOMonthViewEvent : virtual public CTOEvent
  696. {
  697. public:
  698. //virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect);
  699. //virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  700. };
  701. friend class CTOMonthViewEvent;
  702. //------------------------------------------
  703. class _XTP_EXT_CLASS CTOMonthViewEvent_SingleDay : virtual public CTOMonthViewEvent
  704. {
  705. public:
  706. //virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect, int nEventPlaceNumber);
  707. //virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  708. };
  709. friend class CTOMonthViewEvent_SingleDay;
  710. //------------------------------------------
  711. class _XTP_EXT_CLASS CTOMonthViewEvent_MultiDay : virtual public CTOMonthViewEvent
  712. {
  713. public:
  714. //virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect);
  715. //virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  716. };
  717. friend class CTOMonthViewEvent_MultiDay;
  718. //==========================================================================
  719. class _XTP_EXT_CLASS CTOMonthViewDayHeader : virtual public CTOHeader
  720. {
  721. //virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect);
  722. //virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  723. };
  724. friend class CTOMonthViewDayHeader;
  725. //==========================================================================
  726. class _XTP_EXT_CLASS CTOMonthViewDay : virtual public CTODay //virtual public CXTPCalendarThemePart
  727. {
  728. public:
  729. virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect);
  730. //virtual void Draw(CCmdTarget* pObject, CDC* pDC){};
  731. DECLARE_THEMEPART_MEMBER_BASE(CTOMonthViewDayHeader,       Header);
  732. DECLARE_THEMEPART_MEMBER_BASE(CTOMonthViewEvent_MultiDay,  MultiDayEvent);
  733. DECLARE_THEMEPART_MEMBER_BASE(CTOMonthViewEvent_SingleDay, SingleDayEvent);
  734. };
  735. friend class CTOMonthViewDay;
  736. //==========================================================================
  737. class _XTP_EXT_CLASS CTOMonthViewWeekDayHeader : virtual public CTOHeader
  738. {
  739. public:
  740. //virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect);
  741. //virtual void Draw(CCmdTarget* pObject, CDC* pDC){};
  742. };
  743. friend class CTOMonthViewWeekDayHeader;
  744. /////////////////////////////////////////////////////////////////////////
  745. // MonthView theme part object
  746. class _XTP_EXT_CLASS CTOMonthView : virtual public CXTPCalendarThemePart
  747. {
  748. public:
  749. virtual void AdjustLayout(CDC* pDC, const CRect& rcRect, BOOL bCallPostAdjustLayout);
  750. virtual void Draw(CDC* pDC);
  751. DECLARE_THEMEPART_MEMBER_BASE(CTOHeader,            Header);
  752. DECLARE_THEMEPART_MEMBER_BASE(CTOMonthViewEvent,    Event);
  753. DECLARE_THEMEPART_MEMBER_BASE(CTOMonthViewWeekDayHeader,        WeekDayHeader);
  754. DECLARE_THEMEPART_MEMBER_BASE(CTOMonthViewDay,      Day);
  755. };
  756. friend class CTOMonthView;
  757. /////////////////////////////////////////////////////////////////////////
  758. //
  759. // *** WeekView theme parts ***
  760. //
  761. // Parts Hierarchy:
  762. //   *Theme                    CXTPCalendarTheme
  763. //   *--Event*                  CTOEvent
  764. //
  765. //   *--WeekView                CTOWeekView
  766. //   *----Event*                CTOWeekViewEvent
  767. //   *----Day                   CTOWeekViewDay
  768. //   *------DayHeader           CTOWeekViewDayHeader
  769. //   *------MultiDayEvent       CTOWeekViewEvent_MultiDay
  770. //   *------SingleDayEvent      CTOWeekViewEvent_SingleDay
  771. //
  772. /////////////////////////////////////////////////////////////////////////
  773. // === WeekViewEvent ===
  774. class _XTP_EXT_CLASS CTOWeekViewEvent : virtual public CTOEvent
  775. {
  776. public:
  777. //virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect, int nEventPlaceNumber);
  778. //virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  779. };
  780. friend class CTOWeekViewEvent;
  781. // --- WeekViewEvent_SingleDay ---
  782. class _XTP_EXT_CLASS CTOWeekViewEvent_SingleDay : virtual public CTOWeekViewEvent
  783. {
  784. public:
  785. //virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect);
  786. //virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  787. };
  788. friend class CTOWeekViewEvent_SingleDay;
  789. // --- WeekViewEvent_MultiDay ---
  790. class _XTP_EXT_CLASS CTOWeekViewEvent_MultiDay : virtual public CTOWeekViewEvent
  791. {
  792. public:
  793. //virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect);
  794. //virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  795. };
  796. friend class CTOWeekViewEvent_MultiDay;
  797. // === WeekViewDayHeader ===
  798. class _XTP_EXT_CLASS CTOWeekViewDayHeader : virtual public CTOHeader
  799. {
  800. //virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect);
  801. //virtual void Draw(CCmdTarget* pObject, CDC* pDC);
  802. };
  803. friend class CTOWeekViewDayHeader;
  804. // === WeekViewDay ===
  805. class _XTP_EXT_CLASS CTOWeekViewDay : virtual public CTODay
  806. {
  807. public:
  808. virtual void AdjustLayout(CCmdTarget* pObject, CDC* pDC, const CRect& rcRect);
  809. //virtual void Draw(CCmdTarget* pObject, CDC* pDC){};
  810. DECLARE_THEMEPART_MEMBER_BASE(CTOWeekViewDayHeader,       Header);
  811. DECLARE_THEMEPART_MEMBER_BASE(CTOWeekViewEvent_MultiDay,  MultiDayEvent);
  812. DECLARE_THEMEPART_MEMBER_BASE(CTOWeekViewEvent_SingleDay, SingleDayEvent);
  813. virtual int GetDayCol(CXTPCalendarWeekViewDay* pWVDay); // returns {0, 1}
  814. virtual void SetDynColors(CXTPCalendarWeekViewDay* pWViewDay) {};
  815. };
  816. friend class CTOWeekViewDay;
  817. // ===== WeekView theme part object =====
  818. class _XTP_EXT_CLASS CTOWeekView : virtual public CXTPCalendarThemePart
  819. {
  820. public:
  821. virtual void AdjustLayout(CDC* pDC, const CRect& rcRect, BOOL bCallPostAdjustLayout);
  822. virtual void Draw(CDC* pDC);
  823. //DECLARE_THEMEPART_MEMBER_BASE(CTOHeader, Header);
  824. DECLARE_THEMEPART_MEMBER_BASE(CTOWeekViewEvent,         Event);
  825. DECLARE_THEMEPART_MEMBER_BASE(CTOWeekViewDay,           Day);
  826. };
  827. friend class CTOWeekView;
  828. //=======================================================================
  829. /////////////////////////////////////////////////////////////////////////
  830. class _XTP_EXT_CLASS CTOColorsSet : virtual public CXTPCalendarThemePart
  831. {
  832. public:
  833. CTOColorsSet();
  834. virtual void RefreshMetrics(BOOL bRefreshChildren = TRUE);
  835. virtual COLORREF GetColor(int nColorID, COLORREF clrBase = (COLORREF)-1);
  836. virtual int GetScale(int nColorID);//, BOOL& rbHSL);
  837. virtual CString GetName(int nColorID);
  838. virtual void SetColor(int nColorID, LPCTSTR pcszName, int nScale);
  839. virtual void SetCLR_DarkenOffset(int nCLR_DarkenOffset);
  840. //      virtual void SetColorEx(int eCLR, COLORREF clrColor);
  841. //      virtual void CrearColorsEx();
  842. //virtual void SetColorHSL(int eCLR, int nLshift);
  843. protected:
  844. COLORREF m_clrBase;
  845. int m_nCLR_DarkenOffset;
  846. struct _XTP_EXT_CLASS SColorInfo
  847. {
  848. int     nID;
  849. TCHAR   szName[128];
  850. int     nScale;
  851. //COLORREF rgbColor;
  852. };
  853. //typedef CMap<int, int, int, int> CScalesMap;
  854. typedef CMap<int, int, SColorInfo, SColorInfo&> CColorInfoMap;
  855. CColorInfoMap m_mapColors;
  856. //CScalesMap m_mapScale;
  857. //CScalesMap m_mapHSLShift;
  858. };
  859. /////////////////////////////////////////////////////////////////////////
  860. //
  861. // *** Common Theme members ***
  862. //
  863. /////////////////////////////////////////////////////////////////////////
  864. // This base settings which used to initialize other settings by default.
  865. CXTPPaintManagerColor       m_clrBaseColor;
  866. CXTPCalendarThemeFontValue  m_fntBaseFont;
  867. CXTPCalendarThemeFontValue  m_fntBaseFontBold;
  868. DECLARE_THEMEPART_MEMBER_BASE(CTOColorsSet, ColorsSet)
  869. virtual COLORREF GetColor(int eCLR, COLORREF clrBase = (COLORREF)-1) { ASSERT(FALSE); return 0; };
  870. virtual COLORREF GetColor2(LPCTSTR pcszColorName, COLORREF clrDefault) { ASSERT(FALSE); return 0; };
  871. virtual CXTPOffice2007Image* GetBitmap(LPCTSTR pcszStdBmpName);
  872. DECLARE_THEMEPART_MEMBER_BASE(CTOHeader,    Header)
  873. DECLARE_THEMEPART_MEMBER_BASE(CTOEvent,     Event)
  874. //==========================================================================
  875. DECLARE_THEMEPART_MEMBER_BASE(CTODayView,   DayView)
  876. DECLARE_THEMEPART_MEMBER_BASE(CTOWeekView,  WeekView)
  877. DECLARE_THEMEPART_MEMBER_BASE(CTOMonthView, MonthView)
  878. virtual void RefreshMetrics();
  879. virtual void DoPropExchange(CXTPPropExchange* pPX);
  880. virtual CXTPImageManager* GetCustomIconsList() const;
  881. virtual CXTPOffice2007ImageList* GetImageList() const;
  882. virtual DWORD GetBeforeDrawFlags() const;
  883. virtual void SetBeforeDrawFlags(DWORD dwBeforeDrawFlags);
  884. virtual BOOL IsBeforeDraw(int eFlag) const;
  885. virtual DWORD GetAskItemTextFlags() const;
  886. virtual void SetAskItemTextFlags(DWORD dwFlags);
  887. virtual XTPCalendarTheme GetPaintTheme() const;
  888. virtual void SetPaintTheme(XTPCalendarTheme ePaintTheme);
  889. public:
  890. static BOOL IsXPTheme();
  891. // draw a single line text in the center of the rect.
  892. // if rect width is not enough to draw all chars -
  893. // text is aligned to left (or right, see nFormat) or the rect.
  894. // nFormat = 0 or combination of flags: DT_VCENTER, DT_LEFT, DT_RIGHT.
  895. static CSize DrawLine_CenterLR(CDC* pDC, LPCTSTR pcszText, CRect& rcRect, UINT nFormat);
  896. // draw text1 and text2 as single line using different fonts.
  897. // See Also: DrawLine_CenterLR
  898. static CSize DrawLine2_CenterLR(CDC* pDC, LPCTSTR pcszText1, LPCTSTR pcszText2,
  899.    CThemeFontColorSet* pFontColor1, CThemeFontColorSet* pFontColor2,
  900.    CRect& rcRect, UINT nShortAlign = DT_VCENTER | DT_LEFT,
  901.    UINT nFullAlign = DT_VCENTER | DT_CENTER);
  902. // draw rect with round corners and fill it using grclrBk.
  903. static void DrawRoundRect(CDC* pDC, const CRect& rcRect, COLORREF clrBorder,
  904. BOOL bBoldBorder, CXTPPaintManagerColorGradient& grclrBk);
  905. static void DrawRoundRect(CDC* pDC, const CRect& rcRect, COLORREF clrBorder,
  906. BOOL bBoldBorder, CBrush* pBrushBk);
  907. // fill rect using grclrBk and draw rect sides specified by isBorders.
  908. // isBorders.top  = 0 - do not draw top side, 1 - draw;
  909. // isBorders.left = 0 - do not draw left side, 1 - draw;
  910. // ...
  911. static void DrawRectPartly(CDC* pDC, const CRect& rcRect, COLORREF clrBorder,
  912. int nBorderWidth, CRect isBorders);
  913. static void DrawRectPartly(CDC* pDC, const CRect& rcRect, COLORREF clrBorder,
  914. BOOL bBoldBorder, CXTPPaintManagerColorGradient& grclrBk,
  915. CRect isBorders);
  916. //const CRect& isBorders);
  917. static const int cnCornerSize;
  918. public:
  919. static CXTPCalendarView::XTP_VIEW_LAYOUT& AFX_CDECL GetViewLayout(CXTPCalendarView* pView);
  920. static CXTPCalendarViewDay::XTP_VIEW_DAY_LAYOUT& AFX_CDECL GetViewDayLayout(CXTPCalendarViewDay* pViewDay);
  921. static CXTPCalendarDayView::XTP_DAY_VIEW_LAYOUT& AFX_CDECL GetDayViewLayout(CXTPCalendarDayView* pDayView);
  922. static CXTPCalendarDayViewTimeScale::XTP_TIMESCALE_LAYOUT& AFX_CDECL GetTimeScaleLayout(CXTPCalendarDayViewTimeScale* pTimeScale);
  923. static CXTPCalendarViewGroup::XTP_VIEW_GROUP_LAYOUT& AFX_CDECL GetViewGroupLayout(CXTPCalendarViewGroup* pViewGroup);
  924. static CXTPCalendarDayViewGroup::XTP_DAY_VIEW_GROUP_LAYOUT& AFX_CDECL GetDayViewGroupLayout(CXTPCalendarDayViewGroup* pDayViewGroup);
  925. static CXTPCalendarWeekView::XTP_WEEK_VIEW_LAYOUT& AFX_CDECL GetWeekViewLayout(CXTPCalendarWeekView* pWeekView);
  926. //-----------------------------------------------------------------------
  927. // Summary:
  928. //     This member operator is use to copy standard and custom values.
  929. // Remarks:
  930. //     The standard value is always copied from the specified source.
  931. //     The custom value copied from the source only if this object has
  932. //     no custom value and the source object has custom value set.
  933. //-----------------------------------------------------------------------
  934. static void AFX_CDECL CopySettings(CXTPPaintManagerColor& refDest, const CXTPPaintManagerColor& refSrc);
  935. static void AFX_CDECL CopySettings(CXTPPaintManagerColorGradient& refDest, const CXTPPaintManagerColorGradient& refSrc); // <combine CopySettings@CXTPPaintManagerColor&@const CXTPPaintManagerColor&>
  936. static CFont* AFX_CDECL GetMaxHeightFont(CArray<CFont*, CFont*>& arFonts, CDC* pDC = NULL, int* pnMaxHeight = NULL);
  937. public:
  938. virtual CXTPCalendarViewEventSubjectEditor* StartEditSubject(CXTPCalendarViewEvent* pViewEvent) {return NULL;};
  939. virtual void RemoveBoldAttrFromStd(CXTPCalendarThemeFontValue& rFont);
  940. // for internal usage
  941. enum XTPEnumThemeStdImages
  942. {
  943. xtpIMG_DayViewHeader            = -100,
  944. xtpIMG_DayViewHeaderTooday      = -101,
  945. xtpIMG_DayViewGroupHeader       = -102,
  946. xtpIMG_MonthViewDayHeader       = -120,
  947. xtpIMG_MonthViewDayHeaderToday  = -121,
  948. //xtpIMG_MonthViewWeekDayHeader   = 0, //-122, // the base color is enough for default WeekDay header
  949. xtpIMG_MonthViewWeekHeader      = -123,
  950. xtpIMG_WeekViewDayHeader        = -130,
  951. xtpIMG_ExpandDayButtons         = -140,
  952. xtpIMG_PrevNextEventButtons     = -150,
  953. };
  954. protected:
  955. virtual void RefreshMetrics(BOOL bRefreshChildren);
  956. virtual void _DoPropExchange(CXTPPropExchange* pPX, BOOL bExchangeChildren);
  957. static void _DrawRoundRect(CDC* pDC, const CRect& rcRect, COLORREF clrBorder,BOOL bBoldBorder,
  958.    CXTPPaintManagerColorGradient* pgrclrBk, CBrush* pBrushBk);
  959. virtual BOOL _LoadStdBitmap(int nBmpID, LPCTSTR pcszStdBmpName);
  960. public:
  961. virtual CRect DrawExpandDayButton(CDC* pDC, const CRect& rc, BOOL bUp, BOOL bHot);
  962. virtual BOOL ExpandDayButton_HitTest(const CPoint& pt, const CRect& rc, BOOL bUp);
  963. virtual CSize GetExpandDayButtonSize();
  964. protected:
  965. CXTPImageManager* m_pCustomIcons;
  966. CXTPOffice2007ImageList*    m_pImageList;
  967. CXTPOffice2007Images*       m_pImagesStd;
  968. DWORD   m_dwBeforeDrawFlags;
  969. DWORD   m_dwAskItemTextFlags;
  970. XTPCalendarTheme m_nPaintTheme;
  971. protected:
  972. };
  973. //}}AFX_CODEJOCK_PRIVATE
  974. /////////////////////////////////////////////////////////////////////////////
  975. AFX_INLINE BOOL CXTPCalendarThemePart::IsCreated() {
  976. return !!m_pTheme;
  977. }
  978. AFX_INLINE CXTPCalendarControl* CXTPCalendarTheme::GetCalendarControl() {
  979. return m_pCalendar;
  980. }
  981. AFX_INLINE void CXTPCalendarTheme::SetCalendarControl(CXTPCalendarControl* pCalendar) {
  982. if (!pCalendar && m_pCalendar)
  983. OnDetachCalendar();
  984. m_pCalendar = pCalendar;
  985. }
  986. AFX_INLINE void CXTPCalendarTheme::RefreshMetrics() {
  987. RefreshMetrics(TRUE);
  988. }
  989. AFX_INLINE void CXTPCalendarTheme::CTOColorsSet::SetCLR_DarkenOffset(int nCLR_DarkenOffset) {
  990. m_nCLR_DarkenOffset = nCLR_DarkenOffset;
  991. }
  992. AFX_INLINE DWORD CXTPCalendarTheme::GetBeforeDrawFlags() const {
  993. return m_dwBeforeDrawFlags;
  994. }
  995. AFX_INLINE BOOL CXTPCalendarTheme::IsBeforeDraw(int eFlag) const {
  996. return 0 != (m_dwBeforeDrawFlags & eFlag);
  997. }
  998. AFX_INLINE void CXTPCalendarTheme::SetBeforeDrawFlags(DWORD dwBeforeDrawFlags) {
  999. m_dwBeforeDrawFlags = dwBeforeDrawFlags;
  1000. }
  1001. AFX_INLINE DWORD CXTPCalendarTheme::GetAskItemTextFlags() const {
  1002. return m_dwAskItemTextFlags;
  1003. }
  1004. AFX_INLINE void CXTPCalendarTheme::SetAskItemTextFlags(DWORD dwFlags) {
  1005. m_dwAskItemTextFlags = dwFlags;
  1006. }
  1007. AFX_INLINE BOOL CXTPCalendarTheme::IsXPTheme()
  1008. {
  1009. return XTPColorManager()->GetCurrentSystemTheme() != xtpSystemThemeUnknown;
  1010. }
  1011. AFX_INLINE CXTPImageManager* CXTPCalendarTheme::GetCustomIconsList() const {
  1012. return m_pCustomIcons;
  1013. }
  1014. AFX_INLINE CXTPOffice2007ImageList* CXTPCalendarTheme::GetImageList() const {
  1015. return m_pImageList;
  1016. }
  1017. AFX_INLINE XTPCalendarTheme CXTPCalendarTheme::GetPaintTheme() const {
  1018. return m_nPaintTheme;
  1019. }
  1020. AFX_INLINE void CXTPCalendarTheme::SetPaintTheme(XTPCalendarTheme ePaintTheme) {
  1021. m_nPaintTheme = ePaintTheme;
  1022. RefreshMetrics();
  1023. }
  1024. //*********************************
  1025. #if (_MSC_VER > 1100)
  1026. #pragma warning(pop)
  1027. #endif
  1028. #endif // !defined(_XTP_CALENDAR_THEME_H__)