Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(859)

Side by Side Diff: xfa/fwl/basewidget/fwl_monthcalendarimp.h

Issue 2432423002: Merge the CFWL_*Imp classes into the IFWL_* classes. (Closed)
Patch Set: Review feedback Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fwl/basewidget/fwl_listboximp.cpp ('k') | xfa/fwl/basewidget/fwl_monthcalendarimp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #ifndef XFA_FWL_BASEWIDGET_FWL_MONTHCALENDARIMP_H_
8 #define XFA_FWL_BASEWIDGET_FWL_MONTHCALENDARIMP_H_
9
10 #include <memory>
11
12 #include "xfa/fgas/localization/fgas_datetime.h"
13 #include "xfa/fwl/core/fwl_widgetimp.h"
14 #include "xfa/fwl/core/ifwl_widget.h"
15
16 class CFWL_MonthCalendarImpDelegate;
17 class CFWL_MsgMouse;
18 class CFWL_WidgetImpProperties;
19 class IFWL_Widget;
20
21 struct FWL_DATEINFO;
22
23 extern uint8_t FX_DaysInMonth(int32_t iYear, uint8_t iMonth);
24
25 class CFWL_MonthCalendarImp : public CFWL_WidgetImp {
26 public:
27 CFWL_MonthCalendarImp(const CFWL_WidgetImpProperties& properties,
28 IFWL_Widget* pOuter);
29 ~CFWL_MonthCalendarImp() override;
30
31 // FWL_WidgetImp
32 FWL_Error GetClassName(CFX_WideString& wsClass) const override;
33 FWL_Type GetClassID() const override;
34 FWL_Error Initialize() override;
35 FWL_Error Finalize() override;
36 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override;
37 FWL_Error Update() override;
38 FWL_Error DrawWidget(CFX_Graphics* pGraphics,
39 const CFX_Matrix* pMatrix = nullptr) override;
40 int32_t CountSelect();
41 FX_BOOL GetSelect(int32_t& iYear,
42 int32_t& iMonth,
43 int32_t& iDay,
44 int32_t nIndex = 0);
45 FX_BOOL SetSelect(int32_t iYear, int32_t iMonth, int32_t iDay);
46
47 protected:
48 struct DATE {
49 DATE() : iYear(0), iMonth(0), iDay(0) {}
50 DATE(int32_t year, int32_t month, int32_t day)
51 : iYear(year), iMonth(month), iDay(day) {}
52 FX_BOOL operator<(const DATE& right) {
53 if (iYear < right.iYear) {
54 return TRUE;
55 } else if (iYear == right.iYear) {
56 if (iMonth < right.iMonth) {
57 return TRUE;
58 } else if (iMonth == right.iMonth) {
59 return iDay < right.iDay;
60 }
61 }
62 return FALSE;
63 }
64 FX_BOOL operator>(const DATE& right) {
65 if (iYear > right.iYear) {
66 return TRUE;
67 } else if (iYear == right.iYear) {
68 if (iMonth > right.iMonth) {
69 return TRUE;
70 } else if (iMonth == right.iMonth) {
71 return iDay > right.iDay;
72 }
73 }
74 return FALSE;
75 }
76 int32_t iYear;
77 int32_t iMonth;
78 int32_t iDay;
79 };
80
81 void DrawBkground(CFX_Graphics* pGraphics,
82 IFWL_ThemeProvider* pTheme,
83 const CFX_Matrix* pMatrix);
84 void DrawHeadBK(CFX_Graphics* pGraphics,
85 IFWL_ThemeProvider* pTheme,
86 const CFX_Matrix* pMatrix);
87 void DrawLButton(CFX_Graphics* pGraphics,
88 IFWL_ThemeProvider* pTheme,
89 const CFX_Matrix* pMatrix);
90 void DrawRButton(CFX_Graphics* pGraphics,
91 IFWL_ThemeProvider* pTheme,
92 const CFX_Matrix* pMatrix);
93 void DrawCaption(CFX_Graphics* pGraphics,
94 IFWL_ThemeProvider* pTheme,
95 const CFX_Matrix* pMatrix);
96 void DrawSeperator(CFX_Graphics* pGraphics,
97 IFWL_ThemeProvider* pTheme,
98 const CFX_Matrix* pMatrix);
99 void DrawDatesInBK(CFX_Graphics* pGraphics,
100 IFWL_ThemeProvider* pTheme,
101 const CFX_Matrix* pMatrix);
102 void DrawWeek(CFX_Graphics* pGraphics,
103 IFWL_ThemeProvider* pTheme,
104 const CFX_Matrix* pMatrix);
105 void DrawWeekNumber(CFX_Graphics* pGraphics,
106 IFWL_ThemeProvider* pTheme,
107 const CFX_Matrix* pMatrix);
108 void DrawWeekNumberSep(CFX_Graphics* pGraphics,
109 IFWL_ThemeProvider* pTheme,
110 const CFX_Matrix* pMatrix);
111 void DrawToday(CFX_Graphics* pGraphics,
112 IFWL_ThemeProvider* pTheme,
113 const CFX_Matrix* pMatrix);
114 void DrawDatesIn(CFX_Graphics* pGraphics,
115 IFWL_ThemeProvider* pTheme,
116 const CFX_Matrix* pMatrix);
117 void DrawDatesOut(CFX_Graphics* pGraphics,
118 IFWL_ThemeProvider* pTheme,
119 const CFX_Matrix* pMatrix);
120 void DrawDatesInCircle(CFX_Graphics* pGraphics,
121 IFWL_ThemeProvider* pTheme,
122 const CFX_Matrix* pMatrix);
123 void DrawTodayCircle(CFX_Graphics* pGraphics,
124 IFWL_ThemeProvider* pTheme,
125 const CFX_Matrix* pMatrix);
126 CFX_SizeF CalcSize(FX_BOOL bAutoSize = FALSE);
127 void LayOut();
128 void CalcHeadSize();
129 void CalcTodaySize();
130 void CalDateItem();
131 void GetCapValue();
132 int32_t CalWeekNumber(int32_t iYear, int32_t iMonth, int32_t iDay);
133 FX_BOOL GetMinDate(int32_t& iYear, int32_t& iMonth, int32_t& iDay);
134 FX_BOOL SetMinDate(int32_t iYear, int32_t iMonth, int32_t iDay);
135 FX_BOOL GetMaxDate(int32_t& iYear, int32_t& iMonth, int32_t& iDay);
136 FX_BOOL SetMaxDate(int32_t iYear, int32_t iMonth, int32_t iDay);
137 FX_BOOL InitDate();
138 void ClearDateItem();
139 void ReSetDateItem();
140 FX_BOOL NextMonth();
141 FX_BOOL PrevMonth();
142 void ChangeToMonth(int32_t iYear, int32_t iMonth);
143 FX_BOOL RemoveSelDay(int32_t iDay, FX_BOOL bAll = FALSE);
144 FX_BOOL AddSelDay(int32_t iDay);
145 FX_BOOL JumpToToday();
146 void GetHeadText(int32_t iYear, int32_t iMonth, CFX_WideString& wsHead);
147 void GetTodayText(int32_t iYear,
148 int32_t iMonth,
149 int32_t iDay,
150 CFX_WideString& wsToday);
151 int32_t GetDayAtPoint(FX_FLOAT x, FX_FLOAT y);
152 FX_BOOL GetDayRect(int32_t iDay, CFX_RectF& rtDay);
153
154 FX_BOOL m_bInit;
155 CFX_RectF m_rtHead;
156 CFX_RectF m_rtWeek;
157 CFX_RectF m_rtLBtn;
158 CFX_RectF m_rtRBtn;
159 CFX_RectF m_rtDates;
160 CFX_RectF m_rtHSep;
161 CFX_RectF m_rtHeadText;
162 CFX_RectF m_rtToday;
163 CFX_RectF m_rtTodayFlag;
164 CFX_RectF m_rtWeekNum;
165 CFX_RectF m_rtWeekNumSep;
166 CFX_RectF m_rtTemp;
167 CFX_WideString m_wsHead;
168 CFX_WideString m_wsToday;
169 std::unique_ptr<CFX_DateTime> m_pDateTime;
170 CFX_ArrayTemplate<FWL_DATEINFO*> m_arrDates;
171 int32_t m_iCurYear;
172 int32_t m_iCurMonth;
173 int32_t m_iYear;
174 int32_t m_iMonth;
175 int32_t m_iDay;
176 int32_t m_iHovered;
177 int32_t m_iLBtnPartStates;
178 int32_t m_iRBtnPartStates;
179 DATE m_dtMin;
180 DATE m_dtMax;
181 CFX_SizeF m_szHead;
182 CFX_SizeF m_szCell;
183 CFX_SizeF m_szToday;
184 CFX_ArrayTemplate<int32_t> m_arrSelDays;
185 int32_t m_iMaxSel;
186 CFX_RectF m_rtClient;
187 FX_FLOAT m_fHeadWid;
188 FX_FLOAT m_fHeadHei;
189 FX_FLOAT m_fHeadBtnWid;
190 FX_FLOAT m_fHeadBtnHei;
191 FX_FLOAT m_fHeadBtnHMargin;
192 FX_FLOAT m_fHeadBtnVMargin;
193 FX_FLOAT m_fHeadTextWid;
194 FX_FLOAT m_fHeadTextHei;
195 FX_FLOAT m_fHeadTextHMargin;
196 FX_FLOAT m_fHeadTextVMargin;
197 FX_FLOAT m_fHSepWid;
198 FX_FLOAT m_fHSepHei;
199 FX_FLOAT m_fWeekNumWid;
200 FX_FLOAT m_fSepDOffset;
201 FX_FLOAT m_fSepX;
202 FX_FLOAT m_fSepY;
203 FX_FLOAT m_fWeekNumHeigh;
204 FX_FLOAT m_fWeekWid;
205 FX_FLOAT m_fWeekHei;
206 FX_FLOAT m_fDateCellWid;
207 FX_FLOAT m_fDateCellHei;
208 FX_FLOAT m_fTodayWid;
209 FX_FLOAT m_fTodayHei;
210 FX_FLOAT m_fTodayFlagWid;
211 FX_FLOAT m_fMCWid;
212 FX_FLOAT m_fMCHei;
213 friend class CFWL_MonthCalendarImpDelegate;
214 };
215
216 struct FWL_DATEINFO {
217 FWL_DATEINFO(int32_t day,
218 int32_t dayofweek,
219 uint32_t dwSt,
220 CFX_RectF rc,
221 CFX_WideString& wsday);
222 ~FWL_DATEINFO();
223
224 int32_t iDay;
225 int32_t iDayOfWeek;
226 uint32_t dwStates;
227 CFX_RectF rect;
228 CFX_WideString wsDay;
229 };
230
231 class CFWL_MonthCalendarImpDelegate : public CFWL_WidgetImpDelegate {
232 public:
233 CFWL_MonthCalendarImpDelegate(CFWL_MonthCalendarImp* pOwner);
234 void OnProcessMessage(CFWL_Message* pMessage) override;
235 void OnDrawWidget(CFX_Graphics* pGraphics,
236 const CFX_Matrix* pMatrix = nullptr) override;
237
238 protected:
239 void OnActivate(CFWL_Message* pMsg);
240 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE);
241 void OnLButtonDown(CFWL_MsgMouse* pMsg);
242 void OnLButtonUp(CFWL_MsgMouse* pMsg);
243 void OnMouseMove(CFWL_MsgMouse* pMsg);
244 void OnMouseLeave(CFWL_MsgMouse* pMsg);
245 CFWL_MonthCalendarImp* m_pOwner;
246 };
247
248 #endif // XFA_FWL_BASEWIDGET_FWL_MONTHCALENDARIMP_H_
OLDNEW
« no previous file with comments | « xfa/fwl/basewidget/fwl_listboximp.cpp ('k') | xfa/fwl/basewidget/fwl_monthcalendarimp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698