| 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/cfwl_spinbutton.h" | 7 #include "xfa/fwl/cfwl_spinbutton.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 m_rtDnButton.Set(m_rtClient.left + m_rtClient.width / 2, m_rtClient.top, | 62 m_rtDnButton.Set(m_rtClient.left + m_rtClient.width / 2, m_rtClient.top, |
| 63 m_rtClient.width / 2, m_rtClient.height); | 63 m_rtClient.width / 2, m_rtClient.height); |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 | 66 |
| 67 FWL_WidgetHit CFWL_SpinButton::HitTest(FX_FLOAT fx, FX_FLOAT fy) { | 67 FWL_WidgetHit CFWL_SpinButton::HitTest(FX_FLOAT fx, FX_FLOAT fy) { |
| 68 if (m_rtClient.Contains(fx, fy)) | 68 if (m_rtClient.Contains(fx, fy)) |
| 69 return FWL_WidgetHit::Client; | 69 return FWL_WidgetHit::Client; |
| 70 if (HasBorder() && (m_rtClient.Contains(fx, fy))) | 70 if (HasBorder() && (m_rtClient.Contains(fx, fy))) |
| 71 return FWL_WidgetHit::Border; | 71 return FWL_WidgetHit::Border; |
| 72 if (HasEdge() && GetEdgeRect().Contains(fx, fy)) | |
| 73 return FWL_WidgetHit::Left; | |
| 74 if (m_rtUpButton.Contains(fx, fy)) | 72 if (m_rtUpButton.Contains(fx, fy)) |
| 75 return FWL_WidgetHit::UpButton; | 73 return FWL_WidgetHit::UpButton; |
| 76 if (m_rtDnButton.Contains(fx, fy)) | 74 if (m_rtDnButton.Contains(fx, fy)) |
| 77 return FWL_WidgetHit::DownButton; | 75 return FWL_WidgetHit::DownButton; |
| 78 return FWL_WidgetHit::Unknown; | 76 return FWL_WidgetHit::Unknown; |
| 79 } | 77 } |
| 80 | 78 |
| 81 void CFWL_SpinButton::DrawWidget(CFX_Graphics* pGraphics, | 79 void CFWL_SpinButton::DrawWidget(CFX_Graphics* pGraphics, |
| 82 const CFX_Matrix* pMatrix) { | 80 const CFX_Matrix* pMatrix) { |
| 83 if (!pGraphics) | 81 if (!pGraphics) |
| 84 return; | 82 return; |
| 85 | 83 |
| 86 CFX_RectF rtClip(m_rtClient); | 84 CFX_RectF rtClip(m_rtClient); |
| 87 if (pMatrix) | 85 if (pMatrix) |
| 88 pMatrix->TransformRect(rtClip); | 86 pMatrix->TransformRect(rtClip); |
| 89 | 87 |
| 90 IFWL_ThemeProvider* pTheme = GetAvailableTheme(); | 88 IFWL_ThemeProvider* pTheme = GetAvailableTheme(); |
| 91 if (HasBorder()) | 89 if (HasBorder()) |
| 92 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); | 90 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); |
| 93 if (HasEdge()) | |
| 94 DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); | |
| 95 | 91 |
| 96 DrawUpButton(pGraphics, pTheme, pMatrix); | 92 DrawUpButton(pGraphics, pTheme, pMatrix); |
| 97 DrawDownButton(pGraphics, pTheme, pMatrix); | 93 DrawDownButton(pGraphics, pTheme, pMatrix); |
| 98 } | 94 } |
| 99 | 95 |
| 100 void CFWL_SpinButton::DisableButton() { | 96 void CFWL_SpinButton::DisableButton() { |
| 101 m_dwDnState = CFWL_PartState_Disabled; | 97 m_dwDnState = CFWL_PartState_Disabled; |
| 102 } | 98 } |
| 103 | 99 |
| 104 bool CFWL_SpinButton::IsUpButtonEnabled() { | 100 bool CFWL_SpinButton::IsUpButtonEnabled() { |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 | 346 |
| 351 void CFWL_SpinButton::Timer::Run(CFWL_TimerInfo* pTimerInfo) { | 347 void CFWL_SpinButton::Timer::Run(CFWL_TimerInfo* pTimerInfo) { |
| 352 CFWL_SpinButton* pButton = static_cast<CFWL_SpinButton*>(m_pWidget); | 348 CFWL_SpinButton* pButton = static_cast<CFWL_SpinButton*>(m_pWidget); |
| 353 | 349 |
| 354 if (!pButton->m_pTimerInfo) | 350 if (!pButton->m_pTimerInfo) |
| 355 return; | 351 return; |
| 356 | 352 |
| 357 CFWL_Event wmPosChanged(CFWL_Event::Type::Click, pButton); | 353 CFWL_Event wmPosChanged(CFWL_Event::Type::Click, pButton); |
| 358 pButton->DispatchEvent(&wmPosChanged); | 354 pButton->DispatchEvent(&wmPosChanged); |
| 359 } | 355 } |
| OLD | NEW |