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 "third_party/base/ptr_util.h" | 9 #include "third_party/base/ptr_util.h" |
10 #include "xfa/fwl/core/cfwl_picturebox.h" | 10 #include "xfa/fwl/core/cfwl_picturebox.h" |
11 #include "xfa/fwl/core/fwl_noteimp.h" | 11 #include "xfa/fwl/core/fwl_noteimp.h" |
12 | 12 |
13 IFWL_PictureBox::IFWL_PictureBox(const IFWL_App* app, | 13 IFWL_PictureBox::IFWL_PictureBox(const IFWL_App* app, |
14 const CFWL_WidgetImpProperties& properties) | 14 const CFWL_WidgetImpProperties& properties) |
15 : IFWL_Widget(app, properties, nullptr), | 15 : IFWL_Widget(app, properties, nullptr), |
16 m_bTop(FALSE), | 16 m_bTop(FALSE), |
17 m_bVCenter(FALSE), | 17 m_bVCenter(FALSE), |
18 m_bButton(FALSE) { | 18 m_bButton(FALSE) { |
19 m_rtClient.Reset(); | 19 m_rtClient.Reset(); |
20 m_rtImage.Reset(); | 20 m_rtImage.Reset(); |
21 m_matrix.SetIdentity(); | 21 m_matrix.SetIdentity(); |
22 | |
23 SetDelegate(pdfium::MakeUnique<CFWL_PictureBoxImpDelegate>(this)); | |
24 } | 22 } |
25 | 23 |
26 IFWL_PictureBox::~IFWL_PictureBox() {} | 24 IFWL_PictureBox::~IFWL_PictureBox() {} |
27 | 25 |
28 FWL_Type IFWL_PictureBox::GetClassID() const { | 26 FWL_Type IFWL_PictureBox::GetClassID() const { |
29 return FWL_Type::PictureBox; | 27 return FWL_Type::PictureBox; |
30 } | 28 } |
31 | 29 |
32 FWL_Error IFWL_PictureBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { | 30 FWL_Error IFWL_PictureBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { |
33 if (bAutoSize) { | 31 if (bAutoSize) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 case FWL_STYLEEXT_PTB_Vcenter: | 110 case FWL_STYLEEXT_PTB_Vcenter: |
113 m_bVCenter = TRUE; | 111 m_bVCenter = TRUE; |
114 return true; | 112 return true; |
115 case FWL_STYLEEXT_PTB_Bottom: | 113 case FWL_STYLEEXT_PTB_Bottom: |
116 m_bButton = TRUE; | 114 m_bButton = TRUE; |
117 return true; | 115 return true; |
118 } | 116 } |
119 return false; | 117 return false; |
120 } | 118 } |
121 | 119 |
122 CFWL_PictureBoxImpDelegate::CFWL_PictureBoxImpDelegate(IFWL_PictureBox* pOwner) | 120 void IFWL_PictureBox::OnDrawWidget(CFX_Graphics* pGraphics, |
123 : m_pOwner(pOwner) {} | 121 const CFX_Matrix* pMatrix) { |
124 | 122 DrawWidget(pGraphics, pMatrix); |
125 void CFWL_PictureBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | |
126 const CFX_Matrix* pMatrix) { | |
127 m_pOwner->DrawWidget(pGraphics, pMatrix); | |
128 } | 123 } |
OLD | NEW |