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_comboboxtp.h" | 7 #include "xfa/fwl/theme/cfwl_comboboxtp.h" |
8 | 8 |
9 #include "xfa/fwl/core/cfwl_themebackground.h" | 9 #include "xfa/fwl/core/cfwl_themebackground.h" |
10 #include "xfa/fwl/core/ifwl_combobox.h" | 10 #include "xfa/fwl/core/ifwl_combobox.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 CFWL_ComboBoxTP::CFWL_ComboBoxTP() { | 22 CFWL_ComboBoxTP::CFWL_ComboBoxTP() { |
23 m_dwThemeID = 0; | 23 m_dwThemeID = 0; |
24 } | 24 } |
25 | 25 |
26 CFWL_ComboBoxTP::~CFWL_ComboBoxTP() {} | 26 CFWL_ComboBoxTP::~CFWL_ComboBoxTP() {} |
27 | 27 |
28 bool CFWL_ComboBoxTP::IsValidWidget(IFWL_Widget* pWidget) { | 28 bool CFWL_ComboBoxTP::IsValidWidget(IFWL_Widget* pWidget) { |
29 return pWidget && pWidget->GetClassID() == FWL_Type::ComboBox; | 29 return pWidget && pWidget->GetClassID() == FWL_Type::ComboBox; |
30 } | 30 } |
31 | 31 |
32 FX_BOOL CFWL_ComboBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { | 32 void CFWL_ComboBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { |
33 if (!pParams) | 33 if (!pParams) |
34 return FALSE; | 34 return; |
| 35 |
35 switch (pParams->m_iPart) { | 36 switch (pParams->m_iPart) { |
36 case CFWL_Part::Border: { | 37 case CFWL_Part::Border: { |
37 DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); | 38 DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); |
38 break; | 39 break; |
39 } | 40 } |
40 case CFWL_Part::Edge: { | 41 case CFWL_Part::Edge: { |
41 DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), | 42 DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), |
42 &pParams->m_rtPart, &pParams->m_matrix); | 43 &pParams->m_rtPart, &pParams->m_matrix); |
43 break; | 44 break; |
44 } | 45 } |
(...skipping 21 matching lines...) Expand all Loading... |
66 break; | 67 break; |
67 } | 68 } |
68 case CFWL_Part::DropDownButton: { | 69 case CFWL_Part::DropDownButton: { |
69 DrawDropDownButton(pParams, pParams->m_dwStates, &pParams->m_matrix); | 70 DrawDropDownButton(pParams, pParams->m_dwStates, &pParams->m_matrix); |
70 break; | 71 break; |
71 } | 72 } |
72 case CFWL_Part::StretchHandler: { | 73 case CFWL_Part::StretchHandler: { |
73 DrawStrethHandler(pParams, 0, &pParams->m_matrix); | 74 DrawStrethHandler(pParams, 0, &pParams->m_matrix); |
74 break; | 75 break; |
75 } | 76 } |
76 default: { return FALSE; } | 77 default: |
| 78 break; |
77 } | 79 } |
78 return TRUE; | |
79 } | 80 } |
| 81 |
80 void CFWL_ComboBoxTP::DrawStrethHandler(CFWL_ThemeBackground* pParams, | 82 void CFWL_ComboBoxTP::DrawStrethHandler(CFWL_ThemeBackground* pParams, |
81 uint32_t dwStates, | 83 uint32_t dwStates, |
82 CFX_Matrix* pMatrix) { | 84 CFX_Matrix* pMatrix) { |
83 CFX_Path path; | 85 CFX_Path path; |
84 path.Create(); | 86 path.Create(); |
85 path.AddRectangle(pParams->m_rtPart.left, pParams->m_rtPart.top, | 87 path.AddRectangle(pParams->m_rtPart.left, pParams->m_rtPart.top, |
86 pParams->m_rtPart.width - 1, pParams->m_rtPart.height); | 88 pParams->m_rtPart.width - 1, pParams->m_rtPart.height); |
87 CFX_Color cr(ArgbEncode(0xff, 0xff, 0, 0)); | 89 CFX_Color cr(ArgbEncode(0xff, 0xff, 0, 0)); |
88 pParams->m_pGraphics->SetFillColor(&cr); | 90 pParams->m_pGraphics->SetFillColor(&cr); |
89 pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, &pParams->m_matrix); | 91 pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, &pParams->m_matrix); |
90 } | 92 } |
| 93 |
91 void* CFWL_ComboBoxTP::GetCapacity(CFWL_ThemePart* pThemePart, | 94 void* CFWL_ComboBoxTP::GetCapacity(CFWL_ThemePart* pThemePart, |
92 CFWL_WidgetCapacity dwCapacity) { | 95 CFWL_WidgetCapacity dwCapacity) { |
93 if (dwCapacity == CFWL_WidgetCapacity::ComboFormHandler) { | 96 if (dwCapacity == CFWL_WidgetCapacity::ComboFormHandler) { |
94 m_fValue = kComboFormHandler; | 97 m_fValue = kComboFormHandler; |
95 return &m_fValue; | 98 return &m_fValue; |
96 } | 99 } |
97 return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); | 100 return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); |
98 } | 101 } |
99 | 102 |
100 void CFWL_ComboBoxTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, | 103 void CFWL_ComboBoxTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, |
101 uint32_t dwStates, | 104 uint32_t dwStates, |
102 CFX_Matrix* pMatrix) { | 105 CFX_Matrix* pMatrix) { |
103 FWLTHEME_STATE eState = FWLTHEME_STATE_Normal; | 106 FWLTHEME_STATE eState = FWLTHEME_STATE_Normal; |
104 switch (dwStates) { | 107 switch (dwStates) { |
105 case CFWL_PartState_Normal: { | 108 case CFWL_PartState_Normal: { |
106 eState = FWLTHEME_STATE_Normal; | 109 eState = FWLTHEME_STATE_Normal; |
107 break; | 110 break; |
108 } | 111 } |
109 case CFWL_PartState_Hovered: { | 112 case CFWL_PartState_Hovered: { |
110 eState = FWLTHEME_STATE_Hover; | 113 eState = FWLTHEME_STATE_Hover; |
111 break; | 114 break; |
112 } | 115 } |
113 case CFWL_PartState_Pressed: { | 116 case CFWL_PartState_Pressed: { |
114 eState = FWLTHEME_STATE_Pressed; | 117 eState = FWLTHEME_STATE_Pressed; |
115 break; | 118 break; |
116 } | 119 } |
117 case CFWL_PartState_Disabled: { | 120 case CFWL_PartState_Disabled: { |
118 eState = FWLTHEME_STATE_Disabale; | 121 eState = FWLTHEME_STATE_Disable; |
119 break; | 122 break; |
120 } | 123 } |
121 default: {} | 124 default: |
| 125 break; |
122 } | 126 } |
123 DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart, | 127 DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart, |
124 FWLTHEME_DIRECTION_Down, eState, &pParams->m_matrix); | 128 FWLTHEME_DIRECTION_Down, eState, &pParams->m_matrix); |
125 } | 129 } |
OLD | NEW |