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

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

Issue 2422373002: Cleanup unneeded FWL theme code. (Closed)
Patch Set: Created 4 years, 2 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/theme/cfwl_widgettp.h ('k') | xfa/fxfa/app/xfa_fwltheme.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 10
(...skipping 18 matching lines...) Expand all
29 const float kEdgeSunken = 2.0f; 29 const float kEdgeSunken = 2.0f;
30 const float kLineHeight = 12.0f; 30 const float kLineHeight = 12.0f;
31 const float kScrollBarWidth = 17.0f; 31 const float kScrollBarWidth = 17.0f;
32 const float kCXBorder = 1.0f; 32 const float kCXBorder = 1.0f;
33 const float kCYBorder = 1.0f; 33 const float kCYBorder = 1.0f;
34 34
35 #define FWLTHEME_CAPACITY_TextSelColor (ArgbEncode(255, 153, 193, 218)) 35 #define FWLTHEME_CAPACITY_TextSelColor (ArgbEncode(255, 153, 193, 218))
36 36
37 } // namespace 37 } // namespace
38 38
39 static void FWL_SetChildThemeID(IFWL_Widget* pParent, uint32_t dwThemeID) {
40 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance();
41 IFWL_Widget* pChild = pWidgetMgr->GetFirstChildWidget(pParent);
42 while (pChild) {
43 IFWL_ThemeProvider* pTheme = pChild->GetThemeProvider();
44 if (pTheme) {
45 pTheme->SetThemeID(pChild, dwThemeID, FALSE);
46 }
47 FWL_SetChildThemeID(pChild, dwThemeID);
48 pChild = pWidgetMgr->GetNextSiblingWidget(pChild);
49 }
50 }
51
52 bool CFWL_WidgetTP::IsValidWidget(IFWL_Widget* pWidget) { 39 bool CFWL_WidgetTP::IsValidWidget(IFWL_Widget* pWidget) {
53 return FALSE; 40 return FALSE;
54 } 41 }
55 42
56 uint32_t CFWL_WidgetTP::GetThemeID(IFWL_Widget* pWidget) { 43 uint32_t CFWL_WidgetTP::GetThemeID(IFWL_Widget* pWidget) {
57 return m_dwThemeID; 44 return m_dwThemeID;
58 } 45 }
59 46
60 uint32_t CFWL_WidgetTP::SetThemeID(IFWL_Widget* pWidget, 47 uint32_t CFWL_WidgetTP::SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID) {
61 uint32_t dwThemeID,
62 FX_BOOL bChildren) {
63 uint32_t dwOld = m_dwThemeID; 48 uint32_t dwOld = m_dwThemeID;
64 m_dwThemeID = dwThemeID; 49 m_dwThemeID = dwThemeID;
65 if (CFWL_ArrowData::HasInstance()) { 50 if (CFWL_ArrowData::HasInstance())
66 CFWL_ArrowData::GetInstance()->SetColorData(FWL_GetThemeColor(dwThemeID)); 51 CFWL_ArrowData::GetInstance()->SetColorData(FWL_GetThemeColor(dwThemeID));
67 }
68 if (bChildren) {
69 FWL_SetChildThemeID(pWidget, dwThemeID);
70 }
71 return dwOld; 52 return dwOld;
72 } 53 }
73 54
74 FWL_Error CFWL_WidgetTP::GetThemeMatrix(IFWL_Widget* pWidget, 55 FWL_Error CFWL_WidgetTP::GetThemeMatrix(IFWL_Widget* pWidget,
75 CFX_Matrix& matrix) { 56 CFX_Matrix& matrix) {
76 matrix.Set(_ctm.a, _ctm.b, _ctm.c, _ctm.d, _ctm.e, _ctm.f); 57 matrix.Set(_ctm.a, _ctm.b, _ctm.c, _ctm.d, _ctm.e, _ctm.f);
77 return FWL_Error::Succeeded; 58 return FWL_Error::Succeeded;
78 } 59 }
79 60
80 FWL_Error CFWL_WidgetTP::SetThemeMatrix(IFWL_Widget* pWidget, 61 FWL_Error CFWL_WidgetTP::SetThemeMatrix(IFWL_Widget* pWidget,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 139 }
159 default: { return nullptr; } 140 default: { return nullptr; }
160 } 141 }
161 return &m_fValue; 142 return &m_fValue;
162 } 143 }
163 144
164 FX_BOOL CFWL_WidgetTP::IsCustomizedLayout(IFWL_Widget* pWidget) { 145 FX_BOOL CFWL_WidgetTP::IsCustomizedLayout(IFWL_Widget* pWidget) {
165 return FWL_GetThemeLayout(m_dwThemeID); 146 return FWL_GetThemeLayout(m_dwThemeID);
166 } 147 }
167 148
168 FWL_Error CFWL_WidgetTP::GetPartRect(CFWL_ThemePart* pThemePart,
169 CFX_RectF& rect) {
170 return FWL_Error::Succeeded;
171 }
172
173 FX_BOOL CFWL_WidgetTP::IsInPart(CFWL_ThemePart* pThemePart,
174 FX_FLOAT fx,
175 FX_FLOAT fy) {
176 return TRUE;
177 }
178
179 FX_BOOL CFWL_WidgetTP::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { 149 FX_BOOL CFWL_WidgetTP::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) {
180 if (!pParams) 150 if (!pParams)
181 return FALSE; 151 return FALSE;
182 if (!m_pTextOut) 152 if (!m_pTextOut)
183 return FALSE; 153 return FALSE;
184 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); 154 m_pTextOut->SetAlignment(pParams->m_iTTOAlign);
185 m_pTextOut->SetStyles(pParams->m_dwTTOStyles | FDE_TTOSTYLE_ArabicContext); 155 m_pTextOut->SetStyles(pParams->m_dwTTOStyles | FDE_TTOSTYLE_ArabicContext);
186 m_pTextOut->CalcLogicSize(pParams->m_wsText.c_str(), 156 m_pTextOut->CalcLogicSize(pParams->m_wsText.c_str(),
187 pParams->m_wsText.GetLength(), rect); 157 pParams->m_wsText.GetLength(), rect);
188 return TRUE; 158 return TRUE;
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 if (pData->Equal(wsFontFamily, dwFontStyles, wCodePage)) 720 if (pData->Equal(wsFontFamily, dwFontStyles, wCodePage))
751 return pData->GetFont(); 721 return pData->GetFont();
752 } 722 }
753 std::unique_ptr<CFWL_FontData> pFontData(new CFWL_FontData); 723 std::unique_ptr<CFWL_FontData> pFontData(new CFWL_FontData);
754 if (!pFontData->LoadFont(wsFontFamily, dwFontStyles, wCodePage)) 724 if (!pFontData->LoadFont(wsFontFamily, dwFontStyles, wCodePage))
755 return nullptr; 725 return nullptr;
756 m_FontsArray.push_back(std::move(pFontData)); 726 m_FontsArray.push_back(std::move(pFontData));
757 return m_FontsArray.back()->GetFont(); 727 return m_FontsArray.back()->GetFont();
758 } 728 }
759 729
760 FX_BOOL FWLTHEME_Init() {
761 return TRUE;
762 }
763
764 void FWLTHEME_Release() { 730 void FWLTHEME_Release() {
765 CFWL_ArrowData::DestroyInstance(); 731 CFWL_ArrowData::DestroyInstance();
766 CFWL_FontManager::DestroyInstance(); 732 CFWL_FontManager::DestroyInstance();
767 } 733 }
768 734
769 uint32_t FWL_GetThemeLayout(uint32_t dwThemeID) { 735 uint32_t FWL_GetThemeLayout(uint32_t dwThemeID) {
770 return 0xffff0000 & dwThemeID; 736 return 0xffff0000 & dwThemeID;
771 } 737 }
772 738
773 uint32_t FWL_GetThemeColor(uint32_t dwThemeID) { 739 uint32_t FWL_GetThemeColor(uint32_t dwThemeID) {
774 return 0x0000ffff & dwThemeID; 740 return 0x0000ffff & dwThemeID;
775 } 741 }
OLDNEW
« no previous file with comments | « xfa/fwl/theme/cfwl_widgettp.h ('k') | xfa/fxfa/app/xfa_fwltheme.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698