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

Side by Side Diff: xfa/fwl/core/ifwl_form.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_form.h ('k') | xfa/fwl/core/ifwl_formproxy.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_form.h" 7 #include "xfa/fwl/core/ifwl_form.h"
8 8
9 #include "third_party/base/ptr_util.h"
9 #include "xfa/fde/tto/fde_textout.h" 10 #include "xfa/fde/tto/fde_textout.h"
10 #include "xfa/fwl/core/cfwl_message.h" 11 #include "xfa/fwl/core/cfwl_message.h"
11 #include "xfa/fwl/core/cfwl_themebackground.h" 12 #include "xfa/fwl/core/cfwl_themebackground.h"
12 #include "xfa/fwl/core/cfwl_themepart.h" 13 #include "xfa/fwl/core/cfwl_themepart.h"
13 #include "xfa/fwl/core/cfwl_themetext.h" 14 #include "xfa/fwl/core/cfwl_themetext.h"
14 #include "xfa/fwl/core/cfwl_widgetmgr.h" 15 #include "xfa/fwl/core/cfwl_widgetmgr.h"
15 #include "xfa/fwl/core/fwl_noteimp.h" 16 #include "xfa/fwl/core/fwl_noteimp.h"
16 #include "xfa/fwl/core/ifwl_app.h" 17 #include "xfa/fwl/core/ifwl_app.h"
17 #include "xfa/fwl/core/ifwl_formproxy.h" 18 #include "xfa/fwl/core/ifwl_formproxy.h"
18 #include "xfa/fwl/core/ifwl_themeprovider.h" 19 #include "xfa/fwl/core/ifwl_themeprovider.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 m_eFormSize(FWL_FORMSIZE_Manual), 58 m_eFormSize(FWL_FORMSIZE_Manual),
58 m_bDoModalFlag(FALSE), 59 m_bDoModalFlag(FALSE),
59 m_pBigIcon(nullptr), 60 m_pBigIcon(nullptr),
60 m_pSmallIcon(nullptr), 61 m_pSmallIcon(nullptr),
61 m_bMouseIn(FALSE) { 62 m_bMouseIn(FALSE) {
62 m_rtRelative.Reset(); 63 m_rtRelative.Reset();
63 m_rtCaption.Reset(); 64 m_rtCaption.Reset();
64 m_rtRestore.Reset(); 65 m_rtRestore.Reset();
65 m_rtCaptionText.Reset(); 66 m_rtCaptionText.Reset();
66 m_rtIcon.Reset(); 67 m_rtIcon.Reset();
68
69 RegisterForm();
70 RegisterEventTarget();
71 SetDelegate(pdfium::MakeUnique<CFWL_FormImpDelegate>(this));
67 } 72 }
68 73
69 IFWL_Form::~IFWL_Form() { 74 IFWL_Form::~IFWL_Form() {
75 UnregisterEventTarget();
76 UnRegisterForm();
70 RemoveSysButtons(); 77 RemoveSysButtons();
71 } 78 }
72 79
73 void IFWL_Form::Initialize() {
74 IFWL_Widget::Initialize();
75
76 RegisterForm();
77 RegisterEventTarget();
78 m_pDelegate = new CFWL_FormImpDelegate(this);
79 }
80
81 void IFWL_Form::Finalize() {
82 delete m_pDelegate;
83 m_pDelegate = nullptr;
84 UnregisterEventTarget();
85 UnRegisterForm();
86 IFWL_Widget::Finalize();
87 }
88
89 FWL_Type IFWL_Form::GetClassID() const { 80 FWL_Type IFWL_Form::GetClassID() const {
90 return FWL_Type::Form; 81 return FWL_Type::Form;
91 } 82 }
92 83
93 FX_BOOL IFWL_Form::IsInstance(const CFX_WideStringC& wsClass) const { 84 FX_BOOL IFWL_Form::IsInstance(const CFX_WideStringC& wsClass) const {
94 if (wsClass == CFX_WideStringC(FWL_CLASS_Form)) 85 if (wsClass == CFX_WideStringC(FWL_CLASS_Form))
95 return TRUE; 86 return TRUE;
96 return IFWL_Widget::IsInstance(wsClass); 87 return IFWL_Widget::IsInstance(wsClass);
97 } 88 }
98 89
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 1086
1096 uint32_t CFWL_SysBtn::GetPartState() const { 1087 uint32_t CFWL_SysBtn::GetPartState() const {
1097 if (IsDisabled()) 1088 if (IsDisabled())
1098 return CFWL_PartState_Disabled; 1089 return CFWL_PartState_Disabled;
1099 if (m_dwState & FWL_SYSBUTTONSTATE_Pressed) 1090 if (m_dwState & FWL_SYSBUTTONSTATE_Pressed)
1100 return CFWL_PartState_Pressed; 1091 return CFWL_PartState_Pressed;
1101 if (m_dwState & FWL_SYSBUTTONSTATE_Hover) 1092 if (m_dwState & FWL_SYSBUTTONSTATE_Hover)
1102 return CFWL_PartState_Hovered; 1093 return CFWL_PartState_Hovered;
1103 return CFWL_PartState_Normal; 1094 return CFWL_PartState_Normal;
1104 } 1095 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/ifwl_form.h ('k') | xfa/fwl/core/ifwl_formproxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698