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

Side by Side Diff: xfa/fwl/lightwidget/cfwl_theme.cpp

Issue 2071953002: Remove unused code. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 6 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/fwl/lightwidget/cfwl_theme.h ('k') | xfa/fwl/lightwidget/cfwl_tooltip.h » ('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/fwl/lightwidget/cfwl_theme.h"
8
9 #include <algorithm>
10
11 #include "xfa/fwl/core/cfwl_themebackground.h"
12 #include "xfa/fwl/core/cfwl_themepart.h"
13 #include "xfa/fwl/core/cfwl_themetext.h"
14 #include "xfa/fwl/theme/cfwl_barcodetp.h"
15 #include "xfa/fwl/theme/cfwl_carettp.h"
16 #include "xfa/fwl/theme/cfwl_checkboxtp.h"
17 #include "xfa/fwl/theme/cfwl_comboboxtp.h"
18 #include "xfa/fwl/theme/cfwl_datetimepickertp.h"
19 #include "xfa/fwl/theme/cfwl_edittp.h"
20 #include "xfa/fwl/theme/cfwl_formtp.h"
21 #include "xfa/fwl/theme/cfwl_listboxtp.h"
22 #include "xfa/fwl/theme/cfwl_monthcalendartp.h"
23 #include "xfa/fwl/theme/cfwl_pictureboxtp.h"
24 #include "xfa/fwl/theme/cfwl_pushbuttontp.h"
25 #include "xfa/fwl/theme/cfwl_scrollbartp.h"
26
27 CFWL_Theme::CFWL_Theme() {
28 m_ThemesArray.push_back(std::unique_ptr<CFWL_WidgetTP>(new CFWL_FormTP));
29 m_ThemesArray.push_back(
30 std::unique_ptr<CFWL_WidgetTP>(new CFWL_PushButtonTP));
31 m_ThemesArray.push_back(std::unique_ptr<CFWL_WidgetTP>(new CFWL_CheckBoxTP));
32 m_ThemesArray.push_back(std::unique_ptr<CFWL_WidgetTP>(new CFWL_ListBoxTP));
33 m_ThemesArray.push_back(
34 std::unique_ptr<CFWL_WidgetTP>(new CFWL_PictureBoxTP));
35 m_ThemesArray.push_back(std::unique_ptr<CFWL_WidgetTP>(new CFWL_ScrollBarTP));
36 m_ThemesArray.push_back(std::unique_ptr<CFWL_WidgetTP>(new CFWL_EditTP));
37 m_ThemesArray.push_back(std::unique_ptr<CFWL_WidgetTP>(new CFWL_ComboBoxTP));
38 m_ThemesArray.push_back(std::unique_ptr<CFWL_WidgetTP>(new CFWL_BarcodeTP));
39 m_ThemesArray.push_back(
40 std::unique_ptr<CFWL_WidgetTP>(new CFWL_DateTimePickerTP));
41 m_ThemesArray.push_back(
42 std::unique_ptr<CFWL_WidgetTP>(new CFWL_MonthCalendarTP));
43 m_ThemesArray.push_back(std::unique_ptr<CFWL_WidgetTP>(new CFWL_CaretTP));
44 }
45
46 CFWL_Theme::~CFWL_Theme() {}
47
48 bool CFWL_Theme::IsValidWidget(IFWL_Widget* pWidget) {
49 return !!GetTheme(pWidget);
50 }
51
52 uint32_t CFWL_Theme::GetThemeID(IFWL_Widget* pWidget) {
53 return GetTheme(pWidget)->GetThemeID(pWidget);
54 }
55
56 uint32_t CFWL_Theme::SetThemeID(IFWL_Widget* pWidget,
57 uint32_t dwThemeID,
58 FX_BOOL bChildren) {
59 uint32_t dwID = 0;
60 for (const auto& pTheme : m_ThemesArray) {
61 dwID = pTheme->GetThemeID(pWidget);
62 pTheme->SetThemeID(pWidget, dwThemeID, FALSE);
63 }
64 return dwID;
65 }
66
67 FWL_Error CFWL_Theme::GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) {
68 return FWL_Error::Succeeded;
69 }
70
71 FWL_Error CFWL_Theme::SetThemeMatrix(IFWL_Widget* pWidget,
72 const CFX_Matrix& matrix) {
73 return FWL_Error::Succeeded;
74 }
75
76 FX_BOOL CFWL_Theme::DrawBackground(CFWL_ThemeBackground* pParams) {
77 return GetTheme(pParams->m_pWidget)->DrawBackground(pParams);
78 }
79
80 FX_BOOL CFWL_Theme::DrawText(CFWL_ThemeText* pParams) {
81 return GetTheme(pParams->m_pWidget)->DrawText(pParams);
82 }
83
84 void* CFWL_Theme::GetCapacity(CFWL_ThemePart* pThemePart,
85 CFWL_WidgetCapacity dwCapacity) {
86 return GetTheme(pThemePart->m_pWidget)->GetCapacity(pThemePart, dwCapacity);
87 }
88
89 FX_BOOL CFWL_Theme::IsCustomizedLayout(IFWL_Widget* pWidget) {
90 return GetTheme(pWidget)->IsCustomizedLayout(pWidget);
91 }
92
93 FWL_Error CFWL_Theme::GetPartRect(CFWL_ThemePart* pThemePart,
94 CFX_RectF& rtPart) {
95 return GetTheme(pThemePart->m_pWidget)->GetPartRect(pThemePart, rtPart);
96 }
97
98 FX_BOOL CFWL_Theme::IsInPart(CFWL_ThemePart* pThemePart,
99 FX_FLOAT fx,
100 FX_FLOAT fy) {
101 return GetTheme(pThemePart->m_pWidget)->IsInPart(pThemePart, fx, fy);
102 }
103
104 FX_BOOL CFWL_Theme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) {
105 return GetTheme(pParams->m_pWidget)->CalcTextRect(pParams, rect);
106 }
107
108 FWL_Error CFWL_Theme::Initialize() {
109 for (const auto& pTheme : m_ThemesArray)
110 pTheme->Initialize();
111
112 FWLTHEME_Init();
113 return FWL_Error::Succeeded;
114 }
115
116 FWL_Error CFWL_Theme::Finalize() {
117 for (const auto& pTheme : m_ThemesArray)
118 pTheme->Finalize();
119
120 FWLTHEME_Release();
121 return FWL_Error::Succeeded;
122 }
123
124 FWL_Error CFWL_Theme::SetFont(IFWL_Widget* pWidget,
125 const FX_WCHAR* strFont,
126 FX_FLOAT fFontSize,
127 FX_ARGB rgbFont) {
128 for (const auto& pTheme : m_ThemesArray)
129 pTheme->SetFont(pWidget, strFont, fFontSize, rgbFont);
130
131 return FWL_Error::Succeeded;
132 }
133
134 CFWL_WidgetTP* CFWL_Theme::GetTheme(IFWL_Widget* pWidget) {
135 for (const auto& pTheme : m_ThemesArray) {
136 if (pTheme->IsValidWidget(pWidget))
137 return pTheme.get();
138 }
139 return nullptr;
140 }
OLDNEW
« no previous file with comments | « xfa/fwl/lightwidget/cfwl_theme.h ('k') | xfa/fwl/lightwidget/cfwl_tooltip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698