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_MONTHCALENDAR_H_ | 7 #ifndef XFA_FWL_CORE_IFWL_MONTHCALENDAR_H_ |
8 #define XFA_FWL_CORE_IFWL_MONTHCALENDAR_H_ | 8 #define XFA_FWL_CORE_IFWL_MONTHCALENDAR_H_ |
9 | 9 |
10 #include "xfa/fgas/localization/fgas_datetime.h" | 10 #include "xfa/fgas/localization/fgas_datetime.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 int32_t m_iStartDay; | 27 int32_t m_iStartDay; |
28 int32_t m_iEndDay;) | 28 int32_t m_iEndDay;) |
29 | 29 |
30 FWL_EVENT_DEF(CFWL_EventMcdDateChanged, | 30 FWL_EVENT_DEF(CFWL_EventMcdDateChanged, |
31 CFWL_EventType::DateChanged, | 31 CFWL_EventType::DateChanged, |
32 int32_t m_iOldYear; | 32 int32_t m_iOldYear; |
33 int32_t m_iOldMonth; | 33 int32_t m_iOldMonth; |
34 int32_t m_iStartDay; | 34 int32_t m_iStartDay; |
35 int32_t m_iEndDay;) | 35 int32_t m_iEndDay;) |
36 | 36 |
37 class CFWL_MonthCalendarImpDelegate; | |
38 class CFWL_MsgMouse; | 37 class CFWL_MsgMouse; |
39 class CFWL_WidgetImpProperties; | 38 class CFWL_WidgetImpProperties; |
40 class IFWL_Widget; | 39 class IFWL_Widget; |
41 | 40 |
42 struct FWL_DATEINFO; | 41 struct FWL_DATEINFO; |
43 | 42 |
44 extern uint8_t FX_DaysInMonth(int32_t iYear, uint8_t iMonth); | 43 extern uint8_t FX_DaysInMonth(int32_t iYear, uint8_t iMonth); |
45 | 44 |
46 class IFWL_MonthCalendarDP : public IFWL_DataProvider { | 45 class IFWL_MonthCalendarDP : public IFWL_DataProvider { |
47 public: | 46 public: |
48 virtual int32_t GetCurDay(IFWL_Widget* pWidget) = 0; | 47 virtual int32_t GetCurDay(IFWL_Widget* pWidget) = 0; |
49 virtual int32_t GetCurMonth(IFWL_Widget* pWidget) = 0; | 48 virtual int32_t GetCurMonth(IFWL_Widget* pWidget) = 0; |
50 virtual int32_t GetCurYear(IFWL_Widget* pWidget) = 0; | 49 virtual int32_t GetCurYear(IFWL_Widget* pWidget) = 0; |
51 }; | 50 }; |
52 | 51 |
53 class IFWL_MonthCalendar : public IFWL_Widget { | 52 class IFWL_MonthCalendar : public IFWL_Widget { |
54 public: | 53 public: |
55 IFWL_MonthCalendar(const IFWL_App* app, | 54 IFWL_MonthCalendar(const IFWL_App* app, |
56 const CFWL_WidgetImpProperties& properties, | 55 const CFWL_WidgetImpProperties& properties, |
57 IFWL_Widget* pOuter); | 56 IFWL_Widget* pOuter); |
58 ~IFWL_MonthCalendar() override; | 57 ~IFWL_MonthCalendar() override; |
59 | 58 |
60 // FWL_WidgetImp | 59 // FWL_WidgetImp |
61 FWL_Type GetClassID() const override; | 60 FWL_Type GetClassID() const override; |
62 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; | 61 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; |
63 FWL_Error Update() override; | 62 FWL_Error Update() override; |
64 FWL_Error DrawWidget(CFX_Graphics* pGraphics, | 63 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
65 const CFX_Matrix* pMatrix = nullptr) override; | 64 const CFX_Matrix* pMatrix = nullptr) override; |
| 65 void OnProcessMessage(CFWL_Message* pMessage) override; |
| 66 void OnDrawWidget(CFX_Graphics* pGraphics, |
| 67 const CFX_Matrix* pMatrix) override; |
| 68 |
66 int32_t CountSelect(); | 69 int32_t CountSelect(); |
67 FX_BOOL GetSelect(int32_t& iYear, | 70 FX_BOOL GetSelect(int32_t& iYear, |
68 int32_t& iMonth, | 71 int32_t& iMonth, |
69 int32_t& iDay, | 72 int32_t& iDay, |
70 int32_t nIndex = 0); | 73 int32_t nIndex = 0); |
71 FX_BOOL SetSelect(int32_t iYear, int32_t iMonth, int32_t iDay); | 74 FX_BOOL SetSelect(int32_t iYear, int32_t iMonth, int32_t iDay); |
72 | 75 |
73 protected: | 76 protected: |
74 struct DATE { | 77 struct DATE { |
75 DATE() : iYear(0), iMonth(0), iDay(0) {} | 78 DATE() : iYear(0), iMonth(0), iDay(0) {} |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 FX_FLOAT m_fWeekNumHeigh; | 232 FX_FLOAT m_fWeekNumHeigh; |
230 FX_FLOAT m_fWeekWid; | 233 FX_FLOAT m_fWeekWid; |
231 FX_FLOAT m_fWeekHei; | 234 FX_FLOAT m_fWeekHei; |
232 FX_FLOAT m_fDateCellWid; | 235 FX_FLOAT m_fDateCellWid; |
233 FX_FLOAT m_fDateCellHei; | 236 FX_FLOAT m_fDateCellHei; |
234 FX_FLOAT m_fTodayWid; | 237 FX_FLOAT m_fTodayWid; |
235 FX_FLOAT m_fTodayHei; | 238 FX_FLOAT m_fTodayHei; |
236 FX_FLOAT m_fTodayFlagWid; | 239 FX_FLOAT m_fTodayFlagWid; |
237 FX_FLOAT m_fMCWid; | 240 FX_FLOAT m_fMCWid; |
238 FX_FLOAT m_fMCHei; | 241 FX_FLOAT m_fMCHei; |
239 friend class CFWL_MonthCalendarImpDelegate; | 242 |
| 243 private: |
| 244 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet); |
| 245 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
| 246 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
| 247 void OnMouseMove(CFWL_MsgMouse* pMsg); |
| 248 void OnMouseLeave(CFWL_MsgMouse* pMsg); |
240 }; | 249 }; |
241 | 250 |
242 struct FWL_DATEINFO { | 251 struct FWL_DATEINFO { |
243 FWL_DATEINFO(int32_t day, | 252 FWL_DATEINFO(int32_t day, |
244 int32_t dayofweek, | 253 int32_t dayofweek, |
245 uint32_t dwSt, | 254 uint32_t dwSt, |
246 CFX_RectF rc, | 255 CFX_RectF rc, |
247 CFX_WideString& wsday); | 256 CFX_WideString& wsday); |
248 ~FWL_DATEINFO(); | 257 ~FWL_DATEINFO(); |
249 | 258 |
250 int32_t iDay; | 259 int32_t iDay; |
251 int32_t iDayOfWeek; | 260 int32_t iDayOfWeek; |
252 uint32_t dwStates; | 261 uint32_t dwStates; |
253 CFX_RectF rect; | 262 CFX_RectF rect; |
254 CFX_WideString wsDay; | 263 CFX_WideString wsDay; |
255 }; | 264 }; |
256 | 265 |
257 class CFWL_MonthCalendarImpDelegate : public CFWL_WidgetImpDelegate { | |
258 public: | |
259 CFWL_MonthCalendarImpDelegate(IFWL_MonthCalendar* pOwner); | |
260 void OnProcessMessage(CFWL_Message* pMessage) override; | |
261 void OnDrawWidget(CFX_Graphics* pGraphics, | |
262 const CFX_Matrix* pMatrix = nullptr) override; | |
263 | |
264 protected: | |
265 void OnActivate(CFWL_Message* pMsg); | |
266 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); | |
267 void OnLButtonDown(CFWL_MsgMouse* pMsg); | |
268 void OnLButtonUp(CFWL_MsgMouse* pMsg); | |
269 void OnMouseMove(CFWL_MsgMouse* pMsg); | |
270 void OnMouseLeave(CFWL_MsgMouse* pMsg); | |
271 IFWL_MonthCalendar* m_pOwner; | |
272 }; | |
273 | |
274 #endif // XFA_FWL_CORE_IFWL_MONTHCALENDAR_H_ | 266 #endif // XFA_FWL_CORE_IFWL_MONTHCALENDAR_H_ |
OLD | NEW |