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

Side by Side Diff: xfa/src/fwl/theme/monthcalendartp.cpp

Issue 1803723002: Move xfa/src up to xfa/. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 9 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/src/fwl/theme/listboxtp.cpp ('k') | xfa/src/fwl/theme/pictureboxtp.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 #include "xfa/include/fwl/theme/monthcalendartp.h"
8
9 #include "xfa/include/fwl/basewidget/fwl_monthcalendar.h"
10 #include "xfa/include/fwl/core/fwl_widget.h"
11 #include "xfa/src/fde/tto/fde_textout.h"
12
13 #define FWL_THEMECAPACITY_MC_HEADER_WIDTH 200
14 #define FWL_THEMECAPACITY_MC_HEADER_HEIGHT 30
15 #define FWL_THEMECAPACITY_MC_HEADER_BTN_WIDTH 18
16 #define FWL_THEMECAPACITY_MC_HEADER_BTN_HEIGHT 16
17 #define FWL_THEMECAPACITY_MC_HEADER_BTN_HMARGIN 5
18 #define FWL_THEMECAPACITY_MC_HEADER_BTN_VMARGIN \
19 (FWL_THEMECAPACITY_MC_HEADER_HEIGHT - \
20 FWL_THEMECAPACITY_MC_HEADER_BTN_HEIGHT) / \
21 2
22 #define FWL_THEMECAPACITY_MC_HEADER_TEXTWIDHT 100
23 #define FWL_THEMECAPACITY_MC_HEADER_TEXTHEIGHT 20
24 #define FWL_THEMECAPACITY_MC_HEADER_TEXT_HMARGIN \
25 (FWL_THEMECAPACITY_MC_HEADER_WIDTH - \
26 FWL_THEMECAPACITY_MC_HEADER_TEXTWIDHT) / \
27 2
28 #define FWL_THEMECAPACITY_MC_HEADER_TEXT_VMARGIN \
29 (FWL_THEMECAPACITY_MC_HEADER_HEIGHT - \
30 FWL_THEMECAPACITY_MC_HEADER_TEXTHEIGHT) / \
31 2
32 #define FWL_THEMECAPACITY_MC_HSEP_WIDTH (FWL_THEMECAPACITY_MC_WEEK_WIDTH - 10)
33 #define FWL_THEMECAPACITY_MC_HSEP_HEIGHT 1
34 #define FWL_THEMECAPACITY_MC_VSEP_WIDTH 1
35 #define FWL_THEMECAPACITY_MC_VSEP_HEIGHT FWL_THEMECAPACITY_MC_WEEKNUM_HEIGHT
36 #define FWL_THEMECAPACITY_MC_WEEKNUM_WIDTH 26
37 #define FWL_THEMECAPACITY_MC_SEP_DOFFSET -4
38 #define FWL_THEMECAPACITY_MC_SEP_X 3
39 #define FWL_THEMECAPACITY_MC_SEP_Y \
40 (FWL_THEMECAPACITY_MC_HEADER_HEIGHT + FWL_THEMECAPACITY_MC_WEEK_HEIGHT + \
41 FWL_THEMECAPACITY_MC_SEP_DOFFSET)
42 #define FWL_THEMECAPACITY_MC_WEEKNUM_HEIGHT \
43 (6 * FWL_THEMECAPACITY_MC_DATES_CELL_HEIGHT)
44 #define FWL_THEMECAPACITY_MC_WEEK_WIDTH \
45 (FWL_THEMECAPACITY_MC_DATES_CELL_WIDTH * 7)
46 #define FWL_THEMECAPACITY_MC_WEEK_HEIGHT FWL_THEMECAPACITY_MC_DATES_CELL_HEIGHT
47 #define FWL_THEMECAPACITY_MC_DATES_CELL_WIDTH \
48 (FWL_THEMECAPACITY_MC_HEADER_WIDTH / 7)
49 #define FWL_THEMECAPACITY_MC_DATES_CELL_HEIGHT 16
50 #define FWL_THEMECAPACITY_MC_TODAY_WIDHT FWL_THEMECAPACITY_MC_HEADER_WIDTH
51 #define FWL_THEMECAPACITY_MC_TODAY_HEIGHT FWL_THEMECAPACITY_MC_DATES_CELL_HEIGHT
52 #define FWL_THEMECAPACITY_MC_TODAY_FLAG_WIDHT \
53 FWL_THEMECAPACITY_MC_DATES_CELL_WIDTH
54 #define FWL_MC_WIDTH 200
55 #define FWL_MC_HEIGHT 160
56
57 CFWL_MonthCalendarTP::CFWL_MonthCalendarTP() {
58 m_pThemeData = new MCThemeData;
59 SetThemeData(0);
60 }
61 CFWL_MonthCalendarTP::~CFWL_MonthCalendarTP() {
62 delete m_pThemeData;
63 }
64 FX_BOOL CFWL_MonthCalendarTP::IsValidWidget(IFWL_Widget* pWidget) {
65 if (!pWidget)
66 return FALSE;
67 return pWidget->GetClassID() == FWL_CLASSHASH_MonthCalendar;
68 }
69 FX_DWORD CFWL_MonthCalendarTP::SetThemeID(IFWL_Widget* pWidget,
70 FX_DWORD dwThemeID,
71 FX_BOOL bChildren) {
72 if (m_pThemeData) {
73 SetThemeData(FWL_GetThemeColor(dwThemeID));
74 }
75 return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren);
76 }
77 FX_BOOL CFWL_MonthCalendarTP::DrawBackground(CFWL_ThemeBackground* pParams) {
78 if (!pParams)
79 return FALSE;
80 switch (pParams->m_iPart) {
81 case FWL_PART_MCD_Border: {
82 DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix);
83 break;
84 }
85 case FWL_PART_MCD_Edge: {
86 DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(),
87 &pParams->m_rtPart, &pParams->m_matrix);
88 break;
89 }
90 case FWL_PART_MCD_Background: {
91 DrawTotalBK(pParams, &pParams->m_matrix);
92 break;
93 }
94 case FWL_PART_MCD_Header: {
95 DrawHeadBk(pParams, &pParams->m_matrix);
96 break;
97 }
98 case FWL_PART_MCD_LBtn: {
99 #ifdef THEME_XPSimilar
100 FWLTHEME_STATE eState = GetState(pParams->m_dwStates);
101 DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart,
102 FWLTHEME_DIRECTION_Left, eState, &pParams->m_matrix);
103 #else
104 DrawLButton(pParams, &pParams->m_matrix);
105 #endif
106 break;
107 }
108 case FWL_PART_MCD_RBtn: {
109 #ifdef THEME_XPSimilar
110 FWLTHEME_STATE eState = GetState(pParams->m_dwStates);
111 DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart,
112 FWLTHEME_DIRECTION_Right, eState, &pParams->m_matrix);
113 #else
114 DrawRButton(pParams, &pParams->m_matrix);
115 #endif
116 break;
117 }
118 case FWL_PART_MCD_HSeparator: {
119 DrawHSeperator(pParams, &pParams->m_matrix);
120 break;
121 }
122 case FWL_PART_MCD_DatesIn: {
123 DrawDatesInBK(pParams, &pParams->m_matrix);
124 break;
125 }
126 case FWL_PART_MCD_TodayCircle: {
127 DrawTodayCircle(pParams, &pParams->m_matrix);
128 break;
129 }
130 case FWL_PART_MCD_DateInCircle: {
131 DrawDatesInCircle(pParams, &pParams->m_matrix);
132 break;
133 }
134 case FWL_PART_MCD_WeekNumSep: {
135 DrawWeekNumSep(pParams, &pParams->m_matrix);
136 break;
137 }
138 default: {}
139 }
140 return TRUE;
141 }
142 FX_BOOL CFWL_MonthCalendarTP::DrawText(CFWL_ThemeText* pParams) {
143 if (!m_pTextOut)
144 return FALSE;
145 if ((pParams->m_iPart == FWL_PART_MCD_DatesIn) &&
146 !(pParams->m_dwStates & FWL_ITEMSTATE_MCD_Flag) &&
147 (pParams->m_dwStates &
148 (FWL_PARTSTATE_MCD_Hovered | FWL_PARTSTATE_MCD_Selected))) {
149 m_pTextOut->SetTextColor(0xFFFFFFFF);
150 } else if (pParams->m_iPart == FWL_PART_MCD_Caption) {
151 m_pTextOut->SetTextColor(m_pThemeData->clrCaption);
152 } else {
153 m_pTextOut->SetTextColor(0xFF000000);
154 }
155 return CFWL_WidgetTP::DrawText(pParams);
156 }
157 void* CFWL_MonthCalendarTP::GetCapacity(CFWL_ThemePart* pThemePart,
158 FX_DWORD dwCapacity) {
159 FX_BOOL bDefPro = FALSE;
160 FX_BOOL bDwordVal = FALSE;
161 switch (dwCapacity) {
162 case FWL_WGTCAPACITY_MC_HEADER_WIDTH: {
163 m_fValue = FWL_THEMECAPACITY_MC_HEADER_WIDTH;
164 break;
165 }
166 case FWL_WGTCAPACITY_MC_HEADER_Height: {
167 m_fValue = FWL_THEMECAPACITY_MC_HEADER_HEIGHT;
168 break;
169 }
170 case FWL_WGTCAPACITY_MC_HEADER_BTN_WIDTH: {
171 m_fValue = FWL_THEMECAPACITY_MC_HEADER_BTN_WIDTH;
172 break;
173 }
174 case FWL_WGTCAPACITY_MC_HEADER_BTN_HEIGHT: {
175 m_fValue = FWL_THEMECAPACITY_MC_HEADER_BTN_HEIGHT;
176 break;
177 }
178 case FWL_WGTCAPACITY_MC_HEADER_BTN_HMARGIN: {
179 bDwordVal = TRUE;
180 m_dwValue = FWL_THEMECAPACITY_MC_HEADER_BTN_HMARGIN;
181 break;
182 }
183 case FWL_WGTCAPACITY_MC_HEADER_BTN_VMARGIN: {
184 m_fValue = FWL_THEMECAPACITY_MC_HEADER_BTN_VMARGIN;
185 break;
186 }
187 case FWL_WGTCAPACITY_MC_HEADER_TEXTWIDHT: {
188 m_fValue = FWL_THEMECAPACITY_MC_HEADER_TEXTWIDHT;
189 break;
190 }
191 case FWL_WGTCAPACITY_MC_HEADER_TEXTHEIGHT: {
192 m_fValue = FWL_THEMECAPACITY_MC_HEADER_TEXTHEIGHT;
193 break;
194 }
195 case FWL_WGTCAPACITY_MC_HEADER_TEXT_HMARGIN: {
196 m_fValue = FWL_THEMECAPACITY_MC_HEADER_TEXT_HMARGIN;
197 break;
198 }
199 case FWL_WGTCAPACITY_MC_HEADER_TEXT_VMARGIN: {
200 m_fValue = FWL_THEMECAPACITY_MC_HEADER_TEXT_VMARGIN;
201 break;
202 }
203 case FWL_WGTCAPACITY_MC_HSEP_WIDTH: {
204 m_fValue = FWL_THEMECAPACITY_MC_HSEP_WIDTH;
205 break;
206 }
207 case FWL_WGTCAPACITY_MC_HSEP_HEIGHT: {
208 m_fValue = FWL_THEMECAPACITY_MC_HSEP_HEIGHT;
209 break;
210 }
211 case FWL_WGTCAPACITY_MC_VSEP_WIDTH: {
212 m_fValue = FWL_THEMECAPACITY_MC_VSEP_WIDTH;
213 break;
214 }
215 case FWL_WGTCAPACITY_MC_VSEP_HEIGHT: {
216 m_fValue = FWL_THEMECAPACITY_MC_VSEP_HEIGHT;
217 break;
218 }
219 case FWL_WGTCAPACITY_MC_WEEKNUM_WIDTH: {
220 m_fValue = FWL_THEMECAPACITY_MC_WEEKNUM_WIDTH;
221 break;
222 }
223 case FWL_WGTCAPACITY_MC_WEEKNUM_HEIGHT: {
224 m_fValue = FWL_THEMECAPACITY_MC_WEEKNUM_HEIGHT;
225 break;
226 }
227 case FWL_WGTCAPACITY_MC_WEEK_WIDTH: {
228 m_fValue = FWL_THEMECAPACITY_MC_WEEK_WIDTH;
229 break;
230 }
231 case FWL_WGTCAPACITY_MC_WEEK_HEIGHT: {
232 m_fValue = FWL_THEMECAPACITY_MC_WEEK_HEIGHT;
233 break;
234 }
235 case FWL_WGTCAPACITY_MC_SEP_DOFFSET: {
236 m_fValue = FWL_THEMECAPACITY_MC_SEP_DOFFSET;
237 break;
238 }
239 case FWL_WGTCAPACITY_MC_SEP_X: {
240 m_fValue = FWL_THEMECAPACITY_MC_SEP_X;
241 break;
242 }
243 case FWL_WGTCAPACITY_MC_SEP_Y: {
244 m_fValue = FWL_THEMECAPACITY_MC_SEP_Y;
245 break;
246 }
247 case FWL_WGTCAPACITY_MC_DATES_CELL_WIDTH: {
248 m_fValue = FWL_THEMECAPACITY_MC_DATES_CELL_WIDTH;
249 break;
250 }
251 case FWL_WGTCAPACITY_MC_DATES_CELL_HEIGHT: {
252 m_fValue = FWL_THEMECAPACITY_MC_DATES_CELL_HEIGHT;
253 break;
254 }
255 case FWL_WGTCAPACITY_MC_TODAY_WIDHT: {
256 m_fValue = FWL_THEMECAPACITY_MC_TODAY_WIDHT;
257 break;
258 }
259 case FWL_WGTCAPACITY_MC_TODAY_HEIGHT: {
260 m_fValue = FWL_THEMECAPACITY_MC_TODAY_HEIGHT;
261 break;
262 }
263 case FWL_WGTCAPACITY_MC_TODAY_FLAG_WIDHT: {
264 m_fValue = FWL_THEMECAPACITY_MC_TODAY_FLAG_WIDHT;
265 break;
266 }
267 case FWL_WGTCAPACITY_MC_WIDTH: {
268 m_fValue = FWL_MC_WIDTH;
269 break;
270 }
271 case FWL_WGTCAPACITY_MC_HEIGHT: {
272 m_fValue = FWL_MC_HEIGHT;
273 break;
274 }
275 case FWL_MCCAPACITY_Sun: {
276 wsResource = L"Sun";
277 return &wsResource;
278 }
279 case FWL_MCCAPACITY_Mon: {
280 wsResource = L"Mon";
281 return &wsResource;
282 }
283 case FWL_MCCAPACITY_Tue: {
284 wsResource = L"Tue";
285 return &wsResource;
286 }
287 case FWL_MCCAPACITY_Wed: {
288 wsResource = L"Wed";
289 return &wsResource;
290 }
291 case FWL_MCCAPACITY_Thu: {
292 wsResource = L"Thu";
293 return &wsResource;
294 }
295 case FWL_MCCAPACITY_Fri: {
296 wsResource = L"Fri";
297 return &wsResource;
298 }
299 case FWL_MCCAPACITY_Sat: {
300 wsResource = L"Sat";
301 return &wsResource;
302 }
303 case FWL_MCCAPACITY_January: {
304 wsResource = L"January";
305 return &wsResource;
306 }
307 case FWL_MCCAPACITY_February: {
308 wsResource = L"February";
309 return &wsResource;
310 }
311 case FWL_MCCAPACITY_March: {
312 wsResource = L"March";
313 return &wsResource;
314 }
315 case FWL_MCCAPACITY_April: {
316 wsResource = L"April";
317 return &wsResource;
318 }
319 case FWL_MCCAPACITY_May: {
320 wsResource = L"May";
321 return &wsResource;
322 }
323 case FWL_MCCAPACITY_June: {
324 wsResource = L"June";
325 return &wsResource;
326 }
327 case FWL_MCCAPACITY_July: {
328 wsResource = L"July";
329 return &wsResource;
330 }
331 case FWL_MCCAPACITY_August: {
332 wsResource = L"August";
333 return &wsResource;
334 }
335 case FWL_MCCAPACITY_September: {
336 wsResource = L"September";
337 return &wsResource;
338 }
339 case FWL_MCCAPACITY_October: {
340 wsResource = L"October";
341 return &wsResource;
342 }
343 case FWL_MCCAPACITY_November: {
344 wsResource = L"November";
345 return &wsResource;
346 }
347 case FWL_MCCAPACITY_December: {
348 wsResource = L"December";
349 return &wsResource;
350 }
351 case FWL_MCCAPACITY_Today: {
352 wsResource = L"Today";
353 return &wsResource;
354 }
355 default: { bDefPro = TRUE; }
356 }
357 if (!bDefPro) {
358 if (bDwordVal) {
359 return &m_dwValue;
360 }
361 return &m_fValue;
362 }
363 return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity);
364 }
365 FWL_ERR CFWL_MonthCalendarTP::Initialize() {
366 InitTTO();
367 return CFWL_WidgetTP::Initialize();
368 }
369 FWL_ERR CFWL_MonthCalendarTP::Finalize() {
370 FinalizeTTO();
371 return CFWL_WidgetTP::Finalize();
372 }
373 FX_BOOL CFWL_MonthCalendarTP::DrawTotalBK(CFWL_ThemeBackground* pParams,
374 CFX_Matrix* pMatrix) {
375 CFX_Path path;
376 path.Create();
377 CFX_RectF rtTotal(pParams->m_rtPart);
378 path.AddRectangle(rtTotal.left, rtTotal.top, rtTotal.width, rtTotal.height);
379 pParams->m_pGraphics->SaveGraphState();
380 CFX_Color clrBK(m_pThemeData->clrBK);
381 pParams->m_pGraphics->SetFillColor(&clrBK);
382 pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
383 pParams->m_pGraphics->RestoreGraphState();
384 return TRUE;
385 }
386 FX_BOOL CFWL_MonthCalendarTP::DrawHeadBk(CFWL_ThemeBackground* pParams,
387 CFX_Matrix* pMatrix) {
388 CFX_Path path;
389 path.Create();
390 CFX_RectF rtHead = pParams->m_rtPart;
391 path.AddRectangle(rtHead.left, rtHead.top, rtHead.width, rtHead.height);
392 pParams->m_pGraphics->SaveGraphState();
393 CFX_Color clrHeadBK(m_pThemeData->clrBK);
394 pParams->m_pGraphics->SetFillColor(&clrHeadBK);
395 pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
396 pParams->m_pGraphics->RestoreGraphState();
397 return TRUE;
398 }
399 FX_BOOL CFWL_MonthCalendarTP::DrawLButton(CFWL_ThemeBackground* pParams,
400 CFX_Matrix* pMatrix) {
401 CFX_Path path;
402 path.Create();
403 CFX_RectF rtLBtn;
404 rtLBtn = pParams->m_rtPart;
405 path.AddRectangle(rtLBtn.left, rtLBtn.top, rtLBtn.width, rtLBtn.height);
406 pParams->m_pGraphics->SaveGraphState();
407 CFX_Color clrLBtnEdge(ArgbEncode(0xff, 205, 219, 243));
408 pParams->m_pGraphics->SetStrokeColor(&clrLBtnEdge);
409 pParams->m_pGraphics->StrokePath(&path, pMatrix);
410 if ((pParams->m_dwStates & FWL_PARTSTATE_MCD_Pressed) ==
411 FWL_PARTSTATE_MCD_Pressed) {
412 CFX_Color clrLBtnFill(ArgbEncode(0xff, 174, 198, 242));
413 pParams->m_pGraphics->SetFillColor(&clrLBtnFill);
414 pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
415 } else {
416 CFX_Color clrLBtnFill(ArgbEncode(0xff, 227, 235, 249));
417 pParams->m_pGraphics->SetFillColor(&clrLBtnFill);
418 pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
419 }
420 path.Clear();
421 path.MoveTo(rtLBtn.left + rtLBtn.Width() / 3 * 2,
422 rtLBtn.top + rtLBtn.height / 4);
423 path.LineTo(rtLBtn.left + rtLBtn.Width() / 3, rtLBtn.top + rtLBtn.height / 2);
424 path.LineTo(rtLBtn.left + rtLBtn.Width() / 3 * 2,
425 rtLBtn.bottom() - rtLBtn.height / 4);
426 CFX_Color clrFlag(ArgbEncode(0xff, 50, 104, 205));
427 pParams->m_pGraphics->SetStrokeColor(&clrFlag);
428 pParams->m_pGraphics->StrokePath(&path, pMatrix);
429 pParams->m_pGraphics->RestoreGraphState();
430 return TRUE;
431 }
432 FX_BOOL CFWL_MonthCalendarTP::DrawRButton(CFWL_ThemeBackground* pParams,
433 CFX_Matrix* pMatrix) {
434 CFX_Path path;
435 path.Create();
436 CFX_RectF rtRBtn;
437 rtRBtn = pParams->m_rtPart;
438 path.AddRectangle(rtRBtn.left, rtRBtn.top, rtRBtn.width, rtRBtn.height);
439 pParams->m_pGraphics->SaveGraphState();
440 CFX_Color clrRBtnEdge(ArgbEncode(0xff, 205, 219, 243));
441 pParams->m_pGraphics->SetStrokeColor(&clrRBtnEdge);
442 pParams->m_pGraphics->StrokePath(&path, pMatrix);
443 if ((pParams->m_dwStates & FWL_PARTSTATE_MCD_Pressed) ==
444 FWL_PARTSTATE_MCD_Pressed) {
445 CFX_Color clrRBtnFill(ArgbEncode(0xff, 174, 198, 242));
446 pParams->m_pGraphics->SetFillColor(&clrRBtnFill);
447 pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
448 } else {
449 CFX_Color clrRBtnFill(ArgbEncode(0xff, 227, 235, 249));
450 pParams->m_pGraphics->SetFillColor(&clrRBtnFill);
451 pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
452 }
453 path.Clear();
454 path.MoveTo(rtRBtn.left + rtRBtn.Width() / 3, rtRBtn.top + rtRBtn.height / 4);
455 path.LineTo(rtRBtn.left + rtRBtn.Width() / 3 * 2,
456 rtRBtn.top + rtRBtn.height / 2);
457 path.LineTo(rtRBtn.left + rtRBtn.Width() / 3,
458 rtRBtn.bottom() - rtRBtn.height / 4);
459 CFX_Color clrFlag(ArgbEncode(0xff, 50, 104, 205));
460 pParams->m_pGraphics->SetStrokeColor(&clrFlag);
461 pParams->m_pGraphics->StrokePath(&path, pMatrix);
462 pParams->m_pGraphics->RestoreGraphState();
463 return TRUE;
464 }
465 FX_BOOL CFWL_MonthCalendarTP::DrawHSeperator(CFWL_ThemeBackground* pParams,
466 CFX_Matrix* pMatrix) {
467 CFX_Path path;
468 path.Create();
469 CFX_RectF rtHSep;
470 rtHSep = pParams->m_rtPart;
471 path.MoveTo(rtHSep.left, rtHSep.top + rtHSep.height / 2);
472 path.LineTo(rtHSep.right(), rtHSep.top + rtHSep.height / 2);
473 pParams->m_pGraphics->SaveGraphState();
474 CFX_Color clrHSep(m_pThemeData->clrSeperator);
475 pParams->m_pGraphics->SetStrokeColor(&clrHSep);
476 pParams->m_pGraphics->StrokePath(&path, pMatrix);
477 pParams->m_pGraphics->RestoreGraphState();
478 return TRUE;
479 }
480 FX_BOOL CFWL_MonthCalendarTP::DrawWeekNumSep(CFWL_ThemeBackground* pParams,
481 CFX_Matrix* pMatrix) {
482 CFX_Path path;
483 path.Create();
484 CFX_RectF rtWeekSep;
485 rtWeekSep = pParams->m_rtPart;
486 path.MoveTo(rtWeekSep.left, rtWeekSep.top);
487 path.LineTo(rtWeekSep.left, rtWeekSep.bottom());
488 pParams->m_pGraphics->SaveGraphState();
489 CFX_Color clrHSep(m_pThemeData->clrSeperator);
490 pParams->m_pGraphics->SetStrokeColor(&clrHSep);
491 pParams->m_pGraphics->StrokePath(&path, pMatrix);
492 pParams->m_pGraphics->RestoreGraphState();
493 return TRUE;
494 }
495 FX_BOOL CFWL_MonthCalendarTP::DrawDatesInBK(CFWL_ThemeBackground* pParams,
496 CFX_Matrix* pMatrix) {
497 pParams->m_pGraphics->SaveGraphState();
498 if (pParams->m_dwStates & FWL_PARTSTATE_MCD_Selected) {
499 CFX_Path path;
500 path.Create();
501 CFX_RectF rtSelDay;
502 rtSelDay = pParams->m_rtPart;
503 path.AddRectangle(rtSelDay.left, rtSelDay.top, rtSelDay.width,
504 rtSelDay.height);
505 CFX_Color clrSelDayBK;
506 clrSelDayBK = m_pThemeData->clrDatesSelectedBK;
507 pParams->m_pGraphics->SetFillColor(&clrSelDayBK);
508 pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
509 } else if (pParams->m_dwStates & FWL_PARTSTATE_MCD_Hovered) {
510 CFX_Path path;
511 path.Create();
512 CFX_RectF rtSelDay;
513 rtSelDay = pParams->m_rtPart;
514 path.AddRectangle(rtSelDay.left, rtSelDay.top, rtSelDay.width,
515 rtSelDay.height);
516 CFX_Color clrSelDayBK;
517 clrSelDayBK = m_pThemeData->clrDatesHoverBK;
518 pParams->m_pGraphics->SetFillColor(&clrSelDayBK);
519 pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
520 }
521 pParams->m_pGraphics->RestoreGraphState();
522 return FALSE;
523 }
524 FX_BOOL CFWL_MonthCalendarTP::DrawDatesInCircle(CFWL_ThemeBackground* pParams,
525 CFX_Matrix* pMatrix) {
526 CFX_Path path;
527 path.Create();
528 CFX_RectF rtSelDay;
529 rtSelDay = pParams->m_rtPart;
530 path.AddRectangle(rtSelDay.left, rtSelDay.top, rtSelDay.width,
531 rtSelDay.height);
532 pParams->m_pGraphics->SaveGraphState();
533 CFX_Color clrSelDayBK;
534 clrSelDayBK = m_pThemeData->clrDatesCircle;
535 pParams->m_pGraphics->SetStrokeColor(&clrSelDayBK);
536 pParams->m_pGraphics->StrokePath(&path, pMatrix);
537 pParams->m_pGraphics->RestoreGraphState();
538 return TRUE;
539 }
540 FX_BOOL CFWL_MonthCalendarTP::DrawTodayCircle(CFWL_ThemeBackground* pParams,
541 CFX_Matrix* pMatrix) {
542 CFX_Path path;
543 path.Create();
544 CFX_RectF rtTodayCircle;
545 rtTodayCircle = pParams->m_rtPart;
546 path.AddRectangle(rtTodayCircle.left, rtTodayCircle.top, rtTodayCircle.width,
547 rtTodayCircle.height);
548 pParams->m_pGraphics->SaveGraphState();
549 CFX_Color clrTodayCircle;
550 clrTodayCircle = m_pThemeData->clrDatesCircle;
551 pParams->m_pGraphics->SetStrokeColor(&clrTodayCircle);
552 pParams->m_pGraphics->StrokePath(&path, pMatrix);
553 pParams->m_pGraphics->RestoreGraphState();
554 return TRUE;
555 }
556 FWLTHEME_STATE CFWL_MonthCalendarTP::GetState(FX_DWORD dwFWLStates) {
557 if (dwFWLStates & FWL_PARTSTATE_MCD_Hovered) {
558 return FWLTHEME_STATE_Hover;
559 } else if (dwFWLStates & FWL_PARTSTATE_MCD_Pressed) {
560 return FWLTHEME_STATE_Pressed;
561 }
562 return FWLTHEME_STATE_Normal;
563 }
564 void CFWL_MonthCalendarTP::SetThemeData(FX_DWORD dwThemeID) {
565 if (dwThemeID == 0) {
566 m_pThemeData->clrCaption = ArgbEncode(0xff, 0, 153, 255);
567 m_pThemeData->clrSeperator = ArgbEncode(0xff, 141, 161, 239);
568 m_pThemeData->clrDatesHoverBK = ArgbEncode(0xff, 193, 211, 251);
569 m_pThemeData->clrDatesSelectedBK = ArgbEncode(0xff, 173, 188, 239);
570 m_pThemeData->clrDatesCircle = ArgbEncode(0xff, 103, 144, 209);
571 m_pThemeData->clrToday = ArgbEncode(0xff, 0, 0, 0);
572 m_pThemeData->clrBK = ArgbEncode(0xff, 255, 255, 255);
573 } else {
574 m_pThemeData->clrCaption = ArgbEncode(0xff, 128, 128, 0);
575 m_pThemeData->clrSeperator = ArgbEncode(0xff, 128, 128, 64);
576 m_pThemeData->clrDatesHoverBK = ArgbEncode(0xff, 217, 220, 191);
577 m_pThemeData->clrDatesSelectedBK = ArgbEncode(0xff, 204, 208, 183);
578 m_pThemeData->clrDatesCircle = ArgbEncode(0xff, 128, 128, 0);
579 m_pThemeData->clrToday = ArgbEncode(0xff, 0, 0, 0);
580 m_pThemeData->clrBK = ArgbEncode(0xff, 255, 255, 255);
581 }
582 }
OLDNEW
« no previous file with comments | « xfa/src/fwl/theme/listboxtp.cpp ('k') | xfa/src/fwl/theme/pictureboxtp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698