| OLD | NEW |
| 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 "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_themetext.h" | 13 #include "xfa/fwl/core/cfwl_themetext.h" |
| 13 #include "xfa/fwl/core/fwl_noteimp.h" | 14 #include "xfa/fwl/core/fwl_noteimp.h" |
| 14 #include "xfa/fwl/core/ifwl_pushbutton.h" | 15 #include "xfa/fwl/core/ifwl_pushbutton.h" |
| 15 #include "xfa/fwl/core/ifwl_themeprovider.h" | 16 #include "xfa/fwl/core/ifwl_themeprovider.h" |
| 16 | 17 |
| 17 IFWL_PushButton::IFWL_PushButton(const IFWL_App* app, | 18 IFWL_PushButton::IFWL_PushButton(const IFWL_App* app, |
| 18 const CFWL_WidgetImpProperties& properties) | 19 const CFWL_WidgetImpProperties& properties) |
| 19 : IFWL_Widget(app, properties, nullptr), | 20 : IFWL_Widget(app, properties, nullptr), |
| 20 m_bBtnDown(FALSE), | 21 m_bBtnDown(FALSE), |
| 21 m_dwTTOStyles(FDE_TTOSTYLE_SingleLine), | 22 m_dwTTOStyles(FDE_TTOSTYLE_SingleLine), |
| 22 m_iTTOAlign(FDE_TTOALIGNMENT_Center) { | 23 m_iTTOAlign(FDE_TTOALIGNMENT_Center) { |
| 23 m_rtClient.Set(0, 0, 0, 0); | 24 m_rtClient.Set(0, 0, 0, 0); |
| 24 m_rtCaption.Set(0, 0, 0, 0); | 25 m_rtCaption.Set(0, 0, 0, 0); |
| 26 |
| 27 SetDelegate(pdfium::MakeUnique<CFWL_PushButtonImpDelegate>(this)); |
| 25 } | 28 } |
| 26 | 29 |
| 27 IFWL_PushButton::~IFWL_PushButton() {} | 30 IFWL_PushButton::~IFWL_PushButton() {} |
| 28 | 31 |
| 29 void IFWL_PushButton::Initialize() { | |
| 30 IFWL_Widget::Initialize(); | |
| 31 m_pDelegate = new CFWL_PushButtonImpDelegate(this); | |
| 32 } | |
| 33 | |
| 34 void IFWL_PushButton::Finalize() { | |
| 35 delete m_pDelegate; | |
| 36 m_pDelegate = nullptr; | |
| 37 IFWL_Widget::Finalize(); | |
| 38 } | |
| 39 | |
| 40 FWL_Type IFWL_PushButton::GetClassID() const { | 32 FWL_Type IFWL_PushButton::GetClassID() const { |
| 41 return FWL_Type::PushButton; | 33 return FWL_Type::PushButton; |
| 42 } | 34 } |
| 43 | 35 |
| 44 FWL_Error IFWL_PushButton::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { | 36 FWL_Error IFWL_PushButton::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { |
| 45 if (bAutoSize) { | 37 if (bAutoSize) { |
| 46 rect.Set(0, 0, 0, 0); | 38 rect.Set(0, 0, 0, 0); |
| 47 if (!m_pProperties->m_pThemeProvider) { | 39 if (!m_pProperties->m_pThemeProvider) { |
| 48 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 40 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
| 49 } | 41 } |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 CFWL_EvtClick wmClick; | 531 CFWL_EvtClick wmClick; |
| 540 wmClick.m_pSrcTarget = m_pOwner; | 532 wmClick.m_pSrcTarget = m_pOwner; |
| 541 m_pOwner->DispatchEvent(&wmClick); | 533 m_pOwner->DispatchEvent(&wmClick); |
| 542 return; | 534 return; |
| 543 } | 535 } |
| 544 if (pMsg->m_dwKeyCode != FWL_VKEY_Tab) { | 536 if (pMsg->m_dwKeyCode != FWL_VKEY_Tab) { |
| 545 return; | 537 return; |
| 546 } | 538 } |
| 547 m_pOwner->DispatchKeyEvent(pMsg); | 539 m_pOwner->DispatchKeyEvent(pMsg); |
| 548 } | 540 } |
| OLD | NEW |