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 "../../../foxitlib.h" | 7 #include "../../../foxitlib.h" |
8 #include "../core/include/fwl_targetimp.h" | 8 #include "../core/include/fwl_targetimp.h" |
9 #include "../core/include/fwl_noteimp.h" | 9 #include "../core/include/fwl_noteimp.h" |
10 #include "../core/include/fwl_widgetimp.h" | 10 #include "../core/include/fwl_widgetimp.h" |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 params.m_iTTOAlign = FDE_TTOALIGNMENT_Center; | 350 params.m_iTTOAlign = FDE_TTOALIGNMENT_Center; |
351 int32_t iWeek; | 351 int32_t iWeek; |
352 iWeek = m_pDateTime->GetDayOfWeek(); | 352 iWeek = m_pDateTime->GetDayOfWeek(); |
353 CFX_RectF rtDayOfWeek; | 353 CFX_RectF rtDayOfWeek; |
354 if (pMatrix) { | 354 if (pMatrix) { |
355 params.m_matrix.Concat(*pMatrix); | 355 params.m_matrix.Concat(*pMatrix); |
356 } | 356 } |
357 for (int32_t i = 0; i < 7; i++) { | 357 for (int32_t i = 0; i < 7; i++) { |
358 rtDayOfWeek.Set(m_rtWeek.left + i * (m_szCell.x + MONTHCAL_HMARGIN * 2), | 358 rtDayOfWeek.Set(m_rtWeek.left + i * (m_szCell.x + MONTHCAL_HMARGIN * 2), |
359 m_rtWeek.top, m_szCell.x, m_szCell.y); | 359 m_rtWeek.top, m_szCell.x, m_szCell.y); |
360 CFX_WideString* wsWeekDay = NULL; | 360 CFX_WideString* wsWeekDay = static_cast<CFX_WideString*>( |
361 wsWeekDay = | 361 pTheme->GetCapacity(¶ms, i + FWL_MCCAPACITY_Sun)); |
362 (CFX_WideString*)pTheme->GetCapacity(¶ms, i + FWL_MCCAPACITY_Sun); | |
363 params.m_rtPart = rtDayOfWeek; | 362 params.m_rtPart = rtDayOfWeek; |
364 params.m_wsText = *wsWeekDay; | 363 params.m_wsText = *wsWeekDay; |
365 params.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; | 364 params.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; |
366 pTheme->DrawText(¶ms); | 365 pTheme->DrawText(¶ms); |
367 } | 366 } |
368 } | 367 } |
369 void CFWL_MonthCalendarImp::DrawWeekNumber(CFX_Graphics* pGraphics, | 368 void CFWL_MonthCalendarImp::DrawWeekNumber(CFX_Graphics* pGraphics, |
370 IFWL_ThemeProvider* pTheme, | 369 IFWL_ThemeProvider* pTheme, |
371 const CFX_Matrix* pMatrix) { | 370 const CFX_Matrix* pMatrix) { |
372 CFWL_ThemeText params; | 371 CFWL_ThemeText params; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 const CFX_Matrix* pMatrix) { | 416 const CFX_Matrix* pMatrix) { |
418 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoToday) { | 417 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoToday) { |
419 return; | 418 return; |
420 } | 419 } |
421 CFWL_ThemeText params; | 420 CFWL_ThemeText params; |
422 params.m_pWidget = m_pInterface; | 421 params.m_pWidget = m_pInterface; |
423 params.m_iPart = FWL_PART_MCD_Today; | 422 params.m_iPart = FWL_PART_MCD_Today; |
424 params.m_pGraphics = pGraphics; | 423 params.m_pGraphics = pGraphics; |
425 params.m_dwStates = FWL_PARTSTATE_MCD_Normal; | 424 params.m_dwStates = FWL_PARTSTATE_MCD_Normal; |
426 params.m_iTTOAlign = FDE_TTOALIGNMENT_CenterLeft; | 425 params.m_iTTOAlign = FDE_TTOALIGNMENT_CenterLeft; |
427 CFX_WideString* wsDay = NULL; | 426 CFX_WideString* wsDay = static_cast<CFX_WideString*>( |
428 wsDay = (CFX_WideString*)pTheme->GetCapacity(¶ms, FWL_MCCAPACITY_Today); | 427 pTheme->GetCapacity(¶ms, FWL_MCCAPACITY_Today)); |
429 CFX_WideString wsText; | 428 CFX_WideString wsText; |
430 GetTodayText(m_iYear, m_iMonth, m_iDay, wsText); | 429 GetTodayText(m_iYear, m_iMonth, m_iDay, wsText); |
431 params.m_wsText = *wsDay + wsText; | 430 params.m_wsText = *wsDay + wsText; |
432 m_szToday = CalcTextSize(params.m_wsText, m_pProperties->m_pThemeProvider); | 431 m_szToday = CalcTextSize(params.m_wsText, m_pProperties->m_pThemeProvider); |
433 CalcTodaySize(); | 432 CalcTodaySize(); |
434 params.m_rtPart = m_rtToday; | 433 params.m_rtPart = m_rtToday; |
435 params.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; | 434 params.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; |
436 if (pMatrix) { | 435 if (pMatrix) { |
437 params.m_matrix.Concat(*pMatrix); | 436 params.m_matrix.Concat(*pMatrix); |
438 } | 437 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 return fs; | 529 return fs; |
531 if (bAutoSize) { | 530 if (bAutoSize) { |
532 CFWL_ThemePart params; | 531 CFWL_ThemePart params; |
533 params.m_pWidget = m_pInterface; | 532 params.m_pWidget = m_pInterface; |
534 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; | 533 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; |
535 CFX_WideString* wsText = NULL; | 534 CFX_WideString* wsText = NULL; |
536 FX_FLOAT fMaxWeekW = 0.0f; | 535 FX_FLOAT fMaxWeekW = 0.0f; |
537 FX_FLOAT fMaxWeekH = 0.0f; | 536 FX_FLOAT fMaxWeekH = 0.0f; |
538 for (FX_DWORD week = FWL_MCCAPACITY_Sun; week <= FWL_MCCAPACITY_Sat; | 537 for (FX_DWORD week = FWL_MCCAPACITY_Sun; week <= FWL_MCCAPACITY_Sat; |
539 week++) { | 538 week++) { |
540 wsText = (CFX_WideString*)pTheme->GetCapacity(¶ms, week); | 539 wsText = static_cast<CFX_WideString*>(pTheme->GetCapacity(¶ms, week)); |
541 CFX_SizeF sz = CalcTextSize(*wsText, m_pProperties->m_pThemeProvider); | 540 CFX_SizeF sz = CalcTextSize(*wsText, m_pProperties->m_pThemeProvider); |
542 fMaxWeekW = (fMaxWeekW >= sz.x) ? fMaxWeekW : sz.x; | 541 fMaxWeekW = (fMaxWeekW >= sz.x) ? fMaxWeekW : sz.x; |
543 fMaxWeekH = (fMaxWeekH >= sz.y) ? fMaxWeekH : sz.y; | 542 fMaxWeekH = (fMaxWeekH >= sz.y) ? fMaxWeekH : sz.y; |
544 } | 543 } |
545 FX_FLOAT fDayMaxW = 0.0f; | 544 FX_FLOAT fDayMaxW = 0.0f; |
546 FX_FLOAT fDayMaxH = 0.0f; | 545 FX_FLOAT fDayMaxH = 0.0f; |
547 for (int day = 10; day <= 31; day++) { | 546 for (int day = 10; day <= 31; day++) { |
548 CFX_WideString wsDay; | 547 CFX_WideString wsDay; |
549 wsDay.Format(L"%d", day); | 548 wsDay.Format(L"%d", day); |
550 CFX_SizeF sz = CalcTextSize(wsDay, m_pProperties->m_pThemeProvider); | 549 CFX_SizeF sz = CalcTextSize(wsDay, m_pProperties->m_pThemeProvider); |
551 fDayMaxW = (fDayMaxW >= sz.x) ? fDayMaxW : sz.x; | 550 fDayMaxW = (fDayMaxW >= sz.x) ? fDayMaxW : sz.x; |
552 fDayMaxH = (fDayMaxH >= sz.y) ? fDayMaxH : sz.y; | 551 fDayMaxH = (fDayMaxH >= sz.y) ? fDayMaxH : sz.y; |
553 } | 552 } |
554 m_szCell.x = FX_FLOAT((fMaxWeekW >= fDayMaxW) ? (int)(fMaxWeekW + 0.5) | 553 m_szCell.x = FX_FLOAT((fMaxWeekW >= fDayMaxW) ? (int)(fMaxWeekW + 0.5) |
555 : (int)(fDayMaxW + 0.5)); | 554 : (int)(fDayMaxW + 0.5)); |
556 m_szCell.y = (fMaxWeekH >= fDayMaxH) ? fMaxWeekH : fDayMaxH; | 555 m_szCell.y = (fMaxWeekH >= fDayMaxH) ? fMaxWeekH : fDayMaxH; |
557 fs.x = m_szCell.x * MONTHCAL_COLUMNS + | 556 fs.x = m_szCell.x * MONTHCAL_COLUMNS + |
558 MONTHCAL_HMARGIN * MONTHCAL_COLUMNS * 2 + | 557 MONTHCAL_HMARGIN * MONTHCAL_COLUMNS * 2 + |
559 MONTHCAL_HEADER_BTN_HMARGIN * 2; | 558 MONTHCAL_HEADER_BTN_HMARGIN * 2; |
560 FX_FLOAT fMonthMaxW = 0.0f; | 559 FX_FLOAT fMonthMaxW = 0.0f; |
561 FX_FLOAT fMonthMaxH = 0.0f; | 560 FX_FLOAT fMonthMaxH = 0.0f; |
562 for (FX_DWORD month = FWL_MCCAPACITY_January; | 561 for (FX_DWORD month = FWL_MCCAPACITY_January; |
563 month <= FWL_MCCAPACITY_December; month++) { | 562 month <= FWL_MCCAPACITY_December; month++) { |
564 wsText = (CFX_WideString*)pTheme->GetCapacity(¶ms, month); | 563 wsText = |
| 564 static_cast<CFX_WideString*>(pTheme->GetCapacity(¶ms, month)); |
565 CFX_SizeF sz = CalcTextSize(*wsText, m_pProperties->m_pThemeProvider); | 565 CFX_SizeF sz = CalcTextSize(*wsText, m_pProperties->m_pThemeProvider); |
566 fMonthMaxW = (fMonthMaxW >= sz.x) ? fMonthMaxW : sz.x; | 566 fMonthMaxW = (fMonthMaxW >= sz.x) ? fMonthMaxW : sz.x; |
567 fMonthMaxH = (fMonthMaxH >= sz.y) ? fMonthMaxH : sz.y; | 567 fMonthMaxH = (fMonthMaxH >= sz.y) ? fMonthMaxH : sz.y; |
568 } | 568 } |
569 CFX_WideString wsYear; | 569 CFX_WideString wsYear; |
570 GetHeadText(m_iYear, m_iMonth, wsYear); | 570 GetHeadText(m_iYear, m_iMonth, wsYear); |
571 CFX_SizeF szYear = CalcTextSize(wsYear, m_pProperties->m_pThemeProvider); | 571 CFX_SizeF szYear = CalcTextSize(wsYear, m_pProperties->m_pThemeProvider); |
572 fMonthMaxH = (fMonthMaxH >= szYear.y) ? fMonthMaxH : szYear.y; | 572 fMonthMaxH = (fMonthMaxH >= szYear.y) ? fMonthMaxH : szYear.y; |
573 m_szHead.Set(fMonthMaxW + szYear.x, fMonthMaxH); | 573 m_szHead.Set(fMonthMaxW + szYear.x, fMonthMaxH); |
574 fMonthMaxW = m_szHead.x + MONTHCAL_HEADER_BTN_HMARGIN * 2 + m_szCell.x * 2; | 574 fMonthMaxW = m_szHead.x + MONTHCAL_HEADER_BTN_HMARGIN * 2 + m_szCell.x * 2; |
575 fs.x = (fs.x >= fMonthMaxW) ? fs.x : fMonthMaxW; | 575 fs.x = (fs.x >= fMonthMaxW) ? fs.x : fMonthMaxW; |
576 CFX_WideString wsToday; | 576 CFX_WideString wsToday; |
577 GetTodayText(m_iYear, m_iMonth, m_iDay, wsToday); | 577 GetTodayText(m_iYear, m_iMonth, m_iDay, wsToday); |
578 wsText = | 578 wsText = static_cast<CFX_WideString*>( |
579 (CFX_WideString*)pTheme->GetCapacity(¶ms, FWL_MCCAPACITY_Today); | 579 pTheme->GetCapacity(¶ms, FWL_MCCAPACITY_Today)); |
580 m_wsToday = *wsText + wsToday; | 580 m_wsToday = *wsText + wsToday; |
581 m_szToday = CalcTextSize(wsToday, m_pProperties->m_pThemeProvider); | 581 m_szToday = CalcTextSize(wsToday, m_pProperties->m_pThemeProvider); |
582 m_szToday.y = (m_szToday.y >= m_szCell.y) ? m_szToday.y : m_szCell.y; | 582 m_szToday.y = (m_szToday.y >= m_szCell.y) ? m_szToday.y : m_szCell.y; |
583 fs.y = m_szCell.x + m_szCell.y * (MONTHCAL_ROWS - 2) + m_szToday.y + | 583 fs.y = m_szCell.x + m_szCell.y * (MONTHCAL_ROWS - 2) + m_szToday.y + |
584 MONTHCAL_VMARGIN * MONTHCAL_ROWS * 2 + | 584 MONTHCAL_VMARGIN * MONTHCAL_ROWS * 2 + |
585 MONTHCAL_HEADER_BTN_VMARGIN * 4; | 585 MONTHCAL_HEADER_BTN_VMARGIN * 4; |
586 } else { | 586 } else { |
587 GetClientRect(m_rtClient); | 587 GetClientRect(m_rtClient); |
588 fs.Set(m_rtClient.width, m_rtClient.height); | 588 fs.Set(m_rtClient.width, m_rtClient.height); |
589 } | 589 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 } | 664 } |
665 } | 665 } |
666 } | 666 } |
667 void CFWL_MonthCalendarImp::GetCapValue() { | 667 void CFWL_MonthCalendarImp::GetCapValue() { |
668 if (!m_pProperties->m_pThemeProvider) { | 668 if (!m_pProperties->m_pThemeProvider) { |
669 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 669 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
670 } | 670 } |
671 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; | 671 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; |
672 CFWL_ThemePart part; | 672 CFWL_ThemePart part; |
673 part.m_pWidget = m_pInterface; | 673 part.m_pWidget = m_pInterface; |
674 m_fHeadWid = | 674 m_fHeadWid = *static_cast<FX_FLOAT*>( |
675 *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_WIDTH); | 675 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_WIDTH)); |
676 m_fHeadHei = | 676 m_fHeadHei = *static_cast<FX_FLOAT*>( |
677 *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_Height); | 677 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_Height)); |
678 m_fHeadBtnWid = *(FX_FLOAT*)pTheme->GetCapacity( | 678 m_fHeadBtnWid = *static_cast<FX_FLOAT*>( |
679 &part, FWL_WGTCAPACITY_MC_HEADER_BTN_WIDTH); | 679 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_BTN_WIDTH)); |
680 m_fHeadBtnHei = *(FX_FLOAT*)pTheme->GetCapacity( | 680 m_fHeadBtnHei = *static_cast<FX_FLOAT*>( |
681 &part, FWL_WGTCAPACITY_MC_HEADER_BTN_HEIGHT); | 681 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_BTN_HEIGHT)); |
682 m_fHeadBtnHMargin = *(FX_FLOAT*)pTheme->GetCapacity( | 682 m_fHeadBtnHMargin = *static_cast<FX_FLOAT*>( |
683 &part, FWL_WGTCAPACITY_MC_HEADER_BTN_HMARGIN); | 683 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_BTN_HMARGIN)); |
684 m_fHeadBtnVMargin = *(FX_FLOAT*)pTheme->GetCapacity( | 684 m_fHeadBtnVMargin = *static_cast<FX_FLOAT*>( |
685 &part, FWL_WGTCAPACITY_MC_HEADER_BTN_VMARGIN); | 685 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_BTN_VMARGIN)); |
686 m_fHeadTextWid = *(FX_FLOAT*)pTheme->GetCapacity( | 686 m_fHeadTextWid = *static_cast<FX_FLOAT*>( |
687 &part, FWL_WGTCAPACITY_MC_HEADER_TEXTWIDHT); | 687 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_TEXTWIDHT)); |
688 m_fHeadTextHei = *(FX_FLOAT*)pTheme->GetCapacity( | 688 m_fHeadTextHei = *static_cast<FX_FLOAT*>( |
689 &part, FWL_WGTCAPACITY_MC_HEADER_TEXTHEIGHT); | 689 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_TEXTHEIGHT)); |
690 m_fHeadTextHMargin = *(FX_FLOAT*)pTheme->GetCapacity( | 690 m_fHeadTextHMargin = *static_cast<FX_FLOAT*>( |
691 &part, FWL_WGTCAPACITY_MC_HEADER_TEXT_HMARGIN); | 691 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_TEXT_HMARGIN)); |
692 m_fHeadTextVMargin = *(FX_FLOAT*)pTheme->GetCapacity( | 692 m_fHeadTextVMargin = *static_cast<FX_FLOAT*>( |
693 &part, FWL_WGTCAPACITY_MC_HEADER_TEXT_VMARGIN); | 693 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_TEXT_VMARGIN)); |
694 m_fHSepWid = | 694 m_fHSepWid = *static_cast<FX_FLOAT*>( |
695 *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HSEP_WIDTH); | 695 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HSEP_WIDTH)); |
696 m_fHSepHei = | 696 m_fHSepHei = *static_cast<FX_FLOAT*>( |
697 *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HSEP_HEIGHT); | 697 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HSEP_HEIGHT)); |
698 m_fWeekNumWid = | 698 m_fWeekNumWid = *static_cast<FX_FLOAT*>( |
699 *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_WEEKNUM_WIDTH); | 699 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_WEEKNUM_WIDTH)); |
700 m_fSepDOffset = | 700 m_fSepDOffset = *static_cast<FX_FLOAT*>( |
701 *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_SEP_DOFFSET); | 701 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_SEP_DOFFSET)); |
702 m_fSepX = *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_SEP_X); | 702 m_fSepX = *static_cast<FX_FLOAT*>( |
703 m_fSepY = *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_SEP_Y); | 703 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_SEP_X)); |
704 m_fWeekNumHeigh = | 704 m_fSepY = *static_cast<FX_FLOAT*>( |
705 *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_WEEKNUM_HEIGHT); | 705 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_SEP_Y)); |
706 m_fWeekWid = | 706 m_fWeekNumHeigh = *static_cast<FX_FLOAT*>( |
707 *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_WEEK_WIDTH); | 707 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_WEEKNUM_HEIGHT)); |
708 m_fWeekHei = | 708 m_fWeekWid = *static_cast<FX_FLOAT*>( |
709 *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_WEEK_HEIGHT); | 709 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_WEEK_WIDTH)); |
710 m_fDateCellWid = *(FX_FLOAT*)pTheme->GetCapacity( | 710 m_fWeekHei = *static_cast<FX_FLOAT*>( |
711 &part, FWL_WGTCAPACITY_MC_DATES_CELL_WIDTH); | 711 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_WEEK_HEIGHT)); |
712 m_fDateCellHei = *(FX_FLOAT*)pTheme->GetCapacity( | 712 m_fDateCellWid = *static_cast<FX_FLOAT*>( |
713 &part, FWL_WGTCAPACITY_MC_DATES_CELL_HEIGHT); | 713 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_DATES_CELL_WIDTH)); |
714 m_fTodayWid = | 714 m_fDateCellHei = *static_cast<FX_FLOAT*>( |
715 *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_TODAY_WIDHT); | 715 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_DATES_CELL_HEIGHT)); |
716 m_fTodayHei = | 716 m_fTodayWid = *static_cast<FX_FLOAT*>( |
717 *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_TODAY_HEIGHT); | 717 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_TODAY_WIDHT)); |
718 m_fTodayFlagWid = *(FX_FLOAT*)pTheme->GetCapacity( | 718 m_fTodayHei = *static_cast<FX_FLOAT*>( |
719 &part, FWL_WGTCAPACITY_MC_TODAY_FLAG_WIDHT); | 719 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_TODAY_HEIGHT)); |
720 m_fMCWid = *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_WIDTH); | 720 m_fTodayFlagWid = *static_cast<FX_FLOAT*>( |
| 721 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_TODAY_FLAG_WIDHT)); |
| 722 m_fMCWid = *static_cast<FX_FLOAT*>( |
| 723 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_WIDTH)); |
721 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_WeekNumbers) { | 724 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_WeekNumbers) { |
722 m_fMCWid += m_fWeekNumWid; | 725 m_fMCWid += m_fWeekNumWid; |
723 } | 726 } |
724 m_fMCHei = *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEIGHT); | 727 m_fMCHei = *static_cast<FX_FLOAT*>( |
| 728 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEIGHT)); |
725 } | 729 } |
726 int32_t CFWL_MonthCalendarImp::CalWeekNumber(int32_t iYear, | 730 int32_t CFWL_MonthCalendarImp::CalWeekNumber(int32_t iYear, |
727 int32_t iMonth, | 731 int32_t iMonth, |
728 int32_t iDay) { | 732 int32_t iDay) { |
729 return 0; | 733 return 0; |
730 } | 734 } |
731 FX_BOOL CFWL_MonthCalendarImp::GetMinDate(int32_t& iYear, | 735 FX_BOOL CFWL_MonthCalendarImp::GetMinDate(int32_t& iYear, |
732 int32_t& iMonth, | 736 int32_t& iMonth, |
733 int32_t& iDay) { | 737 int32_t& iDay) { |
734 iYear = m_dtMin.iYear; | 738 iYear = m_dtMin.iYear; |
(...skipping 17 matching lines...) Expand all Loading... |
752 } | 756 } |
753 FX_BOOL CFWL_MonthCalendarImp::SetMaxDate(int32_t iYear, | 757 FX_BOOL CFWL_MonthCalendarImp::SetMaxDate(int32_t iYear, |
754 int32_t iMonth, | 758 int32_t iMonth, |
755 int32_t iDay) { | 759 int32_t iDay) { |
756 m_dtMax = DATE(iYear, iMonth, iDay); | 760 m_dtMax = DATE(iYear, iMonth, iDay); |
757 return TRUE; | 761 return TRUE; |
758 } | 762 } |
759 FX_BOOL CFWL_MonthCalendarImp::InitDate() { | 763 FX_BOOL CFWL_MonthCalendarImp::InitDate() { |
760 if (m_pProperties->m_pDataProvider) { | 764 if (m_pProperties->m_pDataProvider) { |
761 IFWL_MonthCalendarDP* pDateProv = | 765 IFWL_MonthCalendarDP* pDateProv = |
762 (IFWL_MonthCalendarDP*)(m_pProperties->m_pDataProvider); | 766 static_cast<IFWL_MonthCalendarDP*>(m_pProperties->m_pDataProvider); |
763 m_iYear = pDateProv->GetCurYear(m_pInterface); | 767 m_iYear = pDateProv->GetCurYear(m_pInterface); |
764 m_iMonth = pDateProv->GetCurMonth(m_pInterface); | 768 m_iMonth = pDateProv->GetCurMonth(m_pInterface); |
765 m_iDay = pDateProv->GetCurDay(m_pInterface); | 769 m_iDay = pDateProv->GetCurDay(m_pInterface); |
766 m_iCurYear = m_iYear; | 770 m_iCurYear = m_iYear; |
767 m_iCurMonth = m_iMonth; | 771 m_iCurMonth = m_iMonth; |
768 } else { | 772 } else { |
769 m_iDay = 1; | 773 m_iDay = 1; |
770 m_iMonth = 1; | 774 m_iMonth = 1; |
771 m_iYear = 1; | 775 m_iYear = 1; |
772 m_iCurYear = m_iYear; | 776 m_iCurYear = m_iYear; |
773 m_iCurMonth = m_iMonth; | 777 m_iCurMonth = m_iMonth; |
774 } | 778 } |
775 GetTodayText(m_iYear, m_iMonth, m_iDay, m_wsToday); | 779 GetTodayText(m_iYear, m_iMonth, m_iDay, m_wsToday); |
776 GetHeadText(m_iCurYear, m_iCurMonth, m_wsHead); | 780 GetHeadText(m_iCurYear, m_iCurMonth, m_wsHead); |
777 { | 781 m_dtMin = DATE(1500, 12, 1); |
778 m_dtMin = DATE(1500, 12, 1); | 782 m_dtMax = DATE(2200, 1, 1); |
779 m_dtMax = DATE(2200, 1, 1); | |
780 } | |
781 return TRUE; | 783 return TRUE; |
782 } | 784 } |
783 void CFWL_MonthCalendarImp::ClearDateItem() { | 785 void CFWL_MonthCalendarImp::ClearDateItem() { |
784 int32_t iCount = m_arrDates.GetSize(); | 786 int32_t iCount = m_arrDates.GetSize(); |
785 for (int32_t i = 0; i < iCount; i++) { | 787 for (int32_t i = 0; i < iCount; i++) { |
786 LPDATEINFO pData = (LPDATEINFO)m_arrDates.GetAt(i); | 788 LPDATEINFO pData = (LPDATEINFO)m_arrDates.GetAt(i); |
787 delete pData; | 789 delete pData; |
788 } | 790 } |
789 m_arrDates.RemoveAll(); | 791 m_arrDates.RemoveAll(); |
790 } | 792 } |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 switch (dwMsgCode) { | 961 switch (dwMsgCode) { |
960 case FWL_MSGHASH_SetFocus: | 962 case FWL_MSGHASH_SetFocus: |
961 case FWL_MSGHASH_KillFocus: { | 963 case FWL_MSGHASH_KillFocus: { |
962 OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); | 964 OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); |
963 break; | 965 break; |
964 } | 966 } |
965 case FWL_MSGHASH_Key: { | 967 case FWL_MSGHASH_Key: { |
966 break; | 968 break; |
967 } | 969 } |
968 case FWL_MSGHASH_Mouse: { | 970 case FWL_MSGHASH_Mouse: { |
969 CFWL_MsgMouse* pMouse = (CFWL_MsgMouse*)pMessage; | 971 CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage); |
970 FX_DWORD dwCmd = pMouse->m_dwCmd; | 972 FX_DWORD dwCmd = pMouse->m_dwCmd; |
971 switch (dwCmd) { | 973 switch (dwCmd) { |
972 case FWL_MSGMOUSECMD_LButtonDown: { | 974 case FWL_MSGMOUSECMD_LButtonDown: { |
973 OnLButtonDown(pMouse); | 975 OnLButtonDown(pMouse); |
974 break; | 976 break; |
975 } | 977 } |
976 case FWL_MSGMOUSECMD_LButtonUp: { | 978 case FWL_MSGMOUSECMD_LButtonUp: { |
977 OnLButtonUp(pMouse); | 979 OnLButtonUp(pMouse); |
978 break; | 980 break; |
979 } | 981 } |
980 case FWL_MSGMOUSECMD_MouseMove: { | 982 case FWL_MSGMOUSECMD_MouseMove: { |
981 OnMouseMove((CFWL_MsgMouse*)pMouse); | 983 OnMouseMove(pMouse); |
982 break; | 984 break; |
983 } | 985 } |
984 case FWL_MSGMOUSECMD_MouseLeave: { | 986 case FWL_MSGMOUSECMD_MouseLeave: { |
985 OnMouseLeave((CFWL_MsgMouse*)pMouse); | 987 OnMouseLeave(pMouse); |
986 break; | 988 break; |
987 } | 989 } |
988 default: { break; } | 990 default: { break; } |
989 } | 991 } |
990 break; | 992 break; |
991 } | 993 } |
992 default: { | 994 default: { |
993 iRet = 0; | 995 iRet = 0; |
994 break; | 996 break; |
995 } | 997 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1049 } | 1051 } |
1050 m_pOwner->AddSelDay(iCurSel); | 1052 m_pOwner->AddSelDay(iCurSel); |
1051 CFWL_EvtClick wmClick; | 1053 CFWL_EvtClick wmClick; |
1052 wmClick.m_pSrcTarget = m_pOwner->m_pInterface; | 1054 wmClick.m_pSrcTarget = m_pOwner->m_pInterface; |
1053 m_pOwner->DispatchEvent(&wmClick); | 1055 m_pOwner->DispatchEvent(&wmClick); |
1054 CFWL_EventMcdDateChanged wmDateSelected; | 1056 CFWL_EventMcdDateChanged wmDateSelected; |
1055 wmDateSelected.m_iStartDay = iCurSel; | 1057 wmDateSelected.m_iStartDay = iCurSel; |
1056 wmDateSelected.m_iEndDay = iCurSel; | 1058 wmDateSelected.m_iEndDay = iCurSel; |
1057 wmDateSelected.m_iOldMonth = m_pOwner->m_iCurMonth; | 1059 wmDateSelected.m_iOldMonth = m_pOwner->m_iCurMonth; |
1058 wmDateSelected.m_iOldYear = m_pOwner->m_iCurYear; | 1060 wmDateSelected.m_iOldYear = m_pOwner->m_iCurYear; |
1059 wmDateSelected.m_pSrcTarget = | 1061 wmDateSelected.m_pSrcTarget = m_pOwner->m_pInterface; |
1060 (IFWL_MonthCalendar*)m_pOwner->m_pInterface; | |
1061 m_pOwner->DispatchEvent(&wmDateSelected); | 1062 m_pOwner->DispatchEvent(&wmDateSelected); |
1062 m_pOwner->Repaint(&rtInvalidate); | 1063 m_pOwner->Repaint(&rtInvalidate); |
1063 } | 1064 } |
1064 } | 1065 } |
1065 } | 1066 } |
1066 } | 1067 } |
1067 void CFWL_MonthCalendarImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) { | 1068 void CFWL_MonthCalendarImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) { |
1068 if (m_pOwner->m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { | 1069 if (m_pOwner->m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { |
1069 m_pOwner->m_iLBtnPartStates = 0; | 1070 m_pOwner->m_iLBtnPartStates = 0; |
1070 m_pOwner->Repaint(&m_pOwner->m_rtLBtn); | 1071 m_pOwner->Repaint(&m_pOwner->m_rtLBtn); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 if (m_pOwner->m_iHovered > 0) { | 1119 if (m_pOwner->m_iHovered > 0) { |
1119 CFX_RectF rtInvalidate; | 1120 CFX_RectF rtInvalidate; |
1120 rtInvalidate.Set(0, 0, 0, 0); | 1121 rtInvalidate.Set(0, 0, 0, 0); |
1121 m_pOwner->GetDayRect(m_pOwner->m_iHovered, rtInvalidate); | 1122 m_pOwner->GetDayRect(m_pOwner->m_iHovered, rtInvalidate); |
1122 m_pOwner->m_iHovered = -1; | 1123 m_pOwner->m_iHovered = -1; |
1123 if (!rtInvalidate.IsEmpty()) { | 1124 if (!rtInvalidate.IsEmpty()) { |
1124 m_pOwner->Repaint(&rtInvalidate); | 1125 m_pOwner->Repaint(&rtInvalidate); |
1125 } | 1126 } |
1126 } | 1127 } |
1127 } | 1128 } |
OLD | NEW |