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 <memory> |
| 8 |
7 #include "../../../foxitlib.h" | 9 #include "../../../foxitlib.h" |
| 10 |
8 CFWL_Caret* CFWL_Caret::Create() { | 11 CFWL_Caret* CFWL_Caret::Create() { |
9 return new CFWL_Caret; | 12 return new CFWL_Caret; |
10 } | 13 } |
11 FWL_ERR CFWL_Caret::Initialize(const CFWL_WidgetProperties* pProperties) { | 14 FWL_ERR CFWL_Caret::Initialize(const CFWL_WidgetProperties* pProperties) { |
12 if (m_pIface) | 15 if (m_pIface) |
13 return FWL_ERR_Indefinite; | 16 return FWL_ERR_Indefinite; |
14 if (pProperties) { | 17 if (pProperties) { |
15 *m_pProperties = *pProperties; | 18 *m_pProperties = *pProperties; |
16 } | 19 } |
17 nonstd::unique_ptr<IFWL_Caret> pCaret(IFWL_Caret::Create( | 20 std::unique_ptr<IFWL_Caret> pCaret(IFWL_Caret::Create( |
18 m_pProperties->MakeWidgetImpProperties(nullptr), nullptr)); | 21 m_pProperties->MakeWidgetImpProperties(nullptr), nullptr)); |
19 FWL_ERR ret = pCaret->Initialize(); | 22 FWL_ERR ret = pCaret->Initialize(); |
20 if (ret != FWL_ERR_Succeeded) { | 23 if (ret != FWL_ERR_Succeeded) { |
21 return ret; | 24 return ret; |
22 } | 25 } |
23 m_pIface = pCaret.release(); | 26 m_pIface = pCaret.release(); |
24 CFWL_Widget::Initialize(); | 27 CFWL_Widget::Initialize(); |
25 return FWL_ERR_Succeeded; | 28 return FWL_ERR_Succeeded; |
26 } | 29 } |
27 FWL_ERR CFWL_Caret::ShowCaret(FX_BOOL bFlag) { | 30 FWL_ERR CFWL_Caret::ShowCaret(FX_BOOL bFlag) { |
28 return static_cast<IFWL_Caret*>(m_pIface)->ShowCaret(bFlag); | 31 return static_cast<IFWL_Caret*>(m_pIface)->ShowCaret(bFlag); |
29 } | 32 } |
30 FWL_ERR CFWL_Caret::GetFrequency(FX_DWORD& elapse) { | 33 FWL_ERR CFWL_Caret::GetFrequency(FX_DWORD& elapse) { |
31 return static_cast<IFWL_Caret*>(m_pIface)->GetFrequency(elapse); | 34 return static_cast<IFWL_Caret*>(m_pIface)->GetFrequency(elapse); |
32 } | 35 } |
33 FWL_ERR CFWL_Caret::SetFrequency(FX_DWORD elapse) { | 36 FWL_ERR CFWL_Caret::SetFrequency(FX_DWORD elapse) { |
34 return static_cast<IFWL_Caret*>(m_pIface)->SetFrequency(elapse); | 37 return static_cast<IFWL_Caret*>(m_pIface)->SetFrequency(elapse); |
35 } | 38 } |
36 FWL_ERR CFWL_Caret::SetColor(CFX_Color crFill) { | 39 FWL_ERR CFWL_Caret::SetColor(CFX_Color crFill) { |
37 return static_cast<IFWL_Caret*>(m_pIface)->SetColor(crFill); | 40 return static_cast<IFWL_Caret*>(m_pIface)->SetColor(crFill); |
38 } | 41 } |
39 CFWL_Caret::CFWL_Caret() {} | 42 CFWL_Caret::CFWL_Caret() {} |
40 CFWL_Caret::~CFWL_Caret() {} | 43 CFWL_Caret::~CFWL_Caret() {} |
OLD | NEW |