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