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

对话框与窗口

开发平台:

Visual C++

  1. // XTPCalendarViewEvent.cpp: implementation of the CXTPCalendarDayViewEvent 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. #include "stdafx.h"
  21. #include "XTPCalendarViewPart.h"
  22. #include "XTPCalendarPaintManager.h"
  23. #include "XTPCalendarUtils.h"
  24. #include "XTPCalendarDayView.h"
  25. #include "XTPCalendarDayViewDay.h"
  26. #include "XTPCalendarDayViewEvent.h"
  27. #include "XTPCalendarControl.h"
  28. #include "XTPCalendarData.h"
  29. #include "XTPCalendarEvent.h"
  30. #include "XTPCalendarRecurrencePattern.h"
  31. #include "XTPCalendarTheme.h"
  32. #include "XTPCalendarThemeOffice2007.h"
  33. #ifdef _DEBUG
  34. #undef THIS_FILE
  35. static char THIS_FILE[] = __FILE__;
  36. #define new DEBUG_NEW
  37. #endif
  38. //////////////////////////////////////////////////////////////////////
  39. // Construction/Destruction
  40. //////////////////////////////////////////////////////////////////////
  41. IMPLEMENT_DYNAMIC(CXTPCalendarDayViewEvent, CXTPCalendarViewEvent)
  42. CXTPCalendarDayViewEvent::CXTPCalendarDayViewEvent(CXTPCalendarEvent* pEvent,
  43.    CXTPCalendarDayViewGroup* pViewGroup) :
  44. TBase(pEvent, pViewGroup)
  45. {
  46. ASSERT(pViewGroup);
  47. m_bHideEventTime = TRUE;
  48. m_rcTimeframe.SetRectEmpty();
  49. }
  50. CXTPCalendarDayViewEvent::~CXTPCalendarDayViewEvent()
  51. {
  52. }
  53. BOOL CXTPCalendarDayViewEvent::IsMultidayEvent()
  54. {
  55. if (!m_ptrEvent)
  56. {
  57. ASSERT(FALSE);
  58. return FALSE;
  59. }
  60. if (m_ptrEvent->IsAllDayEvent())
  61. return TRUE;
  62. int nHours = m_ptrEvent->GetDurationMinutes()/60;
  63. return nHours >= 24;
  64. }
  65. void CXTPCalendarDayViewEvent::AdjustSubjectEditor()
  66. {
  67. AdjustSubjectEditorEx(TRUE);
  68. }
  69. void CXTPCalendarDayViewEvent::AdjustSubjectEditorEx(BOOL bUpdateView)
  70. {
  71. if (IsEditingSubject() && m_pSubjectEditor)
  72. {
  73. if (!XTP_SAFE_GET2(GetViewGroup(), GetViewDay(), GetView(), NULL))
  74. {
  75. ASSERT(FALSE);
  76. return;
  77. }
  78. CRect rcEvents = GetViewGroup()->m_LayoutX.m_rcDayDetails;
  79. m_pSubjectEditor->MoveWindow(&m_rcSubjectEditor, FALSE);
  80. if (!IsMultidayEvent())
  81. {
  82. if (m_rcSubjectEditor.top >= rcEvents.top && m_rcSubjectEditor.top < rcEvents.bottom)
  83. {
  84. m_pSubjectEditor->ShowWindow(SW_SHOW);
  85. m_pSubjectEditor->SetFocus();
  86. }
  87. else
  88. {
  89. if (bUpdateView && GetViewGroup()->GetViewDay()->GetView()->IsEditingSubject())
  90. {
  91. GetViewGroup()->GetViewDay()->GetView()->OnUpdateEditingSubject(GetEditingSubjectFromEditor());
  92. }
  93. XTP_SAFE_CALL1(GetCalendarControl(), SetFocus());
  94. XTP_SAFE_CALL1(m_pSubjectEditor, ShowWindow(SW_HIDE));
  95. }
  96. }
  97. }
  98. }
  99. void CXTPCalendarDayViewEvent::AdjustLayout(CDC* pDC, const CRect& rcEventMax, int nEventPlaceNumber)
  100. {
  101. TBase::AdjustLayout(pDC, rcEventMax, nEventPlaceNumber);
  102. m_nMultiDayEventFlags = 0;
  103. m_bHideEventTime = TRUE;
  104. CXTPCalendarEvent* pEvent = GetEvent();
  105. if (!pEvent  || !pDC ||
  106. !XTP_SAFE_GET2(GetViewGroup(), GetViewDay(), GetView(), NULL))
  107. {
  108. ASSERT(FALSE);
  109. return;
  110. }
  111. // all-day event
  112. if (IsMultidayEvent())
  113. {
  114. //calculate icons rect
  115. CString strLoc = GetItemTextLocation();
  116. CString strEventText = GetItemTextSubject();
  117. if (strLoc.GetLength() > 0)
  118. {
  119. strEventText += _T(" (") + strLoc + _T(")");
  120. }
  121. CSize szText = XTP_SAFE_GET5(GetViewGroup(), GetViewDay(), GetView(), GetPaintManager(), GetDayViewEventPart(), GetTextExtent(pDC, strEventText), CSize(0));
  122. m_szText.cx = szText.cx;
  123. m_szText.cy = szText.cy;
  124. AdjustMultidayEvent(rcEventMax, nEventPlaceNumber);
  125. if (!pEvent->IsAllDayEvent() &&
  126. m_nMultiDayEventFlags & xtpCalendarMultiDayLast
  127.   )
  128. {
  129. COleDateTimeSpan spDay(1, 0, 0, 0);
  130. COleDateTime dtDay = XTP_SAFE_GET2(GetViewGroup_(), GetViewDay_(), GetDayDate(), (DATE)0);
  131. if (dtDay != pEvent->GetEndTime() - spDay)
  132. {
  133. CSize szClock = XTP_SAFE_GET4(GetViewGroup(), GetViewDay(), GetView(), GetPaintManager(), GetClockSize(), CSize(0));
  134. m_rcLastClock.CopyRect(m_rcEvent);
  135. m_rcLastClock.top -= 1;
  136. m_rcLastClock.bottom -= 1;
  137. m_rcLastClock.left = m_rcLastClock.right - szClock.cx;
  138. m_rcText.right = m_rcLastClock.left;
  139. }
  140. }
  141. return;
  142. }
  143. m_nMultiDayEventFlags |= xtpCalendarMultiDayNoMultiDay;
  144. // non all-day event
  145. int nPace = GetEventPlacePos();
  146. int nPaceCount = max(1, GetEventPlaceCount());
  147. ASSERT(GetEventPlaceCount() >= 1);
  148. ASSERT(nPace >= 0 && nPace < nPaceCount);
  149. m_rcEvent.CopyRect(GetViewGroup()->m_LayoutX.m_rcDayDetails);
  150. int nEventWidth = m_rcEvent.Width() / nPaceCount;
  151. // skip event views if they are not fit even by 5 pixel bar width
  152. // and correct some first event views heights
  153. if (nEventWidth <= 5)
  154. {
  155. while (nPaceCount > 1 && nEventWidth <= 5)
  156. {
  157. nPaceCount--;
  158. nEventWidth = m_rcEvent.Width() / nPaceCount;
  159. }
  160. if (nPace > nPaceCount)
  161. {
  162. m_rcEvent.SetRectEmpty();
  163. return;
  164. }
  165. }
  166. // calc other rect coordinates
  167. m_rcEvent.left += nEventWidth * nPace;
  168. m_rcEvent.right = m_rcEvent.left + nEventWidth;
  169. COleDateTime dtStartTime(pEvent->GetStartTime());
  170. COleDateTime dtEndTime(pEvent->GetEndTime());
  171. COleDateTimeSpan spEnd(0.0);
  172. if (CXTPCalendarUtils::IsZeroTime(dtEndTime) &&
  173. !CXTPCalendarUtils::IsEqual(dtStartTime, dtEndTime))
  174. {
  175. spEnd.SetDateTimeSpan(0, 0, 0, 1);
  176. }
  177. int nTopCell = XTP_SAFE_GET1(GetViewGroup(), GetDateTimeCell(dtStartTime, FALSE), 0);
  178. int nBottomCell = XTP_SAFE_GET1(GetViewGroup(), GetDateTimeCell(dtEndTime - spEnd, TRUE), 0);
  179. // is event's Begin/End on cells borders
  180. COleDateTime dtStartCellTime = GetViewGroup()->GetViewDay()->GetView()->GetCellTime(nTopCell);
  181. COleDateTime dtEndCellTime = GetViewGroup()->GetViewDay()->GetView()->GetCellTime(nBottomCell);
  182. dtEndCellTime += GetViewGroup()->GetViewDay()->GetView()->GetCellDuration();
  183. COleDateTime dtStart_TimeOnly = CXTPCalendarUtils::ResetDate(dtStartTime);
  184. COleDateTime dtEnd_TimeOnly = CXTPCalendarUtils::ResetDate(dtEndTime - spEnd);
  185. dtEnd_TimeOnly += spEnd;
  186. m_bHideEventTime = CXTPCalendarUtils::IsEqual(dtStartCellTime, dtStart_TimeOnly) &&
  187. (CXTPCalendarUtils::IsEqual(dtEndCellTime, dtEnd_TimeOnly, TRUE) ||
  188.  CXTPCalendarUtils::IsEqual(dtStartCellTime, dtEnd_TimeOnly) );
  189. CXTPCalendarEventPtr ptrDragEventOrig(GetViewGroup()->GetViewDay()->GetView()->GetDraggingEventOrig(), TRUE);
  190. if (ptrDragEventOrig && ptrDragEventOrig->IsEqualIDs(GetEvent()) &&
  191. !ptrDragEventOrig->IsEqualStartEnd(GetEvent()))
  192. {
  193. m_bHideEventTime = TRUE;
  194. }
  195. //---------------------------------------------------------------------------
  196. if (nBottomCell < nTopCell)
  197. {
  198. if (pEvent->GetEventPeriodDays() <= 1)
  199. {
  200. nBottomCell = nTopCell;
  201. }
  202. else
  203. if (pEvent->GetEndTime().GetDay() != GetViewGroup()->GetCellDateTime(0).GetDay())
  204. {
  205. nBottomCell = GetViewGroup()->GetRowCount() - 1;
  206. }
  207. else
  208. {
  209. nTopCell = 0;
  210. }
  211. }
  212. ASSERT(nBottomCell >= nTopCell);
  213. CRect rcTopCell = GetViewGroup()->GetCellRect(nTopCell);
  214. CRect rcBottomCell = GetViewGroup()->GetCellRect(nBottomCell);
  215. m_rcEvent.top = rcTopCell.top-1;
  216. m_rcEvent.bottom = rcBottomCell.bottom-2;
  217. m_rcEvent.right -= 5;
  218. m_rcEventMax.top = max(m_rcEvent.top-5, GetViewGroup()->m_LayoutX.m_rcDayDetails.top);
  219. m_rcEventMax.bottom = min(m_rcEvent.bottom + 5, GetViewGroup()->m_LayoutX.m_rcDayDetails.bottom);
  220. // adjust subject area
  221. m_rcText.CopyRect(m_rcEvent);
  222. m_rcText.left += 10; // correct to busy area
  223. m_rcText.left += CalcIconsRect(m_rcText);
  224. m_rcText.left += 4;
  225. m_rcSubjectEditor.CopyRect(&m_rcEvent);
  226. m_rcSubjectEditor.top += 1;
  227. m_rcSubjectEditor.left += 8;
  228. m_rcSubjectEditor.right -= 1;
  229. // Calculate Real time frame rect
  230. double dSecondsPerPixel = GetViewGroup()->GetViewDay()->GetView()->GetCellDuration().GetTotalSeconds()
  231. / max(1, GetViewGroup()->GetRowHeight());
  232. COleDateTime dtTopTime = GetViewGroup()->GetCellDateTime(nTopCell);
  233. COleDateTime dtBottomTime = GetViewGroup()->GetCellDateTime(nBottomCell)
  234. + GetViewGroup()->GetViewDay()->GetView()->GetCellDuration();
  235. if (CXTPCalendarUtils::IsEqual(dtStartTime, dtEndTime))
  236. {
  237. m_rcTimeframe.top = m_rcTimeframe.bottom = LONG_MAX;
  238. }
  239. else
  240. {
  241. double dShift = max(0, (dtStartTime - dtTopTime).GetTotalSeconds());
  242. dShift /= dSecondsPerPixel;
  243. m_rcTimeframe.top = m_rcEvent.top + (LONG)dShift;
  244. dShift = max(0, (dtBottomTime - dtEndTime).GetTotalSeconds());
  245. dShift = min(m_rcEvent.Height(), dShift/dSecondsPerPixel);
  246. m_rcTimeframe.bottom = m_rcEvent.bottom - (LONG)dShift;
  247. }
  248. m_rcTimeframe.left = m_rcEvent.left + 1;
  249. m_rcTimeframe.right = m_rcTimeframe.left + 4;
  250. // set expanded signs for day view
  251. CRect rcEvents = GetViewGroup()->m_LayoutX.m_rcDayDetails;
  252. if (m_rcEvent.top >= rcEvents.bottom-10)
  253. GetViewGroup()->SetExpandDown();
  254. if (m_rcEvent.bottom <= rcEvents.top + 10)
  255. GetViewGroup()->SetExpandUp();
  256. }
  257. void CXTPCalendarDayViewEvent::AdjustLayout2(CDC* pDC, const CRect& rcEventMax, int nEventPlaceNumber)
  258. {
  259. TBase::AdjustLayout(pDC, rcEventMax, nEventPlaceNumber);
  260. m_nMultiDayEventFlags = 0;
  261. m_bHideEventTime = TRUE;
  262. CXTPCalendarEvent* pEvent = GetEvent();
  263. if (!pEvent  || !pDC ||
  264. !XTP_SAFE_GET2(GetViewGroup(), GetViewDay(), GetView(), NULL) ||
  265. !XTP_SAFE_GET3(GetViewGroup(), GetViewDay(), GetView(), GetTheme(), NULL) )
  266. {
  267. ASSERT(FALSE);
  268. return;
  269. }
  270. CXTPCalendarTheme* pTheme = GetViewGroup()->GetViewDay()->GetView()->GetTheme();
  271. // all-day event
  272. if (IsMultidayEvent())
  273. {
  274. // to calculate multiday-flags
  275. AdjustMultidayEvent(rcEventMax, nEventPlaceNumber);
  276. pTheme->GetDayViewPart()->GetDayPart()->GetGroupPart()->GetMultiDayEventPart()->AdjustLayout(this, pDC, rcEventMax, nEventPlaceNumber);
  277. return;
  278. }
  279. pTheme->GetDayViewPart()->GetDayPart()->GetGroupPart()->GetSingleDayEventPart()->AdjustLayout(this, pDC, rcEventMax, nEventPlaceNumber);
  280. }
  281. void CXTPCalendarDayViewEvent::OnPostAdjustLayout()
  282. {
  283. CXTPCalendarViewEvent::OnPostAdjustLayout();
  284. CRect rcEvents = GetEventsRect();
  285. if (m_rcToolTip.top < rcEvents.top)
  286. {
  287. m_rcToolTip.top = rcEvents.top;
  288. if (m_rcToolTip.top >= m_rcToolTip.bottom)
  289. {
  290. m_rcToolTip.bottom = m_rcToolTip.top + 10;
  291. }
  292. }
  293. }
  294. CRect CXTPCalendarDayViewEvent::GetEventsRect()
  295. {
  296. if (!GetViewGroup() || !GetViewGroup()->GetViewDay())
  297. {
  298. ASSERT(FALSE);
  299. return CRect(0, 0, 0, 0);
  300. }
  301. if (IsMultidayEvent())
  302. {
  303. return GetViewGroup()->m_LayoutX.m_rcAllDayEvents;
  304. }
  305. return GetViewGroup()->m_LayoutX.m_rcDayDetails;
  306. }
  307. BOOL CXTPCalendarDayViewEvent::IsVisible()
  308. {
  309. return IsVisibleEx(TRUE, TRUE, FALSE);
  310. }
  311. BOOL CXTPCalendarDayViewEvent::IsVisibleEx(BOOL bCheckTop, BOOL bCheckBottom,
  312. BOOL bTopAndBottom)
  313. {
  314. // at least one of bCheckTop or bCheckBottom must be TRUE (or both)
  315. ASSERT((!bCheckTop && !bCheckBottom) == FALSE);
  316. if (!GetViewGroup() || !GetViewGroup()->GetViewDay())
  317. {
  318. ASSERT(FALSE);
  319. return FALSE;
  320. }
  321. BOOL bVisible = FALSE;
  322. if (IsMultidayEvent())
  323. {
  324. CRect rcEvents = GetViewGroup()->m_LayoutX.m_rcAllDayEvents;
  325. bVisible = m_rcEvent.bottom <= rcEvents.bottom;
  326. }
  327. else
  328. {
  329. CRect rcEvents = GetViewGroup()->m_LayoutX.m_rcDayDetails;
  330. BOOL bETopVisible = m_rcEvent.top <= rcEvents.bottom &&
  331. m_rcEvent.top >= rcEvents.top-2;
  332. BOOL bEBottomVisible = m_rcEvent.bottom <= rcEvents.bottom &&
  333.    m_rcEvent.bottom >= rcEvents.top-2;
  334. BOOL bEBodyVisible = !(m_rcEvent.top < rcEvents.top-2 &&
  335. m_rcEvent.bottom < rcEvents.top-2
  336. ||
  337. m_rcEvent.top > rcEvents.bottom &&
  338. m_rcEvent.bottom > rcEvents.bottom);
  339. if (bTopAndBottom)
  340. {
  341. bETopVisible |= !bCheckTop;
  342. bEBottomVisible |= !bCheckBottom;
  343. bVisible = bETopVisible && bEBottomVisible;
  344. }
  345. else
  346. {
  347. bVisible = bETopVisible || bEBottomVisible || bEBodyVisible;
  348. }
  349. }
  350. return bVisible;
  351. }
  352. void CXTPCalendarDayViewEvent::ChangeEventPlace(int nNewPlace)
  353. {
  354. CXTPCalendarTheme* pTheme = XTP_SAFE_GET3(GetViewGroup_(), GetViewDay_(), GetView_(), GetTheme(), NULL);
  355. if (pTheme)
  356. {
  357. CRect rcEventNew = m_rcEvent;
  358. pTheme->GetDayViewPart()->GetDayPart()->GetGroupPart()->GetMultiDayEventPart()->CalcEventYs(rcEventNew, nNewPlace);
  359. int nY0 = m_rcEvent.top;
  360. int nY1 = rcEventNew.top;
  361. _ChangeEventPlace(nNewPlace, nY0, nY1);
  362. }
  363. else
  364. {
  365. TBase::ChangeEventPlace(nNewPlace);
  366. }
  367. }
  368. void CXTPCalendarDayViewEvent::Draw(CDC* pDC)
  369. {
  370. BOOL bNoVisibleMDEvent = IsMultidayEvent() && !IsVisible();
  371. if (m_nMultiDayEventFlags & xtpCalendarMultiDaySlave || bNoVisibleMDEvent)
  372. {
  373. return;// was drawn in the Master (or out of events rect)
  374. }
  375. //ASSERT((m_nMultiDayEventFlags & xtpCalendarMultiDayMaster) || m_nMultiDayEventFlags == xtpCalendarMultiDayNoMultiDay);
  376. XTP_SAFE_CALL5(GetViewGroup(), GetViewDay(), GetView(), GetPaintManager(), GetDayViewEventPart(), OnDraw(pDC, this) );
  377. }
  378. BOOL CXTPCalendarDayViewEvent::HitTestEx(CPoint point, XTP_CALENDAR_HITTESTINFO_DAY_VIEW* pInfo)
  379. {
  380. if (!pInfo || !GetViewGroup() || !GetViewGroup()->GetViewDay())
  381. {
  382. ASSERT(FALSE);
  383. return FALSE;
  384. }
  385. CRect rcEvents = GetEventsRect();
  386. CRect rcEventMax2(m_rcEventMax);
  387. if (IsSelected() && !IsMultidayEvent())
  388. {
  389. rcEventMax2.top = rcEventMax2.top - 5;
  390. rcEventMax2.bottom = rcEventMax2.bottom + 5;
  391. }
  392. BOOL bVisible = IsVisibleEx(TRUE, TRUE, FALSE);
  393. if (!rcEventMax2.PtInRect(point) || !rcEvents.PtInRect(point) || !bVisible)
  394. {
  395. return FALSE;
  396. }
  397. //-----------------------------------------
  398. XTP_CALENDAR_HITTESTINFO_DAY_VIEW tmpInfo, tmpInfo2;
  399. tmpInfo.pt = tmpInfo2.pt = point;
  400. tmpInfo.pViewDay = GetViewGroup()->GetViewDay();
  401. tmpInfo.pViewGroup = GetViewGroup();
  402. tmpInfo.pViewEvent = this;
  403. tmpInfo.uHitCode = xtpCalendarHitTestUnknown;
  404. if (GetViewGroup()->HitTestDateTime(&tmpInfo2))
  405. {
  406. tmpInfo.dt = tmpInfo2.dt;
  407. tmpInfo.bTimePartValid = tmpInfo2.bTimePartValid;
  408. tmpInfo.uHitCode |= (tmpInfo2.uHitCode & xtpCalendarHitTestDayView_Mask);
  409. }
  410. else
  411. {
  412. tmpInfo.dt = GetViewGroup()->GetViewDay()->GetDayDate();
  413. tmpInfo.bTimePartValid = FALSE;
  414. }
  415. //-----------------------------------------
  416. if (IsMultidayEvent())
  417. {
  418. BOOL bIsFirst = (m_nMultiDayEventFlags & xtpCalendarMultiDayFirst);
  419. BOOL bIsLast = (m_nMultiDayEventFlags & xtpCalendarMultiDayLast);
  420. //BOOL bIsMiddle = (m_nMultiDayEventFlags & xtpCalendarMultiDayMiddle);
  421. CRect rcBegin = m_rcEventMax;
  422. rcBegin.right = min(m_rcEvent.left + 5, m_rcEvent.right);
  423. CRect rcEnd = m_rcEventMax;
  424. rcEnd.left = max(m_rcEvent.right - 5, m_rcEvent.left);
  425. if (bIsFirst && rcBegin.PtInRect(point))
  426. {
  427. tmpInfo.uHitCode = xtpCalendarHitTestEventResizeHArea | xtpCalendarHitTestEventResizeBegin;
  428. *pInfo = tmpInfo;
  429. return TRUE;
  430. }
  431. if (bIsLast && rcEnd.PtInRect(point))
  432. {
  433. tmpInfo.uHitCode = xtpCalendarHitTestEventResizeHArea | xtpCalendarHitTestEventResizeEnd;
  434. *pInfo = tmpInfo;
  435. return TRUE;
  436. }
  437. if (m_rcEvent.PtInRect(point))
  438. {
  439. tmpInfo.uHitCode = xtpCalendarHitTestEventTextArea;
  440. *pInfo = tmpInfo;
  441. return TRUE;
  442. }
  443. return FALSE;
  444. }
  445. CRect rcTime = m_rcEvent;
  446. rcTime.right = m_rcTimeframe.right + 1;
  447. CRect rcText = m_rcEvent;
  448. rcText.left = rcTime.right;
  449. CRect rcBegin = m_rcEvent;
  450. rcBegin.bottom = min(m_rcEvent.top + 5, m_rcEvent.bottom);
  451. CRect rcEnd = m_rcEvent;
  452. rcEnd.top = max(m_rcEvent.bottom - 5, m_rcEvent.top);
  453. if (IsSelected())
  454. {
  455. rcBegin.top = m_rcEvent.top - 5;
  456. rcEnd.bottom = m_rcEvent.bottom + 5;
  457. }
  458. if (rcTime.PtInRect(point))
  459. {
  460. tmpInfo.uHitCode = xtpCalendarHitTestEventDragArea;
  461. *pInfo = tmpInfo;
  462. return TRUE;
  463. }
  464. if (rcBegin.PtInRect(point))
  465. {
  466. tmpInfo.uHitCode = xtpCalendarHitTestEventResizeVArea | xtpCalendarHitTestEventResizeBegin;
  467. *pInfo = tmpInfo;
  468. return TRUE;
  469. }
  470. if (rcEnd.PtInRect(point))
  471. {
  472. tmpInfo.uHitCode = xtpCalendarHitTestEventResizeVArea | xtpCalendarHitTestEventResizeEnd;
  473. *pInfo = tmpInfo;
  474. return TRUE;
  475. }
  476. if (rcText.PtInRect(point))
  477. {
  478. tmpInfo.uHitCode = xtpCalendarHitTestEventTextArea;
  479. *pInfo = tmpInfo;
  480. return TRUE;
  481. }
  482. //-----------------------------------------
  483. return FALSE;
  484. }
  485. CFont* CXTPCalendarDayViewEvent::GetSubjectEditorFont()
  486. {
  487. CFont* pFont = &XTP_SAFE_GET5(GetViewGroup(), GetViewDay(), GetView(), GetPaintManager(), GetDayViewEventPart(), GetTextFont(), *((CFont*)(NULL)));
  488. ASSERT(pFont);
  489. return pFont;
  490. }
  491. CXTPCalendarViewEvent* CXTPCalendarDayViewEvent::StartEditSubject()
  492. {
  493. XTP_SAFE_CALL3(GetViewGroup(), GetViewDay(), GetView(), EnsureVisibleH(this));
  494. CXTPCalendarViewEvent* pEV = TBase::StartEditSubject();
  495. AdjustSubjectEditorEx(FALSE);
  496. return pEV;
  497. }