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/src/fwl/src/basewidget/fwl_datetimepickerimp.h" | 7 #include "xfa/src/fwl/basewidget/fwl_datetimepickerimp.h" |
8 | 8 |
9 #include "xfa/include/fwl/basewidget/fwl_spinbutton.h" | 9 #include "xfa/include/fwl/basewidget/fwl_spinbutton.h" |
10 #include "xfa/src/fwl/src/basewidget/fwl_editimp.h" | 10 #include "xfa/src/fwl/basewidget/fwl_editimp.h" |
11 #include "xfa/src/fwl/src/basewidget/fwl_formproxyimp.h" | 11 #include "xfa/src/fwl/basewidget/fwl_formproxyimp.h" |
12 #include "xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.h" | 12 #include "xfa/src/fwl/basewidget/fwl_monthcalendarimp.h" |
13 #include "xfa/src/fwl/src/core/fwl_formimp.h" | 13 #include "xfa/src/fwl/core/fwl_formimp.h" |
14 #include "xfa/src/fwl/src/core/fwl_noteimp.h" | 14 #include "xfa/src/fwl/core/fwl_noteimp.h" |
15 #include "xfa/src/fwl/src/core/fwl_panelimp.h" | 15 #include "xfa/src/fwl/core/fwl_panelimp.h" |
16 #include "xfa/src/fwl/src/core/fwl_targetimp.h" | 16 #include "xfa/src/fwl/core/fwl_targetimp.h" |
17 #include "xfa/src/fwl/src/core/fwl_widgetimp.h" | 17 #include "xfa/src/fwl/core/fwl_widgetimp.h" |
18 #include "xfa/src/fwl/src/core/fwl_widgetmgrimp.h" | 18 #include "xfa/src/fwl/core/fwl_widgetmgrimp.h" |
19 | 19 |
20 #define FWL_DTP_WIDTH 100 | 20 #define FWL_DTP_WIDTH 100 |
21 #define FWL_DTP_HEIGHT 20 | 21 #define FWL_DTP_HEIGHT 20 |
22 | 22 |
23 // static | 23 // static |
24 IFWL_DateTimePicker* IFWL_DateTimePicker::Create( | 24 IFWL_DateTimePicker* IFWL_DateTimePicker::Create( |
25 const CFWL_WidgetImpProperties& properties, | 25 const CFWL_WidgetImpProperties& properties, |
26 IFWL_Widget* pOuter) { | 26 IFWL_Widget* pOuter) { |
27 IFWL_DateTimePicker* pDateTimePicker = new IFWL_DateTimePicker; | 27 IFWL_DateTimePicker* pDateTimePicker = new IFWL_DateTimePicker; |
28 CFWL_DateTimePickerImp* pDateTimePickerImpl = | 28 CFWL_DateTimePickerImp* pDateTimePickerImpl = |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 const CFWL_WidgetImpProperties& properties, | 60 const CFWL_WidgetImpProperties& properties, |
61 IFWL_Widget* pOuter) { | 61 IFWL_Widget* pOuter) { |
62 IFWL_DateTimeEdit* pDateTimeEdit = new IFWL_DateTimeEdit; | 62 IFWL_DateTimeEdit* pDateTimeEdit = new IFWL_DateTimeEdit; |
63 CFWL_DateTimeEdit* pDateTimeEditImpl = | 63 CFWL_DateTimeEdit* pDateTimeEditImpl = |
64 new CFWL_DateTimeEdit(properties, pOuter); | 64 new CFWL_DateTimeEdit(properties, pOuter); |
65 pDateTimeEdit->SetImpl(pDateTimeEditImpl); | 65 pDateTimeEdit->SetImpl(pDateTimeEditImpl); |
66 pDateTimeEditImpl->SetInterface(pDateTimeEdit); | 66 pDateTimeEditImpl->SetInterface(pDateTimeEdit); |
67 return pDateTimeEdit; | 67 return pDateTimeEdit; |
68 } | 68 } |
69 | 69 |
70 IFWL_DateTimePicker::IFWL_DateTimePicker() { | 70 IFWL_DateTimePicker::IFWL_DateTimePicker() {} |
71 } | |
72 int32_t IFWL_DateTimePicker::CountSelRanges() { | 71 int32_t IFWL_DateTimePicker::CountSelRanges() { |
73 return static_cast<CFWL_DateTimePickerImp*>(GetImpl()) | 72 return static_cast<CFWL_DateTimePickerImp*>(GetImpl()) |
74 ->GetDataTimeEdit() | 73 ->GetDataTimeEdit() |
75 ->CountSelRanges(); | 74 ->CountSelRanges(); |
76 } | 75 } |
77 int32_t IFWL_DateTimePicker::GetSelRange(int32_t nIndex, int32_t& nStart) { | 76 int32_t IFWL_DateTimePicker::GetSelRange(int32_t nIndex, int32_t& nStart) { |
78 return static_cast<CFWL_DateTimePickerImp*>(GetImpl()) | 77 return static_cast<CFWL_DateTimePickerImp*>(GetImpl()) |
79 ->GetDataTimeEdit() | 78 ->GetDataTimeEdit() |
80 ->GetSelRange(nIndex, nStart); | 79 ->GetSelRange(nIndex, nStart); |
81 } | 80 } |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 return FWL_ERR_Indefinite; | 158 return FWL_ERR_Indefinite; |
160 return FWL_ERR_Succeeded; | 159 return FWL_ERR_Succeeded; |
161 } | 160 } |
162 FWL_ERR CFWL_DateTimeEdit::Finalize() { | 161 FWL_ERR CFWL_DateTimeEdit::Finalize() { |
163 delete m_pDelegate; | 162 delete m_pDelegate; |
164 m_pDelegate = nullptr; | 163 m_pDelegate = nullptr; |
165 return CFWL_EditImp::Finalize(); | 164 return CFWL_EditImp::Finalize(); |
166 } | 165 } |
167 CFWL_DateTimeEditImpDelegate::CFWL_DateTimeEditImpDelegate( | 166 CFWL_DateTimeEditImpDelegate::CFWL_DateTimeEditImpDelegate( |
168 CFWL_DateTimeEdit* pOwner) | 167 CFWL_DateTimeEdit* pOwner) |
169 : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) { | 168 : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {} |
170 } | |
171 int32_t CFWL_DateTimeEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 169 int32_t CFWL_DateTimeEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
172 if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { | 170 if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { |
173 return DisForm_OnProcessMessage(pMessage); | 171 return DisForm_OnProcessMessage(pMessage); |
174 } | 172 } |
175 FX_DWORD dwHashCode = pMessage->GetClassID(); | 173 FX_DWORD dwHashCode = pMessage->GetClassID(); |
176 if (dwHashCode == FWL_MSGHASH_SetFocus || | 174 if (dwHashCode == FWL_MSGHASH_SetFocus || |
177 dwHashCode == FWL_MSGHASH_KillFocus) { | 175 dwHashCode == FWL_MSGHASH_KillFocus) { |
178 IFWL_Widget* pOuter = m_pOwner->GetOuter(); | 176 IFWL_Widget* pOuter = m_pOwner->GetOuter(); |
179 IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(NULL); | 177 IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(NULL); |
180 pDelegate->OnProcessMessage(pMessage); | 178 pDelegate->OnProcessMessage(pMessage); |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 m_iBtnState(1), | 416 m_iBtnState(1), |
419 m_iYear(-1), | 417 m_iYear(-1), |
420 m_iMonth(-1), | 418 m_iMonth(-1), |
421 m_iDay(-1), | 419 m_iDay(-1), |
422 m_bLBtnDown(FALSE), | 420 m_bLBtnDown(FALSE), |
423 m_pEdit(nullptr), | 421 m_pEdit(nullptr), |
424 m_pMonthCal(nullptr), | 422 m_pMonthCal(nullptr), |
425 m_pForm(nullptr) { | 423 m_pForm(nullptr) { |
426 m_rtBtn.Set(0, 0, 0, 0); | 424 m_rtBtn.Set(0, 0, 0, 0); |
427 } | 425 } |
428 CFWL_DateTimePickerImp::~CFWL_DateTimePickerImp() { | 426 CFWL_DateTimePickerImp::~CFWL_DateTimePickerImp() {} |
429 } | |
430 FWL_ERR CFWL_DateTimePickerImp::GetClassName(CFX_WideString& wsClass) const { | 427 FWL_ERR CFWL_DateTimePickerImp::GetClassName(CFX_WideString& wsClass) const { |
431 wsClass = FWL_CLASS_DateTimePicker; | 428 wsClass = FWL_CLASS_DateTimePicker; |
432 return FWL_ERR_Succeeded; | 429 return FWL_ERR_Succeeded; |
433 } | 430 } |
434 FX_DWORD CFWL_DateTimePickerImp::GetClassID() const { | 431 FX_DWORD CFWL_DateTimePickerImp::GetClassID() const { |
435 return FWL_CLASSHASH_DateTimePicker; | 432 return FWL_CLASSHASH_DateTimePicker; |
436 } | 433 } |
437 FWL_ERR CFWL_DateTimePickerImp::Initialize() { | 434 FWL_ERR CFWL_DateTimePickerImp::Initialize() { |
438 if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) | 435 if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) |
439 return FWL_ERR_Indefinite; | 436 return FWL_ERR_Indefinite; |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 } | 1152 } |
1156 if (m_pOwner->m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { | 1153 if (m_pOwner->m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { |
1157 pMsg->m_pSrcTarget = m_pOwner->m_pEdit.get(); | 1154 pMsg->m_pSrcTarget = m_pOwner->m_pEdit.get(); |
1158 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); | 1155 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); |
1159 pDelegate->OnProcessMessage(pMsg); | 1156 pDelegate->OnProcessMessage(pMsg); |
1160 } | 1157 } |
1161 } | 1158 } |
1162 rtInvalidate.Inflate(2, 2); | 1159 rtInvalidate.Inflate(2, 2); |
1163 m_pOwner->Repaint(&rtInvalidate); | 1160 m_pOwner->Repaint(&rtInvalidate); |
1164 } | 1161 } |
OLD | NEW |