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_datetimecalendar.h" | 7 #include "xfa/fwl/core/ifwl_datetimecalendar.h" |
8 | 8 |
9 #include "third_party/base/ptr_util.h" | 9 #include "third_party/base/ptr_util.h" |
10 #include "xfa/fwl/core/cfwl_widgetmgr.h" | 10 #include "xfa/fwl/core/cfwl_widgetmgr.h" |
11 #include "xfa/fwl/core/ifwl_datetimepicker.h" | 11 #include "xfa/fwl/core/ifwl_datetimepicker.h" |
12 #include "xfa/fwl/core/ifwl_formproxy.h" | 12 #include "xfa/fwl/core/ifwl_formproxy.h" |
13 | 13 |
14 IFWL_DateTimeCalendar::IFWL_DateTimeCalendar( | 14 IFWL_DateTimeCalendar::IFWL_DateTimeCalendar( |
15 const IFWL_App* app, | 15 const IFWL_App* app, |
16 const CFWL_WidgetImpProperties& properties, | 16 const CFWL_WidgetImpProperties& properties, |
17 IFWL_Widget* pOuter) | 17 IFWL_Widget* pOuter) |
18 : IFWL_MonthCalendar(app, properties, pOuter), m_bFlag(FALSE) {} | 18 : IFWL_MonthCalendar(app, properties, pOuter), m_bFlag(false) {} |
19 | 19 |
20 void IFWL_DateTimeCalendar::OnProcessMessage(CFWL_Message* pMessage) { | 20 void IFWL_DateTimeCalendar::OnProcessMessage(CFWL_Message* pMessage) { |
21 CFWL_MessageType dwCode = pMessage->GetClassID(); | 21 CFWL_MessageType dwCode = pMessage->GetClassID(); |
22 if (dwCode == CFWL_MessageType::SetFocus || | 22 if (dwCode == CFWL_MessageType::SetFocus || |
23 dwCode == CFWL_MessageType::KillFocus) { | 23 dwCode == CFWL_MessageType::KillFocus) { |
24 IFWL_Widget* pOuter = GetOuter(); | 24 IFWL_Widget* pOuter = GetOuter(); |
25 pOuter->GetDelegate()->OnProcessMessage(pMessage); | 25 pOuter->GetDelegate()->OnProcessMessage(pMessage); |
26 return; | 26 return; |
27 } | 27 } |
28 if (dwCode == CFWL_MessageType::Mouse) { | 28 if (dwCode == CFWL_MessageType::Mouse) { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 CFX_RectF rtInvalidate(lpDatesInfo->rect); | 87 CFX_RectF rtInvalidate(lpDatesInfo->rect); |
88 if (iOldSel > 0 && iOldSel <= m_arrDates.GetSize()) { | 88 if (iOldSel > 0 && iOldSel <= m_arrDates.GetSize()) { |
89 lpDatesInfo = m_arrDates.GetAt(iOldSel - 1); | 89 lpDatesInfo = m_arrDates.GetAt(iOldSel - 1); |
90 rtInvalidate.Union(lpDatesInfo->rect); | 90 rtInvalidate.Union(lpDatesInfo->rect); |
91 } | 91 } |
92 AddSelDay(iCurSel); | 92 AddSelDay(iCurSel); |
93 if (!m_pOuter) | 93 if (!m_pOuter) |
94 return; | 94 return; |
95 | 95 |
96 pIPicker->ProcessSelChanged(m_iCurYear, m_iCurMonth, iCurSel); | 96 pIPicker->ProcessSelChanged(m_iCurYear, m_iCurMonth, iCurSel); |
97 pIPicker->ShowMonthCalendar(FALSE); | 97 pIPicker->ShowMonthCalendar(false); |
98 } else if (m_bFlag && (!rt.Contains(pMsg->m_fx, pMsg->m_fy))) { | 98 } else if (m_bFlag && (!rt.Contains(pMsg->m_fx, pMsg->m_fy))) { |
99 pIPicker->ShowMonthCalendar(FALSE); | 99 pIPicker->ShowMonthCalendar(false); |
100 } | 100 } |
101 m_bFlag = 0; | 101 m_bFlag = 0; |
102 } | 102 } |
103 | 103 |
104 void IFWL_DateTimeCalendar::OnMouseMoveEx(CFWL_MsgMouse* pMsg) { | 104 void IFWL_DateTimeCalendar::OnMouseMoveEx(CFWL_MsgMouse* pMsg) { |
105 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_MultiSelect) | 105 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_MultiSelect) |
106 return; | 106 return; |
107 | 107 |
108 FX_BOOL bRepaint = FALSE; | 108 bool bRepaint = false; |
109 CFX_RectF rtInvalidate; | 109 CFX_RectF rtInvalidate; |
110 rtInvalidate.Set(0, 0, 0, 0); | 110 rtInvalidate.Set(0, 0, 0, 0); |
111 if (m_rtDates.Contains(pMsg->m_fx, pMsg->m_fy)) { | 111 if (m_rtDates.Contains(pMsg->m_fx, pMsg->m_fy)) { |
112 int32_t iHover = GetDayAtPoint(pMsg->m_fx, pMsg->m_fy); | 112 int32_t iHover = GetDayAtPoint(pMsg->m_fx, pMsg->m_fy); |
113 bRepaint = m_iHovered != iHover; | 113 bRepaint = m_iHovered != iHover; |
114 if (bRepaint) { | 114 if (bRepaint) { |
115 if (m_iHovered > 0) | 115 if (m_iHovered > 0) |
116 GetDayRect(m_iHovered, rtInvalidate); | 116 GetDayRect(m_iHovered, rtInvalidate); |
117 if (iHover > 0) { | 117 if (iHover > 0) { |
118 CFX_RectF rtDay; | 118 CFX_RectF rtDay; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 FWL_DATEINFO* lpDatesInfo = m_arrDates.GetAt(iCurSel - 1); | 172 FWL_DATEINFO* lpDatesInfo = m_arrDates.GetAt(iCurSel - 1); |
173 CFX_RectF rtInvalidate(lpDatesInfo->rect); | 173 CFX_RectF rtInvalidate(lpDatesInfo->rect); |
174 if (iOldSel > 0 && iOldSel <= m_arrDates.GetSize()) { | 174 if (iOldSel > 0 && iOldSel <= m_arrDates.GetSize()) { |
175 lpDatesInfo = m_arrDates.GetAt(iOldSel - 1); | 175 lpDatesInfo = m_arrDates.GetAt(iOldSel - 1); |
176 rtInvalidate.Union(lpDatesInfo->rect); | 176 rtInvalidate.Union(lpDatesInfo->rect); |
177 } | 177 } |
178 AddSelDay(iCurSel); | 178 AddSelDay(iCurSel); |
179 IFWL_DateTimePicker* pDateTime = | 179 IFWL_DateTimePicker* pDateTime = |
180 static_cast<IFWL_DateTimePicker*>(m_pOuter); | 180 static_cast<IFWL_DateTimePicker*>(m_pOuter); |
181 pDateTime->ProcessSelChanged(m_iCurYear, m_iCurMonth, iCurSel); | 181 pDateTime->ProcessSelChanged(m_iCurYear, m_iCurMonth, iCurSel); |
182 pDateTime->ShowMonthCalendar(FALSE); | 182 pDateTime->ShowMonthCalendar(false); |
183 } | 183 } |
184 } | 184 } |
OLD | NEW |