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 22 matching lines...) Expand all Loading... |
33 m_rtDisLBorder.Reset(); | 33 m_rtDisLBorder.Reset(); |
34 m_rtDisRBorder.Reset(); | 34 m_rtDisRBorder.Reset(); |
35 m_rtDisBBorder.Reset(); | 35 m_rtDisBBorder.Reset(); |
36 m_rtDisCaption.Reset(); | 36 m_rtDisCaption.Reset(); |
37 } | 37 } |
38 | 38 |
39 CFWL_FormTP::~CFWL_FormTP() { | 39 CFWL_FormTP::~CFWL_FormTP() { |
40 delete m_pThemeData; | 40 delete m_pThemeData; |
41 } | 41 } |
42 | 42 |
43 FWL_ERR CFWL_FormTP::Initialize() { | 43 FWL_Error CFWL_FormTP::Initialize() { |
44 InitTTO(); | 44 InitTTO(); |
45 InitCaption(TRUE); | 45 InitCaption(TRUE); |
46 InitCaption(FALSE); | 46 InitCaption(FALSE); |
47 return CFWL_WidgetTP::Initialize(); | 47 return CFWL_WidgetTP::Initialize(); |
48 } | 48 } |
49 | 49 |
50 FWL_ERR CFWL_FormTP::Finalize() { | 50 FWL_Error CFWL_FormTP::Finalize() { |
51 FinalizeTTO(); | 51 FinalizeTTO(); |
52 delete m_pActiveBitmap; | 52 delete m_pActiveBitmap; |
53 m_pActiveBitmap = nullptr; | 53 m_pActiveBitmap = nullptr; |
54 delete m_pDeactivebitmap; | 54 delete m_pDeactivebitmap; |
55 m_pDeactivebitmap = nullptr; | 55 m_pDeactivebitmap = nullptr; |
56 return CFWL_WidgetTP::Finalize(); | 56 return CFWL_WidgetTP::Finalize(); |
57 } | 57 } |
58 | 58 |
59 FX_BOOL CFWL_FormTP::IsValidWidget(IFWL_Widget* pWidget) { | 59 FX_BOOL CFWL_FormTP::IsValidWidget(IFWL_Widget* pWidget) { |
60 if (!pWidget) | 60 if (!pWidget) |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 default: { bDefPro = TRUE; } | 192 default: { bDefPro = TRUE; } |
193 } | 193 } |
194 if (!bDefPro) { | 194 if (!bDefPro) { |
195 if (bDwordVal) { | 195 if (bDwordVal) { |
196 return &m_dwValue; | 196 return &m_dwValue; |
197 } | 197 } |
198 return &m_fValue; | 198 return &m_fValue; |
199 } | 199 } |
200 return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); | 200 return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); |
201 } | 201 } |
202 FWL_ERR CFWL_FormTP::GetPartRect(CFWL_ThemePart* pThemePart, | 202 FWL_Error CFWL_FormTP::GetPartRect(CFWL_ThemePart* pThemePart, |
203 CFX_RectF& rtPart) { | 203 CFX_RectF& rtPart) { |
204 switch (pThemePart->m_iPart) { | 204 switch (pThemePart->m_iPart) { |
205 case CFWL_Part::CloseBox: { | 205 case CFWL_Part::CloseBox: { |
206 CalCloseBox(pThemePart->m_pWidget, rtPart); | 206 CalCloseBox(pThemePart->m_pWidget, rtPart); |
207 break; | 207 break; |
208 } | 208 } |
209 case CFWL_Part::MaximizeBox: { | 209 case CFWL_Part::MaximizeBox: { |
210 CalMaxBox(pThemePart->m_pWidget, rtPart); | 210 CalMaxBox(pThemePart->m_pWidget, rtPart); |
211 break; | 211 break; |
212 } | 212 } |
213 case CFWL_Part::MinimizeBox: { | 213 case CFWL_Part::MinimizeBox: { |
214 CalMinBox(pThemePart->m_pWidget, rtPart); | 214 CalMinBox(pThemePart->m_pWidget, rtPart); |
215 break; | 215 break; |
216 } | 216 } |
217 case CFWL_Part::HeadText: { | 217 case CFWL_Part::HeadText: { |
218 CalCaption(pThemePart->m_pWidget, rtPart); | 218 CalCaption(pThemePart->m_pWidget, rtPart); |
219 break; | 219 break; |
220 } | 220 } |
221 case CFWL_Part::Icon: { | 221 case CFWL_Part::Icon: { |
222 CalIcon(pThemePart->m_pWidget, rtPart); | 222 CalIcon(pThemePart->m_pWidget, rtPart); |
223 break; | 223 break; |
224 } | 224 } |
225 default: {} | 225 default: {} |
226 } | 226 } |
227 return FWL_ERR_Succeeded; | 227 return FWL_Error::Succeeded; |
228 } | 228 } |
229 void CFWL_FormTP::CalCloseBox(IFWL_Widget* pWidget, CFX_RectF& rect) { | 229 void CFWL_FormTP::CalCloseBox(IFWL_Widget* pWidget, CFX_RectF& rect) { |
230 uint32_t dwStyles = pWidget->GetStyles(); | 230 uint32_t dwStyles = pWidget->GetStyles(); |
231 CFX_RectF rtWidget; | 231 CFX_RectF rtWidget; |
232 pWidget->GetWidgetRect(rtWidget); | 232 pWidget->GetWidgetRect(rtWidget); |
233 rtWidget.Offset(-rtWidget.left, -rtWidget.top); | 233 rtWidget.Offset(-rtWidget.left, -rtWidget.top); |
234 if (dwStyles & FWL_WGTSTYLE_CloseBox) { | 234 if (dwStyles & FWL_WGTSTYLE_CloseBox) { |
235 rect.Set(rtWidget.left + FWLTHEME_FORMBTN_Margin + FWLTHEME_FORMBTN_Span, | 235 rect.Set(rtWidget.left + FWLTHEME_FORMBTN_Margin + FWLTHEME_FORMBTN_Span, |
236 rtWidget.top + FWLTHEME_FORMBTN_Margin, FWLTHEME_FORMBTN_Size, | 236 rtWidget.top + FWLTHEME_FORMBTN_Margin, FWLTHEME_FORMBTN_Size, |
237 FWLTHEME_FORMBTN_Size); | 237 FWLTHEME_FORMBTN_Size); |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 path.AddRectangle(0, 5, 1, 15); | 881 path.AddRectangle(0, 5, 1, 15); |
882 DrawAxialShading(&gs, 0, 5, 0, 20, m_pThemeData->clrHeadBK[1][1], | 882 DrawAxialShading(&gs, 0, 5, 0, 20, m_pThemeData->clrHeadBK[1][1], |
883 m_pThemeData->clrHeadBK[1][2], &path); | 883 m_pThemeData->clrHeadBK[1][2], &path); |
884 path.Clear(); | 884 path.Clear(); |
885 path.AddRectangle(0, 20, 1, FWLTHEME_CAPACITY_CYCaption - 19); | 885 path.AddRectangle(0, 20, 1, FWLTHEME_CAPACITY_CYCaption - 19); |
886 DrawAxialShading(&gs, 0, 20, 0, FWLTHEME_CAPACITY_CYCaption, | 886 DrawAxialShading(&gs, 0, 20, 0, FWLTHEME_CAPACITY_CYCaption, |
887 m_pThemeData->clrHeadBK[1][2], | 887 m_pThemeData->clrHeadBK[1][2], |
888 m_pThemeData->clrHeadBK[1][3], &path); | 888 m_pThemeData->clrHeadBK[1][3], &path); |
889 } | 889 } |
890 } | 890 } |
OLD | NEW |