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/theme/cfwl_edittp.h" | 7 #include "xfa/fwl/theme/cfwl_edittp.h" |
8 | 8 |
9 #include "xfa/fwl/core/cfwl_themebackground.h" | 9 #include "xfa/fwl/core/cfwl_themebackground.h" |
10 #include "xfa/fwl/core/ifwl_edit.h" | 10 #include "xfa/fwl/core/ifwl_edit.h" |
11 #include "xfa/fwl/core/ifwl_widget.h" | 11 #include "xfa/fwl/core/ifwl_widget.h" |
12 #include "xfa/fxfa/app/xfa_fwltheme.h" | 12 #include "xfa/fxfa/app/xfa_fwltheme.h" |
13 #include "xfa/fxfa/xfa_ffwidget.h" | 13 #include "xfa/fxfa/xfa_ffwidget.h" |
14 #include "xfa/fxgraphics/cfx_color.h" | 14 #include "xfa/fxgraphics/cfx_color.h" |
15 #include "xfa/fxgraphics/cfx_path.h" | 15 #include "xfa/fxgraphics/cfx_path.h" |
16 | 16 |
17 CFWL_EditTP::CFWL_EditTP() {} | 17 CFWL_EditTP::CFWL_EditTP() {} |
18 CFWL_EditTP::~CFWL_EditTP() {} | 18 CFWL_EditTP::~CFWL_EditTP() {} |
19 | 19 |
20 bool CFWL_EditTP::IsValidWidget(IFWL_Widget* pWidget) { | 20 bool CFWL_EditTP::IsValidWidget(IFWL_Widget* pWidget) { |
21 return pWidget && pWidget->GetClassID() == FWL_Type::Edit; | 21 return pWidget && pWidget->GetClassID() == FWL_Type::Edit; |
22 } | 22 } |
23 | 23 |
24 FX_BOOL CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) { | 24 void CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) { |
25 if (CFWL_Part::CombTextLine == pParams->m_iPart) { | 25 if (CFWL_Part::CombTextLine == pParams->m_iPart) { |
26 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); | 26 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); |
27 FX_ARGB cr = 0xFF000000; | 27 FX_ARGB cr = 0xFF000000; |
28 FX_FLOAT fWidth = 1.0f; | 28 FX_FLOAT fWidth = 1.0f; |
29 if (CXFA_Border borderUI = pWidget->GetDataAcc()->GetUIBorder()) { | 29 if (CXFA_Border borderUI = pWidget->GetDataAcc()->GetUIBorder()) { |
30 CXFA_Edge edge = borderUI.GetEdge(0); | 30 CXFA_Edge edge = borderUI.GetEdge(0); |
31 if (edge) { | 31 if (edge) { |
32 cr = edge.GetColor(); | 32 cr = edge.GetColor(); |
33 fWidth = edge.GetThickness(); | 33 fWidth = edge.GetThickness(); |
34 } | 34 } |
35 } | 35 } |
36 CFX_Color crLine(cr); | 36 CFX_Color crLine(cr); |
37 pParams->m_pGraphics->SetStrokeColor(&crLine); | 37 pParams->m_pGraphics->SetStrokeColor(&crLine); |
38 pParams->m_pGraphics->SetLineWidth(fWidth); | 38 pParams->m_pGraphics->SetLineWidth(fWidth); |
39 pParams->m_pGraphics->StrokePath(pParams->m_pPath, &pParams->m_matrix); | 39 pParams->m_pGraphics->StrokePath(pParams->m_pPath, &pParams->m_matrix); |
40 return TRUE; | 40 return; |
41 } | 41 } |
42 | 42 |
43 switch (pParams->m_iPart) { | 43 switch (pParams->m_iPart) { |
44 case CFWL_Part::Border: { | 44 case CFWL_Part::Border: { |
45 DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); | 45 DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); |
46 break; | 46 break; |
47 } | 47 } |
48 case CFWL_Part::Edge: { | 48 case CFWL_Part::Edge: { |
49 DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), | 49 DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), |
50 &pParams->m_rtPart, &pParams->m_matrix); | 50 &pParams->m_rtPart, &pParams->m_matrix); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 } | 85 } |
86 case CFWL_Part::CombTextLine: { | 86 case CFWL_Part::CombTextLine: { |
87 FX_ARGB cr = 0xFF000000; | 87 FX_ARGB cr = 0xFF000000; |
88 FX_FLOAT fWidth = 1.0f; | 88 FX_FLOAT fWidth = 1.0f; |
89 CFX_Color crLine(cr); | 89 CFX_Color crLine(cr); |
90 pParams->m_pGraphics->SetStrokeColor(&crLine); | 90 pParams->m_pGraphics->SetStrokeColor(&crLine); |
91 pParams->m_pGraphics->SetLineWidth(fWidth); | 91 pParams->m_pGraphics->SetLineWidth(fWidth); |
92 pParams->m_pGraphics->StrokePath(pParams->m_pPath, &pParams->m_matrix); | 92 pParams->m_pGraphics->StrokePath(pParams->m_pPath, &pParams->m_matrix); |
93 break; | 93 break; |
94 } | 94 } |
95 default: { break; } | 95 default: |
| 96 break; |
96 } | 97 } |
97 return TRUE; | |
98 } | 98 } |
99 FWL_Error CFWL_EditTP::Initialize() { | 99 |
| 100 void CFWL_EditTP::Initialize() { |
100 InitTTO(); | 101 InitTTO(); |
101 return CFWL_WidgetTP::Initialize(); | 102 CFWL_WidgetTP::Initialize(); |
102 } | 103 } |
103 FWL_Error CFWL_EditTP::Finalize() { | 104 |
| 105 void CFWL_EditTP::Finalize() { |
104 FinalizeTTO(); | 106 FinalizeTTO(); |
105 return CFWL_WidgetTP::Finalize(); | 107 CFWL_WidgetTP::Finalize(); |
106 } | 108 } |
OLD | NEW |