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 #include "xfa/fwl/core/ifwl_monthcalendar.h" | 7 #include "xfa/fwl/core/cfwl_monthcalendar.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
11 #include <utility> | 11 #include <utility> |
12 | 12 |
13 #include "third_party/base/ptr_util.h" | 13 #include "third_party/base/ptr_util.h" |
14 #include "xfa/fde/tto/fde_textout.h" | 14 #include "xfa/fde/tto/fde_textout.h" |
| 15 #include "xfa/fwl/core/cfwl_formproxy.h" |
15 #include "xfa/fwl/core/cfwl_msgmouse.h" | 16 #include "xfa/fwl/core/cfwl_msgmouse.h" |
16 #include "xfa/fwl/core/cfwl_notedriver.h" | 17 #include "xfa/fwl/core/cfwl_notedriver.h" |
17 #include "xfa/fwl/core/cfwl_themebackground.h" | 18 #include "xfa/fwl/core/cfwl_themebackground.h" |
18 #include "xfa/fwl/core/cfwl_themetext.h" | 19 #include "xfa/fwl/core/cfwl_themetext.h" |
19 #include "xfa/fwl/core/ifwl_datetimepicker.h" | 20 #include "xfa/fwl/core/ifwl_datetimepicker.h" |
20 #include "xfa/fwl/core/ifwl_formproxy.h" | |
21 #include "xfa/fwl/core/ifwl_themeprovider.h" | 21 #include "xfa/fwl/core/ifwl_themeprovider.h" |
22 | 22 |
23 #define MONTHCAL_HSEP_HEIGHT 1 | 23 #define MONTHCAL_HSEP_HEIGHT 1 |
24 #define MONTHCAL_VSEP_WIDTH 1 | 24 #define MONTHCAL_VSEP_WIDTH 1 |
25 #define MONTHCAL_HMARGIN 3 | 25 #define MONTHCAL_HMARGIN 3 |
26 #define MONTHCAL_VMARGIN 2 | 26 #define MONTHCAL_VMARGIN 2 |
27 #define MONTHCAL_ROWS 9 | 27 #define MONTHCAL_ROWS 9 |
28 #define MONTHCAL_COLUMNS 7 | 28 #define MONTHCAL_COLUMNS 7 |
29 #define MONTHCAL_HEADER_BTN_VMARGIN 7 | 29 #define MONTHCAL_HEADER_BTN_VMARGIN 7 |
30 #define MONTHCAL_HEADER_BTN_HMARGIN 5 | 30 #define MONTHCAL_HEADER_BTN_HMARGIN 5 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 return static_cast<CFX_WideString*>( | 114 return static_cast<CFX_WideString*>( |
115 pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::November)); | 115 pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::November)); |
116 } | 116 } |
117 | 117 |
118 return static_cast<CFX_WideString*>( | 118 return static_cast<CFX_WideString*>( |
119 pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::December)); | 119 pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::December)); |
120 } | 120 } |
121 | 121 |
122 } // namespace | 122 } // namespace |
123 | 123 |
124 IFWL_MonthCalendar::IFWL_MonthCalendar( | 124 CFWL_MonthCalendar::CFWL_MonthCalendar( |
125 const CFWL_App* app, | 125 const CFWL_App* app, |
126 std::unique_ptr<CFWL_WidgetProperties> properties, | 126 std::unique_ptr<CFWL_WidgetProperties> properties, |
127 IFWL_Widget* pOuter) | 127 IFWL_Widget* pOuter) |
128 : IFWL_Widget(app, std::move(properties), pOuter), | 128 : IFWL_Widget(app, std::move(properties), pOuter), |
129 m_bInitialized(false), | 129 m_bInitialized(false), |
130 m_pDateTime(new CFX_DateTime), | 130 m_pDateTime(new CFX_DateTime), |
131 m_iCurYear(2011), | 131 m_iCurYear(2011), |
132 m_iCurMonth(1), | 132 m_iCurMonth(1), |
133 m_iYear(2011), | 133 m_iYear(2011), |
134 m_iMonth(1), | 134 m_iMonth(1), |
135 m_iDay(1), | 135 m_iDay(1), |
136 m_iHovered(-1), | 136 m_iHovered(-1), |
137 m_iLBtnPartStates(CFWL_PartState_Normal), | 137 m_iLBtnPartStates(CFWL_PartState_Normal), |
138 m_iRBtnPartStates(CFWL_PartState_Normal), | 138 m_iRBtnPartStates(CFWL_PartState_Normal), |
139 m_bFlag(false) { | 139 m_bFlag(false) { |
140 m_rtHead.Reset(); | 140 m_rtHead.Reset(); |
141 m_rtWeek.Reset(); | 141 m_rtWeek.Reset(); |
142 m_rtLBtn.Reset(); | 142 m_rtLBtn.Reset(); |
143 m_rtRBtn.Reset(); | 143 m_rtRBtn.Reset(); |
144 m_rtDates.Reset(); | 144 m_rtDates.Reset(); |
145 m_rtHSep.Reset(); | 145 m_rtHSep.Reset(); |
146 m_rtHeadText.Reset(); | 146 m_rtHeadText.Reset(); |
147 m_rtToday.Reset(); | 147 m_rtToday.Reset(); |
148 m_rtTodayFlag.Reset(); | 148 m_rtTodayFlag.Reset(); |
149 m_rtClient.Reset(); | 149 m_rtClient.Reset(); |
150 m_rtWeekNum.Reset(); | 150 m_rtWeekNum.Reset(); |
151 m_rtWeekNumSep.Reset(); | 151 m_rtWeekNumSep.Reset(); |
152 } | 152 } |
153 | 153 |
154 IFWL_MonthCalendar::~IFWL_MonthCalendar() { | 154 CFWL_MonthCalendar::~CFWL_MonthCalendar() { |
155 ClearDateItem(); | 155 ClearDateItem(); |
156 m_arrSelDays.RemoveAll(); | 156 m_arrSelDays.RemoveAll(); |
157 } | 157 } |
158 | 158 |
159 FWL_Type IFWL_MonthCalendar::GetClassID() const { | 159 FWL_Type CFWL_MonthCalendar::GetClassID() const { |
160 return FWL_Type::MonthCalendar; | 160 return FWL_Type::MonthCalendar; |
161 } | 161 } |
162 | 162 |
163 void IFWL_MonthCalendar::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { | 163 void CFWL_MonthCalendar::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { |
164 if (!bAutoSize) { | 164 if (!bAutoSize) { |
165 rect = m_pProperties->m_rtWidget; | 165 rect = m_pProperties->m_rtWidget; |
166 return; | 166 return; |
167 } | 167 } |
168 | 168 |
169 CFX_SizeF fs = CalcSize(true); | 169 CFX_SizeF fs = CalcSize(true); |
170 rect.Set(0, 0, fs.x, fs.y); | 170 rect.Set(0, 0, fs.x, fs.y); |
171 IFWL_Widget::GetWidgetRect(rect, true); | 171 IFWL_Widget::GetWidgetRect(rect, true); |
172 } | 172 } |
173 | 173 |
174 void IFWL_MonthCalendar::Update() { | 174 void CFWL_MonthCalendar::Update() { |
175 if (IsLocked()) | 175 if (IsLocked()) |
176 return; | 176 return; |
177 if (!m_pProperties->m_pThemeProvider) | 177 if (!m_pProperties->m_pThemeProvider) |
178 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 178 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
179 | 179 |
180 GetCapValue(); | 180 GetCapValue(); |
181 if (!m_bInitialized) { | 181 if (!m_bInitialized) { |
182 InitDate(); | 182 InitDate(); |
183 m_bInitialized = true; | 183 m_bInitialized = true; |
184 } | 184 } |
185 | 185 |
186 ClearDateItem(); | 186 ClearDateItem(); |
187 ResetDateItem(); | 187 ResetDateItem(); |
188 Layout(); | 188 Layout(); |
189 } | 189 } |
190 | 190 |
191 void IFWL_MonthCalendar::DrawWidget(CFX_Graphics* pGraphics, | 191 void CFWL_MonthCalendar::DrawWidget(CFX_Graphics* pGraphics, |
192 const CFX_Matrix* pMatrix) { | 192 const CFX_Matrix* pMatrix) { |
193 if (!pGraphics) | 193 if (!pGraphics) |
194 return; | 194 return; |
195 if (!m_pProperties->m_pThemeProvider) | 195 if (!m_pProperties->m_pThemeProvider) |
196 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 196 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
197 | 197 |
198 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; | 198 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; |
199 if (HasBorder()) | 199 if (HasBorder()) |
200 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); | 200 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); |
201 if (HasEdge()) | 201 if (HasEdge()) |
(...skipping 10 matching lines...) Expand all Loading... |
212 DrawWeek(pGraphics, pTheme, pMatrix); | 212 DrawWeek(pGraphics, pTheme, pMatrix); |
213 DrawDatesIn(pGraphics, pTheme, pMatrix); | 213 DrawDatesIn(pGraphics, pTheme, pMatrix); |
214 DrawDatesOut(pGraphics, pTheme, pMatrix); | 214 DrawDatesOut(pGraphics, pTheme, pMatrix); |
215 DrawToday(pGraphics, pTheme, pMatrix); | 215 DrawToday(pGraphics, pTheme, pMatrix); |
216 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_WeekNumbers) { | 216 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_WeekNumbers) { |
217 DrawWeekNumberSep(pGraphics, pTheme, pMatrix); | 217 DrawWeekNumberSep(pGraphics, pTheme, pMatrix); |
218 DrawWeekNumber(pGraphics, pTheme, pMatrix); | 218 DrawWeekNumber(pGraphics, pTheme, pMatrix); |
219 } | 219 } |
220 } | 220 } |
221 | 221 |
222 void IFWL_MonthCalendar::SetSelect(int32_t iYear, | 222 void CFWL_MonthCalendar::SetSelect(int32_t iYear, |
223 int32_t iMonth, | 223 int32_t iMonth, |
224 int32_t iDay) { | 224 int32_t iDay) { |
225 ChangeToMonth(iYear, iMonth); | 225 ChangeToMonth(iYear, iMonth); |
226 AddSelDay(iDay); | 226 AddSelDay(iDay); |
227 } | 227 } |
228 | 228 |
229 void IFWL_MonthCalendar::DrawBackground(CFX_Graphics* pGraphics, | 229 void CFWL_MonthCalendar::DrawBackground(CFX_Graphics* pGraphics, |
230 IFWL_ThemeProvider* pTheme, | 230 IFWL_ThemeProvider* pTheme, |
231 const CFX_Matrix* pMatrix) { | 231 const CFX_Matrix* pMatrix) { |
232 CFWL_ThemeBackground params; | 232 CFWL_ThemeBackground params; |
233 params.m_pWidget = this; | 233 params.m_pWidget = this; |
234 params.m_iPart = CFWL_Part::Background; | 234 params.m_iPart = CFWL_Part::Background; |
235 params.m_pGraphics = pGraphics; | 235 params.m_pGraphics = pGraphics; |
236 params.m_dwStates = CFWL_PartState_Normal; | 236 params.m_dwStates = CFWL_PartState_Normal; |
237 params.m_rtPart = m_rtClient; | 237 params.m_rtPart = m_rtClient; |
238 if (pMatrix) | 238 if (pMatrix) |
239 params.m_matrix.Concat(*pMatrix); | 239 params.m_matrix.Concat(*pMatrix); |
240 pTheme->DrawBackground(¶ms); | 240 pTheme->DrawBackground(¶ms); |
241 } | 241 } |
242 | 242 |
243 void IFWL_MonthCalendar::DrawHeadBK(CFX_Graphics* pGraphics, | 243 void CFWL_MonthCalendar::DrawHeadBK(CFX_Graphics* pGraphics, |
244 IFWL_ThemeProvider* pTheme, | 244 IFWL_ThemeProvider* pTheme, |
245 const CFX_Matrix* pMatrix) { | 245 const CFX_Matrix* pMatrix) { |
246 CFWL_ThemeBackground params; | 246 CFWL_ThemeBackground params; |
247 params.m_pWidget = this; | 247 params.m_pWidget = this; |
248 params.m_iPart = CFWL_Part::Header; | 248 params.m_iPart = CFWL_Part::Header; |
249 params.m_pGraphics = pGraphics; | 249 params.m_pGraphics = pGraphics; |
250 params.m_dwStates = CFWL_PartState_Normal; | 250 params.m_dwStates = CFWL_PartState_Normal; |
251 params.m_rtPart = m_rtHead; | 251 params.m_rtPart = m_rtHead; |
252 if (pMatrix) | 252 if (pMatrix) |
253 params.m_matrix.Concat(*pMatrix); | 253 params.m_matrix.Concat(*pMatrix); |
254 pTheme->DrawBackground(¶ms); | 254 pTheme->DrawBackground(¶ms); |
255 } | 255 } |
256 | 256 |
257 void IFWL_MonthCalendar::DrawLButton(CFX_Graphics* pGraphics, | 257 void CFWL_MonthCalendar::DrawLButton(CFX_Graphics* pGraphics, |
258 IFWL_ThemeProvider* pTheme, | 258 IFWL_ThemeProvider* pTheme, |
259 const CFX_Matrix* pMatrix) { | 259 const CFX_Matrix* pMatrix) { |
260 CFWL_ThemeBackground params; | 260 CFWL_ThemeBackground params; |
261 params.m_pWidget = this; | 261 params.m_pWidget = this; |
262 params.m_iPart = CFWL_Part::LBtn; | 262 params.m_iPart = CFWL_Part::LBtn; |
263 params.m_pGraphics = pGraphics; | 263 params.m_pGraphics = pGraphics; |
264 params.m_dwStates = m_iLBtnPartStates; | 264 params.m_dwStates = m_iLBtnPartStates; |
265 params.m_rtPart = m_rtLBtn; | 265 params.m_rtPart = m_rtLBtn; |
266 if (pMatrix) | 266 if (pMatrix) |
267 params.m_matrix.Concat(*pMatrix); | 267 params.m_matrix.Concat(*pMatrix); |
268 pTheme->DrawBackground(¶ms); | 268 pTheme->DrawBackground(¶ms); |
269 } | 269 } |
270 | 270 |
271 void IFWL_MonthCalendar::DrawRButton(CFX_Graphics* pGraphics, | 271 void CFWL_MonthCalendar::DrawRButton(CFX_Graphics* pGraphics, |
272 IFWL_ThemeProvider* pTheme, | 272 IFWL_ThemeProvider* pTheme, |
273 const CFX_Matrix* pMatrix) { | 273 const CFX_Matrix* pMatrix) { |
274 CFWL_ThemeBackground params; | 274 CFWL_ThemeBackground params; |
275 params.m_pWidget = this; | 275 params.m_pWidget = this; |
276 params.m_iPart = CFWL_Part::RBtn; | 276 params.m_iPart = CFWL_Part::RBtn; |
277 params.m_pGraphics = pGraphics; | 277 params.m_pGraphics = pGraphics; |
278 params.m_dwStates = m_iRBtnPartStates; | 278 params.m_dwStates = m_iRBtnPartStates; |
279 params.m_rtPart = m_rtRBtn; | 279 params.m_rtPart = m_rtRBtn; |
280 if (pMatrix) | 280 if (pMatrix) |
281 params.m_matrix.Concat(*pMatrix); | 281 params.m_matrix.Concat(*pMatrix); |
282 pTheme->DrawBackground(¶ms); | 282 pTheme->DrawBackground(¶ms); |
283 } | 283 } |
284 | 284 |
285 void IFWL_MonthCalendar::DrawCaption(CFX_Graphics* pGraphics, | 285 void CFWL_MonthCalendar::DrawCaption(CFX_Graphics* pGraphics, |
286 IFWL_ThemeProvider* pTheme, | 286 IFWL_ThemeProvider* pTheme, |
287 const CFX_Matrix* pMatrix) { | 287 const CFX_Matrix* pMatrix) { |
288 CFWL_ThemeText textParam; | 288 CFWL_ThemeText textParam; |
289 textParam.m_pWidget = this; | 289 textParam.m_pWidget = this; |
290 textParam.m_iPart = CFWL_Part::Caption; | 290 textParam.m_iPart = CFWL_Part::Caption; |
291 textParam.m_dwStates = CFWL_PartState_Normal; | 291 textParam.m_dwStates = CFWL_PartState_Normal; |
292 textParam.m_pGraphics = pGraphics; | 292 textParam.m_pGraphics = pGraphics; |
293 int32_t iYear; | 293 int32_t iYear; |
294 int32_t iMonth; | 294 int32_t iMonth; |
295 iYear = m_iCurYear; | 295 iYear = m_iCurYear; |
296 iMonth = m_iCurMonth; | 296 iMonth = m_iCurMonth; |
297 CFX_WideString wsCation; | 297 CFX_WideString wsCation; |
298 GetHeadText(iYear, iMonth, wsCation); | 298 GetHeadText(iYear, iMonth, wsCation); |
299 textParam.m_wsText = wsCation; | 299 textParam.m_wsText = wsCation; |
300 m_szHead = CalcTextSize(textParam.m_wsText, m_pProperties->m_pThemeProvider); | 300 m_szHead = CalcTextSize(textParam.m_wsText, m_pProperties->m_pThemeProvider); |
301 CalcHeadSize(); | 301 CalcHeadSize(); |
302 textParam.m_rtPart = m_rtHeadText; | 302 textParam.m_rtPart = m_rtHeadText; |
303 textParam.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; | 303 textParam.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; |
304 textParam.m_iTTOAlign = FDE_TTOALIGNMENT_Center; | 304 textParam.m_iTTOAlign = FDE_TTOALIGNMENT_Center; |
305 if (pMatrix) | 305 if (pMatrix) |
306 textParam.m_matrix.Concat(*pMatrix); | 306 textParam.m_matrix.Concat(*pMatrix); |
307 pTheme->DrawText(&textParam); | 307 pTheme->DrawText(&textParam); |
308 } | 308 } |
309 | 309 |
310 void IFWL_MonthCalendar::DrawSeperator(CFX_Graphics* pGraphics, | 310 void CFWL_MonthCalendar::DrawSeperator(CFX_Graphics* pGraphics, |
311 IFWL_ThemeProvider* pTheme, | 311 IFWL_ThemeProvider* pTheme, |
312 const CFX_Matrix* pMatrix) { | 312 const CFX_Matrix* pMatrix) { |
313 CFWL_ThemeBackground params; | 313 CFWL_ThemeBackground params; |
314 params.m_pWidget = this; | 314 params.m_pWidget = this; |
315 params.m_iPart = CFWL_Part::HSeparator; | 315 params.m_iPart = CFWL_Part::HSeparator; |
316 params.m_pGraphics = pGraphics; | 316 params.m_pGraphics = pGraphics; |
317 params.m_dwStates = CFWL_PartState_Normal; | 317 params.m_dwStates = CFWL_PartState_Normal; |
318 params.m_rtPart = m_rtHSep; | 318 params.m_rtPart = m_rtHSep; |
319 if (pMatrix) | 319 if (pMatrix) |
320 params.m_matrix.Concat(*pMatrix); | 320 params.m_matrix.Concat(*pMatrix); |
321 pTheme->DrawBackground(¶ms); | 321 pTheme->DrawBackground(¶ms); |
322 } | 322 } |
323 | 323 |
324 void IFWL_MonthCalendar::DrawDatesInBK(CFX_Graphics* pGraphics, | 324 void CFWL_MonthCalendar::DrawDatesInBK(CFX_Graphics* pGraphics, |
325 IFWL_ThemeProvider* pTheme, | 325 IFWL_ThemeProvider* pTheme, |
326 const CFX_Matrix* pMatrix) { | 326 const CFX_Matrix* pMatrix) { |
327 CFWL_ThemeBackground params; | 327 CFWL_ThemeBackground params; |
328 params.m_pWidget = this; | 328 params.m_pWidget = this; |
329 params.m_iPart = CFWL_Part::DateInBK; | 329 params.m_iPart = CFWL_Part::DateInBK; |
330 params.m_pGraphics = pGraphics; | 330 params.m_pGraphics = pGraphics; |
331 if (pMatrix) | 331 if (pMatrix) |
332 params.m_matrix.Concat(*pMatrix); | 332 params.m_matrix.Concat(*pMatrix); |
333 | 333 |
334 int32_t iCount = m_arrDates.GetSize(); | 334 int32_t iCount = m_arrDates.GetSize(); |
(...skipping 13 matching lines...) Expand all Loading... |
348 } else if (pDataInfo->dwStates & FWL_ITEMSTATE_MCD_Flag) { | 348 } else if (pDataInfo->dwStates & FWL_ITEMSTATE_MCD_Flag) { |
349 params.m_dwStates = CFWL_PartState_Flagged; | 349 params.m_dwStates = CFWL_PartState_Flagged; |
350 pTheme->DrawBackground(¶ms); | 350 pTheme->DrawBackground(¶ms); |
351 } | 351 } |
352 params.m_rtPart = pDataInfo->rect; | 352 params.m_rtPart = pDataInfo->rect; |
353 pTheme->DrawBackground(¶ms); | 353 pTheme->DrawBackground(¶ms); |
354 params.m_dwStates = 0; | 354 params.m_dwStates = 0; |
355 } | 355 } |
356 } | 356 } |
357 | 357 |
358 void IFWL_MonthCalendar::DrawWeek(CFX_Graphics* pGraphics, | 358 void CFWL_MonthCalendar::DrawWeek(CFX_Graphics* pGraphics, |
359 IFWL_ThemeProvider* pTheme, | 359 IFWL_ThemeProvider* pTheme, |
360 const CFX_Matrix* pMatrix) { | 360 const CFX_Matrix* pMatrix) { |
361 CFWL_ThemeText params; | 361 CFWL_ThemeText params; |
362 params.m_pWidget = this; | 362 params.m_pWidget = this; |
363 params.m_iPart = CFWL_Part::Week; | 363 params.m_iPart = CFWL_Part::Week; |
364 params.m_pGraphics = pGraphics; | 364 params.m_pGraphics = pGraphics; |
365 params.m_dwStates = CFWL_PartState_Normal; | 365 params.m_dwStates = CFWL_PartState_Normal; |
366 params.m_iTTOAlign = FDE_TTOALIGNMENT_Center; | 366 params.m_iTTOAlign = FDE_TTOALIGNMENT_Center; |
367 CFX_RectF rtDayOfWeek; | 367 CFX_RectF rtDayOfWeek; |
368 if (pMatrix) | 368 if (pMatrix) |
369 params.m_matrix.Concat(*pMatrix); | 369 params.m_matrix.Concat(*pMatrix); |
370 | 370 |
371 for (int32_t i = 0; i < 7; i++) { | 371 for (int32_t i = 0; i < 7; i++) { |
372 rtDayOfWeek.Set(m_rtWeek.left + i * (m_szCell.x + MONTHCAL_HMARGIN * 2), | 372 rtDayOfWeek.Set(m_rtWeek.left + i * (m_szCell.x + MONTHCAL_HMARGIN * 2), |
373 m_rtWeek.top, m_szCell.x, m_szCell.y); | 373 m_rtWeek.top, m_szCell.x, m_szCell.y); |
374 params.m_rtPart = rtDayOfWeek; | 374 params.m_rtPart = rtDayOfWeek; |
375 params.m_wsText = *GetCapacityForDay(pTheme, params, i); | 375 params.m_wsText = *GetCapacityForDay(pTheme, params, i); |
376 params.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; | 376 params.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; |
377 pTheme->DrawText(¶ms); | 377 pTheme->DrawText(¶ms); |
378 } | 378 } |
379 } | 379 } |
380 | 380 |
381 void IFWL_MonthCalendar::DrawWeekNumber(CFX_Graphics* pGraphics, | 381 void CFWL_MonthCalendar::DrawWeekNumber(CFX_Graphics* pGraphics, |
382 IFWL_ThemeProvider* pTheme, | 382 IFWL_ThemeProvider* pTheme, |
383 const CFX_Matrix* pMatrix) { | 383 const CFX_Matrix* pMatrix) { |
384 CFWL_ThemeText params; | 384 CFWL_ThemeText params; |
385 params.m_pWidget = this; | 385 params.m_pWidget = this; |
386 params.m_iPart = CFWL_Part::WeekNum; | 386 params.m_iPart = CFWL_Part::WeekNum; |
387 params.m_pGraphics = pGraphics; | 387 params.m_pGraphics = pGraphics; |
388 params.m_dwStates = CFWL_PartState_Normal; | 388 params.m_dwStates = CFWL_PartState_Normal; |
389 params.m_iTTOAlign = FDE_TTOALIGNMENT_CenterLeft; | 389 params.m_iTTOAlign = FDE_TTOALIGNMENT_CenterLeft; |
390 CFX_WideString wsWeekNum; | 390 CFX_WideString wsWeekNum; |
391 params.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; | 391 params.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; |
(...skipping 10 matching lines...) Expand all Loading... |
402 iTemp++; | 402 iTemp++; |
403 m_rtWeekNum.Set(fHStartPos, fVStartPos + m_fDateCellHei * iTemp, | 403 m_rtWeekNum.Set(fHStartPos, fVStartPos + m_fDateCellHei * iTemp, |
404 m_fWeekNumWid, m_fDateCellHei); | 404 m_fWeekNumWid, m_fDateCellHei); |
405 wsWeekNum.Format(L"0"); | 405 wsWeekNum.Format(L"0"); |
406 params.m_wsText = wsWeekNum; | 406 params.m_wsText = wsWeekNum; |
407 params.m_rtPart = m_rtWeekNum; | 407 params.m_rtPart = m_rtWeekNum; |
408 pTheme->DrawText(¶ms); | 408 pTheme->DrawText(¶ms); |
409 } | 409 } |
410 } | 410 } |
411 | 411 |
412 void IFWL_MonthCalendar::DrawWeekNumberSep(CFX_Graphics* pGraphics, | 412 void CFWL_MonthCalendar::DrawWeekNumberSep(CFX_Graphics* pGraphics, |
413 IFWL_ThemeProvider* pTheme, | 413 IFWL_ThemeProvider* pTheme, |
414 const CFX_Matrix* pMatrix) { | 414 const CFX_Matrix* pMatrix) { |
415 CFWL_ThemeBackground params; | 415 CFWL_ThemeBackground params; |
416 params.m_pWidget = this; | 416 params.m_pWidget = this; |
417 params.m_iPart = CFWL_Part::WeekNumSep; | 417 params.m_iPart = CFWL_Part::WeekNumSep; |
418 params.m_pGraphics = pGraphics; | 418 params.m_pGraphics = pGraphics; |
419 params.m_dwStates = CFWL_PartState_Normal; | 419 params.m_dwStates = CFWL_PartState_Normal; |
420 params.m_rtPart = m_rtWeekNumSep; | 420 params.m_rtPart = m_rtWeekNumSep; |
421 if (pMatrix) | 421 if (pMatrix) |
422 params.m_matrix.Concat(*pMatrix); | 422 params.m_matrix.Concat(*pMatrix); |
423 pTheme->DrawBackground(¶ms); | 423 pTheme->DrawBackground(¶ms); |
424 } | 424 } |
425 | 425 |
426 void IFWL_MonthCalendar::DrawToday(CFX_Graphics* pGraphics, | 426 void CFWL_MonthCalendar::DrawToday(CFX_Graphics* pGraphics, |
427 IFWL_ThemeProvider* pTheme, | 427 IFWL_ThemeProvider* pTheme, |
428 const CFX_Matrix* pMatrix) { | 428 const CFX_Matrix* pMatrix) { |
429 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoToday) | 429 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoToday) |
430 return; | 430 return; |
431 | 431 |
432 CFWL_ThemeText params; | 432 CFWL_ThemeText params; |
433 params.m_pWidget = this; | 433 params.m_pWidget = this; |
434 params.m_iPart = CFWL_Part::Today; | 434 params.m_iPart = CFWL_Part::Today; |
435 params.m_pGraphics = pGraphics; | 435 params.m_pGraphics = pGraphics; |
436 params.m_dwStates = CFWL_PartState_Normal; | 436 params.m_dwStates = CFWL_PartState_Normal; |
437 params.m_iTTOAlign = FDE_TTOALIGNMENT_CenterLeft; | 437 params.m_iTTOAlign = FDE_TTOALIGNMENT_CenterLeft; |
438 | 438 |
439 CFX_WideString* wsDay = static_cast<CFX_WideString*>( | 439 CFX_WideString* wsDay = static_cast<CFX_WideString*>( |
440 pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::Today)); | 440 pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::Today)); |
441 CFX_WideString wsText; | 441 CFX_WideString wsText; |
442 GetTodayText(m_iYear, m_iMonth, m_iDay, wsText); | 442 GetTodayText(m_iYear, m_iMonth, m_iDay, wsText); |
443 params.m_wsText = *wsDay + wsText; | 443 params.m_wsText = *wsDay + wsText; |
444 | 444 |
445 m_szToday = CalcTextSize(params.m_wsText, m_pProperties->m_pThemeProvider); | 445 m_szToday = CalcTextSize(params.m_wsText, m_pProperties->m_pThemeProvider); |
446 CalcTodaySize(); | 446 CalcTodaySize(); |
447 params.m_rtPart = m_rtToday; | 447 params.m_rtPart = m_rtToday; |
448 params.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; | 448 params.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; |
449 if (pMatrix) | 449 if (pMatrix) |
450 params.m_matrix.Concat(*pMatrix); | 450 params.m_matrix.Concat(*pMatrix); |
451 pTheme->DrawText(¶ms); | 451 pTheme->DrawText(¶ms); |
452 } | 452 } |
453 | 453 |
454 void IFWL_MonthCalendar::DrawDatesIn(CFX_Graphics* pGraphics, | 454 void CFWL_MonthCalendar::DrawDatesIn(CFX_Graphics* pGraphics, |
455 IFWL_ThemeProvider* pTheme, | 455 IFWL_ThemeProvider* pTheme, |
456 const CFX_Matrix* pMatrix) { | 456 const CFX_Matrix* pMatrix) { |
457 CFWL_ThemeText params; | 457 CFWL_ThemeText params; |
458 params.m_pWidget = this; | 458 params.m_pWidget = this; |
459 params.m_iPart = CFWL_Part::DatesIn; | 459 params.m_iPart = CFWL_Part::DatesIn; |
460 params.m_pGraphics = pGraphics; | 460 params.m_pGraphics = pGraphics; |
461 params.m_dwStates = CFWL_PartState_Normal; | 461 params.m_dwStates = CFWL_PartState_Normal; |
462 params.m_iTTOAlign = FDE_TTOALIGNMENT_Center; | 462 params.m_iTTOAlign = FDE_TTOALIGNMENT_Center; |
463 if (pMatrix) | 463 if (pMatrix) |
464 params.m_matrix.Concat(*pMatrix); | 464 params.m_matrix.Concat(*pMatrix); |
465 | 465 |
466 int32_t iCount = m_arrDates.GetSize(); | 466 int32_t iCount = m_arrDates.GetSize(); |
467 for (int32_t j = 0; j < iCount; j++) { | 467 for (int32_t j = 0; j < iCount; j++) { |
468 DATEINFO* pDataInfo = m_arrDates.GetAt(j); | 468 DATEINFO* pDataInfo = m_arrDates.GetAt(j); |
469 params.m_wsText = pDataInfo->wsDay; | 469 params.m_wsText = pDataInfo->wsDay; |
470 params.m_rtPart = pDataInfo->rect; | 470 params.m_rtPart = pDataInfo->rect; |
471 params.m_dwStates = pDataInfo->dwStates; | 471 params.m_dwStates = pDataInfo->dwStates; |
472 if (j + 1 == m_iHovered) | 472 if (j + 1 == m_iHovered) |
473 params.m_dwStates |= CFWL_PartState_Hovered; | 473 params.m_dwStates |= CFWL_PartState_Hovered; |
474 params.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; | 474 params.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; |
475 pTheme->DrawText(¶ms); | 475 pTheme->DrawText(¶ms); |
476 } | 476 } |
477 } | 477 } |
478 | 478 |
479 void IFWL_MonthCalendar::DrawDatesOut(CFX_Graphics* pGraphics, | 479 void CFWL_MonthCalendar::DrawDatesOut(CFX_Graphics* pGraphics, |
480 IFWL_ThemeProvider* pTheme, | 480 IFWL_ThemeProvider* pTheme, |
481 const CFX_Matrix* pMatrix) { | 481 const CFX_Matrix* pMatrix) { |
482 CFWL_ThemeText params; | 482 CFWL_ThemeText params; |
483 params.m_pWidget = this; | 483 params.m_pWidget = this; |
484 params.m_iPart = CFWL_Part::DatesOut; | 484 params.m_iPart = CFWL_Part::DatesOut; |
485 params.m_pGraphics = pGraphics; | 485 params.m_pGraphics = pGraphics; |
486 params.m_dwStates = CFWL_PartState_Normal; | 486 params.m_dwStates = CFWL_PartState_Normal; |
487 params.m_iTTOAlign = FDE_TTOALIGNMENT_Center; | 487 params.m_iTTOAlign = FDE_TTOALIGNMENT_Center; |
488 if (pMatrix) | 488 if (pMatrix) |
489 params.m_matrix.Concat(*pMatrix); | 489 params.m_matrix.Concat(*pMatrix); |
490 pTheme->DrawText(¶ms); | 490 pTheme->DrawText(¶ms); |
491 } | 491 } |
492 | 492 |
493 void IFWL_MonthCalendar::DrawDatesInCircle(CFX_Graphics* pGraphics, | 493 void CFWL_MonthCalendar::DrawDatesInCircle(CFX_Graphics* pGraphics, |
494 IFWL_ThemeProvider* pTheme, | 494 IFWL_ThemeProvider* pTheme, |
495 const CFX_Matrix* pMatrix) { | 495 const CFX_Matrix* pMatrix) { |
496 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoTodayCircle) | 496 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoTodayCircle) |
497 return; | 497 return; |
498 if (m_iMonth != m_iCurMonth || m_iYear != m_iCurYear) | 498 if (m_iMonth != m_iCurMonth || m_iYear != m_iCurYear) |
499 return; | 499 return; |
500 if (m_iDay < 1 || m_iDay > m_arrDates.GetSize()) | 500 if (m_iDay < 1 || m_iDay > m_arrDates.GetSize()) |
501 return; | 501 return; |
502 | 502 |
503 DATEINFO* pDate = m_arrDates[m_iDay - 1]; | 503 DATEINFO* pDate = m_arrDates[m_iDay - 1]; |
504 if (!pDate) | 504 if (!pDate) |
505 return; | 505 return; |
506 | 506 |
507 CFWL_ThemeBackground params; | 507 CFWL_ThemeBackground params; |
508 params.m_pWidget = this; | 508 params.m_pWidget = this; |
509 params.m_iPart = CFWL_Part::DateInCircle; | 509 params.m_iPart = CFWL_Part::DateInCircle; |
510 params.m_pGraphics = pGraphics; | 510 params.m_pGraphics = pGraphics; |
511 params.m_rtPart = pDate->rect; | 511 params.m_rtPart = pDate->rect; |
512 params.m_dwStates = CFWL_PartState_Normal; | 512 params.m_dwStates = CFWL_PartState_Normal; |
513 if (pMatrix) | 513 if (pMatrix) |
514 params.m_matrix.Concat(*pMatrix); | 514 params.m_matrix.Concat(*pMatrix); |
515 pTheme->DrawBackground(¶ms); | 515 pTheme->DrawBackground(¶ms); |
516 } | 516 } |
517 | 517 |
518 CFX_SizeF IFWL_MonthCalendar::CalcSize(bool bAutoSize) { | 518 CFX_SizeF CFWL_MonthCalendar::CalcSize(bool bAutoSize) { |
519 if (!m_pProperties->m_pThemeProvider) | 519 if (!m_pProperties->m_pThemeProvider) |
520 return CFX_SizeF(); | 520 return CFX_SizeF(); |
521 if (!bAutoSize) { | 521 if (!bAutoSize) { |
522 GetClientRect(m_rtClient); | 522 GetClientRect(m_rtClient); |
523 return CFX_SizeF(m_rtClient.width, m_rtClient.height); | 523 return CFX_SizeF(m_rtClient.width, m_rtClient.height); |
524 } | 524 } |
525 | 525 |
526 CFX_SizeF fs; | 526 CFX_SizeF fs; |
527 CFWL_ThemePart params; | 527 CFWL_ThemePart params; |
528 params.m_pWidget = this; | 528 params.m_pWidget = this; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 CFX_WideString* wsText = static_cast<CFX_WideString*>( | 576 CFX_WideString* wsText = static_cast<CFX_WideString*>( |
577 pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::Today)); | 577 pTheme->GetCapacity(¶ms, CFWL_WidgetCapacity::Today)); |
578 m_wsToday = *wsText + wsToday; | 578 m_wsToday = *wsText + wsToday; |
579 m_szToday = CalcTextSize(wsToday, m_pProperties->m_pThemeProvider); | 579 m_szToday = CalcTextSize(wsToday, m_pProperties->m_pThemeProvider); |
580 m_szToday.y = (m_szToday.y >= m_szCell.y) ? m_szToday.y : m_szCell.y; | 580 m_szToday.y = (m_szToday.y >= m_szCell.y) ? m_szToday.y : m_szCell.y; |
581 fs.y = m_szCell.x + m_szCell.y * (MONTHCAL_ROWS - 2) + m_szToday.y + | 581 fs.y = m_szCell.x + m_szCell.y * (MONTHCAL_ROWS - 2) + m_szToday.y + |
582 MONTHCAL_VMARGIN * MONTHCAL_ROWS * 2 + MONTHCAL_HEADER_BTN_VMARGIN * 4; | 582 MONTHCAL_VMARGIN * MONTHCAL_ROWS * 2 + MONTHCAL_HEADER_BTN_VMARGIN * 4; |
583 return fs; | 583 return fs; |
584 } | 584 } |
585 | 585 |
586 void IFWL_MonthCalendar::CalcHeadSize() { | 586 void CFWL_MonthCalendar::CalcHeadSize() { |
587 FX_FLOAT fHeadHMargin = (m_rtClient.width - m_szHead.x) / 2; | 587 FX_FLOAT fHeadHMargin = (m_rtClient.width - m_szHead.x) / 2; |
588 FX_FLOAT fHeadVMargin = (m_szCell.x - m_szHead.y) / 2; | 588 FX_FLOAT fHeadVMargin = (m_szCell.x - m_szHead.y) / 2; |
589 m_rtHeadText.Set(m_rtClient.left + fHeadHMargin, | 589 m_rtHeadText.Set(m_rtClient.left + fHeadHMargin, |
590 m_rtClient.top + MONTHCAL_HEADER_BTN_VMARGIN + | 590 m_rtClient.top + MONTHCAL_HEADER_BTN_VMARGIN + |
591 MONTHCAL_VMARGIN + fHeadVMargin, | 591 MONTHCAL_VMARGIN + fHeadVMargin, |
592 m_szHead.x, m_szHead.y); | 592 m_szHead.x, m_szHead.y); |
593 } | 593 } |
594 | 594 |
595 void IFWL_MonthCalendar::CalcTodaySize() { | 595 void CFWL_MonthCalendar::CalcTodaySize() { |
596 m_rtTodayFlag.Set( | 596 m_rtTodayFlag.Set( |
597 m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN + MONTHCAL_HMARGIN, | 597 m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN + MONTHCAL_HMARGIN, |
598 m_rtDates.bottom() + MONTHCAL_HEADER_BTN_VMARGIN + MONTHCAL_VMARGIN, | 598 m_rtDates.bottom() + MONTHCAL_HEADER_BTN_VMARGIN + MONTHCAL_VMARGIN, |
599 m_szCell.x, m_szToday.y); | 599 m_szCell.x, m_szToday.y); |
600 m_rtToday.Set( | 600 m_rtToday.Set( |
601 m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN + m_szCell.x + | 601 m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN + m_szCell.x + |
602 MONTHCAL_HMARGIN * 2, | 602 MONTHCAL_HMARGIN * 2, |
603 m_rtDates.bottom() + MONTHCAL_HEADER_BTN_VMARGIN + MONTHCAL_VMARGIN, | 603 m_rtDates.bottom() + MONTHCAL_HEADER_BTN_VMARGIN + MONTHCAL_VMARGIN, |
604 m_szToday.x, m_szToday.y); | 604 m_szToday.x, m_szToday.y); |
605 } | 605 } |
606 | 606 |
607 void IFWL_MonthCalendar::Layout() { | 607 void CFWL_MonthCalendar::Layout() { |
608 GetClientRect(m_rtClient); | 608 GetClientRect(m_rtClient); |
609 | 609 |
610 m_rtHead.Set( | 610 m_rtHead.Set( |
611 m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN, m_rtClient.top, | 611 m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN, m_rtClient.top, |
612 m_rtClient.width - MONTHCAL_HEADER_BTN_HMARGIN * 2, | 612 m_rtClient.width - MONTHCAL_HEADER_BTN_HMARGIN * 2, |
613 m_szCell.x + (MONTHCAL_HEADER_BTN_VMARGIN + MONTHCAL_VMARGIN) * 2); | 613 m_szCell.x + (MONTHCAL_HEADER_BTN_VMARGIN + MONTHCAL_VMARGIN) * 2); |
614 m_rtWeek.Set(m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN, m_rtHead.bottom(), | 614 m_rtWeek.Set(m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN, m_rtHead.bottom(), |
615 m_rtClient.width - MONTHCAL_HEADER_BTN_HMARGIN * 2, | 615 m_rtClient.width - MONTHCAL_HEADER_BTN_HMARGIN * 2, |
616 m_szCell.y + MONTHCAL_VMARGIN * 2); | 616 m_szCell.y + MONTHCAL_VMARGIN * 2); |
617 m_rtLBtn.Set(m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN, | 617 m_rtLBtn.Set(m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN, |
(...skipping 10 matching lines...) Expand all Loading... |
628 MONTHCAL_HSEP_HEIGHT); | 628 MONTHCAL_HSEP_HEIGHT); |
629 m_rtDates.Set(m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN, | 629 m_rtDates.Set(m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN, |
630 m_rtWeek.bottom(), | 630 m_rtWeek.bottom(), |
631 m_rtClient.width - MONTHCAL_HEADER_BTN_HMARGIN * 2, | 631 m_rtClient.width - MONTHCAL_HEADER_BTN_HMARGIN * 2, |
632 m_szCell.y * (MONTHCAL_ROWS - 3) + | 632 m_szCell.y * (MONTHCAL_ROWS - 3) + |
633 MONTHCAL_VMARGIN * (MONTHCAL_ROWS - 3) * 2); | 633 MONTHCAL_VMARGIN * (MONTHCAL_ROWS - 3) * 2); |
634 | 634 |
635 CalDateItem(); | 635 CalDateItem(); |
636 } | 636 } |
637 | 637 |
638 void IFWL_MonthCalendar::CalDateItem() { | 638 void CFWL_MonthCalendar::CalDateItem() { |
639 bool bNewWeek = false; | 639 bool bNewWeek = false; |
640 int32_t iWeekOfMonth = 0; | 640 int32_t iWeekOfMonth = 0; |
641 FX_FLOAT fLeft = m_rtDates.left; | 641 FX_FLOAT fLeft = m_rtDates.left; |
642 FX_FLOAT fTop = m_rtDates.top; | 642 FX_FLOAT fTop = m_rtDates.top; |
643 int32_t iCount = m_arrDates.GetSize(); | 643 int32_t iCount = m_arrDates.GetSize(); |
644 for (int32_t i = 0; i < iCount; i++) { | 644 for (int32_t i = 0; i < iCount; i++) { |
645 DATEINFO* pDateInfo = m_arrDates.GetAt(i); | 645 DATEINFO* pDateInfo = m_arrDates.GetAt(i); |
646 if (bNewWeek) { | 646 if (bNewWeek) { |
647 iWeekOfMonth++; | 647 iWeekOfMonth++; |
648 bNewWeek = false; | 648 bNewWeek = false; |
649 } | 649 } |
650 pDateInfo->rect.Set( | 650 pDateInfo->rect.Set( |
651 fLeft + pDateInfo->iDayOfWeek * (m_szCell.x + (MONTHCAL_HMARGIN * 2)), | 651 fLeft + pDateInfo->iDayOfWeek * (m_szCell.x + (MONTHCAL_HMARGIN * 2)), |
652 fTop + iWeekOfMonth * (m_szCell.y + (MONTHCAL_VMARGIN * 2)), | 652 fTop + iWeekOfMonth * (m_szCell.y + (MONTHCAL_VMARGIN * 2)), |
653 m_szCell.x + (MONTHCAL_HMARGIN * 2), | 653 m_szCell.x + (MONTHCAL_HMARGIN * 2), |
654 m_szCell.y + (MONTHCAL_VMARGIN * 2)); | 654 m_szCell.y + (MONTHCAL_VMARGIN * 2)); |
655 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_WeekNumbers) | 655 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_WeekNumbers) |
656 pDateInfo->rect.Offset(m_fWeekNumWid, 0); | 656 pDateInfo->rect.Offset(m_fWeekNumWid, 0); |
657 if (pDateInfo->iDayOfWeek >= 6) | 657 if (pDateInfo->iDayOfWeek >= 6) |
658 bNewWeek = true; | 658 bNewWeek = true; |
659 } | 659 } |
660 } | 660 } |
661 | 661 |
662 void IFWL_MonthCalendar::GetCapValue() { | 662 void CFWL_MonthCalendar::GetCapValue() { |
663 if (!m_pProperties->m_pThemeProvider) | 663 if (!m_pProperties->m_pThemeProvider) |
664 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 664 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
665 | 665 |
666 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; | 666 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; |
667 CFWL_ThemePart part; | 667 CFWL_ThemePart part; |
668 part.m_pWidget = this; | 668 part.m_pWidget = this; |
669 m_fHeadWid = *static_cast<FX_FLOAT*>( | 669 m_fHeadWid = *static_cast<FX_FLOAT*>( |
670 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::HeaderWidth)); | 670 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::HeaderWidth)); |
671 m_fHeadHei = *static_cast<FX_FLOAT*>( | 671 m_fHeadHei = *static_cast<FX_FLOAT*>( |
672 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::HeaderHeight)); | 672 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::HeaderHeight)); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::TodayFlagWidth)); | 716 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::TodayFlagWidth)); |
717 m_fMCWid = *static_cast<FX_FLOAT*>( | 717 m_fMCWid = *static_cast<FX_FLOAT*>( |
718 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::Width)); | 718 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::Width)); |
719 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_WeekNumbers) | 719 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_WeekNumbers) |
720 m_fMCWid += m_fWeekNumWid; | 720 m_fMCWid += m_fWeekNumWid; |
721 | 721 |
722 m_fMCHei = *static_cast<FX_FLOAT*>( | 722 m_fMCHei = *static_cast<FX_FLOAT*>( |
723 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::Height)); | 723 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::Height)); |
724 } | 724 } |
725 | 725 |
726 void IFWL_MonthCalendar::InitDate() { | 726 void CFWL_MonthCalendar::InitDate() { |
727 // TODO(dsinclair): These should pull the real today values instead of | 727 // TODO(dsinclair): These should pull the real today values instead of |
728 // pretending it's 2011-01-01. | 728 // pretending it's 2011-01-01. |
729 m_iYear = 2011; | 729 m_iYear = 2011; |
730 m_iMonth = 1; | 730 m_iMonth = 1; |
731 m_iDay = 1; | 731 m_iDay = 1; |
732 m_iCurYear = m_iYear; | 732 m_iCurYear = m_iYear; |
733 m_iCurMonth = m_iMonth; | 733 m_iCurMonth = m_iMonth; |
734 | 734 |
735 GetTodayText(m_iYear, m_iMonth, m_iDay, m_wsToday); | 735 GetTodayText(m_iYear, m_iMonth, m_iDay, m_wsToday); |
736 GetHeadText(m_iCurYear, m_iCurMonth, m_wsHead); | 736 GetHeadText(m_iCurYear, m_iCurMonth, m_wsHead); |
737 m_dtMin = DATE(1500, 12, 1); | 737 m_dtMin = DATE(1500, 12, 1); |
738 m_dtMax = DATE(2200, 1, 1); | 738 m_dtMax = DATE(2200, 1, 1); |
739 } | 739 } |
740 | 740 |
741 void IFWL_MonthCalendar::ClearDateItem() { | 741 void CFWL_MonthCalendar::ClearDateItem() { |
742 for (int32_t i = 0; i < m_arrDates.GetSize(); i++) | 742 for (int32_t i = 0; i < m_arrDates.GetSize(); i++) |
743 delete m_arrDates.GetAt(i); | 743 delete m_arrDates.GetAt(i); |
744 m_arrDates.RemoveAll(); | 744 m_arrDates.RemoveAll(); |
745 } | 745 } |
746 | 746 |
747 void IFWL_MonthCalendar::ResetDateItem() { | 747 void CFWL_MonthCalendar::ResetDateItem() { |
748 m_pDateTime->Set(m_iCurYear, m_iCurMonth, 1); | 748 m_pDateTime->Set(m_iCurYear, m_iCurMonth, 1); |
749 int32_t iDays = FX_DaysInMonth(m_iCurYear, m_iCurMonth); | 749 int32_t iDays = FX_DaysInMonth(m_iCurYear, m_iCurMonth); |
750 int32_t iDayOfWeek = m_pDateTime->GetDayOfWeek(); | 750 int32_t iDayOfWeek = m_pDateTime->GetDayOfWeek(); |
751 for (int32_t i = 0; i < iDays; i++) { | 751 for (int32_t i = 0; i < iDays; i++) { |
752 if (iDayOfWeek >= 7) | 752 if (iDayOfWeek >= 7) |
753 iDayOfWeek = 0; | 753 iDayOfWeek = 0; |
754 | 754 |
755 CFX_WideString wsDay; | 755 CFX_WideString wsDay; |
756 wsDay.Format(L"%d", i + 1); | 756 wsDay.Format(L"%d", i + 1); |
757 uint32_t dwStates = 0; | 757 uint32_t dwStates = 0; |
758 if (m_iYear == m_iCurYear && m_iMonth == m_iCurMonth && m_iDay == (i + 1)) | 758 if (m_iYear == m_iCurYear && m_iMonth == m_iCurMonth && m_iDay == (i + 1)) |
759 dwStates |= FWL_ITEMSTATE_MCD_Flag; | 759 dwStates |= FWL_ITEMSTATE_MCD_Flag; |
760 if (m_arrSelDays.Find(i + 1) != -1) | 760 if (m_arrSelDays.Find(i + 1) != -1) |
761 dwStates |= FWL_ITEMSTATE_MCD_Selected; | 761 dwStates |= FWL_ITEMSTATE_MCD_Selected; |
762 | 762 |
763 CFX_RectF rtDate; | 763 CFX_RectF rtDate; |
764 rtDate.Set(0, 0, 0, 0); | 764 rtDate.Set(0, 0, 0, 0); |
765 m_arrDates.Add(new DATEINFO(i + 1, iDayOfWeek, dwStates, rtDate, wsDay)); | 765 m_arrDates.Add(new DATEINFO(i + 1, iDayOfWeek, dwStates, rtDate, wsDay)); |
766 iDayOfWeek++; | 766 iDayOfWeek++; |
767 } | 767 } |
768 } | 768 } |
769 | 769 |
770 void IFWL_MonthCalendar::NextMonth() { | 770 void CFWL_MonthCalendar::NextMonth() { |
771 int32_t iYear = m_iCurYear, iMonth = m_iCurMonth; | 771 int32_t iYear = m_iCurYear, iMonth = m_iCurMonth; |
772 if (iMonth >= 12) { | 772 if (iMonth >= 12) { |
773 iMonth = 1; | 773 iMonth = 1; |
774 iYear++; | 774 iYear++; |
775 } else { | 775 } else { |
776 iMonth++; | 776 iMonth++; |
777 } | 777 } |
778 DATE dt(m_iCurYear, m_iCurMonth, 1); | 778 DATE dt(m_iCurYear, m_iCurMonth, 1); |
779 if (!(dt < m_dtMax)) | 779 if (!(dt < m_dtMax)) |
780 return; | 780 return; |
781 | 781 |
782 m_iCurYear = iYear, m_iCurMonth = iMonth; | 782 m_iCurYear = iYear, m_iCurMonth = iMonth; |
783 ChangeToMonth(m_iCurYear, m_iCurMonth); | 783 ChangeToMonth(m_iCurYear, m_iCurMonth); |
784 } | 784 } |
785 | 785 |
786 void IFWL_MonthCalendar::PrevMonth() { | 786 void CFWL_MonthCalendar::PrevMonth() { |
787 int32_t iYear = m_iCurYear, iMonth = m_iCurMonth; | 787 int32_t iYear = m_iCurYear, iMonth = m_iCurMonth; |
788 if (iMonth <= 1) { | 788 if (iMonth <= 1) { |
789 iMonth = 12; | 789 iMonth = 12; |
790 iYear--; | 790 iYear--; |
791 } else { | 791 } else { |
792 iMonth--; | 792 iMonth--; |
793 } | 793 } |
794 | 794 |
795 DATE dt(m_iCurYear, m_iCurMonth, 1); | 795 DATE dt(m_iCurYear, m_iCurMonth, 1); |
796 if (!(dt > m_dtMin)) | 796 if (!(dt > m_dtMin)) |
797 return; | 797 return; |
798 | 798 |
799 m_iCurYear = iYear, m_iCurMonth = iMonth; | 799 m_iCurYear = iYear, m_iCurMonth = iMonth; |
800 ChangeToMonth(m_iCurYear, m_iCurMonth); | 800 ChangeToMonth(m_iCurYear, m_iCurMonth); |
801 } | 801 } |
802 | 802 |
803 void IFWL_MonthCalendar::ChangeToMonth(int32_t iYear, int32_t iMonth) { | 803 void CFWL_MonthCalendar::ChangeToMonth(int32_t iYear, int32_t iMonth) { |
804 m_iCurYear = iYear; | 804 m_iCurYear = iYear; |
805 m_iCurMonth = iMonth; | 805 m_iCurMonth = iMonth; |
806 m_iHovered = -1; | 806 m_iHovered = -1; |
807 | 807 |
808 ClearDateItem(); | 808 ClearDateItem(); |
809 ResetDateItem(); | 809 ResetDateItem(); |
810 CalDateItem(); | 810 CalDateItem(); |
811 GetHeadText(m_iCurYear, m_iCurMonth, m_wsHead); | 811 GetHeadText(m_iCurYear, m_iCurMonth, m_wsHead); |
812 } | 812 } |
813 | 813 |
814 void IFWL_MonthCalendar::RemoveSelDay(int32_t iDay, bool bAll) { | 814 void CFWL_MonthCalendar::RemoveSelDay(int32_t iDay, bool bAll) { |
815 if (iDay == -1 && !bAll) | 815 if (iDay == -1 && !bAll) |
816 return; | 816 return; |
817 if (bAll) { | 817 if (bAll) { |
818 int32_t iCount = m_arrSelDays.GetSize(); | 818 int32_t iCount = m_arrSelDays.GetSize(); |
819 int32_t iDatesCount = m_arrDates.GetSize(); | 819 int32_t iDatesCount = m_arrDates.GetSize(); |
820 for (int32_t i = 0; i < iCount; i++) { | 820 for (int32_t i = 0; i < iCount; i++) { |
821 int32_t iSelDay = m_arrSelDays.GetAt(i); | 821 int32_t iSelDay = m_arrSelDays.GetAt(i); |
822 if (iSelDay <= iDatesCount) { | 822 if (iSelDay <= iDatesCount) { |
823 DATEINFO* pDateInfo = m_arrDates.GetAt(iSelDay - 1); | 823 DATEINFO* pDateInfo = m_arrDates.GetAt(iSelDay - 1); |
824 pDateInfo->dwStates &= ~FWL_ITEMSTATE_MCD_Selected; | 824 pDateInfo->dwStates &= ~FWL_ITEMSTATE_MCD_Selected; |
825 } | 825 } |
826 } | 826 } |
827 m_arrSelDays.RemoveAll(); | 827 m_arrSelDays.RemoveAll(); |
828 return; | 828 return; |
829 } | 829 } |
830 | 830 |
831 int32_t index = m_arrSelDays.Find(iDay); | 831 int32_t index = m_arrSelDays.Find(iDay); |
832 if (index == -1) | 832 if (index == -1) |
833 return; | 833 return; |
834 | 834 |
835 int32_t iSelDay = m_arrSelDays.GetAt(iDay); | 835 int32_t iSelDay = m_arrSelDays.GetAt(iDay); |
836 int32_t iDatesCount = m_arrDates.GetSize(); | 836 int32_t iDatesCount = m_arrDates.GetSize(); |
837 if (iSelDay <= iDatesCount) { | 837 if (iSelDay <= iDatesCount) { |
838 DATEINFO* pDateInfo = m_arrDates.GetAt(iSelDay - 1); | 838 DATEINFO* pDateInfo = m_arrDates.GetAt(iSelDay - 1); |
839 pDateInfo->dwStates &= ~FWL_ITEMSTATE_MCD_Selected; | 839 pDateInfo->dwStates &= ~FWL_ITEMSTATE_MCD_Selected; |
840 } | 840 } |
841 m_arrSelDays.RemoveAt(index); | 841 m_arrSelDays.RemoveAt(index); |
842 } | 842 } |
843 | 843 |
844 void IFWL_MonthCalendar::AddSelDay(int32_t iDay) { | 844 void CFWL_MonthCalendar::AddSelDay(int32_t iDay) { |
845 ASSERT(iDay > 0); | 845 ASSERT(iDay > 0); |
846 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_MultiSelect) | 846 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_MultiSelect) |
847 return; | 847 return; |
848 | 848 |
849 if (m_arrSelDays.Find(iDay) != -1) | 849 if (m_arrSelDays.Find(iDay) != -1) |
850 return; | 850 return; |
851 | 851 |
852 RemoveSelDay(-1, true); | 852 RemoveSelDay(-1, true); |
853 if (iDay <= m_arrDates.GetSize()) { | 853 if (iDay <= m_arrDates.GetSize()) { |
854 DATEINFO* pDateInfo = m_arrDates.GetAt(iDay - 1); | 854 DATEINFO* pDateInfo = m_arrDates.GetAt(iDay - 1); |
855 pDateInfo->dwStates |= FWL_ITEMSTATE_MCD_Selected; | 855 pDateInfo->dwStates |= FWL_ITEMSTATE_MCD_Selected; |
856 } | 856 } |
857 m_arrSelDays.Add(iDay); | 857 m_arrSelDays.Add(iDay); |
858 } | 858 } |
859 | 859 |
860 void IFWL_MonthCalendar::JumpToToday() { | 860 void CFWL_MonthCalendar::JumpToToday() { |
861 if (m_iYear != m_iCurYear || m_iMonth != m_iCurMonth) { | 861 if (m_iYear != m_iCurYear || m_iMonth != m_iCurMonth) { |
862 m_iCurYear = m_iYear; | 862 m_iCurYear = m_iYear; |
863 m_iCurMonth = m_iMonth; | 863 m_iCurMonth = m_iMonth; |
864 ChangeToMonth(m_iYear, m_iMonth); | 864 ChangeToMonth(m_iYear, m_iMonth); |
865 AddSelDay(m_iDay); | 865 AddSelDay(m_iDay); |
866 return; | 866 return; |
867 } | 867 } |
868 | 868 |
869 if (m_arrSelDays.Find(m_iDay) == -1) | 869 if (m_arrSelDays.Find(m_iDay) == -1) |
870 AddSelDay(m_iDay); | 870 AddSelDay(m_iDay); |
871 } | 871 } |
872 | 872 |
873 void IFWL_MonthCalendar::GetHeadText(int32_t iYear, | 873 void CFWL_MonthCalendar::GetHeadText(int32_t iYear, |
874 int32_t iMonth, | 874 int32_t iMonth, |
875 CFX_WideString& wsHead) { | 875 CFX_WideString& wsHead) { |
876 ASSERT(iMonth > 0 && iMonth < 13); | 876 ASSERT(iMonth > 0 && iMonth < 13); |
877 static const FX_WCHAR* const pMonth[] = { | 877 static const FX_WCHAR* const pMonth[] = { |
878 L"January", L"February", L"March", L"April", | 878 L"January", L"February", L"March", L"April", |
879 L"May", L"June", L"July", L"August", | 879 L"May", L"June", L"July", L"August", |
880 L"September", L"October", L"November", L"December"}; | 880 L"September", L"October", L"November", L"December"}; |
881 wsHead.Format(L"%s, %d", pMonth[iMonth - 1], iYear); | 881 wsHead.Format(L"%s, %d", pMonth[iMonth - 1], iYear); |
882 } | 882 } |
883 | 883 |
884 void IFWL_MonthCalendar::GetTodayText(int32_t iYear, | 884 void CFWL_MonthCalendar::GetTodayText(int32_t iYear, |
885 int32_t iMonth, | 885 int32_t iMonth, |
886 int32_t iDay, | 886 int32_t iDay, |
887 CFX_WideString& wsToday) { | 887 CFX_WideString& wsToday) { |
888 wsToday.Format(L", %d/%d/%d", iDay, iMonth, iYear); | 888 wsToday.Format(L", %d/%d/%d", iDay, iMonth, iYear); |
889 } | 889 } |
890 | 890 |
891 int32_t IFWL_MonthCalendar::GetDayAtPoint(FX_FLOAT x, FX_FLOAT y) { | 891 int32_t CFWL_MonthCalendar::GetDayAtPoint(FX_FLOAT x, FX_FLOAT y) { |
892 int32_t iCount = m_arrDates.GetSize(); | 892 int32_t iCount = m_arrDates.GetSize(); |
893 for (int32_t i = 0; i < iCount; i++) { | 893 for (int32_t i = 0; i < iCount; i++) { |
894 DATEINFO* pDateInfo = m_arrDates.GetAt(i); | 894 DATEINFO* pDateInfo = m_arrDates.GetAt(i); |
895 if (pDateInfo->rect.Contains(x, y)) | 895 if (pDateInfo->rect.Contains(x, y)) |
896 return ++i; | 896 return ++i; |
897 } | 897 } |
898 return -1; | 898 return -1; |
899 } | 899 } |
900 | 900 |
901 void IFWL_MonthCalendar::GetDayRect(int32_t iDay, CFX_RectF& rtDay) { | 901 void CFWL_MonthCalendar::GetDayRect(int32_t iDay, CFX_RectF& rtDay) { |
902 if (iDay <= 0 || iDay > m_arrDates.GetSize()) | 902 if (iDay <= 0 || iDay > m_arrDates.GetSize()) |
903 return; | 903 return; |
904 | 904 |
905 DATEINFO* pDateInfo = m_arrDates[iDay - 1]; | 905 DATEINFO* pDateInfo = m_arrDates[iDay - 1]; |
906 if (!pDateInfo) | 906 if (!pDateInfo) |
907 return; | 907 return; |
908 rtDay = pDateInfo->rect; | 908 rtDay = pDateInfo->rect; |
909 } | 909 } |
910 | 910 |
911 void IFWL_MonthCalendar::OnProcessMessage(CFWL_Message* pMessage) { | 911 void CFWL_MonthCalendar::OnProcessMessage(CFWL_Message* pMessage) { |
912 if (!pMessage) | 912 if (!pMessage) |
913 return; | 913 return; |
914 | 914 |
915 CFWL_MessageType dwMsgCode = pMessage->GetClassID(); | 915 CFWL_MessageType dwMsgCode = pMessage->GetClassID(); |
916 switch (dwMsgCode) { | 916 switch (dwMsgCode) { |
917 case CFWL_MessageType::SetFocus: | 917 case CFWL_MessageType::SetFocus: |
918 case CFWL_MessageType::KillFocus: | 918 case CFWL_MessageType::KillFocus: |
919 GetOuter()->GetDelegate()->OnProcessMessage(pMessage); | 919 GetOuter()->GetDelegate()->OnProcessMessage(pMessage); |
920 break; | 920 break; |
921 case CFWL_MessageType::Key: | 921 case CFWL_MessageType::Key: |
(...skipping 17 matching lines...) Expand all Loading... |
939 break; | 939 break; |
940 } | 940 } |
941 break; | 941 break; |
942 } | 942 } |
943 default: | 943 default: |
944 break; | 944 break; |
945 } | 945 } |
946 IFWL_Widget::OnProcessMessage(pMessage); | 946 IFWL_Widget::OnProcessMessage(pMessage); |
947 } | 947 } |
948 | 948 |
949 void IFWL_MonthCalendar::OnDrawWidget(CFX_Graphics* pGraphics, | 949 void CFWL_MonthCalendar::OnDrawWidget(CFX_Graphics* pGraphics, |
950 const CFX_Matrix* pMatrix) { | 950 const CFX_Matrix* pMatrix) { |
951 DrawWidget(pGraphics, pMatrix); | 951 DrawWidget(pGraphics, pMatrix); |
952 } | 952 } |
953 | 953 |
954 void IFWL_MonthCalendar::OnLButtonDown(CFWL_MsgMouse* pMsg) { | 954 void CFWL_MonthCalendar::OnLButtonDown(CFWL_MsgMouse* pMsg) { |
955 if (m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { | 955 if (m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { |
956 m_iLBtnPartStates = CFWL_PartState_Pressed; | 956 m_iLBtnPartStates = CFWL_PartState_Pressed; |
957 PrevMonth(); | 957 PrevMonth(); |
958 Repaint(&m_rtClient); | 958 Repaint(&m_rtClient); |
959 } else if (m_rtRBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { | 959 } else if (m_rtRBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { |
960 m_iRBtnPartStates |= CFWL_PartState_Pressed; | 960 m_iRBtnPartStates |= CFWL_PartState_Pressed; |
961 NextMonth(); | 961 NextMonth(); |
962 Repaint(&m_rtClient); | 962 Repaint(&m_rtClient); |
963 } else if (m_rtToday.Contains(pMsg->m_fx, pMsg->m_fy)) { | 963 } else if (m_rtToday.Contains(pMsg->m_fx, pMsg->m_fy)) { |
964 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoToday) == 0) { | 964 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoToday) == 0) { |
965 JumpToToday(); | 965 JumpToToday(); |
966 Repaint(&m_rtClient); | 966 Repaint(&m_rtClient); |
967 } | 967 } |
968 } else { | 968 } else { |
969 IFWL_DateTimePicker* pIPicker = static_cast<IFWL_DateTimePicker*>(m_pOuter); | 969 IFWL_DateTimePicker* pIPicker = static_cast<IFWL_DateTimePicker*>(m_pOuter); |
970 if (pIPicker->IsMonthCalendarVisible()) | 970 if (pIPicker->IsMonthCalendarVisible()) |
971 m_bFlag = 1; | 971 m_bFlag = 1; |
972 } | 972 } |
973 } | 973 } |
974 | 974 |
975 void IFWL_MonthCalendar::OnLButtonUp(CFWL_MsgMouse* pMsg) { | 975 void CFWL_MonthCalendar::OnLButtonUp(CFWL_MsgMouse* pMsg) { |
976 if (m_pWidgetMgr->IsFormDisabled()) | 976 if (m_pWidgetMgr->IsFormDisabled()) |
977 return DisForm_OnLButtonUp(pMsg); | 977 return DisForm_OnLButtonUp(pMsg); |
978 | 978 |
979 if (m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { | 979 if (m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { |
980 m_iLBtnPartStates = 0; | 980 m_iLBtnPartStates = 0; |
981 Repaint(&m_rtLBtn); | 981 Repaint(&m_rtLBtn); |
982 return; | 982 return; |
983 } | 983 } |
984 if (m_rtRBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { | 984 if (m_rtRBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { |
985 m_iRBtnPartStates = 0; | 985 m_iRBtnPartStates = 0; |
(...skipping 24 matching lines...) Expand all Loading... |
1010 return; | 1010 return; |
1011 | 1011 |
1012 pIPicker->ProcessSelChanged(m_iCurYear, m_iCurMonth, iCurSel); | 1012 pIPicker->ProcessSelChanged(m_iCurYear, m_iCurMonth, iCurSel); |
1013 pIPicker->ShowMonthCalendar(false); | 1013 pIPicker->ShowMonthCalendar(false); |
1014 } else if (m_bFlag && (!rt.Contains(pMsg->m_fx, pMsg->m_fy))) { | 1014 } else if (m_bFlag && (!rt.Contains(pMsg->m_fx, pMsg->m_fy))) { |
1015 pIPicker->ShowMonthCalendar(false); | 1015 pIPicker->ShowMonthCalendar(false); |
1016 } | 1016 } |
1017 m_bFlag = 0; | 1017 m_bFlag = 0; |
1018 } | 1018 } |
1019 | 1019 |
1020 void IFWL_MonthCalendar::DisForm_OnLButtonUp(CFWL_MsgMouse* pMsg) { | 1020 void CFWL_MonthCalendar::DisForm_OnLButtonUp(CFWL_MsgMouse* pMsg) { |
1021 if (m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { | 1021 if (m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { |
1022 m_iLBtnPartStates = 0; | 1022 m_iLBtnPartStates = 0; |
1023 Repaint(&(m_rtLBtn)); | 1023 Repaint(&(m_rtLBtn)); |
1024 return; | 1024 return; |
1025 } | 1025 } |
1026 if (m_rtRBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { | 1026 if (m_rtRBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { |
1027 m_iRBtnPartStates = 0; | 1027 m_iRBtnPartStates = 0; |
1028 Repaint(&(m_rtRBtn)); | 1028 Repaint(&(m_rtRBtn)); |
1029 return; | 1029 return; |
1030 } | 1030 } |
(...skipping 13 matching lines...) Expand all Loading... |
1044 rtInvalidate.Union(lpDatesInfo->rect); | 1044 rtInvalidate.Union(lpDatesInfo->rect); |
1045 } | 1045 } |
1046 AddSelDay(iCurSel); | 1046 AddSelDay(iCurSel); |
1047 IFWL_DateTimePicker* pDateTime = | 1047 IFWL_DateTimePicker* pDateTime = |
1048 static_cast<IFWL_DateTimePicker*>(m_pOuter); | 1048 static_cast<IFWL_DateTimePicker*>(m_pOuter); |
1049 pDateTime->ProcessSelChanged(m_iCurYear, m_iCurMonth, iCurSel); | 1049 pDateTime->ProcessSelChanged(m_iCurYear, m_iCurMonth, iCurSel); |
1050 pDateTime->ShowMonthCalendar(false); | 1050 pDateTime->ShowMonthCalendar(false); |
1051 } | 1051 } |
1052 } | 1052 } |
1053 | 1053 |
1054 void IFWL_MonthCalendar::OnMouseMove(CFWL_MsgMouse* pMsg) { | 1054 void CFWL_MonthCalendar::OnMouseMove(CFWL_MsgMouse* pMsg) { |
1055 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_MultiSelect) | 1055 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_MultiSelect) |
1056 return; | 1056 return; |
1057 | 1057 |
1058 bool bRepaint = false; | 1058 bool bRepaint = false; |
1059 CFX_RectF rtInvalidate; | 1059 CFX_RectF rtInvalidate; |
1060 rtInvalidate.Set(0, 0, 0, 0); | 1060 rtInvalidate.Set(0, 0, 0, 0); |
1061 if (m_rtDates.Contains(pMsg->m_fx, pMsg->m_fy)) { | 1061 if (m_rtDates.Contains(pMsg->m_fx, pMsg->m_fy)) { |
1062 int32_t iHover = GetDayAtPoint(pMsg->m_fx, pMsg->m_fy); | 1062 int32_t iHover = GetDayAtPoint(pMsg->m_fx, pMsg->m_fy); |
1063 bRepaint = m_iHovered != iHover; | 1063 bRepaint = m_iHovered != iHover; |
1064 if (bRepaint) { | 1064 if (bRepaint) { |
(...skipping 13 matching lines...) Expand all Loading... |
1078 bRepaint = m_iHovered > 0; | 1078 bRepaint = m_iHovered > 0; |
1079 if (bRepaint) | 1079 if (bRepaint) |
1080 GetDayRect(m_iHovered, rtInvalidate); | 1080 GetDayRect(m_iHovered, rtInvalidate); |
1081 | 1081 |
1082 m_iHovered = -1; | 1082 m_iHovered = -1; |
1083 } | 1083 } |
1084 if (bRepaint && !rtInvalidate.IsEmpty()) | 1084 if (bRepaint && !rtInvalidate.IsEmpty()) |
1085 Repaint(&rtInvalidate); | 1085 Repaint(&rtInvalidate); |
1086 } | 1086 } |
1087 | 1087 |
1088 void IFWL_MonthCalendar::OnMouseLeave(CFWL_MsgMouse* pMsg) { | 1088 void CFWL_MonthCalendar::OnMouseLeave(CFWL_MsgMouse* pMsg) { |
1089 if (m_iHovered <= 0) | 1089 if (m_iHovered <= 0) |
1090 return; | 1090 return; |
1091 | 1091 |
1092 CFX_RectF rtInvalidate; | 1092 CFX_RectF rtInvalidate; |
1093 rtInvalidate.Set(0, 0, 0, 0); | 1093 rtInvalidate.Set(0, 0, 0, 0); |
1094 GetDayRect(m_iHovered, rtInvalidate); | 1094 GetDayRect(m_iHovered, rtInvalidate); |
1095 m_iHovered = -1; | 1095 m_iHovered = -1; |
1096 if (!rtInvalidate.IsEmpty()) | 1096 if (!rtInvalidate.IsEmpty()) |
1097 Repaint(&rtInvalidate); | 1097 Repaint(&rtInvalidate); |
1098 } | 1098 } |
1099 | 1099 |
1100 IFWL_MonthCalendar::DATEINFO::DATEINFO(int32_t day, | 1100 CFWL_MonthCalendar::DATEINFO::DATEINFO(int32_t day, |
1101 int32_t dayofweek, | 1101 int32_t dayofweek, |
1102 uint32_t dwSt, | 1102 uint32_t dwSt, |
1103 CFX_RectF rc, | 1103 CFX_RectF rc, |
1104 CFX_WideString& wsday) | 1104 CFX_WideString& wsday) |
1105 : iDay(day), | 1105 : iDay(day), |
1106 iDayOfWeek(dayofweek), | 1106 iDayOfWeek(dayofweek), |
1107 dwStates(dwSt), | 1107 dwStates(dwSt), |
1108 rect(rc), | 1108 rect(rc), |
1109 wsDay(wsday) {} | 1109 wsDay(wsday) {} |
1110 | 1110 |
1111 IFWL_MonthCalendar::DATEINFO::~DATEINFO() {} | 1111 CFWL_MonthCalendar::DATEINFO::~DATEINFO() {} |
OLD | NEW |