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

Side by Side Diff: xfa/fwl/core/ifwl_spinbutton.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_spinbutton.h ('k') | xfa/fwl/core/ifwl_tooltip.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_spinbutton.h" 7 #include "xfa/fwl/core/ifwl_spinbutton.h"
8 8
9 #include "third_party/base/ptr_util.h"
9 #include "xfa/fwl/core/cfwl_message.h" 10 #include "xfa/fwl/core/cfwl_message.h"
10 #include "xfa/fwl/core/cfwl_themebackground.h" 11 #include "xfa/fwl/core/cfwl_themebackground.h"
11 #include "xfa/fwl/core/cfwl_widgetimpproperties.h" 12 #include "xfa/fwl/core/cfwl_widgetimpproperties.h"
12 #include "xfa/fwl/core/fwl_noteimp.h" 13 #include "xfa/fwl/core/fwl_noteimp.h"
13 #include "xfa/fwl/core/ifwl_spinbutton.h" 14 #include "xfa/fwl/core/ifwl_spinbutton.h"
14 #include "xfa/fwl/core/ifwl_themeprovider.h" 15 #include "xfa/fwl/core/ifwl_themeprovider.h"
15 #include "xfa/fwl/core/ifwl_themeprovider.h" 16 #include "xfa/fwl/core/ifwl_themeprovider.h"
16 #include "xfa/fwl/core/ifwl_timer.h" 17 #include "xfa/fwl/core/ifwl_timer.h"
17 18
18 namespace { 19 namespace {
(...skipping 10 matching lines...) Expand all
29 m_dwUpState(CFWL_PartState_Normal), 30 m_dwUpState(CFWL_PartState_Normal),
30 m_dwDnState(CFWL_PartState_Normal), 31 m_dwDnState(CFWL_PartState_Normal),
31 m_iButtonIndex(0), 32 m_iButtonIndex(0),
32 m_bLButtonDwn(FALSE), 33 m_bLButtonDwn(FALSE),
33 m_pTimerInfo(nullptr), 34 m_pTimerInfo(nullptr),
34 m_Timer(this) { 35 m_Timer(this) {
35 m_rtClient.Reset(); 36 m_rtClient.Reset();
36 m_rtUpButton.Reset(); 37 m_rtUpButton.Reset();
37 m_rtDnButton.Reset(); 38 m_rtDnButton.Reset();
38 m_pProperties->m_dwStyleExes |= FWL_STYLEEXE_SPB_Vert; 39 m_pProperties->m_dwStyleExes |= FWL_STYLEEXE_SPB_Vert;
40
41 SetDelegate(pdfium::MakeUnique<CFWL_SpinButtonImpDelegate>(this));
39 } 42 }
40 43
41 IFWL_SpinButton::~IFWL_SpinButton() {} 44 IFWL_SpinButton::~IFWL_SpinButton() {}
42 45
43 void IFWL_SpinButton::Initialize() {
44 IFWL_Widget::Initialize();
45 m_pDelegate = new CFWL_SpinButtonImpDelegate(this);
46 }
47
48 void IFWL_SpinButton::Finalize() {
49 delete m_pDelegate;
50 m_pDelegate = nullptr;
51 IFWL_Widget::Finalize();
52 }
53
54 FWL_Type IFWL_SpinButton::GetClassID() const { 46 FWL_Type IFWL_SpinButton::GetClassID() const {
55 return FWL_Type::SpinButton; 47 return FWL_Type::SpinButton;
56 } 48 }
57 49
58 FWL_Error IFWL_SpinButton::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { 50 FWL_Error IFWL_SpinButton::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
59 if (bAutoSize) { 51 if (bAutoSize) {
60 rect.Set(0, 0, kMinWidth, kMinHeight); 52 rect.Set(0, 0, kMinWidth, kMinHeight);
61 IFWL_Widget::GetWidgetRect(rect, TRUE); 53 IFWL_Widget::GetWidgetRect(rect, TRUE);
62 } else { 54 } else {
63 rect = m_pProperties->m_rtWidget; 55 rect = m_pProperties->m_rtWidget;
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 IFWL_SpinButton* pButton = static_cast<IFWL_SpinButton*>(m_pWidget); 410 IFWL_SpinButton* pButton = static_cast<IFWL_SpinButton*>(m_pWidget);
419 411
420 if (!pButton->m_pTimerInfo) 412 if (!pButton->m_pTimerInfo)
421 return; 413 return;
422 414
423 CFWL_EvtSpbClick wmPosChanged; 415 CFWL_EvtSpbClick wmPosChanged;
424 wmPosChanged.m_pSrcTarget = pButton; 416 wmPosChanged.m_pSrcTarget = pButton;
425 wmPosChanged.m_bUp = pButton->m_iButtonIndex == 0; 417 wmPosChanged.m_bUp = pButton->m_iButtonIndex == 0;
426 pButton->DispatchEvent(&wmPosChanged); 418 pButton->DispatchEvent(&wmPosChanged);
427 } 419 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/ifwl_spinbutton.h ('k') | xfa/fwl/core/ifwl_tooltip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698