| 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/lightwidget/cfwl_pushbutton.h" | 7 #include "xfa/fwl/lightwidget/cfwl_pushbutton.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| 11 IFWL_PushButton* CFWL_PushButton::GetWidget() { |
| 12 return static_cast<IFWL_PushButton*>(m_pIface.get()); |
| 13 } |
| 14 |
| 15 const IFWL_PushButton* CFWL_PushButton::GetWidget() const { |
| 16 return static_cast<IFWL_PushButton*>(m_pIface.get()); |
| 17 } |
| 18 |
| 11 CFWL_PushButton* CFWL_PushButton::Create() { | 19 CFWL_PushButton* CFWL_PushButton::Create() { |
| 12 return new CFWL_PushButton; | 20 return new CFWL_PushButton; |
| 13 } | 21 } |
| 14 | 22 |
| 15 FWL_Error CFWL_PushButton::Initialize( | 23 FWL_Error CFWL_PushButton::Initialize( |
| 16 const CFWL_WidgetProperties* pProperties) { | 24 const CFWL_WidgetProperties* pProperties) { |
| 17 if (m_pIface) | 25 if (m_pIface) |
| 18 return FWL_Error::Indefinite; | 26 return FWL_Error::Indefinite; |
| 19 if (pProperties) { | 27 if (pProperties) { |
| 20 *m_pProperties = *pProperties; | 28 *m_pProperties = *pProperties; |
| 21 } | 29 } |
| 22 std::unique_ptr<IFWL_PushButton> pPushButton(IFWL_PushButton::Create( | 30 std::unique_ptr<IFWL_PushButton> pPushButton(IFWL_PushButton::Create( |
| 23 m_pProperties->MakeWidgetImpProperties(&m_buttonData), nullptr)); | 31 m_pProperties->MakeWidgetImpProperties(&m_buttonData), nullptr)); |
| 24 FWL_Error ret = pPushButton->Initialize(); | 32 FWL_Error ret = pPushButton->Initialize(); |
| 25 if (ret != FWL_Error::Succeeded) { | 33 if (ret != FWL_Error::Succeeded) { |
| 26 return ret; | 34 return ret; |
| 27 } | 35 } |
| 28 m_pIface = pPushButton.release(); | 36 m_pIface = std::move(pPushButton); |
| 29 CFWL_Widget::Initialize(); | 37 CFWL_Widget::Initialize(); |
| 30 return FWL_Error::Succeeded; | 38 return FWL_Error::Succeeded; |
| 31 } | 39 } |
| 32 | 40 |
| 33 FWL_Error CFWL_PushButton::GetCaption(CFX_WideString& wsCaption) { | 41 FWL_Error CFWL_PushButton::GetCaption(CFX_WideString& wsCaption) { |
| 34 wsCaption = m_buttonData.m_wsCaption; | 42 wsCaption = m_buttonData.m_wsCaption; |
| 35 return FWL_Error::Succeeded; | 43 return FWL_Error::Succeeded; |
| 36 } | 44 } |
| 37 | 45 |
| 38 FWL_Error CFWL_PushButton::SetCaption(const CFX_WideStringC& wsCaption) { | 46 FWL_Error CFWL_PushButton::SetCaption(const CFX_WideStringC& wsCaption) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 57 IFWL_Widget* pWidget, | 65 IFWL_Widget* pWidget, |
| 58 CFX_WideString& wsCaption) { | 66 CFX_WideString& wsCaption) { |
| 59 wsCaption = m_wsCaption; | 67 wsCaption = m_wsCaption; |
| 60 return FWL_Error::Succeeded; | 68 return FWL_Error::Succeeded; |
| 61 } | 69 } |
| 62 | 70 |
| 63 CFX_DIBitmap* CFWL_PushButton::CFWL_PushButtonDP::GetPicture( | 71 CFX_DIBitmap* CFWL_PushButton::CFWL_PushButtonDP::GetPicture( |
| 64 IFWL_Widget* pWidget) { | 72 IFWL_Widget* pWidget) { |
| 65 return m_pBitmap; | 73 return m_pBitmap; |
| 66 } | 74 } |
| OLD | NEW |