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

Side by Side Diff: xfa/fwl/theme/cfwl_widgettp.cpp

Issue 2524173002: Merge IFWL and CFWL classes. (Closed)
Patch Set: make chrome build happy Created 4 years 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
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/fwl/theme/cfwl_widgettp.h" 7 #include "xfa/fwl/theme/cfwl_widgettp.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
11 11
12 #include "xfa/fde/tto/fde_textout.h" 12 #include "xfa/fde/tto/fde_textout.h"
13 #include "xfa/fgas/font/cfgas_fontmgr.h" 13 #include "xfa/fgas/font/cfgas_fontmgr.h"
14 #include "xfa/fgas/font/cfgas_gefont.h" 14 #include "xfa/fgas/font/cfgas_gefont.h"
15 #include "xfa/fwl/core/cfwl_themebackground.h" 15 #include "xfa/fwl/core/cfwl_themebackground.h"
16 #include "xfa/fwl/core/cfwl_themepart.h" 16 #include "xfa/fwl/core/cfwl_themepart.h"
17 #include "xfa/fwl/core/cfwl_themetext.h" 17 #include "xfa/fwl/core/cfwl_themetext.h"
18 #include "xfa/fwl/core/cfwl_widget.h"
18 #include "xfa/fwl/core/cfwl_widgetmgr.h" 19 #include "xfa/fwl/core/cfwl_widgetmgr.h"
19 #include "xfa/fwl/core/ifwl_themeprovider.h" 20 #include "xfa/fwl/core/ifwl_themeprovider.h"
20 #include "xfa/fwl/core/ifwl_widget.h"
21 #include "xfa/fwl/theme/cfwl_arrowdata.h" 21 #include "xfa/fwl/theme/cfwl_arrowdata.h"
22 #include "xfa/fxgraphics/cfx_color.h" 22 #include "xfa/fxgraphics/cfx_color.h"
23 #include "xfa/fxgraphics/cfx_path.h" 23 #include "xfa/fxgraphics/cfx_path.h"
24 #include "xfa/fxgraphics/cfx_shading.h" 24 #include "xfa/fxgraphics/cfx_shading.h"
25 25
26 namespace { 26 namespace {
27 27
28 const float kEdgeFlat = 2.0f; 28 const float kEdgeFlat = 2.0f;
29 const float kEdgeRaised = 2.0f; 29 const float kEdgeRaised = 2.0f;
30 const float kEdgeSunken = 2.0f; 30 const float kEdgeSunken = 2.0f;
31 const float kLineHeight = 12.0f; 31 const float kLineHeight = 12.0f;
32 const float kScrollBarWidth = 17.0f; 32 const float kScrollBarWidth = 17.0f;
33 const float kCXBorder = 1.0f; 33 const float kCXBorder = 1.0f;
34 const float kCYBorder = 1.0f; 34 const float kCYBorder = 1.0f;
35 35
36 #define FWLTHEME_CAPACITY_TextSelColor (ArgbEncode(255, 153, 193, 218)) 36 #define FWLTHEME_CAPACITY_TextSelColor (ArgbEncode(255, 153, 193, 218))
37 37
38 } // namespace 38 } // namespace
39 39
40 bool CFWL_WidgetTP::IsValidWidget(IFWL_Widget* pWidget) { 40 bool CFWL_WidgetTP::IsValidWidget(CFWL_Widget* pWidget) {
41 return false; 41 return false;
42 } 42 }
43 43
44 void CFWL_WidgetTP::DrawBackground(CFWL_ThemeBackground* pParams) {} 44 void CFWL_WidgetTP::DrawBackground(CFWL_ThemeBackground* pParams) {}
45 45
46 void CFWL_WidgetTP::DrawText(CFWL_ThemeText* pParams) { 46 void CFWL_WidgetTP::DrawText(CFWL_ThemeText* pParams) {
47 if (!m_pTextOut) 47 if (!m_pTextOut)
48 InitTTO(); 48 InitTTO();
49 49
50 int32_t iLen = pParams->m_wsText.GetLength(); 50 int32_t iLen = pParams->m_wsText.GetLength();
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 void CFWL_WidgetTP::Initialize() {} 130 void CFWL_WidgetTP::Initialize() {}
131 131
132 void CFWL_WidgetTP::Finalize() { 132 void CFWL_WidgetTP::Finalize() {
133 if (!m_pTextOut) 133 if (!m_pTextOut)
134 FinalizeTTO(); 134 FinalizeTTO();
135 } 135 }
136 136
137 CFWL_WidgetTP::~CFWL_WidgetTP() {} 137 CFWL_WidgetTP::~CFWL_WidgetTP() {}
138 138
139 void CFWL_WidgetTP::SetFont(IFWL_Widget* pWidget, 139 void CFWL_WidgetTP::SetFont(CFWL_Widget* pWidget,
140 const FX_WCHAR* strFont, 140 const FX_WCHAR* strFont,
141 FX_FLOAT fFontSize, 141 FX_FLOAT fFontSize,
142 FX_ARGB rgbFont) { 142 FX_ARGB rgbFont) {
143 if (!m_pTextOut) 143 if (!m_pTextOut)
144 return; 144 return;
145 145
146 m_pFDEFont = CFWL_FontManager::GetInstance()->FindFont(strFont, 0, 0); 146 m_pFDEFont = CFWL_FontManager::GetInstance()->FindFont(strFont, 0, 0);
147 m_pTextOut->SetFont(m_pFDEFont); 147 m_pTextOut->SetFont(m_pFDEFont);
148 m_pTextOut->SetFontSize(fFontSize); 148 m_pTextOut->SetFontSize(fFontSize);
149 m_pTextOut->SetTextColor(rgbFont); 149 m_pTextOut->SetTextColor(rgbFont);
150 } 150 }
151 151
152 void CFWL_WidgetTP::SetFont(IFWL_Widget* pWidget, 152 void CFWL_WidgetTP::SetFont(CFWL_Widget* pWidget,
153 CFGAS_GEFont* pFont, 153 CFGAS_GEFont* pFont,
154 FX_FLOAT fFontSize, 154 FX_FLOAT fFontSize,
155 FX_ARGB rgbFont) { 155 FX_ARGB rgbFont) {
156 if (!m_pTextOut) 156 if (!m_pTextOut)
157 return; 157 return;
158 158
159 m_pTextOut->SetFont(pFont); 159 m_pTextOut->SetFont(pFont);
160 m_pTextOut->SetFontSize(fFontSize); 160 m_pTextOut->SetFontSize(fFontSize);
161 m_pTextOut->SetTextColor(rgbFont); 161 m_pTextOut->SetTextColor(rgbFont);
162 } 162 }
163 163
164 CFGAS_GEFont* CFWL_WidgetTP::GetFont(IFWL_Widget* pWidget) { 164 CFGAS_GEFont* CFWL_WidgetTP::GetFont(CFWL_Widget* pWidget) {
165 return m_pFDEFont; 165 return m_pFDEFont;
166 } 166 }
167 167
168 CFWL_WidgetTP::CFWL_WidgetTP() : m_dwRefCount(1), m_pFDEFont(nullptr) {} 168 CFWL_WidgetTP::CFWL_WidgetTP() : m_dwRefCount(1), m_pFDEFont(nullptr) {}
169 169
170 void CFWL_WidgetTP::InitTTO() { 170 void CFWL_WidgetTP::InitTTO() {
171 if (m_pTextOut) 171 if (m_pTextOut)
172 return; 172 return;
173 173
174 m_pFDEFont = 174 m_pFDEFont =
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 if (!pFontData->LoadFont(wsFontFamily, dwFontStyles, wCodePage)) 677 if (!pFontData->LoadFont(wsFontFamily, dwFontStyles, wCodePage))
678 return nullptr; 678 return nullptr;
679 m_FontsArray.push_back(std::move(pFontData)); 679 m_FontsArray.push_back(std::move(pFontData));
680 return m_FontsArray.back()->GetFont(); 680 return m_FontsArray.back()->GetFont();
681 } 681 }
682 682
683 void FWLTHEME_Release() { 683 void FWLTHEME_Release() {
684 CFWL_ArrowData::DestroyInstance(); 684 CFWL_ArrowData::DestroyInstance();
685 CFWL_FontManager::DestroyInstance(); 685 CFWL_FontManager::DestroyInstance();
686 } 686 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698