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/theme/cfwl_formtp.h" | 7 #include "xfa/fwl/theme/cfwl_formtp.h" |
8 | 8 |
9 #include "xfa/fde/tto/fde_textout.h" | 9 #include "xfa/fde/tto/fde_textout.h" |
10 #include "xfa/fwl/core/cfwl_themebackground.h" | 10 #include "xfa/fwl/core/cfwl_themebackground.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 m_rtDisLBorder.Reset(); | 37 m_rtDisLBorder.Reset(); |
38 m_rtDisRBorder.Reset(); | 38 m_rtDisRBorder.Reset(); |
39 m_rtDisBBorder.Reset(); | 39 m_rtDisBBorder.Reset(); |
40 m_rtDisCaption.Reset(); | 40 m_rtDisCaption.Reset(); |
41 } | 41 } |
42 | 42 |
43 CFWL_FormTP::~CFWL_FormTP() { | 43 CFWL_FormTP::~CFWL_FormTP() { |
44 delete m_pThemeData; | 44 delete m_pThemeData; |
45 } | 45 } |
46 | 46 |
47 FWL_ERR CFWL_FormTP::Initialize() { | 47 FWL_Error CFWL_FormTP::Initialize() { |
48 InitTTO(); | 48 InitTTO(); |
49 InitCaption(TRUE); | 49 InitCaption(TRUE); |
50 InitCaption(FALSE); | 50 InitCaption(FALSE); |
51 return CFWL_WidgetTP::Initialize(); | 51 return CFWL_WidgetTP::Initialize(); |
52 } | 52 } |
53 | 53 |
54 FWL_ERR CFWL_FormTP::Finalize() { | 54 FWL_Error CFWL_FormTP::Finalize() { |
55 FinalizeTTO(); | 55 FinalizeTTO(); |
56 delete m_pActiveBitmap; | 56 delete m_pActiveBitmap; |
57 m_pActiveBitmap = nullptr; | 57 m_pActiveBitmap = nullptr; |
58 delete m_pDeactivebitmap; | 58 delete m_pDeactivebitmap; |
59 m_pDeactivebitmap = nullptr; | 59 m_pDeactivebitmap = nullptr; |
60 return CFWL_WidgetTP::Finalize(); | 60 return CFWL_WidgetTP::Finalize(); |
61 } | 61 } |
62 | 62 |
63 FX_BOOL CFWL_FormTP::IsValidWidget(IFWL_Widget* pWidget) { | 63 FX_BOOL CFWL_FormTP::IsValidWidget(IFWL_Widget* pWidget) { |
64 if (!pWidget) | 64 if (!pWidget) |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 default: { bDefPro = TRUE; } | 196 default: { bDefPro = TRUE; } |
197 } | 197 } |
198 if (!bDefPro) { | 198 if (!bDefPro) { |
199 if (bDwordVal) { | 199 if (bDwordVal) { |
200 return &m_dwValue; | 200 return &m_dwValue; |
201 } | 201 } |
202 return &m_fValue; | 202 return &m_fValue; |
203 } | 203 } |
204 return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); | 204 return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); |
205 } | 205 } |
206 FWL_ERR CFWL_FormTP::GetPartRect(CFWL_ThemePart* pThemePart, | 206 FWL_Error CFWL_FormTP::GetPartRect(CFWL_ThemePart* pThemePart, |
207 CFX_RectF& rtPart) { | 207 CFX_RectF& rtPart) { |
208 switch (pThemePart->m_iPart) { | 208 switch (pThemePart->m_iPart) { |
209 case CFWL_Part::CloseBox: { | 209 case CFWL_Part::CloseBox: { |
210 CalCloseBox(pThemePart->m_pWidget, rtPart); | 210 CalCloseBox(pThemePart->m_pWidget, rtPart); |
211 break; | 211 break; |
212 } | 212 } |
213 case CFWL_Part::MaximizeBox: { | 213 case CFWL_Part::MaximizeBox: { |
214 CalMaxBox(pThemePart->m_pWidget, rtPart); | 214 CalMaxBox(pThemePart->m_pWidget, rtPart); |
215 break; | 215 break; |
216 } | 216 } |
217 case CFWL_Part::MinimizeBox: { | 217 case CFWL_Part::MinimizeBox: { |
218 CalMinBox(pThemePart->m_pWidget, rtPart); | 218 CalMinBox(pThemePart->m_pWidget, rtPart); |
219 break; | 219 break; |
220 } | 220 } |
221 case CFWL_Part::HeadText: { | 221 case CFWL_Part::HeadText: { |
222 CalCaption(pThemePart->m_pWidget, rtPart); | 222 CalCaption(pThemePart->m_pWidget, rtPart); |
223 break; | 223 break; |
224 } | 224 } |
225 case CFWL_Part::Icon: { | 225 case CFWL_Part::Icon: { |
226 CalIcon(pThemePart->m_pWidget, rtPart); | 226 CalIcon(pThemePart->m_pWidget, rtPart); |
227 break; | 227 break; |
228 } | 228 } |
229 default: {} | 229 default: {} |
230 } | 230 } |
231 return FWL_ERR_Succeeded; | 231 return FWL_Error::Succeeded; |
232 } | 232 } |
233 void CFWL_FormTP::CalCloseBox(IFWL_Widget* pWidget, CFX_RectF& rect) { | 233 void CFWL_FormTP::CalCloseBox(IFWL_Widget* pWidget, CFX_RectF& rect) { |
234 uint32_t dwStyles = pWidget->GetStyles(); | 234 uint32_t dwStyles = pWidget->GetStyles(); |
235 CFX_RectF rtWidget; | 235 CFX_RectF rtWidget; |
236 pWidget->GetWidgetRect(rtWidget); | 236 pWidget->GetWidgetRect(rtWidget); |
237 rtWidget.Offset(-rtWidget.left, -rtWidget.top); | 237 rtWidget.Offset(-rtWidget.left, -rtWidget.top); |
238 if (dwStyles & FWL_WGTSTYLE_CloseBox) { | 238 if (dwStyles & FWL_WGTSTYLE_CloseBox) { |
239 rect.Set(rtWidget.left + kButtonMargin + kButtonSpan, | 239 rect.Set(rtWidget.left + kButtonMargin + kButtonSpan, |
240 rtWidget.top + kButtonMargin, kButtonSize, kButtonSize); | 240 rtWidget.top + kButtonMargin, kButtonSize, kButtonSize); |
241 } else { | 241 } else { |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 path.Clear(); | 875 path.Clear(); |
876 path.AddRectangle(0, 5, 1, 15); | 876 path.AddRectangle(0, 5, 1, 15); |
877 DrawAxialShading(&gs, 0, 5, 0, 20, m_pThemeData->clrHeadBK[1][1], | 877 DrawAxialShading(&gs, 0, 5, 0, 20, m_pThemeData->clrHeadBK[1][1], |
878 m_pThemeData->clrHeadBK[1][2], &path); | 878 m_pThemeData->clrHeadBK[1][2], &path); |
879 path.Clear(); | 879 path.Clear(); |
880 path.AddRectangle(0, 20, 1, kCYCaption - 19); | 880 path.AddRectangle(0, 20, 1, kCYCaption - 19); |
881 DrawAxialShading(&gs, 0, 20, 0, kCYCaption, m_pThemeData->clrHeadBK[1][2], | 881 DrawAxialShading(&gs, 0, 20, 0, kCYCaption, m_pThemeData->clrHeadBK[1][2], |
882 m_pThemeData->clrHeadBK[1][3], &path); | 882 m_pThemeData->clrHeadBK[1][3], &path); |
883 } | 883 } |
884 } | 884 } |
OLD | NEW |