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 #include "../core/include/fwl_targetimp.h" | 8 #include "../core/include/fwl_targetimp.h" |
9 #include "../core/include/fwl_noteimp.h" | 9 #include "../core/include/fwl_noteimp.h" |
10 #include "../core/include/fwl_widgetimp.h" | 10 #include "../core/include/fwl_widgetimp.h" |
11 #include "include/fwl_caretimp.h" | 11 #include "include/fwl_caretimp.h" |
12 IFWL_Caret::IFWL_Caret() { | 12 |
| 13 // static |
| 14 IFWL_Caret* IFWL_Caret::Create(const CFWL_WidgetImpProperties& properties, |
| 15 IFWL_Widget* pOuter) { |
| 16 IFWL_Caret* pCaret = new IFWL_Caret; |
| 17 CFWL_CaretImp* pCaretImpl = new CFWL_CaretImp(properties, pOuter); |
| 18 pCaret->SetImpl(pCaretImpl); |
| 19 pCaretImpl->SetInterface(pCaret); |
| 20 return pCaret; |
13 } | 21 } |
14 FWL_ERR IFWL_Caret::Initialize(IFWL_Widget* pOuter) { | 22 IFWL_Caret::IFWL_Caret() {} |
15 CFWL_CaretImp* pCaretImpl = new CFWL_CaretImp(pOuter); | |
16 SetImpl(pCaretImpl); | |
17 pCaretImpl->SetInterface(this); | |
18 return pCaretImpl->Initialize(); | |
19 } | |
20 FWL_ERR IFWL_Caret::Initialize(const CFWL_WidgetImpProperties& properties, | |
21 IFWL_Widget* pOuter) { | |
22 CFWL_CaretImp* pCaretImpl = new CFWL_CaretImp(properties, pOuter); | |
23 SetImpl(pCaretImpl); | |
24 pCaretImpl->SetInterface(this); | |
25 return pCaretImpl->Initialize(); | |
26 } | |
27 FWL_ERR IFWL_Caret::ShowCaret(FX_BOOL bFlag) { | 23 FWL_ERR IFWL_Caret::ShowCaret(FX_BOOL bFlag) { |
28 return static_cast<CFWL_CaretImp*>(GetImpl())->ShowCaret(bFlag); | 24 return static_cast<CFWL_CaretImp*>(GetImpl())->ShowCaret(bFlag); |
29 } | 25 } |
30 FWL_ERR IFWL_Caret::GetFrequency(FX_DWORD& elapse) { | 26 FWL_ERR IFWL_Caret::GetFrequency(FX_DWORD& elapse) { |
31 return static_cast<CFWL_CaretImp*>(GetImpl())->GetFrequency(elapse); | 27 return static_cast<CFWL_CaretImp*>(GetImpl())->GetFrequency(elapse); |
32 } | 28 } |
33 FWL_ERR IFWL_Caret::SetFrequency(FX_DWORD elapse) { | 29 FWL_ERR IFWL_Caret::SetFrequency(FX_DWORD elapse) { |
34 return static_cast<CFWL_CaretImp*>(GetImpl())->SetFrequency(elapse); | 30 return static_cast<CFWL_CaretImp*>(GetImpl())->SetFrequency(elapse); |
35 } | 31 } |
36 FWL_ERR IFWL_Caret::SetColor(CFX_Color crFill) { | 32 FWL_ERR IFWL_Caret::SetColor(CFX_Color crFill) { |
37 return static_cast<CFWL_CaretImp*>(GetImpl())->SetColor(crFill); | 33 return static_cast<CFWL_CaretImp*>(GetImpl())->SetColor(crFill); |
38 } | 34 } |
39 CFWL_CaretImp::CFWL_CaretImp(IFWL_Widget* pOuter) : m_hTimer(NULL) { | 35 |
40 m_dwElapse = 400; | |
41 m_pTimer = new CFWL_CaretTimer(this); | |
42 m_bSetColor = FALSE; | |
43 SetStates(FWL_STATE_CAT_HightLight); | |
44 } | |
45 CFWL_CaretImp::CFWL_CaretImp(const CFWL_WidgetImpProperties& properties, | 36 CFWL_CaretImp::CFWL_CaretImp(const CFWL_WidgetImpProperties& properties, |
46 IFWL_Widget* pOuter) | 37 IFWL_Widget* pOuter) |
47 : m_hTimer(NULL) { | 38 : CFWL_WidgetImp(properties, pOuter), |
48 m_dwElapse = 400; | 39 m_hTimer(nullptr), |
| 40 m_dwElapse(400), |
| 41 m_bSetColor(FALSE) { |
49 m_pTimer = new CFWL_CaretTimer(this); | 42 m_pTimer = new CFWL_CaretTimer(this); |
50 m_bSetColor = FALSE; | |
51 SetStates(FWL_STATE_CAT_HightLight); | 43 SetStates(FWL_STATE_CAT_HightLight); |
52 } | 44 } |
53 CFWL_CaretImp::~CFWL_CaretImp() { | 45 CFWL_CaretImp::~CFWL_CaretImp() { |
54 if (m_pTimer) { | 46 if (m_pTimer) { |
55 delete m_pTimer; | 47 delete m_pTimer; |
56 m_pTimer = NULL; | 48 m_pTimer = NULL; |
57 } | 49 } |
58 } | 50 } |
59 FWL_ERR CFWL_CaretImp::GetClassName(CFX_WideString& wsClass) const { | 51 FWL_ERR CFWL_CaretImp::GetClassName(CFX_WideString& wsClass) const { |
60 wsClass = FWL_CLASS_Caret; | 52 wsClass = FWL_CLASS_Caret; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 } | 145 } |
154 CFWL_CaretImpDelegate::CFWL_CaretImpDelegate(CFWL_CaretImp* pOwner) | 146 CFWL_CaretImpDelegate::CFWL_CaretImpDelegate(CFWL_CaretImp* pOwner) |
155 : m_pOwner(pOwner) {} | 147 : m_pOwner(pOwner) {} |
156 int32_t CFWL_CaretImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 148 int32_t CFWL_CaretImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
157 return 1; | 149 return 1; |
158 } | 150 } |
159 FWL_ERR CFWL_CaretImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 151 FWL_ERR CFWL_CaretImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
160 const CFX_Matrix* pMatrix) { | 152 const CFX_Matrix* pMatrix) { |
161 return m_pOwner->DrawWidget(pGraphics, pMatrix); | 153 return m_pOwner->DrawWidget(pGraphics, pMatrix); |
162 } | 154 } |
OLD | NEW |