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/lightwidget/cfwl_theme.h" | 7 #include "xfa/fwl/lightwidget/cfwl_theme.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 uint32_t dwThemeID, | 57 uint32_t dwThemeID, |
58 FX_BOOL bChildren) { | 58 FX_BOOL bChildren) { |
59 uint32_t dwID; | 59 uint32_t dwID; |
60 for (const auto& pTheme : m_ThemesArray) { | 60 for (const auto& pTheme : m_ThemesArray) { |
61 dwID = pTheme->GetThemeID(pWidget); | 61 dwID = pTheme->GetThemeID(pWidget); |
62 pTheme->SetThemeID(pWidget, dwThemeID, FALSE); | 62 pTheme->SetThemeID(pWidget, dwThemeID, FALSE); |
63 } | 63 } |
64 return dwID; | 64 return dwID; |
65 } | 65 } |
66 | 66 |
67 FWL_ERR CFWL_Theme::GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) { | 67 FWL_Error CFWL_Theme::GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) { |
68 return FWL_ERR_Succeeded; | 68 return FWL_Error::Succeeded; |
69 } | 69 } |
70 | 70 |
71 FWL_ERR CFWL_Theme::SetThemeMatrix(IFWL_Widget* pWidget, | 71 FWL_Error CFWL_Theme::SetThemeMatrix(IFWL_Widget* pWidget, |
72 const CFX_Matrix& matrix) { | 72 const CFX_Matrix& matrix) { |
73 return FWL_ERR_Succeeded; | 73 return FWL_Error::Succeeded; |
74 } | 74 } |
75 | 75 |
76 FX_BOOL CFWL_Theme::DrawBackground(CFWL_ThemeBackground* pParams) { | 76 FX_BOOL CFWL_Theme::DrawBackground(CFWL_ThemeBackground* pParams) { |
77 return GetTheme(pParams->m_pWidget)->DrawBackground(pParams); | 77 return GetTheme(pParams->m_pWidget)->DrawBackground(pParams); |
78 } | 78 } |
79 | 79 |
80 FX_BOOL CFWL_Theme::DrawText(CFWL_ThemeText* pParams) { | 80 FX_BOOL CFWL_Theme::DrawText(CFWL_ThemeText* pParams) { |
81 return GetTheme(pParams->m_pWidget)->DrawText(pParams); | 81 return GetTheme(pParams->m_pWidget)->DrawText(pParams); |
82 } | 82 } |
83 | 83 |
84 void* CFWL_Theme::GetCapacity(CFWL_ThemePart* pThemePart, | 84 void* CFWL_Theme::GetCapacity(CFWL_ThemePart* pThemePart, |
85 CFWL_WidgetCapacity dwCapacity) { | 85 CFWL_WidgetCapacity dwCapacity) { |
86 return GetTheme(pThemePart->m_pWidget)->GetCapacity(pThemePart, dwCapacity); | 86 return GetTheme(pThemePart->m_pWidget)->GetCapacity(pThemePart, dwCapacity); |
87 } | 87 } |
88 | 88 |
89 FX_BOOL CFWL_Theme::IsCustomizedLayout(IFWL_Widget* pWidget) { | 89 FX_BOOL CFWL_Theme::IsCustomizedLayout(IFWL_Widget* pWidget) { |
90 return GetTheme(pWidget)->IsCustomizedLayout(pWidget); | 90 return GetTheme(pWidget)->IsCustomizedLayout(pWidget); |
91 } | 91 } |
92 | 92 |
93 FWL_ERR CFWL_Theme::GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart) { | 93 FWL_Error CFWL_Theme::GetPartRect(CFWL_ThemePart* pThemePart, |
| 94 CFX_RectF& rtPart) { |
94 return GetTheme(pThemePart->m_pWidget)->GetPartRect(pThemePart, rtPart); | 95 return GetTheme(pThemePart->m_pWidget)->GetPartRect(pThemePart, rtPart); |
95 } | 96 } |
96 | 97 |
97 FX_BOOL CFWL_Theme::IsInPart(CFWL_ThemePart* pThemePart, | 98 FX_BOOL CFWL_Theme::IsInPart(CFWL_ThemePart* pThemePart, |
98 FX_FLOAT fx, | 99 FX_FLOAT fx, |
99 FX_FLOAT fy) { | 100 FX_FLOAT fy) { |
100 return GetTheme(pThemePart->m_pWidget)->IsInPart(pThemePart, fx, fy); | 101 return GetTheme(pThemePart->m_pWidget)->IsInPart(pThemePart, fx, fy); |
101 } | 102 } |
102 | 103 |
103 FX_BOOL CFWL_Theme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { | 104 FX_BOOL CFWL_Theme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { |
104 return GetTheme(pParams->m_pWidget)->CalcTextRect(pParams, rect); | 105 return GetTheme(pParams->m_pWidget)->CalcTextRect(pParams, rect); |
105 } | 106 } |
106 | 107 |
107 FWL_ERR CFWL_Theme::Initialize() { | 108 FWL_Error CFWL_Theme::Initialize() { |
108 for (const auto& pTheme : m_ThemesArray) | 109 for (const auto& pTheme : m_ThemesArray) |
109 pTheme->Initialize(); | 110 pTheme->Initialize(); |
110 | 111 |
111 FWLTHEME_Init(); | 112 FWLTHEME_Init(); |
112 return FWL_ERR_Succeeded; | 113 return FWL_Error::Succeeded; |
113 } | 114 } |
114 | 115 |
115 FWL_ERR CFWL_Theme::Finalize() { | 116 FWL_Error CFWL_Theme::Finalize() { |
116 for (const auto& pTheme : m_ThemesArray) | 117 for (const auto& pTheme : m_ThemesArray) |
117 pTheme->Finalize(); | 118 pTheme->Finalize(); |
118 | 119 |
119 FWLTHEME_Release(); | 120 FWLTHEME_Release(); |
120 return FWL_ERR_Succeeded; | 121 return FWL_Error::Succeeded; |
121 } | 122 } |
122 | 123 |
123 FWL_ERR CFWL_Theme::SetFont(IFWL_Widget* pWidget, | 124 FWL_Error CFWL_Theme::SetFont(IFWL_Widget* pWidget, |
124 const FX_WCHAR* strFont, | 125 const FX_WCHAR* strFont, |
125 FX_FLOAT fFontSize, | 126 FX_FLOAT fFontSize, |
126 FX_ARGB rgbFont) { | 127 FX_ARGB rgbFont) { |
127 for (const auto& pTheme : m_ThemesArray) | 128 for (const auto& pTheme : m_ThemesArray) |
128 pTheme->SetFont(pWidget, strFont, fFontSize, rgbFont); | 129 pTheme->SetFont(pWidget, strFont, fFontSize, rgbFont); |
129 | 130 |
130 return FWL_ERR_Succeeded; | 131 return FWL_Error::Succeeded; |
131 } | 132 } |
132 | 133 |
133 CFWL_WidgetTP* CFWL_Theme::GetTheme(IFWL_Widget* pWidget) { | 134 CFWL_WidgetTP* CFWL_Theme::GetTheme(IFWL_Widget* pWidget) { |
134 for (const auto& pTheme : m_ThemesArray) { | 135 for (const auto& pTheme : m_ThemesArray) { |
135 if (pTheme->IsValidWidget(pWidget)) | 136 if (pTheme->IsValidWidget(pWidget)) |
136 return pTheme.get(); | 137 return pTheme.get(); |
137 } | 138 } |
138 return nullptr; | 139 return nullptr; |
139 } | 140 } |
OLD | NEW |