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( | 13 IFWL_PictureBox::IFWL_PictureBox( |
14 const IFWL_App* app, | 14 const IFWL_App* app, |
15 std::unique_ptr<CFWL_WidgetProperties> properties) | 15 std::unique_ptr<CFWL_WidgetProperties> properties) |
16 : IFWL_Widget(app, std::move(properties), nullptr), | 16 : IFWL_Widget(app, std::move(properties), nullptr) { |
17 m_bTop(false), | |
18 m_bVCenter(false), | |
19 m_bButton(false) { | |
20 m_rtClient.Reset(); | 17 m_rtClient.Reset(); |
21 m_rtImage.Reset(); | 18 m_rtImage.Reset(); |
22 m_matrix.SetIdentity(); | 19 m_matrix.SetIdentity(); |
23 } | 20 } |
24 | 21 |
25 IFWL_PictureBox::~IFWL_PictureBox() {} | 22 IFWL_PictureBox::~IFWL_PictureBox() {} |
26 | 23 |
27 FWL_Type IFWL_PictureBox::GetClassID() const { | 24 FWL_Type IFWL_PictureBox::GetClassID() const { |
28 return FWL_Type::PictureBox; | 25 return FWL_Type::PictureBox; |
29 } | 26 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 fx = m_rtClient.width; | 90 fx = m_rtClient.width; |
94 } | 91 } |
95 if (fy > m_rtClient.height) { | 92 if (fy > m_rtClient.height) { |
96 fy = m_rtClient.height; | 93 fy = m_rtClient.height; |
97 } | 94 } |
98 pGraphics->DrawImage(pPicture, CFX_PointF((m_rtClient.width - fx) / 2, | 95 pGraphics->DrawImage(pPicture, CFX_PointF((m_rtClient.width - fx) / 2, |
99 (m_rtClient.height - fy) / 2), | 96 (m_rtClient.height - fy) / 2), |
100 &matrix); | 97 &matrix); |
101 } | 98 } |
102 | 99 |
103 bool IFWL_PictureBox::VStyle(uint32_t dwStyle) { | |
104 switch (dwStyle & FWL_STYLEEXT_PTB_VAlignMask) { | |
105 case FWL_STYLEEXT_PTB_Top: | |
106 m_bTop = true; | |
107 return true; | |
108 case FWL_STYLEEXT_PTB_Vcenter: | |
109 m_bVCenter = true; | |
110 return true; | |
111 case FWL_STYLEEXT_PTB_Bottom: | |
112 m_bButton = true; | |
113 return true; | |
114 } | |
115 return false; | |
116 } | |
117 | |
118 void IFWL_PictureBox::OnDrawWidget(CFX_Graphics* pGraphics, | 100 void IFWL_PictureBox::OnDrawWidget(CFX_Graphics* pGraphics, |
119 const CFX_Matrix* pMatrix) { | 101 const CFX_Matrix* pMatrix) { |
120 DrawWidget(pGraphics, pMatrix); | 102 DrawWidget(pGraphics, pMatrix); |
121 } | 103 } |
OLD | NEW |