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

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

Issue 2556873004: Convert GetWidgetRect to return rect. (Closed)
Patch Set: Created 4 years 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
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/cfwl_pushbutton.h" 7 #include "xfa/fwl/core/cfwl_pushbutton.h"
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 17 matching lines...) Expand all
28 m_rtClient.Set(0, 0, 0, 0); 28 m_rtClient.Set(0, 0, 0, 0);
29 m_rtCaption.Set(0, 0, 0, 0); 29 m_rtCaption.Set(0, 0, 0, 0);
30 } 30 }
31 31
32 CFWL_PushButton::~CFWL_PushButton() {} 32 CFWL_PushButton::~CFWL_PushButton() {}
33 33
34 FWL_Type CFWL_PushButton::GetClassID() const { 34 FWL_Type CFWL_PushButton::GetClassID() const {
35 return FWL_Type::PushButton; 35 return FWL_Type::PushButton;
36 } 36 }
37 37
38 void CFWL_PushButton::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { 38 CFX_RectF CFWL_PushButton::GetWidgetRect(bool bAutoSize) {
39 if (!bAutoSize) { 39 if (!bAutoSize)
40 rect = m_pProperties->m_rtWidget; 40 return m_pProperties->m_rtWidget;
41 return;
42 }
43 41
44 rect.Set(0, 0, 0, 0);
45 if (!m_pProperties->m_pThemeProvider) 42 if (!m_pProperties->m_pThemeProvider)
46 m_pProperties->m_pThemeProvider = GetAvailableTheme(); 43 m_pProperties->m_pThemeProvider = GetAvailableTheme();
47 44
48 FX_FLOAT* fcaption = 45 FX_FLOAT* fcaption =
49 static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::Margin)); 46 static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::Margin));
47 CFX_RectF rect;
50 rect.Inflate(*fcaption, *fcaption); 48 rect.Inflate(*fcaption, *fcaption);
51 InflateWidgetRect(rect); 49 InflateWidgetRect(rect);
50 return rect;
52 } 51 }
53 52
54 void CFWL_PushButton::SetStates(uint32_t dwStates) { 53 void CFWL_PushButton::SetStates(uint32_t dwStates) {
55 if (dwStates & FWL_WGTSTATE_Disabled) { 54 if (dwStates & FWL_WGTSTATE_Disabled) {
56 m_pProperties->m_dwStates = FWL_WGTSTATE_Disabled; 55 m_pProperties->m_dwStates = FWL_WGTSTATE_Disabled;
57 return; 56 return;
58 } 57 }
59 CFWL_Widget::SetStates(dwStates); 58 CFWL_Widget::SetStates(dwStates);
60 } 59 }
61 60
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 if (pMsg->m_dwKeyCode != FWL_VKEY_Return) 297 if (pMsg->m_dwKeyCode != FWL_VKEY_Return)
299 return; 298 return;
300 299
301 CFWL_EvtMouse wmMouse(this); 300 CFWL_EvtMouse wmMouse(this);
302 wmMouse.m_dwCmd = FWL_MouseCommand::LeftButtonUp; 301 wmMouse.m_dwCmd = FWL_MouseCommand::LeftButtonUp;
303 DispatchEvent(&wmMouse); 302 DispatchEvent(&wmMouse);
304 303
305 CFWL_Event wmClick(CFWL_Event::Type::Click, this); 304 CFWL_Event wmClick(CFWL_Event::Type::Click, this);
306 DispatchEvent(&wmClick); 305 DispatchEvent(&wmClick);
307 } 306 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698