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 | 10 |
11 #include "third_party/base/ptr_util.h" | 11 #include "third_party/base/ptr_util.h" |
12 | 12 |
13 CFWL_PushButton::CFWL_PushButton(const IFWL_App* app) | 13 CFWL_PushButton::CFWL_PushButton(const IFWL_App* app) |
14 : CFWL_Widget(app), m_pBitmap(nullptr) {} | 14 : CFWL_Widget(app), m_pBitmap(nullptr) {} |
15 | 15 |
16 CFWL_PushButton::~CFWL_PushButton() {} | 16 CFWL_PushButton::~CFWL_PushButton() {} |
17 | 17 |
18 void CFWL_PushButton::Initialize() { | 18 void CFWL_PushButton::Initialize() { |
19 ASSERT(!m_pIface); | 19 ASSERT(!m_pIface); |
20 | 20 |
21 m_pIface = pdfium::MakeUnique<IFWL_PushButton>( | 21 m_pIface = pdfium::MakeUnique<IFWL_PushButton>( |
22 m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(this)); | 22 m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(this)); |
23 | 23 |
24 CFWL_Widget::Initialize(); | 24 CFWL_Widget::Initialize(); |
25 } | 25 } |
26 | 26 |
27 FWL_Error CFWL_PushButton::GetCaption(CFX_WideString& wsCaption) { | |
28 wsCaption = m_wsCaption; | |
29 return FWL_Error::Succeeded; | |
30 } | |
31 | |
32 FWL_Error CFWL_PushButton::SetCaption(const CFX_WideStringC& wsCaption) { | 27 FWL_Error CFWL_PushButton::SetCaption(const CFX_WideStringC& wsCaption) { |
33 m_wsCaption = wsCaption; | 28 m_wsCaption = wsCaption; |
34 return FWL_Error::Succeeded; | 29 return FWL_Error::Succeeded; |
35 } | 30 } |
36 | 31 |
37 CFX_DIBitmap* CFWL_PushButton::GetPicture() { | 32 CFX_DIBitmap* CFWL_PushButton::GetPicture() { |
38 return m_pBitmap; | 33 return m_pBitmap; |
39 } | 34 } |
40 | 35 |
41 FWL_Error CFWL_PushButton::SetPicture(CFX_DIBitmap* pBitmap) { | 36 FWL_Error CFWL_PushButton::SetPicture(CFX_DIBitmap* pBitmap) { |
42 m_pBitmap = pBitmap; | 37 m_pBitmap = pBitmap; |
43 return FWL_Error::Succeeded; | 38 return FWL_Error::Succeeded; |
44 } | 39 } |
45 | 40 |
46 FWL_Error CFWL_PushButton::GetCaption(IFWL_Widget* pWidget, | 41 void CFWL_PushButton::GetCaption(IFWL_Widget* pWidget, |
47 CFX_WideString& wsCaption) { | 42 CFX_WideString& wsCaption) { |
48 wsCaption = m_wsCaption; | 43 wsCaption = m_wsCaption; |
49 return FWL_Error::Succeeded; | |
50 } | 44 } |
51 | 45 |
52 CFX_DIBitmap* CFWL_PushButton::GetPicture(IFWL_Widget* pWidget) { | 46 CFX_DIBitmap* CFWL_PushButton::GetPicture(IFWL_Widget* pWidget) { |
53 return m_pBitmap; | 47 return m_pBitmap; |
54 } | 48 } |
OLD | NEW |