| 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 29 matching lines...) Expand all Loading... |
| 40 m_pProperties->m_dwStyleExes |= FWL_STYLEEXE_SPB_Vert; | 40 m_pProperties->m_dwStyleExes |= FWL_STYLEEXE_SPB_Vert; |
| 41 } | 41 } |
| 42 | 42 |
| 43 IFWL_SpinButton::~IFWL_SpinButton() {} | 43 IFWL_SpinButton::~IFWL_SpinButton() {} |
| 44 | 44 |
| 45 FWL_Type IFWL_SpinButton::GetClassID() const { | 45 FWL_Type IFWL_SpinButton::GetClassID() const { |
| 46 return FWL_Type::SpinButton; | 46 return FWL_Type::SpinButton; |
| 47 } | 47 } |
| 48 | 48 |
| 49 void IFWL_SpinButton::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { | 49 void IFWL_SpinButton::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { |
| 50 if (bAutoSize) { | 50 if (!bAutoSize) { |
| 51 rect.Set(0, 0, kMinWidth, kMinHeight); | |
| 52 IFWL_Widget::GetWidgetRect(rect, true); | |
| 53 } else { | |
| 54 rect = m_pProperties->m_rtWidget; | 51 rect = m_pProperties->m_rtWidget; |
| 52 return; |
| 55 } | 53 } |
| 54 |
| 55 rect.Set(0, 0, kMinWidth, kMinHeight); |
| 56 IFWL_Widget::GetWidgetRect(rect, true); |
| 56 } | 57 } |
| 57 | 58 |
| 58 void IFWL_SpinButton::Update() { | 59 void IFWL_SpinButton::Update() { |
| 59 if (IsLocked()) { | 60 if (IsLocked()) |
| 60 return; | 61 return; |
| 61 } | 62 |
| 62 GetClientRect(m_rtClient); | 63 GetClientRect(m_rtClient); |
| 63 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXE_SPB_Vert) { | 64 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXE_SPB_Vert) { |
| 64 m_rtUpButton.Set(m_rtClient.top, m_rtClient.left, m_rtClient.width, | 65 m_rtUpButton.Set(m_rtClient.top, m_rtClient.left, m_rtClient.width, |
| 65 m_rtClient.height / 2); | 66 m_rtClient.height / 2); |
| 66 m_rtDnButton.Set(m_rtClient.left, m_rtClient.top + m_rtClient.height / 2, | 67 m_rtDnButton.Set(m_rtClient.left, m_rtClient.top + m_rtClient.height / 2, |
| 67 m_rtClient.width, m_rtClient.height / 2); | 68 m_rtClient.width, m_rtClient.height / 2); |
| 68 } else { | 69 } else { |
| 69 m_rtUpButton.Set(m_rtClient.left, m_rtClient.top, m_rtClient.width / 2, | 70 m_rtUpButton.Set(m_rtClient.left, m_rtClient.top, m_rtClient.width / 2, |
| 70 m_rtClient.height); | 71 m_rtClient.height); |
| 71 m_rtDnButton.Set(m_rtClient.left + m_rtClient.width / 2, m_rtClient.top, | 72 m_rtDnButton.Set(m_rtClient.left + m_rtClient.width / 2, m_rtClient.top, |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 IFWL_SpinButton* pButton = static_cast<IFWL_SpinButton*>(m_pWidget); | 376 IFWL_SpinButton* pButton = static_cast<IFWL_SpinButton*>(m_pWidget); |
| 376 | 377 |
| 377 if (!pButton->m_pTimerInfo) | 378 if (!pButton->m_pTimerInfo) |
| 378 return; | 379 return; |
| 379 | 380 |
| 380 CFWL_EvtSpbClick wmPosChanged; | 381 CFWL_EvtSpbClick wmPosChanged; |
| 381 wmPosChanged.m_pSrcTarget = pButton; | 382 wmPosChanged.m_pSrcTarget = pButton; |
| 382 wmPosChanged.m_bUp = pButton->m_iButtonIndex == 0; | 383 wmPosChanged.m_bUp = pButton->m_iButtonIndex == 0; |
| 383 pButton->DispatchEvent(&wmPosChanged); | 384 pButton->DispatchEvent(&wmPosChanged); |
| 384 } | 385 } |
| OLD | NEW |