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_MONTHCALENDARIMP_H_ | 7 #ifndef XFA_FWL_CORE_IFWL_MONTHCALENDAR_H_ |
8 #define XFA_FWL_BASEWIDGET_FWL_MONTHCALENDARIMP_H_ | 8 #define XFA_FWL_CORE_IFWL_MONTHCALENDAR_H_ |
9 | |
10 #include <memory> | |
11 | 9 |
12 #include "xfa/fgas/localization/fgas_datetime.h" | 10 #include "xfa/fgas/localization/fgas_datetime.h" |
13 #include "xfa/fwl/core/fwl_widgetimp.h" | 11 #include "xfa/fwl/core/cfwl_event.h" |
| 12 #include "xfa/fwl/core/cfwl_widgetimpproperties.h" |
| 13 #include "xfa/fwl/core/ifwl_dataprovider.h" |
14 #include "xfa/fwl/core/ifwl_widget.h" | 14 #include "xfa/fwl/core/ifwl_widget.h" |
15 | 15 |
| 16 #define FWL_CLASS_MonthCalendar L"FWL_MONTHCALENDAR" |
| 17 #define FWL_STYLEEXT_MCD_MultiSelect (1L << 0) |
| 18 #define FWL_STYLEEXT_MCD_NoToday (1L << 1) |
| 19 #define FWL_STYLEEXT_MCD_NoTodayCircle (1L << 2) |
| 20 #define FWL_STYLEEXT_MCD_WeekNumbers (1L << 3) |
| 21 #define FWL_ITEMSTATE_MCD_Nomal (0L << 0) |
| 22 #define FWL_ITEMSTATE_MCD_Flag (1L << 0) |
| 23 #define FWL_ITEMSTATE_MCD_Selected (1L << 1) |
| 24 #define FWL_ITEMSTATE_MCD_Focused (1L << 2) |
| 25 |
| 26 FWL_EVENT_DEF(CFWL_Event_McdDateSelected, |
| 27 CFWL_EventType::DataSelected, |
| 28 int32_t m_iStartDay; |
| 29 int32_t m_iEndDay;) |
| 30 |
| 31 FWL_EVENT_DEF(CFWL_EventMcdDateChanged, |
| 32 CFWL_EventType::DateChanged, |
| 33 int32_t m_iOldYear; |
| 34 int32_t m_iOldMonth; |
| 35 int32_t m_iStartDay; |
| 36 int32_t m_iEndDay;) |
| 37 |
16 class CFWL_MonthCalendarImpDelegate; | 38 class CFWL_MonthCalendarImpDelegate; |
17 class CFWL_MsgMouse; | 39 class CFWL_MsgMouse; |
18 class CFWL_WidgetImpProperties; | 40 class CFWL_WidgetImpProperties; |
19 class IFWL_Widget; | 41 class IFWL_Widget; |
20 | 42 |
21 struct FWL_DATEINFO; | 43 struct FWL_DATEINFO; |
22 | 44 |
23 extern uint8_t FX_DaysInMonth(int32_t iYear, uint8_t iMonth); | 45 extern uint8_t FX_DaysInMonth(int32_t iYear, uint8_t iMonth); |
24 | 46 |
25 class CFWL_MonthCalendarImp : public CFWL_WidgetImp { | 47 class IFWL_MonthCalendarDP : public IFWL_DataProvider { |
26 public: | 48 public: |
27 CFWL_MonthCalendarImp(const CFWL_WidgetImpProperties& properties, | 49 virtual int32_t GetCurDay(IFWL_Widget* pWidget) = 0; |
28 IFWL_Widget* pOuter); | 50 virtual int32_t GetCurMonth(IFWL_Widget* pWidget) = 0; |
29 ~CFWL_MonthCalendarImp() override; | 51 virtual int32_t GetCurYear(IFWL_Widget* pWidget) = 0; |
| 52 }; |
| 53 |
| 54 class IFWL_MonthCalendar : public IFWL_Widget { |
| 55 public: |
| 56 static IFWL_MonthCalendar* Create(const CFWL_WidgetImpProperties& properties, |
| 57 IFWL_Widget* pOuter); |
| 58 |
| 59 IFWL_MonthCalendar(const CFWL_WidgetImpProperties& properties, |
| 60 IFWL_Widget* pOuter); |
| 61 ~IFWL_MonthCalendar() override; |
30 | 62 |
31 // FWL_WidgetImp | 63 // FWL_WidgetImp |
32 FWL_Error GetClassName(CFX_WideString& wsClass) const override; | 64 FWL_Error GetClassName(CFX_WideString& wsClass) const override; |
33 FWL_Type GetClassID() const override; | 65 FWL_Type GetClassID() const override; |
34 FWL_Error Initialize() override; | 66 FWL_Error Initialize() override; |
35 FWL_Error Finalize() override; | 67 FWL_Error Finalize() override; |
36 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; | 68 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; |
37 FWL_Error Update() override; | 69 FWL_Error Update() override; |
38 FWL_Error DrawWidget(CFX_Graphics* pGraphics, | 70 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
39 const CFX_Matrix* pMatrix = nullptr) override; | 71 const CFX_Matrix* pMatrix = nullptr) override; |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 255 |
224 int32_t iDay; | 256 int32_t iDay; |
225 int32_t iDayOfWeek; | 257 int32_t iDayOfWeek; |
226 uint32_t dwStates; | 258 uint32_t dwStates; |
227 CFX_RectF rect; | 259 CFX_RectF rect; |
228 CFX_WideString wsDay; | 260 CFX_WideString wsDay; |
229 }; | 261 }; |
230 | 262 |
231 class CFWL_MonthCalendarImpDelegate : public CFWL_WidgetImpDelegate { | 263 class CFWL_MonthCalendarImpDelegate : public CFWL_WidgetImpDelegate { |
232 public: | 264 public: |
233 CFWL_MonthCalendarImpDelegate(CFWL_MonthCalendarImp* pOwner); | 265 CFWL_MonthCalendarImpDelegate(IFWL_MonthCalendar* pOwner); |
234 void OnProcessMessage(CFWL_Message* pMessage) override; | 266 void OnProcessMessage(CFWL_Message* pMessage) override; |
235 void OnDrawWidget(CFX_Graphics* pGraphics, | 267 void OnDrawWidget(CFX_Graphics* pGraphics, |
236 const CFX_Matrix* pMatrix = nullptr) override; | 268 const CFX_Matrix* pMatrix = nullptr) override; |
237 | 269 |
238 protected: | 270 protected: |
239 void OnActivate(CFWL_Message* pMsg); | 271 void OnActivate(CFWL_Message* pMsg); |
240 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); | 272 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); |
241 void OnLButtonDown(CFWL_MsgMouse* pMsg); | 273 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
242 void OnLButtonUp(CFWL_MsgMouse* pMsg); | 274 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
243 void OnMouseMove(CFWL_MsgMouse* pMsg); | 275 void OnMouseMove(CFWL_MsgMouse* pMsg); |
244 void OnMouseLeave(CFWL_MsgMouse* pMsg); | 276 void OnMouseLeave(CFWL_MsgMouse* pMsg); |
245 CFWL_MonthCalendarImp* m_pOwner; | 277 IFWL_MonthCalendar* m_pOwner; |
246 }; | 278 }; |
247 | 279 |
248 #endif // XFA_FWL_BASEWIDGET_FWL_MONTHCALENDARIMP_H_ | 280 #endif // XFA_FWL_CORE_IFWL_MONTHCALENDAR_H_ |
OLD | NEW |