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

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

Issue 2436103002: Remove FWL globals. (Closed)
Patch Set: Review feedback 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_pushbutton.h ('k') | xfa/fwl/core/ifwl_scrollbar.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_pushbutton.h" 7 #include "xfa/fwl/core/ifwl_pushbutton.h"
8 8
9 #include "xfa/fde/tto/fde_textout.h" 9 #include "xfa/fde/tto/fde_textout.h"
10 #include "xfa/fwl/core/cfwl_message.h" 10 #include "xfa/fwl/core/cfwl_message.h"
11 #include "xfa/fwl/core/cfwl_themebackground.h" 11 #include "xfa/fwl/core/cfwl_themebackground.h"
12 #include "xfa/fwl/core/cfwl_themetext.h" 12 #include "xfa/fwl/core/cfwl_themetext.h"
13 #include "xfa/fwl/core/fwl_noteimp.h" 13 #include "xfa/fwl/core/fwl_noteimp.h"
14 #include "xfa/fwl/core/ifwl_pushbutton.h" 14 #include "xfa/fwl/core/ifwl_pushbutton.h"
15 #include "xfa/fwl/core/ifwl_themeprovider.h" 15 #include "xfa/fwl/core/ifwl_themeprovider.h"
16 16
17 IFWL_PushButton::IFWL_PushButton(const CFWL_WidgetImpProperties& properties) 17 IFWL_PushButton::IFWL_PushButton(const IFWL_App* app,
18 : IFWL_Widget(properties, nullptr), 18 const CFWL_WidgetImpProperties& properties)
19 : IFWL_Widget(app, properties, nullptr),
19 m_bBtnDown(FALSE), 20 m_bBtnDown(FALSE),
20 m_dwTTOStyles(FDE_TTOSTYLE_SingleLine), 21 m_dwTTOStyles(FDE_TTOSTYLE_SingleLine),
21 m_iTTOAlign(FDE_TTOALIGNMENT_Center) { 22 m_iTTOAlign(FDE_TTOALIGNMENT_Center) {
22 m_rtClient.Set(0, 0, 0, 0); 23 m_rtClient.Set(0, 0, 0, 0);
23 m_rtCaption.Set(0, 0, 0, 0); 24 m_rtCaption.Set(0, 0, 0, 0);
24 } 25 }
25 26
26 IFWL_PushButton::~IFWL_PushButton() {} 27 IFWL_PushButton::~IFWL_PushButton() {}
27 28
28 FWL_Type IFWL_PushButton::GetClassID() const { 29 void IFWL_PushButton::Initialize() {
29 return FWL_Type::PushButton; 30 IFWL_Widget::Initialize();
30 }
31
32 FWL_Error IFWL_PushButton::Initialize() {
33 if (IFWL_Widget::Initialize() != FWL_Error::Succeeded)
34 return FWL_Error::Indefinite;
35
36 m_pDelegate = new CFWL_PushButtonImpDelegate(this); 31 m_pDelegate = new CFWL_PushButtonImpDelegate(this);
37 return FWL_Error::Succeeded;
38 } 32 }
39 33
40 void IFWL_PushButton::Finalize() { 34 void IFWL_PushButton::Finalize() {
41 delete m_pDelegate; 35 delete m_pDelegate;
42 m_pDelegate = nullptr; 36 m_pDelegate = nullptr;
43 IFWL_Widget::Finalize(); 37 IFWL_Widget::Finalize();
44 } 38 }
45 39
40 FWL_Type IFWL_PushButton::GetClassID() const {
41 return FWL_Type::PushButton;
42 }
43
46 FWL_Error IFWL_PushButton::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { 44 FWL_Error IFWL_PushButton::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
47 if (bAutoSize) { 45 if (bAutoSize) {
48 rect.Set(0, 0, 0, 0); 46 rect.Set(0, 0, 0, 0);
49 if (!m_pProperties->m_pThemeProvider) { 47 if (!m_pProperties->m_pThemeProvider) {
50 m_pProperties->m_pThemeProvider = GetAvailableTheme(); 48 m_pProperties->m_pThemeProvider = GetAvailableTheme();
51 } 49 }
52 CFX_WideString wsCaption; 50 CFX_WideString wsCaption;
53 IFWL_PushButtonDP* pData = 51 IFWL_PushButtonDP* pData =
54 static_cast<IFWL_PushButtonDP*>(m_pProperties->m_pDataProvider); 52 static_cast<IFWL_PushButtonDP*>(m_pProperties->m_pDataProvider);
55 if (pData) { 53 if (pData) {
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 CFWL_EvtClick wmClick; 539 CFWL_EvtClick wmClick;
542 wmClick.m_pSrcTarget = m_pOwner; 540 wmClick.m_pSrcTarget = m_pOwner;
543 m_pOwner->DispatchEvent(&wmClick); 541 m_pOwner->DispatchEvent(&wmClick);
544 return; 542 return;
545 } 543 }
546 if (pMsg->m_dwKeyCode != FWL_VKEY_Tab) { 544 if (pMsg->m_dwKeyCode != FWL_VKEY_Tab) {
547 return; 545 return;
548 } 546 }
549 m_pOwner->DispatchKeyEvent(pMsg); 547 m_pOwner->DispatchKeyEvent(pMsg);
550 } 548 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/ifwl_pushbutton.h ('k') | xfa/fwl/core/ifwl_scrollbar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698