| 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/cfwl_pushbutton.h" | 7 #include "xfa/fwl/core/cfwl_pushbutton.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 m_rtClient.Set(0, 0, 0, 0); | 28 m_rtClient.Set(0, 0, 0, 0); |
| 29 m_rtCaption.Set(0, 0, 0, 0); | 29 m_rtCaption.Set(0, 0, 0, 0); |
| 30 } | 30 } |
| 31 | 31 |
| 32 CFWL_PushButton::~CFWL_PushButton() {} | 32 CFWL_PushButton::~CFWL_PushButton() {} |
| 33 | 33 |
| 34 FWL_Type CFWL_PushButton::GetClassID() const { | 34 FWL_Type CFWL_PushButton::GetClassID() const { |
| 35 return FWL_Type::PushButton; | 35 return FWL_Type::PushButton; |
| 36 } | 36 } |
| 37 | 37 |
| 38 void CFWL_PushButton::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { | |
| 39 if (!bAutoSize) { | |
| 40 rect = m_pProperties->m_rtWidget; | |
| 41 return; | |
| 42 } | |
| 43 | |
| 44 rect.Set(0, 0, 0, 0); | |
| 45 if (!m_pProperties->m_pThemeProvider) | |
| 46 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | |
| 47 | |
| 48 FX_FLOAT* fcaption = | |
| 49 static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::Margin)); | |
| 50 rect.Inflate(*fcaption, *fcaption); | |
| 51 InflateWidgetRect(rect); | |
| 52 } | |
| 53 | |
| 54 void CFWL_PushButton::SetStates(uint32_t dwStates) { | 38 void CFWL_PushButton::SetStates(uint32_t dwStates) { |
| 55 if (dwStates & FWL_WGTSTATE_Disabled) { | 39 if (dwStates & FWL_WGTSTATE_Disabled) { |
| 56 m_pProperties->m_dwStates = FWL_WGTSTATE_Disabled; | 40 m_pProperties->m_dwStates = FWL_WGTSTATE_Disabled; |
| 57 return; | 41 return; |
| 58 } | 42 } |
| 59 CFWL_Widget::SetStates(dwStates); | 43 CFWL_Widget::SetStates(dwStates); |
| 60 } | 44 } |
| 61 | 45 |
| 62 void CFWL_PushButton::Update() { | 46 void CFWL_PushButton::Update() { |
| 63 if (IsLocked()) | 47 if (IsLocked()) |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 if (pMsg->m_dwKeyCode != FWL_VKEY_Return) | 282 if (pMsg->m_dwKeyCode != FWL_VKEY_Return) |
| 299 return; | 283 return; |
| 300 | 284 |
| 301 CFWL_EvtMouse wmMouse(this); | 285 CFWL_EvtMouse wmMouse(this); |
| 302 wmMouse.m_dwCmd = FWL_MouseCommand::LeftButtonUp; | 286 wmMouse.m_dwCmd = FWL_MouseCommand::LeftButtonUp; |
| 303 DispatchEvent(&wmMouse); | 287 DispatchEvent(&wmMouse); |
| 304 | 288 |
| 305 CFWL_Event wmClick(CFWL_Event::Type::Click, this); | 289 CFWL_Event wmClick(CFWL_Event::Type::Click, this); |
| 306 DispatchEvent(&wmClick); | 290 DispatchEvent(&wmClick); |
| 307 } | 291 } |
| OLD | NEW |