| 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/include/fwl/theme/comboboxtp.h" | 7 #include "xfa/include/fwl/theme/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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 65 } |
| 66 case FWL_PART_CMB_StretcgHandler: { | 66 case FWL_PART_CMB_StretcgHandler: { |
| 67 DrawStrethHandler(pParams, 0, &pParams->m_matrix); | 67 DrawStrethHandler(pParams, 0, &pParams->m_matrix); |
| 68 break; | 68 break; |
| 69 } | 69 } |
| 70 default: { return FALSE; } | 70 default: { return FALSE; } |
| 71 } | 71 } |
| 72 return TRUE; | 72 return TRUE; |
| 73 } | 73 } |
| 74 void CFWL_ComboBoxTP::DrawStrethHandler(CFWL_ThemeBackground* pParams, | 74 void CFWL_ComboBoxTP::DrawStrethHandler(CFWL_ThemeBackground* pParams, |
| 75 FX_DWORD dwStates, | 75 uint32_t dwStates, |
| 76 CFX_Matrix* pMatrix) { | 76 CFX_Matrix* pMatrix) { |
| 77 CFX_Path path; | 77 CFX_Path path; |
| 78 path.Create(); | 78 path.Create(); |
| 79 path.AddRectangle(pParams->m_rtPart.left, pParams->m_rtPart.top, | 79 path.AddRectangle(pParams->m_rtPart.left, pParams->m_rtPart.top, |
| 80 pParams->m_rtPart.width - 1, pParams->m_rtPart.height); | 80 pParams->m_rtPart.width - 1, pParams->m_rtPart.height); |
| 81 CFX_Color cr(ArgbEncode(0xff, 0xff, 0, 0)); | 81 CFX_Color cr(ArgbEncode(0xff, 0xff, 0, 0)); |
| 82 pParams->m_pGraphics->SetFillColor(&cr); | 82 pParams->m_pGraphics->SetFillColor(&cr); |
| 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 FX_DWORD 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 #ifdef THEME_XPSimilar |
| 94 void CFWL_ComboBoxTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, | 94 void CFWL_ComboBoxTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, |
| 95 FX_DWORD 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 | 120 #else |
| 121 void CFWL_ComboBoxTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, | 121 void CFWL_ComboBoxTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, |
| 122 FX_DWORD dwStates, | 122 uint32_t dwStates, |
| 123 CFX_Matrix* pMatrix) { | 123 CFX_Matrix* pMatrix) { |
| 124 FX_BOOL bPressed = ((pParams->m_dwStates & FWL_CMBPARTSTATE_Pressed) == | 124 FX_BOOL bPressed = ((pParams->m_dwStates & FWL_CMBPARTSTATE_Pressed) == |
| 125 FWL_CMBPARTSTATE_Pressed); | 125 FWL_CMBPARTSTATE_Pressed); |
| 126 FX_FLOAT fWidth = bPressed ? 1.0f : 2.0f; | 126 FX_FLOAT fWidth = bPressed ? 1.0f : 2.0f; |
| 127 FWLTHEME_EDGE eType = bPressed ? FWLTHEME_EDGE_Flat : FWLTHEME_EDGE_Raised; | 127 FWLTHEME_EDGE eType = bPressed ? FWLTHEME_EDGE_Flat : FWLTHEME_EDGE_Raised; |
| 128 Draw3DRect(pParams->m_pGraphics, eType, fWidth, &pParams->m_rtPart, | 128 Draw3DRect(pParams->m_pGraphics, eType, fWidth, &pParams->m_rtPart, |
| 129 FWLTHEME_COLOR_EDGELT1, FWLTHEME_COLOR_EDGELT2, | 129 FWLTHEME_COLOR_EDGELT1, FWLTHEME_COLOR_EDGELT2, |
| 130 FWLTHEME_COLOR_EDGERB1, FWLTHEME_COLOR_EDGERB2, pMatrix); | 130 FWLTHEME_COLOR_EDGERB1, FWLTHEME_COLOR_EDGERB2, pMatrix); |
| 131 CFX_Path path; | 131 CFX_Path path; |
| 132 path.Create(); | 132 path.Create(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 151 } | 151 } |
| 152 case FWL_CMBPARTSTATE_Disabled: { | 152 case FWL_CMBPARTSTATE_Disabled: { |
| 153 argbFill = 0xFFF0F0F0; | 153 argbFill = 0xFFF0F0F0; |
| 154 break; | 154 break; |
| 155 } | 155 } |
| 156 } | 156 } |
| 157 DrawArrow(pParams->m_pGraphics, &pParams->m_rtPart, FWLTHEME_DIRECTION_Down, | 157 DrawArrow(pParams->m_pGraphics, &pParams->m_rtPart, FWLTHEME_DIRECTION_Down, |
| 158 argbFill, bPressed, &pParams->m_matrix); | 158 argbFill, bPressed, &pParams->m_matrix); |
| 159 } | 159 } |
| 160 #endif | 160 #endif |
| OLD | NEW |