| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
| 6 | |
| 7 #include "xfa/include/fwl/lightwidget/datetimepicker.h" | |
| 8 | |
| 9 #include <memory> | |
| 10 | |
| 11 #include "xfa/include/fwl/core/fwl_error.h" | |
| 12 #include "xfa/include/fwl/core/fwl_note.h" | |
| 13 #include "xfa/include/fwl/core/fwl_widget.h" | |
| 14 #include "xfa/include/fwl/basewidget/fwl_datetimepicker.h" | |
| 15 | |
| 16 CFWL_DateTimePicker* CFWL_DateTimePicker::Create() { | |
| 17 return new CFWL_DateTimePicker; | |
| 18 } | |
| 19 FWL_ERR CFWL_DateTimePicker::Initialize( | |
| 20 const CFWL_WidgetProperties* pProperties) { | |
| 21 if (m_pIface) | |
| 22 return FWL_ERR_Indefinite; | |
| 23 if (pProperties) { | |
| 24 *m_pProperties = *pProperties; | |
| 25 } | |
| 26 std::unique_ptr<IFWL_DateTimePicker> pDateTimePicker( | |
| 27 IFWL_DateTimePicker::Create( | |
| 28 m_pProperties->MakeWidgetImpProperties(&m_DateTimePickerDP), | |
| 29 nullptr)); | |
| 30 FWL_ERR ret = pDateTimePicker->Initialize(); | |
| 31 if (ret != FWL_ERR_Succeeded) { | |
| 32 return ret; | |
| 33 } | |
| 34 m_pIface = pDateTimePicker.release(); | |
| 35 CFWL_Widget::Initialize(); | |
| 36 return FWL_ERR_Succeeded; | |
| 37 } | |
| 38 | |
| 39 FWL_ERR CFWL_DateTimePicker::SetToday(int32_t iYear, | |
| 40 int32_t iMonth, | |
| 41 int32_t iDay) { | |
| 42 m_DateTimePickerDP.m_iYear = iYear; | |
| 43 m_DateTimePickerDP.m_iMonth = iMonth; | |
| 44 m_DateTimePickerDP.m_iDay = iDay; | |
| 45 return FWL_ERR_Succeeded; | |
| 46 } | |
| 47 int32_t CFWL_DateTimePicker::CountSelRanges() { | |
| 48 return static_cast<IFWL_DateTimePicker*>(m_pIface)->CountSelRanges(); | |
| 49 } | |
| 50 int32_t CFWL_DateTimePicker::GetSelRange(int32_t nIndex, int32_t& nStart) { | |
| 51 return static_cast<IFWL_DateTimePicker*>(m_pIface) | |
| 52 ->GetSelRange(nIndex, nStart); | |
| 53 } | |
| 54 FWL_ERR CFWL_DateTimePicker::GetEditText(CFX_WideString& wsText) { | |
| 55 return static_cast<IFWL_DateTimePicker*>(m_pIface)->GetEditText(wsText); | |
| 56 } | |
| 57 FWL_ERR CFWL_DateTimePicker::SetEditText(const CFX_WideStringC& wsText) { | |
| 58 return static_cast<IFWL_DateTimePicker*>(m_pIface)->SetEditText(wsText); | |
| 59 } | |
| 60 FWL_ERR CFWL_DateTimePicker::GetCurSel(int32_t& iYear, | |
| 61 int32_t& iMonth, | |
| 62 int32_t& iDay) { | |
| 63 return static_cast<IFWL_DateTimePicker*>(m_pIface) | |
| 64 ->GetCurSel(iYear, iMonth, iDay); | |
| 65 } | |
| 66 FWL_ERR CFWL_DateTimePicker::SetCurSel(int32_t iYear, | |
| 67 int32_t iMonth, | |
| 68 int32_t iDay) { | |
| 69 return static_cast<IFWL_DateTimePicker*>(m_pIface) | |
| 70 ->SetCurSel(iYear, iMonth, iDay); | |
| 71 } | |
| 72 CFWL_DateTimePicker::CFWL_DateTimePicker() {} | |
| 73 CFWL_DateTimePicker::~CFWL_DateTimePicker() {} | |
| 74 CFWL_DateTimePicker::CFWL_DateTimePickerDP::CFWL_DateTimePickerDP() { | |
| 75 m_iYear = 2011; | |
| 76 m_iMonth = 1; | |
| 77 m_iDay = 1; | |
| 78 } | |
| 79 FWL_ERR CFWL_DateTimePicker::CFWL_DateTimePickerDP::GetCaption( | |
| 80 IFWL_Widget* pWidget, | |
| 81 CFX_WideString& wsCaption) { | |
| 82 wsCaption = m_wsData; | |
| 83 return FWL_ERR_Succeeded; | |
| 84 } | |
| 85 FWL_ERR CFWL_DateTimePicker::CFWL_DateTimePickerDP::GetToday( | |
| 86 IFWL_Widget* pWidget, | |
| 87 int32_t& iYear, | |
| 88 int32_t& iMonth, | |
| 89 int32_t& iDay) { | |
| 90 iYear = m_iYear; | |
| 91 iMonth = m_iMonth; | |
| 92 iDay = m_iDay; | |
| 93 return FWL_ERR_Succeeded; | |
| 94 } | |
| 95 FX_BOOL CFWL_DateTimePicker::CanUndo() { | |
| 96 return static_cast<IFWL_DateTimePicker*>(m_pIface)->CanUndo(); | |
| 97 } | |
| 98 FX_BOOL CFWL_DateTimePicker::CanRedo() { | |
| 99 return static_cast<IFWL_DateTimePicker*>(m_pIface)->CanRedo(); | |
| 100 } | |
| 101 FX_BOOL CFWL_DateTimePicker::Undo() { | |
| 102 return static_cast<IFWL_DateTimePicker*>(m_pIface)->Undo(); | |
| 103 } | |
| 104 FX_BOOL CFWL_DateTimePicker::Redo() { | |
| 105 return static_cast<IFWL_DateTimePicker*>(m_pIface)->Redo(); | |
| 106 } | |
| 107 FX_BOOL CFWL_DateTimePicker::CanCopy() { | |
| 108 return static_cast<IFWL_DateTimePicker*>(m_pIface)->CanCopy(); | |
| 109 } | |
| 110 FX_BOOL CFWL_DateTimePicker::CanCut() { | |
| 111 return static_cast<IFWL_DateTimePicker*>(m_pIface)->CanCut(); | |
| 112 } | |
| 113 FX_BOOL CFWL_DateTimePicker::CanSelectAll() { | |
| 114 return static_cast<IFWL_DateTimePicker*>(m_pIface)->CanSelectAll(); | |
| 115 } | |
| 116 FX_BOOL CFWL_DateTimePicker::Copy(CFX_WideString& wsCopy) { | |
| 117 return static_cast<IFWL_DateTimePicker*>(m_pIface)->Copy(wsCopy); | |
| 118 } | |
| 119 FX_BOOL CFWL_DateTimePicker::Cut(CFX_WideString& wsCut) { | |
| 120 return static_cast<IFWL_DateTimePicker*>(m_pIface)->Copy(wsCut); | |
| 121 } | |
| 122 FX_BOOL CFWL_DateTimePicker::Paste(const CFX_WideString& wsPaste) { | |
| 123 return static_cast<IFWL_DateTimePicker*>(m_pIface)->Paste(wsPaste); | |
| 124 } | |
| 125 FX_BOOL CFWL_DateTimePicker::SelectAll() { | |
| 126 return static_cast<IFWL_DateTimePicker*>(m_pIface)->SelectAll(); | |
| 127 } | |
| 128 FX_BOOL CFWL_DateTimePicker::Delete() { | |
| 129 return static_cast<IFWL_DateTimePicker*>(m_pIface)->Delete(); | |
| 130 } | |
| 131 FX_BOOL CFWL_DateTimePicker::DeSelect() { | |
| 132 return static_cast<IFWL_DateTimePicker*>(m_pIface)->DeSelect(); | |
| 133 } | |
| 134 FWL_ERR CFWL_DateTimePicker::GetBBox(CFX_RectF& rect) { | |
| 135 return static_cast<IFWL_DateTimePicker*>(m_pIface)->GetBBox(rect); | |
| 136 } | |
| 137 FWL_ERR CFWL_DateTimePicker::SetEditLimit(int32_t nLimit) { | |
| 138 return static_cast<IFWL_DateTimePicker*>(m_pIface)->SetEditLimit(nLimit); | |
| 139 } | |
| 140 FWL_ERR CFWL_DateTimePicker::ModifyEditStylesEx(FX_DWORD dwStylesExAdded, | |
| 141 FX_DWORD dwStylesExRemoved) { | |
| 142 return static_cast<IFWL_DateTimePicker*>(m_pIface) | |
| 143 ->ModifyEditStylesEx(dwStylesExAdded, dwStylesExRemoved); | |
| 144 } | |
| OLD | NEW |