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_scrollbartp.h" | 7 #include "xfa/fwl/theme/cfwl_scrollbartp.h" |
8 | 8 |
9 #include "xfa/fwl/core/cfwl_scrollbar.h" | 9 #include "xfa/fwl/core/cfwl_scrollbar.h" |
10 #include "xfa/fwl/core/cfwl_themebackground.h" | 10 #include "xfa/fwl/core/cfwl_themebackground.h" |
| 11 #include "xfa/fwl/core/cfwl_widget.h" |
11 #include "xfa/fwl/core/ifwl_themeprovider.h" | 12 #include "xfa/fwl/core/ifwl_themeprovider.h" |
12 #include "xfa/fwl/core/ifwl_widget.h" | |
13 #include "xfa/fxgraphics/cfx_color.h" | 13 #include "xfa/fxgraphics/cfx_color.h" |
14 #include "xfa/fxgraphics/cfx_path.h" | 14 #include "xfa/fxgraphics/cfx_path.h" |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 const float kPawLength = 12.5f; | 18 const float kPawLength = 12.5f; |
19 | 19 |
20 } // namespace | 20 } // namespace |
21 | 21 |
22 CFWL_ScrollBarTP::CFWL_ScrollBarTP() : m_pThemeData(new SBThemeData) { | 22 CFWL_ScrollBarTP::CFWL_ScrollBarTP() : m_pThemeData(new SBThemeData) { |
23 SetThemeData(); | 23 SetThemeData(); |
24 } | 24 } |
25 | 25 |
26 CFWL_ScrollBarTP::~CFWL_ScrollBarTP() {} | 26 CFWL_ScrollBarTP::~CFWL_ScrollBarTP() {} |
27 | 27 |
28 bool CFWL_ScrollBarTP::IsValidWidget(IFWL_Widget* pWidget) { | 28 bool CFWL_ScrollBarTP::IsValidWidget(CFWL_Widget* pWidget) { |
29 return pWidget && pWidget->GetClassID() == FWL_Type::ScrollBar; | 29 return pWidget && pWidget->GetClassID() == FWL_Type::ScrollBar; |
30 } | 30 } |
31 | 31 |
32 void* CFWL_ScrollBarTP::GetCapacity(CFWL_ThemePart* pThemePart, | 32 void* CFWL_ScrollBarTP::GetCapacity(CFWL_ThemePart* pThemePart, |
33 CFWL_WidgetCapacity dwCapacity) { | 33 CFWL_WidgetCapacity dwCapacity) { |
34 if (dwCapacity == CFWL_WidgetCapacity::Size) { | 34 if (dwCapacity == CFWL_WidgetCapacity::Size) { |
35 m_fValue = 5; | 35 m_fValue = 5; |
36 return &m_fValue; | 36 return &m_fValue; |
37 } | 37 } |
38 return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); | 38 return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); |
39 } | 39 } |
40 | 40 |
41 void CFWL_ScrollBarTP::DrawBackground(CFWL_ThemeBackground* pParams) { | 41 void CFWL_ScrollBarTP::DrawBackground(CFWL_ThemeBackground* pParams) { |
42 if (!pParams) | 42 if (!pParams) |
43 return; | 43 return; |
44 | 44 |
45 IFWL_Widget* pWidget = pParams->m_pWidget; | 45 CFWL_Widget* pWidget = pParams->m_pWidget; |
46 FWLTHEME_STATE eState = FWLTHEME_STATE_Normal; | 46 FWLTHEME_STATE eState = FWLTHEME_STATE_Normal; |
47 if (pParams->m_dwStates & CFWL_PartState_Hovered) | 47 if (pParams->m_dwStates & CFWL_PartState_Hovered) |
48 eState = FWLTHEME_STATE_Hover; | 48 eState = FWLTHEME_STATE_Hover; |
49 else if (pParams->m_dwStates & CFWL_PartState_Pressed) | 49 else if (pParams->m_dwStates & CFWL_PartState_Pressed) |
50 eState = FWLTHEME_STATE_Pressed; | 50 eState = FWLTHEME_STATE_Pressed; |
51 else if (pParams->m_dwStates & CFWL_PartState_Disabled) | 51 else if (pParams->m_dwStates & CFWL_PartState_Disabled) |
52 eState = FWLTHEME_STATE_Disable; | 52 eState = FWLTHEME_STATE_Disable; |
53 | 53 |
54 CFX_Graphics* pGraphics = pParams->m_pGraphics; | 54 CFX_Graphics* pGraphics = pParams->m_pGraphics; |
55 CFX_RectF* pRect = &pParams->m_rtPart; | 55 CFX_RectF* pRect = &pParams->m_rtPart; |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 m_pThemeData->clrBtnBK[1][1] = ArgbEncode(0xff, 204, 225, 255); | 273 m_pThemeData->clrBtnBK[1][1] = ArgbEncode(0xff, 204, 225, 255); |
274 m_pThemeData->clrBtnBorder[1] = ArgbEncode(0xff, 218, 230, 254); | 274 m_pThemeData->clrBtnBorder[1] = ArgbEncode(0xff, 218, 230, 254); |
275 m_pThemeData->clrPawColorLight[2] = ArgbEncode(0xff, 207, 221, 253); | 275 m_pThemeData->clrPawColorLight[2] = ArgbEncode(0xff, 207, 221, 253); |
276 m_pThemeData->clrPawColorDark[2] = ArgbEncode(0xff, 131, 158, 216); | 276 m_pThemeData->clrPawColorDark[2] = ArgbEncode(0xff, 131, 158, 216); |
277 m_pThemeData->clrBtnBK[2][0] = ArgbEncode(0xff, 167, 190, 245); | 277 m_pThemeData->clrBtnBK[2][0] = ArgbEncode(0xff, 167, 190, 245); |
278 m_pThemeData->clrBtnBK[2][1] = ArgbEncode(0xff, 146, 179, 249); | 278 m_pThemeData->clrBtnBK[2][1] = ArgbEncode(0xff, 146, 179, 249); |
279 m_pThemeData->clrBtnBorder[2] = ArgbEncode(0xff, 124, 159, 211); | 279 m_pThemeData->clrBtnBorder[2] = ArgbEncode(0xff, 124, 159, 211); |
280 m_pThemeData->clrTrackBKStart = ArgbEncode(0xff, 243, 241, 236); | 280 m_pThemeData->clrTrackBKStart = ArgbEncode(0xff, 243, 241, 236); |
281 m_pThemeData->clrTrackBKEnd = ArgbEncode(0xff, 254, 254, 251); | 281 m_pThemeData->clrTrackBKEnd = ArgbEncode(0xff, 254, 254, 251); |
282 } | 282 } |
OLD | NEW |