OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "xfa/fwl/core/ifwl_monthcalendar.h" | 7 #include "xfa/fwl/core/ifwl_monthcalendar.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::December)); | 118 pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::December)); |
119 } | 119 } |
120 | 120 |
121 } // namespace | 121 } // namespace |
122 | 122 |
123 IFWL_MonthCalendar::IFWL_MonthCalendar( | 123 IFWL_MonthCalendar::IFWL_MonthCalendar( |
124 const IFWL_App* app, | 124 const IFWL_App* app, |
125 std::unique_ptr<CFWL_WidgetProperties> properties, | 125 std::unique_ptr<CFWL_WidgetProperties> properties, |
126 IFWL_Widget* pOuter) | 126 IFWL_Widget* pOuter) |
127 : IFWL_Widget(app, std::move(properties), pOuter), | 127 : IFWL_Widget(app, std::move(properties), pOuter), |
128 m_bInit(false), | 128 m_bInitialized(false), |
129 m_pDateTime(new CFX_DateTime), | 129 m_pDateTime(new CFX_DateTime), |
130 m_iCurYear(2011), | 130 m_iCurYear(2011), |
131 m_iCurMonth(1), | 131 m_iCurMonth(1), |
132 m_iYear(2011), | 132 m_iYear(2011), |
133 m_iMonth(1), | 133 m_iMonth(1), |
134 m_iDay(1), | 134 m_iDay(1), |
135 m_iHovered(-1), | 135 m_iHovered(-1), |
136 m_iLBtnPartStates(CFWL_PartState_Normal), | 136 m_iLBtnPartStates(CFWL_PartState_Normal), |
137 m_iRBtnPartStates(CFWL_PartState_Normal), | 137 m_iRBtnPartStates(CFWL_PartState_Normal), |
138 m_iMaxSel(1), | |
139 m_bFlag(false) { | 138 m_bFlag(false) { |
140 m_rtHead.Reset(); | 139 m_rtHead.Reset(); |
141 m_rtWeek.Reset(); | 140 m_rtWeek.Reset(); |
142 m_rtLBtn.Reset(); | 141 m_rtLBtn.Reset(); |
143 m_rtRBtn.Reset(); | 142 m_rtRBtn.Reset(); |
144 m_rtDates.Reset(); | 143 m_rtDates.Reset(); |
145 m_rtHSep.Reset(); | 144 m_rtHSep.Reset(); |
146 m_rtHeadText.Reset(); | 145 m_rtHeadText.Reset(); |
147 m_rtToday.Reset(); | 146 m_rtToday.Reset(); |
148 m_rtTodayFlag.Reset(); | 147 m_rtTodayFlag.Reset(); |
(...skipping 22 matching lines...) Expand all Loading... |
171 } | 170 } |
172 | 171 |
173 void IFWL_MonthCalendar::Update() { | 172 void IFWL_MonthCalendar::Update() { |
174 if (IsLocked()) { | 173 if (IsLocked()) { |
175 return; | 174 return; |
176 } | 175 } |
177 if (!m_pProperties->m_pThemeProvider) { | 176 if (!m_pProperties->m_pThemeProvider) { |
178 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 177 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
179 } | 178 } |
180 GetCapValue(); | 179 GetCapValue(); |
181 if (!m_bInit) { | 180 if (!m_bInitialized) { |
182 m_bInit = InitDate(); | 181 InitDate(); |
| 182 m_bInitialized = true; |
183 } | 183 } |
184 ClearDateItem(); | 184 ClearDateItem(); |
185 ReSetDateItem(); | 185 ResetDateItem(); |
186 LayOut(); | 186 Layout(); |
187 } | 187 } |
188 | 188 |
189 void IFWL_MonthCalendar::DrawWidget(CFX_Graphics* pGraphics, | 189 void IFWL_MonthCalendar::DrawWidget(CFX_Graphics* pGraphics, |
190 const CFX_Matrix* pMatrix) { | 190 const CFX_Matrix* pMatrix) { |
191 if (!pGraphics) | 191 if (!pGraphics) |
192 return; | 192 return; |
193 if (!m_pProperties->m_pThemeProvider) { | 193 if (!m_pProperties->m_pThemeProvider) { |
194 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 194 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
195 } | 195 } |
196 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; | 196 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; |
(...skipping 14 matching lines...) Expand all Loading... |
211 DrawWeek(pGraphics, pTheme, pMatrix); | 211 DrawWeek(pGraphics, pTheme, pMatrix); |
212 DrawDatesIn(pGraphics, pTheme, pMatrix); | 212 DrawDatesIn(pGraphics, pTheme, pMatrix); |
213 DrawDatesOut(pGraphics, pTheme, pMatrix); | 213 DrawDatesOut(pGraphics, pTheme, pMatrix); |
214 DrawToday(pGraphics, pTheme, pMatrix); | 214 DrawToday(pGraphics, pTheme, pMatrix); |
215 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_WeekNumbers) { | 215 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_WeekNumbers) { |
216 DrawWeekNumberSep(pGraphics, pTheme, pMatrix); | 216 DrawWeekNumberSep(pGraphics, pTheme, pMatrix); |
217 DrawWeekNumber(pGraphics, pTheme, pMatrix); | 217 DrawWeekNumber(pGraphics, pTheme, pMatrix); |
218 } | 218 } |
219 } | 219 } |
220 | 220 |
221 int32_t IFWL_MonthCalendar::CountSelect() { | 221 void IFWL_MonthCalendar::SetSelect(int32_t iYear, |
222 return m_arrSelDays.GetSize(); | |
223 } | |
224 | |
225 bool IFWL_MonthCalendar::GetSelect(int32_t& iYear, | |
226 int32_t& iMonth, | |
227 int32_t& iDay, | |
228 int32_t nIndex) { | |
229 if (nIndex >= m_arrSelDays.GetSize()) { | |
230 return false; | |
231 } | |
232 iYear = m_iCurYear; | |
233 iMonth = m_iCurMonth; | |
234 iDay = m_arrSelDays[nIndex]; | |
235 return true; | |
236 } | |
237 | |
238 bool IFWL_MonthCalendar::SetSelect(int32_t iYear, | |
239 int32_t iMonth, | 222 int32_t iMonth, |
240 int32_t iDay) { | 223 int32_t iDay) { |
241 ChangeToMonth(iYear, iMonth); | 224 ChangeToMonth(iYear, iMonth); |
242 return AddSelDay(iDay); | 225 AddSelDay(iDay); |
243 } | 226 } |
244 | 227 |
245 void IFWL_MonthCalendar::DrawBkground(CFX_Graphics* pGraphics, | 228 void IFWL_MonthCalendar::DrawBkground(CFX_Graphics* pGraphics, |
246 IFWL_ThemeProvider* pTheme, | 229 IFWL_ThemeProvider* pTheme, |
247 const CFX_Matrix* pMatrix) { | 230 const CFX_Matrix* pMatrix) { |
248 CFWL_ThemeBackground params; | 231 CFWL_ThemeBackground params; |
249 params.m_pWidget = this; | 232 params.m_pWidget = this; |
250 params.m_iPart = CFWL_Part::Background; | 233 params.m_iPart = CFWL_Part::Background; |
251 params.m_pGraphics = pGraphics; | 234 params.m_pGraphics = pGraphics; |
252 params.m_dwStates = CFWL_PartState_Normal; | 235 params.m_dwStates = CFWL_PartState_Normal; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 const CFX_Matrix* pMatrix) { | 331 const CFX_Matrix* pMatrix) { |
349 CFWL_ThemeBackground params; | 332 CFWL_ThemeBackground params; |
350 params.m_pWidget = this; | 333 params.m_pWidget = this; |
351 params.m_iPart = CFWL_Part::DateInBK; | 334 params.m_iPart = CFWL_Part::DateInBK; |
352 params.m_pGraphics = pGraphics; | 335 params.m_pGraphics = pGraphics; |
353 if (pMatrix) { | 336 if (pMatrix) { |
354 params.m_matrix.Concat(*pMatrix); | 337 params.m_matrix.Concat(*pMatrix); |
355 } | 338 } |
356 int32_t iCount = m_arrDates.GetSize(); | 339 int32_t iCount = m_arrDates.GetSize(); |
357 for (int32_t j = 0; j < iCount; j++) { | 340 for (int32_t j = 0; j < iCount; j++) { |
358 FWL_DATEINFO* pDataInfo = m_arrDates.GetAt(j); | 341 DATEINFO* pDataInfo = m_arrDates.GetAt(j); |
359 if (pDataInfo->dwStates & FWL_ITEMSTATE_MCD_Selected) { | 342 if (pDataInfo->dwStates & FWL_ITEMSTATE_MCD_Selected) { |
360 params.m_dwStates |= CFWL_PartState_Selected; | 343 params.m_dwStates |= CFWL_PartState_Selected; |
361 if (((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoTodayCircle) == | 344 if (((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoTodayCircle) == |
362 0) && | 345 0) && |
363 pDataInfo->dwStates & FWL_ITEMSTATE_MCD_Flag) { | 346 pDataInfo->dwStates & FWL_ITEMSTATE_MCD_Flag) { |
364 params.m_dwStates |= CFWL_PartState_Flagged; | 347 params.m_dwStates |= CFWL_PartState_Flagged; |
365 } | 348 } |
366 if (pDataInfo->dwStates & FWL_ITEMSTATE_MCD_Focused) { | 349 if (pDataInfo->dwStates & FWL_ITEMSTATE_MCD_Focused) { |
367 params.m_dwStates |= CFWL_PartState_Focused; | 350 params.m_dwStates |= CFWL_PartState_Focused; |
368 } | 351 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 params.m_iPart = CFWL_Part::WeekNum; | 392 params.m_iPart = CFWL_Part::WeekNum; |
410 params.m_pGraphics = pGraphics; | 393 params.m_pGraphics = pGraphics; |
411 params.m_dwStates = CFWL_PartState_Normal; | 394 params.m_dwStates = CFWL_PartState_Normal; |
412 params.m_iTTOAlign = FDE_TTOALIGNMENT_CenterLeft; | 395 params.m_iTTOAlign = FDE_TTOALIGNMENT_CenterLeft; |
413 CFX_WideString wsWeekNum; | 396 CFX_WideString wsWeekNum; |
414 params.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; | 397 params.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; |
415 params.m_iTTOAlign = FDE_TTOALIGNMENT_Center; | 398 params.m_iTTOAlign = FDE_TTOALIGNMENT_Center; |
416 if (pMatrix) { | 399 if (pMatrix) { |
417 params.m_matrix.Concat(*pMatrix); | 400 params.m_matrix.Concat(*pMatrix); |
418 } | 401 } |
419 int32_t iWeekNum = 0; | |
420 int32_t iMonthNum = m_pDateTime->GetMonth(); | 402 int32_t iMonthNum = m_pDateTime->GetMonth(); |
421 int32_t iDayNum = FX_DaysInMonth(m_iCurYear, iMonthNum); | 403 int32_t iDayNum = FX_DaysInMonth(m_iCurYear, iMonthNum); |
422 int32_t iTemp = 0; | 404 int32_t iTemp = 0; |
423 FX_FLOAT fVStartPos = m_rtClient.top + m_fHeadHei + m_fHSepHei; | 405 FX_FLOAT fVStartPos = m_rtClient.top + m_fHeadHei + m_fHSepHei; |
424 FX_FLOAT fHStartPos = m_rtClient.left; | 406 FX_FLOAT fHStartPos = m_rtClient.left; |
425 for (int32_t i = 1; i <= iDayNum; i += 7) { | 407 for (int32_t i = 1; i <= iDayNum; i += 7) { |
426 iTemp++; | 408 iTemp++; |
427 iWeekNum = CalWeekNumber(m_iCurYear, iMonthNum, i); | |
428 m_rtWeekNum.Set(fHStartPos, fVStartPos + m_fDateCellHei * iTemp, | 409 m_rtWeekNum.Set(fHStartPos, fVStartPos + m_fDateCellHei * iTemp, |
429 m_fWeekNumWid, m_fDateCellHei); | 410 m_fWeekNumWid, m_fDateCellHei); |
430 wsWeekNum.Format(L"%d", iWeekNum); | 411 wsWeekNum.Format(L"0"); |
431 params.m_wsText = wsWeekNum; | 412 params.m_wsText = wsWeekNum; |
432 params.m_rtPart = m_rtWeekNum; | 413 params.m_rtPart = m_rtWeekNum; |
433 pTheme->DrawText(¶ms); | 414 pTheme->DrawText(¶ms); |
434 } | 415 } |
435 } | 416 } |
436 | 417 |
437 void IFWL_MonthCalendar::DrawWeekNumberSep(CFX_Graphics* pGraphics, | 418 void IFWL_MonthCalendar::DrawWeekNumberSep(CFX_Graphics* pGraphics, |
438 IFWL_ThemeProvider* pTheme, | 419 IFWL_ThemeProvider* pTheme, |
439 const CFX_Matrix* pMatrix) { | 420 const CFX_Matrix* pMatrix) { |
440 CFWL_ThemeBackground params; | 421 CFWL_ThemeBackground params; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 params.m_pWidget = this; | 464 params.m_pWidget = this; |
484 params.m_iPart = CFWL_Part::DatesIn; | 465 params.m_iPart = CFWL_Part::DatesIn; |
485 params.m_pGraphics = pGraphics; | 466 params.m_pGraphics = pGraphics; |
486 params.m_dwStates = CFWL_PartState_Normal; | 467 params.m_dwStates = CFWL_PartState_Normal; |
487 params.m_iTTOAlign = FDE_TTOALIGNMENT_Center; | 468 params.m_iTTOAlign = FDE_TTOALIGNMENT_Center; |
488 if (pMatrix) { | 469 if (pMatrix) { |
489 params.m_matrix.Concat(*pMatrix); | 470 params.m_matrix.Concat(*pMatrix); |
490 } | 471 } |
491 int32_t iCount = m_arrDates.GetSize(); | 472 int32_t iCount = m_arrDates.GetSize(); |
492 for (int32_t j = 0; j < iCount; j++) { | 473 for (int32_t j = 0; j < iCount; j++) { |
493 FWL_DATEINFO* pDataInfo = m_arrDates.GetAt(j); | 474 DATEINFO* pDataInfo = m_arrDates.GetAt(j); |
494 params.m_wsText = pDataInfo->wsDay; | 475 params.m_wsText = pDataInfo->wsDay; |
495 params.m_rtPart = pDataInfo->rect; | 476 params.m_rtPart = pDataInfo->rect; |
496 params.m_dwStates = pDataInfo->dwStates; | 477 params.m_dwStates = pDataInfo->dwStates; |
497 if (j + 1 == m_iHovered) { | 478 if (j + 1 == m_iHovered) { |
498 params.m_dwStates |= CFWL_PartState_Hovered; | 479 params.m_dwStates |= CFWL_PartState_Hovered; |
499 } | 480 } |
500 params.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; | 481 params.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; |
501 pTheme->DrawText(¶ms); | 482 pTheme->DrawText(¶ms); |
502 } | 483 } |
503 } | 484 } |
(...skipping 18 matching lines...) Expand all Loading... |
522 const CFX_Matrix* pMatrix) { | 503 const CFX_Matrix* pMatrix) { |
523 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoTodayCircle) { | 504 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoTodayCircle) { |
524 return; | 505 return; |
525 } | 506 } |
526 if (m_iMonth != m_iCurMonth || m_iYear != m_iCurYear) { | 507 if (m_iMonth != m_iCurMonth || m_iYear != m_iCurYear) { |
527 return; | 508 return; |
528 } | 509 } |
529 if (m_iDay < 1 || m_iDay > m_arrDates.GetSize()) { | 510 if (m_iDay < 1 || m_iDay > m_arrDates.GetSize()) { |
530 return; | 511 return; |
531 } | 512 } |
532 FWL_DATEINFO* pDate = m_arrDates[m_iDay - 1]; | 513 DATEINFO* pDate = m_arrDates[m_iDay - 1]; |
533 if (!pDate) | 514 if (!pDate) |
534 return; | 515 return; |
535 CFWL_ThemeBackground params; | 516 CFWL_ThemeBackground params; |
536 params.m_pWidget = this; | 517 params.m_pWidget = this; |
537 params.m_iPart = CFWL_Part::DateInCircle; | 518 params.m_iPart = CFWL_Part::DateInCircle; |
538 params.m_pGraphics = pGraphics; | 519 params.m_pGraphics = pGraphics; |
539 params.m_rtPart = pDate->rect; | 520 params.m_rtPart = pDate->rect; |
540 params.m_dwStates = CFWL_PartState_Normal; | 521 params.m_dwStates = CFWL_PartState_Normal; |
541 if (pMatrix) { | 522 if (pMatrix) { |
542 params.m_matrix.Concat(*pMatrix); | 523 params.m_matrix.Concat(*pMatrix); |
543 } | 524 } |
544 pTheme->DrawBackground(¶ms); | 525 pTheme->DrawBackground(¶ms); |
545 } | 526 } |
546 | 527 |
547 void IFWL_MonthCalendar::DrawTodayCircle(CFX_Graphics* pGraphics, | |
548 IFWL_ThemeProvider* pTheme, | |
549 const CFX_Matrix* pMatrix) { | |
550 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoToday) { | |
551 return; | |
552 } | |
553 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoTodayCircle) { | |
554 return; | |
555 } | |
556 CFWL_ThemeBackground params; | |
557 params.m_pWidget = this; | |
558 params.m_iPart = CFWL_Part::TodayCircle; | |
559 params.m_pGraphics = pGraphics; | |
560 params.m_dwStates = CFWL_PartState_Normal; | |
561 params.m_rtPart = m_rtTodayFlag; | |
562 if (pMatrix) { | |
563 params.m_matrix.Concat(*pMatrix); | |
564 } | |
565 pTheme->DrawBackground(¶ms); | |
566 } | |
567 | |
568 CFX_SizeF IFWL_MonthCalendar::CalcSize(bool bAutoSize) { | 528 CFX_SizeF IFWL_MonthCalendar::CalcSize(bool bAutoSize) { |
569 if (!m_pProperties->m_pThemeProvider) | 529 if (!m_pProperties->m_pThemeProvider) |
570 return CFX_SizeF(); | 530 return CFX_SizeF(); |
571 | 531 |
572 if (!bAutoSize) { | 532 if (!bAutoSize) { |
573 GetClientRect(m_rtClient); | 533 GetClientRect(m_rtClient); |
574 return CFX_SizeF(m_rtClient.width, m_rtClient.height); | 534 return CFX_SizeF(m_rtClient.width, m_rtClient.height); |
575 } | 535 } |
576 | 536 |
577 CFX_SizeF fs; | 537 CFX_SizeF fs; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN + MONTHCAL_HMARGIN, | 605 m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN + MONTHCAL_HMARGIN, |
646 m_rtDates.bottom() + MONTHCAL_HEADER_BTN_VMARGIN + MONTHCAL_VMARGIN, | 606 m_rtDates.bottom() + MONTHCAL_HEADER_BTN_VMARGIN + MONTHCAL_VMARGIN, |
647 m_szCell.x, m_szToday.y); | 607 m_szCell.x, m_szToday.y); |
648 m_rtToday.Set( | 608 m_rtToday.Set( |
649 m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN + m_szCell.x + | 609 m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN + m_szCell.x + |
650 MONTHCAL_HMARGIN * 2, | 610 MONTHCAL_HMARGIN * 2, |
651 m_rtDates.bottom() + MONTHCAL_HEADER_BTN_VMARGIN + MONTHCAL_VMARGIN, | 611 m_rtDates.bottom() + MONTHCAL_HEADER_BTN_VMARGIN + MONTHCAL_VMARGIN, |
652 m_szToday.x, m_szToday.y); | 612 m_szToday.x, m_szToday.y); |
653 } | 613 } |
654 | 614 |
655 void IFWL_MonthCalendar::LayOut() { | 615 void IFWL_MonthCalendar::Layout() { |
656 GetClientRect(m_rtClient); | 616 GetClientRect(m_rtClient); |
657 { | 617 { |
658 m_rtHead.Set( | 618 m_rtHead.Set( |
659 m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN, m_rtClient.top, | 619 m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN, m_rtClient.top, |
660 m_rtClient.width - MONTHCAL_HEADER_BTN_HMARGIN * 2, | 620 m_rtClient.width - MONTHCAL_HEADER_BTN_HMARGIN * 2, |
661 m_szCell.x + (MONTHCAL_HEADER_BTN_VMARGIN + MONTHCAL_VMARGIN) * 2); | 621 m_szCell.x + (MONTHCAL_HEADER_BTN_VMARGIN + MONTHCAL_VMARGIN) * 2); |
662 m_rtWeek.Set(m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN, | 622 m_rtWeek.Set(m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN, |
663 m_rtHead.bottom(), | 623 m_rtHead.bottom(), |
664 m_rtClient.width - MONTHCAL_HEADER_BTN_HMARGIN * 2, | 624 m_rtClient.width - MONTHCAL_HEADER_BTN_HMARGIN * 2, |
665 m_szCell.y + MONTHCAL_VMARGIN * 2); | 625 m_szCell.y + MONTHCAL_VMARGIN * 2); |
(...skipping 18 matching lines...) Expand all Loading... |
684 CalDateItem(); | 644 CalDateItem(); |
685 } | 645 } |
686 | 646 |
687 void IFWL_MonthCalendar::CalDateItem() { | 647 void IFWL_MonthCalendar::CalDateItem() { |
688 bool bNewWeek = false; | 648 bool bNewWeek = false; |
689 int32_t iWeekOfMonth = 0; | 649 int32_t iWeekOfMonth = 0; |
690 FX_FLOAT fLeft = m_rtDates.left; | 650 FX_FLOAT fLeft = m_rtDates.left; |
691 FX_FLOAT fTop = m_rtDates.top; | 651 FX_FLOAT fTop = m_rtDates.top; |
692 int32_t iCount = m_arrDates.GetSize(); | 652 int32_t iCount = m_arrDates.GetSize(); |
693 for (int32_t i = 0; i < iCount; i++) { | 653 for (int32_t i = 0; i < iCount; i++) { |
694 FWL_DATEINFO* pDateInfo = m_arrDates.GetAt(i); | 654 DATEINFO* pDateInfo = m_arrDates.GetAt(i); |
695 if (bNewWeek) { | 655 if (bNewWeek) { |
696 iWeekOfMonth++; | 656 iWeekOfMonth++; |
697 bNewWeek = false; | 657 bNewWeek = false; |
698 } | 658 } |
699 pDateInfo->rect.Set( | 659 pDateInfo->rect.Set( |
700 fLeft + pDateInfo->iDayOfWeek * (m_szCell.x + (MONTHCAL_HMARGIN * 2)), | 660 fLeft + pDateInfo->iDayOfWeek * (m_szCell.x + (MONTHCAL_HMARGIN * 2)), |
701 fTop + iWeekOfMonth * (m_szCell.y + (MONTHCAL_VMARGIN * 2)), | 661 fTop + iWeekOfMonth * (m_szCell.y + (MONTHCAL_VMARGIN * 2)), |
702 m_szCell.x + (MONTHCAL_HMARGIN * 2), | 662 m_szCell.x + (MONTHCAL_HMARGIN * 2), |
703 m_szCell.y + (MONTHCAL_VMARGIN * 2)); | 663 m_szCell.y + (MONTHCAL_VMARGIN * 2)); |
704 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_WeekNumbers) { | 664 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_WeekNumbers) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::TodayFlagWidth)); | 727 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::TodayFlagWidth)); |
768 m_fMCWid = *static_cast<FX_FLOAT*>( | 728 m_fMCWid = *static_cast<FX_FLOAT*>( |
769 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::Width)); | 729 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::Width)); |
770 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_WeekNumbers) { | 730 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_WeekNumbers) { |
771 m_fMCWid += m_fWeekNumWid; | 731 m_fMCWid += m_fWeekNumWid; |
772 } | 732 } |
773 m_fMCHei = *static_cast<FX_FLOAT*>( | 733 m_fMCHei = *static_cast<FX_FLOAT*>( |
774 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::Height)); | 734 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::Height)); |
775 } | 735 } |
776 | 736 |
777 int32_t IFWL_MonthCalendar::CalWeekNumber(int32_t iYear, | 737 void IFWL_MonthCalendar::InitDate() { |
778 int32_t iMonth, | |
779 int32_t iDay) { | |
780 return 0; | |
781 } | |
782 | |
783 bool IFWL_MonthCalendar::GetMinDate(int32_t& iYear, | |
784 int32_t& iMonth, | |
785 int32_t& iDay) { | |
786 iYear = m_dtMin.iYear; | |
787 iMonth = m_dtMin.iMonth; | |
788 iDay = m_dtMin.iDay; | |
789 return true; | |
790 } | |
791 | |
792 bool IFWL_MonthCalendar::SetMinDate(int32_t iYear, | |
793 int32_t iMonth, | |
794 int32_t iDay) { | |
795 m_dtMin = DATE(iYear, iMonth, iDay); | |
796 return true; | |
797 } | |
798 | |
799 bool IFWL_MonthCalendar::GetMaxDate(int32_t& iYear, | |
800 int32_t& iMonth, | |
801 int32_t& iDay) { | |
802 iYear = m_dtMax.iYear; | |
803 iMonth = m_dtMax.iMonth; | |
804 iDay = m_dtMax.iDay; | |
805 return true; | |
806 } | |
807 | |
808 bool IFWL_MonthCalendar::SetMaxDate(int32_t iYear, | |
809 int32_t iMonth, | |
810 int32_t iDay) { | |
811 m_dtMax = DATE(iYear, iMonth, iDay); | |
812 return true; | |
813 } | |
814 | |
815 bool IFWL_MonthCalendar::InitDate() { | |
816 if (m_pProperties->m_pDataProvider) { | 738 if (m_pProperties->m_pDataProvider) { |
817 IFWL_MonthCalendarDP* pDateProv = | 739 IFWL_MonthCalendarDP* pDateProv = |
818 static_cast<IFWL_MonthCalendarDP*>(m_pProperties->m_pDataProvider); | 740 static_cast<IFWL_MonthCalendarDP*>(m_pProperties->m_pDataProvider); |
819 m_iYear = pDateProv->GetCurYear(this); | 741 m_iYear = pDateProv->GetCurYear(this); |
820 m_iMonth = pDateProv->GetCurMonth(this); | 742 m_iMonth = pDateProv->GetCurMonth(this); |
821 m_iDay = pDateProv->GetCurDay(this); | 743 m_iDay = pDateProv->GetCurDay(this); |
822 m_iCurYear = m_iYear; | 744 m_iCurYear = m_iYear; |
823 m_iCurMonth = m_iMonth; | 745 m_iCurMonth = m_iMonth; |
824 } else { | 746 } else { |
825 m_iDay = 1; | 747 m_iDay = 1; |
826 m_iMonth = 1; | 748 m_iMonth = 1; |
827 m_iYear = 1; | 749 m_iYear = 1; |
828 m_iCurYear = m_iYear; | 750 m_iCurYear = m_iYear; |
829 m_iCurMonth = m_iMonth; | 751 m_iCurMonth = m_iMonth; |
830 } | 752 } |
831 GetTodayText(m_iYear, m_iMonth, m_iDay, m_wsToday); | 753 GetTodayText(m_iYear, m_iMonth, m_iDay, m_wsToday); |
832 GetHeadText(m_iCurYear, m_iCurMonth, m_wsHead); | 754 GetHeadText(m_iCurYear, m_iCurMonth, m_wsHead); |
833 m_dtMin = DATE(1500, 12, 1); | 755 m_dtMin = DATE(1500, 12, 1); |
834 m_dtMax = DATE(2200, 1, 1); | 756 m_dtMax = DATE(2200, 1, 1); |
835 return true; | |
836 } | 757 } |
837 | 758 |
838 void IFWL_MonthCalendar::ClearDateItem() { | 759 void IFWL_MonthCalendar::ClearDateItem() { |
839 for (int32_t i = 0; i < m_arrDates.GetSize(); i++) | 760 for (int32_t i = 0; i < m_arrDates.GetSize(); i++) |
840 delete m_arrDates.GetAt(i); | 761 delete m_arrDates.GetAt(i); |
841 | 762 |
842 m_arrDates.RemoveAll(); | 763 m_arrDates.RemoveAll(); |
843 } | 764 } |
844 | 765 |
845 void IFWL_MonthCalendar::ReSetDateItem() { | 766 void IFWL_MonthCalendar::ResetDateItem() { |
846 m_pDateTime->Set(m_iCurYear, m_iCurMonth, 1); | 767 m_pDateTime->Set(m_iCurYear, m_iCurMonth, 1); |
847 int32_t iDays = FX_DaysInMonth(m_iCurYear, m_iCurMonth); | 768 int32_t iDays = FX_DaysInMonth(m_iCurYear, m_iCurMonth); |
848 int32_t iDayOfWeek = m_pDateTime->GetDayOfWeek(); | 769 int32_t iDayOfWeek = m_pDateTime->GetDayOfWeek(); |
849 for (int32_t i = 0; i < iDays; i++) { | 770 for (int32_t i = 0; i < iDays; i++) { |
850 if (iDayOfWeek >= 7) { | 771 if (iDayOfWeek >= 7) { |
851 iDayOfWeek = 0; | 772 iDayOfWeek = 0; |
852 } | 773 } |
853 CFX_WideString wsDay; | 774 CFX_WideString wsDay; |
854 wsDay.Format(L"%d", i + 1); | 775 wsDay.Format(L"%d", i + 1); |
855 uint32_t dwStates = 0; | 776 uint32_t dwStates = 0; |
856 if (m_iYear == m_iCurYear && m_iMonth == m_iCurMonth && m_iDay == (i + 1)) { | 777 if (m_iYear == m_iCurYear && m_iMonth == m_iCurMonth && m_iDay == (i + 1)) { |
857 dwStates |= FWL_ITEMSTATE_MCD_Flag; | 778 dwStates |= FWL_ITEMSTATE_MCD_Flag; |
858 } | 779 } |
859 if (m_arrSelDays.Find(i + 1) != -1) { | 780 if (m_arrSelDays.Find(i + 1) != -1) { |
860 dwStates |= FWL_ITEMSTATE_MCD_Selected; | 781 dwStates |= FWL_ITEMSTATE_MCD_Selected; |
861 } | 782 } |
862 CFX_RectF rtDate; | 783 CFX_RectF rtDate; |
863 rtDate.Set(0, 0, 0, 0); | 784 rtDate.Set(0, 0, 0, 0); |
864 m_arrDates.Add( | 785 m_arrDates.Add(new DATEINFO(i + 1, iDayOfWeek, dwStates, rtDate, wsDay)); |
865 new FWL_DATEINFO(i + 1, iDayOfWeek, dwStates, rtDate, wsDay)); | |
866 iDayOfWeek++; | 786 iDayOfWeek++; |
867 } | 787 } |
868 } | 788 } |
869 | 789 |
870 bool IFWL_MonthCalendar::NextMonth() { | 790 void IFWL_MonthCalendar::NextMonth() { |
871 int32_t iYear = m_iCurYear, iMonth = m_iCurMonth; | 791 int32_t iYear = m_iCurYear, iMonth = m_iCurMonth; |
872 if (iMonth >= 12) { | 792 if (iMonth >= 12) { |
873 iMonth = 1; | 793 iMonth = 1; |
874 iYear++; | 794 iYear++; |
875 } else { | 795 } else { |
876 iMonth++; | 796 iMonth++; |
877 } | 797 } |
878 DATE dt(m_iCurYear, m_iCurMonth, 1); | 798 DATE dt(m_iCurYear, m_iCurMonth, 1); |
879 if (!(dt < m_dtMax)) { | 799 if (!(dt < m_dtMax)) { |
880 return false; | 800 return; |
881 } | 801 } |
882 m_iCurYear = iYear, m_iCurMonth = iMonth; | 802 m_iCurYear = iYear, m_iCurMonth = iMonth; |
883 ChangeToMonth(m_iCurYear, m_iCurMonth); | 803 ChangeToMonth(m_iCurYear, m_iCurMonth); |
884 return true; | |
885 } | 804 } |
886 | 805 |
887 bool IFWL_MonthCalendar::PrevMonth() { | 806 void IFWL_MonthCalendar::PrevMonth() { |
888 int32_t iYear = m_iCurYear, iMonth = m_iCurMonth; | 807 int32_t iYear = m_iCurYear, iMonth = m_iCurMonth; |
889 if (iMonth <= 1) { | 808 if (iMonth <= 1) { |
890 iMonth = 12; | 809 iMonth = 12; |
891 iYear--; | 810 iYear--; |
892 } else { | 811 } else { |
893 iMonth--; | 812 iMonth--; |
894 } | 813 } |
895 DATE dt(m_iCurYear, m_iCurMonth, 1); | 814 DATE dt(m_iCurYear, m_iCurMonth, 1); |
896 if (!(dt > m_dtMin)) { | 815 if (!(dt > m_dtMin)) { |
897 return false; | 816 return; |
898 } | 817 } |
899 m_iCurYear = iYear, m_iCurMonth = iMonth; | 818 m_iCurYear = iYear, m_iCurMonth = iMonth; |
900 ChangeToMonth(m_iCurYear, m_iCurMonth); | 819 ChangeToMonth(m_iCurYear, m_iCurMonth); |
901 return true; | |
902 } | 820 } |
903 | 821 |
904 void IFWL_MonthCalendar::ChangeToMonth(int32_t iYear, int32_t iMonth) { | 822 void IFWL_MonthCalendar::ChangeToMonth(int32_t iYear, int32_t iMonth) { |
905 m_iCurYear = iYear; | 823 m_iCurYear = iYear; |
906 m_iCurMonth = iMonth; | 824 m_iCurMonth = iMonth; |
907 m_iHovered = -1; | 825 m_iHovered = -1; |
908 ClearDateItem(); | 826 ClearDateItem(); |
909 ReSetDateItem(); | 827 ResetDateItem(); |
910 CalDateItem(); | 828 CalDateItem(); |
911 GetHeadText(m_iCurYear, m_iCurMonth, m_wsHead); | 829 GetHeadText(m_iCurYear, m_iCurMonth, m_wsHead); |
912 } | 830 } |
913 | 831 |
914 bool IFWL_MonthCalendar::RemoveSelDay(int32_t iDay, bool bAll) { | 832 void IFWL_MonthCalendar::RemoveSelDay(int32_t iDay, bool bAll) { |
915 if (iDay == -1 && !bAll) { | 833 if (iDay == -1 && !bAll) { |
916 return false; | 834 return; |
917 } | 835 } |
918 if (bAll) { | 836 if (bAll) { |
919 int32_t iCount = m_arrSelDays.GetSize(); | 837 int32_t iCount = m_arrSelDays.GetSize(); |
920 int32_t iDatesCount = m_arrDates.GetSize(); | 838 int32_t iDatesCount = m_arrDates.GetSize(); |
921 for (int32_t i = 0; i < iCount; i++) { | 839 for (int32_t i = 0; i < iCount; i++) { |
922 int32_t iSelDay = m_arrSelDays.GetAt(i); | 840 int32_t iSelDay = m_arrSelDays.GetAt(i); |
923 if (iSelDay <= iDatesCount) { | 841 if (iSelDay <= iDatesCount) { |
924 FWL_DATEINFO* pDateInfo = m_arrDates.GetAt(iSelDay - 1); | 842 DATEINFO* pDateInfo = m_arrDates.GetAt(iSelDay - 1); |
925 pDateInfo->dwStates &= ~FWL_ITEMSTATE_MCD_Selected; | 843 pDateInfo->dwStates &= ~FWL_ITEMSTATE_MCD_Selected; |
926 } | 844 } |
927 } | 845 } |
928 m_arrSelDays.RemoveAll(); | 846 m_arrSelDays.RemoveAll(); |
929 } else { | 847 } else { |
930 int32_t index = m_arrSelDays.Find(iDay); | 848 int32_t index = m_arrSelDays.Find(iDay); |
931 if (index == -1) { | 849 if (index == -1) { |
932 return false; | 850 return; |
933 } | 851 } |
934 int32_t iSelDay = m_arrSelDays.GetAt(iDay); | 852 int32_t iSelDay = m_arrSelDays.GetAt(iDay); |
935 int32_t iDatesCount = m_arrDates.GetSize(); | 853 int32_t iDatesCount = m_arrDates.GetSize(); |
936 if (iSelDay <= iDatesCount) { | 854 if (iSelDay <= iDatesCount) { |
937 FWL_DATEINFO* pDateInfo = m_arrDates.GetAt(iSelDay - 1); | 855 DATEINFO* pDateInfo = m_arrDates.GetAt(iSelDay - 1); |
938 pDateInfo->dwStates &= ~FWL_ITEMSTATE_MCD_Selected; | 856 pDateInfo->dwStates &= ~FWL_ITEMSTATE_MCD_Selected; |
939 } | 857 } |
940 m_arrSelDays.RemoveAt(index); | 858 m_arrSelDays.RemoveAt(index); |
941 } | 859 } |
942 return true; | |
943 } | 860 } |
944 | 861 |
945 bool IFWL_MonthCalendar::AddSelDay(int32_t iDay) { | 862 void IFWL_MonthCalendar::AddSelDay(int32_t iDay) { |
946 ASSERT(iDay > 0); | 863 ASSERT(iDay > 0); |
947 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_MultiSelect) { | 864 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_MultiSelect) |
948 } else { | 865 return; |
949 if (m_arrSelDays.Find(iDay) == -1) { | 866 |
950 RemoveSelDay(-1, true); | 867 if (m_arrSelDays.Find(iDay) == -1) { |
951 if (iDay <= m_arrDates.GetSize()) { | 868 RemoveSelDay(-1, true); |
952 FWL_DATEINFO* pDateInfo = m_arrDates.GetAt(iDay - 1); | 869 if (iDay <= m_arrDates.GetSize()) { |
953 pDateInfo->dwStates |= FWL_ITEMSTATE_MCD_Selected; | 870 DATEINFO* pDateInfo = m_arrDates.GetAt(iDay - 1); |
954 } | 871 pDateInfo->dwStates |= FWL_ITEMSTATE_MCD_Selected; |
955 m_arrSelDays.Add(iDay); | |
956 } | 872 } |
| 873 m_arrSelDays.Add(iDay); |
957 } | 874 } |
958 return true; | |
959 } | 875 } |
960 | 876 |
961 bool IFWL_MonthCalendar::JumpToToday() { | 877 void IFWL_MonthCalendar::JumpToToday() { |
962 if (m_iYear != m_iCurYear || m_iMonth != m_iCurMonth) { | 878 if (m_iYear != m_iCurYear || m_iMonth != m_iCurMonth) { |
963 m_iCurYear = m_iYear; | 879 m_iCurYear = m_iYear; |
964 m_iCurMonth = m_iMonth; | 880 m_iCurMonth = m_iMonth; |
965 ChangeToMonth(m_iYear, m_iMonth); | 881 ChangeToMonth(m_iYear, m_iMonth); |
966 AddSelDay(m_iDay); | 882 AddSelDay(m_iDay); |
967 } else { | 883 } else { |
968 if (m_arrSelDays.Find(m_iDay) == -1) { | 884 if (m_arrSelDays.Find(m_iDay) == -1) { |
969 AddSelDay(m_iDay); | 885 AddSelDay(m_iDay); |
970 } | 886 } |
971 } | 887 } |
972 return true; | |
973 } | 888 } |
974 | 889 |
975 void IFWL_MonthCalendar::GetHeadText(int32_t iYear, | 890 void IFWL_MonthCalendar::GetHeadText(int32_t iYear, |
976 int32_t iMonth, | 891 int32_t iMonth, |
977 CFX_WideString& wsHead) { | 892 CFX_WideString& wsHead) { |
978 ASSERT(iMonth > 0 && iMonth < 13); | 893 ASSERT(iMonth > 0 && iMonth < 13); |
979 static const FX_WCHAR* const pMonth[] = { | 894 static const FX_WCHAR* const pMonth[] = { |
980 L"January", L"February", L"March", L"April", | 895 L"January", L"February", L"March", L"April", |
981 L"May", L"June", L"July", L"August", | 896 L"May", L"June", L"July", L"August", |
982 L"September", L"October", L"November", L"December"}; | 897 L"September", L"October", L"November", L"December"}; |
983 wsHead.Format(L"%s, %d", pMonth[iMonth - 1], iYear); | 898 wsHead.Format(L"%s, %d", pMonth[iMonth - 1], iYear); |
984 } | 899 } |
985 | 900 |
986 void IFWL_MonthCalendar::GetTodayText(int32_t iYear, | 901 void IFWL_MonthCalendar::GetTodayText(int32_t iYear, |
987 int32_t iMonth, | 902 int32_t iMonth, |
988 int32_t iDay, | 903 int32_t iDay, |
989 CFX_WideString& wsToday) { | 904 CFX_WideString& wsToday) { |
990 wsToday.Format(L", %d/%d/%d", iDay, iMonth, iYear); | 905 wsToday.Format(L", %d/%d/%d", iDay, iMonth, iYear); |
991 } | 906 } |
992 | 907 |
993 int32_t IFWL_MonthCalendar::GetDayAtPoint(FX_FLOAT x, FX_FLOAT y) { | 908 int32_t IFWL_MonthCalendar::GetDayAtPoint(FX_FLOAT x, FX_FLOAT y) { |
994 int32_t iCount = m_arrDates.GetSize(); | 909 int32_t iCount = m_arrDates.GetSize(); |
995 for (int32_t i = 0; i < iCount; i++) { | 910 for (int32_t i = 0; i < iCount; i++) { |
996 FWL_DATEINFO* pDateInfo = m_arrDates.GetAt(i); | 911 DATEINFO* pDateInfo = m_arrDates.GetAt(i); |
997 if (pDateInfo->rect.Contains(x, y)) { | 912 if (pDateInfo->rect.Contains(x, y)) { |
998 return ++i; | 913 return ++i; |
999 } | 914 } |
1000 } | 915 } |
1001 return -1; | 916 return -1; |
1002 } | 917 } |
1003 | 918 |
1004 bool IFWL_MonthCalendar::GetDayRect(int32_t iDay, CFX_RectF& rtDay) { | 919 void IFWL_MonthCalendar::GetDayRect(int32_t iDay, CFX_RectF& rtDay) { |
1005 if (iDay <= 0 || iDay > m_arrDates.GetSize()) { | 920 if (iDay <= 0 || iDay > m_arrDates.GetSize()) |
1006 return false; | 921 return; |
1007 } | 922 |
1008 FWL_DATEINFO* pDateInfo = m_arrDates[iDay - 1]; | 923 DATEINFO* pDateInfo = m_arrDates[iDay - 1]; |
1009 if (!pDateInfo) | 924 if (!pDateInfo) |
1010 return false; | 925 return; |
1011 rtDay = pDateInfo->rect; | 926 rtDay = pDateInfo->rect; |
1012 return true; | |
1013 } | 927 } |
1014 | 928 |
1015 void IFWL_MonthCalendar::OnProcessMessage(CFWL_Message* pMessage) { | 929 void IFWL_MonthCalendar::OnProcessMessage(CFWL_Message* pMessage) { |
1016 if (!pMessage) | 930 if (!pMessage) |
1017 return; | 931 return; |
1018 | 932 |
1019 CFWL_MessageType dwMsgCode = pMessage->GetClassID(); | 933 CFWL_MessageType dwMsgCode = pMessage->GetClassID(); |
1020 switch (dwMsgCode) { | 934 switch (dwMsgCode) { |
1021 case CFWL_MessageType::SetFocus: | 935 case CFWL_MessageType::SetFocus: |
1022 case CFWL_MessageType::KillFocus: | 936 case CFWL_MessageType::KillFocus: |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1096 int32_t iOldSel = 0; | 1010 int32_t iOldSel = 0; |
1097 if (m_arrSelDays.GetSize() > 0) | 1011 if (m_arrSelDays.GetSize() > 0) |
1098 iOldSel = m_arrSelDays[0]; | 1012 iOldSel = m_arrSelDays[0]; |
1099 | 1013 |
1100 int32_t iCurSel = GetDayAtPoint(pMsg->m_fx, pMsg->m_fy); | 1014 int32_t iCurSel = GetDayAtPoint(pMsg->m_fx, pMsg->m_fy); |
1101 CFX_RectF rt; | 1015 CFX_RectF rt; |
1102 IFWL_DateTimePicker* pIPicker = static_cast<IFWL_DateTimePicker*>(m_pOuter); | 1016 IFWL_DateTimePicker* pIPicker = static_cast<IFWL_DateTimePicker*>(m_pOuter); |
1103 pIPicker->GetFormProxy()->GetWidgetRect(rt); | 1017 pIPicker->GetFormProxy()->GetWidgetRect(rt); |
1104 rt.Set(0, 0, rt.width, rt.height); | 1018 rt.Set(0, 0, rt.width, rt.height); |
1105 if (iCurSel > 0) { | 1019 if (iCurSel > 0) { |
1106 FWL_DATEINFO* lpDatesInfo = m_arrDates.GetAt(iCurSel - 1); | 1020 DATEINFO* lpDatesInfo = m_arrDates.GetAt(iCurSel - 1); |
1107 CFX_RectF rtInvalidate(lpDatesInfo->rect); | 1021 CFX_RectF rtInvalidate(lpDatesInfo->rect); |
1108 if (iOldSel > 0 && iOldSel <= m_arrDates.GetSize()) { | 1022 if (iOldSel > 0 && iOldSel <= m_arrDates.GetSize()) { |
1109 lpDatesInfo = m_arrDates.GetAt(iOldSel - 1); | 1023 lpDatesInfo = m_arrDates.GetAt(iOldSel - 1); |
1110 rtInvalidate.Union(lpDatesInfo->rect); | 1024 rtInvalidate.Union(lpDatesInfo->rect); |
1111 } | 1025 } |
1112 AddSelDay(iCurSel); | 1026 AddSelDay(iCurSel); |
1113 if (!m_pOuter) | 1027 if (!m_pOuter) |
1114 return; | 1028 return; |
1115 | 1029 |
1116 pIPicker->ProcessSelChanged(m_iCurYear, m_iCurMonth, iCurSel); | 1030 pIPicker->ProcessSelChanged(m_iCurYear, m_iCurMonth, iCurSel); |
(...skipping 17 matching lines...) Expand all Loading... |
1134 } | 1048 } |
1135 if (m_rtToday.Contains(pMsg->m_fx, pMsg->m_fy)) | 1049 if (m_rtToday.Contains(pMsg->m_fx, pMsg->m_fy)) |
1136 return; | 1050 return; |
1137 | 1051 |
1138 int32_t iOldSel = 0; | 1052 int32_t iOldSel = 0; |
1139 if (m_arrSelDays.GetSize() > 0) | 1053 if (m_arrSelDays.GetSize() > 0) |
1140 iOldSel = m_arrSelDays[0]; | 1054 iOldSel = m_arrSelDays[0]; |
1141 | 1055 |
1142 int32_t iCurSel = GetDayAtPoint(pMsg->m_fx, pMsg->m_fy); | 1056 int32_t iCurSel = GetDayAtPoint(pMsg->m_fx, pMsg->m_fy); |
1143 if (iCurSel > 0) { | 1057 if (iCurSel > 0) { |
1144 FWL_DATEINFO* lpDatesInfo = m_arrDates.GetAt(iCurSel - 1); | 1058 DATEINFO* lpDatesInfo = m_arrDates.GetAt(iCurSel - 1); |
1145 CFX_RectF rtInvalidate(lpDatesInfo->rect); | 1059 CFX_RectF rtInvalidate(lpDatesInfo->rect); |
1146 if (iOldSel > 0 && iOldSel <= m_arrDates.GetSize()) { | 1060 if (iOldSel > 0 && iOldSel <= m_arrDates.GetSize()) { |
1147 lpDatesInfo = m_arrDates.GetAt(iOldSel - 1); | 1061 lpDatesInfo = m_arrDates.GetAt(iOldSel - 1); |
1148 rtInvalidate.Union(lpDatesInfo->rect); | 1062 rtInvalidate.Union(lpDatesInfo->rect); |
1149 } | 1063 } |
1150 AddSelDay(iCurSel); | 1064 AddSelDay(iCurSel); |
1151 IFWL_DateTimePicker* pDateTime = | 1065 IFWL_DateTimePicker* pDateTime = |
1152 static_cast<IFWL_DateTimePicker*>(m_pOuter); | 1066 static_cast<IFWL_DateTimePicker*>(m_pOuter); |
1153 pDateTime->ProcessSelChanged(m_iCurYear, m_iCurMonth, iCurSel); | 1067 pDateTime->ProcessSelChanged(m_iCurYear, m_iCurMonth, iCurSel); |
1154 pDateTime->ShowMonthCalendar(false); | 1068 pDateTime->ShowMonthCalendar(false); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 return; | 1108 return; |
1195 | 1109 |
1196 CFX_RectF rtInvalidate; | 1110 CFX_RectF rtInvalidate; |
1197 rtInvalidate.Set(0, 0, 0, 0); | 1111 rtInvalidate.Set(0, 0, 0, 0); |
1198 GetDayRect(m_iHovered, rtInvalidate); | 1112 GetDayRect(m_iHovered, rtInvalidate); |
1199 m_iHovered = -1; | 1113 m_iHovered = -1; |
1200 if (!rtInvalidate.IsEmpty()) | 1114 if (!rtInvalidate.IsEmpty()) |
1201 Repaint(&rtInvalidate); | 1115 Repaint(&rtInvalidate); |
1202 } | 1116 } |
1203 | 1117 |
1204 FWL_DATEINFO::FWL_DATEINFO(int32_t day, | 1118 IFWL_MonthCalendar::DATEINFO::DATEINFO(int32_t day, |
1205 int32_t dayofweek, | 1119 int32_t dayofweek, |
1206 uint32_t dwSt, | 1120 uint32_t dwSt, |
1207 CFX_RectF rc, | 1121 CFX_RectF rc, |
1208 CFX_WideString& wsday) | 1122 CFX_WideString& wsday) |
1209 : iDay(day), | 1123 : iDay(day), |
1210 iDayOfWeek(dayofweek), | 1124 iDayOfWeek(dayofweek), |
1211 dwStates(dwSt), | 1125 dwStates(dwSt), |
1212 rect(rc), | 1126 rect(rc), |
1213 wsDay(wsday) {} | 1127 wsDay(wsday) {} |
1214 | 1128 |
1215 FWL_DATEINFO::~FWL_DATEINFO() {} | 1129 IFWL_MonthCalendar::DATEINFO::~DATEINFO() {} |
OLD | NEW |