| 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_picturebox.h" | 7 #include "xfa/fwl/core/ifwl_picturebox.h" |
| 8 | 8 |
| 9 #include "xfa/fwl/core/cfwl_picturebox.h" | 9 #include "xfa/fwl/core/cfwl_picturebox.h" |
| 10 #include "xfa/fwl/core/fwl_noteimp.h" | 10 #include "xfa/fwl/core/fwl_noteimp.h" |
| 11 | 11 |
| 12 IFWL_PictureBox::IFWL_PictureBox(const CFWL_WidgetImpProperties& properties) | 12 IFWL_PictureBox::IFWL_PictureBox(const IFWL_App* app, |
| 13 : IFWL_Widget(properties, nullptr), | 13 const CFWL_WidgetImpProperties& properties) |
| 14 : IFWL_Widget(app, properties, nullptr), |
| 14 m_bTop(FALSE), | 15 m_bTop(FALSE), |
| 15 m_bVCenter(FALSE), | 16 m_bVCenter(FALSE), |
| 16 m_bButton(FALSE) { | 17 m_bButton(FALSE) { |
| 17 m_rtClient.Reset(); | 18 m_rtClient.Reset(); |
| 18 m_rtImage.Reset(); | 19 m_rtImage.Reset(); |
| 19 m_matrix.SetIdentity(); | 20 m_matrix.SetIdentity(); |
| 20 } | 21 } |
| 21 | 22 |
| 22 IFWL_PictureBox::~IFWL_PictureBox() {} | 23 IFWL_PictureBox::~IFWL_PictureBox() {} |
| 23 | 24 |
| 24 FWL_Type IFWL_PictureBox::GetClassID() const { | 25 void IFWL_PictureBox::Initialize() { |
| 25 return FWL_Type::PictureBox; | 26 IFWL_Widget::Initialize(); |
| 26 } | |
| 27 | |
| 28 FWL_Error IFWL_PictureBox::Initialize() { | |
| 29 if (IFWL_Widget::Initialize() != FWL_Error::Succeeded) | |
| 30 return FWL_Error::Indefinite; | |
| 31 | |
| 32 m_pDelegate = new CFWL_PictureBoxImpDelegate(this); | 27 m_pDelegate = new CFWL_PictureBoxImpDelegate(this); |
| 33 return FWL_Error::Succeeded; | |
| 34 } | 28 } |
| 35 | 29 |
| 36 void IFWL_PictureBox::Finalize() { | 30 void IFWL_PictureBox::Finalize() { |
| 37 delete m_pDelegate; | 31 delete m_pDelegate; |
| 38 m_pDelegate = nullptr; | 32 m_pDelegate = nullptr; |
| 39 IFWL_Widget::Finalize(); | 33 IFWL_Widget::Finalize(); |
| 40 } | 34 } |
| 41 | 35 |
| 36 FWL_Type IFWL_PictureBox::GetClassID() const { |
| 37 return FWL_Type::PictureBox; |
| 38 } |
| 39 |
| 42 FWL_Error IFWL_PictureBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { | 40 FWL_Error IFWL_PictureBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { |
| 43 if (bAutoSize) { | 41 if (bAutoSize) { |
| 44 rect.Set(0, 0, 0, 0); | 42 rect.Set(0, 0, 0, 0); |
| 45 if (!m_pProperties->m_pDataProvider) | 43 if (!m_pProperties->m_pDataProvider) |
| 46 return FWL_Error::Indefinite; | 44 return FWL_Error::Indefinite; |
| 47 CFX_DIBitmap* pBitmap = | 45 CFX_DIBitmap* pBitmap = |
| 48 static_cast<IFWL_PictureBoxDP*>(m_pProperties->m_pDataProvider) | 46 static_cast<IFWL_PictureBoxDP*>(m_pProperties->m_pDataProvider) |
| 49 ->GetPicture(this); | 47 ->GetPicture(this); |
| 50 if (pBitmap) { | 48 if (pBitmap) { |
| 51 rect.Set(0, 0, (FX_FLOAT)pBitmap->GetWidth(), | 49 rect.Set(0, 0, (FX_FLOAT)pBitmap->GetWidth(), |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 return false; | 127 return false; |
| 130 } | 128 } |
| 131 | 129 |
| 132 CFWL_PictureBoxImpDelegate::CFWL_PictureBoxImpDelegate(IFWL_PictureBox* pOwner) | 130 CFWL_PictureBoxImpDelegate::CFWL_PictureBoxImpDelegate(IFWL_PictureBox* pOwner) |
| 133 : m_pOwner(pOwner) {} | 131 : m_pOwner(pOwner) {} |
| 134 | 132 |
| 135 void CFWL_PictureBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 133 void CFWL_PictureBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
| 136 const CFX_Matrix* pMatrix) { | 134 const CFX_Matrix* pMatrix) { |
| 137 m_pOwner->DrawWidget(pGraphics, pMatrix); | 135 m_pOwner->DrawWidget(pGraphics, pMatrix); |
| 138 } | 136 } |
| OLD | NEW |