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