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/ifwl_caret.h" | 7 #include "xfa/fwl/core/ifwl_caret.h" |
8 | 8 |
9 #include "third_party/base/ptr_util.h" | 9 #include "third_party/base/ptr_util.h" |
10 #include "xfa/fwl/core/cfwl_themebackground.h" | 10 #include "xfa/fwl/core/cfwl_themebackground.h" |
11 #include "xfa/fwl/core/cfwl_widgetimpproperties.h" | 11 #include "xfa/fwl/core/cfwl_widgetproperties.h" |
12 #include "xfa/fwl/core/fwl_noteimp.h" | 12 #include "xfa/fwl/core/fwl_noteimp.h" |
13 #include "xfa/fwl/core/ifwl_caret.h" | 13 #include "xfa/fwl/core/ifwl_caret.h" |
14 #include "xfa/fwl/core/ifwl_themeprovider.h" | 14 #include "xfa/fwl/core/ifwl_themeprovider.h" |
15 | 15 |
16 IFWL_Caret::IFWL_Caret(const IFWL_App* app, | 16 IFWL_Caret::IFWL_Caret(const IFWL_App* app, |
17 const CFWL_WidgetImpProperties& properties, | 17 std::unique_ptr<CFWL_WidgetProperties> properties, |
18 IFWL_Widget* pOuter) | 18 IFWL_Widget* pOuter) |
19 : IFWL_Widget(app, properties, pOuter), | 19 : IFWL_Widget(app, std::move(properties), pOuter), |
20 m_pTimer(new IFWL_Caret::Timer(this)), | 20 m_pTimer(new IFWL_Caret::Timer(this)), |
21 m_pTimerInfo(nullptr), | 21 m_pTimerInfo(nullptr), |
22 m_dwElapse(400), | 22 m_dwElapse(400), |
23 m_bSetColor(false) { | 23 m_bSetColor(false) { |
24 SetStates(FWL_STATE_CAT_HightLight); | 24 SetStates(FWL_STATE_CAT_HightLight); |
25 } | 25 } |
26 | 26 |
27 IFWL_Caret::~IFWL_Caret() { | 27 IFWL_Caret::~IFWL_Caret() { |
28 if (m_pTimerInfo) { | 28 if (m_pTimerInfo) { |
29 m_pTimerInfo->StopTimer(); | 29 m_pTimerInfo->StopTimer(); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 void IFWL_Caret::Timer::Run(IFWL_TimerInfo* pTimerInfo) { | 110 void IFWL_Caret::Timer::Run(IFWL_TimerInfo* pTimerInfo) { |
111 IFWL_Caret* pCaret = static_cast<IFWL_Caret*>(m_pWidget); | 111 IFWL_Caret* pCaret = static_cast<IFWL_Caret*>(m_pWidget); |
112 bool toggle = !(pCaret->GetStates() & FWL_STATE_CAT_HightLight); | 112 bool toggle = !(pCaret->GetStates() & FWL_STATE_CAT_HightLight); |
113 pCaret->SetStates(FWL_STATE_CAT_HightLight, toggle); | 113 pCaret->SetStates(FWL_STATE_CAT_HightLight, toggle); |
114 | 114 |
115 CFX_RectF rt; | 115 CFX_RectF rt; |
116 pCaret->GetWidgetRect(rt); | 116 pCaret->GetWidgetRect(rt); |
117 rt.Set(0, 0, rt.width + 1, rt.height); | 117 rt.Set(0, 0, rt.width + 1, rt.height); |
118 pCaret->Repaint(&rt); | 118 pCaret->Repaint(&rt); |
119 } | 119 } |
OLD | NEW |