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

Side by Side Diff: xfa/fxfa/app/xfa_fwltheme.cpp

Issue 1946213003: Remove CLASSHASH defines in favour of an enum class. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 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/fxfa/app/xfa_fwltheme.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/fxfa/app/xfa_fwltheme.h" 7 #include "xfa/fxfa/app/xfa_fwltheme.h"
8 8
9 #include "xfa/fde/tto/fde_textout.h" 9 #include "xfa/fde/tto/fde_textout.h"
10 #include "xfa/fgas/crt/fgas_codepage.h" 10 #include "xfa/fgas/crt/fgas_codepage.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 m_pTextOut->Release(); 102 m_pTextOut->Release();
103 m_pTextOut = NULL; 103 m_pTextOut = NULL;
104 } 104 }
105 if (m_pCalendarFont) { 105 if (m_pCalendarFont) {
106 m_pCalendarFont->Release(); 106 m_pCalendarFont->Release();
107 m_pCalendarFont = NULL; 107 m_pCalendarFont = NULL;
108 } 108 }
109 FWLTHEME_Release(); 109 FWLTHEME_Release();
110 return FWL_Error::Succeeded; 110 return FWL_Error::Succeeded;
111 } 111 }
112 FX_BOOL CXFA_FWLTheme::IsValidWidget(IFWL_Widget* pWidget) { 112
113 bool CXFA_FWLTheme::IsValidWidget(IFWL_Widget* pWidget) {
113 return TRUE; 114 return TRUE;
114 } 115 }
116
115 uint32_t CXFA_FWLTheme::GetThemeID(IFWL_Widget* pWidget) { 117 uint32_t CXFA_FWLTheme::GetThemeID(IFWL_Widget* pWidget) {
116 return 0; 118 return 0;
117 } 119 }
120
118 uint32_t CXFA_FWLTheme::SetThemeID(IFWL_Widget* pWidget, 121 uint32_t CXFA_FWLTheme::SetThemeID(IFWL_Widget* pWidget,
119 uint32_t dwThemeID, 122 uint32_t dwThemeID,
120 FX_BOOL bChildren) { 123 FX_BOOL bChildren) {
121 return 0; 124 return 0;
122 } 125 }
126
123 FX_BOOL CXFA_FWLTheme::DrawBackground(CFWL_ThemeBackground* pParams) { 127 FX_BOOL CXFA_FWLTheme::DrawBackground(CFWL_ThemeBackground* pParams) {
124 return GetTheme(pParams->m_pWidget)->DrawBackground(pParams); 128 return GetTheme(pParams->m_pWidget)->DrawBackground(pParams);
125 } 129 }
126 FX_BOOL CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { 130 FX_BOOL CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) {
127 if (pParams->m_wsText.IsEmpty()) 131 if (pParams->m_wsText.IsEmpty())
128 return FALSE; 132 return FALSE;
129 133
130 if (pParams->m_pWidget->GetClassID() == FWL_CLASSHASH_MonthCalendar) { 134 if (pParams->m_pWidget->GetClassID() == FWL_Type::MonthCalendar) {
131 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); 135 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget);
132 if (!pWidget) 136 if (!pWidget)
133 return FALSE; 137 return FALSE;
134 138
135 m_pTextOut->SetStyles(pParams->m_dwTTOStyles); 139 m_pTextOut->SetStyles(pParams->m_dwTTOStyles);
136 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); 140 m_pTextOut->SetAlignment(pParams->m_iTTOAlign);
137 m_pTextOut->SetFont(m_pCalendarFont); 141 m_pTextOut->SetFont(m_pCalendarFont);
138 m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize); 142 m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize);
139 m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor); 143 m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor);
140 if ((pParams->m_iPart == CFWL_Part::DatesIn) && 144 if ((pParams->m_iPart == CFWL_Part::DatesIn) &&
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 m_SizeAboveBelow.y = para.GetSpaceBelow(); 262 m_SizeAboveBelow.y = para.GetSpaceBelow();
259 } 263 }
260 } 264 }
261 return &m_SizeAboveBelow; 265 return &m_SizeAboveBelow;
262 } break; 266 } break;
263 default: 267 default:
264 break; 268 break;
265 } 269 }
266 270
267 int dwCapValue = static_cast<int>(dwCapacity); 271 int dwCapValue = static_cast<int>(dwCapacity);
268 if (pThemePart->m_pWidget->GetClassID() == FWL_CLASSHASH_MonthCalendar && 272 if (pThemePart->m_pWidget->GetClassID() == FWL_Type::MonthCalendar &&
269 dwCapValue >= static_cast<int>(CFWL_WidgetCapacity::Today) && 273 dwCapValue >= static_cast<int>(CFWL_WidgetCapacity::Today) &&
270 dwCapValue <= static_cast<int>(CFWL_WidgetCapacity::December)) { 274 dwCapValue <= static_cast<int>(CFWL_WidgetCapacity::December)) {
271 if (CXFA_FFWidget* pWidget = 275 if (CXFA_FFWidget* pWidget =
272 XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { 276 XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) {
273 IXFA_AppProvider* pAppProvider = pWidget->GetAppProvider(); 277 IXFA_AppProvider* pAppProvider = pWidget->GetAppProvider();
274 m_wsResource.clear(); 278 m_wsResource.clear();
275 switch (dwCapacity) { 279 switch (dwCapacity) {
276 case CFWL_WidgetCapacity::Sun: 280 case CFWL_WidgetCapacity::Sun:
277 pAppProvider->LoadString(XFA_IDS_StringWeekDay_Sun, m_wsResource); 281 pAppProvider->LoadString(XFA_IDS_StringWeekDay_Sun, m_wsResource);
278 break; 282 break;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 FWL_Error CXFA_FWLTheme::GetPartRect(CFWL_ThemePart* pThemePart) { 352 FWL_Error CXFA_FWLTheme::GetPartRect(CFWL_ThemePart* pThemePart) {
349 CFX_RectF rect; 353 CFX_RectF rect;
350 return GetTheme(pThemePart->m_pWidget)->GetPartRect(pThemePart, rect); 354 return GetTheme(pThemePart->m_pWidget)->GetPartRect(pThemePart, rect);
351 } 355 }
352 FX_BOOL CXFA_FWLTheme::IsInPart(CFWL_ThemePart* pThemePart, 356 FX_BOOL CXFA_FWLTheme::IsInPart(CFWL_ThemePart* pThemePart,
353 FX_FLOAT fx, 357 FX_FLOAT fx,
354 FX_FLOAT fy) { 358 FX_FLOAT fy) {
355 return GetTheme(pThemePart->m_pWidget)->IsInPart(pThemePart, fx, fy); 359 return GetTheme(pThemePart->m_pWidget)->IsInPart(pThemePart, fx, fy);
356 } 360 }
357 FX_BOOL CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { 361 FX_BOOL CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) {
358 if (pParams->m_pWidget->GetClassID() == FWL_CLASSHASH_MonthCalendar) { 362 if (pParams->m_pWidget->GetClassID() == FWL_Type::MonthCalendar) {
359 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); 363 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget);
360 if (!pWidget) 364 if (!pWidget)
361 return FALSE; 365 return FALSE;
362 if (!pParams) 366 if (!pParams)
363 return FALSE; 367 return FALSE;
364 if (!m_pTextOut) 368 if (!m_pTextOut)
365 return FALSE; 369 return FALSE;
366 m_pTextOut->SetFont(m_pCalendarFont); 370 m_pTextOut->SetFont(m_pCalendarFont);
367 m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize); 371 m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize);
368 m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor); 372 m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor);
(...skipping 16 matching lines...) Expand all
385 if (!m_pTextOut) 389 if (!m_pTextOut)
386 return FALSE; 390 return FALSE;
387 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); 391 m_pTextOut->SetAlignment(pParams->m_iTTOAlign);
388 m_pTextOut->SetStyles(pParams->m_dwTTOStyles); 392 m_pTextOut->SetStyles(pParams->m_dwTTOStyles);
389 m_pTextOut->CalcLogicSize(pParams->m_wsText.c_str(), 393 m_pTextOut->CalcLogicSize(pParams->m_wsText.c_str(),
390 pParams->m_wsText.GetLength(), rect); 394 pParams->m_wsText.GetLength(), rect);
391 return TRUE; 395 return TRUE;
392 } 396 }
393 CFWL_WidgetTP* CXFA_FWLTheme::GetTheme(IFWL_Widget* pWidget) { 397 CFWL_WidgetTP* CXFA_FWLTheme::GetTheme(IFWL_Widget* pWidget) {
394 switch (pWidget->GetClassID()) { 398 switch (pWidget->GetClassID()) {
395 case FWL_CLASSHASH_CheckBox: 399 case FWL_Type::CheckBox:
396 return m_pCheckBoxTP; 400 return m_pCheckBoxTP;
397 case FWL_CLASSHASH_ListBox: 401 case FWL_Type::ListBox:
398 return m_pListBoxTP; 402 return m_pListBoxTP;
399 case FWL_CLASSHASH_PictureBox: 403 case FWL_Type::PictureBox:
400 return m_pPictureBoxTP; 404 return m_pPictureBoxTP;
401 case FWL_CLASSHASH_ScrollBar: 405 case FWL_Type::ScrollBar:
402 return m_pSrollBarTP; 406 return m_pSrollBarTP;
403 case FWL_CLASSHASH_Edit: 407 case FWL_Type::Edit:
404 return m_pEditTP; 408 return m_pEditTP;
405 case FWL_CLASSHASH_ComboBox: 409 case FWL_Type::ComboBox:
406 return m_pComboBoxTP; 410 return m_pComboBoxTP;
407 case FWL_CLASSHASH_MonthCalendar: 411 case FWL_Type::MonthCalendar:
408 return m_pMonthCalendarTP; 412 return m_pMonthCalendarTP;
409 case FWL_CLASSHASH_DateTimePicker: 413 case FWL_Type::DateTimePicker:
410 return m_pDateTimePickerTP; 414 return m_pDateTimePickerTP;
411 case FWL_CLASSHASH_PushButton: 415 case FWL_Type::PushButton:
412 return m_pPushButtonTP; 416 return m_pPushButtonTP;
413 case FWL_CLASSHASH_Caret: 417 case FWL_Type::Caret:
414 return m_pCaretTP; 418 return m_pCaretTP;
415 case FWL_CLASSHASH_Barcode: 419 case FWL_Type::Barcode:
416 return m_pBarcodeTP; 420 return m_pBarcodeTP;
417 default: 421 default:
418 break; 422 return nullptr;
419 } 423 }
420 return NULL;
421 } 424 }
422 CXFA_FWLCheckBoxTP::CXFA_FWLCheckBoxTP() {} 425 CXFA_FWLCheckBoxTP::CXFA_FWLCheckBoxTP() {}
423 FX_BOOL CXFA_FWLCheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { 426 FX_BOOL CXFA_FWLCheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) {
424 if (pParams->m_iPart != CFWL_Part::CheckBox) { 427 if (pParams->m_iPart != CFWL_Part::CheckBox) {
425 return TRUE; 428 return TRUE;
426 } 429 }
427 if ((pParams->m_dwStates & CFWL_PartState_Checked) || 430 if ((pParams->m_dwStates & CFWL_PartState_Checked) ||
428 (pParams->m_dwStates & CFWL_PartState_Neutral)) { 431 (pParams->m_dwStates & CFWL_PartState_Neutral)) {
429 DrawCheckSign(pParams->m_pWidget, pParams->m_pGraphics, &pParams->m_rtPart, 432 DrawCheckSign(pParams->m_pWidget, pParams->m_pGraphics, &pParams->m_rtPart,
430 pParams->m_dwStates, &pParams->m_matrix); 433 pParams->m_dwStates, &pParams->m_matrix);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 } 486 }
484 } 487 }
485 CFX_Color crLine(cr); 488 CFX_Color crLine(cr);
486 pParams->m_pGraphics->SetStrokeColor(&crLine); 489 pParams->m_pGraphics->SetStrokeColor(&crLine);
487 pParams->m_pGraphics->SetLineWidth(fWidth); 490 pParams->m_pGraphics->SetLineWidth(fWidth);
488 pParams->m_pGraphics->StrokePath(pParams->m_pPath, &pParams->m_matrix); 491 pParams->m_pGraphics->StrokePath(pParams->m_pPath, &pParams->m_matrix);
489 return TRUE; 492 return TRUE;
490 } 493 }
491 return CFWL_EditTP::DrawBackground(pParams); 494 return CFWL_EditTP::DrawBackground(pParams);
492 } 495 }
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_fwltheme.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698