| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
| 6 | |
| 7 #include "xfa/fwl/core/ifwl_picturebox.h" | |
| 8 | |
| 9 #include <memory> | |
| 10 #include <utility> | |
| 11 | |
| 12 #include "third_party/base/ptr_util.h" | |
| 13 #include "xfa/fwl/core/cfwl_notedriver.h" | |
| 14 #include "xfa/fwl/core/cfwl_picturebox.h" | |
| 15 | |
| 16 IFWL_PictureBox::IFWL_PictureBox( | |
| 17 const CFWL_App* app, | |
| 18 std::unique_ptr<CFWL_WidgetProperties> properties) | |
| 19 : IFWL_Widget(app, std::move(properties), nullptr) { | |
| 20 m_rtClient.Reset(); | |
| 21 m_rtImage.Reset(); | |
| 22 m_matrix.SetIdentity(); | |
| 23 } | |
| 24 | |
| 25 IFWL_PictureBox::~IFWL_PictureBox() {} | |
| 26 | |
| 27 FWL_Type IFWL_PictureBox::GetClassID() const { | |
| 28 return FWL_Type::PictureBox; | |
| 29 } | |
| 30 | |
| 31 void IFWL_PictureBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { | |
| 32 if (!bAutoSize) { | |
| 33 rect = m_pProperties->m_rtWidget; | |
| 34 return; | |
| 35 } | |
| 36 | |
| 37 rect.Set(0, 0, 0, 0); | |
| 38 | |
| 39 IFWL_Widget::GetWidgetRect(rect, true); | |
| 40 } | |
| 41 | |
| 42 void IFWL_PictureBox::Update() { | |
| 43 if (IsLocked()) | |
| 44 return; | |
| 45 if (!m_pProperties->m_pThemeProvider) | |
| 46 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | |
| 47 | |
| 48 GetClientRect(m_rtClient); | |
| 49 } | |
| 50 | |
| 51 void IFWL_PictureBox::DrawWidget(CFX_Graphics* pGraphics, | |
| 52 const CFX_Matrix* pMatrix) { | |
| 53 if (!pGraphics) | |
| 54 return; | |
| 55 if (!m_pProperties->m_pThemeProvider) | |
| 56 return; | |
| 57 | |
| 58 IFWL_ThemeProvider* pTheme = GetAvailableTheme(); | |
| 59 if (HasBorder()) | |
| 60 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); | |
| 61 if (HasEdge()) | |
| 62 DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); | |
| 63 } | |
| 64 | |
| 65 void IFWL_PictureBox::OnDrawWidget(CFX_Graphics* pGraphics, | |
| 66 const CFX_Matrix* pMatrix) { | |
| 67 DrawWidget(pGraphics, pMatrix); | |
| 68 } | |
| OLD | NEW |