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