| 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 "../../../foxitlib.h" | 7 #include "../../../foxitlib.h" |
| 8 CFWL_PushButton* CFWL_PushButton::Create() { | 8 CFWL_PushButton* CFWL_PushButton::Create() { |
| 9 return new CFWL_PushButton; | 9 return new CFWL_PushButton; |
| 10 } | 10 } |
| 11 FWL_ERR CFWL_PushButton::Initialize(const CFWL_WidgetProperties* pProperties) { | 11 FWL_ERR CFWL_PushButton::Initialize(const CFWL_WidgetProperties* pProperties) { |
| 12 if (m_pIface) | 12 if (m_pIface) |
| 13 return FWL_ERR_Indefinite; | 13 return FWL_ERR_Indefinite; |
| 14 if (pProperties) { | 14 if (pProperties) { |
| 15 *m_pProperties = *pProperties; | 15 *m_pProperties = *pProperties; |
| 16 } | 16 } |
| 17 m_pIface = new IFWL_PushButton; | 17 nonstd::unique_ptr<IFWL_PushButton> pPushButton(IFWL_PushButton::Create( |
| 18 FWL_ERR ret = | 18 m_pProperties->MakeWidgetImpProperties(&m_buttonData), nullptr)); |
| 19 ((IFWL_PushButton*)m_pIface) | 19 FWL_ERR ret = pPushButton->Initialize(); |
| 20 ->Initialize(m_pProperties->MakeWidgetImpProperties(&m_buttonData), | 20 if (ret != FWL_ERR_Succeeded) { |
| 21 nullptr); | 21 return ret; |
| 22 if (ret == FWL_ERR_Succeeded) { | |
| 23 CFWL_Widget::Initialize(); | |
| 24 } | 22 } |
| 25 return ret; | 23 m_pIface = pPushButton.release(); |
| 24 CFWL_Widget::Initialize(); |
| 25 return FWL_ERR_Succeeded; |
| 26 } | 26 } |
| 27 FWL_ERR CFWL_PushButton::GetCaption(CFX_WideString& wsCaption) { | 27 FWL_ERR CFWL_PushButton::GetCaption(CFX_WideString& wsCaption) { |
| 28 wsCaption = m_buttonData.m_wsCaption; | 28 wsCaption = m_buttonData.m_wsCaption; |
| 29 return FWL_ERR_Succeeded; | 29 return FWL_ERR_Succeeded; |
| 30 } | 30 } |
| 31 FWL_ERR CFWL_PushButton::SetCaption(const CFX_WideStringC& wsCaption) { | 31 FWL_ERR CFWL_PushButton::SetCaption(const CFX_WideStringC& wsCaption) { |
| 32 m_buttonData.m_wsCaption = wsCaption; | 32 m_buttonData.m_wsCaption = wsCaption; |
| 33 return FWL_ERR_Succeeded; | 33 return FWL_ERR_Succeeded; |
| 34 } | 34 } |
| 35 CFX_DIBitmap* CFWL_PushButton::GetPicture() { | 35 CFX_DIBitmap* CFWL_PushButton::GetPicture() { |
| 36 return m_buttonData.m_pBitmap; | 36 return m_buttonData.m_pBitmap; |
| 37 } | 37 } |
| 38 FWL_ERR CFWL_PushButton::SetPicture(CFX_DIBitmap* pBitmap) { | 38 FWL_ERR CFWL_PushButton::SetPicture(CFX_DIBitmap* pBitmap) { |
| 39 m_buttonData.m_pBitmap = pBitmap; | 39 m_buttonData.m_pBitmap = pBitmap; |
| 40 return FWL_ERR_Succeeded; | 40 return FWL_ERR_Succeeded; |
| 41 } | 41 } |
| 42 CFWL_PushButton::CFWL_PushButton() {} | 42 CFWL_PushButton::CFWL_PushButton() {} |
| 43 CFWL_PushButton::~CFWL_PushButton() {} | 43 CFWL_PushButton::~CFWL_PushButton() {} |
| 44 FWL_ERR CFWL_PushButton::CFWL_PushButtonDP::GetCaption( | 44 FWL_ERR CFWL_PushButton::CFWL_PushButtonDP::GetCaption( |
| 45 IFWL_Widget* pWidget, | 45 IFWL_Widget* pWidget, |
| 46 CFX_WideString& wsCaption) { | 46 CFX_WideString& wsCaption) { |
| 47 wsCaption = m_wsCaption; | 47 wsCaption = m_wsCaption; |
| 48 return FWL_ERR_Succeeded; | 48 return FWL_ERR_Succeeded; |
| 49 } | 49 } |
| 50 CFX_DIBitmap* CFWL_PushButton::CFWL_PushButtonDP::GetPicture( | 50 CFX_DIBitmap* CFWL_PushButton::CFWL_PushButtonDP::GetPicture( |
| 51 IFWL_Widget* pWidget) { | 51 IFWL_Widget* pWidget) { |
| 52 return m_pBitmap; | 52 return m_pBitmap; |
| 53 } | 53 } |
| OLD | NEW |