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

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

Issue 2418413005: Remove FWL theme subclasses (Closed)
Patch Set: Review fixes 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/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 26 matching lines...) Expand all
37 CXFA_FFWidget* XFA_ThemeGetOuterWidget(IFWL_Widget* pWidget) { 37 CXFA_FFWidget* XFA_ThemeGetOuterWidget(IFWL_Widget* pWidget) {
38 IFWL_Widget* pOuter = pWidget; 38 IFWL_Widget* pOuter = pWidget;
39 while (pOuter && pOuter->GetOuter()) 39 while (pOuter && pOuter->GetOuter())
40 pOuter = pOuter->GetOuter(); 40 pOuter = pOuter->GetOuter();
41 41
42 return pOuter ? static_cast<CXFA_FFWidget*>(pOuter->GetLayoutItem()) 42 return pOuter ? static_cast<CXFA_FFWidget*>(pOuter->GetLayoutItem())
43 : nullptr; 43 : nullptr;
44 } 44 }
45 45
46 CXFA_FWLTheme::CXFA_FWLTheme(CXFA_FFApp* pApp) 46 CXFA_FWLTheme::CXFA_FWLTheme(CXFA_FFApp* pApp)
47 : m_pCheckBoxTP(new CXFA_FWLCheckBoxTP), 47 : m_pCheckBoxTP(new CFWL_CheckBoxTP),
48 m_pListBoxTP(new CFWL_ListBoxTP), 48 m_pListBoxTP(new CFWL_ListBoxTP),
49 m_pPictureBoxTP(new CFWL_PictureBoxTP), 49 m_pPictureBoxTP(new CFWL_PictureBoxTP),
50 m_pSrollBarTP(new CFWL_ScrollBarTP), 50 m_pSrollBarTP(new CFWL_ScrollBarTP),
51 m_pEditTP(new CXFA_FWLEditTP), 51 m_pEditTP(new CFWL_EditTP),
52 m_pComboBoxTP(new CFWL_ComboBoxTP), 52 m_pComboBoxTP(new CFWL_ComboBoxTP),
53 m_pMonthCalendarTP(new CFWL_MonthCalendarTP), 53 m_pMonthCalendarTP(new CFWL_MonthCalendarTP),
54 m_pDateTimePickerTP(new CFWL_DateTimePickerTP), 54 m_pDateTimePickerTP(new CFWL_DateTimePickerTP),
55 m_pPushButtonTP(new CFWL_PushButtonTP), 55 m_pPushButtonTP(new CFWL_PushButtonTP),
56 m_pCaretTP(new CFWL_CaretTP), 56 m_pCaretTP(new CFWL_CaretTP),
57 m_pBarcodeTP(new CFWL_BarcodeTP), 57 m_pBarcodeTP(new CFWL_BarcodeTP),
58 m_fCapacity(0.0f), 58 m_fCapacity(0.0f),
59 m_dwCapacity(0), 59 m_dwCapacity(0),
60 m_pCalendarFont(nullptr), 60 m_pCalendarFont(nullptr),
61 m_pApp(pApp) { 61 m_pApp(pApp) {
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 case FWL_Type::PushButton: 383 case FWL_Type::PushButton:
384 return m_pPushButtonTP.get(); 384 return m_pPushButtonTP.get();
385 case FWL_Type::Caret: 385 case FWL_Type::Caret:
386 return m_pCaretTP.get(); 386 return m_pCaretTP.get();
387 case FWL_Type::Barcode: 387 case FWL_Type::Barcode:
388 return m_pBarcodeTP.get(); 388 return m_pBarcodeTP.get();
389 default: 389 default:
390 return nullptr; 390 return nullptr;
391 } 391 }
392 } 392 }
393
394 CXFA_FWLCheckBoxTP::CXFA_FWLCheckBoxTP() {}
395
396 FX_BOOL CXFA_FWLCheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) {
397 if (pParams->m_iPart != CFWL_Part::CheckBox) {
398 return TRUE;
399 }
400 if ((pParams->m_dwStates & CFWL_PartState_Checked) ||
401 (pParams->m_dwStates & CFWL_PartState_Neutral)) {
402 DrawCheckSign(pParams->m_pWidget, pParams->m_pGraphics, &pParams->m_rtPart,
403 pParams->m_dwStates, &pParams->m_matrix);
404 }
405 return TRUE;
406 }
407
408 void CXFA_FWLCheckBoxTP::DrawCheckSign(IFWL_Widget* pWidget,
409 CFX_Graphics* pGraphics,
410 const CFX_RectF* pRtBox,
411 int32_t iState,
412 CFX_Matrix* pMatrix) {
413 CFX_RectF rtSign(*pRtBox);
414 uint32_t dwColor = 0xFF000000;
415 if (iState & CFWL_PartState_Neutral)
416 dwColor = 0xFFA9A9A9;
417
418 {
419 uint32_t dwStyle = pWidget->GetStylesEx();
420 rtSign.Deflate(rtSign.width / 4, rtSign.height / 4);
421 switch (dwStyle & FWL_STYLEEXT_CKB_SignShapeMask) {
422 case FWL_STYLEEXT_CKB_SignShapeCheck:
423 DrawSignCheck(pGraphics, &rtSign, dwColor, pMatrix);
424 break;
425 case FWL_STYLEEXT_CKB_SignShapeCircle:
426 DrawSignCircle(pGraphics, &rtSign, dwColor, pMatrix);
427 break;
428 case FWL_STYLEEXT_CKB_SignShapeCross:
429 DrawSignCross(pGraphics, &rtSign, dwColor, pMatrix);
430 break;
431 case FWL_STYLEEXT_CKB_SignShapeDiamond:
432 DrawSignDiamond(pGraphics, &rtSign, dwColor, pMatrix);
433 break;
434 case FWL_STYLEEXT_CKB_SignShapeSquare:
435 DrawSignSquare(pGraphics, &rtSign, dwColor, pMatrix);
436 break;
437 case FWL_STYLEEXT_CKB_SignShapeStar:
438 DrawSignStar(pGraphics, &rtSign, dwColor, pMatrix);
439 break;
440 default:
441 break;
442 }
443 }
444 }
445
446 CXFA_FWLEditTP::CXFA_FWLEditTP() {}
447
448 CXFA_FWLEditTP::~CXFA_FWLEditTP() {}
449
450 FX_BOOL CXFA_FWLEditTP::DrawBackground(CFWL_ThemeBackground* pParams) {
451 if (CFWL_Part::CombTextLine == pParams->m_iPart) {
452 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget);
453 FX_ARGB cr = 0xFF000000;
454 FX_FLOAT fWidth = 1.0f;
455 if (CXFA_Border borderUI = pWidget->GetDataAcc()->GetUIBorder()) {
456 CXFA_Edge edge = borderUI.GetEdge(0);
457 if (edge) {
458 cr = edge.GetColor();
459 fWidth = edge.GetThickness();
460 }
461 }
462 CFX_Color crLine(cr);
463 pParams->m_pGraphics->SetStrokeColor(&crLine);
464 pParams->m_pGraphics->SetLineWidth(fWidth);
465 pParams->m_pGraphics->StrokePath(pParams->m_pPath, &pParams->m_matrix);
466 return TRUE;
467 }
468 return CFWL_EditTP::DrawBackground(pParams);
469 }
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