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

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

Issue 2435603003: Cleanup unused methods and return values in FWL code. (Closed)
Patch Set: Fix typo Created 4 years, 2 months 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 CFWL_WidgetImpProperties& properties)
18 : IFWL_Widget(properties, nullptr), 18 : IFWL_Widget(properties, nullptr),
19 m_bBtnDown(FALSE), 19 m_bBtnDown(FALSE),
20 m_dwTTOStyles(FDE_TTOSTYLE_SingleLine), 20 m_dwTTOStyles(FDE_TTOSTYLE_SingleLine),
21 m_iTTOAlign(FDE_TTOALIGNMENT_Center) { 21 m_iTTOAlign(FDE_TTOALIGNMENT_Center) {
22 m_rtClient.Set(0, 0, 0, 0); 22 m_rtClient.Set(0, 0, 0, 0);
23 m_rtCaption.Set(0, 0, 0, 0); 23 m_rtCaption.Set(0, 0, 0, 0);
24 } 24 }
25 25
26 IFWL_PushButton::~IFWL_PushButton() {} 26 IFWL_PushButton::~IFWL_PushButton() {}
27 27
28 FWL_Error IFWL_PushButton::GetClassName(CFX_WideString& wsClass) const {
29 wsClass = FWL_CLASS_PushButton;
30 return FWL_Error::Succeeded;
31 }
32
33 FWL_Type IFWL_PushButton::GetClassID() const { 28 FWL_Type IFWL_PushButton::GetClassID() const {
34 return FWL_Type::PushButton; 29 return FWL_Type::PushButton;
35 } 30 }
36 31
37 FWL_Error IFWL_PushButton::Initialize() { 32 FWL_Error IFWL_PushButton::Initialize() {
38 if (IFWL_Widget::Initialize() != FWL_Error::Succeeded) 33 if (IFWL_Widget::Initialize() != FWL_Error::Succeeded)
39 return FWL_Error::Indefinite; 34 return FWL_Error::Indefinite;
40 35
41 m_pDelegate = new CFWL_PushButtonImpDelegate(this); 36 m_pDelegate = new CFWL_PushButtonImpDelegate(this);
42 return FWL_Error::Succeeded; 37 return FWL_Error::Succeeded;
43 } 38 }
44 39
45 FWL_Error IFWL_PushButton::Finalize() { 40 void IFWL_PushButton::Finalize() {
46 delete m_pDelegate; 41 delete m_pDelegate;
47 m_pDelegate = nullptr; 42 m_pDelegate = nullptr;
48 return IFWL_Widget::Finalize(); 43 IFWL_Widget::Finalize();
49 } 44 }
50 45
51 FWL_Error IFWL_PushButton::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { 46 FWL_Error IFWL_PushButton::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
52 if (bAutoSize) { 47 if (bAutoSize) {
53 rect.Set(0, 0, 0, 0); 48 rect.Set(0, 0, 0, 0);
54 if (!m_pProperties->m_pThemeProvider) { 49 if (!m_pProperties->m_pThemeProvider) {
55 m_pProperties->m_pThemeProvider = GetAvailableTheme(); 50 m_pProperties->m_pThemeProvider = GetAvailableTheme();
56 } 51 }
57 CFX_WideString wsCaption; 52 CFX_WideString wsCaption;
58 IFWL_PushButtonDP* pData = 53 IFWL_PushButtonDP* pData =
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 CFX_Matrix matrix; 116 CFX_Matrix matrix;
122 matrix.Concat(*pMatrix); 117 matrix.Concat(*pMatrix);
123 FX_FLOAT iPicwidth = 0; 118 FX_FLOAT iPicwidth = 0;
124 FX_FLOAT ipicheight = 0; 119 FX_FLOAT ipicheight = 0;
125 CFX_WideString wsCaption; 120 CFX_WideString wsCaption;
126 if (pData) { 121 if (pData) {
127 pData->GetCaption(this, wsCaption); 122 pData->GetCaption(this, wsCaption);
128 } 123 }
129 CFX_RectF rtText; 124 CFX_RectF rtText;
130 rtText.Set(0, 0, 0, 0); 125 rtText.Set(0, 0, 0, 0);
131 if (!wsCaption.IsEmpty()) { 126 if (!wsCaption.IsEmpty())
132 CalcTextRect(wsCaption, pTheme, 0, m_iTTOAlign, rtText); 127 CalcTextRect(wsCaption, pTheme, 0, m_iTTOAlign, rtText);
133 } 128
134 switch (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_PSB_ModeMask) { 129 switch (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_PSB_ModeMask) {
135 case FWL_STYLEEXT_PSB_TextOnly: 130 case FWL_STYLEEXT_PSB_TextOnly:
136 DrawText(pGraphics, m_pProperties->m_pThemeProvider, &matrix); 131 DrawText(pGraphics, m_pProperties->m_pThemeProvider, &matrix);
137 break; 132 break;
138 case FWL_STYLEEXT_PSB_IconOnly: 133 case FWL_STYLEEXT_PSB_IconOnly:
139 if (pData) { 134 if (pData) {
140 pPicture = pData->GetPicture(this); 135 pPicture = pData->GetPicture(this);
141 } 136 }
142 if (pPicture) { 137 if (pPicture) {
143 CFX_PointF point; 138 CFX_PointF point;
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 CFWL_EvtClick wmClick; 541 CFWL_EvtClick wmClick;
547 wmClick.m_pSrcTarget = m_pOwner; 542 wmClick.m_pSrcTarget = m_pOwner;
548 m_pOwner->DispatchEvent(&wmClick); 543 m_pOwner->DispatchEvent(&wmClick);
549 return; 544 return;
550 } 545 }
551 if (pMsg->m_dwKeyCode != FWL_VKEY_Tab) { 546 if (pMsg->m_dwKeyCode != FWL_VKEY_Tab) {
552 return; 547 return;
553 } 548 }
554 m_pOwner->DispatchKeyEvent(pMsg); 549 m_pOwner->DispatchKeyEvent(pMsg);
555 } 550 }
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