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

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

Issue 1834323003: Move xfa/include/fwl/{theme,lightwidget} to xfa/fwl (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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
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/include/fwl/lightwidget/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/include/fwl/theme/barcodetp.h"
15 #include "xfa/include/fwl/theme/carettp.h"
16 #include "xfa/include/fwl/theme/checkboxtp.h"
17 #include "xfa/include/fwl/theme/comboboxtp.h"
18 #include "xfa/include/fwl/theme/datetimepickertp.h"
19 #include "xfa/include/fwl/theme/edittp.h"
20 #include "xfa/include/fwl/theme/formtp.h"
21 #include "xfa/include/fwl/theme/listboxtp.h"
22 #include "xfa/include/fwl/theme/monthcalendartp.h"
23 #include "xfa/include/fwl/theme/pictureboxtp.h"
24 #include "xfa/include/fwl/theme/pushbuttontp.h"
25 #include "xfa/include/fwl/theme/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 FX_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;
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_ERR CFWL_Theme::GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) {
68 return FWL_ERR_Succeeded;
69 }
70
71 FWL_ERR CFWL_Theme::SetThemeMatrix(IFWL_Widget* pWidget,
72 const CFX_Matrix& matrix) {
73 return FWL_ERR_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, uint32_t dwCapacity) {
85 return GetTheme(pThemePart->m_pWidget)->GetCapacity(pThemePart, dwCapacity);
86 }
87
88 FX_BOOL CFWL_Theme::IsCustomizedLayout(IFWL_Widget* pWidget) {
89 return GetTheme(pWidget)->IsCustomizedLayout(pWidget);
90 }
91
92 FWL_ERR CFWL_Theme::GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart) {
93 return GetTheme(pThemePart->m_pWidget)->GetPartRect(pThemePart, rtPart);
94 }
95
96 FX_BOOL CFWL_Theme::IsInPart(CFWL_ThemePart* pThemePart,
97 FX_FLOAT fx,
98 FX_FLOAT fy) {
99 return GetTheme(pThemePart->m_pWidget)->IsInPart(pThemePart, fx, fy);
100 }
101
102 FX_BOOL CFWL_Theme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) {
103 return GetTheme(pParams->m_pWidget)->CalcTextRect(pParams, rect);
104 }
105
106 FWL_ERR CFWL_Theme::Initialize() {
107 for (const auto& pTheme : m_ThemesArray)
108 pTheme->Initialize();
109
110 FWLTHEME_Init();
111 return FWL_ERR_Succeeded;
112 }
113
114 FWL_ERR CFWL_Theme::Finalize() {
115 for (const auto& pTheme : m_ThemesArray)
116 pTheme->Finalize();
117
118 FWLTHEME_Release();
119 return FWL_ERR_Succeeded;
120 }
121
122 FWL_ERR CFWL_Theme::SetFont(IFWL_Widget* pWidget,
123 const FX_WCHAR* strFont,
124 FX_FLOAT fFontSize,
125 FX_ARGB rgbFont) {
126 for (const auto& pTheme : m_ThemesArray)
127 pTheme->SetFont(pWidget, strFont, fFontSize, rgbFont);
128
129 return FWL_ERR_Succeeded;
130 }
131
132 CFWL_WidgetTP* CFWL_Theme::GetTheme(IFWL_Widget* pWidget) {
133 for (const auto& pTheme : m_ThemesArray) {
134 if (pTheme->IsValidWidget(pWidget))
135 return pTheme.get();
136 }
137 return nullptr;
138 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698