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_CORE_IFWL_DATETIMEPICKER_H_ | 7 #ifndef XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_ |
8 #define XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_ | 8 #define XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_ |
9 | 9 |
10 #include "xfa/fwl/core/cfwl_event.h" | 10 #include "xfa/fwl/core/cfwl_event.h" |
11 #include "xfa/fwl/core/cfwl_widgetproperties.h" | 11 #include "xfa/fwl/core/cfwl_widgetproperties.h" |
12 #include "xfa/fwl/core/ifwl_dataprovider.h" | |
13 #include "xfa/fwl/core/ifwl_datetimeedit.h" | 12 #include "xfa/fwl/core/ifwl_datetimeedit.h" |
14 #include "xfa/fwl/core/ifwl_monthcalendar.h" | 13 #include "xfa/fwl/core/ifwl_monthcalendar.h" |
15 #include "xfa/fwl/core/ifwl_widget.h" | 14 #include "xfa/fwl/core/ifwl_widget.h" |
16 | 15 |
17 #define FWL_STYLEEXT_DTP_AllowEdit (1L << 0) | 16 #define FWL_STYLEEXT_DTP_AllowEdit (1L << 0) |
18 #define FWL_STYLEEXT_DTP_LongDateFormat (0L << 1) | 17 #define FWL_STYLEEXT_DTP_LongDateFormat (0L << 1) |
19 #define FWL_STYLEEXT_DTP_ShortDateFormat (1L << 1) | 18 #define FWL_STYLEEXT_DTP_ShortDateFormat (1L << 1) |
20 #define FWL_STYLEEXT_DTP_TimeFormat (2L << 1) | 19 #define FWL_STYLEEXT_DTP_TimeFormat (2L << 1) |
21 #define FWL_STYLEEXT_DTP_Spin (1L << 3) | 20 #define FWL_STYLEEXT_DTP_Spin (1L << 3) |
22 #define FWL_STYLEEXT_DTP_EditHNear (0L << 4) | 21 #define FWL_STYLEEXT_DTP_EditHNear (0L << 4) |
23 #define FWL_STYLEEXT_DTP_EditHCenter (1L << 4) | 22 #define FWL_STYLEEXT_DTP_EditHCenter (1L << 4) |
24 #define FWL_STYLEEXT_DTP_EditHFar (2L << 4) | 23 #define FWL_STYLEEXT_DTP_EditHFar (2L << 4) |
25 #define FWL_STYLEEXT_DTP_EditVNear (0L << 6) | 24 #define FWL_STYLEEXT_DTP_EditVNear (0L << 6) |
26 #define FWL_STYLEEXT_DTP_EditVCenter (1L << 6) | 25 #define FWL_STYLEEXT_DTP_EditVCenter (1L << 6) |
27 #define FWL_STYLEEXT_DTP_EditVFar (2L << 6) | 26 #define FWL_STYLEEXT_DTP_EditVFar (2L << 6) |
28 #define FWL_STYLEEXT_DTP_EditJustified (1L << 8) | 27 #define FWL_STYLEEXT_DTP_EditJustified (1L << 8) |
29 #define FWL_STYLEEXT_DTP_EditDistributed (2L << 8) | 28 #define FWL_STYLEEXT_DTP_EditDistributed (2L << 8) |
30 #define FWL_STYLEEXT_DTP_EditHAlignMask (3L << 4) | 29 #define FWL_STYLEEXT_DTP_EditHAlignMask (3L << 4) |
31 #define FWL_STYLEEXT_DTP_EditVAlignMask (3L << 6) | 30 #define FWL_STYLEEXT_DTP_EditVAlignMask (3L << 6) |
32 #define FWL_STYLEEXT_DTP_EditHAlignModeMask (3L << 8) | 31 #define FWL_STYLEEXT_DTP_EditHAlignModeMask (3L << 8) |
33 | 32 |
34 class IFWL_DateTimeEdit; | 33 class IFWL_DateTimeEdit; |
35 class IFWL_FormProxy; | 34 class IFWL_FormProxy; |
36 | 35 |
37 class IFWL_DateTimePickerDP : public IFWL_DataProvider { | 36 class IFWL_DateTimePickerDP : public IFWL_Widget::DataProvider { |
38 public: | 37 public: |
39 virtual void GetToday(IFWL_Widget* pWidget, | 38 virtual void GetToday(IFWL_Widget* pWidget, |
40 int32_t& iYear, | 39 int32_t& iYear, |
41 int32_t& iMonth, | 40 int32_t& iMonth, |
42 int32_t& iDay) = 0; | 41 int32_t& iDay) = 0; |
43 }; | 42 }; |
44 | 43 |
45 class IFWL_DateTimePicker : public IFWL_Widget, public IFWL_MonthCalendarDP { | 44 class IFWL_DateTimePicker : public IFWL_Widget, |
| 45 public IFWL_MonthCalendar::DataProvider { |
46 public: | 46 public: |
47 explicit IFWL_DateTimePicker( | 47 explicit IFWL_DateTimePicker( |
48 const IFWL_App* app, | 48 const IFWL_App* app, |
49 std::unique_ptr<CFWL_WidgetProperties> properties); | 49 std::unique_ptr<CFWL_WidgetProperties> properties); |
50 ~IFWL_DateTimePicker() override; | 50 ~IFWL_DateTimePicker() override; |
51 | 51 |
52 // IFWL_Widget | 52 // IFWL_Widget |
53 FWL_Type GetClassID() const override; | 53 FWL_Type GetClassID() const override; |
54 void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; | 54 void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; |
55 void Update() override; | 55 void Update() override; |
56 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; | 56 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; |
57 void DrawWidget(CFX_Graphics* pGraphics, | 57 void DrawWidget(CFX_Graphics* pGraphics, |
58 const CFX_Matrix* pMatrix = nullptr) override; | 58 const CFX_Matrix* pMatrix = nullptr) override; |
59 void SetThemeProvider(IFWL_ThemeProvider* pTP) override; | 59 void SetThemeProvider(IFWL_ThemeProvider* pTP) override; |
60 void OnProcessMessage(CFWL_Message* pMessage) override; | 60 void OnProcessMessage(CFWL_Message* pMessage) override; |
61 void OnDrawWidget(CFX_Graphics* pGraphics, | 61 void OnDrawWidget(CFX_Graphics* pGraphics, |
62 const CFX_Matrix* pMatrix) override; | 62 const CFX_Matrix* pMatrix) override; |
63 | 63 |
64 // IFWL_DataProvider | 64 // IFWL_Widget::DataProvider |
65 void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; | 65 void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; |
66 | 66 |
67 // IFWL_MonthCalendarDP | 67 // IFWL_MonthCalendar::DataProvider |
68 int32_t GetCurDay(IFWL_Widget* pWidget) override; | 68 int32_t GetCurDay(IFWL_Widget* pWidget) override; |
69 int32_t GetCurMonth(IFWL_Widget* pWidget) override; | 69 int32_t GetCurMonth(IFWL_Widget* pWidget) override; |
70 int32_t GetCurYear(IFWL_Widget* pWidget) override; | 70 int32_t GetCurYear(IFWL_Widget* pWidget) override; |
71 | 71 |
72 void GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay); | 72 void GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay); |
73 void SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay); | 73 void SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay); |
74 | 74 |
75 void SetEditText(const CFX_WideString& wsText); | 75 void SetEditText(const CFX_WideString& wsText); |
76 void GetEditText(CFX_WideString& wsText, | 76 void GetEditText(CFX_WideString& wsText, |
77 int32_t nStart = 0, | 77 int32_t nStart = 0, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 int32_t m_iCurMonth; | 129 int32_t m_iCurMonth; |
130 int32_t m_iCurDay; | 130 int32_t m_iCurDay; |
131 bool m_bLBtnDown; | 131 bool m_bLBtnDown; |
132 std::unique_ptr<IFWL_DateTimeEdit> m_pEdit; | 132 std::unique_ptr<IFWL_DateTimeEdit> m_pEdit; |
133 std::unique_ptr<IFWL_MonthCalendar> m_pMonthCal; | 133 std::unique_ptr<IFWL_MonthCalendar> m_pMonthCal; |
134 std::unique_ptr<IFWL_FormProxy> m_pForm; | 134 std::unique_ptr<IFWL_FormProxy> m_pForm; |
135 FX_FLOAT m_fBtn; | 135 FX_FLOAT m_fBtn; |
136 }; | 136 }; |
137 | 137 |
138 #endif // XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_ | 138 #endif // XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_ |
OLD | NEW |