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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 class IFWL_MonthCalendar : public IFWL_Widget { | 52 class IFWL_MonthCalendar : public IFWL_Widget { |
53 public: | 53 public: |
54 IFWL_MonthCalendar(const IFWL_App* app, | 54 IFWL_MonthCalendar(const IFWL_App* app, |
55 const CFWL_WidgetImpProperties& properties, | 55 const CFWL_WidgetImpProperties& properties, |
56 IFWL_Widget* pOuter); | 56 IFWL_Widget* pOuter); |
57 ~IFWL_MonthCalendar() override; | 57 ~IFWL_MonthCalendar() override; |
58 | 58 |
59 // FWL_WidgetImp | 59 // FWL_WidgetImp |
60 FWL_Type GetClassID() const override; | 60 FWL_Type GetClassID() const override; |
61 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; | 61 FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; |
62 FWL_Error Update() override; | 62 FWL_Error Update() override; |
63 FWL_Error DrawWidget(CFX_Graphics* pGraphics, | 63 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
64 const CFX_Matrix* pMatrix = nullptr) override; | 64 const CFX_Matrix* pMatrix = nullptr) override; |
65 void OnProcessMessage(CFWL_Message* pMessage) override; | 65 void OnProcessMessage(CFWL_Message* pMessage) override; |
66 void OnDrawWidget(CFX_Graphics* pGraphics, | 66 void OnDrawWidget(CFX_Graphics* pGraphics, |
67 const CFX_Matrix* pMatrix) override; | 67 const CFX_Matrix* pMatrix) override; |
68 | 68 |
69 int32_t CountSelect(); | 69 int32_t CountSelect(); |
70 FX_BOOL GetSelect(int32_t& iYear, | 70 bool GetSelect(int32_t& iYear, |
71 int32_t& iMonth, | 71 int32_t& iMonth, |
72 int32_t& iDay, | 72 int32_t& iDay, |
73 int32_t nIndex = 0); | 73 int32_t nIndex = 0); |
74 FX_BOOL SetSelect(int32_t iYear, int32_t iMonth, int32_t iDay); | 74 bool SetSelect(int32_t iYear, int32_t iMonth, int32_t iDay); |
75 | 75 |
76 protected: | 76 protected: |
77 struct DATE { | 77 struct DATE { |
78 DATE() : iYear(0), iMonth(0), iDay(0) {} | 78 DATE() : iYear(0), iMonth(0), iDay(0) {} |
79 DATE(int32_t year, int32_t month, int32_t day) | 79 DATE(int32_t year, int32_t month, int32_t day) |
80 : iYear(year), iMonth(month), iDay(day) {} | 80 : iYear(year), iMonth(month), iDay(day) {} |
81 FX_BOOL operator<(const DATE& right) { | 81 bool operator<(const DATE& right) { |
82 if (iYear < right.iYear) { | 82 if (iYear < right.iYear) { |
83 return TRUE; | 83 return true; |
84 } else if (iYear == right.iYear) { | 84 } else if (iYear == right.iYear) { |
85 if (iMonth < right.iMonth) { | 85 if (iMonth < right.iMonth) { |
86 return TRUE; | 86 return true; |
87 } else if (iMonth == right.iMonth) { | 87 } else if (iMonth == right.iMonth) { |
88 return iDay < right.iDay; | 88 return iDay < right.iDay; |
89 } | 89 } |
90 } | 90 } |
91 return FALSE; | 91 return false; |
92 } | 92 } |
93 FX_BOOL operator>(const DATE& right) { | 93 bool operator>(const DATE& right) { |
94 if (iYear > right.iYear) { | 94 if (iYear > right.iYear) { |
95 return TRUE; | 95 return true; |
96 } else if (iYear == right.iYear) { | 96 } else if (iYear == right.iYear) { |
97 if (iMonth > right.iMonth) { | 97 if (iMonth > right.iMonth) { |
98 return TRUE; | 98 return true; |
99 } else if (iMonth == right.iMonth) { | 99 } else if (iMonth == right.iMonth) { |
100 return iDay > right.iDay; | 100 return iDay > right.iDay; |
101 } | 101 } |
102 } | 102 } |
103 return FALSE; | 103 return false; |
104 } | 104 } |
105 int32_t iYear; | 105 int32_t iYear; |
106 int32_t iMonth; | 106 int32_t iMonth; |
107 int32_t iDay; | 107 int32_t iDay; |
108 }; | 108 }; |
109 | 109 |
110 void DrawBkground(CFX_Graphics* pGraphics, | 110 void DrawBkground(CFX_Graphics* pGraphics, |
111 IFWL_ThemeProvider* pTheme, | 111 IFWL_ThemeProvider* pTheme, |
112 const CFX_Matrix* pMatrix); | 112 const CFX_Matrix* pMatrix); |
113 void DrawHeadBK(CFX_Graphics* pGraphics, | 113 void DrawHeadBK(CFX_Graphics* pGraphics, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 const CFX_Matrix* pMatrix); | 145 const CFX_Matrix* pMatrix); |
146 void DrawDatesOut(CFX_Graphics* pGraphics, | 146 void DrawDatesOut(CFX_Graphics* pGraphics, |
147 IFWL_ThemeProvider* pTheme, | 147 IFWL_ThemeProvider* pTheme, |
148 const CFX_Matrix* pMatrix); | 148 const CFX_Matrix* pMatrix); |
149 void DrawDatesInCircle(CFX_Graphics* pGraphics, | 149 void DrawDatesInCircle(CFX_Graphics* pGraphics, |
150 IFWL_ThemeProvider* pTheme, | 150 IFWL_ThemeProvider* pTheme, |
151 const CFX_Matrix* pMatrix); | 151 const CFX_Matrix* pMatrix); |
152 void DrawTodayCircle(CFX_Graphics* pGraphics, | 152 void DrawTodayCircle(CFX_Graphics* pGraphics, |
153 IFWL_ThemeProvider* pTheme, | 153 IFWL_ThemeProvider* pTheme, |
154 const CFX_Matrix* pMatrix); | 154 const CFX_Matrix* pMatrix); |
155 CFX_SizeF CalcSize(FX_BOOL bAutoSize = FALSE); | 155 CFX_SizeF CalcSize(bool bAutoSize = false); |
156 void LayOut(); | 156 void LayOut(); |
157 void CalcHeadSize(); | 157 void CalcHeadSize(); |
158 void CalcTodaySize(); | 158 void CalcTodaySize(); |
159 void CalDateItem(); | 159 void CalDateItem(); |
160 void GetCapValue(); | 160 void GetCapValue(); |
161 int32_t CalWeekNumber(int32_t iYear, int32_t iMonth, int32_t iDay); | 161 int32_t CalWeekNumber(int32_t iYear, int32_t iMonth, int32_t iDay); |
162 FX_BOOL GetMinDate(int32_t& iYear, int32_t& iMonth, int32_t& iDay); | 162 bool GetMinDate(int32_t& iYear, int32_t& iMonth, int32_t& iDay); |
163 FX_BOOL SetMinDate(int32_t iYear, int32_t iMonth, int32_t iDay); | 163 bool SetMinDate(int32_t iYear, int32_t iMonth, int32_t iDay); |
164 FX_BOOL GetMaxDate(int32_t& iYear, int32_t& iMonth, int32_t& iDay); | 164 bool GetMaxDate(int32_t& iYear, int32_t& iMonth, int32_t& iDay); |
165 FX_BOOL SetMaxDate(int32_t iYear, int32_t iMonth, int32_t iDay); | 165 bool SetMaxDate(int32_t iYear, int32_t iMonth, int32_t iDay); |
166 FX_BOOL InitDate(); | 166 bool InitDate(); |
167 void ClearDateItem(); | 167 void ClearDateItem(); |
168 void ReSetDateItem(); | 168 void ReSetDateItem(); |
169 FX_BOOL NextMonth(); | 169 bool NextMonth(); |
170 FX_BOOL PrevMonth(); | 170 bool PrevMonth(); |
171 void ChangeToMonth(int32_t iYear, int32_t iMonth); | 171 void ChangeToMonth(int32_t iYear, int32_t iMonth); |
172 FX_BOOL RemoveSelDay(int32_t iDay, FX_BOOL bAll = FALSE); | 172 bool RemoveSelDay(int32_t iDay, bool bAll = false); |
173 FX_BOOL AddSelDay(int32_t iDay); | 173 bool AddSelDay(int32_t iDay); |
174 FX_BOOL JumpToToday(); | 174 bool JumpToToday(); |
175 void GetHeadText(int32_t iYear, int32_t iMonth, CFX_WideString& wsHead); | 175 void GetHeadText(int32_t iYear, int32_t iMonth, CFX_WideString& wsHead); |
176 void GetTodayText(int32_t iYear, | 176 void GetTodayText(int32_t iYear, |
177 int32_t iMonth, | 177 int32_t iMonth, |
178 int32_t iDay, | 178 int32_t iDay, |
179 CFX_WideString& wsToday); | 179 CFX_WideString& wsToday); |
180 int32_t GetDayAtPoint(FX_FLOAT x, FX_FLOAT y); | 180 int32_t GetDayAtPoint(FX_FLOAT x, FX_FLOAT y); |
181 FX_BOOL GetDayRect(int32_t iDay, CFX_RectF& rtDay); | 181 bool GetDayRect(int32_t iDay, CFX_RectF& rtDay); |
182 | 182 |
183 FX_BOOL m_bInit; | 183 bool m_bInit; |
184 CFX_RectF m_rtHead; | 184 CFX_RectF m_rtHead; |
185 CFX_RectF m_rtWeek; | 185 CFX_RectF m_rtWeek; |
186 CFX_RectF m_rtLBtn; | 186 CFX_RectF m_rtLBtn; |
187 CFX_RectF m_rtRBtn; | 187 CFX_RectF m_rtRBtn; |
188 CFX_RectF m_rtDates; | 188 CFX_RectF m_rtDates; |
189 CFX_RectF m_rtHSep; | 189 CFX_RectF m_rtHSep; |
190 CFX_RectF m_rtHeadText; | 190 CFX_RectF m_rtHeadText; |
191 CFX_RectF m_rtToday; | 191 CFX_RectF m_rtToday; |
192 CFX_RectF m_rtTodayFlag; | 192 CFX_RectF m_rtTodayFlag; |
193 CFX_RectF m_rtWeekNum; | 193 CFX_RectF m_rtWeekNum; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 FX_FLOAT m_fWeekHei; | 234 FX_FLOAT m_fWeekHei; |
235 FX_FLOAT m_fDateCellWid; | 235 FX_FLOAT m_fDateCellWid; |
236 FX_FLOAT m_fDateCellHei; | 236 FX_FLOAT m_fDateCellHei; |
237 FX_FLOAT m_fTodayWid; | 237 FX_FLOAT m_fTodayWid; |
238 FX_FLOAT m_fTodayHei; | 238 FX_FLOAT m_fTodayHei; |
239 FX_FLOAT m_fTodayFlagWid; | 239 FX_FLOAT m_fTodayFlagWid; |
240 FX_FLOAT m_fMCWid; | 240 FX_FLOAT m_fMCWid; |
241 FX_FLOAT m_fMCHei; | 241 FX_FLOAT m_fMCHei; |
242 | 242 |
243 private: | 243 private: |
244 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet); | 244 void OnFocusChanged(CFWL_Message* pMsg, bool bSet); |
245 void OnLButtonDown(CFWL_MsgMouse* pMsg); | 245 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
246 void OnLButtonUp(CFWL_MsgMouse* pMsg); | 246 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
247 void OnMouseMove(CFWL_MsgMouse* pMsg); | 247 void OnMouseMove(CFWL_MsgMouse* pMsg); |
248 void OnMouseLeave(CFWL_MsgMouse* pMsg); | 248 void OnMouseLeave(CFWL_MsgMouse* pMsg); |
249 }; | 249 }; |
250 | 250 |
251 struct FWL_DATEINFO { | 251 struct FWL_DATEINFO { |
252 FWL_DATEINFO(int32_t day, | 252 FWL_DATEINFO(int32_t day, |
253 int32_t dayofweek, | 253 int32_t dayofweek, |
254 uint32_t dwSt, | 254 uint32_t dwSt, |
255 CFX_RectF rc, | 255 CFX_RectF rc, |
256 CFX_WideString& wsday); | 256 CFX_WideString& wsday); |
257 ~FWL_DATEINFO(); | 257 ~FWL_DATEINFO(); |
258 | 258 |
259 int32_t iDay; | 259 int32_t iDay; |
260 int32_t iDayOfWeek; | 260 int32_t iDayOfWeek; |
261 uint32_t dwStates; | 261 uint32_t dwStates; |
262 CFX_RectF rect; | 262 CFX_RectF rect; |
263 CFX_WideString wsDay; | 263 CFX_WideString wsDay; |
264 }; | 264 }; |
265 | 265 |
266 #endif // XFA_FWL_CORE_IFWL_MONTHCALENDAR_H_ | 266 #endif // XFA_FWL_CORE_IFWL_MONTHCALENDAR_H_ |
OLD | NEW |