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/basewidget/ifwl_combobox.h" | 9 #include "xfa/fwl/basewidget/ifwl_combobox.h" |
10 #include "xfa/fwl/core/cfwl_themebackground.h" | 10 #include "xfa/fwl/core/cfwl_themebackground.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, &pParams->m_matrix); | 83 pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, &pParams->m_matrix); |
84 } | 84 } |
85 void* CFWL_ComboBoxTP::GetCapacity(CFWL_ThemePart* pThemePart, | 85 void* CFWL_ComboBoxTP::GetCapacity(CFWL_ThemePart* pThemePart, |
86 uint32_t dwCapacity) { | 86 uint32_t dwCapacity) { |
87 if (dwCapacity == FWL_WGTCAPACITY_CMB_ComboFormHandler) { | 87 if (dwCapacity == FWL_WGTCAPACITY_CMB_ComboFormHandler) { |
88 m_fValue = FWLTHEME_CAPACITY_ComboFormHandler; | 88 m_fValue = FWLTHEME_CAPACITY_ComboFormHandler; |
89 return &m_fValue; | 89 return &m_fValue; |
90 } | 90 } |
91 return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); | 91 return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); |
92 } | 92 } |
93 #ifdef THEME_XPSimilar | 93 |
94 void CFWL_ComboBoxTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, | 94 void CFWL_ComboBoxTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, |
95 uint32_t dwStates, | 95 uint32_t dwStates, |
96 CFX_Matrix* pMatrix) { | 96 CFX_Matrix* pMatrix) { |
97 FWLTHEME_STATE eState = FWLTHEME_STATE_Normal; | 97 FWLTHEME_STATE eState = FWLTHEME_STATE_Normal; |
98 switch (dwStates) { | 98 switch (dwStates) { |
99 case FWL_PARTSTATE_CMB_Normal: { | 99 case FWL_PARTSTATE_CMB_Normal: { |
100 eState = FWLTHEME_STATE_Normal; | 100 eState = FWLTHEME_STATE_Normal; |
101 break; | 101 break; |
102 } | 102 } |
103 case FWL_PARTSTATE_CMB_Hovered: { | 103 case FWL_PARTSTATE_CMB_Hovered: { |
104 eState = FWLTHEME_STATE_Hover; | 104 eState = FWLTHEME_STATE_Hover; |
105 break; | 105 break; |
106 } | 106 } |
107 case FWL_PARTSTATE_CMB_Pressed: { | 107 case FWL_PARTSTATE_CMB_Pressed: { |
108 eState = FWLTHEME_STATE_Pressed; | 108 eState = FWLTHEME_STATE_Pressed; |
109 break; | 109 break; |
110 } | 110 } |
111 case FWL_PARTSTATE_CMB_Disabled: { | 111 case FWL_PARTSTATE_CMB_Disabled: { |
112 eState = FWLTHEME_STATE_Disabale; | 112 eState = FWLTHEME_STATE_Disabale; |
113 break; | 113 break; |
114 } | 114 } |
115 default: {} | 115 default: {} |
116 } | 116 } |
117 DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart, | 117 DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart, |
118 FWLTHEME_DIRECTION_Down, eState, &pParams->m_matrix); | 118 FWLTHEME_DIRECTION_Down, eState, &pParams->m_matrix); |
119 } | 119 } |
120 #else | |
121 void CFWL_ComboBoxTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, | |
122 uint32_t dwStates, | |
123 CFX_Matrix* pMatrix) { | |
124 FX_BOOL bPressed = ((pParams->m_dwStates & FWL_CMBPARTSTATE_Pressed) == | |
125 FWL_CMBPARTSTATE_Pressed); | |
126 FX_FLOAT fWidth = bPressed ? 1.0f : 2.0f; | |
127 FWLTHEME_EDGE eType = bPressed ? FWLTHEME_EDGE_Flat : FWLTHEME_EDGE_Raised; | |
128 Draw3DRect(pParams->m_pGraphics, eType, fWidth, &pParams->m_rtPart, | |
129 FWLTHEME_COLOR_EDGELT1, FWLTHEME_COLOR_EDGELT2, | |
130 FWLTHEME_COLOR_EDGERB1, FWLTHEME_COLOR_EDGERB2, pMatrix); | |
131 CFX_Path path; | |
132 path.Create(); | |
133 path.AddRectangle(pParams->m_rtPart.left + fWidth, | |
134 pParams->m_rtPart.top + fWidth, | |
135 pParams->m_rtPart.width - 2 * fWidth, | |
136 pParams->m_rtPart.height - 2 * fWidth); | |
137 pParams->m_pGraphics->SaveGraphState(); | |
138 CFX_Color crFill(FWLTHEME_COLOR_Background); | |
139 pParams->m_pGraphics->SetFillColor(&crFill); | |
140 pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, &pParams->m_matrix); | |
141 pParams->m_pGraphics->RestoreGraphState(); | |
142 FX_ARGB argbFill = ArgbEncode(255, 77, 97, 133); | |
143 switch (pParams->m_dwStates & 0x03) { | |
144 case FWL_CMBPARTSTATE_Normal: { | |
145 } | |
146 case FWL_CMBPARTSTATE_Hovered: { | |
147 } | |
148 case FWL_CMBPARTSTATE_Pressed: { | |
149 argbFill = 0xFF000000; | |
150 break; | |
151 } | |
152 case FWL_CMBPARTSTATE_Disabled: { | |
153 argbFill = 0xFFF0F0F0; | |
154 break; | |
155 } | |
156 } | |
157 DrawArrow(pParams->m_pGraphics, &pParams->m_rtPart, FWLTHEME_DIRECTION_Down, | |
158 argbFill, bPressed, &pParams->m_matrix); | |
159 } | |
160 #endif | |
OLD | NEW |