Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: xfa/fwl/core/ifwl_caret.cpp

Issue 2464703006: Fold IFWL*::{Initialize|Finalize} into constructor/destructor (Closed)
Patch Set: Rebase to master Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fwl/core/ifwl_caret.h ('k') | xfa/fwl/core/ifwl_checkbox.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "xfa/fwl/core/cfwl_themebackground.h" 10 #include "xfa/fwl/core/cfwl_themebackground.h"
10 #include "xfa/fwl/core/cfwl_widgetimpproperties.h" 11 #include "xfa/fwl/core/cfwl_widgetimpproperties.h"
11 #include "xfa/fwl/core/fwl_noteimp.h" 12 #include "xfa/fwl/core/fwl_noteimp.h"
12 #include "xfa/fwl/core/ifwl_caret.h" 13 #include "xfa/fwl/core/ifwl_caret.h"
13 #include "xfa/fwl/core/ifwl_themeprovider.h" 14 #include "xfa/fwl/core/ifwl_themeprovider.h"
14 15
15 IFWL_Caret::IFWL_Caret(const IFWL_App* app, 16 IFWL_Caret::IFWL_Caret(const IFWL_App* app,
16 const CFWL_WidgetImpProperties& properties, 17 const CFWL_WidgetImpProperties& properties,
17 IFWL_Widget* pOuter) 18 IFWL_Widget* pOuter)
18 : IFWL_Widget(app, properties, pOuter), 19 : IFWL_Widget(app, properties, pOuter),
19 m_pTimer(new IFWL_Caret::Timer(this)), 20 m_pTimer(new IFWL_Caret::Timer(this)),
20 m_pTimerInfo(nullptr), 21 m_pTimerInfo(nullptr),
21 m_dwElapse(400), 22 m_dwElapse(400),
22 m_bSetColor(FALSE) { 23 m_bSetColor(FALSE) {
23 SetStates(FWL_STATE_CAT_HightLight); 24 SetStates(FWL_STATE_CAT_HightLight);
25 SetDelegate(pdfium::MakeUnique<CFWL_CaretImpDelegate>(this));
24 } 26 }
25 27
26 IFWL_Caret::~IFWL_Caret() {} 28 IFWL_Caret::~IFWL_Caret() {
29 if (m_pTimerInfo) {
30 m_pTimerInfo->StopTimer();
31 m_pTimerInfo = nullptr;
32 }
33 }
27 34
28 FWL_Type IFWL_Caret::GetClassID() const { 35 FWL_Type IFWL_Caret::GetClassID() const {
29 return FWL_Type::Caret; 36 return FWL_Type::Caret;
30 } 37 }
31 38
32 void IFWL_Caret::Initialize() {
33 IFWL_Widget::Initialize();
34 m_pDelegate = new CFWL_CaretImpDelegate(this);
35 }
36
37 void IFWL_Caret::Finalize() {
38 if (m_pTimerInfo) {
39 m_pTimerInfo->StopTimer();
40 m_pTimerInfo = nullptr;
41 }
42 delete m_pDelegate;
43 m_pDelegate = nullptr;
44 IFWL_Widget::Finalize();
45 }
46
47 FWL_Error IFWL_Caret::DrawWidget(CFX_Graphics* pGraphics, 39 FWL_Error IFWL_Caret::DrawWidget(CFX_Graphics* pGraphics,
48 const CFX_Matrix* pMatrix) { 40 const CFX_Matrix* pMatrix) {
49 if (!pGraphics) 41 if (!pGraphics)
50 return FWL_Error::Indefinite; 42 return FWL_Error::Indefinite;
51 if (!m_pProperties->m_pThemeProvider) 43 if (!m_pProperties->m_pThemeProvider)
52 m_pProperties->m_pThemeProvider = GetAvailableTheme(); 44 m_pProperties->m_pThemeProvider = GetAvailableTheme();
53 if (!m_pProperties->m_pThemeProvider) 45 if (!m_pProperties->m_pThemeProvider)
54 return FWL_Error::Indefinite; 46 return FWL_Error::Indefinite;
55 47
56 DrawCaretBK(pGraphics, m_pProperties->m_pThemeProvider, pMatrix); 48 DrawCaretBK(pGraphics, m_pProperties->m_pThemeProvider, pMatrix);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 114
123 CFWL_CaretImpDelegate::CFWL_CaretImpDelegate(IFWL_Caret* pOwner) 115 CFWL_CaretImpDelegate::CFWL_CaretImpDelegate(IFWL_Caret* pOwner)
124 : m_pOwner(pOwner) {} 116 : m_pOwner(pOwner) {}
125 117
126 void CFWL_CaretImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {} 118 void CFWL_CaretImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {}
127 119
128 void CFWL_CaretImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, 120 void CFWL_CaretImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
129 const CFX_Matrix* pMatrix) { 121 const CFX_Matrix* pMatrix) {
130 m_pOwner->DrawWidget(pGraphics, pMatrix); 122 m_pOwner->DrawWidget(pGraphics, pMatrix);
131 } 123 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/ifwl_caret.h ('k') | xfa/fwl/core/ifwl_checkbox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698