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/basewidget/fwl_datetimepickerimp.h" | 7 #include "xfa/fwl/basewidget/fwl_datetimepickerimp.h" |
8 | 8 |
9 #include "xfa/fwl/basewidget/fwl_editimp.h" | 9 #include "xfa/fwl/basewidget/fwl_editimp.h" |
10 #include "xfa/fwl/basewidget/fwl_formproxyimp.h" | 10 #include "xfa/fwl/basewidget/fwl_formproxyimp.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 void CFWL_DateTimeEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 176 void CFWL_DateTimeEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
177 if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { | 177 if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { |
178 DisForm_OnProcessMessage(pMessage); | 178 DisForm_OnProcessMessage(pMessage); |
179 return; | 179 return; |
180 } | 180 } |
181 | 181 |
182 CFWL_MessageType dwHashCode = pMessage->GetClassID(); | 182 CFWL_MessageType dwHashCode = pMessage->GetClassID(); |
183 if (dwHashCode == CFWL_MessageType::SetFocus || | 183 if (dwHashCode == CFWL_MessageType::SetFocus || |
184 dwHashCode == CFWL_MessageType::KillFocus) { | 184 dwHashCode == CFWL_MessageType::KillFocus) { |
185 IFWL_Widget* pOuter = m_pOwner->GetOuter(); | 185 IFWL_Widget* pOuter = m_pOwner->GetOuter(); |
186 IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(NULL); | 186 IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(nullptr); |
187 pDelegate->OnProcessMessage(pMessage); | 187 pDelegate->OnProcessMessage(pMessage); |
188 } | 188 } |
189 } | 189 } |
190 | 190 |
191 void CFWL_DateTimeEditImpDelegate::DisForm_OnProcessMessage( | 191 void CFWL_DateTimeEditImpDelegate::DisForm_OnProcessMessage( |
192 CFWL_Message* pMessage) { | 192 CFWL_Message* pMessage) { |
193 CFWL_MessageType dwHashCode = pMessage->GetClassID(); | 193 CFWL_MessageType dwHashCode = pMessage->GetClassID(); |
194 if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { | 194 if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { |
195 if (dwHashCode == CFWL_MessageType::Mouse) { | 195 if (dwHashCode == CFWL_MessageType::Mouse) { |
196 CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage); | 196 CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 : CFWL_MonthCalendarImpDelegate(pOwner), m_pOwner(pOwner) { | 236 : CFWL_MonthCalendarImpDelegate(pOwner), m_pOwner(pOwner) { |
237 m_bFlag = FALSE; | 237 m_bFlag = FALSE; |
238 } | 238 } |
239 | 239 |
240 void CFWL_DateTimeCalendarImpDelegate::OnProcessMessage( | 240 void CFWL_DateTimeCalendarImpDelegate::OnProcessMessage( |
241 CFWL_Message* pMessage) { | 241 CFWL_Message* pMessage) { |
242 CFWL_MessageType dwCode = pMessage->GetClassID(); | 242 CFWL_MessageType dwCode = pMessage->GetClassID(); |
243 if (dwCode == CFWL_MessageType::SetFocus || | 243 if (dwCode == CFWL_MessageType::SetFocus || |
244 dwCode == CFWL_MessageType::KillFocus) { | 244 dwCode == CFWL_MessageType::KillFocus) { |
245 IFWL_Widget* pOuter = m_pOwner->GetOuter(); | 245 IFWL_Widget* pOuter = m_pOwner->GetOuter(); |
246 IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(NULL); | 246 IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(nullptr); |
247 pDelegate->OnProcessMessage(pMessage); | 247 pDelegate->OnProcessMessage(pMessage); |
248 return; | 248 return; |
249 } | 249 } |
250 if (dwCode == CFWL_MessageType::Mouse) { | 250 if (dwCode == CFWL_MessageType::Mouse) { |
251 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 251 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
252 if (pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonDown) | 252 if (pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonDown) |
253 OnLButtonDownEx(pMsg); | 253 OnLButtonDownEx(pMsg); |
254 else if (pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonUp) | 254 else if (pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonUp) |
255 OnLButtonUpEx(pMsg); | 255 OnLButtonUpEx(pMsg); |
256 return; | 256 return; |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 if (m_iYear > 0 && m_iMonth > 0 && m_iDay > 0) { | 893 if (m_iYear > 0 && m_iMonth > 0 && m_iDay > 0) { |
894 m_pMonthCal->SetSelect(m_iYear, m_iMonth, m_iDay); | 894 m_pMonthCal->SetSelect(m_iYear, m_iMonth, m_iDay); |
895 } | 895 } |
896 m_pMonthCal->Update(); | 896 m_pMonthCal->Update(); |
897 } | 897 } |
898 m_pMonthCal->SetStates(FWL_WGTSTATE_Invisible, !bActivate); | 898 m_pMonthCal->SetStates(FWL_WGTSTATE_Invisible, !bActivate); |
899 if (bActivate) { | 899 if (bActivate) { |
900 CFWL_MsgSetFocus msg; | 900 CFWL_MsgSetFocus msg; |
901 msg.m_pDstTarget = m_pMonthCal.get(); | 901 msg.m_pDstTarget = m_pMonthCal.get(); |
902 msg.m_pSrcTarget = m_pEdit.get(); | 902 msg.m_pSrcTarget = m_pEdit.get(); |
903 IFWL_WidgetDelegate* pDelegate = m_pEdit->SetDelegate(NULL); | 903 IFWL_WidgetDelegate* pDelegate = m_pEdit->SetDelegate(nullptr); |
904 pDelegate->OnProcessMessage(&msg); | 904 pDelegate->OnProcessMessage(&msg); |
905 } | 905 } |
906 CFX_RectF rtInvalidate, rtCal; | 906 CFX_RectF rtInvalidate, rtCal; |
907 rtInvalidate.Set(0, 0, m_pProperties->m_rtWidget.width, | 907 rtInvalidate.Set(0, 0, m_pProperties->m_rtWidget.width, |
908 m_pProperties->m_rtWidget.height); | 908 m_pProperties->m_rtWidget.height); |
909 m_pMonthCal->GetWidgetRect(rtCal); | 909 m_pMonthCal->GetWidgetRect(rtCal); |
910 rtInvalidate.Union(rtCal); | 910 rtInvalidate.Union(rtCal); |
911 rtInvalidate.Inflate(2, 2); | 911 rtInvalidate.Inflate(2, 2); |
912 Repaint(&rtInvalidate); | 912 Repaint(&rtInvalidate); |
913 } | 913 } |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1058 OnMouseLeave(pMouse); | 1058 OnMouseLeave(pMouse); |
1059 break; | 1059 break; |
1060 } | 1060 } |
1061 default: | 1061 default: |
1062 break; | 1062 break; |
1063 } | 1063 } |
1064 break; | 1064 break; |
1065 } | 1065 } |
1066 case CFWL_MessageType::Key: { | 1066 case CFWL_MessageType::Key: { |
1067 if (m_pOwner->m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { | 1067 if (m_pOwner->m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { |
1068 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); | 1068 IFWL_WidgetDelegate* pDelegate = |
| 1069 m_pOwner->m_pEdit->SetDelegate(nullptr); |
1069 pDelegate->OnProcessMessage(pMessage); | 1070 pDelegate->OnProcessMessage(pMessage); |
1070 return; | 1071 return; |
1071 } | 1072 } |
1072 break; | 1073 break; |
1073 } | 1074 } |
1074 default: | 1075 default: |
1075 break; | 1076 break; |
1076 } | 1077 } |
1077 | 1078 |
1078 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); | 1079 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 if (bSet) { | 1158 if (bSet) { |
1158 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; | 1159 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; |
1159 if (m_pOwner->m_pEdit && | 1160 if (m_pOwner->m_pEdit && |
1160 !(m_pOwner->m_pEdit->GetStylesEx() & FWL_STYLEEXT_EDT_ReadOnly)) { | 1161 !(m_pOwner->m_pEdit->GetStylesEx() & FWL_STYLEEXT_EDT_ReadOnly)) { |
1161 m_pOwner->m_rtBtn.Set(m_pOwner->m_pProperties->m_rtWidget.width, 0, | 1162 m_pOwner->m_rtBtn.Set(m_pOwner->m_pProperties->m_rtWidget.width, 0, |
1162 m_pOwner->m_fBtn, | 1163 m_pOwner->m_fBtn, |
1163 m_pOwner->m_pProperties->m_rtWidget.height - 1); | 1164 m_pOwner->m_pProperties->m_rtWidget.height - 1); |
1164 } | 1165 } |
1165 rtInvalidate = m_pOwner->m_rtBtn; | 1166 rtInvalidate = m_pOwner->m_rtBtn; |
1166 pMsg->m_pDstTarget = m_pOwner->m_pEdit.get(); | 1167 pMsg->m_pDstTarget = m_pOwner->m_pEdit.get(); |
1167 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); | 1168 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(nullptr); |
1168 pDelegate->OnProcessMessage(pMsg); | 1169 pDelegate->OnProcessMessage(pMsg); |
1169 } else { | 1170 } else { |
1170 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; | 1171 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; |
1171 m_pOwner->m_rtBtn.Set(0, 0, 0, 0); | 1172 m_pOwner->m_rtBtn.Set(0, 0, 0, 0); |
1172 if (m_pOwner->DisForm_IsMonthCalendarShowed()) { | 1173 if (m_pOwner->DisForm_IsMonthCalendarShowed()) { |
1173 m_pOwner->ShowMonthCalendar(FALSE); | 1174 m_pOwner->ShowMonthCalendar(FALSE); |
1174 } | 1175 } |
1175 if (m_pOwner->m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { | 1176 if (m_pOwner->m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { |
1176 pMsg->m_pSrcTarget = m_pOwner->m_pEdit.get(); | 1177 pMsg->m_pSrcTarget = m_pOwner->m_pEdit.get(); |
1177 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); | 1178 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(nullptr); |
1178 pDelegate->OnProcessMessage(pMsg); | 1179 pDelegate->OnProcessMessage(pMsg); |
1179 } | 1180 } |
1180 } | 1181 } |
1181 rtInvalidate.Inflate(2, 2); | 1182 rtInvalidate.Inflate(2, 2); |
1182 m_pOwner->Repaint(&rtInvalidate); | 1183 m_pOwner->Repaint(&rtInvalidate); |
1183 } | 1184 } |
1184 | 1185 |
1185 CFWL_DateTimePickerImp::CFWL_MonthCalendarImpDP::CFWL_MonthCalendarImpDP() { | 1186 CFWL_DateTimePickerImp::CFWL_MonthCalendarImpDP::CFWL_MonthCalendarImpDP() { |
1186 m_iCurYear = 2010; | 1187 m_iCurYear = 2010; |
1187 m_iCurMonth = 3; | 1188 m_iCurMonth = 3; |
(...skipping 13 matching lines...) Expand all Loading... |
1201 | 1202 |
1202 int32_t CFWL_DateTimePickerImp::CFWL_MonthCalendarImpDP::GetCurMonth( | 1203 int32_t CFWL_DateTimePickerImp::CFWL_MonthCalendarImpDP::GetCurMonth( |
1203 IFWL_Widget* pWidget) { | 1204 IFWL_Widget* pWidget) { |
1204 return m_iCurMonth; | 1205 return m_iCurMonth; |
1205 } | 1206 } |
1206 | 1207 |
1207 int32_t CFWL_DateTimePickerImp::CFWL_MonthCalendarImpDP::GetCurYear( | 1208 int32_t CFWL_DateTimePickerImp::CFWL_MonthCalendarImpDP::GetCurYear( |
1208 IFWL_Widget* pWidget) { | 1209 IFWL_Widget* pWidget) { |
1209 return m_iCurYear; | 1210 return m_iCurYear; |
1210 } | 1211 } |
OLD | NEW |