| 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/pushbuttontp.h" | 7 #include "xfa/include/fwl/theme/pushbuttontp.h" |
| 8 | 8 |
| 9 #include "xfa/fwl/basewidget/ifwl_pushbutton.h" | 9 #include "xfa/fwl/basewidget/ifwl_pushbutton.h" |
| 10 #include "xfa/fwl/core/cfwl_themebackground.h" | 10 #include "xfa/fwl/core/cfwl_themebackground.h" |
| 11 #include "xfa/fwl/core/ifwl_themeprovider.h" | 11 #include "xfa/fwl/core/ifwl_themeprovider.h" |
| 12 #include "xfa/fwl/core/ifwl_widget.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 #define PUSHBUTTON_SIZE_Corner 2 | 16 #define PUSHBUTTON_SIZE_Corner 2 |
| 17 | 17 |
| 18 CFWL_PushButtonTP::CFWL_PushButtonTP() { | 18 CFWL_PushButtonTP::CFWL_PushButtonTP() { |
| 19 m_pThemeData = new PBThemeData; | 19 m_pThemeData = new PBThemeData; |
| 20 SetThemeData(0); | 20 SetThemeData(0); |
| 21 } | 21 } |
| 22 CFWL_PushButtonTP::~CFWL_PushButtonTP() { | 22 CFWL_PushButtonTP::~CFWL_PushButtonTP() { |
| 23 if (m_pThemeData) { | 23 if (m_pThemeData) { |
| 24 delete m_pThemeData; | 24 delete m_pThemeData; |
| 25 } | 25 } |
| 26 } | 26 } |
| 27 FX_BOOL CFWL_PushButtonTP::IsValidWidget(IFWL_Widget* pWidget) { | 27 FX_BOOL CFWL_PushButtonTP::IsValidWidget(IFWL_Widget* pWidget) { |
| 28 return pWidget->GetClassID() == FWL_CLASSHASH_PushButton; | 28 return pWidget->GetClassID() == FWL_CLASSHASH_PushButton; |
| 29 } | 29 } |
| 30 FX_DWORD CFWL_PushButtonTP::SetThemeID(IFWL_Widget* pWidget, | 30 uint32_t CFWL_PushButtonTP::SetThemeID(IFWL_Widget* pWidget, |
| 31 FX_DWORD dwThemeID, | 31 uint32_t dwThemeID, |
| 32 FX_BOOL bChildren) { | 32 FX_BOOL bChildren) { |
| 33 SetThemeData(FWL_GetThemeColor(dwThemeID)); | 33 SetThemeData(FWL_GetThemeColor(dwThemeID)); |
| 34 return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren); | 34 return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren); |
| 35 } | 35 } |
| 36 FX_BOOL CFWL_PushButtonTP::DrawBackground(CFWL_ThemeBackground* pParams) { | 36 FX_BOOL CFWL_PushButtonTP::DrawBackground(CFWL_ThemeBackground* pParams) { |
| 37 switch (pParams->m_iPart) { | 37 switch (pParams->m_iPart) { |
| 38 case FWL_PART_PSB_Border: { | 38 case FWL_PART_PSB_Border: { |
| 39 DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); | 39 DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); |
| 40 break; | 40 break; |
| 41 } | 41 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 DrawFocus(pGraphics, &rtInner, &pParams->m_matrix); | 89 DrawFocus(pGraphics, &rtInner, &pParams->m_matrix); |
| 90 } | 90 } |
| 91 pGraphics->RestoreGraphState(); | 91 pGraphics->RestoreGraphState(); |
| 92 break; | 92 break; |
| 93 } | 93 } |
| 94 default: {} | 94 default: {} |
| 95 } | 95 } |
| 96 return TRUE; | 96 return TRUE; |
| 97 } | 97 } |
| 98 void* CFWL_PushButtonTP::GetCapacity(CFWL_ThemePart* pThemePart, | 98 void* CFWL_PushButtonTP::GetCapacity(CFWL_ThemePart* pThemePart, |
| 99 FX_DWORD dwCapacity) { | 99 uint32_t dwCapacity) { |
| 100 if (dwCapacity == FWL_WGTCAPACITY_PSB_Margin) { | 100 if (dwCapacity == FWL_WGTCAPACITY_PSB_Margin) { |
| 101 m_fValue = 0; | 101 m_fValue = 0; |
| 102 return &m_fValue; | 102 return &m_fValue; |
| 103 } | 103 } |
| 104 return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); | 104 return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); |
| 105 } | 105 } |
| 106 FWL_ERR CFWL_PushButtonTP::Initialize() { | 106 FWL_ERR CFWL_PushButtonTP::Initialize() { |
| 107 InitTTO(); | 107 InitTTO(); |
| 108 return CFWL_WidgetTP::Initialize(); | 108 return CFWL_WidgetTP::Initialize(); |
| 109 } | 109 } |
| 110 FWL_ERR CFWL_PushButtonTP::Finalize() { | 110 FWL_ERR CFWL_PushButtonTP::Finalize() { |
| 111 FinalizeTTO(); | 111 FinalizeTTO(); |
| 112 return CFWL_WidgetTP::Finalize(); | 112 return CFWL_WidgetTP::Finalize(); |
| 113 } | 113 } |
| 114 void CFWL_PushButtonTP::SetThemeData(FX_DWORD dwID) { | 114 void CFWL_PushButtonTP::SetThemeData(uint32_t dwID) { |
| 115 if (dwID) { | 115 if (dwID) { |
| 116 m_pThemeData->clrBorder[0] = ArgbEncode(255, 55, 98, 6); | 116 m_pThemeData->clrBorder[0] = ArgbEncode(255, 55, 98, 6); |
| 117 m_pThemeData->clrBorder[1] = ArgbEncode(255, 55, 98, 6); | 117 m_pThemeData->clrBorder[1] = ArgbEncode(255, 55, 98, 6); |
| 118 m_pThemeData->clrBorder[2] = ArgbEncode(255, 55, 98, 6); | 118 m_pThemeData->clrBorder[2] = ArgbEncode(255, 55, 98, 6); |
| 119 m_pThemeData->clrBorder[3] = ArgbEncode(255, 55, 98, 6); | 119 m_pThemeData->clrBorder[3] = ArgbEncode(255, 55, 98, 6); |
| 120 m_pThemeData->clrBorder[4] = ArgbEncode(255, 172, 168, 153); | 120 m_pThemeData->clrBorder[4] = ArgbEncode(255, 172, 168, 153); |
| 121 m_pThemeData->clrStart[0] = ArgbEncode(255, 255, 255, 246); | 121 m_pThemeData->clrStart[0] = ArgbEncode(255, 255, 255, 246); |
| 122 m_pThemeData->clrStart[1] = ArgbEncode(255, 223, 205, 180); | 122 m_pThemeData->clrStart[1] = ArgbEncode(255, 223, 205, 180); |
| 123 m_pThemeData->clrStart[2] = ArgbEncode(255, 252, 197, 149); | 123 m_pThemeData->clrStart[2] = ArgbEncode(255, 252, 197, 149); |
| 124 m_pThemeData->clrStart[3] = ArgbEncode(255, 194, 209, 143); | 124 m_pThemeData->clrStart[3] = ArgbEncode(255, 194, 209, 143); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 149 m_pThemeData->clrEnd[2] = ArgbEncode(255, 229, 151, 0); | 149 m_pThemeData->clrEnd[2] = ArgbEncode(255, 229, 151, 0); |
| 150 m_pThemeData->clrEnd[3] = ArgbEncode(255, 105, 130, 238); | 150 m_pThemeData->clrEnd[3] = ArgbEncode(255, 105, 130, 238); |
| 151 m_pThemeData->clrEnd[4] = ArgbEncode(255, 245, 244, 234); | 151 m_pThemeData->clrEnd[4] = ArgbEncode(255, 245, 244, 234); |
| 152 m_pThemeData->clrFill[0] = ArgbEncode(255, 255, 255, 255); | 152 m_pThemeData->clrFill[0] = ArgbEncode(255, 255, 255, 255); |
| 153 m_pThemeData->clrFill[1] = ArgbEncode(255, 226, 225, 218); | 153 m_pThemeData->clrFill[1] = ArgbEncode(255, 226, 225, 218); |
| 154 m_pThemeData->clrFill[2] = ArgbEncode(255, 255, 255, 255); | 154 m_pThemeData->clrFill[2] = ArgbEncode(255, 255, 255, 255); |
| 155 m_pThemeData->clrFill[3] = ArgbEncode(255, 255, 255, 255); | 155 m_pThemeData->clrFill[3] = ArgbEncode(255, 255, 255, 255); |
| 156 m_pThemeData->clrFill[4] = ArgbEncode(255, 245, 244, 234); | 156 m_pThemeData->clrFill[4] = ArgbEncode(255, 245, 244, 234); |
| 157 } | 157 } |
| 158 } | 158 } |
| 159 int32_t CFWL_PushButtonTP::GetColorID(FX_DWORD dwStates) { | 159 int32_t CFWL_PushButtonTP::GetColorID(uint32_t dwStates) { |
| 160 return dwStates &= FWL_PARTSTATE_PSB_Mask; | 160 return dwStates &= FWL_PARTSTATE_PSB_Mask; |
| 161 } | 161 } |
| OLD | NEW |