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 #ifndef XFA_FWL_BASEWIDGET_FWL_DATETIMEPICKERIMP_H_ | 7 #ifndef XFA_FWL_BASEWIDGET_FWL_DATETIMEPICKERIMP_H_ |
8 #define XFA_FWL_BASEWIDGET_FWL_DATETIMEPICKERIMP_H_ | 8 #define XFA_FWL_BASEWIDGET_FWL_DATETIMEPICKERIMP_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 IFWL_Widget* pOuter); | 51 IFWL_Widget* pOuter); |
52 | 52 |
53 protected: | 53 protected: |
54 IFWL_DateTimeEdit() {} | 54 IFWL_DateTimeEdit() {} |
55 }; | 55 }; |
56 | 56 |
57 class CFWL_DateTimeEdit : public CFWL_EditImp { | 57 class CFWL_DateTimeEdit : public CFWL_EditImp { |
58 public: | 58 public: |
59 CFWL_DateTimeEdit(const CFWL_WidgetImpProperties& properties, | 59 CFWL_DateTimeEdit(const CFWL_WidgetImpProperties& properties, |
60 IFWL_Widget* pOuter); | 60 IFWL_Widget* pOuter); |
61 virtual FWL_ERR Initialize(); | 61 virtual FWL_Error Initialize(); |
62 virtual FWL_ERR Finalize(); | 62 virtual FWL_Error Finalize(); |
63 | 63 |
64 protected: | 64 protected: |
65 friend class CFWL_DateTimeEditImpDelegate; | 65 friend class CFWL_DateTimeEditImpDelegate; |
66 }; | 66 }; |
67 class CFWL_DateTimeEditImpDelegate : public CFWL_EditImpDelegate { | 67 class CFWL_DateTimeEditImpDelegate : public CFWL_EditImpDelegate { |
68 public: | 68 public: |
69 CFWL_DateTimeEditImpDelegate(CFWL_DateTimeEdit* pOwner); | 69 CFWL_DateTimeEditImpDelegate(CFWL_DateTimeEdit* pOwner); |
70 int32_t OnProcessMessage(CFWL_Message* pMessage) override; | 70 void OnProcessMessage(CFWL_Message* pMessage) override; |
71 | 71 |
72 private: | 72 private: |
73 int32_t DisForm_OnProcessMessage(CFWL_Message* pMessage); | 73 void DisForm_OnProcessMessage(CFWL_Message* pMessage); |
74 | 74 |
75 protected: | 75 protected: |
76 CFWL_DateTimeEdit* m_pOwner; | 76 CFWL_DateTimeEdit* m_pOwner; |
77 }; | 77 }; |
78 class CFWL_DateTimeCalendar : public CFWL_MonthCalendarImp { | 78 class CFWL_DateTimeCalendar : public CFWL_MonthCalendarImp { |
79 public: | 79 public: |
80 CFWL_DateTimeCalendar(const CFWL_WidgetImpProperties& properties, | 80 CFWL_DateTimeCalendar(const CFWL_WidgetImpProperties& properties, |
81 IFWL_Widget* pOuter); | 81 IFWL_Widget* pOuter); |
82 virtual FWL_ERR Initialize(); | 82 virtual FWL_Error Initialize(); |
83 virtual FWL_ERR Finalize(); | 83 virtual FWL_Error Finalize(); |
84 | 84 |
85 protected: | 85 protected: |
86 friend class CFWL_DateTimeCalendarImpDelegate; | 86 friend class CFWL_DateTimeCalendarImpDelegate; |
87 }; | 87 }; |
88 class CFWL_DateTimeCalendarImpDelegate : public CFWL_MonthCalendarImpDelegate { | 88 class CFWL_DateTimeCalendarImpDelegate : public CFWL_MonthCalendarImpDelegate { |
89 public: | 89 public: |
90 CFWL_DateTimeCalendarImpDelegate(CFWL_DateTimeCalendar* pOwner); | 90 CFWL_DateTimeCalendarImpDelegate(CFWL_DateTimeCalendar* pOwner); |
91 int32_t OnProcessMessage(CFWL_Message* pMessage) override; | 91 void OnProcessMessage(CFWL_Message* pMessage) override; |
92 | 92 |
93 void OnLButtonDownEx(CFWL_MsgMouse* pMsg); | 93 void OnLButtonDownEx(CFWL_MsgMouse* pMsg); |
94 void OnLButtonUpEx(CFWL_MsgMouse* pMsg); | 94 void OnLButtonUpEx(CFWL_MsgMouse* pMsg); |
95 void OnMouseMoveEx(CFWL_MsgMouse* pMsg); | 95 void OnMouseMoveEx(CFWL_MsgMouse* pMsg); |
96 | 96 |
97 private: | 97 private: |
98 int32_t DisForm_OnProcessMessage(CFWL_Message* pMessage); | 98 void DisForm_OnProcessMessage(CFWL_Message* pMessage); |
99 void DisForm_OnLButtonUpEx(CFWL_MsgMouse* pMsg); | 99 void DisForm_OnLButtonUpEx(CFWL_MsgMouse* pMsg); |
100 | 100 |
101 protected: | 101 protected: |
102 CFWL_DateTimeCalendar* m_pOwner; | 102 CFWL_DateTimeCalendar* m_pOwner; |
103 FX_BOOL m_bFlag; | 103 FX_BOOL m_bFlag; |
104 }; | 104 }; |
105 class CFWL_DateTimePickerImp : public CFWL_WidgetImp { | 105 class CFWL_DateTimePickerImp : public CFWL_WidgetImp { |
106 public: | 106 public: |
107 CFWL_DateTimePickerImp(const CFWL_WidgetImpProperties& properties, | 107 CFWL_DateTimePickerImp(const CFWL_WidgetImpProperties& properties, |
108 IFWL_Widget* pOuter); | 108 IFWL_Widget* pOuter); |
109 virtual ~CFWL_DateTimePickerImp(); | 109 virtual ~CFWL_DateTimePickerImp(); |
110 virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; | 110 virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; |
111 virtual uint32_t GetClassID() const; | 111 virtual uint32_t GetClassID() const; |
112 virtual FWL_ERR Initialize(); | 112 virtual FWL_Error Initialize(); |
113 virtual FWL_ERR Finalize(); | 113 virtual FWL_Error Finalize(); |
114 virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); | 114 virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); |
115 virtual FWL_ERR Update(); | 115 virtual FWL_Error Update(); |
116 virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); | 116 virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); |
117 virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, | 117 virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
118 const CFX_Matrix* pMatrix = NULL); | 118 const CFX_Matrix* pMatrix = NULL); |
119 virtual FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pTP); | 119 virtual FWL_Error SetThemeProvider(IFWL_ThemeProvider* pTP); |
120 virtual FWL_ERR GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay); | 120 virtual FWL_Error GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay); |
121 virtual FWL_ERR SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay); | 121 virtual FWL_Error SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay); |
122 virtual FWL_ERR SetEditText(const CFX_WideString& wsText); | 122 virtual FWL_Error SetEditText(const CFX_WideString& wsText); |
123 virtual FWL_ERR GetEditText(CFX_WideString& wsText, | 123 virtual FWL_Error GetEditText(CFX_WideString& wsText, |
124 int32_t nStart = 0, | 124 int32_t nStart = 0, |
125 int32_t nCount = -1) const; | 125 int32_t nCount = -1) const; |
126 | 126 |
127 public: | 127 public: |
128 virtual FX_BOOL CanUndo(); | 128 virtual FX_BOOL CanUndo(); |
129 virtual FX_BOOL CanRedo(); | 129 virtual FX_BOOL CanRedo(); |
130 virtual FX_BOOL Undo(); | 130 virtual FX_BOOL Undo(); |
131 virtual FX_BOOL Redo(); | 131 virtual FX_BOOL Redo(); |
132 virtual FX_BOOL CanCopy(); | 132 virtual FX_BOOL CanCopy(); |
133 virtual FX_BOOL CanCut(); | 133 virtual FX_BOOL CanCut(); |
134 virtual FX_BOOL CanSelectAll(); | 134 virtual FX_BOOL CanSelectAll(); |
135 virtual FX_BOOL Copy(CFX_WideString& wsCopy); | 135 virtual FX_BOOL Copy(CFX_WideString& wsCopy); |
136 virtual FX_BOOL Cut(CFX_WideString& wsCut); | 136 virtual FX_BOOL Cut(CFX_WideString& wsCut); |
137 virtual FX_BOOL Paste(const CFX_WideString& wsPaste); | 137 virtual FX_BOOL Paste(const CFX_WideString& wsPaste); |
138 virtual FX_BOOL SelectAll(); | 138 virtual FX_BOOL SelectAll(); |
139 virtual FX_BOOL Delete(); | 139 virtual FX_BOOL Delete(); |
140 virtual FX_BOOL DeSelect(); | 140 virtual FX_BOOL DeSelect(); |
141 virtual FWL_ERR GetBBox(CFX_RectF& rect); | 141 virtual FWL_Error GetBBox(CFX_RectF& rect); |
142 virtual FWL_ERR SetEditLimit(int32_t nLimit); | 142 virtual FWL_Error SetEditLimit(int32_t nLimit); |
143 virtual FWL_ERR ModifyEditStylesEx(uint32_t dwStylesExAdded, | 143 virtual FWL_Error ModifyEditStylesEx(uint32_t dwStylesExAdded, |
144 uint32_t dwStylesExRemoved); | 144 uint32_t dwStylesExRemoved); |
145 | 145 |
146 public: | 146 public: |
147 IFWL_DateTimeEdit* GetDataTimeEdit(); | 147 IFWL_DateTimeEdit* GetDataTimeEdit(); |
148 | 148 |
149 protected: | 149 protected: |
150 void DrawDropDownButton(CFX_Graphics* pGraphics, | 150 void DrawDropDownButton(CFX_Graphics* pGraphics, |
151 IFWL_ThemeProvider* pTheme, | 151 IFWL_ThemeProvider* pTheme, |
152 const CFX_Matrix* pMatrix); | 152 const CFX_Matrix* pMatrix); |
153 void FormatDateString(int32_t iYear, | 153 void FormatDateString(int32_t iYear, |
154 int32_t iMonth, | 154 int32_t iMonth, |
155 int32_t iDay, | 155 int32_t iDay, |
156 CFX_WideString& wsText); | 156 CFX_WideString& wsText); |
157 void ShowMonthCalendar(FX_BOOL bActivate); | 157 void ShowMonthCalendar(FX_BOOL bActivate); |
158 FX_BOOL IsMonthCalendarShowed(); | 158 FX_BOOL IsMonthCalendarShowed(); |
159 void ReSetEditAlignment(); | 159 void ReSetEditAlignment(); |
160 void InitProxyForm(); | 160 void InitProxyForm(); |
161 void ProcessSelChanged(int32_t iYear, int32_t iMonth, int32_t iDay); | 161 void ProcessSelChanged(int32_t iYear, int32_t iMonth, int32_t iDay); |
162 | 162 |
163 private: | 163 private: |
164 FWL_ERR DisForm_Initialize(); | 164 FWL_Error DisForm_Initialize(); |
165 void DisForm_InitDateTimeCalendar(); | 165 void DisForm_InitDateTimeCalendar(); |
166 void DisForm_InitDateTimeEdit(); | 166 void DisForm_InitDateTimeEdit(); |
167 FX_BOOL DisForm_IsMonthCalendarShowed(); | 167 FX_BOOL DisForm_IsMonthCalendarShowed(); |
168 void DisForm_ShowMonthCalendar(FX_BOOL bActivate); | 168 void DisForm_ShowMonthCalendar(FX_BOOL bActivate); |
169 FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy); | 169 FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy); |
170 FX_BOOL DisForm_IsNeedShowButton(); | 170 FX_BOOL DisForm_IsNeedShowButton(); |
171 FWL_ERR DisForm_Update(); | 171 FWL_Error DisForm_Update(); |
172 FWL_ERR DisForm_GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); | 172 FWL_Error DisForm_GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); |
173 FWL_ERR DisForm_GetBBox(CFX_RectF& rect); | 173 FWL_Error DisForm_GetBBox(CFX_RectF& rect); |
174 FWL_ERR DisForm_DrawWidget(CFX_Graphics* pGraphics, | 174 FWL_Error DisForm_DrawWidget(CFX_Graphics* pGraphics, |
175 const CFX_Matrix* pMatrix = NULL); | 175 const CFX_Matrix* pMatrix = NULL); |
176 | 176 |
177 protected: | 177 protected: |
178 CFX_RectF m_rtBtn; | 178 CFX_RectF m_rtBtn; |
179 CFX_RectF m_rtClient; | 179 CFX_RectF m_rtClient; |
180 int32_t m_iBtnState; | 180 int32_t m_iBtnState; |
181 int32_t m_iYear; | 181 int32_t m_iYear; |
182 int32_t m_iMonth; | 182 int32_t m_iMonth; |
183 int32_t m_iDay; | 183 int32_t m_iDay; |
184 FX_BOOL m_bLBtnDown; | 184 FX_BOOL m_bLBtnDown; |
185 std::unique_ptr<IFWL_DateTimeEdit> m_pEdit; | 185 std::unique_ptr<IFWL_DateTimeEdit> m_pEdit; |
186 std::unique_ptr<IFWL_DateTimeCalender> m_pMonthCal; | 186 std::unique_ptr<IFWL_DateTimeCalender> m_pMonthCal; |
187 std::unique_ptr<IFWL_DateTimeForm> m_pForm; | 187 std::unique_ptr<IFWL_DateTimeForm> m_pForm; |
188 FX_FLOAT m_fBtn; | 188 FX_FLOAT m_fBtn; |
189 class CFWL_MonthCalendarImpDP : public IFWL_MonthCalendarDP { | 189 class CFWL_MonthCalendarImpDP : public IFWL_MonthCalendarDP { |
190 public: | 190 public: |
191 CFWL_MonthCalendarImpDP() { | 191 CFWL_MonthCalendarImpDP() { |
192 m_iCurYear = 2010; | 192 m_iCurYear = 2010; |
193 m_iCurMonth = 3; | 193 m_iCurMonth = 3; |
194 m_iCurDay = 29; | 194 m_iCurDay = 29; |
195 } | 195 } |
196 virtual FWL_ERR GetCaption(IFWL_Widget* pWidget, | 196 virtual FWL_Error GetCaption(IFWL_Widget* pWidget, |
197 CFX_WideString& wsCaption) { | 197 CFX_WideString& wsCaption) { |
198 return FWL_ERR_Succeeded; | 198 return FWL_Error::Succeeded; |
199 } | 199 } |
200 virtual int32_t GetCurDay(IFWL_Widget* pWidget) { return m_iCurDay; } | 200 virtual int32_t GetCurDay(IFWL_Widget* pWidget) { return m_iCurDay; } |
201 virtual int32_t GetCurMonth(IFWL_Widget* pWidget) { return m_iCurMonth; } | 201 virtual int32_t GetCurMonth(IFWL_Widget* pWidget) { return m_iCurMonth; } |
202 virtual int32_t GetCurYear(IFWL_Widget* pWidget) { return m_iCurYear; } | 202 virtual int32_t GetCurYear(IFWL_Widget* pWidget) { return m_iCurYear; } |
203 int32_t m_iCurDay; | 203 int32_t m_iCurDay; |
204 int32_t m_iCurYear; | 204 int32_t m_iCurYear; |
205 int32_t m_iCurMonth; | 205 int32_t m_iCurMonth; |
206 }; | 206 }; |
207 | 207 |
208 CFWL_MonthCalendarImpDP m_MonthCalendarDP; | 208 CFWL_MonthCalendarImpDP m_MonthCalendarDP; |
209 friend class CFWL_DateTimeEditImpDelegate; | 209 friend class CFWL_DateTimeEditImpDelegate; |
210 friend class CFWL_DateTimeCalendar; | 210 friend class CFWL_DateTimeCalendar; |
211 friend class CFWL_DateTimeCalendarImpDelegate; | 211 friend class CFWL_DateTimeCalendarImpDelegate; |
212 friend class CFWL_DateTimePickerImpDelegate; | 212 friend class CFWL_DateTimePickerImpDelegate; |
213 }; | 213 }; |
214 class CFWL_DateTimePickerImpDelegate : public CFWL_WidgetImpDelegate { | 214 class CFWL_DateTimePickerImpDelegate : public CFWL_WidgetImpDelegate { |
215 public: | 215 public: |
216 CFWL_DateTimePickerImpDelegate(CFWL_DateTimePickerImp* pOwner); | 216 CFWL_DateTimePickerImpDelegate(CFWL_DateTimePickerImp* pOwner); |
217 int32_t OnProcessMessage(CFWL_Message* pMessage) override; | 217 void OnProcessMessage(CFWL_Message* pMessage) override; |
218 FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, | 218 void OnDrawWidget(CFX_Graphics* pGraphics, |
219 const CFX_Matrix* pMatrix = NULL) override; | 219 const CFX_Matrix* pMatrix = NULL) override; |
220 | 220 |
221 protected: | 221 protected: |
222 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); | 222 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); |
223 void OnLButtonDown(CFWL_MsgMouse* pMsg); | 223 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
224 void OnLButtonUp(CFWL_MsgMouse* pMsg); | 224 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
225 void OnMouseMove(CFWL_MsgMouse* pMsg); | 225 void OnMouseMove(CFWL_MsgMouse* pMsg); |
226 void OnMouseLeave(CFWL_MsgMouse* pMsg); | 226 void OnMouseLeave(CFWL_MsgMouse* pMsg); |
227 | 227 |
228 CFWL_DateTimePickerImp* m_pOwner; | 228 CFWL_DateTimePickerImp* m_pOwner; |
229 | 229 |
230 private: | 230 private: |
231 void DisForm_OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); | 231 void DisForm_OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); |
232 }; | 232 }; |
233 | 233 |
234 #endif // XFA_FWL_BASEWIDGET_FWL_DATETIMEPICKERIMP_H_ | 234 #endif // XFA_FWL_BASEWIDGET_FWL_DATETIMEPICKERIMP_H_ |
OLD | NEW |