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" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 int32_t iDay;) | 53 int32_t iDay;) |
54 | 54 |
55 class IFWL_DateTimePickerDP : public IFWL_DataProvider { | 55 class IFWL_DateTimePickerDP : public IFWL_DataProvider { |
56 public: | 56 public: |
57 virtual FWL_Error GetToday(IFWL_Widget* pWidget, | 57 virtual FWL_Error GetToday(IFWL_Widget* pWidget, |
58 int32_t& iYear, | 58 int32_t& iYear, |
59 int32_t& iMonth, | 59 int32_t& iMonth, |
60 int32_t& iDay) = 0; | 60 int32_t& iDay) = 0; |
61 }; | 61 }; |
62 | 62 |
63 class IFWL_DateTimePicker : public IFWL_Widget { | 63 class IFWL_DateTimePicker : public IFWL_Widget, public IFWL_MonthCalendarDP { |
64 public: | 64 public: |
65 explicit IFWL_DateTimePicker( | 65 explicit IFWL_DateTimePicker( |
66 const IFWL_App* app, | 66 const IFWL_App* app, |
67 std::unique_ptr<CFWL_WidgetProperties> properties); | 67 std::unique_ptr<CFWL_WidgetProperties> properties); |
68 ~IFWL_DateTimePicker() override; | 68 ~IFWL_DateTimePicker() override; |
69 | 69 |
70 // IFWL_Widget | 70 // IFWL_Widget |
71 FWL_Type GetClassID() const override; | 71 FWL_Type GetClassID() const override; |
72 FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; | 72 FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; |
73 FWL_Error Update() override; | 73 FWL_Error Update() override; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 uint32_t dwStylesExRemoved); | 107 uint32_t dwStylesExRemoved); |
108 IFWL_DateTimeEdit* GetDataTimeEdit(); | 108 IFWL_DateTimeEdit* GetDataTimeEdit(); |
109 | 109 |
110 bool IsMonthCalendarShowed(); | 110 bool IsMonthCalendarShowed(); |
111 void ShowMonthCalendar(bool bActivate); | 111 void ShowMonthCalendar(bool bActivate); |
112 void ProcessSelChanged(int32_t iYear, int32_t iMonth, int32_t iDay); | 112 void ProcessSelChanged(int32_t iYear, int32_t iMonth, int32_t iDay); |
113 | 113 |
114 IFWL_FormProxy* GetFormProxy() const { return m_pForm.get(); } | 114 IFWL_FormProxy* GetFormProxy() const { return m_pForm.get(); } |
115 | 115 |
116 protected: | 116 protected: |
117 class CFWL_MonthCalendarImpDP : public IFWL_MonthCalendarDP { | 117 // IFWL_DataProvider |
118 public: | 118 FWL_Error GetCaption(IFWL_Widget* pWidget, |
119 CFWL_MonthCalendarImpDP(); | 119 CFX_WideString& wsCaption) override; |
120 | 120 |
121 // IFWL_DataProvider | 121 // IFWL_MonthCalendarDP |
122 FWL_Error GetCaption(IFWL_Widget* pWidget, | 122 int32_t GetCurDay(IFWL_Widget* pWidget) override; |
123 CFX_WideString& wsCaption) override; | 123 int32_t GetCurMonth(IFWL_Widget* pWidget) override; |
124 | 124 int32_t GetCurYear(IFWL_Widget* pWidget) override; |
125 // IFWL_MonthCalendarDP | |
126 int32_t GetCurDay(IFWL_Widget* pWidget) override; | |
127 int32_t GetCurMonth(IFWL_Widget* pWidget) override; | |
128 int32_t GetCurYear(IFWL_Widget* pWidget) override; | |
129 | |
130 int32_t m_iCurDay; | |
131 int32_t m_iCurYear; | |
132 int32_t m_iCurMonth; | |
133 }; | |
134 | 125 |
135 void DrawDropDownButton(CFX_Graphics* pGraphics, | 126 void DrawDropDownButton(CFX_Graphics* pGraphics, |
136 IFWL_ThemeProvider* pTheme, | 127 IFWL_ThemeProvider* pTheme, |
137 const CFX_Matrix* pMatrix); | 128 const CFX_Matrix* pMatrix); |
138 void FormatDateString(int32_t iYear, | 129 void FormatDateString(int32_t iYear, |
139 int32_t iMonth, | 130 int32_t iMonth, |
140 int32_t iDay, | 131 int32_t iDay, |
141 CFX_WideString& wsText); | 132 CFX_WideString& wsText); |
142 void ReSetEditAlignment(); | 133 void ReSetEditAlignment(); |
143 void InitProxyForm(); | 134 void InitProxyForm(); |
144 | 135 |
| 136 int32_t m_iCurDay; |
| 137 int32_t m_iCurYear; |
| 138 int32_t m_iCurMonth; |
| 139 |
145 CFX_RectF m_rtBtn; | 140 CFX_RectF m_rtBtn; |
146 CFX_RectF m_rtClient; | 141 CFX_RectF m_rtClient; |
147 int32_t m_iBtnState; | 142 int32_t m_iBtnState; |
148 int32_t m_iYear; | 143 int32_t m_iYear; |
149 int32_t m_iMonth; | 144 int32_t m_iMonth; |
150 int32_t m_iDay; | 145 int32_t m_iDay; |
151 bool m_bLBtnDown; | 146 bool m_bLBtnDown; |
152 std::unique_ptr<IFWL_DateTimeEdit> m_pEdit; | 147 std::unique_ptr<IFWL_DateTimeEdit> m_pEdit; |
153 std::unique_ptr<IFWL_DateTimeCalendar> m_pMonthCal; | 148 std::unique_ptr<IFWL_DateTimeCalendar> m_pMonthCal; |
154 std::unique_ptr<IFWL_FormProxy> m_pForm; | 149 std::unique_ptr<IFWL_FormProxy> m_pForm; |
155 FX_FLOAT m_fBtn; | 150 FX_FLOAT m_fBtn; |
156 CFWL_MonthCalendarImpDP m_MonthCalendarDP; | |
157 | 151 |
158 private: | 152 private: |
159 FWL_Error DisForm_Initialize(); | 153 FWL_Error DisForm_Initialize(); |
160 void DisForm_InitDateTimeCalendar(); | 154 void DisForm_InitDateTimeCalendar(); |
161 void DisForm_InitDateTimeEdit(); | 155 void DisForm_InitDateTimeEdit(); |
162 bool DisForm_IsMonthCalendarShowed(); | 156 bool DisForm_IsMonthCalendarShowed(); |
163 void DisForm_ShowMonthCalendar(bool bActivate); | 157 void DisForm_ShowMonthCalendar(bool bActivate); |
164 FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy); | 158 FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy); |
165 bool DisForm_IsNeedShowButton(); | 159 bool DisForm_IsNeedShowButton(); |
166 FWL_Error DisForm_Update(); | 160 FWL_Error DisForm_Update(); |
167 FWL_Error DisForm_GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false); | 161 FWL_Error DisForm_GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false); |
168 FWL_Error DisForm_GetBBox(CFX_RectF& rect); | 162 FWL_Error DisForm_GetBBox(CFX_RectF& rect); |
169 FWL_Error DisForm_DrawWidget(CFX_Graphics* pGraphics, | 163 FWL_Error DisForm_DrawWidget(CFX_Graphics* pGraphics, |
170 const CFX_Matrix* pMatrix = nullptr); | 164 const CFX_Matrix* pMatrix = nullptr); |
171 | 165 |
172 void OnFocusChanged(CFWL_Message* pMsg, bool bSet); | 166 void OnFocusChanged(CFWL_Message* pMsg, bool bSet); |
173 void OnLButtonDown(CFWL_MsgMouse* pMsg); | 167 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
174 void OnLButtonUp(CFWL_MsgMouse* pMsg); | 168 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
175 void OnMouseMove(CFWL_MsgMouse* pMsg); | 169 void OnMouseMove(CFWL_MsgMouse* pMsg); |
176 void OnMouseLeave(CFWL_MsgMouse* pMsg); | 170 void OnMouseLeave(CFWL_MsgMouse* pMsg); |
177 void DisForm_OnFocusChanged(CFWL_Message* pMsg, bool bSet); | 171 void DisForm_OnFocusChanged(CFWL_Message* pMsg, bool bSet); |
178 }; | 172 }; |
179 | 173 |
180 #endif // XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_ | 174 #endif // XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_ |
OLD | NEW |