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

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

Issue 1512423003: Convert last batch of casts in fwl. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 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 "../../../foxitlib.h" 7 #include "../../../foxitlib.h"
8 FX_BOOL CFWL_Theme::IsValidWidget(IFWL_Widget* pWidget) { 8 FX_BOOL CFWL_Theme::IsValidWidget(IFWL_Widget* pWidget) {
9 CFWL_WidgetTP* pTheme = GetTheme(pWidget); 9 return !!GetTheme(pWidget);
10 return pTheme != NULL;
11 } 10 }
12 FX_DWORD CFWL_Theme::GetThemeID(IFWL_Widget* pWidget) { 11 FX_DWORD CFWL_Theme::GetThemeID(IFWL_Widget* pWidget) {
13 CFWL_WidgetTP* pTheme = GetTheme(pWidget); 12 return GetTheme(pWidget)->GetThemeID(pWidget);
14 FXSYS_assert(pTheme);
15 return pTheme->GetThemeID(pWidget);
16 } 13 }
17 FX_DWORD CFWL_Theme::SetThemeID(IFWL_Widget* pWidget, 14 FX_DWORD CFWL_Theme::SetThemeID(IFWL_Widget* pWidget,
18 FX_DWORD dwThemeID, 15 FX_DWORD dwThemeID,
19 FX_BOOL bChildren) { 16 FX_BOOL bChildren) {
20 int32_t iCount = m_arrThemes.GetSize(); 17 int32_t iCount = m_arrThemes.GetSize();
21 FX_DWORD dwID; 18 FX_DWORD dwID;
22 for (int32_t i = 0; i < iCount; i++) { 19 for (int32_t i = 0; i < iCount; i++) {
23 CFWL_WidgetTP* pTheme = (CFWL_WidgetTP*)m_arrThemes[i]; 20 CFWL_WidgetTP* pTheme = static_cast<CFWL_WidgetTP*>(m_arrThemes[i]);
24 dwID = pTheme->GetThemeID(pWidget); 21 dwID = pTheme->GetThemeID(pWidget);
25 pTheme->SetThemeID(pWidget, dwThemeID, FALSE); 22 pTheme->SetThemeID(pWidget, dwThemeID, FALSE);
26 } 23 }
27 return dwID; 24 return dwID;
28 } 25 }
29 FWL_ERR CFWL_Theme::GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) { 26 FWL_ERR CFWL_Theme::GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) {
30 return FWL_ERR_Succeeded; 27 return FWL_ERR_Succeeded;
31 } 28 }
32 FWL_ERR CFWL_Theme::SetThemeMatrix(IFWL_Widget* pWidget, 29 FWL_ERR CFWL_Theme::SetThemeMatrix(IFWL_Widget* pWidget,
33 const CFX_Matrix& matrix) { 30 const CFX_Matrix& matrix) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 return pTheme->IsInPart(pThemePart, fx, fy); 63 return pTheme->IsInPart(pThemePart, fx, fy);
67 } 64 }
68 FX_BOOL CFWL_Theme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { 65 FX_BOOL CFWL_Theme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) {
69 CFWL_WidgetTP* pTheme = GetTheme(pParams->m_pWidget); 66 CFWL_WidgetTP* pTheme = GetTheme(pParams->m_pWidget);
70 FXSYS_assert(pTheme); 67 FXSYS_assert(pTheme);
71 return pTheme->CalcTextRect(pParams, rect); 68 return pTheme->CalcTextRect(pParams, rect);
72 } 69 }
73 FWL_ERR CFWL_Theme::Initialize() { 70 FWL_ERR CFWL_Theme::Initialize() {
74 int32_t iCount = m_arrThemes.GetSize(); 71 int32_t iCount = m_arrThemes.GetSize();
75 for (int32_t i = 0; i < iCount; i++) { 72 for (int32_t i = 0; i < iCount; i++) {
76 CFWL_WidgetTP* pTheme = (CFWL_WidgetTP*)m_arrThemes[i]; 73 CFWL_WidgetTP* pTheme = static_cast<CFWL_WidgetTP*>(m_arrThemes[i]);
77 pTheme->Initialize(); 74 pTheme->Initialize();
78 } 75 }
79 FWLTHEME_Init(); 76 FWLTHEME_Init();
80 return FWL_ERR_Succeeded; 77 return FWL_ERR_Succeeded;
81 } 78 }
82 FWL_ERR CFWL_Theme::Finalize() { 79 FWL_ERR CFWL_Theme::Finalize() {
83 int32_t iCount = m_arrThemes.GetSize(); 80 int32_t iCount = m_arrThemes.GetSize();
84 for (int32_t i = 0; i < iCount; i++) { 81 for (int32_t i = 0; i < iCount; i++) {
85 CFWL_WidgetTP* pTheme = (CFWL_WidgetTP*)m_arrThemes[i]; 82 CFWL_WidgetTP* pTheme = static_cast<CFWL_WidgetTP*>(m_arrThemes[i]);
86 pTheme->Finalize(); 83 pTheme->Finalize();
87 } 84 }
88 FWLTHEME_Release(); 85 FWLTHEME_Release();
89 return FWL_ERR_Succeeded; 86 return FWL_ERR_Succeeded;
90 } 87 }
91 CFWL_Theme::CFWL_Theme() { 88 CFWL_Theme::CFWL_Theme() {
92 CFWL_FormTP* pFormTP = new CFWL_FormTP; 89 CFWL_FormTP* pFormTP = new CFWL_FormTP;
93 CFWL_PushButtonTP* pPushButtonTP = new CFWL_PushButtonTP; 90 CFWL_PushButtonTP* pPushButtonTP = new CFWL_PushButtonTP;
94 CFWL_CheckBoxTP* pCheckBoxTP = new CFWL_CheckBoxTP; 91 CFWL_CheckBoxTP* pCheckBoxTP = new CFWL_CheckBoxTP;
95 CFWL_ListBoxTP* pListBoxTP = new CFWL_ListBoxTP; 92 CFWL_ListBoxTP* pListBoxTP = new CFWL_ListBoxTP;
(...skipping 12 matching lines...) Expand all
108 m_arrThemes.Add(pPictureBoxTP); 105 m_arrThemes.Add(pPictureBoxTP);
109 m_arrThemes.Add(pSrollBarTP); 106 m_arrThemes.Add(pSrollBarTP);
110 m_arrThemes.Add(pEditTP); 107 m_arrThemes.Add(pEditTP);
111 m_arrThemes.Add(pComboBoxTP); 108 m_arrThemes.Add(pComboBoxTP);
112 m_arrThemes.Add(pBarcodeTP); 109 m_arrThemes.Add(pBarcodeTP);
113 m_arrThemes.Add(pDateTimePickerTP); 110 m_arrThemes.Add(pDateTimePickerTP);
114 m_arrThemes.Add(pMonthCalendarTP); 111 m_arrThemes.Add(pMonthCalendarTP);
115 m_arrThemes.Add(pCaretTP); 112 m_arrThemes.Add(pCaretTP);
116 } 113 }
117 CFWL_Theme::~CFWL_Theme() { 114 CFWL_Theme::~CFWL_Theme() {
118 int32_t iCount = m_arrThemes.GetSize(); 115 for (int32_t i = 0; i < m_arrThemes.GetSize(); i++) {
119 for (int32_t i = 0; i < iCount; i++) { 116 delete static_cast<CFWL_WidgetTP*>(m_arrThemes[i]);
120 CFWL_WidgetTP* pTheme = (CFWL_WidgetTP*)m_arrThemes[i];
121 delete pTheme;
122 } 117 }
123 m_arrThemes.RemoveAll(); 118 m_arrThemes.RemoveAll();
124 } 119 }
125 FWL_ERR CFWL_Theme::SetFont(IFWL_Widget* pWidget, 120 FWL_ERR CFWL_Theme::SetFont(IFWL_Widget* pWidget,
126 const FX_WCHAR* strFont, 121 const FX_WCHAR* strFont,
127 FX_FLOAT fFontSize, 122 FX_FLOAT fFontSize,
128 FX_ARGB rgbFont) { 123 FX_ARGB rgbFont) {
129 int32_t iCount = m_arrThemes.GetSize(); 124 int32_t iCount = m_arrThemes.GetSize();
130 for (int32_t i = 0; i < iCount; i++) { 125 for (int32_t i = 0; i < iCount; i++) {
131 CFWL_WidgetTP* pTheme = (CFWL_WidgetTP*)m_arrThemes[i]; 126 CFWL_WidgetTP* pTheme = static_cast<CFWL_WidgetTP*>(m_arrThemes[i]);
132 pTheme->SetFont(pWidget, strFont, fFontSize, rgbFont); 127 pTheme->SetFont(pWidget, strFont, fFontSize, rgbFont);
133 } 128 }
134 return FWL_ERR_Succeeded; 129 return FWL_ERR_Succeeded;
135 } 130 }
136 CFWL_WidgetTP* CFWL_Theme::GetTheme(IFWL_Widget* pWidget) { 131 CFWL_WidgetTP* CFWL_Theme::GetTheme(IFWL_Widget* pWidget) {
137 int32_t iCount = m_arrThemes.GetSize(); 132 int32_t iCount = m_arrThemes.GetSize();
138 for (int32_t i = 0; i < iCount; i++) { 133 for (int32_t i = 0; i < iCount; i++) {
139 CFWL_WidgetTP* pTheme = (CFWL_WidgetTP*)m_arrThemes[i]; 134 CFWL_WidgetTP* pTheme = static_cast<CFWL_WidgetTP*>(m_arrThemes[i]);
140 if (pTheme->IsValidWidget(pWidget)) { 135 if (pTheme->IsValidWidget(pWidget)) {
141 return pTheme; 136 return pTheme;
142 } 137 }
143 } 138 }
144 return NULL; 139 return NULL;
145 } 140 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698