| 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/core/ifwl_spinbutton.h" | 7 #include "xfa/fwl/core/ifwl_spinbutton.h" |
| 8 | 8 |
| 9 #include "third_party/base/ptr_util.h" | 9 #include "third_party/base/ptr_util.h" |
| 10 #include "xfa/fwl/core/cfwl_message.h" | 10 #include "xfa/fwl/core/cfwl_message.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 IFWL_ThemeProvider* pTheme = GetAvailableTheme(); | 103 IFWL_ThemeProvider* pTheme = GetAvailableTheme(); |
| 104 if (HasBorder()) | 104 if (HasBorder()) |
| 105 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); | 105 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); |
| 106 if (HasEdge()) | 106 if (HasEdge()) |
| 107 DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); | 107 DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); |
| 108 | 108 |
| 109 DrawUpButton(pGraphics, pTheme, pMatrix); | 109 DrawUpButton(pGraphics, pTheme, pMatrix); |
| 110 DrawDownButton(pGraphics, pTheme, pMatrix); | 110 DrawDownButton(pGraphics, pTheme, pMatrix); |
| 111 } | 111 } |
| 112 | 112 |
| 113 FWL_Error IFWL_SpinButton::EnableButton(bool bEnable, bool bUp) { | 113 void IFWL_SpinButton::EnableButton(bool bEnable, bool bUp) { |
| 114 if (bUp) | 114 if (bUp) |
| 115 m_dwUpState = bEnable ? CFWL_PartState_Normal : CFWL_PartState_Disabled; | 115 m_dwUpState = bEnable ? CFWL_PartState_Normal : CFWL_PartState_Disabled; |
| 116 else | 116 else |
| 117 m_dwDnState = bEnable ? CFWL_PartState_Normal : CFWL_PartState_Disabled; | 117 m_dwDnState = bEnable ? CFWL_PartState_Normal : CFWL_PartState_Disabled; |
| 118 | |
| 119 return FWL_Error::Succeeded; | |
| 120 } | 118 } |
| 121 | 119 |
| 122 bool IFWL_SpinButton::IsButtonEnable(bool bUp) { | 120 bool IFWL_SpinButton::IsButtonEnable(bool bUp) { |
| 123 if (bUp) | 121 if (bUp) |
| 124 return (m_dwUpState != CFWL_PartState_Disabled); | 122 return (m_dwUpState != CFWL_PartState_Disabled); |
| 125 return (m_dwDnState != CFWL_PartState_Disabled); | 123 return (m_dwDnState != CFWL_PartState_Disabled); |
| 126 } | 124 } |
| 127 | 125 |
| 128 void IFWL_SpinButton::DrawUpButton(CFX_Graphics* pGraphics, | 126 void IFWL_SpinButton::DrawUpButton(CFX_Graphics* pGraphics, |
| 129 IFWL_ThemeProvider* pTheme, | 127 IFWL_ThemeProvider* pTheme, |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 IFWL_SpinButton* pButton = static_cast<IFWL_SpinButton*>(m_pWidget); | 375 IFWL_SpinButton* pButton = static_cast<IFWL_SpinButton*>(m_pWidget); |
| 378 | 376 |
| 379 if (!pButton->m_pTimerInfo) | 377 if (!pButton->m_pTimerInfo) |
| 380 return; | 378 return; |
| 381 | 379 |
| 382 CFWL_EvtSpbClick wmPosChanged; | 380 CFWL_EvtSpbClick wmPosChanged; |
| 383 wmPosChanged.m_pSrcTarget = pButton; | 381 wmPosChanged.m_pSrcTarget = pButton; |
| 384 wmPosChanged.m_bUp = pButton->m_iButtonIndex == 0; | 382 wmPosChanged.m_bUp = pButton->m_iButtonIndex == 0; |
| 385 pButton->DispatchEvent(&wmPosChanged); | 383 pButton->DispatchEvent(&wmPosChanged); |
| 386 } | 384 } |
| OLD | NEW |