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_datetimepicker.h" | 7 #include "xfa/fwl/core/ifwl_datetimepicker.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_message.h" | 10 #include "xfa/fwl/core/cfwl_message.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 m_iMonth = iMonth; | 197 m_iMonth = iMonth; |
198 m_iDay = iDay; | 198 m_iDay = iDay; |
199 m_pMonthCal->SetSelect(iYear, iMonth, iDay); | 199 m_pMonthCal->SetSelect(iYear, iMonth, iDay); |
200 return FWL_Error::Succeeded; | 200 return FWL_Error::Succeeded; |
201 } | 201 } |
202 | 202 |
203 FWL_Error IFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) { | 203 FWL_Error IFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) { |
204 if (!m_pEdit) | 204 if (!m_pEdit) |
205 return FWL_Error::Indefinite; | 205 return FWL_Error::Indefinite; |
206 | 206 |
207 FWL_Error iRet = m_pEdit->SetText(wsText); | 207 m_pEdit->SetText(wsText); |
208 Repaint(&m_rtClient); | 208 Repaint(&m_rtClient); |
209 CFWL_Event_DtpEditChanged ev; | 209 CFWL_Event_DtpEditChanged ev; |
210 ev.m_wsText = wsText; | 210 ev.m_wsText = wsText; |
211 DispatchEvent(&ev); | 211 DispatchEvent(&ev); |
212 return iRet; | 212 return FWL_Error::Succeeded; |
213 } | 213 } |
214 | 214 |
215 FWL_Error IFWL_DateTimePicker::GetEditText(CFX_WideString& wsText, | 215 FWL_Error IFWL_DateTimePicker::GetEditText(CFX_WideString& wsText, |
216 int32_t nStart, | 216 int32_t nStart, |
217 int32_t nCount) const { | 217 int32_t nCount) const { |
218 if (m_pEdit) { | 218 if (m_pEdit) { |
219 return m_pEdit->GetText(wsText, nStart, nCount); | 219 m_pEdit->GetText(wsText, nStart, nCount); |
| 220 return FWL_Error::Succeeded; |
220 } | 221 } |
221 return FWL_Error::Indefinite; | 222 return FWL_Error::Indefinite; |
222 } | 223 } |
223 | 224 |
224 bool IFWL_DateTimePicker::CanUndo() { | 225 bool IFWL_DateTimePicker::CanUndo() { |
225 return m_pEdit->CanUndo(); | 226 return m_pEdit->CanUndo(); |
226 } | 227 } |
227 | 228 |
228 bool IFWL_DateTimePicker::CanRedo() { | 229 bool IFWL_DateTimePicker::CanRedo() { |
229 return m_pEdit->CanRedo(); | 230 return m_pEdit->CanRedo(); |
(...skipping 30 matching lines...) Expand all Loading... |
260 | 261 |
261 bool IFWL_DateTimePicker::Cut(CFX_WideString& wsCut) { | 262 bool IFWL_DateTimePicker::Cut(CFX_WideString& wsCut) { |
262 return m_pEdit->Cut(wsCut); | 263 return m_pEdit->Cut(wsCut); |
263 } | 264 } |
264 | 265 |
265 bool IFWL_DateTimePicker::Paste(const CFX_WideString& wsPaste) { | 266 bool IFWL_DateTimePicker::Paste(const CFX_WideString& wsPaste) { |
266 return m_pEdit->Paste(wsPaste); | 267 return m_pEdit->Paste(wsPaste); |
267 } | 268 } |
268 | 269 |
269 bool IFWL_DateTimePicker::SelectAll() { | 270 bool IFWL_DateTimePicker::SelectAll() { |
270 return m_pEdit->AddSelRange(0) == FWL_Error::Succeeded; | 271 m_pEdit->AddSelRange(0); |
| 272 return true; |
271 } | 273 } |
272 | 274 |
273 bool IFWL_DateTimePicker::Delete() { | 275 bool IFWL_DateTimePicker::Delete() { |
274 return m_pEdit->ClearText() == FWL_Error::Succeeded; | 276 m_pEdit->ClearText(); |
| 277 return true; |
275 } | 278 } |
276 | 279 |
277 bool IFWL_DateTimePicker::DeSelect() { | 280 bool IFWL_DateTimePicker::DeSelect() { |
278 return m_pEdit->ClearSelections() == FWL_Error::Succeeded; | 281 m_pEdit->ClearSelections(); |
| 282 return true; |
279 } | 283 } |
280 | 284 |
281 FWL_Error IFWL_DateTimePicker::GetBBox(CFX_RectF& rect) { | 285 FWL_Error IFWL_DateTimePicker::GetBBox(CFX_RectF& rect) { |
282 if (m_pWidgetMgr->IsFormDisabled()) { | 286 if (m_pWidgetMgr->IsFormDisabled()) { |
283 return DisForm_GetBBox(rect); | 287 return DisForm_GetBBox(rect); |
284 } | 288 } |
285 rect = m_pProperties->m_rtWidget; | 289 rect = m_pProperties->m_rtWidget; |
286 if (IsMonthCalendarShowed()) { | 290 if (IsMonthCalendarShowed()) { |
287 CFX_RectF rtMonth; | 291 CFX_RectF rtMonth; |
288 m_pMonthCal->GetWidgetRect(rtMonth); | 292 m_pMonthCal->GetWidgetRect(rtMonth); |
289 rtMonth.Offset(m_pProperties->m_rtWidget.left, | 293 rtMonth.Offset(m_pProperties->m_rtWidget.left, |
290 m_pProperties->m_rtWidget.top); | 294 m_pProperties->m_rtWidget.top); |
291 rect.Union(rtMonth); | 295 rect.Union(rtMonth); |
292 } | 296 } |
293 return FWL_Error::Succeeded; | 297 return FWL_Error::Succeeded; |
294 } | 298 } |
295 | 299 |
296 FWL_Error IFWL_DateTimePicker::SetEditLimit(int32_t nLimit) { | 300 FWL_Error IFWL_DateTimePicker::SetEditLimit(int32_t nLimit) { |
297 return m_pEdit->SetLimit(nLimit); | 301 m_pEdit->SetLimit(nLimit); |
| 302 return FWL_Error::Succeeded; |
298 } | 303 } |
299 | 304 |
300 void IFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded, | 305 void IFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded, |
301 uint32_t dwStylesExRemoved) { | 306 uint32_t dwStylesExRemoved) { |
302 m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); | 307 m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); |
303 } | 308 } |
304 | 309 |
305 void IFWL_DateTimePicker::DrawDropDownButton(CFX_Graphics* pGraphics, | 310 void IFWL_DateTimePicker::DrawDropDownButton(CFX_Graphics* pGraphics, |
306 IFWL_ThemeProvider* pTheme, | 311 IFWL_ThemeProvider* pTheme, |
307 const CFX_Matrix* pMatrix) { | 312 const CFX_Matrix* pMatrix) { |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 return m_iCurDay; | 798 return m_iCurDay; |
794 } | 799 } |
795 | 800 |
796 int32_t IFWL_DateTimePicker::GetCurMonth(IFWL_Widget* pWidget) { | 801 int32_t IFWL_DateTimePicker::GetCurMonth(IFWL_Widget* pWidget) { |
797 return m_iCurMonth; | 802 return m_iCurMonth; |
798 } | 803 } |
799 | 804 |
800 int32_t IFWL_DateTimePicker::GetCurYear(IFWL_Widget* pWidget) { | 805 int32_t IFWL_DateTimePicker::GetCurYear(IFWL_Widget* pWidget) { |
801 return m_iCurYear; | 806 return m_iCurYear; |
802 } | 807 } |
OLD | NEW |