| 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" |
| 11 #include "include/fwl_monthcalendarimp.h" | 11 #include "include/fwl_monthcalendarimp.h" |
| 12 #define MONTHCAL_HSEP_HEIGHT 1 | 12 #define MONTHCAL_HSEP_HEIGHT 1 |
| 13 #define MONTHCAL_VSEP_WIDTH 1 | 13 #define MONTHCAL_VSEP_WIDTH 1 |
| 14 #define MONTHCAL_HMARGIN 3 | 14 #define MONTHCAL_HMARGIN 3 |
| 15 #define MONTHCAL_VMARGIN 2 | 15 #define MONTHCAL_VMARGIN 2 |
| 16 #define MONTHCAL_ROWS 9 | 16 #define MONTHCAL_ROWS 9 |
| 17 #define MONTHCAL_COLUMNS 7 | 17 #define MONTHCAL_COLUMNS 7 |
| 18 #define MONTHCAL_HEADER_BTN_VMARGIN 7 | 18 #define MONTHCAL_HEADER_BTN_VMARGIN 7 |
| 19 #define MONTHCAL_HEADER_BTN_HMARGIN 5 | 19 #define MONTHCAL_HEADER_BTN_HMARGIN 5 |
| 20 IFWL_MonthCalendar* IFWL_MonthCalendar::Create() { | 20 IFWL_MonthCalendar* IFWL_MonthCalendar::Create() { |
| 21 return new IFWL_MonthCalendar; | 21 return new IFWL_MonthCalendar; |
| 22 } | 22 } |
| 23 IFWL_MonthCalendar::IFWL_MonthCalendar() { | 23 IFWL_MonthCalendar::IFWL_MonthCalendar() { |
| 24 m_pImpl = NULL; | |
| 25 } | |
| 26 IFWL_MonthCalendar::~IFWL_MonthCalendar() { | |
| 27 if (m_pImpl) { | |
| 28 delete (CFWL_MonthCalendarImp*)m_pImpl; | |
| 29 m_pImpl = NULL; | |
| 30 } | |
| 31 } | 24 } |
| 32 FWL_ERR IFWL_MonthCalendar::Initialize(IFWL_Widget* pOuter) { | 25 FWL_ERR IFWL_MonthCalendar::Initialize(IFWL_Widget* pOuter) { |
| 33 m_pImpl = new CFWL_MonthCalendarImp(pOuter); | 26 CFWL_MonthCalendarImp* pMonthCalendarImpl = new CFWL_MonthCalendarImp(pOuter); |
| 34 ((CFWL_MonthCalendarImp*)m_pImpl)->SetInterface(this); | 27 SetImpl(pMonthCalendarImpl); |
| 35 return ((CFWL_MonthCalendarImp*)m_pImpl)->Initialize(); | 28 pMonthCalendarImpl->SetInterface(this); |
| 29 return pMonthCalendarImpl->Initialize(); |
| 36 } | 30 } |
| 37 FWL_ERR IFWL_MonthCalendar::Initialize( | 31 FWL_ERR IFWL_MonthCalendar::Initialize( |
| 38 const CFWL_WidgetImpProperties& properties, | 32 const CFWL_WidgetImpProperties& properties, |
| 39 IFWL_Widget* pOuter) { | 33 IFWL_Widget* pOuter) { |
| 40 m_pImpl = new CFWL_MonthCalendarImp(properties, pOuter); | 34 CFWL_MonthCalendarImp* pMonthCalendarImpl = |
| 41 ((CFWL_MonthCalendarImp*)m_pImpl)->SetInterface(this); | 35 new CFWL_MonthCalendarImp(properties, pOuter); |
| 42 return ((CFWL_MonthCalendarImp*)m_pImpl)->Initialize(); | 36 SetImpl(pMonthCalendarImpl); |
| 37 pMonthCalendarImpl->SetInterface(this); |
| 38 return pMonthCalendarImpl->Initialize(); |
| 43 } | 39 } |
| 44 int32_t IFWL_MonthCalendar::CountSelect() { | 40 int32_t IFWL_MonthCalendar::CountSelect() { |
| 45 return ((CFWL_MonthCalendarImp*)m_pImpl)->CountSelect(); | 41 return static_cast<CFWL_MonthCalendarImp*>(GetImpl())->CountSelect(); |
| 46 } | 42 } |
| 47 FX_BOOL IFWL_MonthCalendar::GetSelect(int32_t& iYear, | 43 FX_BOOL IFWL_MonthCalendar::GetSelect(int32_t& iYear, |
| 48 int32_t& iMonth, | 44 int32_t& iMonth, |
| 49 int32_t& iDay, | 45 int32_t& iDay, |
| 50 int32_t nIndex) { | 46 int32_t nIndex) { |
| 51 return ((CFWL_MonthCalendarImp*)m_pImpl) | 47 return static_cast<CFWL_MonthCalendarImp*>(GetImpl()) |
| 52 ->GetSelect(iYear, iMonth, iDay, nIndex); | 48 ->GetSelect(iYear, iMonth, iDay, nIndex); |
| 53 } | 49 } |
| 54 FX_BOOL IFWL_MonthCalendar::SetSelect(int32_t iYear, | 50 FX_BOOL IFWL_MonthCalendar::SetSelect(int32_t iYear, |
| 55 int32_t iMonth, | 51 int32_t iMonth, |
| 56 int32_t iDay) { | 52 int32_t iDay) { |
| 57 return ((CFWL_MonthCalendarImp*)m_pImpl)->SetSelect(iYear, iMonth, iDay); | 53 return static_cast<CFWL_MonthCalendarImp*>(GetImpl()) |
| 54 ->SetSelect(iYear, iMonth, iDay); |
| 58 } | 55 } |
| 59 CFWL_MonthCalendarImp::CFWL_MonthCalendarImp(IFWL_Widget* pOuter) | 56 CFWL_MonthCalendarImp::CFWL_MonthCalendarImp(IFWL_Widget* pOuter) |
| 60 : CFWL_WidgetImp(pOuter), | 57 : CFWL_WidgetImp(pOuter), |
| 61 m_iCurYear(2011), | 58 m_iCurYear(2011), |
| 62 m_iCurMonth(1), | 59 m_iCurMonth(1), |
| 63 m_iYear(2011), | 60 m_iYear(2011), |
| 64 m_iMonth(1), | 61 m_iMonth(1), |
| 65 m_iDay(1), | 62 m_iDay(1), |
| 66 m_iHovered(-1), | 63 m_iHovered(-1), |
| 67 m_iLBtnPartStates(FWL_PARTSTATE_MCD_Normal), | 64 m_iLBtnPartStates(FWL_PARTSTATE_MCD_Normal), |
| (...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 if (m_pOwner->m_iHovered > 0) { | 1121 if (m_pOwner->m_iHovered > 0) { |
| 1125 CFX_RectF rtInvalidate; | 1122 CFX_RectF rtInvalidate; |
| 1126 rtInvalidate.Set(0, 0, 0, 0); | 1123 rtInvalidate.Set(0, 0, 0, 0); |
| 1127 m_pOwner->GetDayRect(m_pOwner->m_iHovered, rtInvalidate); | 1124 m_pOwner->GetDayRect(m_pOwner->m_iHovered, rtInvalidate); |
| 1128 m_pOwner->m_iHovered = -1; | 1125 m_pOwner->m_iHovered = -1; |
| 1129 if (!rtInvalidate.IsEmpty()) { | 1126 if (!rtInvalidate.IsEmpty()) { |
| 1130 m_pOwner->Repaint(&rtInvalidate); | 1127 m_pOwner->Repaint(&rtInvalidate); |
| 1131 } | 1128 } |
| 1132 } | 1129 } |
| 1133 } | 1130 } |
| OLD | NEW |